malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m;     cin >> n >> m;     vector<int> a(n);     vector<int> update(n);     for (int i = 0; i < n; i++) {       cin >> a[i];       update[i] = 0;     }     int accumalated = 0;     for (int i = 0; i < m; i++) {       int t;       cin >> t;       if (t == 1) {         int v, x;         cin >> v >> x;         a[v - 1] = x;         update[v - 1] = accumalated;       } else if (t == 2) {         int y;         cin >> y;         accumalated += y;       } else {         int q;         cin >> q;         cout << a[q - 1] + accumalated - update[q - 1] << endl;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 5010;   inline int read() {     int s = 0, w = 1;     register char ch = getchar();     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) w = -1;       ch = getchar();     }     while (ch >=  0  && ch <=  9 )       s = (s << 3) + (s << 1) + (ch ^ 48), ch = getchar();     return s * w;   }   int n, m, K;   int a[N], b[N], c[N], dp[N][N];   struct Node {     int x, w;   } g[N];   inline bool cp(Node x, Node y) { return x.w < y.w; }   signed main() {     n = read(), m = read(), K = read();     for (register int i = 1; i <= n; i++)       a[i] = read(), b[i] = read(), c[i] = read(), g[i].x = g[i].w = i;     for (register int i = 1; i <= m; i++) {       int u, v;       u = read(), v = read();       g[v].w = max(g[v].w, u);     }     sort(g + 1, g + 1 + n, cp);     int now = 1;     while (!g[now].w) now++;     memset(dp, -0x3f, sizeof(dp));     for (register int i = 0; i <= K; i++) dp[0][i] = 0;     int qwq = K;     for (register int i = 1; i <= n; i++) {       if (qwq < a[i]) {         puts( -1 );         return 0;       }       qwq += b[i];       for (register int j = a[i]; j <= 5000 - b[i]; j++)         dp[i][j + b[i]] = max(dp[i][j + b[i]], dp[i - 1][j]);       while (now <= n && g[now].w == i) {         for (register int j = 1; j <= 5000; j++)           dp[i][j - 1] = max(dp[i][j - 1], dp[i][j] + c[g[now].x]);         now++;       }     }     int res = 0;     for (register int i = 0; i <= 5000; i++) res = max(res, dp[n][i]);     printf( %d n , res);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAX = 2e5 + 5;   const int MOD = 998244353;   long long p[MAX];   long long mpow[MAX];   int main(int argc, char* argv[]) {     if (argc == 2 or argc == 3) freopen(argv[1],  r , stdin);     if (argc == 3) freopen(argv[2],  w , stdout);     int n, m;     string a, b;     cin >> n >> m >> a >> b;     while (n < m) a =  0  + a, n++;     while (m < n) b =  0  + b, m++;     mpow[0] = 1;     for (int i = 1; i < MAX; i++) {       mpow[i] = (mpow[i - 1] * 2) % MOD;     }     for (int i = n - 1; i >= 0; i--) {       p[i] = p[i + 1] + (a[i] ==  1 ) * mpow[n - i - 1];       p[i] %= MOD;     }     long long ans = 0;     for (int i = 0; i < m; i++) {       if (b[i] ==  1 ) {         ans = (ans + p[i]) % MOD;       }     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   bool reverse(long long a, long long b) { return a > b; }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long n, i;     cin >> n;     if (n % 2 != 0)       cout <<  -1             <<   n ;     else {       for (long long i = 1; i <= n; i++) {         if (i % 2 == 0)           cout << i - 1 <<    ;         else           cout << i + 1 <<    ;       }     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int TESTS = 1;     while (TESTS--) {       long long int n;       cin >> n;       long long int a[n + 1], b[n + 1];       for (long long int i = 1; i <= n; i++) cin >> a[i];       for (long long int i = 1; i <= n; i++) cin >> b[i];       multiset<long long int> s;       for (long long int i = 1; i <= n; i++) s.insert(b[i]);       for (long long int i = 1; i <= n; i++) {         long long int opt1 = *s.begin();         if (s.lower_bound(n - a[i]) == s.end()) {           cout << (a[i] + opt1) % n <<    ;           s.erase(s.find(opt1));           continue;         }         long long int opt2 = *s.lower_bound(n - a[i]);         if ((a[i] + opt1) % n < (a[i] + opt2) % n) {           cout << (a[i] + opt1) % n <<    ;           s.erase(s.find(opt1));         } else {           cout << (a[i] + opt2) % n <<    ;           s.erase(s.find(opt2));         }       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long head[200010], cnt;   class littlestar {    public:     long long to, nxt;     void add(long long u, long long v) {       to = v;       nxt = head[u];       head[u] = cnt;     }   } star[400010];   long long n, f[200010], g[200010], h[200010];   void dfs(long long u, long long fa) {     for (long long i = head[u]; i; i = star[i].nxt) {       long long v = star[i].to;       if (v == fa) continue;       dfs(v, u);       f[fa] = f[fa] + f[v] + 1;       g[u] = g[u] + f[v] + 1;     }   }   void dp(long long u, long long fa) {     for (long long i = head[u]; i; i = star[i].nxt) {       long long v = star[i].to;       if (v == fa) continue;       h[v] = g[u] - 1;       if (fa) h[v] = h[fa];       dp(v, u);     }   }   signed main() {     cin >> n;     for (register long long i = 1; i <= n - 1; i++) {       long long x, y;       scanf( %lld%lld , &x, &y);       star[++cnt].add(x, y);       star[++cnt].add(y, x);     }     dfs(1, 0);     h[1] = f[1];     dp(1, 0);     long long ans = LLONG_MAX;     for (register long long i = 1; i <= n; i++) ans = min(ans, h[i]);     cout << ans;   }
#include <bits/stdc++.h>   using namespace std;   const long long N = 110;   long long dp[N][2], n, val[N], ans;   char s[N];   signed main() {     scanf( %s , s + 1);     n = strlen(s + 1);     for (long long i = 1; i <= n; ++i) val[i] = (s[i] ==  A );     dp[1][val[1]] = 1;     dp[0][0] = 1;     for (long long i = 2; i <= n; ++i) {       if (val[i]) {         dp[i][1] += dp[i - 1][0] + dp[i - 1][1];         if (!val[i - 1] && i != 2) dp[i][0] += dp[i - 2][0] + dp[i - 2][1];       } else         dp[i][0] += dp[i - 1][0];     }     if (val[1])       ans += dp[n][0] + dp[n][1];     else {       ans += dp[n][0];       if (val[2]) {         memset(dp, 0, sizeof dp);         dp[2][0] = 1;         for (long long i = 3; i <= n; ++i) {           if (val[i]) {             dp[i][1] += dp[i - 1][0] + dp[i - 1][1];             if (!val[i - 1] && i != 2) dp[i][0] += dp[i - 2][0] + dp[i - 2][1];           } else             dp[i][0] += dp[i - 1][0];         }         ans += dp[n][0] + dp[n][1];       }     }     memset(dp, 0, sizeof dp);     if (val[1] == 1 && val[n] == 0) {       dp[1][0] = 1;       for (long long i = 2; i < n; ++i) {         if (val[i]) {           dp[i][1] += dp[i - 1][0] + dp[i - 1][1];           if (!val[i - 1]) dp[i][0] += dp[i - 2][0] + dp[i - 2][1];         } else           dp[i][0] += dp[i - 1][0];       }       ans += dp[n - 1][0] + dp[n - 1][1];     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   bool comparator(string a, string b) {     if (a.size() == b.size()) {       return a > b;     }     return a.size() > b.size();   }   int main() {     int n, m;     cin >> n >> m;     string mat[n];     for (int i = 0; i < n; i++) {       cin >> mat[i];     }     vector<pair<int, int> > enemy;     vector<int> adj[n * m];     int jugador;     int end;     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         int pos = i * m + j;         if (mat[i][j] ==  T ) continue;         if (mat[i][j] ==  E ) {           end = pos;         }         if (mat[i][j] -  0  >= 0 && mat[i][j] -  0  <= 9) {           enemy.emplace_back(pair<int, int>(pos, mat[i][j] -  0 ));         }         if (mat[i][j] ==  S ) {           jugador = pos;         }         if (i > 0 && mat[i - 1][j] !=  T ) {           adj[pos].emplace_back(pos - m);           adj[pos - m].emplace_back(pos);         }         if (i < n - 1 && mat[i + 1][j] !=  T ) {           adj[pos].emplace_back(pos + m);           adj[pos + m].emplace_back(pos);         }         if (j < m - 1 && mat[i][j + 1] !=  T ) {           adj[pos].emplace_back(pos + 1);           adj[pos + 1].emplace_back(pos);         }         if (j > 0 && mat[i][j - 1] !=  T ) {           adj[pos].emplace_back(pos - 1);           adj[pos - 1].emplace_back(pos);         }       }     }     queue<int> qu;     int dist[n * m];     for (int i = 0; i < n * m; i++) {       dist[i] = 1000000000;     }     dist[end] = 0;     qu.push(end);     while (!qu.empty()) {       int u = qu.front();       qu.pop();       for (auto v : adj[u]) {         if (dist[u] + 1 < dist[v]) {           dist[v] = dist[u] + 1;           qu.push(v);         }       }     }     long long ans = 0;     for (auto ene : enemy) {       if (dist[ene.first] <= dist[jugador]) {         ans += ene.second;       }     }     cout << ans;   }
#include <bits/stdc++.h>   using namespace std;   long long a, b;   long long nexta, nextb;   long long d, m;   int main() {     cin >> a >> b;     nexta = a;     nextb = b;     long long cur = 0;     while (nexta != nextb)       if (nexta < nextb) {         d += nexta - cur;         cur = nexta;         nexta += a;       } else {         m += nextb - cur;         cur = nextb;         nextb += b;       }     if (a > b)       d += nexta - cur;     else       m += nextb - cur;     if (d > m)       cout <<  Dasha n ;     else if (d < m)       cout <<  Masha n ;     else       cout <<  Equal n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <typename T>   void _R(T &x) {     cin >> x;   }   void _R(int &x) { scanf( %d , &x); }   void _R(long long &x) { scanf( %  PRId64, &x); }   void _R(double &x) { scanf( %lf , &x); }   void _R(char &x) { scanf(  %c , &x); }   void _R(char *x) { scanf( %s , x); }   void R() {}   template <typename T, typename... X>   void R(T &head, X &...tail) {     _R(head);     R(tail...);   }   const int N = 7005;   int stat[2][N], n, t[2], arr[2][N], cnt[2][N];   char str[3][10] = { Loop ,  Win ,  Lose };   void dfs(int who, int pos, int st) {     if (stat[who][pos]) return;     stat[who][pos] = st;     ;     if (st == 1)       for (int i = 0; i < t[1 - who]; i++) {         int pre = (pos - arr[1 - who][i] + n) % n;         if (--cnt[1 - who][pre] == 0) dfs(1 - who, pre, 2);       }     else       for (int i = 0; i < t[1 - who]; i++) {         int pre = (pos - arr[1 - who][i] + n) % n;         dfs(1 - who, pre, 1);       }   }   void print() {     for (int i = 0; i < 2; i++)       for (int j = 1; j < n; j++)         printf( %s%c , str[stat[i][j]],    n [j == n - 1]);   }   int main() {     R(n);     for (int i = 0; i < 2; i++) {       R(t[i]);       for (int j = 0; j < t[i]; j++) R(arr[i][j]);     }     for (int i = 0; i < 2; i++)       for (int j = 0; j < n; j++) cnt[i][j] = t[i];     stat[0][0] = stat[1][0] = 2;     for (int i = 0; i < 2; i++)       for (int j = 0; j < t[i]; j++) dfs(i, n - arr[i][j], 1);     print();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int kk[7];   int main() {     string s;     cin >> s;     int n = s.length();     sort(s.begin(), s.end());     for (int i = 0, j; i < n; i = j) {       j = i + 1;       while (j < n && s[j] == s[i]) j++;       kk[j - i]++;     }     int ans;     if (kk[6] == 1 || kk[5] == 1 && kk[1] == 1)       ans = 1;     else if (kk[4] == 1 || kk[3] == 2)       ans = 2;     else if (kk[3] == 1 && kk[2] == 1 && kk[1] == 1)       ans = 3;     else if (kk[3] == 1 && kk[1] == 3)       ans = 5;     else if (kk[2] == 3)       ans = 6;     else if (kk[2] == 2 && kk[1] == 2)       ans = 8;     else if (kk[2] == 1 && kk[1] == 4)       ans = 15;     else       ans = 30;     cout << ans <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t--) {       long long int a, b, x, y, n;       cin >> a >> b >> x >> y >> n;       cout << min(max(x, a - n) * max(y, b - n + min(n, a - x)),                   max(y, b - n) * max(x, a - n + min(n, b - y)))            << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long n;     cin >> n;     string s;     cin >> s;     if (n % 4 != 0) {       cout <<  === ;       return 0;     }     vector<long long> v(5, 0);     for (long long i = 0; i < n; i++) {       if (s[i] ==  A ) {         v[0]++;       }       if (s[i] ==  C ) {         v[1]++;       }       if (s[i] ==  G ) {         v[2]++;       }       if (s[i] ==  T ) {         v[3]++;       }       if (s[i] ==  ? ) {         v[4]++;       }     }     long long max1 = max(v[0], max(v[1], v[2]));     long long maxov = max(max1, v[3]);     long long reqd = 4 * maxov - v[0] - v[1] - v[2] - v[3];     bool check = false;     if (v[4] >= reqd && (v[4] - reqd) % 4 == 0) {       check = true;     }     if (check == false) {       cout <<  === ;     } else {       long long reqda = maxov - v[0] + ((v[4] - reqd) / 4);       long long reqdc = maxov - v[1] + ((v[4] - reqd) / 4);       long long reqdg = maxov - v[2] + ((v[4] - reqd) / 4);       long long reqdt = maxov - v[3] + ((v[4] - reqd) / 4);       for (long long i = 0; i < n; i++) {         if (s[i] !=  ? ) {           cout << s[i];         } else {           if (reqda > 0) {             cout <<  A ;             reqda--;             continue;           }           if (reqdc > 0) {             cout <<  C ;             reqdc--;             continue;           }           if (reqdg > 0) {             cout <<  G ;             reqdg--;             continue;           }           if (reqdt > 0) {             cout <<  T ;             reqdt--;           }         }       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int64_t v[200005] = {0};   int64_t fnc(int64_t h, int n) {     int64_t mn = v[0];     for (int i = 1; i < n; i++) {       v[i] += v[i - 1];       mn = min(mn, v[i]);     }     if (v[n - 1] >= 0 && h + mn > 0) return -1;     int64_t ans = 0;     if (h + mn <= 0) {       for (int i = 0; i < n; i++)         if (h + v[i] <= 0) return i + 1;     }     int64_t t = ceil(((-mn - h) * 1.0) / v[n - 1]);     if (t < 0) t = 0;     ans += n * t;     h = h + t * v[n - 1];     for (int i = 0; i < n; i++) {       if (h + v[i] <= 0) {         ans += i + 1;         break;       }     }     return ans;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int m;     int64_t h;     cin >> h >> m;     for (int i = 0; i < m; i++) cin >> v[i];     cout << fnc(h, m) << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     ;     long long n, k, ans = 1e11;     string s;     cin >> n;     if (n == 1 || n == 2) {       cout <<  No  << endl;       return 0;     }     cout <<  Yes  << endl;     set<long long> s1, s2;     for (long long i = 1; i < n + 1; i++) {       i % 2 ? s1.insert(i) : s2.insert(i);     }     cout << s2.size() <<    ;     for (auto i : s2) cout << i <<    ;     cout << endl;     cout << s1.size() <<    ;     for (auto i : s1) cout << i <<    ;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e3 + 5;   int n;   double p[N][N], E[N], g[N], f[N];   bool vis[N];   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++)       for (int j = 1; j <= n; j++) scanf( %lf , &p[i][j]), p[i][j] /= 100.0;     for (int i = 1; i <= n; i++) g[i] = 1 - p[i][n];     vis[n] = 1;     for (int i = 1; i <= n; i++) {       double mn = 1e18;       int id = 0;       for (int j = 1; j <= n; j++)         if (!vis[j] && (f[j] + 1) / (1 - g[j]) < mn) {           mn = (f[j] + 1) / (1 - g[j]);           id = j;         }       vis[id] = 1;       E[id] = (f[id] + 1) / (1 - g[id]);       for (int j = 1; j <= n; j++)         if (!vis[j])           f[j] += g[j] * p[j][id] * E[id], g[j] = g[j] * (1 - p[j][id]);     }     printf( %.6lf n , E[1]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<int64_t> v[3001];   int64_t calc(int64_t taken, int64_t n, int64_t m) {     int64_t req = taken - v[0].size();     int64_t t = v[0].size();     int64_t ans = 0;     vector<int64_t> rem;     for (int64_t i = 1; i < m; i++) {       if (v[i].size() == 0) continue;       for (int64_t j = 0; j < v[i].size(); j++) {         if (j + taken <= v[i].size()) {           ans += v[i][j];           req--;         } else           rem.push_back(v[i][j]);       }     }     if (req > 0) {       sort(rem.begin(), rem.end());       int64_t i = 0;       while (req > 0 and i < rem.size()) {         ans += rem[i];         i++;         req--;       }     }     return ans;   }   void solve() {     int64_t n, m, i, ans;     cin >> n >> m;     for (int64_t i = 0; i < n; i++) {       int64_t p, c;       cin >> p >> c;       p--;       v[p].push_back(c);     }     for (int64_t i = 0; i < m; i++) {       sort(v[i].begin(), v[i].end());     }     ans = LLONG_MAX;     for (int64_t i = 1; i <= n; i++) {       int64_t curr_cost = calc(i, n, m);       ans = min(ans, curr_cost);     }     cout << ans <<   n ;   }   signed main() {     std::ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     solve();     cerr <<   Execution :   << (1.0 * clock()) / CLOCKS_PER_SEC <<  s  n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int INF = 1e9;   long long n, m, b, ans;   long long a[1005];   int l, r, mid;   long long dp[1005][1005];   struct Node {     long long w, id;   } f[1005];   bool cmp(Node a, Node b) {     if (a.w != b.w) return a.w < b.w;     return a.id > b.id;   }   int main() {     cin >> n >> m;     for (int i = 1; i <= n; ++i) cin >> a[i];     for (int i = 1; i <= n + 1; ++i)       for (int j = 0; j <= n + 1; ++j) dp[i][j] = 1e18;     dp[n + 1][0] = 0;     for (int i = n; i >= 1; --i) {       for (int j = 0; j <= n; ++j)         dp[i][j] = min(dp[i][j], max(0LL, dp[i + 1][j] - a[i]));       for (int j = 1; j <= n; ++j) dp[i][j] = min(dp[i][j], dp[i + 1][j - 1]);     }     for (int i = 0; i <= n; ++i) {       f[i].w = dp[1][i];       f[i].id = i;     }     sort(f, f + n + 1, cmp);     for (int i = 1; i <= m; ++i) {       cin >> b;       l = 0;       r = n;       ans = -1;       while (l <= r) {         mid = (l + r) / 2;         if (f[mid].w <= b) {           ans = f[mid].id;           l = mid + 1;         } else           r = mid - 1;       }       cout << ans << endl;     }     return 0;   }
#include <bits/stdc++.h>   int main() {     double y1, y2, yw, xb, yb, r, A, B, C;     scanf( %lf%lf%lf%lf%lf%lf , &y1, &y2, &yw, &xb, &yb, &r);     yw -= r;     y1 += r;     yb = 2 * yw - yb;     A = y1 - yb;     B = xb;     C = -B * y1 + B * y2;     if ((C / sqrt(A * A + B * B)) <= r) {       printf( -1 );       return 0;     }     C = -B * y1;     printf( %.10lf , (-C - B * yw) / A);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, a[200010], t[200010], pos[200010], ans[200010];   struct point {     int pos, v, f;     point(int pos, int v, int f) : pos(pos), v(v), f(f) {}   };   vector<point> v[200010];   inline void insert(int x) {     for (register int i = x; i <= n; i += i & -i) t[i]++;   }   inline int find(int x) {     register int ans = 0;     for (register int i = x; i; i -= i & -i) ans += t[i];     return ans;   }   inline void add(int x, int y, int f, int i) { v[x].push_back(point(i, y, f)); }   inline int read() {     register int x = 0, ch = getchar();     while (!isdigit(ch)) ch = getchar();     while (isdigit(ch)) x = x * 10 + ch -  0 , ch = getchar();     return x;   }   int main() {     n = read(), m = read();     for (register int i = 1; i <= n; i++) pos[a[i] = read()] = i;     for (register int i = 1; i <= m; i++) {       int l = read(), r = read();       add(r, r, 1, i), add(l - 1, r, -1, i), add(r, l - 1, -1, i),           add(l - 1, l - 1, 1, i);     }     for (register int i = 1; i <= n; i++) {       for (register int j = a[i]; j <= n; j += a[i]) insert(pos[j]);       for (register int j = 0; j < v[i].size(); j++)         ans[v[i][j].pos] += find(v[i][j].v) * v[i][j].f;     }     for (register int i = 1; i <= m; i++) printf( %d n , ans[i]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, k;   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> n >> k;     vector<pair<int, int> > v(n), ans;     for (int i = 0; i < n; ++i) cin >> v[i].first, v[i].second = i;     while (k--) {       sort(v.begin(), v.end());       if (v.back().first - v[0].first > 1)         --v.back().first, ++v[0].first,             ans.push_back({v.back().second, v[0].second});     }     sort(v.begin(), v.end());     cout << v.back().first - v[0].first <<     << ans.size() <<   n ;     for (auto it : ans) cout << it.first + 1 <<     << it.second + 1 <<   n ;     return 0;   }
#include <bits/stdc++.h>   #pragma GCC optimize( O3 )   #pragma GCC target( sse4 )   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;     }   };   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long n, x;     cin >> n >> x;     x--;     vector<long long> a(n);     for (long long i = 0; i < n; i++) cin >> a[i];     long long mn = a[x];     for (long long i = 0; i < n; i++) {       if (a[i] < mn) {         mn = a[i];       }     }     long long ans = mn * n;     while (a[x] != mn) {       a[x]--;       ans++;       x--;       if (x < 0) x = n - 1;     }     for (long long i = 0; i < n; i++) cout << (i == x ? ans : a[i] - mn) <<    ;     cout <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int M = 2e5 + 10;   int n, k, m, kk, x, b[M];   int main() {     int T;     cin >> T;     while (T--) {       cin >> n >> k;       kk = 1;       m = 0;       for (int i = 1; i <= n; i++) {         cin >> x;         if (x % 2) {           m++;           if (kk < k) {             b[kk] = i;             kk++;           }         }       }       if ((m - k + 1) % 2 == 1 && kk == k) {         cout <<  YES  << endl;         for (int i = 1; i < kk; i++) cout << b[i] <<    ;         cout << n << endl;       } else         cout <<  NO  << endl;     }     return 0;   }