akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cctype>
#define len length()
#define sz size()
#define rng(i, a, b) for(int i = a; i < b; i++)
#define rep(i, n) rng(i, 0, n)
#define srt(v) sort(v.begin(), v.end())
#define rev(s) reverse(s.begin(), s.end())
#define vi(a, n) vector<int> a(n)
#define vs(a, n) vector<string> a(n)
#define vc(a, n) vector<char> a(n)
#define psb(a) push_back(a)
#define ppb pop_back()
#define erc(S, i) S.erase(S.begin() + i)
#define ers(S, i, j) S.erase(S.begin() + i, S.begin() + j)
#define sp(n) cout << setprecision(n) << fixed
#define fst(s) s.at(0)
#define lst(s) s.at(s.len - 1)
typedef long long ll;
using namespace std;
int mod = 1000000007;

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

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    
    int a,b = 0;
    
    scanf("%d",&a);
    scanf("%d",&b);
    
    if(a < b){
        printf("a < b\n",a,b);
    }else if(a > b){
        printf("a > b\n",a,b);
    }else {
        printf("a == b\n",a,b);
    }
    return 0;
}



Measured memory_bytes: 2112
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<vector>
#include <algorithm>
#include<deque>
#include<queue>
#include<set>
#include <functional>
#include <cmath>


//マクロ
/*動かない・・・
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define REP(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _roverload3(_1,_2,_3,name,...) name
#define _rrep(i,n) repi(i,0,n)
#define rrepi(i,a,b) for(int i=int(a);i<int(b);++i)
#define RREP(...) _roverload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
//*/
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
#define REPS(i,n) for(int i=1; i<=(int)(n); ++i)
#define RREP(i,n) for(int i=(int)(n)-1; i>=0; --i)
#define RREPS(i,n) for(int i=(int)(n); i>0; --i)
#define FOR(i,s,e) for(int i=(int)(s); i<(int)(e); ++i)
#define RFOR(i,s,e) for(int i=(int)(e)-1; i>=(int)(s); --i)
//*/
#define All(a) (a).begin(),(a).end()
#define dump(x)  cerr << #x << " = " << (x) << endl;

//定数
#define INF 1e9
#define MOD (int)(1e9+7)

typedef long long ll;
typedef unsigned long long ull;
/*
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
//*/
using namespace std;

//とりあえず書いておく変数
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

//今回の変数
int n;
string s, t;

//使用する関数
template<class T>bool chmax(T &a, const T &b) {
	if (a < b) { a = b; return 1; }
	return 0;
}
template<class T>bool chmin(T &a, const T &b) {
	if (a > b) { a = b; return 1; }
	return 0;
}

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

	cin >> n;
	cin >> s >> t;

	REP(i, n) {
		cout << s[i] << t[i];
	}
	cout << endl;
}

