malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const int INF = 0x3f3f3f3f;   const double eps = 1E-8;   const int FFTSZ = 1 << 20;   const double pi = acos(-1.);   struct cp {     double real, img;     cp(double _r = 0.0, double _i = 0.0) : real(_r), img(_i) {}     cp operator+(const cp &c) const { return cp(real + c.real, img + c.img); }     cp operator-(const cp &c) const { return cp(real - c.real, img - c.img); }     cp operator*(const cp &c) const {       return cp(real * c.real - img * c.img, real * c.img + img * c.real);     }   };   void fft(cp x[], int n, int op) {     for (int i = 1, j = 0; i < n; i++) {       for (int l = n >> 1; (j ^= l) < l; l >>= 1)         ;       if (i < j) swap(x[i], x[j]);     }     for (int h = 2; h <= n; h <<= 1) {       cp wn(cos(-op * 2 * pi / h), sin(-op * 2 * pi / h));       for (int j = 0; j < n; j += h) {         cp w(1, 0);         for (int k = j; k < j + h / 2; k++) {           cp u = x[k], v = w * x[k + h / 2];           x[k] = u + v, x[k + h / 2] = u - v;           w = w * wn;         }       }     }     if (op == -1)       for (int i = 0; i < n; i++) x[i].real /= n, x[i].img /= n;   }   cp x[FFTSZ], y[FFTSZ];   int convolution(int a[], int lena, int b[], int lenb, int c[]) {     int len = 1;     while (len < lena + lenb - 1) len <<= 1;     for (int i = 0; i < len; i++) {       if (i < lena)         x[i] = cp(a[i] * 1.0, 0.0);       else         x[i] = cp(0.0, 0.0);     }     for (int i = 0; i < len; i++) {       if (i < lenb)         y[i] = cp(b[i] * 1.0, 0.0);       else         y[i] = cp(0.0, 0.0);     }     fft(x, len, 1), fft(y, len, 1);     for (int i = 0; i < len; i++) x[i] = x[i] * y[i];     fft(x, len, -1);     c[len] = 0;     for (int i = 0; i < len; i++) c[i] = int(x[i].real + 0.5);     return lena + lenb - 1;   }   const int N = (1 << 20) + 1;   int a[N], p[N];   int n, k;   int main() {     while (~scanf( %d%d , &n, &k)) {       (memset(a, 0, sizeof(a))), (memset(p, 0, sizeof(p)));       a[0] = 1;       int mx = 0;       for (int i = 1; i <= n; i++) {         int v;         scanf( %d , &v);         p[v] = 1;         mx = max(mx, v);       }       mx++;       while (k) {         if (k & 1) convolution(a, mx, p, mx, a);         mx = convolution(p, mx, p, mx, p);         k >>= 1;         for (int i = 0; i < mx; i++) {           a[i] = !!a[i];           p[i] = !!p[i];         }       }       for (int i = 0; i < mx; i++)         if (a[i] != 0) printf( %d  , i);       puts(  );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long int powOfPositive(long long int n) {     long long int pos = floor(log2(n));     return pos;   }   int main() {     long long int t;     cin >> t;     while (t--) {       long long int n;       cin >> n;       vector<long long int> arr(n);       for (long long int i = 0; i < n; i++) {         cin >> arr[i];       }       vector<long long int> dp(30, 0);       long long int ans = 0;       for (long long int i = 0; i < n; i++) {         if (arr[i] == 1) {           dp[0]++;           continue;         }         long long int x = powOfPositive(arr[i]);         dp[x]++;       }       for (long long int i = 0; i < 30; i++) {         if (dp[i] > 0) {           ans += ((dp[i]) * (dp[i] - 1)) / 2;         }       }       cout << ans << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   namespace zyt {   const int N = 1e6 + 10, CH = 20;   int f[1 << CH], n;   char s[N];   bool check(const int a, const int p) { return a & (1 << p); }   int ctoi(const char c) { return c -  a ; }   void get_max(int &a, const int b) { a = max(a, b); }   int work() {     scanf( %s , s);     n = strlen(s);     for (int i = 0; i < n; i++) {       int tmp = 0;       for (int j = i; j < n; j++)         if (check(tmp, ctoi(s[j])))           break;         else           get_max(f[tmp |= (1 << ctoi(s[j]))], j - i + 1);     }     for (int i = 0; i < (1 << CH); i++)       for (int j = 0; j < CH; j++)         if (check(i, j)) get_max(f[i], f[i ^ (1 << j)]);     int ans = 0;     for (int i = 1; i < (1 << CH); i++)       get_max(ans, f[i] + f[~i & ((1 << CH) - 1)]);     printf( %d , ans);     return 0;   }   }  // namespace zyt   int main() { return zyt::work(); }
#include <bits/stdc++.h>   using namespace std;   const int nax = 2 * (int)1e5 + 10;   const int INF = (int)1e9 + 47;   vector<int> g[nax];   int n, k;   int lvl[nax], tin[nax], tout[nax];   int cnt = 0;   int timer = 0;   int ver[nax];   int seen[nax];   int par[nax];   int vr[nax];   vector<pair<int, int>> vec;   void dfs(int v, int p = -1) {     if (p != -1) lvl[v] = lvl[p] + 1;     vec.push_back({lvl[v], v});     par[v] = p;     if (g[v].size() == 1 && p != -1) cnt++;     if (p != -1) lvl[v] = lvl[p] + 1;     for (auto to : g[v]) {       if (to == p) continue;       dfs(to, v);     }   }   long long f(int red, int blue) {     int w = n - red - blue;     return w * 1ll * (red - blue);   }   int main() {     ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);     cin >> n >> k;     for (int i = 0; i < n - 1; i++) {       int a, b;       cin >> a >> b;       --a, --b;       g[a].push_back(b);       g[b].push_back(a);     }     dfs(0);     sort(vec.begin(), vec.end(), greater<pair<int, int>>());     vector<int> vv;     for (int i = 0; i < n; i++) {       int cur = vec[i].second;       int cc = 0;       while (cur != -1 && !seen[cur]) {         cc++;         seen[cur] = 1;         cur = par[cur];       }       vv.push_back(cc);     }     sort(vv.begin(), vv.end(), greater<int>());     int blue = n;     long long best_ans = -(long long)1e18;     for (int i = 0; i < min(k, cnt); i++) {       blue -= vv[i];       int l = 0, r = blue;       for (int it = 0; it < 40; it++) {         int mid = (l + r) / 2;         if (f(i + 1, mid + 1) <= f(i + 1, mid))           l = mid;         else           r = mid;       }       if ((f(i + 1, r) > f(i + 1, r + 1) && r + 1 < blue) ||           (f(i + 1, r - 1) < f(i + 1, r) && r - 1 >= 0))         throw 47;       best_ans = max(best_ans, f(i + 1, r));     }     while (cnt <= k) {       best_ans = max(best_ans, (n - cnt) * 1ll * cnt);       cnt++;     }     cout << best_ans <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int T;     cin >> T;     while (T--) {       int n;       cin >> n;       vector<long long> v;       for (int i = 1; i <= n; i++) {         int x;         cin >> x;         v.push_back(x);       }       sort(v.begin(), v.end());       long long ans = v[0] * v[v.size() - 1];       int sum = 0, flag = 1;       for (long long i = 2; i * i <= ans; i++) {         if (ans % i == 0) {           if (find(v.begin(), v.end(), i) == v.end() ||               find(v.begin(), v.end(), ans / i) == v.end()) {             flag = 0;             break;           }           sum += 2;           if (i * i == ans) sum--;         }       }       if (sum == n && flag == 1)         cout << ans << endl;       else         cout << -1 << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 1e3 + 10;   const int INF = 99999999;   const double eps = 1e-4;   int dp[MAXN];   int main() {     int n, m, c0, d0;     cin >> n >> m >> c0 >> d0;     memset(dp, 0, sizeof(dp));     for (int i = c0; i <= n; i++) dp[i] = i / c0 * d0;     for (int i = 1; i <= m; i++) {       int a, b, c, d;       cin >> a >> b >> c >> d;       for (int j = 1; j <= a / b; j++) {         for (int k = n; k >= c; k--) dp[k] = max(dp[k - c] + d, dp[k]);       }     }     cout << dp[n] << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long nod(long long a, long long b) {     while (a != 0 && b != 0) {       if (a > b)         a %= b;       else         b %= a;     }     return a + b;   }   int main() {     long long n, a[100];     cin >> n;     for (int i = 0; i < n; i++) cin >> a[i];     sort(a, a + n);     long long p = nod(a[0], a[1]);     for (int i = 1; i < n; i++) p = nod(p, a[i]);     long long max = a[n - 1], s;     s = ((max - p) / p) + 1;     if ((s - n) % 2 == 0)       cout <<  Bob ;     else       cout <<  Alice ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 2e5 + 5;   const long long M = (long long)1e9 + 7;   int Int() {     int x;     scanf( %d , &x);     return x;   }   long long Long() {     long long x;     scanf( %lld , &x);     return x;   }   void Char(char *ch) { scanf( %s , ch); }   template <typename t>   inline t abs(t a) {     if (a >= 0) return a;     return -a;   }   template <typename T>   inline T modpow(T b, T p, T Mod) {     T res = 1;     while (p) {       if (p & 1) {         res *= b;         res %= Mod;       }       b *= b;       b %= Mod;       p >>= 1;     }     return res;   }   template <typename T>   inline T ModInv(T b, T Mod) {     return modpow(b, Mod - 2, Mod);   }   long long pwr(long long b, long long p) {     long long res = 1LL;     while (p) {       if (p & 1) {         res *= b;       }       b *= b;       p >>= 1LL;     }     return res;   }   template <typename T>   inline T gcd(T a, T b) {     if (b == 0) return a;     return gcd(b, a % b);   }   template <typename T>   inline void Int(T &n) {     n = 0;     int f = 1;     register int ch = getchar();     for (; !isdigit(ch); ch = getchar())       if (ch ==  - ) f = -1;     for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch -  0 ;     n = n * f;   }   template <typename T, typename U>   inline void Int(T &a, U &b) {     Int(a);     Int(b);   }   template <typename T, typename U, typename W>   inline void Int(T &a, U &b, W &c) {     Int(a, b);     Int(c);   }   template <typename T, typename U, typename W, typename X>   inline void Int(T &a, U &b, W &c, X &d) {     Int(a, b, c);     Int(d);   }   vector<int> Unique(vector<int> v) {     sort(v.begin(), v.end());     v.erase(unique(v.begin(), v.end()), v.end());     return v;   }   vector<string> split(const string &s, char c) {     vector<string> v;     stringstream ss(s);     string x;     while (getline(ss, x, c)) v.emplace_back(x);     return move(v);   }   void err(vector<string>::iterator it) {}   template <typename T, typename... Args>   void err(vector<string>::iterator it, T a, Args... args) {     cout << it->substr((*it)[0] ==    , it->length()) <<   =   << a <<    ;     err(++it, args...);   }   int digit(long long n) {     int s = 0;     while (n) {       n /= 10;       s++;     }     return s;   }   long long F(long long n) {     int len = digit(n);     if (len <= 1) return n;     long long res = 0, add = 9;     for (int i = 1; i < len; i++) {       if (i == 1) {         res += 9;       } else {         res += add;         add *= 10;       }     }     long long k = pwr(10, len - 1);     long long x = n / k;     long long y = n % 10LL;     long long p = (n % k) / 10LL;     if (y >= x) {       res += (p + 1) + ((x - 1) * (k / 10LL));     } else {       res += p + ((x - 1) * (k / 10LL));     }     return res;   }   int main() {     long long a = Long(), b = Long();     printf( %lld n , F(b) - F(a - 1));     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m;     std::cin >> n >> m;     getchar();     int a[n][m], nums[m];     for (int i = 0; i < m; i++) {       nums[i] = 0;     }     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         a[i][j] = getchar() -  0 ;         nums[j] += a[i][j];       }       getchar();     }     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         if (a[i][j]) {           if (nums[j] == 1) goto A;         }       }       std::cout <<  YES ;       return 0;     A:;     }     printf( NO );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     double n, l, v1, v2, k;     cin >> n >> l >> v1 >> v2 >> k;     double m = ceil(n / k);     double ans =         l * v2 / (v1 * v2 - v2 * (v1 * v1 - v2 * v2) / (v1 + (2 * m - 1) * v2));     cout << fixed << setprecision(10) << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int ar[5000009];   long long j;   int finder(vector<pair<long long, long long> > v, long long jump) {     for (int i = 0; i < v.size(); i++) {       if (v[i].first > jump) {         return i;       }     }     return v.size();   }   long long count = 0;   vector<pair<long long, long long> > v[4];   void dfs1(long long b, long long p, long long jump) {     if (v[b].size() == 0) {       ::count = max(::count, p);       return;     } else {       long long low = finder(v[b], jump);       if (v[b][0].first > jump) {         ::count = max(::count, p);         return;       } else {         low--;         long long u = 0, maxi = v[b][0].second;         for (int k = 1; k <= low; k++) {           if (maxi < v[b][k].second) {             maxi = v[b][k].second;             u = k;           }         }         jump += v[b][u].second;         v[b].erase(v[b].begin() + u);         dfs1((b == 1) ? 0 : ((b == 0) ? 1 : ((b == 2) ? 3 : 2)), p + 1, jump);       }     }   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(NULL);     cout.tie(NULL);     long long n, jump, a, s, d;     cin >> n >> jump;     for (int i = 0; i < n; ++i) {       cin >> a >> s >> d;       if (a == 0) {         v[0].push_back(make_pair(s, d));         v[2].push_back(make_pair(s, d));       } else {         v[3].push_back(make_pair(s, d));         v[1].push_back(make_pair(s, d));       }     }     sort(v[0].begin(), v[0].end());     sort(v[1].begin(), v[1].end());     sort(v[2].begin(), v[2].end());     sort(v[3].begin(), v[3].end());     dfs1(0, 0, jump);     dfs1(3, 0, jump);     cout << ::count;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 10;   int f[1 << 6], ff[1 << 6], g[1 << 6], gg[1 << 6];   int b[N];   char s[N], w[100];   int n, m;   bool check() {     for (int i = 1; i < (1 << 6); i++) gg[i] = gg[i - (i & -i)] + g[i & -i];     for (int i = 1; i < (1 << 6) - 1; i++)       if (gg[i] > f[i] || ff[i] > gg[i]) return 0;     return 1;   }   int main() {     scanf( %s , s + 1);     n = strlen(s + 1);     for (int i = 1; i <= n; i++) g[1 << (s[i] -  a )]++;     scanf( %d , &m);     for (int i = 1; i <= m; i++) {       int x, y, z = 0;       scanf( %d %s , &x, w);       y = strlen(w);       for (int j = 0; j < y; j++) z |= (1 << (w[j] -  a ));       for (int j = 0; j < (1 << 6); j++) {         if (j & z) f[j]++;         if ((j & z) == z) ff[j]++;       }       b[x] = z;     }     for (int i = 1; i <= n; i++)       if (!b[i]) {         ff[b[i] = (1 << 6) - 1]++;         for (int j = 0; j < (1 << 6); j++) f[j]++;       }     if (!check()) {       printf( Impossible n );       return 0;     }     for (int i = 1; i <= n; i++) {       for (int j = 0; j < (1 << 6); j++) {         if (j & b[i]) f[j]--;         if ((j & b[i]) == b[i]) ff[j]--;       }       for (int j = 0; j < 6; j++)         if (g[1 << j] && ((b[i] >> j) & 1)) {           g[1 << j]--;           if (check()) {             printf( %c , j +  a );             break;           }           g[1 << j]++;         }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long int power(long long int x, long long int y) {     long long int res = 1;     x = x;     while (y > 0) {       if (y & 1) res = (res * x);       y = y >> 1;       x = (x * x);     }     return res;   }   long long int logtwo(long long int n) {     if (n == 1) return 0;     return logtwo(n / 2) + 1;   }   vector<long long int> adj[105][105];   long long int vis[105][105];   void dfs(int par, long long int col) {     for (auto child : adj[par][col]) {       if (vis[child][col]) continue;       vis[child][col] = vis[par][col];       dfs(child, col);     }   }   signed main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int t = 1;     while (t--) {       long long int N, M;       cin >> N >> M;       for (long long int i = 0; i < M; i++) {         long long int a, b, c;         cin >> a >> b >> c;         a--;         b--;         adj[a][c].push_back(b);         adj[b][c].push_back(a);       }       for (long long int i = 0; i < 105; i++) {         long long int c = 1;         for (long long int j = 0; j < N; j++) {           if (vis[j][i]) continue;           vis[j][i] = c++;           dfs(j, i);         }       }       long long int Q;       cin >> Q;       while (Q--) {         long long int x, y;         cin >> x >> y;         long long int ans = 0;         x--;         y--;         for (long long int i = 0; i < 105; i++) {           if (vis[x][i] && vis[x][i] == vis[y][i]) ans++;         }         cout << ans <<   n ;       }     }     cerr <<  Time :   << 1000 * (long double)clock() / (long double)CLOCKS_PER_SEC          <<  ms n ;     ;   }
#include <bits/stdc++.h>   using namespace std;   int st[200011], disc = 0, mod, en[200011];   vector<int> adj[200011];   bitset<1003> m[1000011];   int flag[1000011], a[200011];   int p[2011], arr[200011];   vector<int> pr;   bitset<1003> def;   void dfs(int u, int p) {     st[u] = disc;     arr[disc] = u;     disc++;     for (int i = 0; i < adj[u].size(); i++) {       int k = adj[u][i];       if (k == p) continue;       dfs(k, u);     }     en[u] = disc - 1;   }   void rotate(std::bitset<1003>& b, unsigned m) {     b = (((b << m) & def) | (b >> (mod - m)));   }   void build(int n, int b, int e) {     if (b == e) {       m[n].set(a[arr[b]]);       return;     }     int l = 2 * n, mid = (b + e) / 2;     build(l, b, mid);     build(l + 1, mid + 1, e);     m[n] = m[l] | m[l + 1];   }   void update(int n, int b, int e, int x, int y, int v) {     if (flag[n] != 0) {       rotate(m[n], flag[n]);       if (b != e) {         flag[2 * n] = (flag[2 * n] + flag[n]) % mod;         flag[2 * n + 1] = (flag[2 * n + 1] + flag[n]) % mod;       }       flag[n] = 0;     }     if (b > y || e < x) return;     if (b >= x && e <= y) {       rotate(m[n], v);       if (b != e) {         flag[2 * n] = (flag[2 * n] + v) % mod;         flag[2 * n + 1] = (flag[2 * n + 1] + v) % mod;       }       return;     }     int l = 2 * n, mid = (b + e) / 2;     update(l, b, mid, x, y, v);     update(l + 1, mid + 1, e, x, y, v);     m[n] = m[l] | m[l + 1];   }   bitset<1003> query(int n, int b, int e, int x, int y) {     if (flag[n] != 0) {       rotate(m[n], flag[n]);       if (b != e) {         flag[2 * n] = (flag[2 * n] + flag[n]) % mod;         flag[2 * n + 1] = (flag[2 * n + 1] + flag[n]) % mod;       }       flag[n] = 0;     }     if (b > y || e < x) return 0;     if (b >= x && e <= y) return m[n];     int l = 2 * n, mid = (b + e) / 2;     return (query(l, b, mid, x, y) | query(l + 1, mid + 1, e, x, y));   }   int main() {     int n, i, j, k;     scanf( %d %d , &n, &mod);     for (i = 2; i < mod; i++)       if (p[i] == 0) {         pr.push_back(i);         for (j = i + i; j < mod; j += i) p[j] = 1;       }     for (i = 1; i <= n; i++) scanf( %d , &a[i]), a[i] %= mod;     for (i = 0; i < n - 1; i++) {       int u, v;       scanf( %d %d , &u, &v);       adj[u].push_back(v);       adj[v].push_back(u);     }     dfs(1, 0);     build(1, 0, n - 1);     int q;     scanf( %d , &q);     for (i = 0; i < mod; i++) def.set(i);     while (q--) {       int t;       scanf( %d , &t);       if (t == 1) {         int x, v;         scanf( %d %d , &v, &x);         x %= mod;         update(1, 0, n - 1, st[v], en[v], x);       } else {         int v, ans = 0;         scanf( %d , &v);         bitset<1003> b = query(1, 0, n - 1, st[v], en[v]);         for (int i = 0; i < pr.size(); i++)           if (b.test(pr[i])) ans++;         printf( %d n , ans);       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int z, n, m;     while (cin >> n >> m) {       if (m > n)         z = -1;       else {         if (n % 2 == 0)           z = n / 2;         else           z = (n / 2) + 1;         while (z % m != 0) {           z++;         }       }       cout << z;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int gcd(int p, int q) { return q == 0 ? p : gcd(q, p % q); }   char s[100100];   long long res[2][2];   int main() {     cin >> s;     int len = strlen(s);     memset(res, 0, sizeof(res));     long long a = 0, b = 0;     for (int i = 0; i < len; i++) {       int temp = i & 1;       res[s[i] -  a ][temp]++;       a += res[s[i] -  a ][1 - temp];       b += res[s[i] -  a ][temp];     }     cout << a <<     << b << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long int n, m;     cin >> n >> m;     long long int a[m];     for (int i = 0; i < m; i++) {       cin >> a[i];     }     sort(a, a + m);     int i = 0;     while (i < m - 2) {       if (a[i] + 1 == a[i + 1] && a[i + 1] + 1 == a[i + 2]) {         cout <<  NO n ;         return 0;       }       i++;     }     if (a[0] == 1 || a[m - 1] == n) {       cout <<  NO n ;       return 0;     }     cout <<  YES n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long double lim = 1e99;   template <typename T>   inline T read() {     register T sum = 0;     register char cc = getchar();     int sym = 1;     while (cc !=  -  && (cc >  9  || cc <  0 )) cc = getchar();     if (cc ==  - ) sym = -1, cc = getchar();     sum = sum * 10 + cc -  0 ;     cc = getchar();     while (cc >=  0  && cc <=  9 ) sum = sum * 10 + cc -  0 , cc = getchar();     return sym * sum;   }   template <typename T>   inline T read(T& a) {     a = read<T>();     return a;   }   template <typename T, typename... Others>   inline void read(T& a, Others&... b) {     a = read(a);     read(b...);   }   int n, m, K;   long double ans, fac[100010];   long double C(int n, int m) { return fac[n] - fac[m] - fac[n - m]; }   int main() {     read(n, m, K);     for (int i = 1; i <= m; i++) fac[i] = fac[i - 1] + log(1. * i);     for (int i = 0; i <= n; i++)       for (int j = 0; j <= n; j++) {         int num = (i + j) * n - i * j;         if (num <= K) {           long double p = C(n, i) + C(n, j) + C(m - num, K - num) - C(m, K);           ans = min(ans + exp(p), lim);         }       }     printf( %.15Lf n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int Max_N(1050);   int N;   double P[Max_N][Max_N], F[Max_N], G[Max_N], V[Max_N];   bool done[Max_N];   int main() {     scanf( %d , &N);     for (int i = 1; i <= N; ++i) {       V[i] = 1.0;       for (int j = 1; j <= N; ++j) scanf( %lf , P[i] + j), P[i][j] /= 100.0;       if (i < N) F[i] = 1E100;     }     for (int u;;) {       u = -1;       for (int x = 1; x <= N; ++x)         if (!done[x] && (u == -1 || F[x] < F[u])) u = x;       if (u == -1) break;       done[u] = true;       for (int v = 1; v <= N; ++v)         if (!done[v] && P[v][u] != 0.0)           G[v] += V[v] * P[v][u] * F[u], V[v] *= (1.0 - P[v][u]),               F[v] = 1.0 / (1.0 - V[v]) + G[v] / (1.0 - V[v]);     }     printf( %.10lf , F[1]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   constexpr int MAX_N = 200000;   int N, M, S, D;   int X[MAX_N + 10];   int DP[MAX_N + 1] = {0};   stack<string> OPS;   void run(int x) {     if (x == 0) return;     std::ostringstream os;     os <<  RUN   << x;     OPS.push(os.str());   }   void jump(int x) {     assert(x > 0);     std::ostringstream os;     os <<  JUMP   << x;     OPS.push(os.str());   }   bool dfs(int p) {     assert(p >= 0 && p <= N);     if (DP[p] != 0) {       assert(DP[p] == 2);       return false;     }     if (M < X[p]) {       DP[p] = 2;       return false;     }     if (p == N || M < X[p + 1]) {       run(M - X[p] - 1);       DP[p] = 1;     } else {       DP[p] = 2;       int space = X[p + 1] - X[p] - 2;       if (space < S) {         return false;       }       int i = p + 1;       while (DP[p] != 1 && i <= N && X[i] + 1 <= X[p + 1] - 1 + D) {         if (dfs(i)) {           DP[p] = 1;           jump(X[i] + 1 - X[p + 1] + 1);           run(space);         }         i++;       }     }     return DP[p] == 1;   }   int main() {     cin >> N >> M >> S >> D;     X[0] = -1;     for (int i = 0; i < N; i++) {       cin >> X[i + 1];     }     sort(&X[0], &X[N + 1]);     if (!dfs(0)) {       printf( IMPOSSIBLE n );     } else {       while (!OPS.empty()) {         cout << OPS.top() << endl;         OPS.pop();       }     }     return 0;   }