How to reduce the time complexity of the code for HILLJUMP

Can anyone tell me some modifications that I can make in this code so that it could run on large constraints without giving TIME LIMIT EXCEEDED error i.e. I want to reduce its time complexiy.

#include<stdio.h>
long int a[1000005];
int main()
{
long int i,j,q,n,choice,I,K,l,r,x,index,k,current;
scanf("%ld %ld",&n,&q);
for(i=1;i<=n;i++)
scanf("%ld",&a[i]);
while(q–)
{
scanf("%ld",&choice);
if (choice==2)
{
scanf("%ld %ld %ld",&l,&r,&x);
for(i=l;i<=r;i++)
{
a[i]+=x;
}
/* for(i=1;i<=n;i++)
printf("%ld “,a[i]);
printf(”\n");*/
}
else
{
scanf("%ld %ld",&I,&k);
index=I;
i=I;
while(k)
{
if(i<n){
i++;
if(a[i]>a[index] && i-index<=100)
{
index=i;
k–;
}
}
else
break;
}
printf("%ld\n",index);
}
}
return 0;
}

https://www.codechef.com/viewsolution/15013633

It will be better if you properly format your code.
For better understanding, you can have a look on it’s [editorial][1]
[1]: https://discuss.codechef.com/questions/108216/hilljump-editorial