Measured memory_bytes: 256
/*-------enazuma11----------------*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define pii pair<int,int>
#define pll pair<long long,long long>
#define all(v) v.begin(),v.end()
#define inc(a,n) sort(a,a+n)
#define dec(a,n) sort(a,a+n,greater<int>() )
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>b;i--)
#define F first
#define S second
#define M 1000000007
 

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	int t=1;
//	cin>>t;
	while(t--){
		
		ll a,b,c;
		cin>>a>>b>>c;
		ll rem=a-b;
		ll ans=c-rem;
		if(ans<0)
		ans=0;
		cout<<ans<<'\n';
	}
	return 0;
}


Measured memory_bytes: 256
n, k = map(int, input().split())
x = list(map(int, input().split()))

min_t = 10e9
for s in range(n - k + 1):
    e = s + k - 1
    l = min(x[s], 0)
    r = max(x[e], 0)

    t = min(-l, r) * 2 + max(-l, r)
    min_t = min(min_t, t)

print(min_t)

Measured memory_bytes: 14384
#from collections import deque,defaultdict
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7
#R = 998244353

def ddprint(x):
  if DBG:
    print(x)

n,k = inm()
a = inl()

# nxt loc for each val
prev = [-1]*200001
nxt = [-1]*(n+1)
for i in range(2*n):
    v = a[i%n]
    if 0<=prev[v]<n:
        nxt[prev[v]] = (i+1)%n
    prev[v] = i
#ddprint("nxt")
#ddprint(nxt)

# find loop
last = [-1]*(2*n)
cur = 0
cyc = 0
dolast = False
for i in range(2*n):
    last[cur] = cyc
    nx = nxt[cur]
    if nx<cur+2:
        if cyc==k-1:
            dolast = True
            break
        cyc += 1 + (1 if cur==n-1 and nx==0 else 0)
    cur = nx
    if last[nx]>=0:
        break
#ddprint(f"1 {cyc=} {cur=} last {last[nx]}")

if not dolast:
    # loop: last[cur]*n + cur .. cyc*n + cur
    d = cyc-last[nx]
    cyc += ((k-1-cyc)//d)*d
    #ddprint(f"2 {cyc=} {cur=} {d=} last {last[nx]}")

    # cyc*n + cur
    while cyc<k:
        nx = nxt[cur]
        if nx<cur+2:
            if cyc==k-1:
                break
            cyc += 1 + (1 if cur==n-1 and nx==0 else 0)
        cur = nx
#ddprint(f"3 {cyc=} {cur=}")

# last one mile
last = [-1]*200001
b = [] #[a[cur]]
#last[a[cur]] = cur
if cyc<k:
  for i in range(cur,n):
    j = last[a[i]]
    if j>=0:
        while b[-1]!=a[i]:
            last[b[-1]] = -1
            b.pop()
        last[b[-1]] = -1
        b.pop()
    else:
        b.append(a[i])
        last[a[i]] = i

# output
pad = ''
for x in b:
    printn(pad+str(x))
    pad = ' '
print('')


Measured memory_bytes: 109340
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int price = 700;
  cin >> s;
  if(s[0] == 'o') price = price +100;
  if(s[1] == 'o') price = price +100;
  if(s[2] == 'o') price = price +100;
  cout << price << endl;
}


Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int l,i,n;
    char ch[1000];
    cin>>ch>>n;
    l=strlen(ch);
    for(i=0;i<l;i=i+n)
    {
        cout<<ch[i];
    }
    cout<<endl;

    return 0;

}


Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>

using namespace std;

#define INF 2140000000
#define MOD 1000000007

int main() {
	int n;

	cin >> n;

	long long num, sum = 0, minn = INF, cnt = 0;

	for (int i = 0; i < n; ++i) {
		cin >> num;

		if (num < 0) {
			cnt++;
		}

		sum += abs(num);
		minn = min(minn, abs(num));
	}

	if (cnt % 2 == 0) {
		cout << sum << endl;
	}
	else {
		cout << sum - 2 * minn << endl;
	}

	return 0;
}

Measured memory_bytes: 384
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <cassert>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#define ALL(v) begin(v),end(v)
#else
#define ALL(v) (v).begin(),(v).end()
#endif

using namespace std;


namespace{
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}
template <class T> inline T &chmin(T &x, const T &y){ return x = min(x, y); }
template <class T> inline T &chmax(T &x, const T &y){ return x = max(x, y); }
template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8

inline LL get(const vector<LL> &a, int i){
	return i < 0 ? 0LL : a[i];
}

void mainmain(){
	int n, q;
	scanf("%d%d", &n, &q);
	--n;
	vector<LL> as(n + 1);
	for(int i = 1; i <= n; ++i){
		scanf("%lld", &as[i]);
	}
	LL last;
	scanf("%lld", &last);

	vector<LL> acc(n + 1);
	vector<LL> acc2(n + 1);
	for(int i = 1; i <= n; ++i){
		acc[i] = acc[i - 1] + as[i];
		acc2[i] = get(acc2, i - 2) + as[i];
	}

	for(; q--; ){
		LL x;
		scanf("%lld", &x);
		
		int low = 0, high = n / 2;
		while(low < high){
			int num1 = (low + high + 1) >> 1;

			bool ok = false;
			if(num1 == 0){ ok = true; }
			else{
				int rt = n - num1 + 1;
				LL dif = as[rt] - x;
				if(dif >= 0){
					int lt = lower_bound(ALL(as), max(x - dif, 1LL)) - as.begin();
					
					int num2 = rt - lt;
					if(num2 >= num1){ ok = true; }
				}
			}
			
			if(ok){ low = num1; }
			else{ high = num1 - 1; }
		}

		LL ans = 0;
		if(low == 0){
			ans = get(acc2, n - 1);
		}
		else{
			int rt = n - low + 1;
			LL dif = as[rt] - x;
			int lt = lower_bound(ALL(as), max(x - dif, 1LL)) - as.begin();
			lt = max(lt, rt - low);
			
			ans = get(acc, n) - get(acc, rt - 1) + get(acc2, lt - 2);
		}
		printf("%lld\n", ans + last);
	}
}



}
int main() try{
//	ios::sync_with_stdio(false); cin.tie(0);
	cout << fixed << setprecision(10);
	cerr << fixed << setprecision(4);
	mainmain();
}
catch(...){}


Measured memory_bytes: 4096
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def floor_sum(n, m, a, b):
    res = 0
    if a >= m:
        res += (n - 1) * n * (a // m) // 2
        a %= m
    if b >= m:
        res += n * (b // m)
        b &= m
    y_max = (a * n + b) // m
    x_max = (y_max * m - b)
    if y_max == 0:
        return res
    res += (n - (x_max + a - 1) // a) * y_max
    res += floor_sum(y_max, a, m, (a - x_max % a) % a)
    return res


def resolve():
    t = int(input())
    for _ in range(t):
        n, m, a, b = map(int, input().split())
        print(floor_sum(n, m, a, b))


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 9260
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}
 
ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
 
//-----------------------ここから-----------

ll dp[1010][100100] = {0};
int main(void){
    int h, n;
    cin >> h >> n;
 
    for(int i = 0; i < 1010; i++){
        for(int j = 0; j < 100100; j++){
            dp[i][j] = INF;
        }
    }
 
    dp[0][0] = 0;
 
    vector<int> w(n);
    vector<int> v(n);
    for(int i = 0; i < n; i++) cin >> v[i] >> w[i];
 
    for(int i = 0; i < n; i++){
        for(int j = 0; j <= h * 10; j++){
            dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
            if(j >= v[i]){ 
                dp[i + 1][j] = min(dp[i][j], dp[i + 1][j - v[i]] + w[i]);
            }
            //cout << i + 1 << "-" << j << " " << dp[i + 1][j] << endl;
        }
    }
 
    ll ans = INF;
    for(int i = h; i <= h * 10; i++){
        ans = min(ans, dp[n][i]);
    }
    cout << ans << endl;
}

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

const int MAX = 1000000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    // 前処理
    COMinit();
int x,y;
    cin>>x>>y;
    int a,b,c;
    int tx,ty;
    tx=x*2;
    ty=y*2;
    b=(tx-y)/3;
    a=(ty-x)/3;
    if((b<0)||((2*x-y)%3!=0)){cout<<0<<endl;return 0;}
    if((a<0)||((2*y-x)%3!=0)){cout<<0<<endl;return 0;}
    c=a+b;
    int n,k;
    n=c;
    k=a;
    // 計算例
    cout << COM(n, k) << endl;
}

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

int main(void){
  long long a[5];
  long long N;
  cin >> N;
  for(int i = 0; i < 5; i++){
    cin >> a[i];
  }
  
  long long cnt = 10000000000000000;
  for(int i = 0; i < 5; i++){
    if(cnt > a[i]){
      cnt = a[i];
    }
  }
  
  long long ans = 0;
  if((N % cnt) == 0){
    ans = ((N / cnt) - 1);
  }else{
    ans = (N / cnt);
  }
  cout << ans + 5 << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

const int INF = 1000000001;

int w[101], v[101];
int dp[101][100001];

int main() {
	int N, W;
	cin >> N >> W;
	for (int i = 1; i <= N; ++i) {
		cin >> w[i] >> v[i];
	}
	int sum_v = 0;
	for (int i = 1; i <= N; ++i) sum_v += v[i];

	for (int i = 0; i <= sum_v; ++i) dp[0][i] = INF;
	dp[0][0] = 0;

	for (int i = 1; i <= N; ++i) {
		for (int j = 0; j <= sum_v; ++j) {
			dp[i][j] = dp[i - 1][j];
			if (j >= v[i]) dp[i][j] = min(dp[i][j], dp[i - 1][j - v[i]] + w[i]);
		}
	}

	int ans = 0;
	for (int i = 0; i <= sum_v; ++i) {
		if (dp[N][i] <= W) ans = max(ans, i);
	}
	cout << ans << endl;
	return 0;
}


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

#define rep(i, n) for(int i=0; i<n; i++)

int N;
int a, b, c;
int x[1111], y[1111], z[1111], r[1111];
int state[333];

int main()
{
  while(cin >> a >> b >> c, a){
    int n = a + b + c;
    cin >> N;
    rep(i, N) cin >> x[i] >> y[i] >> z[i] >> r[i];
    rep(i, N) x[i] -= 1;
    rep(i, N) y[i] -= 1;
    rep(i, N) z[i] -= 1;

    rep(i, n) state[i] = 2;
    rep(i, N) if( r[i]) state[x[i]] = state[y[i]] = state[z[i]] = 1;
    rep(i, N) if(!r[i]){
      if(state[x[i]] == 1 && state[y[i]] == 1){ state[z[i]] = 0;  continue; }
      if(state[y[i]] == 1 && state[z[i]] == 1){ state[x[i]] = 0;  continue; }
      if(state[z[i]] == 1 && state[x[i]] == 1){ state[y[i]] = 0;  continue; }
    }

    rep(i, n) printf("%d\n", state[i]);
  }

  return 0;
}

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

int cmp(const void *a, const void *b){
	return *(int*)a - *(int*)b;
}

int getpair(const int *cards, int n){
	int flag = 0;
	if(n>=2 && cards[0] == cards[1]){
		flag = 0x1;
		if(n>=3 && cards[1] == cards[2]){
			flag = 0x100;
			if(n>=4 && cards[2] == cards[3]){
				flag = 0x1000;
			}else if(n==5 && getpair(cards+3, 2) == 0x1){
				flag = 0x101;
			}
		}else if(n==5 && getpair(cards+2, 3) == 0x100){
			flag = 0x101;
		}else if((n>=4 && getpair(cards+2, 2)) ||
			(n==5 && getpair(cards+3, 2))){
			flag = 0x10;
		}
	}
	return flag;
}

int main(void){
	int cards[5];
	int flag = 0;
	for(int i=0;i<5;++i){
		cards[i] = 0;
	}

	while(scanf("%d,%d,%d,%d,%d",
		cards, cards+1, cards+2, cards+3, cards+4) != EOF){
		qsort(cards, 5, sizeof(int), cmp);
		if(cards[0] + 1 == cards[1] &&
			cards[1] + 1 == cards[2] &&
			cards[2] + 1 == cards[3] &&
			cards[3] + 1 == cards[4]){
			puts("straight");
			continue;
		}else 
		if(cards[0] == 1 && cards[1] == 10 && cards[2] == 11 &&
			cards[3] == 12 && cards[4] == 13){
			puts("straight");
			continue;
		}
		for(int i=0; i<4; ++i){
			flag = getpair(cards+i, 5-i);
			if(flag > 0){ break; }
		}

		switch(flag){
		case 0x1000:
			puts("four card");
			break;
		case 0x101:
			puts("full house");
			break;
		case 0x100:
			puts("three card");
			break;
		case 0x10:
			puts("two pair");
			break;
		case 0x1:
			puts("one pair");
			break;
		case 0x0:
			puts("null");
			break;
		default:
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 0
a, b = map(int, input().split())

x1 = max(a, b)

if x1 == a:
  a = a-1
  x2 = max(a, b)
  print(x1+x2)
elif x1 == b:
  b = b-1
  x2 = max(a, b)
  print(x1+x2)

Measured memory_bytes: 3060
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	r := bufio.NewReader(os.Stdin)
	var x int
	fmt.Fscan(r, &x)

	if 100 >= x {
		fmt.Println(0)
		return
	}

	ans := 0
	num := 100
	for {
		ans++

		num = int(1.01 * float64(num))
		if num >= x {
			break
		}
	}
	fmt.Println(ans)

}

// Union-Find
type unionFind struct {
	d []int
}

func newUnionFind(n int) *unionFind {
	uf := new(unionFind)
	uf.d = make([]int, n)
	for i := 0; i < n; i++ {
		uf.d[i] = -1
	}
	return uf
}

func (uf *unionFind) find(x int) int {
	if uf.d[x] < 0 {
		return x
	}
	uf.d[x] = uf.find(uf.d[x])
	return uf.d[x]
}

func (uf *unionFind) unite(x, y int) bool {
	rootX := uf.find(x)
	rootY := uf.find(y)
	if rootX == rootY {
		return false
	}

	if uf.d[rootX] < uf.d[rootY] {
		uf.d[rootX] += uf.d[rootY]
		uf.d[rootY] = rootX
	} else {
		uf.d[rootY] += uf.d[rootX]
		uf.d[rootX] = rootY
	}

	return true
}

func (uf *unionFind) same(x, y int) bool {
	return uf.find(x) == uf.find(y)
}

func (uf *unionFind) size(x int) int {
	return -uf.d[uf.find(x)]
}

// mod combination
func modpow(a, n, mod int) int {
	res := 1
	for n > 0 {
		if n%2 != 0 {
			res = res * a % mod
		}
		a = a * a % mod
		n = n / 2
	}
	return res
}

func modcomb(n, a, mod int) int {
	x := 1
	y := 1
	for i := 0; i < a; i++ {
		x = x * (n - i)
		x %= mod
		y = y * (i + 1)
		y %= mod
	}
	return x * modpow(y, mod-2, mod) % mod
}

func modfactorial(n, mod int) int {
	result := 1
	for i := 1; i <= n; i++ {
		result = (result * i) % mod
	}
	return result
}

// Utility

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func primeFactor(x int) map[int]int {
	res := make(map[int]int)
	for i := 2; i*i <= x; i++ {
		for x%i == 0 {
			res[i]++
			x = x / i
		}
	}
	if x != 1 {
		res[x] = 1
	}
	return res
}

func divisor(x int) []int {
	res := make([]int, 0)
	for i := 1; i*i <= x; i++ {
		if x%i == 0 {
			res = append(res, i)
			if i != x/i {
				res = append(res, x/i)
			}
		}
	}
	return res
}

func gcd(x, y int) int {
	if y == 0 {
		return x
	}
	return gcd(y, x%y)
}

func lcm(x, y int) int {
	return x / gcd(x, y) * y
}

func reverseString(s string) string {
	r := []rune(s)
	for i, j := 0, len(r)-1; i < len(r)/2; i, j = i+1, j-1 {
		r[i], r[j] = r[j], r[i]
	}
	return string(r)
}

// Queue ...
type Queue []int

// pop ...
func (q *Queue) empty() bool {
	return len(*q) == 0
}

// push ...
func (q *Queue) push(i int) {
	*q = append(*q, i)
}

// pop ...
func (q *Queue) pop() (int, bool) {
	if q.empty() {
		return 0, false
	} else {
		res := (*q)[0]
		*q = (*q)[1:]
		return res, true
	}
}

// Stack ...
type Stack []int

// pop ...
func (s *Stack) empty() bool {
	return len(*s) == 0
}

// push ...
func (s *Stack) push(i int) {
	*s = append(*s, i)
}

// pop ...
func (s *Stack) pop() (int, bool) {
	if s.empty() {
		return 0, false
	} else {
		index := len(*s) - 1
		res := (*s)[index]
		*s = (*s)[:index]
		return res, true
	}
}


Measured memory_bytes: 1828
#include<stdio.h>
int main()
{
	int n;
	
	scanf("%d",&n);
	if(100>=n&&n>=64){
		puts("64");
	}else if(63>=n&&n>=32){
		puts("32");
	}else if(31>=n&&n>=16){
		puts("16");
	}else if(n>=15&&n>=8){
		puts("8");
	}else if(n>=7&&n>=4){
		puts("4");
	}else if(n!=1){
		puts("2");
	}else puts("1");
	
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long 
using namespace std;
int main(){
	ios::sync_with_stdio(false);
	int n;
	ll k;
	cin>>n>>k;
	vector<int> a;
	for(int i=0;i<n;++i){
		int val;
		cin>>val;
		a.push_back(val);
	}
	vector<int> b;
	b.push_back(1);
	int mp[1000000]={0};
	mp[1]++;
	int val = 1;
	while(1){
		if(mp[a[val-1]]){b.push_back(a[val-1]);mp[a[val-1]]++;break;}
		b.push_back(a[val-1]);
		mp[a[val-1]]++;
		val = a[val-1];
	}
	int rep = 0;
	int mpp[1000000]={0};
	for(int i=0;i<(int)b.size();++i){
		++mpp[b[i]];
		if(mpp[b[i]]>1){
			rep = b[i];
			break;
		}
	}
	int pos = 0;
	for(int i=0;i<(int)b.size();++i){
		if(rep==b[i]){
			pos = i;
			break;
		}
	}
	b.pop_back();
	if(k<pos+1){
		cout<<b[k]<<'\n';
	}
	else{
		k-=(pos+1);
		int mod = (k+1)%(b.size()-pos);
		cout<<b[pos+mod]<<'\n';
	}
}

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

int main()
{
  int k,n;
  cin>>k>>n;
  
  vector<int> a(n);
  for(int i=0;i<n;i++)
    cin>>a.at(i);
  
  int m;
  
  for(int i=0;i<n;i++)
  {
    int T,TR,minfor;
    if(i==0)
      T=k-(a.at(i)+k-a.at(n-1));
    else
      T=k-(a.at(i)-a.at(i-1));
    
    if(i==n-1)
      TR=k-(a.at(0)+k-a.at(i));
    else
      TR=k-(a.at(i+1)-a.at(i));
    
    minfor=min(T,TR);
    if(i==0)
      m=minfor;
    else
    {
      if(m>minfor)
        m=minfor;
    }
  }
  cout<<m<<endl;
  
}

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

#define rep(i, n) for(int i = 0; i < n; i++)

typedef long long ll;
using namespace std;
int mod = 1000000007;

int main(void){
    string S; cin >> S;
    ll lenS = S.length();
    int A[lenS+1] = {};
    rep(i, lenS+1) A[i] = -1;
    if(S[0] == '<'){
        int temp = 0;
        A[0] = 0;
        while(temp < lenS && S[temp] == '<') {A[temp+1] = A[temp]+1; temp++;}
    }
    rep(i, lenS){
        if(i-1 >= 0 && S[i-1] == '>' && S[i] == '<'){
            A[i] = 0;
            for(int j = i-1; j >= 0 && S[j] == '>'; j--){
                A[j] = max(A[j], A[j+1]+1);
            }
            for(int j = i; j < lenS && S[j] == '<'; j++){
                A[j+1] = A[j]+1;
            }
        }
    }
    if(S[lenS-1] == '>'){
        A[lenS] = 0;
        int temp = lenS;
        while(temp-1 >= 0 && S[temp-1] == '>'){
            A[temp-1] = max(A[temp-1], A[temp]+1);
            temp--;
        }
    }
    ll ans = 0;
    rep(i, lenS+1) ans += A[i]; 
    if(A[0] == -1) ans = (lenS+1)*lenS/2;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2820
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<numeric>
#include<algorithm>
#include<complex>
#include<queue>
#include<stdlib.h>
#include<map>
#include<cmath>
#include<stdio.h>
#include<stdlib.h>
#include<set>

#define ll long long int
#define MOD 1000000007

using namespace std;

int main(){
    string S;
    cin >> S;
    string S2 = "CODEFESTIVAL2016";
    int def=0;
    for(int i=0;i<S.size();i++){
        if(S[i]!=S2[i]){
            def++;
        }
    }
    cout << def << endl;
    return 0;
}


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

int main(){
  int N,L;
  cin >>N >>L;
  
  string S[N];
  for (int i=0;i<N;i++){
    cin>>S[i];
  }
  
  string temp;
  
  for (int i=0;i<N;i++){
    for (int j=0;j<N-1;j++){
      if(S[j]>S[j+1]){
        temp=S[j];
        S[j]=S[j+1];
        S[j+1]=temp;
      }
    }
  }
 
  
  
  for (int i=0;i<N;i++){
    cout<<S[i];
  }
  cout<<endl;

  return 0;
}

  

Measured memory_bytes: 256
lines = $stdin.read
array = lines.split("\n")

n = array[0].to_i

score_h = {}
1.upto(n) do |index|
  index,score = array[index].to_s.split(" ").map(&:to_i)
  score_h[index] = score
end

#puts "max value => #{score_h.keys.min} => #{score_h[score_h.keys.min]}"
#puts "min value => #{score_h.keys.max} => #{score_h[score_h.keys.max]}"

top      = score_h.keys.min - 1
interval = score_h.keys.max - score_h.keys.min + 1
bottom   = score_h[score_h.keys.max]

#puts "^ ... = #{score_h.keys.min - 1}"
#puts "| ... = #{interval}"
#puts "_ ... = #{score_h[score_h.keys.max]}"

puts top + interval + bottom


Measured memory_bytes: 20860
from collections import Counter

n = int(input())
s = input()
cnt_l = []
for i in range(n - 1):
  str1_cnt = Counter(s[:i + 1])
  str2_cnt = Counter(s[i + 1:])
  cnt_l.append(len(set(list(str1_cnt)) & set(list(str2_cnt))))
print(max(cnt_l))

Measured memory_bytes: 3316
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
using namespace std;
#define DEBUG(x) cout<<#x<<"="<<x<<endl
#define DEBUG2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<endl
typedef long long ll;
class Solver{
public:
    static const int MAXN=110;
    int K;
    char N[MAXN];
    ll C(int n,int k){
        if(n<0||k<0)return 0;
        ll r=1;
        for(int u=n-k+1;u<=n;u++)r*=u;
        for(int u=1;u<=k;u++)r/=u;
        return r;
    }
    void solve(){
        ios::sync_with_stdio(false);
        cin.tie(0);
        cin>>N>>K;
        ll ans=0;
        int len=strlen(N);
        int nz=0;
        for(int u=0;u<len;u++){
            int x=N[u]-'0';
            if(N[u]=='0'||nz>K)continue;
            ans+=(x-1)*C(len-u-1,K-nz-1)*pow(9,K-nz-1);
            ans+=C(len-u-1,K-nz)*pow(9,K-nz);
            nz++;
        }
        if(nz==K)ans++;
        cout<<ans;
    }
};
int main()
{
    // freopen("in.txt","r",stdin);
    (new Solver())->solve();
}

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

int main() {
  int N;
  cin >> N;
  long long sum=0;
  for (int i=0; i<N ; i++) {
      sum+=i+1;
  }
  int a,b,c;
  long long A,B,C;
  a=N/15;
  b=N/5;
  c=N/3;
  A=0;
  B=0;
  C=0;
  
  for (int i=0; i<a ; i++) {
      A+=i+1;
  }
  for (int i=0; i<b ; i++) {
      B+=i+1;
  }
  for (int i=0; i<c ; i++) {
      C+=i+1;
  }
  
  cout << sum-(5*B)-(3*C)+(15*A) << endl;
}

Measured memory_bytes: 3548
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using static System.Math;
 
public class Hello{
    public static void Main(){
        string[] input = ReadLine().Split(' ');
/*        int n = int.Parse(input[0]);
        int m = int.Parse(input[1]);
        int b = int.Parse(input[2]);*/
