akhauriyash/Code-Regression huggingface dataset:
/*
        |___________________________Arshit Mangukiya_____________________________|
        |_______________________________DA-IICT__________________________________|
        |_____________________________201801173__________________________________|
*/
        /*______________________WRITE  YOUR  CODE  HERE_________________________*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int  ll;            
typedef long double ld;
typedef vector<ll> vl;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppl;
typedef vector<pll> vpl;
#define ff first
#define ss second
#define pi acos(-1)
#define mr_ad_0501 ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define pb push_back
#define all(a)      a.begin(),a.end()
#define F(i,a,n) for(ll i=a;i<n;i++)
#define MOD 1000000007
#define MAX 200007
#define LM LLONG_MAX
#define sz size()
#define p(x) 		cout<< x << " ";
#define pe(x)		cout<< x << endl ;
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
const int N=1e5+5;
    	/*	bool fun(pair<int,int>a , pair<int,int>b)
			{
				if(a.ff == b.ff)	return a.ss < b.ss;
				else			return a.ff < b.ff;
			}*/
 /*void bfs(ll x)
 {
 	queue<ll> q;
	q.push(x);
    while(!q.empty())
    {
        ll k=q.front();
        q.pop();
        for(auto X:v[k])
        {
            if(!vis[X])
            {
            	l[X]=l[k]+1;
                vis[X]=1;
                q.push(X);
            }
        }
    }
 }*/


void solve()
{
	string s,t;
	cin>>s>>t;
	for(ll i=0;i<s.sz;i++)
	{
		if(s[i]!=t[i]){
			cout<<"No";
			return;
		}
	}
	cout<<"Yes";
}
int32_t main(){
	mr_ad_0501;
//	fun();
	ll t=1;
	//cin >> t;
	while(t--)
	{
		solve();
	}
}

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

int main() {
    ll n;
    std::cin >> n;
    vector<ll> a(n);
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
        if(a[i]%2==0){
            if(a[i]%3==0 || a[i]%5==0){
                
            }else{
                std::cout << "DENIED" << std::endl;
                return 0;
            }
        }
        
    }
    std::cout << "APPROVED" << std::endl;
}


Measured memory_bytes: 256
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<unordered_map>
#include<array>
#include<map>
#include<bitset>
#include<iomanip>
#include<list>
#include <numeric>
using namespace std;
typedef unsigned long long int ulint;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
#define RE return 0
//ios::sync_with_stdio(false);
//std::cin.tie(0);
//<< setprecision(20)
const int mod=(int)1e9+7;
const llint big=(llint)(2.19e12+1);
const long double pai=3.141592653589793238462643383279502884197;
const long double ena=2.71828182845904523536;
const long double eps=1e-7;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
template <class T> void soun(T& ar)
{sort(ar.begin(),ar.end());ar.erase(unique(ar.begin(),ar.end()),ar.end());}
llint gcd(llint a,llint b){if(a%b==0){return b;}else{return gcd(b,a%b);}}
llint lcm(llint a,llint b){return a/gcd(a,b) *b;}
template<class T,class U> auto LB(T& ve,U in){return lower_bound(ve.begin(),ve.end(),in);}
template<class T,class U> auto UB(T& ve,U in){return upper_bound(ve.begin(),ve.end(),in);}
template<class T,class U> auto LBI(T& ve,U in){return LB(ve,in)-ve.begin();}
template<class T,class U> auto UBI(T& ve,U in){return UB(ve,in)-ve.begin();}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
int main(void){
	int a;cin>>a;
	cout<<a/3600<<":"<<(a%3600)/60<<":"<<a%60<<endl;
	RE;
}


Measured memory_bytes: 3120
def check(ss):
    flag = True
    for i in range(1, len(ss)):
        if ss[i] != ss[0]:
            flag = False
            break
    return flag

s = input()

g = [0] * 200
ans = 1000000000
sss = s
for x in s:
    if g[ord(x)]:
        continue
    g[ord(x)] = 1
    tot = 0
    s = sss
    while not check(s):
        ss = ""
        has = False
        for j in range(len(s) - 1):
            if s[j] == x or s[j + 1] == x:
                ss += x
            else:
                ss += s[j]
        tot += 1
        s = ss
    ans = min(tot, ans)
print(ans)


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

int main() {
    int n;
    long long tt = 1, aa = 1;
    cin>> n;
    for (int i = 0; i < n; ++i) {
        int t, a;
        cin >> t >> a;
        long long b = max((tt + t - 1) / t, (aa + a - 1) / a);
        tt = t * b;
        aa = a * b;
    }
    cout << (tt + aa) << "\n";
    return 0;
}


Measured memory_bytes: 256
a,b,c = map(int,raw_input().split())
if b <= a:
    if b <= c <= a:
        print b,c,a
    elif c <= b <= a:
        print c,b,a
    else:
        print b,a,c
elif a < b:
    if a <= c <= b:
        print a,c,b
    elif c <= a < b:
        print c,a,b
    else:
        print a,b,c

