akhauriyash/Code-Regression huggingface dataset:
#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 H, N;
	cin >> H >> N;
	vector<int> A(N);
	rep(i, N) cin >> A[i];
	int ans = 0;
	rep(i, N){
		ans += A[i];
	}
	if (ans >= H) cout << "Yes" << endl;
	else cout << "No" << endl;
	//cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3732
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort()
B.sort()
C.sort()
an, bn, cn = -1, -1, 0
nf = 0
ans = [0]*N
for cn in range(N):
    flag = 0
    if cn > 0:
        ans[cn] = ans[cn-1]
    while flag == 0:
        flag = 1
        while bn < N - 1 and B[bn + 1] < C[cn]:
            bn += 1
            flag = 0
            while an < N - 1 and A[an + 1] < B[bn]:
                an += 1
            ans[cn] += an + 1
print(sum(ans))
    


Measured memory_bytes: 23328
#include <stdio.h>
#include <stdlib.h>

int cmp(const void *a, const void *b){
  int p = *(int*)a, q = *(int*)b;
  if( p > q ) { return 1; }
  else if( p == q ) { return 0; }
  else { return -1; }
}

int main(void)
{
  int a[3], i, ans = 0;
  for(i = 0; i < 3; ++i) { scanf("%d", &a[i]); }
  qsort(a, 3, sizeof(int), cmp);
  for(i = 1; i < 3; ++i) { ans += a[i] - a[i-1]; }
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define SpeeD ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define ll long long
#define endl '\n'
//pair<int, int> *p=new pair<int, int>[n];
//std::vector<pair<int,int>> vp;
//v.push_back(make_pair(x,y))
//pair<int, int> p[1000001];
//string *s=new string [n];
//int freq[e];
//freq[a[i]-'a']++; freq[a[i]]++;
 using namespace std;  
ll n,t,m,c,x,y,sum,mx,mn,avg,pos,dif,j,dis;

map<ll, ll >mp;
bool vis[(int)1e9];
bool isPrime(int x)
{
for (int i=2;i*i<=x;i++)
if (x%i==0)
return false;
return true;
}

int main(void) 
{ 
   
        SpeeD
      cin>>n;
       ll *a = new ll [n];
   
       for (int i = 0 ; i <n;i++ ){
       cin>>a[i];
       mp[a[i]]++;
     
       }
     
         for (int i=0;i<n;i++){
         if (!vis[a[i]])
   m+=(mp[a[i]]*(mp[a[i]]-1))/2;
   vis[a[i]]=true;
  
}
for (int i = 0; i <n;i++ ){
    cout<<m-mp[a[i]]+1<<endl;

}
  
     
     
}


Measured memory_bytes: 11264
#include <iostream>

using namespace std;
int A, B;

int main()
{

  cin >> A >> B;
  int m = A + B;
  if (m < A * B) {
    m = A * B;
  }
  if (m < A - B) {
    m = A - B;
  }
  cout << m << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#ifdef __LOCAL
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

#ifdef __LOCAL
    #include <filesystem>
    namespace fs = std::filesystem;
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);
static mt19937 _g(time(nullptr));
 
inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int N;
vector<ll> A;
void input(){
    fast_io();
    #ifdef __LOCAL
        fs::path p = __FILE__;
        fs::path input,output;
        input = output = p.parent_path();
        input += string("/input/") + string(p.stem()) + string(".txt");
        output += string("/output/") + string(p.stem()) + string(".txt");
        freopen(input.c_str(), "r", stdin);
        freopen(output.c_str(), "w", stdout);
    #endif
    cin >> N;
    A = fetch_vec<ll>(N);
}

ll __gcd(ll a,ll b){
    if(a>b) return __gcd(b,a);
    if(a==0) return b;
    if(a==1) return 1;
    return __gcd(b%a,a);
}

int solve(){
    ll ans=A[0];
    for (int i = 0; i < N; i++)
    {
        ans = __gcd(ans,A[i]);
    }
    cout << ans << endl;
    
    return 0;
}   

int main()
{
    input();
    solve();
    return 0;
}


Measured memory_bytes: 1024
s = gets.chomp.split("")
sr = s.reverse
flag = 0
n = s.length
#part1
if s != sr
    flag = 1
end

s1 = s[0..((n-1)/2)-1]
s1r = s1.reverse


#part2
if s1 != s1r
  flag = 1
end

s2 = s[((n+3)/2)-1..(n-1)]
s2r = s2.reverse

if s2 != s2r
  flag = 1
end

if flag == 1
  puts "No"
else
  puts "Yes"
end

Measured memory_bytes: 1788
import java.util.*;

public class Main {

    private static final int[] NS = new int[]{2, 5, 5, 4, 5, 6, 3, 7, 6};

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] A = new int[M];
        for (int m = 0; m < M; m += 1) {
            A[m] = sc.nextInt();
        }

        int[] dp = new int[N + 1];
        dp[0] = 0;
        for (int n = 1; n <= N; n += 1) {
            int next = -1;
            for (int a : A) {
                int prevDP = n - NS[a - 1];
                if (prevDP < 0) {
                    continue;
                }
                int curNext = dp[prevDP] + 1;
                if (next < curNext) {
                    next = curNext;
                }
            }
            dp[n] = next;
        }

        String integer = "";
        int curN = N;
        for (int n = 0; n < dp[N]; n += 1) {
            int curA = 0;
            for (int a : A) {
                int nextDP = curN - NS[a - 1];
                if (curA < a && nextDP >= 0) {
                    if (dp[nextDP] == (dp[curN] - 1)) {
                        curA = a;
                    }
                }
            }
            curN = curN - NS[curA - 1];
            integer += curA;
        }

        System.out.println(integer);

    }

}


Measured memory_bytes: 59604
#include <bits/stdc++.h>
using namespace std;
int x[1000005];

