akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define INF 1e12

#define PB push_back
#define PF push_front
#define fi first
#define se second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vpi vector<pii>
#define vll vector<ll>
#define vpl vector<pll>
#define vvi vector<vector<int>>
#define vvl vector<vector<ll>>
#define MX(x) *max_element(all(x))
#define MN(x) *min_element(all(x))
#define ios ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define pr_d(x) cout << fixed << setprecision(15) << x << endl
#define ud(c, x) distance(c.begin(), upper_bound(all(c), x))
#define ld(c, x) distance(c.begin(), lower_bound(all(c), x))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define rep3(i, n) for (int i = (n - 1); i >= 0; --i)
#define rep4(i, a, b) for (int i = (a); i > (b); --i)
#define pb push_back
#define out(x) cout << x << "\n"
bool odd(int i) { return i % 2; }

#define all(v) v.begin(), v.end()
#define size(x) int(x.size())

int gcd(int a, int b) { return __gcd(a, b); }
int lcm(int a, int b) { return a * (b / gcd(a, b)); }
void Yes_No(bool f) {
  if (f)
    printf("Yes\n");
  else
    printf("No\n");
}

void deb_p(pii p) { printf("pair = %d %d\n", p.fi, p.se); }
void deb_i(int i) { printf("i = %d\n", i); }
void deb_v(vector<int> v) {
  printf("v = ");
  for (auto i : v) printf("%d ", i);
  printf("\n");
}
template <typename T>
bool chmax(T& a, const T& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T& a, const T& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
//-------------------ここから回答する-----------------------

void solve(void) {
  char a, b;
  cin >> a >> b;
  if (a == b)
    out("H");
  else
    out("D");
}
int main(void) { solve(); }

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
typedef pair<int,int> Pi;
typedef long long int ll;
const int INF=(ll)(1LL<<31)-1;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int n;

vector<int> okk;
int t[500][500];

int main(){
	for(int i=2;i<500;i++)
		okk.push_back(i*(i-1)/2);
	
	cin>>n;
	int k=0;
	for(k=0;k<okk.size();k++){
		if(n==okk[k])
			break;
		if(k==okk.size()-1){
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	k+=2;
	cout<<k<<endl;
	int lll=1;
	for(int i=0;i<k-1;i++){
		for(int j=i;j<k-1;j++){
			t[i][j]=lll;
			lll++;
		}
	}
	lll=1;
	for(int i=0;i<k-1;i++){
		for(int j=i;j<k-1;j++){
			t[j+1][i]=lll;
			lll++;
		}
	}
	
	for(int i=0;i<k;i++){
		cout<<k-1<<" ";
		for(int j=0;j<k-1;j++){
			cout<<t[i][j]<<" ";
		}
		cout<<endl;
	}
	return 0;
}
			
	
	
	
			

Measured memory_bytes: 2304
#include <bits/stdc++.h>
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end() 
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000
using namespace std;
typedef long long ll;

int main() {
    char Odd[3] = {'R', 'U', 'D'};
    char Eve[3] = {'L', 'U', 'D'};

    string S;
    cin >> S;

    bool flag;
    REP(i, S.length()){
        flag = false;
        if (i%2 == 0) {
            REP(j, 3){
                if (S[i] == Odd[j]) flag = true;
            }
        }
        else {
            REP(j, 3){
                if (S[i] == Eve[j]) flag = true;
            }
        }

        if(flag == false) break;
    }

    if (flag) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3600
x, y = map(int, input().split())
ax, ay = abs(x), abs(y)


def sign(x):
    if x == 0:
        return 0
    elif x > 0:
        return 1
    else:
        return -1


if x == 0 or y == 0:
    print(abs(x-y)+(x > y))
else:
    if sign(x) != sign(y):
        print(abs(ax - ay) + 1)
    else:
        if x < y:
            print(y - x)
        else:
            print(abs(ax - ay) + 2)


Measured memory_bytes: 8988
#include <stdio.h>

int N, p[212345];
int r[212345], ans[2][212345];

int main(void)
{
	scanf("%d", &N);
	for (int i = 0; i < N; ++i) { scanf("%d", &p[i]); }

	for (int i = 0; i < N; ++i)
	{
		r[p[i] - 1] = (i + 1);
	}
	for (int i = 0; i < N; ++i)
	{
		ans[0][i] = 30000 * (i + 1);
		ans[1][i] = 30000 * (N - (i + 1)) + r[i];
	}

	for (int i = 0; i < 2; ++i)
	{
		for (int j = 0; j < N - 1; ++j)
		{
			printf("%d ", ans[i][j]);
		}
		printf("%d\n", ans[i][N - 1]);
	}
	return 0;
}

Measured memory_bytes: 896
w,h,n = map(int,input().split())
fld = []
for i in range(h):
    l = []
    for j in range(w):
       l.append(0)
    fld.append(l)

for i in range(n):
    x,y,a = map(int,input().split())
    if a == 1:
        for j in range(h):
            for k in range(x):
                fld[j][k] = 1
    elif a == 2:
        for j in range(h):
            for k in range(x,w):
                fld[j][k] = 1
    elif a == 3:
        for j in range(w):
            for k in range(y):
                fld[k][j] = 1
    else:
        for j in range(w):
            for k in range(y,h):
                fld[k][j] = 1

cnt = 0
for i in range(h):
    for j in range(w):
        if fld[i][j] == 0:
            cnt += 1
print(cnt)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
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; }
//(a+b-1)/b

signed main(){
	ll a,b; cin>>a>>b;
    if(a%b==0)cout<<-1<<endl;
    else cout<<a<<endl;
	
	return 0;
}

Measured memory_bytes: 3580
#include <stdio.h>
#include <memory.h>
struct data{
	int h,w;
};
int main(void){
	struct data box[200];
	int n,t,d,i,minw,maxw,minh,maxh;
	while(1){
		scanf("%d",&n);
		if(!n)break;
		memset(box,0,sizeof(box));
		box[0].h=box[0].w=0;
		for(i=1;i<n;i++){
			scanf("%d %d",&t,&d);
			switch(d){
				case 0:box[i].w=box[t].w-1; box[i].h=box[t].h; break;
				case 1:box[i].w=box[t].w; box[i].h=box[t].h-1; break;
				case 2:box[i].w=box[t].w+1; box[i].h=box[t].h; break;
				case 3:box[i].w=box[t].w; box[i].h=box[t].h+1; break;
			}
		}
		minw=minh=202;
		maxw=maxh=-202;
		for(i=0;i<n;i++){
			if(box[i].w<minw)minw=box[i].w;
			if(box[i].w>maxw)maxw=box[i].w;
			if(box[i].h<minh)minh=box[i].h;
			if(box[i].h>maxh)maxh=box[i].h;
		}
		printf("%d %d\n",maxw-minw+1,maxh-minh+1);
	}
	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

const int MOD = 1000000007;

ll L[87];

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);
	L[0] = 2, L[1] = 1;
	FOR(i,2,87) L[i] = L[i-1]+L[i-2];
	
	int N; cin >> N;
	cout << L[N];
}

// read!
// ll vs. int!

Measured memory_bytes: 892
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
#include <ctime>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define mp make_pair
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
#define println(X) cout<<X<<endl;
#define DBG(X) cout<<#X<<" : "<<X<<endl;
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;
const double PI = acos(-1);

int main(){
	int n;
	cin>>n;
	vi a(n);
	rep(i, n) cin>>a[i];
	// if(n == 2 && a[0] == 1 && a[1] == 1){
	// 	cout<<"Possible"<<endl;
	// 	return 0;
	// }
	sort(all(a));
	map<int,int> m;
	rep(i, n) m[a[i]]++;
	bool f = true;
	//if(m[a.back()] < 2) f = false;
	if(a.back()%2==0){
		if(a[0] != a.back()/2) f = false;
		if(m[a[0]] == 1);
		else f = false;
	}
	else{
		if(a[0] != a.back()/2+1) f =false;
		if(m[a[0]]==2);
		else f = false;
	}
	// for(auto& p : m){
	// 	if(p.fi==a[0]) continue;
	// 	else if(p.se<2) f = false;
	// }
	for(int i = a[0]+1; i <= a.back(); i++){
		if(m[i]<2) f =false;
	}
	cout<<(f?"Possible":"Impossible")<<endl;

}

Measured memory_bytes: 256
import sys

for line in sys.stdin:
	l=map(int,line.split(','))
	v=l[-2:]
	del l[-2:]

	al=0
	for i in l:
		al+=i
	al=v[0]*al/float(v[0]+v[1])

	for i in range(10):
		al-=l[i]
		if al<=0:
			print i+1
			break

Measured memory_bytes: 4212
#include<bits/stdc++.h>
using namespace std;
#define int long long 
#define ii pair <int, int>
#define app push_back
const int N = 2e6 + 7;
const int MOD = 1000 * 1000 * 1000 + 7;
const int BASE = 129;
inline int mod(int n) {
    return (n % MOD + MOD) % MOD;
}   
int pw[N];
int h[N];
bool good[N];
int dist[N];
void calc(int n, int m) {
    for (int i = 0; i < n; ++i) dist[i] = N;
    queue <int> q;
    for (int i = 0; i < n; ++i) {
        if (!good[i]) {
            dist[i] = 0;
            q.push(i);
        }   
    }   
    while (q.size()) {
        int p = q.front(); q.pop();
        int pr = ((p - m) % n + n) % n;
        if (dist[p] + 1 < dist[pr]) {
            dist[pr] = dist[p] + 1;
            q.push(pr);
        }   
    }   
}   
signed main() {
    #ifdef HOME
    freopen("input.txt", "r", stdin);
    #else
    ios_base::sync_with_stdio(0); cin.tie(0);
    #endif
    pw[0] = 1;
    for (int i = 1; i < N; ++i) pw[i] = mod(pw[i - 1] * BASE);
    string s, t;
    cin >> s >> t;
    int n = s.size(), m = t.size();
    while (s.size() < t.size()) s += s;
    s += s;
    for (int i = 0; i < s.size(); ++i) h[i + 1] = mod(h[i] * BASE + s[i]);
    int w = 0;
    for (int i = 0; i < m; ++i) w = mod(w * BASE + t[i]);
    for (int i = 0; i < n; ++i) {
        good[i] = mod(h[i + m] - h[i] * pw[m]) == w;
    }   
    calc(n, m);
    int ans = 0;
    for (int i = 0; i < n; ++i) ans = max(ans, dist[i]);
    if (ans == N) cout << "-1\n";
    else cout << ans << '\n';
}   

Measured memory_bytes: 46428
import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List

main :: IO ()
main = do
  n <- getl read
  unless (n == 1) $ do
    putStrLn $ solve n
    main

solve :: Int -> String
solve x = show x ++ ": " ++ (unwords . map show) ans
  where
    ans = filter isPn $ nub $ as ++ (reverse bs)
    as = filter ((== 0).(mod x)) $ takeWhile ((<= x).(^2)) msnum
    bs = map (div x) as

msnum :: [Int]
msnum = 1:6:map (+7) msnum

pns :: [Int]
pns = 6 : filter isPn (drop 2 msnum)

isPn :: Int -> Bool
isPn 1 = False
isPn x = all ((/= 0) . mod x) $ takeWhile ((<= x) . (^2)) pns

getl :: (String -> a) -> IO a
getl f = f <$> getLine

Measured memory_bytes: 4240
n, ma, mb = map(int,input().split())
drag_list = []
a_sum = 0
b_sum = 0
for i in range(n):
    a, b, c = map(int,input().split())
    a_sum +=a
    b_sum +=b
    drag = [a,b,c]
    drag_list.append(drag)

INF = 100000
dp = [[[INF for k in range(401)]\
              for j in range(401)]\
              for i in range(n+1)]
dp[0][0][0] = 0
for i in range(n):
    A, B, C = drag_list[i]
    for a in range(a_sum+1):
        for b in range(b_sum+1):
            if dp[i][a][b] == INF:
                continue
            if A + a <= a_sum + 1 and B + b <= b_sum + 1:
                dp[i+1][a][b] = min(dp[i+1][a][b], dp[i][a][b])
                dp[i+1][a+A][b+B] = min(dp[i+1][a+A][b+B], dp[i][a][b] + C)
ans = INF
for a in range(1,401):
    for b in range(1,401):
        if a*mb == b*ma:
            ans = min(ans, dp[n][a][b])
print(-1 if ans == INF else ans)
import numpy as np
dp = np.array(dp)

Measured memory_bytes: 120572
def merge(A, left, mid, right):

    inf = float('inf')
    L = A[left:mid]+[inf]
    R = A[mid:right] + [inf]

    i = j = 0
    for k in range(left,right):
        if L[i] <= R[j]:
            A[k] = L[i]
            i += 1
        else:
            A[k] = R[j]
            j += 1
    return right - left


def mergeSort(A, left, right, count = 0):
    if left+1 < right:
        mid = (left + right)//2
        count = mergeSort(A, left, mid, count)
        count = mergeSort(A, mid, right, count)
        count += merge(A, left, mid, right)
    return count

n  = int(input())
A = list(map(int, input().split()))
ans = mergeSort(A, 0, n)
s = list(map(str, A))
print(' '.join(s))
print(ans)




Measured memory_bytes: 71460
#include<iostream>
#include<vector>
using namespace std;
typedef long long LL;

const int MAX_N=1005;
int n,m;
LL a[MAX_N];
vector<LL> v1,v2;

void Build();
int main()
{
	ios::sync_with_stdio(false);
	cin>>n>>m;
	for(int i=0;i<n;++i)
		cin>>a[i];
	for(int i=0;i<n;++i)
	{
		LL ss=0;
		for(int j=i;j<n;++j)
		{
			ss+=a[j];
			v1.push_back(ss);
		}
	}
	LL ans=0;
	for(int i=40;i>=0;--i)
	{
		v2.clear();
		LL p=((LL)1<<i);
		for(auto c:v1)
			if(c&p)	v2.push_back(c);
		if(v2.size()>=m){
			ans+=p;
			v1.clear();	v1=v2;
		}
	}
	cout<<ans<<endl;
	
	return 0;
}

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

Measured memory_bytes: 580
///HELLO THERE~!
///CREATED BY MD SADMAN MEHEDI SIVAN(IUT CSE[SWE'19])

#include<bits/stdc++.h>
using namespace std;

#define FASTIO          ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define READ            freopen("input.txt","r",stdin);
#define WRITE           freopen("red.txt","w",stdout);

using ll=long long;
using ull=unsigned long long;
const double pi = 2*acos(0.0);
const long long MX = 2e5+7;

int main()
{
    FASTIO;


    ll n;
    cin>>n;
    ll e=0,o=0;
    ll a[n+1];

    for(ll i=0; i<n; i++)
    {
        cin>>a[i];
        if(a[i]%2==0)
            e++;
        else
            o++;
    }
    ll r=o%2;
    ll g=e%2;
    if(o==0 && e>0)
    {
        cout<<"YES";
    }
    else if(e==0 && o>0)
    {
        if(o==1)
            cout<<"YES";
        else if(o%2==0)
            cout<<"YES";
        else
        {
            cout<<"NO";
        }
    }
    else if(o%2==0)
    {
        cout<<"YES";
    }
    else
    {
        cout<<"NO";
    }






    return 0;



}


Measured memory_bytes: 4440
#include<bits/stdc++.h>
using namespace std;
int N,M;
unordered_map<int,vector<int> > edges;
vector<int> dp(100005,-1);
int longestpath(int src,vector<bool> &visited){
	visited[src]=true;
	if(dp[src]!=-1)return dp[src];
	if(edges.find(src)==edges.end()){
		dp[src]=0;
		return 0;
	}	
	vector<int> edgelist=edges[src];
	int maxval=0;
	for(int i=0;i<edgelist.size();i++){
			maxval=max(maxval,longestpath(edgelist[i],visited));
	}
	return dp[src]=1+maxval;
}
int main(){
	ios_base:: sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	cin>>N>>M;
	int s,t;
	for(int i=0;i<M;i++){
		cin>>s>>t;
		edges[s].push_back(t);
	}
	vector<bool> visited(100005,false);
	int val;
	for(int i=1;i<=N;i++){
		if(visited[i]==false)
			val=longestpath(i,visited);
	}
	cout<<*max_element(dp.begin(),dp.end())<<endl;
	return 0;
}

Measured memory_bytes: 13604
# https://onlinejudge.u-aizu.ac.jp/courses/lesson/1/ALDS1/3/ALDS1_3_D
# これは少し難しい
# stackをうまく利用して個々の湖の面積を出せるかが重要
# 条件を満たしたら面積mergeをするにはどうしたら良いのか考えよう。

chikei = input()
v_lakes = []  # 個々の湖の面積管理用のstack # (面積の始まりのidx, 面積)
idx_stack = []  # 地形のindex管理用のstack

for i, c in enumerate(chikei):
    if c is '\\':
        idx_stack.append(i)
    elif c is '/' and idx_stack:
        j = idx_stack.pop()  # 今の/に対応する\の位置
        v = i-j
        # 可能であるならば面積merge
        # 今のjがv_lakesのj_preよりも小さかったら面積mergeができるということ
        while v_lakes and j < v_lakes[-1][0]:
            # すべての面積をmerge
            v += v_lakes.pop()[1]
        v_lakes.append((j, v))

ans = [len(v_lakes)]
v = [v[1] for v in v_lakes]
ans.extend(v)

print(sum(v))
print(*ans)



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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};


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

  ll x,t;
  cin >> x >> t;

  cout << max(0LL, x-t) << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
main(){
    int i,k,sum,frag;
    sum=0;
    while(scanf("%d",&k)!=EOF){
    	if(k==1||k==2){
    		sum++;continue;
    	}
    	if(k%2==0){
    		continue;
    	}
    	i=3;
    	frag=0;
        while(i*i<=k){
        	if(k%i==0){
        	 frag=1;break;
        	}
        	i+=2;
        }
        if(frag==0) sum++;
    }
    printf("%d\n",sum);
    return 0;
}

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a, b;
  cin >> a >> b;
  a += 12;
  b += 12;
  a %= 14, b %= 14;
  if (a == b) cout << "Draw" << '\n';
  else if (a > b) cout << "Alice" << '\n';
  else cout << "Bob" << '\n';
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int n;
  int i,j,k;
  int build[4][3][10]={{{}}};
  cin >> n;
  int b,f,r,v;
  for(i=0;i<n;i++){
    cin >> b >> f >> r >> v;
    build[b-1][f-1][r-1]+=v;
  }
  for(i=0;i<4;i++){
    for(j=0;j<3;j++){
      for(k=0;k<10;k++){
	cout << " ";
	cout << build[i][j][k];
      }
      cout << endl;
    }
    if(i<3)cout << "####################" << endl;
  }
  return 0;
}



