akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)

int main(){
    int N , M;
    cin >> N;
    M=N%10;

    if(M==3){
        cout   << "bon" << endl;
    }else if(M==0||M==1||M==6||M==8){
        cout  <<   "pon" << endl;
    }
    else{
        cout <<"hon" << endl;
    }
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
 
#define fi first
#define se second
#define pb push_back
 
#define limit (int) (2e5 + 5)
#define mod (int) (1e9 + 7)

using namespace std;
using lli = long long int;
using ulli = unsigned long long int;
using ld = long double;

int a[limit];

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

    int n,k;
    cin >> n >> k;

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

    bool flag = true;

    for (int i = k; i < n; ++i)
    {
        if (a[i] <= a[i-k])
        {
            cout << "No\n";
        } else {
            cout << "Yes\n";
        }
    }

    return 0;
}







Measured memory_bytes: 4436
#include <stdio.h>

int main(void) {
int a,b,i;
for(;i<5;){
	scanf("%d",&a);
	if(a>=40){
		b=a+b;
		i++;
	}else if(a<40){
		b=b+40;
		i++;
	}
}
printf("%d\n",b/5);
	return 0;
}

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

bool isb(string &s){
    int n = s.length();
    for(int i = 0; i < n; i++)  if(s[i] != s[n-1-i])    return false;
    return true;
}