int main()
{
	int n;
	memset(x,0,sizeof(x));
	cin >> n;
	int a[n],max = 0;
	
	for(int i = 0;i < n;i++){
		cin >> a[i];
		if(a[i] > max) max = a[i];
		x[a[i] - 1]++;
		x[a[i]]++;
		x[a[i] + 1]++;
	}
	
	int max2 = 0;
	for(int i = 0;i <= max + 1;i++){
		if(x[i] > max2) max2 = x[i];
	}
	cout << max2;
	return 0;
}

Measured memory_bytes: 4480
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	int n=s.length();
	string w=s;
	reverse(w.begin(),w.end());
	if (w==s)
	{
		string t="";
		for (int i=0;i<(n-1)/2;i++)
			t+=s[i];
		string u=t;
		reverse(u.begin(),u.end());
		if (u==t)
		{
			string v="",x="";
			for (int i=(n+3)/2-1;i<s.length();i++)
			{
				v+=s[i];
			}
			x=v;
			reverse(x.begin(),x.end());
			if (x==v)
			{
				cout<<"Yes"<<endl;
				return 0;
			}
		}
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double r = sc.nextDouble();
        double pi = Math.PI;
        double area = pi * r * r;
        double length = 2 * pi * r;
        System.out.printf("%f %f\n", area, length);
        sc.close();
    }
}


Measured memory_bytes: 28360
#include<bits/stdc++.h>
#include <math.h>
#include <cmath>
#include <limits>
#include <iostream>
#include <assert.h>

#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=10000000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};
struct pos{
	int x,y,cost;
};
int main(){

	ll a,b,x;
	cin>>a>>b>>x;

	if(a==0)cout<<b/x+1<<endl;
	else cout<<b/x-(a-1)/x<<endl;
	return 0;

}



Measured memory_bytes: 256
/** By @ZhakudaMagzhan **/
# include  <bits/stdc++.h>

# define mp  make_pair
# define pb  push_back

# define   sz(x)  (int)x.size()
# define  all(x)  x.begin(), x.end()
# define  bit(x)  __builtin_popcountll(x)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

typedef pair <int,int> pii;

const int inf = (int) 1e9+50, mod = 999983ll;
const ll linf = (ll) 2e18;

int kob (int x, int y) { return ((ll)x * y) % mod; } 
int aza (int x, int y) { x -= y; if (x < 0) return x + mod; return x; } 
int kos (int x, int y) { x += y; if (x >= mod) return x - mod; return x; }

const int maxn = (int) 1e5 + 777, maxn2 = (int) 1e6 + 777;    

//temp.cpp

int a[maxn2];

int main () {
	#define FN "" 
	#ifdef lcl	
		freopen (FN".in", "r", stdin);
		freopen (FN".out", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); 
	int n;
	cin >> n; n *= 2;
	for (int i = 1; i <= n; ++ i) 
		cin >> a[i];

	sort (a + 1, a + n + 1);
	int res = 0;
	for (int i = 1; i <= n; i += 2)
		res += a[i];
	cout << res;
	return 0;
}

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

using namespace std;

typedef long long ll;

#define ff first
#define ss second

const int MAXN = 1e3 + 7;
const ll INF = 1e18 + 7;
const ll MOD = 1e9 + 7;
const ll P = 311;
const int BLOCK = 720;

int main() {

    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    ll n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    ll inv = 0;

    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            if (a[i] > a[j]) {
                inv++;
            }
        }
    }

    ll sum = ((k * (k - 1)) % MOD * 500000004) % MOD;

    ll ans = (inv * k) % MOD;
    for (int i = 0; i < n; i++) {
        ll t = 0;
        for (int j = 0; j < n; j++) {
            if (a[i] > a[j]) {
                t++;
            }
        }
        ans = (ans + (t * sum) % MOD) % MOD;
    }

    cout << ans;

    return 0;
}

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

#define vec                vector<int>
#define vecll              vector<ll>
#define vecd               vector<double>
#define vecst              vector<string>
#define vecb               vector<bool>
#define vec2(var, n, m)    vector<vector<int>> var(n, vector<int>(m, 0))
#define vecll2(var, n, m)  vector<vector<ll>> var(n, vector<ll>(m, 0))

#define rep(i,n)         for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n)       for(ll i=(ll)m; i<(ll)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define arrst(var, n)    vecst var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define uniqueall(v)     v.erase(unique(v.begin(), v.end()), v.end());
#define f_sum(var)       accumulate(all(var), 0)
#define f_sumll(var)     accumulate(all(var), 0LL)
#define chmin(v1, v2)    v1 = min(v1, v2)
#define chmax(v1, v2)    v1 = max(v1, v2)
#define pb(var)          push_back(var)
#define prt(var)         cout << (var) << "\n"
#define prtd(n, var)     cout << fixed << setprecision(n) << var << "\n"
#define prtfill(n, var)  cout << setw(n) << setfill('0') << var;
#define prt2(v1, v2)     cout << v1 << " " << v2 << "\n"
#define prt3(v1, v2, v3) cout << v1 << " " << v2 << " " << v3 << "\n"
#define prtall(v)        rep(i,v.size()){cout<<v[i]<<(i!=v.size()-1?" ":"\n");}
void prtok(bool ok){prt(ok ? "yes" : "no");}
//----------------------------------------------------------------

int main(void) {
  int n;
  cin >> n;
  //vector<pair<int, int>> p(n);
  vec a(n), b(n);
  rep(i,n){
    int tmp1, tmp2;
    cin >> tmp1 >> tmp2;
    a[i] = tmp1;
    b[i] = tmp2;
    //p[i] =make_pair(tmp1, tmp2);
  }
  sortall(a);
  sortall(b);

  int ans;
  if(n%2==1){
    ans = b[n/2] - a[n/2]+1;
  } else {
    int med1 = b[n/2] + b[n/2-1];
    int med2 = a[n/2] + a[n/2-1];
    //prt2(med1, med2);
    ans = med1 - med2 + 1;
  }

  prt(ans);
}


