akhauriyash/Code-Regression huggingface dataset:
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using TP = tuple<ll,ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(18);
}
#define MAX_N 52
#define INF 1e18
ll d[MAX_N][MAX_N*MAX_N];
struct edge{ll to,cost,coin;};
vector<edge> G[MAX_N];
vector<ll> c(MAX_N),di(MAX_N);
void dij(ll s){
  priority_queue<TP,vector<TP>,greater<TP>> que;
  fill(d[0],d[MAX_N],INF);
  s = min(s,MAX_N*MAX_N-1ll);
  d[0][s] = 0;
  que.push(TP(0,-s,0));
  while(!que.empty()){
    auto [dis,coin,v]=que.top();
    que.pop();
    coin *= -1;
    coin = min(coin,MAX_N*(MAX_N-1ll));
    if(d[v][coin]<dis) continue;
    ll n_d = dis + di[v];
    ll n_coin = min(coin+c[v],MAX_N*(MAX_N-1ll));
    if(d[v][n_coin]>n_d){
      que.push(TP(n_d,-n_coin,v));
      d[v][n_coin] = n_d;
    }
    for(ll i=0;i<(ll)G[v].size();i++){
      edge e=G[v][i];
      n_coin = coin - e.coin;
      if(n_coin>=0 && d[e.to][n_coin]>dis+e.cost){
        d[e.to][n_coin] = dis+e.cost;
        que.push(TP(d[e.to][n_coin],-n_coin,e.to));
      }
    }
  }
}
ll min_d[MAX_N][MAX_N];
signed main(){
  init_io();
  ll n,m,s;
  cin >> n >> m >> s;
  vector<ll> u(m),v(m),a(m),b(m);
  for(int i=0;i<m;i++){
    cin >> u[i] >> v[i] >> a[i] >> b[i];
    u[i]--;
    v[i]--;
    G[u[i]].push_back({v[i],b[i],a[i]});
    G[v[i]].push_back({u[i],b[i],a[i]});
  }
  for(int i=0;i<n;i++){
    cin >>c[i] >> di[i];
  }
  for(int i=0;i<n;i++){
    dij(s);
  }
  for(int i=1;i<n;i++){
    ll ans = INF;
    for(int j=0;j<MAX_N*MAX_N;j++){
      ans = min(d[i][j],ans);
    }
    cout << ans << endl;
  }
}


Measured memory_bytes: 9360
#include <bits/stdc++.h>
using namespace std;

int main(){
  string S;
  cin >> S;
  	if(S.at(0)==S.at(1)&&S.at(1)==S.at(2)){
		cout << "No" << endl;
    }else{
    	cout << "Yes" << endl;
    }
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <map>
#include <vector>
#include <queue>
#define LL long long
#define PII pair<int, int>
using namespace std;
const int MAXN = 200005;
const int INF = 1e9;

struct Interval {
    int l, r;
    bool operator < (const Interval &it) const {
        return r < it.r;
    }
};

struct ST {
    int tag1[4*MAXN], tag2[4*MAXN], *pref;
    void init(int *_pref) {
        pref = _pref;
        fill(tag1, tag1 + 4 * MAXN, INF);
    }
    void make_tag(int *tag, int ql, int qr, int val, int l, int r, int idx) {
        if (ql <= l && r <= qr) {
            tag[idx] = min(tag[idx], val);
            return;
        }
        int m = (l + r) >> 1;
        if (ql <= m) make_tag(tag, ql, qr, val, l, m, idx << 1);
        if (qr >  m) make_tag(tag, ql, qr, val, m + 1, r, idx << 1 | 1);
    }
    int get(int pos, int l, int r, int idx) {
        if (pos == 0) return 0;

        int res = 0;
        while (true) {
            res = min(res, tag1[idx] + pref[pos]);
            res = min(res, tag2[idx]);

            if (l == r) break;
            int m = (l + r) >> 1;
            if (pos <= m) {
                r = m;
                idx = idx << 1;
            }
            else {
                l = m + 1;
                idx = idx << 1 | 1;
            }
        }
        return res;
    }
} tree;

int N, Q, tot, pref[MAXN];
Interval intv[MAXN];

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);

    cin >> N;
    for (int i = 1; i <= N; i++) {
        int b;
        cin >> b;
        pref[i] = pref[i - 1] + (b == 0 ? 1 : -1);
        tot += (b == 1);
    }
    tree.init(pref);

    cin >> Q;
    for (int i = 0; i < Q; i++) {
        int l, r;
        cin >> l >> r;
        intv[i] = {l, r};
    }
    sort(intv, intv + Q);

    for (int i = 0; i < Q; i++) {
        int l = intv[i].l, r = intv[i].r, minv = tree.get(l - 1, 1, N, 1);
        // cout << "At " << i << " " << l << " " << r << '\n';
        tree.make_tag(tree.tag1, l, r, minv - pref[l - 1], 1, N, 1);
        tree.make_tag(tree.tag2, r, N, minv + pref[r] - pref[l - 1], 1, N, 1);
    }

    cout << tot + tree.get(N, 1, N, 1) << '\n';
}


Measured memory_bytes: 8576
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const long long INF = 1LL << 60;
const ll MOD = 1000000007;
using pint = pair<ll, ll>;

