malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const int MOD = (int)1e9 + 7;   const int INF = (int)1e9;   const long long LINF = (long long)1e18;   const long double PI = acos((long double)-1);   const long double EPS = 1e-9;   inline long long gcd(long long a, long long b) {     long long r;     while (b) {       r = a % b;       a = b;       b = r;     }     return a;   }   inline long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }   inline long long fpow(long long n, long long k, int p = MOD) {     long long r = 1;     for (; k; k >>= 1) {       if (k & 1) r = r * n % p;       n = n * n % p;     }     return r;   }   template <class T>   inline int chkmin(T& a, const T& val) {     return val < a ? a = val, 1 : 0;   }   template <class T>   inline int chkmax(T& a, const T& val) {     return a < val ? a = val, 1 : 0;   }   template <class T>   inline T isqrt(T k) {     T r = sqrt(k) + 1;     while (r * r > k) r--;     return r;   }   template <class T>   inline T icbrt(T k) {     T r = cbrt(k) + 1;     while (r * r * r > k) r--;     return r;   }   inline void addmod(int& a, int val, int p = MOD) {     if ((a = (a + val)) >= p) a -= p;   }   inline void submod(int& a, int val, int p = MOD) {     if ((a = (a - val)) < 0) a += p;   }   inline int mult(int a, int b, int p = MOD) { return (long long)a * b % p; }   inline int inv(int a, int p = MOD) { return fpow(a, p - 2, p); }   int n, a, b, k;   string s;   void solve() {     cin >> n >> a >> b >> k >> s;     vector<pair<int, int> > v;     int st = -1;     for (int i = (0); i < (n); i++) {       if (s[i] ==  1 ) {         if (st != -1) {           v.push_back(make_pair(st, i - st));           st = -1;         }       } else if (st == -1) {         st = i;       }     }     if (st != -1) {       v.push_back(make_pair(st, n - st));     }     long long can = 0;     for (int i = (0); i < (int((v).size())); i++) {       can += v[i].second / b;     }     long long tot = can - a + 1;     vector<int> ans;     for (int i = 0; i < int((v).size()) && tot > 0; i++) {       int st = v[i].first;       int len = v[i].second;       for (int j = st; tot > 0 && j + b - 1 <= st + len - 1; j += b) {         ans.push_back(j + b - 1);         tot--;       }     }     cout << int((ans).size()) <<   n ;     for (int i = (0); i < (int((ans).size())); i++)       cout << ans[i] + 1 <<    n [i == int((ans).size()) - 1];   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 3000 + 10;   int ans[maxn][maxn];   int N, M, K;   set<pair<pair<int, int>, int> > seti;   queue<pair<int, int> > qu;   vector<int> ve[maxn];   pair<int, int> prv[maxn][maxn];   void BFS() {     ans[0][0] = 1;     prv[0][0] = make_pair(0, 0);     qu.push(make_pair(0, 0));     while (qu.size() > 0) {       pair<int, int> id = qu.front();       qu.pop();       for (int i = 0; i < ve[id.second].size(); i++) {         if (seti.find(make_pair(make_pair(id.first, id.second),                                 ve[id.second][i])) == seti.end() &&             ans[id.second][ve[id.second][i]] == 0) {           ans[id.second][ve[id.second][i]] = ans[id.first][id.second] + 1;           prv[id.second][ve[id.second][i]] = make_pair(id.first, id.second);           qu.push(make_pair(id.second, ve[id.second][i]));         }       }     }   }   int main() {     cin >> N >> M >> K;     while (M--) {       int u, v;       cin >> u >> v;       u--, v--;       ve[u].push_back(v), ve[v].push_back(u);     }     while (K--) {       int a, b, c;       cin >> a >> b >> c;       a--, b--, c--;       seti.insert(make_pair(make_pair(a, b), c));     }     BFS();     for (int i = 0; i < N; i++) ve[i].clear();     int way = 1000 * 1000 * 1000;     int fir = -1, sec = -1;     for (int i = 0; i < N; i++) {       if (ans[i][N - 1] != 0 && ans[i][N - 1] < way) {         fir = i, sec = N - 1;         way = ans[i][N - 1];       }     }     if (fir == -1) {       cout << -1;       return 0;     }     cout << way - 1 <<   n ;     vector<int> path;     while (fir != 0 && (way--) > 0) {       path.push_back(sec);       pair<int, int> prev = prv[fir][sec];       sec = prev.second;       fir = prev.first;     }     if (sec != 0) path.push_back(sec);     path.push_back(fir);     while (path.size() > 0) {       cout << path.back() + 1 <<    ;       path.pop_back();     }   }
#include <bits/stdc++.h>   const int inf = 1e9 + 7;   const int mod = 1e9 + 7;   using namespace std;   int main() {     long long N;     cin >> N;     long long cnt = 1;     long long now = 10;     while (now <= N) {       now *= 10;       cnt++;     }     long long ans = (cnt - 1) * 9;     long long n = cnt - 1;     long long sum = 0;     while (n--) {       sum = sum * 10 + 9;     }     sum = N - sum;     while (sum) {       ans += sum % 10;       sum /= 10;     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     long long int n;     char c;     cin >> n >> c;     n--;     if (n % 4 >= 2) n -= 2;     long long int ans = n / 4 * 16;     n %= 4;     ans += n * 7;     n %= 2;     if (c >=  d )       ans +=  g  - c;     else       ans += c -  a  + 4;     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int ar[100001];   int main() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     int n, cur = 0;     string s;     cin >> n;     cin >> s;     for (int i = 0; i < n; i++) {       cin >> ar[i];     }     for (int i = 0; i < 10000000; i++) {       if (s[cur] ==  < ) {         cur -= ar[cur];       } else {         cur += ar[cur];       }       if (cur < 0 || cur >= n) {         cout <<  FINITE ;         return 0;       }     }     cout <<  INFINITE ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<int> adj[200005];   vector<int> toposort;   bool color[200005];   bool visit[200005];   bool flag;   int mp[200005];   void topo(int index) {     color[index] = true;     for (int i = 0; i < adj[index].size(); i++) {       int next = adj[index][i];       if (color[next] == true) {         flag = true;         return;       }       if (!visit[next]) {         visit[next] = true;         topo(next);       }     }     color[index] = false;     toposort.push_back(index);   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     int t;     cin >> t;     while (t--) {       int n, m;       cin >> n >> m;       memset(visit, 0, sizeof(visit));       memset(color, 0, sizeof(color));       memset(mp, 0, sizeof(mp));       flag = false;       vector<int> unx;       vector<int> uny;       vector<int> dix, diy;       toposort.clear();       for (int i = 0; i < m; i++) {         int op, x, y;         cin >> op >> x >> y;         if (op == 1) {           adj[x].push_back(y);           dix.push_back(x);           diy.push_back(y);         } else {           unx.push_back(x);           uny.push_back(y);         }       }       for (int i = 1; i <= n; i++) {         if (!visit[i]) {           topo(i);         }         adj[i].clear();       }       if (flag) {         cout <<  NO  << endl;         continue;       }       reverse(toposort.begin(), toposort.end());       for (int i = 0; i < toposort.size(); i++) {         mp[toposort[i]] = i;       }       cout <<  YES  << endl;       for (int i = 0; i < dix.size(); i++) {         cout << dix[i] <<     << diy[i] << endl;       }       for (int i = 0; i < unx.size(); i++) {         if (mp[unx[i]] < mp[uny[i]]) {           cout << unx[i] <<     << uny[i] << endl;         } else {           cout << uny[i] <<     << unx[i] << endl;         }       }     }   }
#include <bits/stdc++.h>   using namespace std;   int ch[42][42][42][42], qs[42][42], ans[42][42][42][42];   int b[42][42], cou[42][42];   char a[42];   int main() {     int n, m, q, i, j, ii, jj;     scanf( %d %d %d , &n, &m, &q);     for (i = 1; i <= n; i++) {       scanf(  %s , a + 1);       for (j = 1; j <= m; j++)         if (a[j] ==  1 ) b[i][j] = 1;     }     for (i = 1; i <= n; i++) {       for (j = 1; j <= m; j++) {         qs[i][j] = b[i][j] + qs[i - 1][j] + qs[i][j - 1] - qs[i - 1][j - 1];       }     }     for (i = 1; i <= n; i++) {       for (j = 1; j <= m; j++) {         if (b[i][j] == 1) continue;         for (ii = 1; ii <= i; ii++) {           for (jj = 1; jj <= j; jj++) {             if (qs[i][j] - qs[i][jj - 1] - qs[ii - 1][j] + qs[ii - 1][jj - 1] ==                 0)               ch[i][j][ii][jj] = 1;             ch[i][j][ii][jj] += ch[i][j][ii][jj - 1];             ch[i][j][ii][jj] += ch[i][j][ii - 1][jj];             ch[i][j][ii][jj] -= ch[i][j][ii - 1][jj - 1];           }         }       }     }     for (i = 1; i <= n; i++) {       for (j = 1; j <= m; j++) {         for (ii = 1; ii <= i; ii++) {           for (jj = 1; jj <= j; jj++) {             ans[i][j][ii][jj] = ch[i][j][i][j] - ch[i][j][ii - 1][j] -                                 ch[i][j][i][jj - 1] + ch[i][j][ii - 1][jj - 1];           }         }       }     }     for (ii = 1; ii <= n; ii++) {       for (jj = 1; jj <= m; jj++) {         for (i = 1; i <= ii; i++) {           for (j = 1; j <= jj; j++) {             ans[ii][jj][i][j] += ans[ii - 1][jj][i][j];             ans[ii][jj][i][j] += ans[ii][jj - 1][i][j];             ans[ii][jj][i][j] -= ans[ii - 1][jj - 1][i][j];           }         }       }     }     while (q--) {       scanf( %d %d %d %d , &i, &j, &ii, &jj);       printf( %d n , ans[ii][jj][i][j] - ans[ii][j - 1][i][j] -                          ans[i - 1][jj][i][j] + ans[i - 1][j - 1][i][j]);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   using pii = pair<int, int>;   const int MOD = 1000000007;   vector<pii> ree;   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     int n;     cin >> n;     for (int i = (0); i < (n); i++) {       int x, v;       cin >> x >> v;       ree.push_back({x + v, x - v});     }     sort(ree.begin(), ree.end());     int cl = -2e9, a = 0;     for (int i = (0); i < (n); i++)       if (cl <= ree[i].second) cl = ree[i].first, a++;     cout << a << endl;   }
#include <bits/stdc++.h>   using namespace std;   template <typename T>   ostream& operator<<(ostream& stream, const pair<T, T>& p) {     return stream <<  (  << p.first <<  ,  << p.second <<  )  ;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int T;     cin >> T;     while (T--) {       int i, j, n;       cin >> n;       long long a[n];       for (i = 0; i < n; i++) {         cin >> a[i];       }       long long mx = a[0], mxdiff = a[0] - a[1];       for (i = 1; i < n; i++) {         if (mx - a[i] > mxdiff) mxdiff = mx - a[i];         mx = max(mx, a[i]);       }       if (mxdiff > 0)         cout << (long long)(log2f(mxdiff)) + 1 <<   n ;       else         cout << 0 <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5 + 10;   int a[maxn];   vector<int> b;   int n;   void get_input() { cin >> n; }   void solve() {     for (int i = 0; i < n; i++) {       cin >> a[i];       b.push_back(a[i]);     }     sort(b.begin(), b.begin() + n);     int cnt = 0;     for (int i = 0; i < n; i++) {       if (b[i] != a[i]) {         cnt++;       }     }     cout << (cnt > 2 ?  NO  :  YES );   }   void output() {}   int main() {     ios ::sync_with_stdio(0), cin.tie(0), cout.tie(0);     int t = 1;     while (t--) {       get_input(), solve(), output();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   inline int read() {     int x = 0, f = 1;     char ch = getchar();     while (!isdigit(ch)) {       if (ch ==  - ) f = -1;       ch = getchar();     }     while (isdigit(ch)) {       x = x * 10 + ch - 48;       ch = getchar();     }     return x * f;   }   int n, m, W;   int w[100010], b[100010];   int f[1010];   vector<int> v[1010];   int find(int x) {     if (x == f[x]) return x;     f[x] = find(f[x]);     return f[x];   }   int dp[1010];   int main() {     n = read(), m = read(), W = read();     for (int i = 1; i <= n; ++i) w[i] = read();     for (int i = 1; i <= n; ++i) b[i] = read();     for (int i = 1; i <= n; ++i) f[i] = i;     for (int i = 1; i <= m; ++i) {       int u = read(), v = read();       f[find(u)] = find(v);     }     int tot = n;     for (int i = 1; i <= n; ++i) v[find(i)].push_back(i);     for (int i = 1; i <= n; ++i) {       int len = v[i].size() - 1;       int ww = 0, bb = 0;       if (len < 0) continue;       for (int j = 0; j <= len; ++j) ww += w[v[i][j]], bb += b[v[i][j]];       if (len > 0) {         if (ww > W) continue;         v[i].push_back(++tot);         w[tot] = ww, b[tot] = bb;       }     }     for (int i = 1; i <= n; ++i) {       int len = v[i].size() - 1;       if (len < 0) continue;       for (int j = W; j >= 0; --j) {         for (int k = 0; k <= len; ++k) {           int x = v[i][k];           if (j >= w[x]) dp[j] = max(dp[j], dp[j - w[x]] + b[x]);         }       }     }     int ans = 0;     for (int i = 1; i <= W; ++i) ans = max(ans, dp[i]);     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long int power(long long int base, long long int exp) {     long long int res = 1;     base = base % 1000000007;     while (exp) {       if (exp & 1) res = (res * base) % 1000000007;       base = (base * base) % 1000000007;       exp >>= 1;     }     return res;   }   int main() {     long long int n;     scanf( %lld , &n);     if (n == 0)       printf( 1 n );     else       printf( %lld n , power(2, n - 1) * (power(2, n) + 1) % 1000000007);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     int n;     cin >> n;     ;     vector<int> a(n);     int m = 1000;     for (__typeof(0) i = 0; i < n; i++) {       cin >> a[i];       m = min(a[i], m);     }     int minc = 0;     for (__typeof(0) i = 0; i < n; i++) minc += (a[i] == m);     if (minc > n / 2)       cout <<  Bob n ;     else       cout <<  Alice n ;     return 0;   }
#include <bits/stdc++.h>   char now[100], s[20][100];   int ans, n, m, a[20];   bool check() {     for (int i = 1; i <= m; i++) {       int sum = 0;       for (int j = 0; j < n; j++) sum += now[j] != s[i][j];       if (sum != a[i]) return (false);     }     return (true);   }   void dfs(int x, int y) {     if (y == a[1]) {       ans += check();       return;     }     for (int i = x; i < n; i++) {       now[i] =  1  - s[1][i] +  0 ;       dfs(i + 1, y + 1);       now[i] = s[1][i];     }   }   int main() {     scanf( %d%d , &n, &m);     for (int i = 1; i <= m; i++) scanf( %s%d , s[i], &a[i]);     for (int i = 0; i < n; i++) now[i] = s[1][i];     dfs(0, 0);     printf( %d n , ans);     return (0);   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   using pii = pair<int, int>;   inline int yes(int x) { return x * 2; }   inline int no(int x) { return x * 2 + 1; }   vector<int> E1[210], E2[210];   inline void build(int x, int y) {     E1[x].push_back(y);     E2[y].push_back(x);   }   bool vis[210];   bool vis2[210];   vector<int> ord;   int scc[210];   int nid = 0;   int cho[210];   bool ok = 1;   void dfs2(int x) {     vis2[x] = 1;     for (auto i : E2[x]) {       if (!vis2[i]) dfs2(i);     }   }   void dfs1(int x) {     vis[x] = 1;     for (auto i : E1[x]) {       if (!vis[i]) dfs1(i);     }     if (!vis2[x]) {       cho[x] = 1;       dfs2(x ^ 1);       if (vis2[x]) {         ok = 0;       }     }   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     ;     int n, m;     cin >> n >> m;     for (int i = 0, a, b, c; i < m; i++) {       cin >> a >> b >> c;       if (c) {         build(yes(a), yes(b));         build(no(a), no(b));         build(no(b), no(a));         build(yes(b), yes(a));       } else {         build(no(a), yes(b));         build(no(b), yes(a));         build(yes(b), no(a));         build(yes(a), no(b));       }     }     for (int i = 1; i <= 2 * n; i++) {       if (!vis[i]) dfs1(i);     }     if (!ok) {       cout <<  Impossible n ;       return 0;     }     vector<int> ans;     for (int i = 1; i <= n; i++) {       if (cho[yes(i)] == 1) {         ans.push_back(i);       }     }     cout << ans.size() <<   n ;     for (auto i : ans) {       cout << i <<    ;     }     cout <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   int mo[10];   int main() {     int n;     scanf( %d , &n);     int a[n + 1];     for (int i = int(0); i <= int(n - 1); i++) {       scanf( %d , a + i);     }     sort(a, a + n);     a[0] = 1;     for (int i = int(1); i <= int(n - 1); i++) {       if (a[i] > a[i - 1])         a[i] = a[i - 1] + 1;       else         a[i] = a[i - 1];     }     printf( %d n , a[n - 1] + 1);   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 15;   const int maxe = 1086 * 1086 * 4;   const int mod = 1000000007;   const double eps = 1e-6;   char s[maxn][maxn];   int n = 10;   bool is_x(int x, int y) {     if (x < 0 || x >= n || y < 0 || y >= n) return false;     return s[x][y] ==  X ;   }   bool check(int x, int y) {     int cnt = 0;     for (int i = x; i < n; i++)       if (is_x(i, y))         cnt++;       else         break;     ;     for (int i = x - 1; i >= 0; i--)       if (is_x(i, y))         cnt++;       else         break;     ;     if (cnt >= 5) return true;     cnt = 0;     for (int i = y; i < n; i++)       if (is_x(x, i))         cnt++;       else         break;     ;     for (int i = y - 1; i >= 0; i--)       if (is_x(x, i))         cnt++;       else         break;     ;     if (cnt >= 5) return true;     cnt = 0;     for (int i = 0; i < n; i++)       if (is_x(x + i, y + i))         cnt++;       else         break;     ;     for (int i = -1; i >= -n; i--)       if (is_x(x + i, y + i))         cnt++;       else         break;     ;     if (cnt >= 5) return true;     cnt = 0;     for (int i = 0; i < n; i++)       if (is_x(x + i, y - i))         cnt++;       else         break;     ;     for (int i = -1; i >= -n; i--)       if (is_x(x + i, y - i))         cnt++;       else         break;     ;     if (cnt >= 5) return true;     return false;   }   int main() {     n = 10;     for (int i = 0; i < n; i++) scanf( %s , s[i]);     for (int i = 0; i < n; i++)       for (int j = 0; j < n; j++) {         if (s[i][j] ==  . ) {           s[i][j] =  X ;           if (check(i, j)) {             puts( YES );             return 0;           }           s[i][j] =  . ;         }       }     puts( NO );   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long int n, m, i, j, k, l, p = 0, q, x, y, z;     scanf( %lld %lld %lld %lld , &n, &m, &k, &l);     x = l * 2;     x = min(x, n);     i = x / 2;     for (; i >= 0; i--) {       x = i * 2;       x = n - x;       x = min(x, k);       for (j = x; j >= 0; j--) {         y = (i * 2) + j;         y = n - y;         y *= 2;         if (y <= m) p++;       }     }     printf( %lld , p);   }
#include <bits/stdc++.h>   using namespace std;   int f[305][305][305];   int p[305][305];   int main() {     int n;     scanf( %d , &n);     for (int i = 0; i < n; i++)       for (int j = 0; j < n; j++) scanf( %d , &p[i][j]);     f[0][0][0] = p[0][0];     for (int x1 = 0; x1 < n; x1++)       for (int y1 = 0; y1 < n; y1++)         if (x1 + y1 != 0)           for (int x2 = 0; x2 < n; x2++) {             f[x1][y1][x2] = -1 << 30;             int y2 = x1 + y1 - x2;             int add;             if (x1 == x2 && y1 == y2)               add = p[x1][y1];             else               add = p[x1][y1] + p[x2][y2];             if (x1 - 1 >= 0 && x2 - 1 >= 0) {               f[x1][y1][x2] = max(f[x1][y1][x2], f[x1 - 1][y1][x2 - 1] + add);             }             if (x1 - 1 >= 0 && y2 - 1 >= 0) {               f[x1][y1][x2] = max(f[x1][y1][x2], f[x1 - 1][y1][x2] + add);             }             if (y1 - 1 >= 0 && x2 - 1 >= 0) {               f[x1][y1][x2] = max(f[x1][y1][x2], f[x1][y1 - 1][x2 - 1] + add);             }             if (y1 - 1 >= 0 && y2 - 1 >= 0) {               f[x1][y1][x2] = max(f[x1][y1][x2], f[x1][y1 - 1][x2] + add);             }           }     printf( %d n , f[n - 1][n - 1][n - 1]);   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 5100;   int n, T;   int pr[MAXN], t[MAXN];   double rest[MAXN];   double dp[MAXN][MAXN];   double pw[MAXN];   int main() {     ios_base::sync_with_stdio(false);     cin >> n >> T;     for (int i = 1; i <= n; ++i) {       cin >> pr[i] >> t[i];       double mult = (100. - pr[i]) / 100.;       rest[i] = 1.;       for (int k = 1; k < t[i]; ++k) {         rest[i] *= mult;         if (rest[i] < 1e-15) {           rest[i] = 0.;         }       }     }     dp[0][0] = 1.;     for (int i = 1; i <= n; ++i) {       if (t[i] == 1) {         for (int j = 1; j <= T; ++j) {           dp[i][j] = dp[i - 1][j - 1];         }       } else {         double p = pr[i] / 100., q = 1 - p;         double cur_val = 0.;         double last_prob = p;         {           double tmp = q;           int pw = t[i] - 2;           while (pw) {             if (pw & 1) {               last_prob *= tmp;             }             pw /= 2;             tmp *= tmp;           }           if (last_prob < 1e-15) {             last_prob = 0.;           }         }         for (int j = 1, r = 0; j <= T; ++j) {           if (j > r + (t[i] - 1)) {             cur_val -= dp[i - 1][r] * last_prob;             ++r;           }           cur_val *= q;           cur_val += p * dp[i - 1][j - 1];           dp[i][j] = cur_val;           if (j >= t[i]) {             dp[i][j] += rest[i] * dp[i - 1][j - t[i]];           }           if (dp[i][j] < 1e-15) {             dp[i][j] = 0.;           }         }       }     }     double res = 0.;     for (int i = 1; i < n; ++i) {       pw[1] = 1;       double q = (100. - pr[i + 1]) / 100.;       for (int j = 2; j <= t[i + 1]; ++j) {         pw[j] = pw[j - 1] * q;         if (pw[j] < 1e-15) {           pw[j] = 0.;         }       }       for (int j = t[i + 1] + 1; j <= T; ++j) {         pw[j] = 0.;       }       for (int j = 1; j <= T; ++j) {         res += i * dp[i][j] * pw[T + 1 - j];       }     }     for (int j = 1; j <= T; ++j) {       res += n * dp[n][j];     }     cout << fixed << setprecision(10);     cout << res <<   n ;     return 0;   }