//        string temp = ReadLine();
//        int a = int.Parse(ReadLine());
//        int b = int.Parse(ReadLine());
//        string a = ReadLine();
//        string b = ReadLine();
        string c = "ABCDEF";
        int aa = c.IndexOf(input[0]);
        int bb = c.IndexOf(input[1]);
        if(input[0] == input[1]){
            WriteLine("=");
        }else if(aa > bb){
            WriteLine(">");
        }else{
            WriteLine("<");
        }
    }
}

Measured memory_bytes: 13280
#!python3.4
# -*- coding: utf-8 -*-
# abc154/abc154_b
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    S = i2s()
    print('x'*len(S))
    return

main()


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define INF (ll)1e18
#define MOD (ll)1e9 + 7
#define pb push_back

typedef long long ll;
typedef long long int llt;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

char dif = 'A' - 'a';
int mod = 1e9 + 7;
ll inf = 1e18;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    string s;
    cin >> n >> s;
    vector<int> a(n + 1);
    int sum = 0;
    a[0] = 0;
    for (int i = 0; i < n;i++){
        if(s[i]=='#'){
            a[i + 1] = a[i] + 1;
        }
        else
            a[i + 1] = a[i];
    }
    int mi = mod;
    for (int i = 0; i < n;i++){
        int x = a[i + 1] + (n - i - a[n] + a[i]);
        mi = min(mi, x);
    }
    cout << mi - 1 << endl;
    return 0;
}

