akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rep1(i, n) for(int i=1; i<=n; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define repr1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
const double PI = acos(-1);
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; }


int main() {
    int n, k; cin >> n >> k;
    vector<pll> v(n);
    rep(i, n) cin >> v[i].first >> v[i].second;

    vector<ll> xs, ys;
    rep(i, n) {
        xs.push_back(v[i].first);
        ys.push_back(v[i].second);
    }

    sort(all(xs)); sort(all(ys));

    ll ans = (xs[n-1] - xs[0]) * (ys[n-1] - ys[0]);
    for (int yi = 0; yi < n; yi++) {
        for (int yj = yi+1; yj < n; yj++) {
            for (int xi = 0; xi < n; xi++) {
                for (int xj = xi+1; xj < n; xj++) {
                    int cnt = 0;
                    rep(i, n) {
                        ll x = v[i].first;
                        ll y = v[i].second;
                        if (xs[xi] <= x && x <= xs[xj] &&
                                ys[yi] <= y && y <= ys[yj]) {
                            cnt++;
                        }
                    }

                    if (cnt >= k) {
                        ll tmp = (xs[xj] - xs[xi]) * (ys[yj] - ys[yi]);
                        chmin(ans, tmp);
                    }
                }
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define PI acos(-1.0)
#define pb push_back
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N=1e5+5;
const int MOD=1e9+7;
template <class T>
bool sf(T &ret){ //Faster Input

    char c; int sgn; T bit=0.1;
    if(c=getchar(),c==EOF) return 0;
    while(c!='-'&&c!='.'&&(c<'0'||c>'9')) c=getchar();
    sgn=(c=='-')?-1:1;
    ret=(c=='-')?0:(c-'0');
    while(c=getchar(),c>='0'&&c<='9') ret=ret*10+(c-'0');
    if(c==' '||c=='\n'){ ret*=sgn; return 1; }
    while(c=getchar(),c>='0'&&c<='9') ret+=(c-'0')*bit,bit/=10;
    ret*=sgn;
    return 1;
}

ll a[4];
int main(void){

    string s1,s2;
    cin >>s1>>s2;
    s1+=s1;
//    cout <<s1.substr(1,2) << endl;
    for(int i=0;i<(int)s2.size();i++){
//        cout << s1.substr(i,(int)s2.size())<<endl;
        if(s1.substr(i,(int)s2.size())==s2){
            cout <<"Yes"<<endl;
            return 0;
        }
    }
    printf("No\n");
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
long long f(long long X){
    if(X%2){
        if (X%4 == 1)
            return 1;
        return 0;
    }else{
        if (((X-1)%4) == 1)
            return 1 ^ X;
        return 0 ^ X;
    }
}
int main(void){
    long long a, b;
    scanf("%lld %lld", &a, &b);
    printf("%lld\n", f(a-1) ^ f(b));
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<map>
#include<queue>
#include<cmath>
#include<stack>
#include<vector>
#include<cstdio>
#define MAXN 33000
#define INF 0x3f3f3f3f
#define lmid l,m,rt<<1
#define rmid m+1,r,rt<<1|1
#define ls rt<<1
#define rs rt<<1|1
#define Mod 1000000007
#define i64 __int64
#define LIMIT_ULL 100000000000000000
#define LL long long
using namespace std;
int main()
{
     int a,b,c,d;
     scanf("%d%d%d%d",&a,&b,&c,&d);
     int vis[105];
     memset(vis,0,sizeof(vis));
     for(int i=a;i<=b;i++)
     {
          vis[i]++;
     }
     for(int i=c;i<=d;i++)
     {
          vis[i]++;
     }
     int sum=0;
     for(int i=0;i<=100;i++)
     {
          if(vis[i]==2)
          {
               //cout<<i<<endl;
               sum++;
          }
     }
     if(sum>0)
          sum--;
     cout<<sum<<endl;
}


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

using namespace std;

int minCost(int a[], int n){
  	if(n==0 || n==1) 
      return 0;
  	if(n==2)
      return abs(a[1]-a[0]);
	int dp[n];
  	dp[0]=0;
  	for(int i=1;i<n;i++)
      dp[i]=INT_MAX;
  	for(int i=0;i<n;i++){
    	for(int j=i+1;j<=i+2;j++){
        	dp[j]=min(dp[j],dp[i]+abs(a[j]-a[i]));
        }
    }
  	return dp[n-1];
}

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

Measured memory_bytes: 4332
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

a, b = rm()
c = b - a
c = c*(c+1)//2
print(c-b)







Measured memory_bytes: 26988
#include <bits/stdc++.h>
using namespace std;
 
int main(){
	int N;
  cin >> N;
  N = N %10;
  string hon;
  
  if(N==2 ||N==4 ||N==5||N==7||N==9)
    hon = "hon";
  else if(N==3)
    hon = "bon";
  else
    hon = "pon";
  
  cout << hon << endl;
  return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
 
#define rep(i, s, n) for(int i = s; i < n; ++i)
#define rrep(i, n) for(int i = n - 1; i > -1; --i)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;
const long long INF = 1000000000;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<int, int> P;
 
int main(){
    int n;
    cin >> n;
    vector<P> a(n);
    int tmp;
    rep(i, 0, n){
        cin >> tmp;
        a[i] = make_pair(tmp, i + 1);
    }
    sort(all(a));
    cout << a[0].second;
    rep(i, 1, n){
        cout << ' ' << a[i].second;
    }
    
}

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

int main(){
    int N, X, Y;
    cin >> N >> X >> Y;
    vector<int> k(N-1);
    for(int i=0; i<(N-1); i++) k.at(i) = 0;
    int min_distance;
    for(int i=1; i<N; i++){
        for(int j=i+1; j<=N; j++){
            min_distance = j - i;
            if(i<=X){
                if(Y<=j){
                    min_distance = (X-i) + (j-Y) + 1;
                }
                else{
                    if(X < j && (j-X) > (Y-j+1)) min_distance = (X-i) + (Y-j+1);
                }
            }
            else{
                if(Y<=j){
                    if(i < Y && (Y-i) > (i-X+1)) min_distance = (j-Y) + (i-X+1);
                }
                else{
                    if(min_distance > (i-X) + (Y-j) + 1) min_distance = (i-X) + (Y-j) + 1;
                }
            }
            k.at(min_distance - 1) ++;
        }
    }
    for(int i=0; i<(N-1); i++) cout << k.at(i) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define int long long
 
#define pii pair<int, int>
 
#define x1 x1228
#define y1 y1228
 
#define left left228
#define right right228
 
#define pb push_back
#define eb emplace_back
 
#define mp make_pair                                                                
                                                                                                                                        
#define ff first                                                                  
#define ss second   
 
#define matr vector<vector<int> > 
 
#define all(x) x.begin(), x.end()
 
 
using namespace std;
typedef long long ll; 
typedef long double ld; 
                                                                                                   
const int maxn = 1000 + 7, mod = 1e9 + 9, inf = 1e9, MAXN = 1e6 + 7;
const double eps = 1e-9;                                                        
mt19937 rnd(time(0));
int n; 
int used[maxn][maxn]; 
vector<int> ord[maxn]; 

void solve() { 
    cin >> n; 
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n - 1; ++j) {
            int a; cin >> a, --a; 
            ord[i].pb(a); 
        }
        reverse(all(ord[i])); 
    }
    vector<pii> change;  
    for (int i = 0; i < n; ++i) {
        change.eb(i, ord[i].back()); 
    }
    int ans = 0; 
    while (change.size()) {
        vector<pii> change1; 
        for (auto v : change) {
            used[v.ff][v.ss] = 1;
            if (used[v.ss][v.ff]) {
                ord[v.ff].pop_back();
                ord[v.ss].pop_back();
                if (ord[v.ff].size())                               
                    change1.eb(v.ff, ord[v.ff].back()); 
                if (ord[v.ss].size())  
                    change1.eb(v.ss, ord[v.ss].back()); 
            }
        }
        swap(change, change1); 
        ++ans; 
    }
    for (int i = 0; i < n; ++i) {
        if (ord[i].size()) {
            cout << -1; 
            return; 
        }
    }
    cout << ans; 
}                                
   
signed main() {
#ifdef LOCAL
    freopen("TASK.in", "r", stdin);
    freopen("TASK.out", "w", stdout);
#else 
    
#endif // LOCAL
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(20); 
    cout << fixed; 
    int t = 1; 
    for (int i = 0; i < t; ++i) {              
        solve();
    }
    return 0;
}  

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

const int N = 100010;

int n, k;
int f[N][3], a[N][3];

int main() {
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i) scanf("%d%d%d", &a[i][0], &a[i][1], &a[i][2]);
	for(int i = 1; i <= n; ++i) {
		for(int j = 0; j < 3; ++j) {
			for(int k = 0; k < 3; ++k) {
				if(j == k) continue;
				f[i][j] = max(f[i][j], f[i - 1][k] + a[i][j]);
			}
		}
	}
	printf("%d\n", max(max(f[n][0], f[n][1]), f[n][2]));
}

Measured memory_bytes: 2560
#include <array>
#include <cmath>
#include <cstdio>
int d, g;
std::array<int, 11> p;
std::array<int, 11> c;

int sum = 0;
int ans = 1000000;

int po[11];

signed main()
{
    po[0] = 1;
    for (int i = 1; i < 11; i++) {
        po[i] = po[i - 1] * 2;
    }
    scanf("%d", &d);
    scanf("%d", &g);
    for (int i = 0; i < d; i++) {
        scanf("%d", &p.at(i));
        scanf("%d", &c.at(i));
    }
    int tmp;
    for (int i = 0; i < po[d]; i++) {
        int tmp_ans = 0;
        sum = 0;
        bool use = false;
        int max_num = 0;
        for (int j = 0; j < d; j++) {
            use = ((i / po[j]) % 2 == 1 ? true : false);
            if (use) {
                sum += p.at(j) * (j + 1) * 100 + c.at(j);
                tmp_ans += p.at(j);
            } else {
                max_num = j;
            }
        }
        if (g - sum > 0) {
            tmp = ((g - sum - 1) / ((max_num + 1) * 100)) + 1;
            tmp_ans += tmp;
            if (tmp > p.at(max_num)) {
                continue;
            }
        }
        ans = (ans < tmp_ans ? ans : tmp_ans);
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    string S;
    cin>>S;
    if(S[0]==S[1]){
        if(S[2]==S[3]&&!(S[2]==S[0])){
            cout<<"Yes";
        }else{
            cout<<"No";
        }
    }else if(S[0]==S[2]){
        if(S[1]==S[3]&&!(S[1]==S[0])){
            cout<<"Yes";
        }else{
            cout<<"No";
        }
    }else if(S[0]==S[3]){
        if(S[1]==S[2]&&!(S[2]==S[0])){
            cout<<"Yes";
        }else{
            cout<<"No";
        }
    }else{
        cout<<"No";
    }
    
}

Measured memory_bytes: 256
from collections import Counter
def inpl(): return list(map(int, input().split()))
N, x = inpl()
A = inpl()
B = [a for a in A]

ans = 1e15
for i in range(N+1):
    for j in range(N):
        B[j] = min(B[j], A[(j-i)%N])
    tmp = x*i + sum(B)
    ans = min(ans, tmp)
print(ans)


Measured memory_bytes: 42732
package main

import (
	"sort"
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string { sc.Scan(); return sc.Text() }
func scanInt() int { a,_ := strconv.Atoi(scanString()); return a }
func scanInt64() int64 { a,_ := strconv.ParseInt(scanString(),10,64); return a }
func scanFloat64() float64 { a,_ := strconv.ParseFloat(scanString(),64); return a }

func scanInts(n int) []int {
	res := make([]int, n); for i := 0; i < n; i++ { res[i] = scanInt() }; return res
}

func abs(a int) int { if a<0 { return -a }; return a }
func min(a,b int) int { if a<b { return a }; return b }
func max(a,b int) int { if a>b { return a }; return b }

//•*¨*•.¸¸♪Main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)

func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n := scanInt()
	a := scanInts(n)
	b := scanInts(n)
	c := scanInts(n)

	sort.Ints(a)
	sort.Ints(b)
	sort.Ints(c)

	ans := scanInt()

	for i := 0; i < n; i++ {
		d := sort.SearchInts(a, b[i])
		e := sort.SearchInts(c, b[i]+1)
		ans += d*(n-e)
	}

	fmt.Fprintln(wr, ans)
}


Measured memory_bytes: 5504
#include<iostream>
#include<vector>
#include<sstream>
#include<string>
#include<numeric>
#include <algorithm>
#include<math.h>
#include<cstdio>
#include<string.h>




using namespace std;
typedef long long ll;
struct point{
  int x;
  int y;

};
int gcd(int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	// ユークリッドの方法
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}//gcd
int lcm( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}//lcm
int input(){
  int x;
  cin>>x;
  return x;
}

int moji(char in)
{
    int ans = (int)in-(int)'a';
    if((ans < 0) || (ans > 25)){
        ans = 26;
    }
    return ans;
}
const int VV=10;//場合に応じてVVの値のみ変更する必要あり
//dijkstra(s)sがスタート地点でそこからの最短距離を配列dで表す。正の重みのみ使用可能
int cost[VV][VV];
int d[VV];
bool used[VV];
void dijkstra(int s){
  fill(d,d+VV,100000);
  fill(used,used+VV,false);
  d[s]=0;
  while(true){
    int v=-1;
    for(int u=0;u<VV;u++){
      if(!used[u]&&(v==-1||d[u]<d[v]))v=u;
    }
    if(v==-1)break;
    used[v]=true;
    for(int u=0;u<VV;u++){
      d[u]=min(d[u],d[v]+cost[v][u]);
    }
  }

}

int compare_int(const void *a, const void *b)//qsort(quick sort利用時に使用)
{
    return *(int*)a - *(int*)b;
}

int binary_searchh(long long x,long long k[],int n){
  int l=0;
  int r=n;
  while(r-l>=1){
    int i=(l+r)/2;
    if(k[i]==x)return i;
    else if(k[i]<x)l=i+1;
    else r=i;
  }
  return -1;
}




int main(){
  int N,K;
  cin>>N>>K;
  if(N%K==0){
  cout<<0<<endl;
  }else{
    cout<<1<<endl;
  }






  

  



}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define f(i,n) for(int i=0;i<(n);i++)
#define P pair<int,int>
#define mod 1000000007
#define S second
#define F first
#define int long long
using namespace std;
signed main(){
	int a;
	cin>>a;
	cout<<"Christmas";
	for(int i=25;i>a;i--){
		cout<<" Eve";
	}
	cout<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#define min(a,b) ((a)<(b)?(a):(b))
#define ll long long
using namespace std;
ll a[1000],b[1005],s[1005];

int main(){
	int n,k;
	scanf("%d%d",&n,&k);
	ll S=0,ans=1;
	for (int i=1;i<=n;i++){
		scanf("%lld",&a[i]);
		S+=a[i];
	}
	for (ll i=1;i*i<=S;i++)
	if (S%i==0){
		ll need=-1;
		for (int j=1;j<=n;j++)
		b[j]=a[j]%i;
		sort(b+1,b+1+n);
		for (int j=1;j<=n;j++)
		s[j]=s[j-1]+b[j];
		if (s[n]==0) need=0;
		for (int j=1;j<=n;j++)
		if ((n-j)*i-(s[n]-s[j])==s[j]) {
			need=s[j];
			break;
		}
		if (need>=0&&need<=k&&i>ans) ans=i;
		need=-1;
		for (int j=1;j<=n;j++)
		b[j]=a[j]%(S/i);
		sort(b+1,b+1+n);
		for (int j=1;j<=n;j++)
		s[j]=s[j-1]+b[j];
		if (s[n]==0) need=0;
		for (int j=1;j<=n;j++)
		if ((n-j)*(S/i)-(s[n]-s[j])==s[j]) {
			need=s[j];
			break;
		}
		if (need>=0&&need<=k&&S/i>ans) ans=S/i;
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 128
#include<cstdio>
#include<iostream>
#include<cstring>
#define RG register
#define LL long long
using namespace std;
int n;
LL a,m,num,maxx,minn;
template<typename I> inline void read(I &ot){
	I ch=getchar(), x=0, f=1;
	while(ch<'0' || ch>'9'){if(ch=='-') f=-1; ch=getchar();	}
	while(ch>='0' && ch<='9'){x=x*10+ch-'0'; ch=getchar();	}
	ot=x*f;}
template<typename I, typename... U> inline void read(I &x,U&... y){read(x); read(y...);}
template<typename I>inline I mi(const I&a,const I&b){return a<b ? a : b;}
template<typename I>inline I mx(const I&a,const I&b){return a>b ? a : b;}
int main()
{
	//freopen("An Invisible Hand.in","r",stdin);
	read(n,m); m/=2; minn=3e18;
	for(RG int i=1;i<=n;i++)
	{
		read(a); minn=mi(minn,a);
		if((a-minn)*m>maxx) maxx=(a-minn)*m, num=1;
		else if((a-minn)*m==maxx) num++;
	}
	printf("%lld\n",num);
	return 0;
}

Measured memory_bytes: 764
/*************************************************************************
	> File Name: A.cpp
	> Author: Knowledge_llz
	> Mail: 925538513@qq.com 
	> Created Time: 2020/4/4 20:46:48
 ************************************************************************/

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<algorithm>
#define For(i,a,b) for(register int i=(a);i<=(b);++i)
#define LL long long
using namespace std;
int read(){
	char x=getchar(); int u=0,fg=0;
	while(!isdigit(x)){ if(x=='-') fg=1; x=getchar(); }
	while(isdigit(x)){ u=(u<<3)+(u<<1)+(x^48); x=getchar(); }
	return fg?-u:u;
}
bool pd(int x){
	int pre=x%10;
	x/=10;
	while(x){
		if(abs(x%10-pre)>1)
			return false;
		pre=x%10;
		x/=10;
	}
	return true;
}
LL q[100010],tmp[100010];
int k,f=0,l=0,a=0;
int main()
{

//	For(i,1,10000000)
//		if(pd(i))
//			tmp[++a]=i;

	int k=read();
	if(k<10){
		printf("%d\n",k);
		return 0;
	}
	For(i,1,9) q[++l]=i;
	For(i,1,k){
		++f;
		if(f==k) cout<<q[k]<<endl;	
		if(l>k+5) continue;
		if(q[f]%10){
			q[++l]=q[f]*10+q[f]%10-1;
			q[++l]=q[l-1]+1;
			if(q[f]%10!=9) q[++l]=q[l-1]+1;
		}
		else{
			q[++l]=q[f]*10+q[f]%10;
			q[++l]=q[l-1]+1;
		}
	}
	
	return 0;
}


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

using ll = long long;
using ull = unsigned long long;

#define MOD 1000000007

int main(void) {
    ll N;
    ll count = 1;
    cin >> N;
    for(ll i = 1;i <= N;i++) {
        count *= i;
        count %= MOD;
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
set<int> sq;
int main(){
	int n;
	scanf("%d",&n);
	getchar();
	int x;
	set<int>::iterator it;
	for(int i=0;i<n;i++){
		scanf("%d",&x);
		getchar();
		it=sq.find(x);
		if(it!=sq.end()){
			sq.erase(it);
		} else {
			sq.insert(x);
		}
	}
	cout<<sq.size()<<endl;
	
}

Measured memory_bytes: 4864
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし


K = I()
a = K//2
b = K-a
print(a*b)


Measured memory_bytes: 61912
n = int(input())
cost = [int(i) for i in input().split()]

dp = [0]*n
dp[1] = abs(cost[1] - cost[0])

for i in range(2, n):
  be1 = abs(cost[i]-cost[i-1])
  be2 = abs(cost[i]-cost[i-2])
  dp[i] = min(dp[i-1]+be1, dp[i-2]+be2)
  
print(dp[-1])

Measured memory_bytes: 13928
#include<cstdio>
using namespace std;
int h,w,d;
char c[2][2]={{'R','Y'},{'G','B'}};

int main(void){
	register int i,j,x,y;
	scanf("%d%d%d",&h,&w,&d);
	for(i=1;i<=h;++i,putchar('\n'))
		for(j=1;j<=w;++j){
			x=i+j+1001,y=i-j+1001;
			x/=d,y/=d,x&=1,y&=1;
			printf("%c",c[x][y]);
		}
	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i=0; i<(n); i++)//第一引数の変数をカウンタ変数としてn回回す
//repはカウンタ変数が1ずつ増える場合にしか使えない
using veci = vector<int>;
using vecd = vector<double>;
using vecs = vector<string>;
int main(){//受け取った文字列の集合を辞書順最小となるようにソートしたうえで貪欲に前からつなげる)
  int n, l;
  cin >> n >> l;
  vecs s(n);
  rep(i, n){
    cin >> s.at(i);
  }
  sort(s.begin(), s.end());
  string ans = "";
  rep(i, n){
    ans += s.at(i);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
//file_name:ABC92_C.cpp
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;

    // int scan
    /*
    int x;
    scanf("%d",&x);
    int y;
    scanf("%d",&y);
    int z;
    scanf("%d",&z);

    // matrix scan
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // string scan
    /*
    string s;
    cin >> s;
    */


int main() {
    int n;
    scanf("%d",&n);
    ll a[n+2] = {};
    srep(i,1,n+1){
        scanf("%lld",&a[i]);
    }
    ll ans = 0;
    rep(i,n+1){
        ans += abs(a[i+1] - a[i]);
    }


    srep(i,1,n+1){
        ll ans2 = ans;
        ans2 += abs(a[i+1] - a[i-1]);
        ans2 -= abs(a[i-1] - a[i]);
        ans2 -= abs(a[i+1] - a[i]);

        cout << ans2 << endl;
    }  
    return 0;
}



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

int main(){
  int w,h,n,i,j,k;
  cin >> w >> h >> n;
  vector<int> x(n),y(n),a(n);
  for(i=0;i<n;++i){
    cin >> x[i] >> y[i] >> a[i];
  }
  vector<vector<int>> dt(w,vector<int>(h));
  for(i=0;i<w;i++){
    for(j=0;j<h;++j){
      dt[i][j]=0;
    }
  }
  for(i=0;i<n;++i){
    if(a[i]==1){
      for(j=0;j<x[i];++j){
        for(k=0;k<h;++k){
          dt[j][k]=1;
        }
      }
    }else if(a[i]==2){
      for(j=x[i];j<w;++j){
        for(k=0;k<h;++k){
          dt[j][k]=1;
        }
      }
    }else if(a[i]==3){
      for(j=0;j<w;++j){
        for(k=0;k<y[i];++k){
          dt[j][k]=1;
        }
      }
    }else if(a[i]==4){
      for(j=0;j<w;++j){
        for(k=y[i];k<h;++k){
          dt[j][k]=1;
        }
      }
    }
  }
  int ans=0;
  for(i=0;i<w;++i){
    for(j=0;j<h;++j){
      if(dt[i][j]==0){
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}


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

void _149() {
    string s, t;
    cin >> s >> t;
    cout << t + s << endl;
}

void _148() {
    int a, b;
    cin >> a;
    cin >> b;

    int c = 0;
    if ((a != 1) && (b != 1))
        c = 1;
    else if ((a != 2) && (b != 2))
        c = 2;
    else if ((a != 3) && (b != 3))
        c = 3;
    cout << c << endl;
}

void _147() {
    int a, b, c;
    cin >> a >> b >> c;

    if (a + b + c >= 22)
        cout << "bust" << endl;
    else
        cout << "win" << endl;
}

void _146() {
    string s;
    cin >> s;

    vector<string> list = {"SAT", "FRI", "THU", "WED", "TUE", "MON", "SUN"};
    for (int i = 0; i < list.size(); ++i) {
        if (s == list[i])
            cout << i + 1 << endl;
    }
}

void _145() {
    int r;
    cin >> r;
    cout << pow(r, 2) << endl;
}

void _144() {
    int a, b;
    cin >> a >> b;

    if ((a >= 1 && a <= 9) && (b >= 1 && b <= 9))
        cout << a * b << endl;
    else
        cout << -1 << endl;
}

void _143() {
    int a, b;
    cin >> a >> b;

    if (b * 2 >= a)
        cout << 0 << endl;
    else
        cout << a - 2 * b << endl;
}

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

    if (n % 2 == 0)
        cout << 1 / 2.0 << endl;
    else
        cout << (n / 2 + 1) / (float)n << endl;
}

void _141() {
    string s;
    cin >> s;

    string w;
    if (s == "Sunny")
        w = "Cloudy";
    else if (s == "Cloudy")
        w = "Rainy";
    else
        w = "Sunny";
    cout << w << endl;
}

void _140() {
    int n;
    cin >> n;
    cout << pow(n, 3);
}

int main()
{
    _140();
    return 0;
}



Measured memory_bytes: 384
N,L = map(int,input().split())

all = 0
tmp = 0
for x in range(N):
	all += (x+L)
#print(all)
for i in range (1,N+1):
	tmp = all-(i+L-1)
	tmp_2 = tmp*tmp
	if i == 1:
		ans = tmp
	elif tmp == all:
		ans = tmp
		break
	else:
		if ans*ans < tmp_2:
			ans = tmp
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
using namespace std;
typedef tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update> oset;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
using ll = long long;

void test_case(){
	int s , w; cin >> s >> w;
	if(w >= s)
		cout<<"unsafe\n";
	else
		cout<<"safe\n";
}
 
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int T=1;
	//~ cin >> T;
	while(T--){
		test_case();
	}
	return 0;
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N,V;
int X[202020],id[202020];
pair<ll,int> P[202020];
int ret[202020],imos[202020];

int ML;
int L[202020][20],R[202020][20];
int Ldp[1<<20];
int Rdp[1<<20];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>V;
	FOR(i,N) cin>>x, P[i]={x,i};
	sort(P,P+N);
	FOR(i,N) id[P[i].second]=i, X[i]=P[i].first;
	
	while(1<<ML <= V) ML++;
	ML++;
	
	FOR(i,20) {
		FOR(x,N) {
			if(x && X[x]-X[x-1]<=V>>i) L[x][i]=L[x-1][i];
			else L[x][i]=x;
		}
		for(x=N-1;x>=0;x--) {
			if(x<N-1 && X[x+1]-X[x]<=V>>i) R[x][i]=R[x+1][i];
			else R[x][i]=x;
		}
	}
	
	MINUS(Ldp);
	FOR(i,1<<ML) Ldp[i]=-2,Rdp[i]=N+1;
	Ldp[0]=-1;
	Rdp[0]=N;
	
	for(int mask=0;mask<1<<ML;mask++) {
		FOR(i,ML) if((mask & (1<<i))==0) {
			if(Ldp[mask]==N-1) Ldp[mask | (1<<i)] = N-1;
			else if(Ldp[mask]>=-1) Ldp[mask | (1<<i)] = max(Ldp[mask | (1<<i)], R[Ldp[mask]+1][i]);
			if(Rdp[mask]==0) Rdp[mask | (1<<i)] = 0;
			else if(Rdp[mask]<=N) Rdp[mask | (1<<i)] = min(Rdp[mask | (1<<i)], L[Rdp[mask]-1][i]);
		}
	}
	
	for(int mask=0;mask<1<<ML;mask+=2) {
		int mask2=((1<<ML)-2)^mask;
		//_P("%x %x : %d %d\n",mask,mask2,Ldp[mask],Rdp[mask2]);
		if(Ldp[mask]+1>=Rdp[mask2]) {
			FOR(i,N) ret[i]=1;
			break;
		}
		if(R[Ldp[mask]+1][0]+1>=Rdp[mask2]) {
			imos[Ldp[mask]+1]++;
			imos[R[Ldp[mask]+1][0]+1]--;
		}
	}
	
	FOR(i,N) {
		imos[i+1]+=imos[i];
		ret[i] |= imos[i];
		if(ret[id[i]]) cout<<"Possible"<<endl;
		else cout<<"Impossible"<<endl;
	}
	
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


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

using namespace std;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define eps 1e-9

const int MOD = 1e9+7;

typedef long long ll;
typedef pair<int,int> pii;

ll POWER[65];
ll power(ll a, ll b) {ll ret=1;while(b) {if(b&1) ret*=a;a*=a;if(ret>=MOD) ret%=MOD;if(a>=MOD) a%=MOD;b>>=1;}return ret;}
ll inv(ll x) {return power(x,MOD-2);}

void precompute() {
	POWER[0]=1;
	for(int i=1;i<63;i++) POWER[i]=POWER[i-1]<<1LL;
}

int main() {
//	freopen("TASK.in","r",stdin);	
//	freopen("TASK.out","w",stdout);
//	precompute();
	int a,b;
	cin>>a>>b;
	if(a<=0 and b>=0) cout<<"Zero"<<endl;
	else {
		if(a>0) cout<<"Positive"<<endl;
		else {
			int n=b-a+1;
			if(n%2==0) cout<<"Positive"<<endl;
			else cout<<"Negative"<<endl;
		}
	}
	return 0;
}


Measured memory_bytes: 764
#include <stdio.h>
#define N 100000
#define Q 50000

int main()
{
  int S[N], T[Q], i, j, n, q, count=0, left, right, mid;

  scanf("%d", &n);
  for( i = 0 ; i < n ; i++){
    scanf("%d", &S[i]);
  }
  scanf("%d", &q);
  for( j = 0 ; j < q ; j++){
    scanf("%d", &T[j]);
  }
  
  for( i = 0 ; i < q ; i++){
    left = 0;
    right = n;
    while(left < right){
      mid = (left + right)/2;
      if(T[i] == S[mid]){
	count++;
	break;
      }
      if(T[i] > S[mid]){
	left = mid + 1;
      }
      else if(T[i] < S[mid]){
	right = mid;
      }
    }
  }

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

Measured memory_bytes: 1184
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,i,t,ans,p;
    string s;
    cin>>s;
    if((s[1]=='S'))
    {
        if(s[0]=='R'||s[2]=='R')
            cout<<1<<endl;
        if((s[0]=='S')&&(s[2]=='S'))
            cout<<0<<endl;
    }
     if((s[1]=='R'))
    {
        if(s[0]=='S'&&s[2]=='S')
            cout<<1<<endl;
        if((s[0]=='R')&&(s[2]=='R'))
            cout<<3<<endl;
            if(s[0]=='R'&&s[2]=='S'||(s[0]=='S'&&s[2]=='R'))
                cout<<2<<endl;
    }
}


Measured memory_bytes: 3568
#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios::sync_with_stdio(0);cin.tie(0);
	long long n,q,s=0;
	cin>>n;
	int a[n];map<long long,long long>m;
	for(int i=0;i<n;i++)
		{
			cin>>a[i];
			s+=a[i];
			++m[a[i]];
		}
	int Q;cin>>Q;
	while(Q--)
	{
		int x,y;
		cin>>x>>y;
		s-=(x*m[x]);
		s+=(y*m[x]);
		m[y]+=m[x];
		m[x]=0;
		cout<<s<<endl;
	}
}

Measured memory_bytes: 9792
#include <bits/stdc++.h>
#include <math.h>
#define rep(i,n) for (int i=0;i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
 

int main() {
    int a,b,c;
    cin >> a >> b >> c;
    cout << (a+b+c>=22?"bust":"win") << endl;
}

Measured memory_bytes: 256
n = int(input())
a = sorted(map(int, input().split()))
MAX = a[-1]
mid = MAX // 2
b = float('inf')
for i in a:
    # print(mid, i, b)
    if abs(mid - i) <= b and i != MAX:
        b = mid - i
        y = i

print(MAX, y)

Measured memory_bytes: 14052
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
using namespace std;


#define all(c) (c).begin(),(c).end()
#define endl "\n"
#define ff first
#define ss second
#define allr(c) (c).rbegin(),(c).rend()
#define ifr(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define pof pop_front
#define pob pop_back
#define pb emplace_back
#define pf emplace_front
#define fstm(m,n,r) m.reserve(n);m.max_load_factor(r)
#define mp make_pair
#define mt make_tuple
#define inf LLONG_MAX
#define os tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
//order_of_key (k) : Number of items strictly smaller than k .
//find_by_order(k) : K-th element in a set (counting from zero).
typedef long long ll;
ll gcd(){return 0ll;} template<typename T,typename... Args> T gcd(T a,Args... args) { return __gcd(a,(__typeof(a))gcd(args...)); }
typedef map<ll,ll> mll;
typedef map<string,ll> msll;
typedef unordered_map<ll,ll> umap;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
typedef long double ld;
#define mod 1000000007

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n;
    cin>>n;
    ll r = (n*(n-1))/2;
    cout<<r<<endl;
    return 0;
}

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

using namespace std;
using vi = vector<int>;

#define all(a) (a).begin(),(a).end()
#define rep(i,n) for(int i=0;i<(n);++i)
#define iter(it,v) for(auto it=v.begin();it!=v.end();++it)
#define in(v) if (scanf("%d", &v)<1);
#define out(v) printf("%d\n", v)

int main() {
  int N; in(N);
  int K; in(K);

  map<int, int> m;
  rep(i, N) {
    int a; in(a);
    ++m[a];
  }
  vi v;
  iter(it, m) {
    v.push_back(it->second);
  }
  sort(all(v));
  int ans = 0;
  if (v.size() > K) {
    rep(i, v.size()-K) {
      ans += v[i];
    }
  }
  out(ans);

  return 0;
}


Measured memory_bytes: 10748
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception{
		new Main(new Scanner(System.in), System.out, System.err).exec();
	}
	public final Scanner sc;
	public final PrintStream out, err;
	public Main(final Scanner sc, final PrintStream out, final PrintStream err) {
		this.sc = sc;this.out = out;this.err = err;
	}
	static private final long pair(int a, int b) {return (((long)a) << 32) + b;}
	static private final int upper(long v) {return (int)(v >> 32);}
	static private final int lower(long v) {return (int)(v & 0xFFFFFFFF);}

	//-----------------------------------------

	static private final long load(int end, int length) {
		return pair(end, length);
	}
	static private final int end(long load) {
		return upper(load);
	}
	static private final int length(long load) {
		return lower(load);
	}
	static private final long score(int count, int last) {
		return pair(count, last);
	}
	static private final int count(long score) {
		return upper(score);
	}
	static private final int last(long score) {
		return lower(score);
	}

	//------------------------------------------

	public void exec() throws Exception{
		final long N = sc.nextLong();
		final long MID = (long)Math.sqrt(N)+1;
		long min = N-1;
		for(long A=2;A<MID;A++) {
			if(N%A==0) {
				min = Math.min(min, (A-1)+(N/A-1));
			}
		}
		out.println(min);
	}
}


Measured memory_bytes: 23892
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double eps = 1e-6; 
const double pi = 3.1415926;
const int INF = 0x3f3f3f3f;
const int N = 20 + 5;
 
int main()
{
	int r;
	cin >> r;
	cout << 2 * pi * r << endl; 
    return 0;
}

Measured memory_bytes: 3780
#include <iostream>
#include <string>

using namespace std;

int judge(int n, string s){
  if(n&1) return 0;
  for(int i=0; i<n/2; i++)
    if(s[i]!=s[i+n/2])
      return 0;
  return 1;
    
}

int main(){
  int n;string s;
  cin >> n >> s;
  
  if(judge(n, s))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <limits>

#define DEBUG 0
#define OUT

#if DEBUG
    #define LOG(...) {printf(__VA_ARGS__); printf("\n");}
    #define print_int_array(arr, n) {\
                for (int k = 0; k < n; ++k) {\
                    std::cout << std::setw(2) << arr[k] << " ";\
                }\
                    std::cout << "\n";\
                }
#else
    #define LOG(...) {}
    #define print_int_array(arr, n) {}
#endif

const size_t n_max = (size_t)1e5;

int main(int argc, char** argv)
{
    int n, k;
    std::cin >> n >> k;
    int h[n_max];

    if (k > n) k = n;
    
    for (int i = 0; i < n; ++i) {
        std::cin >> h[i];
    }

    // init
    std::vector<int> dp(n_max);
    
    // base case
    dp[0] = 0;
    dp[1] = abs(h[1] - h[0]) + dp[0];


    for (int i = 2; i < n; ++i) {
        
        dp[i] = std::numeric_limits<int>::max();

        for (int j = 1; j <= k && j <= i; ++j) {
            dp[i] = std::min(dp[i], abs(h[i] - h[i-j]) + dp[i-j]);
        }
        
        LOG("%d : %d ", i, dp[i]);
    }
    std::cout << dp[n-1];

    return 0;
}

/*
4
10 30 40 20

*/

Measured memory_bytes: 1024
#include <iostream>
 
int NumberOfWays(int N, int R, int C)
{
  int lnAns = 0;
  if(R > N || C > N)
    return lnAns;
  
  lnAns = N - C + 1;
  lnAns *= (N - R + 1);
    return lnAns;
}
 
int main()
{
  int N, R , C;
  std::cin>> N>> R>> C;
  int Ans = NumberOfWays(N, R, C);
  std::cout<< Ans;
}

Measured memory_bytes: 256
n,k = gets.split.map(&:to_i)
ar = Array.new(n,0)
k.times do
  d = gets.to_i
  a = gets.split.map(&:to_i)
  a.each do |i|
    ar[i-1] += 1
  end
end

ans = 0
ar.each do |j|
  if j == 0
    ans += 1
  end
end
puts ans

Measured memory_bytes: 14364
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3
#define MAX_N 1000
#define M_INF 1000000000
int n,m,l,i;
void solve(){
   cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n;
  std::vector<ll> v(n);
  rep(i,n) cin>>v[i];
  rep(i,n){
    cin>>l;
    v[i]-=l;
  }
  ll ans = 0;
  rep(i,n) if(v[i]>=0) ans+=v[i];
  cout<<ans<<endl;

}

int main(){
  solve();
  return 0;
}


Measured memory_bytes: 256
h,w,k=map(int,input().split())
c=[]
for i in range(h):
    c.append(str(input()))
#print(c[0][2])

ans=0
for m in range(2**h):
    for l in range(2**w):
        a=0
        for i in range(h):
            for j in range(w):
                if m>>i&1 and l>>j&1 and c[i][j]=="#":
                    a+=1
        if a==k:
            ans+=1
print(ans)


Measured memory_bytes: 9168
#include <stdio.h>

int main(void)
{
    int ary[33]={1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51};
    int k;
    scanf("%d",&k);
    printf("%d",ary[k-1]);
    return 0;
}

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

using namespace std;

#define int long long
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define FI first
#define SE second
typedef pair< int,pair<int,pair<int, int> > > P3;
typedef pair<int, pair<int, int> > P2;
typedef pair<int, int> P1;
typedef tuple<int,int,int,int> T3;
typedef tuple<int,int,int> T2;
typedef tuple<int,int> T1;
static const int INF = 1ll<<60;
static const int dx[] = { 1, -1, 0, 0, };
static const int dy[] = { 0, 0, 1, -1 };

int a,b,c,d;

signed main(){
    cin>>a>>b>>c>>d;
    cout<<max(a*b,c*d)<<endl;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
s = input()
l = [int(i) for i in s]
for i in range(2**3):
    ans = l[0]
    siki = s[0]
    for j in range(3):
        if i>>j & 1:
            ans += l[j+1]
            siki += "+"+s[j+1]
        else:
            ans -= l[j+1]
            siki += "-"+s[j+1]
    if ans == 7:
        print(siki+"=7")
        exit()

Measured memory_bytes: 3060
import scala.io.StdIn._

object Main extends App {

  val Array(n, m) = readLine().split(" ").map(_.toInt)
  val as = readLine().split(" ").map(_.toInt)

  if (n - as.sum < 0) {
    println(-1)
  } else {
    println(n - as.sum)
  }
}


Measured memory_bytes: 54924
n, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
s = 0
c = 0
for i in range(n):
	s += a[i]
	if s <= x:
		if i == n-1:
			if s == x:
				c += 1
		else:
			c += 1
	else:
		break
print (c)


Measured memory_bytes: 3060
#include <algorithm>
#include <iostream>

using namespace std;

const int N = 2000;

int ans[N];

int main() {
	int n, x, y; cin >> n >> x >> y;
	for (int i = 1; i <= n; i++)
		for (int j = i + 1; j <= n; j++)
			ans[min(j - i, abs(i - x) + abs(j - y) + 1)]++;
	for (int k = 1; k <= n - 1; k++)
		cout << ans[k] << '\n';
	return 0;
}


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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

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

  int64 a, b;
  cin >> a >> b;
  cout << a * b / __gcd(a, b) << endl;
}

Measured memory_bytes: 256
fun intList() = readLine()?.split(" ")?.map(String::toInt) ?: TODO()
fun main(args: Array<String>) {
    val (n, k) = intList()
    val a = intList()
    val group = a.groupBy { it }
    val groupSize = group.keys.size
    if (groupSize <= k) {
        println("0")
        return
    }
    var remainGroupCount = groupSize - k
    var count = 0
    group.map { it.value.size }
        .sorted()
        .forEach {
            count += it
            remainGroupCount--
            if (remainGroupCount <= 0) {
                println(count.toString())
                return
            }
        }
}

Measured memory_bytes: 111016
#include<iostream>
#include<algorithm>
#include<bits/stdc++.h>
using namespace std;
/*---------------------DEBUGGING--------------------------------------------*/
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
/*-------------------------------------------------------------------------------------*/
#define mp make_pair
#define pb push_back
#define ll long long
#define pii pair<int,int>
#define pcc pair<char,char>
#define F first
#define S second
#define int long long
#define pi 3.141592653589793238462643383279502
#define M  998244353
#define rep(i,a,n) for(int i=a;i<n;i++)
#define N 300005
#define vi vector<int>
#define all(v) v.begin(),v.end()

signed main()
{
   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
   double n;
   cin>>n;
   //int rem = (n%3);
   double x=n/3;
   cout<<fixed<<setprecision(10)<<(x*x*x)<<endl;

}


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

static int cnt = 0;
int *a, temp, n;

void trace(int a[], int n) {
	int i;

	for (i = 1; i <= n; i++) {
		if (i > 1) {
			printf(" ");
		}
		printf("%d", a[i]);
	}
	printf("\n%d\n", cnt);

}

void BubbleSort() {
	int i, j;

	for (i = 1; i < n; i++) {
		for (j = n; j > i; j--) {
			if (a[j] < a[j - 1]) {
				temp = a[j];
				a[j] = a[j - 1];
				a[j - 1] = temp;
				cnt++;
			}
		}
	}

}

int main(void) {
	int i;

	scanf("%d", &n);
	a = (int *) malloc(sizeof(int) * (n + 1));

	for (i = 1; i <= n; i++) {
		scanf("%d", &a[i]);
	}

	BubbleSort();

	trace(a, n);

	return 0;
}

Measured memory_bytes: 604
function main(input){
  var arg = input.split('\n').map((n) => parseInt(n));
  const a = arg[0];
  const b = arg[1];
  const c = arg[2];
  const x = arg[3];
  var result = 0;
  for(var i = 0; i <= a; i++){
    for(var j = 0; j <= b; j++){
      for(var k = 0; k <= c; k++){
        if(i * 500 + j * 100 + k * 50 == x) {
          result++;
        }
      }
    }
  }
  console.log(result);
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
def main():
    n = int(input())
    array = [int(i) for i in input().split(' ')]

    count = 0
    for i in range(n):
        min_i = i
        for j in range(i, n):
            if array[j] < array[min_i]:
                min_i = j
        if min_i != i:
            count += 1
        array[i], array[min_i] = array[min_i], array[i]
    print(' '.join(map(str, array)))
    print(count)


if __name__ == '__main__':
    main()



Measured memory_bytes: 5604