malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());   const int N = 1100;   int n;   vector<int> g[N];   int ed[N][3];   int ans[10 * N][3];   int ansSz;   void addAns(int v, int u, int x) {     ans[ansSz][0] = v + 1;     ans[ansSz][1] = u + 1;     ans[ansSz][2] = x;     ansSz++;   }   int getLeaf(int v, int par, int u) {     if (v == u) return -1;     if ((int)g[v].size() == 1) return v;     int res = -2;     for (int w : g[v]) {       if (w == par) continue;       int z = getLeaf(w, v, u);       if (z == -1) return -1;       res = z;     }     return res;   }   int main() {     scanf( %d , &n);     for (int i = 1; i < n; i++) {       int v, u, w;       scanf( %d%d%d , &v, &u, &w);       v--;       u--;       ed[i][0] = v;       ed[i][1] = u;       ed[i][2] = w;       g[v].push_back(u);       g[u].push_back(v);     }     for (int v = 0; v < n; v++) {       if ((int)g[v].size() == 2) {         printf( NO n );         return 0;       }     }     for (int i = 1; i < n; i++) {       int v = ed[i][0], u = ed[i][1], x = ed[i][2] / 2;       vector<int> vv, uu;       if ((int)g[v].size() == 1) {         vv.push_back(v);       } else {         for (int w : g[v]) {           int z = getLeaf(w, v, u);           if (z != -1) vv.push_back(z);           if ((int)vv.size() == 2) break;         }       }       if ((int)g[u].size() == 1) {         uu.push_back(u);       } else {         for (int w : g[u]) {           int z = getLeaf(w, u, v);           if (z != -1) uu.push_back(z);           if ((int)uu.size() == 2) break;         }       }       if ((int)uu.size() == 1) swap(vv, uu);       if ((int)uu.size() == 1) {         addAns(vv[0], uu[0], 2 * x);       } else if ((int)vv.size() == 1) {         addAns(vv[0], uu[0], x);         addAns(vv[0], uu[1], x);         addAns(uu[0], uu[1], -x);       } else {         addAns(vv[0], uu[0], x);         addAns(vv[1], uu[1], x);         addAns(vv[0], vv[1], -x);         addAns(uu[0], uu[1], -x);       }     }     printf( YES n );     printf( %d n , ansSz);     for (int i = 0; i < ansSz; i++)       printf( %d %d %d n , ans[i][0], ans[i][1], ans[i][2]);     return 0;   }
#include <bits/stdc++.h>   constexpr int MAXN = 1e5 + 5;   using namespace std;   int tot, n, cnt;   unordered_map<int, int> Map;   vector<int> vec;   vector<pair<string, int>> opt;   string s;   inline void discretization() {     sort(vec.begin(), vec.end());     cnt = unique(vec.begin(), vec.end()) - vec.begin();     for (int i = 0; i < cnt; i++) Map[vec[i]] = i;   }   struct Node {     Node *lson, *rson;     int cnt, l, r;     long long sum[5];   } Tree[MAXN << 1];   inline Node *newNode(Node *&root) { return root = &Tree[++tot]; }   inline void update(Node *root) {     root->cnt = root->lson->cnt + root->rson->cnt;     for (int i = 0; i < 5; i++)       root->sum[i] = root->lson->sum[i] +                      root->rson->sum[((i - root->lson->cnt) % 5 + 5) % 5];   }   inline void build(int L, int R, Node *root) {     root->l = L, root->r = R;     if (L == R) return;     int mid = (L + R) >> 1;     build(L, mid, newNode(root->lson)), build(mid + 1, R, newNode(root->rson));   }   inline void modify(int pos, int val, Node *root) {     if (root->l == pos && root->r == pos) {       root->cnt += val, root->sum[1] += val * vec[pos];       return;     }     int mid = (root->l + root->r) >> 1;     if (pos <= mid) modify(pos, val, root->lson);     if (pos > mid) modify(pos, val, root->rson);     update(root);   }   int main() {     std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);     cin >> n;     for (int i = 1, x; i <= n; i++) {       cin >> s;       if (s ==  add )         cin >> x, opt.push_back({s, x}), vec.push_back(x);       else if (s ==  del )         cin >> x, opt.push_back({s, x});       else         opt.push_back({s, 0});     }     discretization(), build(0, cnt, Tree);     for (auto i : opt) {       if (i.first ==  add )         modify(Map[i.second], 1, Tree);       else if (i.first ==  del )         modify(Map[i.second], -1, Tree);       else         cout << Tree->sum[3] << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int mod = 1e9 + 7;   void add(int &a, int b) {     a += b;     if (a >= mod) a -= mod;   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     int n;     cin >> n;     vector<int> dp(20002), pre(20002, 0);     int zero = 10000;     int ans = 0;     for (int i = 1; i <= n; ++i) {       int x;       cin >> x;       ++pre[zero];       for (int j = 0; j <= zero << 1; ++j) {         if (j >= x) add(dp[j], pre[j - x]);         if (j + x <= zero * 2) add(dp[j], pre[j + x]);       }       add(ans, dp[zero]);       if (i == n) continue;       pre = dp;       memset(&dp[0], 0, sizeof dp[0] * dp.size());     }     cout << ans;   }
#include <bits/stdc++.h>   using namespace std;   int n, k;   map<int, int> m;   string s;   long long ans;   bool flag;   void solve() {     cin >> n;     cin >> k;     vector<int> a(n);     int maxi = 0;     for (auto i = 0; i < n; i++) cin >> a[i];     ;     for (auto i = 0; i < n; i++) {       maxi = max(maxi, a[i]);       m[a[i]]++;       if (m[a[i]] >= k) {         cout << 0;         return;       }     }     long long ans = INT_MAX;     for (auto x = 1; x < 200000; x++) {       queue<int> q;       q.push(x);       long long an = 0;       int mul = 0;       int K = 0;       while (!q.empty() && K < k) {         int N = q.size();         while (N-- && K < k) {           int y = q.front();           q.pop();           int count = m[y];           if ((y * 2 - 1) < maxi) {             q.push(y * 2);             q.push(y * 2 + 1);           }           if (count > (k - K)) count = (k - K);           an += count * mul;           K += count;         }         mul++;       }       if (K == k) ans = min(an, ans);     }     cout << ans;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int t = 1;     while (t--) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   const int S = 400004;   int last, tr[S][26], fail[S], len[S], tot = 0, eg = 1, h[S], nx[S << 1],                                         v[S << 1], e[S];   char c[S];   void insert(int &last, char c) {     c -=  a ;     int p = last, now = ++tot;     len[now] = len[last] + 1;     while (p != -1 && !tr[p][c]) {       tr[p][c] = now;       p = fail[p];     }     if (p == -1)       fail[now] = 0;     else {       int q = tr[p][c];       if (len[p] + 1 == len[q])         fail[now] = q;       else {         int w = ++tot;         len[w] = len[p] + 1;         fail[w] = fail[q];         for (int i = 0; i < 26; ++i) tr[w][i] = tr[q][i];         fail[q] = fail[now] = w;         while (p != -1 && tr[p][c] == q) {           tr[p][c] = w;           p = fail[p];         }       }     }     last = now;   }   inline void egadd(int uu, int vv) {     nx[++eg] = h[uu];     h[uu] = eg;     v[eg] = vv;   }   long long res = 0;   void dfs(int x) {     for (int i = h[x]; i; i = nx[i]) {       dfs(v[i]);       e[x] += e[v[i]];     }     res += (len[x] - len[fail[x]]) * 1ll * e[x] * e[x];   }   int main() {     int T;     scanf( %d , &T);     while (T--) {       tot = last = 0;       fail[0] = -1;       res = 0;       scanf( %s , c + 1);       for (int i = 1; c[i]; ++i) insert(last, c[i]);       int p = 0;       for (int i = 1; c[i]; ++i) {         p = tr[p][c[i] -  a ];         e[p] = 1;       }       for (int i = 1; i <= tot; ++i) egadd(fail[i], i);       dfs(0);       printf( %lld n , res);       for (int i = 0; i <= tot; ++i) {         fail[i] = len[i] = 0;         h[i] = 0;         e[i] = 0;         for (int j = 0; j < 26; ++j) tr[i][j] = 0;       }       eg = 1;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1000 + 3;   void read(int &x) {     char ch;     bool flag = 0;     for (ch = getchar(); !isdigit(ch) && ((flag |= (ch ==  - )) || 1);          ch = getchar())       ;     for (x = 0; isdigit(ch); x = (x << 1) + (x << 3) + ch - 48, ch = getchar())       ;     x *= 1 - 2 * flag;   }   string fuck[maxn];   int edge[105][105];   map<string, int> cou;   int a[105], b[105];   int out = -1;   vector<string> output;   int main() {     int n, m;     scanf( %d%d , &n, &m);     for (int i = 0; i < n; i++) {       string tmp;       cin >> tmp;       fuck[i] = tmp;       cou[tmp] = i;     }     for (int i = 0; i < m; i++) {       string c, d;       cin >> c >> d;       edge[cou[c]][cou[d]] = 1;       edge[cou[d]][cou[c]] = 1;     }     int aa[50];     for (int i = 0; i < (1 << n); i++) {       memset(aa, 0, sizeof(aa));       int top = 0;       for (int j = 0; j < n; j++) {         if (i & (1 << j)) {           aa[j] = 1;           top++;         }       }       bool f = 1;       for (int j = 0; j < n; j++) {         for (int k = j + 1; k < n; k++) {           if (aa[j] && aa[k] && edge[j][k]) {             f = 0;             break;           }         }       }       if (!f) continue;       if (top > out) {         out = top;         output.clear();         for (int j = 0; j < n; j++) {           if (aa[j]) output.push_back(fuck[j]);         }       }     }     cout << output.size() << endl;     sort(output.begin(), output.begin() + out);     for (int i = 0; i < output.size(); i++) cout << output[i] << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long inf = 10000000;   int main() {     int n;     string s;     scanf( %d , &n);     cin >> s;     for (int i = 0; i < s.size(); i++) {       for (int j = 1; j < 25; j++) {         if (i + j * 4 < 100) {           if (s[i] ==  *  && s[i + j] ==  *  && s[i + j * 2] ==  *  &&               s[i + j * 3] ==  *  && s[i + j * 4] ==  * ) {             printf( yes );             return 0;           }         }       }     }     printf( no );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <typename T>   void print_array(T* arr, int num) {     for (int(i) = (0); (i) < (num); (i)++) cout << arr[i] <<    ;     cout <<   n ;   }   template <typename T>   void print_vector(vector<T> vec) {     for (int(i) = (0); (i) < (vec.size()); (i)++) cout << vec[i] <<    ;     cout <<   n ;   }   void setIO() {}   int n, x, p0[5010], b0[5010], arr[5010], b[5010], p[5010];   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     setIO();     cin >> n;     for (int(i) = (0); (i) < (n); (i)++) {       cout <<  ?   << 0 <<     << i <<   n ;       cout.flush();       cin >> p0[i];     }     for (int(i) = (0); (i) < (n); (i)++) {       cout <<  ?   << i <<     << 0 <<   n ;       cout.flush();       cin >> b0[i];     }     int ans = 0;     bitset<5010> chk;     for (int(i) = (0); (i) < (n); (i)++) {       chk.reset();       int found = 1;       for (int(j) = (0); (j) < (n); (j)++) {         p[j] = b0[j] ^ i;         if (p[j] >= n || chk[p[j]]) {           found = 0;           break;         }         chk[p[j]] = 1;       }       if (!found) continue;       for (int(j) = (0); (j) < (n); (j)++) b[p[j]] = j;       for (int(j) = (0); (j) < (n); (j)++) {         if (p0[j] != (p[0] ^ b[j]) || b0[j] != (p[j] ^ b[0])) {           found = 0;           break;         }       }       if (found) {         ans++;         if (ans == 1)           for (int(j) = (0); (j) < (n); (j)++) arr[j] = p[j];       }     }     cout <<  !  <<   n  << ans <<   n ;     for (int(i) = (0); (i) < (n); (i)++) cout << arr[i] <<    ;     cout.flush();   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, k;     double L, v1, v2;     cin >> n >> L >> v1 >> v2 >> k;     double p = 2 * (n / k - (n % k == 0)) + 1;     printf( %.10f , double(L * (p * v2 + v1)) / double(v2 * (p * v1 + v2)));   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int tt;     cin >> tt;     while (tt--) {       int k;       cin >> k;       string s, a, b;       cin >> s >> a >> b;       int n = (int)(s).size();       vector<int> x;       vector<int> p(k, -1);       bool goodx = true;       for (int i = 0; i < n; ++i) {         int c = s[i] -  a ;         if (p[c] != -1) {           if (p[c] < a[i] -  a ) {             goodx = false;             break;           } else if (p[c] == a[i] -  a ) {             continue;           } else {             goodx = true;             break;           }         }         p[c] = a[i] -  a ;         x.push_back(i);       }       bool found = false;       for (int u = 0; u <= (int)(x).size(); ++u) {         if (u == (int)(x).size() && !goodx) {           continue;         }         p.assign(k, -1);         vector<bool> occ(k, false);         bool ok = true;         for (int i = 0; i < u; ++i) {           if (occ[a[x[i]] -  a ]) {             ok = false;             break;           }           occ[a[x[i]] -  a ] = true;           p[s[x[i]] -  a ] = a[x[i]] -  a ;         }         if (u < (int)(x).size()) {           int pos = a[x[u]] -  a  + 1;           while (pos < k && occ[pos]) {             ++pos;           }           if (pos == k) {             ok = false;           } else {             p[s[x[u]] -  a ] = pos;             occ[pos] = true;           }         }         if (!ok) {           continue;         }         int pos = 0;         for (int i = 0; i < n; ++i) {           if (p[s[i] -  a ] != -1) {             continue;           }           while (occ[pos]) {             ++pos;           }           p[s[i] -  a ] = pos;           occ[pos] = true;         }         string res =   ;         for (int i = 0; i < n; ++i) {           res += char(p[s[i] -  a ] +  a );         }         if (res > b) {           continue;         }         found = true;         cout <<  YES n ;         for (int i = 0; i < k; ++i) {           if (p[i] != -1) {             continue;           }           while (occ[pos]) {             ++pos;           }           p[i] = pos;           occ[pos] = true;         }         for (int i = 0; i < k; ++i) {           cout << char(p[i] +  a );         }         cout <<   n ;         break;       }       if (!found) {         cout <<  NO n ;       }     }   }
#include <bits/stdc++.h>   using namespace std;   struct Point {     long long x, y;     int id;   };   long long judge(Point p0, Point p1, Point p2) {     return (p1.x - p0.x) * (p2.y - p1.y) - (p2.x - p1.x) * (p1.y - p0.y);   }   long long cmp(Point a, Point b) {     if (a.x == b.x) return a.y < b.y;     return a.x < b.x;   }   Point s[100005];   int main() {     int n;     while (~scanf( %d , &n)) {       for (int i = 1; i <= n; i++)         scanf( %lld%lld , &s[i].x, &s[i].y), s[i].id = i;       sort(s + 1, s + 1 + n, cmp);       int flag, ans;       int a = 0, b = 0, c = 0;       for (int i = 3; i <= n; i++) {         flag = 0, ans = 0;         if (judge(s[1], s[2], s[i]) == 0) ans++;         if (ans == 0) {           a = s[1].id, b = s[2].id, c = s[i].id;           flag = 1;           break;         }       }       printf( %d %d %d n , a, b, c);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int clique_size(vector<int> *graph, vector<int> &govs, int *visited,                   int starting) {     visited[starting] = 1;     int size = 1;     for (int i = 0; i < graph[starting].size(); i++) {       if (!visited[graph[starting][i]]) {         size += clique_size(graph, govs, visited, graph[starting][i]);       }     }     return size;   }   int main(int argc, char *argv[]) {     vector<int> graph[1001];     vector<int> govs;     int visited[1001] = {0};     int n, m, k;     cin >> n >> m >> k;     for (int i = 0; i < k; i++) {       int c;       cin >> c;       govs.push_back(c);     }     for (int i = 0; i < m; i++) {       int u, v;       cin >> u >> v;       graph[u].push_back(v);       graph[v].push_back(u);     }     int connected_points = 0;     int max_state_size = 0;     int answer = 0;     for (int i = 0; i < k; i++) {       int count = clique_size(graph, govs, visited, govs[i]);       connected_points += count;       max_state_size = (count > max_state_size) ? count : max_state_size;       answer += count * (count - 1) / 2;     }     int remaining = n - connected_points;     answer -= max_state_size * (max_state_size - 1) / 2;     max_state_size += remaining;     answer += max_state_size * (max_state_size - 1) / 2;     cout << answer - m <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   inline long long read() {     long long s = 0;     bool f = 0;     char ch =    ;     while (!isdigit(ch)) {       f |= (ch ==  - );       ch = getchar();     }     while (isdigit(ch)) {       s = (s << 3) + (s << 1) + (ch ^ 48);       ch = getchar();     }     return (f) ? (-s) : (s);   }   inline void write(long long x) {     if (x < 0) {       putchar( - );       x = -x;     }     if (x < 10) {       putchar(x +  0 );       return;     }     write(x / 10);     putchar((x % 10) +  0 );     return;   }   const int N = 100005;   int n, Num, a[N];   struct Zidianshu {     int Trie[N * 25][25], cnt;     int End[N * 25];     inline void Init() { cnt = 0; }     inline void Insert(int Num) {       int i, Root = 0;       for (i = 0; i <= 23; i++) {         int oo = (Num & (1 << i)) >> i;         if (!Trie[Root][oo]) Trie[Root][oo] = ++cnt;         Root = Trie[Root][oo];       }       End[Root]++;     }     inline int Query(int Num, int Want) {       int i, Root = 0;       for (i = 0; i <= 23; i++) {         int oo = ((Want & (1 << i)) >> i) ^ ((Num & (1 << i)) >> i);         if (!Trie[Root][oo]) return 0;         Root = Trie[Root][oo];       }       return End[Root];     }   } Trie;   int main() {     Trie.Init();     int i;     long long ans = 0;     n = read();     Num = read();     for (i = 1; i <= n; i++) {       a[i] = read();       ans += 1ll * Trie.Query(a[i], Num);       Trie.Insert(a[i]);     }     write(ans), putchar(  n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long N = 2e9;   long long sum(long long l, long long r) { return (l + r) * (r - l + 1) / 2; }   int main() {     long long n, H;     cin >> n >> H;     long long l = H, r = 2e9, ans = -1;     while (l <= r) {       long long mid = (l + r) >> 1;       if (n >= sum(H, mid) + sum(1, mid) - mid)         ans = mid, l = mid + 1;       else         r = mid - 1;     }     if (ans != -1) {       cout << 2 * ans - H +                   ((n - sum(H, ans) - sum(1, ans) + ans) + ans - 1) / ans            << endl;     } else {       l = 1, r = min(H, N);       while (l <= r) {         long long mid = (l + r) >> 1;         if (n >= sum(1, mid))           ans = mid, l = mid + 1;         else           r = mid - 1;       }       cout << ans + (n - sum(1, ans) + ans - 1) / ans << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     scanf( %d n , &n);     string str;     getline(cin, str);     int ans = 0;     int subans = 0;     for (int i = 0; i < n; i++) {       if (str[i] !=    ) {         int ascii = (int)str[i];         if (ascii >= 65 && ascii <= 90) {           subans++;         }         ans = max(ans, subans);       } else {         subans = 0;       }     }     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   long long s, x;   string S, X;   long long dp[64][2];   long long d__p(int i, int st) {     if (i == S.size() && st)       return 0;     else if (i == S.size())       return 1;     long long &res = dp[i][st];     if (res != -1) return res;     res = 0;     int x = S[i] -  0 ;     int y = X[i] -  0 ;     for (int a = 0; a <= 1; a++) {       for (int b = 0; b <= 1; b++) {         int remember = (a + b + st) > 1;         int Sum = a + b + st;         Sum %= 2;         int Xor = a ^ b;         if (Sum != x || Xor != y) continue;         res += d__p(i + 1, remember);       }     }     return res;   }   int main() {     cin >> s >> x;     for (int i = 63; i >= 0; i--) {       if (s & (1LL << i))         S +=  1 ;       else         S +=  0 ;       if (x & (1LL << i))         X +=  1 ;       else         X +=  0 ;     }     reverse(S.begin(), S.end());     reverse(X.begin(), X.end());     memset(dp, -1, sizeof dp);     cout << d__p(0, 0) - 2 * (s == x);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   class DREAD {     friend int fread();     static const int buff_max = 20000000 + 10;     char buf[buff_max], *pt;       public:     void clear() {       for (; isspace(*pt); ++pt)         ;     }     void Init() {       buf[fread(buf, 1, buff_max, stdin)] = EOF;       pt = buf;     }     bool eoln() { return *pt ==   n ; }     inline bool eof() { return *pt == EOF; }     int Int() {       bool pos = 1;       int res = 0;       for (; !isdigit(*pt) && *pt !=  -  && !eof(); ++pt)         ;       if (*pt ==  - ) pos = 0, ++pt;       for (; isdigit(*pt); ++pt) res = res * 10 + (*pt -  0 );       return pos ? res : -res;     }   } READ;   const int N_MAX = 5000 + 10;   int N, M, seq[N_MAX], bad[N_MAX];   namespace Nwork {   int gcd[N_MAX];   int GCD(int a, int b) { return b ? GCD(b, a % b) : a; }   int p[N_MAX], e[N_MAX], cnt;   int exist(int p) { return *lower_bound(bad + 1, bad + M + 1, p) == p ? -1 : 1; }   int calc(int x) {     cnt = 0;     for (int i = 2, k = int(sqrt(x)); i <= k; ++i) {       if (x == 1) break;       if (x % i == 0) {         p[++cnt] = i;         for (e[cnt] = 0; x % i == 0; x /= i) ++e[cnt];       }     }     if (x != 1) p[++cnt] = x, e[cnt] = 1;     int ret = 0;     for (int i = 1; i <= cnt; ++i) ret += exist(p[i]) * e[i];     return ret;   }   void main() {     gcd[1] = seq[1];     for (int i = 2; i <= N; ++i) gcd[i] = GCD(gcd[i - 1], seq[i]);     sort(bad + 1, bad + M + 1);     for (int r = N; r >= 1; --r)       if (calc(gcd[r]) < 0)         for (int i = 1; i <= r; ++i) {           seq[i] /= gcd[r];           gcd[i] /= gcd[r];         }     int ret = 0;     for (int i = 1; i <= N; ++i) ret += calc(seq[i]);     printf( %d n , ret);   }   }  // namespace Nwork   namespace Ninit {   void init() {     N = READ.Int(), M = READ.Int();     for (int i = 1; i <= N; ++i) seq[i] = READ.Int();     for (int i = 1; i <= M; ++i) bad[i] = READ.Int();   }   }  // namespace Ninit   int main() {     READ.Init();     Ninit::init();     Nwork::main();     return 0;   }
#include <bits/stdc++.h>   #pragma GCC optimize( O3 )   using namespace std;   enum { MOD0 = 1000000000, MOD7 = 1000000007, MOD9 = 1000000009 };   template <typename T>   ostream &operator<<(ostream &cout, vector<T> &a) {     for (size_t i = 0; i < a.size(); ++i) cout << a[i] <<    ;     return cout;   }   template <typename T>   ostream &operator<<(ostream &cout, vector<vector<T> > &a) {     for (size_t i = 0; i < a.size(); ++i) cout << a[i] << endl;     return cout;   }   int p[256];   inline bool eq(int a, int b) { return p[a] == p[b]; }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     for (int i = 0; i < sizeof(p) / sizeof(*p); ++i) {       p[i] = i;     }     p[ 1 ] = p[ i ] = p[ l ];     p[ 0 ] = p[ o ];     for (int i =  A ; i <=  Z ; ++i) {       p[i] = p[i -  A  +  a ];     }     string s;     cin >> s;     int n;     cin >> n;     string a;     for (int i = 0; i < n; ++i) {       cin >> a;       if (a.size() != s.size()) {         continue;       }       bool bad = 1;       for (int j = 0; j < a.size(); ++j) {         if (!eq(a[j], s[j])) {           bad = 0;           break;         }       }       if (bad) {         cout <<  No  <<   n ;         return 0;       }     }     cout <<  Yes  <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long MOD = 1e9 + 7;   const double err = 1e-12;   const double PI = 3.141592653589793;   const int N = 1e5 + 5;   int n;   vector<int> res;   void solve() {     cin >> n;     if (n & 1) {       cout << 1 <<    ;       n--;       for (int i = 2; i <= n; i += 2) cout << i + 1 <<     << i <<    ;       cout << endl;     } else {       cout << n <<    ;       n--;       for (int i = 2; i <= (n - 1); i += 2) cout << i + 1 <<     << i <<    ;       cout << 1 << endl;     }   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     int t = 1;     while (t--) solve();     return 0;   }