First my soln was tle now after changing it 2 test cases wrong

Hey, just look out for overflow, change int to a long long and your solution passes all the test cases.