akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
static const int MAX = 1e5;
static const int INF = 1e9;

// 隣接リストを用いた幅優先探索 O(|V|+|E|)
int n;
vector<pair<ll, ll>> G[MAX]; // 頂点数がnのグラフを表す隣接リスト
vector<ll> d(MAX, INF); // 始点sから頂点iまでの最短距離をd[i]に記録
// main関数からこれらを削除すること

void bfs(int s) {
  queue<int> q;
  q.push(s);
  d[s] = 0;
  while(!q.empty()){
    int u = q.front();
    q.pop();
    for(int v = 0; v < G[u].size(); v++){
      if(d[G[u][v].first] == INF){
        d[G[u][v].first] = d[u] + G[u][v].second;
        q.push(G[u][v].first);
      }
    }
  }
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  // 重み付き無向(有向)グラフの隣接リスト
  ll u, v, w;
  cin >> n;
  
  for(int i = 0; i < n - 1; i++){
    cin >> u >> v >> w;
    u--;
    v--;
    G[u].push_back(make_pair(v, w));
    G[v].push_back(make_pair(u, w)); // 有向グラフではこの行をコメントアウト
  }
  
  int q, k;
  cin >> q >> k;
  
  bfs(k - 1);
  
  int x, y;
  for(int i = 0; i < q; i++){
    cin >> x >> y;
    cout << d[x - 1] + d[y - 1] << "\n";
  }
}

Measured memory_bytes: 9984
#include<stdio.h>
#include<string.h>


int main(){
  char S[10010];
  char T[10010];

  scanf("%s", S);
  scanf("%s", T);
  int len = strlen(S);

  if(strncmp(S,T,len)== 0){
    printf("Yes\n");
  }else{
    printf("No\n");
  }

  return 0;
}

Measured memory_bytes: 1716
import java.util.*;

class Main {
	static Scanner sc =new Scanner(System.in);
	static int a;
	static int b;
	static int c;
    static int [] x;
		public static void main (String[]agrs){
			a=sc.nextInt();
			b=sc.nextInt();
			c=sc.nextInt();
			int[]x=new int[]{a,b,c};
			
			Arrays.sort(x);
			for(int i = 0;i<x.length;i++){
				System.out.print(x[i]);
				if(i<2){
					System.out.print(" ");
				}
			}
			System.out.println();
		}
}

Measured memory_bytes: 17360
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
	// write your code here
        Scanner sc = new Scanner(System.in);
        int nums[] = new int[3];

        nums[0] = sc.nextInt();
        nums[1] = sc.nextInt();
        nums[2] = sc.nextInt();

        Arrays.sort(nums);
        int ans = 0;

        int diff_1 = nums[1] - nums[0];
        if (diff_1 % 2 != 0){
            ans++;
            nums[1]++;
            nums[2]++;
        }

        System.out.println(ans + nums[2] - nums[1] + (nums[1] - nums[0]) / 2);

    }
}


Measured memory_bytes: 22484
#include <bits/stdc++.h> 
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;ll MM = 1000000000;ll mod = MM + 7;

int main(){
ll n,m; cin>>n>>m;
  vector<pair<ll,ll>>v/*(n)*/;
  rep(i,n) {
    ll a,b; cin>>a>>b;
   v.push_back(pair<ll,ll>(a,b));
           }
  sort(v.begin(),v.end());
  ll cnt=0; ll ans=0;
  for(pair<ll,ll>t:v){
  if(cnt+t.second<m) {
    cnt+=t.second; ans+=t.second*t.first; 
  }
    else if(cnt+t.second>=m){
 ans+=t.first*(m-cnt);
      break;
    }
}
  cout<<ans<<endl;
}

Measured memory_bytes: 2420
#include<cstdio>
#include<cstring>
using namespace std;
int n, q;
int f[10002];


int gf(int u){
    if(f[u] == u)
        return u;
    else{
        f[u] = gf(f[u]);
        return f[u];
    }
}


void un(int u, int v){
    int fu=gf(u), fv=gf(v);
    if(fu==fv)
        return;
    else{
        f[fu] = fv;
        return;
    }
}


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

    int query, u, v;
    for(int i=0; i<q; i++){
        scanf("%d %d %d", &query, &u, &v);
        if(query==0)
            un(u, v);
        else{
            if(gf(u) != gf(v))
                printf("0\n");
            else 
                printf("1\n");
        }
    }
    return 0;
}


Measured memory_bytes: 2680
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>

using namespace std;

int min(int p, int q){
	if(p > q){
		return q;
	}else{
		return p;
	}
}

int max(int p, int q){
	if(p > q){
		return p;
	}else{
		return q;
	}
}