int main(){
    string s;
    cin >> s;
    int n = s.length();
    string t = s.substr(0,(n-1)/2);
    string u = s.substr((n+3)/2-1);
    cout << (isb(s)&&isb(t)&&isb(u) ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  string T;
  cin >> N;
  for (int i = 0; i < N; i++){
    string S;
    cin >> S;
    if (S == "Y"){
      T = "Four";
      break;
    }
    else{
      T = "Three";
    }
  }
  cout << T << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <algorithm> // sort
#include <iomanip>

#define DEBUG 0
#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;
using namespace std;

static const int MAX_X = 10;
static const int MAX_Y = 10;

int main(){
#if DEBUG
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
    int A,B,C,D,res;
    cin >> A >> B >> C >> D;

    res = min(D,B) - max(C,A);
    if(res < 0)res = 0;

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



Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<(int)(n);i++)
#define N 200010


int main() {
	char a[100][110];
	char c[110];
	int b[100];
	f(i, 100) {
		f(j, 110) {
			a[i][j] = 0;
			c[j] = 0;
		}
	}
	int n;
	int s, ans;
	bool v = false;
	ans = 0;
	scanf("%d", &n);
	f(i, n) {
		scanf("%s", a[i]);
		scanf("%d", &b[i]);
	}
	scanf("%s", c);
	f(i, n) {
		if (v)ans += b[i];
		s = 0;
		f(j, 110)if (a[i][j] == c[j])s++;
		if (s == 110)v = true;
	}

	printf("%d\n", ans);


	return 0;
}

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

int main(){

	int x, cnt;
	int coin[6] = {500, 100, 50, 10, 5, 1};
	
	while(cin >> x){
		cnt = 0;
		
		if(x == 0) break;
		
		x = 1000 - x;
		for(int i=0; i<6; i++){
			cnt += x / coin[i];
			x -= x / coin[i] * coin[i];
		}
	
		cout << cnt << endl;
	}

	return 0;

}

Measured memory_bytes: 1160
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#define ll long long
using namespace std;

int main() {
	int N;
	cin >> N;
	vector<int> a(N), b(N);
	for(int i=0; i<N; ++i) cin >> a[i];
	bool no=0;
	for(int i=0; i<N; ++i){
	    cin >> b[i];
	    no |= (a[i]!=b[i] && a[i]<=b[i]*2);
	}
	if(no){
	    cout << -1 << endl;
	    return 0;
	}
	ll ans=0;
	vector<vector<bool>> aa(N, vector<bool>(51, 0));
	for(int i=0; i<N; ++i) aa[i][a[i]]=1;
	while(1){
	    bool continued=0;
	    for(int i=0; i<N; ++i){
	        continued |= !(aa[i][b[i]]);
	    }
	    if(!continued) break;
	    vector<vector<bool>> dp(N, vector<bool>(51, 0));
	    for(int i=0; i<N; ++i) dp[i][b[i]]=1;
	    int d=0;
	    bool more=1;
	    while(more){
	        more=0;
	        ++d;
	        for(int i=0; i<N; ++i){
	            for(int t=0; t<d; ++t){
	                for(int u=1; t+d*u<51; ++u){
	                    dp[i][t+d*u]= dp[i][t+d*u] || dp[i][t];
	                }
	            }
	            bool kicked=0;
	            for(int t=0; t<51; ++t) kicked |= (aa[i][t] && dp[i][t]);
	            more |= !kicked;
	        }
	    }
	    ans |= ((ll) 1<<d);
	    for(int i=0; i<N; ++i){
	        for(int t=0; t<51; ++t){
	            aa[i][t%d]= aa[i][t%d] || aa[i][t];
	        }
	    }
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
from random import random
from sys import setrecursionlimit

setrecursionlimit(3 * 10 ** 5)


class TreapNode:
    _value = None
    _priority = None
    _count = None
    _left = None
    _right = None

    def __init__(self, value):
        self._value = value
        self._priority = random()
        self._count = 1


def treap_rotate_right(n):
    l = n._left
    n._left = l._right
    l._right = n
    return l


def treap_rotate_left(n):
    r = n._right
    n._right = r._left
    r._left = n
    return r


def treap_insert(n, v):
    if n is None:
        return TreapNode(v)
    if v == n._value:
        n._count += 1
        return n
    if v < n._value:
        n._left = treap_insert(n._left, v)
        if n._priority > n._left._priority:
            n = treap_rotate_right(n)
    else:
        n._right = treap_insert(n._right, v)
        if n._priority > n._right._priority:
            n = treap_rotate_left(n)
    return n


def treap_delete(n, v):
    if n is None:
        return None
    if n._value > v:
        n._left = treap_delete(n._left, v)
        return n
    if n._value < v:
        n._right = treap_delete(n._right, v)
        return n

    # n._value == v
    if n._count > 1:
        n._count -= 1
        return n

    if n._left is None and n._right is None:
        return None

    if n._left is None:
        n = treap_rotate_left(n)
    elif n._right is None:
        n = treap_rotate_right(n)
    else:
        # n._left is not None and n._right is not None
        if n._left._priority < n._right._priority:
            n = treap_rotate_right(n)
        else:
            n = treap_rotate_left(n)
    return treap_delete(n, v)


def treap_size(n):
    if n is None:
        return 0
    return n._count + treap_size(n._left) + treap_size(n._right)


def treap_str(n):
    if n is None:
        return ""
    result = []
    if n._left is not None:
        result.append(treap_str(n._left))
    result.append("%d:%d" % (n._value, n._count))
    if n._right is not None:
        result.append(treap_str(n._right))
    return ' '.join(result)


def treap_search(n, v):
    # x 未満で最大のノードを検索する. n 未満のノードがなければ nil を返す
    if n is None:
        return None
    if n._value >= v:
        if n._left is None:
            return None
        return treap_search(n._left, v)
    # n._value < v
    if n._right is None:
        return n
    r = treap_search(n._right, v)
    if r is None:
        return n
    return r


class Treap:
    _root = None

    def insert(self, v):
        self._root = treap_insert(self._root, v)

    def delete(self, v):
        self._root = treap_delete(self._root, v)

    def __len__(self):
        return treap_size(self._root)

    def __str__(self):
        return treap_str(self._root)

    def search(self, v):
        return treap_search(self._root, v)


N = int(input())
A = [int(input()) for _ in range(N)]

t = Treap()
for a in A:
    n = t.search(a)
    if n is not None:
        t.delete(n._value)
    t.insert(a)
print(len(t))


Measured memory_bytes: 44328
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

	bool is_w;

	if(s[0] == 'W') {
		is_w = true;
	}
	else {
		is_w = false;
	}

	int ans = 0;
	for (int i = 1; i < s.size(); i++) {
		if (is_w && s[i] == 'B') {
			ans++;
			is_w = false;
		}
		else if (!is_w && s[i] == 'W') {
			ans++;
			is_w = true;
		}
	}

	cout << ans;

	return 0;
}


Measured memory_bytes: 1144
package main

import "fmt"

func main() {
	var n, y int
	fmt.Scan(&n, &y)
	for i := 0; i <= n; i++ {
		for j := 0; j <= n-i; j++ {
			if i*10000+j*5000+(n-i-j)*1000 == y {
				fmt.Println(i, j, n-i-j)
				return
			}
		}
	}
	fmt.Println("-1 -1 -1")
}


Measured memory_bytes: 512
#!venv/bin/python

import math
import numpy as np
import random
import copy
import statistics 
import bisect
import heapq
from collections import defaultdict 

N = int(input())
S = input()
#A, B, C = [int(x) for x in input().split()]

cnt = {
    "B": 0,
    "R": 0,
}

for s in S:
    cnt[s] += 1

if cnt["R"] > cnt["B"]:
    print ("Yes")
else:
    print ("No")

Measured memory_bytes: 24696
inf = 10 ** 15
mod = 10 ** 9 + 7
h,w = map(int, input().split())
maps = [input() for i in range(h)]
remh = []
remw = []
for i in range(h):
    flag = True
    for j in range(w):
        if maps[i][j] == '#':
            flag = False
            break
    if not flag:
        remh.append(i)
for j in range(w):
    flag = True
    for i in range(h):
        if maps[i][j] == '#':
            flag = False
    if not flag:
        remw.append(j)

for num in remh:
    a = []
    for tmp in remw:
        a.append(maps[num][tmp])
    s = ''.join(a)
    print(s)


Measured memory_bytes: 40048
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
	int a, b, c, d;cin >> a >> b >> c >> d;
	//a<=x<=b, c<=y<=d
	int ans = max(a * c, max(a * d, max(b * c, b * d)));
	cout << ans << endl;
	return 0;
}

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

public class Main {

    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int input = sc.nextInt();
        int ans = 0;
        if(input >= 65 && input <= 90){
            ans = 1;
        }else if(input >= 97 && input <=122){
            ans = 2;
        }
        out.println(ans);
        out.flush();

    }

    static class FastScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

        public String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }

            return tokenizer.nextToken("\n");
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}


Measured memory_bytes: 24336
#include<stdio.h>

int main()
{
    int size,i,j,key,k;
    scanf("%d",&size);
    int arr[size+1];
    for(i=1;i<=size;i++)
                       scanf("%d",&arr[i]);
                       
    for(i=2;i<=size;i++)
    {
                       key = arr[i];
                       j = i-1;
                       for(k=1;k<=size;k++)
                       {
                                           if(k!=size)
                                           printf("%d ",arr[k]);
                                           else
                                           printf("%d\n",arr[k]);
                       }
                       while(j > 0 && arr[j] > key)
                       {
                                 arr[j+1] = arr[j];
                                 j=j-1;
                       }
                       arr[j+1] = key;                 
    }
    for(k=1;k<=size;k++)
    {
                        if(k!=size)
                        printf("%d ",arr[k]);
                        else
                        printf("%d\n",arr[k]);
    }
    return 0;
} 
                       

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