int main(){
    ll N;
    cin >> N;
    bool check = true;
    vector<ll> t(N), x(N), y(N);
    for (int i = 0; i < N; i++) cin >> t[i] >> x[i] >> y[i];
    ll nx = 0;
    ll ny = 0;
    ll time = 0;
    for (int i = 0; i < N; i++) {
      time = t[i] - time;
      ll sum = abs(x[i] - nx) + abs(y[i] - ny);
      if(sum==0 && time%2==0)continue;
      else if(sum==0){
        check = false;
        break;
      }
      if (time%2 != sum%2) check = false;
      if (time < sum) check = false;
      nx = x[i];
      ny = y[i];
      time = t[i];
    }
    if(check) cout << "Yes" << endl;
    else
      cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 5552
using System;
using System.Linq;

class Program {
  static void Main() {
    var k = Console.ReadLine().Split().Select(int.Parse).ToArray()[1];
    var s = Console.ReadLine();
    Console.WriteLine(s.Substring(0, k - 1) + char.ToLower(s[k - 1]) + s.Substring(k));
  }
}

Measured memory_bytes: 11220
h, w = map(int,input().split())

sList = []
for i in range(h):
  sList.append(input())

for i in range(w-1+2):
  print("#",end="")
print("#")

for i in range(h):
  print("#",end="")
  print(sList[i],end="")
  print("#")

for i in range(w-1+2):
  print("#",end="")
print("#")




Measured memory_bytes: 3060
N,K = list(map(int,input().split()))
d=[]
e=[]
f=[]
for i in range(N):
	f.append(-1)
count=0
for i in range(K):
	d.append(0)
	e.append([]*N)
	d[i]= int(input())
	e[i]=list(map(int,input().split()))


for i in range(K):
	for j in range(d[i]):

			f[e[i][j]-1] = 1
		


for i in range(N):
	if f[i] == -1:
		count +=1
print(count)
  

Measured memory_bytes: 9204
#define M 99999
T[M+1],t[M/2];main(i,j,m,a,b,p,q){
for(i=2;i<M;i++)if(!T[i])for(j=i*2;j<M;j+=i)T[j]=1;
for(i=2,j=0;i<M;i++)if(!T[i])t[j++]=i;
for(;scanf("%d%d%d",&m,&a,&b),m;printf("%d %d\n",p,q))for(i=0;;i++)if(t[i]*t[i]>m)i=-1,m--;else if(p=t[i],q=m/t[i],p*q==m&&!T[q]&&a*q<=b*p)break;
exit(0);}

Measured memory_bytes: 1028
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9+7, N = 1e6+5;
ll f[N];
int main(){
    f[0] = 1;
    f[1] = 1;
    ll sum = 2;
    for(int i = 2; i < N; ++i){
        f[i] = ((sum - f[i-2])%MOD + MOD)%MOD;
        sum = (sum+f[i])%MOD;
    }
    int n;
    cin >> n;
    //cout << f[n] << '\n';
    ll ans = f[n];
    for(int i = 0; i < n-1; ++i){
        int room = n-i-1;
        ans += (ll)(n-1)*(n-1)%MOD*f[i];
        ans += (ll)(n-room)%MOD*f[i];
        ans %= MOD;
    }
    ans += (n-1)*f[n-1];
    ans %= MOD;
    cout << ans << '\n';
}


Measured memory_bytes: 8064
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'

using namespace std;

main()
{
    fast;
    int a,i,mx=0,sum=0;
    for (i=0;i<5;i++)
    {
        cin>>a;
        if (a%10==0)
            sum+=a;
        else
        {
            mx=max(mx,10-a%10);
            sum+=(a/10+1)*10;
        }
    }
    cout<<sum-mx<<endl;
}

Measured memory_bytes: 256
N, X = gets.split.map(&:to_i)
A = gets.split.map(&:to_i).sort

x = X
ans = 0

A.each_with_index do |a, idx|
  break if a > x

  x -= a
  ans += 1

  if idx == N - 1 && x > 0
    ans -= 1
  end
end

puts ans


Measured memory_bytes: 1788
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
#define mod 1000000007
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define setA0(a) for(ull i =0;i<n;i++){a[i] = 0;}
#define aout(a) for(auto x : a){cout<<x<<' ';} // array output macro 
#define ain(a) for(ull i =0;i<n;i++){cin>>a[i];} //array input macro
#define NofSetBits(x) __builtin_popcount(x);
#define InpGrph(g,e) while(e--){ll x;ll y;cin>>x>>y ;g[x].pub(y);g[y].pub(x);}
#define FastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const ll N =1000007;
vector<bool>primes(1000007,1);


int main(){
  FastIO;
  ll n;
  cin>>n;
  ll ans =0;
  ll prev =-1;
  for(ll i=0;i<n;i++){
    ll x;
    cin>>x;
    if(i==0){
      prev = x;
    }else{
      if(x<prev){
        ans+=(prev-x);
      }
      prev = max(x,prev);
    }
  }
  cout<<ans;
  return 0;
}


Measured memory_bytes: 3756
#include<bits/stdc++.h>
#define ll long long
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
#define pb push_back
#define for0(i, n) for (int i = 0; i < n; i++)
#define for1(i, n) for (int i = 1; i <n; i++)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define bloop(i,a,b) for (int i = a ; i>=b;i--)
#define mod 1000000007
#define f first
#define sec second
#define gcd(x,y) __gcd(x, y)
using namespace std;
void solve()
{
	ll t=1;
	//cin>>t;
	while(t--)
	{
		string s;
		cin>>s;
		if(s[s.size()-1]=='s')
		cout<<s<<"es"<<endl;
		else
		cout<<s<<"s"<<endl;
	
	}
}
int main()
{
 	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int main(){
    cout << fixed << setprecision(10);
    int n,a,b;
    cin >> n >> a >> b;
    string s;
    cin >> s;
    int all = 0, kai = 0;
    rep(i,n){
        if(s[i] == 'a' && all < a+b){
            cout << "Yes" << endl;
            all++;
        }else if(s[i] == 'b' && all < a+b && kai < b){
            cout << "Yes" << endl;
            all++;
            kai++;
        }else{
            cout << "No" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3744
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Security.Policy;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const char White = '.';
    const char Black = '#';
    const long Mod = 1000000007;

    static void Main(string[] args) {
        checked {
#if DEBUG
            MyDebugger.Test(process, "../TextFile1.txt");
            //TestCaseMaker.MakeTestCase1("../TextFile2.txt");
            //MyDebugger.Test(process, "../TextFile2.txt");
#else
            object ret = process(new StreamReader(Console.OpenStandardInput()));
            Console.WriteLine(ret);
#endif
        }
    }

    static object process(TextReader input) {
        var spl = input.ReadLine().Split(' ');
        var n = int.Parse(spl[0]);
        var m = int.Parse(spl[1]);

        tbl = new HashSet<int>[n];
        for(int i=0; i<n; i++) {
            tbl[i] = new HashSet<int>();
        }

        for(int i=0; i<m; i++) {
            spl = input.ReadLine().Split(' ');
            var a = int.Parse(spl[0]) - 1;
            var b = int.Parse(spl[1]) - 1;

            if (!tbl[a].Contains(b)) tbl[a].Add(b);
            if (!tbl[b].Contains(a)) tbl[b].Add(a);
        }

        ed = new HashSet<int>();
        int max = 0;

        for(int i=0; i<n; i++) {
            if(!ed.Contains(i)) {
                int co = 0;
                Search(i, ref co);
                max = Math.Max(co, max);
            }
        }

        return max;
    }

    static HashSet<int> ed;
    static HashSet<int>[] tbl;

    static void Search(int p, ref int co) {
        ed.Add(p);
        co++;
        foreach(var ne in tbl[p]) {
            if (!ed.Contains(ne)) {
                Search(ne, ref co);
            }
        }
    }

    static long[] ToIntArray(string strs, int n) {
        var ret = new long[n];
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = long.Parse(spl[i]);
        return ret;
    }
}


Measured memory_bytes: 98220
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define sort(a)         sort((a).begin(), (a).end())
#define uniq(a)         SORT(a);(a).erase(unique((a).begin(), (a).end()), (a).end())
#define reverse(a)      reverse((a).begin(), (a).end())
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define Yes()           printf("Yes\n")
#define No()            printf("No\n")
#define YES()           printf("YES\n")
#define NO()            printf("NO\n")
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }

using namespace std;
using ll = long long;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7

void solve() {
  int n, a; cin >> n >> a;
  outl(n * n - a);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e5 + 87;
ll n, k, a[N];
ll c0, cn, cp;

ll solvene() {
  vector<ll> neg(a, a + cn);
  vector<ll> pos(a + n - cp, a + n);
  ll lo = neg[0] * pos.back();
  ll hi = neg.back() * pos[0];
  reverse(pos.begin(), pos.end());
  reverse(neg.begin(), neg.end());
  while (lo <= hi) {
    ll mi = lo + (hi - lo) / 2;
    ll cnt = 0;
    // two pointers, count all products between neg and pos
    // that are <= the candidate product mi
    // -5 -4 -3 -2 -1
    //  5  4  3  2  1
    for (ll i = 0, j = 0; i < neg.size(); ++i) {
      for (; j < pos.size() && neg[i] * pos[j] <= mi; ++j); // notice the ; here
      cnt += j;
    }
    if (cnt < k)
      lo = mi + 1;
    else
      hi = mi - 1;
}
  return lo;
}

ll solvenp(ll k) {
    vector<ll> neg(a, a + cn);
    reverse(neg.begin(), neg.end());
    vector<ll> pos(a + n - cp, a + n);
    ll lo = LLONG_MAX;
    ll hi = LLONG_MIN;
    if (neg.size() >= 2) {
        lo = min(lo, neg[0] * neg[1]);
        hi = max(hi, neg[cn - 1] * neg[cn - 2]);
    }
    if (pos.size() >= 2) {
        lo = min(lo, pos[0] * pos[1]);
        hi = max(hi, pos[cp - 1] * pos[cp - 2]);
    }
    while (lo <= hi) {
        ll mi = lo + (hi - lo) / 2;
        ll c = 0;
        // two pointers again, but for (neg * neg) and (pos * pos)
        for (ll i = cp - 1, j = 0; i >= 0; --i) {
            for (; j < i && pos[i] * pos[j] <= mi; ++j);
            c += min(j, i);
        }
        for (ll i = cn - 1, j = 0; i >= 0; --i) {
            for (; j < i && neg[i] * neg[j] <= mi; ++j);
            c += min(j, i);
        }
        if (c < k)
            lo = mi + 1;
        else
            hi = mi - 1;
    }
    return lo;
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> k;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        if (a[i] == 0)
            ++c0;
        else if (a[i] > 0)
            ++cp;
        else
            ++cn;
    }

    sort(a, a + n);
    ll ne = cn * cp;
    ll n0 = c0 * (c0 - 1) / 2 + c0 * (n - c0);
    ll np = cp * (cp - 1) / 2 + cn * (cn - 1) / 2;
    ll ans;
    if (k <= ne) {
        ans = solvene();
    } else if (k <= ne + n0) {
        ans = 0;
    } else {
        ans = solvenp(k - ne - n0);
    }
    cout << ans << "\n";
}


Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
string a;
char X[5];
int main()
{
    cin>>a;
    X[0]='Y';
    X[1]='A';
    X[2]='K';
    X[3]='I';
    int i=0;
    while(a[i]!=0){
        if(i<=3){
            if(a[i]!=X[i]){
                printf("No");
                return 0;
            }
        }
        i++;
    }
    if(i<4){
        printf("No");
        return 0;
    }
    printf("Yes");
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n,T;
    std::cin >> n >>T;
    if(n==1){
        std::cout << T << std::endl;
        return 0;
    }
    
    int t[200000];
    for (int i = 0; i < n; i++) {
        std::cin >> t[i];
    }
    long long int ans=0;
    for (int i = 1; i < n; i++) {
        ans+=min(T,t[i]-t[i-1]);
    }
    ans+=T;
    std::cout << ans << std::endl;
    return 0;
}


Measured memory_bytes: 1024
h, w = map(int, input().split())

mp = []
for _ in range(h):
  lst = list(map(int, input().split()))
  cum = []
  acc = 0
  for i in lst:
    if not i:
      acc += 1
    else:
      acc = 0
    cum.append(acc)
  mp.append(cum)
mp.append([-1] * w)
ans = 0

for i in range(w):
  stack = []

  for j in range(h + 1):
    score = mp[j][i]

    if not stack:
      stack.append((score, j))

    else:
      last_score, last_ind = stack[-1][0], stack[-1][1]
      if score > last_score:
        stack.append((score, j))
      
      elif score == last_score:
        continue
      
      else:
        while stack != [] and stack[-1][0] >= score:
          last_score, last_ind = stack.pop()
          ans = max(ans, last_score * (j - last_ind))
        stack.append((score, last_ind))

print(ans)


Measured memory_bytes: 52580
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;

int main() {
	int a, b, c; scanf("%d%d%d", &a, &b, &c);
	printf("%d\n", a + b + c - max({ a,b,c }));
}

Measured memory_bytes: 256
#include<cstdio>
int main()
{
	int n,k,ans=0,x;
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&x);
		if(x<=k/2)
			ans+=x*2;
		else
			ans+=(k-x)*2;
	}
	printf("%d\n",ans);
} 

Measured memory_bytes: 128
// Copyright (C) 2017 __debug.

// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; version 3

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program; If not, see <http://www.gnu.org/licenses/>.


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/priority_queue.hpp>

#define x first
#define y second
#define MP std::make_pair
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define DEBUG(...) fprintf(stderr, __VA_ARGS__)
#ifdef __linux__
#define getchar getchar_unlocked
#define putchar putchar_unlocked
#endif

using std::pair;
using std::vector;
using std::string;

typedef long long LL;
typedef pair<int, int> Pii;

const int oo = 0x3f3f3f3f;

template<typename T> inline bool chkmax(T &a, T b) { return a < b ? a = b, true : false; }
template<typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, true : false; }
string procStatus()
{
    std::ifstream t("/proc/self/status");
    return string(std::istreambuf_iterator<char>(t), std::istreambuf_iterator<char>());
}
template<typename T> T read(T &x)
{
    int f = 1;
    char ch = getchar();
    for (; !isdigit(ch); ch = getchar())
        f = (ch == '-' ? -1 : 1);
    for (x = 0; isdigit(ch); ch = getchar())
        x = 10 * x + ch - '0';
    return x *= f;
}
template<typename T> void write(T x)
{
    if (x == 0) {
        putchar('0');
        return;
    }
    if (x < 0) {
        putchar('-');
        x = -x;
    }
    static char s[20];
    int top = 0;
    for (; x; x /= 10)
        s[++top] = x % 10 + '0';
    while (top)
        putchar(s[top--]);
}
// EOT

