akhauriyash/Code-Regression huggingface dataset:
#include<iostream>

using namespace std;

int main(){
	int A, B, C, D, P;
	int X, Y;
	cin >>	A;
	cin >> B;
	cin >> C;
	cin >> D;
	cin >> P;

	X = A * P;
	if(P > C)
		Y = B + (P - C) * D;
	else
		Y = B;
	if(X > Y)
		cout << Y << endl;
	else 
		cout << X << endl;
}

Measured memory_bytes: 1164
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  int n,num,sum=0;
  vector<int> s;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> num;
    sum+=num;
    s.push_back(num);
  }
  sort(s.begin(),s.end());
  if(sum%10!=0){
    cout << sum << endl;
    }else{
      for(int i=0;i<n;i++){
        if(s[i]%10!=0){
          sum-=s[i];
          break;
        }
      }
      sum = (sum%10==0)?0:sum;
      cout << sum <<endl;
    }
}



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

int top=0, S[100];

void push(int x) {
	top++;
	S[top] = x;
}

int pop() {
	top--;
	return S[top+1];
}
int main(void){
	int i,j;
	char s[10];
	while (scanf("%s",s)!=EOF){
		if (s[0]=='+'){
			i=pop();
			j=pop();
			push(i+j);
		}
		else if(s[0]=='-'){
			i=pop();
			j=pop();
			push(j-i);
		}
		else if(s[0]=='*'){
			i=pop();
			j=pop();
			push(i*j);
		}
		else{
			push(atoi(s));
		}
	}
	printf("%d\n",S[1]);
	return 0;
}

Measured memory_bytes: 548
c = 5*pow(10, 14)
list_N = list(input())
k = int(input())
cnt = 0
ans = 0

for i in list_N:
    i = int(i)
    if i != 1:
        ans = i
        break
    else:
        cnt += 1
        if cnt == k:
            ans = 1
            break

print(ans)

Measured memory_bytes: 3060
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		char[] str = br.readLine().toCharArray();

		boolean easy = true;
		for(int i = 0; i < str.length; i++){
			if(i % 2 == 0 && str[i] == 'L'){
				easy = false;
				break;
			}
			if(i % 2 == 1 && str[i] == 'R'){
				easy = false;
				break;
			}
		}

		if(easy){
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}

	}

}


Measured memory_bytes: 23124
#include<bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<(int64_t)N;i++)
typedef int64_t LL;
int main()
{
  int K;
  cin>>K;
  LL sum=0;
  rep(i,K)rep(j,K)rep(k,K){sum+=gcd<LL,LL>(gcd<LL,LL>((i+1),(j+1)),(k+1));}
  return cout<<sum<<endl,0;
}

Measured memory_bytes: 3616
#include <stdio.h>
#include <stdlib.h>
#define Rep(i,a,n)for(int i=(int)(a);i<(int)(n);i++)
#define rep(i,n)Rep(i,0,n)
int dn(const void*a,const void*b){return*(int*)b-*(int*)a;}
int main(){
	int n,k,a,b[200009]={0},c=0;
	scanf("%d%d",&n,&k);
	rep(i,n){scanf("%d",&a);b[a]++;if(b[a]==1)c++;}
	qsort(b,200008,4,dn);
	a=0;
	Rep(i,k,c+1)a+=b[i];
	printf("%d",a);
	return 0;
}

Measured memory_bytes: 3028
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define    endl        '\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define ios        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
int main()
{
    ios
    
    int n;
    cin>>n;

    string s;
    cin>>s;

    int dp[n]={0};
    int dp1[n]={0};

    if(s[0]=='W')
    {
        dp[0]=1;
        dp1[0]=0;
    }
    else
    {
        dp1[0]=1;
        dp[0]=0;
    }
    for(int i=1;i<n;i++)
    {
        if(s[i]=='W')
        {
            dp[i]=dp[i-1]+1;
            dp1[i]=dp1[i-1];
        }
        if(s[i]=='E')
        {
            dp1[i]=dp1[i-1]+1; 
            dp[i]=dp[i-1];
        }   
    }

    int res=0,ans=1000000000;
    for(int i=0;i<n;i++)
    {
        res=0;
        if(s[i]=='W')
        {
            res=dp1[i]+(dp[n-1]-dp[i]);
            //cout<<dp1[i]<<" "<<dp[n-1]-dp[i]<<endl;
        }
        else
        {
            res=dp1[i]+(dp[n-1]-dp[i])-1;
            //cout<<dp1[i]<<" "<<(dp1[n-1]-dp1[i])<<endl;
        }
        res=n-1-res;

        //cout<<res<<" "<<i<<endl;
        ans=min(ans,res);
    }

    cout<<ans;
}

Measured memory_bytes: 2964
#include <algorithm>
#include <bitset>
#include <cmath>
#include <ctime>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(a) begin(a),end(a)
typedef long long ll;
typedef pair<int,int> P;
const int inf=1e+9;
const ll mod=1000000007;
const double PI=3.14159265358979323846;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};
ll gcd(ll a, ll b){
  if (b==0) return a;
  else return gcd(b,a%b);
}
int cans(bool f){
  if(f) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}




int main() {
  int ans = 0;
  int dig = 10;
  rep(i,5) {
    int t;
    cin >> t;
    if(t % 10 == 0) {
      ans += t;
    }
    else {
      int m = t%10;
      dig = min(m,dig);
      ans += t - m + 10;
    }
  }
  if(dig != 10) cout << ans - (10 - dig)  << endl;
  else cout << ans << endl;
}


Measured memory_bytes: 256
N = int(input())
plan = [[0,0,0]]
plan.extend(list(map(int, input().split())) for i in range(N))
f = True
for i in range(N):
    time = plan[i+1][0]-plan[i][0]
    dist = abs(plan[i+1][1]-plan[i][1])+abs(plan[i+1][2]-plan[i][2])
    if dist>time or (dist%2 != time%2):
        f = False