int main() {
  int N, A, B;
  cin >> N >> A >> B;
  cout << min(A * N, B) << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner teclado = new Scanner(System.in);
		int N = teclado.nextInt();
		int K = teclado.nextInt();
		double resto = N % K;
		System.out.println((int) resto);
		teclado.close();

	}

}

Measured memory_bytes: 22740
INF = 10**10 - 1


#指定数分の３つの整数を順番に受けてリストに入力
# スペース区切りの整数入力
N,Wmax = map(int, input().split())
w = [0]*(N+1)
v = [0]*(N+1)
for i in range(1,N+1):
    w[i],v[i] = map(int, input().split())

#dpの初期化
dp = [[-INF] * (Wmax+1) for i in range(N+1)]
for i in range(0,N+1):
    dp[i][0] = 0
#print(dp[0])

for i in range(1,N+1):
    for ww in range(1,Wmax+1):
        dp[i][ww] = dp[i-1][ww]        
        if w[i] > ww:
            continue
        else:
            dp[i][ww] = max(dp[i][ww],dp[i-1][ww-w[i]]+v[i])
    #print(dp[i])

Vmax = 0
for ww in range(1,Wmax+1):
    Vmax = max(Vmax,dp[N][ww])
print(Vmax)


Measured memory_bytes: 120172
n,m,c = map(int,input().split())

B = [int(i) for i in input().split()]

ans = 0
for j in range(n):
    out = c
    A = [int(i) for i in input().split()]
    for i in range(m):
        out += A[i]*B[i]
    if out > 0:
        ans +=1


print(ans)


Measured memory_bytes: 3060
import collections

n = int(input())
v = list(map(int,input().split()))

vodd = [v[2*i] for i in range(int(n/2))]
veven = [v[2*i+1] for i in range(int(n/2))]

codd = collections.Counter(vodd)
ceven = collections.Counter(veven)

aodd = codd.most_common()[0][0]
aeven = ceven.most_common()[0][0]

nodd = codd.most_common()[0][1]
neven = ceven.most_common()[0][1]

if aodd != aeven:
    print(n-nodd-neven)
else:
    if len(codd) == 1:
        if len(ceven) == 1:
            print(n-nodd)
        else:
            meven = ceven.most_common()[1][1]
            print(n-nodd-meven)
    elif len(ceven) == 1:
        modd = codd.most_common()[1][1]
        print(n-modd-neven)
    else:
        modd = codd.most_common()[1][1]
        meven = ceven.most_common()[1][1]
        print(min(n-nodd-meven,n-modd-neven))

Measured memory_bytes: 19032
"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const K = Number(arg[0].split(" ")[0]);
    const N = Number(arg[0].split(" ")[1]);
    const A = arg[1].split(" ").map(Number);
    
    let longestDistances = 0;
    
    // 区間を作る
    for(let i=0; i<N; i++) {
        let distance;
        
        if(Number(i) === N - 1) {
            distance = (K - A[i]) + A[0];
        } else {
            distance = A[Number(i) + 1] - A[i];
        }
        
        if(longestDistances < distance) {
            longestDistances = distance;
        }
    }
    
    const answer = K - longestDistances;
    
    console.log(answer);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 22292
#include <iostream>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <algorithm>
#include <functional>
#include <cstring>
#include <limits.h>
#define FOR(i,k,n)  for (int i=(k); i<(int)(n); ++i)
#define REP(i,n)    FOR(i,0,n)
#define FORIT(i,c)	for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define SZ(i) ((int)i.size())
#define pb          push_back
#define mp          make_pair
#define mt          make_tuple
#define get0(x)     (get<0>(x))
#define get1(x)     (get<1>(x))
#define get2(x)     (get<2>(x))
#define ALL(X)      (X).begin(),(X).end()
#define LLMAX       9223372036854775807LL
#define LLMIN       -9223372036854775808LL
#define IMAX        2147483647
#define IMIN        -2147483648
typedef long long LL;
using namespace std;

int N,K;
vector<int> G[2000];
int dist[2000];

void dfs(int v,int p,int k){
    dist[v]=k;
    REP(i,SZ(G[v]))
        if(G[v][i]!=p)
            dfs(G[v][i],v,k+1);
}

