malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   void read(int &x) {     register int c = getchar();     x = 0;     for (; c < 48 || c > 57; c = getchar())       ;     for (; c > 47 && c < 58; c = getchar()) x = (x << 1) + (x << 3) + c - 48;   }   queue<int> y[300005], v;   int main() {     int n, q, w = 0, x, z = 0, t = 0;     read(n);     read(q);     while (q--) {       read(x);       if (x == 1) {         read(x);         v.push(x);         y[x].push(t++);       } else if (x == 2) {         read(x);         z += y[x].size();         while (!y[x].empty()) y[x].pop();       } else {         read(x);         while (x > w) {           if (!y[v.front()].empty() && y[v.front()].front() < x) {             y[v.front()].pop();             z++;           }           ++w;           v.pop();         }       }       printf( %d n , t - z);     }   }
#include <bits/stdc++.h>   using namespace std;   struct P {     int x;     int a;   };   P data[105];   bool cmp(P x, P y) { return x.x < y.x; }   int main() {     int n;     int x, a;     int po = 0, ne = 0;     int res = 0;     scanf( %d , &n);     for (int i = 0; i < n; ++i) {       scanf( %d%d , &x, &a);       data[i].x = x;       data[i].a = a;       if (x < 0)         ++ne;       else         ++po;     }     sort(data, data + n, cmp);     if (ne > po) {       for (int i = n - 1; i >= n - po * 2 - 1; --i) {         res += data[i].a;       }     } else {       for (int i = 0; i < ne * 2 + 1; ++i) {         res += data[i].a;       }     }     printf( %d n , res);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int count = 0;   bool YES = false;   vector<string> record;   int compare(vector<string> cards, int pile1, int pile2) {     if (cards.at(pile1)[0] == cards.at(pile2)[0] ||         cards.at(pile1)[1] == cards.at(pile2)[1])       return 1;     return 0;   }   void move(vector<string> cards) {     int N = cards.size();     int end = N - 1;     if (N >= 4) {       if (compare(cards, end, end - 3)) {         string str =   ;         for (int k = 0; k < cards.size(); k++) {           str += cards.at(k);         }         for (int k = 0; k < record.size(); k++) {           if (str == record.at(k)) return;         }         record.push_back(str);         vector<string> cards_t = cards;         cards_t.at(end - 3) = cards_t.at(end);         cards_t.pop_back();         move(cards_t);         if (YES) return;       }       if (compare(cards, end, end - 1)) {         vector<string> cards_t = cards;         cards_t.at(end - 1) = cards_t.at(end);         cards_t.pop_back();         move(cards_t);         if (YES) return;       }     } else if (N > 1) {       if (compare(cards, end, end - 1)) {         vector<string> cards_t = cards;         cards_t.at(end - 1) = cards_t.at(end);         cards_t.pop_back();         move(cards_t);         if (YES) return;       }     } else if (N == 1) {       YES = true;       return;     }     return;   }   int main() {     vector<string> cards;     int t;     string card;     cin >> t;     for (int i = 0; i < t; i++) {       cin >> card;       cards.push_back(card);     }     move(cards);     if (YES)       cout <<  YES  << endl;     else       cout <<  NO  << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, a[3005], ans;   int main() {     scanf( %d , &n);     for (int i = 0; i < n; i++) {       scanf( %d , a + i);       for (int j = 0; j < i; j++) {         if (a[j] > a[i]) ans++;       }     }     if (ans % 2)       printf( %.6lf , (ans - 1) * 2.0 + 1);     else       printf( %.6lf , ans * 2.0);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int arr[100000 + 1];     int n, a;     set<int> s;     cin >> n;     vector<bool> vst(n, false);     for (int i = 0; i < n; ++i) {       cin >> a;       arr[i] = a;       s.insert(a);     }     int k = 1;     if (n != 1)       for (int i = 0; i < n; ++i) {         int j = arr[i];         if (!vst[j] && j <= n) {           vst[j] = 1;           cout << j <<    ;         } else {           while (s.count(k) || vst[k]) {             k++;           }           vst[k] = true;           cout << k <<    ;           k++;         }       }     else       cout <<  1 ;   }
#include <bits/stdc++.h>   using namespace std;   int perm[55];   int main() {     int n;     long long m;     scanf( %d%lld , &n, &m);     m--;     int l = 1;     int r = n;     for (long long i = n - 2; i >= 0; i--) {       if (m & (1LL << i)) {         perm[r] = n - 2 - i + 1;         r--;       } else {         perm[l] = n - 2 - i + 1;         l++;       }     }     perm[l] = n;     for (int i = 1; i <= n; i++) {       printf( %d  , perm[i]);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   pair<long int, long int> p[500005];   bool cmp(pair<long int, long int> p1, pair<long int, long int> p2) {     if (p1.second < p2.second)       return true;     else {       if (p1.first < p2.first)         return true;       else         return false;     }   }   int main() {     int n;     int i, ans = 0, l;     cin >> n;     for (i = 0; i < n; i++) cin >> p[i].second >> p[i].first;     sort(p, p + n);     ans++;     l = p[0].first;     for (i = 1; i < n; i++) {       if (p[i].second > l) {         l = p[i].first;         ans++;       }     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<int> alz(string a) {     int n = a.size();     vector<int> res(n);     int left = 0, right = 0;     for (int k = 1; k < n; k++) {       if (right < k) {         right = left = k;         while (right < n && a[right] == a[right - left]) right++;         res[k] = right - left;         right--;       } else {         int k1 = k - left;         if (res[k1] < right - k + 1)           res[k] = res[k1];         else {           left = k;           while (right < n && a[right] == a[right - left]) right++;           res[k] = right - left;           right--;         }       }     }     return res;   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     string ar[3];     cin >> ar[0] >> ar[1] >> ar[2];     int ta = ar[0].size() + ar[1].size() + ar[2].size();     int res = ta;     int a = ar[0].size(), b = ar[1].size(), c = ar[2].size();     string neo;     int per[] = {0, 1, 2};     vector<int> z;     do {       z = alz(ar[per[1]] +  $  + ar[per[0]]);       int mi = 0;       int ta = ar[per[1]].size() + 1 + ar[per[0]].size();       bool ins = false;       for (int i = ar[per[1]].size() + 1; i < ta; i++) {         if (z[i] == ar[per[1]].size()) {           ins = true;           break;         }         if (z[i] + i == ta) {           mi = z[i];           break;         }       }       if (ins)         neo = ar[per[0]];       else         neo = ar[per[0]].substr(0, ar[per[0]].size() - mi) + ar[per[1]];       ins = false;       z = alz(ar[per[2]] +  $  + neo);       ta = ar[per[2]].size() + 1 + neo.size();       mi = 0;       for (int i = ar[per[2]].size() + 1; i < ta; i++) {         if (z[i] == ar[per[2]].size()) {           ins = true;           break;         }         if (z[i] + i == ta) {           mi = z[i];           break;         }       }       if (ins) {         res = min(res, (int)neo.size());       } else         res = min(res, (int)neo.size() + (int)ar[per[2]].size() - mi);     } while (next_permutation(per, per + 3));     cout << res <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     int x[n];     for (int i = 0; i < n; i++) cin >> x[i];     sort(x, x + n);     int c = n / 2, ans = 0;     for (int i = 0; i < n / 2 && c < n; i++, c++)       if (x[i] * 2 <= x[c])         ans++;       else         i--;     cout << n - ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long int t, n, x, m, z, u, v, f, a, b, l, r;     cin >> t;     while (t--) {       cin >> n >> x >> m;       a = x;       b = x;       for (int i = 0; i < m; i++) {         cin >> l >> r;         if (a >= l && a <= r && b >= l && b <= r) {           a = min(a, l);           b = max(b, r);         } else if (a >= l && a <= r && b >= r) {           a = min(a, l);           b = max(b, r);         } else if (a <= l && b >= l && b <= r) {           a = min(a, l);           b = max(b, r);         } else if (a == l || b == l || a == r || b == r) {           a = min(a, l);           b = max(b, r);         }       }       cout << b - a + 1 << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int x;     cin >> x;     int a[x], i;     for (i = 0; i < x; i++) {       cin >> a[i];     }     sort(a, a + x);     int s = 0;     int j = 0, m = 0;     for (i = 0; i < x; i++) {       while (j < x && a[j] - a[i] <= 5) {         j++;         s = max(s, j - i);       }     }     cout << s;   }
#include <bits/stdc++.h>   using namespace std;   int n, m;   vector<pair<char, long long> > s1;   vector<pair<char, long long> > s2;   vector<pair<char, long long> > p;   int sl, pl;   int lps[1000009];   vector<int> ii;   void calclps() {     lps[0] = 0;     int j = 0, i = 1;     while (i < pl) {       if (p[j] == p[i]) {         if (j == 0) {           lps[i] = 1;         } else {           lps[i] = j + 1;         }         j++;         i++;       } else {         if (j == 0) {           lps[i] = 0;           i++;         } else {           j = lps[j - 1];         }       }     }   }   void kmp() {     ii.clear();     if (p.size() == 1) {       for (int i = 0; i < (int)sl; i++) {         if (s1[i] == p[0]) ii.push_back(i);       }       return;     }     calclps();     int i = 0, j = 0;     while (i < sl) {       if (s1[i] == p[j]) {         if (j == pl - 1) {           ii.push_back(i - pl + 1);           j = lps[j - 1];         } else {           i++;           j++;         }       } else {         if (j == 0)           i++;         else           j = lps[j - 1];       }     }   }   void print(vector<pair<char, long long> > v) {     cout <<  printing :   << endl;     for (int i = 0; i < (int)v.size(); i++) {       cout << v[i].first <<     << v[i].second << endl;     }   }   int main() {     scanf( %d , &n);     scanf( %d , &m);     for (int i = 0; i < n; i++) {       long long a;       cin >> a;       getchar();       char c = getchar();       if (i != 0 && s1[s1.size() - 1].first == c) {         s1[s1.size() - 1].second += a;       } else {         s1.push_back(make_pair(c, a));       }     }     for (int i = 0; i < m; i++) {       long long a;       cin >> a;       getchar();       char c = getchar();       if (i != 0 && s2[s2.size() - 1].first == c) {         s2[s2.size() - 1].second += a;       } else {         s2.push_back(make_pair(c, a));       }     }     long long ans = 0;     if (s2.size() == 1) {       char c = s2[0].first;       long long v = s2[0].second;       for (int i = 0; i < (int)s1.size(); i++) {         if (c == s1[i].first && s1[i].second >= v) {           ans += s1[i].second - v + 1;         }       }     } else if (s2.size() == 2) {       char c1 = s2[0].first;       char c2 = s2[1].first;       long long v1 = s2[0].second;       long long v2 = s2[1].second;       for (int i = 1; i < (int)s1.size(); i++) {         if (s1[i - 1].first == c1 && s1[i].first == c2 &&             s1[i - 1].second >= v1 && s1[i].second >= v2)           ans++;       }     } else {       for (int i = 1; i < (int)s2.size() - 1; i++) {         p.push_back(s2[i]);       }       sl = s1.size();       pl = p.size();       kmp();       for (int i = 0; i < (int)ii.size(); i++) {         int x = ii[i];         if (x > 0 && x + pl < n && s1[x - 1].first == s2[0].first &&             s1[x - 1].second >= s2[0].second &&             s1[x + pl].first == s2[s2.size() - 1].first &&             s1[x + pl].second >= s2[s2.size() - 1].second)           ans++;       }     }     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   const int INF = 1e9;   const int MOD = 1e9 + 7;   const long long INF64 = 1e18;   const long double EPS = 1e-7;   mt19937 myrand(time(NULL));   const int N = 100 * 1000 + 13;   int n, ac, d;   pair<int, int> a[N];   long double t[N];   bool read() {     if (scanf( %d%d%d , &n, &ac, &d) != 3) return 0;     for (int i = 0; i < (n); i++) scanf( %d%d , &a[i].first, &a[i].second);     return 1;   }   void solve() {     for (int i = 0; i < (n); i++) {       long double cur = a[i].second * 1.0 / ac;       t[i] = a[i].first;       if (cur * cur * ac / 2 > d - EPS)         t[i] += sqrtl(d * 2.0 / ac);       else         t[i] += cur + (d - cur * cur * ac / 2) / a[i].second;       if (i && t[i] < t[i - 1]) t[i] = t[i - 1];       printf( %.10f n , (double)t[i]);     }   }   int main() {     while (read()) solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int maxint = ~0U >> 1;   int flow, cost;   int pi[200001 + 1], v[200001 + 1];   int S, T;   int INF = 1000000000;   int tempAdd = 100000;   struct etype {     int t, c;     etype* next;     etype* pair;     etype() { next = 0; }     etype(int _t, int _c, etype* _n) { t = _t, c = _c, next = _n; }   } * e[200001 + 1], *eb[200001 + 1], *Pe, *Pool;   int aug(int w, int lim) {     int t;     v[w] = 1;     if (w == T) {       flow += lim;       return lim;     }     for (etype*& i = e[w]; i; i = i->next)       if (i->c && !v[i->t] && pi[w] == pi[i->t] + 1)         if (t = aug(i->t, min(lim, i->c))) return i->c -= t, i->pair->c += t, t;     return 0;   }   bool fix() {     int t = maxint;     for (int i = S; i <= T; i++)       if (v[i]) {         for (etype* j = eb[i]; j; j = j->next)           if (j->c && !v[j->t]) t = min(t, pi[j->t] + 1 - pi[i]);       }     if (t == maxint) return 0;     for (int i = S; i <= T; i++)       if (v[i]) e[i] = eb[i], pi[i] += t;     return 1;   }   void addedge(int s, int t, int c) {     ++Pe;     Pe->t = t, Pe->c = c, Pe->next = e[s];     e[s] = Pe;     ++Pe;     Pe->t = s, Pe->c = 0, Pe->next = e[t];     e[t] = Pe;     e[s]->pair = e[t];     e[t]->pair = e[s];   }   void prepare() {     if (Pool == NULL) Pool = new etype[1000001];     Pe = Pool;     memset(e, 0, sizeof(e));   }   int MaxFlow() {     flow = 0, cost = 0;     memcpy(eb, e, sizeof(e));     memset(pi, 0, sizeof(pi));     do {       do memset(v, 0, sizeof(v));       while (aug(S, maxint));     } while (fix());     return flow;   }   int nDog, nPeople;   int oriSex[10001];   int g;   int dogNode(int x) { return 1 + x; }   int peopleNode(int x) { return 1 + 10000 + x; }   int MAIN() {     prepare();     S = 1, T = 1 + 10000 + 2000 + 1;     cin >> nDog >> nPeople >> g;     int ifAllGet = 0;     for (int i = 1; i <= nDog; i++) cin >> oriSex[i];     for (int i = 1; i <= nDog; i++) {       int t;       cin >> t;       addedge(S, dogNode(i), tempAdd);       addedge(dogNode(i), T, tempAdd);       if (oriSex[i] == 0)         addedge(dogNode(i), T, t);       else         addedge(S, dogNode(i), t);     }     for (int i = 1; i <= nPeople; i++) {       addedge(S, peopleNode(i), tempAdd);       addedge(peopleNode(i), T, tempAdd);       int wantSex, pay, needDog;       cin >> wantSex >> pay >> needDog;       ifAllGet += pay;       if (wantSex == 0)         addedge(peopleNode(i), T, pay);       else         addedge(S, peopleNode(i), pay);       for (int j = 1; j <= needDog; j++) {         int t;         cin >> t;         if (wantSex == 1)           addedge(peopleNode(i), dogNode(t), INF);         else           addedge(dogNode(t), peopleNode(i), INF);       }       int isFriend;       cin >> isFriend;       if (isFriend) {         if (wantSex == 0)           addedge(peopleNode(i), T, g);         else           addedge(S, peopleNode(i), g);       }     }     cout << ifAllGet - MaxFlow() + (nDog + nPeople) * tempAdd << endl;     return 0;   }   int main() {     ios ::sync_with_stdio(false);     cout << fixed << setprecision(16);     return MAIN();   }
#include <bits/stdc++.h>   using namespace std;   template <class T>   bool inside(T a, T b, T c) {     return a <= b && b <= c;   }   long long modpower(long long x, long long n) {     long long m = 1000000007;     long long ans = 1;     x = (x + m) % m;     while (n > 0) {       if (n & 1) {         ans = (ans * x) % m;       }       n = n >> 1;       x = (x * x) % m;     }     return ans;   }   long long am(long long a, long long b) { return (a + b) % 1000000007; }   long long sm(long long a, long long b) {     return (a - b + 1000000007) % 1000000007;   }   long long mm(long long a, long long b) { return (a * b) % 1000000007; }   long long dm(long long a, long long b) {     return (a * modpower(b, 1000000007 - 2)) % 1000000007;   }   int main() {     ios_base::sync_with_stdio(false);     ;     cin.tie(NULL);     cout.tie(NULL);     ;     long long n;     cin >> n;     cout << sm(modpower(3, 3 * n), modpower(7, n)) <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 222222;   const int inf = 1e9 + 7;   vector<int> adj[MAXN], radj[MAXN];   int vis[MAXN], q[MAXN], qn, C;   int cost[MAXN], mn[MAXN], cnt[MAXN];   void dfs(int u) {     vis[u] = 1;     for (auto v : adj[u]) {       if (vis[v] == 1) continue;       dfs(v);     }     q[qn++] = u;   }   void rdfs(int u) {     vis[u] = C;     for (int i = 0; i < radj[u].size(); i++) {       int v = radj[u][i];       if (vis[v] == 0) rdfs(v);     }   }   void SCC(int n) {     for (int i = 1; i <= n; i++) vis[i] = 0;     qn = C = 0;     for (int i = 1; i <= n; i++) {       if (!vis[i]) {         dfs(i);       }     }     for (int i = 1; i <= n; i++) vis[i] = 0;     for (int i = qn - 1; i >= 0; i--) {       int cc = q[i];       if (!vis[cc]) {         C++;         rdfs(cc);       }     }   }   int main() {     int n, m, u, v;     scanf( %d , &n);     for (int i = 1; i <= n; i++) scanf( %d , cost + i);     scanf( %d , &m);     for (int i = 0; i < m; i++) {       scanf( %d%d , &u, &v);       adj[u].push_back(v);       radj[v].push_back(u);     }     SCC(n);     for (int i = 1; i <= C; i++) {       mn[i] = inf;       cnt[i] = 0;     }     for (int i = 1; i <= n; i++) {       int cc = vis[i];       if (mn[cc] == cost[i]) cnt[cc]++;       if (mn[cc] > cost[i]) mn[cc] = cost[i], cnt[cc] = 1;     }     long long ansc = 0, ansn = 1;     for (int i = 1; i <= C; i++) {       ansc += mn[i];       ansn = (1LL * ansn * cnt[i]) % inf;     }     printf( %lld %lld n , ansc, ansn);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAX = (2e5) + 10;   pair<int, int> ara[MAX];   int id[MAX];   vector<int> didi[MAX];   void solve() {     int n;     cin >> n;     for (int i = 0; i <= n - 1; i++) {       cin >> ara[i].first;     }     for (int i = 0; i <= n - 1; i++) {       cin >> ara[i].second;     }     sort(ara, ara + n, [](pair<int, int> x, pair<int, int> y) {       return (x.first == y.first) ? x.second > y.second : x.first < y.first;     });     int cp = -1;     priority_queue<int> que;     long long sum, prin;     sum = prin = 0;     for (int i = 0; i <= n - 1; i++) {       if (cp >= ara[i].first) {         que.push(ara[i].second);         sum += ara[i].second;       } else {         if (!que.empty()) {           sum -= que.top();           que.pop();           prin += sum;           cp++;           i--;         } else {           cp = ara[i].first;           i--;         }       }     }     while (!que.empty()) {       sum -= que.top();       que.pop();       prin += sum;     }     cout << prin << endl;   }   int main() {     ios::sync_with_stdio(false);     int tc;     solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long n, m, num[200001], sum[200001], ans;   set<int> s;   int main() {     cin >> n >> m;     for (int i = 0; i < m; i++) s.insert(i);     for (int i = 0; i < n; i++) {       int d, tmp;       cin >> num[i];       d = num[i] % m;       if (d > *s.rbegin())         tmp = *s.begin();       else         tmp = *s.lower_bound(d);       sum[tmp]++;       if (sum[tmp] == n / m) s.erase(tmp);       int s = (tmp - d + m) % m;       ans += s;       num[i] += s;     }     cout << ans << endl;     for (int i = 0; i < n; i++) cout << num[i] <<    ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int m[100100];   vector<int> diff[100100];   int main() {     int n;     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> m[i];       diff[i - m[i]].push_back(i);     }     long long sum = 0;     int d = 0, tot = 1;     for (int i = 2; i <= n; i++) {       auto it = upper_bound(diff[d + 1].begin(), diff[d + 1].end(), i);       sum += tot - m[i];       if (it != diff[d + 1].end() || m[i] == tot)         tot++;       else {         d++;         sum--;       }     }     cout << sum << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, i, j;     cin >> n;     set<int> row;     set<int> col;     map<int, int> row_map;     map<int, int> col_map;     for (i = 1; i <= n; i++) {       string s;       cin >> s;       for (j = 1; j <= n; j++) {         if (s[j - 1] ==  . ) {           row.insert(i);           col.insert(j);           row_map[i] = j;           col_map[j] = i;         }       }     }     if (row.size() == n) {       for (i = 1; i <= n; i++) {         cout << i <<     << row_map[i] << endl;       }     } else if (col.size() == n) {       for (j = 1; j <= n; j++) {         cout << col_map[j] <<     << j << endl;       }     } else       cout << -1 << endl;   }
#include <bits/stdc++.h>   using namespace std;   int n, a[200005], sum;   int main() {     cin >> n;     for (int i = 1; i <= n; i++) cin >> a[i], sum ^= a[i];     if (n % 2 == 0) {       if (sum) {         puts( NO );         return 0;       }       n--;     }     puts( YES );     printf( %d n , n - 1);     for (int i = 1; i <= n - 2; i += 2) printf( %d %d %d n , i, i + 1, i + 2);     for (int i = 1; i <= n - 2; i += 2) printf( %d %d %d n , i, i + 1, n);   }
#include <bits/stdc++.h>   using namespace std;   unsigned long long t1, t2, c1, c2, t0;   unsigned long long yy1 = 0, y2 = 0;   unsigned long long resyy1, resy2;   inline bool besser(unsigned long long res1, unsigned long long res2,                      unsigned long long res3, unsigned long long res4) {     return res1 * t1 * res4 + res2 * t2 * res3 <            res3 * t1 * res2 + res4 * t2 * res1;   }   inline bool eq(unsigned long long res1, unsigned long long res2,                  unsigned long long res3, unsigned long long res4) {     return res1 * t1 * res4 + res2 * t2 * res3 ==            res3 * t1 * res2 + res4 * t2 * res1;   }   int main() {     cin >> t1 >> t2 >> c1 >> c2 >> t0;     if (t1 == t2) {       cout << c1 <<     << c2 << endl;       return 0;     }     resyy1 = 0, resy2 = c2;     yy1 = 1;     while (yy1 <= c1) {       while (y2 <= c2 && (t1 * yy1 + t2 * y2 < t0 * (yy1 + y2))) y2++;       if (y2 > c2) break;       if ((t1 * yy1 + t2 * y2 < t0 * (yy1 + y2))) {         break;       } else {         if (besser(yy1, y2, resyy1, resy2)) {           resyy1 = yy1, resy2 = y2;           yy1++;           continue;         }         if (eq(yy1, y2, resyy1, resy2) && (yy1 + y2 > resyy1 + resy2)) {           resyy1 = yy1, resy2 = y2;           yy1++;           continue;         }       }       yy1++;     }     cout << resyy1 <<     << resy2 << endl;   }
#include <bits/stdc++.h>   using namespace std;   const double eps = 1e-6;   double r;   int main() {     scanf( %lf , &r);     for (int a = 1; a <= 10; ++a) {       for (int h = 1; h <= 10; ++h) {         double area = (a / 2.0 * h);         double bot = sqrt(a * a / 4.0 + h * h);         double tmp = area / bot;         if (fabs(tmp - r) < eps) {           printf( %d %d n , a, h);           return 0;         }       }     }   }