Measured memory_bytes: 4792
#include <iostream>
#include <string>

using namespace std;

int
main(int argc, const char *argv[])
{
    string x;
    while (cin >> x) {
        if (x == "0") break;
        int s = 0;
        for (auto &e : x) {
            s += e - '0';    
        }
        cout << s << endl;
    }

    return 0;
}

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

#define pb push_back
#define mp make_pair
#define sz(x) (int)(x).size()
#define ll long long
#define ld long double
#define ft first
#define sc second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define forn(i, t) for(int i = 0; i < (t); i++)
#define fore(i, f, t) for(int i = (f); i < (t); i++)
#define forr(i, f, t) for(int i = (f) - 1; i >= (t); i--)
#define all(x) (x).begin(), (x).end()
#define ins insert

const int INF = 2147483647;
const int MOD = 1000000007;
const ll INF64 = 9223372036854775807;
const ld EPS = 1e-7;

using namespace std;


int main(){
    string s;
    cin >> s;
    int n = sz(s);
    int i = -1;
    for (i = 0; i < n; i++)
        if (s[i] == 'C')
            break;
    if (i == n){
        printf("No\n");
        return 0;
    }
    for (; i < n; i++)
        if (s[i] == 'F')
            break;
    if (i == n){
        printf("No\n");
        return 0;
    }
    printf("Yes\n");
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
int main()
{
  string line;
  int a, b;
  getline (cin,line);
  stringstream(line) >> a >> b;
  cout << a*b << ' ' << 2*(a+b) << '\n';
  return 0;
}

Measured memory_bytes: 3072
// Problem : A - Don't be late
// Contest : AtCoder - AtCoder Beginner Contest 177
// URL : https://atcoder.jp/contests/abc177/tasks/abc177_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
typedef long long       ll;
#define PI                acos(-1)
#define pb                push_back
#define mp                make_pair
#define mt                make_tuple
#define all(a)            (a).begin(), (a).end()
#define clr(a,h)          memset(a, (h), sizeof(a))
#define F first
#define S second
#define fore(i,b,e)		  for(int i=(int)b;i<(int)e;++i)
#define forr(i,b,e)		  for(int i=(int)b;i<(int)e;++i)
#define deb(x)			  cerr << "# " << (#x) << " = " << (x) << endl;
#define sz(x)             (int)x.size()
int faster_in(){int r=0,c;for(c=getchar();c<=32;c=getchar());if(c=='-') return -faster_in();for(;c>32;r=(r<<1)+(r<<3)+c-'0',c=getchar());return r;}

using namespace std;

typedef pair<int, int>  ii;
typedef vector<int>     vi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
const int INF = 1234567890;

int main()
{
    std::ios::sync_with_stdio(false); cin.tie(0);
    //freopen("","r",stdin);
    //freopen("","w",stdout);
    int d, t, s;
    cin >> d >> t >> s;
    if ( d <= t*s ) {
    	cout << "Yes" << '\n';
    }
    else {
    	cout << "No" << '\n';
    }
    return 0;
}
// Dinosaurs are cool!

Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using std::cin;
using std::cout;
using std::endl;

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

using std::vector;
using std::sort;

bool odd(int x){
    return x%2==1;
}

bool male(string& s){
    return s=="Male";
}

int main(){
    int N;
    cin >> N;
    string s;

    cout << 0 << endl << std::flush;
    cin >> s;
    if(s=="Vacant"){
        return 0;
    }

    int l=0;
    int h=N;
    bool lm=male(s);

    while(true){
        int m=(l+h)/2;
        cout << m << endl << std::flush;
        cin >> s;
        if(s=="Vacant"){
            return 0;
        }
        bool mm=male(s);
        if(odd(m)==odd(l)){
            if(mm==lm){
                l=m;
            }
            else{
                h=m;
            }
        }
        else{
            if(mm!=lm){
                l=m;
                lm=mm;
            }
            else{
                h=m;
            }
        }
    }

    return 0;
}



Measured memory_bytes: 852
N, M = tuple(int(i) for i in input().split())
PY = [tuple(int(i) for i in input().split()) for j in range(M)]

iPY = [(i+1, p, y) for i, (p, y) in enumerate(PY)]
iPY.sort(key=lambda x: x[2])

def f(iPY):
    c = [0] * N
    for i, p, _y in iPY:
        c[p-1] += 1
        yield i, "{:06d}{:06d}".format(p, c[p-1])

for i, d in  sorted(list(f(iPY)), key=lambda x: x[0]):
    print(d)


Measured memory_bytes: 43976
long n,p,ans=1;
main()
{
	scanf("%ld%ld",&n,&p);
	for(long i=2;i*i<=p;i++)
	{
		long cnt=0;
		while(p%i<1)cnt++,p/=i;
		if(cnt>=n)
		{
			for(int j=0;j<cnt/n;j++)ans*=i;
		}
	}
	if(p>1&&n==1)ans*=p;
	printf("%ld\n",ans);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<ll> vi;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define sq(x) ((x)*(x))
#define fo(i,n) for(int i=0;i<n;i++)
#define fp(i,k,n) for(int i=k;i<n;i++)
#define Fo(i,n) for(int i=1;i<=n;i++)
#define all(x) x.begin(),x.end()
#define fi first
#define se second
const double pi = 3.14159265358979323846;
#define uni(c) (c).resize(unique(all(c))-(c).begin())
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL)
//pair <int, int> w[4] = {mp(-1, 0), mp(0, -1), mp(1, 0), mp(0, 1)};   // for matrix movement:
void cp()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif // ONLINE_JUDGE
}
void solve()
{
	ll a, b; cin >> a >> b;
	cout << a*b;










}
int main()
{
	fast;
	//cp();
	ll t = 1;
	//cin >> t;
	while (t--)
		solve();


	return 0;
}