int A, B, C;

void solve()
{
    int ans = 0;
    for (; ans <= 1e7 && !(A & 1) && !(B & 1) && !(C & 1); ++ans) {
        int a = (B + C) >> 1;
        int b = (A + C) >> 1;
        int c = (A + B) >> 1;
        A = a;
        B = b;
        C = c;
    }
    if (ans > 1e7)
        ans = -1;
    printf("%d\n", ans);
}

int main()
{
#ifdef __DEBUG
    freopen("A.in", "r", stdin);
    freopen("A.out", "w", stdout);
#endif

    read(A); read(B); read(C);
    solve();

    return 0;
}

// 凡是愚弱的国民，即使体格如何健全，如何茁壮，
// 也只能做毫无意义的示众的材料和看客，病死多少是不必以为不幸的。
//   --《呐喊自序》鲁迅


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))

from functools import reduce
from fractions import gcd

def lcm(x, y):
  return x * y // gcd(x, y)

l = reduce(lcm, A) - 1


ans = 0
for a in A:
  ans += (l % a)
print(ans)


Measured memory_bytes: 5272
#include<bits/stdc++.h>

using namespace std;

#define int long long
#define ar array
#define vt vector
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define sz(x) (int)(x).size()

#define F_OR(i, a, b, s) for (int i=(a); (s)>0?i<(b):i>(b); i+=(s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define FOR(...) F_ORC(__VA_ARGS__)(__VA_ARGS__)
#define EACH(x, a) for (auto& x: a)

