malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   template <class T>   inline void maz(T &a, T b) {     if (a < b) a = b;   }   template <class T>   inline void miz(T &a, T b) {     if (a > b) a = b;   }   template <class T>   inline T abs(T a) {     return a > 0 ? a : -a;   }   const int N = 100100, INF = 1e9;   const double EPS = 1e-7;   const int mod = 1e9 + 7;   long long mul(long long a, long long b, long long MOD) { return a * b % MOD; }   long long Pow(long long a, long long x, long long MOD) {     long long res = 1, tmp = a;     while (x) {       if (x & 1) res = mul(res, tmp, MOD);       tmp = mul(tmp, tmp, MOD);       x >>= 1;     }     return res;   }   int main() {     int p;     scanf( %d , &p);     int k;     scanf( %d , &k);     if (k == 0) {       cout << Pow(p, p - 1, mod) << endl;     } else if (k == 1) {       cout << Pow(p, p, mod) << endl;     } else {       long long now = k;       int ct = 1;       while (now != 1) {         now = mul(now, k, p), ct++;       }       cout << Pow(p, (p - 1) / ct, mod) << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     string s;     cin >> s;     int n = (int)s.size();     vector<vector<int>> a(26, vector<int>(n + 1));     for (int i = 1; i < n + 1; ++i) {       a[s[i - 1] -  a ][i] += 1;     }     for (int i = 0; i < 26; ++i) {       for (int j = 1; j < n + 1; ++j) {         a[i][j] += a[i][j - 1];       }     }     int q;     cin >> q;     while (q--) {       int l, r;       cin >> l >> r;       if (l == r) {         cout <<  Yes  <<   n ;         continue;       }       int cnt = 0;       for (int i = 0; i < 26; ++i) {         cnt += !!(a[i][r] - a[i][l - 1]);       }       if (cnt == 1) {         cout <<  No  <<   n ;         continue;       }       if (cnt == 2) {         cout << (s[l - 1] == s[r - 1] ?  No  :  Yes ) <<   n ;         continue;       }       cout <<  Yes  <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long t[505];   long long p[505][505];   long long dp[505][505];   const long long oo = 4557430888798830399LL;   int main() {     ios_base::sync_with_stdio(0), cin.tie(0);     int n, m, k;     cin >> n >> m >> k;     vector<string> s(n);     for (auto &i : s) cin >> i;     memset(p, 63, sizeof p);     memset(dp, 63, sizeof dp);     for (int i = 0; i < n; ++i) {       for (int j = 0; j < m; ++j) t[j + 1] = t[j] + s[i][j] -  0 ;       for (int j = 1; j <= m; ++j)         if (s[i][j - 1] ==  1 )           for (int l = j; l <= m; ++l)             if (s[i][l - 1] ==  1 )               p[i][t[m] - t[l] + t[j - 1]] =                   min(p[i][t[m] - t[l] + t[j - 1]], (long long)l - j + 1);       p[i][t[m]] = 0;     }     dp[0][0] = 0;     for (int i = 0; i < n; ++i)       for (int j = 0; j <= k; ++j)         if (dp[i][j] != oo)           for (int l = k - j; l >= 0; --l)             if (p[i][l] != oo)               dp[i + 1][j + l] = min(dp[i + 1][j + l], dp[i][j] + p[i][l]);     long long ans = oo;     for (int i = 0; i <= k; ++i) ans = min(ans, dp[n][i]);     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int dp[41][1 << 7][1 << 7], num[1 << 7], vis[3][30], n, m;   void init() {     int i, j, k;     for (i = 0; i <= 40; i++) {       for (j = 0; j < 1 << 7; j++) {         for (k = 0; k < 1 << 7; k++) {           dp[i][j][k] = -11111111;         }       }     }   }   int get_zero(int x) {     int sum = 0, len = 0;     while (x) {       if (x % 2 == 0) sum++;       x /= 2;       len++;     }     return sum + m - len;   }   void gao(int index, int x) {     int ans = 0;     while (x) {       vis[index][ans++] = x % 2;       x /= 2;     }   }   int check(int up, int mid, int down, int a) {     int i, j, flag = 1;     memset(vis, 0, sizeof(vis));     gao(0, up), gao(1, mid), gao(2, down);     for (i = 0; i < m; i++) {       if (vis[1][i] == 1) continue;       if (i + 1 <= m - 1 && vis[1][i + 1] == 1) continue;       if (i - 1 >= 0 && vis[1][i - 1] == 1) continue;       if (vis[0][i] == 1) continue;       if (vis[2][i] == 1) continue;       flag = 0;       break;     }     return flag;   }   int main() {     init();     int up, mid, i, j, k, x;     scanf( %d %d , &n, &m);     if (n < m) swap(n, m);     for (i = 0; i <= (1 << m); i++) {       dp[0][0][i] = 0;       num[i] = get_zero(i);     }     int r = (1 << m);     for (i = 0; i < n; i++) {       for (j = 0; j < r; j++) {         for (k = 0; k < r; k++) {           for (x = 0; x < r; x++) {             if (check(j, k, x, i)) {               dp[i + 1][k][x] = max(dp[i + 1][k][x], dp[i][j][k] + num[k]);             }           }         }       }     }     int maxnum = -1;     for (i = 0; i < r; i++) {       maxnum = max(maxnum, dp[n][i][0]);     }     printf( %d n , maxnum);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const double eps = 1e-8;   int dcmp(double x) {     if (fabs(x) < eps) return 0;     return (x > 0) ? 1 : -1;   }   const unsigned long long hash1 = 201326611;   const unsigned long long hash2 = 50331653;   const int N = 1000000 + 10;   const int M = 1000 + 10;   const int inf = 0x3f3f3f3f;   const long long mod = 1000000000 + 7;   int n, m, k, sx, sy, ex, ey;   char mp[M][M];   int vis[M][M], dis[M][M];   int dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0};   struct node {     int x, y;   };   int check(int tx, int ty) {     if (tx < 1 || tx > n || ty < 1 || ty > m) return 0;     if (mp[tx][ty] ==  # ) return 0;     return 1;   }   int bfs() {     queue<pair<int, int> > qu;     qu.push(make_pair(sx, sy));     vis[sx][sy] = (1 << 4) - 1;     dis[sx][sy] = 0;     while (!qu.empty()) {       pair<int, int> now = qu.front();       qu.pop();       if (now.first == ex && now.second == ey) return dis[ex][ey];       for (int i = 0; i < 4; i++) {         int tmp = k, tx = now.first, ty = now.second;         while (tmp--) {           tx += dx[i], ty += dy[i];           if (!check(tx, ty)) break;           if ((vis[tx][ty] >> i) & 1) break;           vis[tx][ty] |= (1 << i);           if (dis[tx][ty] != 0)             dis[tx][ty] = min(dis[tx][ty], dis[now.first][now.second] + 1);           else             dis[tx][ty] = dis[now.first][now.second] + 1;           qu.push(make_pair(tx, ty));         }       }     }     return -1;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0), cout.tie(0);     cin >> n >> m >> k;     for (int i = 1; i <= n; i++) {       cin >> mp[i] + 1;     }     cin >> sx >> sy >> ex >> ey;     cout << bfs() << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, k;   long long pow2(int x) {     if (x == 0) return 1;     if (x == 1) return 2;     long long h = pow2(x / 2);     return (h * h * (x & 1 ? 2 : 1)) % 1000000009;   }   int main() {     cin >> n >> m >> k;     int x = n / k;     int y = n % k;     int z = m - (x * (k - 1) + y);     if (z > 0) {       long long v = ((pow2(z + 1) + 1000000009 - 2 - z) * k) % 1000000009;       long long res = (v + m) % 1000000009;       cout << res << endl;     } else {       cout << m << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 50100;   unsigned long long arr[maxn];   int main() {     ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);     unsigned long long s = 0, res = 0;     long long n;     cin >> n;     for (int i = 0; i < n; i++) cin >> arr[i], s += arr[i];     s = s / n;     for (int i = 0; i + 1 < n; i++) {       long long tmp = arr[i] - s;       res += abs(tmp);       arr[i + 1] += tmp;     }     cout << res << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   bool prime[1000009];   vector<long long> pri;   void SieveOfEratosthenes() {     memset(prime, true, sizeof(prime));     for (long long p = 2; p * p <= 1000000; p++) {       if (prime[p] == true) {         for (long long i = p * p; i <= 1000000; i += p) prime[i] = false;       }     }     for (long long i = 2; i <= 1000000; i++) {       if (prime[i]) {         pri.push_back(i);       }     }   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long t;     cin >> t;     SieveOfEratosthenes();     while (t--) {       long long n;       cin >> n;       long long counter = 0;       int i = 0;       long long sz = pri.size();       long long st = 0;       long long end = sz - 1;       long long idx;       if (n == 1) {         printf( 1 n );         continue;       }       while (st < end) {         long long md = st + (end - st) / 2;         if (pri[md] * pri[md] > n) {           end = md;           idx = md;         } else {           st = md + 1;         }       }       st = 0;       end = sz - 1;       long long id = upper_bound(pri.begin(), pri.end(), n) - pri.begin();       id--;       long long ans = id - idx + 2;       printf( %lld n , ans);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 105, maxm = 1000005;   const int inf = 0x3f3f3f3f;   int f[maxn][maxn];   int p[maxm], d[maxm], pre[maxm], nxt[maxm];   int main() {     int n, m;     char ch;     cin >> n;     for (int i = 1; i <= n; ++i) {       for (int j = 1; j <= n; ++j) {         cin >> ch;         f[i][j] = ch -  0 ;         if (f[i][j] == 0) f[i][j] = inf;       }     }     for (int i = 1; i <= n; ++i) f[i][i] = 0;     for (int k = 1; k <= n; ++k) {       for (int i = 1; i <= n; ++i) {         for (int j = 1; j <= n; ++j) {           f[i][j] = min(f[i][j], min(inf, f[i][k] + f[k][j]));         }       }     }     cin >> m;     nxt[0] = 1, pre[m + 1] = m;     for (int i = 1; i <= m; ++i) {       cin >> p[i];       d[i] = 1;       pre[i] = i - 1;       nxt[i] = i + 1;     }     int cnt = 0;     for (int i = 2; i < m; ++i) {       if (d[pre[i]] + d[i] == f[p[pre[i]]][p[nxt[i]]]) {         d[pre[i]] += d[i];         nxt[pre[i]] = nxt[i];         pre[nxt[i]] = pre[i];         ++cnt;       }     }     cout << m - cnt << endl;     for (int i = nxt[0]; i != m + 1; i = nxt[i]) {       cout << p[i] <<    ;     }     cout << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n;   int a[210000];   long long sum[210000];   long long calc_move(int from, int to) {     return a[from] * 1ll * (to - from) - (sum[to] - sum[from]);   }   long long crossover(int from, int to) {     long long headstart = calc_move(from, to);     if (headstart < 0) return to;     return to + 1 + headstart / (a[to] - a[from]);   }   long long solve() {     long long ret = 0;     deque<int> q;     for (int(i) = 0; (i) < (int)(n); (i)++)       sum[i] = (i == 0 ? 0 : sum[i - 1]) + a[i];     int largest_so_far = -100000000;     for (int(i) = 0; (i) < (int)(n); (i)++) {       if (a[i] > largest_so_far) {         while (q.size() >= 2 && crossover(q[0], q[1]) >= crossover(q[0], i))           q.pop_back();         q.push_back(i);         largest_so_far = a[i];       }       while (q.size() >= 2 && crossover(q[0], q[1]) <= i) q.pop_front();       ret = max(ret, calc_move(q[0], i));     }     return ret;   }   int main() {     long long start_char = 0;     scanf( %d , &n);     for (int(i) = 0; (i) < (int)(n); (i)++) {       scanf( %d , &a[i]);       start_char += (i + 1) * 1ll * a[i];     }     long long best_delta = solve();     reverse(a, a + n);     for (int(i) = 0; (i) < (int)(n); (i)++) a[i] = -a[i];     best_delta = max(best_delta, solve());     printf( %lld n , start_char + best_delta);   }
#include <bits/stdc++.h>   using namespace std;   const int INF = 0x3f3f3f3f;   inline int Max(int a, int b) { return a > b ? a : b; }   const int maxn = 2e5 + 20;   int maxy[maxn << 2], mark[maxn], x[maxn], y[maxn];   set<int> s[maxn];   int n, m;   char op[20];   vector<int> v;   void build(int l, int r, int rt) {     if (l == r) {       maxy[rt] = -1;       return;     } else {       int mid = (l + r) >> 1;       build(l, mid, rt << 1);       build(mid + 1, r, rt << 1 | 1);     }   }   void pushup(int rt) { maxy[rt] = Max(maxy[rt << 1], maxy[rt << 1 | 1]); }   void update(int pos, int val, int l, int r, int rt) {     if (l == r) {       maxy[rt] = val;       return;     }     int mid = (l + r) >> 1;     if (pos <= mid)       update(pos, val, l, mid, rt << 1);     else       update(pos, val, mid + 1, r, rt << 1 | 1);     pushup(rt);   }   int query(int L, int R, int val, int l, int r, int rt) {     if (maxy[rt] <= val) return -1;     if (l == r) return l;     int mid = (l + r) >> 1;     int ans = -1;     if (L <= mid && maxy[rt << 1] > val) {       ans = query(L, R, val, l, mid, rt << 1);       if (ans != -1) return ans;     }     if (R > mid && maxy[rt << 1 | 1] > val)       ans = query(L, R, val, mid + 1, r, rt << 1 | 1);     return ans;   }   int main() {     scanf( %d , &n);     for (int i = (0); i < (n); i++) {       scanf( %s%d%d , op, &x[i], &y[i]);       if (op[0] ==  a )         mark[i] = 1;       else if (op[0] ==  r )         mark[i] = 2;       else         mark[i] = 3;       if (op[0] ==  a ) v.push_back(x[i]);     }     sort(v.begin(), v.end());     v.erase(unique(v.begin(), v.end()), v.end());     m = v.size();     for (int i = (0); i < (n); i++) {       if (mark[i] == 1 || mark[i] == 2) {         int pos = lower_bound(v.begin(), v.end(), x[i]) - v.begin() + 1;         if (mark[i] == 1)           s[pos].insert(y[i]);         else           s[pos].erase(y[i]);         int val;         if (s[pos].empty())           val = -INF;         else           val = *(--s[pos].end());         update(pos, val, 1, m, 1);       } else {         int pos = upper_bound(v.begin(), v.end(), x[i]) - v.begin() + 1;         int z = query(pos, m, y[i], 1, m, 1);         if (z == -1 || pos == m + 1) {           puts( -1 );           continue;         }         int ans = *(s[z].upper_bound(y[i]));         printf( %d %d n , v[z - 1], ans);       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int32_t main() {     long long q;     cin >> q;     for (long long i = 0; i < q; i++) {       long long a, b, c;       cin >> a >> b >> c;       long long ans = 0;       long long num = min(min(a, b), c);       ans += num;       a -= num;       b -= num;       c -= num;       if (a > b) {         swap(a, b);       }       num = min(a, (a + b) / 3);       ans += num;       cout << ans << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MOD = 1e9 + 7;   int main() {     cin.tie(0), cout.tie(0);     ios::sync_with_stdio(false);     int t;     cin >> t;     while (t--) {       int n, l, r, now = 1;       cin >> n;       for (int i = 0; i < n; i++) {         cin >> l >> r;         if (now < l) {           now = l;         }         if (now <= r) {           cout << now <<    ;           now++;         } else {           cout << 0 <<    ;         }       }       cout << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   int n, m;   int nd, na;   int nm;   int atq[124], def[124], meu[124];   int foi[124];   int killAll() {     memset(foi, 0, sizeof(foi));     for (int i = 0; i < nd; i++) {       int j = 0;       while (j < nm && (meu[j] <= def[i] || foi[j] == 1)) j++;       if (j == nm)         return 0;       else         foi[j] = 1;     }     int ans = 0;     for (int i = 0; i < na; i++) {       int j = 0;       while (j < nm && (meu[j] < atq[i] || foi[j])) j++;       if (j == nm) return 0;       if (meu[j] >= atq[i] && !foi[j]) {         ans += meu[j] - atq[i];         foi[j] = 1;       }     }     for (int j = 0; j < nm; j++)       if (!foi[j]) ans += meu[j];     return ans;   }   int killAtq() {     int me = min(nm, na);     int ans = 0;     for (int k = 1; k <= me; k++) {       int j = nm - k;       int aux = 0;       for (int i = 0; i < k; i++, j++) {         if (meu[j] >= atq[i]) {           aux += meu[j] - atq[i];         }       }       ans = max(ans, aux);     }     return ans;   }   int main() {     char s[124];     scanf(  %d %d , &n, &m);     nd = na = nm = 0;     int p;     for (int i = 0; i < n; i++) {       scanf(  %s %d , s, &p);       if (!strcmp( ATK , s)) atq[na++] = p;       if (!strcmp( DEF , s)) def[nd++] = p;     }     for (int i = 0; i < m; i++) {       scanf(  %d , &p);       meu[nm++] = p;     }     sort(atq, atq + na);     sort(def, def + nd);     sort(meu, meu + nm);     printf( %d n , max(killAll(), killAtq()));     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long int power(long long int x, long long int n) {     if (n == 0)       return 1;     else if (n % 2 == 0)       return power(x * x, n / 2);     else       return x * power(x * x, (n - 1) / 2);   }   long long int highestPowerof2(long long int n) {     long long int p = (long long int)log2(n);     return (long long int)pow(2, p);   }   long long int powermod(long long int x, long long int y, long long int p) {     long long int res = 1;     x = x % p;     if (x == 0) return 0;     while (y > 0) {       if (y & 1) res = (res * x) % p;       y = y >> 1;       x = (x * x) % p;     }     return res;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     long long int n, m, i, j, k, count;     bool ok = false;     cin >> n >> m;     long long int a[n][m];     long long int arr[n][m];     memset(arr, -1, sizeof(arr));     for (i = 0; i < n; i++) {       for (j = 0; j < m; j++) cin >> a[i][j];     }     for (i = 0; i < n; i++) {       for (j = 0; j < m; j++) {         if (a[i][j] == 0) {           for (k = 0; k < n; k++) arr[k][j] = 0;           for (k = 0; k < m; k++) arr[i][k] = 0;         }       }     }     for (i = 0; i < n; i++) {       for (j = 0; j < m; j++) {         if (arr[i][j] == -1) arr[i][j] = 1;       }     }     for (i = 0; i < n; i++) {       for (j = 0; j < m; j++) {         count = 0;         if (a[i][j] == 1) {           for (k = 0; k < n; k++)             if (arr[k][j] == 1) count++;           for (k = 0; k < m; k++)             if (arr[i][k] == 1) count++;           if (count == 0) {             ok = true;             break;           }         } else if (a[i][j] == 0) {           for (k = 0; k < n; k++)             if (arr[k][j] == 1) count++;           for (k = 0; k < m; k++)             if (arr[i][k] == 1) count++;           if (count != 0) {             ok = true;             break;           }         }       }       if (ok) break;     }     if (ok)       cout <<  NO  << endl;     else {       cout <<  YES  << endl;       for (i = 0; i < n; i++) {         for (j = 0; j < m; j++) {           cout << arr[i][j] <<    ;         }         cout << endl;       }     }   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 1e5 + 5;   const int INF = 1e9 + 7;   vector<int> adjList[MAXN];   vector<int> vec;   bool visited[MAXN];   void dfs(int start) {     visited[start] = true;     for (auto u : adjList[start]) {       if (!visited[u]) {         dfs(u);       }     }     vec.push_back(start);   }   int main() {     int n, m;     cin >> n >> m;     for (int i = 0; i < m; ++i) {       int c, d;       cin >> c >> d;       adjList[c].push_back(d);     }     for (int i = 1; i <= n; ++i) {       if (!visited[i]) {         vec.clear();         dfs(i);         for (auto u : vec) {           cout << u <<    ;         }       }     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     int x = 1, y = 1;     int k = 0;     cin >> k;     bool fl = false;     for (int i = 1; i <= n; i++) {       int t;       if (i != n)         cin >> t;       else         t = 1 - k;       if (t == k && fl == false) {         x++;       } else if (t != k) {         if (y != x && fl == true) {           cout <<  NO ;           return 0;         }         fl = true;         y = 1;         k = t;       } else if (t == k) {         y++;       }     }     cout <<  YES ;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 200 + 5;   int mp[maxn][maxn], dp[maxn][maxn], n, m;   int main() {     int t;     scanf( %d , &t);     while (t--) {       memset(dp, 0, sizeof dp);       scanf( %d%d , &n, &m);       for (int i = 1; i <= n; i++)         for (int j = 1; j <= m; j++) scanf( %d , &mp[i][j]);       for (int i = 1; i <= m; i++) {         memset(dp[i & 1], 0, sizeof dp[i & 1]);         for (int k = 0; k < n; k++) {           for (int s = 0; s < (1 << n); s++) {             int tmp = 0;             for (int j = 1; j <= n; j++) {               if (s & (1 << (j - 1))) tmp += mp[j][i];             }             for (int x = 0; x < (1 << n); x++) {               if (!(s & x))                 dp[i & 1][s | x] = max(dp[i & 1][s | x], dp[!(i & 1)][x] + tmp);             }           }           for (int j = 1; j <= n; j++) mp[j - 1][i] = mp[j][i];           mp[n][i] = mp[0][i];         }       }       printf( %d n , dp[m & 1][(1 << n) - 1]);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int a[654321];   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     int n, k;     cin >> n >> k;     int a, b, c, d;     cin >> a >> b >> c >> d;     map<int, int> mapka;     mapka[1] = a;     mapka[2] = c;     mapka[n - 1] = d;     mapka[n] = b;     set<int> st;     for (int i = 1; i <= n; ++i) st.insert(i);     st.erase(a);     st.erase(b);     st.erase(c);     st.erase(d);     if (n == 4 || k <= n) {       cout << -1;       return 0;     }     int cc = 3;     for (set<int>::iterator it = st.begin(); it != st.end(); ++it)       mapka[cc++] = *it;     for (int i = 1; i <= n; ++i) cout << mapka[i] <<    ;     cout << endl;     cout << mapka[2] <<     << mapka[1] <<    ;     for (int i = 3; i <= n - 2; ++i) cout << mapka[i] <<    ;     cout << mapka[n] <<     << mapka[n - 1] << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int inf = 1e9;   template <class T>   int getbit(T x, int pos) {     return (x >> (pos - 1)) & 1;   }   template <class T>   void turn_on(T &x, int pos) {     x = x | ((T)1 << (pos - 1));   }   template <class T>   void turn_off(T &x, int pos) {     x = x & ~((T)1 << (pos - 1));   }   template <class T>   T sqr(T a) {     return a * a;   }   int main() {     int n;     scanf( %d , &n);     long long g = 0;     for (int i = 1; i <= n; ++i) {       long long x = 0;       scanf( %I64d , &x);       if (x < 4)         g ^= 0;       else if (x < 16)         g ^= 1;       else if (x < 82)         g ^= 2;       else if (x < 6723)         g ^= 0;       else if (x < 50626)         g ^= 3;       else if (x < 2562991876)         g ^= 1;       else         g ^= 2;     }     if (g == 0)       printf( Rublo );     else       printf( Furlo );   }
#include <bits/stdc++.h>   using namespace std;   const int N = 2e5 + 100;   struct Node {     int a, b, id;     Node() {}     Node(int a, int b, int id) : a(a), b(b), id(id) {}     bool operator<(const Node& th) const { return a < th.a; }   } node[N];   int vis[N];   int main() {     int n, m;     while (scanf( %d%d , &n, &m) != EOF) {       for (int i = 0; i < m; i++) {         int a, b;         scanf( %d%d , &a, &b);         b += a - 1;         node[i] = Node(a, b, i);       }       sort(node, node + m);       int l = 0;       int i = 0;       memset(vis, 0, sizeof(vis));       int cnt = 0;       while (i < m) {         l = max(l, node[i].a - 1);         int r = node[i].b;         int id = i;         while (i < m && node[i].a <= l + 1) {           if (node[i].b > r) {             id = i;             r = node[i].b;           }           i++;         }         if (r > l) {           cnt++;           vis[node[id].id] = 1;         }         l = max(l, r);       }       cnt = m - cnt;       printf( %d n , cnt);       for (int i = 0; i < m; i++)         if (!vis[i]) {           cnt--;           printf( %d%c , i + 1, cnt == 0 ?   n  :    );         }     }     return 0;   }