akhauriyash/Code-Regression huggingface dataset:
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <list>
#include <stack>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   all(a) (a.begin(),a.end())
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std;

inline void solve(){
    int n,in=0; cin>>n; 
    vi X(n),Y(n),h(n);
    for (int  i=0 ; i<n ; i++) {
    	cin >> X[i] >> Y[i] >> h[i] ; 
    	if (h[i] != 0) in = i;
    }
    for (int x=0;x<=100;x++){ 
    	for (int y=0;y<=100;y++){ 
    		int H=h[in]+abs(x-X[in])+abs(y-Y[in]);
    		bool flag=true;
    		for (int i=0;i<n;i++){
    			if (h[i] != max(0LL,H-abs(x-X[i])-abs(y-Y[i]))) flag = false;
    		}
    		if (flag){
    			cout << x << " " << y << " " << H << endl; 
    			return;
    		}
    	}
    }
    
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}


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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFやMODの値が適切か確認する --- */
const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const ll MOD = 1000000007;

int dp[1000000 + 5][2];

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

  reverse(all(s));
  s += '0';

  int n = s.size();

  rep(i, n + 1) rep(j, 2) dp[i][j] = INF;
  dp[0][0] = 0;

  rep(i, n) rep(j, 2) if (dp[i][j] != INF) {
    int d = s[i] - '0';
    dp[i + 1][0] = min(dp[i + 1][0], dp[i][j] + d + j);
    dp[i + 1][1] = min(dp[i + 1][1], dp[i][j] + 10 - d - j);
  }

  cout << dp[n][0] << endl;
}


Measured memory_bytes: 9220
#include<bits/stdc++.h>
using namespace std;
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mod 1000000007
#define endl "\n"
#define test ll t; cin>>t; while(t--)
typedef long long int ll;
int main() {
    FIO;
    ll n,ans=0;
    cin>>n;
    vector<pair<ll,ll>>v(n);
    for(int i=0;i<n;i++){
        cin>>v[i].first>>v[i].second;
    }
    // Let us consider xi<xj
    sort(v.begin(),v.end());
    // Two cases 1)yi<yj
    vector<ll>sum(n);
    for(int i=0;i<n;i++){
        sum[i]=v[i].first+v[i].second;
    }
    ans=max(ans,*max_element(sum.begin(),sum.end())-*min_element(sum.begin(),sum.end()));
    // Second case yi>yj
    for(int i=0;i<n;i++){
        sum[i]=v[i].first-v[i].second;
    }
    ans=max(ans,*max_element(sum.begin(),sum.end())-*min_element(sum.begin(),sum.end()));
    cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 7928
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define forn(i, n) for (ll i = 0; i < (n); i++)
#define fori(i, b, e) for (ll i = (b); i < (e); i++)
#define forr(i, b, e) for (ll i = (b); i >= (e); i--)
#define allele(v) v.begin(), v.end()
#define fi first
#define se second

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n, k;
	cin >> n >> k;
	long double ans = 0;
	fori(i, 1, n + 1)
	{
		ll res = i;
		long double coin = 1;
		while (res < k)
			res *= 2, coin *= 2;
		ans += 1.0f / coin;
	}
	cout << setprecision(12) << (ans / (long double)n) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(n) begin(n),end(n)
using ll = long long;
using P = pair<int,int>;

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> red(n, 0), num(n, 1);
    red[0] = 1;
    rep(i,m) {
        int x, y;
        cin >> x >> y;
        --x, --y;
        if(red[x]==1){
            red[y]=1;
        }
        num[x]--;
        num[y]++;
        if(num[x]==0) red[x]=0;
    }
    int ans = 0;
    rep(i,n) if(red[i]) ans++;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4032
n = int(input())
s = input()
strS = []
for i in range(len(s)):
    charnum = ord(s[i])
    if charnum+n > 90:
        charnum = 64 + (charnum+n - 90) 
    else:
        charnum += n
#    print(charnum)
    strS.append(chr(charnum))
ans = "".join(strS)
print(ans)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
ll i, temp, n,j, a[200600];
string s, t;
bool cond;
int main()
{
    //I am Monim, a tiny creature of Allah
    cin >> s;
    cin >> t;
    n = s.size();
    cond = true;
    for(i=0;i<n;i++)
    {
        if(s[i]!=t[i])
        {
            cond = false;
            break;
        }
    }
    if(cond)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}



Measured memory_bytes: 3588
#include <cstdio>
#include <algorithm>

using namespace std;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)

typedef long long ll;

const int N_MAX = 300000;

//------------------------------------------------------------------------------
ll mod_pow(ll x, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) {
      res = res * x % mod;
    }
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}

ll mod_inverse(ll x, ll mod) {
  return mod_pow(x, mod - 2, mod);
}

ll fact[N_MAX + 1];    // mod_fact tbl

void init_fact(ll n, ll mod) {
  fact[0] = 1;
  FOR(i, 1, n) fact[i] = fact[i - 1] * i % mod;
}

ll mod_comb_fast(ll n, ll k, ll mod) {
  if (n < 0 || k < 0 || n < k) return 0;
  ll a = fact[n];
  ll b = fact[k] * fact[n - k] % mod;
  return a * mod_inverse(b, mod) % mod;
}

//------------------------------------------------------------------------------
const ll MOD = 998244353;

ll N, A, B;
ll K;

void solve() {
  init_fact(N, MOD);
  ll ans = 0;
  for (ll xy = 0; xy <= min(K / A, N); xy++) {
    ll v = K - A * xy;
    if (v % B > 0) continue;
    ll yz = v / B;
    ll m = mod_comb_fast(N, xy, MOD);
    m = m * mod_comb_fast(N, yz, MOD) % MOD;
    ans = (ans + m) % MOD;
  }
  printf("%lld\n", ans);
}