Measured memory_bytes: 3656
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include<list>
#include<map>
#include<utility>
#include<tuple>
#include<numeric>
#include<set>

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(a) a.begin(),a.end()
using namespace std;

int main()
{
	int old;
	cin >> old;

	if (old == 7 || old == 5 || old == 3) {
		cout<<"YES"<<endl;

	}
	else {
		cout << "NO" << endl;
	}



}


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

int main() {
	long long n, i, j, r = 0;
	scanf("%lld", &i);
	
	if (i == 0) {
		printf("0\n");
		return 0;
	}
	
	while (i) {
		if (i > 0) {
			n = 1; j = 0;
			while (n < i) {
				n <<= 2; n += 1;
				j += 2;
			}
			i -= (1ll << j);
			r |= (1ll << j);
		}
		else {
			i = -i;
			n = 2; j = 1;
			while (n < i) {
				n <<= 2; n += 2;
				j += 2;
			}
			i = (1ll << j) - i;
			r |= (1ll << j);
		}
	}
	
	std::stack<char> s;
	while (r) {
		s.push(r & 1);
		r >>= 1;
	}
	
	while (!s.empty()) {
		printf("%c", s.top() + '0');
		s.pop();
	}
	printf("\n");
}

Measured memory_bytes: 256
n = int(input())
a = [int(s) for s in input().split()]

alice = 0
bob = 0

a.sort(reverse=True)

turn = "alice"

for p in a :
    if turn == "alice" :
        alice = alice + p
        turn = "bob"
    elif turn == "bob" :
        bob = bob + p
        turn = "alice"

print(str(alice - bob))

Measured memory_bytes: 3064
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <chrono>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

ll dp[100010][13];
const ll MOD = 1000000007;

int main() {
    string s;
    cin >> s;
    int l = s.size();
    dp[0][0] = 1;
    for (int i = 0; i < l; i++) {
        int c = (s[i] != '?' ? s[i] - '0' : -1);
        for (int j = 0; j < 10; j++) {
            if (c != -1 && c != j) continue;
            for (int k = 0; k < 13; k++) {
                dp[i + 1][(k * 10 + j) % 13] += dp[i][k];
            }
        }
        for (int j = 0; j < 13; j++) {
            dp[i + 1][j] %= MOD;
        }
    }
    cout << dp[l][5] << endl;
    return 0;
}


Measured memory_bytes: 10752
#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

using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using P = pair<int, int>;

void Main(){
    ll a, v, b, w, t; cin >> a >> v >> b >> w >> t;
    if(w >= v) {
        cout << "NO" << endl;
        return;
    }
    ll dis = abs(b-a);
    ll d = (v - w) * t;
    if(dis > d) {
        cout << "NO" << endl;
        return;
    }
    cout << "YES" << endl;
    return;
}

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

Measured memory_bytes: 3652
#include<bits/stdc++.h>
#define NILL -1
using namespace std;

typedef struct
{
  int parent;
  int r; //right sibling
  int l; //left  sibling
} TREE;

int sibling(int);
int degree(int);
int depth(int,int);
int height(int);

int n;
int h[30];
vector<TREE> t(30);

int main()
{
  int n;
  cin >> n;
  //TREE &point = t;
  
  for(int i=0;i < n;i++) t[i].parent = NILL;

  int v;
  for(int i=0;i < n;i++){
    cin >> v;
    cin >> t[v].l >> t[v].r;
    if(t[v].l != NILL) t[t[v].l].parent = v;
    if(t[v].r != NILL) t[t[v].r].parent = v;
  }
  
  for(int i=0;i < n;i++){
    printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",
	   i,t[i].parent,sibling(i),degree(i),depth(i,0),height(i));
    if(t[i].parent == NILL) printf("root\n");
    else if(t[i].l == NILL && t[i].r == NILL) printf("leaf\n");
    else printf("internal node\n");
  }
  return 0;
}

int sibling(int i)
{
  if(t[i].parent == NILL) return NILL;//root
  if(t[t[i].parent].r != i && t[t[i].parent].r != NILL) return t[t[i].parent].r;
  if(t[t[i].parent].l != i && t[t[i].parent].l != NILL) return t[t[i].parent].l;
  return -1;
}

int degree(int i)
{
  int cnt=0;
  if(t[i].l != NILL) cnt++;
  if(t[i].r != NILL) cnt++;
  return cnt;
}

int depth(int i, int di)
{
  di = 0;
  while(t[i].parent != NILL){
    i = t[i].parent;
    di++;
  }
  return di;
}

int height(int i)
{
  int h1=0,h2=0;
  if(t[i].r != NILL) h1 = height(t[i].r)+1;
  if(t[i].l != NILL) h2 = height(t[i].l)+1;
  return h[i] = (h1 > h2 ? h1:h2);
}


Measured memory_bytes: 3220
N, Q = input().strip().split()
N = int(N)
Q = int(Q)
S = input()

counts = [0 for _ in range(len(S))]
for i in range(1, len(S)):
  if S[i] == 'C' and S[i-1] == 'A':
    counts[i] = counts[i-1] + 1
  else:
    counts[i] = counts[i-1]
    
for q_i in range(Q):
  l, r = input().strip().split()
  l = int(l)-1
  r = int(r)-1  
  print(counts[r] - counts[l])

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

#define ll long long
#define d long double

#define scf(n) scanf("%d",&n)
#define lscf(n) scanf("%lld",&n)
#define dscf(n) scanf("%Lf",&n)
#define pri(n) printf("%d ",(int)n)
#define lpri(n) printf("%lld ",n)
#define dpri(n) printf("%Lf ",n)
#define prin(n) printf("%d\n",(int)n)
#define lprin(n) printf("%lld\n",n)
#define dprin(n) printf("%Lf\n",n)