Measured memory_bytes: 3104
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

typedef long long LL;

int len;
LL ans = 0;

char a[15];

LL chuli(int l, int r)
{
    LL aa = 0;
    for (int i = l; i <= r; i++)
    {
        aa *= 10;
        aa += a[i] - '0';
    }
    return aa;
}

void dfs(int l, int r, int jh, LL lss)
{
    if ((jh == 0 && r < len) || jh < 0 || (jh > 0 && r == len))
    {
        return;
    }
    if (jh == 0 && r == len)
        ans += lss;
    for (int j = r+1; j <= len; j++)
    {
        dfs(r+1, j, jh-1, lss + chuli(r+1,j));
    }
}

int main()
{
    scanf("%s", a+1);
    len = strlen(a+1);
    for (int i = 1; i < len; i++)
    {
        for (int j = 1; j < len; j++)
        {
            dfs(1, j, i, chuli(1, j));
        }
    }
    ans += chuli(1,len);
    cout << ans;
    return 0;
}


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

using namespace std;
using ll =long long;
typedef pair<int,int> P;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }
//Write From this Line

int main()
{
	int n;
	cin >> n;
	string s;
	cin >> s;
	int q;
	cin >> q;
	
	vector<set<int>> is(26);
	rep(i,n){
		is[s[i]-'a'].insert(i);
	}
	while(q--){
		int ty;
		cin >> ty;
		if(ty == 1){
			int i;
			cin >> i;
			i--;
			char c;
			cin >> c; 
			is[s[i]-'a'].erase(i);
			is[c-'a'].insert(i);
			s[i] = c;
		} else {
			int l, r;
			cin >> l >> r;
			l--,r--;
			int ans = 0;
			rep(i,26){
				// i番目のアルファベットがあるか
				auto it = is[i].lower_bound(l);
				if(it != is[i].end() && *it <= r) ans ++;
			}
			cout << ans << endl;
		}
	}
}