print('Yes' if f else 'No')

Measured memory_bytes: 27380
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include <iostream>
#include <algorithm>
#include <fstream>
#include <iomanip>
#include <vector>
#include <bitset>
#include <stack>
#include <queue>
#include <set>
#include <map>
 
using namespace std;

const int MAXN = 100005;

struct Edge
{
	int to;
	int w;
	int nxt;
}edge[MAXN << 1];

int n,m,id;
int first[MAXN];
int u[MAXN];
int v[MAXN];
int cnt[MAXN];
int fa[MAXN];

int getroot(int u)
{
	return u == fa[u] ? u : fa[u] = getroot(fa[u]);
}

void addE(int u,int v,int c)
{
	edge[++id] = (Edge){v,c,first[u]};
	first[u] = id;
}

void dfs(int U,int fa)
{
	for (int i = first[U];i;i = edge[i].nxt)
		if (edge[i].to != fa)
		{
			dfs(edge[i].to,U);
			if (cnt[edge[i].to])
			{
				swap(u[edge[i].w],v[edge[i].w]);
				cnt[edge[i].to] ^= 1;
				cnt[U] ^= 1;
			}
		}
}

int main()
{
	scanf("%d%d",&n,&m);
	for (int i = 1;i <= n;i++)
		fa[i] = i;
	for (int i = 1;i <= m;i++)
	{
		scanf("%d%d",&u[i],&v[i]);
		if (u[i] > v[i])
			swap(u[i],v[i]);
		int ru = getroot(u[i]),rv = getroot(v[i]);
		if (ru != rv)
		{
			fa[ru] = rv;
			addE(u[i],v[i],i);
			addE(v[i],u[i],i);
		}
		cnt[u[i]] ^= 1;
	}
	dfs(1,0);
	for (int i = 1;i <= n;i++)
		if (cnt[i])
		{
			puts("-1");
			return 0;
		}
	for (int i = 1;i <= m;i++)
		printf("%d %d\n",u[i],v[i]);
	return 0;
}


Measured memory_bytes: 11008
import numpy as np
N = int(input())
M = [0] + sorted(list(map(int, input().split())))
C = np.cumsum(M)
#print(M, C)
#2分探索とかでも良さそうだけど
for i in range(N-1, -1, -1):
  #print(M[i], C[i+1])
  if C[i]*2 < M[i+1]:
    #print(i)
    break
print(N-i)


Measured memory_bytes: 23120
#include<bits/stdc++.h>
using namespace std;
#define mo 1000000007
long long int dp[102][100002];int n ;long long k ; long long int a[102];
int main()
{
	ios_base:: sync_with_stdio(false);cin.tie(NULL);
	cin>>n>>k; 
	for(int i = 1; i<=n ; i++)
	cin>>a[i];
	
	dp[0][k]= 1; 
    for(int i = 1; i<=n ; i++)
    {   long long int val = 0 ; 
    		for(int p =0 ; p<=min(a[i],k); p++)
    		val = (val + dp[i-1][p])%mo;
    	  dp[i][0]= val; 
    	  
    	for(int j = 1; j<=k ; j++)
    	{
    		val= (val-dp[i-1][j-1]+mo)%mo;
    		if(j+a[i]<=k)
    		val = (val+dp[i-1][j+a[i]])%mo;
    		dp[i][j]= val;
    		
    		
    	}
    	
    	
		
		}
		
		cout<<dp[n][0];
		return(0);
	}



Measured memory_bytes: 78336
#include <iostream>

using namespace std;

int ans[100005] = {};

bool solve(int x) {
	int cnt = 0, var = 0;
	long long i;
	for (i = 2; i * i <= x; ++i) {
		if (x % i == 0) {
			var++;
			while (x % i == 0) cnt++, x /= i;
			if (var >= 3 || (var >= 2 && cnt >= 3) || (var >= 1 && cnt >= 4)) return true;
		}
	}
	if (x != 1) {
		cnt++;
		if (i <= x) var++;
	}
	return (var >= 3 || (var >= 2 && cnt >= 3) || (var >= 1 && cnt >= 4));
}

int main() {
	for (long long i = 2; i <= 100000; ++i) {
		if (solve(i)) ans[i]++;
		ans[i] += ans[i - 1];
	}
	int q; cin >> q;
	while (q--) {
		int n; cin >> n;
		cout << ans[n] << endl;
	}

	return 0;
}


Measured memory_bytes: 3524
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from itertools import chain, product
from functools import reduce
from collections import OrderedDict, Counter, deque
import operator

IS = lambda: int(input())

N = IS()
p = 10**9+7

A, C, G, T = range(4)
prev = [1] * (4**2)
banned = set([
    (A << 4) + (G << 2) + C,
    (G << 4) + (A << 2) + C,
    (A << 4) + (C << 2) + G,
    ])

cur = [0] * (4**3)
for i in range(4):
    i4 = i << 2
    i8 = i << 4
    for j in range(4):
        j4 = j << 2
        for k in range(4):
            if (i8 + j4 + k) in banned: continue
            cur[i8 + j4 + k] += prev[i4 + j]
prev = [x % p for x in cur]

banned |= set(map(sum, product([x<<6 for x in range(4)], banned)))
banned |= set(map(sum, product([x<<4 for x in range(4)], [
    (A << 6) + (G << 2) + C,
    ])))
banned |= set(map(sum, product([x<<2 for x in range(4)], [
    (A << 6) + (G << 4) + C,
    ])))

for _ in range(3,N):
    cur = [0] * (4**3)
    for i in range(4):
        i4 = i << 2
        i8 = i << 4
        i16 = i << 6
        for j in range(4):
            j4 = j << 2
            j8 = j << 4
            for k in range(4):
                k4 = k << 2
                for l in range(4):
                    if (i16 + j8 + k4 + l) in banned: continue
                    cur[j8 + k4 + l] += prev[i8 + j4 + k]
    prev = [x % p for x in cur]

