akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <random>
#include <set>
#include <stack>
#include <time.h>

//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define SORTR(x) sort(x.begin(),x.end(),greater<vector<int>>())

#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple

using namespace std;
using ll = long long;
typedef std::pair<int, int> pii;
typedef std::pair<int, double> pid;
typedef std::vector<int> vi;
typedef std::vector<pii> vii;

#define PI 3.14159265358979323846264338327950L
const int mod = 1e9+7;



void solve(){

    int n;
    cin >> n;
    ll dp[n+1][4];
    memset(dp,0,sizeof dp);
    
    dp[0][0] = 1;
    for(int i = 1; i <= n; i++){
        for(int t = 0; t < 4; t++){
            // none, 0, 9, {0,9}
            if (t==0){
                dp[i][0] = dp[i-1][0]*8;
                dp[i][1] += dp[i-1][0];
                dp[i][2] += dp[i-1][0];
            }
            if (t==1){
                dp[i][1] += dp[i-1][1]*9;
                dp[i][3] += dp[i-1][1];
            }
            if (t==2){
                dp[i][2] += dp[i-1][2]*9;
                dp[i][3] += dp[i-1][2];
            }
            if (t==3){
                dp[i][3] += dp[i-1][3]*10;
            }
        }
        rep(t,4){
            dp[i][t] %= mod;
        }
    }
    

    cout << dp[n][3];
    
}




int main() {
    int T;
    //if (0==0) cin >> T;  
    //else T = 1;
    T = 1;
    while (T--) {
        solve();
        cout << endl;
    }
}




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

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int[] d = new int[n];
		for(int i = 0; i < n; i++) {
			d[i] = sc.nextInt();
		}
		Arrays.sort(d);
		
		if(d[n / 2] == d[(n / 2) - 1])
			System.out.println(0);
		else
			System.out.println(d[n / 2] - d[(n / 2) - 1]);
		
	}

}


Measured memory_bytes: 52432
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cmath>

int main() {
	int N, B[100];
	std::scanf("%d", &N);
	for (int i = 0; i < N - 1; ++i) {
		std::scanf("%d", B + i);
	}

	int result = 0;
	for (int i = 0; i < N; ++i) {
		if (i == 0) {
			result += B[i];
		} else if (i == N - 1) {
			result += B[i - 1];
		} else {
			result += std::min(B[i - 1], B[i]);
		}
	}

	std::printf("%d", result);
}

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

int main() {
    int N, Y; cin >> N >> Y;
    bool can = false;
    vector<int> ans(3);
    for (int i = 0; i <= N; i++) {
        for (int j = i; j <= N; j++) {
            int man = i;
            int gosen = j-i;
            int sen = N-j;
            int money = 10000*man+5000*gosen+1000*sen;
            if (money == Y) {
                can = true;
                ans[0] = man; ans[1] = gosen; ans[2] = sen;
                break;
            }
        }
    }

    if (!can) cout << -1 << " " << -1 << " " << -1 << endl;
    else {
        for (int i = 0; i < 3; i++) {
            cout << ans[i] << " ";
        }
        cout << endl;
    }
}

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