Measured memory_bytes: 6444
#include<stdio.h>
#include<string.h>
int main(void){
	int n,i,ans,tmp;
	int sai[3];
	char siji[6];

	while(1){
		scanf("%d ",&n);
		if(!n) break;

		for(i=0;i<3;i++){
			sai[i]=i+1;
		}
		ans=1;

		for(i=0;i<n;i++){
			scanf("%s",&siji);
			if(!strcmp(siji,"North")){
				tmp=sai[0];
				sai[0]=sai[1];
				sai[1]=7-tmp;
			}else if(!strcmp(siji,"East")){
				tmp=sai[2];
				sai[2]=sai[0];
				sai[0]=7-tmp;
			}else if(!strcmp(siji,"West")){
				tmp=sai[0];
				sai[0]=sai[2];
				sai[2]=7-tmp;
			}else if(!strcmp(siji,"South")){
				tmp=sai[1];
				sai[1]=sai[0];
				sai[0]=7-tmp;
			}else if(!strcmp(siji,"Right")){
				tmp=sai[1];
				sai[1]=sai[2];
				sai[2]=7-tmp;
			}else{
				tmp=sai[2];
				sai[2]=sai[1];
				sai[1]=7-tmp;
			}
			ans+=sai[0];
		}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 608
class DP:
    def __init__(self, value, variety, coins):
        self.value = value
        self.variety = variety
        self.coins = coins
        self.DP = [[0 for _ in range(value + 1)] for _ in range(variety)]
        self.DPinit()

    def monitor(self):
        for (i, row) in enumerate(self.DP):
            print(coins[i], row)

    def DPinit(self):
        for row in self.DP:
            row[1] = 1
        self.DP[0] = [i for i in range(self.value + 1)]

    def DPcomp(self):
        for m in range(self.variety):
            if m == 0:
                continue
            for n in range(self.value + 1):
                self.DP[m][n] = self.numberOfCoin(m, n)

    def numberOfCoin(self, m, n):
        if n >= self.coins[m]:
            return min(self.DP[m - 1][n], self.DP[m][n - self.coins[m]] + 1)
        else:
            return self.DP[m - 1][n]

    def answer(self):
        self.DPcomp()
        return self.DP[self.variety - 1][self.value]

if __name__ == "__main__":
    status = list(map(int,input().split()))
    coins = list(map(int,input().split()))
    dp = DP(status[0],status[1],coins)
    print(dp.answer())

Measured memory_bytes: 45420
#include<stdio.h>
#include<math.h>

int main(void){

    int N,x[9],y[9],i,j;
    double distance = 0,ans;

    scanf("%d",&N);
    for(i = 0;i < N;i++){
        scanf("%d %d",&x[i],&y[i]);
    }

    for(i = 0;i < N;i++){
        for(j = 0;j < N;j++){
            distance += sqrt((x[j]-x[i]) * (x[j] - x[i]) * 1.0 + (y[j]-y[i]) * (y[j] - y[i]) * 1.0);
        }
    }

    ans = distance/N;

    printf("%lf",ans);
    return 0;
}

Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	boolean canDraw = true;

	public static void main(String[] args) throws IOException {
		Main m = new Main();

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] get = br.readLine().split(" ");
		int H = Integer.parseInt(get[0]);
		int W = Integer.parseInt(get[1]);

		String[][] field = new String[H][W];

		for (int h = 0; h < H; h++) {
			get = br.readLine().split("");
			for (int w = 0; w < W; w++) {
				field[h][w] = get[w];
			}
		}

		for(int x = 0;x<H;x++){
			for(int y = 0;y<W;y++){
				if(field[x][y].equals("#"))field = m.haba(field,0,x,y);
				if(!m.canDraw){
					System.out.println("No");
					System.exit(0);
				}
			}
		}

		System.out.println("Yes");
	}

	String[][] haba(String[][] f, int c, int x, int y) {
		// c...counter,1でbreakならNo出力
		// TODO: 四方向黒かどうか->黒方向に幅探索

		f[x][y] = ".";

		int h = f.length-1;		//それぞれ配列番号
		int w = f[0].length-1;
		//String up,down,left,right;
		if(y!=0){
			if(f[x][y-1].equals("#")){
				c++;
				f = haba(f,c,x,y-1);
			}
		}
		if(x!=0){
			if(f[x-1][y].equals("#")){
				c++;
				f = haba(f,c,x-1,y);
			}
		}
		if(y!=w){
			if(f[x][y+1].equals("#")){
				c++;
				f = haba(f,c,x,y+1);
			}
		}
		if(x!=h){
			if(f[x+1][y].equals("#")){
				c++;
				f = haba(f,c,x+1,y);
			}
		}

		if(c == 0)canDraw = false;

		return f;

	}
}

Measured memory_bytes: 22868
#include <stdio.h>
#define MAX 26

int main(void) {
  char s[MAX];
  int i,j;

  scanf("%s",s);
  //for(i=0;s[i]!='\0';i++)
  //printf("%c\n",s[i]);
  for (i=0;s[i]!='\0';i++) {
    for(j=i+1;s[j]!='\0';j++){
      if(s[i]==s[j]){
        printf("no\n");
        return 0;
      }
    }
  }
  printf("yes\n");

  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#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 rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define rev(v) reverse(v.begin(), v.end())
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
#define OK { cout << "OK" << endl; return 0; }
#define NG { cout << "NG" << endl; return 0; }
#define sz(v) ((int)(v).size())
#define uniq(a) sort(all(a));(a).resize(unique(all(a)) - a.begin());
#define dab(v) for(auto i:v)cout<<i<<' '; cout << endl;
#define vin(v) for (ll i = 0; i < v.size(); ++i) cin >> v[i];
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<class T>void out(T a){cout << a << endl;}
template<class T>void die(T a){cout << a << endl; exit(0);}
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

#define SIZE 200005
#define MOD 1000000007
 
typedef pair <int,int> P;
 
ll inv[SIZE], fac[SIZE], finv[SIZE];
void make(){
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for(int i=2; i<SIZE; i++)
	{
		inv[i] = MOD - inv[MOD%i]*(MOD/i)%MOD;
		fac[i] = fac[i-1] * (ll) i % MOD;
		finv[i] = finv[i-1] * inv[i] % MOD;
	}
    return ;
}
ll comb(int a,int b){
	if(a < b) return 0;
	return fac[a] * (finv[b] * finv[a-b] % MOD) % MOD;
}



ll beki(int a, int n){
    if(n == 0) return 1;
    ll ans = beki(a, n / 2);
    ans = ans * ans;
    if(n % 2 == 1) ans = ans * a;
    return ans;
}

string S,T,U;
int a,b,c;
vi A,B,C;


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
    //cout << fixed << setprecision(15);
    
    vi x(5); vin(x);
	rep(i,5) if(x[i] == 0) die(i + 1);
}

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

int main()
{
	double x1, x2, y1, y2;
	cin >> x1 >> y1 >> x2 >> y2;

	cout <<setprecision(8)<<fixed<< sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2)) << endl;
}