#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define rep(i,ini,n) for(ll i=ini;i<(int)n;i++)
#define all(x) x.begin(),x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define bitcount(n) __builtin_popcount(n)
#define tc   int tt; scf(tt); while(tt--)
#define gcd __gcd
#define inf INT_MAX
#define ninf INT_MIN

#define pb push_back
#define mp make_pair
#define F first
#define S second
#define PI 3.14159265358979323846264

const ll M =1e9+7;
const int N = 1e6+7;



int main()
{
    int x;
    cin>>x;
    if(x==1)
    cout<<"0";
    else
    {
        cout<<"1";
    }
    
return 0;
}

Measured memory_bytes: 3580
import           Control.Monad

main :: IO ()
main = do
    [n, d] <- map read . words <$> getLine
    xs <- map (map read . words) <$> replicateM n getLine
    let ans = length [ x| x <- xs, sqrt ((x!!0)**2 + (x!!1)**2) <= fromIntegral d ]
    print ans


Measured memory_bytes: 151396
#include<stdio.h>
#include<cmath>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<complex>
#include<queue>
#include<set>
#include<utility>
#include <iomanip>
#include <limits>
#include <thread>
#include <map>
#include <stack>
#include <numeric>
#include <cassert>
#include <random>
#include <chrono>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <list>
#include <functional>
#include <bitset>
#include <tuple>

using namespace std;

template <class... A>
void prints() { cout << "\n"; }
template <class... A>
void prints_rest() { cout << "\n"; }
template <class T, class... A>
void prints_rest(const T &first, const A &... rest) { cout << " " << first; prints_rest(rest...); }
template <class T, class... A>
void prints(const T &first, const A &... rest) { cout << first; prints_rest(rest...); }

#define rep(i,n) for(int i=0; i<n; i++)
#define rep1(i,n) for(int i=1; i<n+1; i++)
#define repr(i,n) for(int i=n-1; i>=0; i--)
#define repr1(i,n) for(int i=n; i>0; i--)
#define souatari rep1(i,n-1)rep(j,i)
#define souatari1 for(int i=2; i<n+1; i++)rep1(j,i-1)

#define elif else if

typedef long long ll;
typedef vector<int>  vi;
typedef vector<vi>  vvi;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double D;


const ll llinf =  numeric_limits<ll>::max();
const int inf = numeric_limits<int>::max();
const double dinf = numeric_limits<double>::infinity();
const ll MOD = 1000000007;





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

  int n,m;
  cin >> n >> m;
  vector<pii> jobs;

  rep(i,n){
    int a,b;
    cin >> a >> b;
    jobs.push_back(make_pair(a,b));
  }

  sort(jobs.begin(),jobs.end(), greater<pii>());
  ll ans = 0;

  priority_queue<int> que;
  rep1(i,m){
    while(true){
      pii p = jobs.back();
      jobs.pop_back();
      if (p.first == i){
        que.push(p.second);
      }
      else{
        jobs.push_back(p);
        break;
      }
    }
    if(que.empty()){
      ans+=0;
    }
    else{
      ans += que.top();
      que.pop();
    }
  }

  cout <<  ans << endl;


  return 0;

}


Measured memory_bytes: 1908
n = int(input())

check = [[] for i in range(n)]
for i in range(n):
    a = int(input())
    for j in range(a):
        x,y = map(int,input().split())
        check[i].append((x,y))

def count(x,check):
    l = []
    for j in range(n):
        if ((x >> j) & 1):
            l.append(1)
        else:
            l.append(0)
    chec = True
    for i in range(n):
        if l[i] == 1:
            for k in check[i]:
                if k[1] == 1 and l[k[0]-1] == 0:
                    chec = False
                elif k[1] == 0 and l[k[0]-1] == 1:
                    chec = False
    if chec:
        return l.count(1)
    else:
        return 0

ans = 0
for i in range(2**n):
    ans = max(ans,count(i,check))
print(ans)




Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int main (){
    int a, b, i;
    for(i=0; i<3000; i++){
    cin>>a>>b;
    if(a==0&&b==0){
    return 0;
    }
    else if(b>=a){
    cout<<a<<" "<<b<<endl;
    }
    else{
    cout<<b<<" "<<a<<endl;
    }
    }
    cout<<endl;
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const int INF = 1001001001;
const int MOD = 1000000007;

template <typename T>
void print(const T &v);

int main()
{
    string S;
    cin >> S;
    cout << S[0] << S[1] << S[2] << endl;
    return 0;
}

// Use For Debug
template <typename T>
void print(T const &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << " ";
        cout << v[i];
    }
    cout << endl;
}


Measured memory_bytes: 3504
#include <bits/stdc++.h>
using namespace std;
#define ll long long
bool b[200001];
bool e[200001];
bool visited[200001];
int solve(int s) {
  if(visited[s]) {
    return 0;
  }
  visited[s] = true;
  if(e[s]) {
    return 1+solve(s+1);
  } else {
    return 1;
  }
}
int main() {
  int n;
  cin >> n;
  vector<int> p;
  for(int i=0; i<200001; i++) {
    b[i] = false;
    e[i] = false;
    visited[i] = false;
  }
  for(int i=0; i<n; i++) {
    int tmp;
    cin >> tmp;
    p.push_back(tmp);
    b[tmp] = true;
    if(b[tmp-1]) {
      e[tmp-1] = true;
    }
  }
  int m = 0;
  for(auto a: p) {
    if(!visited[a]) {
      m = max(m, solve(a));
    }
  }
  cout << (n-m) << endl;
  return 0;
}


