akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)a, i##_len=(b); i<i##_len; i++)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define int long long
using namespace std;
using P = pair<int, int>;
using ll = long long;
using prique = priority_queue<int>;
const ll INF = LLONG_MAX/3;

/*-----Library-----*/

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

struct UnionFind {
    vector<int> par; // 親ノード
    vector<int> rank; // ランク
    vector<int> sizeuf; //要素数
    UnionFind(int n = 1) {
        init(n);
    }

    void init(int n = 1) {
        par.resize(n); rank.resize(n); sizeuf.resize(n);
        for (int i = 0; i < n; ++i) {
            par[i] = i;
            rank[i] = 0;
            sizeuf[i]=1;
        }
    }

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

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

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y);
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        sizeuf[x]+=sizeuf[y];
        return true;
    }

    int size(int x){
        return sizeuf[root(x)];
    }
};

long long gcd(long long a,long long b){
    if(b==0)return a;
    return gcd(b,a%b);
}

long long lcm(long long i,long long j){
    return i*(j/gcd(i,j));
}
//コンビネーション
/*
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 */
/*-----Library-----*/
const int MOD=1234567;
signed main(){
	int n;
	cin>>n;
	P a[110000];
	rep(i,n){
		cin>>a[i].first;
		a[i].second=i+1;
	}
	sort(a,a+n);
	cout<<a[0].second<<endl;
}




Measured memory_bytes: 4820
#include<bits/stdc++.h>
using namespace std;
#define int long
#define mod (1000000007)
#define L 1
#define R 0
main(){
  int n,r=1,c_,c,l=1;
  string s;
  cin>>n>>s;
  c=L;
  for(int i=1;i<2*n;++i,r%=mod){
    c=(s[i-1]==s[i]?!c:c);
    if(c==R)(r*=l)%=mod;
    l+=2*c-1;
    if(l<0)cout<<0,exit(0);
  }
  if(l||s[0]=='W'||s[2*n-1]=='W')cout<<0,exit(0);
  for(int i=2;i<=n;++i)(r*=i)%=mod;
  cout<<r;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
    int x, y, z, k;
    cin >> x >> y >> z >> k;
    vector<int> a(x), b(y), c(z);
    rep(i, 0, x) cin >> a[i];
    rep(i, 0, y) cin >> b[i];
    rep(i, 0, z) cin >> c[i];
    sort(a.rbegin(), a.rend());
    sort(b.rbegin(), b.rend());
    sort(c.rbegin(), c.rend());
    vector<int> d;
    rep(i, 0, x){
        rep(j, 0, y){
            d.push_back(a[i] + b[j]);
        }
    }
    sort(d.rbegin(), d.rend());
    vector<int> e;
    rep(i, 0, min(k, (int)d.size())){
        rep(j, 0, z){
            e.push_back(d[i] + c[j]);
        }
    }
    sort(e.rbegin(), e.rend());
    rep(i, 0, k){
        cout << e[i] << endl;
    }
}

Measured memory_bytes: 43240
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

class Solution {
public:
	int lower(const vector<int>& h) {
		const int n = h.size();
		int ans = 0, len = 0;
		for (int i = 1; i < n; ++i) {
			if (h[i - 1] >= h[i])
				++len;
			else
				len = 0;
			ans = max(ans, len);
		}
		return ans;
	}
};

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

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

	Solution sol;
	int ans = sol.lower(h);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 640
import java.util.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long m = sc.nextLong();
        //int a[] = new int[n];
        //int b[] = new int[n];
        String ans = "No";
        if(n == m){
            ans = "Yes";
        }
        
        
        System.out.println(ans);
    }
}

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

using namespace std;
typedef long long ll;
#define MOD 1000000007

int main()
{

  ll k;
  cin >> k;
  string s;
  cin >> s;

  if (s.length() <= k)
  {
    cout << s << endl;
    return 0;
  }

  cout << s.substr(0, k) << "..." << endl;

  return 0;
}


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

int main() {
  int N, C[510], S[510], F[510];

  cin >> N;
  for (int i = 0; i < N - 1; i++) {
    cin >> C[i] >> S[i] >> F[i];
  }

  int ans;
  for (int i = 0; i < N - 1; i++) {
    ans = S[i];
    for (int j = i; j < N - 1; j++) {
      if (ans < S[j]) {
        ans = S[j] + C[j];
      } else if (ans % F[j] == 0) {
        ans += C[j];
      } else {
        ans += (F[j] - ans % F[j]) + C[j];
      }
    }
    cout << ans << endl;
  }

  cout << 0 << endl;

  return 0;

}

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

using namespace std;

int main() {
	
	int day;
	int nihongo[3], math[3];

	while (cin >> day) {

		cin >> nihongo[0] >> math[0] >> nihongo[1] >> math[1];
		
		if (nihongo[0] % nihongo[1])
			nihongo[2] = nihongo[0] / nihongo[1] + 1;

		else
			nihongo[2] = nihongo[0] / nihongo[1];

		if (math[0] % math[1])
			math[2] = math[0] / math[1] + 1;

		else
			math[2] = math[0] / math[1];

		cout << day - max(nihongo[2], math[2]) << "\n";

	}

	return 0;

}


Measured memory_bytes: 3100
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> //tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <numeric>
using namespace std;

int main() {
    int N;
    cin >> N;
    bool include7 = false;
    for (int i = 0; i < 3; i++) {
        if (N % 10 == 7) {
            include7 = true;
            break;
        }
        N /= 10;
    }
    cout << (include7 ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3632
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        long long n,m;
        scanf("%lld %lld",&n,&m);

        long long num = 0;
        long long sum = n*m;
        long long s = sqrt(sum);
        if(m==n)
        {
            num = (s-1)*2;
        }
        else
        {
            long long hh = s*(s+1);

            if(hh>=sum)
                num = (s-1)*2;
            else
                num = (s)*2-1;
            if(s*s == sum)
                num = (s-1)*2-1;
        }
        printf("%lld\n",num);
    }
    return 0;
}