Measured memory_bytes: 3228
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;

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

    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; ++i) cin >> a[i];

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

    ll sm = a[0];
    int border = 0;
    for(int i = 1; i < n; ++i){
        if(sm*2 < a[i]) border = i;

        sm += a[i];
    }

    cout << n - border << endl;

    return 0;
}

Measured memory_bytes: 3668
import sys
from math import ceil, floor, sqrt, sin, cos, pi
from itertools import accumulate, permutations, combinations
from fractions import gcd # 最大公約数
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)
def lcm(x, y): return ((x * y) // gcd(x, y)) # 最小公倍数
# list(map(int, input().split()))

s, w = map(int, input().split())
print('safe') if w < s else print('unsafe')

Measured memory_bytes: 10460
#include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#define INF 999999999

using namespace std;

int n, s, ans;
int a[105000];

void solve()
{
	int ret = n + 1;

	int l = 0, r = 0, sum = 0;
	while (1) {
		while (r < n&&sum < s) {
			sum += a[r++];
		}
		if (sum < s)break;
		ret = min(ret, r-l);
		sum -= a[l++];
	}
	if (ret > n)ret = 0;
	printf("%d\n", ret);

}


int main()
{
	scanf("%d %d", &n, &s);
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
		
	}
	solve();

	return 0;
}

Measured memory_bytes: 3620
from collections import defaultdict

n=int(input())
if n==1:
    print(1)
    exit()
x=[]
y=[]
for i in range(n):
    xx,yy=list(map(int,input().split()))
    x.append(xx)
    y.append(yy)

dif=defaultdict(int)

for i in range(n):
    for j in range(n):
        if i==j:continue
        p=x[j]-x[i]
        q=y[j]-y[i]
        dif[(p,q)]+=1

dif=sorted(dif.items(),key=lambda x:x[1],reverse=True)
ans=n-dif[0][1]

print(ans)

Measured memory_bytes: 3948
# encoding: utf-8
N, x = map(int, input().split())
a = list(map(int, input().split()))

sums = [0] * (N - 1)
for i, ai in enumerate(a):
    if i == 0: prev = ai
    else:
        sums[i - 1] = ai + prev
        prev = ai

ans = 0

if a[0] > x:
    ans += (a[0] - x)
    sums[0] -= (a[0] - x)

for i in range(N - 1):
    # skip
    if sums[i] <= x: continue
    # eat
    ans += (sums[i] - x)
    if i < N - 2: sums[i + 1] -= (sums[i] - x)
    sums[i] = x

print(ans)

Measured memory_bytes: 14592
#include <algorithm>
#include <iostream>
#include <map>
#include <string>
using namespace std;

int main() {
	const int n = 5;
	int hand[n];
	while(cin >> hand[0], hand[0]) {
		int ans[5];
		bool flag[4] = {false};
		flag[hand[0]] = true;
		for(int i = 1; i < n; ++i) {
			cin >> hand[i];
			flag[hand[i]] = true;
		}
		for(int i = 0; i < n; ++i) {
			if(flag[1] && flag[2] && !flag[3]) ans[i] = (hand[i] == 1) ? 1 : 2;
			else if(!flag[1] && flag[2] && flag[3]) ans[i] = (hand[i] == 2) ? 1 : 2;
			else if(flag[1] && !flag[2] && flag[3]) ans[i] = (hand[i] == 3) ? 1 : 2;
			else ans[i] = 3;
			cout << ans[i] << endl;
		}
	}
}

Measured memory_bytes: 1160
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;cin>>n;
  vector<ll>a(n),sum(n+1);
  rep(i,n)cin>>a[i];
  rep(i,n)sum[i+1]=sum[i]+a[i];
  ll res=1e15;
  rep(i,n)
  {
    //cout<<i<<endl;
    ll suml=sum[i+1],sumr=sum[n]-sum[i+1];
    auto itl=lower_bound(all(sum),(suml+1)/2);
    ll p=max(suml-*itl,*(itl-1)),q=suml-p;
    auto itr=lower_bound(all(sum),(sumr+1)/2+suml);
    //cout<<*itr<<endl;
    ll r=max(sumr+suml-*itr,*(itr-1)-suml),s=sumr-r;
    //cout<<p<<" "<<q<<" "<<r<<" "<<s<<endl;;
    chmin(res,max({p,q,r,s})-min({p,q,r,s}));

  }
  cout<<res<<endl;
  return 0;

}



Measured memory_bytes: 3328
#include <bits/stdc++.h>
 
#define rep(i,n) for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

using namespace std;
using ll  = long long;
using pll = pair<ll, ll>;

const ll MOD  = 1e9 + 7;
const ll LINF = 1LL << 62;
const int INF = 1e9 + 7;

int main(){
    ll l, r, d;
    cin >> l >> r >> d;

    ll ans = 0;
    for(int i = l; i <= r; i++)if(i % d == 0)ans++;
    cout << ans << endl;
}

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

int main() {
  int N,M,C;
  cin >> N >> M >> C;

  vector<int> B(M);
  for (int j=0; j<M; ++j)
    cin >> B[j];

  vector< vector<int> > A(N, vector<int>(M));
  for (int i=0; i<N; ++i)
    for (int j=0; j<M; ++j)
      cin >> A[i][j];

  int ret = 0;
  for (int i=0; i<N; ++i)
    ret += (inner_product(B.begin(), B.end(), A[i].begin(), 0) + C > 0) ? 1 : 0;

  cout << ret << endl;
}

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