template<class T>
bool umin(T &a, const T &b) {
    return b < a ? a = b, 1 : 0;
}

template<class T>
bool umax(T &a, const T &b) {
    return a < b ? a = b, 1 : 0;
}

template<class A>
void read(vt<A> &v);

template<class A, size_t S>
void read(ar<A, S> &a);

template<class T>
void read(T &x) {
    cin >> x;
}

void read(double &d) {
    string t;
    read(t);
    d = stod(t);
}

void read(long double &d) {
    string t;
    read(t);
    d = stold(t);
}

template<class H, class... T>
void read(H &h, T &... t) {
    read(h);
    read(t...);
}

template<class A>
void read(vt<A> &x) {
    EACH(a, x)read(a);
}

template<class A, size_t S>
void read(array<A, S> &x) {
    EACH(a, x)read(a);
}

string to_string(char c) {
    return string(1, c);
}

string to_string(bool b) {
    return b ? "true" : "false";
}

string to_string(const char *s) {
    return string(s);
}

string to_string(string s) {
    return s;
}

string to_string(vt<bool> v) {
    string res;
    FOR(sz(v))res += char('0' + v[i]);
    return res;
}

template<size_t S>
string to_string(bitset<S> b) {
    string res;
    FOR(S)res += char('0' + b[i]);
    return res;
}

