malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   vector<int> A;   vector<int> d;   vector<int> P;   vector<int> g;   vector<vector<int>> G;   int bestu, bestv, bestw, bestvv;   void dfs(int x, int v, int n) {     for (int i = 0; i < G[x].size(); ++i) {       int y = G[x][i];       int u = g[y];       if (u >= 0) {         if (d[u] < 0) {           d[u] = v;           P[u] = y;           P[y] = x;           dfs(u, v, n);         }       } else if (A[y] + A[v] > bestw) {         bestw = A[y] + A[v];         bestu = x;         bestv = y;         bestvv = v;       }     }   }   bool cmp(int a, int b) { return A[a] > A[b]; }   void solve() {     int n, k;     scanf( %d%d , &n, &k);     vector<int> a(1 << n);     for (int i = 0; i < a.size(); ++i) scanf( %d , &a[i]);     vector<array<int, 3>> edges;     {       vector<int> bc(1 << n);       for (int i = 1; i < bc.size(); ++i) bc[i] = bc[i & (i - 1)] + 1;       array<int, 3> e;       for (int i = 0; i < bc.size(); ++i) {         if (bc[i] % 2 == 0)           for (int j = 0; j < n; ++j) {             e[0] = -(a[i] + a[i ^ (1 << j)]);             e[1] = i;             e[2] = i ^ (1 << j);             edges.push_back(e);           }       }     }     int edges_cnt = min(2 * n * k + 1, (int)edges.size());     nth_element(edges.begin(), edges.begin() + edges_cnt, edges.end());     vector<int> idx(1 << n, -1);     int vert = 0;     for (int i = 0; i < edges_cnt; ++i)       if (idx[edges[i][1]] < 0) {         A.push_back(a[edges[i][1]]);         idx[edges[i][1]] = vert;         ++vert;       }     G.resize(vert);     int vert2 = vert;     for (int i = 0; i < edges_cnt; ++i) {       if (idx[edges[i][2]] < 0) {         A.push_back(a[edges[i][2]]);         idx[edges[i][2]] = vert2;         ++vert2;       }       G[idx[edges[i][1]]].push_back(idx[edges[i][2]]);     }     vector<int> idx1(vert);     for (int i = 0; i < vert; ++i) idx1[i] = i;     sort(idx1.begin(), idx1.end(), cmp);     vector<char> was(vert);     g.assign(vert2, -1);     P.resize(vert2);     int res = 0;     for (int i = 0; i < k; ++i) {       d.assign(vert, -1);       bestw = -1;       for (int j = 0; j < vert; ++j) {         int x = idx1[j];         if (!was[x] && d[x] < 0) {           P[x] = -1;           d[x] = x;           dfs(x, x, n);         }       }       if (bestw >= 0) {         res += bestw;         g[bestv] = bestu;         was[bestvv] = 1;         for (int x = P[bestu]; x >= 0;) {           int y = P[x];           g[x] = y;           x = P[y];         }       } else         break;     }     printf( %d n , res);   }   int main() {     solve();     return 0;   }
#include <bits/stdc++.h>   #pragma comment(linker,  /STACK:300000000 )   #pragma warning(disable : 4800)   using namespace std;   const double pi = 3.1415926535897932384626433832795;   template <class T>   T abs(const T &a) {     return a >= 0 ? a : -a;   };   template <class T>   T sqr(const T &x) {     return x * x;   }   int n, m, k;   vector<vector<int> > g;   vector<bool> visited;   vector<int> ans;   vector<pair<int, int> > traders;   pair<int, int> erased;   bool isErased(int x, int y) {     return pair<int, int>(x, y) == erased || pair<int, int>(y, x) == erased;   }   void dfs(int k) {     if (visited[k]) return;     visited[k] = true;     for (int i = 0; i < (int((g[k]).size())); i++) {       int to = g[k][i];       if (!isErased(k, to)) dfs(to);     }   }   void work(int x, int y) {     erased = pair<int, int>(x, y);     visited.assign(n, false);     dfs(x);     for (int i = 0; i < (k); i++)       if (visited[traders[i].first] && !visited[traders[i].second]) ans[i]++;   }   int main() {     cin >> n >> m;     g.resize(n);     for (int i = 0; i < (m); i++) {       int x, y;       cin >> x >> y;       x--, y--;       g[x].push_back(y);       g[y].push_back(x);     }     cin >> k;     ans.resize(k);     traders.resize(k);     for (int i = 0; i < (k); i++) {       cin >> traders[i].first >> traders[i].second;       traders[i].first--;       traders[i].second--;     }     for (int i = 0; i < (n); i++)       for (int j = 0; j < (int((g[i]).size())); j++) work(i, g[i][j]);     for (int i = 0; i < (k); i++) cout << ans[i] << endl;   }
#include <bits/stdc++.h>   using namespace std;   const long long N = 2e5 + 5, inf = 998244353;   long long n, k, i;   long long A[N], B[N];   long long in[N], f[N];   inline long long expo(long long n, long long k, long long p = inf) {     long long r = 1;     for (; k; k >>= 1) {       if (k & 1) r = r * n % p;       n = n * n % p;     }     return r;   }   inline long long inv(long long a, long long p = inf) {     return expo(a, p - 2, p);   }   vector<long long> BIT(N);   void upd(long long first, long long val) {     for (; first <= n; first += (first & -first)) BIT[first] += val;   }   long long q(long long first) {     long long res = 0;     for (; first > 0; first -= (first & -first)) res += BIT[first];     return res;   }   long long m[N];   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     long long i, j, first, second, ans = 0, c = 0, a;     cin >> n;     for (i = 1; i < n + 1; i++) {       cin >> A[i];       if (A[i] != -1) {         m[A[i]] = 1;         ans += c - q(A[i] - 1);         upd(A[i], 1);         c++;       }     }     vector<long long> v;     for (i = 1; i < n + 1; i++)       if (!m[i]) v.emplace_back(i);     ans += 1LL * (long long)v.size() * ((long long)v.size() - 1) % inf * inv(4) %            inf;     long long t = 0;     c = 0;     for (i = 1; i < n + 1; i++) {       if (A[i] != -1) {         a = lower_bound(v.begin(), v.end(), A[i]) - v.begin();         ans +=             c * ((long long)v.size() - a) % inf * inv((long long)v.size()) % inf;         ans +=             a * ((long long)v.size() - c) % inf * inv((long long)v.size()) % inf;       } else         c++;     }     cout << ans % inf;   }
#include <bits/stdc++.h>   using namespace std;   const int Maxn = 100 * 1000 + 10;   int n, m, l[Maxn], ans1, ans2;   long double a, b;   pair<long double, int> arr[Maxn], brr[Maxn];   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     cin >> n >> m >> a >> b;     for (int i = 0; i < n; i++) {       cin >> arr[i].first;       arr[i].second = i;     }     for (int i = 0; i < m; i++) {       cin >> brr[i].first;       brr[i].second = i;     }     for (int i = 0; i < m; i++) cin >> l[i];     sort(arr, arr + n);     sort(brr, brr + m);     int cup;     long double Min = LLONG_MAX;     for (int i = 0; i < m; i++) {       long double p = (brr[i].first * a) / b;       int ind = lower_bound(arr, arr + n, make_pair(p, -1)) - arr;       long double c, dis;       if (ind < n) {         c = arr[ind].first,         dis = sqrt(a * a + c * c) +               sqrt((b - a) * (b - a) + (brr[i].first - c) * (brr[i].first - c));         cup = ind;       }       if (ind > 0) {         ind--;         c = arr[ind].first;         if (sqrt(a * a + c * c) + sqrt((b - a) * (b - a) +                                        (brr[i].first - c) * (brr[i].first - c)) <             dis) {           cup = ind;           dis = sqrt(a * a + c * c) +                 sqrt((b - a) * (b - a) + (brr[i].first - c) * (brr[i].first - c));         }       }       if (dis + l[brr[i].second] < Min) {         Min = dis + l[brr[i].second];         ans1 = arr[cup].second + 1, ans2 = brr[i].second + 1;       }     }     cout << ans1 <<     << ans2 << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int Maxn = 4e5 + 5;   struct edge {     int v, nx;   } e[Maxn << 1];   int n, m, ne = 1, f[Maxn], dfn[Maxn], low[Maxn], scc[Maxn];   int rt, tot, cnt, top, st[Maxn];   int ans, cu[Maxn], cv[Maxn], nx[Maxn], ansu[Maxn], ansv[Maxn];   bool vis[Maxn];   void read(int u, int v) {     e[++ne].v = v;     e[ne].nx = f[u];     f[u] = ne;   }   void Tarjan(int u, int fa) {     dfn[u] = low[u] = ++tot;     vis[u] = 1;     st[++top] = u;     for (int i = f[u]; i; i = e[i].nx) {       int v = e[i].v;       if (v == fa) continue;       if (!dfn[v]) {         Tarjan(v, u);         low[u] = min(low[u], low[v]);       } else if (vis[v])         low[u] = min(low[u], low[v]);     }     if (dfn[u] == low[u]) {       cnt++;       int x, sz = 0;       do {         x = st[top];         top--;         sz++;         scc[x] = cnt;         vis[x] = 0;       } while (x != u);       if (sz > ans) ans = sz, rt = u;     }   }   void dfs2(int u) {     vis[u] = 1;     for (int i = f[u]; i; i = e[i].nx) {       int v = e[i].v;       if (vis[v]) {         ansu[i >> 1] = u;         ansv[i >> 1] = v;         continue;       }       if (low[v] != low[u]) {         ansu[i >> 1] = v;         ansv[i >> 1] = u;       } else {         ansu[i >> 1] = u;         ansv[i >> 1] = v;       }       dfs2(v);     }   }   int main() {     scanf( %d%d , &n, &m);     for (int i = 1; i <= m; i++) {       int u, v;       scanf( %d%d , &u, &v);       read(u, v);       read(v, u);     }     Tarjan(1, 0);     ne = 0;     printf( %d n , ans);     dfs2(rt);     for (int i = 1; i <= m; i++) printf( %d %d n , ansu[i], ansv[i]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void Solve() {     string s;     cin >> s;     int n = s.size();     int cnt1 = 0, cnt2 = 0;     for (int i = 0; i < n - 1; i++) {       string t = s.substr(i, 2);       if (t ==  ab ) {         cnt1++;       } else if (t ==  ba ) {         cnt2++;       }     }     if (cnt1 == cnt2) {       cout << s <<   n ;       return;     }     if (cnt1 > cnt2) {       for (int i = n - 1; i >= 0; i--) {         if (s[i] ==  b ) {           s[i] =  a ;           break;         }       }     } else {       for (int i = n - 1; i >= 0; i--) {         if (s[i] ==  a ) {           s[i] =  b ;           break;         }       }     }     cout << s <<   n ;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     int TC = 1;     cin >> TC;     while (TC--) Solve();   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 100 * 1000 + 5;   int a[MAXN], b[MAXN], c[MAXN], d[MAXN], k[MAXN], ans[MAXN];   pair<int, pair<char, int> > p[3 * MAXN];   int main() {     ios_base::sync_with_stdio(false);     int n;     cin >> n;     for (int i = 0; i < n; i++) {       cin >> a[i] >> b[i];       p[i] = make_pair(a[i], make_pair(1, i));     }     int m;     cin >> m;     for (int i = 0; i < m; i++) {       cin >> c[i] >> d[i] >> k[i];       p[n + 2 * i] = make_pair(c[i], make_pair(0, i));       p[n + 2 * i + 1] = make_pair(d[i], make_pair(2, i));     }     sort(p, p + n + 2 * m);     set<pair<int, int> > st;     for (int i = 0; i < n + 2 * m; i++) {       int id = p[i].second.second;       if (p[i].second.first == 0)         st.insert(make_pair(d[id], id));       else if (p[i].second.first == 2)         st.erase(make_pair(d[id], id));       else {         set<pair<int, int> >::iterator it = st.lower_bound(make_pair(b[id], -1));         if (it == st.end()) {           cout <<  NO n ;           return 0;         }         int segId = it->second;         ans[id] = segId;         k[segId]--;         if (!k[segId]) st.erase(it);       }     }     cout <<  YES n ;     for (int i = 0; i < n; i++) cout << ans[i] + 1 <<    ;     cout <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, l[103], a[103];   int num[103];   vector<int> v;   int main() {     scanf( %d%d , &n, &m);     for (int i = 1; i <= m; i++) scanf( %d , &l[i]);     for (int i = 1; i < m; i++) {       int t = l[i + 1];       while (t <= l[i]) t += n;       if (a[l[i]] && a[l[i]] != t - l[i]) {         printf( -1 n );         return 0;       }       if (!a[l[i]]) {         a[l[i]] = t - l[i];         num[a[l[i]]]++;       }     }     for (int i = 1; i <= n; i++)       if (num[i] > 1) {         printf( -1 n );         return 0;       } else if (!num[i])         v.push_back(i);     for (int i = 1; i <= n; i++) {       if (!a[i]) a[i] = v.back(), v.pop_back();       printf( %d  , a[i]);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5 + 5;   int x[maxn], y[maxn];   int main() {     int n, m;     cin >> n >> m;     for (int i = 1; i <= n; i++) {       cin >> x[i];     }     for (int i = 1; i <= m; i++) {       cin >> y[i];     }     int u = 0, d = 0, ans = 0;     int sumu = 0, sumd = 0;     while (u <= n && d <= m) {       if (sumu && sumu == sumd) {         ans++;         sumd = y[++d];         sumu = x[++u];       } else if (sumu > sumd) {         sumd += y[++d];       } else if (sumu <= sumd) {         sumu += x[++u];       }     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   string lower(string second) {     for (int i = 0; i < second.size(); i++)       if (second[i] >=  A  && second[i] <=  Z ) second[i] = second[i] -  A  +  a ;     return second;   }   char reg(char c, char t) {     if (c >=  A  && c <=  Z ) return t -  a  +  A ;     return t;   }   string second, a[105], sl;   bool u[105];   int n;   int main() {     cin >> n;     for (int i = 0; i < n; i++) {       cin >> a[i];       a[i] = lower(a[i]);     }     char let;     cin >> second >> let;     sl = lower(second);     for (int i = 0; i < second.size(); i++)       for (int j = 0; j < n; j++)         if (i + a[j].size() <= second.size() &&             sl.substr(i, a[j].size()) == a[j]) {           for (int k = i; k < i + a[j].size(); k++) u[k] = true;         }     for (int i = 0; i < second.size(); i++)       if (u[i]) {         if (sl[i] == let) {           if (sl[i] ==  a )             second[i] = reg(second[i],  b );           else             second[i] = reg(second[i],  a );         } else           second[i] = reg(second[i], let);       }     cout << second;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long n, m, i = 0, j = 0, x, t, w, p, q, l, r, count1 = 0, count2 = 0,                   k = 0, first = 0, second = 0, last, sum = 1e9;   const long long mod = 1000003, num = 0;   bool compare(pair<string, int> a, pair<string, int> b) {     if (a.second == b.second)       return a.first < b.first;     else       return a.second > b.second;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cin >> n;     vector<vector<long long>> v(n, vector<long long>(n, 0));     long long val = 1;     for (i = 0; i < n / 2; i++) {       for (j = 0; j < n; j++) {         v[j][i] = val;         val += 1;       }     }     for (i = n / 2; i < n; i++) {       for (long long j = n - 1; j >= 0; j--) {         v[j][i] = val;         val += 1;       }     }     for (i = 0; i < n; i++) {       for (j = 0; j < n; j++) cout << v[i][j] <<    ;       cout << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, t;     cin >> n >> t;     if (t == 10) {       if (n == 1)         cout << -1 << endl;       else {         for (int i = 0; i < n - 1; i++) {           cout << 1;         }         cout << 0 << endl;       }     } else {       for (int i = 0; i < n; i++) {         cout << t;       }       cout <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   void doRoutine() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     cout.tie(nullptr);     srand(322179);   }   signed main() {     doRoutine();     long long n;     cin >> n;     long long res = 0;     while (n > 0) {       ++res;       n /= 2;     }     cout << res << endl;     return 0;   }
#include <bits/stdc++.h>   int n, fac[1000005], inv[1000005], ans;   int qpow(int a, long long b) {     int s = 1;     for (; b; b >>= 1, a = 1ll * a * a % 998244353)       if (b & 1) s = 1ll * s * a % 998244353;     return s;   }   int C(int n, int m) {     return 1ll * fac[n] * inv[n - m] % 998244353 * inv[m] % 998244353;   }   int add(int x, int y) { return (x += y) >= 998244353 ? x -= 998244353 : x; }   int sub(int x, int y) { return (x -= y) < 0 ? x += 998244353 : x; }   int main() {     scanf( %d , &n), fac[0] = 1;     for (register int i = 1; i <= n; ++i)       fac[i] = 1ll * fac[i - 1] * i % 998244353;     inv[n] = qpow(fac[n], 998244353 - 2);     for (register int i = n; i; --i) inv[i - 1] = 1ll * inv[i] * i % 998244353;     ans = sub(qpow(3, 1ll * n * n), qpow(sub(qpow(3, n), 3), n));     for (register int i = 1; i <= n; ++i) {       int s =           1ll * C(n, i) *           add(3ll * qpow(qpow(3, n - i) - 1, n) % 998244353,               1ll * sub(qpow(3, i), 3) * qpow(3, 1ll * n * (n - i)) % 998244353) %           998244353;       if (i & 1)         ans = add(ans, s);       else         ans = sub(ans, s);     }     printf( %d n , ans);   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     scanf( %d , &n);     char input[n + 5][n + 5];     for (int i = 0; i < n; i++) scanf( %s , input[i]);     int row[n], col[n], count_row = 0, count_col = 0;     for (int i = 0; i < n; i++) row[i] = -1;     for (int j = 0; j < n; j++) col[j] = -1;     for (int i = 0; i < n; i++)       for (int j = 0; j < n; j++) {         if (input[i][j] ==  . ) {           row[i] = j;           col[j] = i;         }       }     for (int i = 0; i < n; i++) {       if (row[i] != -1) count_row++;       if (col[i] != -1) count_col++;     }     if (count_row != n && count_col != n)       printf( -1 n );     else if (count_row == n) {       for (int i = 0; i < n; i++) printf( %d %d n , i + 1, row[i] + 1);     } else       for (int j = 0; j < n; j++) printf( %d %d n , col[j] + 1, j + 1);   }
#include <bits/stdc++.h>   using namespace std;   typedef long long ll;   const int N=4e2+2,p=998244353;   vector<int> lj[N];   int dis[N][N],dl[N],ans[N][N],rd[N][N],cnt[N],pre[N][N],lb[N*3][2];   int n,m,s,t,i,j,tou,wei,x,y,r;   bool ed[N];   int main()   {    scanf( %d%d ,&n,&m);    for (i=1;i<=m;i++) scanf( %d%d ,&x,&y),lj[lb[i][0]=x].push_back(lb[i][1]=y),lj[y].push_back(x);    for (i=1;i<=m;i++) lb[i+m][0]=lb[i][1],lb[i+m][1]=lb[i][0];m<<=1;    for (s=1;s<=n;s++)    {     dis[s][dl[tou=wei=1]=s]=rd[s][s]=1;     while (tou<=wei) for (auto v:lj[x=dl[tou++]]) if (!dis[s][v]) dis[s][dl[++wei]=v]=dis[s][pre[s][v]=x]+(rd[s][v]=1); else if (dis[s][v]==dis[s][x]+1) ++rd[s][v];    }    for (s=1;s<=n;s++)    {     for (t=1;t<s;t++) printf( %d  ,ans[s][t]);     //for (i=1;i<=n;i++) printf( %d: pre%d dis%d rd%d n ,i,pre[i],dis[i],rd[i]);     for (t=s;t<=n;t++)     {      for (x=t;x!=s&&rd[s][x]<=1;x=pre[s][x]);      if (x!=s) {printf( 0  );continue;}      for (x=t;x!=s;x=pre[s][x]) ed[x]=1;r=1;      for (i=1;i<=m;i++) if (dis[s][lb[i][0]]+1==dis[s][lb[i][1]]&&dis[t][lb[i][0]]+1==dis[t][lb[i][1]]) ++cnt[lb[i][1]];      //if (s==1&&t==1) for (i=1;i<=n;i++) printf( %d%c ,cnt[i],i==n?10:32);      for (i=1;i<=n;i++) if (!ed[i]&&i!=s) r=(ll)r*cnt[i]%p;      memset(cnt,0,sizeof(cnt));      for (x=t;x!=s;x=pre[s][x]) ed[x]=0;      ans[t][s]=r;printf( %d  ,r);     }puts(  );    }   }
#include <bits/stdc++.h>   using namespace std;   int n;   int a[1001], b[1001], c[1001], d[1001];   void solve() {     cin >> n;     int r = 1;     int i = 1;     cin >> a[i] >> b[i] >> c[i] >> d[i];     int sum = a[1] + b[1] + c[1] + d[1];     for (int i = 2; i <= n; i++) {       cin >> a[i] >> b[i] >> c[i] >> d[i];       int sum1 = a[i] + b[i] + c[i] + d[i];       if (sum1 > sum) {         r += 1;       }     }     cout << r;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     if (fopen( input.txt ,  r )) {       freopen( input.txt ,  r , stdin);       freopen( output.txt ,  w , stdout);     }     int t = 1;     while (t--) {       solve();     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t, n, a[100];     cin >> t;     while (t--) {       cin >> n;       for (int i = 0; i < n; i++) {         cin >> a[i];       }       sort(a, a + n);       vector<int> v;       int dif = 0;       for (int i = 1; i < n; i++) {         dif = a[i] - a[i - 1];         v.push_back(dif);       }       sort(v.begin(), v.end());       cout << v[0] << endl;     }     return 0;   }
#include <bits/stdc++.h>   #pragma optimize( Ofast )   using namespace std;   void solve() {     int n, k;     string s;     cin >> n >> k >> s;     vector<int> cnt(27);     for (char &c : s) {       cnt[c -  a ]++;     }     int t = 0;     for (int d = 1; d <= n; d++) {       vector<int> ncnt = cnt;       int curr = 0;       for (int j = 0; j < 26; j++) {         if (ncnt[j] >= d) {           ncnt[j] -= d;           curr++;           --j;         }         if (curr && k % curr == 0) {           t = max(t, curr * d);         }       }     }     cout << t <<   n ;   }   int main() {     ios_base::sync_with_stdio(false);     int q;     cin >> q;     while (q--) {       solve();     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int a, b;     cin >> a >> b;     while (b) {       int c = b % a;       if (c == 0)         b /= a;       else if (c == 1)         b--;       else if (c == a - 1)         b++;       else         return cout <<  NO , 0;     }     cout <<  YES ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     int t;     cin >> t;     while (t--) {       int n;       cin >> n;       vector<int> nums(n);       vector<vector<int> > pos(n);       for (int i = 0; i < (int)n; i++) {         cin >> nums[i];         nums[i] -= 1;         pos[nums[i]].push_back(i);       }       vector<vector<int> > dp(n + 1, vector<int>(n));       for (int i = n - 1; i >= 0; i--) {         for (int j = i + 1; j < (int)n; j++) {           dp[i][j] = (dp[i + 1][j] + (nums[i] != nums[j]));           for (auto k : pos[nums[i]]) {             if (k > j) break;             if (k < i) continue;             int temp = dp[i][k] + 1 + dp[k + 1][j];             dp[i][j] = min(dp[i][j], temp);           }         }       }       cout << dp[0][n - 1] <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   long long a, b, x;   int n;   int main() {     scanf( %d , &n);     scanf( %lld%lld , &a, &b);     while (n--) {       scanf( %lld , &x);       printf( %lld  , ((x * a) - b * ((x * a) / b)) / a);     }     return 0;   }