int main(void){
	int n, k;
	cin >> n >> k;
	
	int sum = 1;
	
	for(int i=0;i<n;i++){
		if(min(sum*2, sum+k) == sum*2){
			sum *= 2;
		}else{
			sum += k;
		}	
	}
	
	cout << sum << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000000000.0

map<pair<int,int>,long long> mp;

long long combination(long long x,long long y){
	if(mp[make_pair(x,y)]!=0)return mp[make_pair(x,y)];
	if(x==0&&y==0)return 1;
	if(y>x||y<0)return 0;
	long long k = combination(x-1,y-1)+combination(x-1,y);
	mp[make_pair(x,y)] = k;
	return k;
}

int main(){
	
	int N,A,B;
	cin>>N>>A>>B;
	
	vector<long long> v(N);
	
	for(int i=0;i<N;i++)cin>>v[i];
	
	sort(v.begin(),v.end(),greater<long long>());
	
	vector<long long> a(A);
	
	double ans = 0.0;
	int A_cnt = 0;
	
	for(int i=0;i<A;i++){
		a[i] = v[i];
		ans += a[i];
		if(v[A-1]==a[i])A_cnt++;
	}
	
	cout<<fixed<<setprecision(20)<<ans/(double)A<<endl;
	
	int B_cnt = 0;
	
	for(int i=0;i<N;i++){
		if(v[A-1]==v[i])B_cnt++;
	}
		
	long long Ans = 0;
	
	if(v[0]==v[A-1]){
		for(int i=A_cnt;i<=min(B-(A-A_cnt),B_cnt);i++){
			Ans += combination(B_cnt,i);
		}
	}
	else{
		Ans = combination(B_cnt,A_cnt);
	}
	
	cout<<Ans<<endl;
		
	
	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <fstream>
#include <chrono>
#include <random>
#include <bitset>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) ((int)(x).size())
#define pb push_back
using ll = long long;
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}

int main(){
  int N, M; cin >> N >> M;
  vector<vector<int>> G(N);
  int a,b;
  rep(i,M){
    cin >> a >> b; a--; b--;
    G[a].pb(b); G[b].pb(a);
  }
  vector<int> ans(N);
  vector<int> d(N,-1);
  queue<int> q;
  q.push(0); d[0] = 0;
  while(!q.empty()){
    int now = q.front(); q.pop();
    rep(i,sz(G[now])){
      if(d[G[now][i]]>=0) continue;
      ans[G[now][i]] = now;
      q.push(G[now][i]);
      d[G[now][i]] = d[now]+1;
    }
  }
  cout << "Yes" << endl;
  rep(i,N){
    if(i==0) continue;
    cout << ans[i]+1 << endl;
  }
  return 0;
}


Measured memory_bytes: 10620
/* ex3_4
   key_tree */

#include <stdio.h>

// Nを1-9で割った商が1-9かつ余りが0になればよい
int main(void) {
	int N;
	scanf("%d", &N);
	int i = 1;
	// 1-9まで調べる
    while(i < 10){
		int quotient = N / i;
		int remainder = N % i;
    	//商が1-9かつ余り0
        if(quotient >= 1 && quotient <= 9 && remainder == 0){
			printf("Yes\n");
			break;/*当てはまったらwhile脱出*/
		}
		i += 1;
    }
	if(i == 10){
	    printf("No\n");
    }
	return 0;
}


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

int main(){
    int a, b; cin >> a >> b;
    int ans = 0;
    if(a == 1 && b == 1){
        ans += 400000;
    }
        if(a == 1){
            ans += 300000;
        }else if(a == 2){
            ans += 200000;
        }else if(a == 3){
            ans += 100000;
        }
        if(b == 1){
            ans += 300000;
        }else if(b == 2){
            ans += 200000;
        }else if(b == 3){
            ans += 100000;
        }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
//const long long MOD = 1000000007;
const long long MOD = 998244353;
using namespace std;
 

int main(int argc, char* argv[])
{
    int n,k;
    scanf("%d%d", &n, &k);
    k--;
    vector<int> a(n),b(n),c(n);

    int i;
    for(i=0; i<n; i++) {
        a[i]=k+i+1;
        b[i]=n*2-i+k;
        c[i]=n*2+k+1+i;
    }
    int m=(n-1)/2;
    if(m>0) {
        for(i=0; i<=(m-1)/2; i++) {
            swap(b[i],b[m-1-i]);
        }
    }
    for(i=0; i<=m/2; i++) {
        swap(b[i+m],b[m-i+m]);
    }

    vector<pair<int,int> > z;
    for(i=0; i<n; i++) {
        z.push_back(make_pair(a[i]+b[i],i));
    }
    sort(z.begin(), z.end());
    vector<int> an(n), bn(n);
    for(i=0; i<n; i++) {
        an[i]=a[z[i].second];
        bn[i]=b[z[i].second];
        if(an[i]+bn[i]>c[i]) {
            printf("-1\n"); return 0;
        }
    }

    for(i=0; i<n; i++) {
        printf("%d %d %d\n", an[i], bn[i], c[i]);
    }

    return 0;
}


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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

bool dp[101][10001];

int main()
{
    rep(i, 101) rep(j, 10001) dp[i][j] = 0;
    dp[0][0] = 1;
    int n;
    cin >> n;
    int a[n];
    rep(i, n) cin >> a[i];

    rep(i, n)
    {
        rep(j, 10000)
        {
            dp[i + 1][j] = dp[i][j];
            if (j - a[i] >= 0)
                dp[i + 1][j] = dp[i][j - a[i]] || dp[i][j];
        }
    }

    int maxv = 0;
    rep(i, 10001)
    {
        if (i % 10 == 0 || dp[n][i] == 0)
            continue;
        maxv = i;
    }

    OP(maxv);
    return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define for1(i, a, b) for (int i = (int)a; i < (int)(b); ++i)
#define rfor1(i, a, b) for (int i=(int)b-1;i>=(int)a;i--)
#define for2(i, a, b) for (int i = (int)a; i <= (int)(b); ++i)
#define for3(i, a, b) for (int i = (int)a; i < (int)(b); i=i+2)
#define for4(i, a, b) for (int i = (int)a; i <= (int)(b); i=i+2)
#define tc(t) int t; cin>>t; while(t--)
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
//==================================================================//

int main() {
#ifndef ONLINE_JUDGE
	freopen("input1.txt", "r", stdin);
	freopen("output1.txt", "w", stdout);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0);
//=================================================================//
	int n; cin >> n;
	int sum = 0;
	for2(i, 1, n) {
		sum += i;
	}
	cout << sum << "\n";
}








Measured memory_bytes: 3528
#include<stdio.h>
#include<string.h>
#include<math.h>
int main(){
	int a,b=600,c,d,e=0;
	while(scanf("%d",&a)!=EOF){
	e=0;
		c=600/a;
		for(d=1;d<c;d++){
			e=e+d*a*d*a*a;
		}
		printf("%d\n",e);
	}
			
	return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = 1e9;
const ll INF = 1e18;
const ld EPS = 1e-10;

int main(){
    int N;
    cin >> N;
    ll A[N];
    rep(i, N) cin >> A[i];
    ll ans = INF;
    ll sum = 0, num = 0;
    //+,-,+,-,...の場合
    rep(i, N){
        sum += A[i];
        if(i%2 == 0 && sum <= 0){
            num += 1-sum;
            sum = 1;
        }
        elif(i%2 == 1 && sum >= 0){
            num += 1+sum;
            sum = -1;
        }
    }
    ans = min(ans, num);
    sum = 0, num = 0;
    //-,+,-,+,...の場合
    rep(i, N){
        sum += A[i];
        if(i%2 == 1 && sum <= 0){
            num += 1-sum;
            sum = 1;
        }
        elif(i%2 == 0 && sum >= 0){
            num += 1+sum;
            sum = -1;
        }
    }
    ans = min(ans, num);
    cout << ans << endl;
}

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

int main(void){
    int n;
    int a[100];
    cin>>n;
    int i;
    for(i=0;i<n;i++){
        cin>>a[i];
    }
    for(i=n-1;i>0;i--){
        cout<<a[i]<<" ";
    }
    cout<<a[0]<<endl;
    return 0;
}


Measured memory_bytes: 3088
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.stdio, std.bitmanip;

int N;
int[][] adj;

long dfs(int n) {
    if (adj[n].length == 0)
        return 0;

    auto rets = new long[](adj[n].length);
    foreach (i, m; enumerate(adj[n]))
        rets[i] = dfs(m);
    rets.sort!"a > b"();
    foreach (i; 0..adj[n].length) {
        rets[i] += i + 1;
    }

    return rets.reduce!(max);
}

void main() {
    N = readln.chomp.to!int;
    adj = new int[][](N+1);
    foreach (i; 2..N+1) {
        auto n = readln.chomp.to!int;
        adj[n] ~= i;
    }

    dfs(1).writeln;
}


Measured memory_bytes: 20348
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
 
using namespace std;

 
const int MAX_N = int(1e6) + 10;
const long long int MOD=1e9+7;
const long long int INF=1e18;
 
typedef long long int ll;
typedef unsigned long long int llu;
 
 
 
inline ll mul(ll a,ll b){
 
    a=(a+MOD)%MOD;
    b=(b+MOD)%MOD;
    ll c=a*b;
    c=(c+MOD)%MOD;
    return c;
}
inline ll add(ll a,ll b){
    a=(a+MOD)%MOD;
    b=(b+MOD)%MOD;
    ll ans=(a+b);
    ans=(ans+MOD)%MOD;
    return ans;
}
ll power(ll a,ll b,ll c=0){
    ll ans=1;
    while(b){
        if(b&1){
            ans=mul(ans,a);
        }
        a=mul(a,a);
        b=b/2;
    }
    return ans;
}
 
  
 
 
#define all(x) (x).begin(),(x).end()




//s.reserve(32768); //updated !
//s.max_load_factor(0.25);









int spf[10000005];




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

   for(int i=2;i*i<=n;i++){
    if(spf[i]==0){
        for(int j=i*i;j<=n;j+=i){
            if(spf[j]==0){
                spf[j]=i;
            }
        }
    }
   }

   for(int i=2;i<=n;i++){
    if(spf[i]==0){
        spf[i]=i;
    }
   }

   ll ans=0;
   ans=1;

   for(int i=2;i<=n;i++){
    
    int x=i;
    ll ans22=1;
    int last=spf[x];
    int cnt=0;
    while(x!=1){
        cnt++;
        x=x/spf[x];
        if(spf[x]!=last){
            ans22=ans22*1LL*(cnt+1);
            last=spf[x];
            cnt=0;
        }
    }

    
    
    ans22=ans22*1LL*i;
    ans=ans+ans22;
   }

   cout<<ans;
   
    
}


 
    



    



    
    
    




    


    

    






    
    

    
 
    
 

 
 
    
 
 


Measured memory_bytes: 42640
#include <algorithm>
#include <cassert>
#include <climits>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

const int INF = 1e9;
const long long LINF = 1e18;

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

    if (K <= A) {
        cout << K << endl;    
    } else if (K <= A + B) {
        cout << A << endl;
    } else {
        cout << A - (K - A - B) << endl;
    }

    return 0;
}


Measured memory_bytes: 3192
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
	ios_base::sync_with_stdio(false);
	int a,b,c,d,i;
	cin>>a>>b>>c>>d;
	while(a>=0&&c>=0){
		c-=b;
		if(c<=0){
			cout<<"Yes";
			break;
		}
		a-=d;
		if(a<=0){
			cout<<"No";
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#ifdef ONLINE_JUDGE
#define LLD "%I64d"
#else
#define LLD "%lld"
#endif
#define fu(a,b,c) for(int a=b;a<=(int)c;++a)
#define fd(a,b,c) for(int a=b;a>=(int)c;--a)
#define cu(a,b,c) for(int a=b;a<(int)c;++a)
#define cd(a,b,c) for(int a=(b)-1;a>=(int)c;--a)
#define gcd(a,b) __gcd(a,b) 
#define pii pair<int,int>
#define pll pair<long long,long long>
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define pf push_front
#define MOD 1000000007 
#define MAXN 52
#define MAXH 20
#define MAXM 52
#define INF 100000000
#define ll long long
#define ull unsigned long long
#define RNG rng mt19937(time(NULL))
#define udist(a,b) uniform_int_distribution<uint32_t> distribution(a,b)
#define max3(a,b,c) max(a, max(b, c))
#define min3(a,b,c) min(a, min(b, c))
#define gmax(a,b) a = max(a, b)
#define gmin(a,b) a = min(a, b)
#define whatis(x) cerr << #x << " is " << x << endl;
#define fast_io() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define PI 3.1415926535897932384626433
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int main(){
	int H,W,h,w;
	cin >> H >> W >> h >> w;
	cout << (H*W - (w * H) - (h * W) + h * w) << '\n';
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

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

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

		Arrays.sort(V);

		double result = V[0];
		for (int i = 1; i < N; i++) {
			result = (result + V[i]) / 2;
		}

		System.out.print(result);

	}
}


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

#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)

using namespace std;

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a.at(i);
  a.insert(a.begin(), 0);
  a.push_back(0);
  int total = 0;
  for (int i = 0; i <= n; i++) {
    int diff = abs(a.at(i + 1) - a.at(i));
    total += diff;
  }
  for (int i = 1; i <= n; i++) {
    int before = a.at(i - 1);
    int cur = a.at(i);
    int after = a.at(i + 1);
    int minus = abs(cur - before) + abs(after - cur);
    int plus = abs(after - before);
    cout << total - minus + plus << endl;
  }
  return 0;
}


Measured memory_bytes: 4052
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int ans = (a+b)/2;
      if((a+b)%2 != 0)
        ans = 0;
        

        System.out.println(ans != 0?ans:"IMPOSSIBLE");
    }
}


