malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   void FREOPEN() {}   inline double Time() { return (clock() * 1.0) / CLOCKS_PER_SEC; }   const int N = (int)2000, inf = (int)2e9, MOD = (int)1e9 + 7, alph = 26;   char CH[N];   const long long INF = (long long)1e18;   const int dx[] = {1, -1, 0, 0, -1, 1, -1, 1};   const int dy[] = {0, 0, 1, -1, -1, 1, 1, -1};   const int dp[] = {8, 9, 1, 13, 3, 12, 7, 5, 0, 2, 4, 11, 6, 10, 15, 14};   int a[N][N];   int main() {     FREOPEN();     int n;     cin >> n;     int num = 0;     for (int bi = 0; bi < n; bi += 4) {       for (int bj = 0; bj < n; bj += 4) {         for (int i = bi; i < bi + 4; i++) {           for (int j = bj; j < bj + 4; j++) {             int p = (i - bi) * 4 + (j - bj);             a[i][j] = (dp[p] ^ num);           }         }         num += 16;       }     }     for (int i = 0; i < n; i++) {       for (int j = 0; j < n; j++) printf( %d  , a[i][j]);       printf(  n );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 2000000 + 7;   const int M = 26;   const int mod = 999983;   const int inf = 1e9 + 7;   const double pi = acos(-1);   const int maxn = N * 2;   const double PI = acos(-1);   int n, m;   int a[N];   int dp[22][N];   string s;   void solve() {     cin >> n >> m;     for (int i = (0); i < (n); i++) {       cin >> s;       for (int j = (0); j < (m); j++) {         int u = s[j] -  0 ;         a[j] = (a[j] << 1) | u;       }     }     for (int i = (0); i < (m); i++) {       dp[0][a[i]]++;     }     for (int k = (1); k < (n + 1); k++) {       for (int mask = (0); mask < (1 << n); mask++) {         if (k >= 2) dp[k][mask] = (k - 2 - n) * dp[k - 2][mask];         for (int p = (0); p < (n); p++) dp[k][mask] += dp[k - 1][mask ^ (1 << p)];         dp[k][mask] /= k;       }     }     int ans = inf;     for (int mask = (0); mask < (1 << n); mask++) {       int cur = 0;       for (int k = (0); k < (n + 1); k++) cur += min(k, n - k) * dp[k][mask];       ans = min(ans, cur);     }     cout << ans;   }   int main() {     int T = 1;     for (int i = (1); i < (T + 1); i++) {       solve();     }   }
#include <bits/stdc++.h>   using namespace std;   char s[2005];   char p[505];   int dp[2005][2005];   int len[2005];   int main() {     scanf( %s , s);     scanf( %s , p);     int len_s = strlen(s);     int len_p = strlen(p);     for (int i = 0; i < len_s; i++) {       int tot = i;       if (s[i] != p[0]) {         len[i] = -1;         continue;       }       for (int j = 0; j < len_p; j++) {         while (tot < len_s && s[tot] != p[j]) tot++;         tot++;       }       if (tot >= len_s + 1)         len[i] = -1;       else         len[i] = tot - 1;     }     for (int i = 0; i <= len_s; i++)       for (int j = 0; j <= len_s; j++) dp[i][j] = 0x3f3f3f3f;     dp[0][0] = 0;     int all = len_s / len_p;     len[len_s] = -1;     for (int i = 0; i <= len_s; i++) {       if (i) {         for (int j = 0; j <= all; j++) dp[i][j] = min(dp[i][j], dp[i - 1][j]);       }       if (len[i] != -1) {         for (int j = 0; j <= all; j++) {           dp[len[i] + 1][j + 1] =               min(dp[len[i] + 1][j + 1], dp[i][j] + len[i] - i + 1 - len_p);         }       }     }     int temp = 1;     while (dp[len_s][temp] <= 2000 &&            dp[len_s][temp] - dp[len_s][temp - 1] >= 0 && temp <= all) {       for (int i = 0; i < dp[len_s][temp] - dp[len_s][temp - 1]; i++)         printf( %d  , temp - 1);       temp++;     }     temp -= 1;     int a = len_s - temp * len_p - dp[len_s][temp] + 1;     while (a > 0 && a--) printf( %d  , temp);     for (int i = temp * len_p - 1; i >= 0; i--) {       printf( %d  , i / len_p);     }   }
#include <bits/stdc++.h>   using namespace std;   long long input[100000], n, output, table[100000], a, tlg, go, high, lg;   int main(int argc, char** argv) {     int i, j, k;     while (scanf(  %d , &n) == 1) {       output = 0;       lg = 1;       tlg = 1;       scanf(  %d , &input[0]);       for (i = 1; i < n; i++) {         scanf(  %d , &a);         if (a != input[lg - 1]) {           input[lg] = a;           lg++;         }       }       table[0] = input[0];       input[lg] = 1000000000;       for (i = 1; i < lg; i++) {         if ((input[i] < input[i - 1] && input[i] < input[i + 1]) ||             (input[i] > input[i - 1] && input[i] > input[i + 1])) {           table[tlg] = input[i];           tlg++;         }       }       table[tlg] = 1000000000;       high = table[0];       for (i = 0; i < tlg; i++) {         if (table[i] > table[i + 1] && table[i + 1] < table[i + 2]) {           if (high > table[i + 2]) {             output += table[i + 2] - table[i + 1];             i++;           } else {             output += high - table[i + 1];             high = table[i + 2];             i++;           }         } else {           high = table[i + 1];         }       }       cout << output << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int M = 100000 + 10;   int a[M];   vector<int> ans[M];   int main() {     int n, k;     cin >> n >> k;     for (int i = 0; i < n; i++) {       cin >> a[i];     }     sort(a, a + n);     int num = 0;     while (num < k) {       for (int i = n; i >= 0 && num < k; i--) {         for (int j = 0; j < i; j++) {           for (int x = n - 1; x >= i; x--) {             ans[num].push_back(a[x]);           }           ans[num].push_back(a[j]);           num++;           if (num == k) {             break;           }         }       }     }     for (int i = 0; i < num; i++) {       cout << ans[i].size() <<    ;       for (int j = 0; j < ans[i].size(); j++) {         cout << ans[i][j] <<    ;       }       cout << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   inline int Pow(int x, int y, int mod) {     long long t = x, r = 1;     for (; y; y >>= 1, t = t * t % mod) y& 1 ? r = r * t % mod : 0;     return r;   }   inline int Get() {     int res = 0, q = 1;     char ch = getchar();     while ((ch <  0  || ch >  9 ) && ch !=  - ) ch = getchar();     if (ch ==  - ) q = -1, ch = getchar();     while (ch >=  0  && ch <=  9 ) res = res * 10 + ch -  0 , ch = getchar();     return res * q;   }   const double eps = 1e-12, pi = M_PI;   const int oo = (int)2.1e9, mod = (int)1e9 + 7;   const long long INF = (long long)1e17;   const int N = 110;   int n;   int dp[N][3];   int a[N];   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; ++i) scanf( %d , a + i);     dp[1][0] = 1;     dp[1][1] = a[1] == 1 || a[1] == 3 ? 0 : oo;     dp[1][2] = a[1] == 2 || a[1] == 3 ? 0 : oo;     for (int i = 2; i <= n; ++i) {       dp[i][0] = min(min(dp[i - 1][0], dp[i - 1][1]), dp[i - 1][2]) + 1;       if (a[i] == 1 || a[i] == 3)         dp[i][1] = min(dp[i - 1][0], dp[i - 1][2]);       else         dp[i][1] = oo;       if (a[i] == 2 || a[i] == 3)         dp[i][2] = min(dp[i - 1][0], dp[i - 1][1]);       else         dp[i][2] = oo;     }     printf( %d n , min(dp[n][0], min(dp[n][1], dp[n][2])));     return 0;   }
#include <bits/stdc++.h>   long long n, i, j, h, k, t, d;   long double a, m, b;   using namespace std;   long double pow(long double a, long long b) {     if (b == 0) return 1;     if (b == 1) return a;     long double t = pow(a, b / 2);     t = t * t;     if (b % 2 == 0)       return t;     else       return t * a;   }   int main() {     cin >> m >> n;     a = m;     for (i = 1; i < m; i++) {       b = i / m;       a -= pow(b, n);     }     cout << a;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 2e5 + 10;   int main() {     ios::sync_with_stdio(false);     int _;     cin >> _;     while (_--) {       int n;       cin >> n;       int ans = 1e9 + 10;       for (int i = 1; i * i <= n; i++) {         int res = i - 1 + ceil(1.0 * n / (1.0 * i)) - 1;         ans = min(res, ans);       }       cout << ans <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int cycle;   vector<int> adj[26], topo;   int color[26];   void dfs(int i) {     color[i] = 1;     for (auto nx : adj[i])       if (!color[nx])         dfs(nx);       else if (color[nx] == 1)         cycle = 1;     topo.push_back(i);     color[i] = 2;   }   int main() {     int n;     scanf( %d , &n);     string a[110];     for (int i = 0; i < n; i++) {       cin >> a[i];     }     if (n == 1) {       for (char c =  a ; c <=  z ; c++) {         cout << c;       }       return 0;     }     for (int i = 1; i < n; i++) {       int flag = 0;       for (int j = 0; j < (int)min(a[i - 1].size(), a[i].size()); j++) {         if (a[i - 1][j] != a[i][j]) {           adj[a[i - 1][j] -  a ].push_back(a[i][j] -  a );           flag = 1;           break;         }       }       if (!flag && a[i - 1].size() > a[i].size()) {         puts( Impossible );         return 0;       }     }     for (int i = 0; i < 26; i++) {       if (!color[i]) dfs(i);     }     if (cycle) {       puts( Impossible );       return 0;     }     reverse(topo.begin(), topo.end());     for (auto x : topo) cout << char(x +  a );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, ans, col[1000005], flag[1000005], tot, res[1000005];   int k = 1, la[1000005], ff[1000005 * 2], check[1000005], pre[1000005], pos,       del[1000005];   int cnt, f[1000005], g[1000005];   struct node {     int a, b;   } e[1000005 * 2];   map<pair<int, int>, int> MAP;   void add(int a, int b) {     e[++k] = (node){a, b};     ff[k] = la[a];     la[a] = k;     e[++k] = (node){b, a};     ff[k] = la[b];     la[b] = k;   }   void dfs(int x, int fa) {     check[x] = flag[x] = 1;     col[x] = -col[fa];     for (int a = la[x]; a; a = ff[a]) {       if (e[a].b == fa) continue;       if (!check[e[a].b]) {         pre[e[a].b] = a;         dfs(e[a].b, x);         f[x] += f[e[a].b];         g[x] += g[e[a].b];         continue;       }       if (col[e[a].b] == col[x]) {         if (flag[e[a].b]) {           if (!cnt) pos = a;           cnt++;           f[x]++;         } else           f[x]--;       } else {         if (flag[e[a].b])           g[x]++;         else           g[x]--;       }     }     flag[x] = 0;   }   int main() {     int a, b;     scanf( %d%d , &n, &m);     for (int i = 1; i <= m; i++) {       scanf( %d%d , &a, &b), add(a, b);       int num = MAP[make_pair(a, b)];       if (num) del[i] = 1, del[num] = 1;       MAP[make_pair(a, b)] = i;     }     col[0] = 1;     for (int i = 1; i <= n; i++)       if (!check[i]) dfs(i, 0);     if (!cnt)       for (int i = 1; i <= m; i++) res[++tot] = i;     else {       if (cnt == 1 && !del[pos >> 1]) res[++tot] = (pos >> 1);       for (int i = 1; i <= n; i++) {         if (f[i] == cnt && !g[i] && !del[pre[i] >> 1])           if (!pre[i]) {             for (int a = la[i]; a; a = ff[a])               if (e[a].b == i && !del[a >> 1]) res[++tot] = (a >> 1);           } else             res[++tot] = (pre[i] >> 1);       }     }     sort(res + 1, res + tot + 1);     tot = unique(res + 1, res + tot + 1) - res - 1;     printf( %d n , tot);     for (int i = 1; i < tot; i++) printf( %d  , res[i]);     if (tot) printf( %d n , res[tot]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int who(int n) {     if (n < 5) {       return n;     } else {       n -= 5;       return who(n / 2);     }   }   int main(int argc, char** argv) {     int n, m;     cin >> n >> m;     vector<vector<char> > snake(n, vector<char>(m,  # ));     for (int i = 1; i < n; i += 2) {       for (int j = (i / 2) % 2; j < m - 1 + (i / 2) % 2; ++j) {         snake[i][j] =  . ;       }     }     for (int i = 0; i < n; ++i) {       for (int j = 0; j < m; ++j) {         cout << snake[i][j];       }       cout <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e5, K = 4;   vector<int> g[N];   set<int> s;   int a[N];   int get_index(const vector<int> x) {     static map<vector<int>, int> m;     static int cnt;     if (m.find(x) == m.end()) m[x] = cnt++;     return m[x];   }   void dfs_pre(int u, int fa) {     vector<int> x;     for (int v : g[u])       if (v != fa) {         dfs_pre(v, u);         x.push_back(a[v]);       }     sort(x.begin(), x.end());     a[u] = get_index(x);   }   void dfs(int u, int fa) {     vector<int> x;     if (g[u].size() < K) {       for (int v : g[u]) x.push_back(a[v]);       sort(x.begin(), x.end());       s.insert(get_index(x));     }     sort(g[u].begin(), g[u].end(), [](int x, int y) { return a[x] < a[y]; });     x.clear();     for (int i = 1; i < g[u].size(); i++) x.push_back(a[g[u][i]]);     int t = a[u];     for (int i = 0; i < g[u].size(); i++) {       if (g[u][i] != fa) {         a[u] = get_index(x);         dfs(g[u][i], u);       }       if (i < g[u].size() - 1) x[i] = a[g[u][i]];     }     a[u] = t;   }   int main() {     ios::sync_with_stdio(false);     int n;     cin >> n;     for (int i = 0; i < n - 1; i++) {       int x, y;       cin >> x >> y;       x--, y--;       g[x].push_back(y);       g[y].push_back(x);     }     dfs_pre(0, -1);     dfs(0, -1);     cout << s.size() << endl;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     int a[] = {1, 2, 3, 4, 6, 12};     int b[] = {12, 6, 4, 3, 2, 1};     cin >> t;     while (t--) {       string s;       cin >> s;       int ans[20];       int count = 0, n = 0, no;       for (int i = 0; i < 6; i++) {         for (int j = 0; j < b[i]; j++) {           no = 0;           for (int k = 0; k < a[i]; k++) {             if (s[j + k * b[i]] !=  X ) {               no = 1;               break;             }           }           if (!no) {             ans[count++] = i;             n++;             break;           }         }       }       cout << n <<    ;       for (int i = 0; i < n; i++) {         cout << a[ans[i]] <<  x  << b[ans[i]] <<    ;       }       cout << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   vector<pair<long long, long long> > v;   bool cmp(pair<long long, long long> a, pair<long long, long long> b) {     if (a.first == b.first) a.second < b.second;     return a.first > b.first;   }   int main() {     long long t, n, arr[200005], brr[200005], i;     cin >> t;     while (t--) {       cin >> n;       for (i = 0; i < n; i++) cin >> arr[i];       for (i = 0; i < n; i++) cin >> brr[i];       for (i = 0; i < n; i++) v.push_back({arr[i], brr[i]});       sort(v.begin(), v.end(), cmp);       long long self = 0;       long long deli = v[0].first;       long long mx = max(self, deli);       long long mn = deli;       for (i = 1; i < n; i++) {         self += v[i - 1].second;         deli = v[i].first;         mx = max(self, deli);         mn = min(mn, mx);       }       mn = min(mn, self + v[n - 1].second);       cout << mn << endl;       v.clear();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, s;     cin >> n >> s;     int a[n + 1];     int b[n + 1];     bool isCrossable = false;     for (int i = 1; i <= n; i++) cin >> a[i];     for (int i = 1; i <= n; i++) cin >> b[i];     if (a[1] == 0 || (a[s] == 0 && b[s] == 0)) {       cout <<  NO ;       return 0;     }     for (int i = 1; i <= n; i++) {       if (i >= s && a[i] == 1 && b[i] == 1) isCrossable = true;     }     if (a[s]) {       cout <<  YES ;       return 0;     }     if (b[s] && isCrossable) {       cout <<  YES ;       return 0;     }     cout <<  NO ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct interval {     int l, r;     bool operator<(const interval &t) const { return r < t.r; }   };   set<interval> itree[20];   set<interval>::iterator l, r;   long long ans;   long long f(int type, int num) {     return (1LL << type) * ((num + 1LL) * num) / 2;   }   void add(int type, int pos, int val) {     interval unit = {pos, pos};     l = r = itree[type].lower_bound(unit);     if (val == 0) {       if (r->l <= pos && pos <= r->r) {         interval new_left = {r->l, pos - 1}, new_right = {pos + 1, r->r};         ans -= f(type, (r->r) - (r->l) + 1);         ans += f(type, new_left.r - new_left.l + 1);         ans += f(type, new_right.r - new_right.l + 1);         itree[type].erase(r);         if (new_left.l <= new_left.r) itree[type].insert(new_left);         if (new_right.l <= new_right.r) itree[type].insert(new_right);       }     } else {       if (r->l <= pos && pos <= r->r) {         return;       }       if (!itree[type].empty()) {         if (l != itree[type].begin() && (--l)->r == pos - 1) {           unit.l = l->l;           ans -= f(type, l->r - l->l + 1);           itree[type].erase(l);         }         if (r != itree[type].end() && r->l == pos + 1) {           unit.r = r->r;           ans -= f(type, r->r - r->l + 1);           itree[type].erase(r);         }       }       itree[type].insert(unit);       ans += f(type, unit.r - unit.l + 1);     }   }   int main() {     int n, m;     cin >> n >> m;     for (int i = 1; i <= n; ++i) {       int a;       cin >> a;       for (int j = 0; j < 20; ++j) {         if (a % 2 != 0) add(j, i, a % 2);         a /= 2;       }     }     for (int i = 0; i < m; ++i) {       int pos, val;       cin >> pos >> val;       for (int j = 0; j < 20; ++j) {         add(j, pos, val % 2);         val /= 2;       }       cout << ans <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t--) {       long long n, a, b;       cin >> a >> b >> n;       if (n % 2 == 0)         cout << (n / 2) * (a - b) << endl;       else         cout << ((n / 2) * (a - b)) + a << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 2000005;   long long n, L, t;   long long K;   long long a[maxn];   double ans;   int main() {     scanf( %I64d%I64d%I64d , &n, &L, &t);     t += t;     K = t / L;     t = t - L * K;     ans += 0.25 * (double)K * n * (n - 1);     for (int i = 1; i <= n; i++) scanf( %I64d , &a[i]), a[i + n] = a[i];     for (int i = 1; i <= n; i++) {       int l = i, r = i + n - 1;       while (l < r) {         int mid = (l + r + 1) / 2;         if (mid > n) {           if (L - a[i] + a[mid] <= t)             l = mid;           else             r = mid - 1;         } else {           if (a[mid] - a[i] <= t)             l = mid;           else             r = mid - 1;         }       }       ans += 0.25 * (l - i);     }     printf( %lf n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     cin.tie(nullptr);     ios::sync_with_stdio(false);     int n;     cin >> n;     vector<int> a(n);     set<int> s;     int g = 0;     for (int i = 0; i < n; i++) {       cin >> a[i];       g ^= a[i];       s.insert(a[i]);     }     if (n == 3) {       printf( YES n );       printf( 1 n );       printf( 1 2 3 n );       return 0;     }     if (n % 2 == 0 and g > 0) {       printf( NO n );       return 0;     }     if (n % 2 == 0) {       printf( YES n );       vector<pair<int, pair<int, int>>> v;       for (int i = 1;; i += 2) {         if (i + 2 > n) break;         v.push_back(make_pair(i, make_pair(i + 1, i + 2)));       }       for (int i = 1;; i += 2) {         if (i + 3 == n) break;         v.push_back(make_pair(i, make_pair(i + 1, n)));       }       printf( %d n , v.size());       for (auto p : v) {         printf( %d %d %d n , p.first, p.second.first, p.second.second);       }       return 0;     } else {       printf( YES n );       vector<pair<int, pair<int, int>>> v;       for (int i = 1;; i += 2) {         if (i + 2 > n) break;         v.push_back(make_pair(i, make_pair(i + 1, i + 2)));       }       for (int i = 1;; i += 2) {         if (i + 2 == n) break;         v.push_back(make_pair(i, make_pair(i + 1, n)));       }       printf( %d n , v.size());       for (auto p : v) {         printf( %d %d %d n , p.first, p.second.first, p.second.second);       }       return 0;     }   }
#include <bits/stdc++.h>   using namespace std;   void Read(int &x) {     char c;     while (c = getchar(), c != EOF)       if (c >=  0  && c <=  9 ) {         x = c -  0 ;         while (c = getchar(), c >=  0  && c <=  9 ) x = x * 10 + c -  0 ;         ungetc(c, stdin);         return;       }   }   int n, a, b;   stack<int> s;   bool dfs(long long now) {     if (now > b) return 0;     if (now == b) {       s.push(b);       return 1;     }     if (dfs(now << 1)) {       s.push(now);       return 1;     }     if (dfs(now * 10 + 1)) {       s.push(now);       return 1;     }     return 0;   }   int main() {     Read(a), Read(b);     if (dfs(a)) {       puts( YES );       printf( %u n , s.size());       while (!s.empty()) {         printf( %d  , s.top());         s.pop();       }     } else       puts( NO );   }
#include <bits/stdc++.h>   using namespace std;   int main() {     cin.tie(0);     cout.tie(0);     ios_base::sync_with_stdio(0);     int t;     cin >> t;     while (t--) {       long long l, r;       cin >> l >> r;       cout << l <<     << l * 2 << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   pair<long long, int> ar[200003 + 2];   long long DP[200003 + 2][2];   long long n;   long long dp(int i, bool fl) {     if (i == n + 1) {       if (fl == 0) return 0;       return 2e18;     }     if (i > n + 1) return 2e18;     long long &ret = DP[i][fl];     if (ret != -1) return ret;     ret = 2e18;     if (fl == 0)       ret = min(ret, -ar[i].first + dp(i + 2, 1));     else {       ret = min(ret, dp(i + 1, 1));       ret = min(ret, +ar[i].first + dp(i + 1, 0));     }     return ret;   }   int team[200003 + 2];   long long res;   int cnt = 0;   void print(int i, bool fl) {     if (i == n + 1) return;     if (fl == 0) {       res += ar[i].first;       team[ar[i].second] = ++cnt;       team[ar[i + 1].second] = cnt;       print(i + 2, 1);     } else {       long long kop = dp(i + 1, 1);       if (kop == res) {         team[ar[i].second] = cnt;         print(i + 1, 1);       } else {         team[ar[i].second] = cnt;         res -= ar[i].first;         print(i + 1, 0);       }     }   }   int main() {     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> ar[i].first;       ar[i].second = i;     }     sort(ar + 1, ar + n + 1);     memset(DP, -1, sizeof DP);     res = dp(1, 0);     long long ans = res;     print(1, 0);     cout << ans <<     << cnt << endl;     for (int i = 1; i <= n; i++) {       if (i > 1) cout <<    ;       cout << team[i];     }     cout << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MX = 500000;   int m, i, j, ii;   long long l, r, k, R, h, s, a[2][2], b[2][2], f[2][2];   void upd(long long h) {     if (r / h - (l - 1) / h >= k) R = max(R, h);   }   int main() {     scanf( %d%I64d%I64d%I64d , &m, &l, &r, &k);     for (h = 1; h <= MX; h++) upd(h);     for (h = 1; r / h > MX; h++) upd(r / h);     for (h = 1; (l - 1) / h > MX; h++) upd((l - 1) / h);     R--;     a[0][0] = 0;     a[0][1] = 1 % m;     a[1][0] = 1 % m;     a[1][1] = 1;     f[0][0] = 1 % m;     f[0][1] = 0;     f[1][0] = 0;     f[1][1] = 1 % m;     for (ii = 60; ii >= 0; ii--) {       for (i = 0; i < 2; i++)         for (j = 0; j < 2; j++) {           b[i][j] = 0;           for (int k = 0; k < 2; k++) b[i][j] = (b[i][j] + f[i][k] * f[k][j]) % m;         }       if (R & (1LL << ii))         for (i = 0; i < 2; i++)           for (j = 0; j < 2; j++) {             f[i][j] = 0;             for (int k = 0; k < 2; k++)               f[i][j] = (f[i][j] + b[i][k] * a[k][j]) % m;           }       else         for (i = 0; i < 2; i++)           for (j = 0; j < 2; j++) f[i][j] = b[i][j];     }     printf( %I64d n , f[1][1] % m);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, h;     cin >> n >> h;     double s = 1.0 * h / n;     double t = s;     for (int i = 0; i < n - 1; i++) {       double ans = sqrt(1.0 * s * h);       s += t;       printf( %.12llf n , ans);     }     return 0;   }