Measured memory_bytes: 24196
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int ans = 1;
  int n;
  int k;
  cin >> n >> k;
  for(int i=0;i<n;i++){
    if(ans <= k){
      ans *= 2;
    }
    else{
      ans += k;
    }
  }
  cout << ans << endl;
}

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

int main() {
  ll N,D;cin>>N>>D;ll X[N][2];ll s=0;
  for(int i=0;i<N;i++){
    cin>>X[i][0]>>X[i][1];
    if(X[i][0]*X[i][0]+X[i][1]*X[i][1]<=D*D)s++;
  }
  cout<<s<<endl;
}

Measured memory_bytes: 6760
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
  ll A,B,K;
  cin>>A>>B>>K;
  if(K<=A) {
cout<<A-K<<" "<<B<<endl;
  }
  else if (K<=A+B) {
cout<<0<<" "<<A+B-K<<endl;
  }
  else {
cout<<0<<" "<<0<<endl;
  }
}

Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)

int main(){
    int n, k; cin >> n >> k;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    sort(a.begin(), a.end());
    vector<int> cnt(n);
    rep(i,n){
        cnt[--a[i]]++;
    }
    sort(cnt.begin(), cnt.end());
    cnt.erase(remove(cnt.begin(), cnt.end(), 0), cnt.end());
    int len=cnt.size();
    int j=0;
    int ans=0;
    while(k < len){
        cnt[j]--;
        if(cnt[j]==0){
            len--;
            j++;
            ans++;
        }else{
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
a = int(input())
x = 0
y = 0
for i in range(a):
    b,c = input().split(' ')
    if b < c:
        x = x + 3
    elif b == c:
        x = x + 1
        y = y + 1
    elif b > c:
        y = y + 3
print(str(y) + ' ' + str(x))


Measured memory_bytes: 5596
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int MOD = 998244353;
		int N = sc.nextInt();
		int S = sc.nextInt();
		int[] A = new int[N];
		Arrays.setAll(A, i -> sc.nextInt());
		long[][] dp = new long[N+1][S+1];
		dp[0][0] = 1;
		for(int i = 0; i < N; i++) {
			for(int j = 0; j <= S; j++)
				dp[i+1][j] = dp[i][j] * 2 % MOD;
			for(int j = 0; j <= S; j++)
				if(j+A[i] <= S)
					dp[i+1][j+A[i]] += dp[i][j];
		}
		System.out.println(dp[N][S] % MOD);
	}

}

Measured memory_bytes: 137196
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll a,b,c,k;
    cin>>a>>b>>c>>k;
    ll ans=0;
    if(a<=k)
    {
        ans+=a;
        k-=a;
    }
    else
    {
        ans+=k;
        k=0;
    }
    if(b<=k)
    {
        k-=b;
    }
    else
    {
        k=0;
    }
    if(c<=k)
    {
        ans+=(c*-1);
        k-=c;
    }
    else
    {
        ans+=(k*-1);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3408
#include <bits/stdc++.h>
#define st first
#define nd second

using namespace std;

void debug_out() { cerr << endl; }
template<class T> ostream& prnt(ostream& out, T v) { out << v.size() << '\n'; for(auto e : v) out << e << ' '; return out;}
template<class T> ostream& operator<<(ostream& out, vector <T> v) { return prnt(out, v); }
template<class T> ostream& operator<<(ostream& out, set <T> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, map <T1, T2> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, pair<T1, T2> p) { return out << '(' << p.st << ' ' << p.nd << ')'; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}

#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(long long _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!\n"

// const long long N = ;
long long n, a, b, c, d;
int main() {
	ios_base::sync_with_stdio(false);

	cin >> n >> a >> b >> c >> d;

	long long req = b - a;
	for(long long i = 0; i < n; i++) {
		long long scad_min = - c * i;
		long long scad_max = - d * i;
		long long add_min = c * (n - 1 - i);
		long long add_max = d * (n - 1 - i);
		if(scad_min + add_max >= req && req >= scad_max + add_min)  {
			dbg(i, scad_min, scad_max, add_min, add_max);
			return cout << "YES\n", 0;
		}
	}
	cout << "NO\n";

}	

	

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<functional>
using namespace std;
int main()
{
	int  r = 0, b = 0;
	char s[100000];
	scanf("%s", s);
	int i = 0;
	while (s[i] != '\0') {
		if (s[i] == '0') r++;
		if (s[i] == '1') b++;
		i++;
	}
	printf("%d", min(r, b) * 2);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
  
int main(){
  int n;  cin>>n;
  vector<int>L(2*n);
  for(int i=0; i<2*n; i++){
    int l; cin>>l;
    L[i]=l;
  }
  sort(L.begin(),L.end());
  int sum=0;
  for (int i=0;i<n;i++){
    sum+=L[2*i];
  }
  cout<<sum<<endl;
}

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

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

    ll n,m;
    cin>>n>>m;
    ll ans=1e9;
    if(n==0){
        cout<<0<<endl;
        return 0;
    }
    for(ll i=n;i<min(m,n+3000);i++){
        for(ll j=i+1;j<=min(m,i+3000);j++){
            ans = min(ans,(i*j)%2019);
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <functional>
#include <typeinfo>

#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REP1(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREP1(i, x) for (int i = ((int)(x)); i > 0; i--)
/*
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

#define all(x) (x).begin(),(x).end()
*/

using namespace std;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    cout << a * b - (a + b - 1) << endl;
}

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

const int mxH = 1e3 + 2, MOD = 1e9 + 7;
int h, w, dp[mxH][mxH];
char grid[mxH][mxH];

int calc(int i, int j)
{
    if (i < 0 || j < 0)
        return 0;
    return dp[i][j];
}

int main()
{
    cin >> h >> w;
    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < w; j++)
        {
            cin >> grid[i][j];
        }
    }

    dp[0][0] = 1;
    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < w; j++)
        {
            if (grid[i][j] == '#')
            {
                dp[i][j] = 0;
            }
            else if (i == 0 && j == 0)
            {
                continue;
            }
            else
            {
                dp[i][j] = calc(i - 1, j) + calc(i, j - 1);
                dp[i][j] %= MOD;
            }
        }
    }

    cout << dp[h - 1][w - 1] << endl;
}