print(sum(prev) % p)

Measured memory_bytes: 3700
#include <iostream>

using namespace std;


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

    string s;
    int w;
    cin >> s >> w;
    for (int i = 0; i < s.length(); i += w) {
        cout << s[i];
    }
    cout << endl;
    return 0;
}

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

#define INF 200000000
#define FER 0.0000000001

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;

int dp[10001];
int c[10001];
int v[1000];
int w[1000];
int m[1000];

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

	int N, W;
	cin >> N >> W;
	vector<int> dp(W + 1, 0);

	for (int i = 0; i<N; i++) {
		int v, w, m;
		cin >> v >> w >> m;

		for (int k = 0; m>0; k++) {
			int num = min(m, (1 << k));
			m -= num;
			for (int j = W; j >= num*w; j--)
				dp[j] = max(dp[j], dp[j - num*w] + num*v);
		}
	}

	//int ans = 0;
	//for (int x : dp) ans = max(ans, x);
	cout << dp[W] << endl;
	return 0;
}


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

int main(){
    ll a;
    double b;
    cin>>a>>b;

    int b_sub=b*100+0.5;
    ll ans=a*b_sub/100;

    cout<<ans<<endl;
    return 0;
}

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

template<typename T>
T gcd(T a, T b) {
	if (a % b == 0) {
		return(b);
	}
	else {
		return(gcd(b, a % b));
	}
}

template<typename T>
T lcm(T a, T b) {
	return a / gcd(a, b) * b;
}


int main(void) {
	ll x;
	cin >> x;
	ll m = 100;
	ll ans = 0;
	while (m < x) {
		++ans;
		m *= 1.01;
	}
	cout << ans;
}

/*

*/


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define MOD 1000000007
#define INF 1e9
#define All(x) (x).begin(), (x).end()
typedef long long ll;
using namespace std;


int main() {
  int N;
  cin>>N;
  vector<int> cnt(4);
  for(int i=0;i<N;i++){
    string s;
    cin>>s;
    if(s=="AC")cnt[0]++;
    if(s=="WA")cnt[1]++;
    if(s=="TLE")cnt[2]++;
    if(s=="RE")cnt[3]++;
  }

  printf("AC x %d\n",cnt[0]);
  printf("WA x %d\n",cnt[1]);
  printf("TLE x %d\n",cnt[2]);
  printf("RE x %d\n",cnt[3]);


  return 0;
}


Measured memory_bytes: 3728
#include <iostream>
#include <string>
#include <stdio.h>
#include <math.h>
#include <queue>
#include <algorithm>
#include <utility>
#include <vector>
#include <tuple>
#include <numeric>
using namespace std;


int main(int argc, char* argv[]){
	long long X,K,D;
	scanf("%lld %lld %lld",&X, &K, &D);

	long long p = abs(X)/D;
	long long q = abs(X)%D;
	long long ans;
	if(p > K){
		if(X >= 0){
			ans = X - K*D;
		}else{
			ans = abs(X + K*D);
		}
	}else{
		if(X>=0){
			long long ans1 = X - p*D;
			long long ans2 = abs(X - (p+1)*D);
			if((K - p) % 2 == 0){
				ans = ans1;
			}else{
				ans = ans2;
			}
		}else{
			long long ans1 = abs(X + p*D);
			long long ans2 = X + (p+1)*D;
			if((K - p) % 2 == 0){
				ans = ans1;
			}else{
				ans = ans2;
			}
		}
	}

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


}


Measured memory_bytes: 3788
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>

using namespace std;
typedef long long ll;

const int maxn=1e5+5;
const ll inf=1e16;
vector < pair < int, int > > ms[maxn];
ll put[maxn];
int ce1, ce2;
int n;
ll sol;

int dfs(int x, int pros){
	int zbr=1;
	bool p=1;
	int y;
	for(int i=0; i<ms[x].size(); i++){
		if(ms[x][i].first!=pros){
			y=dfs(ms[x][i].first, x);
			if(y>n/2){
				p=0;
				sol+=(ll)(n-y)*ms[x][i].second;
			}
			else{
				sol+=(ll)y*ms[x][i].second;
			}
			zbr+=y;
		}
	}
	if(p && n-zbr<=n/2){
		if(ce1==-1){
			ce1=x;
		}
		else{
			ce2=x;
		}
	}
	return zbr;
}

void siri(int x, int pros, ll ud){
	put[x]=max(put[x], ud);
	for(int i=0; i<ms[x].size(); i++){
		if(ms[x][i].first!=pros){
			siri(ms[x][i].first, x, ud+ms[x][i].second);
		}
	}
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin >> n;
	int a, b, c;
	for(int i=0; i<n-1; i++){
		cin >> a >> b >> c;
		a--;
		b--;
		ms[a].push_back({b, c});
		ms[b].push_back({a, c});
	}
	ce1=-1;
	ce2=-1;
	dfs(0, -1);
	sol*=2;
	siri(ce1, -1, 0);
	if(ce2!=-1){
		siri(ce2, -1, 0);
	}
	ll mini=1e16;
	for(int i=0; i<n; i++){
		if(ce1==i && ce2==-1){
			continue;
		}
		mini=min(mini, put[i]);
	}
	cout << sol-mini << '\n';
	return 0;
}

Measured memory_bytes: 11904
def make_divisors(n):
    divisors = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)
    return divisors


n = int(input())
ans = len(make_divisors(n - 1))
divisors = []
for i in make_divisors(n):
    j = n
    if i != 1:
        while j % i == 0:
            j //= i
        if (j - 1) % i == 0:
            divisors.append(i)
print(ans + len(divisors) - 1)


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

string n;
int k;