Measured memory_bytes: 2040
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
    /*#ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif*/
        /* 
        Ofcourse it's Hard.
        It's supposed to be Hard.
        If it's easy everyone would do it.
        HARD IS WHAT MAKES IT GREAT

        YESTERDAY U SAID TOMORROW

        SLOWLY BECOMING THE PERSON I 
        SHOULD HAVE BEEN A LONG TIME AGO

        SAME TASK CAN'T BE FOUND DIFFICULT TWICE

        BTBHWSITW

        SPRH TU KAB P

        CP IS ALL ABOUT THINKING 
        YOU HAVE MUCH MORE POTENTIAL THAN U THINK

        AJIT SHIDDAT 10

        UR DAILY ROUTINE 


        */

fast();
//ll t;cin>>t;while(t--)
{
  ll n,s=0;
  cin>>n;
  for(int i=0;i<n;i++)
  {
    ll x,y;
    cin>>x>>y;
    s+=(abs(y-x)+1);
  }
  cout<<s<<endl;

    
}
return 0;
}

Measured memory_bytes: 256
const input = require("fs").readFileSync("/dev/stdin", "utf8")

;(input => {

    const lines = input.split("\n")
    const [N, K] = lines[0].split(" ").map(Number)
    const p = lines[1].split(" ").map(Number)

    p.sort((a, b) => a - b)

    let sum = 0;
    for(let i = 0; i < K; i++) {
        sum += p[i]
    }

    console.log(sum)

})(input)



Measured memory_bytes: 29740
import java.util.*;

public class Main {
    
    public static void main(String[] args) {
        Main main = new Main();
        main.solv();
    }
    
    private void solv() {
        Scanner input = new Scanner(System.in);
        
        while (true) {
            char[] cs = input.nextLine().toCharArray();
            if (cs.length <= 0 || cs[0] == '0') break;
            int sum = 0;
            for (int i = 0; i < cs.length; i++) sum += cs[i] - '0';
            System.out.println(sum);
        }
    }
}

Measured memory_bytes: 17472
#include <algorithm>
#include <cstring>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
using ll = long long;

int main() {
  string s;
  cin >> s;
  int size = s.size();
  int mid = size / 2;
  // cout << s.at(0) << s.at(2);
  if (s.size() == 3 && s.at(0) != s.at(2)) {
    // cout << s.at(0) << s.at(2);
    cout << "No";
    goto end;
  }

  for (int i = 0; i < mid; i++) {
    if (s.at(i) == s.at(mid - 1 - i) &&
        s.at(mid + 1 + i) == s.at(size - 1 - i) &&
        s.at(i) == s.at(size - 1 - i)) {
      continue;
    } else {
      cout << "No";
      goto end;
    }
  }
  cout << "Yes";
end:
  return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define LB(a,x) lb(all(a),x)-a.begin()
#define UB(a,x) ub(all(a),x)-a.begin()
#define mod 1000000007
#define FS fixed<<setprecision(15)
using namespace std;
typedef long long ll;
const double pi=3.141592653589793;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
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; }

const ll INF=1e18;

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int n,k;
    cin>>n>>k;
    V<int> a(n);
    cinf(n,a);
    sort(all(a));
    int sum=0;
    rep(i,k) sum+=a[i];
    cout<<sum<<endl;
}
//ペナルティ出しても焦らない　ACできると信じろ！！！
//どうしてもわからないときはサンプルで実験　何か見えてくるかも
//頭で考えてダメなら紙におこせ！！
/*
V,P(大文字)使用不可
乗算などの際にオーバーフローに注意せよ！
(適切にmodをとれ　にぶたんで途中で切り上げろ)
制約をよく読め！
{
    ・全探索できるなら全探索しろ
    ・異常な制約ならそこに注目
}
stringの計算量(扱い)注意
コーナー注意！(特に数値が小さいものについては要検証)
N行出力のときは'¥n'
グリッド上では行先が範囲内におさまるかif文で確認(RE注意)
if文ではちゃんと比較演算子==を使え('='でもエラー出ない)
配列(vector)の大きさが0か1以上かで場合分けせよ(RE注意)
(vector<int> a(m)でm==0というものはできない)
modはなるべく最後に取れ！
doubleを扱うときには(abs)ではなく'fabs'!!!
*/

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define x first
#define y second
#define pii pair<int, int>
#define p3i pair<pii, int>
#define pll pair<ll, ll>
#define p3l pair<pll, ll>
#define lseg L, (L+R)/2, N*2+1
#define rseg (L+R)/2+1, R, N*2+2
#define ub upper_bound
#define lb lower_bound
#define pq priority_queue
#define MN 1000000007
#define fox(k, x) for (int k=0; k<x; ++k)
#define fox1(k, x) for (int k=1; k<=x; ++k)
#define foxr(k, x) for (int k=x-1; k>=0; --k)
#define fox1r(k, x) for (int k=x; k>0; --k)
#define ms multiset
#define flood(x) memset(x, 0x3f3f3f3f, sizeof x)
#define drain(x) memset(x, 0, sizeof x)
#define rng() ((rand() << 14)+rand())
#define scan(X) do{while((X=getchar())<'0'); for(X-='0'; '0'<=(_=getchar()); X=(X<<3)+(X<<1)+_-'0');}while(0)
char _;
#define pi 3.14159265358979323846S

string s;
bool u[30];
bool un(char C){
    fox(l, s.size()){
        if (s[l]==C) return 0;
    }
    return 1;
}
int main(){
    cin >> s;
    if (s.size()<26){
        fox(l, 26){
            if (un(l+'a')){
                cout << s<< char(l+'a');
                return 0;
            }
        }
    }
    fox(l, s.size()){
        u[s[l]-'a']=1;
    }
    foxr(l, s.size()){
        u[s[l]-'a']=0;
        for(int l2=s[l]-'a'+1; l2<26; ++l2){
            if (!u[l2]){
                cout << s.substr(0, l) << char(l2+'a');
                return 0;
            }
        }
    }
    cout << -1;
    return 0;
}



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

using namespace std;