Measured memory_bytes: 1428
#include<iostream>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<cmath>
using namespace std;

class Dice {



public:

	int men[6];
	int men2[6];
	void rolling(char s) {
		if (s == 'N') {
			men2[0] = men[1];
			men2[1] = men[5];
			men2[2] = men[2];
			men2[3] = men[3];
			men2[4] = men[0];
			men2[5] = men[4];
			 
			for (int i = 0; i < 6; i++) {
				men[i] = men2[i];
			}

		}
		if (s == 'E') {
			men2[0] = men[3];
			men2[1] = men[1];
			men2[2] = men[0];
			men2[3] = men[5];
			men2[4] = men[4];
			men2[5] = men[2];
			for (int i = 0; i < 6; i++) {
				men[i] = men2[i];
			}

		}
		if (s == 'W') {
			men2[0] = men[2];
			men2[1] = men[1];
			men2[2] = men[5];
			men2[3] = men[0];
			men2[4] = men[4];
			men2[5] = men[3];
			for (int i = 0; i < 6; i++) {
				men[i] = men2[i];
			}

		}
		if (s == 'S') {
			men2[0] = men[4];
			men2[1] = men[0];
			men2[2] = men[2];
			men2[3] = men[3];
			men2[4] = men[5];
			men2[5] = men[1];
			for (int i = 0; i < 6; i++) {
				men[i] = men2[i];
			}

		}
	}

};
int main() {
	string str;
	Dice dice1;
	for (int i = 0; i < 6; i++) {
		cin >> dice1.men[i];
	}

	cin >> str;

	for (int i=0; i < str.size(); i++) {
		dice1.rolling(str[i]);
	}

	cout << dice1.men[0] << endl;
	return 0;

}