int main() {
    cin >> n >> k;
    int sz = n.length();
    // dp0:ジャスト, dp1:未満
    vector<vector<lint>> dp0(sz + 2, vector<lint>(sz + 2, 0));
    vector<vector<lint>> dp1(sz + 2, vector<lint>(sz + 2, 0));
    dp0[0][1] = 1;
    dp1[0][1] = n[0] - '0' - 1;
    // i:n[i]
    for (int i = 1; i < sz; i++) {
        for (int j = 0; j <= sz + 1; j++) {
            if (n[i] == '0') {
                dp0[i][j] = dp0[i - 1][j];
            } else {
                dp0[i][j + 1] += dp0[i - 1][j];
                dp1[i][j + 1] += dp0[i - 1][j] * (n[i] - '0' - 1);
                dp1[i][j] += dp0[i - 1][j];
            }
            dp1[i][j + 1] += dp1[i - 1][j] * 9;
            dp1[i][j] += dp1[i - 1][j];
        }
        dp1[i][1] += 9;
    }
    cout << dp0[sz - 1][k] + dp1[sz - 1][k] << endl;
}

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

    int main(){
        int a,k=0,c = 0;

        cin>>a;
       
        int b[a];
        for (int i = 0; i < a; i++)
        {
            cin>>b[i];
            k += b[i];
        }
        if(k/(a*1.0) - k/a > 0.5) k = (int) ceil(k/(a*1.0));
        else k = (int) floor(k/(a*1.0));
        for (int i = 0; i < a; i++)
        {
            c += (b[i]-k)*(b[i]-k);
        }
        cout<< c << "\n";
        
      
    }

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define INF 1e9+5
int min(int x,int y){
    return (x<y)?x:y;
}
int main(){
    int n,ans=0;
    cin>>n;
    int h[n];
    vector<int> dp(n,INF);
    for(int i=0;i<n;++i)
        cin>>h[i];
    
    dp[0]=0;
    //dp[0][1]=abs(h[1]-h[0])
    for(int i=0;i<n;++i){
        for(int j:{i+1,i+2}){
            if(j<n){
                dp[j]=min(dp[j],dp[i]+abs(h[i]-h[j]));
            }
        }
    }
    cout<<dp[n-1];
    return 0;
}

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

int main(){
	string s;
	cin >> s;
	int n = s.length()+1;
	vector<int> a(n);
	rep(i,s.length()) if (s[i] == '<') a[i+1] = max(a[i]+1, a[i+1]);
	for (int i = s.length()-1; i >= 0; i--) {
		if (s[i] == '>') {
			a[i] = max(a[i+1]+1, a[i]);
		}
	}
	cout << accumulate(a.begin(), a.end(), ll(0));
 	return 0;
}

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

int n, place;

struct node
{
	int id, pid, bid, depth, degree, h;
	int lc, rc;
	string type;
}N[10000];

void Set()
{
	cin >> n;

	for (int i = 0; i < n; i++)
	{
		N[i].pid = -1;
		N[i].bid = -1;
		N[i].h = 0;
	}

	for (int i = 0; i < n; i++)
	{
		cin >> place;
		N[place].id = place;

		cin >> N[place].lc >> N[place].rc;
		N[N[place].lc].id = N[place].lc;
		N[N[place].rc].id = N[place].rc;

		if (N[place].lc != -1 && N[place].rc != -1)
		{
			N[N[place].lc].bid = N[N[place].rc].id;
			N[N[place].rc].bid = N[N[place].lc].id;

			N[N[place].lc].pid = N[place].id;
			N[N[place].rc].pid = N[place].id;

			N[place].degree = 2;
		}
		else if (N[place].lc == -1 && N[place].rc == -1)
			N[place].degree = 0;
		else
		{
			if (N[place].lc != -1)
				N[N[place].lc].pid = N[place].id;
			else
				N[N[place].rc].pid = N[place].id;

			N[place].degree = 1;
		}
	}
}

void GetDepth(node& GN)
{
	GN.depth = 0;
	node temp = GN;
                                           
	while (temp.pid != -1)
	{
		GN.depth++;
		temp = N[temp.pid];
	}
}

int GetHeight(node& GN)
{
	int h1 = 0, h2 = 0;

	if (GN.lc != -1)
		h1 = GetHeight(N[GN.lc]) + 1;
	if (GN.rc != -1)
		h2 = GetHeight(N[GN.rc]) + 1;

	return h1 > h2 ? h1 : h2;
}

void GetType(node& GN)
{
	if (GN.pid == -1)
		GN.type = "root";
	else if (GN.degree == 0)
		GN.type = "leaf";
	else
		GN.type = "internal node";
}

void print()
{
	for (int i = 0; i < n; i++)
	{
		cout << "node " << N[i].id << ": " << "parent = " << N[i].pid << ", ";
	    cout << "sibling = " << N[i].bid << ", ";
		cout << "degree = " << N[i].degree << ", ";
		cout << "depth = " << N[i].depth << ", ";
		cout << "height = " << N[i].h << ", ";
		cout << N[i].type << endl;
	}
}

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

	for (int i = 0; i < n; i++)
	{
		GetDepth(N[i]);	
		N[i].h = GetHeight(N[i]);
		GetType(N[i]);
	}
	
	print();

	return 0;
}



Measured memory_bytes: 3588
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner stdIn = new Scanner(System.in);
		int sum = 0;
		for(int r = 0; r < 10; r++) {
			int input = stdIn.nextInt();
			sum += input;
		}
		System.out.println(sum);
	}
}

Measured memory_bytes: 17368
def main():
    k = [int(i) for i in input().split()]
    x = k[0]
    n = k[1]
    if(n==0):
        print(x)
        return 0
        
    nums = [int(i) for i in input().split()]
    
    a=x
    b=x
    
    while(True):
        if(a not in nums):
            print(a)
            break
        if(b not in nums):
            print(b)
            break
        a-=1
        b+=1
    return 0
    
main()

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

# Set max recursion limit
sys.setrecursionlimit(1000000)