void input() {
  scanf("%lld%lld%lld%lld", &N, &A, &B, &K);
}

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


Measured memory_bytes: 2560
// スタックサイズ: 100MB

#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <unordered_map>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iomanip>
#include <queue>
#include <list>
#include <set>
using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
const ll INF = 1000000000000000000;
#define fori(i, a, b) for (ll i = (a); i < (b); ++i)
#define ford(i, a, b) for (ll i = (b - 1); (a) <= i; --i)
#define rep(i, n) fori(i, 0, n)
#define all(v) (v).begin(), (v).end()
ll pw(ll x, ll y) { ll r = 1;  rep(i, y) { r *= x; }; return r; }


int main() {
	
	ll N;
	cin >> N;
	vll H(N), I(N);
	rep(i, N) {
		cin >> H[i];
		if (i == 0) I[0] = H[0];
		else I[i] = max(I[i - 1], H[i]);
	}

	ll ans = 0;
	rep(i, N) if (H[i] >= I[i]) ++ans;
	cout << ans << endl;
}

Measured memory_bytes: 256
let () = Scanf.scanf "%d\n" @@ fun n ->
  let as_ = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun a -> a in
  let inv_as = Array.make n 0 in
  Array.iter (fun a -> inv_as.(a - 1) <- inv_as.(a - 1) + 1) as_;
  let somme =
    Array.fold_right (fun n -> ( + ) @@ n * (n - 1) / 2) inv_as 0 in
  for i = 0 to n - 1 do
    let n = inv_as.(as_.(i) - 1) in
    Printf.printf "%d\n" @@ somme - n * (n - 1) / 2 + max 0 ((n - 1) * (n - 2) / 2)
  done

Measured memory_bytes: 8832
def inpl(): return [int(i) for i in input().split()]
N, K = inpl()
D = inpl()
for i in range(1000000):
    sn = list(map(int, str(N+i)))
    for s in sn:
        if s in D:
            break
    else:
        print(N+i)
        break

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <numeric>
#include <utility>

using namespace std;

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

ll A[11];
int H, W;

pii add(pii r, pii p) {
    return { r.first + p.first, r.second + p.second };
}

int coll(pii r, set <pii>& box) {
    int rx = 0;
    
    for(int x = -1; x < 2; ++x)
        for(int y = -1; y < 2; ++y)
            rx += box.find(add(r, {x, y})) != box.end();
    
    return rx;
}

bool lt(pii r, pii p) {
    return r.first < p.first && r.second < p.second;
}

void col(pii r, set <pii>& box) {
    for(int x = -1; x < 2; ++x)
        for(int y = -1; y < 2; ++y) {
            pii d = add(r, {x, y});
            if(lt({1, 1}, d) && lt(d, {H, W}))
                A[coll(d, box)] += 1;
        }
    
    return ;
}

int main() {
    int n; cin >> H >> W >> n;
    ll mx = (H - 2LL) * (W - 2LL);
    int u, v;
    set <pii> box;
    
    while(n--) {
        cin >> u >> v;
        box.emplace(u, v);
    }
    
    for(pii r : box)
        col(r, box);
    
    ll rx = 0;
    for(int i = 1; i < 11; ++i)
        rx += (A[i] /= i);
    cout << mx - rx;
    for(int i = 1; i < 10; ++i)
        cout << '\n' << A[i];
    
    return 0;
}

Measured memory_bytes: 4992
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <string>
#include <set>

