malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   int arr[250];   int ans[250];   int main() {     int num;     int clr;     scanf( %d%d , &num, &clr);     for (int i = 1; i <= num; ++i) {       scanf( %d , &arr[i]);     }     int res = 0;     for (int i = 1; i <= clr; ++i) {       scanf( %d , &ans[i]);       res += ans[i];     }     std::queue<int> que;     for (int i = 1; i <= num; ++i) {       --ans[arr[i]];       --res;       que.push(arr[i]);       while (ans[arr[i]] < 0) {         int now = que.front();         que.pop();         ++ans[now];         ++res;       }       if (res == 0) {         puts( YES );         return 0;       }     }     puts( NO );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 200200;   const long long MOD = (int)1e9 + 7;   const long long INF = (long long)2e18;   const int C = 2e4 + 10;   long long add(long long a, long long b) { return (a + b) % MOD; }   long long sub(long long a, long long b) {     a -= b;     a %= MOD;     if (a < 0) a += MOD;     return a;   }   long long mult(long long a, long long b) { return (a * b) % MOD; }   long long bin_pow(long long a, long long n) {     long long res = 1;     while (n) {       if (n & 1) res = mult(res, a);       a = mult(a, a);       n /= 2;     }     return res;   }   long long divide(long long a, long long b) {     return mult(a, bin_pow(b, MOD - 2));   }   bool is_inf(long long a, long long b) {     if ((long double)a * b > 2 * INF) return true;     return a * b > INF;   }   int n;   long long a[MAXN];   int nxt[MAXN];   void solve() {     long long k;     scanf( %d%lld , &n, &k);     for (int i = 0; i < n; ++i) scanf( %lld , &a[i]);     nxt[n] = n;     for (int i = n - 1; i >= 0; --i) {       if (a[i] != 1)         nxt[i] = i;       else         nxt[i] = nxt[i + 1];     }     long long ans = 0;     for (int i = 0; i < n; ++i) {       long long p = a[i];       long long s = a[i] * k;       for (int j = i + 1; j <= n; ++j) {         if (p == s) ++ans;         if (j == n) break;         if (is_inf(p, a[j])) break;         if (a[j] == 1) {           long long len = nxt[j] - j;           if (p > s && p < s + len * k) {             if ((p - s) % k == 0) ++ans;           }           s += len * k;           j = nxt[j] - 1;           continue;         }         p *= a[j];         s += a[j] * k;       }     }     printf( %lld n , ans);   }   int main() {     solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1000005;   long long fac[N], dp[N];   int mod = 1000000007;   long long pow(int a, int b, int MOD) {     long long x = 1, y = a;     while (b > 0) {       if (b % 2 == 1) {         x = (x * y);         if (x > MOD) x %= MOD;       }       y = (y * y);       if (y > MOD) y %= MOD;       b /= 2;     }     return x % MOD;   }   long long ncr(int n, int r) {     long long temp = (fac[r] * fac[n - r]) % mod;     return (fac[n] * pow(temp, mod - 2, mod)) % mod;   }   int main() {     int n, i, k;     long long temp;     fac[0] = 1;     for (i = 1; i < N; i++) {       fac[i] = (fac[i - 1] * i) % mod;     }     scanf( %d%d , &n, &k);     for (i = k + 1; i <= n; i++) {       dp[i] = (i * dp[i - 1]) % mod;       temp = (fac[k] * ncr(i - 1, k)) % mod;       dp[i] += (((fac[i - k - 1] - dp[i - k - 1]) % mod + mod) * temp) % mod;       dp[i] %= mod;     }     long long ans = 0;     for (i = 1; i <= n; i++) {       temp = (ncr(n - 1, i - 1) * dp[i - 1]) % mod;       temp = (temp * fac[n - i]) % mod;       ans += temp;       ans %= mod;     }     printf( %lld , ans);   }
#include <bits/stdc++.h>   using namespace std;   int t;   long long b[3000000];   pair<long long, long long> a[3000000];   int main() {     cin >> t;     while (t--) {       int n;       cin >> n;       for (int i = 0; i < n; ++i) {         scanf( %lld%lld , &a[i].first, &a[i].second);       }       for (int i = 0; i < n; ++i) {         b[(i + 1) % n] = a[(i + 1) % n].first - a[i].second;       }       long long ans = a[0].first, anw = 1e18;       for (int i = 1; i < n; ++i) {         if (b[i] > 0) {           ans += b[i];         }       }       anw = min(ans, anw);       for (int i = 1; i < n; ++i) {         ans -= a[i - 1].first;         if (b[i] > 0) {           ans -= b[i];         }         ans += a[i].first;         if (b[i - 1] > 0) {           ans += b[i - 1];         }         anw = min(ans, anw);       }       printf( %lld n , anw);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, a, b, k, q;   int added[200055];   struct BIT {     int dat[200055];     void add(int id, int val) {       while (id < n) {         dat[id] += val;         id |= (id + 1);       }     }     int sum(int id) {       int ret = 0;       while (id >= 0) {         ret += dat[id];         id = (id & (id + 1)) - 1;       }       return ret;     }   } B1, B2;   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cin >> n >> k >> a >> b >> q;     int ope, x, y;     while (q--) {       cin >> ope;       if (ope == 1) {         cin >> x >> y;         x--;         if (added[x] < b) {           B2.add(x, min(y, b - added[x]));         }         if (added[x] < a) {           B1.add(x, min(y, a - added[x]));           added[x] = min(a, added[x] + y);         }       } else {         cin >> x;         x--;         y = x + k - 1;         cout << B1.sum(n - 1) - B1.sum(y) + B2.sum(x - 1) <<   n ;       }     }     return 0;   }
#include <bits/stdc++.h>   #pragma comment(linker,  /stack:200000000 )   #pragma GCC optimize( O3 )   using namespace std;   const double eps = 1e-9;   const double pi = acos(-1.0);   const int inf = 2e5 + 10;   int mod = 1e9 + 7;   const int MAXN = 1e5 + 7;   long double C(int n, int k) {     long double res = 1.;     if (2 * k > n) k = n - k;     for (int i = 1; i <= k; ++i) {       res *= n - k + i;       res /= i;     }     return res;   }   int32_t main() {     ios_base::sync_with_stdio(0);     cout << fixed << setprecision(10);     cin.tie(0);     int n, m;     cin >> n >> m;     long double res = 0;     for (int k = 1; k <= min(n, m); ++k) {       res += C(m, k) * C(m * (n - 1), n - k) * k * k;     }     res /= n;     res /= C(n * m, n);     cout << res;     return 0;   }
#include <bits/stdc++.h>      using namespace std;   #define int long long      int scalar(int Ax, int Ay, int Bx, int By) {       return Ax * Bx + Ay * By;   }      bool isok(int x1, int y1, int x2, int y2, int x3, int y3) {       int Ax = x1 - x2;       int Ay = y1 - y2;       int Bx = x3 - x2;       int By = y3 - y2;       if (scalar(Ax, Ay, Bx, By) <= 0) {           return false;       } else {           return true;       }   }      vector<pair<int, int>> points;   vector<int> per;      void add(int id) {       if (per.size() <= 1) {           per.push_back(id);           return;       }       vector<int> new_p;       for (int i = per.size() - 2; i >= 0; --i) {           if (isok(points[per[i]].first, points[per[i]].second, points[per[i + 1]].first, points[per[i + 1]].second,                    points[id].first, points[id].second)) {               for (int j = 0; j <= i + 1; ++j) {                   new_p.push_back(per[j]);               }               new_p.push_back(id);               for (int k = i + 2; k < per.size(); ++k) {                   new_p.push_back(per[k]);               }               break;           }       }       if (new_p.size() == 0) {           reverse(per.begin(), per.end());           for (int i = per.size() - 2; i >= 0; --i) {               if (isok(points[per[i]].first, points[per[i]].second, points[per[i + 1]].first, points[per[i + 1]].second,                        points[id].first, points[id].second)) {                   for (int j = 0; j <= i + 1; ++j) {                       new_p.push_back(per[j]);                   }                   new_p.push_back(id);                   for (int k = i + 2; k < per.size(); ++k) {                       new_p.push_back(per[k]);                   }                   break;               }           }       }       per = new_p;   }      signed main() {       cin.tie();       cout.tie();       ios_base::sync_with_stdio(false);       int n;       cin >> n;       for (int i = 0; i < n; ++i) {           int x, y;           cin >> x >> y;           points.push_back({x, y});           add(i);       }       for (int j = 0; j < per.size(); ++j) {           cout << per[j] + 1 <<    ;       }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     string s;     cin >> s;     int k;     cin >> k;     int a[26];     int maxi = 0;     for (int i = 0; i < 26; ++i) {       cin >> a[i];       maxi = max(maxi, a[i]);     }     int val = 0;     for (int i = 0; i < s.size(); ++i) {       val += a[s[i] - 97] * (i + 1);     }     for (int i = 0; i < k; ++i) {       val += maxi * (s.size() + i + 1);     }     cout << val;   }
#include <bits/stdc++.h>   using namespace std;   long long qk(long long x, long long y) {     long long ans = 1;     while (y) {       if (y & 1) ans = ans * x % 1000000007;       y >>= 1;       x = x * x % 1000000007;     }     return ans;   }   const int dx[8] = {0, -1, 0, 1, -1, -1, 1, 1},             dy[8] = {-1, 0, 1, 0, -1, 1, -1, 1};   const int dxx[8] = {2, 1, -1, -2, -2, -1, 1, 2},             dyy[8] = {1, 2, 2, 1, -1, -2, -2, -1};   long long a[100005], b[100005];   void solve() {     long long n, p;     scanf( %lld%lld , &n, &p);     for (int i = 1; i <= n; i++) {       long long x, y;       scanf( %lld%lld , &x, &y);       a[i] = y / p - (x - 1) / p;       b[i] = y - x + 1;     }     double ans = 0;     for (int i = 1; i < n; i++) {       double num = a[i] * b[i + 1];       num += a[i + 1] * (b[i] - a[i]);       ans += 2000.0 * num / (double)(b[i] * b[i + 1]);     }     double num = a[n] * b[1];     num += a[1] * (b[n] - a[n]);     ans += 2000.0 * num / (double)(b[n] * b[1]);     printf( %.7lf n , ans);   }   int main() {     solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <typename T>   void read(T &t) {     t = 0;     char ch = getchar();     int f = 1;     while ( 0  > ch || ch >  9 ) {       if (ch ==  - ) f = -1;       ch = getchar();     }     do {       (t *= 10) += ch -  0 ;       ch = getchar();     } while ( 0  <= ch && ch <=  9 );     t *= f;   }   const long long INF = 1e16;   const int maxn = (2e5) + 10;   int n, m, k, s[maxn], t[maxn], d[maxn], w[maxn], t1, t2;   long long dp[maxn / 2][210], ans;   struct cmp {     bool operator()(pair<pair<int, int>, int> a, pair<pair<int, int>, int> b) {       if (a > b) return 0;       return 1;     }   };   priority_queue<pair<pair<int, int>, int>, vector<pair<pair<int, int>, int> >,                  cmp>       q;   struct node {     int pos, P;   } a[maxn], b[maxn];   int vis[maxn], u[maxn];   bool cmp2(node x, node y) { return x.pos < y.pos; }   int main() {     read(n);     read(m);     read(k);     for (int i = 1; i <= k; i++) {       read(s[i]), read(t[i]), read(d[i]), read(w[i]);       a[++t1] = (node){s[i], i};       b[++t2] = (node){t[i], i};     }     sort(a + 1, a + t1 + 1, cmp2);     sort(b + 1, b + t2 + 1, cmp2);     int I1 = 1, I2 = 1;     for (int i = 1; i <= n; i++) {       while (I1 <= t1 && a[I1].pos == i) {         q.push(make_pair(make_pair(w[a[I1].P], d[a[I1].P]), a[I1].P));         I1++;       }       u[i] = -1;       while (!q.empty()) {         pair<pair<int, int>, int> A = q.top();         u[i] = A.second;         if (!vis[u[i]])           break;         else           q.pop(), u[i] = -1;       }       while (I2 <= t2 && b[I2].pos == i) {         vis[b[I2].P] = 1;         I2++;       }     }     ans = INF;     for (int i = n; i >= 1; i--) {       for (int j = 0; j <= m; j++) {         if (u[i] != -1)           dp[i][j] = dp[d[u[i]] + 1][j] + w[u[i]];         else           dp[i][j] = dp[i + 1][j];         if (j) dp[i][j] = min(dp[i + 1][j - 1], dp[i][j]);         if (i == 1) ans = min(ans, dp[i][j]);       }     }     printf( %lld n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long M = 2e5 + 7, MOD = 1e9;   long long cnt = 0;   long long arr[M], arrr[M];   long long sum, sum1, mx = 0;   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     long long t;     cin >> t;     for (int i = 0; i < t; i++) cin >> arr[i];     for (int i = 0; i < t; i++) {       cin >> arrr[i];     }     for (int i = 0; i < t; i++) {       sum = arr[i];       sum1 = arrr[i];       mx = max(mx, sum + sum1);       for (int j = i + 1; j < t; j++) {         sum = sum | arr[j];         sum1 = sum1 | arrr[j];         mx = max(mx, sum + sum1);       }     }     cout << mx << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e6 + 50;   vector<int> g[maxn];   int n, k;   int ans = 0;   int dfs(int u, int p) {     if (g[u].size() == 1) return 0;     vector<int> vt;     for (auto it : g[u]) {       if (it != p) {         vt.push_back(dfs(it, u) + 1);       }     }     sort(vt.begin(), vt.end());     while (int(vt.size()) >= 2) {       if (vt.back() + vt[int(vt.size()) - 2] <= k) break;       ++ans;       vt.pop_back();     }     return vt.back();   }   int main() {     ios::sync_with_stdio(false);     cin.tie();     cout.tie();     cin >> n >> k;     for (int i = 1; i < n; i++) {       int u, v;       cin >> u >> v;       g[u].push_back(v);       g[v].push_back(u);     }     for (int i = 1; i <= n; i++) {       if (int(g[i].size()) > 1) {         dfs(i, -1);         break;       }     }     cout << ans + 1 << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   queue<int> fila[100000 + 10];   int bit[100000 + 10];   int rsp[100000 + 10];   pair<pair<int, int>, int> q[100000 + 10];   int v[100000 + 10];   int ls[100000 + 10];   void add(int p, int v) {     if (p == 0) return;     for (; p <= 100000; p += (p & (-p))) bit[p] += v;   }   int get(int p) {     int ret = 0;     for (; p > 0; p -= (p & (-p))) ret += bit[p];     return ret;   }   int main() {     int n, m;     scanf( %d %d , &n, &m);     memset(bit, 0, sizeof(bit));     for (int i = 1; i <= n; i++) scanf( %d , &v[i]), ls[i] = -1, fila[i].push(0);     for (int i = 1; i <= m; i++) {       scanf( %d %d , &q[i - 1].first.second, &q[i - 1].first.first);       q[i - 1].second = i - 1;     }     sort(q, q + m);     int ind = 0;     for (int i = 1; i <= n; i++) {       if (v[i] <= n) {         if (ls[v[i]] != -1) {           add(ls[v[i]] + 1, -1);           add(fila[v[i]].front() + 1, +1);         }         if (fila[v[i]].size() == v[i]) {           add(fila[v[i]].front() + 1, +1);           ls[v[i]] = fila[v[i]].front();           fila[v[i]].pop();           fila[v[i]].push(i);           add(fila[v[i]].front() + 1, -1);         } else           fila[v[i]].push(i);       }       while (ind < m && q[ind].first.first == i) {         rsp[q[ind].second] = get(q[ind].first.second);         ind++;       }     }     for (int i = 0; i < m; i++) {       printf( %d n , rsp[i]);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   inline int read() {     int res = 0, f = 1;     char ch = getchar();     while (!isdigit(ch)) {       if (ch ==  - ) f = -f;       ch = getchar();     }     while (isdigit(ch)) {       res = (res << 1) + (res << 3) + (ch ^ 48);       ch = getchar();     }     return res * f;   }   const int N = 200005;   int n, m, root;   int ls[N], rs[N], val[N], key[N], cnt[N], add[N], ans[N];   inline void pushdown(int v) {     if (add[v]) {       add[ls[v]] += add[v];       add[rs[v]] += add[v];       val[ls[v]] += add[v];       val[rs[v]] += add[v];       add[v] = 0;     }     if (ans[v]) {       ans[ls[v]] += ans[v];       ans[rs[v]] += ans[v];       cnt[ls[v]] += ans[v];       cnt[rs[v]] += ans[v];       ans[v] = 0;     }   }   void split(int k, int &x, int &y, int v) {     if (!k) {       x = y = 0;       return;     }     pushdown(k);     if (val[k] < v)       x = k, split(rs[k], rs[x], y, v);     else       y = k, split(ls[k], x, ls[y], v);   }   int merge(int x, int y) {     if (!x || !y) return x + y;     if (key[x] < key[y]) {       pushdown(x);       rs[x] = merge(rs[x], y);       return x;     } else {       pushdown(y);       ls[y] = merge(x, ls[y]);       return y;     }   }   int insert(int x, int y) {     int rt1 = 0, rt2 = 0;     split(x, rt1, rt2, val[y]);     rt1 = merge(rt1, y);     x = merge(rt1, rt2);     return x;   }   int build(int v, int y) {     if (!v) return y;     pushdown(v);     y = build(ls[v], y);     y = build(rs[v], y);     ls[v] = rs[v] = 0;     return insert(y, v);   }   void dfs(int v) {     if (!v) return;     pushdown(v);     dfs(ls[v]);     dfs(rs[v]);   }   pair<int, int> a[N];   int main() {     scanf( %d , &n);     for (int i = 1, c, q; i <= n; i++) {       scanf( %d%d , &c, &q);       a[i] = make_pair(-q, c);     }     sort(a + 1, a + 1 + n);     scanf( %d , &m);     for (int i = 1; i <= m; i++) {       scanf( %d , &val[i]);       key[i] = rand();       root = insert(root, i);     }     for (int i = 1; i <= n; i++) {       int c = a[i].second;       int r1 = 0, r2 = 0, r3 = 0, r4 = 0;       split(root, r1, r2, c);       val[r2] -= c;       add[r2] -= c;       cnt[r2]++;       ans[r2]++;       split(r2, r3, r4, c - 1);       r1 = build(r3, r1);       root = merge(r1, r4);     }     dfs(root);     for (int i = 1; i <= m; i++) printf( %d  , cnt[i]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int Ans, Cap[55][55], From[55], K, N, T[55];   vector<int> E[55];   bool dijkstra() {     priority_queue<pair<int, int>, vector<pair<int, int>>,                    greater<pair<int, int>>>         q;     vector<int> d(55, 1005);     d[1] = 0;     q.push(make_pair(0, 1));     while (!q.empty()) {       pair<int, int> p = q.top();       q.pop();       int n = p.second, c = p.first;       if (n == N) return true;       for (int i = 1; i <= N; i++)         if (Cap[n][i] && c < d[i]) {           d[i] = c;           From[i] = n;           T[i] = 0;           q.push(make_pair(c, i));         }       for (int v : E[n])         if (c + 1 < d[v]) {           d[v] = c + 1;           From[v] = n;           T[v] = 1;           q.push(make_pair(c + 1, v));         }     }     return false;   }   int main() {     cin >> N >> K;     for (int i = 1; i <= N; i++)       for (int j = 1; j <= N; j++) {         cin >> Cap[i][j];         if (Cap[i][j]) E[i].push_back(j);       }     while (true) {       if (!dijkstra()) break;       int cost = 0, flow = 1000000, n = N;       while (From[n] > 0) {         if (T[n] == 0) flow = min(flow, Cap[From[n]][n]);         n = From[n];       }       n = N;       while (From[n] > 0) {         if (T[n])           cost++;         else           Cap[From[n]][n] -= flow, Cap[n][From[n]] += flow;         n = From[n];       }       if (cost * flow <= K) {         K -= cost * flow;         Ans += flow;       } else {         Ans += K / cost;         break;       }     }     cout << Ans;   }
#include <bits/stdc++.h>   using namespace std;   template <typename... T>   void read(T &...args) {     ((cin >> args), ...);   }   template <typename... T>   void write(T... args) {     ((cout << args <<    ), ...);     cout <<   n ;   }   long long gcd(long long a, long long b) {     if (b > a) {       return gcd(b, a);     }     if (b == 0) {       return a;     }     return gcd(b, a % b);   }   long long add(long long a, long long b) {     a = a % 1000000007;     b = b % 1000000007;     return (((a + b) % 1000000007) + 1000000007) % 1000000007;   }   long long sub(long long a, long long b) {     a = a % 1000000007;     b = b % 1000000007;     return (((a - b) % 1000000007) + 1000000007) % 1000000007;   }   long long mul(long long a, long long b) {     a = a % 1000000007;     b = b % 1000000007;     return (((a * b) % 1000000007) + 1000000007) % 1000000007;   }   long long power(long long x, long long y) {     long long res = 1;     x = x % 1000000007;     if (x == 0) return 0;     while (y > 0) {       if (y & 1) {         res = (res * x) % 1000000007;       }       y = y >> 1;       x = (x * x) % 1000000007;     }     return res;   }   long long find(vector<long long> &parent, long long x) {     if (parent[x] != x) parent[x] = find(parent, parent[x]);     return parent[x];   }   void join(vector<long long> &parent, vector<long long> &rank, long long x,             long long y) {     long long xParent = find(parent, x);     long long yParent = find(parent, y);     if (xParent == yParent) return;     if (rank[xParent] > rank[yParent]) {       parent[yParent] = xParent;     } else if (rank[xParent] < rank[yParent]) {       parent[xParent] = yParent;     } else {       parent[xParent] = yParent;       rank[yParent]++;     }   }   void solve() {     long long n, m, k;     read(n, m, k);     vector<vector<long long> > mat(n, vector<long long>(m, 0));     for (long long i = 0; i < n; i++) {       string str;       cin >> str;       for (long long j = 0; j < m; j++) {         if (str[j] ==  * ) mat[i][j] = 1;       }     }     for (long long i = 0; i < n; i++) {       for (long long j = 0; j < m; j++) {         if (mat[i][j] == 0) continue;         long long len = 0;         while (j - len >= 0 && i - len >= 0 && j + len < m) {           if (mat[i - len][j - len] == 0 || mat[i - len][j + len] == 0) break;           len++;         }         len--;         if (len >= k) {           for (long long p = 0; p < len + 1; p++) {             mat[i - p][j - p] = 2;             mat[i - p][j + p] = 2;           }         }       }     }     bool found = false;     for (long long i = 0; i < n; i++) {       for (long long j = 0; j < m; j++) {         if (mat[i][j] == 1) found = true;       }     }     if (found)       write( NO );     else       write( YES );   }   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     long long iter;     cin >> iter;     while (iter) {       solve();       iter--;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t--) {       int n, last = 0, count = 0, sum, sum1;       cin >> n;       while (n >= 10) {         last = n / 10;         n = n / 10;         count += 1;       }       if (count + 1 == 1)         sum1 = 1;       else if (count + 1 == 2)         sum1 = 3;       else if (count + 1 == 3)         sum1 = 6;       else if (count + 1 == 4)         sum1 = 10;       sum = (last - 1) * 10 + sum1;       if (n > 10)         cout << sum << endl;       else {         last = n;         sum = (last - 1) * 10 + sum1;         cout << sum << endl;       }     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     long long int M, k, Q, sum = 0, a = 1, W;     vector<int> x;     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       scanf( %lld , &W);       for (int j = 0; j < W; j++) {         x.push_back(i);       }     }     scanf( %lld , &M);     for (k = 1; k <= M; k++) {       scanf( %lld , &Q);       printf( %d n , x[Q - 1]);     }     return 0;   }