int main()
{
  
  int N,count=0;
  bool judge;
  
  scanf("%d",&N);
  
  int H[N];
  for(int i=0;i<N;i++){
    scanf("%d",&H[i]);
  }
  
  for(int i1=0;i1<N;i1++){
    judge=true;
    for(int i2=0;i2<i1;i2++){
      if(H[i1]<H[i2]){
        judge=false;
      }
    }
    if(judge==true){
      count++;
    }
  }
  
  printf("%d\n",count);
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
 
 int a,b,c,d;
 char ch[1000001];
 cin>>ch;
 
 d=strlen(ch);
 
 a=(d-1)/2;
 b=(d+3)/2;
 int x=0,y=0,z=0;
 for(int i=0,j=d-1;i<d,j>=0;i++,j--)
 {
   
   if(ch[i]!=ch[j])
   {
     x++;
     
   }
   
 }
 
 for(int i=0,j=a-1;i<a,j>=0;i++,j--)
 {
   
   if(ch[i]!=ch[j])
   {
     y++;
     
   }
   
 }
 
 for(int i=b-1,j=d-1;i<d,j>=b;i++,j--)
 {
   
   if(ch[i]!=ch[j])
   {
     z++;
     
   }
   
   
 }
 
 if((x!=0)||(y!=0)||(z!=0))
 {
   cout<<"No"<<endl;
 }
 else
 {
   cout<<"Yes"<<endl;
 }
 
 
 return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
int main()
{
	int n,a;
	float b;
	while(~scanf("%d", &n))
	{
		a=ceil(n/1.08);
		if(floor(a*1.08)==n)
			printf("%d\n", a);
		else 
			printf(":(\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> PP;
//#define MOD 1000000007
#define MOD 998244353
#define INF 1145141919810893364
//#define INF 810114514
#define PI 3.141592653589
#define setdouble setprecision
#define REP(i,n) for(ll i=0;i<(n);++i)
#define OREP(i,n) for(ll i=1;i<=(n);++i)
#define RREP(i,n) for(ll i=(n)-1;i>=0;--i)
#define GOODBYE do { cout << "0" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl
#define debug false
#define debug2 false


int main(void){
    ll N,Q,a,b;
    vector<ll> A,B,C;
    cin >> N;
    REP(i,N){
        cin >> a;
        A.push_back(a);
    }
    cin >> Q;
    REP(i,Q){
        cin >> a >> b;
        B.push_back(a);
        C.push_back(b);
    }
    
    ll Ans=0;
    REP(i,N){
        Ans+=A[i];
    }
    
    vector<ll> D(114514,0);
    REP(i,N){
        D[A[i]]++;
    }
    
    REP(i,Q){
        Ans+=D[B[i]]*(C[i]-B[i]);
        D[C[i]]+=D[B[i]];
        D[B[i]]=0;
        cout << Ans << endl;
    }
    
    return 0;
}



Measured memory_bytes: 6596
import java.util.*;
import java.util.Map.Entry;
 
class Main {
	 static int mod =  (int) (Math.pow(10,9)+7);
//	 static int mod = 998244353;
   public static void main(String[] args) {
	   
       Scanner sc = new Scanner(System.in);
       int N = sc.nextInt();
       
       long[] a = new long[(int)N];
       for (int i=0 ; i<N; i++) {
           a[i] = sc.nextLong();
       }
       
//       String S = sc.next();
//       String T = sc.next();
//       char[] s = S.toCharArray();
//       char[] t = T.toCharArray();
       Arrays.sort(a);
       int cnt=0;
       while(a[cnt]-a[N-1]/2<0) {
    	   cnt++;
       }
       if(cnt==0) {
    	   System.out.println(a[N-1] + " " + a[0]);
    	   return;
       }
       if(cnt==N-1) {
    	   System.out.println(a[N-1] + " " + a[N-2]);
    	   return;
       }
       if(Math.abs(a[cnt-1]-a[N-1]/2.0)<Math.abs(a[cnt]-a[N-1]/2.0)) {
    	   System.out.println(a[N-1] + " " + a[cnt-1]);
    	   return;    	   
       } else {
    	   System.out.println(a[N-1] + " " + a[cnt]);
    	   return;    	       	   
       }

       
   }


}

Measured memory_bytes: 50496
#include<vector>
#include<map>
#include<algorithm>
#include<set>
#include<iostream>
#include<string>
#include<set>
#include<queue>
#include<random>

using namespace std;

#pragma GCC optimize("Ofast")
#pragma GCC optimize("fast-math")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")

#define pb push_back
#define ld long double
#define int long long
#define mp make_pair

mt19937 rnd(51);

int32_t main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n, a, b, c;
	cin >> n >> a >> b >> c;
	vector<string> v(n);
	map<char, int> mp;
	mp['A'] = a, mp['B'] = b, mp['C'] = c;
	for (int i = 0; i < n; i++) {
		cin >> v[i];
	}
	if (a + b + c == 0) {
		cout << "No";
		return 0;
	}
	else if (a + b + c == 1) {
		vector<char> ans;
		for (int j = 0; j < n; j++) {
			if (mp[v[j][0]] == 0 && mp[v[j][1]] == 0) {
				cout << "No";
				return 0;
			}
			else {
				if (mp[v[j][0]]) ans.pb(v[j][1]);
				if (mp[v[j][1]]) ans.pb(v[j][0]);
				swap(mp[v[j][0]], mp[v[j][1]]);
			}
		}
		cout << "Yes\n";
		for (auto to : ans) {
			cout << to << endl;
		}
	}
	else {
		if (!mp[v[0][0]] && !mp[v[0][1]]) {
			cout << "No";
			return 0;
		}
		else {
			cout << "Yes\n";
		}
		vector<char> ans;
		for (int j = 0; j < n; j++) {
			if (mp[v[j][0]] == 0) {
				mp[v[j][1]]--;
				mp[v[j][0]]++;
				ans.pb(v[j][0]);
			}
			else if (mp[v[j][1]] == 0) {
				mp[v[j][1]]++;
				mp[v[j][0]]--;
				ans.pb(v[j][1]);
			}
			else if (mp[v[j][0]] + mp[v[j][1]] > 2) {
				if (mp[v[j][0]] > mp[v[j][1]]) {
					mp[v[j][0]]--;
					mp[v[j][1]]++;
					ans.pb(v[j][1]);
				}
				else {
					mp[v[j][0]]++;
					mp[v[j][1]]--;
					ans.pb(v[j][0]);
				}
			}
			else {
				if (j == n - 1) {
					ans.pb(v[j][0]);
				}
				else {
					if (v[j] == v[j + 1]) {
						mp[v[j][0]]++;
						mp[v[j][1]]--;
						ans.pb(v[j][0]);
					}
					else {
						if (v[j] == "AB") {
							if (v[j + 1] == "BC") {
								ans.pb('B');
								mp['B']++;
								mp['A']--;
							}
							else {
								ans.pb('A');
								mp['B']--;
								mp['A']++;
							}
						}
						else if (v[j] == "BC") {
							if (v[j + 1] == "AC") {
								ans.pb('C');
								mp['C']++;
								mp['B']--;
							}
							else {
								ans.pb('B');
								mp['B']++;
								mp['C']--;
							}
						}
						else if (v[j] == "AC") {
							if (v[j + 1] == "BC") {
								ans.pb('C');
								mp['C']++;
								mp['A']--;
							}
							else {
								ans.pb('A');
								mp['A']++;
								mp['C']--;
							}
						}
					}
				}
			}
		}
		for (auto to : ans) {
			cout << to << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 6716
from sys  import stdin,stdout

st=lambda:list(stdin.readline().strip())
li=lambda:list(map(int,stdin.readline().split()))
mp=lambda:map(int,stdin.readline().split())
inp=lambda:int(stdin.readline())
pr=lambda n: stdout.write(str(n)+"\n")

mod=1000000007
INF=float('inf')

def knapSack(W, wt, val, n): 
    K = [[0 for x in range(W + 1)] for x in range(n + 1)] 
  
    # Build table K[][] in bottom up manner 
    for i in range(n + 1): 
        for w in range(W + 1): 
            if i == 0 or w == 0: 
                K[i][w] = 0
            elif wt[i-1] <= w: 
                K[i][w] = max(val[i-1]  + K[i-1][w-wt[i-1]],  K[i-1][w]) 
            else: 
                K[i][w] = K[i-1][w] 
  
    return K[n][W] 
    

x=[]
y=[]
n,w=mp()
for i in range(n):
    a,b=mp()
    x.append(a)
    y.append(b)

print(knapSack(w,x,y,n))



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

int il[105][105] = { 0 };
int w, h;
int dx[2][6] = { {0,1,1,1,0,-1} ,{ -1,0,1,0,-1,-1 } }, dy[] = { -1,-1,0,1,1,0 };
int res = 0;

void dfs(int nowy, int nowx) {
	il[nowy][nowx] = -1;
	for (int i = 0; i < 6; i++) {
		int ny = nowy + dy[i];
		int nx = 0;
		if (nowy % 2) nx = nowx + dx[0][i];
		else nx = nowx + dx[1][i];
		if (0 <= ny&&ny <= h+1 && 0 <= nx&&nx <= w+1) {
			if (il[ny][nx] == 1) res++;
			if (il[ny][nx] == 0) dfs(ny, nx);
		}
	}
	return;
}

int main() {
	cin >> w >> h;
	for (int i = 1; i <= h; i++) {
		for (int j = 1; j <= w; j++) {
			cin >> il[i][j];
		}
	}
	dfs(0, 0);
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 3384
#include<iostream>
#include<set>
#include<queue>
#include<vector>
#include<map>
#include<stack>
#include<algorithm>
using namespace std;
long long inf=100000000000007;
#define int long long
typedef pair<int,int>  P;
string alph("abcdefghijklmnopqrstuvwxyz");
signed main(){
    int n;cin>>n;
    int num[1005]={};
    for(int i=2;i<=n;i++){
        int h=i;
        for(int j=2;j*j<=i;j++){
            while(h%j==0){
              num[j]++;
                h/=j;
            }
        }
        num[h]++;
    }
    int count=1;
    for(int i=2;i<=1000;i++){
        count*=(num[i]+1);
        count%=1000000007;
    }
    cout<<count<<endl;
    return 0;
}

Measured memory_bytes: 256
H,W = map(int,input().split())
C = [list(map(int,input().split())) for _ in range(10)]
A = [list(map(int,input().split())) for _ in range(H)]

for k in range(10):
    for i in range(10):
        for j in range(10):
            C[i][j] = min(C[i][j], C[i][k]+C[k][j])

ans = 0
for aa in A:
    for a in aa:
        if a >= 0: ans += C[a][1]
print(ans)

Measured memory_bytes: 3444
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const double EPS = 1e-9;


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

  string s;
  cin>>s;
  int a,b,c,d;
  a = s[0] - '0';
  b = s[1] - '0';
  c = s[2] - '0';
  d = s[3] - '0';
  int sum1 = a;
  int sum2,sum3;

  string op[3];
  
  for(int i = 0; i < 2; i++)
  {
    if(i == 0) {
      sum1 += b;
      op[0] =  "+";
    } else {
      sum1 -= b;
      op[0] = "-";
    }
    
    for(int j = 0; j < 2; j++)
    {
      if(j == 0) {
        sum2 = sum1 + c;
        op[1] = "+";
      } else {
        sum2 = sum1 - c;
        op[1] = "-";
      }
      
      for(int k = 0; k < 2; k++)
      {
        if(k == 0) {
          sum3 = sum2 + d;
          op[2] = "+";
        } else {
          sum3 = sum2 - d;
          op[2] = "-";
        }
        if(sum3 == 7) {
          cout << s[0] + op[0] + s[1] + op[1] + s[2] + op[2] + s[3] + "=7" << endl;
          return 0;
        }
        sum3 = 0;
        op[2] = "";
      }
      sum2 = 0;
      op[1] = "";
    }
    sum1 = a;
    op[0] = "";
  }
  
  
  return 0;
}


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

main()
{
    int a[3]={-1,-1,-1};
    int n; cin>>n;
    int m; cin>>m;
    for(;m--;)
    {
        int s,c; cin>>s>>c;
        --s;
        if(~a[s] and a[s]!=c)
        {
            cout << -1 << "\n";
            return 0;
        }
        a[s]=c;
    }
    int ans=0;
    for(int i=0;i<n;++i)
    {
        ans*=10;
        int now=a[i];
        if(!~now)
        {
            if(n>1 and !i) now=1;
            else now=0;
        }
        ans+=now;
    }
    if(n>1 and a[0]==0)
    {
        cout << -1 << "\n";
    }
    else cout << ans << "\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <cassert>
#include <climits>

using namespace std;

//typedef __int64 lint;

const double EPS = 1e-10;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
const int INF = 1001001001;
//const lint INFLL = (__int64)1001001001001001001;

#define clear(a) memset((a), 0, sizeof(a))
#define mclear(a) memset((a), -1, sizeof(a))

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

int main()
{
	int Q;
	
	scanf("%d", &Q);
	
	for (int T = 0; T < Q; T++){
		int a, b, c;
		
		scanf("%d %d %d", &a, &b, &c);
		
		int ans = 0;
		for (int i = 0; i <= 333; i++){
			for (int j = 0; j < 555; j++){
				int aa = a - 3 * i - 2 * j;
				int bb = b - j;
				
				if (aa < 0 || bb < 0) continue;
				ans = max(ans, i + j + min(aa, min(bb, c)));
			}
		}
		printf("%d\n", ans);
	}
	return (0);
}

Measured memory_bytes: 1192
#include<stdio.h>
int main(){
  int a[4][13],n,i,j,k,x;
  char m;
  for(i=0;i<4;i++){
    for(j=0;j<13;j++){
      a[i][j]=0;
    }
  }
 
  scanf("%d",&n);
 
  for(k=0;k<3*n;k++){
    scanf("%c %d",&m,&x);
    if(m=='S')a[0][x-1]=1;
    else if(m=='H')a[1][x-1]=1;
    else if(m=='C')a[2][x-1]=1;
    else if(m=='D')a[3][x-1]=1;
  }
 
  for(i=0;i<4;i++){
    for(j=0;j<13;j++){
      if(a[i][j]==0){
    if(i==0)printf("S %d\n",j+1);
    else if(i==1)printf("H %d\n",j+1);
    else if(i==2)printf("C %d\n",j+1);
    else if(i==3)printf("D %d\n",j+1);
      }
    }
  }
  return 0;
}

Measured memory_bytes: 596
#include<iostream>

using namespace std;

int main(){
    int a, b;
    cin >> a >> b;
    if(a<b)
    {
        for (int i = 0; i < b; i++)
        {
            cout << a;
        }
    }
    else
    {
        for (int i = 0; i < a; i++)
        {
            cout << b;
        }
    }
    cout << endl;
    return 0;
}

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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef double ld;
#define int ll
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<vvc> vvvc;
typedef pair<int, int> pii;
typedef pair<pii, pii> piii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector<short> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<ld> vld;
typedef vector<vld> vvld;
typedef vector<vvld> vvvld;
typedef vector<string> vst;
typedef vector<vst> vvst;
typedef pair<ld, ld> pld;

#define inmin(a, b) a = min(a, (b))
#define inmax(a, b) a = max(a, (b))
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define sqr(x) ((x) * (x))
#define fori(i, n) for(int i = 0; i < int(n); ++i)
#define SZ(a) ((int)((a).size()))
#define triple(T) tuple<T, T, T>
#define quad(T) tuple<T, T, T, T>
#define watch(x) cerr << (#x) << " = " << (x) << endl;

#ifdef RUS_HOME
#define cerr cout
#else
#define cerr if (false) cerr
#endif

const double PI = 2 * acos(0.0);
#define rand shittttty_shit
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng_64(chrono::steady_clock::now().time_since_epoch().count());

const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";


template <class T0, class T1>
inline ostream & operator << (ostream &out, pair<T0, T1> &a) {
    return out << "{" << a.first << ", " << a.second << "}";
}

template <class T0, class T1>
inline istream & operator >> (istream &in, pair<T0, T1> &a) {
    return in >> a.first >> a.second;
}

template <class T0, class T1, class T2>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << "}";
}

template <class T0, class T1, class T2, class T3>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2, T3> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << ", " <<  get<3>(a) << "}";
}

template<class T>
inline ostream & operator << (ostream &out, vector<T> &a) {
    out << "[";
    fori (i, a.size())
        out << a[i] << vector<string>{", ", "]  "}[i + 1 == a.size()];
    return out;
}


void smain();



signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
#ifdef RUS_HOME
    freopen("input", "r", stdin);
    clock_t start = clock();
#endif
    cout << setprecision(12) << fixed;
    smain();
#ifdef RUS_HOME
    cout << "\n\n\n\nTOTAL EXECUTION TIME: " << float( clock () - start ) /  CLOCKS_PER_SEC << endl;
#endif
    return 0;
}



void smain() {

    int n;
    cin>>n;
    vi a(n);
    int sum=0;
    map<int,int>mp;
    for(int i=0;i<n;i++){
        cin>>a[i];
        sum+=a[i];
        mp[sum]++;
    }

    int ans=0;
    sum=0;
    for(int i=0;i<n;i++){
        ans+=mp[sum];
        sum+=a[i];
        mp[sum]--;
    }
    cout<<ans;


}


Measured memory_bytes: 14336
import java.io.BufferedReader;
import java.io.InputStreamReader;

class Main {
    public static void main(String[] args) throws Exception {
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] strArr = br.readLine().split(" ");
        int a =Integer.parseInt(strArr[0]);
        int b =Integer.parseInt(strArr[1]);
        int c =Integer.parseInt(strArr[2]);
        int d =Integer.parseInt(strArr[3]);
        int e =Integer.parseInt(strArr[4]);

        int chksum=0;

        if(0<=a && 0<=b && 0<=c && 0<=d){
        	if(c+e <= a && d+e <= b && 0<=c-e && 0 <= d-e){
            	System.out.println("Yes");
            	chksum++;
            }
        }

        if(0>=a && 0<=b && 0>=c && 0<=d){
        	if(c+e <= 0 && d+e <= b && a<=c-e && 0 <= d-e){
            	System.out.println("Yes");
            	chksum++;
            }
        }

        if(0>=a && 0>=b && 0>=c && 0>=d){
        	if(c+e <= 0 && d+e <= 0 && a<=c-e && b <= d-e){
            	System.out.println("Yes");
            	chksum++;
            }
        }

        if(0>=a && 0>=b && 0<=c && 0>=d){
        	if(c+e <= a && d+e <= 0 && a<=c-e && b <= d-e){
            	System.out.println("Yes");
            	chksum++;
            }
        }

        if(chksum==0){
        	System.out.println("No");
        }

    }
}

Measured memory_bytes: 24328
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
//---------------------------------------------------------------------------------------------------
template<class V> struct MaxFlow {
    struct edge { int to, reve; V cap; edge(int t, int r, V c) : to(t), reve(r), cap(c) {} };
    int MV; vector<vector<edge>> E; vector<int> itr, lev;
    MaxFlow() {} MaxFlow(int n) { init(n); }
    void init(int n) { MV = n; itr = vector<int>(MV), lev = vector<int>(MV); E = vector<vector<edge>>(MV); }
    void add_edge(int x, int y, V cap, bool undir = false) { E[x].push_back(edge(y, (int)E[y].size(), cap));
        E[y].push_back(edge(x, (int)E[x].size() - 1, undir ? cap : 0)); }
    void bfs(int cur) { rep(i, 0, MV) lev[i] = -1; queue<int> q; lev[cur] = 0; q.push(cur);
        while (q.size()) { int v = q.front(); q.pop();
        for(auto e : E[v]) if (e.cap>0 && lev[e.to]<0) lev[e.to] = lev[v] + 1, q.push(e.to); } }
    V dfs(int from, int to, V cf) { if (from == to) return cf;
        for (; itr[from]<E[from].size(); itr[from]++) {
            edge* e = &E[from][itr[from]]; if (e->cap>0 && lev[from]<lev[e->to]) { 
                V f = dfs(e->to, to, min(cf, e->cap));
                if (f>0) { e->cap -= f; E[e->to][e->reve].cap += f; return f; }
            } } return 0; }
    V maxflow(int from, int to) { V fl = 0, tf;
        while (1) { bfs(from); if (lev[to]<0) return fl;
            rep(i, 0, MV) itr[i] = 0; while ((tf = dfs(from, to, numeric_limits<V>::max()))>0) fl += tf; } }
};
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　　|　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/







#define INF 100000
int H, W; string S[101];
int dx[4] = { 0, 1, 0, -1 }, dy[4] = { -1, 0, 1, 0 };
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> H >> W;
    rep(y, 0, H) cin >> S[y];

    int N = H * W;
    MaxFlow<int> mf(N * 2 + 2);
    int s = N * 2, t = N * 2 + 1;

    rep(y, 0, H) rep(x, 0, W) {
        if (S[y][x] == 'X') {
            mf.add_edge(y * W + x, y * W + x + N, INF);
            mf.add_edge(s, y * W + x, INF);
        }
        else mf.add_edge(y * W + x, y * W + x + N, 1);
    }

    rep(y, 0, H) rep(x, 0, W) rep(i, 0, 4) {
        int xx = x + dx[i];
        int yy = y + dy[i];
        int a = y * W + x;
        int b = yy * W + xx;
        
        if (xx < 0 || W <= xx || yy < 0 || H <= yy) mf.add_edge(a + N, t, INF);
        else {
            mf.add_edge(a + N, b, 1);
            if(S[y][x] == '.') mf.add_edge(a + N, b, INF);
        }
    }

    int f = mf.maxflow(s, t);
    if (INF <= f) f = -1;
    cout << f << endl;
}

Measured memory_bytes: 4096
#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 = 1001001001;

int main() {
    int n, m; cin >> n >> m;
    if(m >= n) {
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char c;
  cin >> c;
  if(c == 'a'){
  cout <<  "vowel" << endl;
  }
  else if(c == 'i'){
  cout <<  "vowel" << endl;
  }
  else if(c == 'o'){
  cout <<  "vowel" << endl;
  }
  else if(c == 'e'){
  cout <<  "vowel" << endl;
  }
  else if(c == 'u'){
  cout <<  "vowel" << endl;
  }
  else{
  cout <<  "consonant" << endl;
  }
}

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

int main()
{
  int n, k;
  cin >> n >> k;
  int ans = 0;
  for (int i = 0; i < n; i++)
  {
    int h;
    cin >> h;

    if (k <= h)
    {
      ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 
  int N;
  cin >> N;

  string S, T;
  cin >> S >> T;

  string answer = "";

  for (int i = 0; i < N; i++){
    answer += S[i];
    answer += T[i];
  }

  cout << answer << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <typeinfo>

using namespace std;
 
int main() {
  string S;
  cin >> S;
  int n;
  int X = 753;
  int mi = 1000;
  for(int i = 0; i + 2 < S.size(); i++){
    n = (S.at(i) - '0') * 100 + (S.at(i+1) - '0') * 10 + S.at(i+2) - '0';
//    cout << n << endl;
    mi = std::min(mi,std::abs(n - X));
//    cout << mi << endl;
  }
  cout << mi << endl;
  
}

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

int main(){
	int A1, A2, A3;
	
	cin >> A1 >> A2 >> A3;

	if(A1 + A2 + A3 >= 22){
  	cout << "bust" << endl;
	}
	else {
  	cout << "win" << endl; 
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define debug(x) cerr << #x << " " << x << '\n'
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
const int INF = 0x3f3f3f3f, N = 105;
const ll LINF = 1e18 + 5;
int n, k, v[N];
int main()
{
 	ios::sync_with_stdio(false);
 	cin.tie(0);
 	cin >> n >> k;
 	for(int i=1; i<=n; i++) cin >> v[i];
 	ll ans = 0;
 	for(int len=1; len<=n; len++)
 	{
 		for(int i=1; i+len-1<=n; i++)
 		{
 			int j = i + len - 1;
 			int op = i-1+n-j;
 			if(op>k) continue;
 			vector <int> tmp;
 			for(int a=1; a<i; a++) tmp.pb(v[a]);
 			for(int b=j+1; b<=n; b++) tmp.pb(v[b]);
 			sort(all(tmp));
 			int st = k-op;
 			ll cur = 0;
 			for(int x : tmp)
 			{
 				if(x<0 && st) st--;
 				else cur += x;
 			}
 			if(cur>ans) ans = cur;
 		}
 	}
 	sort(v+1, v+n+1);
 	if(n<=k)
 	{
	 	ll cur = 0;
	 	int st = k - n;
	 	for(int i=1; i<=n; i++)
	 	{
	 		if(v[i]<0 && st) st--;
	 		else cur += v[i];
	 	}
	 	if(cur>ans) ans = cur;
	 }
 	cout << ans;
	return 0;
}


Measured memory_bytes: 256
#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<time.h>
using namespace std;
typedef long long int llint;
typedef pair<int, int> pint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<llint, llint>> vpllint;
#define rep(i,n) for(int i=0;i<n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#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 YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;
#define POSSIBLE(ans) if(ans)cout<<"POSSIBLE"<<endl;else cout<<"IMPOSSIBLE"<<endl;

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;

	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}

	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい
	}

	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}

		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);

		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;

		return true;
	}
};

//aとbの最大公約数を求めるよ
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
long long extGCD(long long a, long long b, long long& x, long long& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}

bool check(int a, int b) {
	return a > b;
}

// 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を1000000007で割った余りを求める
llint convination(llint a, llint b) {
	llint ans = 1;
	for (llint i = 0; i < b; i++) {
		ans *= a - i;
		ans %= 1000000007;
	}
	for (llint i = 1; i <= b; i++) {
		ans *= modinv(i, 1000000007);
		ans %= 1000000007;
	}
	return ans;
}

int main() {
	int a, b;
	cin >> a >> b;
	if (a < b)cout << "a < b" << endl;
	else if (a > b)cout << "a > b" << endl;
	else cout << "a == b" << endl;
	return 0;
}


Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<n;++i)
const ll MOD=1000000007;
const ll INF=1000000000;

int main(){
    int N,A,B,C,D;
    cin >> N >> A >> B >> C >> D;
    A--;
    B--;
    C--;
    D--;
    string S;
    cin >> S;
    vector<bool> AC(N),BD(N);
    AC[A]=true;
    for (int i=A;i<=C-1;i++){
        if (AC[i]&&S[i+1]=='.'){
            AC[i+1]=true;
        }
        else if (AC[i]&&i<=C-2&&S[i+2]=='.'){
            AC[i+2]=true;
        }
    }
    BD[B]=true;
    for (int i=B;i<=D-1;i++){
        if (BD[i]&&S[i+1]=='.'){
            BD[i+1]=true;
        }
        else if (BD[i]&&i<=D-2&&S[i+2]=='.'){
            BD[i+2]=true;
        }
    }
    if (AC[C]&&BD[D]){
        if (C<D){
            cout << "Yes" << endl;
        }
        else {
            bool can=false;
            for (int i=B-1;i<D;i++){
                if (S.substr(i,3)=="..."){
                    can=true;
                    break;
                }
            }
            if (can){
                cout << "Yes" << endl;
            }
            else {
                cout << "No" << endl;
            }
        }
    }
    else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <string.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m; i < n; i++) 
#define mod 1000000007
#define pi 3.1415926535
typedef long long ll;

double deg_to_rad(double deg) {
	return deg*pi/180;
}

double clock_angle_degree(int H,int M){
    //H時M分の長針と短針の角度
    double angle=fabs((H%12)*30+(double)0.5*M-M*6);
    return min(angle,(double)360-angle);
}

int main(){
    int A,B,H,M;
    cin>>A>>B>>H>>M;
    double angle=clock_angle_degree(H,M);
    cout<<fixed<<setprecision(10)<<sqrt((double)(A*A+B*B)-2*A*B*cos(deg_to_rad(angle)))<<endl;
    return 0;
}

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

typedef long long ll;
const int N = 1e5 + 5;

char a[N], b[N];
ll ans;
int n, m; 

ll gcd(ll a, ll b) { return (a%b == 0)? b : gcd(b, a%b); }

int main() {
	cin>>n>>m>>a>>b;
	ans = (ll) n*m/gcd(n, m);
	ll x = ans/n, y = ans/m;
	ll len = x*y/gcd(x, y);
	for(int i = 0; i*len/x < n && i*len/y < m; i++) {
		if(a[i*len/x] != b[i*len/y]) {
			cout<<-1<<endl;
			return 0;
		} 
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 384
import numpy as np
import math

n, _ = [int(i) for i in input().split()]
x = [int(i) for i in input().split()]

x.sort()
x2 = [0] + x[:-1]

xn = np.array(x)
x2n = np.array(x2)

diff = (xn - x2n)[1:]
diff.sort()

if n > 1:
    diff = diff[:-(n-1)]


diffsum = np.sum(diff)

print(diffsum)

Measured memory_bytes: 22312
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
using namespace std;

#define rep(i,a) for(int i=0; i<a; i++)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define loop3(i,j,k,a) for(int i=0; i<a; i++)for(int j=0; j<a; j++)if(i!=j)for(int k=0; k<a; k++)if(i!=k&&j!=k)
#define loop4(i,j,k,l,a) for(int i=0; i<a; i++)for(int j=0; j<a; j++)if(i!=j)for(int k=0; k<a; k++)if(i!=k&&j!=k)for(int l=0; l<a; l++)if(i!=l&&j!=l&&k!=l)
#define rep1(i,a) for(int i=1; i<=a; i++)

#define scnd1(a) scanf("%d", &a)
#define scnd2(a,b) scanf("%d%d", &a,&b)
#define scnd3(a,b,c) scanf("%d%d%d", &a,&b,&c)
#define scnd4(a,b,c,d) scanf("%d%d%d%d", &a,&b,&c,&d)

#define prtd1(a) printf("%d\n", a)
#define prtd2(a,b) printf("%d %d\n", a,b)
#define prtd3(a,b,c) printf("%d %d %d\n", a,b,c)
#define prtd4(a,b,c,d) printf("%d %d %d %d\n", a,b,c,d)

#define mem(a,n) memset( a, n, sizeof(a))

typedef long long ll;

int main(void){
    int A, B, AB, X, Y;
    
    cin >> A >> B >> AB >> X >> Y;
    
    int ans = A*X + B*Y;
    
    if ( ans > (X*2*AB + max(0,Y-X)*B) ) ans = X*2*AB + max(0,Y-X)*B;
    if ( ans > (Y*2*AB + max(0,X-Y)*A) ) ans = Y*2*AB + max(0,X-Y)*A;
    
    cout << ans << endl;
}


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

using namespace std;

int main() {
	int K = 0;
	int N = 0;

	cin >> N >> K;

	int arr[N];

	for (int i = 0 ; i < N ; i++) {
		cin >> arr[i];
	}
	int n = sizeof(arr)/sizeof(arr[0]);

	sort(arr , arr + n );

	int hsd{0};
	
	for (int x = 0; x < K ; x++) {
		hsd += arr[x];	
	}
	cout << hsd << "\n";
	

	
	
}


Measured memory_bytes: 3588
A = []
for i in range(5):
    a = int(input())
    A.append(a)
    
k = int(input())

flag = 0
for i in range(5):
    if flag:
        break
    for j in range(5):
        if abs(A[i] - A[j]) > k:
            print(':(')
            flag = 1
            break
        else:
            continue
else:
    print('Yay!')

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main(){
int N;
  cin>>N;
  bool ans=false;
  for(int i=0;i<=N/4;i++){
  if((N-4*i)%7==0){
  ans=true; break;
  }
  
  }if(ans)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;

return 0;
}

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

using namespace std;

//using Matrix = vector< vector<int> >;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9 + 10;
//const ll INF = 1e18 + 10LL;
int dx[5] = {0, 0, 1, -1, 0}, dy[5] = {1, -1, 0, 0, 0};
const double EPS = 1e-10;
bool cmp(P a, P b) { return a.second < b.second; } //End sort (Interval scheduling problem)
ll MOD = 1e9 + 7;

int n;
string S;

int cnt;

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

	cnt = 1;
	for (int i = 0; i + 1 < n; i++) {
		if (S[i] == S[i + 1]) continue;
		cnt++;
	}

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

Measured memory_bytes: 512
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <set>
#include <sstream>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

signed main(){
  ll n,a,b,c,d; cin>>n>>a>>b>>c>>d;
  rep(m,n){
    if((n-m-1)*c-m*d<=b-a&&b-a<=(n-m-1)*d-m*c) return cout<<"YES"<<endl,0;
  }
  cout << "NO" << endl;

  return 0;
}


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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

int main() {
  vector<vector<int>> A(3, vector<int>(3));
  REP(i, 3) {
    REP(k, 3) {
      cin >> A[i][k];
    }
  }
  int N; cin >> N;
  vector<int> b(N); REP(i, N) cin >> b[i];

  vector<vector<int>> ans = {
    {0, 0, 0},
    {0, 0, 0},
    {0, 0, 0},
  };

  REP(i, N) {
    REP(k, 3) {
      REP(m, 3) {
        if(b[i] == A[k][m]) ans[k][m] = 1;
      }
    }
  }

  if((ans[0][0] == 1 && ans[0][1] == 1 && ans[0][2] == 1) ||
      (ans[1][0] == 1 && ans[1][1] == 1 && ans[1][2] == 1) || 
      (ans[2][0] == 1 && ans[2][1] == 1 && ans[2][2] == 1) || 
      (ans[0][0] == 1 && ans[1][0] == 1 && ans[2][0] == 1) || 
      (ans[0][1] == 1 && ans[1][1] == 1 && ans[2][1] == 1) || 
      (ans[0][2] == 1 && ans[1][2] == 1 && ans[2][2] == 1) ||
      (ans[0][0] == 1 && ans[1][1] == 1 && ans[2][2] == 1) ||
      (ans[0][2] == 1 && ans[1][1] == 1 && ans[2][0] == 1)) {
        cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <regex>
#include <numeric>
using namespace std;

/*--- Macro ---*/
#define rep(i, n) for(int i=0; i<(int)n; i++)
#define rep1(i, n) for(int i=1; i<(int)n; i++)
#define mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()

/*---  Type ---*/
typedef long long ll;

/*--- Constants ---*/
template <typename T> const T INF = numeric_limits<T>::max() / 10;
const int MOD = (int)1e9 + 7;

// Floating
const double EPS = 1e-11;
#define EQ0(x) (abs(x) < EPS)
#define EQ(x, y) (abs(a-b) < EPS)

// Util
int max(int a, int b, int c) {return max(a, max(b, c));}
int min(int a, int b, int c) {return min(a, min(b, c));}
ll max(ll x, ll y) {return x > y ? x : y;}
ll min(ll x, ll y) {return x < y ? x : y;}
ll max(ll a, ll b, ll c) {return max(a, max(b, c));}
ll min(ll a, ll b, ll c) {return min(a, min(b, c));}

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



int main() {
  int x, y, z;
  cin >> x >> y >> z;

  cout << (x - z) / (y + z) << endl;

  return 0;
}

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

typedef long long ll;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

typedef vector<double> P;
const double eps=1e-7;
struct L : public vector<P> {
  L(const P& a,const P &b){
    push_back(a);
    push_back(b);
  }
};

P operator+(const P& a,const P& b){
  P res;
  rep(i,3)res.push_back(a[i]+b[i]);
  return res;
}
P operator-(const P& a,const P& b){
  P res;
  rep(i,3)res.push_back(a[i]-b[i]);
  return res;
}
double dot(P a,P b){
  double res=0;
  rep(i,3)res+=a[i]*b[i];
  return res;
}
double norm(P a){
  double res=0;
  rep(i,3)res+=a[i]*a[i];
  return res;
}
double abs(P a){
  return sqrt(norm(a));
}
P projection(L l,P p){
  P base=l[1]-l[0];
  double r=dot(p-l[0],base)/norm(base);
  P res;
  rep(i,3)res.push_back(l[0][i]+base[i]*r);
  return res;
}
bool intersectSP(L s,P p){
  return abs(s[0]-p)+abs(s[1]-p)-abs(s[1]-s[0])<eps;
}
double distanceSP(L l,P p){
  P r=projection(l,p);
  return intersectSP(l,r)?abs(r-p):min(abs(l[0]-p),abs(l[1]-p));
}

int main(){
  while(1){
    int N,M,R;
    cin>>N>>M>>R;
    if(N==0)break;
    vector<P> cps;
    vector<double> crs;
    rep(i,N){
      P p;
      rep(j,3){
        double t;
        cin>>t;
        p.push_back(t);
      }
      cps.push_back(p);
      double r;
      cin>>r;
      crs.push_back(r);
    }
    vector<P> lps;
    vector<double> lbs;
    rep(j,M){
      P p;
      rep(j,3){
        double t;
        cin>>t;
        p.push_back(t);
      }
      lps.push_back(p);
      double r;
      cin>>r;
      lbs.push_back(r);
    }
    P cent;
    rep(j,3){
      double t;
      cin>>t;
      cent.push_back(t);
    }
    vector<set<int> > idxs;
    vector<double> score;
    rep(i,M){
      set<int> idx;
      rep(j,N){
        double d=distanceSP(L(cent,lps[i]),cps[j]);
        if(d<crs[j]-eps&&(abs(lps[i]-cps[j])>crs[j]-eps||abs(cent-cps[j])>crs[j]-eps)){
          idx.insert(j);
        }
      }
      idxs.push_back(idx);
      score.push_back(lbs[i]/norm(cent-lps[i]));
    }
    double res=-1e16;
    rep(S,1<<M){
      vector<bool> tot(N,0);
      double sum=0;
      int cnt=0;
      rep(i,M){
        if(!((S>>i)&1))continue;
        for(int idx : idxs[i]){
          if(!tot[idx])cnt++;
          tot[idx]=true;
          if(cnt>R)break;
        }
        sum+=score[i];
        if(cnt>R)break;
      }
      if(cnt<=R){
        res=max(res,sum);
      }
    }
    printf("%.10f\n", res);
  }
  return 0;
}



Measured memory_bytes: 3800
#D問題
S = list(str(input()))
Slen = len(S)

fro = S[0]
bac = S[-1]

if fro == bac:
    if Slen%2 == 0:
        print("First")
    else:
        print("Second")
else:
    if Slen%2 == 0:
        print("Second")
    else:
        print("First")
    

Measured memory_bytes: 45972
###template###
import sys
def input(): return sys.stdin.readline().rstrip()
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt, ceil, floor
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
import heapq
INF = float("inf")
sys.setrecursionlimit(10**7)
# 4近傍（右, 下, 左, 上）
dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]
def inside(y: int, x: int, H: int, W: int) -> bool: return 0 <= y < H and 0 <= x < W
def mi(): return map(int, input().split())
def ii(): return int(input())
###template###

N = ii()
Ds = sorted(list(mi())); #昇順

lo = Ds[N//2-1]
hi = Ds[N//2]

print(hi-lo)



Measured memory_bytes: 52964
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {

        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };


    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        s: String,
    }
    let s: Vec<u64> = s.chars().map(|c| c.to_digit(10).unwrap() as u64).collect();
    println!("{}", rec(&s));
}

fn rec(s: &[u64]) -> u64 {
    if s.len() == 1 {
        return s[0];
    }
    let mut sum = 0;
    for i in 0..s.len() {
        let multiplier = if i < s.len() - 1 {
            2_u64.pow((s.len() - i - 2) as u32)
        } else {
            1
        };
        for j in 0..i + 1 {
            sum += multiplier * s[j] * 10_u64.pow((i - j) as u32);
        }
        if i < s.len() - 1 {
            sum += rec(&s[i + 1..]);
        }
    }
    return sum;
}


Measured memory_bytes: 4352
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<string>

using namespace std;

int main(){

int N;
cin>>N;

int A[N+1];
int a[N+1];
int M=0;
for(int i=1;i<=N;i++){
    cin >> a[i];
}
    for(int i=N;i>=N/2+1;i--){

            if(a[i]==0){
                A[i]=0;
            }
            else{
                A[i]=1;
                M++;
            }
    }

int k=N/2;
int l;
int t;
while(k>0){

    l=N/k;
    t=0;
    for(int i=l;i>1;i--){
        t+=A[i*k];
    }
    A[k]=abs(a[k]-(t%2));
    if(A[k]==1){
        M++;
    }
    k--;
}
cout << M <<endl;
for(int i=1;i<=N;i++){
    if(A[i]==1){
    cout <<i<<" ";
    }
}

 return 0;
}

Measured memory_bytes: 2432
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(10000)


# Debug output
def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))


# Binary converter
def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]


# --------------------------------------------

dp = None


def main():
    print(input().count("1"))


main()


Measured memory_bytes: 4796
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>

using namespace std;
using ll = long long int;

const ll MOD = 1e9 + 7;

ll pow_fast(ll n, ll k) {
  if (k == 0) {
    return 1LL;
  }
  if (k == 1) {
    return n;
  }

  if (k % 2 == 0) {
    ll tmp = pow_fast(n, k / 2);
    return tmp * tmp % MOD;
  } else {
    ll tmp = pow_fast(n, (k - 1) / 2);
    tmp *= tmp;
    tmp %= MOD;
    return tmp * n % MOD;
  }
}

int main() {
  ll N, K;
  cin >> N >> K;
  cout << (K * pow_fast(K - 1, N - 1)) << endl;
}

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

using namespace std;

#define _int64 long long

int d[2][500][500];
int a[500][3];

int main()
{
  int ma,mb,ans,i,j,k,now,n;
  scanf("%d%d%d",&n,&ma,&mb);
  for (i=0;i<n;i++)
    scanf("%d%d%d",&a[i][0],&a[i][1],&a[i][2]);
  memset(d,-1,sizeof(d));
  d[0][0][0]=0;
  now=0;
  for (i=0;i<n;i++)
  {
    memset(d[1-now],-1,sizeof(d[1-now]));
    for (j=0;j<500;j++)
      for (k=0;k<500;k++)
        if (d[now][j][k]!=-1)
        {
          if ((d[1-now][j][k]==-1)||(d[1-now][j][k]>d[now][j][k]))
            d[1-now][j][k]=d[now][j][k];
          if ((d[1-now][j+a[i][0]][k+a[i][1]]==-1)||(d[1-now][j+a[i][0]][k+a[i][1]]>d[now][j][k]+a[i][2]))
            d[1-now][j+a[i][0]][k+a[i][1]]=d[now][j][k]+a[i][2];
        }
    now=1-now;
  }
  ans=-1;
  for (i=0;i<500;i++)
    for (j=0;j<500;j++)
      if ((d[now][i][j]!=-1)&&(i*mb==j*ma))
      {
        if ((i==0)&&(j==0)) continue;
        if ((ans==-1)||(ans>d[now][i][j]))
          ans=d[now][i][j];
      }
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 2304
n, k = gets.split.map(&:to_i)
s = Array.new(100002, 0)
n.times do
  a, b = gets.split.map(&:to_i)
  s[a - 1] += b
end
100001.times do |i|
  k -= s[i]
  if k <= 0
    puts i + 1
    exit
  end
end


Measured memory_bytes: 2556