Measured memory_bytes: 256
def main():
    s = input()
    t = input()
    len_s = len(s)
    len_t = len(t)

    min_count = len_t
    for i in range(len_s-len_t+1):
        count = len_t
        for j in range(len_t):
            if s[i+j] == t[j]:
                count -= 1
        if count < min_count:
            min_count = count
    return min_count


if __name__ == "__main__":
    print(main())


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

int main(){
  long long int S;
  cin >> S;
  int xy[6];
  xy[0]=0;
  xy[1]=0;
  xy[2]=1000000000;
  xy[3]=1;
  xy[5]=S/1000000000+1;
  xy[4]=1000000000-S%1000000000;
  if(S==1000000000000000000){
    xy[3]=0;
    xy[5]=1000000000;
  }
  for(int i=0;i<5;i++){
    cout<< xy[i] << " ";
  }
  cout << xy[5]<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#define mod 1000000007
using namespace std;

bool e[50][50];
signed main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	int S = 0;
	for (int f = 0; f < a; f++) {
		for (int g = 0; g < b; g++) {
			cout << "? " << f << " " << g << " " << f << " " << g << endl;
			int P; cin >> P;
			if (!P)continue;
			e[f][g] = true;
			S++;
			if (S == c)break;
		}
	}
	int ans = 0;
	int K = 1;
	for (int i = 0; i < a; i++) {
		for (int j = 0; j < b; j++) {
			ans += K*e[i][j];
			ans %= d;
			K *= 2;
			K %= d;
		}
	}
	cout <<"! "<< ans << endl;
}

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

#define INF 1000010000
#define nl '\n'
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
#define pdd pair<double,double>
#define all(c) (c).begin(), (c).end()
#define SORT(c) sort(all(c))
#define sz(c) (c).size()
#define rep(i,n) for( int i = 0; i < n; ++i )
#define repi(i,n) for( int i = 1 ; i <= n; ++i )
#define repn(i,n) for( int i = n - 1 ; i >= 0 ; --i )
#define repf(j,i,n) for( int j = i ; j < n ; ++j )
#define die(s) {std::cout << s << nl;}
#define dier(s) {std::cout << s; return 0;}
#define vi vector<int>
typedef long long ll;
#define MAXN 222
using namespace std;

vector<vector<ll>> d(MAXN , vector<ll>(MAXN , INF));

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

	int n , m , r;
	cin >> n >> m >> r;
	
	
	vi p(r);
	rep(i , r){
		cin >> p[i];
	}
	
	rep(i , m){
		int a , b , c;
		cin >> a >> b >> c;
		d[a][b] = d[b][a] = c;
	}
	
	repi(i , n){
		d[i][i] = 0;
	}
	
	repi(k , n){
		repi(i , n){
			repi(j , n){
				d[j][i] = d[i][j] = min(d[i][j] , d[i][k] + d[k][j]);
			}
		}
	}
	
	SORT(p);
	
	ll ans = LLONG_MAX;
	
	do{
		ll cur = 0;
		rep(i , r - 1){
			cur += d[p[i]][p[i + 1]];
		}
		ans = min(ans , cur);
	}while(next_permutation(all(p)));
	
	die(ans);
	

	return 0;
}

Measured memory_bytes: 640
import sys
input=sys.stdin.readline

h,n=map(int,input().split())
a=[list(map(int,input().split())) for i in range(n)]

dp=[float("INF") for i in range(h+1)]

dp[0]=0

for i in range(n):
    for j in range(1,h+1):
        if j<a[i][0]:
            dp[j]=min(dp[j],dp[0]+a[i][1])
        else:
            dp[j]=min(dp[j-a[i][0]]+a[i][1],dp[j])
print(dp[-1])



Measured memory_bytes: 48860
#include <bits/stdc++.h>
using namespace std;
int n,m,q,mod,fa[600010],id[50010][3][2],x=0,g=0,z;
bool can_a[2][1000010];
struct edge{
	int u,v,w;
}e[50010];
int find(int a){
	return fa[a]==a?a:fa[a]=find(fa[a]);
}
int gcd(int x,int y){
	return y?gcd(y,x%y):x;
}
void merge(int u,int v){
	int fau=find(u),fav=find(v);
	if(fau==fav) return;
	fa[fav]=fau;
}
int main() {
	scanf("%d %d %d %d",&n,&m,&q,&mod);
	for(int i=1;i<=n;i++) for(int j=0;j<3;j++) for(int k=0;k<2;k++) id[i][j][k]=++x,fa[x]=x;
	for(int i=1;i<=m;i++) scanf("%d %d %d",&e[i].u,&e[i].v,&e[i].w),g=gcd(abs(e[i].w-e[1].w),g);
	if(!g) g=mod;
	mod=gcd(mod,3*g),z=e[1].w%g;
	for(int i=1;i<=m;i++){
		for(int j=0;j<3;j++) for(int k=0;k<2;k++){
			merge(id[e[i].u][j][k],id[e[i].v][(2*j+e[i].w/g)%3][k^1]);
			merge(id[e[i].v][j][k],id[e[i].u][(2*j+e[i].w/g)%3][k^1]);
		}
	}
	for(int i=0,j=z,ed=mod*2;i<ed;i++,j=2*j%mod) can_a[i&1][j]=1;
	for(int i=1,s,t,r;i<=q;i++){
		scanf("%d %d %d",&s,&t,&r);
		bool flag=false;
		for(int j=0;j<3;j++) for(int k=0;k<2;k++) if(find(id[t][0][0])==find(id[s][j][k])) flag|=can_a[k][(r+z+(3-j)*g)%mod];
		puts(flag?"YES":"NO");
	}
	return 0;
}

