func_code_string: #include <bits/stdc++.h>   using namespace std;   inline long long mod(long long n, long long m) {     long long ret = n % m;     if (ret < 0) ret += m;     return ret;   }   long long gcd(long long a, long long b) {     return (b == 0LL ? a : gcd(b, a % b));   }   long long exp(long long a, long long b, long long m) {     if (b == 0LL) return 1LL;     if (b == 1LL) return mod(a, m);     long long k = mod(exp(a, b / 2, m), m);     if (b & 1LL) {       return mod(a * mod(k * k, m), m);     } else       return mod(k * k, m);   }   long long k;   bool ok(long long x, vector<long long>& v) {     long long cur = 0;     long long tot = 1;     long long some = 0;     for (long long i = 0; i < (long long)v.size(); i++) {       if (tot > k) return 0;       long long fim = (i == (long long)v.size() - 1) ? -1 : 0;       if (cur + v[i] + fim <= x) {         cur += v[i] + fim;       } else {         cur = v[i] + fim;         if (cur > x) return 0;         tot++;       }     }     if (tot > k) return 0;     return 1;   }   int32_t main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     ;     cin >> k;     vector<long long> v;     string s;     long long tot = 0;     while (cin >> s) {       long long tam = 0;       for (long long i = 0; i < (long long)s.size();) {         while (i < (long long)s.size() and s[i] !=  - ) {           tam++;           i++;         }         if (i < (long long)s.size()) {           tam++;           v.push_back(tam);           tam = 0;           i++;         }       }       if (tam) v.push_back(tam + 1);     }     for (long long x : v) tot += x;     long long l = 1, r = tot;     long long ans = tot;     while (l <= r) {       long long mid = (l + r) / 2;       if (ok(mid, v)) {         ans = mid;         r = mid - 1;       } else         l = mid + 1;     }     cout << ans <<   n ;   }   