malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const int N = 2e3 + 15;   const int mod = 998244353;   char s[N];   int len;   int depth[N];   vector<int> adj[N];   int dp[N][2];   int add(int x, int y) { return ((x + y) % mod + mod) % mod; }   int mul(int x, int y) { return (long long)x * y % mod; }   int mypow(int x, int c) {     int ret = 1;     while (c > 0) {       if (c & 1) {         ret = mul(ret, x);       }       c /= 2;       x = mul(x, x);     }     return ret;   }   bool vis[N];   void dfs(int node, int par) {     vis[node] = true;     for (int ch : adj[node]) {       if (ch != par && !vis[ch]) {         depth[ch] = depth[node] + 1;         dfs(ch, node);       }     }   }   int solveDp(int node, int bit) {     int &ret = dp[node][bit];     if (ret != -1) {       return ret;     }     ret = 0;     bool isLeaf = true;     int cc = 0;     for (int ch : adj[node]) {       if (depth[ch] > depth[node]) {         isLeaf = false;       } else {         continue;       }       ++cc;       int diff = abs(ch - node);       if (diff >= len) {         int ind = min(ch, node);         if (s[ind] ==  ? ) {           ret = add(ret, solveDp(ch, 0));           ret = add(ret, solveDp(ch, 1));         } else {           int u = (s[ind] -  0 ) ^ bit;           ret = solveDp(ch, u);         }       } else {         ret = solveDp(ch, bit);       }     }     if (isLeaf) {       ret = 1;     }     return ret;   }   void solve() {     scanf(  %s  , s + 1);     len = strlen(s + 1);     int ret = 0;     for (int st = 2; st <= len; ++st) {       for (int i = 1; i <= len * 2; ++i) adj[i].clear();       memset(dp, -1, sizeof(dp));       memset(depth, 0, sizeof(depth));       memset(vis, 0, sizeof(vis));       for (int i = 1; i <= len; ++i) {         int j = len - i + 1;         if (i != j) adj[i].push_back(j);       }       int g = len - st + 1;       for (int j = st; j <= len; ++j) {         int ind = j - st + 1;         int nind = g - ind + 1 + (st - 1);         if (j + len != nind + len) adj[j + len].push_back(nind + len);       }       for (int i = 1; i < st; ++i) {         dp[i + len][1] = 0;       }       dp[1][0] = 0;       dp[len][0] = 0;       dp[st + len][0] = 0;       dp[len * 2][0] = 0;       for (int i = 1; i <= len; ++i) {         adj[i].push_back(i + len);         adj[i + len].push_back(i);       }       int tmp = 1;       for (int i = 1; i <= len * 2; ++i) {         assert(adj[i].size() <= 2);         if (adj[i].size() == 1 && !vis[i]) {           dfs(i, 0);         }       }       for (int i = 1; i <= len * 2; ++i) {         assert(vis[i]);         if (depth[i] == 0) {           assert(adj[i].size() == 1);           tmp = mul(tmp, add(solveDp(i, 0), solveDp(i, 1)));         }       }       ret = add(ret, tmp);     }     printf( %d n , ret);   }   int main() {     solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5 + 50;   long long T, n, m;   char s[maxn];   int main() {     cin >> n;     cin >> s + 1;     int sign = 0, x = 0, y = 0, ans = 0;     for (int i = 1; i <= n; i++) {       if (s[i] ==  U )         y++;       else if (s[i] ==  R )         x++;       if (y > x) {         if (sign == -1) ans++;         sign = 1;       } else if (y < x) {         if (sign == 1) ans++;         sign = -1;       }     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int inf = 0x3f3f3f3f;   const long long llinf = 0x3f3f3f3f3f3f3f3f;   template <typename INint>   inline void IN(INint &first) {     first = 0;     int f = 1;     char c;     cin.get(c);     while (c <  0  || c >  9 ) {       if (c ==  - ) f = -1;       cin.get(c);     }     while (c >=  0  && c <=  9 ) {       first = first * 10 + c -  0 ;       cin.get(c);     }     first *= f;   }   template <typename INint>   inline void OUT(INint first) {     if (first > 9) OUT(first / 10);     cout.put(first % 10 +  0 );   }   const int maxn = int(4e5);   int mod = int(1e9 + 7);   int n;   int mn = -inf, mx = inf;   set<int> A;   int gtype(int first) {     if (first < mn) return 0;     if (first > mx) return 4;     if (first == mn) return 1;     if (first == mx) return 3;     return 2;   }   void mul(long long &a, long long b) {     a *= b;     if (a > mod) a %= mod;   }   int main() {     int T(1), times(0);     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     while (++times, T--) {       cin >> n;       A.insert(mx);       A.insert(mn);       long long res(1), ans(1);       for (int i = 1; i <= int(n); i++) {         int no;         string s;         cin >> s >> no;         int p = gtype(no);         if (s[1] ==  D ) {           A.insert(no);           if (p == 2) ++res;         } else {           if (p == 0 || p == 4) {             cout << 0 << endl;             return 0;           }           if (p == 2) mul(ans, 2);           A.erase(no);           res = 1;           auto pos = A.lower_bound(no);           mx = *pos;           mn = *(--pos);         }       }       ans *= res;       ans %= mod;       cout << ans << endl;     }     return 0;   }
#include <bits/stdc++.h>   int n, h;   int dynamics[1001][2][31][31][31];   int progress(int a) { return (a == 0 || a == h - 1) ? 0 : a + 1; }   inline void add(int& a, int b, int mod) { a = (a + b) % mod; }   int main(int argc, char* argv[]) {     std::cin >> n >> h;     if (h == 1)       dynamics[1][1][0][0][0] = 4;     else       dynamics[1][1][1][1][1] = 4;     for (int i = 1; i < n; i++) {       for (int alive = 0; alive < 2; alive++) {         for (int left = 0; left < h; left++) {           for (int right = 0; right < h; right++) {             for (int front = 0; front < h; front++) {               int current = dynamics[i][alive][left][right][front];               int next_left = progress(left);               int next_right = progress(right);               int next_front = progress(front);               add(dynamics[i + 1][alive][next_left][next_right][next_front],                   current, 1e9 + 9);               add(dynamics[i + 1][left > 0][alive][next_right][next_front],                   current, 1e9 + 9);               add(dynamics[i + 1][right > 0][alive][next_left][next_front],                   current, 1e9 + 9);               add(dynamics[i + 1][front > 0][alive][next_left][next_right],                   current, 1e9 + 9);             }           }         }       }     }     int result = 0;     for (int alive = 0; alive < 2; alive++) {       for (int left = 0; left < h; left++) {         for (int right = 0; right < h; right++) {           for (int front = 0; front < h; front++) {             if (alive > 0 || left > 0 || right > 0 || front > 0) {               add(result, dynamics[n][alive][left][right][front], 1e9 + 9);             }           }         }       }     }     std::cout << result << std::endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1000 + 11;   int sdis(int x, int y, int xx, int yy) {     int dx = x - xx;     int dy = y - yy;     return dx * dx + dy * dy;   }   int main() {     int ax, ay, ar, bx, by, br;     while (cin >> ax >> ay >> ar >> bx >> by >> br) {       int ds = sdis(ax, ay, bx, by);       if ((ar + br) * (ar + br) <= ds) {         printf( %.10lf n , (sqrt(ds + 0.0) - ar - br) * 0.5);       } else if (ds <= (ar - br) * (ar - br)) {         printf( %.10lf n , (abs(ar - br) - sqrt(ds + 0.0)) * 0.5);       } else {         printf( %.10lf n , 0.0);       }     }   }
#include <bits/stdc++.h>   int main(void) {     int t;     long long int a, b, k, p, s;     scanf( %d , &t);     for (int i = 0; i < t; i++) {       scanf( %lld  , &a);       scanf( %lld  , &b);       scanf( %lld  , &k);       s = k / 2;       if ((k % 2) == 0) {         p = (a - b) * (s);       }       if ((k % 2) == 1) {         p = ((a - b) * (s) + a);       }       printf( %lld  n , p);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 2e5 + 5;   int a[maxn];   int t[maxn], l[maxn], r[maxn];   int n, m, ans;   void solve(int k) {     int tot = 0;     if (k == 1) {       for (int i = 2; i <= n; i++)         if (a[i] < a[i - 1]) tot++;     } else {       for (int i = 2; i <= n; i++) {         int p = i / k;         if (i % k > 1) p++;         if (a[i] < a[p]) tot++;       }     }     printf( %d  , tot);   }   void prepare() {     l[1] = 2, r[1] = m + 1;     for (int i = l[1]; i <= r[1]; i++)       if (a[i] < a[1]) ans++;     for (int i = l[1]; i <= r[1]; i++) {       l[i] = m * (i - 1) + 2;       if (l[i] > n) l[i] = n + 1;       r[i] = m * i + 1;       if (r[i] > n) r[i] = n;       for (int j = l[i]; j <= r[i]; j++)         if (a[j] < a[i]) ans++;     }     printf( %d  , ans);   }   void deal(int k) {     for (int i = 1; i <= m + 1; i++) {       if (l[i] > r[i]) break;       for (int j = 1; j < i; j++)         if (l[i] <= r[i] && a[l[i]++] < a[i]) ans--;       for (int j = 1; j <= i; j++)         if (r[i] < n && a[++r[i]] < a[i]) ans++;     }     printf( %d  , ans);   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) scanf( %d , &a[i]);     m = sqrt(n) + 1;     for (int i = 1; i < m; i++) solve(i);     if (m > n - 1) return 0;     prepare();     for (int i = m + 1; i < n; i++) deal(i);     return 0;   }
#include <bits/stdc++.h>   int scan() {     int noRead = 0;     char p = getchar();     for (; p < 33;) {       p = getchar();     }     while (p > 32) {       noRead = (noRead << 3) + (noRead << 1) + (p -  0 );       p = getchar();     }     return noRead;   }   long long int lscan() {     long long int noRead = 0;     char p = getchar();     for (; p < 33;) {       p = getchar();     }     while (p > 32) {       noRead = (noRead << 3) + (noRead << 1) + (p -  0 );       p = getchar();     }     return noRead;   }   using namespace std;   int dp[501][501];   int vec[501];   int f(int l, int r) {     if (l > r) return 0;     if (l == r) return 1;     if (dp[l][r] != -1) return dp[l][r];     int &ans = dp[l][r];     ans = 100001;     ans = min(ans, 1 + f(l + 1, r));     for (int i = l + 2; i <= r; ++i) {       if (vec[l] == vec[i]) {         ans = min(ans, f(l + 1, i - 1) + f(i + 1, r));       }     }     if (vec[l] == vec[l + 1]) ans = min(ans, 1 + f(l + 2, r));     return ans;   }   int main(void) {     int n = scan();     for (int i = 0; i < n; ++i) vec[i] = scan();     for (int i = 0; i < n; ++i)       for (int j = 0; j < n; ++j) dp[i][j] = -1;     printf( %d , f(0, n - 1));     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxN = (int)2E5 + 5;   int n, x, y;   vector<int> Adj[maxN];   int deg[maxN];   bool avail[maxN];   bool marked[maxN];   int Count[maxN];   int DFS(int u) {     marked[u] = true;     Count[u] = 0;     int cnt = 0;     for (int i = 0, sz = Adj[u].size(); i < sz; ++i) {       int v = Adj[u][i];       if (marked[v]) continue;       DFS(v);       Count[u] += Count[v];       if (avail[v]) ++cnt;     }     if (cnt == 0)       avail[u] = true;     else if (cnt == 1)       avail[u] = true, ++Count[u];     else       avail[u] = false, Count[u] += 2;     return Count[u];   }   int main() {     scanf( %d %d %d , &n, &x, &y);     for (int u = 1; u <= n; ++u) Adj[u].clear();     memset(deg, 0, sizeof(deg));     for (int i = 0; i < n - 1; ++i) {       int u, v;       scanf( %d %d , &u, &v);       Adj[u].push_back(v);       Adj[v].push_back(u);       ++deg[u];       ++deg[v];     }     if (x >= y) {       for (int u = 1; u <= n; ++u)         if (deg[u] == n - 1) {           cout << (long long)(n - 2) * y + x << endl;           return 0;         }       cout << (long long)(n - 1) * y << endl;       return 0;     }     DFS(1);     memset(marked, false, sizeof(marked));     cout << (long long)Count[1] * x + (long long)(n - 1 - Count[1]) * y << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, l, r, deg[100005], num;   int main() {     scanf( %d%d , &n, &m);     for (int i = 1; i < n; i++) {       scanf( %d%d , &l, &r);       deg[l]++;       deg[r]++;     }     for (int i = 1; i <= n; i++)       if (deg[i] == 1) num++;     printf( %.7f n , (double)2.0 * m / num);   }
#include <bits/stdc++.h>   using namespace std;   const long long maxn = 500005;   const long long inf = 0x3f3f3f3f3f3f3f3f;   const long long MOD = 100000007;   const double eps = 1e-10;   long long qpow(long long a, long long b) {     long long tmp = a % MOD, ans = 1;     while (b) {       if (b & 1) {         ans *= tmp, ans %= MOD;       }       tmp *= tmp, tmp %= MOD, b >>= 1;     }     return ans;   }   long long lowbit(long long x) { return x & -x; }   long long max(long long a, long long b) { return a > b ? a : b; }   long long min(long long a, long long b) { return a < b ? a : b; }   long long mmax(long long a, long long b, long long c) {     return max(a, max(b, c));   }   long long mmin(long long a, long long b, long long c) {     return min(a, min(b, c));   }   void mod(long long &a) {     a += MOD;     a %= MOD;   }   long long ll(long long p) { return p << 1; }   long long rr(long long p) { return p << 1 | 1; }   long long mm(long long l, long long r) { return (l + r) / 2; }   long long lg(long long x) {     if (x == 0) return 1;     return (long long)log2(x) + 1;   }   bool smleql(double a, double b) {     if (a < b || fabs(a - b) <= eps) return true;     return false;   }   double len(double a, double b, double c, double d) {     return sqrt((a - c) * (a - c) + (b - d) * (b - d));   }   bool isp(long long x) {     if (x == 1) return false;     if (x == 2) return true;     for (long long i = 2; i * i <= x; ++i)       if (x % i == 0) return false;     return true;   }   inline long long read() {     char ch = getchar();     long long s = 0, w = 1;     while (ch < 48 || ch > 57) {       if (ch ==  - ) w = -1;       ch = getchar();     }     while (ch >= 48 && ch <= 57) {       s = (s << 1) + (s << 3) + ch - 48;       ch = getchar();     }     return s * w;   }   inline void write(long long x) {     if (x < 0) putchar( - ), x = -x;     if (x > 9) write(x / 10);     putchar(x % 10 + 48);   }   long long n, k, a[maxn], sum = 0;   deque<long long> q;   long long chk(long long now) {     long long res = 0;     for (long long i = 1; i <= n; ++i) res += min(now, a[i]);     return res;   }   long long half(long long l, long long r) {     while (l <= r) {       long long m = (l + r) / 2;       if (chk(m) <= k)         l = m + 1;       else         r = m - 1;     }     return r;   }   signed main() {     ios_base::sync_with_stdio(0);     cin.tie(0), cout.tie(0);     cin >> n >> k;     long long mx = -inf;     for (long long i = 1; i <= n; ++i)       cin >> a[i], mx = max(mx, a[i]), sum += a[i];     if (sum < k)       cout << -1;     else if (sum == k)       ;     else {       long long t = half(1, mx);       k -= chk(t);       for (long long i = 1; i <= n; ++i) {         a[i] -= t;         if (a[i] > 0) q.push_back(i);       }       while (k--) {         long long f = q.front();         q.pop_front();         a[f]--;         if (a[f] > 0) q.push_back(f);       }       for (long long i = 0; i < q.size(); ++i) cout << q[i] <<    ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, a[100005], dp[100005][5];   bool solve(int i, int j) {     if (i == n - 1) return true;     if (dp[i][j] == -1) {       bool ans = false;       if (a[i] < a[i + 1])         for (int k = j + 1; k < 5; k++) ans |= solve(i + 1, k);       else if (a[i] > a[i + 1])         for (int k = 0; k < j; k++) ans |= solve(i + 1, k);       else         for (int k = 0; k < 5; k++)           if (j != k) ans |= solve(i + 1, k);       dp[i][j] = ans;     }     return dp[i][j];   }   void print(int i, int j) {     cout << j + 1 <<    ;     if (i == n - 1) {       cout << endl;       return;     }     if (a[i] < a[i + 1]) {       for (int k = j + 1; k < 5; k++) {         if (solve(i + 1, k)) {           print(i + 1, k);           return;         }       }     } else if (a[i] > a[i + 1]) {       for (int k = 0; k < j; k++) {         if (solve(i + 1, k)) {           print(i + 1, k);           return;         }       }     } else {       for (int k = 0; k < 5; k++) {         if (j != k && solve(i + 1, k)) {           print(i + 1, k);           return;         }       }     }   }   int main() {     scanf( %d , &n);     for (int i = 0; i < n; i++) scanf( %d , &a[i]);     memset(dp, -1, sizeof(dp));     for (int j = 0; j < 5; j++) {       if (solve(0, j)) {         print(0, j);         return 0;       }     }     cout << -1 << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long k, b, n;     long long z = 1, t;     cin >> k >> b >> n >> t;     for (int i = 0; i < n; i++) {       if (z > t) {         cout << n - i + 1 << endl;         return 0;       }       z = z * k + b;     }     if (z <= t)       cout << 0 << endl;     else       cout << 1 << endl;   }
#include <bits/stdc++.h>   using namespace std;   const long long inf = (long long)(1e9 + 17);   const long long mod = (long long)(1e9 + 7);   int n, k;   string s, t;   int dp[201][201][201];   int recurse(int idx, int tot, int ct) {     if (tot > k) {       return -inf;     }     if (idx == n) {       if (tot > k) return -inf;       return 0;     }     int &ans = dp[idx][tot][ct];     if (ans != -1) {       return ans;     }     ans = -inf;     if (s[idx] != t[1] or s[idx] != t[0])       ans = max(ans, recurse(idx + 1, tot, ct));     ans = max(ans, recurse(idx + 1, tot + (s[idx] != t[0]), ct + 1));     ans = max(ans,               ct + recurse(idx + 1, tot + (s[idx] != t[1]), ct + (t[0] == t[1])));     return ans;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     cin >> n >> k;     cin >> s >> t;     memset(dp, -1, sizeof dp);     int ans = recurse(0, 0, 0);     cout << ans <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long limit = 1e5 + 1;   long long res = 0, ans = 1e17, sum = 0;   long long a[limit], cost[limit];   long long n;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     cin >> n;     for (long long i = 1; i <= n; i++) cin >> a[i] >> cost[i];     for (long long i = 1; i <= n; i++) {       ans = min(cost[i], ans);       cost[i] = ans;     }     for (long long i = 1; i <= n; i++) res += a[i] * cost[i];     cout << res;   }
#include <bits/stdc++.h>   using namespace std;   const int MAX_N = 1e2 + 2, MAX_K = 1100;   int n, k;   int Arr[MAX_N];   double ans;   double dp[MAX_K][MAX_N][MAX_N];   int main() {     ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);     cin >> n >> k;     k = min(k, MAX_K - 1);     for (int i = 1; i <= n; i++) cin >> Arr[i];     for (int i = 1; i <= n; i++)       for (int j = i + 1; j <= n; j++) dp[0][i][j] = (Arr[i] > Arr[j]);     for (int p = 1; p <= k; p++)       for (int i = 1; i <= n; i++)         for (int j = i + 1; j <= n; j++) {           for (int q = 1; q <= i; q++) {             dp[p][i][j] += dp[p - 1][q][j] * min(q, j - i);             if (1 <= q - (j - i))               dp[p][i][j] +=                   (1.0 - dp[p - 1][q - (j - i)][q]) * min(q - (j - i), n - j + 1);           }           for (int q = i + 1; q < j; q++) {             dp[p][i][j] += dp[p - 1][q][j] * min(i, j - q);             if (1 <= i - (j - q))               dp[p][i][j] +=                   (1.0 - dp[p - 1][i - (j - q)][q]) * min(i - (j - q), n - j + 1);           }           for (int q = j; q <= n; q++)             dp[p][i][j] += (1.0 - dp[p - 1][i + (q - j)][q]) * min(i, n - q + 1);           for (int q = i + 1; q <= j; q++)             dp[p][i][j] += dp[p - 1][i][q] * min(q - i, n - j + 1);           for (int q = j + 1; q <= n; q++)             dp[p][i][j] += dp[p - 1][i][q] * min(j - i, n - q + 1);           dp[p][i][j] +=               dp[p - 1][i][j] * ((i - 1) * i / 2 + (j - i - 1) * (j - i) / 2 +                                  (n - j) * (n - j + 1) / 2);           dp[p][i][j] /= n * (n + 1) / 2.0;         }     for (int i = 1; i <= n; i++)       for (int j = i + 1; j <= n; j++) ans += dp[k][i][j];     cout << fixed << setprecision(1000) << ans <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   int n, s1, s2;   int x[100001];   bool C(int v) {     if (abs(s1 - s2) > v) return false;     set<int> st;     st.insert(s1);     int pos = s2;     for (int i = 0; i < n; i++) {       if (st.size()) {         st.insert(pos);       }       while (st.size() && abs(*st.begin() - x[i]) > v) {         st.erase(*st.begin());       }       while (st.size() && abs(*st.rbegin() - x[i]) > v) {         st.erase(*st.rbegin());       }       pos = x[i];     }     if (st.empty()) return false;     return true;   }   int main(void) {     scanf( %d%d%d , &n, &s1, &s2);     for (int i = 0; i < n; i++) {       scanf( %d , &x[i]);     }     int l = -1, r = 1000000007;     while (l + 1 < r) {       int mid = (l + r) / 2;       if (C(mid))         r = mid;       else         l = mid;     }     printf( %d n , r);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 500010;   const int LOG = 20;   const long long INF = (1ll << 60);   int n;   int a[N];   vector<int> adj[N];   int par[LOG][N];   void dfs(int u, int p) {     par[0][u] = p;     for (int i = 1; i < LOG; i++) {       par[i][u] = par[i - 1][par[i - 1][u]];     }     for (int v : adj[u]) {       if (v != p) dfs(v, u);     }   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cin >> n;     int root = -1;     for (int i = 1; i <= n; i++) {       cin >> a[i];       if (root == -1 || a[root] > a[i]) root = i;     }     for (int i = 1; i < n; i++) {       int u, v;       cin >> u >> v;       adj[u].push_back(v);       adj[v].push_back(u);     }     dfs(root, 0);     long long res = 0;     for (int i = 1; i <= n; i++) {       if (i == root) continue;       long long foo = INF;       for (int j = 0; j < LOG; j++) {         int u = par[j][i];         if (u == 0) u = root;         foo = min(foo, 1ll * a[u] * (j + 1));         if (u == root) break;       }       res += foo;       res += a[i];     }     cout << res << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   using ld = long double;   using uint = unsigned int;   using ull = unsigned long long;   mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());   double startTime;   double gct() { return ((double)clock() - startTime) / CLOCKS_PER_SEC; }   void suraj() {     int n, m;     cin >> n >> m;     vector<int> ans;     if (m % 2 == 1) {       int ref = m / 2;       int ptr = 1;       ans.push_back(ref);       while (ptr <= ref) {         ans.push_back(ref - ptr);         ans.push_back(ref + ptr);         ptr++;       }     } else {       int ref = m / 2 - 1;       int ptr = 1;       ans.push_back(ref);       while (ptr <= ref) {         ans.push_back(ref + ptr);         ans.push_back(ref - ptr);         ptr++;       }       ans.push_back(ref + ptr);     }     for (int i = 0; i < n; i++) {       cout << ans[i % m] + 1 <<   n ;     }   }   void suraj2() {}   int main() {     startTime = (double)clock();     suraj();     return 0;   }