Measured memory_bytes: 5248
//Aleksander Łukasiewicz
#include<bits/stdc++.h>
using namespace std;

#define x first
#define y second
#define pb push_back
#define mp make_pair

typedef long long LL;
typedef pair<int,int> PII;
typedef vector<int> VI;

const int INF = 1000000009;
const int MAXN = 1000*1000;

int tab[MAXN + 3];

int main(){
    int k, n;
    scanf("%d %d", &k, &n);
    for(int i=0; i<n; i++)
        scanf("%d", &tab[i]);
    tab[n] = k+tab[0];
    int dif = 0;
    for(int i=1; i<=n; i++)
        dif = max(dif, tab[i] - tab[i-1]);
    printf("%d\n", k - dif);
return 0;
}

Measured memory_bytes: 1024
A, B, C, x, y = map(int, input().split())

if x > y:
    ans = min(A+B, 2*C) * y
    ans += min(A, 2*C) * (x-y)
elif x < y:
    ans = min(A+B, 2*C) * x
    ans += min(B, 2*C) * (y-x)
else:
    ans = min(A+B, 2*C) * x
print(ans)

Measured memory_bytes: 3064
#include <stdio.h>
#include <stdint.h>

uint64_t n, k;
uint64_t a[100005];
uint64_t bit_sum[65];
uint64_t x;
uint64_t ans;

int main()
{
	scanf("%llu %llu", &n, &k);
	for (uint64_t i = 1; i <= n; i++) {
		scanf("%llu", &a[i]);

		uint64_t tmp = a[i];
		uint64_t j = 0;
		while (tmp) {
			if (tmp & 1) {
				bit_sum[j]++;
			}

			tmp >>= 1;
			j++;
		}
	}

	uint64_t mask = (1ll << 50ll);
	for (int64_t i = 50; i >= 0; i--) {
		if (bit_sum[i] < (n - bit_sum[i]) && x + mask <= k) {
			x += mask;
		}

		mask /= 2;
	}

	for (uint64_t i = 1; i <= n; i++) {
		ans += a[i] ^ x;
	}

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

	return 0;
}


Measured memory_bytes: 896
#include <iostream>

using namespace std;

