malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   int read() {     int ans = 0, c, f = 1;     while (!isdigit(c = getchar()))       if (c ==  - ) f *= -1;     do ans = ans * 10 + c -  0 ;     while (isdigit(c = getchar()));     return ans * f;   }   const int N = 10050;   int n, A[N], B[N];   int m, a[N], b[N], c[N], d[N];   void por(int x1, int y1, int x2, int y2) {     a[m] = x1;     b[m] = y1;     c[m] = x2;     d[m] = y2;     ++m;   }   int main() {     n = read();     for (int i = 1; i <= n; ++i) A[i] = read();     for (int i = 1; i <= n; ++i) B[i] = read();     for (int k = 1; k <= n; ++k) {       int ti = 0, tj = 0;       for (int i = k; i <= n; ++i) {         if (A[i] == k) ti = i;         if (B[i] == k) tj = i;       }       if (ti == k && tj == k)         ;       else if (ti == k)         por(k, k, k, tj);       else if (tj == k)         por(k, k, ti, k);       else         por(ti, k, k, tj);       std::swap(A[k], A[ti]);       std::swap(B[k], B[tj]);     }     printf( %d n , m);     for (int i = 0; i < m; ++i) printf( %d %d %d %d n , a[i], b[i], c[i], d[i]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m, a, b;     cin >> n >> m >> a >> b;     int x = m - n, r = 0, t = 14;     if (b >= a && a * 8 < x) {       cout << -1;       return 0;     }     while (x > 0) {       if (10 <= t && t < 22)         x -= a;       else         x += b;       t++;       if (t == 24) r++, t = 0;     }     cout << r;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     string s, str[10];     cin >> s;     for (int i = 0; i < 10; i++) cin >> str[i];     for (int i = 0; i < s.length(); i += 10) {       string w;       for (int j = i; j < i + 10; j++) w = w + s[j];       for (int i = 0; i < 10; i++) {         if (w.compare(str[i]) == 0) {           cout << i;           break;         }       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   bool check(string &w, string &s, map<char, int> &cnt) {     int used[ z  -  a  + 1] = {};     int arr[ z  -  a  + 1] = {};     for (int i = 0; i < w.size(); ++i) {       if (w[i] !=  * ) {         used[w[i] -  a ] = 1;       }     }     for (int i = 0; i < w.size(); ++i) {       if (w[i] ==  * ) {         if (used[s[i] -  a ]) {           return false;         }         arr[s[i] -  a ] += 1;       } else if (w[i] != s[i]) {         return false;       }     }     for (int i = 0; i <  z  -  a  + 1; ++i) {       if (arr[i]) {         cnt[ a  + i] += 1;       }     }     return true;   }   int main() {     ios_base::sync_with_stdio(false);     int n;     cin >> n;     string w;     cin >> w;     map<char, int> cnt;     int k = 0;     int m;     cin >> m;     string s;     for (int i = 0; i < m; ++i) {       cin >> s;       if (check(w, s, cnt)) {         k++;       }     }     int ans = 0;     for (auto p : cnt) {       if (p.second == k) {         ans++;       }     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void solve() {     int n, h;     cin >> n >> h;     for (int i = 1; i < n; i++) printf( %.10f  , h * sqrt(1. * i / n));     puts(  );   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int t;     t = 1;     while (t--) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int INF = 1e9;   vector<int> primes(int n) {     vector<int> p(n + 1, 1);     for (int i = 2; i * i <= n; ++i)       if (p[i])         for (int j = i * i; j <= n; j += i) p[j] = 0;     vector<int> res;     for (int i = 2; i <= n; ++i)       if (p[i]) res.push_back(i);     return res;   }   int a[128], b[128];   int dp[128][1 << 16];   int pr[128][1 << 16];   int bit[64];   int main() {     int n;     cin >> n;     for (int i = 0; i < (int)(n); i++) cin >> a[i];     vector<int> prime = primes(54);     for (int i = 0; i < (int)(128); i++)       for (int j = 0; j < (int)(1 << 16); j++) dp[i][j] = INF;     dp[0][0] = 0;     for (int i = 0; i < (int)(64); i++)       for (int j = 0; j < (int)(16); j++)         if (i % prime[j] == 0) bit[i] += (1 << j);     for (int i = 0; i < (int)(n); i++)       for (int j = 0; j < (int)(1 << 16); j++) {         for (int k = 0; k < (int)(54); k++)           if ((bit[k] & j) == 0)             if (dp[i + 1][bit[k] | j] > dp[i][j] + abs(a[i] - k)) {               dp[i + 1][bit[k] | j] = dp[i][j] + abs(a[i] - k);               pr[i + 1][bit[k] | j] = k;             }       }     int pos = 0;     for (int i = 0; i < (int)(1 << 16); i++)       if (dp[n][pos] > dp[n][i]) pos = i;     vector<int> res;     for (int i = n; i > 0; --i) {       res.push_back(pr[i][pos]);       int k = pr[i][pos];       pos = pos - bit[k];     }     reverse((res).begin(), (res).end());     for (int i = 0; i < (int)(res.size()); i++) {       if (i > 0) cout <<    ;       cout << res[i];     }     cout << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 10005;   int gcd(int a, int b) { return !b ? a : gcd(b, a % b); }   int T, n, A, B, C, cnt, p[N], mu[N], du[N], fe[N], tot;   long long a[N], b[N], c[N];   bool np[N];   void init() {     mu[1] = 1;     for (int i = 2; i <= n; i++) {       if (!np[i]) p[++cnt] = i, mu[i] = -1;       for (int j = 1; j <= cnt && i * p[j] <= n; j++) {         np[i * p[j]] = 1;         if (i % p[j] == 0) break;         mu[i * p[j]] = -mu[i];       }     }   }   struct edge {     int u, v, w;   };   struct _ {     int v, w;   };   vector<_> G[N];   int main() {     n = 10000;     init();     scanf( %d%d%d , &A, &B, &C);     n = max(A, max(B, C));     for (int i = 0; i <= n; i++) a[i] = b[i] = c[i] = du[i] = 0, G[i].clear();     for (int i = 1; i <= A; i++)       for (int j = i; j <= A; j += i) a[i] += A / j;     for (int i = 1; i <= B; i++)       for (int j = i; j <= B; j += i) b[i] += B / j;     for (int i = 1; i <= C; i++)       for (int j = i; j <= C; j += i) c[i] += C / j;     long long ans = 0;     for (int i = 1; i <= n; i++)       ans += mu[i] * mu[i] * mu[i] * a[i] * b[i] * c[i];     vector<edge> e;     for (int d = 1; d <= n; d++)       for (int i = 1, l = n / d; i <= l; i++)         if (mu[i * d])           for (int j = i + 1, r = n / d / i; j <= r; j++)             if (mu[j * d] && gcd(i, j) == 1) {               int u = i * d, v = j * d, lcm = i * j * d;               ans += mu[u] * mu[u] * mu[v] *                      (a[u] * b[lcm] * c[lcm] + a[lcm] * b[u] * c[lcm] +                       a[lcm] * b[lcm] * c[u]);               ans += mu[u] * mu[v] * mu[v] *                      (a[v] * b[lcm] * c[lcm] + a[lcm] * b[v] * c[lcm] +                       a[lcm] * b[lcm] * c[v]);               ++du[u];               ++du[v];               e.push_back((edge){u, v, lcm});             }     for (auto &f : e)       if (du[f.u] > du[f.v] || (du[f.u] == du[f.v] && f.u < f.v))         G[f.u].push_back((_){f.v, f.w});       else         G[f.v].push_back((_){f.u, f.w});     for (int u = 1; u <= n; u++) {       for (auto &f : G[u]) fe[f.v] = f.w;       for (auto &f : G[u])         for (auto &p : G[f.v])           if (fe[p.v])             ans += mu[u] * mu[f.v] * mu[p.v] *                    (a[f.w] * b[p.w] * c[fe[p.v]] + a[f.w] * b[fe[p.v]] * c[p.w] +                     a[p.w] * b[f.w] * c[fe[p.v]] + a[fe[p.v]] * b[f.w] * c[p.w] +                     a[fe[p.v]] * b[p.w] * c[f.w] + a[p.w] * b[fe[p.v]] * c[f.w]);       for (auto &f : G[u]) fe[f.v] = 0;     }     printf( %d n , int(ans & ((1 << 30) - 1)));   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t, m, n, a, ans;     cin >> t;     while (t--) {       ans = 0;       cin >> n >> m;       for (int i = 0; i < n; i++) {         cin >> a;         ans += a;       }       if (n > m || n == 2)         cout <<  -1  << endl;       else {         cout << 2 * ans << endl;         for (int i = 1; i < n; i++) {           cout << i <<     << i + 1 << endl;         }         cout <<  1  <<     << n << endl;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     int n, k;     cin >> n >> k;     set<long long> myset;     for (int i = 0; i < n; i++) {       int c;       cin >> c;       myset.insert(c);     }     auto it = myset.begin();     int ans = 0;     do {       long long x = (*it) * k;       if (x != *it) {         if (myset.count(x)) myset.erase(x);       }       ans++;       if (it != myset.end()) it++;     } while (it != myset.end());     cout << ans;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5 + 5;   int n, k;   int a[maxn];   long long pre[maxn];   void read_input() {     cin >> n >> k;     for (int i = 1; i <= n; ++i) cin >> a[i];   }   void init() {     for (int i = 1; i <= n; ++i) pre[i] = pre[i - 1] + a[i];   }   vector<int> get_divs(int x) {     vector<int> res;     for (int i = 2; i * 1LL * i <= x; ++i)       if (x % i == 0) {         res.push_back(i);         if (i * i != x) res.push_back(x / i);       }     return res;   }   void solve() {     if (pre[n] % k != 0) {       cout <<  No n ;       return;     }     int x = pre[n] / k;     int cur = 1, lst = 0;     vector<int> ans;     for (int i = 1; i <= n; ++i)       if (pre[i] == cur * x) {         ans.push_back(i - lst);         lst = i;         ++cur;       }     if ((int)ans.size() != k) {       cout <<  No n ;       return;     }     cout <<  Yes n ;     for (auto& x : ans) cout << x <<    ;     cout <<   n ;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     read_input();     init();     solve();   }
#include <bits/stdc++.h>   using namespace std;   long long s, x;   int main() {     cin >> s >> x;     s -= x;     if (s < 0 || s % 2 != 0) {       cout << 0 << endl;       return 0;     }     s /= 2;     if (s & x) {       cout << 0 << endl;       return 0;     }     long long bit = 0, result = 0;     if (!s) result -= 2;     while (x > 0) {       bit += x & 1;       x >>= 1;     }     result += 1LL << bit;     cout << result << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long a, n, trans = 0, cnt = 0, b, c, m, s, d;     vector<int> v, vd;     cin >> n;     for (long long x = 0; x < n; x++) {       cin >> m;       v.clear();       for (long long j = 0; j < m; j++) {         cin >> d;         v.push_back(d);       }       sort(v.rbegin(), v.rend());       vd.clear();       trans = 0;       for (long long j = 1; j < v.size(); j++) {         if ((v[j] - v[0]) % 2 != 0) {           trans = 1;           cout <<  NO  << endl;           break;         }       }       if (trans == 0) cout <<  YES  << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   int a[303][303], dp[602][301][301], n;   bool valid(int x, int y) { return (x >= 0 && x < n && y >= 0 && y < n); }   int update(int d, int x1, int x2) {     if (x2 < x1) swap(x1, x2);     int y1 = d - x1, y2 = d - x2;     if (!valid(x1, y1) || !valid(x2, y2)) return INT_MIN;     if (dp[d][x1][x2] != INT_MIN) return dp[d][x1][x2];     for (long long mask = 0; mask < 4; mask++) {       dp[d][x1][x2] = max(dp[d][x1][x2],                           update(d - 1, x1 - (mask & 1), x2 - ((mask & 2) >> 1)));     }     if (dp[d][x1][x2] == INT_MIN) dp[d][x1][x2] = 0;     dp[d][x1][x2] += a[x1][y1] + (x1 != x2 ? a[x2][y2] : 0);     return dp[d][x1][x2];   }   int main() {     cin >> n;     for (long long i = 0; i < n; i++)       for (long long j = 0; j < n; j++) cin >> a[i][j];     for (long long i = 0; i < 2 * n; i++)       for (long long j = 0; j < n; j++)         for (long long k = 0; k < n; k++) dp[i][j][k] = INT_MIN;     cout << update(2 * n - 2, n - 1, n - 1) << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<pair<long int, long int>> adj[100001];   bool visit[100001] = {};   long int val[100001];   long int ans = 0;   void dfs(long int node, long int w) {     if (w > val[node]) {       return;     }     ans++;     for (long int i = 0; i < (int)adj[node].size(); i++) {       dfs(adj[node][i].first, max(w + adj[node][i].second, (long int)0));     }     return;   }   int main() {     long int n;     cin >> n;     for (long int i = 1; i <= n; i++) cin >> val[i];     for (long int i = 1; i <= n - 1; i++) {       long int x, y;       cin >> x >> y;       adj[x].push_back(make_pair(i + 1, y));     }     dfs(1, 0);     cout << n - ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   using namespace rel_ops;   struct Fraction {     long long p, q;     static inline __attribute__((always_inline)) long long gcd(long long a,                                                                long long b) {       while (b ^= a ^= b ^= a = a % b)         ;       return a;     }     inline __attribute__((always_inline)) void clear() { p = 0, q = 1; }     inline __attribute__((always_inline)) Fraction() { clear(); }     inline __attribute__((always_inline)) Fraction(long long a, long long b) {       p = a, q = b;     }     inline __attribute__((always_inline)) Fraction& simplify() {       long long x = gcd(p, q);       p /= x, q /= x;       return *this;     }     inline __attribute__((always_inline)) bool operator<(         const Fraction& rhs) const {       return p * rhs.q < rhs.p * q;     }     inline __attribute__((always_inline)) bool operator==(         const Fraction& rhs) const {       return p * rhs.q == rhs.p * q;     }   };   const int N = 1e5 + 5;   pair<Fraction, Fraction> d[N];   int n;   long long ans;   inline __attribute__((always_inline)) bool pffcomp(       const pair<Fraction, Fraction>& a, const pair<Fraction, Fraction>& b) {     return a.first < b.first || (a.first == b.first && a.second > b.second);   }   void mergesort(int l, int r) {     static pair<Fraction, Fraction> tmp[N];     if (l >= r) return;     int mid = (l + r) >> 1;     mergesort(l, mid);     mergesort(mid + 1, r);     int pl = l, pr = mid + 1, pt = l;     while (pl <= mid && pr <= r) {       if (d[pl].second < d[pr].second)         tmp[pt++] = d[pl++];       else {         ans += mid - pl + 1;         tmp[pt++] = d[pr++];       }     }     while (pl <= mid) tmp[pt++] = d[pl++];     while (pr <= r) tmp[pt++] = d[pr++];     for (pt = l; pt <= r; ++pt) d[pt] = tmp[pt];   }   int main() {     int w;     scanf( %d%d , &n, &w);     for (int i = 1, x, v; i <= n; ++i) {       scanf( %d%d , &x, &v);       d[i] = make_pair(Fraction(-x, v - w).simplify(),                        Fraction(-x, v + w).simplify());     }     sort(d + 1, d + 1 + n, pffcomp);     mergesort(1, n);     printf( %I64d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void imGonnaDoIt() {     long long r, x, y, xx, yy;     cin >> r >> x >> y >> xx >> yy;     cout << ceil(hypot((x - xx), (y - yy)) / (r * 2));   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     imGonnaDoIt();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     map<string, int> puncte, cnt, goluri, rateu;     int x, y;     char c1[25], c2[25];     for (int i = 0; i < 5; i++) {       scanf( %s%s%d:%d , c1, c2, &x, &y);       cnt[c1]++;       cnt[c2]++;       if (x > y) {         puncte[c1] += 3;       }       if (x < y) {         puncte[c2] += 3;       }       if (x == y) {         puncte[c1]++;         puncte[c2]++;       }       goluri[c1] += x;       rateu[c1] += y;       goluri[c2] += y;       rateu[c2] += x;     }     string czn;     vector<string> echipe;     for (auto &s : cnt) {       echipe.push_back(s.first);       if (s.second == 2 && s.first !=  BERLAND ) {         czn = s.first;       }     }     for (int i = 1; i < 100; i++) {       for (int j = 0; j < 100; j++) {         int k = i + j;         goluri[ BERLAND ] += k;         rateu[ BERLAND ] += j;         goluri[czn] += j;         rateu[czn] += k;         puncte[ BERLAND ] += 3;         vector<tuple<int, int, int, string>> w;         for (auto &s : echipe) {           w.push_back(               make_tuple(-puncte[s], -goluri[s] + rateu[s], -goluri[s], s));         }         sort(w.begin(), w.end());         if (get<3>(w[0]) ==  BERLAND  || get<3>(w[1]) ==  BERLAND ) {           printf( %d:%d , k, j);           return 0;         }         puncte[ BERLAND ] -= 3;         goluri[ BERLAND ] -= k;         rateu[ BERLAND ] -= j;         goluri[czn] -= j;         rateu[czn] -= k;       }     }     printf( IMPOSSIBLE );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int i, n;     cin >> n;     int cnt = 0;     int jump = 1;     int arr[n];     for (int k = 1; k <= n; k++) {       arr[k] = k;     }     for (i = 1; i <= n * n; i++) {       jump += i;       if (jump <= n) {         cout << arr[jump] <<    ;       } else {         cout << arr[jump % n] <<    ;       }       cnt++;       if (cnt == n - 1) {         break;       }     }   }
#include <bits/stdc++.h>   using namespace std;   const long long mod = 998244353;   long long sum[55][100005], f[55][100005], t[100005];   int l[55], r[55];   int add(int p, int x, int y) {     if (x < 0) return 0;     if (y < 0) return sum[p][x];     return sum[p][x] - sum[p][y];   }   long long solve1(int n, int m) {     long long ans = 0;     for (int i = l[1]; i <= r[1]; i++) f[1][i] = 1;     for (int i = 1; i <= m; i++) sum[1][i] = (sum[1][i - 1] + f[1][i]) % mod;     for (int i = 2; i <= n; i++) {       for (int j = 1; j <= m; j++) {         f[i][j] = add(i - 1, j - l[i], j - r[i] - 1);         sum[i][j] = (sum[i][j - 1] + f[i][j]) % mod;       }     }     for (int i = 1; i <= m; i++) ans = (ans + f[n][i]) % mod;     for (int i = 1; i <= n; i++)       for (int j = 1; j <= m; j++) f[i][j] = sum[i][j] = 0;     return ans;   }   long long solve2(int n, int m, int d) {     long long ans = 0;     for (int i = d; i <= m; i += d)       if (i >= l[1] && i <= r[1]) f[1][i] = 1;     for (int i = d; i <= m; i += d) sum[1][i] = f[1][i] + sum[1][i - d];     for (int i = 2; i <= n; i++) {       for (int j = d; j <= m; j += d) {         int R = j - l[i] - ((j - l[i]) % d + d) % d;         int L = j - r[i] - ((j - r[i]) % d + d) % d;         if ((j - r[i]) % d == 0) L -= d;         f[i][j] = add(i - 1, R, L);         sum[i][j] = (sum[i][j - d] + f[i][j]) % mod;       }     }     for (int i = d; i <= m; i += d) ans = (ans + f[n][i]) % mod;     for (int i = 1; i <= n; i++)       for (int j = d; j <= m; j += d) f[i][j] = sum[i][j] = 0;     return ans;   }   int main() {     int n, m;     scanf( %d%d , &n, &m);     for (int i = 1; i <= n; i++) scanf( %d%d , &l[i], &r[i]);     long long ans = solve1(n, m);     for (int d = 2; d <= m / n; d++) {       ans = ((ans - (1 - t[d]) * solve2(n, m, d)) % mod + mod) % mod;       for (int j = 2; j * d <= m; j++) t[j * d] += 1 - t[d];     }     printf( %lld , ans);     return 0;   }
#include <bits/stdc++.h>   void solve() {     int n, z;     std::cin >> n >> z;     std::vector<int> xs(n);     for (auto& x : xs) std::cin >> x;     std::sort(xs.begin(), xs.end());     int ok = 0, ng = n / 2 + 1;     while (ng - ok > 1) {       int k = (ok + ng) / 2;       bool judge = true;       for (int i = 0; i < k; ++i) {         if (xs[n - k + i] - xs[i] < z) judge = false;       }       if (judge) {         ok = k;       } else {         ng = k;       }     }     std::cout << ok <<   n ;   }   int main() {     std::cin.tie(nullptr);     std::ios::sync_with_stdio(false);     solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int a, b, c;     cin >> a >> b >> c;     bool flag = 0;     int by1, by2;     int x, y;     for (int i = 0; i <= a; i++) {       x = a - i;       y = i;       by1 = b - x;       by2 = c - y;       if (by1 == by2 and by1 >= 0) {         flag = 1;         break;       }     }     if (flag)       cout << x <<     << by1 <<     << y << endl;     else       cout <<  Impossible  << endl;   }
#include <bits/stdc++.h>   using namespace std;   long long n, m;   string s;   long long q;   char ch;   long long k = 0;   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     cin >> n >> m >> s;     for (long long i = 0; i < n - 1; i++)       if (s[i] ==  .  && s[i + 1] ==  . ) k++;     for (long long i = 0; i < m; i++) {       cin >> q >> ch;       q--;       if ((q > 0 && s[q - 1] ==  . ) || (q < n - 1 && s[q + 1] ==  . )) {         if (ch ==  . ) {           if (s[q] !=  . ) {             if ((q > 0 && s[q - 1] ==  . ) && (q < n - 1 && s[q + 1] ==  . ))               k += 2;             else               k++;           }         } else {           if (s[q] ==  . ) {             if ((q > 0 && s[q - 1] ==  . ) && (q < n - 1 && s[q + 1] ==  . ))               k -= 2;             else               k--;           }         }       }       s[q] = ch;       if (i > 0) cout <<   n ;       cout << k;     }   }
#include <bits/stdc++.h>   using namespace std;   int arr[100100];   vector<int> adj[100100];   int cnt[100100];   queue<int> q[2];   int main() {     int n, m;     cin >> n >> m;     for (int i = 0; i < n; ++i) scanf( %d , &arr[i]);     for (int i = 0; i < m; ++i) {       int u, v;       scanf( %d%d , &u, &v);       adj[v].push_back(u);       cnt[u]++;     }     for (int i = 0; i < n; ++i) {       if (cnt[i] == 0) {         q[arr[i]].push(i);       }     }     int ans = 0;     while (1) {       int a = q[0].size(), b = q[1].size();       if (a + b == 0) break;       for (int i = 0; i < 2; ++i) {         if (!q[i].empty() && i == 1) ans++;         while (!q[i].empty()) {           int u = q[i].front();           q[i].pop();           for (int j = 0; j < adj[u].size(); ++j) {             int to = adj[u][j];             cnt[to]--;             if (!cnt[to]) {               q[arr[to]].push(to);             }           }         }       }     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m, k;     cin >> n >> m >> k;     int total = 0;     for (int i = 1; i <= n; ++i) {       int temp;       cin >> temp;       if (n - i < m) {         total += min(k, temp);       } else {         total += temp;       }     }     cout << total << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long int n;     long long int k;     cin >> n;     cin >> k;     long long int arr[k];     for (long long int i = 0; i < k; i++) cin >> arr[i];     long long minrem = n % arr[0];     long long number = 0;     long long pos = 0;     for (long long int i = 0; i < k; i++) {       long long int rem = n % arr[i];       if (minrem >= rem) {         number = n / arr[i];         minrem = rem;         pos = i;       }     }     cout << (pos + 1) <<     << number;   }