malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int n;     cin >> n;     --n;     int right, left, down, up;     right = left = down = up = n / 4;     n = n - up * 4;     if (n != 0) {       ++right;       --n;     }     if (n != 0) {       ++down;       --n;     }     if (n != 0) {       ++left;       --n;     }     if (n != 0) {       ++up;       --n;     }     int centerx = 0, centery = 0;     cout << centerx <<     << centery << endl;     for (int i = 0; i < right; ++i) {       cout << centerx + i + 1 <<     << centery << endl;     }     for (int i = 0; i < left; ++i) {       cout << centerx - i - 1 <<     << centery << endl;     }     for (int i = 0; i < up; ++i) {       cout << centerx <<     << centery + i + 1 << endl;     }     for (int i = 0; i < down; ++i) {       cout << centerx <<     << centery - i - 1 << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long int t;     cin >> t;     while (t--) {       long long int n;       cin >> n;       long long int a[n];       long long int freq[200001] = {0};       for (long long int i = 0; i < n; i++) {         cin >> a[i];         freq[a[i]]++;       }       sort(a, a + n);       long long int present = 1;       long long int ans = 1;       long long int expected = 0;       long long int count = 0;       int flag = 0;       while (count < n) {         expected = a[count];         present += freq[a[count]] - 1;         if (present >= expected) {           ans = present + 1;         }         count += freq[a[count]];         present += 1;       }       cout << ans << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long r, sum, lim[4], s[4], x[4], y[4], dist, a[3], d, tol;   int k[4][3] = {1, 1, 1, 1, 1, -1, 1, -1, 1, -1, 1, 1};   void func() {     printf( %I64d %I64d %I64d n , (s[1] + s[2]) / 2, (s[1] + s[3]) / 2,            (s[2] + s[3]) / 2);     return;   }   bool check(int k) {     int i;     for (i = 0; i < 4; i++) {       s[i] = (x[i] - r) + ((x[i] - r + k) % 2 + 2) % 2;       if (s[i] > y[i] + r) return 0;     }     sum = s[1] + s[2] + s[3];     if (sum > y[0] + r) return 0;     if (sum >= x[0] - r) return 1;     for (i = 0; i < 4; i++) lim[i] = (y[i] + r) - ((y[i] + r + k) % 2 + 2) % 2;     for (i = 1; i < 4; i++) {       d = min(lim[i] - s[i], lim[0] - sum);       sum += d;       s[i] += d;     }     if (sum < x[0] - r) return 0;     return 1;   }   int main() {     int i, j, cnt, n;     scanf( %d , &cnt);     while (cnt--) {       for (i = 0; i < 4; i++) {         x[i] = -4 * 1e18;         y[i] = 4 * 1e18;       }       dist = -4 * 1e18;       scanf( %d , &n);       while (n--) {         scanf( %I64d %I64d %I64d , a + 0, a + 1, a + 2);         for (i = 0; i < 4; i++) {           tol = k[i][0] * a[0] + k[i][1] * a[1] + k[i][2] * a[2];           if (tol > x[i]) x[i] = tol;           if (tol < y[i]) y[i] = tol;         }       }       for (i = 0; i < 4; i++) {         if (dist < x[i] - y[i]) dist = x[i] - y[i];       }       tol = max(x[0] / 4 - y[1] / 4 - y[2] / 4 - y[3] / 4 - 5,                 x[1] / 4 + x[2] / 4 + x[3] / 4 - y[0] / 4 - 5);       r = max(tol, (dist + 1) / 2);       while (1) {         if (check(1)) {           func();           break;         } else if (check(0)) {           func();           break;         } else           r++;       }     }   }
#include <bits/stdc++.h>   const int N = 65550;   int ru[N], sum[N];   int n;   int s[N], t[N], cc = 0;   int main() {     int i;     scanf( %d , &n);     for (i = 0; i < n; i++) scanf( %d%d , &ru[i], &sum[i]);     for (i = 0; i < n; i++) {       int now = i;       while (ru[now] == 1) {         cc++;         s[cc] = now;         t[cc] = sum[now];         ru[now]--;         ru[sum[now]]--;         sum[sum[now]] ^= now;         now = sum[now];       }     }     printf( %d n , cc);     for (i = 1; i <= cc; i++) printf( %d %d n , s[i], t[i]);     return 0;   }
#include <bits/stdc++.h>   int a[200010];   int main() {     long long ans = 0;     int m = 0, n;     scanf( %d n , &n);     for (int i = 1; i <= n; i++) {       int a1, b1, a2, b2;       scanf( %d%d%d%d n , &a1, &b1, &a2, &b2);       if (a1 + b1 >= a2 + b2) {         a[++m] = a1 + b1;         a[++m] = a2 + b2;         ans = ans + a1 + a2;       } else if (a1 > b2)         ans += a1 - b2;       else if (a2 < b1)         ans += a2 - b1;     }     std::sort(a + 1, a + m + 1);     for (int i = 1; i <= m; i++)       if (i & 1) ans -= a[i];     printf( %I64d n , ans);   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 2e5 + 9;   const int MAX = 2e2 + 9;   const double ep = 1e-6;   const int mod = 998244353;   const int INF = 0x3f3f3f3f;   const double inf = 1e20;   const double pi = acos(-1);   vector<int> vec[maxn];   int n, m, k, d[maxn], cnt1, ans[maxn], tot;   bool vis[maxn];   bool solve1() {     queue<int> q;     cnt1 = 0;     for (int i = (1); i <= (n); ++i) {       if (d[i] < k) q.push(i), vis[i] = 1;     }     while (!q.empty()) {       int p = q.front();       q.pop();       cnt1++;       if (d[p] == k - 1) {         ans[tot = 1] = p;         bool ju = 0;         for (int i : vec[p]) {           if (d[i] < k - 1) continue;           for (int j : vec[p]) {             if (i == j) break;             if (d[j] < k - 1) continue;             auto k = lower_bound(vec[j].begin(), vec[j].end(), i);             if (k == vec[j].end() || (*k) != i) {               ju = 1;               break;             }           }           if (ju) break;           ans[++tot] = i;         }         if (!ju && tot == k) {           puts( 2 );           for (int i = (1); i <= (k); ++i) printf( %d  , (ans[i]));           puts(  );           return 1;         }       }       d[p] = 0;       for (int to : vec[p]) {         d[to]--;         if (vis[to]) continue;         if (d[to] < k) {           vis[to] = 1;           q.push(to);         }       }     }     if (n - cnt1 < k) return 0;     printf( %d %d n , (1), (n - cnt1));     for (int i = (1); i <= (n); ++i)       if (!vis[i]) printf( %d  , (i));     puts(  );     return 1;   }   void solve() {     scanf( %d%d%d , &n, &m, &k);     for (int i = (1); i <= (n); ++i) d[i] = 0, vis[i] = 0, vec[i].clear();     for (int i = (1); i <= (m); ++i) {       int u, v;       scanf( %d%d , &(u), &(v));       vec[u].emplace_back(v);       vec[v].emplace_back(u);       d[u]++;       d[v]++;     }     if (1ll * k * (k - 1) / 2 > m) {       puts( -1 );       return;     }     for (int i = (1); i <= (n); ++i) sort(vec[i].begin(), vec[i].end());     if (solve1()) return;     puts( -1 );   }   int main() {     int T = 1;     scanf( %d , &(T));     while (T--) solve();   }
#include <bits/stdc++.h>   using namespace std;   vector<long long> v;   int main() {     long long p, k, rem;     cin >> p >> k;     v.push_back(-p / k);     for (int i = 0;; i++) {       for (long long x = v.back() / k - 1; x <= v.back() / k + 1; x++) {         if (v.back() - x * k >= 0 && v.back() - x * k < k) {           v.push_back(-x);           break;         }       }       if (v[v.size() - 1] * k + v[v.size() - 2] < k && v.back() < k &&           v.back() >= 0)         break;     }     while (v.back() == 0) v.pop_back();     v.push_back(0);     cout << v.size() << endl;     for (int i = 0; i < v.size(); i++) {       if (i)         cout << v[i] * k + v[i - 1] <<    ;       else         cout << v[i] * k + p <<    ;     }   }
#include <bits/stdc++.h>   using namespace std;   const int MAX = 1e5 + 55;   int x[MAX];   int main() {     int n;     cin >> n;     double sum = 0;     int a[n + 1];     for (int i = 0; i < n; i++) cin >> a[i];     sort(a, a + n, greater<int>());     for (int i = 0; i < n; i++) {       if (i % 2 == 0)         sum += a[i] * a[i];       else         sum -= a[i] * a[i];     }     cout << setprecision(11) << fixed << sum * 3.1415926536;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct edge {     int u, v, l, id;     edge() {}     edge(int a, int b, int c, int d) { u = a, v = b, l = c, id = d; }     bool operator<(const edge &p) const {       return l < p.l || (l == p.l && id < p.id);     }   };   char *p1, *p2, buffer[10000009];   int n, m, cur;   int l[1200009], r[1200009];   vector<int> v[1200009];   edge e[300009];   int ans[300009];   int f[100009], sz[100009];   pair<int, int> bf[29][100009], bsz[29][100009];   int tp[29];   void rd(int &x) {     char ch = 0;     x = 0;     while (ch <  0  || ch >  9 )       ch = (p1 == p2 && (p2 = (p1 = buffer) + fread(buffer, 1, 10000000, stdin),                          p1 == p2)                 ? EOF                 : *p1++);     while (ch >=  0  && ch <=  9 )       x = x * 10 + (ch & 15),       ch = (p1 == p2 && (p2 = (p1 = buffer) + fread(buffer, 1, 10000000, stdin),                          p1 == p2)                 ? EOF                 : *p1++);   }   int fnd(int x) { return x == f[x] ? x : fnd(f[x]); }   int uni(int d, int a, int b) {     a = fnd(a), b = fnd(b);     if (a == b) return 0;     if (sz[a] > sz[b]) swap(a, b);     int ret = 0;     if ((sz[a] & 1) && (sz[b] & 1)) ret = 2;     bf[d][++tp[d]] = pair<int, int>(a, f[a]);     bsz[d][tp[d]] = pair<int, int>(b, sz[b]);     f[a] = b;     sz[b] += sz[a];     return ret;   }   void roll(int d) {     for (int &i = tp[d]; i >= 1; i--) {       pair<int, int> tf = bf[d][i], tsz = bsz[d][i];       f[tf.first] = tf.second;       sz[tsz.first] = tsz.second;     }   }   void build(int a, int ll, int rr) {     l[a] = ll;     r[a] = rr;     if (ll < rr) {       int mid = (ll + rr) >> 1;       build(a << 1, ll, mid);       build(a << 1 | 1, mid + 1, rr);     }   }   void add(int a, int ll, int rr, int val) {     if (ll > rr) return;     if (l[a] > rr || r[a] < ll) return;     if (l[a] >= ll && r[a] <= rr) {       v[a].push_back(val);       return;     }     add(a << 1, ll, rr, val);     add(a << 1 | 1, ll, rr, val);   }   void solve(int d, int sm, int a) {     int tsm = sm;     for (int i = 0; i < (int)v[a].size(); i++) {       int p = v[a][i];       tsm -= uni(d, e[p].u, e[p].v);     }     if (l[a] != r[a])       solve(d + 1, tsm, a << 1 | 1), solve(d + 1, tsm, a << 1);     else {       while (cur <= m && tsm) {         cur++;         if (e[cur].id > l[a])           continue;         else {           tsm -= uni(d, e[cur].u, e[cur].v);           add(1, e[cur].id, l[a] - 1, cur);         }       }       ans[l[a]] = cur > m ? -1 : e[cur].l;     }     roll(d);   }   int main() {     rd(n), rd(m);     if (n & 1) {       for (int i = 1; i <= m; i++) printf( -1 n );       return 0;     }     for (int i = 1; i <= n; i++) f[i] = i, sz[i] = 1;     for (int i = 1, a, b, c; i <= m; i++) {       rd(a), rd(b), rd(c);       e[i] = edge(a, b, c, i);     }     sort(e + 1, e + m + 1);     build(1, 1, m);     solve(1, n, 1);     for (int i = 1; i <= m; i++) printf( %d n , ans[i]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     string s, t;     cin >> s >> t;     vector<int> p;     int a[27] = {0};     for (int i = 0; i < s.size(); i++) {       if (s[i] ==  ? ) {         p.push_back(i);       } else {         a[int(s[i]) - 96]++;       }     }     if (p.size() == 0) {       cout << s;       return 0;     }     int i = 0, j = 0;     while (j < p.size()) {       if (i == t.size()) {         i = 0;       }       if (a[int(t[i]) - 96] > 0) {         a[int(t[i]) - 96]--;       } else {         s[p[j]] = t[i];         j++;       }       i++;     }     cout << s << endl;   }
#include <bits/stdc++.h>   const int MAXN = 2e5 + 7;   int a[MAXN];   int main() {     int N;     scanf( %d , &N);     for (int i = 1; i <= N; ++i) scanf( %d , &a[i]);     int ans = 0;     int j = 1, i;     for (i = 2; i <= N;) {       while (i <= N && a[i] <= 2 * a[i - 1]) {         ++i;         ans = (ans > i - j ? ans : i - j);       }       j = i;       ++i;     }     ans = (ans > i - j ? ans : i - j);     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 7, POWN = (1 << N), MOD = 1000 * 1000 * 1000 + 7;   int ans[POWN], res[POWN], a[POWN][POWN], b[POWN][POWN], c[POWN][POWN];   void powm(int p, int n) {     for (int i = 0; i < n; i++)       for (int j = 0; j < n; j++) {         b[i][j] = a[i][j];         a[i][j] = (i == j);       }     while (p) {       if (p & 1) {         for (int i = 0; i < n; i++)           for (int j = 0; j < n; j++) {             c[i][j] = 0;             for (int k = 0; k < n; k++)               c[i][j] = (c[i][j] + (long long)a[i][k] * b[k][j]) % MOD;           }         for (int i = 0; i < n; i++)           for (int j = 0; j < n; j++) a[i][j] = c[i][j];       }       p >>= 1;       for (int i = 0; i < n; i++)         for (int j = 0; j < n; j++) {           c[i][j] = 0;           for (int k = 0; k < n; k++)             c[i][j] = (c[i][j] + (long long)b[i][k] * b[k][j]) % MOD;         }       for (int i = 0; i < n; i++)         for (int j = 0; j < n; j++) b[i][j] = c[i][j];     }   }   void mul(int n) {     for (int i = 0; i < n; i++) {       res[i] = 0;       for (int j = 0; j < n; j++)         res[i] = (res[i] + (long long)ans[j] * a[j][i]) % MOD;     }     for (int i = 0; i < n; i++) ans[i] = res[i];   }   int main() {     ios_base::sync_with_stdio(false);     ans[0] = 1;     for (int i = 0; i < N; i++) {       for (int j = 0; j < (1 << i); j++) {         ans[j | (1 << i)] = ans[j];         ans[j] = 0;       }       int w;       cin >> w;       if (!w) continue;       for (int j = 0; j < (1 << (i + 1)); j++)         for (int k = 0; k < (1 << (i + 1)); k++) {           a[j][k] = 0;           for (int l = 0; l < (1 << i); l++) {             int msk = ((1 << (i + 1)) | (l << 1) | 1);             bool ok = true;             for (int m = 0; m < i + 1; m++)               if ((j & (1 << m)) && (k & (1 << m)) && (msk & (1 << m)) &&                   (msk & (1 << (m + 1)))) {                 ok = false;                 break;               }             if (ok) a[j][k]++;           }         }       powm(w, 1 << (i + 1));       mul(1 << (i + 1));     }     cout << ans[(1 << N) - 1] <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, s, t, g;   int dl[200009], head, last, q[20009];   int dep[20010];   int h[20010], top = 1;   struct edge {     int to, net;     long long w;   } es[200009];   void add(int u, int v, long long w) {     top++;     es[top].w = w;     es[top].net = h[u];     h[u] = top;     es[top].to = v;     return;   }   inline int read() {     int sum = 0, fh = 1;     char c = getchar();     while (c >  9  || c <  0 ) {       if (c ==  - ) fh = -1;       c = getchar();     }     while (c >=  0  && c <=  9 ) {       sum *= 10;       sum += c -  0 ;       c = getchar();     }     return sum * fh;   }   bool bfs() {     for (int i = 1; i <= t; i++) dep[i] = 0;     head = 1;     last = 1;     dl[1] = s;     dep[s] = 1;     while (head <= last) {       int u = dl[head];       head++;       for (int i = h[u]; i; i = es[i].net) {         if (dep[es[i].to] == 0 && es[i].w) {           dep[es[i].to] = dep[u] + 1;           last++;           dl[last] = es[i].to;         }       }     }     return dep[t];   }   long long ans = 0, ssm = 0;   long long dfs(int now, long long zg) {     if (now == t) {       return zg;     }     long long sum = 0;     for (int i = h[now]; i; i = es[i].net) {       int v = es[i].to;       if (dep[v] == dep[now] + 1 && es[i].w) {         long long res = dfs(v, min(es[i].w, zg));         sum += res;         zg -= res;         es[i].w -= res;         es[i ^ 1].w += res;       }     }     if (sum == 0) dep[now] = 0;     return sum;   }   int main() {     n = read();     m = read();     g = read();     s = 0;     t = n + m + 2;     for (int i = 1; i <= n; i++) q[i] = read();     for (int i = 1; i <= n; i++) {       int x = read();       if (q[i] == 0)         add(s, i, x), add(i, s, 0);       else         add(i, t, x), add(t, i, 0);     }     for (int i = 1; i <= m; i++) {       int opt = read(), w = read(), k = read();       ssm += w;       for (int j = 1; j <= k; j++) {         int x = read();         if (opt == 0) {           add(n + i, x, 1e18);           add(x, n + i, 0);         } else {           add(x, n + i, 1e18);           add(n + i, x, 0);         }       }       int gt = read();       if (opt == 0) {         add(s, n + i, w + g * gt);         add(n + i, s, 0);       } else {         add(n + i, t, w + g * gt);         add(t, n + i, 0);       }     }     while (bfs()) {       ans += dfs(s, 1e18);     }     cout << ssm - ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int r, c, n, mnm, x, y, ret = 0;     cin >> r >> c >> n >> mnm;     vector<vector<int> > mapa(r, vector<int>(c, 1));     for (int i = 0; i < n; i++) {       cin >> x >> y;       mapa[x - 1][y - 1] = 2;     }     for (int i = 1; i <= r; i++) {       for (int j = 1; j <= c; j++) {         for (int k = 0; k < r - (i - 1); k++) {           for (int l = 0; l < c - (j - 1); l++) {             int cnt = 0;             for (int m = 0; m < i; m++) {               for (int n = 0; n < j; n++) {                 if (mapa[k + m][l + n] == 2) cnt++;               }             }             if (cnt >= mnm) ret++;           }         }       }     }     cout << ret << endl;   }
#include <bits/stdc++.h>   using namespace std;   signed main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long n;     cin >> n;     vector<pair<long long, long long> > v(n);     for (long long i = 0; i < n; i++) {       cin >> v[i].first >> v[i].second;     }     long long sum = 0;     for (long long i = 0; i < n; i++) {       for (long long j = i + 1; j < n; j++) {         pair<long long, long long> p1 = v[i], p2 = v[j];         bool flag = true;         if (p1.first > p2.first || p1.first == p2.first && i < j) {           swap(p1, p2);           flag = false;         }         vector<pair<long long, pair<long long, long long> > > p(4);         if (flag) {           p[0] = {p1.first, {-i, 1}};           p[1] = {p1.first + p1.second, {-i, 2}};           p[2] = {p2.first, {-j, 3}};           p[3] = {p2.first + p2.second, {-j, 4}};         } else {           p[0] = {p1.first, {-j, 1}};           p[1] = {p1.first + p1.second, {-j, 2}};           p[2] = {p2.first, {-i, 3}};           p[3] = {p2.first + p2.second, {-i, 4}};         }         sort(p.begin(), p.end());         vector<long long> g(4);         for (long long h = 0; h < 4; h++) {           g[h] = p[h].second.second;         }         if (g[0] == 1 && g[2] == 2 && g[1] == 3 && g[3] == 4 ||             g[0] == 2 && g[2] == 1 && g[3] == 3 && g[1] == 4)           sum += 2;         else if (g[0] == 1 && g[3] == 2 || g[1] == 2 && g[2] == 1 ||                  g[1] == 1 && g[2] == 2 ||                  g[1] == 1 && g[2] == 3 && g[3] == 2 && g[0] == 4 ||                  g[0] == 1 && g[2] == 2 && g[3] == 3 && g[1] == 4)           sum++;       }     }     cout << sum;   }
#include <bits/stdc++.h>   using namespace std;   const long long INF = 1e18;   const long long mod = 1e9 + 7;   const long long modd = 1;   const long long N = 1e5 + 5;   void solve() {     long long n, m;     cin >> n >> m;     long long a[n + 1][m + 1];     for (long long i = 0; i < n; i++)       for (long long j = 0; j < m; j++) cin >> a[i][j];     for (long long i = 0; i < n; i++) a[i][m] = a[i][m - 1] + 1;     for (long long i = 0; i < m; i++) a[n][i] = a[n - 1][i] + 1;     long long ans = 0;     for (long long i = n - 1; i >= 0; i = i - 1) {       for (long long j = m - 1; j >= 0; j = j - 1) {         if (a[i][j] == 0) a[i][j] = min(a[i + 1][j], a[i][j + 1]) - 1;         if (a[i][j] >= a[i + 1][j] || a[i][j] >= a[i][j + 1]) {           cout << -1;           return;         }         ans = ans + a[i][j];       }     }     cout << ans;   }   int32_t main() {     std::ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);     long long t = 1;     for (long long i = 1; i <= t; i = i + 1) {       solve();       cout << endl;     }   }
#include <bits/stdc++.h>   int a, b, i, j, n;   std::string s;   bool isgood(int n) {     int i;     for (i = 2; i < n; i++)       if (n % i == 0) return false;     return true;   }   void sol() {     if (!isgood(b)) {       printf( NO  );       return;     }     for (i = a + 1; i < b; i++)       if (isgood(i)) {         printf( NO  );         return;       }     printf( YES  );   }   int main() {   #pragma comment(linker,  /STACK:16777216 )     while (scanf( %d %d  , &a, &b) != EOF) {       sol();     }   }
#include <bits/stdc++.h>   using namespace std;   long long par[200000];   long long ran[200000];   long long cnt[200000];   void init(long long n) {     for (long long i = 0; i <= n; i++) {       par[i] = i;       ran[i] = 0;     }   }   long long finds(long long x) {     if (par[x] == x)       return x;     else       return par[x] = finds(par[x]);   }   void unite(long long x, long long y) {     x = finds(x);     y = finds(y);     if (x == y) return;     if (ran[x] < ran[y]) {       par[x] = y;     } else {       par[y] = x;       if (ran[x] == ran[y]) ran[x]++;     }   }   long long quick_mod(long long a, long long n) {     long long tmp = a;     long long ans = 1;     while (n) {       if (n % 2 == 1) ans = (tmp * ans) % 1000000007;       n /= 2;       tmp = (tmp * tmp) % 1000000007;     }     return ans;   }   int main() {     long long n, k;     scanf( %lld%lld , &n, &k);     init(n);     for (long long i = 0; i < n - 1; i++) {       long long a, b, c;       scanf( %lld%lld%lld , &a, &b, &c);       if (c == 0) unite(a, b);     }     for (long long i = 1; i <= n; i++) {       finds(i);       cnt[par[i]]++;     }     long long ans = quick_mod(n, k);     for (long long i = 1; i <= n; i++) {       ans = (ans + 1000000007 - quick_mod(cnt[i], k)) % 1000000007;     }     printf( %lld n , ans);   }
#include <bits/stdc++.h>   const int P = 29;   using namespace std;   inline int read() {     int x = 0, f = 1;     char ch = getchar();     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) f = -1;       ch = getchar();     }     while (ch >=  0  && ch <=  9 ) {       x = x * 10 + ch -  0 ;       ch = getchar();     }     return x * f;   }   int n, k, cnt;   int a[20];   int main() {     n = read();     k = read();     for (int i = 1; i <= n; i++) {       int x = 0, base = 1;       for (int j = 1; j <= k; j++) {         int p = read();         x = x * base + p;         base *= 2;       }       bool flag = 0;       for (int j = 1; j <= cnt; j++)         if (a[j] == x) flag = 1;       if (!flag) a[++cnt] = x;     }     for (int i = 1; i <= cnt; i++)       for (int j = 1; j <= cnt; j++)         if ((a[i] & a[j]) == 0) {           cout <<  YES  << endl;           return 0;         }     cout <<  NO ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int x[3];   int y[3];   bool isok(int a, int b, int c) {     if (b > c && a > c && a < b) return true;     if (b < c && a > b && a < c) return true;     return false;   }   bool TP() {     if (x[1] == x[0] && isok(y[2], y[1], y[0])) return true;     if (x[2] == x[0] && isok(y[1], y[2], y[0])) return true;     if (x[2] == x[1] && isok(y[0], y[1], y[2])) return true;     if (y[1] == y[0] && isok(x[2], x[1], x[0])) return true;     if (y[2] == y[0] && isok(x[1], x[2], x[0])) return true;     if (y[2] == y[1] && isok(x[0], x[1], x[2])) return true;     return false;   }   int main() {     for (int i = 0; i < 3; i++) cin >> x[i] >> y[i];     if (x[0] == x[1] && x[1] == x[2])       cout <<  1  << endl;     else if (y[0] == y[1] && y[1] == y[2])       cout <<  1  << endl;     else if ((x[0] != x[1] && x[1] != x[2] && x[2] != x[0]) &&              (y[0] != y[1] && y[1] != y[2] && y[2] != y[0])) {       cout <<  3  << endl;     } else {       if (TP())         cout <<  3  << endl;       else         cout <<  2  << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int execute() {     int n;     cin >> n;     string s;     s.assign(n / 2 - 1,  1 );     if (n % 2) {       cout << 7;     } else {       cout << 1;     }     cout << s << endl;     return 0;   }   int TE = true;   bool mTest = true;   int main() {     ios_base::sync_with_stdio(false);     if (mTest) cin >> TE;     while (TE--) {       execute();     }     return 0;   }