#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(a)  (a).begin(),(a).end()
using ll = long long;
using Pair = pair<int, int>;
const ll mod = 1e9 + 7;

int main(int argc, char const* argv[])
{
  int h, n;
  cin >> h >> n;

  vector<Pair> p;
  REP(i, n) {
    int a, b;
    cin >> a >> b;
    p.emplace_back(a, b);
  }

  vector<vector<int>> dp;
  vector<int> tmp(h+1, 1001001001);
  dp.push_back(tmp);
  dp[0][0] = 0;

  REP(i, n) {
    dp.push_back(tmp);
    REP(j, h+1) {
      // dp[i][j]: i番目までの魔法を使って体力jを削るときの消費魔力の最小値
      int idx_j = j-p[i].first > 0 ? j-p[i].first : 0;
      dp[i+1][j] = min(dp[i][j], dp[i+1][idx_j] + p[i].second);
      // dp[i+1][j] = min(dp[i][j], dp[i][idx_j] + p[i].second); // これだとi番目の魔法が一度しか使えない
    }
  }

  cout << dp[n][h] << endl;

  return 0;
}

Measured memory_bytes: 39424
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
typedef long long ll;
#define rep(i, a, b) for (int i = a; i <= b; ++ i)
const int maxn = 200010;
const int inf = 2000000007;
using namespace std;
int n, m, tr[2][maxn], f[maxn], fa[maxn]; 
struct epoch { int x, y, z; } a[maxn << 1];
bool cmp(epoch a, epoch b) { return a.z < b.z; }
int getfa(int x) { return fa[x] == x ? x : fa[x] = getfa(fa[x]); }
void put(int c, int x, int y) { for ( ; x <= n; x += x & (- x)) tr[c][x] = min(tr[c][x], y); }
int get(int c, int x) { int ret = inf; for ( ; x; x -= x & (- x)) ret = min(ret, tr[c][x]); return ret; }
int main() {
	scanf("%d%d", &n, &m);
	rep(i, 1, m) scanf("%d%d%d", &a[i].x, &a[i].y, &a[i].z);
	rep(i, 1, n) tr[0][i] = tr[1][i] = inf;
	rep(i, 1, m) put(0, a[i].x + 1, a[i].z - 2 * a[i].x), put(1, n - a[i].x, a[i].z - 2 * a[i].x);
	rep(i, 0, n - 1) f[i] = min(get(0, i) + 2 * i - 1, get(1, n - i) + 2 * (n + i) - 1);
	rep(i, 1, n) tr[0][i] = tr[1][i] = inf;
	rep(i, 1, m) put(0, a[i].y + 1, a[i].z - 2 * a[i].y), put(1, n - a[i].y, a[i].z - 2 * a[i].y);
	rep(i, 0, n - 1) f[i] = min(f[i], min(get(0, i) + 2 * i, get(1, n - i) + 2 * (n + i)));	
	rep(i, 0, n - 1) ++ m, a[m].x = (i - 1 + n) % n, a[m].y = i, a[m].z = f[i], fa[i] = i;
	ll ans = 0; sort(a + 1, a + m + 1, cmp);
	rep(i, 1, m) {
		int x = getfa(a[i].x), y = getfa(a[i].y);
		if (x != y) ans += a[i].z, fa[x] = y;
	}
	printf("%lld\n", ans);
	return 0;
}

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

using namespace std;

int main() {
	int x1, x2, x3, x4, x5;
	cin >> x1 >> x2 >> x3 >> x4 >> x5;

	cout << 5 * 3 - x1 - x2 - x3 -x4 -x5;
}


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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define UB upper_bound
#define LB lower_bound
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

LL a, b, c;

int main() {
	cin >> a >> b >>c;
	
	LL n = a + b + c, ans = 0;
	while(a % 2 + b % 2 + c % 2 == 0) {
		a = (n - a) / 2;
		b = (n - b) / 2;
		c = (n - c) / 2;
		ans++;
		if(ans > 1000000) { cout << -1 << endl; return 0; }
	}
	
	cout << ans << endl;
	
	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 inf3 = 1_001_001_001;
enum inf6 = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;




void main() {
    int n, d;
    scan(n, d);
    auto x = new int[][](n, d);

    foreach (i ; 0 .. n) {
        x[i] = readln.split.to!(int[]);
    }

    int ans;

    foreach (i ; 0 .. n) {
        foreach (j ; i + 1 .. n) {
            ans += isIntDist(d, x[i], x[j]);
        }
    }

    writeln(ans);
}

bool isIntDist(int d, int[] x, int[] y) {
    int dist;

    foreach (j ; 0 .. d) {
        dist += (x[j] - y[j])^^2;
    }

    auto q = sqrt(dist.to!real).to!int;

    return q^^2 == dist;
}



















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: 256
#include <bits/stdc++.h>
using namespace std;

multiset<pair<int,int>> edge[100005];
int memo[100005],f=1;

void dfs(int now)
{
	for (auto v:edge[now])
	{
		if (memo[v.first]==1000000007)
		{
			memo[v.first]=memo[now]+v.second;
			dfs(v.first);
		}
		else if (memo[now]+v.second!=memo[v.first])
		{
			f=0;
		}
	}
}

int main(int argc, char const *argv[])
{
	int n,m;
	cin>>n>>m;
	int l,r,d;
	for (int i = 0; i < m; ++i)
	{
		cin>>l>>r>>d;--l;--r;
		edge[l].insert({r,d});
		edge[r].insert({l,-d});
	}
	for (int i = 0; i < n; ++i)
	{
		memo[i]=1000000007;
	}
	for (int i = 0; i < n; ++i)
	{
		if (memo[i]==1000000007)
		{
			memo[i]=0;
			dfs(i);
		}
	}
	if (f)
	{
		cout<<"Yes\n";
	}
	else
	{
		cout<<"No\n";
	}
	return 0;
}


Measured memory_bytes: 26880
#include <iostream>
using namespace std;

int main(){
	int a,b;
	while(cin >> a >> b){
		if(!a&&!b)
			break;
		int oturi = b-a;
		int hyaku=0,gohyaku=0,senn=0;
		while(oturi >= 1000){
			oturi-=1000;
			senn++;
		}
		while(oturi >= 500){
			oturi-=500;
			gohyaku++;
		}
		while(oturi >= 100){
			oturi-=100;
			hyaku++;
		}
		cout << hyaku << " " << gohyaku << " " << senn << endl;
	}
	return 0;
}

Measured memory_bytes: 0
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author silviase
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B105 solver = new B105();
        solver.solve(1, in, out);
        out.close();
    }

    static class B105 {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int res = 0;
            for (int i = 1; i <= n; i++) {
                if (yakusu(i) == 8 && i % 2 == 1) res++;
            }
            out.println(res);
        }

        int yakusu(int x) {
            int res = 0;
            for (int i = 1; i <= x; i++) {
                if (x % i == 0) res++;
            }
            return res;
        }

    }
}



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

