malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const int inf(1010101010);   int n, k;   struct node_t {     node_t(char edge, int h) : edge(edge), hier(0), pop(0), h(h) {}     char edge;     int hier, pop;     int h;     vector<node_t *> child;   };   void ins(node_t *x, char *pos) {     x->pop++;     if (!pos[0]) {       x->hier++;       return;     }     for (__typeof((x->child).end()) it((x->child).begin());          it != ((x->child).end()); ++it) {       node_t *y(*it);       if (y->edge == pos[0]) {         ins(y, ++pos);         return;       }     }     x->child.push_back(new node_t(pos[0], x->h + 1)), ins(x->child.back(), ++pos);   }   char bla[2005];   vector<vector<int> > mems;   int new_mem() {     mems.push_back(vector<int>());     return ((int)(mems).size()) - 1;   }   inline int tri(int x) { return x * (x - 1) / 2; }   inline void chmax(int &x, int y) { x = max(x, y); }   inline void merge(vector<int> &dst, vector<int> &erbij, int hh) {     int cnt_bij(((int)(erbij).size()) - 1);     dst.resize(((int)(dst).size()) + cnt_bij);     for (int i(((int)(dst).size()) - 1); ~i; i--) {       for (int bij(0); bij <= cnt_bij && bij <= i; bij++) {         chmax(dst[i], dst[i - bij] + erbij[bij] +                           hh * (tri(i) - tri(i - bij) - tri(bij)));       }     }   }   int calc(node_t *x) {     if (x->hier == 0 && ((int)(x->child).size()) == 1) return calc(x->child[0]);     int pt(new_mem());     if (((int)(x->child).size()) == 0) {       mems[pt].resize(x->pop + 1);       for (int i(0); i <= (x->pop); i++) {         mems[pt][i] = tri(i) * x->h;       }     } else {       node_t *y0(x->child[0]);       int y0pos(calc(y0));       mems[pt].assign((mems[y0pos]).begin(), (mems[y0pos]).end());       int ander(y0->pop);       for (__typeof((x->child).end()) it((x->child).begin() + 1);            it != ((x->child).end()); ++it) {         node_t *y(*it);         int ypos(calc(y));         merge(mems[pt], mems[ypos], x->h);         ander += y->pop;       }       for (int i(ander + 1); i <= (ander + x->hier); i++) {         mems[pt].push_back(mems[pt][ander] + (tri(i) - tri(ander)) * x->h);       }     }     return pt;   }   void solve() {     if (!(cin >> n >> k)) exit(0);     node_t *root(new node_t( - , 0));     for (int i(0); i < (n); i++) {       scanf( %s , bla), ins(root, bla);     }     int rr(calc(root));     cout << mems[rr][k] << endl;   }   int main() {     while (1) solve();   }
#include <bits/stdc++.h>   using namespace std;   struct Node {     int d;     struct Node *left, *right;   };   int p[1000][1000] = {0};   string s, t;   void dp(int i, int j) {     if (j - i + 1 == t.size()) {       int f = 1;       for (int z = 0; z < t.size(); z++) {         if (s[i + z] != t[z]) {           f = 0;           break;         }       }       if (f == 1) p[i][j] = 1;     } else if (j - i + 1 < t.size())       return;     else if (j - i + 1 > t.size()) {       int maxm = 0, l = t.size();       for (int x = i; x <= j - l + 1; x++) {         if (p[x][x + l - 1] > 0) p[i][j]++;       }     }     return;   }   int main() {     int n, m, q;     cin >> n >> m >> q;     int a[q][2];     getchar();     cin >> s;     getchar();     cin >> t;     for (int i = 0; i <= q - 1; i++) {       cin >> a[i][0] >> a[i][1];     }     int l = t.size();     for (int si = l; si <= n; si++) {       for (int j = 0; j <= n - si; j++) dp(j, j + si - 1);     }     for (int i = 0; i <= q - 1; i++) cout << p[a[i][0] - 1][a[i][1] - 1] <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     string one, two;     cin >> one >> two;     int odin = 0, dva = 0;     for (int i = 0; i < one.length(); i++)       if (one[i] ==  1 ) odin++;     for (int j = 0; j < two.length(); j++)       if (two[j] ==  1 ) dva++;     if (odin & 1 && odin + 1 >= dva)       cout <<  YES ;     else if (!(odin & 1) && odin >= dva)       cout <<  YES ;     else       cout <<  NO ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long x, y, n;   long long arr[6];   int main() {     ios_base::sync_with_stdio(0);     cin >> x >> y >> n;     int pos = (n - 1) % 6;     arr[0] = (x + 1000000007) % 1000000007;     arr[1] = (y + 1000000007) % 1000000007;     arr[2] = (y - x + 1000000007 + 1000000007) % 1000000007;     arr[3] = (-x + 1000000007) % 1000000007;     arr[4] = (-y + 1000000007) % 1000000007;     arr[5] = (x - y + 1000000007 + 1000000007) % 1000000007;     cout << arr[pos] << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   double eps = 1e-10;   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     long long h, l;     while (cin >> h >> l) {       double L = 0.0, R = 10000000.0;       long long ans = l * l - h * h;       printf( %.13f n , ans / (2.0 * h));     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<long long> v;   bool super(string s) {     int sv = 0, f = 0;     for (int i = 0; i < s.length(); ++i) {       (s[i] ==  7  ? sv += 1 : f += 1);     }     return (sv == f ? true : false);   }   long long strtoll(string s) {     long long res = 0;     for (int i = 0; i < s.length(); ++i) {       res = res * 10 + (s[i] -  0 );     }     return res;   }   void gennbrs(string s) {     if (s.length() == 11) return;     if (s !=    and super(s)) v.push_back(strtoll(s));     gennbrs(s +  4 );     gennbrs(s +  7 );   }   int main() {     gennbrs(  );     sort(v.begin(), v.end());     int n;     scanf( %d , &n);     for (int i = 0; i < v.size(); ++i) {       if (v[i] >= n) {         cout << v[i] << endl;         break;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, t;   char S[25][100005];   long long f[1048576], dp[1048576];   int ans;   inline void Read(int &p) {     p = 0;     char c = getchar();     for (; c <  0  || c >  9 ; c = getchar())       ;     for (; c >=  0  && c <=  9 ; c = getchar()) p = p * 10 + c -  0 ;   }   inline void XorFWT(int n, long long *A) {     for (int i = 1; i < n; i <<= 1) {       for (int j = 0; j < n; j += (i << 1)) {         for (int k = 0; k < i; k++) {           long long x = A[j + k] + A[j + k + i];           long long y = A[j + k] - A[j + k + i];           A[j + k] = x, A[j + k + i] = y;         }       }     }   }   inline void XorIFWT(int n, long long *A) {     for (int i = 1; i < n; i <<= 1) {       for (int j = 0; j < n; j += (i << 1)) {         for (int k = 0; k < i; k++) {           long long x = A[j + k] + A[j + k + i];           long long y = A[j + k] - A[j + k + i];           A[j + k] = x / 2;           A[j + k + i] = y / 2;         }       }     }   }   inline void mul(long long *A, long long *B, int w) {     for (int i = 0; i < w; i++) A[i] = A[i] * B[i];   }   int main() {     scanf( %d%d , &n, &m);     for (int i = 1; i <= n; i++) scanf( %s , S[i] + 1);     for (int i = 1; i <= m; i++) {       int v = 0;       for (int j = 1; j <= n; j++) v = v * 2 + S[j][i] -  0 ;       f[v]++;     }     for (int i = 1; i < (1 << n); i++) dp[i] = dp[i - (i & -i)] + 1;     for (int i = 0; i < (1 << n); i++) dp[i] = min(dp[i], n - dp[i]);     XorFWT(1 << n, f);     XorFWT(1 << n, dp);     mul(f, dp, 1 << n);     XorIFWT(1 << n, f);     ans = n * m;     for (int i = 0; i < (1 << n); i++) ans = min(ans, int(f[i]));     printf( %d n , ans);   }
#include <bits/stdc++.h>   using namespace std;   const int inf = 1e9;   const long long inf64 = 1e18;   const int mod = inf + 7;   const int N = 2e5 + 10;   int main() {     ios::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     ;     int n, k;     cin >> n >> k;     vector<int> a(n);     for (int i = 0; i < n; i++) cin >> a[i];     ;     vector<int> values;     for (int i = 0; i < n; i++) {       int temp = a[i];       while (temp) {         values.push_back(temp);         temp >>= 1;       }     }     int ans = inf;     for (int x : values) {       vector<int> cnt;       for (int i = 0; i < n; i++) {         int cur = 0, temp = a[i];         while (temp > x) {           temp >>= 1;           cur++;         }         if (temp == x) cnt.push_back(cur);       }       if ((int)cnt.size() < k) continue;       sort((cnt).begin(), (cnt).end());       ans = min(ans, accumulate(cnt.begin(), cnt.begin() + k, 0));     }     cout << ans;   }
#include <bits/stdc++.h>   using namespace std;   const long long MOD = 1e9 + 7;   const long long INF = 2e9;   const long double PI = acos((long double)-1);   const long double EPS = 1e-9;   inline bool isPrime(long long x) {     if (x <= 1) return 0;     if (x <= 3) return 1;     if (!(x % 2) || !(x % 3)) return 0;     long long s = sqrt(1.0 * x) + EPS;     for (long long i = 5; i <= s; i += 6) {       if (!(x % i) || !(x % (i + 2))) return 0;     }     return 1;   }   inline long long fpow(long long n, long long k, long long p = 2e18) {     long long r = 1;     for (; k; k >>= 1) {       if (k & 1) r = r * n % p;       n = n * n % p;     }     return r;   }   inline int inv(int a, long long p = 2e18) { return fpow(a, p - 2, p); }   inline void addmod(int& a, int val, int p = MOD) {     if ((a = (a + val)) >= p) a -= p;   }   inline void submod(int& a, int val, int p = MOD) {     if ((a = (a - val)) < 0) a += p;   }   inline long long gcd(long long a, long long b) {     long long r;     while (b) {       r = a % b;       a = b;       b = r;     }     return a;   }   inline long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }   const int N = 3e5 + 5;   long long n, m;   long long a[N];   vector<int> adj[N];   void Solve() {     cin >> n;     vector<pair<int, int> > edges;     map<pair<int, int>, int> mp;     for (int i = 1; i < n; i++) {       int u, v;       cin >> u >> v;       adj[u].push_back(v);       adj[v].push_back(u);       edges.push_back({u, v});     }     int cnt = 0;     for (int i = 1; i <= n; i++) {       if (int((adj[i]).size()) == 1 && !mp.count({i, adj[i][0]})) {         mp[{i, adj[i][0]}] = mp[{adj[i][0], i}] = cnt++;       }     }     for (auto p : edges) {       int u = p.first;       int v = p.second;       if (mp.count({u, v})) {         cout << mp[{u, v}] <<   n ;       } else {         cout << cnt++ <<   n ;       }     }   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cout << fixed << setprecision(10);     int query = 1;     int start = 1000 * clock() / CLOCKS_PER_SEC;     while (query--) Solve();     cerr <<   nTime elapsed:   << 1000 * clock() / CLOCKS_PER_SEC - start          <<  ms n ;   }
#include <bits/stdc++.h>   using namespace std;   const unsigned long long int mod = 1e9 + 7;   const long long int inf = (long long int)1e18 + 2;   const long long int N = (long long int)1e6 + 2;   vector<vector<pair<long long int, long long int>>> graph;   vector<long long int> ans;   long long int visi[5005];   long long int dfs(long long int src, long long int des, long long int val) {     if (src == des) return 1;     visi[src] = 1;     for (auto x : graph[src]) {       if (!visi[x.first]) {         if (dfs(x.first, des, val)) {           ans[x.second] = max(ans[x.second], val);           return 1;         }       }     }     return 0;   }   long long int ck = 0;   long long int dfs2(long long int src, long long int des, long long int cur) {     if (src == des) return cur == ck;     visi[src] = 1;     for (auto x : graph[src]) {       if (!visi[x.first]) {         if (dfs2(x.first, des, min(cur, ans[x.second]))) {           return 1;         }       }     }     return 0;   }   void solve() {     long long int n, a, b, c;     cin >> n;     graph.resize(n);     ans.resize(n);     for (long long int i = 0; i < n - 1; i++) {       cin >> a >> b;       a--, b--;       graph[a].push_back({b, i});       graph[b].push_back({a, i});       ans[i] = 1;     }     long long int m;     cin >> m;     vector<pair<pair<long long int, long long int>, long long int>> st;     for (long long int i = 0; i < m; i++) {       cin >> a >> b >> c;       a--, b--;       st.push_back({{a, b}, c});       memset(visi, 0, sizeof(visi));       dfs(a, b, c);     }     for (long long int i = 0; i < m; i++) {       memset(visi, 0, sizeof(visi));       ck = st[i].second;       if (!dfs2(st[i].first.first, st[i].first.second, inf)) {         cout << -1 <<   n ;         return;       }     }     for (long long int i = 0; i < n - 1; i++) cout << ans[i] <<    ;     cout <<   n ;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long int t;     t = 1;     while (t--) {       solve();     }     cerr <<   nTime elapsed:   << 1000 * clock() / CLOCKS_PER_SEC <<  ms n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long exgcd(long long a, long long b, long long &x, long long &y) {     long long d = a;     if (b != 0) {       d = exgcd(b, a % b, y, x);       y -= (a / b) * x;     } else {       x = 1;       y = 0;     }     return d;   }   int main() {     long long n, a, b, x, y, t;     cin >> n >> a >> b;     t = exgcd(a, b, x, y);     if (n % t != 0 || (n < a && n < b)) {       puts( NO );     } else {       t = n / t;       long long a1 = (t * x % b + b) % b, b1 = (t * y % a + a) % a;       long long c = n - a1 * a - b1 * b;       if (c % a == 0)         a1 += c / a;       else         b1 += c / b;       if (a1 < 0 || b1 < 0)         puts( NO );       else {         puts( YES );         cout << a1 <<     << b1;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m;     cin >> n >> m;     int res = 0;     bool no = 0;     int i = 0;     while (1) {       i += m;       if (i > n) {         no = 1;         break;       }       if ((2 * i) >= n) {         res = i;         break;       }     }     if (no)       cout <<  -1  << endl;     else       cout << res;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int a[4][4];     int i, j;     for (i = 0; i < 4; i++)       for (j = 0; j < 4; j++) cin >> a[i][j];     for (i = 0; i < 4; i++) {       if (a[i][3]) {         int cnt = 0;         for (j = (i + 1) % 4; j != i; j = (j + 1) % 4) {           {             if (a[j][cnt]) {               cout <<  YES ;               return 0;             }             cnt++;           }         }         if (i == j) {           if (a[i][0] || a[i][1] || a[i][2]) {             cout <<  YES ;             return 0;           }         }       }     }     cout <<  NO ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void solve() {     int n;     cin >> n;     std::vector<int> v;     int maxi = 0;     for (long long i = 0; i < n; i++) {       int a;       cin >> a;       v.push_back(a);       maxi = max(maxi, a);     }     int ans = -1;     for (long long i = 0; i < n; i++) {       if (v[i] == maxi &&           ((v[i] > v[i + 1] && i < n - 1) || (i > 0 && v[i] > v[i - 1]))) {         ans = i + 1;       }     }     cout << ans <<   n ;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     int t = 1;     cin >> t;     while (t--) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long INF = 1e15;   const int MOD = 1e9 + 7;   const double EPS = 1e-9;   const double PI = acos(-1.0);   mt19937 rng((int)chrono::steady_clock::now().time_since_epoch().count());   const int N = 105;   pair<long long, long long> e[N];   long long n, m, a[N];   vector<vector<int>> capacity;   vector<vector<int>> adj;   int bfs(int s, int t, vector<int>& parent) {     fill(parent.begin(), parent.end(), -1);     parent[s] = -2;     queue<pair<int, int>> q;     q.push({s, MOD});     while (!q.empty()) {       int cur = q.front().first;       int flow = q.front().second;       q.pop();       for (int next : adj[cur]) {         if (parent[next] == -1 && capacity[cur][next]) {           parent[next] = cur;           int new_flow = min(flow, capacity[cur][next]);           if (next == t) return new_flow;           q.push({next, new_flow});         }       }     }     return 0;   }   int maxflow(int s, int t) {     int flow = 0;     vector<int> parent(N);     int new_flow;     while (new_flow = bfs(s, t, parent)) {       flow += new_flow;       int cur = t;       while (cur != s) {         int prev = parent[cur];         capacity[prev][cur] -= new_flow;         capacity[cur][prev] += new_flow;         cur = prev;       }     }     return flow;   }   void add_primes(long long x, set<long long>& primes) {     for (int i = 2; i <= x / i; ++i) {       if (x % i == 0) {         primes.insert(i);         while (x % i == 0) x /= i;       }     }     if (x != 1) primes.insert(x);   }   long long cnt(long long x, long long p) {     long long ret = 0;     while (x && x % p == 0) {       ++ret;       x /= p;     }     return ret;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(NULL), cout.tie(NULL);     cin >> n >> m;     adj = vector<vector<int>>(N);     capacity = vector<vector<int>>(N, vector<int>(N));     set<long long> primes;     for (int i = 1; i <= n; ++i) {       cin >> a[i];       add_primes(a[i], primes);     }     for (int i = 1; i <= n; ++i) {       if (i & 1) {         adj[0].push_back(i);         adj[i].push_back(0);       } else {         adj[n + 1].push_back(i);         adj[i].push_back(n + 1);       }     }     for (int i = 0; i < m; ++i) {       cin >> e[i].first >> e[i].second;       int u = e[i].first;       int v = e[i].second;       adj[u].push_back(v);       adj[v].push_back(u);     }     long long ans = 0;     for (auto p : primes) {       for (int i = 1; i <= n; ++i) {         if (i & 1)           capacity[0][i] = cnt(a[i], p);         else           capacity[i][n + 1] = cnt(a[i], p);       }       for (int i = 0; i < m; ++i) {         int u = e[i].first;         int v = e[i].second;         if (u & 1)           capacity[u][v] = cnt(a[u], p);         else           capacity[v][u] = cnt(a[v], p);       }       ans += maxflow(0, n + 1);     }     cout << ans <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   char s1[1010], s2[1010];   int dp[1010][1010][15][2], n, m, k;   int main() {     scanf( %d%d%d , &n, &m, &k);     scanf( %s%s , s1, s2);     for (int i = 1; i <= k; i++) {       for (int j1 = 1; j1 <= n; j1++) {         for (int j2 = 1; j2 <= m; j2++) {           if (s1[j1 - 1] == s2[j2 - 1]) {             dp[j1][j2][i][1] = 1 + max(dp[j1 - 1][j2 - 1][i][1],                                        max(dp[j1 - 1][j2 - 1][i - 1][0],                                            dp[j1 - 1][j2 - 1][i - 1][1]));           }           dp[j1][j2][i][0] = max(dp[j1 - 1][j2][i][1], dp[j1 - 1][j2][i][0]);           dp[j1][j2][i][0] = max(max(dp[j1][j2 - 1][i][1], dp[j1][j2 - 1][i][0]),                                  dp[j1][j2][i][0]);         }       }     }     int ans = max(dp[n][m][k][1], dp[n][m][k][0]);     printf( %d , ans);     return 0;   }
#include <bits/stdc++.h>   #pragma comment(linker,  /STACK:1024000000,1024000000 )   using namespace std;   const int Maxn = 600010, Maxm = 300005, Mo = 1000000007,             sp[8][2] = {{-1, 0}, {1, 0},   {0, 1},  {0, -1},                         {1, 1},  {-1, -1}, {1, -1}, {-1, 1}};   const long long oo = (1LL << 62);   typedef int IArr[Maxn];   typedef long long LArr[Maxn];   typedef double DArr[Maxn];   struct SA {     int fl, dep, nt[28], ct[11];   } sa[Maxn];   int total, tl, M_dep;   void init() {     memset((sa), 0, sizeof((sa)));     fill(sa[0].nt, sa[0].nt + 27, 1);     sa[0].dep = -1;     total = tl = 1;   }   void ins(int c) {     int p = tl;     int np = tl = ++total;     sa[np].dep = sa[p].dep + 1;     for (; !sa[p].nt[c]; p = sa[p].fl) sa[p].nt[c] = np;     int q = sa[p].nt[c];     if (sa[p].dep + 1 == sa[q].dep)       sa[np].fl = q;     else {       int nq = ++total;       sa[nq] = sa[q];       sa[nq].dep = sa[p].dep + 1;       sa[np].fl = sa[q].fl = nq;       for (; sa[p].nt[c] == q; p = sa[p].fl) sa[p].nt[c] = nq;     }   }   int n;   IArr ck;   vector<int> e[Maxn];   string st, s;   void dfs(int u) {     for (int i = 0; i < e[u].size(); i++) {       int v = e[u][i];       dfs(v);       for (int j = 1; j <= n; j++) sa[u].ct[j] += sa[v].ct[j];     }   }   int main() {     ios::sync_with_stdio(0);     cin >> st;     init();     for (int i = 0; i < st.size(); i++) ins(st[i] -  a );     cin >> n;     int l[20], r[20];     for (int i = 1; i <= n; i++) {       cin >> s;       cin >> l[i] >> r[i];       int p = 1;       for (int j = 0; j < s.size(); j++) {         int c = s[j] -  a ;         while (!sa[p].nt[c]) p = sa[p].fl;         int q = sa[p].nt[c];         if (sa[p].dep + 1 == sa[q].dep)           p = q;         else {           int nq = ++total;           sa[nq] = sa[q];           memset((sa[nq].ct), 0, sizeof((sa[nq].ct)));           sa[nq].dep = sa[p].dep + 1;           sa[q].fl = nq;           for (; sa[p].nt[c] == q; p = sa[p].fl) sa[p].nt[c] = nq;           p = total;         }         sa[p].ct[i]++;       }     }     for (int i = 2; i <= total; i++) e[sa[i].fl].push_back((i));     dfs(1);     long long ans = 0;     for (int i = 2; i <= total; i++) {       ck[i] = 1;       for (int j = 1; j <= n; j++)         ck[i] &= ((l[j] <= sa[i].ct[j]) && (sa[i].ct[j] <= r[j]));       if (ck[i]) ans += sa[i].dep - sa[sa[i].fl].dep;     }     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   const double pi = 4 * atan(1);   int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }   int lcm(int a, int b) { return a / gcd(a, b) * b; }   const int LEN = 330;   int main() {     long long x1, y1, x2, y2;     long long n;     long long arr[LEN][3];     long long x, y;     cin >> x1 >> y1;     cin >> x2 >> y2;     cin >> n;     int ans = 0;     for (int i = 0; i < n; i++) cin >> arr[i][0] >> arr[i][1] >> arr[i][2];     for (int i = 0; i < n; i++) {       x = arr[i][0] * x1 + arr[i][1] * y1 + arr[i][2];       y = arr[i][0] * x2 + arr[i][1] * y2 + arr[i][2];       if (x > 0 && y < 0 || x < 0 && y > 0) ans++;     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, k;   int main() {     scanf( %d %d %d , &n, &m, &k);     for (int i = 0; i < k; ++i) {       int x, y;       scanf( %d %d , &x, &y);       x = min(x - 1, n - x);       y = min(y - 1, m - y);       if (min(x, y) <= 4) {         printf( YES );         return 0;       }     }     printf( NO );     return 0;   };