# 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()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v


# Width First Search (+ Distance)
def wfs_d(D, N, K):
    """
    D: 隣接行列(距離付き)
    N: ノード数
    K: 始点ノード
    """

    dfk = [-1] * (N + 1)
    dfk[K] = 0

    cps = [(K, 0)]
    r = [False] * (N + 1)
    r[K] = True
    while len(cps) != 0:
        n_cps = []
        for cp, cd in cps:
            for i, dfcp in enumerate(D[cp]):
                if dfcp != -1 and not r[i]:
                    dfk[i] = cd + dfcp
                    n_cps.append((i, cd + dfcp))
                    r[i] = True

        cps = n_cps[:]

    return dfk


# Depth First Search (+Distance)
def dfs_d(v, pre, dist):
    """
    v:  現在のノード
    pre: １つ前のノード
    dist: 現在の距離

    以下は別途用意する
    D: 隣接リスト(行列ではない)
    D_dfs_d: dfs_d関数で用いる，始点ノードから見た距離リスト
    """

    global D
    global D_dfs_d

    D_dfs_d[v] = dist

    for next_v, d in D[v]:
        if next_v != pre:
            dfs_d(next_v, v, dist + d)

    return


def sigma(N):
    ans = 0
    for i in range(1, N + 1):
        ans += i
    return ans


def comb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def bisearch(L, target):
    low = 0
    high = len(L) - 1
    
    while low <= high:
        mid = (low + high) // 2
        guess = L[mid]
        if guess == target:
            return True
        elif guess < target:
            low = mid + 1
        elif guess > target:
            high = mid - 1
    if guess != target:
        return False

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

dp = None


def main():
    S = input()

    for i in range(len(S)-1):
        s = S[i:i+2]
        if len(set(s)) != 2:
            print(i+1, i+2)
            return
    
    for i in range(len(S)-2):
        s = S[i:i+3]
        if len(set(s)) != 3:
            print(i+1, i+3)
            return

    print(-1, -1)



main()


Measured memory_bytes: 5028
def search(l, n):
    left = 0
    right = len(l) - 1
    m = (left + right) // 2

    while right - left > 1:
        if n == l[m]:
            return True
        elif n < l[m]:
            right = m
        elif n > l[m]:
            left = m
        else:
            raise Exception()

        m = (left + right) // 2

    if l[left] == n or l[right] == n:
        return True
    else:
        return False


n = int(input())
s = [int(i) for i in input().split()]
q = int(input())
t = [int(i) for i in input().split()]

ans = 0
for ti in t:
    if search(s, ti):
        ans += 1

print(ans)



Measured memory_bytes: 16892
#include<bits/stdc++.h>
#define ll long long 
#define mp make_pair 
#define f(i,n) for(int i=0;i<n;i++) 
#define F first 
#define S second 
#define pb push_back 

using namespace std;

void test(){
	int n;
	cin>>n;
	ll ans = 0;
	ll a[n];
	f(i,n)cin>>a[i];
	f(i,n){
		for(int j=i+1;j<n;j++){
			for(int k=j+1;k<n;k++){
				if(a[i]!=a[j] and a[i]!=a[k] and a[j]!=a[k]){
					ll s1 = a[i] + a[j] + a[k];
					ll s2 = max(a[i],max(a[j],a[k]));
					s1 = s1 - s2;
					if(s1>s2)ans++;
				}
			}
		}
	}
	cout<<ans<<"\n";
}

int main(){
	int tests=1;
	// cin>>tests;
	while(tests--){
		test();
	}
}


Measured memory_bytes: 3620
a,b,c=map(int,input().split())
if a>=b>=c:
    print(a-c)
elif a>=c>=b:
    print(a-b)
elif b>=a>=c:
    print(b-c)
elif b>=c>=a:
    print(b-a)
elif c>=a>=b:
    print(c-b)
else:
    print(c-a)




Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <memory>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(long long int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;

int main(){

    long long int n;
    cin>>n ;
    vector<long long int> v(n);
    REP(i,n){
        cin>>v[i];
    }
    sort(v.begin(), v.end());
    long long int result = linf,tmp;
    
    FOR(i,v[0]-2,v[n-1]+3){
        tmp = 0;
        REP(j,n){
            tmp += (i - v[j]) * (i - v[j]);
        }
        if(tmp>=0)
        {
            result = min(result, tmp);
        }
    }
    cout << result << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define eb emplace_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
#define int ll
// #define ll int
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[8] ={1,0,-1,0,1,-1,1,-1};
ll dy[8] ={0,1,0,-1,1,-1,-1,1};
 
template<class T> 
inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> 
inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


const int MAX_N = 1<<19;
int dat[2 * MAX_N -1];
int n;

struct SegmentTree{
    SegmentTree(int n_){
        n=1;
        while(n<n_) n*= 2;
        for(int i=0;i<2*n-1;i++){
            dat[i]=0;
        }
    }
    int query(int k){
        k += n-1;
        int count=dat[k];
        while(k>0){
            k=(k-1)/2;
            count+=dat[k];
        }
        return count;
    }
    void update(int a,int b,int k,int p,int l,int r){
        if(r<=a || b<=l) return;
        if(a<=l && r<=b){
            dat[k]+=p;
        }
        else{
            update(a,b,k*2+1,p,l,(l+r)/2);
            update(a,b,k*2+2,p,(l+r)/2,r);
        }
    }
};




void solve(){
    ll _n,d,a;
    ll x[200010],h[200010];
    cin>>_n>>d>>a;
    rep(i,_n) cin>>x[i]>>h[i];
    pll p[200010];
    rep(i,_n) p[i]={x[i],h[i]};
    sort(p,p+_n);
    vll v;
    ll ans=0;

    SegmentTree sg(_n);

    ll now=0;
    rep(i,_n){
        if(i!=0){
            if(lower_bound(v.begin(),v.end(),p[i].fi)!=v.end()){
                ll k=LB(v,p[i].fi);
                
                p[i].sc-=sg.query(k)*a;
            }
        }
        ll cnt;
        if(p[i].sc<=0) cnt=0;
        else cnt=p[i].sc/a+(p[i].sc%a!=0);
        if(cnt>=0) ans+=cnt;

        v.pb(p[i].fi+d*2);
        sg.update(0,i+1,0,cnt,0,n);
        now++;
    }
    cout<<ans<<endl;


}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    
     

    solve(); 


    return 0;
}


Measured memory_bytes: 15608
import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = println(solve(new Scanner(System.in)))

  def solve(in: String): String = solve(new Scanner(in))

  def solve(sc: Scanner): String = {
    val S = sc.next
    val T = sc.next

    if ((S + S).contains(T)) "Yes" else "No"
  }
}


