malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const int INF = 0x3f3f3f3f;   const long long LINF = 0x3f3f3f3f3f3f3f3fll;   vector<vector<string> > dp;   int n, m;   string resp =   ;   vector<string> a;   vector<set<char> > occr;   string solve(int at, int estado) {     if (at == m) {       return   ;     }     if (dp[at][estado] !=   ) {       return dp[at][estado];     }     for (char c : occr[at]) {       bool pode = true;       for (int I = 0; I < n; I++) {         if (a[I][at] != c && (estado & (1 << I))) {           pode = false;         }       }       if (!pode) {         continue;       }       int temp = estado;       for (int I = 0; I < n; I++) {         if (a[I][at] != c) {           temp |= (1 << I);         }       }       string res = solve(at + 1, temp);       if (res !=    ) {         return dp[at][estado] = c + res;       }     }     return dp[at][estado] =    ;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     int t;     cin >> t;     while (t--) {       cin >> n >> m;       a.clear();       a.resize(n);       occr.clear();       occr.resize(m);       dp.clear();       dp.resize(11, vector<string>(1030,   ));       for (int I = 0; I < n; I++) {         cin >> a[I];       }       for (int I = 0; I < n; I++) {         for (int J = 0; J < m; J++) {           occr[J].insert(a[I][J]);         }       }       string resp = solve(0, 0);       if (resp ==    ) {         cout << -1 <<   n ;       } else {         cout << resp <<   n ;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long MX = 1e5 + 10;   long long A[MX];   long long cnt[MX];   vector<long long> pos[MX];   long long ans[MX];   void init(long long n) {     for (long long i = 0; i <= n + 2; i++) cnt[i] = 0;     for (long long i = 0; i <= n + 2; i++) pos[i].clear();     for (long long i = 0; i <= n + 2; i++) ans[i] = -1;   }   void salida(long long n, long long val) {     for (long long i = 0; i < n; i++)       if (ans[i] == -1) ans[i] = val;     cout <<  YES n ;     for (long long i = 0; i < n; i++) cout << ans[i] <<    ;     cout <<   n ;   }   void solve() {     long long n, fijo, tot, x;     cin >> n >> fijo >> tot;     long long nfijo = tot - fijo;     init(n);     set<long long> s;     for (long long i = 0; i < n; i++) {       cin >> x;       A[i] = x;       cnt[x]++;       pos[x].push_back(i);       s.insert(x);     }     long long maxNum = n + 1;     priority_queue<pair<long long, long long> > pq;     for (long long i = 1; i <= maxNum; i++) {       if (cnt[i] != 0) pq.push({cnt[i], i});     }     while (!pq.empty() && fijo != 0) {       long long cn = pq.top().first;       long long val = pq.top().second;       pq.pop();       cnt[val]--;       if (cnt[val] != 0) pq.push({cnt[val], val});       long long sz = pos[val].size();       ans[pos[val][sz - 1]] = val;       pos[val].erase(pos[val].begin() + sz - 1);       fijo--;     }     if (fijo > 0) {       cout <<  NO n ;       return;     }     long long numExtra = -1;     for (long long i = 1; i <= maxNum; i++) {       if (s.find(i) == s.end()) numExtra = i;     }     if (nfijo == 0) {       salida(n, numExtra);       return;     }     long long falta = 0;     for (long long i = 1; i <= maxNum; i++) falta += cnt[i];     long long mxSize = pq.top().first;     vector<long long> posi;     while (!pq.empty()) {       long long val = pq.top().second;       pq.pop();       for (long long xx : pos[val]) posi.push_back(xx);     }     if (mxSize <= falta - mxSize) {       long long sz = posi.size();       long long mid = sz / 2;       for (long long i = 0; i < sz; i++) {         if (nfijo == 0) break;         long long cur = i;         long long nxt = (i + mid) % sz;         ans[posi[cur]] = A[posi[nxt]];         nfijo--;       }       salida(n, numExtra);     } else {       reverse(posi.begin(), posi.end());       long long mxPos = falta - mxSize;       if (mxPos * 2 < nfijo) {         cout <<  NO n ;         return;       }       long long sz = posi.size();       for (long long i = 0; i < sz; i++) {         if (nfijo == 0) break;         long long cur = i;         long long nxt = i + mxPos;         if (nfijo == 0) break;         ans[posi[cur]] = A[posi[nxt]];         nfijo--;         if (nfijo == 0) break;         ans[posi[nxt]] = A[posi[cur]];         nfijo--;       }       salida(n, numExtra);     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     cout.precision(10);     cout << fixed;     long long t;     cin >> t;     while (t--) solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const double eps = 1e-9;   const double pi = acos(-1.0);   const double dinf = 1e250;   const long long INF = (long long)(2e18);   const int inf = (int)(1e9 + 7);   struct myt {     int d, s, t;   };   void out(int a, int b) { cout << a <<     << b <<   n ; }   vector<int> ind;   vector<vector<int> > g;   int32_t main() {     ios_base::sync_with_stdio(0);     cout << fixed << setprecision(10);     cin.tie(0);     int n;     cin >> n;     vector<myt> ar(n);     for (int i = 0; i < n; ++i) {       cin >> ar[i].d;       ar[i].s = 2 * i + 1;       ar[i].t = 2 * i + 2;     }     sort(begin(ar), end(ar), [](myt a, myt b) { return a.d > b.d; });     g.resize(2 * n);     ind.resize(2 * n, 0);     for (int i = 0; i < n; ++i) {       int d = ar[i].d;       if (ind[i] == 0)         ind[i] = ar[i].s;       else {         --d;         g[i].push_back(ar[i].s);       }       if (d == 0) {         out(ar[i].s, ar[i].t);       } else if (ind[i + d] == 0) {         ind[i + d] = ar[i].t;       } else {         g[i + d - 1].push_back(ar[i].t);       }     }     for (int i = 0; i < g.size(); ++i) {       if (ind[i] == 0) continue;       for (auto& it : g[i]) out(ind[i], it);     }     for (int i = 0; i < ind.size() - 1; ++i) {       if (ind[i] == 0) continue;       if (ind[i + 1] == 0) continue;       out(ind[i], ind[i + 1]);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAX = 100010;   long long quick_Mod(long long n) {     long long ans = 1;     long long x = 2;     while (n) {       if (n & 1) ans = ans * x % 1000000007;       n = n >> 1;       x = x * x % 1000000007;     }     return ans;   }   void ex_gcd(long long a, long long b, long long &gcd, long long &x,               long long &y) {     if (b == 0) {       gcd = a;       y = 0;       x = 1;       return;     } else {       ex_gcd(b, a % b, gcd, y, x);       y -= x * (a / b);     }   }   long long inverse(long long a) {     long long gcd, x, y;     ex_gcd(a, 1000000007, gcd, x, y);     if (gcd == 1)       return (x % 1000000007 + 1000000007) % 1000000007;     else       return -1;   }   int main() {     char s[MAX];     long long k;     scanf( %s , s);     scanf( %I64d , &k);     long long len = strlen(s);     long long ans = 0;     for (int i = 0; i < len; i++) {       if (s[i] ==  0  || s[i] ==  5 ) {         ans += quick_Mod(i) * inverse(quick_Mod(len) - 1) % 1000000007 *                (quick_Mod(k * len) - 1) % 1000000007;       }     }     printf( %I64d n , (ans % 1000000007 + 1000000007) % 1000000007);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, Q;   set<int> cut[2];   map<int, int> mx[2];   long long getmx() {     map<int, int>::iterator it;     it = mx[0].end();     it--;     int u = (*it).first;     it = mx[1].end();     it--;     int v = (*it).first;     return 1ll * u * v;   }   void Insert(int t, int x) {     int u, v;     set<int>::iterator it = cut[t].lower_bound(x);     v = *it;     it--;     u = *it;     mx[t][v - u]--;     if (mx[t][v - u] == 0) mx[t].erase(v - u);     cut[t].insert(x);     mx[t][x - u]++;     mx[t][v - x]++;   }   int main() {     char t;     int x;     scanf( %d %d %d , &n, &m, &Q);     cut[0].insert(0);     cut[0].insert(n);     mx[0][n]++;     cut[1].insert(0);     cut[1].insert(m);     mx[1][m]++;     for (int i = 1; i <= Q; i++) {       scanf(  %c %d , &t, &x);       if (t ==  V ) Insert(0, x);       if (t ==  H ) Insert(1, x);       printf( %I64d n , getmx());     }     return 0;   }
#include <bits/stdc++.h>   template <class T>   std::string toStr(T t);   using namespace std;   int main() {     int statA[4];     int statB[4];     for (__typeof(4) i = 0; i < 4; i++) {       cin >> statA[i];       cin >> statB[i];     }     int pos[4][4] = {{0, 1, 2, 3}, {1, 0, 2, 3}, {0, 1, 3, 2}, {1, 0, 3, 2}};     int res[4] = {0, 0, 0, 0};     for (__typeof(4) p = 0; p < 4; p++) {       if (statA[pos[p][0]] > statB[pos[p][2]] &&           statB[pos[p][1]] > statA[pos[p][3]]) {         res[p] = 1;       }       if (statA[pos[p][0]] < statB[pos[p][2]] &&           statB[pos[p][1]] < statA[pos[p][3]]) {         res[p] = 2;       }     }     if ((res[0] == 1 && res[2] == 1) || (res[1] == 1 && res[3] == 1)) {       cout <<  Team 1  << endl;       return 0;     }     if ((res[0] == 2 || res[2] == 2) && (res[1] == 2 || res[3] == 2)) {       cout <<  Team 2  << endl;       return 0;     }     cout <<  Draw  << endl;   }   template <class T>   string toStr(T t) {     std::stringstream strstream;     string resStr;     strstream << t;     strstream >> resStr;     return resStr;   }
#include <bits/stdc++.h>   using namespace std;   inline int scan() {     int x;     scanf( %d , &x);     return x;   }   struct data {     int first;     int edge_used;     int prev;     data() {       first = 0;       edge_used = 0;       prev = 0;     }   };   vector<pair<int, int> > v[100005];   bool edge[100005] = {0};   pair<int, int> edges[100005];   data nodes[100005];   bool visited[100005] = {0};   bool used[100005] = {0};   int dist[100005];   int main() {     int n = scan(), m = scan();     for (int i = 1; i <= m; i++) {       int x = scan(), y = scan(), z = scan();       v[x].push_back(make_pair(y, i));       v[y].push_back(make_pair(x, i));       edge[i] = z;       edges[i] = make_pair(x, y);     }     queue<int> q;     q.push(1);     visited[1] = 1;     for (int i = 0; i <= n; i++) dist[i] = 999999;     dist[1] = 0;     bool aslivisit[100001] = {0};     while (!q.empty()) {       int node = q.front();       aslivisit[node] = 1;       q.pop();       int x = v[node].size();       int num = nodes[node].first;       for (int i = 0; i < x; i++) {         int next = v[node][i].first;         if (aslivisit[next]) continue;         int num2 = num;         if (edge[v[node][i].second] == 0) {           num2++;         }         if (!visited[next]) {           visited[next] = 1;           q.push(next);           nodes[next].first = num2;           nodes[next].edge_used = v[node][i].second;           nodes[next].prev = node;           dist[next] = dist[node] + 1;         } else if (dist[next] >= dist[node] + 1) {           if (num2 < nodes[next].first) {             nodes[next].first = num2;             nodes[next].edge_used = v[node][i].second;             nodes[next].prev = node;           }         }       }     }     int cur = n;     while (cur != 0) {       used[nodes[cur].edge_used] = 1;       cur = nodes[cur].prev;     }     int counter = 0;     queue<pair<pair<int, int>, bool> > ans;     for (int i = 1; i <= m; i++) {       if (!used[i] && edge[i] == 1) {         counter++;         ans.push(make_pair(edges[i], 0));       } else if (used[i] && edge[i] == 0) {         counter++;         ans.push(make_pair(edges[i], 1));       }     }     printf( %d n , counter);     while (!ans.empty()) {       printf( %d %d %d n , ans.front().first.first, ans.front().first.second,              ans.front().second);       ans.pop();     }   }
#include <bits/stdc++.h>   using namespace std;   const int MX = 256;   vector<vector<vector<vector<vector<int> > > > > dp;   char grid[MX][MX];   int R, C, mxmask, MOD = 1e9 + 7;   int ison(int x, int bit) {     if ((x & (1 << bit))) return 1;     return 0;   }   int turnoff(int x, int bit) {     if ((x & (1 << bit))) x ^= (1 << bit);     return x;   }   int turnon(int x, int bit) {     x |= (1 << bit);     return x;   }   int calc(int row, int mask, int col, int left, int tok) {     if (col == C) return calc(row + 1, mask, 0, 0, tok);     if (row == R) return 1;     int &ret = dp[row][mask][col][left][tok];     if (ret != -1) return ret;     ret = 0;     if (grid[row][col] ==  x ) {       return ret = calc(row, turnoff(mask, col), col + 1, 0, tok);     }     ret += calc(row, turnon(mask, col), col + 1, 1, tok);     ret %= MOD;     if (left || ison(mask, col)) {       ret += calc(row, mask, col + 1, left, tok);       ret %= MOD;     } else {       if (!tok) ret += calc(row, mask, col + 1, left, 1);       ret %= MOD;     }     return ret;   }   int main() {     cin >> R >> C;     for (int j = 0; j < R; j++) {       for (int i = 0; i < C; i++) {         if (R >= C)           cin >> grid[j][i];         else           cin >> grid[i][j];       }     }     if (R < C) swap(R, C);     mxmask = (1 << C);     dp.resize(R + 2);     for (auto &pp : dp) {       pp.resize(mxmask);       for (auto &qq : pp) {         qq.resize(C + 2);         for (auto &ll : qq) {           ll.resize(2);           for (auto &nn : ll) {             nn.resize(2);             nn[0] = nn[1] = -1;           }         }       }     }     cout << calc(0, 0, 0, 0, 0);   }
#include <bits/stdc++.h>   using namespace std;   long long n, a[1234], i;   int main() {     cin >> n;     for (i = 0; i < n; i++) cin >> a[i];     for (i = 0; i < n; i++)       if (a[i] % 2 == 0) a[i]--;     for (i = 0; i < n; i++) cout << a[i] <<    ;     cout << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <class T1>   void deb(T1 e1) {     cout << e1 << endl;   }   template <class T1, class T2>   void deb(T1 e1, T2 e2) {     cout << e1 <<     << e2 << endl;   }   template <class T1, class T2, class T3>   void deb(T1 e1, T2 e2, T3 e3) {     cout << e1 <<     << e2 <<     << e3 << endl;   }   template <class T1, class T2, class T3, class T4>   void deb(T1 e1, T2 e2, T3 e3, T4 e4) {     cout << e1 <<     << e2 <<     << e3 <<     << e4 << endl;   }   template <class T1, class T2, class T3, class T4, class T5>   void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5) {     cout << e1 <<     << e2 <<     << e3 <<     << e4 <<     << e5 << endl;   }   template <class T1, class T2, class T3, class T4, class T5, class T6>   void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5, T6 e6) {     cout << e1 <<     << e2 <<     << e3 <<     << e4 <<     << e5 <<     << e6          << endl;   }   struct data {     int x, y;   };   data point[110];   int num[110];   int main() {     memset(num, 0, sizeof(num));     int i, j, t, mark = 1, x1 = 0, y1 = 0;     for (i = 0; i < 8; i += 2) {       scanf( %d%d , &point[i].x, &point[i].y);       scanf( %d%d , &point[i + 1].x, &point[i + 1].y);       if (point[i].x == point[i + 1].x && point[i].y != point[i + 1].y) {         x1++;       } else if (point[i].y == point[i + 1].y && point[i].x != point[i + 1].x) {         y1++;       } else         mark = 0;     }     if ((x1 != 2)) mark = 0;     if (y1 != 2) mark = 0;     for (i = 0; i < 8; i++) {       for (j = 0; j < 8; j++) {         if (point[i].x == point[j].x && point[i].y == point[j].y) {           num[i]++;         }       }     }     for (i = 0; i < 8; i++) {       if (num[i] != 2) {         mark = 0;       }     }     if (mark == 0)       printf( NO );     else       printf( YES );     cout << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <typename T, bool MIN>   struct ConvexHullTrickAddMonotone {     using Line = pair<T, T>;     deque<Line> deq;     inline bool check(const Line &a, const Line &b, const Line &c) {       return (b.first - a.first) * (c.second - b.second) >=              (b.second - a.second) * (c.first - b.first);     }     inline T f(const Line &a, const T x) { return a.first * x + a.second; }     void add_line(T a, T b) {       if (!MIN) a = -a, b = -b;       Line line(a, b);       if (deq.empty()) return (void)deq.emplace_back(line);       if (deq.front().first <= a) {         while (deq.size() >= 2 && check(line, deq.front(), deq[1]))           deq.pop_front();         deq.emplace_front(line);       } else {         while (deq.size() >= 2 && check(deq[deq.size() - 2], deq.back(), line))           deq.pop_back();         deq.emplace_back(line);       }     }     T query_monotone_inc(T x) {       while (deq.size() >= 2 && f(deq.front(), x) >= f(deq[1], x))         deq.pop_front();       T res = f(deq.front(), x);       return MIN ? res : -res;     }     T query_monotone_dec(T x) {       while (deq.size() >= 2 && f(deq.back(), x) >= f(deq[deq.size() - 2], x))         deq.pop_back();       T res = f(deq.back(), x);       return MIN ? res : -res;     }   };   const long long INF = 1LL << 60;   template <class T>   inline bool chmin(T &a, T b) {     if (a > b) {       a = b;       return 1;     }     return 0;   }   int main() {     int n, m;     cin >> n >> m;     int p;     cin >> p;     vector<int> d(n);     for (int i = 0; i < n - 1; i++) {       int x;       cin >> x;       d[i + 1] = d[i] + x;     }     vector<long long> x(m + 1);     for (int i = 0; i < m; i++) {       int h, t;       cin >> h >> t;       h--;       x[i + 1] = t - d[h] + 1e9;     }     sort(begin(x), end(x));     vector<vector<long long>> dp(p + 1, vector<long long>(m + 1, INF));     for (int i = 0; i <= p; i++) dp[i][0] = 0;     for (int i = 0; i < p; i++) {       ConvexHullTrickAddMonotone<long long, true> cht;       for (int j = 1; j <= m; j++) {         cht.add_line(-(j - 1), dp[i][j - 1]);         dp[i + 1][j] = cht.query_monotone_inc(x[j]) + x[j] * j;       }     }     long long ans = dp[p][m];     for (int i = 0; i <= m; i++) ans -= x[i];     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long INF = 1000000000000;   long long A, B, n, l, t, m, r;   bool check(long long len) {     long long sum = A + (B * (l - 1));     long long mx = A + (B * (len - 1));     if (mx <= t && mx + sum <= 2 * m * t / (len - l + 1))       return true;     else       return false;   }   long long BS(long long L, long long R) {     if (L > R) return r;     long long mid = L + R >> 1;     if (check(mid)) {       r = mid;       return BS(mid + 1, R);     } else       return BS(L, mid - 1);   }   int32_t main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> A >> B >> n;     while (n--) {       cin >> l >> t >> m;       r = l - 1;       BS(l, INF);       if (r >= l)         cout << r <<   n ;       else         cout << -1 <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   template <typename T>   void maxtt(T& t1, T t2) {     t1 = max(t1, t2);   }   template <typename T>   void mintt(T& t1, T t2) {     t1 = min(t1, t2);   }   bool debug = 0;   int n, m, k;   int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};   string direc =  URDL ;   const long long MOD2 = (long long)1000000007 * (long long)1000000007;   long long ln, lk, lm;   void etp(bool f = 0) {     puts(f ?  YES  :  NO );     exit(0);   }   void addmod(int& x, int y, int mod = 1000000007) {     x += y;     if (x >= mod) x -= mod;     if (x < 0) x += mod;     assert(x >= 0 && x < mod);   }   void et(int x = -1) {     printf( %d n , x);     exit(0);   }   long long fastPow(long long x, long long y, int mod = 1000000007) {     long long ans = 1;     while (y > 0) {       if (y & 1) ans = (x * ans) % mod;       x = x * x % mod;       y >>= 1;     }     return ans;   }   long long gcd1(long long x, long long y) { return y ? gcd1(y, x % y) : x; }   char s[3001335];   int id[3001335], cnt;   int mt[3001335];   inline vector<int> cal(int l, int r) {     vector<int> ans;     if (l + 2 == r) {       assert(s[l + 1] ==  * );       ans.push_back(id[l + 1]);       return ans;     }     bool fg = 1;     for (int i = l + 1; i < r;) {       vector<int> tmp = cal(i, mt[i]);       if (fg) {         if (tmp.size() > ans.size()) swap(ans, tmp);         for (int z : tmp) ans.push_back(z);       } else {         if (tmp.size() < ans.size()) swap(ans, tmp);       }       i = mt[i] + 1;       if (i < r) {         assert(s[i] ==  P  || s[i] ==  S );         if (s[i] ==  S ) fg = 0;         i++;       }     }     return ans;   }   void fmain(int tid) {     int r;     scanf( %d , &r);     n = 0;     cnt = 0;     while (1) {       char x = getchar();       if (x ==   n ) break;       if (x ==    ) continue;       if (x ==  * ) {         s[++n] =  ( ;         s[++n] =  * ;         id[n] = ++cnt;         s[++n] =  ) ;       } else         s[++n] = x;     }     vector<int> vp;     for (int(i) = 1; (i) <= (int)(n); (i)++) {       if (s[i] ==  ( )         vp.push_back(i);       else if (s[i] ==  ) ) {         int x = vp.back();         vp.pop_back();         mt[x] = i;         mt[i] = x;       }     }     vector<int> ans = cal(1, n);     vector<bool> vis(cnt + 1, 0);     for (int z : ans) vis[z] = 1;     printf( REVOLTING );     for (int(i) = 1; (i) <= (int)(cnt); (i)++)       if (vis[i]) {         printf(  %lld , (long long)r * ans.size());       } else         printf(  0 );     puts(  );   }   int main() {     int t = 1;     scanf( %d , &t);     for (int(i) = 1; (i) <= (int)(t); (i)++) {       fmain(i);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<int> v[188];   int dist[188][188];   int n, m;   int dp[188][188];   int best[188];   void dfs(int x, int p) {     for (int i = 0; i < v[x].size(); i++) {       int t = v[x][i];       if (t != p) dfs(t, x);     }     best[x] = 1;     for (int c = 1; c <= n; c++) {       for (int j = 0; j < v[x].size(); j++) {         int t = v[x][j];         if (t == p) continue;         dp[x][c] += min(dp[t][c], dp[t][best[t]] + m);       }       dp[x][c] += dist[x][c];       if (dp[x][c] < dp[x][best[x]]) best[x] = c;     }   }   int bel[188];   void process(int x, int p, int c) {     bel[x] = c;     for (int i = 0; i < v[x].size(); i++) {       int t = v[x][i];       if (t == p) continue;       if (dp[t][c] < dp[t][best[t]] + m)         process(t, x, c);       else         process(t, x, best[t]);     }   }   int cost[188];   int main() {     cin >> n >> m;     memset(dist, 0x3f, sizeof(dist));     for (int i = 1; i < n; i++) cin >> cost[i];     dist[1][1] = 0;     for (int i = 1; i < n; i++) {       dist[i + 1][i + 1] = 0;       int x, y;       scanf( %d%d , &x, &y);       dist[x][y] = dist[y][x] = 1;       v[x].push_back(y);       v[y].push_back(x);     }     for (int i = 1; i <= n; i++)       for (int j = 1; j <= n; j++)         for (int k = 1; k <= n; k++)           dist[j][k] = min(dist[j][i] + dist[i][k], dist[j][k]);     for (int i = 1; i <= n; i++)       for (int j = 1; j <= n; j++) dist[i][j] = cost[dist[i][j]];     dfs(1, 0);     cout << dp[1][best[1]] + m <<   n ;     process(1, 0, best[1]);     for (int i = 1; i <= n; i++) cout << bel[i] <<    ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int32_t main() {     int n;     cin >> n;     if (n == 2) return cout << -1, 0;     cout <<  385 n21 n165 n ;     for (int i = 0; i < n - 3; i++) {       cout << 21 * (i + 100) << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   long long int binpowmod(long long int a, long long int b, long long int m) {     a %= m;     long long int res = 1;     while (b > 0) {       if (b & 1) res = res * a % m;       a = a * a % m;       b >>= 1;     }     return res;   }   unsigned long long modInverse(unsigned long long n, int p) {     return binpowmod(n, p - 2, p);   }   int main() {     long long int t, n, j, k, i, f, h, l, r, t1, t2, a, b, x, ans;     cin >> t;     while (t--) {       cin >> n;       string s;       cin >> s;       f = 0;       x = -1;       for (i = 0; i < n; ++i) {         if (s[i] ==  0 ) {           f = 1;           x = i + 1;           break;         }       }       if (f) {         if (x <= n / 2) {           cout << x <<     << n <<     << x + 1 <<     << n <<   n ;         } else {           cout << 1 <<     << x <<     << 1 <<     << x - 1 <<   n ;         }       } else         cout << 1 <<     << n / 2 <<     << ((n + 1) / 2) + 1 <<     << n <<   n ;     }     return 0;   }