Measured memory_bytes: 22868
#define _USE_NATH_DEFINES
#include<cstdio>
#include <iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include <string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
using namespace std;

int main() {
	int x, y, z;
	cin >> x >> y >> z;
	cout << (x-z) / (y + z) << endl;
	return 0;
} 

Measured memory_bytes: 256
#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>

#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>
#include <regex>
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define _LIBCPP_DEBUG 0
using namespace std;
int64_t MOD = 1000000007;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  if(n == 1) cout << "Hello World" << endl;
  else {
    int a, b;
    cin >> a >> b;
    cout << a + b << endl;
  }
  return 0;
}
//templete by private_yusuke1

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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long int ll;
typedef long double ld;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
    gearup;
    ll n; cin >> n;
    vl a(n), b(n);
    rep(i,n)cin>>a[i];
    rep(i,n)cin>>b[i];
    
    ll cnt = 0;
    //aに2, bに1
    rep(i,n){
        if(a[i] > b[i]){
            cnt +=a[i] - b[i]; //b[i]に１を足す
            b[i] = a[i];
        }
    }
    rep(i,n){
        if(b[i] > a[i]){
            ll cnt2 = (b[i] - a[i])/2; 
            a[i] += 2*cnt2;
            cnt -= cnt2;
            if(b[i] > a[i]){
                a[i] += 2;
                b[i] += 1;
            }
        }
    }
    cout << (cnt <= 0?"Yes":"No" ) << endl;
}