int main(void){

  int j[5];
  bool R,S,P;


  while(cin >> j[0], j[0]){
    for( int i = 1 ; i < 5 ; i++ ){
      cin >> j[i];
    }
    R = S = P = false;
    for( int i = 0 ; i < 5 ; i++ ){
      if(j[i] == 1 ) R = true;
      if(j[i] == 2 ) S = true;
      if(j[i] == 3 ) P = true;
    }

    if( R && S && P )
      for( int i = 0 ; i < 5 ; i++ )
	cout << "3" << endl;
    else if( R && S && !P ) // パーなし
      for( int i = 0 ; i < 5 ; i++ ){
	switch(j[i]){
	case 1:
	  cout << "1" << endl;
	  break;
	case 2:
	  cout << "2" << endl;
	  break;
	}
      }
    else if( R && !S && P ) // チョキなし
      for( int i = 0 ; i < 5 ; i++ ){
	switch(j[i]){
	case 1:
	  cout << "2" << endl;
	  break;
	case 3:
	  cout << "1" << endl;
	  break;
	}
      }
    else if( !R && S && P ) // グーなし
      for( int i = 0 ; i < 5 ; i++ ){
	switch(j[i]){
	case 2:
	  cout << "1" << endl;
	  break;
	case 3:
	  cout << "2" << endl;
	  break;
	}
      }
    else if( (!R && !S && P) || (!R && S && !P ) || (R && !S && !P ) ){
      for( int i = 0 ; i < 5 ; i++ )
	cout << "3" << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1156
#include <iostream>
#include <vector>
#include <queue>
#include <string.h>
#include <math.h>
using namespace std;
typedef long long ll;

int main(void){
    int  d, g, p[15], c[15];
    cin >> d >> g;
    for (int i = 0; i < d; i++) cin >> p[i] >> c[i];
    
    int ans = 1e9;
    for (int i = 0; i < pow(2, d); i++) {
        int ic = i, pts = 0, qs = 0;
        int m[10];
        for (int j = 0; j < d; j++) {
            if (ic % 2 == 1) m[j] = 1;
            else m[j] = 0;
            ic /= 2;
        }
        
        for (int j = 0; j < d; j++) {
            if (m[j] == 1) {
                pts += p[j] * (j + 1) * 100 + c[j];
                qs += p[j];
            }
        }
        
        if (pts < g) {
            int mn_q = 1e8;
            for (int j = 0; j < d; j++) {
                if (m[j] == 0) {
                    if (g - pts <= (p[j] - 1) * (j + 1) * 100) {
                        int f = (g - pts) / ((j + 1) * 100);
                        if ((g - pts) % ((j + 1) * 100) != 0) f++;
                        mn_q = min(f, mn_q);
                    }
                }
            }
            qs += mn_q;
        }
        
        ans = min(ans, qs);
        
    }
    
    cout << ans << endl;
    
    
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		String s = sc.next();
		String c = sc.next();
		System.out.println(a.substring(0, 1) + s.substring(0, 1) + c.substring(0, 1));
		sc.close();
	}
}

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

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> l(m), r(m);
    rep(i, 0, m) cin >> l[i] >> r[i];
    vector<int> a(100005);
    rep(i, 0, m){
        a[l[i]]++; a[r[i]+1]--;
    }
    int ans = 0;
    int sum = 0;
    rep(i, 0, 100005){
        sum += a[i];
        if(sum == m) ans++;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 4564
#include<iostream>
#include<vector>
#include<queue>
using namespace std;
struct edge{
	int to,rev,F;
};
vector<edge>G[1<<17];
int N,M;
int vis[1<<17];
void dfs(int u,int p)
{
	vis[u]=1;
	int cnt=0,par=-1;
	for(int i=0;i<G[u].size();i++)
	{
		if(vis[G[u][i].to]==0)dfs(G[u][i].to,u);
	}
	for(int i=0;i<G[u].size();i++)
	{
		if(G[u][i].to!=p&&G[u][i].F!=0)
		{
			if(G[u][i].F==-1)
			{
				G[u][i].F=1;
				G[G[u][i].to][G[u][i].rev].F=0;
			}
			cnt++;
		}
		else if(G[u][i].to==p)par=i;
	}
	if(p==-1)
	{
		for(int i=0;i<G[u].size();i++)
		{
			if(G[u][i].F==-1)
			{
				G[u][i].F=1;
				G[G[u][i].to][G[u][i].rev].F=0;
			}
		}
	}
	else
	{
		if(cnt%2==1)
		{
			G[u][par].F=1;
			G[G[u][par].to][G[u][par].rev].F=0;
		}
	}
	return;
}
main()
{
	cin>>N>>M;
	if(M%2==1)
	{
		cout<<-1<<endl;
		return 0;
	}
	vector<int>cnt(N);
	for(int i=0;i<M;i++)
	{
		int a,b;cin>>a>>b;
		a--,b--;
		cnt[a]++;
		cnt[b]++;
		G[a].push_back((edge){b,(int)G[b].size(),-1});
		G[b].push_back((edge){a,(int)G[a].size()-1,-1});
	}
	int id=0;
	for(int i=1;i<N;i++)
	{
		if(cnt[id]>cnt[i])id=i;
	}
	dfs(0,-1);
	for(int i=0;i<N;i++)
	{
		for(edge&e:G[i])
		{
			if(e.F==1)cout<<i+1<<" "<<e.to+1<<endl;
		}
	}
}


Measured memory_bytes: 16128
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <vector>
#include <cstring>
#include <queue>
#include <map>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
const int INF = 1e6;
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using uld = unsigned long long;
using P = pair<int,int>;
const ll mod = 1e9+7;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
template<class T> inline bool chmax(T &a,T& b){if(a < b){a = b; return true;} else return false;}
template<class T> inline bool chmin(T &a,T& b){if(a > b){a = b; return true;} else return false;}
int main(){
    int n,m;
    cin >> n >> m;
    vector<bool> check(m,true);
    rep(i,n){
        int k;
        cin >> k;
        vector<bool> count(m,false);
        rep(j,k){
            int a;
            cin >> a;
            count[a-1] = true;
        }
        rep(j,m){
            if(!count[j]) check[j] = false;
        }
    }
    int ans = 0;
    rep(i,m){
        if(check[i]) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3616
// resale
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
int main(int argc, char const *argv[])
{
	int n;
	vector<int> value,cost;
	cin>>n;
	int tmp,sum=0;
	for (int i = 0; i < n; ++i)
	{
		cin>>tmp;
		value.push_back(tmp);
	}
	for (int i = 0; i < n; ++i)
	{
		cin>>tmp;
		cost.push_back(tmp);
	}
	for (int i = 0; i < n; ++i)
	{
		if (value[i] > cost[i])
		{
			sum += value[i]-cost[i];
		}
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;

namespace ARC099D
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            int k = int.Parse(Console.ReadLine());

            long max = (long) Math.Pow(10, 15);
            Dictionary<long, double> rates = new Dictionary<long, double>();
            for (long i = 1; i < max;)
            {
                rates.Add(i, Rate(i));
                i += Math.Max((long) Math.Pow(10, Digit(i + 1) - 4), 1);
            }

            List<long> keyList = new List<long>(rates.Keys);
            keyList.Reverse();
            double min = max;

            List<long> ans = new List<long>();
            foreach (long index in keyList)
            {
                if (min >= rates[index])
                {
                    ans.Add(index);
                    min = rates[index];
                }
            }

            ans.Reverse();
            for (int i = 0; i < k; i++)
            {
                Console.WriteLine(ans[i]);
            }
        }

        public static int Digit(long n)
        {
            return n == 0 ? 1 : (int) Math.Log10(n) + 1;
        }

        public static double Rate(long n)
        {
            long temp = n;
            long sn = 0;
            while (temp > 0)
            {
                sn += temp % 10;
                temp /= 10;
            }

            return (double) n / sn;
        }
    }
}

Measured memory_bytes: 19168
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;

struct UnionFind{
	vector<int> par;
	vector<int> rank;
	
	UnionFind(int n){
        init(n);
    }
	
	//n要素で初期化
	void init(int n){
		par.resize(n);
		rank.resize(n);
		for(int i = 0; i < n; i++){
			par[i] = i;
			rank[i] = 0;
		}
	}
	
	//木の根を求める
	int root(int x){
		if(par[x] == x) return x;
		else return par[x] = root(par[x]);
	}
	
	//xとyの属する集合を併合
	void unite(int x, int y){
		x = root(x);
		y = root(y);
		if(x == y) return;
		if(rank[x] < rank[y]) par[x] = y;
		else{
			par[y] = x;
			if(rank[x] == rank[y]) rank[x]++;
		}
	}
	
	bool same(int x, int y){
		return root(x) == root(y);
	}
};

int main(){
	int n,m;
	cin >> n >> m;
	int p[n],q[n];
	REP(i,n){
		cin >> p[i];
		p[i]--;
		q[p[i]] = i;
	}
	int x[m],y[m];
	REP(i,m){
		cin >> x[i] >> y[i];
		x[i]--;
		y[i]--;
	}
	UnionFind uf(n);
	REP(i,m) uf.unite(x[i], y[i]);
	int ans = 0;
	REP(i,n){
		if(uf.same(i, q[i])) ans++;
	}
	cout << ans << endl;
}

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


class Keyboard {
  public:
    string input, output;
    vector<vector<char>> keyboard;
    string make_output();

    Keyboard(string input) : input(input) {
      // IMPORTANT: vector<vector<char>> keyboard;
      // ?????????????????§?????£??????????????¨??????????????°??¨?????????
      // ??¢??§??????????????????????????????????????¨???????????§??§???????????????
      keyboard.resize(10);

      keyboard[0] = vector<char>({'A'});
      keyboard[1] = vector<char>({'.', ',', '!', '?', ' '});
      keyboard[2] = vector<char>({'a', 'b', 'c'});
      keyboard[3] = vector<char>({'d', 'e', 'f'});
      keyboard[4] = vector<char>({'g', 'h', 'i'});
      keyboard[5] = vector<char>({'j', 'k', 'l'});
      keyboard[6] = vector<char>({'m', 'n', 'o'});
      keyboard[7] = vector<char>({'p', 'q', 'r', 's'});
      keyboard[8] = vector<char>({'t', 'u', 'v'});
      keyboard[9] = vector<char>({'w', 'x', 'y', 'z'});
    }

};

string Keyboard::make_output() {
  int curr;
  int prev = -1;
  int freq =  0;
  output = "";

  rep (i, input.size()) {
    curr = (int)input[i] - 48; // ascii code

    // ?????? or ??????
    if (curr == prev || prev == -1) freq++;

    // ??\????¢????
    if (curr == 0) {
      if (prev != -1) {
        freq--;
        int qindex = keyboard[prev].size();
        /* cout << "i, j: " << prev << "," << freq % qindex << endl; */
        /* cout << keyboard[prev][freq%qindex] << endl; */
        output += keyboard[prev][freq%qindex];
      }

      // ?????????
      prev = -1;
      freq = 0;
    }
    else prev = curr;
  }

  return output;
}

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

  rep (i, n) {
    cin >> s;
    Keyboard k = Keyboard(s);
    cout << k.make_output() << endl;
  }

  return 0;
}

Measured memory_bytes: 3052
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);i++)
//#define int long long  
int main(){
    string Sh;
    string T;
    string S;
    bool k=0;
    cin >> Sh >> T;
    S=Sh;
    for(int i=Sh.size()-T.size();i>=0;i--){
        k=0;
        REP(j,T.size()){
            if(Sh[i+j]!=T[j] && Sh[i+j]!='?'){
                k=1;break;
            }
        }
        if(k==0){
            REP(j,T.size()){
                S[i+j]=T[j];
            }
            REP(j,S.size()){
                if(S[j]=='?'){
                    S[j]='a';
                }
            }
            cout << S << endl;
            return 0;
        }
    }
    cout << "UNRESTORABLE" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
ll h(ll n,ll j){
  ll k=1;
  if(n-j>=j){
  for(int i=n;i>=n-j+1;i--){
    k*=i;
  }
  for(int i=j;i>0;i--){
    k/=i;
  }
  return k;
  }
  else{
    ll g=n-j;
    ll k=1;
    for(int i=n;i>=j+1;i--){
      k*=i;
    }
    for(int i=g;i>=1;i--){
      k/=i;
    }
    return k;
  }
}
ll kk(ll n){
  ll k=1;
  rep(i,n){
    k*=2;
  }
  return k;
}
int main(){
  ll n,p;
  cin>>n>>p;
  vll a(n);
  ll a0=0;
  ll a1=0;
  rep(i,n){
    cin>>a[i];
    if(a[i]%2==0) a0++;
    else a1++;
  }
  sort(all(a));
  ll ans=0;
  if(p){
    ans+=a1;
    ll k=3;
    while(a1-k>=0){
      ans+=h(a1,k);
      k+=2;
    }
    ans*=kk(a0);
  }
  else{
    ll k=2;
    ans++;
    while(a1-k>=0){
      ans+=h(a1,k);
      k+=2;
    }
    ans*=kk(a0);
  }
  COUT(ans);
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 0xccccccc;
const ll LINF = 922337203685477580LL;
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);}
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}