template<class T>
string to_string(T v) {
    bool f = 1;
    string res;
    EACH(x, v) {
        if (!f)
            res += ' ';
        f = 0;
        res += to_string(x);
    }
    return res;
}

template<class A>
void write(A x) {
    cout << to_string(x);
}

template<class H, class... T>
void write(const H &h, const T &... t) {
    write(h);
    write(t...);
}

void print() {
    write("\n");
}

template<class H, class... T>
void print(const H &h, const T &... t) {
    write(h);
    if (sizeof...(t))
        write(' ');
    print(t...);
}

template<class T, class U>
void vti(vt<T> &v, U x, size_t n) {
    v = vt<T>(n, x);
}

template<class T, class U>
void vti(vt<T> &v, U x, size_t n, size_t m...) {
    v = vt<T>(n);
    EACH(a, v)vti(a, x, m);
}

int cmp(int a, int b) {
    if (a == b) {
        return 0;
    }
    return a < b ? -1 : 1;
}

void solve() {
    int n;
    read(n);
    vt<int> a(n);
    read(a);
    int sum = 0;
    FOR(n) {
        sum += a[i];
    }
    int ans = 1e9;
    FOR(j, -100, 101) {
        int val = 0;
        FOR(n) {
            val += (a[i] - j) * (a[i] - j);
        }
        ans = min(ans, val);
    }

    print(ans);
}

int32_t main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    int tt = 1;
//    read(tt);
    FOR(tt) {
//        write("Case #", i + 1, ": ");
        solve();
    }

}



Measured memory_bytes: 3756
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e15;

#define maxn 85
#define maxs 6400
bitset<maxs*2> f[maxn][maxn];