Measured memory_bytes: 3784
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

using namespace std;
typedef long long ll;

int main() {

    ll N,K,Q;
    cin >> N >> K >> Q;
    ll A[N];
    rep(i,N) A[i] = 0;
    ll a = 0;
    rep(i,Q){
        cin >> a;
        A[a-1]++;
    }
    rep(i,N){
        string out = "No";
        if(A[i]>Q-K) out = "Yes";
        cout << out << endl;
    }
    return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
constexpr int mod = 1000000007;
constexpr int M = 100010;
long long dpx[M], dpy[M];
long long sumx[M], sumy[M];


int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n; long long a, b; cin >> n >> a >> b;
    vector<long long> s(n+1);
    for (int i = 0; i < n; i++) cin >> s[i+1];
    dpx[0] = 1, dpy[0] = 1; s[0] = -1e18; // dpx[1][0], dpy[1][0]
    int lfx = 0, lfy = 0;
    for (int i = 1; i < n; i++) {
        // sum of [0, i)
        sumx[i] = (sumx[i-1] + dpx[i-1]) % mod;
        sumy[i] = (sumy[i-1] + dpy[i-1]) % mod; 
        // use s[i+1]
        int xi = upper_bound(s.begin(), s.end(), s[i+1]-a) - s.begin();
        int yi = upper_bound(s.begin(), s.end(), s[i+1]-b) - s.begin();
        // dpy[0, xi) -> dpx[i] // lastY = i
        dpx[i] = sumy[max(min(xi, i), lfy)] - sumy[lfy];
        // dpx[0, yi) -> dpy[i]
        dpy[i] = sumx[max(min(yi, i), lfx)] - sumx[lfx];
        if (dpx[i] < 0) dpx[i] += mod;
        if (dpy[i] < 0) dpy[i] += mod;
        // dpx[0, i) -> 0
        if (s[i+1] - s[i] < a) lfx = i;
        // dpy[0, i) -> 0
        if (s[i+1] - s[i] < b) lfy = i;
        //cout << i << "-" << s[i] << " : " << dpx[i] << " " << dpy[i] << " // " << xi << " " << yi << " // " << lfx << " " << lfy << "\n";
    }
    long long ans = 0;
    for (int i = 0; i < n; i++) {
        if (lfx <= i) ans += dpx[i];
        if (lfy <= i) ans += dpy[i];
    }
    cout << ans % mod << "\n";
    return 0;
}

