malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   #pragma GCC optimize( Ofast )   #pragma GCC optimization( unroll-loops )   const int N = 1e5 + 5;   const long long int mod = 1e9 + 7;   const long long int Mod = 998244353;   const long double Pi = acos(-1);   const long long int Inf = 4e18;   using namespace std;   int n, m;   vector<pair<int, int> > e;   bool Check(int k) {     vector<bool> rem(n + 1, false);     vector<int> in[n + 1], out[n + 1], rank(n + 1, -1);     for (int i = 0; i <= k; i++) {       in[e[i].second].push_back(e[i].first);       out[e[i].first].push_back(e[i].second);     }     int cnt_in = 0, cnt_out = 0, one = -1, last = -1;     for (int i = 1; i <= n; i++) {       if ((int)in[i].size() == 0) {         cnt_in++;         one = i;       }       if ((int)out[i].size() == 0) {         cnt_out++;         last = i;       }     }     if (cnt_in * cnt_out != 1) return false;     rank[1] = one;     rank[n] = last;     int cur = one;     for (int i = 2; i <= n; i++) {       int fone = 0, nxt = -1;       for (auto u : out[cur]) {         int cnt = 0;         for (auto t : in[u]) {           if (rem[t] == false) cnt++;         }         if (cnt == 1) {           fone++;           nxt = u;         }       }       if (fone != 1)         return false;       else {         rem[cur] = true;         cur = nxt;         rank[i] = cur;       }     }     for (int i = 1; i <= n; i++) {       if (rank[i] == -1) return false;     }     return true;   }   void TestCase() {     cin >> n >> m;     for (int i = 1, u, v; i <= m; i++) {       cin >> u >> v;       e.push_back({u, v});     }     int lb = 0, ub = m - 1, ans = m;     while (lb <= ub) {       int mid = (lb + ub) / 2;       if (Check(mid)) {         ans = min(ans, mid);         ub = mid - 1;       } else         lb = mid + 1;     }     ans == m ? cout << -1 : cout << ans + 1;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     ;     int T = 1;     while (T--) {       TestCase();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     std::ios_base::sync_with_stdio(false);     vector<long long int> v;     long long int n, i;     cin >> n;     if (n == 1) {       cout << 1;       return 0;     }     for (long long int i = 1; i * i <= n; ++i) {       if (n % i == 0) {         if (i * i == n)           v.push_back(i);         else {           v.push_back(i);           v.push_back(n / i);         }       }     }     sort(v.begin(), v.end());     if (v.size() == 2)       cout << n;     else {       long long int flag = 0;       if (v.size() == 3) {         if (v[1] / v[0] != v[2] / v[1]) {           cout << 1;         } else           cout << v[1];       } else {         long long int ans = v[1] / v[0];         for (i = 1; i < v.size() - 1; i++) {           if (v[i + 1] != ans * v[i]) {             flag = 1;             break;           }         }         if (flag == 1)           cout << 1;         else {           cout << v[1];         }       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5 + 5;   const int mod = 1e9 + 7;   long long qpow(long long a, long long b) {     long long res = 1;     for (; b; b >>= 1) {       if (b & 1) res = res * a % mod;       a = a * a % mod;     }     return res;   }   struct graph {     int head[maxn], nxt[maxn << 1], to[maxn << 1], w[maxn << 1], sz;     void init() { memset(head, -1, sizeof(head)); }     graph() { init(); }     void push(int a, int b, int c) {       nxt[sz] = head[a], to[sz] = b, w[sz] = c, head[a] = sz++;     }     int& operator[](const int a) { return to[a]; }   };   long long dist[maxn][40], fi[maxn][40], mi[maxn][40];   int to[maxn], w[maxn];   int main() {     int n;     long long k;     cin >> n >> k;     for (int i = 0; i < n; ++i) scanf( %d , &to[i]);     for (int i = 0; i < n; ++i) {       scanf( %d , &w[i]);       dist[i][0] = w[i];       mi[i][0] = w[i];       fi[i][0] = to[i];     }     for (int i = 1; i <= 39; ++i) {       for (int j = 0; j < n; ++j) {         dist[j][i] = dist[j][i - 1] + dist[fi[j][i - 1]][i - 1];         fi[j][i] = fi[fi[j][i - 1]][i - 1];         mi[j][i] = min(mi[j][i - 1], mi[fi[j][i - 1]][i - 1]);       }     }     for (int i = 0; i < n; ++i) {       long long mix = 1e18;       long long ans = 0;       long long res = k;       int now = i;       for (int j = 39; j >= 0; --j) {         if (res >= (1ll << j)) {           ans += dist[now][j];           mix = min(mix, mi[now][j]);           now = fi[now][j];           res -= (1ll << j);         }       }       printf( %lld %lld n , ans, mix);     }     return 0;   }
#pragma GCC target ( avx2 )   #pragma GCC optimize ( O3 )   #pragma GCC optimize ( unroll-loops )   #include <bits/stdc++.h>   using namespace std;      typedef long long int ll;   typedef long double ld;   typedef pair<ll, ll> pl;   typedef pair<ld, ld> pd;   typedef priority_queue<pl, vector<pl>, greater<pl> > pq;      template<class T, class S>   ostream& operator<<(ostream &o, pair<T, S> p) {       return o<< ( <<p.first<< ,  <<p.second<< ) ;   }      template<template<class, class...> class T, class... A>   typename enable_if<!is_same<T<A...>, string>(), ostream&>::type   operator<<(ostream &o, T<A...> V) {    o<< [ ;    for(auto a:V) o<<a<< ,  ;    return o<< ] ;   }      // This is tuples, _p is helper   template<ll i, class... T>   typename enable_if<i==sizeof...(T)>::type _p(ostream& o, tuple<T...> t) {}      template<ll i, class... T>   typename enable_if<i<sizeof...(T)>::type _p(ostream& o, tuple<T...> t) {       _p<i+1>(o << get<i>(t)<<  ,  , t);   }       template<class... T>   ostream& operator<<(ostream& o, tuple<T...> t) {       _p<0>(o<< ( , t);       return o<< ) ;   }         #define G(x) ll x; cin >> x;   #define Gs(s) string s; cin >> s;   #define Gd(x) ld x; cin >> x;   #define F(i, l, r) for(ll i = l; i < (r); i++)   #define F1(i, l, r) for(ll i = l; i >= (r); i--)   #define Fi(i, s) for(auto i = (s).begin(); i != (s).end(); i++)   #define L G(_t) F(_t1, 0, _t)   #define H(ar, n) vector<ll> ar(n); F(_i, 0, n) cin >> ar[_i];   #define A first   #define B second   #define PA(ar, n) F(_i, 0, n) cout << (ar)[_i] <<    ; cout << endl;    #define PB push_back   #define V vector   #define CASE cout <<  Case #  << _t1 + 1 <<  :      #define CC <<     <<   #define BE(ar) ar.begin(), ar.end()   #define CO(x) cout << (x) << endl;   #define D(x) ((x) -  0 )   #define EX(x) {cout << (x) << endl; return 0;}   #define S(ar, val) memset(ar, val, sizeof(ar));   ll M = 1000000007; //998244353;   ll inv(ll a, ll b){return 1<a ? b - inv(b%a,a)*b/a : 1;}   ll gcd(ll x, ll y){if(y == 0) return x; return gcd(y, x % y); }   pl neigh[4] = {{-1, 0}, {1, 0}, {0, 1}, {0, -1}};      #define N 0      int main() {           ios_base::sync_with_stdio(0);           cin.tie(0);    L{     G(n)     if(n == 2){      cout <<  1 n2 1 n1 n2 1  << endl;      continue;     }     if(n == 3){      cout <<  5 n2 3 1 n2 n1 3 n3 2  << endl;      continue;     }     ll perm[n];     perm[n-1] = 1;     perm[0] = n-1;     F1(i, n-2, (n-1)/2+2){      perm[i] = i;     }     perm[(n-1)/2] = n;     perm[(n-1)/2+1]=2;     F(i, 1, (n-1)/2){      perm[i] = i+2;     }     ll x = (n-1)*(n-1);     ll c = 1;     ll p = n-1;     while(c < n-1){      if(c %2) p--;      c++;      x += p * p;     }     cout << x << endl;     F(i, 0, n){      cout << perm[i] <<    ;     }     cout << endl;     cout << n - 1 << endl;     F1(i, n-1, (n-1)/2+2){      cout << i <<     << 1 << endl;     }     F(i, 1, (n-1)/2+2){      cout << i <<     << n << endl;     }    }   }
#include <bits/stdc++.h>   #pragma warning(disable : 4996)   using namespace std;   const int mod = 1000000007;   const int inf = 2012345678;   const long long infl = 9012345678901234567;   const double pi = 3.1415926535897932384626433832795;   const int N = 20;   const int M = 100010;   char buf[M];   int a[M];   int dp[1 << N][N + 1];   int main() {     freopen( input.txt ,  r , stdin);     int n, m;     scanf( %d%d , &(n), &(m));     for (int i = 0; i < (n); i++) {       scanf( %s , buf);       for (int j = 0; j < (m); j++) a[j] = 2 * a[j] + buf[j] -  0 ;     }     for (int i = 0; i < (m); i++) dp[a[i]][0]++;     for (int i = 0; i < (m); i++)       for (int j = 0; j < (n); j++) dp[a[i] ^ (1 << j)][1]++;     for (int k = 2; k <= n; k++) {       for (int i = 0; i < ((1 << n)); i++) {         int sum = 0;         for (int j = 0; j < (n); j++) {           sum += dp[i ^ (1 << j)][k - 1];         }         sum -= (n - k + 2) * dp[i][k - 2];         dp[i][k] = sum / k;       }     }     int ans = inf;     for (int i = 0; i < ((1 << n)); i++) {       int s = 0;       for (int k = 0; k <= (n); k++) {         s += min(k, n - k) * dp[i][k];       }       ans = min(ans, s);     }     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     string s;     cin >> s;     char cur = s[0];     int count = 1;     for (int i = 1; i < s.length(); i++) {       if (cur == s[i]) {         count++;         if (count == 7) {           cout <<  YES  << endl;           return 0;         }       } else {         count = 1;         cur = s[i];       }     }     cout <<  NO  << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long int M = 1e9 + 7;   const long long int N = 2e5 + 5;   const long long int inf = 2e18;   long long int mod(long long int x) { return (x % M); }   long long int mod_minus(long long int a, long long int b) {     long long int ans = (mod(a) - mod(b));     if (ans < 0) ans = mod(ans + M);     return ans;   }   long long int mod_mul(long long int a, long long int b) {     return mod(mod(a) * mod(b));   }   long long int mod_add(long long int a, long long int b) { return mod(a + b); }   long long int power(long long int a, long long int n) {     if (n == 0)       return 1;     else if (n == 1)       return a;     long long int R = power(a, n / 2) % M;     if (n % 2 == 0) {       return mod(mod_mul(R, R));     } else {       return mod(mod_mul(mod_mul(R, a), mod(R)));     }   }   long long int mod_inv(long long int n) { return power(n, M - 2); }   long long int mod_div(long long int a, long long int b) {     long long int ans = mod(a);     long long int b1 = power(b, M - 2);     ans = mod(mod_mul(ans, b1));     return ans;   }   long long int fact_mod(long long int n) {     vector<long long int> fact(n + 1);     fact[0] = 1;     for (long long int i = 1; i < n + 1; i++) {       fact[i] = mod_mul(fact[i - 1], i);     }     return fact[n];   }   long long int nCr_mod(long long int n, long long int r) {     if (r == 0 || n == 0) return 1;     long long int fac[n + 1];     fac[0] = 1;     for (long long int i = 1; i <= n; i++) fac[i] = (fac[i - 1] * i) % M;     return (fac[n] * mod_inv(fac[r]) % M * mod_inv(fac[n - r]) % M) % M;   }   int main() {     long long int n;     cin >> n;     long long int i;     queue<pair<long long int, long long int>> q;     vector<pair<long long int, long long int>> v(n);     for (i = 0; i < n; i++) {       long long int x, y;       cin >> x >> y;       v[i] = {x, y};       if (x == 1) q.push({i, y});     }     vector<pair<long long int, long long int>> ans;     while (q.empty() == false) {       pair<long long int, long long int> temp = q.front();       q.pop();       ans.push_back({temp});       long long int x = temp.second;       v[x].first--;       v[x].second = temp.first ^ v[x].second;       if (v[x].first == 1) q.push({x, v[x].second});     }     set<pair<long long int, long long int>> s;     for (auto x : ans) {       if (!s.count({x.first, x.second}) && !s.count({x.second, x.first}))         s.insert({x.first, x.second});     }     cout << s.size() << endl;     for (auto x : s) cout << x.first <<     << x.second << endl;   }
#include <bits/stdc++.h>   using namespace std;   const int oo = 0x3f3f3f3f;   const double eps = 1e-9;   string words[100005];   int type[100005];   int gender[100005];   void reverse(string &c) {     for (int i = (0); i < (int((c).size()) / 2); i++) {       char tmp = c[i];       c[i] = c[int((c).size()) - i - 1];       c[int((c).size()) - i - 1] = tmp;     }   }   int main() {     string line;     getline(cin, line);     stringstream ss(line);     int n = 0;     while (true) {       string word;       ss >> word;       if (ss.fail()) break;       words[n++] = word;     }     for (int i = (0); i < (n); i++) reverse(words[i]);     for (int i = (0); i < (n); i++) {       if (words[i].find( soil ) == 0) {         type[i] = 0;         gender[i] = 0;         continue;       };       if (words[i].find( alail ) == 0) {         type[i] = 0;         gender[i] = 1;         continue;       };       if (words[i].find( rte ) == 0) {         type[i] = 1;         gender[i] = 0;         continue;       };       if (words[i].find( arte ) == 0) {         type[i] = 1;         gender[i] = 1;         continue;       };       if (words[i].find( sitini ) == 0) {         type[i] = 2;         gender[i] = 0;         continue;       };       if (words[i].find( setini ) == 0) {         type[i] = 2;         gender[i] = 1;         continue;       };       gender[i] = -1;     }     if (n == 1 && gender[0] != -1) {       cout <<  YES n ;       return 0;     }     bool SameGender = true;     for (int i = (1); i < (n); i++)       if (gender[i] != gender[0]) SameGender = false;     if (!SameGender || gender[0] == -1) {       cout <<  NO n ;       return 0;     }     int p1, p2, p3;     p1 = 0;     while (p1 < n && type[p1] == 0) ++p1;     p2 = p1;     while (p2 < n && type[p2] == 1) ++p2;     p3 = p2;     while (p3 < n && type[p3] == 2) ++p3;     if (p3 == n && p2 == p1 + 1)       cout <<  YES n ;     else       cout <<  NO n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e6 + 10;   const int mod = 1e9 + 7;   const int inf = 0x3f3f3f3f;   int a1[maxn], a2[maxn];   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     long long n, k;     cin >> n >> k;     long long ans = (n + 1) * n / 2;     for (int i = 1; i <= n; i++) a1[i] = i;     for (int i = 1; i <= n; i++) a2[i] = i;     if (ans > k) {       cout << -1 <<   n ;       return 0;     }     long long up = n / 2;     long long now = n - 1;     for (int i = 1; i <= up; i++) {       if (ans + now <= k) {         ans += now;         swap(a2[i], a2[i + now]);       } else {         swap(a2[i], a2[i + k - ans]);         ans = k;         break;       }       now -= 2;     }     cout << ans <<   n ;     for (int i = 1; i <= n; i++) cout << a1[i] << (i == n ?   n  :    );     for (int i = 1; i <= n; i++) cout << a2[i] << (i == n ?   n  :    );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <class c>   struct rge {     c b, e;   };   template <class c>   rge<c> range(c i, c j) {     return rge<c>{i, j};   }   template <class c>   auto dud(c* x) -> decltype(cerr << *x, 0);   template <class c>   char dud(...);   struct debug {     template <class c>     debug& operator<<(const c&) {       return *this;     }   };   using ll = long long;   using ld = long double;   constexpr int nax = 1000 * 1000 + 105;   constexpr int infty = 1000 * 1000 * 1000 + 5;   constexpr int mod = 1000 * 1000 * 1000 + 7;   int main() {     int n;     scanf( %d , &n);     set<int> s;     for (int i = 0; i < n; i++) {       int a;       scanf( %d , &a);       s.insert(a);     }     printf( %d n , n + 1 - (int)s.size());     return 0;   }
#include <bits/stdc++.h>   #pragma GCC optimize( Ofast )   #pragma GCC optimize( unroll-loops )   #pragma GCC target( avx2 )   #pragma GCC optimize( Os )   using namespace std;   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     string str;     long long i, j, k, x = 0, y = 0, n, m, t, sum = 0, a = 0, b, l, c, d, id;     cin >> n;     set<long long> s;     for (i = 0; i < n; i++) {       cin >> a;       sum += a;       s.insert(a);     }     x = s.size();     if (x >= 4)       cout << -1;     else {       if (x == 1)         cout << 0;       else if (x == 2) {         a = *next(s.begin(), 0);         b = *next(s.begin(), 1);         if ((a + b) % 2 != 0)           cout << b - a;         else           cout << (b - a) / 2;       } else {         a = *next(s.begin(), 0);         b = *next(s.begin(), 1);         c = *next(s.begin(), 2);         t = c - b;         if (a + c == b * 2)           cout << t;         else           cout << -1;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct node {     int x, i;   } a[100020], b[100020], c[100020];   bool f(node a, node b) { return a.x < b.x; }   bool g(node a, node b) { return a.i < b.i; }   int main() {     int i, n, j;     cin >> n;     cout <<  YES n ;     for (i = 1; i <= n; i++) {       cin >> a[i].x, a[i].i = i, a[i].x += 2;     }     sort(a + 1, a + n + 1, f);     for (i = 1; i <= n / 3; i++)       b[i].i = c[i].i = a[i].i, b[i].x = i, c[i].x = a[i].x - i;     for (i = 1 + n / 3; i <= (n + n) / 3; i++)       b[i].i = c[i].i = a[i].i, c[i].x = i, b[i].x = a[i].x - i;     for (i = 1 + (n + n) / 3, j = i; i <= n; i++)       b[i].i = c[i].i = a[i].i, c[i].x = n - i + 1, b[i].x = a[i].x - c[i].x;     sort(b + 1, b + n + 1, g);     sort(c + 1, c + n + 1, g);     for (i = 1; i <= n; i++) cout << b[i].x - 1 <<    ;     cout << endl;     for (i = 1; i <= n; i++) cout << c[i].x - 1 <<    ;     cout << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<long long> g[1100];   map<long long, bool> visited;   long long a, b;   map<long long, long long> parent;   void dfs(long long v) {     visited[v] = 1;     if (v > 1e9 || v == b) {       return;     }     if (!visited[2 * v]) {       parent[2 * v] = v;       dfs(2 * v);     }     if (!visited[10 * v + 1]) {       parent[10 * v + 1] = v;       dfs(10 * v + 1);     }   }   decltype(0) main() {     ios::sync_with_stdio(0);     cin >> a >> b;     dfs(a);     if (!visited[b]) {       cout <<  NO n ;     } else {       vector<long long> ans;       long long x = b;       while (x != parent[a]) {         ans.push_back(x);         x = parent[x];       }       cout <<  YES n  << (long long)(ans.size()) <<   n ;       for (long long i = (long long)(ans.size()) - 1; i >= 0; i--) {         cout << ans[i] <<    ;       }       cout <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   unsigned long long X, Y, sum, exor, l, m;   int main() {     cin >> sum >> exor;     if (sum < exor || sum % 2 != exor % 2) {       cout <<  -1  << endl;       return 0;     }     X = (sum - exor) / 2;     Y = sum - X;     cout << X << endl << Y << endl;   }
#include <bits/stdc++.h>   using namespace std;   int n, m;   vector<int> ans;   int row[5], col[20];   vector<int> v[3];   bool vis[20][11][11][11][11][11][1 << 5];   bool solve(int x, int r1, int r2, int r3, int r4, int r5, int mask) {     if (x == m) {       if (r1 + r2 + r3 + r4 + r5) return false;       return true;     }     bool &ret = vis[x][r1][r2][r3][r4][r5][mask];     if (ret) return false;     ret = true;     int a[5];     a[0] = r1, a[1] = r2, a[2] = r3, a[3] = r4, a[4] = r5;     int h = col[x];     for (int i = 0; i < v[h].size(); i++) {       int b[5] = {0};       int now = v[h][i];       for (int j = 0; j < n; j++) b[j] = a[j];       bool flag = true;       for (int j = 0; j < n; j++) {         if ((mask & (1 << j)) == 0 && now & (1 << j)) b[j]--;         if (b[j] < 0) {           flag = false;           break;         }       }       if (flag) {         if (solve(x + 1, b[0], b[1], b[2], b[3], b[4], now)) {           ans.push_back(now);           return true;         }       }     }     return false;   }   int main() {     scanf( %d , &n);     ;     scanf( %d , &m);     ;     for (int i = 0; i < n; i++) scanf( %d , &row[i]);     ;     for (int i = 0; i < m; i++) scanf( %d , &col[i]);     ;     for (int i = 0; i < 1 << n; i++) {       int c = 0, pre = 0;       for (int j = 0; j < n; j++) {         if (i & (1 << j) && !pre) {           pre = 1;           c++;         } else           pre = bool(i & (1 << j));       }       v[c].push_back(i);     }     solve(0, row[0], row[1], row[2], row[3], row[4], 0);     reverse(ans.begin(), ans.end());     for (int i = 0; i < n; i++) {       for (int j = 0; j < ans.size(); j++) {         if (ans[j] & (1 << i))           cout <<  * ;         else           cout <<  . ;       }       cout <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long INF = 1e18;   const unsigned long long base = 2333;   const int maxn = 1e2 + 55;   const int maxm = 1e4 + 50;   const int maxv = 1e6 + 5;   const int mod = 51123987;   long long Cal(string s, long long p) {     long long len = s.size();     long long sum = 0;     for (long long i = 0; i < len; i++) {       sum = (sum * 10 + s[i] -  0 ) % p;     }     return sum;   }   long long phi(long long n) {     long long res = n, m = n;     for (long long i = 2; i <= sqrt(m); i++) {       if (m % i == 0) res = res / i * (i - 1);       while (m % i == 0) m /= i;     }     if (m > 1) res = res / m * (m - 1);     return res;   }   long long Quick_pow(long long x, long long y, long long p) {     long long ans = 1, res = x;     while (y) {       if (y & 1) ans = ans * res % p;       res = res * res % p;       y >>= 1;     }     return ans;   }   int main() {     string b, n;     long long c;     cin >> b >> n >> c;     long long ph = phi(c);     long long bb = Cal(b, c);     long long nn = Cal(n, ph);     if (n.size() < 10) {       long long z = 0;       for (long long i = 0; i < n.size(); i++) z = (z * 10 + n[i] -  0 );       long long ans = ((bb - 1 + c) % c) * Quick_pow(bb, z - 1, c) % c;       if (ans == 0) ans = c;       printf( %lld n , ans);       return 0;     }     nn = (nn - 1 + ph) % ph + ph;     long long ans = ((bb - 1 + c) % c) * Quick_pow(bb, nn, c) % c;     if (ans == 0) ans = c;     printf( %lld n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t--) {       int n, m, x, y;       cin >> n >> m >> x >> y;       char a[n][m];       for (int i = 0; i < n; i++) {         for (int j = 0; j < m; j++) {           cin >> a[i][j];         }       }       int county = 0, count = 0;       if (2 * x > y) {         for (int i = 0; i < n; i++) {           for (int j = 0; j < m; j++) {             if (a[i][j] ==  . ) count++;             if (j != m - 1) {               if (a[i][j] == a[i][j + 1] && a[i][j] ==  . ) {                 county++;                 j++;               }             }           }         }         cout << (county * y) + (count - county) * x;       } else {         for (int i = 0; i < n; i++) {           for (int j = 0; j < m; j++) {             if (a[i][j] ==  . ) count++;           }         }         cout << count * x;       }       cout <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   pair<int, int> a[110];   int n, k;   vector<int> ans;   void solve() {     cin >> n >> k;     for (int i = (1); i <= (n); ++i) {       int x;       cin >> x;       a[i].first = x;       a[i].second = i;     }     sort(a + 1, a + 1 + n);     int s = 0;     for (int i = 1; i <= n; ++i) {       s += a[i].first;       if (s <= k)         ans.push_back(a[i].second);       else         break;     }     sort(ans.begin(), ans.end());     cout << ans.size() << endl;     {       for (int i = (0); i < (ans.size()); ++i) cout << ans[i] <<    ;       cout << endl;     };   }   int main() {     solve();     return 0;   }