Measured memory_bytes: 25796
// "include" {{{
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cstring>
#include <iomanip>
#include <tuple>
// }}}
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define pii pair<int,int> 
#define int long long
#define setout(n,x) setw(n) << setfill(x)
#define Fixed fixed << setprecision(10)
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const long long mod = 1000000007;

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int x,y,z;
	cin >> x >> y >> z;
	cout << (x - z) / (y+z) << '\n';
	return 0;
}


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

def comb(n,k,p):
  """power_funcを用いて(nCk) mod p を求める"""
  from math import factorial
  if n<0 or k<0 or n<k: return 0
  if n==0 or k==0: return 1
  a=factorial(n) %p
  b=factorial(k) %p
  c=factorial(n-k) %p
  return (a*power_func(b,p-2,p)*power_func(c,p-2,p))%p
def power_func(a,b,p):
  """a^b mod p を求める"""
  if b==0: return 1
  if b%2==0:
    d=power_func(a,b//2,p)
    return d*d %p
  if b%2==1:
    return (a*power_func(a,b-1,p ))%p

N, K = map(int, input().split())
tree = [[] for i in range(N+1)]
for _ in range(N-1):
    a, b = map(int, input().split())
    tree[a].append(b)
    tree[b].append(a)

ans = K
visit = [False]*(N+1)
visit[1] = True
queue = tree[1][:]
for i in range(len(queue)):
    ans *= K-1-i
    ans %= 1000000007
    visit[queue[i]] = True


while len(queue) > 0:
    nextqueue = []
    for now in queue:
        nexttemp = []
        for next in tree[now]:
            if not visit[next]:
                nexttemp.append(next)
                visit[next] = True
        nextqueue.extend(nexttemp)
        for i in range(len(nexttemp)):
            ans *= K-2-i
            ans %= 1000000007
    queue = nextqueue[:]

print(ans)


Measured memory_bytes: 64816
import numpy as np
a,b,n = map(int,input().split())
xbmodlist = []
ans_list = []
if b == 1:
    print(0)
    
else:
    if n >= b-1:
        tmp = b-1
        if b!= 1:
            while tmp <= n:
                xbmodlist.append(tmp)
                tmp += b-1
            for i in xbmodlist:
                ans_list.append(np.floor(a*i/b)-a*np.floor(i/b))

            print(int(max(ans_list)))
    else:
        print(int(np.floor(a*n/b)-a*np.floor(n/b)))

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

#define rep(X,N) for(ll X = 0LL; X < (N); X++)
#define ALL(V) (V).begin(),(V).end()

using namespace std;
typedef long long ll;

const double PI = 3.1415926535897932384626;
const ll MODN = 1000000007;
const ll MODN2 = 998244353;
const double EPS = 1e-10;

int main(){

    int n;
    cin >> n;

    map<string, int> m;

    rep(i, n){
        string s;
        cin >> s;
        m[s]++;
    }

    cout << "AC x " << m["AC"] << endl;
    cout << "WA x " << m["WA"] << endl;
    cout << "TLE x " << m["TLE"] << endl;
    cout << "RE x " << m["RE"] << endl;

    return 0;
}


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

int main() {
  string S;
  cin >> S;
  
  if ( S == "Sunny" ) {
    cout << "Cloudy" << endl; 
  }
  else if ( S == "Cloudy" ) {
    cout << "Rainy" << endl; 
  }
  else {
    cout << "Sunny" << endl; 
  }
}


Measured memory_bytes: 256
# A B
# 8%のときA円，10％のときB円となる消費税商品の税抜価格を出力（切り捨て）
# 複数ある場合はmin,存在しないときは-1
A, B = gets.split.map(&:to_i)
for i in 1..10000
  if A == (i * 0.08).floor && B == (i * 0.1).floor
    puts i
    exit
  end
end
puts -1

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

h_list = list(map(int,input().split()))

way_list = []
for i in range(m):
    org = list(map(int, input().split()))
    org.sort()
    way_list.append(org)

bad = []

for j in range(m):
    way = way_list[j]
    if h_list[way[0]-1] > h_list[way[1]-1]:
        bad.append(way[1])
    elif h_list[way[0]-1] < h_list[way[1]-1]:
        bad.append(way[0])
    else:
        bad.append(way[0])
        bad.append(way[1])

bad = list(set(bad))
print(n - len(bad))


Measured memory_bytes: 34672
N,M = map(int,input().split())
H = list(map(int,input().split()))
AB = []
for _ in range(M):
    AB.append(list(map(int,input().split())))

ans = [1] * N
for i in range(M):
    if H[AB[i][0]-1] < H[AB[i][1]-1]:
        ans[AB[i][0]-1] = 0
    elif H[AB[i][0]-1] > H[AB[i][1]-1]:
        ans[AB[i][1]-1] = 0
    else:
        ans[AB[i][0]-1] = 0
        ans[AB[i][1]-1] = 0

print(sum(ans))

Measured memory_bytes: 31980
#!/usr/bin/env python3
import sys
input = sys.stdin.readline

class UnionFind():
    def __init__(self, n, m = None, read = 0):
        self.n = n
        self.parents = [-1] * n
        if read:
            if m is None:
                exit(print("Warning: What is M"))
            for i in range(m):
                a, b = map(int, input().split())
                self.union(a - 1, b - 1)

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

n, m = map(int, input().split())
*p, = map(int, input().split())
UF = UnionFind(n, m, read = 1)

a = 0
for i in range(n):
    P = p[i] - 1
    if UF.same(P, i):
        a += 1
print(a)

Measured memory_bytes: 13876
#include <iostream>
#include <algorithm>
#include <functional>
#include <utility>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
using namespace std;

#define rep(i,end)          rep2(i,0,(end))
#define rep2(i,beg,end)   for (int i=(beg);i<(end);i++)
#define all(cont)           begin(cont), end(cont)
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll, ll> pii;
typedef pair<ll, string> pis;
typedef pair<string, ll> psi;

string gets(bool skipnewline);


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int c = 0;
    int i = 1;
    int digLimit = 10;
    while (i <= n) {
        while (i < min(digLimit, n+1)) {
            i++; c++;
        }
        i = digLimit * 10;
        digLimit *= 100;
    }
    cout << c << endl;
    return 0;
}

