https://www.codechef.com/PCO12020/problems/MANSQ

Can anyone please write editorial for this problem or tell me the logic?

Project of code 1.0 - #10 by anon8049083 check this

it is kind of equation but it is hard to calculate, when i used it on the example it is wrong answer, i get 8 and the answer 18 for first test case how he calculate it i don’t know the code cheff but with my eyes it is 8 ?

Total number of squares = m x (m+1) x (2m+1)/6 +
(n-m) x m x (m+1)/2

Can you please elaborate more @eng_ghanima