malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   int main() {     int n, i, s = 0, m = 0, t;     int a[100001];     scanf( %d , &n);     for (i = 0; i < n; i++) {       scanf( %d , a + i);       s += a[i];     }     t = a[0];     if (t > m) m = t;     for (i = 1; i < n; i++) {       if (t > 0)         t += a[i];       else         t = a[i];       if (t > m) m = t;     }     printf( %d n , 2 * m - s);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 200000;   int a[N], n, m, k;   int check(int x) {     int cnt = 1, space = k;     for (int i = x; i < n; i++) {       if (a[i] <= space)         space -= a[i];       else {         if (cnt == m) return 0;         ++cnt, space = k - a[i];       }     }     return 1;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cin >> n >> m >> k;     for (int i = 0; i < n; i++) cin >> a[i];     int l = 0, r = n - 1, mid;     while (l != r) {       mid = (l + r) / 2;       check(mid) ? r = mid : l = mid + 1;     }     cout << n - l <<   n ;     return 0;   }
#include <bits/stdc++.h>   #define IOS ios::sync_with_stdio(false), cin.tie(0)   #define debug(a) cout << #a  :   << a << endl   using namespace std;   typedef long long ll;   const int N = 1010;   int a[N][N], b[N][N], mov[3], loc[3];   int main(void){       IOS;       int T; cin >> T;       while (T--){           int n, m; cin >> n >> m;           for (int i = 0; i < n; ++i){               for (int j = 0; j < n; ++j){                   cin >> a[i][j];                   a[i][j]--;               }           }           for (int i = 0; i < 3; ++i){               mov[i] = 0;               loc[i] = i;           }           string op; cin >> op;           for (int i = 0; i < m; ++i){               if (op[i] ==  D ){                   mov[0] = (mov[0] + 1) % n;               }else if (op[i] ==  U ){                   mov[0] = (mov[0] - 1 + n) % n;               }else if (op[i] ==  L ){                   mov[1] = (mov[1] - 1 + n) % n;               }else if (op[i] ==  R ){                   mov[1] = (mov[1] + 1) % n;               }else if (op[i] ==  I ){                   swap(loc[1], loc[2]), swap(mov[1], mov[2]);               }else{                   swap(loc[0], loc[2]), swap(mov[0], mov[2]);               }           }           for (int i = 0; i < n; ++i){               for (int j = 0; j < n; ++j){                   int tmp[3] = {i, j, a[i][j]}, tp[3];                   for (int k = 0; k < 3; ++k){                       tp[k] = (tmp[loc[k]] + mov[k]) % n;                   }                   b[tp[0]][tp[1]] = tp[2];                   //b[tmp[loc[0]]][tmp[loc[1]]] = tmp[loc[2]];               }           }           for (int i = 0; i < n; ++i){               for (int j = 0; j < n; ++j){                   cout << b[i][j] + 1 <<    ;               }               cout << endl;           }           cout << endl;       }       return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long int N = 200005;   const long long int mod = 1e9 + 7;   long long int n, i, j, m, k;   long long int a[N];   long long int sz[N], c[N];   long long int vis[N];   vector<long long int> g[N];   long long int ans = 0;   void dfs(long long int v, long long int p) {     vis[v] = c[v];     for (auto x : g[v]) {       if (x != p) {         dfs(x, v);         vis[v] += vis[x];       }     }     ans += min(vis[v], 2 * k - vis[v]);   }   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     cin >> n >> k;     for (i = 1; i <= 2 * k; i++) {       long long int x;       cin >> x;       c[x] = 1;     }     for (i = 1; i < n; i++) {       long long int x, y;       cin >> x >> y;       g[x].push_back(y);       g[y].push_back(x);     }     dfs(1, 0);     cout << ans;   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     int t;     cin >> t;     while (t--) {       int n;       cin >> n;       set<int> s;       for (int i = 0; i < n; i++) {         int a;         cin >> a;         s.insert(a);       }       cout << s.size() <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long Seg[3][1 << 21 + 2], X, Cnt = 1;   pair<long long, int> P[1000001];   int l_q, r_q, Len;   long long RSQ(int l, int r, int root) {     if (l > r_q || l_q > r || l > r) return 0;     if (l >= l_q && r <= r_q) return Seg[Len][root];     int mid = (r + l) / 2;     long long C1 = RSQ(l, mid, root * 2);     long long C2 = RSQ(mid + 1, r, root * 2 + 1);     return C1 + C2;   }   void Update(int l, int r, int root) {     if (l > r_q || l_q > r || l > r) return;     if (l >= l_q && r <= r_q) {       Seg[Len][root] += X;       return;     }     int mid = (r + l) / 2;     Update(l, mid, root * 2);     Update(mid + 1, r, root * 2 + 1);     Seg[Len][root] = Seg[Len][root * 2] + Seg[Len][root * 2 + 1];   }   int main() {     int n;     cin >> n;     for (int i = 0; i < n; i++) cin >> P[i].first, P[i].second = i;     sort(P, P + n);     for (int i = 0; i < n; i++) {       P[P[i].second].first = Cnt++;     }     reverse(P, P + n);     for (int i = 0; i < n; i++) {       for (int L = 0; L < 3; L++) {         l_q = 1;         r_q = P[i].first - 1;         Len = L - 1;         long long val;         if (L == 0)           val = 1;         else           val = RSQ(1, n, 1);         l_q = r_q = P[i].first;         Len = L;         X = val;         Update(1, n, 1);       }     }     cout << Seg[2][1] << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long ans;   int a[305], b[305], c[305], dp[150005], DP[150005], i, j, k, n, m, d, l, r, J,       MIN;   struct node {     int x;     int y;   };   node st[150005];   int main() {     scanf( %d%d%d , &n, &m, &d);     for (i = 1; i <= m; i++) {       scanf( %d%d%d , &a[i], &b[i], &c[i]);       ans = ans + b[i];     }     for (j = 1; j <= n; j++) dp[j] = abs(a[1] - j);     for (i = 2; i <= m; i++) {       for (j = 1; j <= n; j++) DP[j] = 1453266144;       r = 0;       l = 1;       for (j = 1; j <= n; j++) {         st[++r].x = j;         st[r].y = dp[j];         while (r > l && st[r].y < st[r - 1].y) {           r--;           st[r] = st[r + 1];         }         while (l < r && (j - st[l].x - 1) / d + 1 > c[i] - c[i - 1]) l++;         DP[j] = min(DP[j], st[l].y + abs(a[i] - j));       }       r = 0;       l = 1;       J = j;       for (j = n; j >= 1; j--) {         st[++r].x = j;         st[r].y = dp[j];         while (r > l && st[r].y < st[r - 1].y) {           r--;           st[r] = st[r + 1];         }         while (l < r && (st[l].x - j - 1) / d + 1 > c[i] - c[i - 1]) l++;         DP[j] = min(DP[j], st[l].y + abs(a[i] - j));       }       for (j = 1; j <= n; j++) dp[j] = DP[j];     }     MIN = 1453266144;     for (j = 1; j <= n; j++) MIN = min(MIN, dp[j]);     cout << ans - MIN;     return 0;   }
#include <bits/stdc++.h>   int main(void) {     int n;     while (scanf( %d , &n) != EOF) {       int k = 0, flag = 0, su;       for (int i = 9; i >= 0; i--) {         if (i == n && i != 1) continue;         if (n % i == 0) {           k = n / i;           su = i;           break;         }       }       if (flag == 0) {         printf( %d n , k);         for (int i = 0; i < k; i++) {           printf( %d , su);           if (i != k - 1) printf(   );         }         printf(  n );       }     }     return 0;   }
#include <bits/stdc++.h>   #pragma GCC optimize( Ofast,unroll-loops )   #pragma GCC target( avx,avx2,fma )   using namespace std;   template <typename T>   using vc = vector<T>;   template <typename T>   using uset = unordered_set<T>;   template <typename A, typename B>   using umap = unordered_map<A, B>;   template <typename T, typename Comp = less<T>>   using pq = priority_queue<T, vc<T>, Comp>;   template <typename T>   using minpq = pq<T, greater<T>>;   using ld = long double;   using ll = long long;   using ull = unsigned long long;   using pii = pair<int, int>;   using ppi = pair<pii, int>;   using pip = pair<int, pii>;   using vi = vc<int>;   using vii = vc<pii>;   constexpr char el =   n ;   constexpr char sp =    ;   constexpr int INF = 0x3f3f3f3f;   constexpr ll LLINF = 0x3f3f3f3f3f3f3f3fLL;   int k;   string s;   vi a{-1};   ll evan(ll x) { return x * (x + 1) / 2; }   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     cout << fixed;     cin >> k >> s;     for (int i = 0; i < s.size(); ++i)       if (s[i] ==  1 ) a.push_back(i);     a.push_back(s.size());     ll ans = 0;     if (k == 0) {       for (int i = 1; i < a.size(); ++i) ans += evan(a[i] - a[i - 1] - 1);       cout << ans;       exit(0);     }     int l = 1, r = k;     while (r + 1 < a.size()) {       ll A = a[l] - a[l - 1];       ll B = a[r + 1] - a[r];       ans += A * B;       ++l, ++r;     }     cout << ans;   }
#include <bits/stdc++.h>   using namespace std;   const int INF = 1e9 + 5;   int n, m;   vector<vector<pair<int, int>>> adj;   vector<int> dist, color;   void bfs(int v) {     queue<int> q;     q.push(v);     while (!q.empty()) {       int u = q.front();       q.pop();       for (auto it : adj[u]) {         int to = it.first;         if (color[to] == -1) {           color[to] = (it.second == 1) ? 0 : 1;         } else {           if (dist[to] == INF && color[to] == it.second) {             dist[to] = dist[u] + 1;             q.push(to);           }         }       }     }   }   int main() {     cin >> n >> m;     dist.assign(n, INF);     adj.resize(n);     color.assign(n, -1);     dist[n - 1] = 0;     for (int i = 0; i < m; ++i) {       int u, v, t;       cin >> u >> v >> t;       u--;       v--;       adj[v].push_back({u, t});     }     bfs(n - 1);     if (dist[0] == INF) {       cout << -1 <<   n ;     } else {       cout << dist[0] <<   n ;     }     for (int i = 0; i < n; ++i) {       if (color[i] == -1)         cout << 0;       else         cout << color[i];     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<long long> a;   vector<long long> dp(2001);   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL), cout.tie(NULL);     int t = 1;     long long n, k, x, temp;     2000000001LL;     while (t--) {       cin >> n >> k;       for (int i = 0; i < n; i++) {         cin >> x, a.push_back(x);       }       long long left = 0, right = 2000000000LL;       long long required = 2000000001LL;       while (left < right) {         x = (left + right) / 2LL;         required = 2000000001LL;         for (int i = 0; i < n; i++) {           dp[i] = i;           for (int j = 0; j < i; j++) {             temp = (abs(a[i] - a[j]) + i - j - 1) / (i - j);             if (temp <= x) dp[i] = min(dp[i], dp[j] + i - j - 1);           }           required = min(required, dp[i] + n - i - 1);         }         if (required > k)           left = x + 1;         else           right = x;       }       cout << left << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   string r, s, t, u;   int mini;   int main() {     int i, j, k;     cin >> r >> u;     int n, m = u.size();     mini = INT_MAX;     s =   ;     for (i = 0; i < m; i++) s.append( 0 );     s.append(r);     for (i = 0; i < m; i++) s.append( 0 );     n = s.size();     for (i = 0; i < n - m + 1; i++) {       t = s.substr(i, m);       int cont = 0;       for (k = 0; k < m; k++)         if (t[k] != u[k]) cont++;       if (mini > cont) mini = cont;     }     cout << mini << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     int p = 0, q = 0;     cin >> n;     int ar[n];     for (int i = 0; i < n; i++) {       cin >> ar[i];     }     for (int i = 0; i < n; i++) {       if (ar[i] == 5)         p++;       else         q++;     }     int r = p / 9;     if (q == 0)       cout <<  -1 ;     else if (p < 9 && q != 0)       cout <<  0 ;     else {       for (int i = 1; i <= r; i++) {         cout <<  555555555 ;       }       for (int i = 1; i <= q; i++) {         cout <<  0 ;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int M = 100100;   long long mabs(long long x) { return x < 0 ? -x : x; }   int n, m;   long long a[M], h[M];   long long q[M], c[M], qf, qs, sum;   void read() {     cin >> n >> m;     for (int i = 0; i < n; ++i) {       cin >> h[i];     }     for (int i = 0; i + 1 < n; ++i) {       a[i] = mabs(h[i + 1] - h[i]);     }   }   void ini() {     qf = qs = 0;     sum = 0;   }   void pop() {     --qf;     sum -= q[qf] * c[qf];   }   void push(long long x, long long cnt) {     assert(qs == qf || q[qf - 1] > x);     sum += x * cnt;     q[qf] = x;     c[qf] = cnt;     ++qf;   }   void add(long long x) {     long long cur = 1;     while (qs < qf && q[qf - 1] <= x) {       pop();       cur += c[qf];     }     push(x, cur);   }   long long get(long long l, long long r) {     long long ans = 0;     ini();     for (int i = l; i < r; ++i) {       add(a[i]);       ans += sum;     }     return ans;   }   void kill() {     for (int i = 0; i < m; ++i) {       int l, r;       cin >> l >> r;       --l;       --r;       cout << get(l, r) <<   n ;     }   }   int main() {     ios_base::sync_with_stdio(false);     cout.precision(13);     cout << fixed;     read();     kill();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct edge {     int src, dst;   };   int const MOD = 1000000007;   long long _MOD = 1000000009;   double EPS = 1e-9;   long long INF = LLONG_MAX / 2;   int main() {     int N, w;     cin >> N >> w;     vector<int> a(N);     for (int i = 0; i < N; i++) cin >> a[i];     vector<int> b(N);     int sum = 0;     for (int i = 0; i < N; i++) {       b[i] = (a[i] + 1) / 2;       sum += b[i];     }     if (sum > w) {       cout << -1 << endl;       return 0;     }     vector<pair<int, int> > ai(N);     for (int i = 0; i < N; i++) ai[i] = pair<int, int>(a[i], i);     sort(ai.rbegin(), ai.rend());     for (int t = 0; t < N; t++) {       int i = ai[t].second;       int d = min(a[i] - b[i], w - sum);       b[i] += d;       sum += d;     }     for (int i = 0; i < N; i++) cout << b[i] <<    ;     cout << endl;   }
#include <bits/stdc++.h>   using namespace std;   long long exp(long long a, long long n) {     if (n == 0) return 1;     long long residue = 1, result = a % 1000000007LL;     while (n > 1LL) {       if (n % 2LL == 1LL) residue = residue * result % 1000000007LL;       result = result * result % 1000000007LL;       n = n >> 1LL;     }     return residue * result % 1000000007LL;   }   void sieve(long long n, vector<bool> &isPrime) {     for (int i = 0; i <= n; i++) isPrime[i] = true;     isPrime[0] = isPrime[1] = false;     for (long long i = 2; i * i <= n; i++) {       if (!isPrime[i]) continue;       for (long long j = i * i; j <= n; j += i) {         isPrime[j] = false;       }     }   }   long long nc2(long long n) { return (n * (n - 1LL) / 2LL) % 1000000007LL; }   bool checkPal(string s) {     string t = s;     reverse(s.begin(), s.end());     if (s == t)       return true;     else       return false;   }   void rev(int i, int k, string &s) {     int last = (i + k) / 2;     for (int t = i; t <= last; t++) {       swap(s[t], s[k - (t - i)]);     }   }   int len(string &s) { return s.size(); }   vector<int> KMP_preprocessing(string test1) {     vector<int> preprocess;     int i = 0, j = 1;     preprocess.push_back(0);     int len1 = len(test1);     while (i < len1 and j < len1) {       if (test1[i] == test1[j]) {         preprocess.push_back(i + 1);         i += 1;         j += 1;       } else {         while (i != 0 and test1[i] != test1[j]) {           i = preprocess[i - 1];         }         if (test1[i] == test1[j]) {           preprocess.push_back(i + 1);           i += 1;           j += 1;         } else           preprocess.push_back(0), j += 1;       }     }     return preprocess;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL), cout.tie(NULL);     int n, k;     vector<int> a(200001);     cin >> n >> k;     for (int i = 0; i < n; i++) cin >> a[i];     priority_queue<pair<int, pair<int, int>>, vector<pair<int, pair<int, int>>>,                    greater<pair<int, pair<int, int>>>>         minq;     int last = -1;     int ans;     for (int i = 0; i < n; i++) {       if (a[i] <= -1) {         if (last != -1)           minq.push(make_pair(i - last - 1, make_pair(last + 1, i - 1)));         last = i;       }     }     if (last != -1 && minq.size() + 1 > k) {       cout << -1 << endl;       return 0;     }     k -= minq.size() + 1;     while (minq.size() > 0 &&            (minq.top().first == 0 || minq.top().second.first == 0)) {       minq.pop();     }     ans = 2 * minq.size();     while (minq.size() > 0 && minq.top().first <= k) {       ans -= 2;       k -= minq.top().first;       minq.pop();     }     if (last != -1) {       ans++;       if (k < n - last - 1) {         ans++;       }     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m, x, y;     cin >> n >> m >> x >> y;     vector<vector<int>> chessboard(n, vector<int>(m));     for (int i = 0; i < n; i++)       for (int j = 0; j < m; j++) chessboard[i][j] = 0;     cout << x <<     << y << endl;     chessboard[x - 1][y - 1] = 1;     if (chessboard[0][y - 1] == 0) cout << 1 <<     << y << endl;     chessboard[0][y - 1] = 1;     if (chessboard[0][0] == 0) cout << 1 <<     << 1 << endl;     chessboard[0][0] = 1;     int j = 0;     for (int i = 0; i < n; i++) {       if (j == m) j--;       if (j < 0) j++;       bool plus = (j == 0);       while (j >= 0 && j < m) {         if (chessboard[i][j] == 0) {           cout << i + 1 <<     << j + 1 << endl;           chessboard[i][j] = 1;         }         (plus) ? j++ : j--;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     vector<string> strs;     int n = 0;     int j = 0;     int count = 0;     cin >> n;     for (int i = 0; i < n; i++) {       if (i != 0) {         string temp =   ;         cin >> temp;       }       string str1 =   ;       string str2 =   ;       string str3 =   ;       string str4 =   ;       string str5 =   ;       string str6 =   ;       cin >> str1 >> str2;       str3 += str1.at(0);       str3 += str1.at(1);       str3 += str2.at(0);       str3 += str2.at(1);       str3 += str3;       str4 += str2.at(0);       str4 += str1.at(0);       str4 += str2.at(1);       str4 += str1.at(1);       str4 += str4;       str5 += str2.at(1);       str5 += str2.at(0);       str5 += str1.at(1);       str5 += str1.at(0);       str5 += str5;       str6 += str1.at(1);       str6 += str2.at(1);       str6 += str1.at(0);       str6 += str2.at(0);       str6 += str6;       if (i == 0) {         strs.push_back(str3);         strs.push_back(str4);         strs.push_back(str5);         strs.push_back(str6);         count++;       } else {         bool check = false;         for (int j = 0; j < strs.size(); j++) {           if (!strs[j].find(str1 + str2)) {             check = true;             break;           }         }         if (!check) {           strs.push_back(str3);           strs.push_back(str4);           strs.push_back(str5);           strs.push_back(str6);           count++;         }       }     }     cout << count << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 3e2 + 5;   int n;   long long hx, hy;   long long ux, uy;   struct line {     long long x1, y1;     long long x2, y2;     line(long long _x1, long long _y1, long long _x2, long long _y2) {       x1 = _x1;       y1 = _y1;       x2 = _x2;       y2 = _y2;     }   };   vector<line> lines;   void get_line(long long a, long long b, long long c) {     long long x1, y1;     long long x2, y2;     if (b == 0) {       x1 = -c / a;       x2 = -c / a;       y1 = -1e7;       y2 = 1e7;     }     if (a == 0) {       y1 = -c / b;       y2 = -c / b;       x1 = -1e7;       x2 = 1e7;     }     if (a != 0 && b != 0) {       x1 = -1e7;       x2 = 1e7;       y1 = (-a * x1 - c) / b;       y2 = (-a * x2 - c) / b;     }     lines.push_back(line(x1, y1, x2, y2));   }   struct point {     long long x;     long long y;     point() {       x = 0;       y = 0;     }     point(long long _x, long long _y) {       x = _x;       y = _y;     }   };   int orientation(point a, point b, point c) {     long long clockwise = (b.y - a.y) * (c.x - b.x) - (c.y - b.y) * (b.x - a.x);     if (clockwise > 0) return 1;     if (clockwise == 0) return 0;     if (clockwise < 0) return -1;   }   bool do_intersect(line a, line b) {     point a1, a2;     point b1, b2;     a1 = point(a.x1, a.y1);     a2 = point(a.x2, a.y2);     b1 = point(b.x1, b.y1);     b2 = point(b.x2, b.y2);     if ((orientation(a1, a2, b1) != orientation(a1, a2, b2)) &&         (orientation(b1, b2, a1) != orientation(b1, b2, a2)))       return true;     return false;   }   int ans;   int main() {     int i;     long long a, b, c;     cin >> hx >> hy;     cin >> ux >> uy;     cin >> n;     for (i = 1; i <= n; i++) {       scanf( %I64d%I64d%I64d , &a, &b, &c);       get_line(a, b, c);     }     line road = line(hx, hy, ux, uy);     for (i = 0; i < lines.size(); i++) {       if (do_intersect(road, lines[i])) ans++;     }     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL), cout.tie(NULL);     int n, t, num, x;     long long int ans;     cin >> n;     vector<int> vect;     vect.push_back(0);     for (int i = 0; i < n; ++i) {       cin >> x;       vect.push_back(x);     }     long long int dp[n];     dp[1] = vect[1];     t = log2(n - 1);     num = 1 + pow(2, t);     vect[num] += vect[1];     for (int i = 2; i <= n - 1; ++i) {       dp[i] = dp[i - 1] + vect[i];       t = log2(n - i);       num = i + pow(2, t);       vect[num] += vect[i];     }     for (int i = 1; i < n; ++i) cout << dp[i] << endl;     return 0;   }
#include <bits/stdc++.h>   void err() { std::cout << std::endl; }   template <typename T, typename... Args>   void err(T a, Args... args) {     std::cout << a <<    ;     err(args...);   }   template <template <typename...> class T, typename t, typename... A>   void err(const T<t> &arg, const A &...args) {     for (auto &v : arg) std::cout << v <<    ;     err(args...);   }   using namespace std;   const int N = 1e5 + 5;   void run() {     string s, t;     cin >> s >> t;     int n = s.length(), m = t.length();     vector<int> nxt(n, -1);     for (int i = 0; i < n; i++)       if (s[i] !=  . ) {         int t = 0;         for (int j = i; j < n; j++) {           if (s[j] !=  . )             ++t;           else             --t;           if (t == 0) {             nxt[i] = j;             break;           }         }       }     vector<vector<int>> dp(n + 1, vector<int>(m + 1, 0x3f3f3f3f));     dp[0][0] = 0;     for (int i = 0; i < n; i++) {       for (int j = 0; j <= m; j++) {         if (j < m && s[i] == t[j]) {           dp[i + 1][j + 1] = min(dp[i + 1][j + 1], dp[i][j]);         }         dp[i + 1][j] = min(dp[i + 1][j], dp[i][j] + 1);         if (s[i] !=  .  && nxt[i] != -1) {           dp[nxt[i] + 1][j] = min(dp[nxt[i] + 1][j], dp[i][j]);         }       }     }     cout << dp[n][m] <<   n ;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     cout << fixed << setprecision(20);     run();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long int n, k;     cin >> n >> k;     int cnt = 1;     if (k & 1)       puts( 1 );     else {       do {         k /= 2;         cnt++;       } while (k % 2 != 1);       cout << cnt;     }     return 0;   }