using namespace std;

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

	int ans = 0;
	for (int i = 1; i < n - 1; i++) {
		auto t = s.substr(0, i);
		auto u = s.substr(i);

		set<char> alpha;
		for (char c: t) {
			if (u.find(c) != string::npos) {
				alpha.insert(c);
			}
		}

		ans = max<int>(ans, alpha.size());
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<sstream>
#include<cmath>

using namespace std;

const int MAX = 12;
vector<double> Cake;
double box;
double dp[(1<<MAX)][MAX];

void init(){
  Cake.clear();
  fill(dp[0],dp[0]+(1<<MAX)*MAX,100000000);
  dp[0][0] = 0;
}

void make(){
  string s;
  getline(cin,s);
  stringstream ss(s);
  double num;
  while(ss >> num) Cake.push_back(num);
}

void solve(){


  for(int i = 0; i < (1<<Cake.size()); i++)
    for(int j = 0; j < (int)Cake.size(); j++){
      if(i == 0) {dp[(1<<j)][j] = Cake[j]; continue;}
      for(int k = 0; k < (int)Cake.size(); k++)
	if(!(i&(1<<k)) && j != k)
	  dp[i+(1<<k)][k] = min(dp[i+(1<<k)][k],dp[i][j]+2.0*sqrt(Cake[j]*Cake[k]));
	
    }

  for(int i = 0; i < (int)Cake.size(); i++){
    if(dp[(1<<Cake.size())-1][i]+Cake[i] <= box) {cout << "OK" << endl;return;}
  }

  cout << "NA" << endl;
}

int main(){

  while(cin >> box){
    init();
    make();
    solve();
  }
  return 0;
}

Measured memory_bytes: 1644
//g++ t.cpp -o t && t < p.txt
//d>p.txt&&t<p.txt&&t2<p.txt

#include <iostream> // プログラムの耳と口
#include <vector> // 超有能配列秘書
#include <algorithm> // みんな大好きソートと二分探索
#include <queue> // きゅーちゃん、だいすき
#include <string> // to_string
#include <functional> // 関数を変数に入れる子
#include <set> // 値の取得・挿入・削除を高速に
#include <map> // setの妹 これまた優秀
#include <random> // 乱択さん
#include <cassert>

#define DB cerr<<"D"<<endl
using namespace std; using ll=long long; using ld=long double; const int INF=1e9; const ll LINF=1e18; const double dINF = 1e18; const ld ldINF = 1e18; const double EPS = 1e-6;
template<typename T, typename U, typename O> void caut(T a, U b, O c){cout<<"("<<a<<","<<b<<","<<c<<") ";} template<typename T, typename U> void caut(T a, U b){cout<<"("<<a<<","<<b<<") ";} template<typename T> void caut(T a){cout<<"("<<a<<") ";};
using P=pair<ll,ll>;
const ll M = 1e9+7;
ll mod_pow(ll x, ll a) { ll an = 1; while(a > 0) { if (a&1) an = an * x % M; x = x * x % M; a >>= 1;} return an;}
void add(ll& x, ll y) {x+=y; x%=M;}; void mul(ll& x, ll y) {x*=y; x%=M;}; template<typename T, typename U> void chmax(T& x, U y) {if (x<y) x=y;}; template<typename T, typename U> void chmin(T& x, U y) {if (x>y) x=y;}
bool vaild(int x, int y, int hh, int ww){return 0<=x&&x<hh&&0<=y&&y<ww;}
int keta(ll a) {int res=0; while(a>0) res+=(a%10/5)+(a%5), a/=10; return res;}

int main() {
  int h,w; cin>>h>>w;
  string s[h]; for(int i=0;i<h;i++) cin>>s[i];
  ll dp[h][w]; fill(dp[0],dp[h],0); dp[0][0]=1; 
  for(int i=0;i<h;i++) {
    for(int j=0;j<w;j++) {
      if (i+1<h && s[i+1][j]=='.') add(dp[i+1][j],dp[i][j]);
      if (j+1<w && s[i][j+1]=='.') add(dp[i][j+1],dp[i][j]);
    }
  }
  /*
  for(int i=0;i<h;i++) {
    for(int j=0;j<w;j++) {
      cout<<dp[i][j]<<" ";
    } cout<<endl;
  }*/
  cout<<dp[h-1][w-1]<<endl;
}
// ・配列の大きさok？　・priority_queueはgreater？　・debug消した？
// ・落ち着いて。提出まで4分待ってね……WJ……1/10……2/10……

// Thank you for making problems and running the contest


Measured memory_bytes: 13332
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        Map<Integer, Integer> map = new HashMap<>(10000);
        int N = scan.nextInt();
        long sum = 0;
        for (int i = 0; i < N; i++) {
            int cur = scan.nextInt();
            if (!map.containsKey(cur)) {
                map.put(cur, 0);
            }
            map.put(cur, map.get(cur) + 1);
            sum += cur;
        }
        int Q = scan.nextInt();
        for (int i = 0; i < Q; i++) {
            int b = scan.nextInt();
            int c = scan.nextInt();
            if (map.containsKey(b)) {
                sum += (c - b) * (long) map.get(b);
                if (!map.containsKey(c)) {
                    map.put(c, 0);
                }
                map.put(c, map.get(c) + map.get(b));
                map.put(b, 0);
            }
            System.out.println(sum);
        }
    }
}

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

int main() {
	int S, h, m, s;
	
	cin >> S;
	
	h = S/3600;
	m = (S%3600)/60;
	s = (S%3600)%60;
	
	cout << h << ":" << m << ":" << s << endl;
	
	return 0;
}


Measured memory_bytes: 3080
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define size_of_array(array) (sizeof(array)/sizeof(array[0]))
#define max 100005
using ll =long long;
using namespace std;
using Graph=vector<vector<int>>;

int main(){
    ll x;
    cin>>x;

    ll hap=0;
    hap+=1000*(x/500);
    hap+=5*((x%500)/5);
    cout<<hap<<endl;
}



Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int stones = s.nextInt();
        int arr[] = new int[stones];
        for(int i= 0;i<stones;i++){
            arr[i] = s.nextInt();
        }
        long dp[] = new long[stones];
        dp[0] = 0;
        for(int i= 1;i<stones;i++){
            long option1 = Math.abs(arr[i]-arr[i-1])+dp[i-1];
            long option2 = i==1?Integer.MAX_VALUE:Math.abs(arr[i]-arr[i-2])+dp[i-2];
            dp[i] = Math.min(option1,option2);
        }
        System.out.println(dp[stones-1]);
    }
}


Measured memory_bytes: 50656
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:https://onlinejudge.u-aizu.ac.jp/courses/library/6/NTL/1/NTL_1_D>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

vector<ll> PrimeFact(ll n){
    vector<ll> res;
    while(n!=1){
        if(n == 2 || n == 3){
            res.emplace_back(n); n/=n;
            continue;
        }
        bool prime_flag = false;
        for(int i = 2;i*i <= n;i++){
            if(n%i==0){
                res.emplace_back(i); n/=i;
                prime_flag = true;
                break;
            }
        }
        if(!prime_flag){res.emplace_back(n); n/= n;}
    }
    return res;
}

ll solve(){
    ll res = 0; cin >> res;
    auto primes = PrimeFact(res);
    primes.erase(unique(primes.begin(),primes.end()),primes.end());
    for(auto p:primes){
        res -= res/p;
    }
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    cout << solve() << endl;
    return 0;
}



Measured memory_bytes: 3156
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int a[n];
	
	for(int i=0;i<n;i++)cin>>a[i];
	int cnt=0,i;
	do{
	   for (i=0;i<n;i++)
	      if(a[i]%2==1){
		     cout<<cnt;
		     return 0;
	      }
	      else
	         a[i]=a[i]/2;
	   cnt++;
	} while (1);
	return 0;
}