template<class T>
struct RMQ {
  const T ex;
  int n;
  vector<T> dat, laz;
  RMQ(int n_):ex(0) {
    n = 1;
    while(n < n_) n <<= 1;
    dat.assign(2*n-1, ex);
    laz.assign(2*n-1, ex);
  }
  inline int chld(int k) {return k*2+1;}
  inline int chrd(int k) {return k*2+2;}
  void eval(int k) {
    if(laz[k] == ex) return;
    if(k < n-1) {
      laz[chld(k)] += laz[k];
      laz[chrd(k)] += laz[k];
    }
    dat[k] += laz[k];
    laz[k] = ex;
  }
  void update(int a, int b, T x, int k, int l, int r) {
    eval(k);
    if(a <= l and r <= b) {
      laz[k] += x;
      eval(k);
    } else if(a < r and l < b) {
      update(a, b, x, chld(k), l, (l+r)>>1);
      update(a, b, x, chrd(k), (l+r)>>1, r);
      dat[k] = max(dat[chld(k)], dat[chrd(k)]);
    }
  }
  inline void update(int a, int b, T x) {update(a, b, x, 0, 0, n);}
  T query(int a, int b, int k, int l, int r) {
    eval(k);
    if(r <= a or b <= l) return ex;
    if(a <= l and r <= b) return dat[k];
    return max(query(a, b, chld(k), l, (l+r)>>1), query(a, b, chrd(k), (l+r)>>1, r));
  }
  inline T query(int a, int b) {return query(a, b, 0, 0, n);}
};

const int N = 2e5+10;

//head