Measured memory_bytes: 8440
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

const int MOD_TYPE = 1;
const ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
const int INF = (int)1e9;
const ll LINF = (ll)4e18;
const ld PI = acos(-1.0);
const ld EPS = 1e-11;

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define possible(n) cout << ((n) ? "possible" : "impossible") << endl
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << endl;

vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

template <class Abel = ll>
struct UnionFind
{
  vector<int> par;
  vector<int> rank;
  vector<Abel> diff_weight;

  UnionFind(int N = 100010, Abel SUM_UNITY = 0)
  {
    init(N, SUM_UNITY);
  }

  void init(int N = 100010, Abel SUM_UNITY = 0)
  {
    par.resize(N);
    rank.resize(N);
    diff_weight.resize(N);
    for (int i = 0; i < N; ++i)
      par[i] = i, rank[i] = 0, diff_weight[i] = SUM_UNITY;
  }

  int root(int x)
  {
    if (par[x] == x)
    {
      return x;
    }
    else
    {
      int r = root(par[x]);
      diff_weight[x] += diff_weight[par[x]];
      return par[x] = r;
    }
  }

  Abel weight(int x)
  {
    root(x);
    return diff_weight[x];
  }

  bool issame(int x, int y)
  {
    return root(x) == root(y);
  }

