func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, m;   long long a[333333];   const long long MOD = 1000000009;   long long fib[333333];   long long fsum[333333];   inline const long long getFsum(const int l, const int r) {     return ((fsum[r] - fsum[l - 1]) + MOD) % MOD;   }   inline void pllAdd(pair<long long, long long>& des,                      const pair<long long, long long>& toAdd) {     if (des.first < 0) des = pair<long long, long long>(0, 0);     des.first += toAdd.first;     des.second += toAdd.second;     des.first %= MOD;     des.second %= MOD;   }   class a_sum {    public:     vector<long long> c;     vector<pair<long long, long long> > lazy;     a_sum() {       c = vector<long long>(4 * n + 1, 0);       lazy = vector<pair<long long, long long> >(           4 * n + 1, pair<long long, long long>(-1, -1));       for (int i = 1; i <= n; i++) init(i);     }     void init(const int index, const int nodeLeft, const int nodeRight,               const int node) {       c[node] += a[index];       c[node] %= MOD;       if (nodeLeft == nodeRight) return;       int mid = (nodeLeft + nodeRight) / 2;       if (index <= mid)         init(index, nodeLeft, mid, node * 2);       else         init(index, mid + 1, nodeRight, node * 2 + 1);     }     void init(const int index) { init(index, 1, n, 1); }     long long query(const int left, const int right, const int nodeLeft,                     const int nodeRight, const int node) {       int mid = (nodeLeft + nodeRight) / 2;       if (lazy[node].first >= 0) {         const long long a = lazy[node].first, b = lazy[node].second;         int size = nodeRight - nodeLeft + 1;         if (size == 1) {           c[node] += a;           c[node] %= MOD;         } else {           const long long x = getFsum(1, size - 2) + 1, y = getFsum(1, size - 1);           long long toAdd = ((a * x) % MOD + (b * y) % MOD) % MOD;           c[node] += toAdd;           c[node] %= MOD;           pllAdd(lazy[node * 2], pair<long long, long long>(a, b));           int nextIndex = mid - nodeLeft + 2;           pllAdd(lazy[node * 2 + 1],                  pair<long long, long long>(((a * fib[nextIndex - 2]) % MOD +                                              b * fib[nextIndex - 1] % MOD) %                                                 MOD,                                             ((a * fib[nextIndex - 1]) % MOD +                                              (b * fib[nextIndex]) % MOD) %                                                 MOD));         }         lazy[node] = pair<long long, long long>(-1, -1);       }       if (left <= nodeLeft && nodeRight <= right) return c[node];       if (nodeLeft > right || nodeRight < left) return 0;       return (query(left, right, nodeLeft, mid, node * 2) +               query(left, right, mid + 1, nodeRight, node * 2 + 1)) %              MOD;     }     long long query(const int left, const int right) {       return query(left, right, 1, n, 1);     }     void modify(const int left, const int right, const int nodeLeft,                 const int nodeRight, const int node) {       int mid = (nodeLeft + nodeRight) / 2;       if (lazy[node].first >= 0) {         const long long a = lazy[node].first, b = lazy[node].second;         int size = nodeRight - nodeLeft + 1;         if (size == 1) {           c[node] += a;           c[node] %= MOD;         } else {           const long long x = getFsum(1, size - 2) + 1, y = getFsum(1, size - 1);           long long toAdd = ((a * x) % MOD + (b * y) % MOD) % MOD;           c[node] += toAdd;           c[node] %= MOD;           pllAdd(lazy[node * 2], pair<long long, long long>(a, b));           int nextIndex = mid - nodeLeft + 2;           pllAdd(lazy[node * 2 + 1],                  pair<long long, long long>(((a * fib[nextIndex - 2]) % MOD +                                              b * fib[nextIndex - 1] % MOD) %                                                 MOD,                                             ((a * fib[nextIndex - 1]) % MOD +                                              (b * fib[nextIndex]) % MOD) %                                                 MOD));         }         lazy[node] = pair<long long, long long>(-1, -1);       }       if (nodeLeft > right || nodeRight < left) return;       if (left <= nodeLeft && nodeRight <= right) {         long long toAdd = getFsum(nodeLeft - left + 1, nodeRight - left + 1);         c[node] += toAdd;         c[node] %= MOD;         if (nodeLeft != nodeRight) {           pllAdd(lazy[node * 2],                  pair<long long, long long>(fib[nodeLeft - left + 1],                                             fib[nodeLeft - left + 2]));           pllAdd(lazy[node * 2 + 1],                  pair<long long, long long>(fib[mid - left + 2],                                             fib[mid - left + 3]));         }         return;       }       modify(left, right, nodeLeft, mid, node * 2);       modify(left, right, mid + 1, nodeRight, node * 2 + 1);       c[node] = (c[node * 2] + c[node * 2 + 1]) % MOD;     }     void modify(const int left, const int right) { modify(left, right, 1, n, 1); }   };   int main() {     fib[1] = fib[2] = 1;     for (int i = 3; i <= 300000; i++) fib[i] = (fib[i - 1] + fib[i - 2]) % MOD;     for (int i = 1; i <= 300000; i++) fsum[i] = (fsum[i - 1] + fib[i]) % MOD;     cin >> n >> m;     for (int i = 1; i <= n; i++) cin >> a[i];     a_sum g = a_sum();     for (int i = 0; i < m; i++) {       int x, y, z;       cin >> x >> y >> z;       if (x == 1)         g.modify(y, z);       else         cout << g.query(y, z) << endl;     }   }   