int main(void){
    cin>>N>>K;
    REP(i,N-1){
        int a,b;cin>>a>>b;a--;b--;G[a].pb(b);G[b].pb(a);
    }
    int ans=IMAX;
    if(K%2==0){
        REP(i,N){
            fill(dist,dist+N,0);
            dfs(i,N,0);
            int r=0;
            REP(i,N)
                if(dist[i]>(K/2))
                    r++;
            // printf("K=%d i=%d r=%d\n",K,i,r);
            // REP(i,N)
            //     printf("dist[%d]=%d\n",i,dist[i]);
            // printf("\n");
            ans=min(ans,r);
        }
    }else{
        REP(i,N){
            REP(j,SZ(G[i])){
                int r=0;
                fill(dist,dist+N,0);
                dfs(i,G[i][j],0);
                REP(k,N)
                    if(dist[k]>K/2)
                        r++;
                fill(dist,dist+N,0);
                dfs(G[i][j],i,0);
                REP(k,N)
                    if(dist[k]>(K/2))
                        r++;
            // printf("i=%d r=%d\n",i,r);
                ans=min(ans,r);
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 512
#include<stdio.h>

int main(){
  int a, b, c, d, e, f;
  int i, j, k, l, wo=0, su=0;
  double p, max=0.0;
  
  scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &f);
  
  for(i=0; i*a*100 <= f; i++){
    for(j=0; (i*a+j*b)*100 <= f; j++){
       if(i+j != 0){
         for(k=0; (i*a+j*b)*100+k*c <= f; k++){
           for(l=0; (i*a+j*b)*100+k*c+l*d <= f; l++){ 
             p = 100.0 * (double)(k*c + l*d) / (double)(i*a + j*b + k*c + l*d);
             if((double)(k*c+l*d)/(double)(i*a+j*b) <= (double)e && p > max){
              wo = (i*a+j*b)*100+k*c+l*d;
              su = k*c+l*d;
              max = p; 
            }
          }
        }
      }
    }
  }
  if(wo == 0){
    wo = a * 100;
    su = 0;
  }
  printf("%d %d\n", wo, su);

  return 0;
}


Measured memory_bytes: 128
// AOJ 1215: Co-occurrence Search
// 2017.10.15

#include <stdio.h>
#include <string.h>

char s[1000003];
char *pos[55]; int key[128], len;

int gettext()
{
	char c, *p = s;
	while (1) {
		if ((c = getchar()) < 0 || (c == '\n' && p == s)) return 0;
		if (c == '\n') if ((c = getchar()) < 0 || c == '\n') { *p = 0; break; }
		*p++ = c;
	}
	return 1;
}

void print(char *s, char *e)
{
	int w = 0;
	while (s <= e) {
		if (w == 72) putchar('\n'), w = 0;
		putchar(*s++), w++;
	}
	puts("\n");
}

int check(char *p)
{
	int i;
	char *q = p;
	for (i = 1; i <= len; i++) if (pos[i] < q) q = pos[i];
	return p-q;
}

int main()
{
	int k, t, min, ans, cnt;
	char buf[80], *p, *pp;

	while (1) {
		if (!gettext()) break;
		memset(key, 0, sizeof(key)), memset(pos, 0, sizeof(pos));
		fgets(p = buf, 80, stdin);
		len = 0; while (*p > ' ') key[*p++] = ++len;

		min = 0x7fffffff, ans = cnt = 0, p = s;
		while (*p) {
			if ((t = key[*p]) > 0) {
				if (pos[t] == NULL) cnt++;
				pos[t] = p;
				if (cnt == len) {
					if ((k = check(p)) < min) min = k, ans = 1, pp = p-k;
					else if (k == min) ans++;
				}
			}
			p++;
		}
		printf("%d\n\n", ans);
		if (ans > 0) print(pp, pp+min);
		fgets(buf, 80, stdin);		// skip empty line
	}
	return 0;
}

Measured memory_bytes: 2096
# coding: utf-8
N=int(input())
A=list(map(int,input().split()))
Flg=True
cnt=0
for i in range(N):
    if A[i]%2==0:
        if A[i]%3==0 or A[i]%5==0:
            cnt+=1
        
    else:
        cnt+=1

if cnt==N:
    print('APPROVED')
    
else:
    print('DENIED')

Measured memory_bytes: 38256
#include <stdio.h>

int main(void)
{
	int i = 1;
   	while(1)
   	{
   		int a;
   		scanf("%d", &a);
   		if(a == 0) break;
   		printf("Case %d: %d\n", i, a);
   		i++;
   	}
    return 0;
}

Measured memory_bytes: 2584
#include <functional>
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <queue>
#include <string>
#include <cstring>
#include <math.h>
using namespace std;
int main() {
  
   char n;
 
   cin >> n;
 
   char a = n+1;
  
   cout << a << endl;
  return 0;
}

Measured memory_bytes: 256
n,x = map(int, raw_input().split(' '))
ais = map(int, raw_input().split(' '))
count,cur,i = 0,0, 0
res = [cur]
while(i < len(ais)):
	cur += ais[i]
	res.append(cur)
	i +=1

print len([e for e in res if e <= x])

Measured memory_bytes: 27884
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cassert>
#include <stack>
#include <limits>
#include <array>
#include <unordered_map>
#include <unordered_set>
#include <memory>
#include <numeric>
//#include <tuple>

constexpr long long mod = static_cast<long long>(1e9 + 7);

int main() {
    int N;
    std::cin >> N;
    std::vector<int> v(N);
    for(auto& val: v)
        std::cin >> val;
    std::sort(begin(v), end(v), std::greater<int>{});
    int ans = 0;
    for(int i = 0; i < v.size(); ++i){
        if(i % 2 == 0) ans += v[i];
        else ans -= v[i];
    }
    std::cout << ans << std::endl;
    return 0;
}


Measured memory_bytes: 256
def up(n):
	goal = [0 for i in range(n)]
	goal[:3] = [1,2,4]
	for i in range(3,n):
		goal[i] = sum(goal[i-3:i])
	return goal[-1]
	
while True:
	n = int(raw_input())
	if n == 0: break
	print (up(n)//10+1)//365+1

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

void ckmax (int &x, int a) {
	x = max(x, a);
}

vector < int > zf (string s) {
	int n = s.size();
	vector < int > z(n, 0);
	int l = 0, r = 0;
	for (int i = 1; i < n; ++i) {
		ckmax(z[i], min(r - i, z[i - l]));
		while (i + z[i] < n && s[i + z[i]] == s[z[i]])
			++z[i];
		if (i + z[i] > r)
			r = i + z[i], l = i;
	}
	return z;
}

signed main () {
	int n;
	string s;
	cin >> n >> s;
	int ans = 0;
	for (int i = 0; i < n; ++i) {
		vector < int > z = zf(s.substr(i, n - i));
		for (int j = 0; j < int(z.size()); ++j) 
			ckmax(ans, min(z[j], j));
	}
	cout << ans << '\n';
}


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

int main(){
	int n, m;
	cin>>n>>m;
  	for(int i=0;i<m;i++){
    	int a;
      	cin>>a;
      	n-=a;
    }
  	if(n<0){
    	cout<<-1;
      	return 0;
    }
  	cout<<n;
  	return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(v) v.begin(), v.end()
#define mod 1000000007
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int a, b, t;
    cin >> a >> b >> t;
    cout << b  * (t / a) << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define sync ios::sync_with_stdio(false); cin.tie(NULL); cerr.tie(NULL);

int main(){
  int n,m;
  cin >> n >> m;
  pair<int,int> a[m];
  for(int i=0;i<m;i++){
    cin >> a[i].first >> a[i].second;
  }
  sort(a,a+m);
  int left=INT_MAX,right=INT_MAX,count=0;
  for(int i=0;i<m;i++){
    if(a[i].first>=left&&a[i].first<right){
      left=a[i].first;
      right=min(right,a[i].second);
    }
    else{
      count++;
      left=a[i].first,right=a[i].second;
    }
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 1024
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;

import java.util.*;

public class Main {
    long MOD = (long) 1e9 + 7;

    InputStream in;
    OutputStream out;

    public Main() {
        this(System.in, System.out);
    }

    public Main(InputStream in, OutputStream out) {
        this.in = in;
        this.out = out;
    }

    void run() {
        Scanner sc = new Scanner(this.in);
        PrintWriter out = new PrintWriter(this.out);

        // write your code
        int n = sc.nextInt();
        int[] ls = new int[n];
        for (int i = 0; i < n; i++) {
            ls[i] = sc.nextInt();
        }

        Arrays.sort(ls);

        long cnt = 0;
        for (int i = 0; i < n; i++) {
            for (int j = i + 1; j < n; j++) {
                int l = Math.max(j + 1, lowerBound(ls, Math.max(ls[j] - ls[i], ls[i] - ls[j] + 1)));
                int r = lowerBound(ls, ls[i] + ls[j]);
                int dup = 0;
                if (l <= i && i < r) dup++;
                if (l <= j && j < r) dup++;
//                debug(i, j, ls[i], ls[j], l, r, r - l - dup);
                cnt += r - l - dup;
            }
        }

        out.println(cnt);

        out.flush();
    }

    public int lowerBound(int[] array, int value) {
        int left = -1;
        int right = array.length;
        while (right - left > 1) {
            int middle = (right + left) / 2;
            if (array[middle] >= value) {
                right = middle;
            } else {
                left = middle;
            }
        }
        return right;
    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) {
        new Main().run();
    }
}

Measured memory_bytes: 26856
#include <stdio.h>

int main(void){

  int n;
  scanf("%d", &n);
  char s[n+1];
  scanf("%s", s);
  int x = 0;
  int max = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'I') {
      x++;
      if (x > max) {
        max = x;
      }
    } else {
      x--;
    }
  }
  printf("%d\n", max);

  return 0;
}

Measured memory_bytes: 128
let n = stdin.ReadLine() |> int

let rec getLength a =
    if a <= 0 then 0
    else 1 + getLength (a / 10)

let rec getAns n = 
    match getLength n with
    |0 -> 0
    |1 -> n 
    |m when m % 2 = 0 -> getAns ((pown 10 (m - 1)) - 1)
    |m when m % 2 = 1 -> n - pown 10 (m - 1) + 1 + getAns(n / 10)

getAns n |> stdout.WriteLine

Measured memory_bytes: 11220
#include<bits/stdc++.h>
using namespace std;
#define lint long long
#define inf 100000000000000000
#define mod 1000000007
#define MAX 100005
#define pb push_back
#define vit vector<int>::iterator
typedef pair<int,int> pii;
map<int,int>M;
vector<int> V[MAX];
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin>>n;
    if(n>=30) cout<<"Yes";
    else cout<<"No";
    return 0;
}


Measured memory_bytes: 5988
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int w,a,b;
    cin>>w>>a>>b;
    if(b>a && b>a+w )
    {
        cout<<(b-(a+w));

    }
    else if(a>b && a>b+w )
    {
        cout<<(a-(b+w));
    }
    else
    {
        cout<<0<<endl;
    }


}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int D = sc.nextInt();
        int X = sc.nextInt();
        
        int ans = X;
        for (int i = 0; i < N; i++) {
        	int a = sc.nextInt();
        	for (int j = 1; j <= D; j+=a) {
        		ans++;
        	}
        }
        System.out.println(ans);
    }
    
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
using namespace std;
const int MOD = 1000000007;

struct UnionFind {
    //自身が親であれば、その集合に属する頂点数に-1を掛けたもの
    //そうでなければ親のid
    vector<int> r;
 
    UnionFind(int N) {
        r = vector<int>(N, -1);
    }
 
    int root(int x) {
        if (r[x] < 0) return x;
        return r[x] = root(r[x]);
    }
 
    bool unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (r[x] > r[y]) swap(x, y);
        r[x] += r[y];
        r[y] = x;
        return true;
    }
 
    int size(int x) {
        return -r[root(x)];
    }

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

int main() {
    int N, M;
    cin >> N >> M;
 
    //友達集合を作る
    UnionFind UF(N+1);
    for (int i = 0; i < M; i++)
    {
        int A, B;
        cin >> A >> B;
        //A -= 1; B -= 1;
        UF.unite(A, B);
    }
 
    //最大の友達集合を求める
    int ans = 0;
    for (int i = 1; i <= N; i++)
    {
        ans = max(ans, UF.size(i));
    }
 
    cout << ans << endl;
}


Measured memory_bytes: 4048
#include<bits/stdc++.h>   
#include<tr1/unordered_map>
#define ll long long int  
#define mkp make_pair 
#define mod 1000000007 
#define maxn 100001 
#define ff first
#define ss second
using namespace std;    

int main(){    
  ios_base::sync_with_stdio(false); 
  cin.tie(NULL);   
  float d,t,s; 
  cin>>d>>t>>s; 
  if(d/s<=t)  
    cout<<"Yes\n"; 
  else 
   cout<<"No\n";
  
  
  
  return 0;
}

Measured memory_bytes: 3736
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
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; }
typedef long long ll;
int main(void){
    int x,a,b;cin>>x>>a>>b;
    int res=abs(x-a),xb=abs(x-b);
    if(chmin(res,xb))cout<<"B"<<endl;
    else cout<<"A"<<endl;
}

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

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

    vector<string> words;
    for (auto litr = begin(s); litr != end(s); litr++) {
        for (auto ritr = litr + 1; ritr != min(litr + 5, end(s)) + 1; ritr++) {
            words.push_back(string(litr, ritr));
        }
    }

    sort(begin(words), end(words));
    unique(begin(words), end(words));
    words.shrink_to_fit();

    cout << words[k-1] << endl;
}


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

