malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   vector<pair<int, int> > pts;   vector<pair<int, int> > rods1;   vector<pair<int, int> > rods2;   vector<int> r1;   vector<int> r2;   vector<int> rr1;   vector<int> rr2;   bool cmp(const pair<int, int> &a, const pair<int, int> &b) {     return a.first < b.first;   }   inline int m_dist(pair<int, int> a, pair<int, int> b) {     return abs(a.first - b.first) + abs(a.second - b.second);   }   int main() {     ios::sync_with_stdio(0);     int n, m;     int a, b, r;     cin >> n >> m;     for (int i = 0; i < n; i++) {       cin >> a >> b;       pts.push_back(make_pair(a, b));     }     for (int i = 0; i < m; i++) {       cin >> r;       rods1.push_back({r, i});       rods2.push_back({r, i});     }     sort(rods1.begin(), rods1.end());     sort(rods2.begin(), rods2.end());     for (int i = 0; i < n - 1; i += 2) {       r1.push_back(m_dist(pts[i], pts[i + 1]) +                    m_dist(pts[i + 1], pts[(i + 2) % n]));       r2.push_back(m_dist(pts[(i - 1 + n) % n], pts[i % n]) +                    m_dist(pts[i % n], pts[(i + 1) % n]));     }     bool check1 = true;     for (auto r : r1) {       auto fr =           lower_bound(rods1.begin(), rods1.end(), pair<int, int>(r, 0), cmp);       if (fr == rods1.end() || r != (*fr).first) {         check1 = false;         break;       } else {         rr1.push_back((*fr).second);         rods1.erase(fr);       }     }     bool check2 = true;     for (auto r : r2) {       auto fr =           lower_bound(rods2.begin(), rods2.end(), pair<int, int>(r, 0), cmp);       if (fr == rods2.end() || r != (*fr).first) {         check2 = false;         break;       } else {         rr2.push_back((*fr).second);         rods2.erase(fr);       }     }     if (check1 || check2) {       cout <<  YES n ;       if (check1) {         for (auto e : rr1) {           cout <<  -1  <<     << e + 1 <<    ;         }       } else {         for (auto e : rr2) {           cout << e + 1 <<     <<  -1  <<    ;         }       }     } else {       cout <<  NO n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t--) {       int a, b, c = 0, e, i, n;       cin >> n;       vector<char> v;       char s[n + 1];       cin >> s;       for (i = 0; i < n; i++) {         if ((s[i] -  0 ) % 2 != 0) {           c++;           v.push_back(s[i]);           if (c == 2) break;         }       }       if (c < 2)         cout <<  -1 n ;       else {         for (i = 0; i < 2; i++) cout << v[i];         cout <<   n ;       }     }   }
#include <bits/stdc++.h>   using namespace std;   const double eps = 1e-8;   const int inf = 0x3f3f3f3f;   const int Minf = 0x7f7f7f7f;   const long long INF = 0x3f3f3f3f3f3f3f3fll;   const long long MINF = 0x7f7f7f7f7f7f7f7fll;   const int N = 1e6 + 50;   long long val[N], fa[N];   int pp[N], ps[N];   int to[N][2], cnt[N * 2];   int main() {     long long n, k;     scanf( %lld%lld , &n, &k);     for (int i = (2); i <= n; ++i)       scanf( %lld%lld , &fa[i], &val[i]), val[i] ^= val[fa[i]];     long long ans = 0;     for (int j = (62); j >= 0; --j) {       int tot = 0;       long long num = 0;       for (int i = (1); i <= n; ++i) {         int d = (val[i] >> j) & 1;         if (to[pp[i]][d] == 0) to[pp[i]][d] = ++tot;         cnt[to[pp[i]][d]]++;         pp[i] = to[pp[i]][d];       }       for (int i = (1); i <= n; ++i) {         int d = (val[i] >> j) & 1;         num += cnt[to[ps[i]][d]];       }       int flag = 0;       if (num < k) k -= num, ans |= (1ll << j), flag = 1;       for (int i = (1); i <= n; ++i) {         int d = (val[i] >> j) & 1;         ps[i] = to[ps[i]][d ^ flag];       }       memset(to, 0, sizeof to);       memset(cnt, 0, sizeof cnt);     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long int powr(long long int a, long long int b) {     long long int res = 1;     while (b) {       if (b % 2) res = (a * res) % 1000000007;       a = (a * a) % 1000000007;       b /= 2;     }     return res;   }   void extentded_eucledian(long long int a, long long int b, long long int &ex,                            long long int &ey) {     if (b == 0) {       ex = 1;       ey = 0;       return;     }     extentded_eucledian(b, a % b, ex, ey);     swap(ex, ey);     ey -= (a / b) * ex;   }   bool cmp(pair<pair<long long int, long long int>, long long int> &a,            pair<pair<long long int, long long int>, long long int> &b) {     if (a.first.first != b.first.first) return (a.first.first < b.first.first);     return (a.first.second < b.first.second);   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long int tc = 1;     cin >> tc;     while (tc--) {       long long int n;       cin >> n;       vector<pair<pair<long long int, long long int>, long long int>> vec;       vector<long long int> ans(n);       for (long long int i = 0; i < n; ++i) {         long long int x, y;         cin >> x >> y;         vec.push_back(make_pair(make_pair(x, y), i));       }       sort(vec.begin(), vec.end(), cmp);       long long int curr = 1, maxr = vec[0].first.second, wasn1 = 1, wasn2 = 1;       ans[vec[0].second] = 1;       stack<long long int> s;       for (long long int i = 1; i < n; ++i) {         if (maxr >= vec[i].first.first)           s.push(vec[i].second);         else {           while (!s.empty()) {             long long int tmp = s.top();             s.pop();             ans[tmp] = curr;           }           curr = 3 - curr;           s.push(vec[i].second);         }         maxr = max(maxr, vec[i].first.second);       }       while (!s.empty()) {         long long int tmp = s.top();         s.pop();         ans[tmp] = curr;       }       for (long long int i : ans)         if (i == 1) wasn1 = 0;       for (long long int i : ans)         if (i == 2) wasn2 = 0;       if (wasn1 || wasn2)         cout <<  -1 n ;       else {         for (auto lstelem : ans) cout << lstelem <<    ;         cout <<    n ;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long int n, t;     cin >> n >> t;     long int arr[n + 1];     bool visited[n + 1];     for (long int i = 1; i < n; i++) {       cin >> arr[i];       visited[i] = false;     }     long int i = 1;     while (visited[i] == false && i != t && i != n) {       visited[i] = true;       i = i + arr[i];     }     if (i == t) {       cout <<  YES ;     } else {       cout <<  NO ;     }     return 0;   }
#include <bits/stdc++.h>   int a[2][200000], b[2][200000], c[2][200000], n, m, i, j, x, y, z;   char s[2][200000 + 1];   int main() {     scanf( %d%d%s%s , &n, &m, s[0], s[1]);     for (i = n - 1, x = n; i >= 0; i--) {       if (s[0][i] ==  X ) x = i;       c[0][i] = x;     }     for (i = n - 1, x = n; i >= 0; i--) {       if (s[1][i] ==  X ) x = i;       c[1][i] = x;     }     i = 0;     while (i < n) {       ++z;       while (i < n && s[0][i] ==  X  && s[1][i] ==  X ) ++i;       if (i < n) x = s[0][i] ==  X ;       while (i < n) {         for (; i < n && s[x][i] ==  . ; i++) a[x][i] = ++y, b[x][i] = z;         if (i < n && s[x ^ 1][i] ==  .  && s[x ^ 1][i - 1] ==  . )           x ^= 1, --i;         else           break;       }     }     while (m--) {       scanf( %d%d , &x, &y);       --x, --y;       i = x % n, j = y % n;       x /= n, y /= n;       if (i > j || (i == j && a[x][i] > a[y][j]))         z = i, i = j, j = z, z = x, x = y, y = z;       if (x == y && c[x][i] == c[y][j])         printf( %d n , j - i);       else {         if (c[x][i] - 1 <= j)           z = c[x][i] - i - 1, i = c[x][i] - 1;         else           z = j - i, i = j;         if (!a[x][i]) x ^= 1, ++z;         if (!a[y][j]) y ^= 1, ++z;         if (a[y][j] > a[x][i])           z += a[y][j] - a[x][i];         else           z += a[x][i] - a[y][j];         printf( %d n , b[y][j] == b[x][i] ? z : -1);       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   double find(int x, int y) { return (sqrt(x * x + y * y)); }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int r, d;     int t;     cin >> r >> d;     cin >> t;     int c = 0;     while (t--) {       int x, y, q;       cin >> x >> y >> q;       double l;       l = find(x, y);       int a = r - d;       int b = a + d;       if (l - q >= a && l + q <= r) c++;     }     cout << c << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 1e5;   const int MAXR = 1;   const int MAXC = 1;   const int INF = (int)1e9;   priority_queue<int, vector<int>, greater<int>> q1;   priority_queue<int, vector<int>, less<int>> q2;   int arr[MAXN];   vector<pair<int, int>> v(MAXN);   vector<vector<int>> adjl(MAXN);   queue<int> q;   set<pair<int, int>> s;   int n;   int x4[] = {-1, 0, 1, 0};   int y4[] = {0, 1, 0, -1};   void createGraph() {     while (!q.empty()) {       int vn = q.front();       q.pop();       pair<int, int> p = v[vn];       int deg = p.first;       int xs = p.second;       if (deg == 0) continue;       if (adjl[vn].size() == deg) continue;       int cxs = 0;       for (int j = 0; j < adjl[vn].size(); ++j) {         cxs ^= adjl[vn][j];       }       int ns = xs ^ cxs;       ;       adjl[vn].push_back(ns);       ;       adjl[ns].push_back(vn);       if (v[ns].first - adjl[ns].size() == 1) {         q.push(ns);       }     };   }   void createEdgeSet() {     for (int i = 0; i < adjl.size(); ++i) {       for (int j = 0; j < adjl[i].size(); ++j) {         int src = i;         int dest = adjl[i][j];         pair<int, int> p1 = make_pair(src, dest);         pair<int, int> p2 = make_pair(dest, src);         if (s.find(p1) == s.end() && s.find(p2) == s.end()) {           s.insert(p1);         }       }     };   }   int main(void) {     ios::sync_with_stdio(false);     cin >> n;     v.resize(n);     adjl.resize(n);     int d, sv;     for (int i = 0; i < n; ++i) {       cin >> d >> sv;       v[i] = make_pair(d, sv);       if (d == 1) {         q.push(i);       }     };     createGraph();     createEdgeSet();     cout << s.size() << endl;     for (set<pair<int, int>>::iterator it = s.begin(); it != s.end(); it++) {       pair<int, int> p = *it;       cout << p.first <<     << p.second << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int a, b;     cin >> a >> b;     if (a == b) {       cout << (a * 10) <<     << (b * 10) + 1;     } else if (a + 1 == b) {       cout << (min(a, b) * 10) + 9 <<     << (max(a, b) * 10);     } else if (a == 9 && b == 1) {       cout << a <<     << b * 10;     } else       cout << -1;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   #pragma comment(linker,  /STACK:256000000 )   struct __ {     __() {       ios_base::sync_with_stdio(false);       cin.tie(NULL);     }   } _;   template <typename I>   inline void in(I l, I r) {     while (l != r) cin >> *l, ++l;   }   template <typename I>   inline void out(I l, I r, char D =    ) {     if (l != r) {       cout << *l;       while (++l != r) cout << D << *l;     }     cout <<   n ;   }   struct debug_t {     template <typename T>     debug_t& operator<<(const T& value) {       return *this;     }   } debug;   namespace DSU {   vector<int> parent, rank;   void init(int n) {     parent = vector<int>(n);     rank = vector<int>(n, 0);     for (int i = 0; i < (n); ++i) parent[i] = i;   }   int find(int v) {     if (parent[v] != v) return parent[v] = find(parent[v]);     return v;   }   int merge(int a, int b) {     a = find(a);     b = find(b);     if (a == b) return a;     if (rank[a] > rank[b]) swap(a, b);     parent[a] = b;     if (rank[a] == rank[b]) ++rank[b];     return b;   }   }  // namespace DSU   vector<int> mx_dist;   pair<int, int> find_far(vector<vector<int> >& g, int v, int p = -1) {     pair<int, int> result = make_pair(0, v);     for (int i = 0; i < (static_cast<int>((g[v]).size())); ++i) {       int nxt = g[v][i];       if (nxt != p) {         pair<int, int> nxt_result = find_far(g, nxt, v);         nxt_result.first += 1;         result = max(result, nxt_result);       }     }     return result;   }   int get_color_value(vector<vector<int> >& g, int v) {     int n = static_cast<int>((g).size());     pair<int, int> f;     f = find_far(g, v);     f = find_far(g, f.second);     return f.first;   }   void calc_mx_dist(vector<vector<int> >& g) {     int n = static_cast<int>((g).size());     vector<int> used(n, 0);     for (int i = 0; i < (n); ++i) {       int color = DSU::find(i);       if (!used[color]) {         used[color] = 1;         mx_dist[color] = get_color_value(g, i);       }     }   }   void req(int x, int y) {     x = DSU::find(x);     y = DSU::find(y);     if (x != y) {       int result = (mx_dist[x] + 1) / 2 + (mx_dist[y] + 1) / 2 + 1;       int res = DSU::merge(x, y);       mx_dist[res] = max(result, max(mx_dist[x], mx_dist[y]));     }   }   int main() {     int n, m, q;     while (cin >> n >> m >> q) {       DSU::init(n);       mx_dist = vector<int>(n, 0);       vector<vector<int> > g = vector<vector<int> >(n);       while (m--) {         int a, b;         cin >> a >> b;         --a;         --b;         g[a].push_back(b);         g[b].push_back(a);         DSU::merge(a, b);       }       calc_mx_dist(g);       while (q--) {         int code, a, b;         cin >> code >> a;         --a;         if (code == 1)           cout << mx_dist[DSU::find(a)] <<   n ;         else {           cin >> b;           --b;           req(a, b);         }       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void solve() {     int n;     cin >> n;     long long coins = 0;     vector<long long> arr(n);     for (int i = 0; i < n; i++) cin >> arr[i];     int i = 0, j = 0;     while (i < n && j < n) {       while (i < n && arr[i] <= 0) i++;       while (j < n && (arr[j] >= 0 || j < i)) j++;       if (i >= n || j >= n) break;       long long x = min(abs(arr[i]), abs(arr[j]));       arr[i] -= x;       arr[j] += x;     }     for (int i = 0; i < n; i++) {       if (arr[i] > 0) coins += arr[i];     }     cout << coins <<   n ;   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int t;     cin >> t;     while (t--) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <typename T>   T mabs(const T &a) {     return a < 0 ? -a : a;   }   int n, m, p, bss;   vector<int> a, b;   map<int, int> bCounts;   vector<int> checkPos(int sp) {     vector<int> res;     map<int, int> aCounts;     int wrongCounts = bss;     for (int i = (0), ei = (m); i < ei; i++) {       int cp = sp + i * p;       if (cp >= n) return res;       int aVal = a[cp];       int cac = aCounts[aVal];       int nac = cac + 1;       if (cac == bCounts[aVal])         wrongCounts++;       else if (nac == bCounts[aVal])         wrongCounts--;       aCounts[aVal] = nac;     }     int moved = 0;     while (1) {       if (wrongCounts == 0) res.push_back(sp + moved * p);       int curExc = a[sp + moved * p];       int curIncIdx = sp + (moved + m) * p;       if (curIncIdx >= n) break;       int curInc = a[curIncIdx];       {         int cac = aCounts[curExc];         int nac = cac - 1;         if (cac == bCounts[curExc])           wrongCounts++;         else if (nac == bCounts[curExc])           wrongCounts--;       }       if (wrongCounts < 0) throw 1;       aCounts[curExc]--;       {         int cac = aCounts[curInc];         int nac = cac + 1;         if (cac == bCounts[curInc])           wrongCounts++;         else if (nac == bCounts[curInc])           wrongCounts--;       }       if (wrongCounts < 0) throw 1;       aCounts[curInc]++;       moved++;     }     return res;   }   void run() {     scanf( %d%d%d , &n, &m, &p);     for (int i = (0), ei = (n); i < ei; i++) {       int cur;       scanf( %d , &cur);       a.push_back(cur);     }     for (int i = (0), ei = (m); i < ei; i++) {       int cur;       scanf( %d , &cur);       b.push_back(cur);       bCounts[cur]++;     }     bss = bCounts.size();     vector<int> res;     for (int i = (0), ei = (p); i < ei; i++) {       vector<int> cur = checkPos(i);       for (int j = (0), ej = (cur.size()); j < ej; j++) res.push_back(cur[j]);     }     sort((res).begin(), (res).end());     printf( %d n , (int)res.size());     for (int i = (0), ei = (res.size()); i < ei; i++) {       printf( %d  , res[i] + 1);     }   }   int main() {     run();     return 0;   }
#include <bits/stdc++.h>   int input[1001];   int ans[1001][2];   int main() {     int n, i, answer;     scanf( %d , &n);     for (i = 0; i < n; i++) scanf( %d , &input[i]);     ans[0][0] = 1;     for (i = 1; i < n; i++) {       if (input[i] >= input[i - 1])         ans[i][0] = 1 + ans[i - 1][0];       else         ans[i][0] = 1;     }     ans[n - 1][1] = 1;     for (i = n - 2; i >= 0; i--) {       if (input[i] >= input[i + 1])         ans[i][1] = ans[i + 1][1] + 1;       else         ans[i][1] = 1;     }     answer = -1;     for (i = 0; i < n; i++)       answer =           (answer > ans[i][0] + ans[i][1] ? (answer) : (ans[i][0] + ans[i][1]));     printf( %d n , answer - 1);   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m, count_zero = 0, count_max = 0;     cin >> n >> m;     int data[n][m];     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         cin >> data[i][j];         count_max += data[i][j];         if (data[i][j] == 0) {           count_zero++;         }       }     }     for (int i = n - 2; i >= 1; i--) {       for (int j = m - 2; j >= 1; j--) {         int h_d = data[i][j + 1] - data[i][j - 1],             v_d = data[i + 1][j] - data[i - 1][j];         if (data[i][j] == 0 && h_d > 1 && v_d > 1) {           data[i][j] = min(data[i + 1][j] - 1, data[i][j + 1] - 1);           count_max += data[i][j];         } else if (h_d <= 1 || v_d <= 1) {           cout <<  -1 ;           return 0;         }       }     }     for (int i = 0; i < n; i++) {       for (int j = 1; j < m; j++) {         if (data[i][j] <= data[i][j - 1]) {           cout <<  -1 ;           return 0;         }       }     }     for (int i = 0; i < m; i++) {       for (int j = 1; j < n; j++) {         if (data[j][i] <= data[j - 1][i]) {           cout <<  -1 ;           return 0;         }       }     }     cout << count_max;     return 0;   }
#include <bits/stdc++.h>   int cc[3000];   int good(int i) {     return !(cc[i] == 0 && cc[i + 1] == 0 && cc[i + 2] == 1 && cc[i + 3] == 1) &&            !(cc[i] == 0 && cc[i + 1] == 1 && cc[i + 2] == 0 && cc[i + 3] == 1) &&            !(cc[i] == 1 && cc[i + 1] == 1 && cc[i + 2] == 1 && cc[i + 3] == 0) &&            !(cc[i] == 1 && cc[i + 1] == 1 && cc[i + 2] == 1 && cc[i + 3] == 1);   }   int main() {     static int dp[3000][3000], lcp[3000 + 1][3000 + 1], ll[3000];     int m, i, j, l, sum;     scanf( %d , &m);     for (i = 0; i < m; i++) scanf( %d , &cc[i]);     for (i = m - 1; i >= 0; i--)       for (j = m - 1; j >= 0; j--)         lcp[i][j] = cc[i] == cc[j] ? 1 + lcp[i + 1][j + 1] : 0;     for (i = 0; i < m; i++)       for (j = 0; j < i; j++)         if (ll[i] < lcp[i][j]) ll[i] = lcp[i][j];     for (i = 0; i < m; i++)       for (j = i; j < m; j++) {         if (j - i < 3 || (j - i == 3 && good(i)))           dp[i][j] = (dp[i][j] + 1) % 1000000007;         if (dp[i][j])           for (l = 1; l <= 4 && j + l < m; l++)             if (l < 4 || good(j + 1))               dp[i][j + l] = (dp[i][j + l] + dp[i][j]) % 1000000007;       }     sum = 0;     for (j = 0; j < m; j++) {       for (i = 0; i <= j; i++)         if (i + ll[i] <= j) sum = (sum + dp[i][j]) % 1000000007;       printf( %d n , sum);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1000;   vector<int> a[maxn];   bool flag[maxn];   int ans[maxn];   int n;   bool judge(int x, int y) {     int cnt = 0;     memset(flag, false, sizeof(flag));     for (int i = 0; i < (int)a[x].size(); i++) {       flag[a[x][i]] = true;     }     for (int i = 0; i < (int)a[y].size(); i++) {       if (flag[a[y][i]] == false) return false;     }     return true;   }   int main() {     while (cin >> n) {       for (int i = 1; i <= n; i++) a[i].clear();       for (int i = 1; i <= n; i++) {         int m;         cin >> m;         while (m--) {           int x;           cin >> x;           a[i].push_back(x);         }       }       for (int i = 1; i <= n; i++) ans[i] = 1;       for (int i = 1; i <= n; i++) {         for (int j = 1; j <= n; j++) {           if (i == j) continue;           if (judge(i, j)) {             ans[i] = 0;             break;           }         }       }       for (int i = 1; i <= n; i++) {         if (ans[i])           puts( YES );         else           puts( NO );       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long int n;     cin >> n;     int event, police = 0, ans = 0;     for (int i = 0; i < n; i++) {       cin >> event;       if (event == -1) {         if (police == 0)           ans++;         else           police--;       } else         police += event;     }     cout << ans;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 5000 + 10;   int n, a[N], dp[N][N][2];   int calc(int i, int rem, bool isLess) {     if (rem == 0) return 0;     if (i >= n) return 2e9;     int &ret = dp[i][rem][isLess];     if (ret != -1) return ret;     ret = 2e9;     if (isLess) {       if (i != n - 1) {         int h = a[i + 1];         int extra = max(h - a[i] + 1, 0);         h -= extra;         ret = min(ret, extra + calc(i + 2, rem - 1, h < a[i + 2]));         if (i != n - 2) {           int h = a[i + 1];           int extra = max(h - a[i + 2] + 1, 0);           h -= extra;           ret = min(ret, extra + calc(i + 2, rem - (h < a[i]), h < a[i + 2]));         }         ret = min(ret, calc(i + 1, rem, a[i] < a[i + 1]));         if (a[i] >= a[i + 1])           ret = min(ret, (a[i] - a[i + 1] + 1) + calc(i + 1, rem, true));       } else         ret = min(ret, calc(i + 1, rem - 1, false));     } else {       if (i != n - 1) {         ret = min(ret, calc(i + 1, rem, a[i] < a[i + 1]));         if (a[i] >= a[i + 1])           ret = min(ret, (a[i] - a[i + 1] + 1) + calc(i + 1, rem, true));       }     }     return ret;   }   int main() {     scanf( %d , &n);     for (int i = 0; i < n; ++i) scanf( %d , a + i);     memset(dp, -1, sizeof dp);     int k = (n + 1) / 2;     for (int i = 1; i <= k; ++i) printf( %d  , calc(0, i, true));     puts(  );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long int power(long long int x, long long int y, long long int p) {     long long int res = 1;     x = x % p;     while (y > 0) {       if (y & 1) res = (res * x) % p;       y = y >> 1;       x = (x * x) % p;     }     return res;   }   long long int modInverse(long long int a, long long int m) {     return power(a, m - 2, m);   }   long long int f(long long int y) {     long double x = -1 + sqrt(1 + 8 * (y + 0.0));     long long int ret = x / 2;     return ret;   }   vector<long long int> v[101];   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     ;     long long int b;     cin >> b;     long long int cnt = 0;     for (long long int i = 1; i * i <= b; i++) {       if (b % i == 0) {         if (b / i == i)           cnt++;         else           cnt += 2;       }     }     cout << cnt <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   int n;   int res[51][51];   int main() {     scanf( %d , &n);     for (int i = 0; i < n * (n - 1) / 2 - 1; i++) {       int a, b;       scanf( %d%d , &a, &b);       res[a][b] = 1;       res[b][a] = -1;     }     int q1, q2;     for (int i = 1; i < n + 1; i++)       for (int j = i + 1; j < n + 1; j++) {         if (res[i][j] == 0) {           q1 = i;           q2 = j;         }       }     for (int i = 1; i < n + 1; i++) {       if (i != q1 && i != q2 && res[q1][i] > res[q2][i]) {         printf( %d %d , q1, q2);         return 0;       }       if (i != q1 && i != q2 && res[q1][i] < res[q2][i]) {         printf( %d %d , q2, q1);         return 0;       }     }     printf( %d %d , q2, q1);     return 0;   }