akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define MAX 1000005
#define ll long long
#define upperlimit 1000100
#define INF 1e18
#define eps 1e-8
#define endl '\n'
#define pcc pair<char,char>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tr(container,it) for(typeof(container.begin()) it=container.begin();it!=container.end();it++)
#define MOD 1000000007
#define slld(t) scanf("%lld",&t)
#define sd(t) scanf("%d",&t)
#define pd(t) printf("%d\n",t)
#define plld(t) printf("%lld\n",t)
#define mp(a,b) make_pair(a,b)
#define FF first
#define SS second
#define pb(x) push_back(x)
#define vi vector<int>
#define clr(a) memset(a,0,sizeof(a))
#define debug(a) printf("check%d\n",a)
#define csl ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
int v[1002][1002];
char s[1002][1002];
int main()
{
    int n,m,k;
    cin>>n>>m>>k;
    int l,u;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            cin>>s[i][j];
            if(s[i][j]=='S'){l=i;u=j;}
        }
    }
//    dfs(l,u);
//cout<<"FFF"<<endl;
    queue< pii > q;
    q.push(mp(l,u));
   // cout<<l<<" "<<u<<endl;
    v[l][u]=1;
    while(!q.empty())
    {
            pii h=q.front();
            q.pop();

            int i=h.FF;
            int j=h.SS;
           // cout<<i<<" "<<j<<endl;
            if(i+1<=n&&v[i+1][j]==0&&s[i+1][j]=='.')
            {
                q.push(mp(i+1,j));
                v[i+1][j]=1+v[i][j];
            }
            if(i-1>=1&&v[i-1][j]==0&&s[i-1][j]=='.')
            {
                q.push(mp(i-1,j));
                v[i-1][j]=v[i][j]+1;
            }
            if(j+1<=m&&v[i][j+1]==0&&s[i][j+1]=='.')
            {
                q.push(mp(i,j+1));
                v[i][j+1]=v[i][j]+1;
            }
            if(j-1>=1&&v[i][j-1]==0&&s[i][j-1]=='.')
            {
                q.push(mp(i,j-1));
                v[i][j-1]=v[i][j]+1;
            }
    }
    int ans=100000000;
    for(int i=1;i<=n;i++)
    {

        for(int j=1;j<=m;j++)
        {
            if(v[i][j]==0)continue;
            int d=v[i][j]-1;
            int g=min(i-1,j-1);
            g=min(n-i,g);
            g=min(m-j,g);
            int f;
            if(i==1||i==n||j==1||j==m||d>=k)
            {
                g=g+d;
                f=g/k;
                if(g%k!=0)f++;
                ans=min(ans,f);
                continue;
            }

          //  cout<<g<<" "<<i<<" "<<j<<" "<<f<<" "<<d<<endl;
            f=g/k;
            if(g%k!=0)f++;
            f++;
            ans=min(ans,f);
        }
    }
    cout<<ans<<endl;


}