int main(){
  int n;
  cin >> n;
  //1からｎまで２で割って試す２・４・８・１６・３２・６４
  if(n>=64)cout << 64 <<endl;
  else if(n>=32)cout << 32 << endl;
  else if(n>=16)cout << 16 << endl;
  else if(n>=8)cout << 8 << endl;
  else if(n>=4)cout << 4 << endl;
  else if(n>=2)cout << 2 << endl;
  else if(n==1)cout << 1 << endl;
  
  return 0;
  
}


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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using cd = complex<ld>;

const int MOD = 200'003;
const int G = 2;

int add(int a, int b, int mod) {
	return (a + b) % mod;
}

int mult(int a, int b, ll mod) {
	return (ll) a * b % mod;
}

constexpr int LOG = 20;
constexpr int N = 1 << LOG;
const ld PI = acos(-1);

int inv[N + 10];
cd w[N + 10];
cd A[N + 10];
cd B[N + 10];

void precalc() {
	for (int i = 0; i < N; i++) {
		ld ang = 2 * PI * i / N;
		w[i] = cd(cos(ang), sin(ang));
	}

	for (int i = 1; i < N; i++) {
		inv[i] = (inv[i >> 1] >> 1) | ((i & 1) << (LOG - 1));
	}
}

void fft(cd *A, int n) {
	int n_log = __builtin_ctz(n);

	for (int i = 0; i < n; i++) {
		int inv_shift = inv[i] >> (LOG - n_log);

		if (i < inv_shift) {
			swap(A[i], A[inv_shift]);
		}
	}

	for (int lvl = 0; lvl < n_log; lvl++) {
		int len = 1 << lvl;

		for (int i = 0; i < n; i += 2 * len) {
			for (int j = 0; j < len; j++) {
				cd x = A[i + j], y = A[i + j + len] * w[j << (LOG - 1 - lvl)];

				A[i + j] = x + y;
				A[i + j + len] = x - y;
			}
		}
	}
}

