func_code_string: #include <bits/stdc++.h>   using namespace std;   long long num[100005], sorted[100005];   long long prenum[100005], presorted[100005];   int main() {     int n, q, l, r, op;     cin >> n;     for (__typeof(n) i = 0; i < n; i++) {       cin >> num[i];       sorted[i] = num[i];     }     sort(sorted, sorted + n);     prenum[0] = 0;     presorted[0] = 0;     for (__typeof(n + 1) i = 1; i < n + 1; i++) {       prenum[i] = prenum[i - 1] + num[i - 1];       presorted[i] = presorted[i - 1] + sorted[i - 1];     }     cin >> q;     for (__typeof(q) i = 0; i < q; i++) {       cin >> op >> l >> r;       switch (op) {         case 1:           cout << prenum[r] - prenum[l - 1] << endl;           break;         case 2:           cout << presorted[r] - presorted[l - 1] << endl;           break;       }     }     return 0;   }   