malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   #pragma warning(disable : 4996)   using namespace std;   int n, m;   int a[300000];   int s[300000];   int main() {     int i, j, k, l;     cin >> n >> m;     for (i = 0; i < n; i++) scanf( %d , &a[i]);     m--;     int ans = 0;     if (a[m] != 0) ans = 1, a[m] = 0;     if (n == 1) return !printf( %d , ans);     for (i = 0; i < n; i++) s[a[i]]++;     int z = 0;     int now = 0;     int mi = 0x3f3f3f3f;     for (i = 1; i < n; i++) {       if (s[i] == 0) z++;       now += s[i];       mi = min(mi, max(n - 1 - now, z));     }     cout << ans + mi;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int i;     printf( 9 ? ?>> ? ?0 n );     for (i = 8; i >= 0; i--) printf( %d ? ?<>%d n , i, i + 1);     printf(  ? ?<>1 n );     for (i = 9; i >= 0; i--) printf( ?%d>>%d? n , i, i);     printf( >>? n );   }
#include <bits/stdc++.h>   using namespace std;   const int INF = INT_MAX;   const long long mod = 1e9 + 7;   int main() {     cin.tie(0);     ios_base::sync_with_stdio(0);     unsigned long long n;     cin >> n;     unsigned long long c = 2 * 3 * 4 * 5 * 7 * 3;     if (c > n) {       cout <<  0 n ;       return 0;     }     cout << n / c <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, x, y, neg, pos;   int main() {     cin >> n;     for (int i = 0; i < n; i++) {       cin >> x >> y;       if (x < 0)         neg++;       else         pos++;     }     if (pos <= 1 || neg <= 1)       cout <<  Yes ;     else       cout <<  No ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void solve() {     long long n, i, x1, y1, x2, y2;     cin >> x1 >> y1 >> x2 >> y2;     cout << (x2 - x1) * (y2 - y1) + 1 <<   n ;   }   int main() {     std::ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long tt;     cin >> tt;     while (tt--) {       solve();     }     cerr <<   Execution :   << (1.0 * clock()) / CLOCKS_PER_SEC <<  s  n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxN = 1e5 + 5;   long double N, t;   long double Pow(long double b, long long e) {     if (e == 0) return 1;     long double ret = Pow(b, e / 2);     ret *= ret;     if (e % 2) return ret * b;     return ret;   }   int main() {     cin >> N >> t;     N *= Pow(1.000000011, t);     printf( %.12lf , (double)N);   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     long long i, j, c = 0, k, n, x = 0, y = 0;     char ch;     string s;     cin >> n;     cin >> s;     for (i = 0; i < n - 1; i++) {       if (s[i] ==  U ) {         y = y + 1;       }       if (s[i] ==  R ) {         x = x + 1;       }       if (x == y) {         ch = s[i];         if (s[i + 1] == ch) {           c++;         }       }     }     cout << c << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 5;   int n, m, k, fa[N], cnt[N], vis[N];   vector<int> G[N];   vector<pair<int, int> > p, q[N];   int findset(int x) { return x == fa[x] ? x : fa[x] = findset(fa[x]); }   void dfs(int x) {     vis[x] = 1;     for (auto it : G[x]) dfs(it);     for (auto it : q[x])       if (vis[it.first]) cnt[it.second]++;     vis[x] = 0;   }   int main() {     scanf( %d%d , &n, &m);     for (int i = 0; i <= n; i++) fa[i] = i;     int opt, x, y;     while (m--) {       scanf( %d %d , &opt, &x);       if (opt == 1)         scanf( %d , &y), fa[x] = y, G[y].push_back(x);       else if (opt == 2)         p.push_back({findset(x), x});       else {         scanf( %d , &y);         q[x].push_back({p[y - 1].first, k});         q[p[y - 1].second].push_back({x, k});         k++;       }     }     for (int i = 1; i <= n; i++)       if (fa[i] == i) dfs(i);     for (int i = 0; i < k; i++) printf( %s n , cnt[i] == 2 ?  YES  :  NO );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 200 * 1000 + 100;   int n, m, p;   int a[maxn];   int b[maxn];   map<int, int> numb;   map<int, int> numa;   vector<int> ans;   int sum = 0;   void add(int x) {     int val = numa[x] + 1;     numa[x] = val;     if (numb[x] >= val) sum++;   }   void remove(int x) {     int val = numa[x] - 1;     numa[x] = val;     if (numb[x] > val) sum--;   }   int main() {     ios::sync_with_stdio(false);     cin >> n >> m >> p;     for (int i = 0; i < n; ++i) cin >> a[i];     for (int i = 0; i < m; ++i) {       cin >> b[i];       numb[b[i]]++;     }     for (int i = 0; i < p; ++i) {       numa.clear();       sum = 0;       for (int j = i; j < i + (long long)p * (long long)m && j < n; j += p)         add(a[j]);       for (int q = i; (long long)q + (long long)p * (long long)(m - 1) < n;            q += p) {         if (sum == m) ans.push_back(q);         if ((long long)q + (long long)p * (long long)m < n) {           add(a[q + p * m]);           remove(a[q]);         }       }     }     sort((ans).begin(), (ans).end());     cout << (int)(ans).size() << endl;     for (int i = 0; i < (int)(ans).size(); ++i) cout << ans[i] + 1 <<    ;     cout << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   using ull = unsigned long long;   using dbl = double;   using ldb = long double;   using pii = pair<int, int>;   using pll = pair<ll, ll>;   using vi = vector<int>;   using mii = map<int, int>;   using msi = map<string, int>;   using umii = unordered_map<int, int>;   using umsi = unordered_map<string, int>;   using iii = tuple<int, int, int>;   using lll = tuple<ll, ll, ll>;   ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }   ll lcm(ll a, ll b) {     if (!a || !b) return a + b;     return a * (b / gcd(a, b));   }   const int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};   int main() {     cin.tie(0);     ios_base::sync_with_stdio(0);     int tc;     cin >> tc;     while (tc--) {       int n;       string s;       cin >> n;       cin >> s;       int a = 0, b = 0;       for (int i = 0; i < n; i++) {         if (s[i] !=  < ) {           break;         }         a++;       }       for (int i = n - 1; i >= 0; i--) {         if (s[i] !=  > ) {           break;         }         b++;       }       cout << min(a, b) <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int x, y, a, b, n;   void init() {     scanf( %d , &n);     puts( YES );     for (int i = 1; i <= n; i++) {       scanf( %d%d%d%d , &x, &y, &a, &b);       printf( %d n , 2 * abs(x % 2) + abs(y % 2) + 1);     }   }   int main() {     init();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, a, matrica[101][101], pas = 0;     cin >> n;     for (int i = 0; i < n; i++)       for (int j = 0; j < n; j++) {         cin >> a;         matrica[i][j] = a;       }     for (int i = 0; i < n; i++)       for (int j = 0; j < n; j++) {         if (i == j || i == ((n + 1) / 2) - 1 && j != ((n + 1) / 2) - 1 ||             j == ((n + 1) / 2) - 1 && i != ((n + 1) / 2) - 1 ||             i == n - j - 1 && j != ((n + 1) / 2) - 1)           pas += matrica[i][j];       }     cout << pas << endl;     return 0;   }
#include  bits/stdc++.h       #define ll long long int   #define MOD 1000000007   using namespace std;         ll randNum(ll a , ll b){    return a + rand() % (b-a+1);   }      template<class t>   void print(t *a , int n){    for(int i =0 ; i<n ; i++) cout<<a[i]<<   ;    cout<<endl;   }      template<class t>   void print(vector<t> &v){    for(int i=0 ; i<v.size() ; i++) cout<<v[i]<<   ;    cout<<endl;   }         ll gcd(ll a, ll b)   {     if (b == 0)       return a;     return gcd(b, a % b);   }         ll lcm(ll a, ll b)   {       return (a / gcd(a, b)) * b;   }         ll gcdExtended(ll a, ll b, ll *x, ll *y)    {              if (a == 0)        {            *x = 0, *y = 1;            return b;        }             ll x1, y1;       ll gcd = gcdExtended(b%a, a, &x1, &y1);             *x = y1 - (b/a) * x1;        *y = x1;             return gcd;    }       ll modInverse(ll b, ll m)    {        ll x, y;       ll g = gcdExtended(b, m, &x, &y);             if (g != 1)            return -1;             return (x%m + m) % m;    }         ll modDivide(ll a, ll b, ll m)    {        a = a % m;        ll inv = modInverse(b, m);        if (inv == -1)           return -1;        else          return (inv * a) % m;    }       //precompute factorial array if multiple queries are present   unsigned long long nCrModPFermat(unsigned long long n, int r, int p){           if (n < (unsigned long long)r)           return 0;       if (r == 0)           return 1;           unsigned long long fac[n + 1];       fac[0] = 1;       for (unsigned long long i = 1; i <= n; i++)           fac[i] = (fac[i - 1] * i) % p;           return (fac[n] * modInverse(fac[r], p) % p               * modInverse(fac[n - r], p) % p)              % p;   }             //--------         void testcase(){    int n;    cin>>n;    vector<int> v(n);    for(int i=0 ; i<n ; i++) cin>>v[i];    vector<int> prevmax(n) , prevmaxindex(n);    prevmax[0] = v[0];    prevmaxindex[0] = 0;    for(int i=1 ; i<n ; i++) {     if(v[i] > prevmax[i-1]){      prevmax[i] = v[i];      prevmaxindex[i] = i;     }     else{      prevmax[i] = prevmax[i-1];      prevmaxindex[i] = prevmaxindex[i-1];     }     //prevmax[i] = max(v[i] , prevmax[i-1]);    }        int end = n-1;    vector<int> ansindex;    while(end >= 0){     int index = prevmaxindex[end];     ansindex.push_back(index);     end = index-1;    }        for(int i=0 ; i<ansindex.size() ; i++){     if(i == 0){      for(int j=ansindex[i] ; j<n ; j++) cout<<v[j]<<   ;     }     else{      for(int j = ansindex[i] ; j<ansindex[i-1] ; j++) cout<<v[j]<<   ;     }    }    cout<<endl;   }      int main(){    cin.sync_with_stdio(false);    cin.tie(NULL);    cout.tie(NULL);       int tt;       cin>>tt;       tt++;       while(--tt){           testcase();       }       return 0;          }
#include <bits/stdc++.h>   using namespace std;   const int MAXSIZE = 300010;   int rank1[MAXSIZE];   int parent[MAXSIZE];   int visited[MAXSIZE];   int diameter[MAXSIZE];   int N;   vector<int> V[MAXSIZE];   int maxL = 0, last = 0;   int FindSet(int x) {     if (x != parent[x]) parent[x] = FindSet(parent[x]);     return parent[x];   }   void Union(int root1, int root2) {     int x = FindSet(root1), y = FindSet(root2);     if (x == y) return;     if (rank1[x] > rank1[y])       parent[y] = x;     else {       parent[x] = y;       if (rank1[x] == rank1[y]) ++rank1[y];     }   }   void Union1(int root1, int root2) {     int x = FindSet(root1), y = FindSet(root2);     if (x == y) return;     if (rank1[x] > rank1[y])       parent[y] = x;     else {       parent[x] = y;       if (rank1[x] == rank1[y]) ++rank1[y];     }     diameter[FindSet(x)] =         max((double)max(diameter[x], diameter[y]),             ceil(diameter[x] / 2.0) + ceil(diameter[y] / 2.0) + 1);   }   void Init() {     memset(rank1, 0, sizeof(rank1));     for (int i = 0; i < MAXSIZE; ++i) parent[i] = i;   }   void dfs(int v, int path, int p) {     if (path > maxL) {       maxL = path;       last = v;     }     for (int i = 0; i < V[v].size(); i++) {       int to = V[v][i];       if (to != p) dfs(V[v][i], path + 1, v);     }   }   int nextInt() {     int x = 0, p = 1;     char c;     do {       c = getchar();     } while (c <= 32);     if (c ==  - ) {       p = -1;       c = getchar();     }     while (c >=  0  && c <=  9 ) {       x = x * 10 + c -  0 ;       c = getchar();     }     return x * p;   }   void solve() {     int m, q;     N = nextInt();     m = nextInt();     q = nextInt();     Init();     for (int i = 0; i < m; i++) {       int p, q;       p = nextInt();       q = nextInt();       p--, q--;       Union(p, q);       V[p].push_back(q);       V[q].push_back(p);     }     memset(diameter, -1, sizeof(diameter));     memset(visited, 0, sizeof(visited));     for (int i = 0; i < N; i++) {       int setIbelongs = FindSet(i);       if (!visited[setIbelongs]) {         visited[setIbelongs] = 1;         maxL = -1;         dfs(i, 0, -1);         maxL = -1;         dfs(last, 0, -1);         diameter[setIbelongs] = maxL;       }     }     int x, y, p;     while (q--) {       p = nextInt();       x = nextInt();       x--;       if (p == 1) {         printf( %d n , diameter[FindSet(x)]);       } else {         y = nextInt();         y--;         Union1(x, y);       }     }   }   int main() {     Init();     solve();   }
#include <bits/stdc++.h>   using namespace std;   const int NN = 200005;   vector<int> vv[NN];   void _addedge(int x, int y) { vv[x].push_back(y); }   int dfn[NN], low[NN], stk[NN], blo[NN], block, Cnt, Now;   int ins[NN];   void tarjan(int n) {     int i, j;     low[n] = dfn[n] = ++Cnt, ins[stk[++Now] = n] = 1;     for (i = 0; i < vv[n].size(); i++)       if (dfn[j = vv[n][i]] == 0)         tarjan(j), low[n] = min(low[n], low[j]);       else if (ins[j])         low[n] = min(low[n], low[j]);     if (dfn[n] == low[n] && ++block) do         blo[i = stk[Now--]] = block, ins[i] = 0;       while (i != n);   }   int uu[NN];   vector<int> ans[NN];   bool vs[NN];   void check(int n) {     for (int i = 1; i <= n; i++) {       for (int j = 0; j < vv[i].size(); j++)         if (blo[i] != blo[vv[i][j]]) vs[blo[i]] = 1;     }     for (int i = 1; i <= n; i++) ans[blo[i]].push_back(i);     int best = n + 1;     int index = 0;     for (int i = 1; i <= block; i++)       if (!vs[i]) {         if (best > ans[i].size()) {           best = ans[i].size();           index = i;         }       }     printf( %d n , ans[index].size());     for (int i = 0; i < ans[index].size(); i++)       printf( %d%c , ans[index][i], i == ans[index].size() ?   n  :    );   }   int main() {     int n, m, k;     cin >> n >> m >> k;     for (int i = 1; i <= n; i++) scanf( %d , &uu[i]);     for (int i = 0; i < m; i++) {       int x, y;       scanf( %d %d , &x, &y);       int v1 = uu[x], v2 = uu[y];       if (v1 < v2) {         if (v1 + 1 == v2) _addedge(x, y);         if (v1 == 0 && v2 == k - 1) _addedge(y, x);       }       if (v2 < v1) {         if (v2 + 1 == v1) _addedge(y, x);         if (v2 == 0 && v1 == k - 1) _addedge(x, y);       }     }     for (int i = 1; i <= n; i++)       if (dfn[i] == 0) tarjan(i);     check(n);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long n, m, i, j, k, l1 = 1, l2 = 1, s, r[7], z = 0;     cin >> n >> m;     for (i = 7; i < n; i *= 7) l1++;     for (i = 7; i < m; i *= 7) l2++;     if (l1 + l2 < 8)       for (i = 0; i < n; ++i)         for (j = 0; j < m; ++j) {           for (k = 0; k < 7; ++k) r[k] = 0;           for (s = i, k = 0; k < l1; s /= 7, ++k) r[s % 7]++;           for (s = j, k = 0; k < l2; s /= 7, ++k) r[s % 7]++;           for (k = 0; k < 7; k++)             if (r[k] > 1) break;           if (k == 7) z++;         }     cout << z;   }
#include <bits/stdc++.h>   using namespace std;   const int M = 1500 + 5, inf = 1e9 + 7;   int n, m;   pair<int, int> mark[M][M];   bool A[M][M];   inline int state(int i, int j) { return (i * M + j); }   void dfs(int i, int j, int i2, int j2) {     i = (i % n + n) % n, j = (j % m + m) % m;     if (!A[i][j]) return;     if (mark[i][j] == make_pair(i2, j2)) return;     if (mark[i][j].first < inf && mark[i][j] != make_pair(i2, j2)) {       cout <<  Yes n ;       exit(0);     }     mark[i][j] = make_pair(i2, j2);     int dx[] = {1, 0, -1, 0};     int dy[] = {0, 1, 0, -1};     for (int k = 0; k < 4; k++) dfs(i + dx[k], j + dy[k], i2 + dx[k], j2 + dy[k]);   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     for (int i = 0; i < M; i++)       for (int j = 0; j < M; j++) mark[i][j] = make_pair(inf + 1, inf + 1);     int root;     cin >> n >> m;     string s;     for (int i = 0; i < n; i++) {       cin >> s;       for (int j = 0; j < m; j++)         if (s[j] !=  # ) {           A[i][j] = 1;           if (s[j] ==  S ) root = state(i, j);         }     }     dfs(root / M, root % M, root / M, root % M);     cout <<  No n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 211;   vector<pair<int, int> > con[maxn];   vector<pair<int, int> > edge;   bool vis[maxn];   int n, w, tmx, tv, ans;   void dfs(int x, int dis) {     vis[x] = 1;     if (dis > tmx) tmx = dis, tv = x;     for (int i = 0; i < con[x].size(); i++)       if (!vis[con[x][i].first] && w != con[x][i].second)         dfs(con[x][i].first, dis + 1);   }   int go(int x) {     memset(vis, 0, sizeof(vis));     tmx = tv = 0, dfs(x, 0);     memset(vis, 0, sizeof(vis));     tmx = 0, dfs(tv, 0);     return tmx;   }   int main() {     scanf( %d , &n);     int x, y;     for (int i = 1; i < n; i++) {       scanf( %d %d , &x, &y);       con[x].push_back(make_pair(y, i));       con[y].push_back(make_pair(x, i));       edge.push_back(make_pair(x, y));     }     for (w = 1; w < n; w++)       ans = max(ans, go(edge[w - 1].first) * go(edge[w - 1].second));     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   char g[1001][1001];   int main() {     int k, z, n = 2, i, j, b3[30], len = 0, from, prev, y;     scanf( %d , &k);     memset(g,  N , sizeof(g));     z = k;     while (z) b3[len++] = z % 3, z /= 3;     for (i = 0; i < len; i++)       if (b3[i]) {         from = 0;         prev = 1;         for (j = 0; j < i; j++) {           for (z = 0; z < prev; z++)             for (y = 0; y < 3; y++) g[from + z][n + y] =  Y ;           from = n;           prev = 3;           n += 3;         }         for (z = 0; z < prev; z++)           for (y = 0; y < b3[i]; y++) g[from + z][n + y] =  Y ;         from = n;         prev = b3[i];         n += b3[i];         for (; j < len - 1; j++) {           for (z = 0; z < prev; z++) g[from + z][n] =  Y ;           from = n;           n++;           prev = 1;         }         for (z = 0; z < prev; z++) g[from + z][1] =  Y ;       }     for (i = 0; i < n; i++)       for (j = 0; j < n; j++)         if (g[i][j] ==  Y ) g[j][i] =  Y ;     printf( %d n , n);     for (i = 0; i < n; i++) {       g[i][n] = 0;       puts(g[i]);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m, k, sum = 0, i, j, ara[100000], mid, low, high;     scanf( %d , &n);     for (i = 0; i < n; i++) {       scanf( %d , &j);       sum += j;       ara[i] = sum;     }     scanf( %d , &m);     for (i = 0; i < m; i++) {       scanf( %d , &k);       low = 0;       high = n - 1;       for (j = 0;; j++) {         mid = (high + low) / 2;         if (ara[mid] == k) {           printf( %d n , mid + 1);           break;         } else if (ara[mid] > k)           high = mid;         else if (ara[mid] < k)           low = mid + 1;         if (high == low) {           printf( %d n , low + 1);           break;         }       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long pow(long long b, long long e, long long m) {     long long t = 1;     for (; e; e >>= 1, b = b * b % m) e & 1 ? t = t * b % m : 0;     return t;   }   template <class T>   inline bool chkmin(T &a, T b) {     return a > b ? a = b, true : false;   }   template <class T>   inline bool chkmax(T &a, T b) {     return a < b ? a = b, true : false;   }   template <class T>   inline T sqr(T x) {     return x * x;   }   template <typename T>   T gcd(T x, T y) {     for (T t; x; t = x, x = y % x, y = t)       ;     return y;   }   template <class edge>   struct Graph {     vector<vector<edge> > adj;     Graph(int n) {       adj.clear();       adj.resize(n + 5);     }     Graph() { adj.clear(); }     void resize(int n) { adj.resize(n + 5); }     void add(int s, edge e) { adj[s].push_back(e); }     void del(int s, edge e) { adj[s].erase(find(iter(adj[s]), e)); }     vector<edge> &operator[](int t) { return adj[t]; }   };   string S, T;   map<pair<char, char>, int> f;   int main() {     ios_base::sync_with_stdio(false);     cin >> S >> T;     int n = (int)((S).size()), m = (int)((T).size()), L = 0, R = 0;     long long ans = 0;     for (int i = 0; i < n; ++i) {       for (; R < m - 1 && T[R] != S[i]; ++R) ++f[make_pair(T[R], T[R + 1])];       ans += R - L + 1;       if (i < n - 1 && S[i] != S[i + 1]) ans -= f[make_pair(S[i + 1], S[i])];       if (T[L] == S[i]) --f[make_pair(T[L], T[L + 1])], ++L;       if (R < m - 1) ++f[make_pair(T[R], T[R + 1])], ++R;       if (L == m) break;     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAX_N = (int)1e5 + 15;   bool isAns = 1;   int n, m;   vector<vector<int>> gr;   vector<int> a, b;   void in() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cin >> n >> m;     gr.resize(n + 5);     for (int i = 0; i < m; ++i) {       int a, b;       cin >> a >> b;       gr[a].push_back(b);       gr[b].push_back(a);     }   }   void solution() {     if (n == 1) {       isAns = 0;       return;     }     a.resize(n + 1);     int last = 2;     int ind = -1;     for (int i = 1; i <= n; ++i) {       if (gr[i].size() != n - 1) {         ind = i;         a[i] = 1;         int cur = n;         for (auto it : gr[i]) {           a[it] = cur--;         }         break;       }     }     if (ind == -1) {       isAns = 0;       return;     }     for (int i = 1; i <= n; ++i) {       if (a[i] == 0) {         a[i] = last++;       }     }     b = a;     pair<int, int> res = {0, 0};     int i = ind;     int L = 1, R = n;     for (auto it : gr[i]) {       if (a[i] < a[it])         R = min(R, a[it] - 1);       else         L = max(L, a[it] + 1);     }     for (int j = L; j <= R; ++j) {       if (j != a[i]) {         res = {i, j};         break;       }     }     if (res.first == 0) {       isAns = 0;     } else {       b[res.first] = res.second;     }   }   void out() {     if (!isAns) {       cout <<  NO n ;     } else {       cout <<  YES n ;       for (int i = 1; i <= n; ++i) {         cout << a[i] <<    ;       }       cout <<   n ;       for (int i = 1; i <= n; ++i) {         cout << b[i] <<    ;       }       cout <<   n ;     }   }   int main() {     in();     solution();     out();     return 0;   }
#include <bits/stdc++.h>   bool isRight(int *c) {     int sides[3] = {0};     sides[0] = (c[4] - c[2]) * (c[4] - c[2]) + (c[5] - c[3]) * (c[5] - c[3]);     sides[1] = (c[4] - c[0]) * (c[4] - c[0]) + (c[5] - c[1]) * (c[5] - c[1]);     sides[2] = (c[2] - c[0]) * (c[2] - c[0]) + (c[3] - c[1]) * (c[3] - c[1]);     std::sort(sides, sides + 3);     if (sides[0] > 0 && sides[2] == sides[0] + sides[1]) {       return 1;     } else {       return 0;     }   }   int main() {     int points[6] = {0};     for (int k = 0; k < 6; k++) {       scanf( %d , points + k);     }     std::string output =  NEITHER ;     if (isRight(points)) {       output =  RIGHT ;     } else {       for (int k = 0; k < 6; k++) {         ++points[k];         if (isRight(points)) {           output =  ALMOST ;           break;         }         points[k] -= 2;         if (isRight(points)) {           output =  ALMOST ;           break;         }         ++points[k];       }     }     std::cout << output << std::endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long n, m, k, q, bst, onemove, pmove;   int main() {     ios_base::sync_with_stdio(0);     cin >> n >> m >> k;     bst = 1e9;     for (int i = 1; i <= n; i++) {       cin >> q;       if (q < bst && i % 2 == 1) bst = q;     }     if (n % 2 == 0) {       cout << 0 << endl;       return 0;     } else {       onemove = n + 1;       onemove /= 2;       pmove = m / onemove;       if (pmove == 0)         bst = 0;       else if (bst / pmove >= k)         bst = pmove * k;       cout << bst << endl;     }     cin.get();     cin.get();     return 0;   }