int n, m;
P lr[N];
P a[N];
bool comp(const P &a, const P &b) {
  return a.second < b.second?true:
      a.second != b.second?false:
      a.first<b.first;
}
RMQ<ll> rng(N);

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  rep(i, m) cin >> lr[i] >> a[i].first;
  rep(i, m) {
    a[i].second = lr[i].first-1;
    lr[i].first = i;
  }
  sort(lr, lr+m, comp);
  
  int j = 0;
  rep(i, n) {
    ll ma = rng.query(0, i);
    while(j != m and lr[j].second-1 == i) {
      int nn = lr[j++].first;
      rng.update(a[nn].second, i+1, a[nn].first);
    }
    rng.update(i, i+1, ma);
  }
  cout << rng.query(0, n) << endl;
}

Measured memory_bytes: 14540
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
#include<limits.h>
#include<unordered_map>
#include<unordered_set>
#include<deque>
#include<cstdio>
using namespace std;
typedef long long int ll;
const int N = 1000000;
const int mod = 1000000007;
const int INF = 1 << 30;
int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
#define rep(i,n) for(ll i=(ll)0;i<(ll)n;++i)
#define vin(v,n) rep(i,n)cin>>v[i];
#define ALL(x) x.begin(),x.end()
#define pp pair<ll,ll>
#define sz size()
#define fi first
#define se second0
#define pb push_back
#define prqueue priority_queue<ll,vector<ll>,greater<ll>>
string YN(bool b) { return(b ? "YES" : "NO"); }
string yn(bool b) { return(b ? "Yes" : "No"); }
ll d, n,ans;
int main() {
	cin >> d >> n;
	for (int i = 1; i <= n; ++i) { ++ans; if (i % 100 == 0)++ans; }
	cout << ll(ans * pow(100,d)) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <numeric>
#include <climits>

using namespace std;

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  int max_sum = INT_MIN;
  for (int i = 0; i <= k; i++) {
    for (int j = 0; j <= k; j++) {
      if (i+j > k || i+j > n) continue;
      vector<int> extracted;
      extracted.insert(extracted.end(), v.begin(), v.begin()+i);
      extracted.insert(extracted.end(), v.end()-j, v.end());
      sort(extracted.begin(), extracted.end());
      int sum = accumulate(extracted.begin(), extracted.end(), 0);
      int cnt = k-i-j;
      for (auto x : extracted) {
        if (cnt-- > 0 && x < 0) {
          sum -= x;
        }
      }
      max_sum = max(max_sum, sum);
    }
  }
  cout << max_sum << endl;
  return 0;
}


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



int main(){
	cin.tie(0)->sync_with_stdio(0);
	int x;
	cin >> x;
	cout << 360 / gcd(x, 360);
	return 0;
}

/*

*/

////////////////////////////////////////////////////////////////////////////////////////
//                                                                                    //
//                                   Coded by Aeren                                   //
//                                                                                    //
////////////////////////////////////////////////////////////////////////////////////////

Measured memory_bytes: 3660
#include <iostream>
#include <vector>
#include <math.h>
#include <bits/stdc++.h>
using namespace std;


#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,b,a) for(int i=(b)-1;i>=(a);--i)
#define FILL(A,val) memset(A,val,sizeof(A))
#define ITER(it,a) for(__typeof(a.begin()) it=a.begin();it!=a.end();++it)
#define DBG1(a) cerr<<#a<<"="<<(a)<<"\n"
#define DBG2(a,b) cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<"\n"

#define ALL(V) V.begin(),V.end()
#define SZ(V) (int)V.size()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const int INF = 1000*1000*1000 + 7;
const LL LINF = 1LL*INF*INF;

const LL MOD = 1000000007;

const int MAX = 200005;

struct Fen
{
	int t[MAX];

	int n;

	void init (int nn)
	{
		n = nn;
		FILL(t,-1);
	}

	int getmax (int r)
	{
		int result = -1;
		for (; r >= 0; r = (r & (r+1)) - 1)
			result = max (result, t[r]);
		return result;
	}

	void upd (int i, int val)
	{
		for (; i < n; i = (i | (i+1)))
			t[i] = max (t[i], val);
	}

} F;



int a[MAX];


int L[MAX];
int R[MAX];
int main()
{
	//freopen("in.txt","r",stdin);
	ios::sync_with_stdio(false);cin.tie(0);
	int n;
	cin>>n;

	FOR(i,0,n)
	{
		cin>>a[i];
	}


	F.init(n+1);

	FOR(i,0,n)
	{
		L[i] = F.getmax(a[i])+1;
		F.upd(a[i],i);
	}

	F.init(n+1);

	reverse(a,a+n);
	FOR(i,0,n)
	{
		R[n-1-i] = n-1-(F.getmax(a[i])+1);
		F.upd(a[i],i);
	}


	reverse(a,a+n);
	LL ans = 0;

	FOR(i,0,n)
	{
		ans += (R[i]-i+1)*1ll*(i-L[i]+1) * a[i];
	}

	cout<<ans;
	return 0;
}


Measured memory_bytes: 3328
import java.util.*;

public class Main {
    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int A = sc.nextInt();
        int B = sc.nextInt();
        
        if(B % A == 0){
        	System.out.println(A + B);
        } else {
        	System.out.println(B - A);
        }
        
        sc.close();
        
    }
}


Measured memory_bytes: 22612
x, y = map(int, input() .split())


if y > x:
	if x*y >= 0:
		a = y-x
	else:
		a = abs(abs(x) - abs(y)) + 1
else:
	if x*y > 0:
		a = abs(abs(x) - abs(y)) + 2
	else:
		a = abs(abs(x) - abs(y)) + 1

print (a)




