malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   long long a, i, high, low, mid, nstr, ninte;   int main() {     scanf( %lld , &a);     long long ans[a], str[a], inte[a], exp[a];     for (i = 0; i < a; i++) {       scanf( %lld %lld %lld , &str[i], &inte[i], &exp[i]);     }     for (i = 0; i < a; i++) {       high = exp[i];       low = 0;       ans[i] = 0;       while (low <= high) {         mid = (high + low) / 2;         nstr = str[i] + mid;         ninte = inte[i] + (exp[i] - mid);         if (nstr > ninte) {           ans[i] = (exp[i] + 1) - mid;           high = mid - 1;         } else {           low = mid + 1;         }       }     }     for (i = 0; i < a; i++) {       printf( %lld n , ans[i]);     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, a1, a2, b1, b2, k = 1, f = 0, ans = 0;     scanf( %d , &n);     while (k <= 4) {       scanf( %d%d%d%d , &a1, &a2, &b1, &b2);       if (n >= a1 + b1 || n >= a1 + b2)         ans = a1;       else if (n >= a2 + b1 || n >= a2 + b2)         ans = a2;       if (ans > 0) {         f = 1;         printf( %d %d %d , k, ans, n - ans);         break;       }       k++;     }     if (f == 0) printf( -1 );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   set<int> s;   vector<vector<int> > v;   bool ch[100005];   void go(int i) {     ch[i] = true;     int z = 0;     for (auto it : v[i]) {       if (ch[it] == false) {         z++;         go(it);       }     }     if (z == 0) {       s.insert(i);     }   }   void dynamic() {     int n;     cin >> n;     long double sum = 0;     cin >> sum;     v.resize(n + 1);     memset(ch, 0, sizeof(ch));     for (int i = 0; i < n - 1; i++) {       int x, y;       cin >> x >> y;       v[x].push_back(y);       v[y].push_back(x);     }     go(1);     int z = s.size();     if (v[1].size() == 1) {       z++;     }     sum = sum / z;     sum *= 2;     cout << setprecision(12) << sum <<   n ;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int t;     t = 1;     while (t--) {       dynamic();     }   }
#include <bits/stdc++.h>   using namespace std;   bool sortbysec(const pair<int, int> &a, const pair<int, int> &b);   long long int gcd(long long int a, long long int b);   int prime(int n);   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     long long int t = 1;     while (t--) {       long long int n, m, sum;       cin >> n >> m;       long long int a[n];       for (int i = 0; i < n; i++) cin >> a[i];       sort(a, a + n, greater<int>());       for (int k = 1; k <= n; k++) {         sum = 0;         for (int i = 0; i < n; i++) {           sum += max(0LL, a[i] - (i / k));         }         if (sum >= m) {           cout << k << endl;           break;         }       }       if (sum < m) cout << -1 << endl;     }   }   bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) {     return (a.second < b.second);   }   long long int gcd(long long int a, long long int b) {     if (b == 0) return a;     return gcd(b, a % b);   }   int prime(int n) {     int flag = 1;     for (int i = 2; i <= sqrt(n); i++) {       if (n % i == 0) {         flag = 0;         break;       }     }     return flag;   }
#include <bits/stdc++.h>   using namespace std;   const int D[8][2] = {{1, 0},  {0, 1},  {-1, 0},  {0, -1},                        {1, -1}, {-1, 1}, {-1, -1}, {1, 1}};   int N, M, K, f[600005], F[3005][6005], b[600005], tot;   int find(int x) { return x == f[x] ? x : f[x] = find(f[x]); }   bool can(int& x, int& y) {     if (!y) y = 2 * M;     if (y > 2 * M) y = 1;     return 1 <= x && x <= N && F[x][y];   }   bool check(int x, int y) {     tot++;     int xx, yy;     for (int i = 0; i < 8; i++)       if (can(xx = x + D[i][0], yy = y + D[i][1])) b[find(F[xx][yy])] = tot;     for (int i = 0; i < 8; i++)       if (can(xx = x + D[i][0], yy = y + M + D[i][1]) &&           b[find(F[xx][yy])] == tot)         return 0;     return 1;   }   void add(int x, int y, int z) {     F[x][y] = z;     for (int i = 0; i < 8; i++) {       int xx = x + D[i][0], yy = y + D[i][1];       if (can(xx, yy)) f[find(F[xx][yy])] = find(z);     }   }   void doit() {     int ans = 0;     scanf( %d%d%d , &N, &M, &K);     if (M == 1) {       puts( 0 );       return;     }     for (int i = 1; i <= 2 * K; i++) f[i] = i;     for (int i = 1, x, y; i <= K; i++) {       scanf( %d%d , &x, &y);       if (check(x, y)) add(x, y, i), add(x, y + M, i + K), ans++;     }     printf( %d n , ans);   }   int main() {     doit();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int a[3] = {0, 0, 0}, s;   int main() {     string n;     getline(cin, n);     string x;     getline(cin, x);     s = x.size();     s = (s + 1) / 2;     for (int i = 0; i < 2 * s - 1; i += 2) {       if (x[i] ==  1 ) a[0]++;       if (x[i] ==  2 ) a[1]++;       if (x[i] ==  3 ) a[2]++;     }     cout << s - max(a[0], max(a[1], a[2]));   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long int a, b, d, p, q, s, t, r;     cin >> a >> b >> d;     p = a + a + b + b;     q = a + d + b;     s = a + d + d + a;     t = b + d + d + b;     r = min(p, min(q, min(s, t)));     cout << r << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void Print() { cout << endl; }   template <typename T1, typename... T>   void Print(const T1 &t1, const T &...t) {     cout << t1 <<    ;     Print(t...);   }   template <typename T1, typename T2>   ostream &operator<<(ostream &os, const pair<T1, T2> &p) {     os <<  (  << p.first <<  ,   << p.second <<  ) ;     return os;   }   long long gcd(long long a, long long b) {     if (b) {       long long r = a % b;       a = b, b = r;     }     return a;   }   tuple<long long, long long, long long> extend_gcd(long long a, long long b) {     if (b == 0)       return make_tuple(a, 1, 0);     else {       long long g, nx, ny;       std::tie(g, nx, ny) = extend_gcd(b, a % b);       return make_tuple(g, ny, nx - (a / b) * ny);     }   }   long long fastpow(long long a, long long e, long long mod) {     if (e == 0) return 1;     if (e == 1) return a % mod;     long long t = fastpow(a, e / 2, mod);     t = t * t % mod;     if (e & 1)       return t * a % mod;     else       return t % mod;   }   const double PI = 3.14159265358979323846;   const int MOD = (int)1e9 + 7;   char s[100007], t[100007];   int n, m;   long long dp[100007], psum[100007];   vector<int> process() {     vector<int> p(2);     int last = 0;     for (int i = 2; i <= m; i++) {       while (last > 0 && t[i] != t[last + 1]) last = p[last];       if (t[i] == t[last + 1])         p.push_back(++last);       else         p.push_back(last);     }     return p;   }   int main() {     scanf( %s %s , s + 1, t + 1);     n = strlen(s + 1);     m = strlen(t + 1);     auto pre = process();     unordered_set<int> pos;     int last = 0;     for (int i = 1; i <= n; i++) {       while (last > 0 && s[i] != t[last + 1]) last = pre[last];       if (s[i] == t[last + 1]) {         last++;         if (last == m) {           pos.insert(i);           last = pre[last];         }       }     }     long long ans = 0;     last = -1;     dp[0] = 1, psum[0] = 1;     for (int i = 1; i <= n; i++) {       if (!pos.count(i) && last == -1) {         dp[i] = 1;       } else if (pos.count(i)) {         dp[i] = (psum[i - m] + dp[i - 1]) % MOD;         last = i;       } else {         dp[i] = (psum[last - m] + dp[i - 1]) % MOD;       }       psum[i] = (dp[i] + psum[i - 1]) % MOD;     }     printf( %lld n , (dp[n] + MOD - 1) % MOD);   }
#include <bits/stdc++.h>   using namespace std;   const double eps = 1e-10;   const int inf = 1000000009;   int i, j, k, m, n, l;   int ans;   int f(int n, int m) {     return n < m ? (n + (n % 2) * (m - 1)) / 2 : f(n - m, 2 * m);   }   int main() {     cin >> n;     cout << (n < 2 ? 0 : f(n - 2, 2)) << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long MAX = 100005;   const long long mod = 1000000007;   const double PI = 2 * acos(0.0);   const double EPS = 0.00000000001;   int main() {     long long n;     cin >> n;     string a, b;     cin >> a >> b;     long long OO = 0, II = 0, IO = 0, OI = 0;     for (long long i = 0; i < n; i++) {       if (a[i] ==  1  and b[i] ==  1 )         II++;       else if (a[i] ==  0  and b[i] ==  0 )         OO++;       else if (a[i] ==  1  and b[i] ==  0 )         IO++;       else if (a[i] ==  0  and b[i] ==  1 )         OI++;     }     long long ans = (OO * II) + (OI * IO) + (OO * IO);     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long N = 2e5 + 5;   long long a[N];   long long p[N];   long long size[N];   long long n;   long long root(long long v) {     if (v != p[v]) {       return p[v] = root(p[v]);     }     return v;   }   void fix(long long v, long long x) {     if (v == n + 1) return;     p[v] = v + 1;     long long r = root(p[v]);     p[v] = r;     if (size[r] + x <= a[r]) {       size[r] += x;       return;     } else {       long long excess = size[r] + x - a[r];       size[r] = a[r];       fix(r, excess);     }     return;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     cin >> n;     for (long long i = 1; i <= n; i++) {       cin >> a[i];       p[i] = i;       size[i] = 0;     }     p[n + 1] = n + 1;     long long q;     cin >> q;     while (q--) {       long long type, x, k;       cin >> type;       if (type == 1) {         cin >> k >> x;         if (size[k] + x <= a[k]) {           size[k] += x;         } else {           long long excess = size[k] + x - a[k];           size[k] = a[k];           if (k == n) continue;           fix(k, excess);         }       } else {         cin >> k;         cout << size[k] <<   n ;       }     }   }
#include <bits/stdc++.h>   using namespace std;   inline int read() {     int s = 0;     char ch = getchar();     while (!isdigit(ch)) ch = getchar();     while (isdigit(ch)) s = s * 10 + ch -  0 , ch = getchar();     return s;   }   inline char getch() {     char ch = getchar();     while (!islower(ch)) ch = getchar();     return ch;   }   const int N = 20005;   int n, m, u, v, x, y, c1, c2, ans;   int dfn[N], dep[N], fa[N], dfn_t, pos[N], ab[N];   int tag[N], len[N], type[N];   char s[N], t[N], fw[N];   vector<pair<int, char> > G[N];   void dfs(int u, int f) {     dep[u] = dep[f] + 1, fa[u] = f;     dfn[u] = ++dfn_t, pos[dfn_t] = u;     ab[dfn[u]] = dfn[f];     for (auto v : G[u]) {       if (v.first == f) continue;       fw[v.first] = v.second;       dfs(v.first, u);     }   }   int main() {     n = read(), m = read();     for (int i = 1; i < n; i++) {       u = read(), v = read();       char c = getch();       G[u].emplace_back(v, c);       G[v].emplace_back(u, c);     }     dfs(1, 0);     for (int T = 1; T <= m; T++) {       memset(s + 1, 0, n * sizeof(char));       u = x = read(), v = y = read();       c1 = c2 = 0;       while (u != v)         dep[u] > dep[v] ? (s[++c1] = fw[u], u = fa[u])                         : (t[++c2] = fw[v], v = fa[v]);       for (; c2;) s[++c1] = t[c2--];       type[dfn[x]] = len[dfn[x]] = 0, tag[dfn[x]] = T;       ans = 0;       for (int i = dfn[x]; ab[i];) {         tag[ab[i]] = T, len[ab[i]] = len[i] + 1;         type[ab[i]] =             (type[i]                  ? type[i]                  : ((fw[pos[i]] > s[len[ab[i]]]) - (fw[pos[i]] < s[len[ab[i]]])));         i = ab[i];         if (type[i] == -1 || (!type[i] && len[i] < c1)) ++ans;       }       for (int i = 2; i <= n; i++) {         if (tag[i] != T) {           len[i] = len[ab[i]] + 1;           type[i] = (type[ab[i]]                          ? type[ab[i]]                          : ((fw[pos[i]] > s[len[i]]) - (fw[pos[i]] < s[len[i]])));           if (type[i] == -1 || (!type[i] && len[i] < c1)) ++ans;         }       }       printf( %d n , ans);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e6 + 10;   int a[maxn], cnt[maxn], tmp[maxn];   int main(void) {     int n, m;     scanf( %d %d , &n, &m);     for (int i = 1; i <= n; i++) {       scanf( %d , a + i);       if (a[i] <= m) cnt[a[i]]++;     }     for (int i = 1; i <= m; i++)       for (int k = 1; k * i <= m; k++) tmp[k * i] += cnt[i];     int M = -1, p;     for (int i = 1; i <= m; i++)       if (tmp[i] > M) M = tmp[i], p = i;     printf( %d %d n , p, M);     for (int i = 1; i <= n; i++)       if (p % a[i] == 0) printf( %d  , i);     return 0;   }
#include <bits/stdc++.h>   long long int const MOD = 1000000007;   long long int const N = 1000005;   long long int const LN = 20;   long long int const inf = 8e18;   using namespace std;   long long int n, m, a[N];   vector<pair<long long int, long long int> > v[N];   struct data {     long long int d, second, prev, idx;     data(long long int d, long long int second, long long int prev,          long long int idx) {       this->d = d;       this->second = second;       this->prev = prev;       this->idx = idx;     }     bool operator<(data other) const {       if (d != other.d) return d < other.d;       if (second != other.second) return second < other.second;       if (prev != other.prev) return prev < other.prev;       if (idx != other.idx) return idx < other.idx;       return 0;     }   };   int main() {     ios::sync_with_stdio(false);     cin.tie(NULL);     long long int n, m, k;     cin >> n >> m >> k;     for (long long int i = 1; i <= m; i++) {       long long int a, b, c;       cin >> a >> b >> c;       v[a].push_back({c, b});       v[b].push_back({c, a});     }     for (long long int i = 1; i <= n; i++) sort(v[i].begin(), v[i].end());     set<pair<long long int, long long int> > st;     set<data> q;     for (long long int i = 1; i <= n; i++) {       st.insert({i, i});       q.insert(data(v[i][0].first, i, i, 0));     }     k = 2 * k;     while (!q.empty()) {       data cur = *q.begin();       q.erase(cur);       long long int nxt = v[cur.prev][cur.idx].second;       if (st.find({cur.second, nxt}) == st.end()) {         st.insert({cur.second, nxt});         k--;         if (k == 0) {           cout << cur.d <<   n ;           return 0;         }         q.insert(data(cur.d + v[nxt][0].first, cur.second, nxt, 0));       }       if (cur.idx + 1 < v[cur.prev].size())         q.insert(data(             cur.d - v[cur.prev][cur.idx].first + v[cur.prev][cur.idx + 1].first,             cur.second, cur.prev, cur.idx + 1));     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t--) {       int x;       cin >> x;       int divisor = 1;       int digits;       int ans = 0;       for (; divisor <= 9; divisor++) {         if (x / divisor == 1 && x % divisor == 0) {           digits = 1;           break;         } else if (x / divisor == 11 && x % divisor == 0) {           digits = 2;           break;         } else if (x / divisor == 111 && x % divisor == 0) {           digits = 3;           break;         } else if (x / divisor == 1111 && x % divisor == 0) {           digits = 4;           break;         }       }       ans = ans + 10 * (divisor - 1);       ans = ans + ((digits) * (digits + 1)) / 2;       cout << ans << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   set<long long> tp;   long long tmp[100002], x, y, z, t;   char ch;   int main() {     int n, k;     scanf( %d %d , &n, &k);     for (int i = 1; i <= n; i++) {       scanf( %lld%c%lld%c%lld%c%lld , &x, &ch, &y, &ch, &z, &ch, &t);       tmp[i] = t + (1 << 8) * z + (1 << 16) * y + (1 << 24) * x;     }     long long sum = 0LL;     bool mn = false;     for (int i = 31; i >= 0; i--) {       sum += (1LL << i);       tp.clear();       for (int j = 1; j <= n; j++) {         tp.insert((tmp[j] & sum));       }       if (tp.size() == k) {         int ans = 0;         for (int i = 31; i > 23; i--) {           ans = ans * 2;           if ((1LL << i) & sum) ans++;         }         printf( %d. , ans);         ans = 0;         for (int i = 23; i > 15; i--) {           ans = ans * 2;           if ((1LL << i) & sum) ans++;         }         printf( %d. , ans);         ans = 0;         for (int i = 15; i > 7; i--) {           ans = ans * 2;           if ((1LL << i) & sum) ans++;         }         printf( %d. , ans);         ans = 0;         for (int i = 7; i >= 0; i--) {           ans = ans * 2;           if ((1LL << i) & sum) ans++;         }         printf( %d , ans);         ans = 0;         mn = true;         break;       }     }     if (mn == false) printf( -1 );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     vector<int> child;     int n, k;     scanf( %d %d , &n, &k);     int *A = new int[k];     for (int i = 0; i < k; ++i) {       scanf( %d , &A[i]);     }     for (int i = 0; i < n; ++i) {       child.push_back(i + 1);     }     int count = 0;     for (int i = 0; i < k; ++i) {       count += A[i];       count = count % (n - i);       printf( %d  , child[count]);       child.erase(child.begin() + count);       if (count >= child.size()) count = 0;     }     return 0;   }
#include <bits/stdc++.h>   char g[64][64];   int h[64][64];   void conv(long long x, long long y, long long a, long long b, long long *dx,             long long *dy) {     long long k, l;     k = x - y + b * 2000000000LL;     l = x + y + a * 2000000000LL;     *dx = k / (2 * b) - 1000000000LL;     *dy = l / (2 * a) - 1000000000LL;   }   void solve(int x1, int y1, int x2, int y2, int a, int b) {     long long c, d, e, f, g, h, i;     conv(x1, y1, a, b, &c, &d);     conv(x2, y2, a, b, &e, &f);     g = c - e;     if (g < 0) g = -g;     h = d - f;     if (h < 0) h = -h;     i = g > h ? g : h;     printf( %d n , i);   }   int main() {     int i, j, u, v;     int a, b, x1, y1, x2, y2;     long long A, B;     long long k, l;     memset(g, 0, sizeof(g));     scanf( %d %d %d %d %d %d , &a, &b, &x1, &y1, &x2, &y2);     solve(x1, y1, x2, y2, a, b);     return 0;   }
#include <bits/stdc++.h>   long long k, m = 9, l, c, lc, n, md, tr = 1, fl, res;   int main() {     scanf( %lld , &k);     while (1) {       l++;       lc += m * l;       if (k - lc <= 0) {         c = k - (lc - m * l);         break;       }       m *= 10;       tr *= 10;     }     n = (c + l - 1) / l;     tr = tr + n - 1;     md = c % l;     if (md == 0) md += l;     while (1) {       res = tr % 10;       tr /= 10;       if (l - fl == md) {         printf( %lld , res);         return 0;       }       fl++;     }   }
#include <bits/stdc++.h>   using namespace std;   int n;   inline int read() {     int x = 0, f = 1;     char ch = getchar();     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) f = -1;       ch = getchar();     }     while (ch >=  0  && ch <=  9 )       x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();     return x * f;   }   inline void write(int x, char end =    ) {     char F[200];     int tmp = x > 0 ? x : -x, cnt = 0;     if (x == 0) putchar( 0 );     if (x < 0) putchar( - );     while (tmp > 0) F[cnt++] = tmp % 10 +  0 , tmp /= 10;     while (cnt > 0) putchar(F[--cnt]);     putchar(end);   }   void f(int a, int b) { write(a), write(b,   n ); }   int main() {     n = read();     if (n % 4 >= 2) return puts( NO ), 0;     puts( YES );     for (int i = 1; i < n; i += 2) {       for (int j = i + 2; j < n; j += 2)         f(i, j), f(i + 1, j + 1), f(i, j + 1), f(i + 1, j);       if (n % 4 == 1)         f(i, n), f(i, i + 1), f(i + 1, n);       else         f(i, i + 1);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e6 + 100;   const int inf = 0x7ffffff;   int a[maxn];   long long dp[maxn];   int main(void) {     int n;     scanf( %d , &n);     for (int i = 1; i <= n; i++) scanf( %d , &a[i]);     dp[0] = 0;     for (int i = 1; i <= n; i++) {       dp[i] = dp[i - 1] + 20;       int pos1 = lower_bound(a + 1, a + n + 1, a[i] - 90 + 1) - a - 1;       int pos2 = lower_bound(a + 1, a + n + 1, a[i] - 1440 + 1) - a - 1;       long long t1 = (i - pos1 + 1) * 20;       long long t2 = (i - pos2 + 1) * 20;       dp[i] = min(dp[i], dp[pos1] + min(50LL, t1));       dp[i] = min(dp[i], dp[pos2] + min(120LL, t2));       printf( %I64d n , dp[i] - dp[i - 1]);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1000005;   const int MAXN = 1e5 + 5;   const int LG = 22;   int dp[51][51][51][51];   int n;   int a[55][55];   int get(int tli, int tlj, int rbi, int rbj) {     int res = a[rbi][rbj];     if (tli > 0) res = res - a[tli - 1][rbj];     if (tlj > 0) res = res - a[rbi][tlj - 1];     if (tli > 0 && tlj > 0) res = res + a[tli - 1][tlj - 1];     return res;   }   int foo(int r1, int r2, int c1, int c2) {     if (r1 > r2 or c1 > c2) return 0;     if (dp[r1][r2][c1][c2] != -1) return dp[r1][r2][c1][c2];     int ans = (get(r1, c1, r2, c2) > 0) * max(r2 - r1 + 1, c2 - c1 + 1);     for (int i = r1; i < r2; i++) {       ans = min(ans, foo(r1, i, c1, c2) + foo(i + 1, r2, c1, c2));     }     for (int i = c1; i < c2; i++) {       ans = min(ans, foo(r1, r2, c1, i) + foo(r1, r2, i + 1, c2));     }     return dp[r1][r2][c1][c2] = ans;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     cin >> n;     string s[n];     for (int i = 0; i < n; i++) cin >> s[i];     for (int i = 0; i < n; i++) {       for (int j = 0; j < n; j++) {         if (s[i][j] ==  # ) {           a[i][j] = 1;         }       }     }     for (int i = 0; i < n; i++)       for (int j = 0; j < n; j++)         for (int ii = 0; ii < n; ii++)           for (int jj = 0; jj < n; jj++) dp[i][ii][j][jj] = -1;     for (int i = 0; i < n; i++) {       for (int j = 1; j < n; j++) {         a[i][j] += a[i][j - 1];       }     }     for (int i = 1; i < n; i++) {       for (int j = 0; j < n; j++) {         a[i][j] += a[i - 1][j];       }     }     int ans = foo(0, n - 1, 0, n - 1);     cout << ans <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   string s;   int kappa[100];   void incc(int jj) {     if (kappa[jj] > 9) {       kappa[jj + 1]++;       kappa[jj] %= 10;       incc(jj + 1);     }   }   void get_count(int a1, int a2, int a3) {     int i, j;     if (a2 - a3 == 2) {       j = 0;       for (i = a2; i >= a1; i--) {         if (!(s[i] ==  . )) {           kappa[j] += s[i] -  0 ;           if (kappa[j] > 9) {             kappa[j + 1]++;             kappa[j] %= 10;           }           j++;         }       }     } else {       j = 2;       for (i = a2; i >= a1; i--) {         if (!(s[i] ==  . )) {           kappa[j] += s[i] -  0 ;           if (kappa[j] > 9) {             kappa[j + 1]++;             kappa[j] %= 10;           }           j++;         }       }     }     incc(j);   }   int main(void) {     cout << setprecision(10);     ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);     int i, i1, q, g, flag = 0, tt;     for (i = 0; i < 100; i++) {       kappa[i] = 0;     }     double k = 0;     cin >> s;     int leng;     leng = s.length();     i = 0;     while (i < leng) {       if (flag == 0) {         if (!(( z  >= s[i]) && (s[i] >=  a ))) {           flag = 1;           q = i;         }       } else {         if (( z  >= s[i]) && (s[i] >=  a )) {           flag = 0;           g = i - 1;           get_count(q, g, tt);         }         if (s[i] ==  . ) {           tt = i;         }       }       i++;     }     get_count(q, leng - 1, tt);     for (i = 99; i > -1; i--) {       if (kappa[i] > 0) {         break;       }     }     if ((kappa[0] == 0) && (kappa[1] == 0)) {       for (i1 = i; i1 > 1; i1--) {         cout << kappa[i1];         if ((i1 % 3 == 2) && (i1 > 2)) {           cout <<  . ;         }       }     } else {       if (i > 1) {         for (i1 = i; i1 > 1; i1--) {           cout << kappa[i1];           if ((i1 % 3 == 2) && (i1 > 2)) {             cout <<  . ;           }         }         cout <<  . ;         cout << kappa[1];         cout << kappa[0];       } else {         cout <<  0. ;         cout << kappa[1];         cout << kappa[0];       }     }     return 0;   }