int main()
{
	int sum=0;
	string s,t;
	cin>>s;
	cin>>t;
	for(int i=0;i<3;i++)
	{
		if(s[i]==t[i])sum++;
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256
/*
        _            _                  _            _       _     _         _   _          _          _             _        
       / /\         / /\               / /\         / /\    / /\  /\ \      /\_\/\_\ _     /\ \       /\ \     _    /\ \      
      / /  \       / /  \             / /  \       / / /   / / /  \ \ \    / / / / //\_\   \ \ \     /  \ \   /\_\ /  \ \     
     / / /\ \__   / / /\ \           / / /\ \__   / /_/   / / /   /\ \_\  /\ \/ \ \/ / /   /\ \_\   / /\ \ \_/ / // /\ \_\    
    / / /\ \___\ / / /\ \ \         / / /\ \___\ / /\ \__/ / /   / /\/_/ /  \____\__/ /   / /\/_/  / / /\ \___/ // / /\/_/    
    \ \ \ \/___// / /  \ \ \        \ \ \ \/___// /\ \___\/ /   / / /   / /\/________/   / / /    / / /  \/____// / / ______  
     \ \ \     / / /___/ /\ \        \ \ \     / / /\/___/ /   / / /   / / /\/_// / /   / / /    / / /    / / // / / /\_____\ 
 _    \ \ \   / / /_____/ /\ \   _    \ \ \   / / /   / / /   / / /   / / /    / / /   / / /    / / /    / / // / /  \/____ / 
/_/\__/ / /  / /_________/\ \ \ /_/\__/ / /  / / /   / / /___/ / /__ / / /    / / /___/ / /__  / / /    / / // / /_____/ / /  
\ \/___/ /  / / /_       __\ \_\\ \/___/ /  / / /   / / //\__\/_/___\\/_/    / / //\__\/_/___\/ / /    / / // / /______\/ /   
 \_____\/   \_\___\     /____/_/ \_____\/   \/_/    \/_/ \/_________/        \/_/ \/_________/\/_/     \/_/ \/___________/    
                                                                                                                              
*/
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for(int i = 0;i < (n);++i)

#define endl '\n'
#define pb emplace_back
#define mkp make_pair
#define p_q priority_queue
#define INF 2000000000
#define PI 3.1415926

const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};
const int dx_8[]={1,1,0,-1,-1,-1,0,1}, dy_8[]={0,-1,-1,-1,0,1,1,1};
const long long MOD = 1e9+7;

// typedef long long ll;
#define int long long

template <typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template <typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template <typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}

signed main(void){
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n,a,b,c,d,e; cin>>n>>a>>b>>c>>d>>e;
  cout << (n+min({a,b,c,d,e})-1)/min({a,b,c,d,e}) + 4 << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
const ll INF = 1LL<<61;
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
  if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
  }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる




int main() {
  ll a,b,c,d,e,f,n;
  cin>>n;

  a=0;
  b=0;
  c=1;
  d=1000000000;
  e=(n+d-1)/d;
  f=d-n%d;

  if(f==d) f=0;

  cout << a<<" "<<b<<" "<<c<<" "<<d<<" "<<e<<" "<<f << endl;

}


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

int main(void)
{
	int x, a, b;
	cin >> x >> a >> b;
	
	int al = a - x, bl = b - x;
	if (al < 0)
		al *= -1;
	if (bl < 0)
		bl *= -1;
	if (al < bl)
		cout << 'A' << endl;
	else
		cout << 'B' << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int k = Integer.parseInt(sc.next());
        if (n >= 10 || k >= 10) {
            System.out.println(-1);
        } else {
            System.out.println(n * k);
        }
    }
}

Measured memory_bytes: 22608
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        
        if ((a == b && a != c) || (a == c && b != c) || (b == c && a != b)) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
        
    }
}


Measured memory_bytes: 21460
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define CHAL_BC_APNE_BAAP_KO_MAT_SIKHA ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define fr first
#define se second 
signed main()
{
	CHAL_BC_APNE_BAAP_KO_MAT_SIKHA;		
	int n,k;
	cin>>n>>k;
	int a[n+1];
	int b[n+1];
	for(int i=1;i<=n;i++)
		cin>>a[i];
	for(int i=1;i<=n;i++)
		cin>>b[i];
	sort(a+1,a+n+1);
	sort(b+1,b+1+n,greater<int>());
	int l=0,r=(int)pow(10,18);
	int val=0;
	while(l<=r){
		int mid=(l+(r-l)/2);
		int cnt=0;
		for(int i=1;i<=n;i++){
			int u=mid/b[i];
			cnt+=max(0LL,a[i]-u);
		}	
		if(cnt<=k){
			r=mid-1;
			val=mid;
		}
		else
			l=mid+1;
	}
	cout<<val<<endl;
}


Measured memory_bytes: 3328
#include<stdio.h>
int main(){
  int a,b,m[1000],i,j,r;
  while(scanf("%d %d",&a,&b)!=EOF){
    m[r=0]=a%b;
    r++;
    while(1){
      printf("%d",(m[r-1]*10)/b);
      m[r]=(m[r-1]*10)%b;
      if(m[r]==0)break;
      for(i=0;i<r;i++){
	if(m[i]==m[r])break;
      }
      if(r-i){
	printf("\n");
	for(j=0;j<i;j++)printf(" ");
	for(   ;j<r;j++)printf("^");
	break;
      }
      r++;
    }
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 604
package main

import "fmt"

func main() {
	var n, l int
	fmt.Scan(&n, &l)

	sum := 0
	eatingRingo := 1000
	for i := 0; i < n; i++ {
		tmp := l + i
		sum += tmp
		if abs(eatingRingo) > abs(tmp) {
			eatingRingo = tmp
		}
	}

	fmt.Println(sum - eatingRingo)
}

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


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int N = 1000000;
const ll mod = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

/*------------------------------------------------------------------*/


int main(){
    int n; cin >> n;
    vector<int> t(n), x(n), y(n);
    rep(i, n) cin >> t[i] >> x[i] >> y[i];
    bool flag = true;

    rep(i, n){
        if(i == 0){
            if(t[i] >= x[i] + y[i] and (t[i] % 2 == (x[i] + y[i]) % 2)) continue;
            else flag = false;
        }else{
            if(t[i] - t[i - 1] >= abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1]) 
            and ((t[i] - t[i - 1]) % 2 == (abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1])) % 2)) continue;
            else flag = false;
        }
    }
    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(c) (c).begin(), (c).end()
