malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const int M = 6e5;   int n, d, f[M];   int main() {     cin >> n >> d;     f[0] = 1;     int now = 0, times = 0;     for (int i = 0; i < n; i++) {       int x;       cin >> x;       for (int j = M - 1; j >= x; j--) f[j] |= f[j - x];     }     while (1) {       int old = now;       for (int i = 1; i <= d; i++)         if (f[i + old]) now = old + i;       if (now == old) break;       times++;     }     cout << now <<     << times << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct point {     double x, y;     point operator-(point A) { return (point){x - A.x, y - A.y}; }     double operator*(point A) { return x * A.y - y * A.x; }     double dis() { return sqrt(x * x + y * y); }   } a[1005][1005], t[1005], E[1005];   int n, vis[1005][1005];   double r[1005][1005];   point Mid(point a, point b) {     return (point){(a.x + b.x) / 2, (a.y + b.y) / 2};   }   double disline(int i, point A) { return abs(E[i] * (A - t[i]) / E[i].dis()); }   int ch(int R) { return R % n ? R % n : n; }   int main() {     cin >> n;     for (int i = 1; i <= n; i++) scanf( %lf%lf , &t[i].x, &t[i].y);     for (int i = 1; i <= 2 * n; i++) t[n + i] = t[i];     for (int i = 1; i <= 3 * n; i++) E[i] = t[i + 1] - t[i];     for (int L = 1, R = L + 1, nw = L; L <= n; L++)       for (R--, nw = max(L, nw); R == L || E[L] * E[R] > 0.5; R++) {         while (nw < R && disline(L, t[nw + 1]) < disline(R, t[nw + 1])) ++nw;         point le = t[nw], ri = t[nw + 1];         for (int j = 1; j <= 42; j++) {           point mid = Mid(le, ri);           if (disline(L, mid) < disline(R, mid))             le = mid;           else             ri = mid;         }         point P = Mid(le, ri);         a[L][ch(R)] = P;         r[L][ch(R)] = max(disline(L, P), disline(R, P));         vis[L][ch(R)] = 1;       }     double ans = 1e7;     point a1, a2;     for (int L = 1; L <= n; L++)       for (int R = L; R <= L + n; R++)         if (vis[L][ch(R)] && vis[ch(R + 1)][ch(L - 1 + n)]) {           double newr = max(r[L][ch(R)], r[ch(R + 1)][ch(L - 1 + n)]);           if (newr < ans)             ans = newr, a1 = a[L][ch(R)], a2 = a[ch(R + 1)][ch(L - 1 + n)];         }     printf( %.10f n%.10f %.10f n%.10f %.10f n , ans, a1.x, a1.y, a2.x, a2.y);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int Solve(int n) {     int ten = 1;     int ans = 0;     while (n != 0) {       if (n % 10 != 0) {         ans += (ten * (n % 10));         ten *= 10;       }       n /= 10;     }     return ans;   }   long long int gcd(long long int a, long long int b) {     if (b == 0) return a;     return gcd(b, a % b);   }   bool prime(long long int i) {     if (i == 1) return false;     if ((i == 2) || (i == 3)) return true;     if ((i % 2 == 0) || (i % 3 == 0))       return false;     else {       for (long long int j = 5; j * j <= i; j += 6)         if ((i % j == 0) || (i % (j + 2) == 0)) return false;     }     return true;   }   int main() {     int flag = 0;     bool ok;     int n, m, test, sum = 0, id1 = 0, id2 = 0, id3 = 0, dig1, dig2, dig3;     int a, b;     cin >> a >> b;     int c = a + b;     dig1 = Solve(a);     dig2 = Solve(b);     dig3 = Solve(c);     if (dig1 + dig2 == dig3) {       cout <<  YES ;     } else {       cout <<  NO ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long n;   long long calcCards(long long x) { return x * (x + 1) + (x - 1) * x / 2; }   bool P(int x) { return calcCards(x) <= n; }   long long bs(long long l = 0, long long h = n) {     long long m;     while (l < h) {       m = (l + h + 1) / 2;       if (P(m))         l = m;       else         h = m - 1;     }     return l;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(nullptr);     cout.tie(nullptr);     cout << fixed;     cout << setprecision(10);     int t;     cin >> t;     while (t--) {       cin >> n;       int ans = 0;       while (n >= 2) {         ans++;         n -= calcCards(bs());       }       cout << ans << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   const double pi = acos(-1.0);   void Fast() {     std::ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);   }   long long gcd(long long a, long long b) { return a ? gcd(b % a, a) : b; }   long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }   long long fact(long long n) {     long long f = 1;     for (int i = 2; i <= n; i++) {       f *= i;     }     return f;   }   long long ncr(long long n, long long r) {     return fact(n) / (fact(r) * fact(n - r));   }   long long npr(long long n, long long r) { return fact(n) / fact(n - r); }   bool prime(long long n) {     for (long long i = 2; i * i <= n; i++) {       if (n % i == 0) {         return 0;         break;       }     }     return 1;   }   char arr[55][55];   void solve() {     int n, m;     cin >> n >> m;     int r1 = INT_MIN, r2 = INT_MAX, c1 = INT_MIN, c2 = INT_MAX;     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         cin >> arr[i][j];         if (arr[i][j] ==  * ) {           r1 = max(r1, i);           r2 = min(r2, i);           c1 = max(c1, j);           c2 = min(c2, j);         }       }     }     for (int i = r2; i <= r1; i++) {       for (int j = c2; j <= c1; j++) {         cout << arr[i][j];       }       cout <<   n ;     }   }   int main() {     Fast();     solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t--) {       int n, d;       cin >> n >> d;       int ld = 0, rd = n * (n - 1) / 2;       for (int i = 1, cd = 0; i <= n; ++i) {         if (!(i & (i - 1))) ++cd;         ld += cd - 1;       }       if (!(ld <= d && d <= rd)) {         cout <<  NO  << endl;         continue;       }       vector<int> par(n);       iota(par.begin(), par.end(), -1);       vector<int> cnt(n, 1);       cnt[n - 1] = 0;       vector<int> bad(n);       vector<int> dep(n);       iota(dep.begin(), dep.end(), 0);       int cur = n * (n - 1) / 2;       while (cur > d) {         int v = -1;         for (int i = 0; i < n; ++i) {           if (!bad[i] && cnt[i] == 0 && (v == -1 || dep[v] > dep[i])) {             v = i;           }         }         assert(v != -1);         int p = -1;         for (int i = 0; i < n; ++i) {           if (cnt[i] < 2 && dep[i] < dep[v] - 1 && (p == -1 || dep[p] < dep[i])) {             p = i;           }         }         if (p == -1) {           bad[v] = 1;           continue;         }         assert(dep[v] - dep[p] == 2);         --cnt[par[v]];         --dep[v];         ++cnt[p];         par[v] = p;         --cur;       }       cout <<  YES  << endl;       for (int i = 1; i < n; ++i) cout << par[i] + 1 <<    ;       cout << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int N, K, D[1010], S[1010], ans, tt, crtMax;   int main() {     int i;     scanf( %i %i , &N, &K);     for (i = 1; i <= N; i++) scanf( %i , &D[i]);     for (i = 1; i <= N; i++) scanf( %i , &S[i]);     for (i = 1; i <= N; i++) {       crtMax = max(crtMax, S[i]);       ans += S[i];       while (ans < D[i]) {         ans += crtMax;         tt += K;       }       tt += D[i];       ans -= D[i];     }     printf( %i n , tt);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 200000 + 10;   const long long INF = 0x3f3f3f3f3f3f3f3fLL;   long long dp[105][105][105];   long long c[105], val[105][105], ans = INF;   int main() {     int i, j, K, n, m, k;     cin >> n >> m >> K;     for (i = 1; i <= n; i++) cin >> c[i];     for (i = 1; i <= n; i++) {       for (j = 1; j <= m; j++) {         cin >> val[i][j];       }     }     memset(dp, 0x3f, sizeof(dp));     dp[0][0][0] = 0;     for (i = 0; i < n; i++) {       for (j = 0; j <= m; j++) {         for (k = 0; k <= i; k++) {           if (dp[i][j][k] != INF) {             if (c[i + 1]) {               dp[i + 1][c[i + 1]][k + (c[i + 1] != j)] =                   min(dp[i + 1][c[i + 1]][k + (c[i + 1] != j)], dp[i][j][k]);             } else {               for (int p = 1; p <= m; p++) {                 dp[i + 1][p][k + (p != j)] =                     min(dp[i][j][k] + val[i + 1][p], dp[i + 1][p][k + (p != j)]);               }             }           }         }       }     }     for (i = 1; i <= m; i++) {       ans = min(dp[n][i][K], ans);     }     if (ans == INF)       cout << -1 << endl;     else       cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long fast_power(long long x, long long y) {     if (y == 0) return 1;     long long temp = fast_power(x, y / 2);     temp = ((temp % 1000000007) * (temp % 1000000007)) % 1000000007;     if (y % 2 != 0) temp = ((temp % 1000000007) * (x % 1000000007)) % 1000000007;     return temp;   }   long long f[1000001];   long long inv[1000001];   long long ncr(long long n, long long r) {     return ((((f[n] % 1000000007) * (inv[n - r] % 1000000007)) % 1000000007) *             inv[r]) %            1000000007;   }   long long nCr(long long n, long long r) {     long long f = 1;     long long x = 1;     for (long long i = n; i > n - r; i--) {       f *= i;       f /= x++;     }     return f;   }   long long npr(long long n, long long r) {     return (f[n] % 1000000007 * inv[n - r] % 1000000007) % 1000000007;   }   int main() {     long long n, r, t;     cin >> n >> r >> t;     f[0] = 1;     inv[0] = 1;     for (long long i = 1; i <= n; i++) {       f[i] = (f[i - 1] * i) % 1000000007;       inv[i] = fast_power(f[i], 1000000007 - 2);     }     long long sum = 0;     if (n >= 4)       for (long long i = 4; i < t; i++) {         if (t - i <= r) sum += nCr(n, i) * nCr(r, t - i);       }     cout << sum <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(false);     int n, m;     cin >> n >> m;     vector<int> a(n);     for (auto& x : a) cin >> x, --x;     vector<int> k(m);     for (auto& x : k) cin >> x;     for (int i = 0; i < n; ++i)       for (int j = i + 1; j <= n; ++j) {         vector<int> cur(m);         for (int l = i; l < j; ++l) ++cur[a[l]];         if (cur == k) {           cout <<  YES n ;           return 0;         }       }     cout <<  NO n ;   }
#include <bits/stdc++.h>   using namespace std;   template <typename T>   void nexts(T *, int);   template <typename T>   void dump(T *arr, int cnt, char sep =    );   void __init__(bool, bool);   const int MAXMAXMAX = 1000 * 1000 * 1000;   string a, b, c;   char ans[100015];   vector<int> cnt_a(26);   vector<int> cnt_b(26);   vector<int> cnt_c(26);   int main() {     __init__(1, 0);     cin >> a >> b >> c;     for (int(i) = (0); (i) < (a.size()); ++(i)) ++cnt_a[a[i] -  a ];     for (int(i) = (0); (i) < (b.size()); ++(i)) ++cnt_b[b[i] -  a ];     for (int(i) = (0); (i) < (c.size()); ++(i)) ++cnt_c[c[i] -  a ];     int b_max = MAXMAXMAX;     for (int(i) = (0); (i) < (26); ++(i))       if (cnt_b[i] != 0) b_max = min(b_max, cnt_a[i] / cnt_b[i]);     int max_ans = 0;     int max_b = 0;     int max_c = 0;     if (b_max == MAXMAXMAX) b_max = 0;     vector<int> tmp = cnt_a;     for (int(i) = (0); (i) < (b_max + 1); ++(i)) {       if (i != 0)         for (int(i) = (0); (i) < (26); ++(i)) tmp[i] -= cnt_b[i];       int c_max = MAXMAXMAX;       for (int(i) = (0); (i) < (26); ++(i))         if (cnt_c[i] != 0) c_max = min(c_max, tmp[i] / cnt_c[i]);       if (c_max == MAXMAXMAX) b_max = 0;       if (i + c_max > max_ans) {         max_ans = i + c_max;         max_b = i;         max_c = c_max;       }     }     for (int(i) = (0); (i) < (max_b); ++(i)) cout << b;     for (int(i) = (0); (i) < (max_c); ++(i)) cout << c;     for (int(i) = (0); (i) < (26); ++(i)) {       cnt_a[i] -= max_b * cnt_b[i] + max_c * cnt_c[i];       for (int(j) = (0); (j) < (cnt_a[i]); ++(j)) cout << (char)( a  + i);     }     cout <<   n ;     return 0;   }   template <typename T>   void nexts(T *arr, int cnt) {     for (int i = 0; i < cnt; ++i) cin >> arr[i];   }   template <typename T>   void dump(T *arr, int cnt, char sep) {     for (int i = 0; i < cnt; ++i) cout << arr[i] << sep;   }   void __init__(bool fastIOstream, bool acmp) {     if (fastIOstream) {       ios_base::sync_with_stdio(false);       cin.tie(0);     }     if (acmp) {       freopen( INPUT.TXT ,  rt , stdin);       freopen( OUTPUT.TXT ,  wt , stdout);     }   }
#include <bits/stdc++.h>   using namespace std;   long long nMod = 1e9 + 7;   inline long long GCD(long long a, long long b) {     while (b != 0) {       long long c = a % b;       a = b;       b = c;     }     return a;   };   inline long long LCM(long long a, long long b) { return (a / GCD(a, b)) * b; };   int m, n, k;   vector<set<int>> st(55);   void vietnakid() {     cin >> m >> n;     for (int i = 0; i < m; i++) {       cin >> k;       for (int j = 0; j < k; j++) {         int x;         cin >> x;         st[i].insert(x);       }     }     bool check = true;     for (int i = 0; i < m; i++) {       if (!check) break;       for (int j = 0; j < m; j++) {         bool ok = false;         for (auto x : st[i]) {           if (ok) break;           if (st[j].count(x)) {             ok = true;           }         }         if (!ok) {           check = false;           break;         }       }     }     if (check) {       cout <<  possible n ;     } else {       cout <<  impossible n ;     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie();     vietnakid();     cerr <<   nTime elapsed:   << 1000 * clock() / CLOCKS_PER_SEC <<  ms n ;     return 0;   }
#include <bits/stdc++.h>   #pragma GCC optimize( O3,unroll-loops )   #pragma pack(0)   using namespace std;   vector<string> v[1000001];   string s;   int ptr = 0, maxd = 0;   void dfs(int dis) {     maxd = max(maxd, dis);     int k = 0, f = ptr;     for (; ptr < s.length(); ptr++)       if (s[ptr] ==  , ) break;     string t = s.substr(f, ptr - f);     ptr++;     for (; ptr < s.length(); ptr++) {       if (s[ptr] ==  , ) break;       k = k * 10 + (s[ptr] -  0 );     }     ptr++;     v[dis].emplace_back(t);     for (int i = 1; i <= k; i++) dfs(dis + 1);   }   signed main() {     ios::sync_with_stdio(0), cin.tie(0);     cin >> s;     while (ptr < s.length()) dfs(0);     cout << maxd + 1 <<   n ;     for (int i = 0; !v[i].empty(); i++) {       for (auto j : v[i]) cout << j <<    ;       cout <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   class Solution {     int n, x[2];     vector<pair<long long, int>> A;       public:     void run() {       cin >> n >> x[0] >> x[1];       for (int i = 0; i < n; ++i) {         int c;         cin >> c;         A.emplace_back(c, i);       }       sort(A.begin(), A.end());       for (int i = 0; i < n; ++i) {         int a = A[i].first;         int j = (x[0] + a - 1) / a + i;         if (j < n and x[1] <= A[j].first * (n - j)) {           cout <<  Yes n ;           cout << j - i <<     << n - j <<   n ;           for (int k = i; k < j; ++k)             cout << A[k].second + 1 <<    n [k == j - 1];           for (int k = j; k < n; ++k)             cout << A[k].second + 1 <<    n [k == n - 1];           return;         }         j = (x[1] + a - 1) / a + i;         if (j < n and x[0] <= A[j].first * (n - j)) {           cout <<  Yes n ;           cout << n - j <<     << j - i <<   n ;           for (int k = j; k < n; ++k)             cout << A[k].second + 1 <<    n [k == n - 1];           for (int k = i; k < j; ++k)             cout << A[k].second + 1 <<    n [k == j - 1];           return;         }       }       cout <<  No n ;     }   };   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     Solution().run();   }
#include <bits/stdc++.h>   using namespace std;   bool isPrime(int a, int p) {     return (a <= p) || ((a % p != 0) && (isPrime(a, p + 1)));   }   int main() {     const int N = 256;     int freq[N] = {0};     string s;     cin >> s;     int len = s.size();     for (int p = 0; p < len; p++) {       ++freq[s[p]];     }     string t(len, 0);     int *m = max_element(freq, freq + N);     for (int p = 1; p < len; p++) {       if ((p < len / 2) || (!isPrime(p + 1, 2))) {         t[p] = m - freq;         (*m)--;       }     }     if (*m < 0) {       cout <<  NO  << endl;     } else {       int q = 0;       for (int p = 0; p < len; p++) {         if (!t[p]) {           while (!freq[q]) {             q++;           }           freq[t[p] = q]--;         }       }       cout <<  YES  << endl << t << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m;   bool cmp(pair<int, int> a, pair<int, int> b) {     if (a.first != b.first) return a.first > b.first;     return a.second < b.second;   }   bool cmp2(pair<int, int> a, pair<int, int> b) { return a.second < b.second; }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> n;     vector<pair<int, int> > v;     for (int i = 1; i <= n; i++) {       int x;       cin >> x;       v.push_back({x, i});     }     sort(v.begin(), v.end(), cmp);     cin >> m;     while (m--) {       int k, pos;       cin >> k >> pos;       vector<pair<int, int> > res;       for (int i = 0; i < k; i++) {         res.push_back(v[i]);       }       sort(res.begin(), res.end(), cmp2);       cout << res[pos - 1].first <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   using PII = pair<int, int>;   const int mod = 998244353;   const int inf = 1 << 30;   const int maxn = 200000 + 5;   int n, tot, tin[maxn], tout[maxn], rid[maxn], vis[maxn], deg[maxn];   vector<int> edge[maxn];   int query(int x, int y) {     cout <<  ?   << x <<     << y << endl;     cin >> x;     assert(x >= 1 && x <= n);     return x;   }   int ok[maxn];   void dfs(int u, int f) {     tin[u] = ++tot;     rid[tot] = u;     for (int v : edge[u]) {       if (v == f) continue;       dfs(v, u);     }     tout[u] = tot;   }   bool check(int x, int y) { return tin[x] <= tin[y] && tout[y] <= tout[x]; }   int main() {     scanf( %d , &n);     ok[1] = true;     for (int i = 2, u, v; i <= n; i++) {       scanf( %d%d , &u, &v);       ok[i] = true;       edge[u].push_back(v);       edge[v].push_back(u);       deg[u]++;       deg[v]++;     }     dfs(1, 0);     vector<int> v;     for (int i = 1; i <= n; i++)       if (deg[i] == 1) v.push_back(i);     assert(v.size() >= 2);     for (int i = 1; i < (int)v.size(); i += 2) {       int ans = query(v[i - 1], v[i]);       for (int y : edge[ans]) {         if (check(ans, y)) {           if (check(y, v[i - 1]) || check(y, v[i])) {             for (int j = tin[y]; j <= tout[y]; j++) {               ok[rid[j]] = false;             }           }         } else {           if (!check(ans, v[i - 1]) || !check(ans, v[i])) {             for (int j = 1; j < tin[ans]; j++) {               ok[rid[j]] = false;             }             for (int j = tout[ans] + 1; j <= n; j++) {               ok[rid[j]] = false;             }           }         }       }     }     v.clear();     for (int i = 1; i <= n; i++) {       if (!ok[i]) continue;       int c = 0;       for (int v : edge[i]) {         if (ok[v]) c++;       }       assert(c <= 2);       if (c == 1) {         v.push_back(i);       }     }     if (v.size() == 0) {       for (int i = 1; i <= n; i++) {         if (ok[i]) {           cout <<  !   << i << endl;           return 0;         }       }     } else if (v.size() == 2) {       int r = query(v[0], v[1]);       cout <<  !   << r << endl;     } else {       assert(false);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int INF = 1000000000;   const long long LINF = 4000000000000000000LL;   const double eps = 1e-9;   void prepare() {}   int a, n;   int day[10000008];   void read() { scanf( %d%d , &a, &n); }   void solve() {     read();     for (int i = 1; i * i < a + n; i++) {       int ii = i * i;       for (int j = ii; j < a + n; j += ii) day[j] = i * i;     }     long long res = 0;     for (int i = a; i < a + n; i++) res += i / day[i];     cout << res << endl;   }   int main() {     prepare();     solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long N = 100005;   long long t, l, i, j, k, p, q, u, v, n, color[1000005];   string s;   vector<long long> zro;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     cin >> q;     for (l = 1; l <= q; l++) {       cin >> n >> k >> s;       for (i = 0; i < n; i++) {         if (s[i] ==  0 )           zro.push_back(i);         else           color[i] = 1;       }       u = 0;       v = 0;       for (i = 0; i < zro.size(); i++) {         if (u == n || k == 0) break;         for (; u < n; u++) {           if (zro[i] < u) break;           if (color[u] == 1 && zro[i] - u <= k) {             k -= (zro[i] - u);             color[zro[i]] = 1;             color[u] = 0;             swap(s[u], s[zro[i]]);             u++;             break;           }         }       }       cout << s << endl;       for (i = 0; i <= n; i++) color[i] = 0;       zro.clear();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int a, sum = 0;     string s;     cin >> a;     for (int i = 0; i < a; i++) {       cin >> s;       if (s ==  Tetrahedron )         sum = sum + 4;       else if (s ==  Cube )         sum = sum + 6;       else if (s ==  Octahedron )         sum = sum + 8;       else if (s ==  Dodecahedron )         sum = sum + 12;       else if (s ==  Icosahedron )         sum = sum + 20;     }     cout << sum;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   ofstream file( debug.txt );   template <typename Int>   ostream &operator<<(ostream &s, const vector<Int> &v) {     s <<  [ ;     for (auto i = v.begin(); i != v.end(); i++) {       s << *i;       if (i != prev(v.end())) s <<  ,  ;     }     s <<  ] ;     return s;   }   template <typename Int, typename INT>   ostream &operator<<(ostream &s, const map<Int, INT> &mp) {     s <<  [ ;     for (auto &i : mp) {       s <<  [  << i.first <<  ,   << i.second <<  ] ;       if (i != *mp.rbegin()) s <<  ,  ;     }     s <<  ] ;     return s;   }   template <typename Int>   ostream &operator<<(ostream &s, const set<Int> &st) {     s <<  [ ;     for (auto &i : st) {       s << i;       if (i != *st.rbegin()) s <<  ,  ;     }     s <<  ] ;     s <<   n ;     return s;   }   template <typename Int, typename INt>   ostream &operator<<(ostream &s, const pair<Int, INt> &x) {     s <<  [  << x.first <<  ,   << x.second <<  ] ;     return s;   }   template <typename T>   void print(T *x, int n) {     for (int i = 0; i < n; i++) {       file << x[i] <<    n [i == n - 1];     }   }   template <typename T>   ostream &operator<<(ostream &s, const complex<T> &a) {     s <<  (  << a.real() <<  ,   << a.imag() <<  ) ;     return s;   }   template <typename T>   T debug(const T &x, const string &s =   ) {     file << s <<   =   << x <<   n  << flush;     return x;   }   const int dr[]{-1, -1, 0, 1, 1, 1, 0, -1};   const int dc[]{0, 1, 1, 1, 0, -1, -1, -1};   const int N = 2e5 + 10;   int n, m, q, ans;   bool dead[N];   set<int> edg[N];   void add(int u, int v) {     if (!dead[u]) {       dead[u] = 1;       ans--;     }     edg[u].insert(v);   }   void rem(int u, int v) {     if (dead[u] && edg[u].size() == 1) {       dead[u] = 0;       ans++;     }     edg[u].erase(v);   }   int main() {     cin.tie(0);     ios_base::sync_with_stdio(0);     cin >> n >> m;     ans = n;     for (int i = 0, u, v; i < m; i++) {       cin >> u >> v;       if (u > v) swap(u, v);       add(u, v);     }     cin >> q;     while (q--) {       int t;       cin >> t;       if (t < 3) {         int u, v;         cin >> u >> v;         if (u > v) swap(u, v);         if (t == 1)           add(u, v);         else           rem(u, v);       } else         cout << ans <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, s, ans, x, y, a;     bool flag = false;     cin >> n >> s;     s = s * 100;     ans = -1;     for (int i = 0; i < n; i++) {       cin >> x >> y;       a = x * 100 + y;       if (a <= s) {         ans = max(ans, (100 - a % 100) % 100);       }     }     cout << ans;     return 0;   }