Measured memory_bytes: 3196
#include <iostream>
#include <algorithm>
#include <math.h> 
#include <string>
#include <iomanip>
#include <vector>
#include <chrono>
#include <cstdlib>
#include <bitset>
using namespace std;
int main(){
    string s;
    cin >> s;
    int l = s.length();
    for(int i = 0; i < l; i++) s[i] = 'x';
    cout << s << endl;
}

Measured memory_bytes: 3608
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC073A
{
    class Program
    {
        static void Main(string[] args)
        {
            string S;
            S = Console.ReadLine();
           if (S[0] == 'a' && S[1] == 'b' &&S[2] =='c')
                Console.WriteLine("Yes");

			else if(S[0] == 'b' && S[1] == 'a' && S[2] == 'c')
				Console.WriteLine("Yes");

			else if(S[0] == 'c' && S[1] == 'b' && S[2] == 'a')
				Console.WriteLine("Yes");

			 else if (S[0] == 'a' && S[1] == 'c' && S[2] == 'b')
				Console.WriteLine("Yes");

			else if (S[0] == 'b' && S[1] == 'c' && S[2] == 'a')
				Console.WriteLine("Yes");

			else if (S[0] == 'c' && S[1] == 'a' && S[2] == 'b')
				Console.WriteLine("Yes");
			else
                Console.WriteLine("No");
            Console.ReadKey();
        }
    }
}