void multiply(vector<ll> &a, vector<ll> &b) {
	int len = 1;

	while (len < a.size() + b.size()) {
		len <<= 1;
	}

	a.resize(len, 0);
	b.resize(len, 0);

	for (int i = 0; i < len; i++) {
		A[i] = a[i];
		B[i] = b[i];
	}

	fft(A, len);
	fft(B, len);

	for (int i = 0; i < len; i++) {
		A[i] *= B[i];
	}

	fft(A, len);

	reverse(A + 1, A + len);

	for (int i = 0; i < len; i++) {
		a[i] = round(A[i].real() / len);
	}

	while (a.back() == 0) {
		a.pop_back();
	}
}

int discrete_pow[MOD];
int modPow[MOD * 2];

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

	precalc();
	for (int i = 0, j = 1; i < MOD - 1; i++, j = mult(j, G, MOD)) {
		discrete_pow[j] = i;
	}
	modPow[0] = 1;
	for (int i = 1; i < 2 * MOD; i++) {
		modPow[i] = mult(modPow[i - 1], G, MOD);
	}

	int n;
	cin >> n;
	vector<ll> a(2 * MOD);
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		if (x > 0) {
			a[discrete_pow[x]]++;
		}
	}
	vector<ll> b = a, c = a;
	multiply(a, b);
	for (int i = 0; i < MOD; i++) {
		a[2 * i] -= c[i];
	}
	ll res = 0;
	for (int i = 0; i < 2 * MOD; i++) {
		if (a[i] > 0) {
			res += 1LL * modPow[i] * a[i];
		}
	}
	cout << (res / 2);
	return 0;
}