#define pb push_back
#define eb emplace_back
using namespace std;
const long long INF = 1LL<<60; // 仮想的な無限大の値;
using ll = long long;
using P  = pair<int, int>;
#define vi vector<int>
#define vll vector<ll>
#define vs vector<string>
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; }
#include <atcoder/all>
using namespace atcoder;
//int dp[300005];
int op(int a, int b){ return max(a, b);}
int e(){ return 0; }
int main()
{
    int N, K;
    cin >> N >> K;
    vi A(N);
    rep(i, N) cin >> A[i];
    segtree<int, op, e> dp(300005);
    rep(i, N){
        //dp[A[i]] = max(dp[A[i]-K], ..., dp[A[i]+K]) + 1
        int l = A[i]-K;
        int r = A[i]+K+1;
        if(l < 0) l = 0;
        if(r > 300005) r =  300005;
        int m = dp.prod(l, r);
        dp.set(A[i], m+1);
    }
    cout << dp.all_prod() << endl;

    return 0;
}
//const int MX = 300005;
 
// // Segment tree
// struct F { // min func
//   typedef int TT;
//   TT d;
//   F(TT d=0):d(d) {}
//   F& operator+=(const F& f) {
//     maxs(d, f.d);
//     return *this;
//   }
//   F operator+(const F& f) const { return F(*this) += f;}
// };
// struct seg {
//   vector<F> d; int n;
//   seg(){}
//   seg(int mx) {
//     n = 1; while (n < mx) n <<= 1;
//     d = vector<F>(n<<1);
//   }
//   void upd(int i) { d[i] = d[i<<1]+d[i<<1|1];}
//   F& operator[](int i) { return d[n+i];}
//   void init() { for(int i=n-1;i;--i) upd(i);}
//   void add(int i, F f) { for (i+=n,d[i]+=f,i>>=1;i;i>>=1) upd(i);}
//   void set(int i, F f) { for (i+=n,d[i]=f,i>>=1;i;i>>=1) upd(i);}
//   F get(int l, int r) {
//     l += n; r += n;
//     F lf, rf;
//     while (l < r) {
//       if (l&1) lf += d[l++];
//       if (r&1) rf = d[--r] + rf;
//       l >>= 1; r >>= 1;
//     }
//     return lf += rf;
//   }
// };
// //
 
 
// int main() {
//   int n;
//   scanf("%d",&n);
//   int k;
//   scanf("%d",&k);
 
//   seg t(MX);
//   int ans = 0;
//   rep(i,n) {
//     int a;
//     scanf("%d",&a);
//     int l = a-k, r = a+k+1;
//     maxs(l,0); mins(r,MX-2);
//     int now = t.get(l,r).d+1;
//     maxs(ans,now);
//     t.add(a,F(now));
//   }
//   cout<<ans<<endl;
//   return 0;
// }

Measured memory_bytes: 9632
# -*- coding:utf-8 -*-
# A.py : A - Round One

def main():
    _a = int(input())
    _b = int(input())

    answers = [1,2,3]

    _a_index = answers.index(_a)
    answers.pop(_a_index)

    _b_index = answers.index(_b)
    answers.pop(_b_index)

    print(answers[0])

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include<stdio.h>
int main(void)
{
    int a[10000],r,c,b,d=0,e,f=0;
    scanf("%d%d",&r,&c);
    for(b=0;b<r*c;b++){
        scanf("%d",&a[b]);
    }
    for(b=0;b<r*c;b++){
        printf("%d ",a[b]);
        d+=a[b];
        if((b+1)%c==0){
            printf("%d\n",d);
            f+=d;
            d=0;
        }
    }
    for(b=0;b<c;b++){
        for(e=b;e<r*c;e=e+=c){
            d+=a[e];
        }
        printf("%d ",d);
        d=0;
    }
    printf("%d\n",f);
    return 0;
}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  cpp_bin_float_100 a, b, c, eps(1e-80);
  cin >> a >> b >> c;
  
  if (sqrt(c) - sqrt(a) - sqrt(b) > eps) cout << "Yes\n";
  else cout << "No\n";
}

Measured memory_bytes: 3788
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
#define rep(i,n) for (ll i = 0; i < (ll)(n); ++i)
#define rrep(i,j,n) for(ll i = (ll)(j); i < (ll)(n); i++)
#define mrep(i,n) for (ll i = (ll)(n); i > 0; i--)
#define be(v) (v).begin(), (v).end()
#define dcout cout << fixed << setprecision(20) 
ll INF = 1LL << 60;
ll mod = 1e9 + 7;

int suu(char n) {
	return n-'0';
}

int main() {
	int n; cin >> n;
	string s = to_string(n);
	rrep(i,1,s.size()) {
		ll o=1;
		rep(j,i) {
			o*=10;
		}
		if(o==n) {
			cout << 10 << endl;
			return 0;
		}
	}
	int ans =0 ;
	rep(i,s.size()) {
		ans+=s[i]-'0';
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
//0-1 Knapsack Problem
#include <iostream>
#include <algorithm>

using namespace std;

struct Item {
public:
    int v, w;
    Item(int v=0, int w=0): v(v), w(w) {}
};

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

    int dp[N+1][W+1];
    for(int j=0; j<W+1; j++) dp[0][j] = 0;

    for(int i=1; i<N+1; i++) {
        for(int j=0; j<W+1; j++) dp[i][j] = dp[i-1][j];
        for(int j=0; j<W+1; j++) {
            if(items[i].w + j <= W) {
                if(i==0) dp[i][items[i].w + j] = items[i].v;
                else dp[i][items[i].w + j] = max(dp[i][items[i].w + j], dp[i-1][j] + items[i].v);
            }
        }
    }

    cout << dp[N][W] << endl;

    return 0;
}


Measured memory_bytes: 7028
#include <bits/stdc++.h>
#include <vector>
#include <cstdlib> //abs(int)
using namespace std;
int main(void){
  string a;
  int count = 0;
  cin >> a;
  for(int i = 0; i < 4; i++){
    if(a.at(i) == '+'){
      count++;
    }
  }
  cout << count - (4 - count);
}

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

int main(void){
    int r, c, table[101][101];
    cin >> r >> c;

    for(int i = 0; i < r; i++){
        for(int j = 0; j < c; j++){
            cin >> table[i][j];
            table[r][j] = 0;
        }
        table[i][c] = 0;
    }
    table[r][c] = 0;

    for(int i = 0; i <= r; i++){
        for(int j = 0; j < c; j++){
            cout << table[i][j] << ' ';
            table[i][c] += table[i][j];
            table[r][j] += table[i][j];
        }
        cout << table[i][c] << endl;
    }

    return 0;
}


Measured memory_bytes: 3124
#include<bits/stdc++.h>
 using namespace std;
 #define ll long long int
 int main()
  { ll c,d,e,f,g,r,i,x=0,sum,l,v,aa,bb,y;
     ll n;
      cin>>n;
    ll a[n+1];
       for(i=1;i<=n;i++)
         cin>>a[i];
        for(i=1;i<=n;i++)
        { if(a[i]%2==1&&i%2==1)
            x++;
        }

      cout<<x<<endl;
  }


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

#define pii pair<int,int>
#define pll pair<long long, long long>
#define rep(i,l,r) for(int i = l;i<r;i++)

#define SSTR( x ) static_cast< std::ostringstream & >( \
        ( std::ostringstream() << std::dec << x ) ).str()

