Grand temple problem

https://ide.codingblocks.com/s/229458 tried it this way gives run time error

hello @Learning_bunny
n can be upto 10^5
so increase ur array size

ek test case ab bhi reh gya

please help with that too

use long long . . . .