Measured memory_bytes: 127968
#define  REP(i, s, e) for (register int i = (s), end_##i = (e); i <= end_##i; i++)
#define DREP(i, s, e) for (register int i = (s), end_##i = (e); i >= end_##i; i--)
#define DEBUG fprintf(stderr, "Passing [%s] in Line %d\n", __FUNCTION__, __LINE__)

#define chkmax(a, b) (a < (b) ? a = (b) : a)
#define chkmin(a, b) (a > (b) ? a = (b) : a)

#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <queue>
#include <map>

using namespace std;
const int maxn = 2e5 + 10;

template <typename T> T read()
{
	T ans(0), flag(1);
	char c(getchar());
	while (!isdigit(c))
	{
		if (c == '-') flag = -1;
		c = getchar();
	}
	while (isdigit(c))
	{
		ans = ans * 10 + c - 48;
		c = getchar();
	}
	return ans * flag;
}

void file(string s)
{
	freopen((s + ".in").c_str(), "r", stdin);
	freopen((s + ".out").c_str(), "w", stdout);
}

int n;
int a[maxn], b[maxn];
long long k, ans;

inline bool judge(long long mid)
{
	long long k = ::k;
	REP(i, 1, n) if (1ll * a[i] * b[i] > mid)
	{
		long long dl = 1ll * a[i] * b[i] - mid;
		long long need = max(0ll, dl / b[i] + (dl % b[i] == 0 ? 0 : 1));
		if (k >= need) k -= need;
		else return 0;
	}
	return 1;
}

int main()
{
#ifdef CraZYali
	file("E");
#endif
	cin >> n >> k;
	REP(i, 1, n) a[i] = read<int>();
	REP(i, 1, n) b[i] = read<int>();
	sort(a + 1, a + 1 + n);
	sort(b + 1, b + 1 + n, greater <int> ());
	long long l = 0, r = 1e12;
	while (l <= r)
	{
		long long mid = l + r >> 1;
		if (judge(mid)) r = mid - 1;
		else l = mid + 1;
	}
	cout << r + 1 << endl;
	return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//clock_t start=clock();clock_t end=clock();cout<<(double)(end-start)/CLOCKS_PER_SEC<<endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef pair<pii,pii> P;
typedef tuple<ll,ll,ll> tl;
typedef pair<double,double> pdd;
typedef vector<vector<ll>> mat;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll mod5=1000000009;
ll inf=1LL<<62;
double pi=3.141592653589793238462643383279L;
double eps=1e-14;
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
#define mrep(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define Max(a,b) a=max(a,b)
#define Min(a,b) a=min(a,b)
typedef pair<pii,pii> e;
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
#define umh unordered_map<ll,ll,custom_hash>
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll c=gcd(a,b);
    return a*b/c;
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
    now%=md;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}
ll popcount(ll n){
    ll ret=0;
    ll u=n;
    while(u>0){
        ret+=u%2;
        u/=2;
        
    }
    return ret;
}

int main(){
    ios::sync_with_stdio(false);cin.tie(0);
    double r;cin>>r;
    cout<<2*pi*r<<endl;
}


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

using namespace std;

int main() {
    int N; cin >> N;
    int A[20];
    int sum=0;
    for(int i = 0; i < N; i++) {
        cin >> A[i];
        sum += A[i];
    }
    sort(A,A+N);
    if(sum-2*A[N-1] > 0)
    cout << "Yes" << endl;
    else
    {
      cout << "No" << endl;
    }
     

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
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;
}

using ll = long long;
using ull = unsigned long long;
const int INF = 2100100100;
//const int MOD = 1e9 + 7;

ll N, M, K, Q;
string S;