#define fastout  ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
using namespace __gnu_pbds;

typedef tree<pll,null_type,less<pll>,rb_tree_tag,tree_order_statistics_node_update> order_set;

const int INF = (int)1e9 + 7;
const long long LLINF = (long long)1e18 + 7;

int main() {
    int a;
    cin >> a;
    cout << (24 * 2 - a);
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define NMAX 100000

int len, part, rank[NMAX+1];
int compare_sa(const void *a, const void *b);
void construct_sa(char *string, int n, int *sa);
int main(void)
{
  int i, n, k, l, lo, hi, sa[NMAX+1];
  char s[NMAX+1];
  scanf("%d%*c", &k);
  scanf("%s%*c", s);
  n = strlen(s);
  l = (n + k) / (k + 1);
  lo = 1;
  hi = n;
  construct_sa(s, n, sa);
  if (n % (k + 1) == 0) {
    int res = 0;
    for (i = 0; i < k; i++) {
      if (rank[n/(k+1)*(i+1)] > rank[res]) res = n / (k + 1) * (i + 1);
    }
    s[res+n/(k+1)] = '\0';
    printf("%s\n", s + res);
  } else {
    while (hi >= lo) {
      int mid = (lo + hi) / 2, pos = 0, res = 0;
      while (pos < n) {
        pos += rank[pos] <= mid ? l : l - 1;
        res++;
      }
      if (res <= k + 1) hi = mid - 1;
      else lo = mid + 1;
    }
    s[sa[lo]+l] = '\0';
    printf("%s\n", s + sa[lo]);
  }
}

int compare_sa(const void *a, const void *b)
{
  int i = *(int*)a, j = *(int*)b;
  if (rank[i] != rank[j]) return rank[i] - rank[j];
  else {
    int ri = (i + part <= len ? rank[i+part] : -1), rj = (j + part <= len ? rank[j+part] : -1);
    return ri - rj;
  }
}

void construct_sa(char *string, int n, int *sa)
{
  int i, tmp[NMAX+1];
  len = n;
  for (i = 0; i < len; i++) {
    sa[i] = i;
    rank[i] = string[i];
  }
  sa[len] = len;
  rank[len] = -1;
  for (part = 1; part <= (len + 1) / 2; part *= 2) {
    qsort(sa, len + 1, sizeof(int), compare_sa);
    tmp[sa[0]] = 0;
    for (i = 1; i <= len; i++) {
      tmp[sa[i]] = tmp[sa[i-1]] + (compare_sa(&sa[i-1], &sa[i]) ? 1 : 0);
    }
    for (i = 0; i <= len; i++) rank[i] = tmp[i];
  }
}


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

typedef pair<long long, long long> P;
typedef pair<long long, P> PP;

void solve(int t, int p, int r){
	int ws[t][p];
	for(int i=0; i<t; ++i)
		for(int j=0; j<p; ++j)
			ws[i][j] = 0;
	int acs[t] = {};
	int pena[t] = {};
	for(int i=0; i<r; ++i){
		int a, b, c;
		string s;
		cin >> a >> b >> c >> s;
		if(s[0] == 'C'){
			++acs[a-1];
			pena[a-1] += ws[a-1][b-1] * 1200 + c;
		}else{
			++ws[a-1][b-1];
		}
	}
	vector<PP> v;
	for(int i=0; i<t; ++i)
		v.push_back(PP(p-acs[i], P(pena[i], i+1)));
	sort(v.begin(), v.end());
	for(int i=0; i<t; ++i)
		cout << v[i].second.second << " " << p-v[i].first << " " << v[i].second.first << "\n";
}

int main(){
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	while(1){
		int t, p, r;
		cin >> t >> p >> r;
		if(t+p+r==0) return 0;
		solve(t, p, r);
	}
}


Measured memory_bytes: 3160
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define df 0
int dc=100000;
#define MAX 100010
typedef struct{
  int x;
  int y;
}data;


void print_data(data a){
  printf("(%d,%d) ",a.x,a.y);
}


int comp(const void* a,const void* b){
  data s=*((data*)a),t=*((data*)b);
  return t.x-s.x;
}

int main(){
  if(df)printf("*** debug mode ***\n");
  int n;
  scanf("%d",&n);
  data red[n],blue[n];
  int i;
  for(i=0;i<n;i++){
    int a,b;
    scanf("%d%d",&a,&b);
    red[i].x=a; red[i].y=b;
  }
  for(i=0;i<n;i++){
    int a,b;
    scanf("%d%d",&a,&b);
    blue[i].x=a; blue[i].y=b;
  }
  qsort(red,n,sizeof(data),comp);
  qsort(blue,n,sizeof(data),comp);
  if(df){
    printf(" red:");
    for(i=0;i<n;i++){
      print_data(red[i]);
    }
    printf("\n");
  }
  if(df){
    printf("blue:");
    for(i=0;i<n;i++){
      print_data(blue[i]);
    }
    printf("\n");
  }
  
  
  int count=0;
  int matched[MAX]={};
  for(i=0;i<n;i++){
    int j,min=220,idx=-1;
    if(df){
      printf("find pair of red: (%d,%d)\n",red[i].x,red[i].y);
    }
    for(j=0;j<n;j++){
      if(df)printf(" (%d,%d)->",blue[j].x,blue[j].y);
      if(blue[j].x<red[i].x){if(df)printf("x is too small\n");break;}
      if(matched[j]==0 && red[i].y<blue[j].y && blue[j].y<min){
	min=blue[j].y; idx=j;
	if(df)printf("good! idx:%d\n",idx);
      }
      if(df)printf("NG\n");
    }
    if(idx!=-1){
      count++;
      matched[idx]=1;
      if(df)printf("match  (%d,%d) and (%d,%d)\n"
		   ,red[i].x,red[i].y,blue[idx].x,blue[idx].y);
    }
  }
  printf("%d",count);

  return 0;
}


/// confirm df==0 ///


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define ll  long long
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define pb push_back
#define Max(x,y,z) max(x,max(y,z))
#define f first
#define s second
#define lbd lower_bound
#define sz(x)       (ll)x.size()
#define pi 3.1415926536
#define mod 1000000007
using namespace std;
void solve()
{
    ll n,m,k,x,y=0,res=0,l,cnt=0,sum=0,z,sum1=0,cnt1=0,h,res1;
    string s;
    cin>>s;
    n=s.size();
    ll ar[n]={0};
    ll br[n]={0};
    for(ll i=0;i<n;i+=2)
        ar[i]=1;
    for(ll i=1;i<n;i+=2) br[i]=1;
    rep(i,0,n)
    {
        if(((s[i]-'0')^ar[i])==1)
            cnt++;
        if(((s[i]-'0')^br[i])==1)
            cnt1++;
    }
    cout<<min(cnt,cnt1);



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


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

using namespace std;

const int N=1e5+7;


int main() {
    int cnt[52][26];
    memset(cnt,0,sizeof(cnt));
    
    int n; cin>>n;
    for(int i=0;i<n;i++) {
        string s; cin>>s;
        for(int j=0;j<s.size();j++) {
            cnt[i][s[j]-'a']++;
        }
    }
    
    string ans;
    for(int j=0;j<26;j++) {
        int sz=cnt[0][j];
        for(int i=1;i<n;i++) {
            sz=min(sz,cnt[i][j]);
        }
        while(sz) cout<<char(j+'a'),sz--;
    }
    
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] V = new int[N];
        int[] C = new int[N];

        for(int i = 0; i < N; i ++){
            V[i] = sc.nextInt();
        }

        for(int i = 0; i < N; i ++){
            C[i] = sc.nextInt();
        }

        int sum = 0;

        for(int i = 0; i < N; i ++){
            if(V[i]-C[i]>0){
                sum += V[i]-C[i];
            }
        }

        System.out.println(sum);


    }
}