  bool unite(int x, int y, Abel w)
  { //weight[y] = weight[x] + w
    w += weight(x);
    w -= weight(y);
    x = root(x);
    y = root(y);
    if (x == y)
      return false;
    if (rank[x] < rank[y])
      swap(x, y), w = -w;
    if (rank[x] == rank[y])
      ++rank[x];
    par[y] = x;
    diff_weight[y] = w;
    return true;
  }

  Abel diff(int x, int y)
  {
    return weight(y) - weight(x);
  }
};

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

  int n, m;
  cin >> n >> m;
  UnionFind<> uf;
  rep(i, m)
  {
    ll l, r, d;
    cin >> l >> r >> d;
    if (uf.root(l) == uf.root(r))
    {
      if (uf.weight(r) - uf.weight(l) != d)
      {
        Yes(false);
        return 0;
      }
    }
    else
    {
      uf.unite(l, r, d);
    }
  }
  Yes(true);
  return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
long long n,temp,i,j,s[100];
	
int main()
{
	cin>>n;
	temp=n;
	for(i=0;temp>=1;i++)
	{
		s[i]=temp%10;
		temp/=10;
	}
	temp=0;
	for(j=0;j<=i;j++)
		temp+=s[j];
	if(n%temp==0)
		cout<<"Yes";
	else
		cout<<"No";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <limits>
#include <cassert>
#define REP(i,n) for(long (i)=0;(i)<(n);(i)++)
#define REPI(i,a,b) for(long (i)=(a);(i)<(b);(i)++)
#define INF numeric_limits<double>::infinity()
constexpr long MOD = 998244353;
using namespace std;

int main() {
    long n;
    cin >> n;
    long ans = 0;
    for (long i = 1; i * i <= n; i += 1) {
        ans = i * i;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod107 1000000007
#define rep(i, n) for (int i = 0; i < n; ++i)
using Graph = vector<vector<int>>;
#define grepq priority_queue<double, std::vector<double>, std::greater<double>>
#define all(v) v.begin(), v.end()
#define PI acos(-1)
const ll INF = 10010001010;
const int inf = 1000034000;
typedef vector<ll> vecl;
typedef vector<int> veci;
typedef tuple<string, int, int> TUP;

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

uintmax_t combination(unsigned int n, unsigned int r)
{
    if (r * 2 > n)
        r = n - r;
    uintmax_t dividend = 1;
    uintmax_t divisor = 1;
    for (unsigned int i = 1; i <= r; ++i)
    {
        dividend *= (n - i + 1);
        divisor *= i;
    }
    return dividend / divisor;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //cout << fixed << setprecision(15);
    int N;
    cin >> N;
    vector<int> P(N);
    ll ans = 0;
    for (int i = 0; i < N; i++)
    {
        cin >> P[i];
    }
    for (int i = 0; i < N;i++)
    {
        if(i+1 == P[i]){
            if(i != 0){
                if(i != P[i]){
                    swap(P[i],P[i-1]);
                    ans++;
                    i++;
                }
            }
            else{
                swap(P[i],P[i+1]);
                ans++;
                i++;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3728
import std.stdio, std.algorithm, std.range, std.random, std.array, std.string, std.conv;

int[] merge(int[] a, int [] b) {
    auto xs = new int[a.length + b.length];
    int i, j;
    foreach (ref x; xs) {
        x = i >= a.length ? b[j++] :
            j >= b.length ? a[i++] :
            a[i] < b[j] ? a[i++] : b[j++];
    }
    return xs;
}
int[] merge_sort(int[] a) {
    if (a.length == 1) return a;
    auto xs = a[0 .. $ / 2],
         ys = a[$ / 2 .. $];
    return merge(merge_sort(xs), merge_sort(ys));
}

void main() {
    auto xs = readln.chomp.split(" ").map!(to!int).array;
    writefln("%(%s %)", xs.merge_sort.reverse);
}

Measured memory_bytes: 1092
#include <bits/stdc++.h>
#define H ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define ld long double
using namespace std;
const ll  mod = 3e7;

string bin(int x){
    string s = "00000";
    int i = 4;
    while (x){
        s[i--] = (x % 2) + '0';
        x /= 2;
    }
    return s;
}

string s, str;
int f[1000006], arr[1000006];
int getNxt(int len, char c){
    while (len && s[len] != c){
        len = f[len - 1];
    }
    if (s[len] == c)
        len++;
    return len;
}

void computeF(){
    f[0] = 0;
    for (int i = 1; i < s.size(); i++){
        f[i] = getNxt(f[i - 1], s[i]);
    }
}

void KMP(){
    computeF();
    int k = 0, ans = 0;
    for (int i = 0; i < str.size(); i++){
        k = getNxt(k, str[i]);
        arr[k]++;
    }

}

int main()
{
    H
    int n, k;
    cin >> n >> k;
    int arr[n];
    for (int i = 0; i < n; i++) cin >> arr[i];
    sort(arr, arr + n);
    int mn = 0x3f3f3f3f;
    for (int i = k - 1; i < n; i++){
        mn = min(arr[i] - arr[i - k + 1], mn);
    }
    cout << mn;
    return 0 ;
}

Measured memory_bytes: 640
#include <iostream>
#include <stdio.h>
using namespace std;
string s, s1;
int res;
int main()
{
    //freopen("test.inp","r", stdin);
    cin >> s >> s1;
    for (int i = 0; i < s.length(); i++) res += (s[i] != s1[i]);
    cout << res;
    return 0;
}


Measured memory_bytes: 3868
#include <stdio.h>

int main(){
  int n,m,i,temp,temp2,ans=0;
  scanf("%d %d",&n,&m);
  int high[n];
  int flag[n];
  for(i=0;i<n;i++){
    scanf("%d",&temp);
    high[i]=temp;
    flag[i]=0;
  }
  for(i=0;i<m;i++){
    scanf("%d %d",&temp,&temp2);
    if(high[temp-1]>high[temp2-1]){
      flag[temp2-1]++;
    }else if(high[temp-1]<high[temp2-1]){
      flag[temp-1]++;
    }else{
      flag[temp-1]++;
      flag[temp2-1]++;
    }
  }
  for(i=0;i<n;i++){
    if(flag[i]==0){
      ans++;
    }
  }
  printf("%d\n",ans);
  return 0;  
}  

Measured memory_bytes: 2512
#include <bits/stdc++.h>
const long long MOD = 1e9+7;
using namespace std;
#define ll long long
#define ar array

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

	int N;
	cin >> N;
	cout << (N*800)-(N/15*200) << endl;
	return 0;
}


Measured memory_bytes: 3616
#include <iostream>
using namespace std;
int main(){
 uint64_t a,b,k;
  cin >> a >> b >> k;
  if(a + b <= k){
    cout << "0 0";
  }
  else if(a <= k && a + b > k){
    cout << "0 " << a+b-k;
  }
  else{
    cout << a-k << " " << b;
  }
  
  return 0;
}

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

using namespace std;

typedef long long ll;

const ll M = 1e9 + 7;

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, d;
    cin >> n >> d;
    if (d == 100) {
        ++d;
    }
    while (n--) {
        d *= 100;
    }
    cout << d;
    return 0;
}

Measured memory_bytes: 256
s = gets.chomp.chars

n = s.length
m = (n-1)/2
u = (n+3)/2

mae = s[0..m-1]
ushiro = s[u-1..n-1]

if mae == mae.reverse && ushiro == ushiro.reverse && s == s.reverse
  puts "Yes"
else
  puts "No"
end

Measured memory_bytes: 3836
N = int(input())
S = [input() for _ in range(N)]

ans = 0
b_start = 0
a_end = 0
b_start_and_a_end = 0
for s in S:
    ans += s.count("AB")
    if s[0] == "B" and s[-1] == "A":
        b_start_and_a_end += 1
    elif s[0] == "B":
        b_start += 1
    elif s[-1] == "A":
        a_end += 1

ans += min(b_start, a_end)

if b_start == 0 and a_end == 0:
    ans += max(0, b_start_and_a_end - 1)
else:
    ans += b_start_and_a_end

print(ans)

Measured memory_bytes: 3700
#define ENABLE_DEBUG 1
// Kana's kitchen {{{
#include<bits/stdc++.h>
#define ALL(v) std::begin(v),std::end(v)
#define LOOP(k) for(i64 ngtkana_is_a_genius=0; ngtkana_is_a_genius<(i64)k; ngtkana_is_a_genius++)

using i32 = std::int_least32_t;
using i64 = std::int_least64_t;
using u32 = std::uint_least32_t;
using u64 = std::uint_least64_t;
using usize = std::size_t;

template <class T, class U> using pair = std::pair<U, T>;
template <class T> using diag_pair = std::pair<T, T>;
template <class... Args> using tuple = std::tuple<Args...>;
template <class T> using vec = std::vector<T>;
template <class T> using numr = std::numeric_limits<T>;

#ifdef NGTKANA
#include<debug.hpp>
#else
#define DEBUG(...)(void)0
#endif
/*}}}*/

int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    std::cout << std::setprecision(15) << std::fixed;

    u32 x = 0, coeff = 100;
    for (usize i=0; i<3; i++, coeff/=10) {
        u32 y;
        std::cin >> y;
        x += coeff * y;
    }
    std::cout << (x % 4 == 0 ? "YES" : "NO") << '\n';
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
 
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
 
//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef long long LL;
typedef pair<long, long> PLL;
 
//container util
//------------------------------------------
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define ALL(a)  (a).begin(),(a).end()
//constant
//--------------------------------------------
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

const LL MOD=1e9+7;



int main(){
    int N,M;
    cin>>N>>M;
    vector<int>res(N+2,0);
    REP(i,M){
        int L,R;
        cin>>L>>R;
        res[L]+=1;res[R+1]-=1;
    }
    int sum=0;
    int cnt=0;
    FOR(i,1,N+1){
        sum+=res[i];
        if(sum==M){
            cnt++;
        }
    }
    cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 640
//https://atcoder.jp/contests/dp/tasks/dp_h
#include<bits/stdc++.h>
#define m 1000000007
using namespace std;
typedef long long ll;
int h,w,dp[1001][1001],vis[1001][1001];
char arr[1001][1001];
int row[]={1,0},col[]={0,1};
bool issafe(int r,int c)
{
    if(r>=h||c>=w)
        return false;
    if(arr[r][c]=='#')
        return false;
    return true;
}
ll go(int r,int c)
{
    if(r==h-1&&c==w-1)
        return 1;
    int rn,cn;
    ll ans=0;
    for(int i=0;i<2;i++)
    {
        rn=r+row[i],cn=c+col[i];
        if(issafe(rn,cn))
        {
            if(vis[rn][cn]!=0)
            {
                ans=(ans+dp[rn][cn])%m;
            }
            else
            {
                vis[rn][cn]=1;
                dp[rn][cn]=go(rn,cn);
                ans=(ans+dp[rn][cn])%m;
            }

        }
    }
    return ans;
}
int main()
{
    memset(dp,0,sizeof(dp));
    memset(vis,0,sizeof(vis));
    cin>>h>>w;
    for(int i=0;i<h;i++)
        for(int j=0;j<w;j++)
           cin>>arr[i][j];
    cout<<go(0,0)<<'\n';
}


Measured memory_bytes: 9216
#include<iostream>
#include<map>
using namespace std;
typedef long long int LL;
const LL INF=(LL)1<<35;
map<LL,int> m1,m2;
LL s[100005];

LL min(LL a,LL b){
	return a<b?a:b;
}
LL max(LL a,LL b){
	return a>b?a:b;
}

int main(){
	int n,m,q;
	LL a,b,c,d,e,f,g;
	int i,j,k;
	cin>>n>>m>>q;
	for(i=0;i<n;i++){
		cin>>a;
		m1[a]=1;
	}
	for(i=0;i<m;i++){
		cin>>a;
		m2[a]=1;
	}
	m1[INF]=1,m1[-INF]=1,m2[INF]=1,m2[-INF]=1;
	for(i=0;i<q;i++){
		cin>>a;
		auto itr1=m1.lower_bound(a);
		auto itr2=m2.lower_bound(a);
		b=itr1->first,c=itr2->first;
		itr1--,itr2--;
		d=itr1->first,e=itr2->first;
		s[i]=min(max(b,c)-a,a-min(d,e));
		f=min(b-a,a-e)+b-e;
		g=min(c-a,a-d)+c-d;
		s[i]=min(s[i],min(f,g));
	}
	for(i=0;i<q;i++){
		cout<<s[i]<<endl;
	}
	return 0;
}
		


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

#define    ll     long long int

vector<int> p, q, r;
int a, b, c;
int x, y;
ll s = 0;

int main( )
{
    cin >> x >> y >> a >> b >> c;
    int i, j, k;
    for (i = 0; i < a; i++) {
        cin >> j;
        p.push_back(j);
    }
    for (i = 0; i < b; i++) {
        cin >> j;
        q.push_back(j);
    }
    for (i = 0; i < c; i++) {
        cin >> j;
        r.push_back(j);
    }
    sort(p.rbegin(), p.rend());
    sort(q.rbegin(), q.rend());
    for (i = 0; i < x; i++) {
        r.push_back(p[i]);
    }
    for (i = 0; i < y; i++) {
        r.push_back(q[i]);
    }
    sort(r.rbegin(), r.rend());
    for (i = 0; i < (x + y); i++) {
        s += r[i];
    }
    cout << s << '\n';
    return 0;
}


Measured memory_bytes: 3188
//A'が回文であるとは？→対称な位置に同じ文字がある
//Aが回文アナグラムであるとは？→4個ペア, 2個ペア, 1個ペアをそれぞれ何個作るか
//4個ペアから順に作ったほうがよさそう。
#include <iostream>
#include <string>
#define rep(i, n) for (i = 0; i < n; i++)
using namespace std;

int h, w;
string s[100];
int cnt[26];

int main() {
	int i, j;
	
	cin >> h >> w;
	rep(i, h) cin >> s[i];
	rep(i, h) rep(j, w) cnt[s[i][j] - 'a']++;
	
	int cnt4 = (h / 2) * (w / 2);
	int cnt2 = (h % 2) * (w / 2) + (w % 2) * (h / 2);
	int cnt1 = (h % 2) * (w % 2);
	
	while (cnt4 > 0) {
		rep(i, 26) {
			if (cnt[i] >= 4) { cnt4--; cnt[i] -= 4; break; }
		}
		if (i == 26) { cout << "No" << endl; return 0; }
	}
	
	while (cnt2 > 0) {
		rep(i, 26) {
			if (cnt[i] >= 2) { cnt2--; cnt[i] -= 2; break; }
		}
		if (i == 26) { cout << "No" << endl; return 0; }
	}
	
	while (cnt1 > 0) {
		rep(i, 26) {
			if (cnt[i] >= 1) { cnt1--; cnt[i] -= 1; break; }
		}
		if (i == 26) { cout << "No" << endl; return 0; }
	}
	
	cout << "Yes" << endl;
	return 0;
}

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

int main()
{
    int n,a,c,i,sum;
    double m,b;
    sum=0; b=0;i=0;
    while(~scanf("%d,%lf",&n,&m))
    {     i++;
        a=n*m;
        sum+=a;
        b+=m;
    } 
    b=b/i*10;
    c=(int)(b);
     if(c%10>=5)
        c=c/10+1;
        else c=c/10;
 printf("%d\n%d\n",sum,c);
    return 0;
}



Measured memory_bytes: 1984
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define ll long long
#define imfor(i, n) for(int i = 0; i < n; i++)
using namespace std;
ll MOD = 1000000007;

int main() {
    int n;
    cin >> n;
    ll ans = 1;
    imfor(i, n) {
        ans = (ans * (i + 1)) % MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import math

n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

times = [a, b, c, d, e]
counts = [math.ceil(n/a)-1, math.ceil(n/b)-1, math.ceil(n/c)-1, math.ceil(n/d)-1, math.ceil(n/e)-1]
ans = 0
for i in range(5):
    ans += max((counts[i]-ans),0)

ans += 5

print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define rep(i,m,n) for(int (i)=(m);(i)<(n);++(i))
#define rREP(i,m,n) for(int (i)=(n)-1;(i)>=(m);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr ll INF = (ll)1e9;
constexpr double PI = 3.1415926535897932;
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;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

int main() {
	init();

	int data[6];
	rep(i, 0, 6) {
		int a; cin >> a;
		data[i] = a;
	}
	vector<int>dp(data[5] + 1, -1);
	dp[0] = 0;
	rep(i, 0, data[5] + 1) {
		if (dp[i] == -1)continue;
		if (i + 100 * data[0] < data[5] + 1) {
			dp[i + 100 * data[0]] = 0;
		}
		if (i + 100 * data[1] < data[5] + 1) {
			dp[i + 100 * data[1]] = 0;
		}
	}
	rep(i, 0, data[5] + 1) {
		if (dp[i] == -1)continue;
		if (i + data[2] < data[5] + 1 && data[4] * (i - dp[i]) >= 100 * (dp[i] + data[2])) {
			chmax(dp[i + data[2]], dp[i] + data[2]);
		}
		if (i + data[3] < data[5] + 1 && data[4] * (i - dp[i]) >= 100 * (dp[i] + data[3])) {
			chmax(dp[i + data[3]], dp[i] + data[3]);
		}
	}
	int index = data[0];
	rep(i, 0, data[5] + 1) {
		if (dp[i] < 0)continue;
		if (i * dp[index] <= index * dp[i]) {
			index = i;
		}
	}
	cout << index << " " << dp[index] << "\n";

	return 0;
}

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

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

int main(){
    ios::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0);
    int n , m;
    cin >> n >> m;
    string arr[n + 1];
    
    for (int i = 0; i < n; ++i) {
        cin >> arr[i];
    }


    ll dd[n + 1][m + 1];
    memset(dd , 0 , sizeof(dd));

    dd[1][1] = 1;

    for(int i = 2 ; i <= m ; i ++) {
        if(arr[0][i - 1] == '#')
            dd[1][i] = 0;
        else
            dd[1][i] = dd[1][i-1];
    }

    for (int i = 2; i <= n; ++i) {
        for (int j = 1; j <= m; ++j) {
           if(arr[i-1][j-1] != '#') dd[i][j] = (dd[i][j-1]% M + dd[i-1][j]% M) % M;
           else
                dd[i][j] = 0;
        }
    }


    cout << dd[n][m];

}

Measured memory_bytes: 9088