Measured memory_bytes: 4224
function main(lines) {
  const input = lines.split('\n')
  for(let i=0; i<input.length; i++){
      let array = input[i].split(' ').map(function(val){return parseInt(val,10)}).sort(function(a,b){return a-b;})
      if(array[0] === 0 && array[1] === 0){
          break;
      } else {
          console.log(array.join(' '))
      }
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 20008
D=int(input())
c=list(map(int,input().split()))
s=[list(map(int,input().split())) for _ in range(D)]

last=[0]*26


for d in range(1,D+1):
    ans=0
    for choice in range(1,27):
        ans_tmp=0
        ans_tmp+=s[d-1][choice-1]
        for i in range(26):
            if i+1==choice:
                continue
            ans_tmp-=c[i]*(d-last[i])
        if ans_tmp>ans:
            case=choice
            ans=ans_tmp
    last[case-1]=d
    print(case)

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

using namespace std;

int main()
{
   int n;
   cin>>n;
   vector<char> v;
   for(int i = 0;i<n;i++)
   {
      char ch;
      cin>>ch;
      v.push_back(ch);
   }

   int l = 0;
   int r = v.size()-1;
   int count = 0;
   while(r > l)
   {
       if(v[l] == 'R')
       {
          l++;
       }
       else
       {
           while(r > l)
           {
               if(v[r] == 'R')
               {
                   swap(v[l],v[r]);
                   count++;
                   break;
               }
               else
               {
                   r--;
               }
               
           }
       }

   }

   cout<<count;
    
    return 0;
}

Measured memory_bytes: 3756
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define INF 100000000
#define EPS 1e-10
#define MOD 1000000007
using namespace std;
typedef pair<int,int> P;

string str[8];
map<string,int> m;
int num[8];
vector<int> f;

void solve(){
	int cnt = 0;
	m.clear(); f.clear();
	rep(i,8) num[i] = 0;
	rep(i,8){
		if(m.count(str[i]) == 0){
			m[str[i]] = cnt;
			num[cnt]++;
			cnt++;
		} else num[m[str[i]]]++;
	}
	rep(i,8) if(num[i] > 0) f.push_back(num[i]);
	sort(f.begin(),f.end());
	if(f.size() == 1){
		cout << 1 << endl;
		return;
	}
	if(f.size() == 2 && f[0] == 1){
		cout << 1 << endl;
		return;
	}
	if(f.size() == 2 && f[0] == 2){
		cout << 3 << endl;
		return;
	}
	if(f.size() == 2 && f[0] == 3){
		cout << 3 << endl;
		return;
	} else if(f.size() == 2 && f[0] == 4){
		cout << 7 << endl;
		return;
	}
	long long ans = 0;
	int x[8];
	if(f[0] == 1){
		for(int i = 1; i < f.size(); i++){
			f[i]--;
			for(int j = 0; j < (1<<(f.size()-1)*2); j++){
				int J = j, checker = 0;
				vector<int> y, z;
				for(int k = 1; k < f.size(); k++){
					x[k] = J%4;
					if(x[k] > 0) y.push_back(x[k]);
					checker += x[k];
					J /= 4;
				}
				if(checker != 3) continue;
				for(int k = 1; k < f.size(); k++) if(f[k] < x[k]) checker = -1;
				if(checker == -1) continue;
				for(int k = 1; k < f.size(); k++) if(f[k] > x[k]) z.push_back(f[k]-x[k]);
				if(y.size() == 1){
					if(z.size() == 1) ans += 1;
					if(z.size() == 2) ans += 1;
					if(z.size() == 3) ans += 2;
				} else if(y.size() == 2){
					if(z.size() == 1) ans += 1;
					if(z.size() == 2) ans += 3;
					if(z.size() == 3) ans += 6;
				} else{
					if(z.size() == 1) ans += 2;
					if(z.size() == 2) ans += 6;
					if(z.size() == 3) ans += 12;
				}
			}
			f[i]++;
		}
	} else if(f[0] == 2){
		if(f[1] == 3){
			ans = 24;
		} else{
			if(f[2] == 2) ans = 114;
			else ans = 22;
		}
	}
	
	cout << ans << endl;
}

int main(){
	while(cin >> str[0]){
		for(int i = 1; i < 8; i++) cin >> str[i];
		solve();
	}
}

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

int main(){
	int a, b; cin>>a>>b;
	
	bool ok1 = false;
	bool ok2 = false;
	if(a == 2 || b == 2){
		cout<<"No\n";
		return 0;
	}
	else{
		int x[4] = {4, 6, 9, 11};
		for(int i = 0; i < 4; i++){
			if(x[i] == a){
				ok1 = true;
			}
			if(x[i] ==b){
				ok2=  true;
			}
		}
		if(ok1 && ok2){
			cout<<"Yes\n"; return 0;
		}
	}
	cout<<(ok1 || ok2 ? "No\n" : "Yes\n");
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
    long int L[87];
    int n,i;
    L[0] = 2;
    L[1] = 1;
    scanf("%d",&n);
    for(i=2;i<=n;i++){
        L[i] = L[i-1]+L[i-2];
    }
    printf("%ld\n",L[n]);
    return 0;
}



Measured memory_bytes: 128
N,T = map(int,input().split(' '))
HOME_PATH = [tuple(map(int,input().split(' '))) for i in range(N)]

# 最小コストの経路の番号
x = None
# 最小コスト
min = float('inf')

for c,t in HOME_PATH:
  if t <= T and c < min:
    x = t
    min = c
if min == float('inf'):
  print('TLE')
else:
  print(min)


Measured memory_bytes: 3064
H = int(input())
#H = 1000000000000

import numpy as np

cnt=0
for i in range(100):
    if H<2**(i+1):
        break
    else:
        cnt+=1
        
if cnt == 0:
    print(1)
else:    
    print(np.sum([2**i for i in range(cnt+1)]))

Measured memory_bytes: 12448
import java.util.*;

public class Main {

	public static void compute_maxprofit(int n, int[] prices) {
		int[] table = new int[n];
		int min = prices[0];
		table[0] =Integer.MIN_VALUE;
		
		
		for(int i = 1; i < n; i ++) {
			
			 table[i] = Math.max(prices[i] - min, table[i-1]);
			 
			 if (prices[i] < min) {
				 min = prices[i];
			 }
	}
		System.out.println(table[n-1]);
		
	}
		
		      

	public static void main(String[] args) {
		
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] prices = new int[n];

		
		
		for (int z =0; z < n; z++) {
			
		int temp = scan.nextInt();
		prices[z] = temp;
			
		}
		
		

		compute_maxprofit(n, prices);
		
	}
}



Measured memory_bytes: 71328
s = input()
t = input()

ans = 'z' * len(s)
tmp = 'z' * len(s)

x = False
for i in range(len(s)-len(t)+1):
    ok = True
    for j in range(len(t)):
        if not (s[i+j] == '?' or s[i+j] == t[j]):
            ok = False
    
    if ok:
        x = True
        tmp = s[:i] + t + s[i+len(t):]
        if ans > tmp:
            ans = tmp

if x:
    ans = ans.replace("?", "a")
    print(ans)
else:
    print('UNRESTORABLE')


Measured memory_bytes: 9148
/*In the name of ALLAH, Most Gracious, Most Merciful*/
///     </> : omar_aziz

#include<bits/stdc++.h>

#define ll                      long long int
#define ull                     unsigned long long int
#define PI                      2*acos(0.0)
#define sqr(x)                  (x)*(x)
#define EPS                     10E-10
#define MOD                     1000000007
#define longlimit               92233720368547758
#define infinity                (1<<28)
#define setbits                 __builtin_popcount
#define zerobits                __builtin_ctzll
#define pb(a)                   emplace_back(a)
#define mp                      make_pair
#define ff                      first
#define ss                      second
#define gcd(a, b)               __gcd(a,b)
#define lcm(a, b)               ((a)*(b))/gcd(a,b)
#define pii                     pair<ll,ll>
#define vi                      vector<ll>
#define vii                     vector<pii>
#define watch(x)                cout << (#x) << " is " << (x) << endl
#define FOR(x,n)                for (ll i=x,j=x,k=x;i<n,j<n,k<n;i++,j++,k++)
#define FORR(n,x)               for (ll i=n-1,j=n-1,k=n-1;i>=x,j>=x,k>=x;i--,j--,k--)
#define TEST_CASES()            ll t;cin>>t;while (t--)
#define PRECISION(a,x)          fixed<<setprecision(x)<<a<<endl;
#define all(a)                  (a.begin()),(a.end())
#define UNIQUE(X)               (X).erase(unique(all(X)),(X).end())
#define DELETE(X)               (X).erase (remove (all(X)),(X).end())
#define SORT_UNIQUE(c)          (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define FAST_IO()               ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define FILE_IO()               freopen("output.txt", "w", stdout);freopen("input.txt", "r", stdin)
using namespace std;
ll tc=1;
//ll cnt=0,sum=0,ans=0,res=0,maxi=INT_MIN,mini=INT_MAX,row,col;


void solve()
{
    ll cnt=0,flag=0;
    string s;
    cin>>s;
    for (int i=0;i<3;i++)
    {
        if (s[i]=='R')
        {
            cnt++;
            flag=1;
        }
        else if (flag)
        {
            cout<<cnt<<endl;
            return;
        }
    }
    cout<<cnt<<endl;
}

int32_t main()
{
    FAST_IO();

   // TEST_CASES()
        solve();
}


Measured memory_bytes: 3580
#include<stdio.h>
int main(void){
	int arg[3],s,t,num;
	scanf("%d %d %d",&arg[0],&arg[1],&arg[2]);
	for(s=0;s<=1;s++){
		for(t=s+1;t<=2;t++){
			if(arg[s]>arg[t]){
				num=arg[s];
				arg[s]=arg[t];
				arg[t]=num;
			}
		}
	}
	printf("%d %d %d\n",arg[0],arg[1],arg[2]);
	return 0;
}

Measured memory_bytes: 596
#include<iostream>
#include<stack>
#include<queue>
#include<map>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define sc(x) scanf("%d",&x);
int main(){
    int n, m, minv, ans;
    static const int INF = 1e9;
    sc(n) sc(m)
    P A[n], B[m];
    for (int i = 0; i < n; i++){
        sc(A[i].first) sc(A[i].second)
    }
    for (int i = 0; i < m; i++){
        sc(B[i].first) sc(B[i].second)
    }
    for (int i = 0; i < n; i++){
        minv = INF;
        for (int j = 0; j < m; j++){
            if (minv > abs(A[i].first - B[j].first) + abs(A[i].second - B[j].second)){
                minv = abs(A[i].first - B[j].first) + abs(A[i].second - B[j].second);
                ans = j + 1;
            }
        }
        cout << ans << endl;
    }
    return 0;
}

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

int main() {
  int N, M;
  vector<int> X;
  int A;

  cin >> N;

  for(int i = 0; i < N; i++) {
    int	x;
    cin >> x;
    X.push_back(x);
  }

  cin >> M;
  for(int i = 0; i < M; i++) {
    int	flag = 0;
    cin >> A;
    if(X[A-1] == 2019) continue;
    for(int j = 0; j < N; j++) {
      if((X[A-1]+1) == X[j]) {
        flag = 1;
        break;
      }
    }
    if(flag != 1)
      X[A-1]++;
  }

  for(int i = 0; i < N; i++) {
    cout << X[i] << endl;
  }
  return 0;
}



Measured memory_bytes: 3148
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <ctime>
#include <list>
#include <numeric>
#include <utility>
#include <ctime>
#define INF 1000000000
#define LINF 9000000000000000000
#define mod 1000000007
 
#define rep(i,n) for(int i=0;i<int(n);i++)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair
#define MOD(x) (x%(mod))
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;
 
// int dx[4]={1,0,-1,0};
// int dy[4]={0,1,0,-1};
bool debug=false;
 
/*---------------------------------------------------*/

int main(){
  int n,a,b;
  cin>>n>>a>>b;
  if(abs(a-b)%2==1)cout<<"Borys"<<endl;
  else cout<<"Alice"<<endl;
  return 0;
}


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

using namespace std;

#define ld long double
#define ll long long int
#define endl '\n'
#define check_time() cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MOD 1e9+7
#define INF 0x3f3f3f3f
#define PI 3.141592653589793
#define maxarr(A,n) *max_element(A,A+n) 
#define minarr(A,n) *min_element(A,A+n);

int main()
{
	fastio();
	int R;
	cin>>R;
	cout<<fixed<<setprecision(20);
	cout<<PI*2*R;
	return 0;   
}   


Measured memory_bytes: 3800
#include<bits/stdc++.h>
using namespace std;
int main(){
  int x,y;
  cin>>x>>y;
  if((x+y)%3!=0){
    cout<<0<<endl;
    return 0;
  }
  int k=(x+y)/3;
  x-=k;
  y-=k;
  if(x<0||y<0){
    cout<<0<<endl;
    return 0;
  }
  int p=1000000007;
  vector<int64_t> f(x+y+1,1);
  for(int i=1;i<=x+y;i++)
    f.at(i)=f.at(i-1)*i%p;
  vector<int64_t> fi(x+y+1,1);
  int q=p-2;
  vector<bool> b;
  while(q>0){
    b.push_back(q%2==1);
    q/=2;
  }
  for(int d=(int)b.size()-1;d>=0;d--){
    fi.at(x+y)=fi.at(x+y)*fi.at(x+y)%p;
    if(b.at(d))
      fi.at(x+y)=fi.at(x+y)*f.at(x+y)%p;
  }
  for(int i=x+y;i>=1;i--)
    fi.at(i-1)=fi.at(i)*i%p;
  cout<<f.at(x+y)*fi.at(x)%p*fi.at(y)%p<<endl;
}

Measured memory_bytes: 13796
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
const ll mod=1e9+7;

int main(){
	string S,T;
	cin >> S;
	cin >> T;

	int ans=0;
	for(int i=0; i<S.length(); i++){
		if(S[i]==T[i]) ans++;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <bitset>
#include <functional>
#include <random>
#define REP(_i,_a,_n) for(int _i=_a;_i<=_n;++_i)
#define PER(_i,_a,_n) for(int _i=_n;_i>=_a;--_i)
#define hr putchar(10)
#define pb push_back
#define lc (o<<1)
#define rc (lc|1)
#define mid ((l+r)>>1)
#define ls lc,l,mid
#define rs rc,mid+1,r
#define x first
#define y second
#define io std::ios::sync_with_stdio(false)
#define endl '\n'
#define DB(_a) ({REP(_i,1,n) cout<<_a[_i]<<',';hr;})
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int P = 1e9+7, INF = 0x3f3f3f3f;
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll qpow(ll a,ll n) {ll r=1%P;for (a%=P;n;a=a*a%P,n>>=1)if(n&1)r=r*a%P;return r;}
ll inv(ll x){return x<=1?1:inv(P%x)*(P-P/x)%P;}
inline int rd() {int x=0;char p=getchar();while(p<'0'||p>'9')p=getchar();while(p>='0'&&p<='9')x=x*10+p-'0',p=getchar();return x;}
//head



#ifdef __APPLE__
const int N = 1e2+50;
#else
const int N = 1e6+50;
#endif


int n,x,a[N];

int main() {
	scanf("%d%d",&n,&x);
	REP(i,1,n) scanf("%d",a+i);
	sort(a+1,a+1+n);
	int ans = 0;
	REP(i,1,n) {
		if (a[i]<x&&i!=n) ++ans,x-=a[i];
		else if (a[i]==x) ++ans,x-=a[i];
	}
	printf("%d\n",ans);
}








Measured memory_bytes: 256
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

N,M = map(int,input().split())
A = [int(i) for i in input().split()]
change = [0 for i in range(M)]
for i in range(M):
    change[i] = [int(i) for i in input().split()]

D = []
change = sorted(change,key=lambda x:x[1],reverse=True)
for i in range(M):
    b,c = change[i]
    for j in range(b):
        D += [c]
    if len(D) > N:
        break

A += D
A.sort(reverse=True)
print(sum(A[:N]))


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

#define MAX 2000001
#define BOTTOMUP 0
#define TOPDOWN 1

void swap(int *a, int *b) {
	int tmp = *a;
	*a = *b;
	*b = tmp;
}

void maxHeapify(int *A, int h, int i, int direction) {
	int left, right, largest, next;
	if (i < 1) return;
	left = i * 2;
	right = left + 1;

	if (left <= h && A[left] > A[i]) largest = left;
	else largest = i;

	if (right <= h && A[right] > A[largest]) largest = right;

	if (largest != i) {
		swap(&A[i], &A[largest]);
		next = direction ? largest : i / 2;
		maxHeapify(A, h, next, direction);
	}
}

int main() {
	char order[8];
	int *A = (int *)malloc(sizeof(int) * MAX);
	int i, h = 0, flg = 1;

	while (flg) {
		scanf("%s", order);
		switch (order[2])
		{
		case 's': //insert
			scanf("%d", &A[++h]);
			maxHeapify(A, h, h / 2, BOTTOMUP);
			break;
		case 't': //extract
			printf("%d\n", A[1]);
			swap(&A[1], &A[h]);
			h--;
			maxHeapify(A, h, 1, TOPDOWN);
			break;
		case 'd': //end
			flg = 0;
			break;
		}
	}

	free(A);

	return 0;
}


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

int main() {
	int N; cin >> N;
	int a[2][105];
	for(int i=0; i<N; ++i) cin >> a[0][i];
	for(int i=0; i<N; ++i) cin >> a[1][i];
	int sum=a[0][0];
	for(int i=0; i<N; ++i) sum += a[1][i];
	int ans=sum;
	for(int i=1; i<N; ++i){
	    sum = sum + a[0][i] - a[1][i-1];
	    ans=max(ans, sum);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
n = int(input())
cnt = 0
ans = 1

for i in range(1,n+1):
    num = i
    tmp_cnt = 0
    while num % 2 == 0:
        num = num//2
        tmp_cnt += 1
    if cnt < tmp_cnt:
        cnt = tmp_cnt
        ans = i

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int dy[9] = {-1, -1, -1, 0, 0, 0, 1, 1, 1};
int dx[9] = {-1, 0, 1, -1, 0, 1, -1, 0, 1};
int A, B;
string s[100];

bool check(int y, int x, char c) {
  for (int i = 0; i < 9; i++) {
    int ny = y + dy[i];
    int nx = x + dx[i];
    if (ny >= 0 && ny < 100 && s[ny][nx] != c) return false;
  }
  return true;
}

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> A >> B;
  for (int i = 0; i < 50; i++) {
    s[i] = string(100, '#');
    s[i+50] = string(100, '.');
  }
  A--; B--;
  for (int i = 0; i < 49; i++) {
    for (int j = 0; j < 100; j++) {
      if (check(i, j, '#') && A) {
        s[i][j] = '.';
        A--;
      }
    }
  }
  for (int i = 51; i < 100; i++) {
    for (int j = 0; j < 100; j++) {
      if (check(i, j, '.') && B) {
        s[i][j] = '#';
        B--;
      }
    }
  }
  cout << 100 << " " << 100 << endl;
  for (int i = 0; i < 100; i++) {
    cout << s[i] << endl;
  }

  return 0;
}

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

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if (abs(a - c) <= d || (abs(a - b) <= d && abs(b - c) <= d)) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <algorithm>
#include <random>
#include <chrono>
#include <iomanip>
#define lint unsigned long long int
#define FOR(x, to) for(int x=0; x<(int)(to); x++)
#define DUMP(ar) for(auto itd=begin(ar); itd != end(ar); itd++) cout << "["s << itd - begin(ar) << "]:"s << *itd << endl
#define DUMPL(ar) for(auto itd=begin(ar); itd != end(ar); itd++) { cout << *itd; if(end(ar)-itd > 1) cout << ' '; } cout << endl
#define COUT(x) cout << (x) << endl
#define VCIN(ar) for(auto &vcin: (ar)) cin >> vcin
#define ALL(ar) ar.begin(), ar.end()
#define LOOPD(i) cout << "ループ["s << i << "]回目---------------"s << endl
using namespace std;
// lint:64ビット 10^19

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

    int a, b;
    cin >> a >> b;

    if(a % b == 0){
        cout << a/b << endl;
    }else{
        cout << a/b + 1 << endl;
    }
    

    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define int long long
#define pb push_back
#define pf push_front
#define eb emplace_back
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define f first
#define s second
#define sz(x) (int)x.size()
#define endl "\n"
#define forn(i,n) for(int i=0;i<n;++i)
#define fore(i,l,r) for(int i=int(l);i<=int(r);++i)
#define rep(i,begin,end) for(__typeof(end) i=(begin);i!=(end);i++)
#define fill(a,value) memset(a,value,sizeof(a));
#define gcd(a,b) __gcd((a),(b))
#define watch1(x) cout<<(x)<<endl
#define watch2(x,y) cout<<(x)<<" "<<(y)<<endl
#define watch3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> oset;

const int INF = 9e18;
const int mod = 1e9 + 7;
const int N = 2e5 + 5;

int d, t, s;

void solve()
{
    cin >> d >> t >> s;
    if (d <= s * t)
        cout << "Yes";
    else
        cout << "No";
}

signed main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    fastio;
    int t;
    //cin >> t;
    t = 1;
    while (t--)
    {
        solve();
    }
    return 0;
}

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

int main() {
  int N, X;
  cin >> N >> X;
  
  vector<int> d(N);
  for (int i = 0; i < N; i++) {
  	cin >> d.at(i);
  }
  
  int sum = 0;
  int count = 0;
  for (int i = 0; i < N; i++) {
  	if (sum <= X) {
    	sum += d.at(i);
      	count++;
    }
  }
  if (sum <= X) {
  	count++;
  }
  cout << count << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define SORT(v) sort(v.begin(), v.end());
#define RSORT(v) sort(v.rbegin(), v.rend());
#define REVERSE(v) reverse(v.begin(), v.end());
using ll = long long;
using P = pair<int, int>;

int H, W;
vector<vector<int>> a;
vector<array<int, 4>> ans;

void move_coin(int y, int x, int ny, int nx)
{
    a[y][x]--;
    a[ny][nx]++;
    ans.push_back(array<int, 4>{y, x, ny, nx});
}

int main()
{
    cin >> H >> W;
    a.resize(H);
    rep(i, H)
    {
        a[i].resize(W);
        rep(j, W)
        {
            cin >> a[i][j];
        }
    }

    rep(h, H)
    {
        rep(w, W - 1)
        {
            if (a[h][w] % 2 == 1)
                move_coin(h, w, h, w + 1);
        }
        if (a[h][W - 1] % 2 == 1 && h != H - 1)
            move_coin(h, W - 1, h + 1, W - 1);
    }

    cout << ans.size() << endl;
    rep(i, ans.size())
    {
        cout << ans[i][0] + 1 << " " << ans[i][1] + 1 << " " << ans[i][2] + 1 << " " << ans[i][3] + 1 << endl;
    }
    return 0;
}

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

int main() {
  string s;
  string old_1, old_2, old_3;
  int n, count = 0;
  cin >> n >> s;
  rep(i, n + 2) {
    old_3 = old_2;
    old_2 = old_1;
    old_1 = s[i];
    if (old_3 + old_2 + old_1 == "ABC") count++;
  }
  cout << count << endl;
}

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

int main() {
  int a, b;
  cin >> a >> b;
  if (a + b == 3) {
    cout << 3;
  }
  else if (a + b == 4) {
    cout << 2;
  }
  else {
    cout << 1;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<map>



using namespace std;

int a,b,c;

int main(){
    cin >> a >> b >> c;
    if(a+b+c > 21) cout << "bust" << endl;
    else cout << "win" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll mod=1000000007;
int main()
{
	int n,k;
	cin>>n>>k;
	ll ans=0;
	for(int i=k;i<=n+1;i++)
	{
		ll lb=(((ll)(i-1)*(ll)i)/(ll)2)%mod;
		ll ub=(((ll)(n)*(ll)(n+1))/(ll)2)%mod;
		ub=(ub-(((ll)n-(ll)i)*((ll)n-(ll)i+(ll)1))/(ll)2+mod)%mod;
		ans=(ans+ub-lb+(ll)1+mod)%mod;
	}
	cout<<ans;
	
}

Measured memory_bytes: 3624
#include <stdio.h>
#include <limits.h>
 
long c = 0;
 
void merge(long *a, long left, long mid, long right){
  long n1, n2, i, j, k;
  n1 = mid - left;
  n2 = right - mid;
  long l[n1 + 1], r[n2 + 1];
  for(i = 0; i < n1; ++i) l[i] = a[left + i];
  for(i = 0; i < n2; ++i) r[i] = a[mid + i];
  l[n1] = LONG_MAX;
  r[n2] = LONG_MAX;
  i = 0;
  j = 0;
  for(k = left; k < right; ++k){
    if(l[i] <= r[j]) a[k] = l[i++];
    else a[k] = r[j++];
    c++;
  }
}
 
void merge_sort(long *a, long left, long right){
  if(left + 1 < right){
    long mid = (left + right) / 2;
    merge_sort(a, left, mid);
    merge_sort(a, mid, right);
    merge(a, left, mid, right);
  }
}
 
int main(){
  long n, s[500000], i, j;
  scanf("%ld", &n);
  for(i = 0; i < n; ++i) scanf("%ld", s + i);
 
  merge_sort(s, 0, n);
 
  for(i = 0; i < n; ++i) printf(i != 0 ? " %ld" : "%ld", s[i]);
  printf("\n%ld\n", c);
  return 0;
}

Measured memory_bytes: 8408
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int X = scan.nextInt();
        int Y = scan.nextInt();
        int Z = scan.nextInt();
        //N * Y + (N+1) * Z <= X
        //(Y+Z)N <= X - Z
        // N <= (X-Z)/(Y+Z)
        long answer = (X-Z)/(Y+Z);
        System.out.println(answer);
    }
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<n; ++i)
#define rep1(i, n) for (int i=1; i<=n; ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
constexpr ll  MOD = (1e9+7);
constexpr int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
constexpr int lcm(int a, int b) { return a / gcd(a, b) * b; }

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;
}
ll factorial(ll n, ll m=2) {
    // calculate n!
    m = max(2LL, m);
    ll rtn = 1;
    for (ll i=m; i<=n; i++) {
        rtn = (rtn * i) % MOD;
    }
    return rtn;
}
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
ll modpow(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1)
            res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, m; cin >> n >> m;
    if (abs(n - m) > 1) puts("0");
    else if (abs(n-m) == 0) {
        cout << factorial(n) % MOD * factorial(m) % MOD * 2 % MOD << endl;
    } else {
        cout << factorial(n) % MOD * factorial(m) % MOD << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    int N = scanner.nextInt();
    Node[] nodes = new Node[N];
    for (int i = 0; i < N; i++) nodes[i] = new Node(i);
    for (int i = 0; i < N - 1; i++) {
      int a = scanner.nextInt() - 1;
      int b = scanner.nextInt() - 1;
      int c = scanner.nextInt();

      nodes[a].edges.add(new Edge(nodes[b], c));
      nodes[b].edges.add(new Edge(nodes[a], c));
    }

    int Q = scanner.nextInt();
    int K = scanner.nextInt() - 1;
    dfs(nodes[K], 0);
    for (int i = 0; i < Q; i++) {
      int x = scanner.nextInt() - 1;
      int y = scanner.nextInt() - 1;
      System.out.println(nodes[x].depth + nodes[y].depth);
    }
  }

  private static void dfs(Node n, long depth) {
    n.depth = depth;
    n.visited = true;
    for (Edge e : n.edges) {
      if (!e.to.visited) dfs(e.to, depth + e.dist);
    }
  }

  static class Node {
    final int id;
    boolean visited;
    List<Edge> edges = new ArrayList<>();
    long depth = 0;

    Node(int id) {
      this.id = id;
    }
  }

  static class Edge {
    final Node to;
    final int dist;

    Edge(Node to, int dist) {
      this.to = to;
      this.dist = dist;
    }
  }
}

Measured memory_bytes: 187308
#include <stdio.h>

int main(){
	int n, k, m = 1, m2, m3;
	scanf("%d", &n);
	scanf("%d", &k);
	
	while(n > 0) {
		m2 = m*2;
		m3 = m + k;
		
		if(m2 < m3)
			m = m2;
			
		else if(m3 < m2)
			m = m3;
			
		else
			m = m2;
		
		n -= 1;
	}
	
	printf("%d\n", m);

	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define mk make_pair
#define fi first
#define se second
#define vll vector<ll>
#define pii pair<ll,ll>
#define vvll vector< vector<ll> >
#define pb push_back
#define sz(v) (ll)(v).size()
#define inf 1e18
#define md 1000000007
#define all(v) (v).begin(),(v).end()
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define tel(a){cout<<a<<"\n";}
#define tell(a,b){cout<<a<<" | "<<b<<"\n";}
#define telll(a,b,c){cout<<a<<" | "<<b<<" | "<<c<<"\n";}
#define teln(v,n){cout<<"v- ";rep(o,0,n)cout<<v[o]<<" ";cout<<"\n";}
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
#define TRACE
 
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif


#define M 100010

// a<=a0  s=a0+a1
// a+b=s a^b=x    
// s=x+2(a&b)
// a&b=(s-x)/2 a<=a0   
// 
int main(){
    IOS;
 	
 	ll n;cin>>n;
 	ll A[n],x=0,s,ok=1;
 	rep(i,0,n)cin>>A[i];
 	rep(i,2,n)x^=A[i];
 	s=A[0]+A[1];
 	ll rem=(s-x);
 	if(rem%2 or rem<0)ok=0;
 	rem/=2;
 	ll b=rem;
 	for(ll i=50;i>=0;--i){
 		ll p=1ll<<i;
 		if(x&p and rem&p)ok=0;
 		if(x&p and (b+p)<=A[0])b+=p;
 	}
 	b=A[0]-b;
 	if(b>=A[0] or b<0)ok=0;
 	cout<<(ok?b:-1);
 	
    return 0;
}


Measured memory_bytes: 3648
N = int(input())
nums = [int(input()) for i in range(N)]
idxs = set(nums)
ans = {idxs.pop() : 0 for i in range(len(idxs))}
count = 0

for num in nums:
    ans[num] += 1

for i in ans.keys():
    ans[i] = (ans[i] % 2)

print(sum(ans.values()))


Measured memory_bytes: 23312
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n, m;
  cin >> n >> m;
  vector<pair<int, int>> ab(m);
  for (int i = 0; i < m; i++) cin >> ab[i].first >> ab[i].second;
  sort(ab.begin(), ab.end());
  
  int A = 0, B = 0, ans = 0;
  for (int i = 0; i < m; i++) {
    if (ab[i].first < B) {
      A = ab[i].first;
      B = min(B, ab[i].second);
    }
    else {
      A = ab[i].first;
      B = ab[i].second;
      ans++;
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using System.Security.Policy;
using System.Text;
using System.Threading.Tasks;

class Program
{   static void Main(string[] args)
    {
        string s = Console.ReadLine();
        var array = new[] { "Sunny", "Cloudy", "Rainy" };
        int r = 0;
        for(int i = 0;i < 3; i++)
        {
            if(array[i] == s)
            {
                r = (i + 1) % 3;
                break;
            }
        }
        Console.WriteLine(array[r]);
    }
}


Measured memory_bytes: 11092
a,b,K = map(int,input().split())

def func(m,n):
	x = max(m,n)
	y = min(m,n)
	tmp =[]
	for it in range(y):
		it = it + 1
		if x%it == 0 and y%it==0:
			tmp.append(it)
	return tmp

tmp = func(a,b)
print(tmp[len(tmp)-K])

Measured memory_bytes: 3060
q, h, s, d = [int(i) for i in input().split()]
n = int(input())
a = [[q*8, 0.25, q], [h*4, 0.5, h], [s*2, 1, s], [d, 2, d]]
a.sort()
if a[0][1] != 2:
    print(int(n/a[0][1]*a[0][2]))
else:
    print(n//2*d+(n%2)*a[1][0]//2)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    while(cin>>n,n){
        int num[2000]={},co=n;
        for(int i=0;i<n;i++)cin>>num[i];
        for(int i=0;;i++){
            bool kawa=1;
            if(i==10000){
                cout<<-1<<endl;
                break;
            }
            for(int j=0;j<co&&kawa;j++)if(num[j]!=j+1)kawa=0;
            if(kawa){
                cout<<i<<endl;
                break;
            }
            num[co]=co+1;
            for(int j=0;j<=co;j++){
                if(num[j]==1){
                    for(int k=j+1;k<=co;k++){
                        if(num[k]!=1){
                            swap(num[j],num[k]);
                            break;
                        }
                    }
                }
                num[j]--;
            }
            for(int j=co+1;j>=0;j--){
                if(num[j]!=0){
                    co=j+1;
                    break;
                }
            }
        }
    }
}

Measured memory_bytes: 1168
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
int D,c[26],s[365][26],t[365],v[365],lst[26],m,d[100001],q[100001];

int calc_satisfaction(){
  int stsf=0;
  REP(i,26) lst[i]=0;
  REP(i,D){
    stsf+=s[i][t[i]-1];
    lst[t[i]-1]=i+1;
    REP(j,26) stsf-=c[j]*(i+1-lst[j]);
  }
  return stsf;
}

void chng_t(){
  REP(i,m){
    t[d[i]-1]=q[i];
    cout<<calc_satisfaction()<<endl;
  }
}

int main(){
  cin>>D;
  REP(i,26) cin>>c[i];
  REP(i,D) REP(j,26) cin>>s[i][j];
  REP(i,D){
    int mx=0;
    REP(j,26){
      if(mx<s[i][j]){
        t[i]=j+1;
        mx=s[i][j];
      }
    }
  }
  REP(i,D) cout<<t[i]<<endl;
}

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

int gcd(int x,int y){
  if(y==0)return x;
  return gcd(y,x%y);
}

int lcm(int x,int y,int gcd){
  return gcd*(x/gcd)*(y/gcd);
}

int main(){
  int x,y;
  while(scanf("%d %d",&x,&y)!=EOF)
    cout<<gcd(x,y)<<" "<<lcm(x,y,gcd(x,y))<<endl;
  return 0;
}

Measured memory_bytes: 1208
use std::io::*;
use std::str::FromStr;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n = read::<usize>();
    let mut vs = vec![0; n];
    let mut cs = vec![0; n];
    for i in 0..n {
        vs[i] = read::<i32>();
    }
    for i in 0..n {
        cs[i] = read::<i32>();
    }
    let mut ans = 0;
    for i in 0..n {
        ans += std::cmp::max(0, vs[i] - cs[i]);
    }
    println!("{}", ans);
}


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

void solve(string S)
{
    if (S == "RRR")
        cout << 3 << endl;
    else if (S.find("RR") != string::npos)
        cout << 2 << endl;
    else if (S.find("R") != string::npos)
        cout << 1 << endl;
    else
        cout << 0 << endl;
}

int main()
{
    string S;
    cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 3624
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		double c = sc.nextInt();
		int k = sc.nextInt();

		double d = Math.max(a, b);
		if(d > c) {
			d = d * Math.pow(2, k);
		}else {
			c = c * Math.pow(2, k);
		}

		System.out.println((int)Math.min(a,b) + (int)d + (int)c);


	}

}


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

#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define test cout<<"test"<<endl;
#define fi first
#define se second
#define MP make_pair
#define rep(i,n,m) for(ll i = n; i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = n - 1; i >= (ll)(m); i--)
typedef long long ll;
typedef long double ld;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T>
void chmin(T &a,T b){if(a>b)a=b;}
template<typename T>
void chmax(T &a,T b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>v,ll n){cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
//m.emplace(x,0).fi->se++;

int main(){
  cin.tie(NULL);
  ios_base::sync_with_stdio(false);
  ll res=0,res1=INF,res2=-INF,buf=0;
  bool judge = true;
  ld ret=0;
  ll n;cin>>n;
  vector<ld>a(n);
  rep(i,0,n)cin>>a[i];
  rep(i,0,n){
    ret+=1/a[i];
  }
  ret=1/ret;
  cout<<setprecision(10)<<fixed<<ret<<endl;

  return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx,avx2")
#pragma GCC optimize ("trapv")

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

#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cin.exceptions(cin.failbit);
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(x) (x).size()
#define what_is(x) cerr << #x << " is " << x << endl;
#define wis cout<<endl<<"I already speak english, bitch"<<endl<<endl;
 
typedef long long int lli;
typedef vector<lli> vi;
typedef pair<lli,lli> ii;
typedef vector<ii> vii;
typedef pair<ii,lli> iii;
typedef long double C; 

#define trace(args...) { string  _s =#args; replace(_s.begin(), _s.end(), ',',' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);}
void err(istream_iterator<string> it){}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args){
    cerr <<  *it  << " : " << a << endl;
    err(++it, args...);
}
set<char> foo;
map<char,int> m;
int main(){
	fastio;
	string s; cin>>s;
	rep(i,0,sz(s)) m[s[i]]++,foo.insert(s[i]);
	bool chi=true;
	for(auto x : foo){
		if(m[x]%2!=0) chi=false;
	}
	if(chi) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}


/* stuff you should look for
    * int overflow, array bounds
    * special cases (n=1?), set tle
    * do smth instead of nothing and stay organized
*/

/*
tip:
 crtl+B to find errors in the code  
*/


Measured memory_bytes: 256
N,Y = [int(i) for i in input().split()]
for i in range(N+1):
    for j in range(N-i, -1, -1):
        money = i*10000 + j*5000 + (N - i - j)*1000
        if money == Y:
            print(i,j,N-i-j)
            exit()
        elif money < Y:
            break
print(-1,-1,-1)

Measured memory_bytes: 9080
#include<iostream>
#include <iomanip>
using namespace std;
#define PI 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679
int main()
{
	double r;
	double a,c;
	while(cin>>r)
	{
		a=r*r*PI;
		c=2*r*PI;
		cout<<setiosflags(ios::fixed)<<setprecision(8);
		cout<<a<<" "<<c<<endl;


		
}
}
	

Measured memory_bytes: 3268
#include<stdio.h>
#define N 100000
#define M 2000000000
#define O 0
#define I 1
#define W 2
#define Z 10

struct Card{
  char s;
  int v;
};

struct Card L[N],R[N];

void merge(struct Card A[],int n,int left,int mid,int right){
  int i,j,k;
  int n1=mid-left;
  int n2=right-mid;
  for(i=O;i<n1;i++){
    L[i]=A[left+i];
  }
  for(i=O;i<n2;i++){
    R[i]=A[mid+i];
  }
  L[n1].v=R[n2].v=M;
  i=j=O;
  for(k=left;k<right;k++){
    if(L[i].v<=R[j].v){
      A[k]=L[i++];
    }
    else{
      A[k]=R[j++];
    }
  }
}

void m_sort(struct Card A[],int n,int left,int right){
  int mid;
  if(left+I<right){
    mid=(left+right)/W;
    m_sort(A,n,left,mid);
    m_sort(A,n,mid,right);
    merge(A,n,left,mid,right);
  }
}

int partition(struct Card A[],int n,int p,int r){
  int i,j;
  struct Card t,x;
  x=A[r];
  i=p-I;
  for(j=p;j<r;j++){
    if(A[j].v<=x.v){
      i++;
      t=A[i];
      A[i]=A[j];
      A[j]=t;
    }
  }
  t=A[i+I];
  A[i+I]=A[r];
  A[r]=t;
  return i+I;
}

void quickSort(struct Card A[],int n,int p,int r){
  int q;
  if(p<r){
    q=partition(A,n,p,r);
    quickSort(A,n,p,q-I);
    quickSort(A,n,q+I,r);
  }
}

int main(){
  int i,n,v;
  struct Card A[N],B[N];
  char S[Z];
  int stable=I;

  scanf("%d",&n);
  for(i=O;i<n;i++){
    scanf("%s %d",S,&v);
    A[i].s=B[i].s=S[O];
    A[i].v=B[i].v=v;
  }
  m_sort(A,n,O,n);
  quickSort(B,n,O,n-I);
  for(i=O;i<n;i++){
    if(A[i].s!=B[i].s){
      stable=O;
    }
  }

  if(stable==I){
    printf("Stable\n");
  }
  else{
    printf("Not stable\n");
  }
  for(i=O;i<n;i++){
    printf("%c %d\n",B[i].s,B[i].v);
  }
  return O;
}



Measured memory_bytes: 4080
package main

import (
	"fmt"
)

func main() {
	var a, b int 
	fmt.Scan(&a, &b)
	c := a * b
	var res string
	if c & 1 == 1 {
		res = "Odd"
	} else {
		res = "Even"
	}
	fmt.Println(res)
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
  ll n,k,sum=0;
  cin>>n>>k;
  vector<int> v(n);
  for(ll i=0;i<n;++i)
  {
      cin>>v[i];
  }
  if(k>=n)
  {
      cout<<"0";
  }
  else
  {
    sort(v.begin(),v.end());
    for(ll i=0;i<n-k;++i)
        sum+=v[i];
    cout<<sum;
  }
}
  

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

int main(){
    int n;
    cin >> n;
    for(int i = 0; i < n-1; i++){
        for(int j = i+1; j < n; j++){
            int k = i^j, cnt = 1;
            while(k%2 == 0){
                cnt++, k/=2;
            }
            cout << cnt << " \n"[j+1==n];
        }
    }
    return 0;
}

Measured memory_bytes: 512
// #include {{{
#include <iostream>
#include <cassert>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <ctime>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <string>
#include <bitset>
#include <vector>
#include <complex>
#include <algorithm>
using namespace std;
// }}}
// #define {{{
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
// }}}

const int N = 1e5 + 10;
int K , dis[N];
deque<int> Q;

int main(){
    cin >> K;
    rep(i,0,K) dis[i] = 1<<30;
    Q.push_back(1);dis[1] = 1;
    while(sz(Q)){
        int c = Q.front();Q.pop_front();
        int t = c * 10 % K;
        if(dis[t] > dis[c]) Q.push_front(t) , dis[t] = dis[c];
        t = (c + 1) % K;
        if(dis[t] > dis[c] + 1) Q.push_back(t) , dis[t] = dis[c] + 1;
    }
    printf("%d\n",dis[0]);
    return 0;
}


Measured memory_bytes: 896
h,w = tuple(map(int,input().split()))

a = [[int(t)for t in input().split()]for _ in [0]*h]

steps = []
for i in range(h):
  if i%2==0:
    for j in range(w-1):
      if a[i][j]%2==1:
        steps.append((i+1,j+1,i+1,j+2))
        a[i][j+1]+=1
    if i!=h-1 and a[i][-1]%2==1:
      steps.append((i+1,w,i+2,w))
      a[i+1][-1] +=1
  else:
    for j in range(1,w)[::-1]:
      if a[i][j]%2==1:
        steps.append((i+1,j+1,i+1,j))
        a[i][j-1]+=1
    if i!=h-1 and a[i][0]%2==1:
      steps.append((i+1,1,i+2,1))
      a[i+1][0] +=1

    
print(len(steps))
for s in steps:
  print(*s)
    
      


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

using namespace std;

typedef long long LL;
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

int main(){
	int N; cin >> N;
	vector<int> a(N+1,0);
	repp(i,0,N){
		int P; cin >> P;
		a[P] = a[P-1]+1;
	}
	int ans = N;
	repp(i,1,N+1) ans = min(ans,N-a[i]);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1024
h, w, a, b = map(int, input().split())

MOD = 10 ** 9 + 7

class ModCmb:
    def __init__(self, size):
        self.inv = [1] * (size + 1)
        self.fact = [1] * (size + 1)
        temp_inv = [1] * (size + 1)
        for i in range(2, size + 1):
            temp_inv[i] = ( -(MOD // i) * temp_inv[MOD%i] ) % MOD
        for i in range(2, size + 1):
            self.fact[i] = self.fact[i-1] * i % MOD
            self.inv[i] = self.inv[i-1] * temp_inv[i] % MOD

    def cmb(self, n, r):
        #print(n, r)
        if n <= 1 or n == r:
            return 1
        elif r == 1:
            return n
        res = (self.fact[n] * self.inv[r] % MOD ) * self.inv[n-r] % MOD
        #print(res)
        return res

c = ModCmb(h+w)

ans = 0
x = h-a-1
y = w-b-1
for i in range(h-a):
    j = h+w-2-i-b
    #print(i, j)
    #print(i+b-1, b-1, j, w-b-1)
    ans += c.cmb(i+b-1, b-1) * c.cmb(j, w-b-1)
    ans %= MOD

print(ans % MOD)


Measured memory_bytes: 26740
#include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;
const int INF = 100100100;
const double PI = 3.14159265358979323846;
typedef long long ll;
#define FOR(i, a, b) for (ll i = (a); i < (b); ++i)
#define REP(i, n) for (ll i = 0; i < (n); ++i)

int main() {
  ll n, a[100001] = {0}, counter[100001] = {0}, ans = 0;
  cin >> n;
  REP(i, n) cin >> a[i];
  sort(a, a + n, greater<ll>());
  FOR(i, 0, n) {
    ll count = 0;
    while (a[i + count] == a[i + count + 1]) count++;
    if (count % 2 == 0) ans++;
    i += count;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024