Measured memory_bytes: 13140
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
#include <climits>
#include <queue>
#include <iomanip>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i = 0; i < (ll)(n); ++i)
template<class T> inline bool chmax(T& a, T b) { if(a < b){ a=b; return 1; } return 0;}
template<class T> inline bool chmin(T& a, T b) { if(a > b){ a=b; return 1; } return 0;}

vector<ll> get_prime(ll n){
	vector<ll> prime;
	
	for(ll i=1; i*i<=n; ++i){
		if(n%i!=0) continue;
		
		prime.push_back(i);
		if(i!=n/i) prime.push_back(n/i);
	}
	
	return prime;
}

int main(){
	ll n, m;
	cin >> n >> m;
	
	vector<ll> prime = get_prime(m);
	
	sort(prime.begin(),prime.end(),greater<ll>());
	
	REP(i,prime.size()){
		if(m/prime[i] >= n){
			cout << prime[i] << endl;
			return 0;
		}
	}
	cout << 1 << endl;
	
	return 0;
}

Measured memory_bytes: 3600
# -*- coding: utf-8 -*-
def solve():
    N = input()[::-1]+'00'
    res = 0
    c = 0
    for i in range(len(N)-1):
        r = int(N[i])+c
        c = r//10
        r %= 10
        r_ = (int(N[i+1])+c)%10
        if r < 5 or (r==5 and r_ < 5):
            res += r
        else:
            res += 10-r
            c += 1
    return str(res)

if __name__ == '__main__':
    print(solve())



Measured memory_bytes: 6668
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<map>
#include<functional>
#include<set>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
#define LOWER(a,x) lower_bound(ALL(a), x) - a.begin() - 1;
#define COUNT(a,x)  upper_bound(ALL(a), x) - lower_bound(ALL(a), x);
#define MCOUNT(a,x,y) upper_bound(ALL(a), y) - lower_bound(ALL(a), x);
#define INF 111111111111111111
#define MOD 1000000007
#define pb push_back
#define F first 
#define S second
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
ll n = 0, m = 0, ans = 0, sum = 0, cnt = 0, tmp = 0, ma = 0, mi = 0;
string s;
bool flag;
#pragma endregion
#define MAX 111111