Measured memory_bytes: 4224
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner((System.in));
        int n = sc.nextInt();
        int[] w = new int[n];
        int sum1 = 0, sum2 = 0, min = 0;
        
        for (int i = 0; i < n; i++) {
            w[i] = sc.nextInt();
            sum1 += w[i];
        }

        min = sum1;
for (int i = 0; i < n; i++) {
    sum1 -= w[i];
    sum2 += w[i];
        if (Math.abs(sum1 - sum2) < min) {
            min = Math.abs(sum1 - sum2);
        }
    }
        System.out.println(min);
        

		sc.close();
	}
}


Measured memory_bytes: 23124
#include<bits/stdc++.h>
#define LL long long
using namespace std;
const int N=100005,inf=2e9;
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int n,a[N],b[N],c[N];
LL ans,g[N];
int main()
{
	n=read();
	for(int i=1;i<=n;i++) a[i]=read(); sort(a+1,a+n+1); 
	for(int i=1;i<=n;i++) b[i]=read(); sort(b+1,b+n+1); b[n+1]=inf;
	for(int i=1;i<=n;i++) c[i]=read(); sort(c+1,c+n+1); c[n+1]=inf;
	for(int l=1,r=1;l<=n;l++){
		while(r<=n&&c[r]<=b[l]) r++;
		g[l]=n-r+1;
	}
//	for(int i=1;i<=n;i++) cout<<g[i]<<" "; cout<<endl; 
	for(int i=n;i>=0;i--) g[i]+=g[i+1];
	for(int l=1,r=1;l<=n;l++){
		while(r<=n&&b[r]<=a[l]) r++;
		ans+=g[r];
	}
	printf("%lld\n",ans);
	return 0;
}


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

typedef long long ll;
#define repd(i,a,b) for (ll i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)

ll mod=1e9+7;

using namespace std;


ll inputValue(){
	ll a;
	cin >> a;
	return a;
};

void inputArray(int * p, ll a){
	rep(i, a){
		cin >> p[i];
	}
};

template<typename T>
void inputVector(vector<T>& p, ll a){
	rep(i, a){
		T input;
		cin >> input;
		p.emplace_back(input);
	}
}


template <typename T>
void output(T a) {
	cout << a << "\n";
}



int main(int argc, const char * argv[]) {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
  ll n,m;
  cin >> n >> m ;
  cout << (n+m) * (n+m-1) / 2 - n*m << endl;

}


Measured memory_bytes: 256
<?php

class In {

	private $buf = [];
	private $count = 0;
	private $pointer = 0;

	public function nextLine() {
		$ret = '';
		if($this->hasNext()){
			while($this->hasNext()){
				$ret .= $this->next();
			}
		}else{
			$ret = trim(fgets(STDIN));
		}

		return $ret;
	}

	public function next() {
		if(!$this->hasNext()) {
			$str = trim(fgets(STDIN));
			$this->buf = explode(' ',$str);
			$this->count = count($this->buf);
			$this->pointer = 0;
		}

		return $this->buf[$this->pointer++];
	}

	public function hasNext() {
		return $this->pointer < $this->count;
	}

	public function nextInt() {
		return (int)$this->next();
	}

	public function nextDouble() {
		return (double)$this->next();
	}
}

class Out {
	public function println($str = '') {
		echo $str . PHP_EOL;
	}
}

$in = new In();
$out = new Out();

$s = $in->next();

$len = strlen($s);

$out->println($s[0] . ($len-2) . $s[$len-1]);

?>


Measured memory_bytes: 4604
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define sqr(x) ((x)*(x))
#define mp make_pair
#define uint unsigned
#define PI pair<int,int>
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline int read(){
	int x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(int a){
    if(a<0){
    	a=-a; putchar('-');
	}
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(int a){
    if(a<0){
    	a=-a; putchar('-');
	}
	write(a); puts("");
}
inline int rnd(int x){
	return rand()%x;
}
inline ull rnd(){
	return ((ull)rand()<<30^rand())<<4|rand()%4;
}
const int N=505;
int h,w;
char ch[N];
char f[N][N],g[N][N];
int main(){
	h=read(); w=read();
	for(int i=1;i<=h;i++){f[i][1]=1; g[i][w]=1;}
	for(int i=1;i<=h;i++){
		if(i&1)for(int j=2;j<w;j++)f[i][j]=1; else for(int j=2;j<w;j++)g[i][j]=1;
	}
	for(int i=1;i<=h;i++){
		scanf("%s",ch+1);
		for(int j=1;j<=w;j++)if(ch[j]=='#')f[i][j]=g[i][j]=1;
	}
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++)putchar(f[i][j]?'#':'.'); puts("");
	}
	puts("");
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++)putchar(g[i][j]?'#':'.'); puts("");
	}
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
typedef pair< int , int > Pi;
 
int w, h, n, x1[1000], yy1[1000], x2[1000], y2[1000];
 