int main() {
    cin >> S;

    if (S[2] == S[3] && S[4] == S[5]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


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

using namespace std;

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

  int cnt[100000] = {};
  for (int i = 0; i < n; i++) {
    int l, r;
    cin >> l >> r;
    cnt[l - 1]++;
    cnt[r]--;
  }

  for (int i = 1; i < 100000; i++) {
    cnt[i] += cnt[i - 1];
  }

  int ans = 0;
  for (int i = 0; i < 100000; i++) {
    ans += cnt[i];
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF (1ll<<60)
typedef long long ll;
using namespace std;

string s;
vector<string> v;

int main(){
    cin >> s;

    for (int i = 0; i < (1<<4); i++){
        string a;
        if ((i << 0) & 1){
            a += 'A';
        }
        a += "KIH";
        if ((i >> 1) & 1){
            a += "A";
        } 
        a += "B";
        if ((i >> 2) & 1){
            a += "A";
        }
        a+= "R";
        if ((i >> 3) & 1){
            a += "A";
        }
        v.push_back(a);
    } 

    bool flag = false;
    for (int i = 0; i < v.size(); i++){
        if (v[i] == s) flag = true;
        //cout << v[i] << endl; 
    }

    if (flag){
        cout <<"YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
n = int(input())

p = [0]*1000001
for i in range(2,n):
    if(p[i] == 0):
        for j in range(i,1000001,i):
            p[j] = 1

result = 0
for i in range(n,1000001):
    if(p[i] == 0):
        result = i
        break

print(result)

Measured memory_bytes: 10868
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,d,p,x,y;
  cin>>a>>b>>c>>d>>p;
  x=a*p;
  y=b;
  if(p>c)y+=(p-c)*d;
  cout<<min(x,y)<<endl;
}

Measured memory_bytes: 3088
n = int(input().strip())
s = [int(input()) for _ in range(n)]
s.sort()
su = sum(s)
if su % 10 == 0:
    for elem in s:
        if (su - elem) % 10 != 0:
            print(su - elem)
            exit()
    print(0)
else:
    print(su)


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

public class Main {

	void solve() {
		String s = "A" + in.nextToken() + "A";
		StringBuilder wox = new StringBuilder();
		for (int i = 0; i < s.length(); i++) {
			if (s.charAt(i) != 'x') {
				wox.append(s.charAt(i));
			}
		}

		if (!wox.toString().equals(wox.reverse().toString())) {
			out.println(-1);
			return;
		}
		List<Integer> cnt = new ArrayList<>();
		for (int i = 1; i < s.length();) {
			int j = i;
			while (s.charAt(j) == 'x') {
				j++;
			}
			cnt.add(j - i);
			i = j + 1;
		}
		int result = 0;
		for (int i = 0; i < cnt.size() / 2; i++) {
			result += Math.abs(cnt.get(i) - cnt.get(cnt.size() - i - 1));
		}
		out.println(result);
	}

	FastScanner in;
	PrintWriter out;

	void run() {
		in = new FastScanner();
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		public FastScanner(String s) {
			try {
				br = new BufferedReader(new FileReader(s));
			} catch (FileNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}

		public String nextToken() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
				}
			}
			return st.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextToken());
		}

		public long nextLong() {
			return Long.parseLong(nextToken());
		}

		public double nextDouble() {
			return Double.parseDouble(nextToken());
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}
}


Measured memory_bytes: 27344
#include <iostream>
using namespace std;
int main(void){
    int a,b;
    int temp;
    while(1){
        cin>>a;
        cin>>b;
        
        if(a==0&&b==0)break;
        
        if(a>b){
            temp=a;
            a=b;
            b=temp;
        }
        cout<<a<<" "<<b<<endl;
    }
    
    return 0;
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define f(a, b) for (ll i = a; i <= b; i++)
#define pb push_back
#define pf push_front
#define mp make_pair
using namespace std;
#define N 200005
const ll INF = 1000000001;
const ll MOD = 1000000007;

vector< vector<ll> > g(N);
//vector< pair<ll, pair< ll, ll > > > g(N);
ll vis[N] = {0}, par[N] = {0}, child[N] = {0},cnt = 0;
map< pair<ll, ll> , ll> ump;

void dfs(ll v){
    vis[v] = 1;
    cnt++;
    for(auto u: g[v]) if(!vis[u]) dfs(u);
}

void solve(){
    ll h, w;
    cin >>h >> w;
    char a[h][w];
    ll dp[h+1][w+1] = {0};
    for(ll i=0; i<h;i ++){
        for(ll j=0 ; j<w; j++) {
            cin >> a[i][j];
            if(a[i][j] == '#') dp[i+1][j+1] = -1;
        }
    }
    for(ll i=0 ;i<=h ;i++){
        dp[i][0] = 0;
    }
    for(ll i=0 ; i<=w; i++){
        dp[0][i] = 0;
    }
    for(ll i=1 ;i<= h; i++){
        for(ll j =1; j<=w; j++){
            if(i == 1 and j==1) dp[i][j] = 1; 
            else if(dp[i][j] == -1) continue;
            else {
                if(dp[i-1][j] == -1 and dp[i][j-1] == -1) dp[i][j] = 0;
                else if(dp[i-1][j] == -1) dp[i][j] = dp[i][j-1];
                else if(dp[i][j-1] == -1) dp[i][j] = dp[i-1][j];
                else 
                    dp[i][j] = (dp[i-1][j] + dp[i][j-1]) % MOD;;
            }
        }
    }
    
    cout << dp[h][w] % MOD << "\n";

}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("out.txt","w",stdout);
    #endif
    //ll t;cin >> t;for(ll index=1; index<=t; index++){
        //cout << "Case #" << index << ": " ;
        solve();
    //}
    return 0;
}


Measured memory_bytes: 16600
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
#include<limits.h>

using namespace std;
int partition(int A[], int p, int r){
    int x = A[r];
    int i = p-1;
    for(int j=p; j<r; j++){
        if(A[j] <= x){
            i++;  
            std::swap(A[i], A[j]);
        }
    }
    std::swap(A[i+1], A[r]);
    return i+1;
}

int main(){
    int n;
    cin >> n;
    int *A = new int[n];
    for(int i=0; i<n; i++){
        cin >> A[i];
    }
    int k = partition(A, 0, n-1);
    for(int i=0; i<n; i++){
        if(i != 0) cout << " ";
        if(i == k){
            cout << "[" << A[i] << "]";
            continue;
        }
        cout << A[i];
    }
    cout << endl;
}


Measured memory_bytes: 3448
use std::io;

fn main() {
    let mut buf: String = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    let n = buf.trim().parse::<usize>().unwrap();
    let mut buf: String = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    let mut a = buf.trim().split_whitespace().map(|s| s.parse::<i64>().unwrap())
        .collect::<Vec<i64>>();
    a.sort_by(|x, y| y.cmp(x));
    let mut alice = 0;
    let mut bob = 0;
    for i in 0..n {
        if i % 2 == 0 {
            alice += a[i];
        } else {
            bob += a[i];
        }
    }
    println!("{}", alice - bob);
}


Measured memory_bytes: 4352