int main(void) {
  vll a;
  FOR(i, 0, 3) {
	cin >> tmp;
	a.pb(tmp);
  }
  cin >> n;
  sort(ALL(a));
  cout << a[0] + a[1] + a[2] * pow(2, n) << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
#define INF 1LL<<60

int main() {
    int H, W, N;
    cin >> H >> W >> N;
    if(H > W) cout << ceil(double(N) / H) << endl;
    else cout << ceil(double(N) / W) << endl;

    return 0;
}

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

int main() {
	int n, m; cin >> n >> m;
	vector<long> h(n);
	vector<bool> good(n);
	for(int i = 0; i < n; i++) {
		cin >> h[i];
		good[i] = true;
	}
	int a, b, h_a, h_b;
	vector<set<int>> neighboor(n);
	for(int i = 0; i < m; i++) {
		cin >> a >> b;
		h_a = h[a - 1]; h_b = h[b - 1];
		if(h_a == h_b) {
			good[a - 1] = good[b - 1] = false;
		}
		else if(h_a > h_b) good[b - 1] = false;
		else good[a - 1] = false;
	}
	int c = 0;
	for(int i = 0; i < n; i++) {
		if(good[i]) c++;
	}
	cout << c << endl;
	return 0;
}


Measured memory_bytes: 8804
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << endl;
#define CFYN(n) cout << ( (n) ? "YES":"NO") << endl;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;

int main(void)
{
    IOS
    int n; cin >> n;
    if (n < 1200) cout << "ABC";
    else cout << "ARC";

    return 0;
}

Measured memory_bytes: 384
#![allow(unused)]

use std::{cell, cmp, collections, convert, fmt, io, iter, ops, str};

use cell::{Cell, RefCell};
use cmp::Ordering::{Equal, Greater, Less};
use collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, LinkedList, VecDeque};
use io::{Read, Write};

#[cfg(feature = "debug")]
macro_rules! debug {
    ($($args: tt)*) => { eprint!($($args)*) };
}

#[cfg(feature = "debug")]
macro_rules! debugln {
    ($($args: tt)*) => { eprintln!($($args)*) };
}

#[cfg(not(feature = "debug"))]
macro_rules! debug {
    ($($args:tt)*) => {};
}

#[cfg(not(feature = "debug"))]
macro_rules! debugln {
    ($($args:tt)*) => {};
}

macro_rules! vmax {
    ($x: expr, $y: expr) => { cmp::max($x, $y) };
    ($x: expr, $($args: expr),*) => { cmp::max($x, vmax!($($args),*)) };
}

macro_rules! vmin {
    ($x: expr, $y: expr) => { cmp::min($x, $y) };
    ($x: expr, $($args: expr),*) => { cmp::min($x, vmin!($($args),*)) };
}

fn main() {
    let (a, b) = {
        let ab = parse_vec::<i32>();
        (ab[0], ab[1])
    };

    let d = b - a;
    let heights = (d - 1) * d / 2;

    println!("{}", heights - a);
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test() {
        //
    }
}

fn read_line() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().to_owned()
}

fn read_word() -> String {
    const CAPACITY: usize = 16;

    let mut stdin = io::stdin();
    let mut byte: [u8; 1] = [0];

    loop {
        let mut buf = Vec::with_capacity(CAPACITY);

        loop {
            let res = stdin.read(&mut byte);

            if res.unwrap_or(0) == 0 || byte[0] <= b' ' {
                break;
            } else {
                buf.push(byte[0]);
            }
        }

        if !buf.is_empty() {
            return String::from_utf8(buf).unwrap();
        }
    }
}

fn parse_line<T: str::FromStr>() -> T {
    read_line().parse().ok().unwrap()
}

fn parse_word<T: str::FromStr>() -> T {
    read_word().parse().ok().unwrap()
}

fn parse_vec<T: str::FromStr>() -> Vec<T> {
    read_line()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn flush() {
    io::stdout().flush();
}

fn next_prime(x: i32) -> i32 {
    for i in (x + 1).. {
        if is_prime(i) {
            return i;
        }
    }

    panic!("attempt to add with overflow");
}

fn is_prime(x: i32) -> bool {
    let ceil = f64::from(x).sqrt().ceil() as i32;
    x == 2 || (2..(ceil + 1)).all(|i| x % i != 0)
}

fn bit_high(bits: u64, pos: u64) -> bool {
    bits & (1 << pos) != 0
}


Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <iomanip>
#include <deque>
#include <stdio.h>
using namespace std;

#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 FILL(Itr,n) fill((Itr).begin(),(Itr).end(),n)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
#define UNIQUE(Itr) sort((Itr).begin(),(Itr).end()); (Itr).erase(unique((Itr).begin(),(Itr).end()),(Itr).end())
#define LBOUND(Itr,val) lower_bound((Itr).begin(),(Itr).end(),(val))
#define UBOUND(Itr,val) upper_bound((Itr).begin(),(Itr).end(),(val))
typedef long long ll;
#define MOD 1000000007

ll N,M;

bool judge(long long x){
    ll Nt = N, Mt = M;
    Nt -= x;
    if(Nt<0){
        Mt -= abs(Nt)*2;
        Nt = 0;
    }
    Mt -= x*2;
    if(Mt>=0&&Nt>=0)return true;
    return false;
}

long long BinarySearchHighest(long long low, long long high){
    while(high-low>1){
        long long mid=(low+high)/2;
        if(judge(mid))low = mid;
        else high = mid;
    }
    return low;
}

int main(){
    
    cin>>N>>M;
    cout<<BinarySearchHighest(0,1e13)<<endl;
    
    return 0;
}


Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n,m=LI()
  if n==m:
    return 'Yes'
  return 'No'

# main()
print(main())


Measured memory_bytes: 8132
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb push_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef multiset<ll> S;
typedef priority_queue<ll> PQ;
typedef priority_queue<P,vector<P>,greater<P>> SPQ;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())outp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size()){rep(j,v[i].size()){if(j)cout<<' ';cout<<v[i][j];}cout<<'\n';}}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll modpow(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*modpow(a,b-1)%mod;ll k=modpow(a,b/2);return k*k%mod;}