int main(){
 
  while(scanf("%d %d", &w, &h), w){
 
    cin >> n;
    vector< int > numx, numy;
    for(int i = 0; i < n; i++){
      scanf("%d %d %d %d", &x1[i], &yy1[i], &x2[i], &y2[i]);
      for(int j = -1; j <= 1; j++){
        if(x1[i] + j >= 0 && x1[i] + j < w) numx.push_back(x1[i] + j);
        if(x2[i] + j >= 0 && x2[i] + j < w) numx.push_back(x2[i] + j);
        if(yy1[i] + j >= 0 && yy1[i] + j < h) numy.push_back(yy1[i] + j);
        if(y2[i] + j >= 0 && y2[i] + j < h) numy.push_back(y2[i] + j);
      }
    }
    sort( numx.begin(), numx.end());
    sort( numy.begin(), numy.end());
    numx.erase( unique(numx.begin(), numx.end()), numx.end());
    numy.erase( unique(numy.begin(), numy.end()), numy.end());
   
    vector< vector< bool > > mas( numy.size(), vector< bool >( numx.size(), false));
    for(int i = 0; i < n; i++){
      int xx1 = lower_bound( numx.begin(), numx.end(), x1[i]) - numx.begin();
      int xx2 = lower_bound( numx.begin(), numx.end(), x2[i]) - numx.begin();
      int yyy1 = lower_bound( numy.begin(), numy.end(), yy1[i]) - numy.begin();
      int yy2 = lower_bound( numy.begin(), numy.end(), y2[i]) - numy.begin();
      for(int j = yyy1; j < yy2; j++){
        for(int k = xx1; k < xx2; k++){
          mas[j][k] = true;
        }
      }    
    }
 
    int ret = 0;
    const static signed dy[] = { 1, 0, -1, 0}, dx[] = { 0, 1, 0, -1};
    queue< Pi > que;
    for(int i = 0; i < numy.size(); i++){
      for(int j = 0; j < numx.size(); j++){
        if(mas[i][j]) continue;
        mas[i][j] = true;
        ret++;
        que.push(make_pair( i, j));
        while(!que.empty()){
          Pi p = que.front(); que.pop();
          for(int i = 0; i < 4; i++){
            int ny = p.first + dy[i], nx = p.second + dx[i];
            if(ny < 0 || ny >= numy.size() || nx < 0 || nx >= numx.size()) continue;
            if(mas[ny][nx]) continue;
            mas[ny][nx] = true;
            que.push(make_pair( ny, nx));
          }
        }
      }
    }
    printf("%d\n", ret);
  }
}

Measured memory_bytes: 1532
require 'thread'

nq=gets.split(' ').map(&:to_i)
n=nq[0]
q=nq[1]
r=Queue.new
n.times{
  p=gets.split(' ').map(&:to_s)
  p[1]=p[1].to_i
  r.push(p)
}
total=0
while !r.empty? do
  p=r.pop
  if p[1]>q then
     total+=q
     p[1]-=q
     r.push(p)
  else
     total+=p[1]
     printf("%s %d\n",p[0],total)
  end
end

Measured memory_bytes: 14608
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
namespace mp = boost::multiprecision;
// mp::cpp_int
// mp::cpp_dec_float_100
#define rep(i,s,n) for(ll i = (s); i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()



int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  ll n;
  cin >> n;
  map<string, int> m;
  rep(i, 0, n) {
    string s;
    cin >> s;
    m[s]++;
  }
  
 // cout <<  << "\n";
  
  cout << m.size() << "\n";
  
  //cout << fixed << setprecision(15) << n << "\n";

}

Measured memory_bytes: 19240
/*  ex3_4
    L40S38  */

#include<stdio.h>
int main(void){
    int n, quotient, remainder;
    scanf("%d", &n);
    for(int i=1;i<10;i++){
        remainder = n%i;
        quotient = n/i;
        if(remainder==0 && quotient<=9 && quotient>=1){
            //remainder=0つまりiで割り切れてかつ商が1以上9以下の場合
            printf("Yes");
            return 0;
        }
    }
    printf("No");
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

int S[100000];

int main(void) {

    int n;
    cin >> n;

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

    int q, total = 0;
    cin >> q;
    for (int i = 0; i < q; ++i) {
        int t;
        cin >> t;
        int left = 0, right = n - 1, mid = 0;
        while (left <= right) {     // '<' ?????¨?????¨??§?????????
            mid = (left + right) / 2;
            if (t > S[mid]) {
                left = mid + 1;
            }
            else if (t < S[mid]) {
                right = mid - 1;
            }
            else {
                ++total;
                break;
            }
        }
    }

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

    return 0;
}

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

struct node{
  struct node *ri;
  struct node *le;
  struct node *pa;
  int key;
};
typedef struct node * Node;

Node ne;

Node treeMinimum(Node );
Node treeSearch(Node,int );
Node treeSuccessor(Node );
void insert(int);
void inorder(Node);
void preorder(Node);
void treeDelete(Node);
void Transplant(Node,Node);

Node treeMinimum(Node x){
  
  while(x->le != NULL)
    x = x->le;
  
  return x;
    
}
 
Node treeSearch(Node u, int k){
 
  if(u == NULL || k == u->key)
    return u;
    
  if(k < u->key)
    return treeSearch(u->le, k);
    
  else
    return treeSearch(u->ri, k);
    
}
 
Node treeSuccessor(Node x){
    
  Node y;
  
  if(x->ri != NULL)
    return treeMinimum(x->ri);
  
  y = x->pa;
  
  while(y != NULL && x == y->ri){
    x = y;
    y = y->pa;
  }
  
  return y;
  
}
 
void insert(int k){
  Node y = NULL;
  Node x = ne;
  Node z;
  
  z = malloc(sizeof(struct node));
  z->key = k;
  z->le = NULL;
  z->ri = NULL;
  
  while(x != NULL){
    y = x;
    if(z->key < x->key)
      x = x->le;
  
    else
      x = x->ri;
  }
    
  z->pa = y;
  
  if(y == NULL)
    ne = z;
  
  else if(z->key < y->key)
    y->le = z;
  
  else
    y->ri = z;
}
 
void treeDelete(Node z){
  Node y;
  if(z->le == NULL)
    Transplant(z, z->ri);
 
  else if(z->ri == NULL)
    Transplant(z, z->le);
 
  else{
    y = treeMinimum(z->ri);
    if(y->pa != z){
      Transplant(y, y->ri);
      y->ri = z->ri;
      y->ri->pa = y;
    }
 
    Transplant(z,y);
    y->le = z->le;
    y->le->pa = y;
  }
}
 
void Transplant(Node u, Node v){
  if(u->pa == NULL)
    ne = v;
 
  else if(u == u->pa->le)
    u->pa->le = v;
 
  else
    u->pa->ri = v;
 
  if(v != NULL)
    v->pa = u->pa;
}
 
void inorder(Node u){
  if(u != NULL){
    inorder(u->le);
    printf(" %d",u->key);
    inorder(u->ri);
  }
}
 
void preorder(Node u){
  if(u != NULL){
    printf(" %d",u->key);
    preorder(u->le);
    preorder(u->ri);
  }
}
 
int main(int argc, char *argv[]){
  int n, i, x;
  char com[20];
  scanf("%d", &n);
 
  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(ne, x);
      if ( t != NULL )
    printf("yes\n");
      else
    printf("no\n");
    }
     
    else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    }
    else if ( com[0] == 'p' ){
      inorder(ne);
      printf("\n");
      preorder(ne);
      printf("\n");
    }
    else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(ne, x));
    }
  }
 
  return 0;
}

