is there any other way to avoid TLE or simplify the given code?
i did the below code:
int n, q, l, r;
scanf("%d %d", &n, &q);
int a[n], i, j, sum;
for(i=0;i<n;i++)
{
scanf("%d", &a[i]);
}
while(q–)
{
sum=0;
scanf(&q…