malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int n;     cin >> n;     string a;     cin >> a;     if (n & 1) {       cout <<  :( ;       return 0;     }     int cnt1 = 1;     int cnt2 = 1;     if (a[0] ==  ) ) {       cout <<  :( ;       return 0;     }     a[0] =  ( ;     if (a.back() ==  ( ) {       cout <<  :( ;       return 0;     }     a[a.size() - 1] =  ) ;     for (int i = 1; i < a.size(); ++i)       if (a[i] ==  ( ) ++cnt1;     if (cnt1 > n / 2) {       cout <<  :( ;       return 0;     }     for (int i = 0; i < a.size(); ++i) {       if (a[i] ==  ? ) {         ++cnt1;         a[i] =  ( ;       }       if (cnt1 == n / 2) break;     }     if (cnt1 < n / 2) {       cout <<  :( ;       return 0;     }     for (int i = 0; i < a.size(); ++i)       if (a[i] ==  ? ) a[i] =  ) ;     stack<int> s;     for (int i = 0; i < a.size(); ++i) {       if (a[i] ==  ( )         s.push(a[i]);       else {         if (s.empty()) {           cout <<  :( ;           return 0;         } else {           s.pop();           if (s.empty() && i != a.size() - 1) {             cout <<  :( ;             return 0;           }         }       }     }     if (!s.empty()) {       cout <<  :( ;       return 0;     }     for (int i = 0; i < a.size(); ++i) cout << a[i];     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long n, m, x, a[3000], b[3000], qmi[3000], ymi[3000];   string s;   int main() {     iostream::sync_with_stdio(0), cin.tie(0), cout.tie(0);     cin >> n >> m;     for (int i = 0; i < n; i++) {       cin >> a[i + 1];       a[i + 1] += a[i];     }     for (int j = 0; j < m; j++) {       cin >> b[j + 1];       b[j + 1] += b[j];     }     cin >> x;     for (int l = 1; l <= n; l++) {       qmi[l] = x + 1;       for (int j = 0; j + l <= n; j++) {         qmi[l] = min(qmi[l], a[j + l] - a[j]);       }     }     for (int l = 1; l <= m; l++) {       ymi[l] = x + 1;       for (int j = 0; j + l <= m; j++) {         ymi[l] = min(ymi[l], b[j + l] - b[j]);       }     }     int ans = 0;     for (int l = 1; l <= n; l++) {       for (int xl = 1; xl <= m; xl++) {         if (qmi[l] <= x / ymi[xl]) {           ans = max(ans, l * xl);         }       }     }     cout << ans <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long i, n, k, sum = 0;     bool flag = false;     set<long long> S;     scanf( %I64d%I64d , &n, &k);     for (i = 1; i <= sqrt(n); i++) {       if (n % i == 0) {         S.insert(i);         S.insert(n / i);       }     }     if (S.size() >= k) flag = true;     if (flag) {       set<long long>::iterator it;       it = S.begin();       while (k--) {         it++;       }       it--;       cout << *it;     } else       cout << -1;     return 0;   }
#include <bits/stdc++.h>   int n, m, seg[300005], lazy[300005], d[200005], l[200005], r[200005], q[200005];   bool b = 1;   void update(int root, int lo, int hi, int l, int r, int val) {     if (lazy[root]) {       seg[root] |= lazy[root];       if (lo ^ hi) {         lazy[root * 2 + 1] |= lazy[root];         lazy[root * 2 + 2] |= lazy[root];       }       lazy[root] = 0;     }     if (lo >= l && hi <= r) {       seg[root] |= val;       if (lo ^ hi) {         lazy[root * 2 + 1] |= val;         lazy[root * 2 + 2] |= val;       }     } else if (lo > r || hi < l)       return;     else {       update(root * 2 + 1, lo, (lo + hi) / 2, l, r, val);       update(root * 2 + 2, (lo + hi) / 2 + 1, hi, l, r, val);     }   }   int query(int root, int lo, int hi, int l, int r) {     if (lazy[root]) {       seg[root] |= lazy[root];       if (lo ^ hi) {         lazy[root * 2 + 1] |= lazy[root];         lazy[root * 2 + 2] |= lazy[root];       }       lazy[root] = 0;     }     if (lo >= l && hi <= r) {       if (lo == hi) d[lo] = seg[root];       return seg[root];     } else if (lo > r || l > hi)       return -1;     else       return query(root * 2 + 1, lo, (lo + hi) / 2, l, r) &              query(root * 2 + 2, (lo + hi) / 2 + 1, hi, l, r);   }   int main() {     scanf( %d%d , &n, &m);     for (int i = 0; i < m; i++) {       scanf( %d%d%d , l + i, r + i, q + i);       update(0, 0, n - 1, l[i] - 1, r[i] - 1, q[i]);     }     for (int i = 0; i < m && b; i++)       b = query(0, 0, n - 1, l[i] - 1, r[i] - 1) == q[i];     if (b) {       printf( YES n );       for (int i = 0; i < n; i++)         printf( %d%c , d[i] ? d[i] : query(0, 0, n - 1, i, i),                i + 1 < n ? 32 : 10);     } else       printf( NO n );   }
#include <bits/stdc++.h>   using namespace std;   const int MAX = 1e5 + 1;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     long long int n;     cin >> n;     vector<long long int> v(n);     for (int i = 0; i < n; i++) {       cin >> v[i];     }     long long int s, t;     cin >> s >> t;     long long int sum1 = 0;     for (int i = min(s, t) - 1; i < max(s, t) - 1; i++) {       sum1 += v[i];     }     long long int sum2 = 0;     for (int i = max(s, t) - 1;; i = (i + 1) % n) {       if (i == min(s, t) - 1) break;       sum2 += v[i];     }     cout << min(sum1, sum2) << endl;   }
#include <bits/stdc++.h>   using namespace std;   const double eps = 1e-8;   const int mod = 1000000007;   const double PI = acos(-1.0);   int dx[4] = {0, 0, 1, -1};   int dy[4] = {1, -1, 0, 0};   int n, m;   long long ans;   int a[100005];   int b[2000];   int c[2000];   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     int n, k, x;     cin >> n >> k >> x;     for (int i = 0; i < n; i++) {       int num;       cin >> num;       b[num]++;     }     for (int i = 0; i < k; i++) {       int cnt = 1;       memset(c, 0, sizeof(c));       for (int j = 0; j <= 1111; j++) {         if (b[j]) {           if ((cnt & 1)) {             c[j ^ x] += (b[j] + 1) / 2;             c[j] += b[j] / 2;           } else {             c[j ^ x] += b[j] / 2;             c[j] += (b[j] + 1) / 2;           }           cnt += b[j];         }       }       for (int j = 0; j <= 1111; j++) b[j] = c[j];     }     int ans1 = 0, ans2 = 0x3f3f3f3f;     for (int j = 0; j <= 1111; j++)       if (b[j]) {         ans1 = max(ans1, j);         ans2 = min(ans2, j);       }     cout << ans1 <<     << ans2 << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     int ind = 0;     vector<int> v;     scanf( %d , &n);     for (int i = 0; i < n; i++) {       int temp;       scanf( %d , &temp);       v.push_back(temp);     }     sort(v.begin(), v.end());     for (int i = 0; i < n; i++) {       if (v[i] - ind == 1) {         ind++;       } else {         break;       }     }     printf( %d , ind + 1);   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5 + 10;   const int maxm = 500 * 500 + 10;   const int inf = 1e9;   const long long mod = 1e9 + 7;   int getint() {     char c;     while ((c = getchar()) && !(c >=  0  && c <=  9 ) && c !=  - )       ;     int ret = c -  0 , sgn = 0;     if (c ==  - ) sgn = 1, ret = 0;     while ((c = getchar()) && c >=  0  && c <=  9 ) ret = ret * 10 + c -  0 ;     if (sgn) ret = -ret;     return ret;   }   vector<int> g[maxn], h[maxn];   int cnt;   int vis[maxn];   void dfs(int u) {     vis[u] = 1;     h[cnt].push_back(u);     int sz = g[u].size();     for (int i = 0; i < sz; i++) {       int v = g[u][i];       if (vis[v]) continue;       dfs(v);     }   }   int main() {     int n;     while (scanf( %d , &n) == 1) {       int i;       for (i = 1; i <= n; i++) g[i].clear(), h[i].clear();       for (i = 1; i <= n; i++) {         int x = getint();         g[i].push_back(x), g[x].push_back(i);       }       memset(vis, 0, sizeof(vis));       cnt = 0;       for (int i = 1; i <= n; i++) {         if (!vis[i]) {           cnt++;           dfs(i);         }       }       int flag = 0, ff = 1;       int center1 = -1, center2 = -1;       for (int i = 1; i <= cnt; i++) {         int sz = h[i].size();         if (sz == 1) center1 = i, flag = 1;         if (sz == 2) center2 = i, flag = 1;         if (sz >= 3 && sz & 1) {           ff = 0;         }       }       if (center1 == -1 && center2 == -1) {         puts( NO );         continue;       } else if (center1 == -1 && !ff) {         puts( NO );         continue;       }       puts( YES );       if (center1 != -1) {         int u = h[center1][0];         for (int i = 1; i <= cnt; i++)           if (i != center1) {             int sz = h[i].size();             for (int j = 0; j < sz; j++) {               printf( %d %d n , u, h[i][j]);             }           }       } else {         int u = h[center2][0], v = h[center2][1];         printf( %d %d n , u, v);         for (int i = 1; i <= cnt; i++)           if (i != center2) {             int sz = h[i].size();             for (int j = 0; j < sz; j++) {               if (j & 1) {                 printf( %d %d n , u, h[i][j]);               } else                 printf( %d %d n , v, h[i][j]);             }           }       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long MOD = 1e9 + 7;   const long long N = 1e5 + 10;   long long power(long long a, long long b) {     long long ret = 1;     while (b) {       if (b & 1) ret *= a;       a *= a;       if (ret >= MOD) ret %= MOD;       if (a >= MOD) a %= MOD;       b >>= 1;     }     return ret;   }   long long invmod(long long x) { return power(x, MOD - 2); }   long long dp[55][2];   long long a[55];   long long n;   long long go(long long pos, long long check) {     if (pos == n + 1) return 0;     if (dp[pos][check] != -1) return dp[pos][check];     long long ans = 0;     if (check == 0) {       ans += max(a[pos] + go(pos + 1, check ^ 1), go(pos + 1, check));     } else {       ans += min(go(pos + 1, check ^ 1), a[pos] + go(pos + 1, check));     }     dp[pos][check] = ans;     return ans;   }   long long go1(long long pos, long long check) {     if (pos == n + 1) return 0;     if (dp[pos][check] != -1) return dp[pos][check];     long long ans = 0;     if (check == 0) {       ans += min(go1(pos + 1, check ^ 1), a[pos] + go1(pos + 1, check));     } else {       ans += max(a[pos] + go1(pos + 1, check ^ 1), go1(pos + 1, check));     }     dp[pos][check] = ans;     return ans;   }   int32_t main() {     cin >> n;     long long sum = 0;     for (long long i = 1; i <= n; i++) {       cin >> a[i];       sum += a[i];     }     memset(dp, -1, sizeof(dp));     long long k = go1(1, 0);     cout << k <<     << sum - k << endl;   }
#include <bits/stdc++.h>   using namespace std;   bool G[100005];   bool use[100005];   int top[100005];   int Top[100005];   char R[100005];   int num[100005];   int main() {     int m, n, Len = 0, useLen = 0;     char str[10];     memset(G, true, sizeof(G));     memset(use, false, sizeof(use));     scanf( %d%d , &n, &m);     int number = 0, last = 0;     for (int i = 0; i < m; i++) {       scanf( %s %d , str, &num[i]);       R[i] = str[0];     }     for (int i = 0; i < m; i++) {       int a;       str[0] = R[i];       a = num[i];       if (str[0] ==  + ) {         if (number != 0 || (Len != 0 && use[a] == false)) G[a] = false;         last = a;         number++;       }       if (str[0] ==  - ) {         if (use[a] == false) {           for (int i = Len - 1; i >= useLen; i--) {             G[Top[i]] = false;           }           useLen = Len;           if (number != 0 || (i != m - 1 && a != num[i + 1])) G[a] = false;         } else {           if (number > 1 || (number == 1 && i != m - 1 && num[i + 1] != a))             G[a] = false;           number--;         }       }       if (use[a] == false) {         Top[Len++] = a;         use[a] = true;       }     }     int sum = 0;     for (int i = 1; i <= n; i++)       if (G[i]) {         top[sum++] = i;       }     printf( %d n , sum);     if (sum > 0) {       for (int i = 0; i < sum - 1; i++) printf( %d  , top[i]);       printf( %d n , top[sum - 1]);     }     return 0;   }
#include <bits/stdc++.h>   #pragma comment(linker,  /stack:32000000 )   using namespace std;   const int INF = 2147483647;   const long long LLINF = 9223372036854775807LL;   const int maxn = 300100;   struct state {     int len, link;     map<char, int> next;     int cnt[3];     state() { memset(cnt, 0, sizeof(cnt)); }   };   const int MAXLEN = 300100;   state st[MAXLEN * 2];   int sz, last;   void sa_init() {     sz = last = 0;     st[0].len = 0;     st[0].link = -1;     ++sz;   }   int KK;   vector<int> states[maxn];   void sa_extend(char c) {     int cur = sz++;     st[cur].len = st[last].len + 1;     if (c >=  a  && c <=  z ) st[cur].cnt[KK] = 1;     int p;     for (p = last; p != -1 && !st[p].next.count(c); p = st[p].link)       st[p].next[c] = cur;     if (p == -1)       st[cur].link = 0;     else {       int q = st[p].next[c];       if (st[p].len + 1 == st[q].len)         st[cur].link = q;       else {         int clone = sz++;         st[clone].len = st[p].len + 1;         st[clone].next = st[q].next;         st[clone].link = st[q].link;         for (; p != -1 && st[p].next[c] == q; p = st[p].link)           st[p].next[c] = clone;         st[q].link = st[cur].link = clone;       }     }     last = cur;   }   const int mod = 1000000007;   struct num {     int x;     num() : x(0) {}     num(int x) : x(x) {}     num operator+(const num& o) const {       num res(x + o.x);       if (res.x >= mod) res.x -= mod;       return res;     }     num operator-(const num& o) const {       num res(x - o.x);       if (res.x < 0) res.x += mod;       return res;     }     num operator*(const num& o) const { return num(x * (long long)o.x % mod); }   };   num add[maxn];   num ans[maxn];   int main() {     string s1, s2, s3;     cin >> s1 >> s2 >> s3;     sa_init();     KK = 0;     for (int i = 0; i < int((s1).size()); ++i) sa_extend(s1[i]);     sa_extend( A );     KK = 1;     for (int i = 0; i < int((s2).size()); ++i) sa_extend(s2[i]);     sa_extend( B );     KK = 2;     for (int i = 0; i < int((s3).size()); ++i) sa_extend(s3[i]);     sa_extend( C );     for (int i = 0; i < sz; ++i) states[st[i].len].push_back(i);     for (int ii = maxn - 1; ii >= 1; --ii) {       for (int i = 0; i < int((states[ii]).size()); ++i) {         int curst = states[ii][i];         for (int iter = 0; iter < 3; ++iter)           st[st[curst].link].cnt[iter] += st[curst].cnt[iter];       }     }     for (int i = 1; i < sz; ++i) {       num curres = num(st[i].cnt[0]) * num(st[i].cnt[1]) * num(st[i].cnt[2]);       add[st[i].len] = add[st[i].len] + curres;       int lf = st[st[i].link].len;       add[lf] = add[lf] - curres;     }     num cr(0);     for (int i = maxn - 1; i >= 0; --i) {       cr = cr + add[i];       ans[i] = cr;     }     int to = min(int((s1).size()), min(int((s2).size()), int((s3).size())));     for (int i = 0; i < to; ++i) printf( %d  , ans[i + 1].x);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long int modmulti(long long int a, long long int b, long long int m) {     return ((a % m) * (b % m)) % m;   }   long long int gcd(long long int a, long long int b) {     if (b == 0) return a;     return gcd(b, a % b);   }   long long int power(long long int x, long long int y, long long int m) {     if (y == 0) return 1;     long long int p = power(x, y / 2, m) % m;     p = (p * p) % m;     return (y % 2 == 0) ? p : (x * p) % m;   }   long long int power2(long long int x, long long int y) {     if (y == 0) return 1;     long long int p = power2(x, y / 2);     p = (p * p);     return (y % 2 == 0) ? p : (x * p);   }   bool cmp(pair<long long int, long long int>& a,            pair<long long int, long long int>& b) {     if (a.first == b.first)       return (a.second < b.second);     else       return (a.first > b.first);   }   long long int bin(vector<long long int> a, long long int left,                     long long int right, long long int x) {     long long int mid = left + (right - left) / 2;     if (a[mid] == x) return mid;     if (left <= right) {       if (a[mid] < x)         return bin(a, mid + 1, right, x);       else if (a[mid] > x)         return bin(a, left, mid - 1, x);     }     return -1;   }   long long int findclosest(long long int n) {     long long int i;     for (i = 0; i <= 64; i++) {       if (power2(2, i) <= n)         continue;       else         break;     }     return power2(2, i - 1);   }   long long int get_signi(long long int n) {     while (n >= 10) {       n = n / 10;     }     return n;   }   long long int get_digits(long long int n) {     long long int i = 0;     while (n >= 10) {       n = n / 10;       i++;     }     return i;   }   bool is_palindrome(string t) {     for (int i = 0; i < t.size() / 2; i++) {       if (t[i] != t[t.size() - i - 1]) return false;     }     return true;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     ;     string second;     cin >> second;     string t =   ;     long long int last_index = 0, i, j;     for (i = 0; i < 26; i++) {       for (j = last_index; j < second.size(); j++) {         if (second[j] ==  a  + 25 - i) {           t += second[j];           last_index = j;         }       }     }     cout << t <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long MAX = 2500000000;   const int inf = 123456789;   const double EPS = 1e-9;   const double PI = 2 * asin(1.0);   const long long mod = 1e9 + 7;   int double_cmp(double x, double y = 0, double tol = EPS) {     return (x <= y + tol) ? (x + tol < y) ? -1 : 0 : 1;   }   const int N = 3e5;   int n;   int t[2 * N][2];   void modify(int p, int value, int q) {     for (t[p += n][q] += value; p > 1; p >>= 1)       t[p >> 1][q] = t[p][q] + t[p ^ 1][q];   }   int query(int l, int r, int q) {     int res = 0;     for (l += n, r += n; l < r; l >>= 1, r >>= 1) {       if (l & 1) res += t[l++][q];       if (r & 1) res += t[--r][q];     }     return res;   }   int main() {     scanf( %d , &n);     int k;     scanf( %d , &k);     int a, b;     scanf( %d%d , &a, &b);     int q;     scanf( %d , &q);     a -= b;     for (int i = 0; i < q; ++i) {       int s;       scanf( %d , &s);       if (s == 1) {         int x, y;         scanf( %d%d , &x, &y);         int aux = min(b - t[x + n][0], y);         int aux2 = max(0, min(a - t[x + n][1], y - aux));         modify(x, aux, 0);         modify(x, aux2, 1);       } else {         int x;         scanf( %d , &x);         long long saida =             query(1, x, 0) + query(x + k, n + 1, 1) + query(x + k, n + 1, 0);         cout << saida << endl;       }     }   }
#include <bits/stdc++.h>   using namespace std;   int n;   bool benar;   string ans, st;   int main() {     scanf( %d , &n);     vector<string> data;     while (cin >> st) data.push_back(st);     if (data[0] ==  int ) {       if (data.size() == 1)         printf( %s n , data[0].c_str());       else         printf( Error occurred n );     } else {       vector<int> q;       q.push_back(0);       benar = true;       ans =  pair< ;       for (int i = 1; i < data.size(); i++) {         if (data[i] ==  pair ) {           if (q.size() == 0) {             benar = false;             break;           }           ans +=  pair< ;           q[q.size() - 1]++;           q.push_back(0);         } else {           if (q.size() == 0) {             benar = false;             break;           }           ans +=  int ;           q[q.size() - 1]++;           while (q.size()) {             if (q[q.size() - 1] == 2) {               ans +=  > ;               q.pop_back();             } else               break;           }           if (q.size())             if (q[q.size() - 1] == 1) ans +=  , ;         }       }       if (q.size()) benar = false;       if (benar)         printf( %s n , ans.c_str());       else         printf( Error occurred n );     }   }
#include <bits/stdc++.h>   using namespace std;   long long int bexp(long long int a, long long int b, long long int mod) {     long long int res = 1;     while (b) {       if (b & 1) res = (res * a) % mod;       a = (a * a) % mod;       b >>= 1;     }     return res;   }   long long int gcd(long long int a, long long int b) {     if (b == 0) return a;     return gcd(b, a % b);   }   const long long int N = 1000010;   const long long int mod = 1e9 + 7;   struct comp {     bool operator()(const pair<long long int, long long int> a,                     const pair<long long int, long long int> b) const {       return a.second > b.second;     }   };   long long int dp[N] = {}, prime[N] = {};   int32_t main() {     ios::sync_with_stdio(false);     cin.tie(NULL);     cout.precision(10);     long long int t;     cin >> t;     dp[1] = 1;     prime[1] = 1;     long long int cnt = 1;     for (long long int i = 2; i < N; ++i) {       if (prime[i] == 0) {         cnt++;         for (long long int j = i * i; j < N; j += i) {           prime[j] = 1;         }       }       long long int k = sqrt(i);       if (k * k == i && prime[k] == 0) {         cnt--;       }       dp[i] = cnt;     }     for (long long int i = 0; i < t; ++i) {       long long int n;       cin >> n;       cout << dp[n] <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   float r, p, m;   float a[100 * 1000];   int main() {     cin >> m >> r;     p = r * sqrt(2);     a[0] = 2 * r;     a[1] = 2 * r + p;     for (int i = (2), _end = (m); i < _end; ++i) {       a[i] = 2 * p;       a[i] += 2 * r * (i - 1);     }     float sum = 0;     sum += a[0] * m;     for (int i = (1), _end = (m); i < _end; ++i) {       sum += 2 * (m - i) * a[i];     }     sum = sum / (m * m);     printf( %.9f n , sum);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using lli = long long;   using ld = long double;   mt19937 rnd(time(nullptr));   lli GCD(lli a, lli b) {     if (b == 0) return a;     return GCD(b, a % b);   }   lli LCM(lli a, lli b) { return a / GCD(a, b) * b; }   inline void Solve() {     lli n = 0;     cin >> n;     vector<lli> data(n);     for (auto &it : data) {       cin >> it;       while (it % 2 == 0) it /= 2;       while (it % 3 == 0) it /= 3;     }     for (lli i = 1; i < n; i++) {       if (data[i] != data[i - 1]) {         cout <<  No ;         return;       }     }     cout <<  Yes ;   }   signed main() {     cout << fixed << setprecision(20);     Solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MOD = 1000000007;   const int P[] = {2,       3,       5,        7,        13,      17,                    19,      31,      61,       89,       107,     127,                    521,     607,     1279,     2203,     2281,    3217,                    4253,    4423,    9689,     9941,     11213,   19937,                    21701,   23209,   44497,    86243,    110503,  132049,                    216091,  756839,  859433,   1257787,  1398269, 2976221,                    3021377, 6972593, 13466917, 20996011, 24036583};   long long expBySqr(long long x, long long n) {     long long y = 1;     for (; n != 0; n >>= 1) {       if ((n & 1) == 1) {         y = y * x % MOD;       }       x = x * x % MOD;     }     return y;   }   int main() {     int n;     scanf( %d , &n);     int res = expBySqr(2LL, P[n - 1] - 1) % MOD;     res = (res + MOD - 1) % MOD;     printf( %d n , res);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long int n, m, k;     cin >> n >> m >> k;     long long int b[n];     memset(b, 0, sizeof(b));     vector<pair<long long int, long long int> > a;     for (int i = 0; i < n; i++) {       long long int x;       cin >> x;       a.push_back(make_pair(x, i));     }     sort(a.begin(), a.end());     reverse(a.begin(), a.end());     long long int sum = 0;     for (int i = 0; i < k * m; i++) {       b[a[i].second] = 1;       sum += a[i].first;     }     long long int l = 0, p = 0;     cout << sum << endl;     for (int i = 0; i < n; i++) {       l = l + b[i];       if (l == m) {         p++;         cout << i + 1 <<    ;         l = 0;       }       if (p == k - 1) break;     }     cout << endl;   }