Measured memory_bytes: 3060
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  ll n;
  cin>>n;
  
  vector<ll> A(n);
  rep(i,n) cin>>A[i];
  
  ll x=0;
  rep(i,n) x^=A[i];
  
  rep(i,n){
    if(i) cout<<" ";
    cout<<(x^A[i]);
  }
  cout<<endl;
  
  return 0;
}

Measured memory_bytes: 4708
N=int(input())
S= list(str(input()) for i in range(N))
count_M = 0
count_R = 0
count_A = 0
count_C = 0
count_H = 0
for i in range(N):
  if S[i][0] =='M':
    count_M +=1
  if S[i][0] =='R':
    count_R +=1
  if S[i][0] =='C':
    count_C +=1
  if S[i][0] =='H':
    count_H +=1
  if S[i][0] =='A':
    count_A +=1
print(count_M*count_A*count_R+count_M*count_A*count_C+count_M*count_A*count_H+count_M*count_R*count_C+count_M*count_R*count_H+count_M*count_C*count_H+count_A*count_R*count_C+count_A*count_R*count_H+count_R*count_C*count_H+count_A*count_C*count_H)


Measured memory_bytes: 9784
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;

vector <P> ans;
string str;

int main(){
  ll anssum=0,anssize=0;
  ll maxH,nowH,cnt,maxW;
  cin>>str;
  maxH=nowH=20000LL;
  cnt=0;

  for(int i=0;i<(int)str.size();i++){

    if(str[i]=='/'){
      nowH++;
      if(maxH==nowH){
	cnt++;
	ans.push_back(P(i,cnt/2));
	cnt=0;
      }else if(maxH<nowH){
	maxH=nowH;
      }else{
	cnt+=(maxH-nowH)*2+1;
      }
      
    }else if(str[i]=='_'){

      if(maxH>nowH){
	cnt+=(maxH-nowH)*2;

      }
    }else{

      nowH--;
      if(maxH>nowH){
	cnt+=(maxH-nowH)*2-1;
      }

    }
  }
  
  maxH=nowH=20000LL;
  maxW=(int)str.size()-1;

  cnt=0;

  for(int i=(int)str.size()-1;i>=0;i--){
    if(str[i]=='\\'){
      nowH++;
      if(maxH==nowH){
	cnt++;
	ans.push_back(P(maxW,cnt/2));
	cnt=0;
      }else if(maxH<nowH){
	maxH=nowH;
	maxW=i;
      }else{
	cnt+=(maxH-nowH)*2+1;
      }
    }else if(str[i]=='_'){
      if(maxH>nowH){
	cnt+=(maxH-nowH)*2;
	
      }else if(maxH==nowH){
	maxW=i;
      }
    }else{
      if(nowH==maxH)maxW=i;
      nowH--;
      if(maxH>nowH){
	cnt+=(maxH-nowH)*2-1;
      }
    }
  }

  sort(ans.begin(),ans.end());
  anssum=anssize=0;
  for(int i=0;i<(int)ans.size();i++){
    if(i>0&&ans[i-1]==ans[i])continue;
    anssum+=ans[i].second;
    anssize++;
  }
  
  cout<<anssum<<endl;
  cout<<anssize;
  for(int i=0;i<(int)ans.size();i++){
    if(i>0&&ans[i-1]==ans[i])continue;
    cout<<' '<<ans[i].second;
  }
  cout<<endl;
}



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

int main()
{
	string s;
	cin>>s;
	
	for(int i=0;i<s.size();i++)
	 if(s[i]>='A'&&s[i]<='Z') s[i]='A';
	  else s[i]='a';
	
	cout<<s<<endl;
	return 0;
 } 

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;
const long double PI = 3.141592653589793;
int main() {
  ll n;

  cin >> n;

  long double ans = 2 * n * PI;
  cout << setprecision(10)<<ans << endl;
  return 0;
}


Measured memory_bytes: 3776
n, k, c = map(int, input().split())
s = input()
fo = []
ba = []
r = 0
for ind, cc in enumerate(s):
    ind += 1
    r -= 1
    if cc=='x' or r>0:
        continue
    fo.append(ind)
    if len(fo)==k:
        break
    r = c+1
r = 0
for ind, cc in enumerate(reversed(s)):
    ind = n-ind
    r -= 1
    if cc=='x' or r>0:
        continue
    ba.append(ind)
    if len(ba)==k:
        break
    r = c+1

for f, b in zip(fo, reversed(ba)):
    if f==b:
        print(f)


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

int main() {
	int a,b,c,d,o;
	int digit = 0;
	o = scanf("%d %d",&a,&b);
	d =b;
  while(b!=0){
    b = b / 10;
    ++digit;
  }
  o = pow(10,digit);
  c = a * o + d;
  double an = pow(c,0.5);
  if((int)an== an){
  	printf("Yes");
  }else{
  	printf("No");
  }
return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <chrono>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define eps 1e-9

typedef long long ll;

using namespace std;

const int mod = 1e9+7;
const int N = 1e5+5;
//int a[N];

int main()

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

    int n, d, x;

    cin >> n >> d >> x;

    int ans = abs(x-d);

    for (int i = 1; i < n; i++) {

        cin >> x;

        x = abs(x-d);

        ans = __gcd(ans, x);
    }

    cout << ans;

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef vector < vector <int> > vvi;
const int HUGEI = 2147483647;  // (1 << 31) - 1
const ll HUGEL = 9223372036854775807;  // (1 << 63) - 1
const string ABC = "abcdefghijklmnopqrstuvwxyz";

int main(void) {
    int n;
    vector <int> pn;
    cin >> n;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        pn.push_back(a);
    }
    int rn[n];
    for (int i = 0; i < n; i++) {
        rn[pn[i] - 1] = i + 1;
    }
    int an[n], bn[n];
    for (int i = 0; i < n; i++) {
        an[i] = 30000 * (i + 1);
        bn[i] = 30000 * (n - i - 1) + rn[i];
    }
    for (int i = 0; i < n; i++) {
        cout << an[i];
        if (i < n - 1) cout << " ";
    }
    cout << endl;
    for (int i = 0; i < n; i++) {
        cout << bn[i];
        if (i < n - 1) cout << " ";
    }
    cout << endl;
    return 0;
}


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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

