akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <string>
#include <unordered_map>
#include <queue>
#include <set>

using namespace std;

#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;


int main(){
    int n;
    cin >> n;
    int a[2][n], tmp;
    rep(i, 2) rep(j, n) {
        cin >> tmp;
        if (j == 0) a[i][j] = tmp;
        else a[i][j] = a[i][j - 1] + tmp;
    }
    int result = 0;
    rep(i, n) {
        if (i == 0) tmp = a[0][i] + a[1][n - 1];
        else tmp = a[0][i] + a[1][n - 1] - a[1][i - 1];
        result = max(result, tmp);
    }
    cout << result << endl;
    return 0;
}


Measured memory_bytes: 256
def examA():
    S = SI()
    ans = S[:3]
    print(ans)
    return

def examB():
    A, V = LI()
    B, W = LI()
    T = I()
    L = abs(A-B)
    v = V-W
    if v*T>=L:
        ans = "YES"
    else:
        ans = "NO"
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

def test():
    i = I()
    li = LI()
    lsi = LSI()
    si = LS()
    print(i)
    print(li)
    print(lsi)
    print(si)
    return

from decimal import Decimal as dec
import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def DI(): return dec(input())
def LDI(): return list(map(dec,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examB()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Measured memory_bytes: 77004
#include <bits/stdc++.h>
using namespace std;
#define REP(name, stop) for (ll(name) = 0; (name) < (stop); (name)++)
using ll = long long;
using vi = vector<ll>;

int main(void) {
    ll n;
    cin >> n;
    set<string> giveaway;
    REP(i, n) {
        string s;
        cin >> s;
        giveaway.insert(s);
    }
    cout << giveaway.size() << endl;

    return 0;
}


Measured memory_bytes: 19168
#include <stdio.h>
#define max 25
#define null -1
typedef struct
{
	int p,l,r;	
}Node;
Node T[max];

void preorder(int root)
{
	if(root==null)
		return;		
		printf(" %d",root);
		preorder(T[root].l);
		preorder(T[root].r);		
}

void inorder(int root)
{
	if(root==null)
		return;					
		inorder(T[root].l);
		printf(" %d",root);
		inorder(T[root].r);
}

void postorder(int root)
{
	if(root==null)
		return;				
		postorder(T[root].l);
		postorder(T[root].r);
		printf(" %d",root);
}

int main(int argc, char *argv[])
{
	int i,n,node,left,right,root;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	T[i].p=null;
	for(i=0;i<n;i++)
	{
		scanf("%d%d%d",&node,&left,&right);
		T[node].l=left;
		T[node].r=right;
		if(left!=null)
		T[left].p=node;
		if(right!=null)
		T[right].p=node;
	}
	for(i=0;i<n;i++)
	if(T[i].p==null)
	{
	root=i;	
	break;
	}
	printf("Preorder\n");
	preorder(root);
	printf("\nInorder\n");
	inorder(root);
	printf("\nPostorder\n");
	postorder(root);
	printf("\n");
	return 0;
}

Measured memory_bytes: 1808
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>

using namespace std;

int main(){
	int N;
	while(cin>>N,N){
		vector<int> num(N);
		for(int i=0;i<N;i++){
			int a;
			cin>>a;
			num[i]=a;
		}
		int cnt=0;
		while(1){
			map<int,int> mp;
			vector<int>::iterator it=num.begin();
			for(;it!=num.end();it++){
				mp[*it]++;
			}
			bool flag=false;
			for(int i=0;i<N;i++){
				if(num[i]!=mp[num[i]]){
					flag=true;
				}
			}
			if(!flag){
				break;
			}
			for(int i=0;i<N;i++){
				num[i]=mp[num[i]];
			}
			cnt++;
		}
		cout<<cnt<<endl;
		for(int i=0;i<N;i++){
			cout<<num[i];
			if(i!=N-1){
				cout<<' ';
			}
		}
		cout<<endl;
	}
	return 0;
}

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

int main(){
  int n, l;
  cin >> n >> l;
  vector <string>  s(n);
  for( int i = 0; i < n; ++i ) cin >> s.at(i);

  sort(s.begin(), s.end());

  for( int i = 0; i < n; ++i ){
    cout << s.at(i);
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#define pb push_back
#define mp make_pair
#define p1 first
#define p2 second
using namespace std;

const int N = 1e5+5;
int n, m, b[N], a, j;

int main()
{
    //freopen("a.inp","r",stdin);

    cin >> n;
    for(int i=1; i<=n; ++i) {
        scanf("%d",&a); a = -a;
        j = upper_bound(b+1, b+1+m, a) - b;
        m = max(m, j); b[j] = a;
    }
    cout << m;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef double D;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef long double ld;

#define rd(x) scanf("%d",&x)
#define rd2(x,y) scanf("%d %d",&x,&y)
#define rl(x) scanf("%lld",&x)
#define rl2(x,y) scanf("%lld %lld",&x,&y)
#define wd(x) printf("%d" ,x)
#define wd2(x,y) printf("%d %d",x,y)
#define wl(x) printf("%lld",x)
#define wl2(x,y) printf("%lld %lld",x,y)
#define PC(x) putchar(x)
#define GC() getchar()
#define NL printf("\n")
#define SP printf(" ")
 
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define F first
#define S second
#define MP make_pair
#define PB push_back

#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define fr(i,s,e) for(int i=s;i<e;i++)
#define frl(i,s,e) for(ll i=s;i<e;i++)
#define frr(i,s,e) for(int i=s-1;i>=e;i--)
#define frv(i,a) for(int i = 0;i<(int)a.size();i++)
#define frvr(i,a) for(int i = a.size()-1;i>=0;i--)
#define tr(i,a) for(typeof(a.begin()) i = a.begin(); i != a.end();i++)

#define inf 10000000000000
#define mod 1000000007
#define maxn 100009
#define maxr 100009
int main(){
	//sstd::ios::sync_with_stdio(false); cin.tie(NULL);
	ll a,b;
	rl2(a,b);
	if((a+b)%2==0)
	{
		ll k=(a+b)/2;
		cout<<k<<endl;
	}
	else
		cout<<"IMPOSSIBLE"<<endl;
	return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

typedef long long ll;

const ll inf = 1 << 30;
const ll mod = 1000000000 + 7;


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

	vector<pair<int, int>> p(n);
	for (int i = 0; i < n; i++)
	{
		int a, b;
		cin >> a >> b;

		p.at(i) = make_pair(a, b);
	}

	sort(p.begin(), p.end(), [](const pair<int, int>& a, const pair<int, int>& b)
	{
		return a.second < b.second;
	});

	bool ok = true;
	ll tm = 0;
	for (int i = 0; i < n; i++)
	{
		tm += p.at(i).first;
		if (tm > p.at(i).second)
		{
			ok = false;
			break;
		}
	}

	cout << (ok ? "Yes" : "No") << endl;
}

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

int main(){
  int N;
  vector<int> a;
  cin >> N;
  for(int i=0; i<N; i++){
    int x; cin >> x;
    a.push_back(x);
  }
  sort(a.begin(), a.end());
  int dist=0;
  for(int i=0; i<N-1; i++){
    dist+=a[i+1]-a[i];
  }
  cout << dist << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
ll gcd(ll a,ll b){
  if(b==0) return a;
  return gcd(b,a%b);
}
ll lcm(ll a,ll b){
  return a*b/gcd(a,b);
}
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

template<typename T> inline bool chmax(T& a,T b) { if (a < b) { a = b; return true; } return false; }
template<typename T> inline bool chmin(T& a,T b) { if (a > b) { a = b; return true; } return false; }
const int MOD = 1e9+7;

int dx4[] = {0, 0, +1, -1};
int dy4[] = {+1, -1, 0, 0};
const int mx=25;

char ch[mx][mx];
int visit[mx][mx],dis[mx][mx];
int n,m;

void bfs(int a,int b){
  visit[a][b]=1;
  queue<pii>q;
  q.push(make_pair(a,b));
  while(!q.empty()){
    pii p=q.front();
    q.pop();
    rep(i,4){
      int u=p.first+dx4[i];
      int v=p.second+dy4[i];
      if(u>=0 && u<n && v>=0 && v<m && ch[u][v]=='.' && visit[u][v]==0){
        dis[u][v]=1+dis[p.first][p.second];
        visit[u][v]=1;
        q.push(make_pair(u,v));
      }
    }
  }
}

int main() {
  cin >> n >> m;
  rep(i,n){
    rep(j,m)cin >> ch[i][j];
  }
  int ans=0;
  rep(i,n){
    rep(j,m){
      if(ch[i][j]=='.')bfs(i,j);
      rep(k,n){
        rep(l,m){
          ans=max(ans,dis[k][l]);
          visit[k][l]=dis[k][l]=0;
        }
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {

	var N int
	var S string
	fmt.Scanf("%d", &N)
	fmt.Scanf("%s", &S)

	for i := 0; i < len(S); i++ {
		if int(S[i])+N <= int('Z') {
			fmt.Printf("%s", string(int(S[i])+N))
		} else {
			fmt.Printf("%s", string(int(S[i])+N-26))
		}
	}
	fmt.Printf("\n")
}


Measured memory_bytes: 2144
#include <iostream>

using namespace std;

int main(void){
    int pre, cur;
    pre=getchar();
    for(int i = 1; i < 4; i++){
        cur=getchar();
        if(pre==cur){
            printf("Bad\n");
            return 0;
        }
        pre=cur;
    }
    printf("Good\n");
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    static ArrayList<Integer>po=new ArrayList<>();
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        aaa("",9);
        Collections.sort(po);
        po.add(1000000000);
        int i=0;
        for(;po.get(i)<=n;i++){}
        System.out.println(i);
    }
    public static void aaa(String a,int n){
        if(a.replace("3","").replace("7","").length()!=0&&a.replace("3","").replace("5","").length()!=0&&a.replace("5","").replace("7","").length()!=0){
            po.add(Integer.parseInt(a));
        }
        if(n!=0){
            aaa(a+3,n-1);
            aaa(a+5,n-1);
            aaa(a+7,n-1);
        }
    }
}


Measured memory_bytes: 88832
#include<iostream>
using namespace std;
int main(){
	int n,m,t;
	int a[2][105];
	int i,j,k;
	int s=0,s2=0;
	cin>>n;
	for(i=0;i<2;i++){
		for(j=0;j<n;j++){
			cin>>a[i][j];
			if(i==1)s2+=a[i][j];
		}
	}
	for(i=0;i<n;i++){
		s2+=a[0][i];
		if(s<s2)s=s2;
		s2-=a[1][i];
	}
	cout<<s<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
typedef long long ll;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};
using namespace std;
int main(int argc, char const *argv[]) {
  long long int a,b,c,k;
  cin>>a>>b>>c>>k;
  ll ans = k%2== 0 ? a-b:b-a;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
n, a, b, c = map(int, input().split())
ls = [int(input()) for i in range(n)]

ans = float("inf")
d = [a,b,c]

def calc_cost(aa, bb, cc):
    if len(aa)*len(bb)*len(cc) == 0:
        return -1
    cost = 0
    for ind, lis in enumerate([aa,bb,cc]):
        cost += 10*(len(lis)-1) + abs(sum(lis) - d[ind])
    return cost

def DFS(depth, aa, bb, cc):
    global ans
    if depth == n:
        cost = calc_cost(aa,bb,cc)
        if cost >= 0:
            ans = min(ans, cost)
        return
    for i in range(4):
        next_a = aa[::] + [[], [ls[depth]]][i%4 == 1]
        next_b = bb[::] + [[], [ls[depth]]][i%4 == 2]
        next_c = cc[::] + [[], [ls[depth]]][i%4 == 3]
        DFS(depth+1, next_a, next_b, next_c)

DFS(0, [],[],[])
print(ans)

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

void fnInput(int &rnElmCnt, vector<int> &rvnElm, int &rnTrgCnt , vector<int> &rvnTrg )
{
  cin >> rnElmCnt;

  rvnElm.resize(rnElmCnt);
  for (int i = 0; i < rnElmCnt; i++)
    cin >> rvnElm[i];

  cin >> rnTrgCnt;

  rvnTrg.resize(rnTrgCnt);
  for (int i = 0; i < rnTrgCnt; i++)
    cin >> rvnTrg[i];
}

void fnDPtblMake(vector<vector<int>> &rvvnDP, const vector<int> &cnrvnElm, int nMaxTrg)
{
  rvvnDP[cnrvnElm.size()][0] = 1;
  for (int j = 1; j <= nMaxTrg; j++)
    rvvnDP[cnrvnElm.size()][j] = 0;

  for (int i = cnrvnElm.size() - 1; i >= 0; i--)
    for (int j = 0; j <= nMaxTrg; j++)
      if (cnrvnElm[i] <= j)
        rvvnDP[i][j] = rvvnDP[i + 1][j] || rvvnDP[i + 1][j - cnrvnElm[i]];
      else
        rvvnDP[i][j] = rvvnDP[i + 1][j];

}

void fnExhSch(const vector<int> &cnrvnElm, const vector<int> &cnrvnTrg)
{
  vector<vector<int>> vvnDP(21, vector<int>(2001, -1));

  int nMaxTrg = cnrvnTrg[0]; 
  for (int i = 1; i < cnrvnTrg.size(); i++)
    nMaxTrg = max(nMaxTrg, cnrvnTrg[i]);

  fnDPtblMake(vvnDP, cnrvnElm, nMaxTrg);

  for (int i = 0; i < cnrvnTrg.size(); i++)
    if (vvnDP[0][cnrvnTrg[i]])
      cout << "yes" << endl;
    else
      cout << "no" << endl;
}

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

  int nElmCnt, nTrgCnt;
  vector<int> vnElm, vnTrg;

  fnInput(nElmCnt, vnElm, nTrgCnt, vnTrg);
  fnExhSch(vnElm, vnTrg);

  return 0;
}

Measured memory_bytes: 1344
s = input()
A = []

for i in range(len(s)-2):
    tmp = s[i]+s[i+1]+s[i+2]
    A.append(tmp)

ans = 753

for j in range(len(A)):
    tmp = abs(753-int(A[j]))
    if ans > tmp:
        ans = tmp
print(ans)
    

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

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

	while (1) {
		int n = sqrt(x) + 1;
		if (n == x) {
			n--;
		}

		int i = 2;
		for (; i <= n; ++i) {
			if (x%i == 0) {
				break;
			}
		}
		if (i == n + 1) {
			break;
		}
		++x;
	}

	cout << x << endl;

	return 0;
}

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

int main() {
  int A, B, C, X;
  cin >> A >> B >> C >> X;

  int ans = 0;
  rep(a, A + 1) rep(b, B + 1) rep(c, C + 1) {
    if (500 * a + 100 * b + 50 * c == X)
      ans++;
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

class Main {

	public static void main(String[] args) throws Exception {
		final Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[3];
		for (int i = 0; i < n; i++) {
			a[sc.nextInt() - 1]++;
		}

		double[][][] dp = new double[305][305][305];
		for (int i = 0; i <= n; i++) {
			for (int j = 0; j <= n; j++) {
				for (int k = 0; k <= n; k++) {
					double ijk = i + j + k;
					if (ijk == 0) continue;
					dp[i][j][k] = n;
					if (i > 0) dp[i][j][k] += i * dp[i - 1][j + 1][k];
					if (j > 0) dp[i][j][k] += j * dp[i][j - 1][k + 1];
					if (k > 0) dp[i][j][k] += k * dp[i][j][k - 1];
					dp[i][j][k] /= ijk;
				}
			}
		}

		System.out.println(dp[a[2]][a[1]][a[0]]);
	}
}


Measured memory_bytes: 304212
from collections import Counter
import sys
input=sys.stdin.buffer.readline
h,w,n=map(int,input().split())
cc=Counter()
for _ in range(n):
    b,a=map(int,input().split())
    for i in range(3):
        for j in range(3):
            x=a+i
            y=b-j #brute forcing valid bottom right corners
            if x>=1 and x<=w and y>=1 and y<=h:
                if x-2>=1 and x-2<=w and y+2>=1 and y+2<=h:
                    cc[(x,y)]+=1
#                    print(x,y,end=' xy\n')#a valid 3*3 grid bottom right
ans=[0]*10
for i in cc.keys():
    ans[cc[(i)]]+=1
ans[0]=(h-2)*(w-2)-sum(ans)
print(*ans,sep='\n')


Measured memory_bytes: 166896
#include<iostream>
#include<algorithm>
#include<climits>
#include<vector>
#include<utility>
#include<cmath>
#include<string>
#include<cstring>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define prin(arg) std::cout<<arg<<"\n"
#define prin2(arg1,arg2) std::cout<<arg1<<" "<<arg2<<"\n"
#define fill(arg,n) memset(arg,n,sizeof(arg))
using std::cin;
typedef long long ll;
typedef std::pair<int,int> pi;
typedef std::vector<int> vi;
const int INF=1e+9;
const ll INFLL=1e+17;
int N;
ll a[200010],b[200010],aa[200010],bb[200010];
//二分探索
int upper(int l,int r,ll x){
  int lb=l-1,ub=r+1;
  while(ub-lb>1){
    int mid=(ub+lb)/2;
    if(x<=bb[mid]) ub=mid;
    else lb=mid;
  }
  return ub;
}/*
int lower(int l,int r,int x){
  int lb=l-1,ub=r+1;
  while(ub-lb>1){
    int mid=(ub+lb)/2;
    if(bb[mid]<x) lb=mid;
    else ub=mid;
  }
  return lb;
  }*/
//数列a,bのmodをとってsort
void make_ab(ll mod){
  rep(i,N){
    aa[i]=a[i]%mod;
    bb[i]=b[i]%mod;
  }
  std::sort(bb,bb+N);
}
void solve(){
  ll mod=2,res=0;
  rep(i,30){
    make_ab(mod);
    ll cnt=0;
    rep(j,N){
      cnt+=upper(0,N-1,mod-aa[j])-upper(0,N-1,mod/2-aa[j]);
      cnt+=upper(0,N-1,3*mod/2-aa[j])-upper(0,N-1,2*mod-aa[j]);
    }
    if(cnt%2==1) res+=mod/2;
    mod*=2;
  }
  prin(res);
}
int main(){
  cin>>N;
  rep(i,N) cin>>a[i];
  rep(i,N) cin>>b[i];  
  solve();
  return 0;
}


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

int main(void){
	char alp[27] = {'z','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y'};
	long long N;
	cin >> N;
	string ans = "";
	while (N > 0){
	long long tmp = N%26;
	ans += alp[tmp];
	N -= tmp;
	if (tmp == 0) N -= 26;
	N /= 26;
	}

	reverse(ans.begin(), ans.end());
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3632
fun main(args: Array<String>) {
    val (M1, D1) = readLine()!!.split(' ').map(String::toLong)
    val (M2, D2) = readLine()!!.split(' ').map(String::toLong)
    if (M2 == M1 + 1 && D2 == 1L) {
        println(1)
    } else {
        println(0)
    }
}

Measured memory_bytes: 38116
#11_A
import random
class Dice:
    def __init__(self, numbers):
        self.dice=[i for i in numbers]
        self.workspace=[i for i in numbers]
        
        self.top=self.dice[0]
        
        
    def rotate(self,command):
        if command == "W":
            self.workspace=[self.dice[2], self.dice[1], self.dice[5], self.dice[0], self.dice[4], self.dice[3]]
            self.dice=self.workspace
        elif command == "E":
            self.workspace=[self.dice[3], self.dice[1], self.dice[0], self.dice[5], self.dice[4], self.dice[2]]
            self.dice = self.workspace
        
        if command == "S":
            self.workspace=[self.dice[4], self.dice[0], self.dice[2], self.dice[3], self.dice[5], self.dice[1]]
            self.dice=self.workspace
        elif command == "N":
            self.workspace=[self.dice[1], self.dice[5], self.dice[2], self.dice[3], self.dice[0], self.dice[4]]
            self.dice=self.workspace
            
    def get_top(self):
        self.top=self.dice[0]
        print(self.top)
        
    def predict(self, num):
        for i in range(num):
            top, front = map(int, input().split())
            while(True):
                if top == self.dice[0] and front == self.dice[1]:
                    break
                command_num=random.randint(1,4)
                if command_num == 1:
                    self.rotate("W")
                elif command_num == 2:
                    self.rotate("E")
                elif command_num == 3:
                    self.rotate("S")
                elif command_num == 4:
                    self.rotate("N")
            print(self.dice[2])
            
    def getter(self):
        return self.dice[0], self.dice[1], self.dice[2], self.dice[3], self.dice[4], self.dice[5]
    
    def predict_same(self, top, front, right, left, back, bottom):
        for n in range(300):
            if top ==self.dice[0] and front== self.dice[1] and right ==self.dice[2]:
                break
            command_num=random.randint(1,4)
            if command_num == 1:
                    self.rotate("W")
            elif command_num == 2:
                    self.rotate("E")
            elif command_num == 3:
                    self.rotate("S")
            elif command_num == 4:
                    self.rotate("N")
        
        if top ==self.dice[0] and front== self.dice[1] and right ==self.dice[2]:
            if self.dice[3] == left and self.dice[4] == back and self.dice[5] == bottom:
                return "Yes"
                
            else:
                return "No"
                
        else:
            return "No"
            
        
            
                
    
        
#11_C
numbers1=list(map(int,input().split()))
numbers2=list(map(int,input().split()))
dice1=Dice(numbers1)
dice2=Dice(numbers2)
top, front, right, left, back, bottom=dice1.getter()

print(dice2.predict_same(top, front, right, left, back, bottom))






Measured memory_bytes: 8208
#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e3 + 10;
typedef long long ll;
int x; 
int main() {
	scanf("%d",&x);
	ll ans = 1ll * x / 500 * 1000;
	x %= 500;
	ans += 1ll * x / 5 * 5;
	printf("%lld\n",ans);
	return 0;
}

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

using ll = int64_t;
#define int ll

#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()

using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  REP(i, (int)v.size()) {
    if (i) os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

ll read() {
  ll i;
  scanf("%" SCNd64, &i);
  return i;
}

void printSpace() { printf(" "); }

void printEoln() { printf("\n"); }

void print(ll x, int suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1) printEoln();
  if (suc == 2) printSpace();
}

string readString() {
  static char buf[3341000];
  scanf("%s", buf);
  return string(buf);
}

char *readCharArray() {
  static char buf[3341000];
  static int bufUsed = 0;
  char *ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}

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

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

template <class T>
T Sq(const T &t) {
  return t * t;
}

const int mod = 1e9 + 7;

signed main() {
  string s, t;
  cin >> s >> t;
  map<char, char> m;
  REP(i, s.size()) {
    if (m.count(s[i]) == 0) {
      m[s[i]] = t[i];
    } else if (t[i] != m[s[i]]) {
      cout << "No" << endl;
      return 0;
    }
  }
  m.clear();
  REP(i, s.size()) {
    if (m.count(t[i]) == 0) {
      m[t[i]] = s[i];
    } else if (s[i] != m[t[i]]) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}


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

int main(){
	int x, y, a, b, c; cin >> x >> y >> a >> b >> c;
	vector<ll> p(a), q(b), r(c);
	rep(i, a) cin >> p[i];
	rep(i, b) cin >> q[i];
	rep(i, c) cin >> r[i];
	sort(ALL(p));
	sort(ALL(q));
	sort(ALL(r));
	vector<ll> arr;
	rep(i, x) arr.push_back(p[a-i-1]);
	rep(i, y) arr.push_back(q[b-i-1]);
	rep(i, c) arr.push_back(r[i]);
	sort(ALL(arr));
	ll ans = 0;
	rep(i, x+y) ans += arr[arr.size()-1-i];
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 8816
package main

import (
	"fmt"
)

func main() {
	var N int
	fmt.Scanf("%d\n", &N)
	if N%2 != 0 {
		fmt.Println(0)
		return
	}
	n := N / 2
	r := 0
	for n > 0 {
		r += n / 5
		n /= 5
	}
	fmt.Println(r)
}


Measured memory_bytes: 512
#include<stdio.h>

int main(void)
{
    int i,j,k;
    int x[300];
    int n[100];
    int count[300]= {0};
    int a = 0;
    int c = 0;

    do {

    scanf("%d %d",&n[a], &x[a]);

    a += 1;
    c = a;
    } while (n[a-1] != 0 || x[a-1] != 0);

    for(a = 0; a < c - 1; a++){

    for(i = 1; i < n[a]; i++){
        for(j = 1; j < n[a]; j++){
            for(k = 1; k <= n[a] ; k++){

            if(i + j + k == x[a] && i < j && j < k){
                count[a] += 1;
            }
            }
        }
    }

    printf("%d\n",count[a]);
    }
    return 0;
}


Measured memory_bytes: 2060
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


x,y = list(map(int, input().split()))
# n = 12
# t = [[None]*n for _ in range(n)]
# t[0][0] = t[1][0] = t[1][1] = t[0][1] = 0
# t[2][0] = t[0][2] = 1
# if t[x][y] is not None:
#     ans = t[x][y]
# else:
#     l = [0,1,1]
#     ans = l[(y-(x%3))%3]
if abs(x-y)<=1:
    print("Brown")
else:
    print("Alice")

Measured memory_bytes: 61864
#include <iostream>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
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 (b<a) { a=b; return 1; } return 0; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e18;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
const ll MAX = 100010;
constexpr ll nx[8] = {1,0,-1,0,-1,-1,1,1};
constexpr ll ny[8] = {0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll odd = 0,even = 0;
    ll n,p,a;
    cin >> n >> p;
    rep(i,n){
        cin >> a;
        if (a%2) odd++;
        else even++;
    }
    ll ans;
    if (p == 0){
        ans = pow(2,even)*(odd == 0 ? 1 : pow(2,odd-1));
    }
    else{
        ans = pow(2,even)*(odd == 0 ? 0 : pow(2,odd-1));
    }
    PRINT(ans);
}


Measured memory_bytes: 256
x,y,z=list(map(int, input().split()))
a=x
b=y
c=z
cnt=0
for i in range(100):
	if a%2==0 and b%2==0 and c%2==0:
		x=b//2+c//2
		y=a//2+c//2
		z=a//2+b//2
		a=x
		b=y
		c=z
		cnt=cnt+1
if cnt>30:
	cnt=-1
print(cnt)

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

#define rep(i, ii, n) for(i=ii; i<n ;i++)
#define int long long
using namespace std;

int n;
int l[2000];
signed main(){
  cin>>n;
  int i, j;
  rep(i, 0, n){ cin >> l[i]; }
  sort(l, l+n);

  int result=0;
  rep(i, 0, n-2){
    int k;
    k=i+2;
    rep(j, i+1, n-1){
      while(k<n && l[i]+l[j]>l[k]) k+=1;

//cout << (k-j-1)<<endl;

      result += (k-j-1);
    }
  }

  cout << result;

  return 0;
}

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

int n, x[5], y[5];
int v[10], g[10];
//void f(int p, int q) {
//	if (q == 4) {
//		cout << "YES";
//		exit(0);
//	}
//	for (i = 0; i < 3; i++) {
//		if (g[i]) continue;
//		g[i] = 1;
//		if (v[])
//		f()
//	}
//}
int main()
{
	int i;
	for (i = 0; i < 3; i++) {
		scanf ("%d %d", &x[i], &y[i]);
		v[x[i]]++;
		v[y[i]]++;
	}
	for (i =1; i <= 4; i++) {
		g[v[i]]++;
	}
	if (g[1] == 2 && g[2] == 2) cout << "YES";
	else cout <<"NO";
//	for (i= 1; i <= 4; i++) {
//		if (f(i)) {
//			cout << "YES";
//			return 0;
//		}
//	}
//	cout << "NO";
    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#define all(v) ((v).begin()),((v).end())
#define allr(v)	     ((v).rbegin()), ((v).rend())
#define sz(v) ((int)(v).size())
#define clr(v, d)        memset(v, d, sizeof(v))
#define JSE ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
typedef unsigned long long ull;
ll mod = ll(1e9 + 7);
typedef  double ld;
void file(){
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin); //freopen("out.txt", "w", stdout);  
#endif
}
int f(int x)
{
	while (x)
	{
		if (x % 10 == 4 || x % 10 == 7)
		{
			return 1;
		}
		x /= 10;
	}
	return 0;
}
int main()
{
	//cout << setprecision(7) << fixed;
	JSE
		//file();
	//	freopen("friday.in", "r", stdin);
	///////////
	ll n, m;
	cin >> n >> m;
	cout << (n*m & 1 ? "Odd" : "Even") << endl;
}

Measured memory_bytes: 764
N = int(input())
A = [int(input()) for _ in range(N)]

max_value = max(A)
second_value = 0
for i in range(N):
    if A[i] == max_value:
        if second_value:
            print(second_value)
        else:
            a, A[i] = A[i], 0
            second_value = max(A)
            print(second_value)
            A[i] = a
    else:
        print(max_value)

Measured memory_bytes: 12632
#include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define pb push_back
typedef long long int ll;
const int N=3e5+5,MAX=1e9;
int cons[3],sz[3],tmp,tt,n;
vector < pair<int,int> > a;
ll ans;
int main(){
    cin.tie(NULL);
    cout.tie(NULL);
    ios_base::sync_with_stdio(false);
    cin>>cons[0]>>cons[1]>>sz[0]>>sz[1]>>sz[2];
    cons[2]=N;
    for(int i=0;i<3;i++){
        for(int j=0;j<sz[i];j++){
            cin>>tmp;
            a.pb({tmp,i});
        }
    }
    n=sz[0]+sz[1]+sz[2];
    sort(a.begin(),a.end());
    int tmx= cons[0]+cons[1];
    for(int i=n-1;i>=0 && tt < tmx;i--){
        if(cons[a[i].s]){
           cons[a[i].s]--;
           ans+=a[i].f;
           tt++;
        }
        else
            continue;
    }
    cout<<ans<<'\n';
    return 0;
}


Measured memory_bytes: 6384
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int N;
  cin>>N;
  int B[N-1];
  for(int i=0;i<N-1;i++){
    cin>>B[i];
  }
  if(N==2){
    cout<<2*B[0];
    return 0;
  }
  int sum=B[0]+B[N-2];
  for(int i=1;i<N-1;i++){
    sum+=min({B[i-1],B[i]});
  }
  cout<<sum;
}


Measured memory_bytes: 256
def search(arr,x)
  len = arr.length
  if x > arr[-1]
    d = (len-1) / 2
    i = d
    while len > 1
      if arr[i] < x
        i -= d
        len = len - d - ((len-1)%2)
        d = (len-1) / 2
        i += d
      else
        len = len - d - 1
        d = (len-1) / 2
        i += d + 1
      end
    end
    arr[i] = x
  else
    arr.push(x)
  end
  arr
end

n = gets.to_i
a = []
n.times do |i|
  a[i] = gets.to_i
end
arr = [a[0]]
(n-1).times do |i|
  arr = search(arr,a[i+1])
end
puts arr.length

Measured memory_bytes: 16044
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <climits>
#include <cmath>
#include <queue>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <stack>
#include <bitset>
using namespace std;
#define rep(i,a,b) for(int i=a; i<=b; i++)
#define fi first
#define se second
#define ll long long
#define ii pair<int, int>

int main() {
	ios::sync_with_stdio(false); cin.tie(0);
	//freopen("Test.inp", "r", stdin);
	//freopen("RATING.out", "w", stdout);
	int h, a;
	cin >> h >> a;
	if (h%a == 0) cout << h / a;
	else cout << h / a + 1;
	return 0;
}

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

int main(){
 
  string s1,s2;
  cin >> s1>>s2;
  if(s1[0]==s2[2]&&s1[1]==s2[1]&&s1[2]==s2[0]){
    cout << "YES"<<endl;
  }else{
    cout<<"NO"<<endl;
  }
  return 0;
  
}

Measured memory_bytes: 256
s=input()

s1=s[0]+s[1]
s2=s[2]+s[3]

if (s1[0]=='0' and s1!='00') or s1=='11' or s1=='12':
  ans1='MM'
else:
  ans1='YY'

if (s2[0]=='0' and s2!='00') or s2=='11' or s2=='12':
  ans2='MM'
else:
  ans2='YY'

if ans1==ans2=='MM':
  print('AMBIGUOUS')
elif ans1==ans2=='YY':
  print('NA')
else:
  print(ans1+ans2)

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


int main(){


    string s;

    int a = 0;

    int b = 0; 

    int i;


    cin >> s;


    for( i = 0 ; i < s.size() ; i = i + 1 ){

         if( s.at(i) == '0' ){

             a += 1;

             }

         else{

             b += 1;

             }

         }


    cout << 2 * min(a, b) << endl;


    return 0;

    }


Measured memory_bytes: 512
#ifdef __GNUC__ 
#include <bits/stdc++.h>
auto & in = std::cin;
#pragma GCC optimize ("O3") 
#pragma GCC target ("avx")

#else
std::istringstream in;
#endif
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/dynamic_bitset.hpp>
using namespace std;
#define ALL(v) std::begin(v),std::end(v)
using u6 = std::uint64_t;
using u3 = std::uint32_t;
constexpr u6 moduloNo = 1'000'000'000+7; //'

struct State {
	array<u3, 3> buf;
	//State() :buf{ 1,0,1 } {}
	State() {}
	State(u3 zerocount) :buf{ 1,0,zerocount } { addX(zerocount); }
	void addX(u3 zero) {
		if (zero != buf[2]){
			u6 zerodiff = zero - buf[2];
			buf[0] = (u3)(((u6)buf[0] + zerodiff * buf[1])%moduloNo);
			buf[2] = zero;

		}
		
		buf[1] = buf[0]+buf[1];
		buf[1] = (buf[1] >= moduloNo) ?buf[1] - moduloNo: buf[1];
	}
};
u6 pow2(u6 n) {
	if (n < 64)return (u6(1) << n)% moduloNo;
	else if (n == 64)return (u6(0) - moduloNo) % moduloNo;
	u6 tmp = pow2(n / 2);
	tmp=tmp * tmp;
	if (n & 1)tmp *= 2;
	return tmp % moduloNo;
}

struct Calc {
	u6 N;
	
	unordered_map<u3, State> stmap;
	Calc() {
		in >> N;
	}
	u6 calc() {
		u3 st = 0;
		u3 tmp;
		u3 zerocount = 0;
		for (u3 index = 0; index < N; ++index) {
			in >> tmp;
			st ^= tmp;
			if (!st) {
				++zerocount;
				//cout << index << endl;
			}
			else {
				auto ite = stmap.find(st);
				if (ite == stmap.end()) {
					stmap.emplace(st, zerocount);
				}
				else {					
					ite->second.addX(zerocount);
				}
			}
		}
		if (st != 0) {
			return stmap[st].buf[0];
		}
		else {
			u6 result = pow2(zerocount-1);
			for (auto & stv: stmap) {
				result = (result + stv.second.buf[1])%moduloNo;
			}
			
			/*u6 sum0 = 0, sum1 = 0;
			for (auto & stv : stmap) {
				cout << stv.second.buf[0] << " " << stv.second.buf[1]  <<  " " << stv.second.buf[2] << endl;
				sum0 += stv.second.buf[0];
				sum1 += stv.second.buf[1];
			}
			cout << sum0 << " " << sum1 << endl;*/
			return result;
		}
	}
};

int main() {

#ifndef __GNUC__ 
	in.str("32\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0");
#endif
	Calc calc;

	cout << calc.calc() << endl;
	/*
	u6 i = 0; u6 maxnum = 0;
	for (auto & v : tbl.buf) {
		for (auto n : v.buf) {
			if (n > maxnum)maxnum = n;
		}
	}
	cout << maxnum << endl;
	for (auto & v : tbl.buf) {
		cout << i << "=" << v << endl;
		++i;
	}
	cout << maxnum << endl;*/
}


Measured memory_bytes: 14280
#include <bits/stdc++.h>
#define mod 998244353
using namespace std;
typedef long long ll;
inline int read()
{
	int x=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1; ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
	return x*f;
}
inline int qpow(int bas,int pw)
{
	int ans=1; for(;pw;pw>>=1,bas=1ll*bas*bas%mod)
		if(pw&1) ans=1ll*ans*bas%mod; return ans;
}
int xx[300],yy[300],Ans;
map <int,int> M;
int main()
{
	int n=read(); for(int i=1;i<=n;i++)
		xx[i]=read(), yy[i]=read();
	Ans=qpow(2,n)-n-1;
	for(int i=1;i<=n;i++)
	{
		M.clear();
		for(int j=i+1;j<=n;j++)
		{
			int tx=(1ll*(yy[j]-yy[i])*qpow((xx[j]-xx[i]),mod-2)%mod+mod)%mod;
			if(xx[j]==xx[i]) tx=-1;
			M[tx]++;
		}
		for(map<int,int> :: iterator it=M.begin();it!=M.end();it++)
			(Ans-=qpow(2,it -> second)-1)%=mod;
	}
	cout << (Ans%mod+mod)%mod << endl;
	return 0 ;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define printarr(arr, n) for(int i = 0; i < n; i++) {cout << arr[i] << " ";} cout << endl; 
#define MO 1000000007
int main(){
	//freopen("input.txt","r",stdin);
	int n;
	string s;
	cin>>n>>s;
	int dp[n+2][n+2];
	for (int i = 0; i < n+2; ++i)
	{
		for (int j = 0; j < n+2; ++j)
		{
			dp[i][j] = 0;
		}
	}
	dp[1][1] = 1;
	for (int len= 2; len <= n; len++)
	{
		for (int last = 1; last <= len; ++last)
		{
			if(s[len-2]=='>'){
				dp[len][last] = (dp[len-1][len-1]-dp[len-1][last-1]+MO)%MO;
			}else{
				dp[len][last] = dp[len-1][last-1];
			}
			//cout << len << " " << last << " " << dp[len][last] << endl;
		}
		for (int i = 2; i <= len; ++i)
		{
			dp[len][i] = (dp[len][i]+dp[len][i-1])%MO;
		}
	}


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

}







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

int main(){
  int n;
  cin >> n;
  int ans = 0;
  for (int a = 1; a <= n;a++){
    for (int b = 1; b <= n;b++){
      if (a*b >= n) break;
      if (n -a*b > 0) ans++;
    }
  }
  cout << ans << endl;


  

  return 0;
}

Measured memory_bytes: 3652
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <climits>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <sstream>
#include <vector>
#include <map>
#include <set>
#include <complex>
#include <functional>
#include <utility>
#include <iterator>

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (m); i < (int)(n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define INF 2000000000

#ifdef LOCAL
  #define dprintf(...) fprintf(stdout, __VA_ARGS__)
#else
  #define dprintf(...) 0
#endif

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned int uint;

//const double PI = 3.1415926535897932384626433832795;

int main() {
  int h, a;
  cin >> h >> a;
  int ans = h % a == 0 ? h / a : h / a + 1;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int N;

int main(){
	int A,B,C;
	cin>>A>>B>>C;
	if(A+B+C>=22){
		cout<<"bust"<<endl;
	}else{
		cout<<"win"<<endl;
	}
}

Measured memory_bytes: 256
fun main(args: Array<String>){
    val(n,m) = readLine()!!.split(" ").map{it.toInt()}
    var kind = 0
    if(m > 1 && n > 1) {
         kind = combination(m) + combination(n)
    }else if(m < 2 && n > 1){
         kind = combination(n)
    }else if(m > 1 && n < 2){
        kind = combination(m)
    }else{
        println(kind)
        return
    }
    println(kind)
}

fun combination(x: Int) : Int{
    return (x * (x-1)) / 2
}

Measured memory_bytes: 36268
#include <stdio.h>

int main(){
	const int MAX_V = 10000;
	int prime[MAX_V+1];
    	int i, k, v;
    	for(i = 2; i <= MAX_V; i++) prime[i] = 1;
    	for(i = 2; i <= MAX_V; i++){
        	if(prime[i]){
        		for(k = 2 * i; k <= MAX_V; k += i){
        			prime[k] = 0;
      			}
       	 	}
    	}
    	while(scanf("%d", &v) != EOF) {
        	for(i = v; i >= 5; i--){
       			if(prime[i] && prime[i-2]) {
               		 	printf("%d %d\n", i-2, i);
                		break;
            		}
        	}
    	}
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define eee(a) (cerr << (#a) << ": " << (a) << endl);
#define ppp(a) (cout << (a) << endl);
#define cop(a) for(auto x:(a)){cout << x << endl;}


using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using mint = map<int, int>;

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

const char sp = ' ';
const char cmm = ',';
const int MOD = 1e9+7;
const int INF = 1e9;
const ll LINF = 1e18;

ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powmod(ll b, ll e){ll r=1;while(e>0){if(e&1)r=(r%MOD)*(b%MOD)%MOD;b=(b%MOD)*(b%MOD)%MOD;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

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 (b<a) { a=b; return 1; } return 0; }
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
    int len = v.size();
    s << '[';
    for (int i = 0; i < len; ++i) {
        s << v[i]; if (i < len-1) s << ", ";
    }
    s << ']';
    return s;
}

struct aaa{
    aaa(){
        // comment this out when you use scanf or printf
        // cin.tie(0); ios::sync_with_stdio(0);
        cout<<fixed<<setprecision(15);
    };
}fastio;



int main(){

    int n;
    cin >> n;
    vector<int> a(n), c(n-1);
    int s = 0;
    rep(i, n) scanf("%d", &a[i]);
    rep(i, n) {
        int b;
        scanf("%d", &b);
        s += b;
    }
    rep(i, n-1) scanf("%d", &c[i]);

    rep(i, n-1){
        if(a[i] + 1 == a[i+1]){
            s += c[a[i]-1];
        }
    }
    ppp(s);




    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;

const int mod = 1000000007;
int add(int a, int b) { return (a += b) < mod? a : a - mod; }
int sub(int a, int b) { return (a -= b) >=  0? a : a + mod; }
int mul(int a, int b) { return 1LL * a * b % mod; }
void adds(int& a, int b) { a = add(a, b); }
void subs(int& a, int b) { a = sub(a, b); }
void muls(int& a, int b) { a = mul(a, b); }
void maxs(int& a, int b) { a = max(a, b); }
void mins(int& a, int b) { a = min(a, b); }
int pwr(int a, ll p) {
    if (p == 0) return 1;
    if (p & 1) return mul(a, pwr(a, p - 1));
    return pwr(mul(a, a), p / 2);
}
int inv(int a) { return pwr(a, mod - 2); }
int neg(int a) { return sub(0, a); }
int dp[2005];

int f(int s)
{
    if (s == 0)
        return 1;
    if (dp[s] != -1)
        return dp[s];
    int sol = 0;
    for (int i = 3; i <= s; ++i)
        adds(sol, f(s - i));
    return dp[s] = sol;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int s;
    cin >> s;
    memset(dp, -1, sizeof dp);
    cout << f(s);
}


Measured memory_bytes: 3664
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


n,m = map(int,input().split())
uf = UnionFind(n)
for i in range(m):
    x,y = map(int,input().split())
    uf.union(x-1,y-1)

ans = 0
for i in range(n):
    ans = max(ans,uf.size(i))
print(ans)

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

using ll = long long;
using P = pair<int, int>;

const int INF = 1e9;
const int MOD = 1e9 + 7;

// 4近傍、8近傍
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

// 最大公約数（a > b）
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}

int main() {
  // 入力
  ll N, X;
  cin >> N >> X;
  ll a[N];
  for (int i = 0; i < N; i++) scanf("%lld", a + i);

  ll b[N];
  for (int i = 0; i < N; i++) b[i] = llabs(a[i] - X);

  ll ans = 1e12;
  sort(b, b + N);
  if (N == 1) {
    cout << b[0] << endl;
    return 0;
  }
  for (int i = 0; i < N - 1; i++) {
    ans = min(ans, gcd(b[i+1], b[i]));
  }

  cout << ans << endl;
  return 0;
}


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

int main(){
  int n; cin >> n;
  vector<int> p(n+1);
  int a = 300000;
  int ans = 0;
  p[0] = 300000;
  
  for(int i = 1; i <= n; i++) cin >> p[i];
  
  for(int i = 0; i < n; i++){
  	a = min(a, p[i]);
  	if(a >= p[i+1]) ans++;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 1024