Measured memory_bytes: 19364
// C - Cat Snuke and a Voyage
#include <bits/stdc++.h>
using namespace std;

int main(){
	int N,M; cin>>N>>M;
	string ans = "IMPOSSIBLE";
	vector<bool> P(N);
	while(M--){
		int a,b; cin>>a>>b;
		if(a==1){
			if(P[b-1]){
				ans = "POSSIBLE";
				break;
			}
			P[b-1] = true;
		}
		if(b==N){
			if(P[a-1]){
				ans = "POSSIBLE";
				break;
			}
			P[a-1] = true;
		}
	}
	cout<< ans <<endl;
}

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

namespace Contest
{
    class Program
    {
        static void Main()
        {
            int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int n = input[0];
            int ticket = input[1];
            long[] a = Console.ReadLine().Split().Select(long.Parse).ToArray();
            Array.Sort(a);
            Array.Reverse(a);

            while (ticket > 0)
            {
                a[0] /= 2;
                ticket--;
                if (ticket == 0) break;

                for(int i = 1; i < n; i++)
                {
                    if(a[0] > a[i])
                    {
                        Array.Sort(a);
                        Array.Reverse(a);
                        break;
                    }
                    a[i] /= 2;
                    ticket--;
                    if (ticket == 0) break;
                }
            }
            Console.WriteLine(a.Sum());
        }
    }
}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define fs first
#define fst first
#define sc second
#define snd second
#define sz(X) (int)(X).size()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define fornr(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define forab(i, a, b) for(int i = int(a); i < int(b); i++)
#define forabr(i, a, b) for(int i = int(b)-1; i >= int(a); i--)
#define all(X) X.begin(), X.end()

typedef long long ll;
typedef pair<int, int> pii;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef double dbl;
typedef long double ld;
typedef vector<int> vi;


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin >> s;
    if (s == "AAA" || s == "BBB") cout << "No\n";
    else cout << "Yes\n";
    return 0;
}

Measured memory_bytes: 256
K, N = [int(s) for s in input().split()]
A = [int(s) for s in input().split()]
max_diff = 0
for i in range(N):
    diff = (A[i] - A[(i-1)%N]) % K
    if diff > max_diff:
        max_diff = diff
print(K - max_diff)

Measured memory_bytes: 24908
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <string>
#include <cctype>
#include <map>

using namespace std;

const int mod = 1000000007;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
#define ll long long

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

    cout << t+s << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
	int stu[5];
	int ave = 0;

	for (int i = 0; i < 5; i++){
		cin >> stu[i];
		if (stu[i] < 40){
			stu[i] = 40;
		}
		ave += stu[i];
		if (i == 4){
			cout << ave / 5 << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 3068
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define first_more_idx(ve, num) upper_bound(all(ve), num)-ve.begin() // idx = first_more_idx(ve,num); if(idx = ve.size()) , then not exist
#define first_lessequal_idx(ve, num) lower_bound(all(ve), num)-ve.begin()
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > >
#define pq_pair_ts priority_queue <pair<ll,ll> > // only sort first param
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}
ll power(ll x, ll n){if(n == 0) return 1;return  (n%2)? x*power(x, n-1)%MOD : power(x*x%MOD, n/2);}

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

    ll a, b ; cin >> a >> b ;
    if((a+b) % 2)cout << "IMPOSSIBLE" << endl;
    else cout << (a+b)/2 << endl;

    //cout << fixed << setprecision(16) << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <tuple>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>
#include <random>
#include <cstring>

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

using namespace std;
using ll = long long;

const ll mod = 1000000007;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=false;

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

int main(){
  ll a, b, x;
  cin >> a >> b >> x;
  if(x < a){
    cout << x % mod << endl;;
    return 0;
  }
  ll n = ((x - a) / (a - b) + 1);
  n %= mod;
  a %= mod;
  b %= mod;
  x %= mod;
  cout << (x + n * b % mod) % mod << endl;
  return 0;
}



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

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

  ll A[N];
  rep(i,0,N-1) cin >> A[i];

  int i=0, j=N-1;
  ll l=0, r=0;
  while (1) {
    if (l <= r) {
      l += A[i];
      i++;
    } else {
      r += A[j];
      j--;
    }
    if (j < i) break;
  }

  cout << abs(l - r) << endl;
  return 0;
}