int main(){
    string s;cin>>s;
    ll n=s.size();
    bool b=true;
    if(n%2){
        out("No");
        return 0;
    }
    for(int i=0;i<n;i+=2)if(s[i]!='h'||s[i+1]!='i')b=false;
    if(b)out("Yes");
    else out("No");
}

Measured memory_bytes: 256
a[3];m;main(i,n){for(scanf("%d",&i);m=~scanf("%d%d%d",a,a+1,a+2);puts(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]-m?"NO":"YES"))for(m=i=0;i<3;i++)if(n=2*a[i]*a[i],m<n)m=n;}

Measured memory_bytes: 580
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <numeric>
#include <random>
#include <algorithm>
#include <functional>
#include <cassert>

using namespace std;
typedef long long ll;

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 int INF = (1 << 30) - 1;
const ll INFLL= (1LL << 61) - 1;
const int MOD = 1000000007;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int N;
  ll ans=0;
  cin>>N;
  vector<vector<ll>> cnt(9,vector<ll>(9));
  FOR(i,1,N+1){
    string s=to_string(i);
    int f=s.front()-'0',b=s.back()-'0';
    if(f!=0 && b!=0){
      cnt[f-1][b-1]++;
    }
  }
  REP(i,9){
    REP(j,9){
      ans+=cnt[i][j]*cnt[j][i];
    }
  }
  cout<<ans<<endl;
}


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

using namespace std;
using ll = long long;

int main()
{
   int x, y, n, m, xi, yi, xmax=-100, ymin=100;
   cin>>n>>m>>x>>y;
   for (int i = 0; i < n; i++)
   {
       cin>>xi;
       xmax = max(xmax, xi);
   }
   for (int i = 0; i < m; i++)
   {
       cin>>yi;
       ymin = min(ymin, yi);
   }
   if(max(x,xmax) < min(y,ymin)){
       cout<<"No War";
   }
   else
   {
       cout<<"War";
   }
   
   
   
   return 0;
}


Measured memory_bytes: 3644
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b, c;
    cin >> a >> b >> c;
    set<int> st;
    st.insert(a);
    st.insert(b);
    st.insert(c);
    cout << st.size() << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int a,b,answer;
    char op;
    while(1){
        cin >> a >> op >> b;
        if(op == '+')
            answer = a + b;
        else if(op=='-')
            answer = a - b;
        else if(op=='*')
            answer = a * b;
        else if(op=='/')
            answer = a / b;
        else
            break;
        cout << answer << endl;
    }
    return 0;
}


Measured memory_bytes: 3096
#include <iostream>

using namespace std;

int n, heap[500001];

void maxHeapify(int i) {
    int l = i * 2;
    int r = i * 2 + 1;
    int maxi = i;
    if (l <= n && heap[l] > heap[maxi])
        maxi = l;
    if (r <= n && heap[r] > heap[maxi])
        maxi = r;
    if (maxi != i) {
        swap(heap[i], heap[maxi]);
        maxHeapify(maxi);
    }
}

void buildMaxHeap() {
    for (int i = n / 2; i >= 1; --i) {
        maxHeapify(i);
    }
}

int main() {
    int v;
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        cin >> v;
        heap[i] = v;
    }
    buildMaxHeap();
    for (int i = 1; i <= n; ++i)
        cout << " " << heap[i];
    cout << endl;

    return 0;
}




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

int main(){
    int l,r,N;
    cin >> N;
    int cnt = 0;
    for (int i = 0; i < N; i++) {
        cin >> l >> r;
        cnt = cnt + 1 + r - l;
    }
    cout << cnt << endl;
}


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

int a[200];
int main(){
	int n;scanf("%d",&n);
	rep(i,n)scanf("%d",&a[i]);
	int cnt=0;
	while(1){
		rep(i,n){
			if(a[i]%2){
				cout<<cnt<<endl;
				return 0;
			}
			else a[i]/=2;
		}
		cnt++;
	}
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    class QuestionD
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 整数の入力
            int n = int.Parse(Console.ReadLine());

            var sM = new List<string>();
            var sA = new List<string>();
            var sR = new List<string>();
            var sC = new List<string>();
            var sH = new List<string>();

            for (int i = 0; i < n; i++) {
                // 文字列の入力
                var temp = Console.ReadLine();
                if (temp[0] == 'M') {
                    sM.Add(temp);
                } else if (temp[0] == 'A') {
                    sA.Add(temp);
                } else if (temp[0] == 'R') {
                    sR.Add(temp);
                } else if (temp[0] == 'C') {
                    sC.Add(temp);
                } else if (temp[0] == 'H') {
                    sH.Add(temp);
                }
            }

            long count = 0;

            var ss = new List<string>[] { sM, sA, sR, sC, sH };

            for (int i = 0; i < 3; i++) {
                for(int j = i + 1; j < 4; j++) {
                    for(int k = j + 1; k < 5; k++) {
                        count += (long)ss[i].Count * ss[j].Count * ss[k].Count;
                    }
                }
            }

            Console.WriteLine(count);

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 14944