string gets(bool skipToNextline)
{
    if (skipToNextline) gets(false);
    const int LINE_MAX = 1024;
    char buf[LINE_MAX];
    cin.getline(buf, sizeof(buf));
    return buf;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll unsigned long long int
#define mod 1000000007
bool isPrime[1000001];
ll power(ll a,ll b)
{
    ll result = 1;
    while(b>0)
    {
        if(b%2)
        {
            result = (a*result)%mod;
        }
        a = (a*a)%mod;
        b = b/2;
    }
    return result;
}
int gcd(int a,int b)
{
    if(b==0)
    {
        return a;
    }
    return gcd(b,a%b);
}
void sieve()
{
    memset(isPrime,1,sizeof(isPrime));
    isPrime[0] = isPrime[1] = 0;
    for(int i=2;i*i<=1000000;i++)
    {
        if(isPrime[i])
        {
            for(int j=i*i;j<=1000000;j+=i)
            {
                isPrime[j] = 0;
            }
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL),cout.tie(NULL);
    int t,n;
    t = 1;
    for(int i=0;i<t;i++)
    {
        string s1,s2;
        cin>>s1>>s2;
        if(s1.size()!=s2.size()-1)
        {
            cout<<"No";
        }
        else
        {
            bool x = 0;
            for(int i=0;i<s1.size();i++)
            {
                if(s1[i]!=s2[i])
                {
                    x = 1;
                    break;
                }
            }
            if(!x)
            {
                cout<<"Yes";
            }
            else
            {
                cout<<"No";
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3652
#include <cstdio>
#include <iostream>
#include <cmath>
#include <set>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
using namespace std;
typedef long long ll;
const int N=200000+10;
const int mod=1e9+7;
int siz[N],n,x,y,ans[N];
vector<int> g[N];
int qpow(int a,int n)
{
	int res=1;
	while(n)
	{
		if(n&1)res=1ll*res*a%mod;
		a=1ll*a*a%mod;
		n>>=1;
	}
	return res;
}
int inv(int x){
	return qpow(x,mod-2);
}
int dfs(int u,int p)
{
	siz[u]=1;
	for(int v:g[u]){
		if(v==p)continue;
		siz[u]+=dfs(v,u);
	}
	return siz[u];
}
void dfs1(int u,int p)
{
	for(int v:g[u]){
		if(v==p)continue;
		ans[v]=1ll*ans[u]*inv(siz[v])%mod*(n-siz[v])%mod;
		dfs1(v,u);
	}
}
int main()
{
    //freopen("a.in","r",stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>n;
    for(int i=1;i<n;i++){
    	cin>>x>>y;
    	g[x].push_back(y);
    	g[y].push_back(x);
    }
    dfs(1,0);
    ans[1]=1;
    int res=1;
    for(int i=1;i<=n;i++)res=1ll*res*i%mod;
    for(int i=1;i<=n;i++)ans[1]=1ll*ans[1]*siz[i]%mod;
    dfs1(1,0);
	for(int i=1;i<=n;i++){
		cout<<1ll*res*inv(ans[i])%mod<<"\n";
	}
    return 0;
}

Measured memory_bytes: 15476
#include"stdio.h"
int main(){
    int N,D,res=0,X[20][20],i,j,k,H,h;
    scanf("%d%d",&N,&D);
    for(i=0;i<N;i++){
        for(j=0;j<D;j++){
            scanf("%d",&X[i][j]);
        }
    }
    for(i=0;i<N-1;i++){
        for(j=i+1;j<N;j++){
            H=0;
            for(k=0;k<D;k++){
                H+=(X[i][k]-X[j][k])*(X[i][k]-X[j][k]);
            }
            int h=(int) (sqrt(H))*10;
          	h/=10;
            if(h*h==H){
              	res++;
          		//printf("%d %d\n",i,j);
            }
        }
    }
    printf("%d\n",res);
    return 0;
}

Measured memory_bytes: 2144
using System;

namespace A___CODEFESTIVAL_2016
{
    class Program
    {
        static void Main (string[] args)
        {
            var s = Console.ReadLine ();
            var ans = s.Substring (0, 4) + " " + s.Substring (4, 8);
            Console.WriteLine (ans);
        }
    }
}

Measured memory_bytes: 11092
A , V = map(int, input().split())
B , W = map(int, input().split())
T = int(input())
if A < B:
  Am = A + (V * T)
  Bm = B + (W * T)
  if Am >= Bm:
    print("YES")
  else:
    print("NO")
if A > B:
  Am = A - (V * T)
  Bm = B - (W * T)
  if Am <= Bm:
    print("YES")
  else:
    print("NO")


Measured memory_bytes: 9128
#include <stdio.h>
#include <stdlib.h>
int comp(const void* a, const void* b){
	return *(int *)b-*(int *)a;
}
int max(int a, int b){
	if(a>b){
		return a;
	}
	return b;
}
int main(){
	int N;
	int H;
	int a[100000];
	int b[100001];
	scanf("%d %d",&N,&H);
	int i;
	int A;
	A=0;
	for(i=0;i<N;i++){
		scanf("%d %d",&a[i],&b[i]);
		A=max(A,a[i]);
	}
	qsort(b,N,sizeof(int),comp);
	int d;
	d=0;
	int c;
	c=0;
	i=0;
	while(d<H){
		if(b[i]<=A||i==N){
			c=c+(H-d)/A-max(-((H-d)%A),-1);
			printf("%d",c);
			return 0;
		}
		d=d+b[i];
		c=c+1;
		i=i+1;
	}
	printf("%d",c);
}

Measured memory_bytes: 1276
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <stdio.h>
#include <string.h>
using ll = long long;
using namespace std;
//LLONG_MAX = 90^18
#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define LOWER_BOUND(v,a) (lower_bound((v).begin(), (v).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((v).begin(), (v).end(), (a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
void YesNo(bool b) { cout << (b ? "Yes" : "No"); }
void Yes() { cout << "Yes"; }
void No() { cout << "No"; }

set<string> ss;

signed main()
{
	int N;
	cin >> N;
	REP(i, N)
	{
		string s;
		cin >> s;
		ss.insert(s);
	}

	cout << ss.size() << endl;
}




Measured memory_bytes: 19116
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		int[] d = new int[a];
		for(int i = 0; i < a; i++){
			d[i] = sc.nextInt();
		}
      Arrays.sort(d);
		int c = 0; 
		for(int i = 0; i < a; i++){
				for(int j = i + 1; j < a; j++){
					int ok = j;
                      int no = a;
                  while(ok + 1 != no){
                  	if(d[(ok + no) / 2] < d[i] + d[j]){
                    	ok = (ok + no) / 2;
                    }else{
                    	no = (ok + no) / 2;
                    }
                  }
                  c += ok - j;
                  //System.out.println(ok);
                  //System.out.println(j);
							
				}
						
		}
					
		
		System.out.println(c);
		
		
	}
}

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

namespace MP2019A
{
    class MainClass
    {

        static int[] s;

        public static void Main(string[] args)
        {

            s = Array.ConvertAll(Console.ReadLine().Split().ToArray(), int.Parse);

            if((s[0]+1)/2 >= s[1])
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }





            return;


        }
    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
#define REP(i,s,e) for(int i=(s); i<(e);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n)
#define repe(i,n) for(auto &&i:n)
#define all(v) (v).begin(),(v).end()
#define decimal fixed<<setprecision(20)
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1e9;
const LL LLINF = 1e16;

int main(){
    fastcin();
    int l;
    string s;
    cin >> l >> s;
    s = "."+s+".";

    int ans = 0;

    rep1(i, l+1){
        if(s[i] != '.') continue;
        int f = 0;
        for(int j=i-1; j>=0; j--){
            if(s[j] == 'W') continue;
            if(s[j] == 'B'){
                f++;
                break;
            }
            break;
        }
        for(int j=i+1; j<=l+1; j++){
            if(s[j] == 'W') continue;
            if(s[j] == 'B'){
                f++;
                break;
            }
            break;
        }
        if(f == 2) continue;

        int ansl = 0, ansr = 0;
        for(int j=i-1; j>=0; j--){
            if(s[j] == 'W') break;
            if(s[j] == '.'){
                ansl = 0;
                break;
            }
            ansl++;
        }
        for(int j=i+1; j<=l+1; j++){
            if(s[j] == 'W') break;
            if(s[j] == '.'){
                ansr = 0;
                break;
            }
            ansr++;
        }
        chmax(ans, ansl+ansr);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3212
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(ll i = (begin); i < (end); i++)
#define rep(i, n) FOR(i, 0, n)
using ll = long long;
using ull = unsigned long long;
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using pii = pair<int, int>; using pll = pair<ll, ll>; using vi = vector<int>; using vl = vector<ll>;
template<typename T, typename U> static void chmin(T &x, U y) { if (y < x) x = y; }
template<typename T, typename U> static void chmax(T &x, U y) { if (x < y) x = y; }

signed main() {
    string a, b;
    cin>>a>>b;
    rep(i, a.size()) {
        if(a[i] != b[i]) {
            cout<<"No";
            return 0;
        }
    }
    cout<<"Yes";
    return 0;
}

Measured memory_bytes: 3628
#include <iostream>

using namespace std;

int main()
{
    int A, B, C, D, E;
    cin >> A >> B >> C >> D >> E;
    
    int T = 0;
    if (A < 0)  T += -A * C;
    if (A <= 0) T += D;
    T += min(B - A, B) * E;

    cout << T << endl;
    return 0;
}

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

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(ll)(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) reps(i,0,((n)+1))
#define repst(i,s,n) reps(i,s,((n)+1))
#define reprt(i,n,t) for(ll (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(itr,v) for(auto (itr):(v))
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp(x,y) make_pair((x),(y))
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define dbg(x) cout<<#x" = "<<(x)<<ln
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ');}}

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<ld> vld;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

int c[3][3];

signed main() {
	rep(i,3) rep(j,3) cin >> c[i][j];
	repst(x,-200,200) repst(y,-200,200) {
			int a[3] = {x,c[1][0]-y,c[2][0]-y};
			int b[3] = {y,c[0][1]-x,c[0][2]-x};
			bool ng = false;
			rep(i,3) rep(j,3) {
					if (a[i]+b[j]!=c[i][j]) ng = true;
				}
			if (!ng) {
				cout << "Yes" << ln;
				return 0;
			}
		}
	cout << "No" << ln;
}

Measured memory_bytes: 256