I am trying to solve this qstn(https://www.codechef.com/problems/MULTQ3/) using lazy propagation of segment tree but i am getting TLE please help me to optimize

About the code logic

1)Create a segment tree of node

2)each node keep the count of no of 0,1,2 obtained by doing mod in that range i.e a[i]%3

struct node

{

lli rem[3];

};

```
rem[0]==count number of all a[i] such that a[i]%3==0
rem[1]==count number of all a[i] such that a[i]%3==1
rem[2]==count number of all a[i] such that a[i]%3==2
for each node
```

3)Update the range as per given intrusions

my code link http://ideone.com/U2XNLF