using namespace std;

int color[100005];
vector <pair<int, int> > edge[100005];

void solve(int id, int p, int c) {
	color[id] = c;
	for (int i = 0; i < edge[id].size(); i++) {
		int to = edge[id][i].first;
		int dist = edge[id][i].second;
		
		if (to == p) continue;
		
		if (dist % 2 == 0) solve(to, id, c);
		else solve(to, id, c ^ 1);
	}
}

int main() {
	int n;
	scanf("%d", &n);
	
	for (int i = 0; i < n - 1; i++) {
		int x, y, z;
		scanf("%d%d%d", &x, &y, &z);
		edge[x].push_back(make_pair(y, z));
		edge[y].push_back(make_pair(x, z));
	}
	
	solve(1, -1, 0);
	
	for (int i = 1; i <= n; i++) printf("%d\n", color[i]);
}


Measured memory_bytes: 9984
import sys
import bisect
import itertools
import collections
import fractions
import heapq
import math
from operator import mul
from functools import reduce
from functools import lru_cache


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    N, M, K = map(int, readline().split())
    A = list(map(int, readline().split()))
    B = list(map(int, readline().split()))


    nowtime = 0

    Asum = [0]
    Bsum = [0]
    tmp = 0
    for a in A:
        tmp += a
        Asum.append(tmp)
    tmp = 0
    for b in B:
        tmp += b
        Bsum.append(tmp)

    maxbooks = 0
    before = M
    bcount = M
    for acount in range(N+1):
        if Asum[acount] > K:
            continue
        while K < Asum[acount] + Bsum[bcount]:
            bcount -= 1
        maxbooks = max(maxbooks, acount+bcount)

    print(maxbooks)

if __name__ == '__main__':
    solve()


Measured memory_bytes: 49392
//gcc -std=gnu11 -O2 -o a.out Main.c -lm

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

//#define	dbgPrint	printf
#define	dbgPrint	

int main(void)
{
	
	int n, k;
	int ret;
	int i;
	
	ret = scanf("%d %d", &n, &k);
	
	ret = k;
	for(i = 1 ; i < n ; i++){
		ret *= (k-1);
	}
	
	printf("%d\n", ret);
	
	return 0;
}


Measured memory_bytes: 128
n= int(input())
a = [int(i) for i in input().split()]

life = 1
for i in range(n-2, -1,-1):
    if a[i]>a[i+1]+1:
        print("No")
        break
    elif a[i]==a[i+1]+1:
        a[i] -= 1
else:
    print("Yes")

Measured memory_bytes: 14396
N,M = map(int,input().split())
A = [0 for i in range(M)]
for i in range(N):
    B = list(map(int,input().split()))
    B.pop(0)
    for j in range(len(B)):
        A[B[j]-1] += 1

cnt = 0
for i in range(M):
    if A[i] == N:
        cnt += 1
print(cnt)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;

int main()
{
	int n,a;
	bool check=true;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a;
		if(a%2==0&&(a%3!=0&&a%5!=0))check=false;
	}
	if(check)cout<<"APPROVED"<<endl;
	else cout<<"DENIED"<<endl;
}

Measured memory_bytes: 256
from bisect import bisect_left
from collections import deque

N = int(input())
A = [int(s) for s in input().split()]
A.sort()
if len(A) == 2:
    print(A[1] - A[0])
    print(A[1], A[0])
    exit()

i = bisect_left(A, 0)
left = deque(A[:i])
right = deque(A[i:])
ans = []
if not len(left):
    r0 = right.popleft()
    r1 = right.pop()
    ans.append((r0, r1))
    left.append(r0 - r1)
if not len(right):
    l0 = left.popleft()
    l1 = left.pop()
    ans.append((l1, l0))
    right.append((l1 - l0))

while len(left) > 1:
    l = left.popleft()
    r = right[0]
    ans.append((r, l))
    right[0] = r - l

while len(right) > 1:
    r = right.pop()
    l = left[0]
    ans.append((l, r))
    left[0] = l - r

ans.append((right[0], left[0]))
print(right[0] - left[0])
for x, y in ans:
    print(x, y)


Measured memory_bytes: 64340
H,W=map(int,input().split())
S=[]
for i in range(H):
  a=[int(x) for x in input().split()]
  S.append(a)

Ans=[]
for i in range(H):
  for j in range(W):
    if S[i][j]%2==1:
      if j+1<W:
        S[i][j]-=1
        S[i][j+1]+=1
        Ans.append((i+1,j+1,i+1,j+2))
      elif i+1<H:
        S[i][j]-=1
        S[i+1][j]+=1
        Ans.append((i+1,j+1,i+2,j+1))
      else:
        continue

print(len(Ans))
for i in range(len(Ans)):
  print(*list(Ans[i]))


Measured memory_bytes: 27340