int main() {
  ll h,w;
  cin >> h >> w;
  mat a(h+1,vec(w+1));
  for(ll i=1;i<=h;i++) {
    for(ll j=1;j<=w;j++) {
      cin >> a[i][j];
    }
  }
  for(ll i=1;i<=h;i++) {
    for(ll j=1;j<=w;j++) {
      ll b;
      cin >> b;
      a[i][j]=abs(a[i][j]-b);
    }
  }
  f[0][1][6400]=1;
  for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			f[i][j]|=(f[i][j-1]>>a[i][j])|(f[i][j-1]<<a[i][j]);
			f[i][j]|=(f[i-1][j]>>a[i][j])|(f[i-1][j]<<a[i][j]);
		}
	}
  for(ll i=maxs;;i++) {
    if(f[h][w][i]) {
      cout << i-6400 << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 10880
#include"bits/stdc++.h"
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pii;

void Main()
{
	int n;
	cin >> n;
	cout << n/3 << endl;
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}


Measured memory_bytes: 256
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

enum inf = 1_001_001_001;
enum inf6 = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;


void main() {
    int N;
    scan(N);
    auto adj = new int[][](N*N, 0);
    auto deg = new int[](N*N);
    foreach (i ; 0 .. N) {
        auto a = readln.split.to!(int[]);
        a[] -= 1;
        foreach (j ; 0 .. N - 2) {
            int x = i, y = a[j];
            if (x > y) swap(x, y);
            int nx = i, ny = a[j + 1];
            if (nx > ny) swap(nx, ny);

            adj[N * x + y] ~= N * nx + ny;
            deg[N * nx + ny]++;
        }
    }

    debug {
        writeln(adj);
    }

    int[] next;
    auto dp = new int[](N*N);
    foreach (i ; 0 .. N*N) {
        if (deg[i] == 0) next ~= i;
    }

    while (!next.empty) {
        int[] nn;

        foreach (v ; next) {
            foreach (u ; adj[v]) {
                chmax(dp[u], dp[v] + 1);
                deg[u]--;
                if (deg[u] == 0) nn ~= u;
            }
        }

        next = nn;
    }

    debug {
        writeln(dp);
    }

    if (deg.any!"a > 0") {
        writeln(-1);
    }
    else {
        writeln(dp.reduce!max + 1);
    }
}







void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x > arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x < arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}


Measured memory_bytes: 59388
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
  int n;
  cin >> n;
  vector<ll> down(n), up(n), A(n);
  for (int i = 0; i < n; i++) cin >> A[i];

  for (int i = 0; i < n; i++) {
    if (i + A[i] < n) up[i + A[i]]++;
    if (i - A[i] > 0) down[i - A[i]]++;
  }

  ll ans = 0;
  for (int i = 0; i < n; i++) {
    ans += down[i] * up[i];
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 8004
N = int(input())

l = [0]*N
for i in range(int(N**(1/2))):
    for j in range(int(N**(1/2))):
        for k in range(int(N**(1/2))):
            a = (i+1)**2 + (j+1)**2 + (k+1)**2 + (i+1)*(j+1) + (j+1)*(k+1) + (k+1)*(i+1)
            if a > N:
                break
            l[a-1] = l[a-1] + 1

for c in range(N):
    print(l[c])

Measured memory_bytes: 9408
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = 0
ans += sum(B)
A.append(0)
C.append(0)
for i in range(N):
    if A[i] +1 == A[i+1]:
        ans += C[A[i]-1]
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF=1<<30;

int main(){
    string s;
    int n;
    cin >> s ;
    n = s.length();
    int ans = INF;
    for(int i=0;i<n-1;i++){
        if(s[i]!=s[i+1]){
            ans = min(ans,max(i+1,n-i-1));
        }
    }
    if(ans==INF){
        ans = n;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
#![allow(unused_imports)]
use std::cmp;
use std::collections::*;
use std::io::*;
use std::mem::swap;
#[allow(dead_code)]
struct Io<'a> {
    r: BufReader<StdinLock<'a>>,
    w: BufWriter<StdoutLock<'a>>,
    buf: VecDeque<String>,
    buf_str: String,
}
#[allow(dead_code)]
impl<'a> Io<'a> {
    fn r<T: std::str::FromStr>(&mut self) -> T {
        if self.buf.len() == 0 {
            self.r.read_line(&mut self.buf_str).unwrap();
            for w in self.buf_str.split_whitespace() {
                self.buf.push_back(w.to_owned());
            }
            self.buf_str.clear();
        }
        self.buf
            .pop_front()
            .unwrap()
            .parse()
            .unwrap_or_else(|_| panic!())
    }
    fn r_s(&mut self) -> String {
        if self.buf.len() == 0 {
            self.r.read_line(&mut self.buf_str).unwrap();
            for w in self.buf_str.split_whitespace() {
                self.buf.push_back(w.to_owned());
            }
            self.buf_str.clear();
        }
        self.buf.pop_front().unwrap()
    }
    fn w<T: std::fmt::Display>(&mut self, v: T) {
        write!(self.w, "{}", v).unwrap();
    }
    fn wl<T: std::fmt::Display>(&mut self, v: T) {
        writeln!(self.w, "{}", v).unwrap();
    }
    fn iter<'b, T: std::str::FromStr>(&'b mut self) -> IoIter<'a, 'b, T> {
        IoIter {
            io: self,
            p: std::marker::PhantomData,
        }
    }
}
#[allow(dead_code)]
struct IoIter<'a: 'b, 'b, T: std::str::FromStr> {
    io: &'b mut Io<'a>,
    p: std::marker::PhantomData<T>,
}
#[allow(dead_code)]
impl<'a, 'b, T: std::str::FromStr> Iterator for IoIter<'a, 'b, T> {
    type Item = T;
    fn next(&mut self) -> Option<T> {
        Some(self.io.r())
    }
}
fn main() {
    let stdin = stdin();
    let stdout = stdout();
    let r = BufReader::new(stdin.lock());
    let w = BufWriter::new(stdout.lock());
    let mut io = Io {
        r,
        w,
        buf: VecDeque::new(),
        buf_str: String::new(),
    };
    unsafe {
        problem(&mut io);
    }
}

unsafe fn problem(io: &mut Io) {
    let s: String = io.r();
    let si: Vec<usize> = s.chars().map(|c| c as usize - 48).collect();

    let mut t1 = [0u64; 2019];
    let mut t2 = [0u64; 2019];

    let mut src = &mut t1;
    let mut dest = &mut t2;

    let mut count = 0;

    for i in si {
        for j in 0..src.len() {
            dest[(j * 10 + i) % 2019] = src[j];
        }
        dest[i] += 1;
        count += dest[0];
        swap(&mut src, &mut dest);
        *dest = [0; 2019];
    }
    io.wl(count);
}


Measured memory_bytes: 4128
#include<bits/stdc++.h>
#define ll long long
using namespace std;

int main(){
    int n;
    ll a,cash=1000,stocks=0;
    cin >> n;
    vector<ll> V;
    for (int i=0;i<n;i++) {
        cin >> a;
        V.push_back(a);
    }
    V.push_back(1);
    for (int i=0;i<n;i++) {
        if (V[i+1]>=V[i]) {
            ll x=cash/V[i];
            stocks+=x;
            cash-=x*V[i];
        }
        else {
            cash+=stocks*V[i];
            stocks=0;
        }
    }
    cout << cash << endl;
}


Measured memory_bytes: 3568
import std.stdio;
import std.string;
import std.range;
import std.conv;

void main()
{
	auto ip = readln.split.to!(int[]), a = ip[0], b = ip[1];
	if(a*b%2 == 1){
		writeln("Odd");
	}else{
		writeln("Even");
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF INT_MAX
#define ll  long long
#define ull unsigned long long
#define rep(i,n) for(ll i=0; i<n; ++i)
#define FOR(i, s, e) for(ll i=s; i<e; ++i)
#define MOD 1000000007
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if(a>b) {a=b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) { if(a<b) {a=b; return true;} return false;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll A, B, K; cin >> A >> B >> K;
  
  if(A>=K) {
    cout << A-K << " " << B <<endl;
  } else if(A+B <= K) {
    cout << "0 0" <<endl;
  } else {
    cout << "0 " << A+B-K << endl;
  }
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            A();
        }

        static void A()
        {
            var x = ReadSplitInt();
            Println(x.FindIndex(value => value == 0)+1);
        }

        static List<long> ReadLines(long n)
        {
            var l = new List<long>();
            for (long i = 0; i < n; i++)
            {
                l.Add(ReadLong());
            }
            return l;
        }

        static void YESOrNO(bool e) => Println(e ? "YES" : "NO");

        static void YesOrNo(bool e) => Println(e ? "Yes" : "No");

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int SumDigits(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static long Gcd(long a, long b) => b == 0 ? a : Gcd(b, a % b);
        static long Lcm(long a, long b) => a / Gcd(a, b) * b;

        static bool IsPrime(int x)
        {
            if (x <= 1 || (x != 2 && x % 2 == 0)) return false;
            if (x == 2) return true;

            for (int i = 3; i < x; i += 2)
                if (x % i == 0) return false;

            return true;
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
        static List<long> ReadSplitLong() => Read().Split().Select(long.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());
        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}



Measured memory_bytes: 28108
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    vector<int> cnt(3, 0), upper(3);
    vector<string> s(3);
    for (int i = 0; i < 3; i++) cin >> s[i];
    for (int i = 0; i < 3; i++) upper[i] = s[i].size();

    int cur = 0;
    while (true) {
        if (cnt[cur] == upper[cur]) {
            printf("%c\n",'A' + cur);
            return 0;
        }
        int ne = s[cur][cnt[cur]] - 'a';
        cnt[cur]++;
        cur = ne;
    }
}


Measured memory_bytes: 256
#include<stdio.h>
#define MAX 100
static const int  INFTY = 10000000;

int i,j,M[MAX][MAX],e,minv,d[MAX],p[MAX],color[MAX],u,v,n,sum=0;
int prim(){
  int u,minv;
  int d[MAX],p[MAX],color[MAX];

  for(i = 0;i < n;i++){
    d[i] = INFTY;
    p[i] = -1;
    color[i] = 0;
  }

  d[0] = 0;
  while(1){
    minv = INFTY;
    u = -1;
    for(i = 0;i< n;i++){
      if(minv > d[i] && color[i] != 2){
	u = i;
	minv = d[i];
      }
    }
    if(u == -1) break;
    color[u] = 2;
    for(v = 0;v < n;v++){
      if(color[v] != 2 && M[u][v] != INFTY){
	if(d[v] > M[u][v]){
	  d[v] = M[u][v];
	  p[v] = u;
	  color[v] = 1;
	}
      }
    }
  }
  for(i=0;i<n;i++){
    if(p[i] != -1)sum += M[i][p[i]];
  }
  return sum;
}

int main(){
  scanf("%d",&n);
  for(i = 0;i < n;i++){
    for(j=0;j<n;j++){
      scanf("%d",&e);
      if(e == -1)M[i][j] = INFTY;
      else if(e != -1)M[i][j] = e;
    }
  }
  printf("%d\n",prim());

  return 0;
}

Measured memory_bytes: 636
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;

const int dx[5] = {-1, 0, 0, 0, 1};
const int dy[5] = {0, -1, 0, 1, 0};

// Self settings
// clang-format off
#define MAX_N 100000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
// clang-format on

int N;
ll A[MAX_N * 2], B[MAX_N * 2];

priority_queue<P, vector<P>, greater<P>> que;

void solve()
{
  REP(i, N) que.push(P(B[i], A[i]));
  bool f = true;
  int now = 0;
  while (!que.empty()) {
    P p = que.top();
    que.pop();
    now += p.second;
    if (now > p.first) {
      f = false;
      break;
    }
  }
  printf("%s\n", f ? "Yes" : "No");
}

int main(void)
{
  cin >> N;
  REP(i, N) cin >> A[i] >> B[i];
  solve();
  return 0;
}


Measured memory_bytes: 5620
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
using namespace std;
static const int64_t INFL = 0x3F3F3F3F3F3F3F3FLL;
typedef int64_t ll;
typedef vector<ll> vll;
struct Solution {
    void solve(std::istream& in, std::ostream& out) {
        ll N;
        in >> N;
        vll a(N);
        ll sum = 0;
        rep(i, N) {
            in >> a[i];
            sum += a[i];
        }
        ll ans = INFL;
        for (int x = -100; x <= 100; x++) {
            ll cost = 0;
            for (int i = 0; i < N; i++) {
                cost += (x - a[i]) * (x - a[i]);
            }
            ans = min(ans, cost);
        }
        out << ans << '\n';
    }
};
void solve(std::istream& in, std::ostream& out) {
    out << std::setprecision(12);
    Solution solution;
    solution.solve(in, out);
}
#include <fstream>
#include <iostream>
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    istream& in = cin;
    ostream& out = cout;
    solve(in, out);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

vector<ll> find_divisor(ll n) {
	vector<ll> divisor;
	
	ll i = 1;
	for (; i * i <= n; i++) if (n % i == 0) divisor.push_back(i);
	i--;
	if (i * i == n) i--;
	for (; i >= 1; i--) if (n % i == 0) divisor.push_back(n / i);
	
	return divisor;
}

int main() {
	ll N;
	cin >> N;
	
	vector<ll> div = find_divisor(N);
	set<ll> ss;
	
	for (ll d : div) {
		if (d <= 1) continue;
		
		vector<ll> div2 = find_divisor(d - 1);
		for (ll K : div2) {
			ll ky = N / d;
			// K^y = ky となる y が存在するか
			
			bool ok = false;
			if (K > 1) {
				ll cur = 1;
				while (cur < ky) cur *= K;
				if (cur == ky) ok = true;
			}
			if (ok) ss.insert(K);
		}
	}
	
	for (ll d : div) {
		if (d <= 1) continue;
		ll cur = N;
		while (cur % d == 0) cur /= d;
		if (cur == 1) ss.insert(d);
	}
	
	cout << ss.size() << endl;
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int main() {
    int x, y; cin >> x >> y;
    bool ok = false;
    rep(i, x+1) {
        int tsuru = 2 * i;
        int kame = 4 * (x - i);
        if (tsuru + kame == y) {
            ok = true;
            break;
        }
    }
    if (ok) cout << "Yes";
    else cout << "No";
}


Measured memory_bytes: 3544
import kotlin.math.*
import java.util.*
var countn = 0
var ans = 0
fun main() {
    val N = readLine()!!.toInt()
    for(i in 1..N){
        val D = readLine()!!.split(" ").map { it.toInt() }
        if(D[0] == D[1]){
            countn++
            if(countn == 3){
                ans = 1
                countn = 0
            }
        }
        else{
            countn = 0
        }
    }
    if(ans == 1){
        println("Yes")
    }
    else{
        println("No")
    }

}

Measured memory_bytes: 37804
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  vector<int> P(N), Q(N);
  for(int i=0; i<N; i++){
    cin>>P[i];
  }
  for(int i=0; i<N; i++){
    cin>>Q[i];
  }
  vector<int> L;
  for(int i=1; i<=N; i++){
    L.push_back(i);
  }

  int a, b, i=0;
  do{
    if(L==P)a = i;
    if(L==Q)b = i;
    i++;
  }while(next_permutation(L.begin(), L.end()));

  cout<<abs(a-b)<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>

using namespace std;

#define SZ(x) (int)(x.size())

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}


int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int n; cin >> n;
  string s; cin >> s;
  int k; cin >> k;

  char tmp = s[k-1];
  for(int i=0;i<n;++i) {
    if(s[i] == tmp) {
      cout << s[i];
    } else {
      cout << '*';
    }
  }
  cout << endl;

}


Measured memory_bytes: 256
n,x,y = map(int,input().split())
k = [0]*n
for i in range(n-1):
    for j in range(i+1,n):
        k[min(j-i,abs(x-i-1)+abs(y-j-1)+1)] += 1
            
for i in range(1,n):
    print(k[i])

Measured memory_bytes: 3444
def solve(xv_sorted):
    x = [False for _ in range(n)]
    y = [False for _ in range(n)]

    s = 0
    buf = (- 1) * float('inf')
    for i in range(n):
        s += xv_sorted[i][1]##cal 
        x[i] = max(buf, s - 2 * xv_sorted[i][0])##pos
        buf = x[i]

    ##print(x)

    s = 0
    buf = (- 1) * float('inf')
    for i in sorted(range(n), reverse=True):
        s += xv_sorted[i][1]##cal 
        y[i] = max(buf, s - (c - xv_sorted[i][0]))##pos
        buf = y[i]

    ##print(y)

    ans = max(x[n - 1], y[0])
    for i in range(n - 1):
        ans = max(ans, x[i] + y[i + 1])

    return ans

if __name__ == '__main__':
    n, c = map(int, input().split())
    xv = []
    for i in range(n):
        xv.append(list(map(int, input().split())))
    xv_sorted = sorted(xv, key=lambda x:x[0])
    ans = 0
    ans = max(ans, solve(xv_sorted))

    for i in range(n):
        xv_sorted[i][0] = abs(c - xv_sorted[i][0]) 
    xv_sorted = sorted(xv_sorted, key=lambda x:x[0])
    ans = max(ans, solve(xv_sorted))
    print(ans)

Measured memory_bytes: 40772
#include <bits/stdc++.h>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)

using namespace std;
long long N, A;

int main(void){
	//IO("test.in", "test.out");
	scanf("%lld", &N);
	for(long long i = 0; i <= N; i++)
		if(i * i <= N) A = i * i;
	printf("%lld\n", A);
}

Measured memory_bytes: 256
#include <stdio.h>
main(){
  int k,j,t,y,a[30],i,b,c,d;
  scanf("%d%d",&t,&y);
   for(i=0;i<t;i++) a[i]=i+1;
   for(i=0;i<y;i++){
     scanf("%d,%d",&b,&c);
     for(j=0;j<t;j++){
       if(j+1==b){
	 for(k=0;k<t;k++){
	   if(k+1==c){
	     d=a[j];
	     a[j]=a[k];
	     a[k]=d;
	     break;
	   }
	 }
	 break;
       }
     }
   }
   for(i=0;i<t;i++) printf("%d\n",a[i]);
  return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;

int main() {
    int N;
    cin >> N;
    int f[N];
    for (int i = 0; i < N; i++)
    {
        cin >> f[i];
    }

    int res = 0;
    while (true)
    {
        if(*max_element(f, f + N) == 0) break;
        int i = 0;
        while (i < N)
        {
            if(f[i] == 0) i++;
            else{
                res++;
                while (i < N && f[i] > 0)
                {
                    f[i]--;
                    i++;
                }
            }
        }
    }

    cout << res << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//#include<boost/multiprecision/cpp_dec_float.hpp>
//namespace mp=boost::multiprecision;
//#define mulint mp::cpp_int
//#define mulfloat mp::cpp_dec_float_100
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
constexpr int MOD=1000000007;
//constexpr int MOD=998244353;
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcountll(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
#define fi first
#define se second
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};
const int MAX_N=2e5+5;
//struct edge{lint to,num;};
//vector<int> bucket[MAX_N/1000];

int main(void){
    string S;
    cin >> S;
    int L=S.length();
    if(S[L-1]=='s') S+="es";
    else S+="s";
    cout << S << endl;
}

Measured memory_bytes: 3648