Measured memory_bytes: 21716
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String ans = "x";

		for(int i=1;i<S.length();i++) {
			ans = ans + "x";
		}

		System.out.println(ans);
	}
}


Measured memory_bytes: 22868
N,*A=map(int,open(0).read().split())

x4 = 0
x2 = 0
x1 = 0

for i in range(N):
  if A[i]%4 == 0:
    x4+=1
  elif A[i]%2 == 0:
    x2+=1
  else:
    x1 +=1
if x1 +min(1,x2)<= x4+1:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 91364
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
#define chmin(a, b) ((a) = min((a), (b)))
#define chmax(a, b) ((a) = max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

const ll MOD = 1e9 + 7;
const ll INF = 1e18;
const double pi = acos(-1);
const double eps = 1e-10;

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

int main(){
    int n, k; cin>>n>>k;
    int maxedge = n * (n - 1) / 2;
    if(maxedge - (n - 1) < k){
        cout << "-1" << endl;
        return 0;
    }

    vector<P> edge;
    int cnt = 0;
    vector<P> G;
    for(int i=1; i<=n; i++){
        for(int j=i+1; j<=n; j++){
            G.emplace_back(i, j);
            cnt++;
            if(cnt == maxedge - k) goto END;
        }
    }
    END:;

    cout << G.size() << endl;
    for(auto i:G){
        cout << i.first << " " << i.second << endl;
    }
}

Measured memory_bytes: 384
N = int(input())
S = [int(a) for a in input().split()]
T = [int(a) for a in input().split()]
U = [int(a) for a in input().split()]
V = [int(a) for a in input().split()]
X = [[0] * N for _ in range(N)]
m = (1 << 64) - 1

for i in range(N):
    for j in range(N):
        if not S[i]:
            X[i][j] |= U[i]
        if not T[j]:
            X[i][j] |= V[j]
        X[i][j] |= U[i] & V[j]

A1 = [[m] * N for _ in range(N)]
A2 = [[m] * N for _ in range(N)]
for i in range(N-1)[::-1]:
    for j in range(N):
        A2[i][j] = A2[i+1][j] & X[i+1][j]

for i in range(N):
    a = 0
    for j in range(N):
        a |= X[i][j]
    for j in range(N):
        if i:
            A1[i][j] = A1[i-1][j] & X[i-1][j]
        if S[i] and not T[j]:
            X[i][j] |= U[i] & ~((A1[i][j] & A2[i][j]) | a)
        a |= X[i][j]

A1 = [[m] * N for _ in range(N)]
A2 = [[m] * N for _ in range(N)]
for j in range(N-1)[::-1]:
    for i in range(N):
        A2[i][j] = A2[i][j+1] & X[i][j+1]

