malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   using ll = int64_t;   using ull = uint64_t;   using ld = long double;   using uint = uint32_t;   const double EPS = 1e-8;   const int INF = 0x3F3F3F3F;   const ll LINF = 4611686018427387903;   const int MOD = 1e9 + 7;   signed main() {     ios::sync_with_stdio(0);     cin.tie(NULL);     int n, m, mx = 0;     string a, b;     cin >> n >> m >> a >> b;     vector<vector<int>> dp(n + 1, vector<int>(m + 1));     for (int i = 0; i <= n; i++) {       for (int j = 0; j <= m; j++) {         if (i) dp[i][j] = max(dp[i][j], dp[i - 1][j] - 1);         if (j) dp[i][j] = max(dp[i][j], dp[i][j - 1] - 1);         if (i && j && a[i - 1] == b[j - 1])           dp[i][j] = max(dp[i][j], dp[i - 1][j - 1] + 2);         mx = max(mx, dp[i][j]);       }     }     cout << mx <<   n ;   }
#include <bits/stdc++.h>   const long long MOD = 1000000007;   using namespace std;   long long ans[2005][2005];   int main() {     long long i, j, k;     long long A[2005], N, H;     cin >> N >> H;     for (i = 0; i < N; i++) {       cin >> A[i];     }     if (A[0] == H - 1) {       ans[0][0] = 1;       ans[0][1] = 1;     }     if (A[0] == H) {       ans[0][0] = 1;     }     for (i = 1; i <= N; i++) {       for (j = 0; j <= i + 1; j++) {         if (A[i] + j == H - 1) {           ans[i][j] += ans[i - 1][j];           ans[i][j] %= MOD;           ans[i][j] += (ans[i - 1][j + 1] * (j + 1));           ans[i][j] %= MOD;           if (j > 0) {             ans[i][j] += (ans[i - 1][j] * j);             ans[i][j] %= MOD;           }         } else if (A[i] + j == H) {           ans[i][j] += ans[i - 1][j];           ans[i][j] %= MOD;           if (j > 0) {             ans[i][j] += ans[i - 1][j - 1];             ans[i][j] %= MOD;           }         }       }     }     ans[i][j] %= MOD;     cout << ans[N - 1][0] <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int dis(char a, char b) {     if (a > b) swap(b, a);     return min(b - a, a + 26 - b);   }   string tmp =  ACTG ;   int main() {     int n;     scanf( %d , &n);     string s;     cin >> s;     int mn = INT_MAX;     for (int i = 0; i + 4 - 1 < n; i++) {       int now = 0;       for (int j = i, k = 0; k < 4; j++, k++) {         now += dis(s[j], tmp[k]);       }       mn = min(mn, now);     }     printf( %d n , mn);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long maxn = 90;   vector<long long> col[2];   long long savecol[maxn];   long long dis[maxn][12];   long long g[88][88];   void solve() {     long long n, k;     scanf( %lld %lld , &n, &k);     for (long long i = 1; i <= n; i++)       for (long long j = 1; j <= n; j++) scanf( %lld , &g[i][j]);     long long t = 2000;     long long ans = LLONG_MAX;     while ((double)clock() / 1000 < 0.8) {       col[0].clear();       col[1].clear();       for (long long i = 1; i <= n; i++) {         savecol[i] = rand() % 2;         col[savecol[i]].push_back(i);       }       memset(dis, 0x3f, sizeof(dis));       dis[1][0] = 0;       for (long long nowk = 1; nowk <= k; nowk++) {         for (long long s = 1; s <= n; s++) {           for (long long d : col[savecol[s] ^ 1]) {             dis[d][nowk] = min(dis[d][nowk], dis[s][nowk - 1] + g[s][d]);           }         }       }       ans = min(ans, dis[1][k]);     }     cout << ans << endl;   }   signed main() {     srand(time(NULL));     solve();   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 55;   int a[MAXN];   int nxt[6];   long long solve() {     int n;     scanf( %d , &n);     vector<int> ids[6];     for (int i = 0; i < n; i++) {       int x;       scanf( %d , &x);       if (x == 4) ids[0].push_back(i);       if (x == 8) ids[1].push_back(i);       if (x == 15) ids[2].push_back(i);       if (x == 16) ids[3].push_back(i);       if (x == 23) ids[4].push_back(i);       if (x == 42) ids[5].push_back(i);     }     for (int i = 0; i < 6; i++) nxt[i] = 0;     int res = 0;     for (int i : ids[0]) {       int lst = i;       nxt[0]++;       for (int j = 1; j < 6; j++) {         while (nxt[j] < ids[j].size() && ids[j][nxt[j]] < lst) {           nxt[j]++;           res++;         }         if (nxt[j] == ids[j].size()) {           for (int k = 0; k < 6; k++) {             res += ids[k].size() - nxt[k];           }           res += j;           return res;         }         lst = ids[j][nxt[j]];         nxt[j]++;       }     }     int len = ids[0].size();     return (n - res) - len * 6;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     int T;     T = 1;     while (T--) {       printf( %lld n , solve());     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e3 + 11, inf = 1e9 + 10;   char ch[4] = { D ,  I ,  M ,  A };   int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, -1, 1}, ans = -inf, tans[N][N], n, m;   char c[N][N];   bool mark[N][N], indfs[N][N];   bool isOkay(int x, int y) { return (x >= 0 && x < n && y >= 0 && y < m); }   void calcans(int i, int j, int X, int Y) {     tans[i][j] = max(tans[i][j], tans[X][Y]);   }   void dfs(int i, int j, int ind) {     indfs[i][j] = true;     mark[i][j] = true;     bool r = false;     for (int k = 0; k < 4; k++) {       int X = i + dx[k], Y = j + dy[k], t = (ind + 1) % 4;       if (!isOkay(X, Y) || c[X][Y] != ch[t]) continue;       r = true;       if (indfs[X][Y]) {         tans[i][j] = inf;         continue;       }       if (mark[X][Y]) {         calcans(i, j, X, Y);         continue;       }       dfs(X, Y, t);       calcans(i, j, X, Y);     }     if (!r && c[i][j] !=  A )       tans[i][j] = -inf;     else if (c[i][j] ==  A )       tans[i][j]++;     indfs[i][j] = false;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     cin >> n >> m;     for (int i = 0; i < n; i++)       for (int j = 0; j < m; j++) cin >> c[i][j];     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         if (c[i][j] !=  D  || mark[i][j]) continue;         dfs(i, j, 0);       }     }     for (int i = 0; i < n; i++)       for (int j = 0; j < m; j++) ans = max(ans, tans[i][j]);     if (ans <= 0)       cout <<  Poor Dima! ;     else if (ans >= inf)       cout <<  Poor Inna! ;     else       cout << ans;   }
#include <bits/stdc++.h>   using namespace std;   const int MOD = 1e9 + 7;   const int maxn = 611111;   long long num[maxn];   namespace SAM {   int trans[maxn][30], par[maxn], len[maxn], tot, last;   long long cnt[maxn][3];   inline int NewNode() {     memset(trans[tot], 0, sizeof(trans[tot]));     return tot++;   }   inline int NewNode(int u) {     memcpy(trans[tot], trans[u], sizeof(trans[u]));     par[tot] = par[u];     return tot++;   }   inline int h(int u) { return len[u] - len[par[u]]; }   void Extend(int w) {     int p = last, np = NewNode();     len[np] = len[p] + 1;     while (p && !trans[p][w]) {       trans[p][w] = np;       p = par[p];     }     if (!p && !trans[p][w]) {       trans[p][w] = np;       par[np] = 0;     } else {       int q = trans[p][w];       if (len[p] + 1 == len[q])         par[np] = q;       else {         int nq = NewNode(q);         len[nq] = len[p] + 1;         par[q] = par[np] = nq;         while (p && trans[p][w] == q) {           trans[p][w] = nq;           p = par[p];         }         if (!p && trans[p][w] == q) trans[p][w] = nq;       }     }     last = np;   }   bool vis[maxn];   void Dp(int u) {     if (vis[u]) return;     vis[u] = true;     for (int k = 0; k < 3; k++) {       if (trans[u][26 + k]) cnt[u][k] = 1;     }     for (int i = 0; i < 26; i++) {       int v = trans[u][i];       if (v) {         Dp(v);         for (int k = 0; k < 3; k++) {           cnt[u][k] = (cnt[u][k] + cnt[v][k]) % MOD;         }       }     }   }   void Gao() {     for (int i = 1; i < tot; i++) {       long long tmp = ((cnt[i][0] * cnt[i][1]) % MOD * cnt[i][2]) % MOD;       num[len[i]] = (num[len[i]] + tmp) % MOD;       num[len[par[i]]] = (num[len[par[i]]] - tmp + MOD) % MOD;     }     for (int i = tot - 2; i >= 1; i--) {       num[i] = (num[i] + num[i + 1]) % MOD;     }   }   void Init() {     memset(vis, 0, sizeof(vis));     memset(cnt, 0, sizeof(cnt));     tot = 0;     NewNode();   }   void Debug(int tp = 0) {     if (tp == 0)       for (int i = 0; i < tot; i++) {         printf( i=%d,par=%d,len=%d n , i, par[i], len[i]);         for (int j = 0; j < 30; j++) {           if (trans[i][j]) {             printf( to %d %c n , trans[i][j], (char)(j +  a ));           }         }       }     if (tp == 1)       for (int i = 0; i < tot; i++) {         printf( i=%d %I64d %I64d %I64d n , i, cnt[i][0], cnt[i][1], cnt[i][2]);       }   }   }  // namespace SAM   const int INF = 0x3f3f3f3f;   char s[maxn];   int main() {     SAM::Init();     int n = INF;     scanf( %s , s);     n = min(n, (int)strlen(s));     for (int i = 0; s[i]; i++) SAM::Extend(s[i] -  a );     SAM::Extend(26);     scanf( %s , s);     n = min(n, (int)strlen(s));     for (int i = 0; s[i]; i++) SAM::Extend(s[i] -  a );     SAM::Extend(27);     scanf( %s , s);     n = min(n, (int)strlen(s));     for (int i = 0; s[i]; i++) SAM::Extend(s[i] -  a );     SAM::Extend(28);     SAM::Dp(0);     SAM::Gao();     for (int i = 1; i <= n; i++) {       if (i > 1) printf(   );       printf( %I64d , num[i]);     }     puts(  );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int x, y, z;     int x1, y1, z1;     cin >> x >> y >> z;     cin >> x1 >> y1 >> z1;     int a[6];     int ans(0);     for (int i(0); i < 6; ++i) cin >> a[i];     if (z > z1) ans += a[3];     if (z < 0) ans += a[2];     if (x < 0) ans += a[4];     if (x > x1) ans += a[5];     if (y > y1) ans += a[1];     if (y < 0) ans += a[0];     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main(int argc, char** argv) {     string str;     cin >> str;     char g = str[0];     long count = 0, d = 1;     for (string::iterator i = str.begin() + 1; i < str.end(); ++i) {       if (*i != g) {         count++;         g = *i;         d = 1;       } else if (d == 5) {         count++;         d = 1;       } else {         d++;       }     }     cout << ++count;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long int a, b, c = 0;     cin >> a;     b = 1;     while (c < a) {       c = (b * (b + 1)) / 2;       b++;     }     b--;     if (c == a)       cout << b << endl;     else {       cout << b - c + a << endl;     }   }
#include <bits/stdc++.h>   const double EPS = 1e-9;   const int INT_INF = 1 << 31 - 1;   const long long I64_INF = 1ll << 63 - 1ll;   const double PI = acos(-1.0);   using namespace std;   long long solve(int len) {     if (len == 1 || len == 2) return 9LL;     long long pow = 1LL;     for (int i = 0; i < len - 2; i++) pow *= 10LL;     return 9LL * pow;   }   long long go(long long r) {     if (r <= 0) return 0;     int len = 0;     long long R = r;     long long c[20];     while (R) c[len] = R % 10LL, len++, R /= 10LL;     long long res = 0;     for (int i = 1; i < len; i++) res += solve(i);     for (int i = 0; i < (int)len / 2; i++) swap(c[i], c[len - i - 1]);     long long pow = 1LL;     for (int i = 0; i < len - 2; i++) pow *= 10LL;     res += (c[0] - 1LL) * pow;     long long mid = 0;     for (int i = 1; i <= len - 2; i++) mid = mid * 10LL + 1LL * c[i];     if (c[0] <= c[len - 1])       res += mid + 1LL;     else       res += mid;     return res;   };   bool ok(int a) {     int last = a % 10;     int first;     while (a) first = a % 10, a /= 10;     return first == last;   }   long long l, r;   int main() {     cin >> l >> r;     cout << go(r) - go(l - 1) <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MxN = (int)2e5 + 9;   const int mod = 998244353;   long long fact[MxN + 9];   vector<int> adj[MxN + 9];   long long f(const int u, const int parent) {     long long res = fact[(int)adj[u].size()];     for (int v : adj[u])       if (v != parent) {         res *= f(v, u);         res %= mod;       }     return res;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(nullptr), cout.tie(nullptr);     fact[0] = 1;     for (int i = 1; i <= MxN; ++i) {       fact[i] = fact[i - 1] * i % mod;     }     int n;     cin >> n;     for (int i = 1; i < n; ++i) {       int u, v;       cin >> u >> v;       adj[u].push_back(v);       adj[v].push_back(u);     }     long long ans = n * fact[adj[1].size()] % mod;     for (int x : adj[1]) {       ans *= f(x, 1);       ans %= mod;     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, x1, x2, x3, x4;   int main() {     cin >> n;     cout <<  YES  << endl;     for (int i = 0; i < n; i++) {       cin >> x1 >> x2 >> x3 >> x4;       x1 = abs(x1) % 2;       x2 = abs(x2) % 2;       cout << x1 * 2 + x2 + 1 << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   long long int mod = 1000000009;   long long int power(int x, int y) {     if (y == 0) return 1;     long long int temp = power(x, y / 2);     temp *= temp;     temp %= mod;     if (y & 1) temp *= x;     return temp % mod;   }   long long int ans[100005];   int main() {     int m, n;     cin >> n >> m;     ans[1] = power(2, m) - 1;     for (int i = 2; i <= n; i++) {       ans[i] = ans[i - 1] * (ans[1] - i + 1);       ans[i] %= mod;     }     ans[n] += mod;     ans[n] %= mod;     cout << ans[n] << endl;   }
#include <bits/stdc++.h>   using namespace std;   char s[302][302];   int main() {     ios_base::sync_with_stdio(0);     cin.tie(nullptr);     int n, p;     cin >> n >> p;     int a[n];     for (int i = 0; i < n; i++) {       cin >> a[i];     }     sort(a, a + n);     vector<int> ans;     for (int i = 1; i < 2003; i++) {       int cnt = 1, x = i;       for (int j = 0; cnt > 0 && j < n; j++) {         int y = upper_bound(a, a + n, x) - a;         cnt *= (y - j);         cnt %= p;         x++;       }       if (cnt > 0) ans.push_back(i);     }     cout << ans.size() <<   n ;     for (int i = 0; i < (int)ans.size(); i++) {       cout << (i == 0 ?    :    ) << ans[i];     }     cout <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     long long n;     cin >> t;     while (t--) {       set<long long> a;       a.insert(0);       cin >> n;       for (int i = 1; i <= sqrt(n); i++) {         a.insert(i);         a.insert(n / i);       }       cout << a.size() << endl;       for (auto i : a) cout << i <<    ;       cout << endl;     }   }
#include <bits/stdc++.h>   #pragma comment(linker,  /STACK:66777216 )   using namespace std;   int inf = 1e9 + 7;   long long INF = 1e18;   int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }   int main() {     ios_base::sync_with_stdio(false);     int k;     cin >> k;     vector<long long> a;     map<long long, pair<int, int> > sums;     for (int i = 0; i < k; i++) {       int n;       long long sum = 0;       cin >> n;       a.resize(n);       for (int j = 0; j < n; j++) {         cin >> a[j];         sum += a[j];       }       for (int j = 0; j < n; j++) {         if (sums[sum - a[j]] != make_pair(0, 0) &&             sums[sum - a[j]].first != i + 1) {           cout <<  YES  <<   n ;           cout << sums[sum - a[j]].first <<     << sums[sum - a[j]].second                <<   n ;           cout << i + 1 <<     << j + 1;           return 0;         }         sums[sum - a[j]] = make_pair(i + 1, j + 1);       }     }     cout <<  NO ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MOD = 1e9 + 7;   const int N = 1e7 + 5;   const long long INF = 9e18;   const int M = 1e5 + 5;   map<long long, vector<int> > f;   long long p[N], ans1[M], a[M];   void solve() {     for (int i = 2; i <= N; ++i) {       if (i % 2 == 0) {         p[i] = 2;         continue;       }       if (p[i]) continue;       p[i] = i;       for (int j = i * 2; j <= N; j += i) {         if (!p[j]) p[j] = i;       }     }     int n, m;     cin >> n >> m;     for (int i = 1; i <= n; ++i) {       long long x;       cin >> x;       a[i] = x;       while (x > 1) {         long long y = p[x];         while (x > 1 && x % y == 0) {           f[y].push_back(i);           x /= y;         }       }     }     for (int i = 1; i <= m; ++i) {       ans1[i] = 1;       long long x;       cin >> x;       while (x > 1) {         long long y = p[x];         while (x > 1 && x % y == 0) {           if ((int)f[y].size()) {             a[f[y].back()] /= y;             f[y].pop_back();           } else             ans1[i] *= y;           x /= y;         }       }     }     cout << n <<     << m <<   n ;     for (int i = 1; i <= n; ++i) {       cout << a[i] <<    ;     }     cout <<   n ;     for (int i = 1; i <= m; ++i) {       cout << ans1[i] <<    ;     }   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     int t = 1;     while (t--) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int T;     cin >> T;     while (T--) {       long long n, k;       cin >> n >> k;       if (k % 3 != 0) {         if (n % 3 == 0)           cout <<  Bob  << endl;         else           cout <<  Alice  << endl;       } else {         n %= (k + 1);         if (n == k || n % 3)           cout <<  Alice  << endl;         else           cout <<  Bob  << endl;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   string tostr(int n) {     stringstream rr;     rr << n;     return rr.str();   }   int sc() {     register int c = getchar();     register int x = 0;     int neg = 0;     for (; ((c < 48 || c > 57) && c !=  - ); c = getchar())       ;     if (c ==  - ) {       neg = 1;       c = getchar();     }     for (; c > 47 && c < 58; c = getchar()) {       x = (x << 1) + (x << 3) + c - 48;     }     if (neg) x = -x;     return x;   }   inline void out(int n) {     int N = n < 0 ? -n : n, rev, cnt = 0;     rev = N;     if (N == 0) {       putchar( 0 );       putchar(  n );       return;     }     while ((rev % 10) == 0) {       cnt++;       rev /= 10;     }     if (n < 0) putchar( - );     rev = 0;     while (N != 0) {       rev = (rev << 3) + (rev << 1) + N % 10;       N /= 10;     }     while (rev != 0) {       putchar(rev % 10 +  0 );       rev /= 10;     }     while (cnt--) putchar( 0 );     putchar(  n );     return;   }   void deb(istream_iterator<string> it) {}   template <typename T, typename... Args>   void deb(istream_iterator<string> it, T a, Args... args) {     cerr << *it <<   =   << a << endl;     deb(++it, args...);   }   const int mod = 1e9 + 7;   const int N = 3e5 + 9;   const long double eps = 1e-9;   const long double PI = acos(-1.0);   long long gc(long long a, long long b) {     while (b) {       long long x = a % b;       a = b;       b = x;     }     return a;   }   long long lc(long long a, long long b) { return a / gc(a, b) * b; }   long long qpow(long long n, long long k) {     long long ans = 1;     assert(k >= 0);     n %= mod;     while (k > 0) {       if (k & 1) ans = (ans * n) % mod;       n = (n * n) % mod;       k >>= 1;     }     return ans % mod;   }   vector<long long> v;   void solve() {     long long n;     cin >> n;     long long id = (upper_bound(v.begin(), v.end(), n) - v.begin());     cout << id << endl;   }   int main() {     int t;     cin >> t;     long long ct = 0;     long long add = 1;     long long prv = 0;     for (long long i = 1;; i++) {       ct += add;       add *= 2;       long long x = (ct * (ct + 1) / 2);       x += prv;       prv = x;       if (x > 1000000000000000000LL) break;       v.push_back(x);     }     while (t--) solve();     return 0;   }
#include <bits/stdc++.h>   struct circle {     double x, y, r;   };   double dis(circle a, circle b) {     return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));   }   bool canGo(circle tar, circle small, circle big) {     if (small.r >= tar.r + dis(tar, small)) return true;     if (big.r + tar.r <= dis(tar, big)) return true;     if (tar.r >= big.r + dis(tar, big)) return true;     return false;   }   int main() {     circle ain, aout, bin, bout;     int ret;     double x, y, r, R;     while (scanf( %lf%lf%lf%lf , &x, &y, &r, &R) != EOF) {       ain.x = aout.x = x;       ain.y = aout.y = y;       ain.r = r;       aout.r = R;       scanf( %lf%lf%lf%lf , &x, &y, &r, &R);       bin.x = bout.x = x;       bin.y = bout.y = y;       bin.r = r;       bout.r = R;       ret = 0;       if (canGo(ain, bin, bout)) ret++;       if (canGo(aout, bin, bout)) ret++;       if (canGo(bin, ain, aout)) ret++;       if (canGo(bout, ain, aout)) ret++;       printf( %d n , ret);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n;   int m;   void bfs(int u, vector<pair<int, int>> &p,            vector<vector<pair<int, int>>> &adj) {     queue<int> q;     q.push(u);     while (!q.empty()) {       int cur = q.front();       q.pop();       for (auto as : adj[cur]) {         int v = as.first;         if (v == p[cur].first) continue;         int e = as.second;         p[v].first = cur;         p[v].second = e;         q.push(v);       }     }   }   int main() {     scanf( %d , &n);     vector<vector<pair<int, int>>> adj(n + 1);     for (int i = 1; i <= n - 1; ++i) {       int u, v;       scanf( %d %d , &u, &v);       adj[u].push_back(make_pair(v, i));       adj[v].push_back(make_pair(u, i));     }     vector<vector<pair<int, int>>> pre(n + 1, vector<pair<int, int>>(n + 1));     for (int i = 1; i <= n; ++i) {       pre[i][i] = make_pair(0, 0);       bfs(i, pre[i], adj);     }     scanf( %d , &m);     vector<int> val(n, 0);     vector<vector<int>> query(m + 1, vector<int>(3, 0));     for (int i = 1; i <= m; ++i) {       scanf( %d %d %d , &query[i][0], &query[i][1], &query[i][2]);     }     for (int i = 1; i <= m; ++i) {       int u = query[i][0];       int v = query[i][1];       int f = query[i][2];       while (true) {         int pree = pre[u][v].second;         int prev = pre[u][v].first;         val[pree] = max(val[pree], f);         v = prev;         if (v == u) break;       }     }     for (int i = 1; i <= m; ++i) {       int u = query[i][0];       int v = query[i][1];       int f = query[i][2];       int mx = 1000000 + 10;       while (true) {         int pree = pre[u][v].second;         int prev = pre[u][v].first;         mx = min(mx, val[pree]);         v = prev;         if (v == u) break;       }       if (mx != f) {         printf( -1 );         return 0;       }     }     for (int i = 1; i <= n - 1; ++i) {       if (val[i] == 0)         printf( 100  );       else         printf( %d  , val[i]);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long INF = 2e18 + 33;   const int MX = 2 * 1e5 + 11;   long long N, M, k, s, d;   int arr[MX];   vector<pair<int, int> > v;   int main() {     cin >> N >> M >> s >> d;     for (int i = 0; i < N; i++) scanf( %d , &arr[i]);     arr[N] = M + 1;     sort(arr, arr + N + 1);     long long pos = arr[0] - 1;     if (pos < s) {       cout <<  IMPOSSIBLE n ;       return 0;     }     v.push_back(make_pair(pos, 0));     for (int i = 0; i < N; i++) {       if (i < N - 1 && arr[i + 1] - arr[i] - 2 < s) continue;       if (arr[i] - pos + 1 <= d) {         v.push_back(make_pair(arr[i] - pos + 1, 1));         v.push_back(make_pair(arr[i + 1] - arr[i] - 2, 0));         pos = arr[i + 1] - 1;       }     }     if (pos < M)       cout <<  IMPOSSIBLE n ;     else       for (int i = 0; pos >= M && i < v.size(); i++) {         if (v[i].first == 0) continue;         if (v[i].second == 1)           cout <<  JUMP  ;         else           cout <<  RUN  ;         cout << v[i].first <<   n ;       }     return 0;   }