Idea at a glance: I precalculated all the sum of phi() values till some range. Then while for some query I ran a binary search on the precalculated sum of the euler values.... So according to this process complexity should be O(n) + T*(log(n)
Problem:
https://algo.codemarshal.org/contests/icpc-dhaka-19-preli/problems/G
If needs to sign up to see the problem then please check this drive link ( problem number G) to see the problem
Drive link :
https://drive.google.com/file/d/10k4fXa1SZWQM79XbwONUMyAWk70zwMCt/view?usp=drivesdk
My code: