### PROBLEM LINK:

**Setter:** Misha Chorniy

**Tester:** Hasan Jaddouh

**Editorialist:** Taranpreet Singh

### DIFFICULTY:

Simple

### PREREQUISITES:

Basic Math.

### PROBLEM:

Given a sequence A of length N, by changing at most K elements, can we make A_1^2+A_2^2+A_3^2 \dots A_N^2 \leq A_1+A_2+A_3 \dots A_N?

### SUPER QUICK EXPLANATION

- Count number of A[i] > 1, say C. If C \leq K, we can achieve inequality, otherwise no.

### EXPLANATION

First of all, It can be seen that for every integer X, X \leq X^2. So, we can prove that we can never achieve A_1^2+A_2^2+A_3^2 \dots A_N^2 < A_1+A_2+A_3 \dots A_N.

Only option is, to achieve A_1^2+A_2^2+A_3^2 \dots A_N^2 == A_1+A_2+A_3 \dots A_N.

Now, Let’s find all integers, for which X^2 == X. We can find, that This holds for only X = 0 and X = 1. But we can assign only positive values to elements. Hence, to achieve this inequality, we need all elements to be 1.

Hence, just count the number of elements greater than 1 and if this count is \leq K, we can achieve this inequality, otherwise, we cannot achieve.

**Challenge**

Find any real value for which X^2 < X. Enjoy solving.

### Time Complexity

Time complexity is O(N) per test case.

### AUTHOR’S AND TESTER’S SOLUTIONS:

Setter’s solution

Tester’s solution

Editorialist’s solution

Feel free to Share your approach, If it differs. Suggestions are always welcomed.