## GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

## [Solution] Slow Solution CodeChef Solution | Codechef Solution 2022

Chef is trying to solve a problem having $T$ test cases, where, for each test case he is given a single integer $N$.

Chef has an algorithm which takes exactly ${N}^{2}$ iterations for a test case with value $N$.

The constraints of the problem are as follows:

• $1\le T\le maxT$
• $1\le N\le maxN$
• Sum of $N$ over all test cases does not exceed $sumN$.

Given the values $maxT,maxN,$ and $sumN$, determine the maximum number of iterations Chef's algorithm can take for any valid input file satisfying all the constraints.

Solution Click Below:-  👉
👇👇👇👇👇

Formally speaking, find the maximum value of ${N}_{1}^{2}+{N}_{2}^{2}+\cdots +{N}_{T}^{2}$ for any valid input file satisfying all the constraints.

### Input Format

• The first line of input will contain a single integer $T$, denoting the number of test cases.
• Each test case consists of single line consisting of three integers $maxT,maxN,$ and $sumN$.

### Output Format

For each test case, output the the maximum number of iterations Chef's algorithm can take in any valid test file.

### Constraints

• $1\le T\le 1000$