malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   vector<string> substrings;   bool cmp(pair<int, int> &a, pair<int, int> &b) {     if (a.first < b.first) return true;     if (a.first > b.first) return false;     if (substrings[a.second].length() > substrings[b.second].length())       return true;     return false;   }   int main() {     int n, m, pos, dlen, maxlen = 1;     cin >> n;     string dummy;     vector<pair<int, int> > v;     for (int i = 0; i < n; i++) {       cin >> dummy >> m;       substrings.push_back(dummy);       dlen = dummy.length();       for (int j = 0; j < m; j++) {         cin >> pos;         if (dlen + pos - 1 > maxlen) maxlen = dlen + pos - 1;         v.push_back({pos - 1, i});       }     }     sort(v.begin(), v.end(), cmp);     string s(maxlen,  a );     int curr_pos = v[0].first, offset, copy_size;     s.replace(curr_pos, substrings[v[0].second].length(),               substrings[v[0].second]);     curr_pos += substrings[v[0].second].length();     for (int i = 1; i < v.size(); i++) {       if (v[i].first + substrings[v[i].second].length() <= curr_pos) continue;       offset = curr_pos - v[i].first;       if (offset < 0) {         offset = 0;         curr_pos = v[i].first;       }       copy_size = substrings[v[i].second].length() - offset;       s.replace(curr_pos, copy_size, substrings[v[i].second], offset, copy_size);       curr_pos += copy_size;     }     cout << s <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   map<string, string> mp;   string get_type(string s) {     if (mp.count(s)) return mp[s];     int n = s.size();     if (s[0] ==  &  && s[n - 1] ==  * ) return get_type(s.substr(1, n - 2));     if (s[0] ==  & ) {       string ret = get_type(s.substr(1, n - 1));       int sz = ret.size();       if (ret ==  void  or ret ==  errtype )         return  errtype ;       else {         if (ret[sz - 1] ==  * ) return ret.substr(0, sz - 1);         return s[0] + ret;       }     }     if (s[n - 1] ==  * ) {       string ret = get_type(s.substr(0, n - 1));       if (ret[0] ==  & ) return ret.substr(1, n - 1);       if (ret ==  errtype ) return  errtype ;       return get_type(s.substr(0, n - 1)) + s[n - 1];     }     return  errtype ;   }   void add_type(string u, string v) { mp[v] = get_type(u); }   int main() {     mp[ void ] =  void ;     mp[ &void ] =  errtype ;     mp[ errtype ] =  errtype ;     ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);     int q;     cin >> q;     while (q--) {       string fun, u, v;       cin >> fun;       if (fun ==  typedef ) {         cin >> u >> v;         add_type(u, v);       } else {         cin >> u;         cout << get_type(u) <<   n ;       }     }   }
#include <bits/stdc++.h>   using namespace std;   const int N = 8;   int main() {     char r1, r2;     int x1, x2;     while (4 == scanf(  %c%d %c%d , &r1, &x1, &r2, &x2)) {       int y1 = r1 -  a ;       int y2 = r2 -  a ;       --x1;       --x2;       int ans = 0;       for (int y = 0; y < (int)(N); y++)         for (int x = 0; x < (int)(N); x++) {           if (y1 == y || x1 == x) continue;           int dx1 = abs(x1 - x), dy1 = abs(y1 - y);           int dx2 = abs(x2 - x), dy2 = abs(y2 - y);           if (dx1 > dy1) swap(dx1, dy1);           if (dx2 > dy2) swap(dx2, dy2);           if (dx1 == 1 && dy1 == 2) continue;           if (dx2 == 1 && dy2 == 2) continue;           if (dx2 == 0 && dy2 == 0) continue;           ++ans;         }       printf( %d n , ans);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long mod = 998244353;   const int N = 1e5 + 2;   const int M = 1 << 19;   const int inf = 2e9;   const long long linf = 1e18;   long long n, m, k;   int ok(long long mid) {     long long ans = 0;     for (int i = 1; i <= n; i++) {       ans += min(m, mid / i);     }     return ans >= k;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     cin >> n >> m >> k;     long long l = 1, r = n * m, ans = 0;     while (l <= r) {       long long mid = l + r >> 1;       if (ok(mid)) {         r = mid - 1;         ans = mid;       } else         l = mid + 1;     }     cout << ans <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   double pi = M_PI;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int t;     cin >> t;     while (t--) {       long long n;       cin >> n;       n = n * 2;       double angle = ((n - 2) * M_PI) / (2 * n);       cout << fixed << setprecision(9) << tan(angle);       cout <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     int tc;     cin >> tc;     while (tc--) {       int n;       cin >> n;       priority_queue<pair<int, int> > pq;       for (int i = 0; i < n; i++) {         int ai;         cin >> ai;         pq.push(pair<int, int>(ai, i));       }       int turn = 0;       while (not pq.empty()) {         auto pp = pq.top();         pq.pop();         turn = 1 - turn;         if (pq.empty()) break;         auto qq = pq.top();         pq.pop();         turn = 1 - turn;         pp.first -= 1;         qq.first -= 1;         if (pp.first != 0) pq.push(pp);         if (qq.first != 0) pq.push(qq);       }       if (turn == 0)         cout <<  HL n ;       else         cout <<  T n ;     }     return (0);   }
#include <bits/stdc++.h>   using namespace std;   const long long int N = 2e5 + 5;   void solve() {     long long int n;     cin >> n;     long long int k = sqrt(n);     long long int sum = 0;     if (n == k * k) {       cout << 4 * k <<   n ;       return;     }     sum = sum + k * 4;     n = n - (k * k);     if (n > (k)) {       sum = sum + (n / (k)) * 2;       if (n % k != 0) sum = sum + 2;     } else {       sum = sum + 2;     }     cout << sum <<   n ;   }   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long int t = 1;     while (t--) solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 100005;   vector<int> g[N], ans;   bool vis[N];   int x[N];   void Set(int u) {     x[u] ^= 1;     ans.push_back(u);   }   void dfs(int u) {     Set(u);     vis[u] = 1;     for (int i = 0; i < g[u].size(); ++i) {       int v = g[u][i];       if (vis[v]) continue;       dfs(v);       Set(u);       if (x[v]) {         Set(v);         Set(u);       }     }   }   int main() {     int n, m, u, v, r = 0;     scanf( %d%d , &n, &m);     for (int i = 1; i <= m; ++i) {       scanf( %d%d , &u, &v);       g[u].push_back(v);       g[v].push_back(u);     }     for (int i = 1; i <= n; ++i) {       scanf( %d , &x[i]);       if (x[i]) r = i;     }     dfs(r);     int f = 0;     if (x[r]) x[r] = 0, f = 1;     bool ok = true;     for (int i = 1; i <= n; ++i)       if (x[i]) {         ok = false;         break;       }     if (!ok)       puts( -1 );     else {       printf( %d n , ans.size() - f);       for (int i = 0; i < ans.size() - f; ++i) printf( %d  , ans[i]);     }     return 0;   }
#include <bits/stdc++.h>   const int T_DATA = 100000;   const int N = 100000;   int T;   int a, b;   char mp[N + 10];   int n, m;   int l[N + 10], r[N + 10];   int dis[N + 10];   int main() {     scanf( %d , &T);     while (T--) {       scanf( %d %d , &a, &b);       scanf( %s , mp + 1);       n = strlen(mp + 1);       m = 0;       for (int i = 1, j; i <= n; i = j + 1) {         while (i <= n && mp[i] !=  1 ) ++i;         if (i > n) break;         for (j = i; j < n && mp[j + 1] ==  1 ; ++j)           ;         ++m;         l[m] = i, r[m] = j;       }       if (m == 0) {         printf( 0 n );         continue;       }       if (m == 1) {         printf( %d n , a);         continue;       }       for (int i = 1; i <= m - 1; ++i) dis[i] = l[i + 1] - r[i] - 1;       std::sort(dis + 1, dis + m);       int ans = a * m;       for (int ind = 1; ind <= m - 1; ++ind) {         if (dis[ind] * b >= a) continue;         ans -= a - dis[ind] * b;       }       printf( %d n , ans);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os <<  (  << p.first <<  ,   << p.second <<  ) ; }   template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::value_type>::type> ostream& operator<<(ostream &os, const T_container &v) { os <<  { ; string sep; for (const T &x : v) os << sep << x, sep =  ,  ; return os <<  } ; }   void dbg_out() { cerr << endl; }   template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr <<     << H; dbg_out(T...); }   #ifdef WA_DEBUG   #define dbg(...) cerr <<  (  << #__VA_ARGS__ <<  ): , dbg_out(__VA_ARGS__)   #else   #define dbg(...)   #endif      using ll  = long long;   using ull = unsigned long long;   #define pb push_back   #define fi first   #define se second   #define rep(i,a,b) for(int i=int(a);i<=(int)(b);i++)   #define per(i,a,b) for(int i=int(a);i>=(int)(b);i--)   const int mod  = 1e9+7;   const int inf  = 0x3f3f3f3f;   const int maxn = 1e5+10;   int main() {   #ifndef WA_DEBUG       ios::sync_with_stdio(false);cin.tie(nullptr);   #endif       int _;       cin>>_;       while(_--) {           int n;           cin>>n;            string a,b,c;           cin>>a>>b>>c;           int lena=0,lenb=0,lenc=0;           rep(i,1,3*n) {               vector<int> cnt(2,0);               if(lena<2*n) cnt[a[lena]- 0 ]++;               if(lenb<2*n) cnt[b[lenb]- 0 ]++;               if(lenc<2*n) cnt[c[lenc]- 0 ]++;               if(cnt[0]>cnt[1]) {                   cout<<0;                   if(lena<2*n&&a[lena]== 0 ) lena++;                   if(lenb<2*n&&b[lenb]== 0 ) lenb++;                   if(lenc<2*n&&c[lenc]== 0 ) lenc++;               }               else {                   cout<<1;                   if(lena<2*n&&a[lena]== 1 ) lena++;                   if(lenb<2*n&&b[lenb]== 1 ) lenb++;                   if(lenc<2*n&&c[lenc]== 1 ) lenc++;               }               if(lena==2*n||lenb==2*n||lenc==2*n) {                   break;               }           }           if(lena==2*n) {               if(lenb>lenc) {                   while(lenb<2*n) cout<<b[lenb++];               }               else {                   while(lenc<2*n) cout<<c[lenc++];               }           }           else if(lenb==2*n) {               if(lena>lenc) {                   while(lena<2*n) cout<<a[lena++];               }               else {                   while(lenc<2*n) cout<<c[lenc++];               }           }           else {               if(lena>lenb) {                   while(lena<2*n) cout<<a[lena++];               }               else {                   while(lenb<2*n) cout<<b[lenb++];               }           }           cout<<  n ;       }       return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxbuff = 1 << 17;   char ibuff[maxbuff], obuff[maxbuff];   inline char Getchar() {     static char *p1 = ibuff, *p2 = ibuff;     if (p1 == p2) {       p1 = ibuff;       p2 = ibuff + fread(ibuff, 1, maxbuff, stdin);       if (p1 == p2) return -1;     }     return *p1++;   }   int optr = 0;   inline void Putchar(char c) {     if (optr == maxbuff) {       fwrite(obuff, 1, optr, stdout);       optr = 0;     }     obuff[optr++] = c;   }   inline void Flush() { fwrite(obuff, 1, optr, stdout); }   template <class T>   inline int read(T &x) {     x = 0;     char c = Getchar();     if (c == EOF) return -1;     for (; c <  0  || c >  9 ; c = Getchar())       ;     for (; c >=  0  && c <=  9 ; c = Getchar()) x = x * 10 + c -  0 ;     return 0;   }   template <class T>   inline void write(const T &x, int tag = 0) {     if (!x) {       if (!tag) Putchar(x +  0 );       return;     }     write(x / 10, 1);     Putchar(x % 10 +  0 );   }   template <class T>   inline void writeln(const T &x) {     write(x);     Putchar(  n );   }   template <class T>   inline void writesp(const T &x) {     write(x);     Putchar(   );   }   const int N = 4e6 + 19;   long long num[N], A[N];   int cnt, fac[N];   map<long long, int> mp1, mp2;   long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }   void solve(int n, long long x, long long y) {     long long t = y;     for (long long i = 2; i <= 1000000 && i * i <= y && i <= t; ++i) {       if (t % i == 0) {         while (t % i == 0) t /= i;         fac[cnt++] = i;       }     }     for (int i = 0; i < n; ++i) {       if (A[i] % x) continue;       long long tmp = gcd(A[i] / x, y / x);       int msk = 0;       for (int j = 0; j < cnt; ++j) msk |= (tmp % fac[j] == 0) << j;       ++num[msk];     }     for (int i = 0; i < cnt; ++i)       for (int j = 0; j < (1 << cnt); ++j)         if ((j & (1 << i)) == 0) num[j | (1 << i)] += num[j];     long long ans = 0;     for (int i = 0; i < n; ++i) {       if (y % A[i]) continue;       long long tmp = y / A[i];       int msk = 0;       for (int j = 0; j < cnt; ++j) msk |= (tmp % fac[j] == 0) << j;       ans += num[((1 << cnt) - 1) ^ msk];     }     writeln(ans);   }   signed main() {     long long n, x, y;     read(n);     read(x);     read(y);     if (y % x) {       puts( 0 );       return 0;     }     for (int i = 0; i < n; ++i) {       read(A[i]);       if (A[i] % x == 0) ++mp1[gcd(A[i] / x, y / x)];       if (y % A[i] == 0) ++mp2[y / A[i]];     }     if (mp1.size() < 5000 && mp2.size() < 5000) {       long long ans = 0;       for (auto u : mp1)         for (auto v : mp2)           if (gcd(u.first, v.first) == 1) ans += 1ll * u.second * v.second;       writeln(ans);     } else       solve(n, x, y);     Flush();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   pair<long long, long long> a[1000000];   long long ans = 0;   bool check(long long k, pair<long long, long long> l,              pair<long long, long long> r) {     long long cur = abs(k - l.second) + abs(k - r.second);     if (cur <= r.first - l.first) {       return true;     }     return false;   }   int main() {     long long n, m;     cin >> n >> m;     for (long long i = 1; i <= m; ++i) {       cin >> a[i].first >> a[i].second;       ans = max(ans, a[i].second * 1LL);     }     if (a[m].first != n) {       a[m + 1] = make_pair(n, a[m].second + n - a[m].first);       ++m;       ans = max(ans, a[m].second);     }     if (a[1].first != 1) {       for (int i = m + 1; i >= 2; --i) {         a[i] = a[i - 1];       }       a[1] = make_pair(1, a[2].second + a[2].first - 1);       ans = max(ans, a[1].second);       ++m;     }     for (long long i = 1; i <= m - 1; ++i) {       if (abs(a[i + 1].second - a[i].second) > a[i + 1].first - a[i].first) {         return 0 * printf( IMPOSSIBLE );       }       long long bot = min(a[i].second, a[i + 1].second);       long long top = 22814882281488;       while (top > bot + 1) {         long long mid = (bot + top) / 2;         if (check(mid, a[i], a[i + 1])) {           bot = mid;         } else {           top = mid;         }       }       ans = max(ans, bot);     }     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   long long int key[300005], dia[300005], m1[300005], m2[300005], dp1[300005],       dp2[300005];   vector<long long int> kv[300005], adj[300005];   bool mrk[300005];   inline void dfs(long long int x, long long int pr, long long int root) {     if (mrk[x]) return;     mrk[x] = 1;     key[x] = root;     if (x != root) kv[root].push_back(x);     for (auto j : adj[x]) {       if (j == pr) continue;       if (mrk[j]) continue;       dfs(j, x, root);       if (dp1[j] >= m1[x]) {         m2[x] = m1[x];         m1[x] = dp1[j];       } else if (dp1[j] >= m2[x])         m2[x] = dp1[j];     }     dp1[x] = m1[x] + 1;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     ;     long long int n, m, q;     cin >> n >> m >> q;     for (long long int i = 1; i <= n; i++) {       m1[i] = m2[i] = -1;       key[i] = i;       kv[i].push_back(i);     }     for (long long int i = 0; i < m; i++) {       long long int x, y;       cin >> x >> y;       adj[x].push_back(y);       adj[y].push_back(x);     }     for (long long int i = 1; i <= n; i++) {       if (!mrk[i]) dfs(i, -1, i);     }     long long int mx = 0;     for (long long int i = 1; i <= n; i++) {       dp2[i] = m1[i] + m2[i] + 2;       mx = max(dp1[i], dp2[i]);       dia[key[i]] = max(dia[key[i]], mx);     }     while (q--) {       long long int ch;       cin >> ch;       if (ch == 1) {         long long int x;         cin >> x;         cout << dia[key[x]] <<   n ;         continue;       }       long long int x, y;       cin >> x >> y;       if (key[x] != key[y]) {         if (kv[key[x]].size() < kv[key[y]].size()) swap(x, y);         long long int xx = ceil(dia[key[x]] / 2.0) + ceil(dia[key[y]] / 2.0) + 1;         dia[key[x]] = max(max(dia[key[x]], dia[key[y]]), xx);         long long int z = key[y];         for (auto j : kv[z]) {           kv[key[x]].push_back(j);           key[j] = key[x];         }         kv[z].clear();       }     }   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1010, maxm = 1 << 16, INF = 1e9;   int n, dp[2][maxm], a[5], cMask[maxn];   vector<int> optionalMasks[5];   string s[4];   int addColumn(int column, int mask) {     return (mask >> 4) | (cMask[column] << 12);   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= 4; i++) scanf( %d , &a[i]);     for (int i = 0; i < 4; i++) cin >> s[i];     for (int sz = 1; sz <= 4; sz++) {       for (int i = 0; i + sz <= 4; i++) {         int mask = maxm - 1;         for (int c = 0; c < sz; c++) {           for (int r = i; r < i + sz; r++) {             mask ^= 1 << (r + c * 4);           }         }         optionalMasks[sz].push_back(mask);       }     }     for (int i = 0; i < n; i++) {       int mask = 0;       for (int j = 0; j < 4; j++) mask |= (s[j][i] ==  * ) << j;       cMask[i] = mask;     }     for (int i = 0; i < 2; i++)       for (int j = 0; j < maxm; j++) dp[i][j] = INF;     int mask = 0, cur = 0;     for (int i = 0; i < 4; i++) mask = addColumn(i, mask);     dp[cur][mask] = 0;     for (int i = 0; i < n; i++) {       int nxt = !cur;       for (int j = maxm - 1; j >= 0; j--) {         if (dp[cur][j] < INF) {           if (!(j & 15)) {             int nxtJ = addColumn(i + 4, j);             dp[nxt][nxtJ] = min(dp[nxt][nxtJ], dp[cur][j]);           }           for (int sz = 1; sz <= 4 && i + sz <= n; sz++) {             for (int k = 0; k < optionalMasks[sz].size(); k++) {               int nxtJ = j & optionalMasks[sz][k];               dp[cur][nxtJ] = min(dp[cur][nxtJ], dp[cur][j] + a[sz]);             }           }         }         dp[cur][j] = INF;       }       cur = !cur;     }     printf( %d n , dp[cur][0]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int const N = 100000;   vector<pair<int, int> > g[N + 1];   vector<int> imp;   long long cl[42][N + 1];   int dp[N + 1], n;   pair<int, long long> pa[N + 1][17];   bool vis[N + 1];   void pl(int v = 1, int p = 0, int w = 0) {     dp[v] = dp[p] + 1;     vis[v] = true;     pa[v][0] = make_pair(p, w);     int k = 1, z;     while (k < 17 && (z = pa[v][k - 1].first))       pa[v][k] = make_pair(pa[z][k - 1].first,                            pa[v][k - 1].second + pa[z][k - 1].second),       ++k;     for (int i = 0; i < (int)(g[v].size()); ++i) {       int u = g[v][i].first;       if (u == p) continue;       if (vis[u])         imp.push_back(v), imp.push_back(u);       else         pl(u, v, g[v][i].second);     }   }   long long dis(int a, int b) {     if (dp[a] < dp[b]) swap(a, b);     int d = dp[a] - dp[b], j = 0;     long long an = 0;     while (d) {       if (d & 1) an += pa[a][j].second, a = pa[a][j].first;       d >>= 1;       ++j;     }     if (a == b) return an;     for (int i = 16; i >= 0; --i)       if (pa[a][i].first != pa[b][i].first)         an += pa[a][i].second + pa[b][i].second, a = pa[a][i].first,                                                  b = pa[b][i].first;     return an + pa[a][0].second + pa[b][0].second;   }   void bfs(int v, long long dis[]) {     for (int i = 1; i < (int)(n + 1); ++i) dis[i] = 1e18;     priority_queue<pair<long long, int> > q;     q.push(make_pair(0, v));     dis[v] = 0;     while (!q.empty()) {       int v = q.top().second;       long long d = -q.top().first;       q.pop();       for (int i = 0; i < (int)(g[v].size()); ++i) {         int u = g[v][i].first;         long long nd = d + g[v][i].second;         if (dis[u] > nd) {           dis[u] = nd;           q.push(make_pair(-nd, u));         }       }     }   }   int main() {     int m;     scanf( %d%d , &n, &m);     for (int i = 0; i < (int)(m); ++i) {       int a, b, c;       scanf( %d%d%d , &a, &b, &c);       g[a].push_back(make_pair(b, c));       g[b].push_back(make_pair(a, c));     }     pl();     sort(imp.begin(), imp.end());     imp.resize(unique(imp.begin(), imp.end()) - imp.begin());     for (int i = 0; i < (int)(imp.size()); ++i) bfs(imp[i], cl[i]);     int q;     scanf( %d , &q);     while (q--) {       int a, b;       scanf( %d%d , &a, &b);       long long an = dis(a, b);       for (int i = 0; i < (int)(imp.size()); ++i)         for (int j = 0; j < (int)(imp.size()); ++j)           an = min(an, cl[i][a] + cl[i][imp[j]] + cl[j][b]);       printf( %lld n , an);     }   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 100010;   int n, m;   int low[maxn], dfn[maxn], v[maxn << 1], A[maxn];   int nxt[maxn << 1], head[maxn], belong[maxn], a[maxn], vis[maxn << 1];   stack<int> s;   int indexs = 0, cnt = 0;   int ans = 0;   void add_edge(int x, int y) {     static int N = 1;     N++;     v[N] = y;     nxt[N] = head[x];     head[x] = N;   }   void tarjan(int x, int fa) {     dfn[x] = low[x] = ++indexs;     for (int i = head[x]; i != -1; i = nxt[i]) {       if (vis[i]) continue;       vis[i] = vis[i ^ 1] = 1;       s.push(i);       if (!dfn[v[i]]) {         tarjan(v[i], x);         low[x] = min(low[x], low[v[i]]);         if (low[v[i]] >= dfn[x]) {           cnt++;           int num = 0, bcnt = 0;           while (1) {             int tmp = s.top();             s.pop();             if (belong[v[tmp]] != cnt) belong[v[tmp]] = cnt, num++;             if (belong[v[tmp ^ 1]] != cnt) belong[v[tmp ^ 1]] = cnt, num++;             a[++bcnt] = tmp;             if (tmp == i) break;           }           if (num == bcnt)             for (int i = 1; i <= bcnt; i++) A[++ans] = a[i];         }       } else         low[x] = min(low[x], dfn[v[i]]);     }   }   int main() {     memset(head, -1, sizeof(head));     scanf( %d%d , &n, &m);     for (int i = 1; i <= m; i++) {       int x, y;       scanf( %d%d , &x, &y);       add_edge(x, y);       add_edge(y, x);     }     for (int i = 1; i <= n; i++)       if (!dfn[i]) tarjan(i, 0);     sort(A + 1, A + 1 + ans);     printf( %d n , ans);     for (int i = 1; i <= ans; i++) cout << (A[i] >> 1) <<    ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int a, b;     cin >> a >> b;     if (a == b) {       cout <<  infinity ;       return 0;     }     if (a < b) {       cout << 0;       return 0;     }     a -= b;     int s = 0;     for (int i = 1; i * i <= a; i++)       if (a % i == 0) {         s += (i > b);         s += (a / i > b);         if (i == a / i and i > b) s--;       }     cout << s;   }