for j in range(N):
    a = 0
    for i in range(N):
        a |= X[i][j]
    for i in range(N):
        if j:
            A1[i][j] = A1[i][j-1] & X[i][j-1]
        if T[j] and not S[i]:
            X[i][j] |= V[j] & ~((A1[i][j] & A2[i][j]) | a)
        a |= X[i][j]

for i in range(N):
    if S[i] == 0:
        s = m
        for j in range(N):
            s &= X[i][j]
        if s != U[i]:
            print(-1)
            exit()
    else:
        s = 0
        for j in range(N):
            s |= X[i][j]
        if s != U[i]:
            print(-1)
            exit()

for j in range(N):
    if T[j] == 0:
        s = m
        for i in range(N):
            s &= X[i][j]
        if s != V[j]:
            print(-1)
            exit()
    else:
        s = 0
        for i in range(N):
            s |= X[i][j]
        if s != V[j]:
            print(-1)
            exit()

for x in X:
    print(*x)

Measured memory_bytes: 191692
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int H = sc.nextInt();
		int N = sc.nextInt();
		for (int i=0;i<N;i++ ) {
			int temp = sc.nextInt();
			H -= temp;
			if (H <= 0) {
				System.out.println("Yes");
				return ;
			}
		}
		System.out.println("No");
	}
}


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

int main()
{
    int n;
    scanf("%d", &n);
    int *a = new int[n];
    for (int i = 0; i < n; i++) scanf("%d", a + i);

    for (int i = n - 1; i >= 0; i -= 2)
    {
        if (i != n - 1) printf(" ");
        printf("%d", a[i]);
    }
    for (int i = n % 2; i < n; i += 2)
    {
        printf(" %d", a[i]);
    }
    printf("\n");
    return 0;
}

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod =(1e9)+7;
using P = pair<ll,ll>;

int main() {
    double w,h;
    cin >>w>>h;
    double x,y;cin >>x>>y;
    double s,t=0;
    s=w*h/2;
    if(w/2==x&&h/2==y)t=1;
    cout <<setprecision(20)<<s<<" ";
    cout <<t <<endl;
    return 0;
}



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

int main(){
     int n,k;
    cin>>n>>k;
    vector<double>p(n);
    vector<double>sum(n+1);
    for(int i=0; i<n; i++){
        cin>>p.at(i);
        double bu=(1+p.at(i))/2;
        sum.at(i+1)=sum.at(i)+bu;
    }
    double mak=0;
    for(int i=k; i<n+1; i++){
        mak=max(mak,sum.at(i)-sum.at(i-k));
    }
    cout << fixed << setprecision(2);
    cout<<mak<<endl;
}

Measured memory_bytes: 3456
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<set>
#include<map>
using namespace std;

#define int long long
#define inf 1000000000
typedef pair<int, int> P;//to,1=cost
set<int>c;
signed main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		if(c.erase(a))c.erase(a);
		else c.insert(a);
	}
	cout << c.size() << endl;
}

Measured memory_bytes: 4864
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <iomanip>
#include <bitset>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>

using namespace std;

int main() {
  int a, b;
  cin >> a >> b;
  cout << (1ll * a * 3 + b) / 2 << endl;
  return 0;
}


Measured memory_bytes: 256
S = input()
S_str = str(S)
n = len(str(S))
ans = 0

for i in range(2**(n-1)):
    tmp = 0
    for j in range(n-1):
        if i & (1 <<(n-2 -j)):
            ans += 10*tmp + int(S_str[j])
            tmp = 0
        else:
            tmp = 10*tmp + int(S_str[j]) 
    ans += 10*tmp + int(S_str[-1])
print(ans)

Measured memory_bytes: 3060
use std::fs;
use std::io::{stdin, Read};

macro_rules! parse {
    ($it: ident) => {
        $it.next().unwrap().parse().unwrap()
    };
    ($it: ident,2) => {
        (parse!($it), parse!($it))
    };
    ($it: ident,3) => {
        (parse!($it), parse!($it), parse!($it))
    };
    ($it: ident,4) => {
        (parse!($it), parse!($it), parse!($it), parse!($it))
    };
    ($it: ident, $n: expr) => {
        (&mut $it).take($n).map(|e| e.parse().unwrap()).collect();
    };
}

fn solve(s: &str) {
    let mut it = s.split_whitespace();
    let n: usize = parse!(it);
    let mut a: Vec<isize> = parse!(it, n);
    a.sort();
    let np = a.iter().filter(|&&x| x >= 0).count();
    let nm = n - np;
    let mut stack = vec![];
    if nm == 0 {
        let mut lhs = a[0];
        for i in 2..n {
            stack.push((lhs, a[i]));
            lhs -= a[i];
        }
        stack.push((a[1], lhs));
        let ret = a[1] - lhs;
        printans(stack);
    } else if np == 0 {
        let mut lhs = a[n - 1];
        for i in 0..(n - 1) {
            stack.push((lhs, a[i]));
            lhs -= a[i];
        }
        printans(stack);
    } else {
        let mut lhs = a[0];
        for i in (nm + 1)..n {
            stack.push((lhs, a[i]));
            lhs -= a[i];
        }
        stack.push((a[nm], lhs));
        lhs = a[nm] - lhs;
        for i in 1..nm {
            stack.push((lhs, a[i]));
            lhs -= a[i];
        }
        printans(stack);
    }
}
fn printans(stack: Vec<(isize, isize)>) {
    let &(a, b) = stack.last().unwrap();
    println!("{}", a - b);
    for (i, j) in stack {
        println!("{} {}", i, j);
    }
}

fn test() {
    let mut f = fs::File::open("foo.txt").unwrap();
    let mut s = String::new();
    f.read_to_string(&mut s).unwrap();
    solve(&s);
}

fn main() {
    let mut s = String::new();
    stdin().read_to_string(&mut s).unwrap();
    solve(&s);
}

#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn test_main() {
        test();
    }
    #[test]
    fn test_input() {
        let s = "
        3
        1 -1 2
        ";
        solve(s);
    }
}


Measured memory_bytes: 12156