Measured memory_bytes: 5156
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
using namespace std;
#define rep(i,a,n) for(int i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define sort(s) sort(s.begin(),s.end())
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<int>>
constexpr auto mod = 1000000007;


//2のn乗を求めるよ！！！
int ni(int n) {
	if (n == 0)return 1;
	int x = ni(n / 2);
	x *= x;
	if (n % 2 == 1)x *= 2;
	return x;
}

//フィボナッチ数列のx番目を求めるよ！
int f(int x, vector<int> s) {
	if (x == 0)return 0;
	if (x == 1)return 1;
	if (s[x] != 0)return s[x];
	s[x] = f(x - 1, s) + f(x - 2, s);
	return s[x];
}

//aとｂの最大公約数を求めるよ！
llint gcd(llint a, llint b) {
	if (a < b)swap(a, b);
	if (b == 0)return a;
	return gcd(b, a % b);
}



// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

// mod. m での a の逆元 a^{-1} を計算するよ！
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}


//aCbをmod.mで割った余りを求める
ll int c(ll int a, ll int b, ll int m) {
	ll int ans = 1;
	for (ll int i = 0; i < b; i++) {
		ans *= a - i;
		ans %= m;
	}
	for (ll int i = 1; i <= b; i++) {
		ans *= modinv(i, m);
		ans %= m;
	}
	return ans;
}

//m進数のn桁を全列挙やで
void dfs(int m, int n) {

	stack<string> st;
	st.push("");
	while (!st.empty()) {
		string now = st.top();
		st.pop();
		if (now.size() == n) {
			cout << now << endl;
		}
		else {
			for (int i = m - 1; i >= 0; i--) {
				string next = now + to_string(i);
				st.push(next);
			}
		}
	}
}
void press(string& v) { v.erase(unique((v).begin(), (v).end()), v.end()); }

int main() {
	int a;
	cin >> a;
	int ans = (a+1)/2;
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 764
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
  long long n,m,t,i,sq,res=0;
  cin >> n;
  if(n==2){
    cout << "1" << endl;
    return 0;
  }
  sq=(long long)floor(sqrt(n)+1);
  for(i=2;i<=sq;i++){
    m=n;
    while(m%i==0)
      m/=i;
    if(m%i==1)
      res++;
    if(n%i==1){
      t=(n-1)/i;
      if(t>sq)
        res++;
    }
  }
  if(n-1>sq) res++;
  if(n>sq) res++;
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 256
let cnt = ref 0

let insertion_sort (a : int array) n g =
  for i = g to n - 1 do
    let v = a.(i) in
    let j = ref (i - g) in
    while !j >= 0 && a.(!j) > v do
      a.(!j+g) <- a.(!j);
      j := !j - g;
      incr cnt;
    done;
    a.(!j+g) <- v;
  done

let generate_g n =
  let rec doit i g acc =
    if g > n then acc
    else doit (i + 1) (int_of_float (4.**(float_of_int i) +. 3.*.2.**(float_of_int (i - 1)) +. 1.)) (g :: acc) in
  doit 1 1 []

let shell_sort (a : int array) n =
  cnt := 0;
  let g = generate_g n in
  List.iter (fun g -> insertion_sort a n g) g;
  g

let () =
  let n = read_int () in
  let a = Array.init n (fun _ -> read_int ()) in
  let g = shell_sort a n in
  Printf.printf "%d\n" (List.length g);
  List.iteri (fun i n -> if i <> 0 then print_string " "; print_int n) g;
  print_newline ();
  Printf.printf "%d\n" !cnt;
  for i = 0 to n - 1 do
    Printf.printf "%d\n" a.(i)
  done

Measured memory_bytes: 12588
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define M 1000000007
#define vll vector<ll>
#define pll pair<ll, ll>
#define lb lower_bound
#define ub upper_bound
#define all(x) (x).begin(), (x).end()
ll a[1000000], dp[105][100001] = {0};
ll weights[1000000], values[1000000];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif

  ll t, n, w, i, j, c, k, m, x, y, f, ans;
  cin >> n >> w;
  for (i = 1; i <= n; i++) {
    cin >> weights[i] >> values[i];
  }
  for (i = 1; i <= n; i++) {
    for (j = 0; j <= w; j++) {
      dp[i][j] = max(dp[i][j], dp[i - 1][j]);
      if (j >= weights[i])
        dp[i][j] = max(dp[i][j], values[i] + dp[i - 1][j - weights[i]]);
    }
  }
  cout << dp[n][w];
  return 0;
}


Measured memory_bytes: 81708
#include <stdio.h>

int main() {
  int i, j, n, minj, tmp;
  scanf("%d",&n);
  int A[n];
  for(i=0; i<n; i++)
    scanf("%d", &A[i]);
  int cnt=0;
  for(i=0; i<n; i++) {
    minj=i;
    for(j=i+1; j<n; j++) {
      if(A[j]<A[minj]) minj=j;
    }
    if(A[i]>A[minj]) {
      tmp=A[i];
      A[i]=A[minj];
      A[minj]=tmp;
      cnt++;
    }
  }
  for(i=0; i<n; i++) {
    if(i) printf(" ");

    printf("%d",A[i]);
  }
  printf("\n%d\n",cnt);
  return 0;
}



Measured memory_bytes: 2104