signed main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
	
  	string st; cin >> st; cin >> st;
  	cout << "A" << st[0] << "C" << endl;
  
    return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {

	int D,E;
	public void solve() {

		while(true){
			D = nextInt();
			E = nextInt();

			if(D + E == 0)break;

			double diff = Double.MAX_VALUE;

			for(int x = 0;x <= D;x++){
				int y = D - x;

				diff = Math.min(diff,Math.abs(Math.sqrt(x * x + y * y) - E));

			}

			out.println(diff);
		}
	}

	public static void main(String[] args) {
		out.flush();
		new Main().solve();
		out.close();
	}

	/* Input */
	private static final InputStream in = System.in;
	private static final PrintWriter out = new PrintWriter(System.out);
	private final byte[] buffer = new byte[2048];
	private int p = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (p < buflen)
			return true;
		p = 0;
		try {
			buflen = in.read(buffer);
		} catch (IOException e) {
			e.printStackTrace();
		}
		if (buflen <= 0)
			return false;
		return true;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrint(buffer[p])) {
			p++;
		}
		return hasNextByte();
	}

	private boolean isPrint(int ch) {
		if (ch >= '!' && ch <= '~')
			return true;
		return false;
	}

	private int nextByte() {
		if (!hasNextByte())
			return -1;
		return buffer[p++];
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = -1;
		while (isPrint((b = nextByte()))) {
			sb.appendCodePoint(b);
		}
		return sb.toString();
	}

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

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

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

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

using namespace std;

int main(){
  int a, b, c, d;
  cin >> a >> b >> c >> d;

  bool can = false;
  if(abs(c-a) <= d){
    can = true;
  }
  else if(abs(b-a)<=d && abs(c-b)<=d){
    can = true;
  }

  if(can) cout << "Yes" << endl;
  else    cout << "No" << endl;

  return 0;
}


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

#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREP1(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(c) begin(c), end(c)

int _ = (
#ifndef LOCAL
    std::cin.tie(nullptr), std::ios::sync_with_stdio(false),
#endif
    std::cout.precision(10), std::cout.setf(std::ios::fixed));

using ll = long long;
using ld = long double;
// constexpr auto mod = 1000000007;
using namespace std;

vector<ll> d, p;

ll solve(ll N, ll X) {
  if (N == 0) {
    return X <= 0 ? 0 : 1;
  }
  else if (X <= 1 + d[N - 1]) {
    return solve(N - 1, X - 1);
  }
  else if (X == 2 + d[N - 1]){
    return 1 + p[N - 1];
  }
  else if (X <= 2 + 2 * d[N - 1]) {
    return 1 + p[N - 1] + solve(N - 1, X - 2 - d[N - 1]);
  }
  else if (X == 3 + 2 * d[N - 1]) {
    return 1 + 2 * p[N - 1];
  }
}

int main() {
  ll N, X;
  cin >> N >> X;

  d.resize(N + 1), p.resize(N + 1);
  d[0] = p[0] = 1;
  REP(i, N) {
    d[i + 1] = 2 * d[i] + 3;
    p[i + 1] = 2 * p[i] + 1;
  }
  cout << solve(N, X) << endl;

  return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include<cassert>
#include<cfloat>
#include<climits>
#include<cmath>
#include<cstring>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

using lint = long long;
using P = pair<int, int>;
using LLP = pair<long long, long long>;

#define REP(i, x, n) for(int i = (x), i##_len = int(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = int(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = int(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = int(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = int(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())
#define TWINS(x) cout << ((x) ? "Yay!" : ":(") << endl

constexpr int IINF = (1 << 30) - 1;
constexpr long long LLINF = 1LL << 61;
constexpr double EPS = 1e-8;

constexpr int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
constexpr int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

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

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

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

    int n;
    cin >> n;

    int ans = 0;
    int prev = 0;
    rep(i, n){
        int h;
        cin >> h;
        ans += max(h - prev, 0);
        prev = h;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
// #include<bits/stdc++.h>
using namespace std;
#define ll long long


int main(){
  int N,M;
  cin >> N >> M;
  vector<pair<int,int>> c;
  for(int i=0; i<M; i++){
    int a,b;
    cin >> a >> b;
    c.push_back(make_pair(b,a));
  }
  sort(c.begin(), c.end());
  int broke=-1;
  int ans=0;
  for(int i=0; i<M; i++){
    int g,s;
    g = c[i].first;
    s = c[i].second;
    if(broke >= s){
      continue;
    }
    broke = g-1;
    ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1400
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define sc(a,b) scanf("%lld %lld",&a,&b) 

int main()
{
	ll a,b;
/*while(*/sc(a,b);//!=EOF)

ll p= floor((3*a+b)/2);
printf("%lld\n",p);
   
 
 
}
//}

Measured memory_bytes: 256
function Main(input) {
  input=input.split("\n");
　const S=input[0];
  var array=new Array(S.length-1);
  array.fill(false);
  var sum=0;
  var temp=[];
  for(var i=0;i<S.length;i++){
    temp=[];
    for(var j=0;j<S.length-i;j++){
      if(j!==S.length-1-i){
        temp.push(2**(S.length-2-j));
      }else{
        temp.push(2**(S.length-1-j));
      }
    }
    //console.log(temp);
    for(var j=0;j<temp.length;j++){
      sum+=S[i]*temp[j]*(10**j);
      //console.log(sum);
    }
  }
  console.log(sum);
}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
  
  


Measured memory_bytes: 29660