Measured memory_bytes: 256
// #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>	// istringstream
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;

#define MP make_pair
#define fastIO	cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
//for gcc (未test)
// #define FOREACH_IT(it,c)	for(typeof(c)::iterator it=(c).begin(); it!=(c).end(); ++it)
//for Visual Studio
#define foreach_it(type,it,c) for(type::iterator it=c.begin(); it!=c.end(); ++it)

int main(){
	int n, ans = 0;
	while (cin >> n){
		ans = n % 39;
		if (ans == 0)	ans = 39;
		printf("3C%02d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main() {

    int n;
    string s;

    cin >> n >> s;


    vector< int > sumw(n + 2, 0), sume(n + 2, 0);
    sumw[0] = sume[0] = 0;;
    for(int i = 1; i <= n; i++) {
        sumw[i] = sumw[i - 1] + (s[i - 1] == 'W');
        sume[i] = sume[i - 1] + (s[i - 1] == 'E');
    }

    int ans = 1e+8;
    for(int i = 1; i <= n; i++) {
        int left = sumw[i - 1] - sumw[0];
        int right = sume[n] - sume[i];
        ans = min(ans, left + right);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3076
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { 
  INIT(){cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


signed main() {
  string s;
  cin >> s;

  vector<bool> used(26, false);
  REP(i, s.size()){
    used[s[i]-'a'] = true;
  }

  REP(i, 26){
    if(!used[i]){
      cout << char(i+'a') << "\n";
      return 0;
    }
  }

  cout << "None" << "\n";

  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define sz size()
#define ll long long
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin >> n;
	cout << n / 2 + n % 2;
	return 0;
}


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

int main() {
    int x, y, z;
    cin >> x >> y >> z;
    swap(x,y);
    swap(x,z);
    cout << x << " " << y << " " << z << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int HMAX=12,WMAX=1005;
int mat[HMAX][WMAX];
const int INF=1<<30;
int n,m,k;
int v[HMAX][WMAX];
int getscore(int nrlin){
  int ans=0;
  for(int i=1;i<=m;i++){
    int maxi=0;
    for(int j=1;j<=nrlin;j++){
      if(v[j][i]>k)
        return INF;
      v[j][i]+=v[j][i-1];
      maxi=max(maxi,v[j][i]);
    }
    if(maxi>k){
      ans++;
      for(int j=1;j<=nrlin;j++){
        v[j][i]-=v[j][i-1];
      }
    }
  }
  return ans;
}
int main()
{
  cin>>n>>m>>k;
  for(int i=1;i<=n;i++){
    char c;
    for(int j=1;j<=m;j++){
      cin>>ws>>c;
      mat[i][j]=c-'0';
    }
  }
  int ans=INF;
  for(int mask=0;mask<1<<(n);mask++){
    int nrlin=1;
    for(int i=1;i<=m;i++){
      v[nrlin][i]=mat[1][i];
    }
    for(int lin=2;lin<=n;lin++){
      if(mask&(1<<(lin-1))){
        nrlin++;
      }
      for(int i=1;i<=m;i++){
        v[nrlin][i]+=mat[lin][i];
      }
    }

    ans=min(ans,__builtin_popcount(mask)+getscore(nrlin));
    for(int i=1;i<=nrlin;i++){
      for(int j=1;j<=m;j++)
        v[i][j]=0;
    }
  }
  cout<<ans;
  return 0;
}


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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < n; i++)
#define Rep(i, n) for(int i = 1; i < n; i++)
#define In(vec) rep(i, n) cin>>vec[i];
#define ANS(s) cout << s << endl
#define inc(a, b) cin >> a >> b;

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

typedef long long ll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<pair<int, int>> vii;

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; }

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
int round_int(int a, int b) { return (a + (b - 1)) / b; }


// 4,8方向に探索する際に用いる配列
//int dx[4] = { 0,  0, 1, -1 };
//int dy[4] = { 1, -1, 0,  0 };
int dx[8] = { 1, 0, -1,  0, 1, -1, -1,  1 };
int dy[8] = { 0, 1,  0, -1, 1,  1, -1, -1 };

constexpr auto MAX = 100010;

// ────────────────────────────────────────────────────

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

	string s;
	cin >> s;

	int ans = 0;
	int x = 0;

	rep(i, n) {
		if (s[i] == 'I') x++;
		else x--;

		ans = max(ans, x);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define int ll
#define pb push_back
#define setbits(x)          __builtin_popcountll(x)
#define endl "\n"
typedef long long ll;
vector<int> find(int n)
{vector<int> ans;
    for(int i=1;i*i<=n;i++)
    {
        if(n%i==0)
        {
            ans.pb(i);

            if(n/i!=i)
                ans.pb(n/i);
        }
    }
    return ans;
}
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin>>n;
vector<int> arr=find(n);
int ans=0;
vector<int> s;
s=find(n-1);
sort(s.begin(),s.end());
 ans=s.size();
set<int> a;
for(int i=0;i<s.size();i++)
{
    a.insert(s[i]);
}

for(int i=0;i<arr.size();i++)
{
    int x=arr[i];
    int v=n;
    if(x==1)
    {
        continue;
    }
    while(v%x==0)
      {
        v/=x;
      }
      if(v%x==1)
        a.insert(arr[i]);
     int pos=lower_bound(s.begin(),s.end(),v)-s.begin();
    if(pos==s.size())
        continue;
    else if(s[pos]==v)
          {ans++;
          a.insert(arr[i]);
          }
}
ans=a.size();
ans-=1;
cout<<ans<<endl;
    return 0;
}


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

int main() {
	int a,b;
	string ans;
	cin>>a>>b;

	if(a>b)ans="a > b";
	else if(a<b)ans="a < b";
	else if(a==b)ans="a == b";
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3176
//Author:- S_Aditya

#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define ll long long 
#define scn(n) scanf("%d",&n)
#define lscn(n) scanf("%lld",&n)
#define lpri(n) printf("%lld",n)
#define pri(n) printf("%d",n)
#define priln(n) printf("%d\n",n)
#define lpriln(n) printf("%lld\n",n)
#define rep(i,init,n) for(int i=init;i<n;i++)
#define pb push_back     
#define mp make_pair
#define F first
#define S second
#define gcd __gcd
#define inf INT_MAX
#define ninf INT_MIN
const ll mod=1e9+7;         
const int N=1e5+4;

int main()                  
{
    int a,b,m;
    
    scn(a); scn(b); scn(m);
    
    int aa[a+1],ab[b+1],ma=inf,mb=inf;
    
    rep(i,1,a+1)
    scn(aa[i]),ma=min(ma,aa[i]);
    
    rep(i,1,b+1)
    scn(ab[i]),mb=min(mb,ab[i]);
    
    int ans=ma+mb;
    
    rep(i,0,m)
    {
        int x,y,c;
        
        scn(x); scn(y); scn(c);
        
        ans=min(ans,aa[x]+ab[y]-c);
    }
    
    pri(ans);
} 

Measured memory_bytes: 1024
using System;
public class Hello{
    public static void Main(){
        // Your code here!
        var line=System.Console.ReadLine();
        char c=Convert.ToChar(line);
        if (char.IsUpper(c)) {
         System.Console.WriteLine("A");
        }else{
             System.Console.WriteLine("a");
        }

       
    }
}


Measured memory_bytes: 25816
#include"iostream"
using namespace std;
int main(){
  string s;
  std::cin >> s;
  string ans;
  ans="None";

    if(std::string::npos == s.find("a")){ans="a";}
    else if(std::string::npos == s.find("b")){ans="b";}
    else if(std::string::npos == s.find("c")){ans="c";}
    else if(std::string::npos == s.find("d")){ans="d";}
    else if(std::string::npos == s.find("e")){ans="e";}
    else if(std::string::npos == s.find("f")){ans="f";}
    else if(std::string::npos == s.find("g")){ans="g";}
    else if(std::string::npos == s.find("h")){ans="h";}
    else if(std::string::npos == s.find("i")){ans="i";}
    else if(std::string::npos == s.find("j")){ans="j";}
    else if(std::string::npos == s.find("k")){ans="k";}
    else if(std::string::npos == s.find("l")){ans="l";}
    else if(std::string::npos == s.find("m")){ans="m";}
    else if(std::string::npos == s.find("n")){ans="n";}
    else if(std::string::npos == s.find("o")){ans="o";}
    else if(std::string::npos == s.find("p")){ans="p";}
    else if(std::string::npos == s.find("q")){ans="q";}
    else if(std::string::npos == s.find("r")){ans="r";}
    else if(std::string::npos == s.find("s")){ans="s";}
    else if(std::string::npos == s.find("t")){ans="t";}
    else if(std::string::npos == s.find("u")){ans="u";}
    else if(std::string::npos == s.find("v")){ans="v";}
    else if(std::string::npos == s.find("w")){ans="w";}
    else if(std::string::npos == s.find("x")){ans="x";}
    else if(std::string::npos == s.find("y")){ans="y";}
    else if(std::string::npos == s.find("z")){ans="z";}


    std::cout << ans << '\n';
return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    cin.tie(0);
    ios::sync_with_stdio(false);<- これら、printfとかと併用しない方が良さそう

*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);

    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };


// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b){
    double ax=a.first, ay=a.second, bx=b.first, by=b.second;
    return atan2(by-ay, bx-ax);
}

/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */



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

    int N; cin >> N;
    vector<int> A(N);
    vector<vector<pair<int, int>>> info(N);

    rep(i, N){
        cin >> A[i];
        rep(j, A[i]) {
            int x, y; cin >> x >> y;
            --x;
            info[i].push_back(make_pair(x, y));
        }
    }

    vector<int> honest(N, -1);
    int ans = 0;
    rep(bit, 1<<N) {
        bool flg = true;
        rep(i, N) honest[i] = -1;
        
        rep(i, N) if(bit&1<<i) {
            for(auto p: info[i]) {
                int x = p.first; int y = p.second;
                if(y==0 && bit&1<<x) { flg = false; break; }
                else if(y==1 && (bit&1<<x)==0) { flg = false; break; }
                else if(honest[x]==-1 || honest[x]==y) { honest[x] = y; }
                else { flg = false; break; }
            }
        }

        if(flg){
            int cnt = 0;
            rep(i, N) if(bit&1<<i) ++cnt;
            chmax(ans, cnt);
            //cout << bit << endl;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
int main(){
	int X,t;
	cin >> X >> t;
	X -= min(X,t);
	cout << X << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <utility>
#include <deque>
#include <stack>
#include <bitset>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
#define rep(i,n) for (int i=0;i<n;++i)
#define REP(i,n) for (int i=1;i<=n;++i)
#define all(x) x.begin(),x.end()
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define read(x) scanf("%d",&x)
int n;
int a[100];
int main(){
	ios::sync_with_stdio(false);
	cin>>n;
	REP(i,n) cin>>a[i];
	int sum=0;
	for (int i=1;i<n;++i) for (int j=i+1;j<=n;++j) sum+=a[i]*a[j];
	cout<<sum;
	return 0;
}

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

using namespace std;

struct meal
{
	int x, y;
};

const int DIM = 1e5 + 7;

meal v[DIM];
int dp[DIM];

bool cmp(meal a, meal b)
{
	return a.x < b.x;
}

main()
{
	int n, t;
	cin >> n >> t;
	
	int res = 0;
	
	for(int i = 1; i <= n; i++)
	{
		cin >> v[i].x >> v[i].y;
		res = max(res, v[i].y);
	}
	
	sort(v + 1, v + 1 + n, cmp);
	
	dp[v[1].x] = v[1].y;
	
	for(int i = 2; i <= n; i++)
		for(int j = t - 1; j >= 0; j--)
		{
			res = max(res, dp[j] +  v[i].y);
			
			if(j + v[i].x < t)
				dp[j + v[i].x] = max(dp[j + v[i].x], dp[j] + v[i].y);
		}
	
	cout << res;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LL long long
using namespace std;
int n;
long long ans;
int main()
{
	scanf("%d",&n);
	ans+=(LL)n*(n+1)*(n+2)/6;
	for (int i=1,x,y;i<n;i++)
	{
		scanf("%d%d",&x,&y);
		if (x>y) swap(x,y);
		ans-=(LL)x*(n-y+1);
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 3804
#include <bits/stdc++.h>
#define mp make_pair
#define eb emplace_back
#define fi first
#define se second
#define bit(n) 1 << n
#define int long long
using namespace std;
using cd = complex <double>;

typedef pair <int, int> pii;
typedef vector <int> vi;
typedef vector <pair <int, int> > vii;
typedef map <int, int> mii;

const int Inf = 1000000000000000007;
const int mod = 1000000007;
const double Pi = acos(-1);

void Fastio()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}

int n, m, s;
int c[55], d[55];
int Dist[55][3005];
vector <pair <pii, int> > Adj[55];

void Solve()
{
	cin >> n >> m >> s;
	for(int i = 1; i <= n; i++)
	{
		for(int j = 0; j <= 2500; j++)
		{
			Dist[i][j] = Inf;
		}
	}	
	for(int i = 1; i <= m; i++)
	{
		int u, v, a, b;
		cin >> u >> v >> a >> b;
		Adj[u].eb(mp(mp(a, b), v));
		Adj[v].eb(mp(mp(a, b), u));
	}
	for(int i = 1; i <= n; i++)
	{
		cin >> c[i] >> d[i];
		c[i] = min(c[i], 2500ll);
	}
	s = min(s, 2500ll);
	priority_queue <pair <int, pii>, vector <pair <int, pii> >, greater <pair <int, pii> > > pq;
	Dist[1][s] = 0;
	pq.push(mp(0, mp(1, s)));
	while(pq.empty() == false)
	{
		int dd = pq.top().fi, pos = pq.top().se.fi, coin = pq.top().se.se;
		pq.pop();
		if(dd == Dist[pos][coin])
		{
			if(Dist[pos][min(coin + c[pos], 2500ll)] > dd + d[pos])
			{
				Dist[pos][min(coin + c[pos], 2500ll)] = dd + d[pos];
				pq.push(mp(dd + d[pos], mp(pos, min(coin + c[pos], 2500ll))));
			}
			for(auto x : Adj[pos])
			{
				int nxt = x.se, ti = x.fi.se, cc = x.fi.fi;
				if(cc <= coin)
				{
					if(Dist[nxt][coin - cc] > dd + ti)
					{
						Dist[nxt][coin - cc] = dd + ti;
						pq.push(mp(dd + ti, mp(nxt, coin - cc)));
					}
				}
			}
		}
	}
	for(int i = 2; i <= n; i++)
	{
		int ans = Inf;
		for(int j = 0; j <= 2500; j++)
		{
			ans = min(ans, Dist[i][j]);
		}
		cout << ans << '\n';
	}
}

signed main()
{
//	freopen("PARK.inp", "r", stdin);
//	freopen("PARK.out", "w", stdout);
	Fastio();
	Solve();
}

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

typedef long long int ll;

//#define endl '\n'

ll n;
ll arr[200005];
ll hrr[200005];
ll dp[200005];

ll bit[200005];

ll compute(ll idx){
    ll ans = 0;
    while(idx>=0){
        //cout<<idx<<" "<<bit[idx]<<endl;
        ans = max(ans,bit[idx]);
        idx = (idx&(idx+1))-1;
    }
    return ans;
}

void update(ll idx,ll delta)
{
    while(idx<n){
        //cout<<idx<<endl;
        bit[idx]=max(bit[idx],delta);
        idx = (idx|(idx+1));
    }
}

int main()
{
    std::ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    memset(dp,-1,sizeof(dp));
    memset(bit,0,sizeof(bit));
    cin>>n;
    for(ll i=0;i<n;i++)cin>>arr[i];
    for(ll i=0;i<n;i++)cin>>hrr[i];

    map <ll,ll> mp;
    ll ans = 0;
    for(ll i=0;i<n;i++){

        ll val = arr[i];
        ll maxval = compute(val-1);
        //cout<<maxval<<"-"<<endl;
        ans = max(ans,maxval+hrr[i]);

        update(val-1,maxval+hrr[i]);


    }

    cout<<ans<<endl;

}


Measured memory_bytes: 6528
#include<bits/stdc++.h>    
using namespace std;
#define ll long long 
#define pi pair<int,int>
#define pb push_back
#define inf 1e16
#define mod 1000000007
#define en '\n'
int pw(int a, int b){
	int ans = 1;
	while(b){
		if(b&1)ans = (ans*a)%mod;
		a = (a*a)%mod;
		b>>=1;
	}
	return ans;
}
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	ll n;cin>>n;
	ll arr[60];memset(arr,0,sizeof arr);
	ll mx = 0 ; 
	for(int i = 0 ; i < n ; i ++ ){
		ll val;cin>>val;
		for(ll j = 0 ; j < 60 ; j ++ ){
			if(val&(1LL<<j)){
				arr[j]++;
				mx=max(mx,j);
			}
		}
	}
	ll sum = 0 ;
	ll counter = 0 ;
	while(counter<=mx){
		ll add = ((arr[counter]*(n-arr[counter])))%mod;
		add = (add*((1LL<<counter)%mod)%mod);
		sum = (sum+add)%mod;
		counter++;
	}
	cout<<sum<<en;
	return 0 ; 
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ff first
#define ss second
#define pb push_back
#define N 1010

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

	int n;
	cin >> n;
	ll a[n];
	ll sum = 0;
	for (int i = 0; i < n; ++i)
	{
		cin >> a[i];
		sum += a[i];
	}
	sum /= 2;
	for(int i = 1; i < n; i += 2)
	{
		sum -= a[i];
	}
	cout << 2 * sum << " ";
	for (int i = 0; i < n - 1; ++i)
	{
		sum = a[i] - sum;
		cout << 2 * sum << " ";
	}
	return 0;
} 





// void phi()
// {
// 	p[1] = 1;
// 	for(int i = 2; i < N; ++i)
// 		p[i] = i;
// 	for(int i = 2; i < N; ++i)
// 	{
// 		if(p[i] == i)
// 		{
// 			p[i] = i - 1;
// 			for(int j = 2 * i; j < N; j += i)
// 				p[j] = p[j] * (i - 1) / i;
// 		}
// 	}
// }

// void dpf()
// {
// 	for(int i = 1; i < N; ++i)
// 	{
// 		for(int j = i; j < N; j += i)
// 		{
// 			dp[j] += (i * p[i]);
// 		}		
// 	}
// 	for(int i = 2; i < N; ++i)
// 	{
// 		dp[i] = ((dp[i] + 1) * i) / 2;
// 	}
// }



Measured memory_bytes: 2176
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=int(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using ll = long long;

int main(){
    int N,A,B;cin>>N>>A>>B;
    if(abs(B-A)&1) cout<<"Borys"<<endl;
    else cout<<"Alice"<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector< vector<int> > VVI;
typedef pair<int,int> PII;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()

int main(){
  ll A,B,C;
  cin>>A>>B>>C;
  int ans=0;
  if(A%2&&B%2&&C%2) cout<<0<<endl;
  else if(A==B&&B==C) cout<<-1<<endl;
  else{
    while(A%2==0&&B%2==0&&C%2==0){
      ll A2=A;
      ll B2=B;
      ll C2=C;
      A=(B2+C2)/2;
      B=(C2+A2)/2;
      C=(A2+B2)/2;
      ans++;
    }
    cout<<ans<<endl;
  }
}

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

int main(){
    int n, l, ans, q;
    string str;
    char in;
    while(cin >> n){
        if(n==0) break;
        str = "I";
        for(int i = 0;i<n;i++) str += "OI";
        ans = q = 0;
        cin >> l;
        for(int i = 0;i<l;i++){
            cin >> in;
            if(in == 'I' && q == 2*n){
                ans++;
                q = 2*n-1;
            }
            else if(in == 'I' && q%2 == 0){
                q++;
            }
            else if(in == 'I'){
                q = 1;
            }
            else if(in == 'O' && q%2==1){
                q++;
            }
            else{
                q=0;
            }
        }
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 3212
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
        String n = sc.next();
        char[] str = n.toCharArray();
        if(str[2]==str[3] && str[4] == str[5]) {
        	System.out.println("Yes");
        	
        }else {
        	System.out.println("No");
        }
		
	}
}

Measured memory_bytes: 35776
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using static System.Console;
using static System.Math;
class Simple
{
    string N;
    void Solve() {
        //input
        N = io.String;
        //cal
        var ans = N.Skip(0).Take(3).All(c => c == N.First()) ||
                  N.Skip(1).Take(3).All(c => c == N.Last());
        //ret
        WriteLine(ans?"Yes":"No");
    }

    SimpleIO io = new SimpleIO();
    public static void Main(string[] args) => new Simple().Stream();
    private void Stream() {
        //var exStdIn = new System.IO.StreamReader("stdin.txt");
        //SetIn(exStdIn);
        Solve();
        io.Flush();
    }
}
class SimpleIO
{
    string[] _nextBuffer;
    int _bufferCnt;
    char[] cs = new char[] { ' ', '"', ',' };
    StreamWriter sw = new StreamWriter(OpenStandardOutput()) {
        AutoFlush = false
    };
    public SimpleIO() {
        _nextBuffer = new string[0];
        _bufferCnt = 0;
        SetOut(sw);
    }
    string Next() {
        if (_bufferCnt < _nextBuffer.Length)
            return _nextBuffer[_bufferCnt++];
        var st = ReadLine();
        while (st == "")
            st = ReadLine();
        if (st != null)
            _nextBuffer = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        else
            st = "";
        _bufferCnt = 0;
        return _nextBuffer[_bufferCnt++];
    }
    public string String => Next();
    public char Char => char.Parse(String);
    public int Int => int.Parse(String);
    public long Long => long.Parse(String);
    public double Double => double.Parse(String);
    public void Flush() => Out.Flush();
}


Measured memory_bytes: 11348
import java.io.*;
class Main{
    public static void main(String[] args) throws IOException{

	BufferedReader br=
	    new BufferedReader(new InputStreamReader(System.in));
	String buf;
	buf=br.readLine();
	char[] data=buf.toCharArray();
	for(int i=(data.length-1);i>=0;i--){
	    System.out.print(data[i]);
	}
	System.out.println();
    }
}

Measured memory_bytes: 9092
#include<bits/stdc++.h>
#define F first
#define S second
#define endl "\n"
#define rep(i , a , b) for (int i=a; i<(b); i++)
#define re0(i , a)     for (int i=0; i<(a); i++)
using namespace std;

typedef pair<int, int> ii;
typedef long long ll;
typedef long double ld;

const int mod=7+1e9;
const int inf=1e9;
const int N=0;
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  string s;
  cin>>s;
  re0(i,s.size())cout<<((s[i]=='1')?9:1);
  cout<<endl;
}


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

int main(void)
{
    long long N , d;
    cin >> N >> d;
    int count = 0;
    for (int i = 0; i < N; i++)
    {
        long long x,y;
        cin >> x >> y;

        if(d * d >= x * x + y * y)
        {
            count++;
        }
    }

    cout << count << endl;
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>

using namespace std;

int main(){
  int N, X;
  cin >> N >> X;
  vector<int> L(N);
  for(int i = 0; i < N; i++){
    cin >> L[i];
  }
  
  int cnt = 1;
  int D = 0;
  for(int i = 0; i < N; i++){
    D += L[i];
    if(D <= X)cnt++;
  }
  cout << cnt;
}


Measured memory_bytes: 384
#include <iostream>
#include <cstring>
#include <string>    
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
ll n, m;
string str;

int main(){
	cin >> str;
	n = str.size();
	
	bool isred = true;
	ll stack = 0;
	ll ans = 0;
	for(ll i = 0; i < n; i++){
		if(stack == 0){
			stack++;
			isred = (str[i] == '0');
		}
		else{
			if((isred && str[i] == '0') || (!isred && str[i] == '1')){stack++;}
			else{
				stack--;
				ans += 2;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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

int main() {

	int N, X;
	cin >> N >> X;

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

	int sum = 0;
	int ans = 1;
	for(int i = 0; i < N; i++){
		sum += L[i];
		if (sum > X){
			break;
		}	
		ans += 1;
	}

	cout << ans << endl;


	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    long long sum=0;
    for(int i=0;i<s.length();i++)
    {
        int p=(int)s[i] - '0';
        sum+=p;
    }
    if(sum%9==0)
    {
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }
    return 0;
}


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

int main(){
    string s; cin >> s;
    int s_size = s.size();
    int ans = 2;
    
    for(int i = 0; i < s_size/2; i++){
        int half_size = s.size() / 2;
        if(s.substr(0, half_size) == s.substr(half_size, half_size) && i != 0){
            ans = s.size();
            break;
        }
        s.pop_back();
        s.pop_back();
    }
            
    cout << ans << endl;
        
       
}

Measured memory_bytes: 256
<?php
fscanf(STDIN, "%d %d %d", $n, $m, $x);

$books = array();
for ($i=0; $i < $n; $i++) {
  $book = explode(' ', trim(fgets(STDIN)));
  $books[] = $book;
}

$fst = 10000000;
$ans = $fst;

for ($i=0; $i < 1<<$n; $i++) {
  $cost = 0;
  for ($k=1; $k <= $m; $k++) {
    $ms[$k] = 0;
  }

  for ($j=0; $j < $n; $j++) {
    if ($i>>$j&1) {
      $cost += $books[$j][0];
      for ($k=1; $k <= $m; $k++) {
        $ms[$k] += $books[$j][$k];
      }
    }
  }

  $ok = true;
  for ($j=1; $j <= $m; $j++) {
    if ($ms[$j] < $x) {
      $ok = false;
    }
  }

  if ($ok) {
    $ans = min($ans, $cost);
  }
}

if ($ans == $fst) {
  echo -1;
} else {
  echo $ans;
}


Measured memory_bytes: 16180
import Control.Monad
import Control.Applicative
import Data.List

main = do
  n <- readLn :: IO Int
  xs <- map read . words <$> getLine :: IO [Int]
  mapM_ putStrLn $ solve xs

solve :: [Int] -> [String]
solve xs = [intercalate " " (map show ys),show c]
  where
    (c,ys) = bsort (0,xs)

bsort :: (Ord a) => (Int, [a]) -> (Int, [a])
bsort (c, []) = (c,[])
bsort (c, xs) = (nnc, y : zs)
  where
    (nnc, zs) = bsort (nc, ys)
    (nc, (y:ys)) = bsort' (c, xs)

bsort' :: (Ord a) => (Int,[a]) -> (Int,[a])
bsort' (c,[x]) = (c,[x])
bsort' (c,(x:xs))
  | x <= y = (nc,x:y:ys)
  | otherwise = (nc+1,y:x:ys)
  where
    (nc,(y:ys)) = bsort' (c,xs)

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

int main() {
    int n, m; cin >> n >> m;
    vector<int> h(n);
    for (int i = 0; i < n; i++) {
        cin >> h.at(i);
    }
    vector<bool> good(n, true);
    for (int i = 0; i < m; i++) {
        int a, b; cin >> a >> b;
        a--; b--;
        if (h.at(a) < h.at(b)) {
            good.at(a) = false;
        }
        if (h.at(a) > h.at(b)) {
            good.at(b) = false;
        }
        if (h.at(a) == h.at(b)) {
            good.at(a) = false;
            good.at(b) = false;
        }
    }
    int cnt = 0;
    for (bool g: good) {
        if (g) {
            cnt++;
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 3756