akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#define rep(i,n) for(int i = 0;i < (int)(n);i++)
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;
const int MAX_BANK = 100010;

int main() {
	ll dp[MAX_BANK];	//引き出す最大の金額より多めに
	rep(i, MAX_BANK)dp[i] = INF;
	dp[0] = 0;
	//i + out6円は、引き出すのに　dp[i]+1回かかるか、dp[i]回である
	// ex) 1円は、引き出すのに0円 + (1円) * 1回かかる　dp[1] = 1
	//2円は引き出すのに1円+(1円)*1回かかる dp[2] = 2
	//6円は引き出すのに5円 + (1円) * 1回かかる dp[6] = 6
	//6円は引き出すのに0円 + (6円) * 1回かかる　dp[6] = 1
	for (int i = 0; i < MAX_BANK; i++) {
		for (int out6 = 1; i + out6 <= MAX_BANK; out6 *= 6) {
			dp[i + out6] = min(dp[i + out6], dp[i] + 1);
		}
		for (int out9 = 1; i + out9 <= MAX_BANK; out9 *= 9) {
			dp[i + out9] = min(dp[i + out9], dp[i] + 1);
		}
	}
	int n;
	cin >> n;
	cout << dp[n] << endl;
	return 0;
}


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

	public static void main(String[] args) {
		int[] Num = new int[4];
		Scanner n=new Scanner(System.in);
		
		Num[0]=n.nextInt();
		Num[1]=n.nextInt();
		Num[2]=n.nextInt();
		
		for (int a = 1; a >= 0; a--){
			for (int b = 0; b <= 1; b++){
					if (Num[b] > Num[b+1]){
					Num[3]=Num[b];
					Num[b]=Num[b+1];
					Num[b+1]=Num[3];
					}
			}
			}
		System.out.println(Num[0]+" "+Num[1]+" "+Num[2]);
	}

}

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

long long N;
long long pos[100];
bool there[24];
long long ans = 0;


long long dfs(long long idx){
	if(idx == 24){
		vector<long long>vec;
		vec.push_back(0);
		for(long long i = 0; i < 24; i++){
			if(there[i]){
				vec.push_back(i);
			}
		}
		vec.push_back(24);

		long long tmp = INT_MAX;
		for(long long i = 0; i < vec.size() -1 ; i++){
			tmp = min(tmp, vec[i+1] - vec[i]);
		}
		ans = max(tmp, ans);
		return 0;
	}

	if(pos[idx] == 2){
		there[idx] = true;
		there[24-idx] = true;
		dfs(idx + 1);
		there[idx] = false;
		there[24-idx] = false;
		return 0;
	}else if(pos[idx] == 1){
		there[idx] = true;
		dfs(idx + 1);
		there[idx] = false;
		there[24-idx] = true;
		dfs(idx + 1);
		there[24-idx] = false;
		return 0;
	}else if(pos[idx] == 0){
		dfs(idx + 1);
	}else{
		exit(1);
	}
}


int main(){
	cin >> N;
	for(long long i = 0; i < N; i++){
		long long tmp;
		cin >> tmp;
		pos[tmp]++;
		ans = min(ans, tmp);
	}
	if(pos[0] > 0){
			cout << 0 << endl;
			return 0;
	}

	for(long long i = 0; i <= 12; i++){
		if(pos[i] >= 3){
			cout << 0 << endl;
			return 0;
		}
	}

	dfs(0);
	cout << ans << endl;

}

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

const int MAXN = 50;
char mat[MAXN][MAXN];
int mark[MAXN][MAXN];
int adj[2][4] = {{1, -1, 0, 0}, {0, 0, 1, -1}};

int bfs(int yi, int xi){
	memset(mark, -1, sizeof(mark));
	queue<pair<int, int>> Q;
	Q.push({yi, xi});
	mark[yi][xi] = 0;
	int resp = -1;
	while(!Q.empty()){
		pair<int, int> v = Q.front();
		//cout << "---> " << "( " << v.first << " , " << v.second << " )   " << mark[v.first][v.second] << "\n";
		Q.pop();

		for (int k = 0; k < 4; k++){
			int y = v.first + adj[0][k];
			int x = v.second + adj[1][k];

			if (mark[y][x] == -1 && mat[y][x] == '.'){
				Q.push({y, x});
				mark[y][x] = mark[v.first][v.second] + 1;
				resp = mark[y][x];
			}
		}
	}
	return resp;
}

int main(){
	int h, w;
	memset(mat, 0, sizeof(mat));
	scanf("%d %d%*c", &h, &w);
	for (int i = 1; i <= h; i++){
		for (int j = 1; j <= w; j++)
			scanf("%c", &mat[i][j]);
		scanf("%*c");
	}
	
	int ans = -1;
	for (int i = 1; i <= h; i++){
		for (int j = 1; j <= w; j++){
			if (mat[i][j] == '.'){
				ans = max(ans, bfs(i, j));
				//cout << "( " << i << " , " << j << " )\n";
			}
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 3780
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    int N;
    cin >> N;
    vector<ll> A(N);
    rep(i,N) cin >> A.at(i);
    sort(A.begin(), A.end());
    cout << abs(A[0] - A[A.size() - 1]) << endl;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Created on Sun Sep  2 17:29:52 2018
ABC057D
@author: maezawa
"""
import math

n, a, b = list(map(int, input().split()))
v = list(map(int, input().split()))
v.sort(reverse=True)

vave = 0
mi = 0
for i in range(a, b+1):
    vsumi = sum(v[:i])
    vavei = vsumi/(i)
    if vave <= vavei:
        vave = vavei
        ci = v.count(v[i-1])
        cin = v[:i].count(v[i-1])
        m = math.factorial(ci)//math.factorial(cin)//math.factorial(ci-cin)
        mi += m
        #print(i,m)

print(vave)
print(mi)


Measured memory_bytes: 3064
n,k=map(int,input().split())
A=sorted(list(map(int,input().split())))

mod=10**9+7

if A[-1]<0 and k%2==1:
    now=1
    for i in range(k):
        now*=A[-i-1]%mod
        now%=mod
    print(now)
    exit()

l=0
r=n-1
ans=1
if k%2==1:
    ans=A[-1]
    r-=1

for i in range(k//2):
    mi=A[l]*A[l+1]
    pl=A[r]*A[r-1]
    if mi>pl:
        ans*= mi%mod
        ans%=mod
        l+=2
    else:
        ans*= pl%mod
        ans%=mod
        r-=2
print(ans%mod)

Measured memory_bytes: 31716
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
const double PI=acos(-1);

int main(){
    ll n; cin >> n;
    vector<ll> a(n), asum(n);
    rep(i, n){
        cin >> a[i];
        if(i == 0) asum[i] = a[i];
        else asum[i] = asum[i-1] + a[i];
    }
    ll ans = 999999999999;
    rep(i, n-1){
        ll diff = abs(asum[i] - (asum[n-1] - asum[i]));
        ans = min(ans, diff);
    }
    cout << ans << endl;
    return 0;
}

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

long long int N, a[114514], b[114514], c[114514], dpb[114514], dpa[114514], i;

int main(){
    scanf("%lld", &N);
    for(; i < N; ++i){
        scanf("%lld", a + i);
    }
    for(i = 0; i < N; ++i){
        scanf("%lld", b + i);
    }
    for(i = 0; i < N; ++i){
        scanf("%lld", c + i);
    }
    sort(a, a + N);
    sort(b, b + N);
    sort(c, c + N);
    for(i = 0; i < N; ++i){
        dpb[i] = c + N - upper_bound(c, c + N, b[N - i - 1]);
    }
    //for(i = 0; i < N; ++i)cout << dpb[i] << " ";
    //cout << endl;
    partial_sum(dpb, dpb + N, dpb);
    reverse(dpb, dpb + N);
    //for(i = 0; i < N; ++i)cout << dpb[i] << " ";
    //cout << endl;
    for(i = 0; i < N; ++i){
        dpa[i] = dpb[upper_bound(b, b + N, a[N - i - 1]) - b];
    }
    //for(i = 0; i < N; ++i)cout << dpa[i] << " ";
    //cout << endl;
    cout << accumulate(dpa, dpa + N, 0LL) << endl;
    return 0;
}


Measured memory_bytes: 4352
//ll eval(string s, int bm){
//    ll ans = 0;
//    ll cur = 0;
//    for(char c : s){
//        cur = cur*10+c-'0';
//        if(bm%2){
//            ans += cur;
//            cur = 0;
//        }
//        bm /= 2;
//    }
//    ans += cur;
//    return ans;
//}
//ll _(){
//    string s;
//    cin >> s;
//    int n = sz(s);
//    ll ans = 0;
//    rep(i,0,(1<<(n-1))-1)
//        ans += eval(s,i);
//    return ans;
//}
//
//
#include <iomanip>
#include <vector>
#include <utility>
#include <iostream>
#include <string>
#define REP_INT(i,l,r) for(int i = l; i <= r; ++i)
#define GET_REP_MACRO(_1,_2,_3,_4,NAME,...) NAME
#define rep(...) GET_REP_MACRO(__VA_ARGS__,REP_ANY,REP_INT)(__VA_ARGS__)
#define all(v) (v).begin(), (v).end()
#define sz(v) ll(v.size())
#define T1 template<typename T> static
using namespace std;
typedef long long ll;
T1 ostream& operator<<(ostream& stream, const vector<T>& t);
T1 istream& read(T, T, istream& = cin);
ll eval(string s, int bm){
    ll ans = 0;
    ll cur = 0;
    for(char c : s){
        cur = cur*10+c-'0';
        if(bm%2){
            ans += cur;
            cur = 0;
        }
        bm /= 2;
    }
    ans += cur;
    return ans;
}
ll _(){
    string s;
    cin >> s;
    int n = sz(s);
    ll ans = 0;
    rep(i,0,(1<<(n-1))-1)
        ans += eval(s,i);
    return ans;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
        cout << _() << '\n';
}


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

int main() {
    int K, T;
    cin >> K >> T;
    vector<int> a(T);
    int largest = 0;
    int sum = 0;
    for (int i = 0; i < T; ++i) {
        cin >> a[i];
        sum += a[i];
        largest = max(largest, a[i]);
    }
    sum -= largest;
    if (sum >= largest+1) cout << 0 << endl;
    else cout << largest - sum -1 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
typedef long long ll;
ll MOD = 1e9+7;

using namespace std;

int main()
{
	string s;
	int n;
	int bw=0;
	int ans=0;
	bool f;
	
	cin>>s;
	n=s.length();
	int i=0;
	while(i<n)
	{
		f=false;
		if(s[i]=='W')
		{
			while(s[i]=='W' && i<n)
				i++;
			while(s[i]=='B' && i<n)
			{
				f=true;
				i++;
			}
			if(f)
				bw++;
		}else{
			while(s[i]=='B' && i<n)
				i++;
			while(s[i]=='W' && i<n)
			{
				f=true;
				i++;
			}
			if(f)
				bw++;
		}
		//cerr<<i<<" "<<bw<<endl;
	}
	if(bw==0)
	{
		if(s[0]=='W')
			ans=0;
		else
			ans=0;
	}else{
		ans=bw*2;
		if(f)
			ans--;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <tuple>
#include <queue>
#include <set>
#include <cmath>
#include <array>
#include <list>
#include <set>
const int MOD=1000000007;
using namespace std;
typedef long long ll;
typedef tuple<ll,int,int> tup;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> p;
typedef vector<p> vp;
const int INF=1e9;
ll n,ans=0;
bool visited[100005];

bool comp(const pair<ll,ll> &a,const pair<ll,ll> &b)
{
  return a.first+a.second>b.first+b.second;
}

int main(int argc,char const* argv[])
{
  cin >> n;
  vector<pair<ll,ll> > sushi(n);
  memset(visited,false,sizeof(visited));
  for(int i=0;i<n;i++)
    {
      cin >> sushi[i].first >> sushi[i].second;
    }
  sort(sushi.begin(),sushi.end(),comp);
  /*for(int i=0;i<n;i++)
    {
      cout << sushi[i].first << ' ' << sushi[i].second << endl;
      }*/
  for(int i=0;i<n;i++)
    {
      if(i%2==0)
	{
	  ans+=sushi[i].first;
	}
      else
	{
	  ans-=sushi[i].second;
	}
    }
  cout << ans << endl;
  return 0; 
}


Measured memory_bytes: 1920
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<string>
#include<numeric>
#include<set>
#include<math.h>
using namespace std;

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

    vector<pair<int, int> > xy(N);
    int x, y;
    for(int i = 0; i < N; i++){
        cin >> x >> y;
        xy[i] = make_pair(x, y);
    }

    stable_sort(xy.begin(), xy.end());

    vector<pair<int, int> > pq;

    for(int i = 0; i < N; i++){
        for(int j = i+1; j < N; j++){
            pq.push_back(make_pair(xy[i].first-xy[j].first, xy[i].second-xy[j].second));
        }
    }

    stable_sort(pq.begin(), pq.end());

    vector<pair<int, int> > cnt;
    cnt.push_back(make_pair(1, 0));

    for(int i = 1; i < pq.size(); i++){
        if(pq[i-1] == pq[i]) cnt.back().first++;
        else cnt.push_back(make_pair(1, i));
    }

    stable_sort(cnt.begin(), cnt.end(), greater<pair<int, int> >());

    if(N == 1) cout << 1 << endl;
    else cout << N - cnt[0].first << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
 // #include <ext/pb_ds/tree_policy.hpp>
 // #include <ext/pb_ds/assoc_container.hpp>
 #include<chrono>
 using namespace std;
 using namespace std::chrono;      
 //using namespace __gnu_pbds; 
 #define fastio     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
 #define fi         first
 #define se         second
 #define int         long long 
 #define pb         push_back
 #define emp        emplace_back
 #define vv(x)      vector<x>
 #define mp(x,y)    map<x,y>
 #define dq(x)      deque<x>
 #define pql(x)     priority_queue<x>
 #define pqs(x)     priority_queue<x,vv(x),greater<x> >
 #define M          1000000007
 #define forf(i,a,b) for(int i=a;i<b;i++)
 #define it(x)      x::iterator
 #define ll         long long 
 #define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
 #define time__(d)  for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false); debug("%s time : %.4fs", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
 #define vii        vector<int>
 #define big        3e18
 #define sm         -2e9
 #define mkr        make_pair
 #define vpi        vector<pair<int,int> >
 #define pii        pair<int,int>
 #define rng        500005
 #define sz(x)      (int)x.size()
 #define rv(x)      reverse(x.begin(),x.end())
 #define out(x)     cout<<x.fi<<" "<<x.se<<endl;

//#define ordered_set tree<pii, null_type,less<pii>, rb_tree_tag,tree_order_statistics_node_update> 
  
void pr_init()
{
   
    #ifndef ONLINE_JUDGE
    freopen("gin.txt", "r", stdin);
    freopen("gout.txt", "w", stdout);
   
    #endif
}

int total[100001] ;
vector<vii> tree,par;

void dfs(int u,int p)
{
   par[p].pb(u);
   
   int bl =1 ,wh=1;
   

   for(auto x:tree[u])
   if(x!=p)
   {
       dfs(x,u);
       wh = (wh%M*total[x]%M)%M;
       for(auto z:par[x]) bl = (bl%M*total[z]%M)%M;
   }


   total[u] = bl+wh;
   total[u]%=M;

}
void solve()
{
   int n;
   cin >> n;
   
   tree.assign(n+1,vii());
   par.assign(n+1,vii());

   forf(i,0,n-1)
   {
    int u,v;
    cin >> u >> v;
    tree[u].pb(v);
    tree[v].pb(u);
   }

   dfs(1,0);
  //forf(i,1,n+1) cout<<total[i]<<" "<<black[i]<<"\n";
   cout<<total[1];
}


int32_t main()
{
  pr_init();
  //fastio;
  
  auto start = high_resolution_clock::now(); 
 
  solve();
  auto stop = high_resolution_clock::now();
  auto duration = duration_cast<microseconds>(stop - start); 
   // cout << "Time taken by function: "
   //       << duration.count() << " microseconds" << endl; 

 }
      
      

Measured memory_bytes: 23288
#include<bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define ll long long
const int N = 1e5+50 ;
ll dp[102][N], v[N], w[N], n, s;
int main()
{
    cin >> n >> s ;
    for ( int i = 1 ; i <= n ; i++)
        cin >> w[i] >> v[i] ;
    for ( int i = 1 ; i <= n ; i++)
    {
        for ( int c = 1 ; c <= s ; c++)
        {
            ll opt1 = dp[i-1][c] ;
            ll opt2 = 0 ;
            if ( c >= w[i]){
                opt2 += dp[i-1][c-w[i]]+v[i];
            }
            dp[i][c] = max(opt1,opt2);
        }
    }
    cout << dp[n][s];
}


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


int main(){
	long long int C[10010],n,W=0;
	while(1){
		cin>>n;
		if(n==0)break;
		for(int i=0;i<n;i++){
			cin>>C[i];
		}
		sort(C,C+n);
		for(int i=0;i<n;i++){
			W+=C[i]*(n-1-i);
		}
		cout<<W<<endl;
		W=0;
	}
	return 0;
}

Measured memory_bytes: 3068
#!/usr/bin/env python3
a, b = map(int, input().split())
ans = 1
for i in range(2, 1000001):
	if a%i==0 and b%i==0: ans += 1
	while a%i==0: a //= i
	while b%i==0: b //= i
if (a!=1 and b!=1) and (a%b==0 or b%a==0): ans += 1
print(ans)


Measured memory_bytes: 3060
import copy
import sys
import math

def main():
	n,k = map(int,input().split())
	d = list(map(str,input().split()))
	while True:
		s = str(n)
		flag  = True
		for i in s:
			if(i in d):
				flag = False
		if flag:
			print(n)
			sys.exit()
		else:
			n += 1


def listtodict(a):
	b = {}
	for i in a:
		try:
			b[i] += 1
		except:
			b[i] = 1
	return b

def base_10_to_n(X, n):
	X_dumy = X
	out = ''
	while X_dumy>0:
		out = str(X_dumy%n)+out
		X_dumy = int(X_dumy/n)
	if(out == ''): return '0'
	return out

main()

Measured memory_bytes: 40940
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
# 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())
tree = [[] for i in range(N)]
for i in range(M):
    X,Y,Z = map(int,input().split())
    X -= 1
    Y -= 1
    tree[X] += [Y]
    tree[Y] += [X]

# print(tree)
used = [0 for i in range(N)]

def dfs(node,p):
    used[node] = 1
    # print(tree[node])
    for new in tree[node]:
        if new == p or used[new] == 1:continue
        dfs(new,node)

cnt = 0
while sum(used) < len(used):
    for i in range(N):
        if used[i] == 0:
            dfs(i,-1)
            cnt += 1

ans = cnt
print(ans)


Measured memory_bytes: 112924
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;using vvi=vector<vi>;using vl=vector<ll>;
using P=pair<int,int>;using PL=pair<ll,ll>;using vp=vector<P>;
const int INF=1<<30,MOD=1000000007;const ll LINF=1ll<<60;
#define _ol3(_1,_2,_3,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...) _ol3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n) for(int i=n-1;i>=0;--i)
#define REPA(i,v) REP(i,v.size())
#define all(v) (v).begin(),(v).end()
#define bit(n) (1ll<<(n))
#define clamp(n,mi,ma) max(min(n,ma),mi)
#define uniq(v) sort(all(v));v.erase(unique(all(v)),v.end())
#define pb push_back
#define F first
#define S second
#define endl '\n'
#define cho(n,a,b) cout<<((n)?a:b)<<endl
#define YES(n) cho(n,"YES","NO")
#define Yes(n) cho(n,"Yes","No")
#define Poss(n) cho(n,"Possible","Impossible")
template<class T>bool chmax(T&a,const T&b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T&a,const T&b){if(a>b){a=b;return 1;}return 0;}
template<class T>ostream&operator<<(ostream&o,const vector<T>&v){for(const T&i:v)o<<i<<' ';return o;}
template<class T>istream&operator>>(istream&i,vector<T>&v){for(T&j:v)i>>j;return i;}
template<class T,class U>ostream&operator<<(ostream&o,const pair<T,U>&p){return o<<p.F<<' '<<p.S;}
template<class T,class U>istream&operator>>(istream&i,pair<T,U>&p){return i>>p.F>>p.S;}
template<class T>ostream&operator<<(ostream&o,const set<T>&v){for(const T&i:v)o<<i<<' ';return o;}
template<class T>ostream&operator<(ostream&o,const T&t){return o<<t;}
template<class T>istream&operator>(istream&i,T&t){return i>>t;}
#ifndef LOCAL
struct ostdmy{
template<class T>ostdmy&operator<<(const T&t){return*this;}
template<class T>ostdmy&operator<(const T&t){return*this;}};ostdmy cer_;
#define cerr cer_
#endif
int main(){
    cin.tie(0);ios::sync_with_stdio(0);
    ll n,a,b,c,d,e;
    cin>n>a>b>c>d>e;
    chmin(b,a);
    chmin(c,b);
    chmin(d,c);
    chmin(e,d);

    cout<max({
        (n+a-1)/a+0,
        (n+b-1)/b+1,
        (n+c-1)/c+2,
        (n+d-1)/d+3,
        (n+e-1)/e+4,
    })<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
 
using namespace std;
 
int main()
{
  string s;
  cin >> s;
 
  int cnt[26];
  for(int i = 0; i < 26; i++) {
    cnt[i] = count(begin(s), end(s), i + 'a');
  }
  int ret = 0;
  bool one = false;
  for(int i = 0; i < 26; i++) {
    ret += cnt[i] % 2;
  }
 
  cout << ret / 2 << endl;
}

Measured memory_bytes: 3216
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;
#define BIG_NUM 2000000000
using namespace std;

struct Info{
	int number;
};

int main(){

	int N,M,tmp;
	scanf("%d %d",&N,&M);
	Info info[N+1];
	for(int i = 1; i <= N; i++)scanf("%d",&info[i].number);

	for(int button = 1; button <= M; button++){
		for(int i = 2; i <= N; i++){
			if(info[i-1].number%button > info[i].number%button){
				tmp = info[i].number;
				info[i].number = info[i-1].number;
				info[i-1].number = tmp;
			}
		}
	}

	for(int i = 1; i <= N; i++)printf("%d\n",info[i].number);

    return 0;
}

Measured memory_bytes: 2684
#include<stdio.h>

int main(void)
{
  int h,w;
  char a[200][128];
  scanf("%d %d",&h,&w);
  for(int i=0;i<h;i++){
    scanf("%s",a[i]);
  }
  for(int i=0;i<w+2;i++){
    printf("#");
  }
  puts(" ");
  for(int i=0;i<h;i++){
    printf("#%s#\n",a[i]);
  }
  for(int i=0;i<w+2;i++){
    printf("#");
  }
  puts(" ");
  return 0;
}


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

using namespace std;

uint64_t a;
string s;

int main()
{
    cin>>a>>s;
    if (s.length()==5) cout<<a*10;
    else
    {
        uint64_t b=s[0]-'0';
        for (int i=2;i<4;++i)
            b=(b*10)+s[i]-'0';
        cout<<(a*b)/100;
    }
    return 0;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
 ll n;
 cin>>n;
 vector<ll> a(n);
 for(ll i=0;i<n;i++) cin>>a[i];
 vector<vector<ll>> dp(n,vector<ll>(n));
 for(ll i=0;i<n;i++) dp[i][i]=a[i];
 for(ll i=n-1;i>=0;i--){
  for(ll j=i+1;j<n;j++){
   dp[i][j]=max(a[i]-dp[i+1][j],a[j]-dp[i][j-1]);
  }
 }
 cout<<dp[0][n-1]<<endl;
 return 0;
}

Measured memory_bytes: 70784
#include<stdio.h>
int main(){
    int x,a,b,sub1,sub2;
    unsigned u,v;
    scanf("%d %d %d",&x,&a,&b);
    sub1=x-a;
    sub2=x-b;
    u=sub1;
    v=sub2;
    u=(sub1>=0 ? sub1: -sub1);
    v=(sub2>=0 ? sub2: -sub2);
    if(u<v){
        printf("A\n");
    }
    else{
        printf("B\n");
    }
    return 0;
}


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



int main(){
   
    int M=100010;
   vector<int> prime(M,1);
   prime.at(0)=0; prime.at(1)=0;
   for(int i=2;i<M;i++){
     if(prime.at(i)==0){
         continue;
     }
     for(int j=i*2;j<M;j+=i){
         prime.at(j)=0;
     }
   
   } 
   vector<int> A(M,0);
   for(int i=3;i<M;i++){
       if(prime.at(i)==1&&prime.at((i+1)/2)==1){
           A.at(i)=1;
       }
   }
   vector<int> R(M+1,0);
   for(int i=0;i<M;i++){
       R.at(i+1)=R.at(i)+A.at(i);
   }
   int Q; cin>>Q;
   for(int i=0;i<Q;i++){
       int l,r;
       cin>>l>>r;
       cout<<R.at(r+1)-R.at(l)<<endl;
   }
}

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

int selectionSort(int A[100], int n)
{
	int c, i, j, m, minj; // ????????£??\????´?????????¨??????

	for(i=0; i < n; i++){
		minj=i;
		for(j = i; j < n; j++){ 
			if(A[j] < A[minj]){
				minj = j;
			}
		}
		if (minj != i){
		m = A[i];
		 	A[i] = A[minj];
		 	A[minj]=m;
			A[n+1]++;
		}
	}
	c = A[n+1];
	return c;
}

int main (void)
{
	int n, A[100]={0}, i, c;
	
	scanf("%d", &n);
	
	for(i=0; i<n; i++){
		scanf("%d", &A[i]);
	}
	
	c = selectionSort(A,n);
	
	for(i=0; i<n; i++){
		printf("%d", A[i]);
		if(i != n-1) printf(" ");
		if(i == n-1) printf("\n");
	}
	
	printf("%d\n", c);
	
  return 0;
}

Measured memory_bytes: 604
// https://beta.atcoder.jp/contests/abc045
// status:

#define SUBMIT
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
#ifdef SUBMIT
    auto& stream = cin;
#else
    stringstream stream(R"(aca
accc
ca
)");
#endif

    string S[3];
    stream >> S[0] >> S[1] >> S[2];
    char current = 0;
    while (true) {
        if (S[current].size() == 0) {
            cout << static_cast<char>('A' + current) << endl;
            break;
        }

        char next = S[current][0] - 'a';
        S[current].erase(S[current].begin());
        current = next;
    }
    return 0;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
num = n // k
if k == 1:
    print(num ** 3)
else:
    num2 = n // (k // 2) - num

    if k % 2 == 0:
        print(num ** 3 + num2 ** 3)
    else:
        print(num ** 3)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define ri register
#define int long long
using namespace std; const int N=200010;
inline int read()
{
    int s=0, w=1; ri char ch=getchar();
    while(ch<'0'||ch>'9') { if(ch=='-') w=-1; ch=getchar(); }
    while(ch>='0'&&ch<='9') s=(s<<3)+(s<<1)+(ch^48), ch=getchar();
    return s*w;
}
signed main()
{
    int x,y;
    x=read(), y=read();
    printf("%lld\n",x-(y<x));
    return 0;
}

Measured memory_bytes: 3692
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,A,B;
string S;
string alpha = "abcdefghijklmnopqrstuvwxyz";
string ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";


int main() {
    cin>>S;
    ll ss = S.size();
    ll n0=0,n1=0;
    rep(i,ss){
        if(S[i] == '0') ++n0;
        else ++n1;
    }
    cout<<min(n0,n1)*2<<endl;
}

Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
	int n;
	scanf("%d",&n);
	double ans;
	if(n%2) ans=(double)(n/2+1)/n;
	else ans=0.5;
	printf("%.10lf\n",ans);
	return 0;
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
int ctoi(char c) {return c-'0';}// char to int
int gcd(ll a,ll b){return b?gcd(b,a%b):a;}//MAX
int lcm(ll a,ll b){return a*b/gcd(a,b);}//MIN
int  main(){
vector<int>a(4);
for(int i=0;i<6;i++){
    int z;
    cin >> z;
    a.at(z-1)++;
}
sort(a.begin(),a.end());
if(a.at(0)==1&&a.at(0)==a.at(1)&&a.at(2)==2&&a.at(2)==a.at(3))cout<<"YES"<<endl;
else cout <<"NO"<<endl;
}
 


Measured memory_bytes: 256
use std::cmp::max;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

fn main() {
    input!{
        n: usize,
        k: usize,
        s: chars
    }
    let mut s: Vec<usize> = s.iter().map(|&c| {
        if c == '0' {
            0
        } else {
            1
        }
    }).collect();
    let mut vs = vec![];
    let mut last = s[0];
    let mut cnt = 1;
    for i in 1..n {
        if last == s[i] {
            cnt += 1;
        } else {
            vs.push((last, cnt as usize));
            cnt = 1;
            last = s[i];
        }
    }
    vs.push((last, cnt));
    // TEST
    // println!("{:?}", vs);
    let result = if 2 * k >= vs.len() {
        vs.iter().fold(0, |sum, &(_, c)| sum + c)
    } else {
        let mut sum = 0;
        let mut m = 0;
        for (i, &(v, c)) in vs.iter().enumerate() {
            sum += c;
            if i >= 2 * k + 1 {
                sum -= vs[i - (2 * k + 1)].1;
            }
            // println!("i: {}, v: {}, c: {}, sum: {}, m: {}", i, v, c, sum, max(m, sum));
            if v == 0 {
                continue;
            }
            m = max(m, sum);
        }
        sum -= vs[vs.len() - (2 * k + 1)].1;
        max(m, sum)
    };
    println!("{}", result);
}


Measured memory_bytes: 8444
#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() {
  char c;
  cin >> c;
  printf("%c\n", ++c);
  return 0;
}

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

int Binarysearch(int[],int,int);

int main(){
  int i, count=0, n, q, *S, *T;
  scanf("%d",&n);
  S = (int *)malloc(sizeof(int) * n);
  for(i=0; i<n; i++)
    scanf("%d",&S[i]);
  scanf("%d",&q);
  T = (int *)malloc(sizeof(int) * q);
  for(i=0; i<q; i++)
    scanf("%d",&T[i]);

  for(i=0; i<q; i++)
    if(Binarysearch(S,n,T[i]))
      count++;
  printf("%d\n",count);
  free(S);
  free(T);
  return 0;
}

int Binarysearch(int A[],int n,int key){
  int l=0, r=n, m;
  while(l<r){
    m = (l + r) / 2;
    if(A[m] == key)
      return 1;
    else if(A[m] > key)
      r = m;
    else if(A[m] < key)
      l = m + 1;
  }
  return 0;
}

Measured memory_bytes: 1152
//Name: Pankaj Mandrawal (pankaj_m05)
//Problem: Replacing Integer
#include<iostream> 
using namespace std;

int main(void) {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long long n, k; cin >> n >> k;
	long long rem = n % k; 
	cout << min(rem, k - rem) << '\n'; 
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <time.h>
#include <math.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <sstream>
#include <string>
#include <bitset>
using namespace std;
#define FOR(I,F,N) for(int I = F; I < (int)(N); I++)
#define rep(i, n) FOR(i, 0, n)
#define FIN(V) cout<<V<<endl
#define pb push_back
#define INF (1 << 30)
typedef pair<int, int> P;
typedef pair<pair<int, int>, int> PP;
typedef long long ll;
typedef priority_queue<int> pq;
int main(void) {
    string encrypt_S, T;
    cin >> encrypt_S >> T;
    int tsize = T.size();
    if(tsize > encrypt_S.size()){
        cout << "UNRESTORABLE" << endl;
        return 0;
    }
    vector<string> probabilities;
    for(int i = 0; i <= encrypt_S.size() - tsize; i++){
        probabilities.push_back(encrypt_S.substr(i, tsize));
    }
    int index = -1;
    rep(i, probabilities.size()){
        bool found = true;
        int c;
        for(c = 0; c < tsize; c++){
            char now = probabilities[i][c];
            if(now == '?')continue;
            if(now != T[c]){
                found = false;
                break;
            }
        }
        if(found){
            index = i;
        }
    }
    if(index==-1)cout << "UNRESTORABLE" << endl;
    else {
        for (int k = index; k < index + tsize; k++)
        {
            encrypt_S[k] = T[k - index];
        }

        for (int k = 0; k < encrypt_S.size(); k++)
        {
            cout << ((encrypt_S[k] == '?') ? 'a' : encrypt_S[k]);
        }
        cout << endl;
    }
}

Measured memory_bytes: 256
s = input()
n = len(s)
ans = 0
for i in range(2**(n-1)):
  l = [0]
  for j in range(n-1):
    if i >> j & 1:
      l.append(j+1)
  l.append(n)
  for j in range(len(l)-1):
    ans += int(s[l[j]:l[j+1]])
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <string>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <iterator>
#include <limits>
#include <numeric>
#include <utility>
#include <cmath>
#include <cassert>
#include <cstdio>

using namespace std;
using namespace placeholders;

using LL = long long;
using ULL = unsigned long long;
using VI = vector< int >;
using VVI = vector< vector< int > >;
using VS = vector< string >;
using SS = stringstream;
using PII = pair< int, int >;
using VPII = vector< pair< int, int > >;
template < typename T = int > using VT = vector< T >;
template < typename T = int > using VVT = vector< vector< T > >;
template < typename T = int > using LIM = numeric_limits< T >;

template < typename T > inline istream& operator>>( istream &s, vector< T > &v ){ for ( T &t : v ) { s >> t; } return s; }
template < typename T > inline ostream& operator<<( ostream &s, const vector< T > &v ){ for ( int i = 0; i < int( v.size() ); ++i ){ s << ( " " + !i ) << v[i]; } return s; }
template < typename T > inline T fromString( const string &s ) { T res; istringstream iss( s ); iss >> res; return res; }
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); }

#define REP2( i, n ) REP3( i, 0, n )
#define REP3( i, m, n ) for ( int i = ( int )( m ); i < ( int )( n ); ++i )
#define GET_REP( a, b, c, F, ... ) F
#define REP( ... ) GET_REP( __VA_ARGS__, REP3, REP2 )( __VA_ARGS__ )
#define FOR( e, c ) for ( auto &&e : c )
#define ALL( c ) begin( c ), end( c )
#define AALL( a, t ) ( t* )a, ( t* )a + sizeof( a ) / sizeof( t )
#define DRANGE( c, p ) ( c ).begin(), ( c ).begin() + ( p ), ( c ).end()

#define SZ( v ) ( (int)( v ).size() )
#define EXIST( c, e ) ( ( c ).find( e ) != ( c ).end() )

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

#define PB push_back
#define EM emplace
#define EB emplace_back
#define BI back_inserter

#define MP make_pair
#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

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

	int A, B;
	cin >> A >> B;

	if ( A <= 0 && 0 <= B )
	{
		cout << "Zero" << endl;
	}
	else if ( 0 < A )
	{
		cout << "Positive" << endl;
	}
	else
	{
		cout << ( ( B - A ) % 2 ? "Positive" : "Negative" ) << endl;
	}


	return 0;
}


Measured memory_bytes: 256
y=input()
 
if y[0]==y[1] and y[2]==y[3]:
    if y[1]==y[2]:
        print("No")
    else:
        print("Yes")
elif y[0]==y[2] and y[1]==y[3]:
    if y[1]==y[2]:
        print("No")
    else:
        print("Yes")
elif y[0]==y[3] and y[1]==y[2]:
    if y[0]==y[2]:
        print("No")
    else:
        print("Yes")   
    
else:
    print("No")

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

 int N;
 int A[210];

int main(){

 cin >> N;
 for(int i=0;i<N;i++) cin >> A[i];

 int min,max;
 max=*max_element(A,A+N);
 min=*min_element(A,A+N);
 cout << max-min << endl;

}


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

max = m//n
lis = []


for i in range(int(m**0.5)):
    if i != 0 and m%i == 0:
        lis.append(i)
l = len(lis)
for i in range(l):
    if m/lis[i] != lis[i]:
        lis.append(m//lis[i])

lis.sort()
lis = lis[::-1]

if m%n == 0:
    print(max)
else:
    for line in lis:
        if line > max:
            continue
        else:
            if m/line > n:
                print(line)
                break





Measured memory_bytes: 3064
S = input()
n = len(S)
ans = 0
for i in range(2 ** (n-1)):
    F = [False] * (n-1)
    for j in range(n-1):
        if (i >> j) & 1:
            F[j] = True
    tmp = 0
    ct = 0
    prev = 0
    while tmp < n - 1:
        if F[tmp] == True:
            ct += int(S[prev : (tmp + 1)])
            prev = tmp + 1    
        tmp += 1
    ct += int(S[prev :])
    ans += ct
print(ans)

Measured memory_bytes: 3064
import math
def solve(C,A,x,k,s,U):
    if k == 0:
        if min(U) >= x:
            return s
        else:
            return math.inf
    
    else:
        s_use = s+C[k-1]
        U_use = [u+a for u,a in zip(U,A[k-1])]

        return min(solve(C,A,x,k-1,s,U),solve(C,A,x,k-1,s_use,U_use))

        

def main():
    from sys import stdin
    n,m,x = map(int,stdin.readline().rstrip().split())
    C = []
    A = []
    for _ in range(n):
        temp = list(map(int,stdin.readline().rstrip().split()))
        C.append(temp[0])
        A.append(temp[1:])
    
    U = [0]*m
    ans = solve(C,A,x,n,0,U)
    print(ans if ans != math.inf else -1)
    
main()

Measured memory_bytes: 9220
#include <iostream>

using namespace std;

int main()
{
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    int count = 0;
    while (A > 0 && C > 0)
    {
        if (count % 2 == 0)
        {
            C -= B;
        }
        else
        {
            A -= D;
        }
        count++;
    }
    if (A > 0)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

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

int l[8];
int n;
int calc(int selected, int len) {
  int ret = 0;
  int tmp_len = 0;
  for (int i=0; i<n; i++) {
    if ((selected >> i) & 1) {
      tmp_len += l[i];
      ret += 10;
    }
  }
  ret -= 10;
  ret += abs(len - tmp_len);
  return ret;
}
int main() {
  int a, b, c;
  cin>>n>>a>>b>>c;
  for (int i=0; i<n; i++) cin>>l[i];
  int ans = 1e9;
  for (int i=1; i<(1<<n); i++) {
    for (int j=1; j<(1<<n); j++) {
      if ((i & j) != 0) {
        continue;
      }
      for (int k=1; k<(1<<n); k++) {
        if ((i & k) != 0 || (j & k) != 0) {
          continue;
        }
        ans = min(calc(i, a) + calc(j, b) + calc(k, c), ans);
      }
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
//????????£?????????????????????????????¨?????¢???????´?1, 2, ???, N?????????????????£???????????????????????????????????°??¨????????????
//(????????§????????£????´?????????°, ??????3????????£??????????????¨??????)???????????????????????¨???????¨??????§?????????
//????????????(????????§????????£????´?????????°, 2????????£??????????????¨??????)???3?????????????????£??????????????¨??????????±??????????
//???????????????3??????????????\??????????????¨??????????°?????????????????????????

#include <iostream>
using namespace std;

int INF = 876765346;
int dp[2][2501][2501];	//dp[][????????£??????1?????????][????????£??????2?????????] = ????????£??????3????????????????°????

int n;
int t[50];

int main(){
	int i, j, k, m;
	
	cin >> n;
	for( i = 0; i < n; i++ ){ cin >> t[i]; }
	for( i = 0; i < 2501; i++ ) for( j = 0; j < 2501; j++ ){ dp[0][i][j] = INF; }
	
	dp[0][0][0] = 0;
	for( i = 0; i < n; i++ ){
		for( j = (i+1) * 50; j >= 0; j-- ) for( k = (i+1) * 50; k >= 0; k-- ) dp[1][j][k] = INF;
		for( j = i * 50; j >= 0; j-- ){
			for( k = i * 50; k >= 0; k-- ){
				dp[1][j + t[i]][k] = min(dp[0][j][k], dp[1][j + t[i]][k]);
				dp[1][j][k + t[i]] = min(dp[0][j][k], dp[1][j][k + t[i]]);
				dp[1][j][k] = min(dp[0][j][k] + t[i], dp[1][j][k]);
			}
		}
		for( j = (i+1) * 50; j >= 0; j-- ) for( k = (i+1) * 50; k >= 0; k-- ) dp[0][j][k] = dp[1][j][k];
	}
	int ans = INF;
	for( j = n * 50; j >= 0; j-- )
		for( k = n * 50; k >= 0; k-- )
			ans = min(ans, max(j, max(k, dp[0][j][k])));
	cout << ans << endl;
	return 0;
}

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

bool f() {
    int64_t n, a, b, c, d;
    cin >> n >> a >> b >> c >> d;
    b -= a;

    if (d == 0 && b != 0) return false;
    if (c == 0 && b == 0) return true;
    if (abs(b) > (n - 1) * d) return false;

    int64_t t = b - (n - 1) * -d;
    return (n - 1) * (d - c) >= t % (c + d);
}

int main() {
    cout << (f() ? "YES" : "NO") << endl;

    return 0;
}

Measured memory_bytes: 256
N, M, C = map(int, input().split())
B = [int(x) for x in input().split()]
A = [[int(x) for x in input().split()] for _ in range(N)]
cnt = 0

for i in A:
    tmp = 0
    for a, b in zip(i, B):
        tmp += a * b
    tmp += C
    if tmp > 0:
        cnt += 1
print(cnt)


Measured memory_bytes: 38384
#include <iostream>

int main()
{
    int x[4], y[4];
    std::cin >> x[0] >> y[0] >> x[1] >> y[1];
    int dx = x[1] - x[0];
    int dy = y[1] - y[0];
    x[2] = x[1] - dy;
    y[2] = y[1] + dx;
    x[3] = x[2] - dx;
    y[3] = y[2] - dy;
    std::cout << x[2] << " " << y[2] << " " << x[3] << " " << y[3] << std::endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <set>
#include <vector>
#include <deque>
#include <queue>
#include <map>
#include <stack>
#include <string>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <random>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <chrono>
#include <ctime>

using namespace std;

#define en '\n'
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef double db;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const double EPS = 1e-9;
const int INF = 1e9 + 7;
const ll LINF = 1e18;
const double PI = 3.1415926535897932384626433832795;
const int MAX_SIZE = 5e5;
ld START_TIME, TIME;

void fast_in_out() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    START_TIME = clock();
}

void solve() {
    int n;
    cin >> n;
    map<int, int> mp;
    for (int i = 1; i < n; ++i) {
        int x;
        cin >> x;
        ++mp[x];
    }
    for (int i = 1; i <= n; ++i) cout << mp[i] << en;
}

int main() {
    fast_in_out();
    TIME = (clock() - START_TIME) / CLOCKS_PER_SEC;
    int t = 1;
//    cin >> t;
    while (t--) {
        solve();
    }
    cerr << en << TIME << " sec." << en;
    return 0;
}

/*
     ▄▀▀▀▄
▄███▀░◐░░░▌
    ▌░░░░░▐
    ▐░░░░░▐
    ▌░░░░░▐▄▄
    ▌░░░░▄▀▒▒▀▀▀▀▄
   ▐░░░░▐▒▒▒▒▒▒▒▒▀▀▄
   ▐░░░░▐▄▒▒▒▒▒▒▒▒▒▒▀▄
    ▀▄░░░░▀▄▒▒▒▒▒▒▒▒▒▒▀▄
      ▀▄▄▄▄▄█▄▄▄▄▄▄▄▄▄▄▄▀▄
           ▌▌░▌▌
           ▌▌░▌▌
         ▄▄▌▌▄▌▌        */


Measured memory_bytes: 13148
#include <bits/stdc++.h>
using namespace std;
#define PB push_back
#define ZERO (1e-10)
#define INF (1<<29)
#define CL(A,I) (memset(A,I,sizeof(A)))
#define DEB printf("DEB!\n");
#define D(X) cout<<"  "<<#X": "<<X<<endl;
#define EQ(A,B) (A+ZERO>B&&A-ZERO<B)
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
#define IN(n) int n;scanf("%d",&n);
#define FOR(i, m, n) for (int i(m); i < n; i++)
#define REP(i, n) FOR(i, 0, n)
#define F(n) REP(i, n)
#define FF(n) REP(j, n)
#define FT(m, n) FOR(k, m, n)
#define aa first
#define bb second
void ga(int N,int *A){F(N)scanf("%d",A+i);}
#define MX (128)
int N,S,T[MX],a,b;
int main(void){
    scanf("%d",&N),ga(N,T),S=accumulate(T,T+N,0);
    IN(Q)F(Q)scanf("%d%d",&a,&b),printf("%d\n",S-T[--a]+b);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
	int n,i,j,k;string s,t;cin>>n;
	getline(cin,s);
	while(n--){getline(cin,s);t=s;
		for(i=0;i<99;i++)for(j=0;j<26;j++){
			for(k=0;k<s.size();k++)if(t[k]-32)t[k]=97+(i*s[k]+j)%26;
			if(t.find("this")+1||t.find("that")+1)goto loop;
		}loop:cout<<t<<endl;
	}return 0;
}

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

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> ac(n), pena(n);
  rep(i,m) {
    int p;
    string s;
    cin >> p >> s;
    --p;
    if (ac[p]) continue;
    if (s == "AC") {
      ac[p] = 1;
    } else {
      pena[p]++;
    }
  }
  int AC = 0, PENA = 0;
  rep(i,n) {
    AC += ac[i];
    if (ac[i]) PENA += pena[i];
  }
  printf("%d %d\n", AC, PENA);
  return 0;
}


Measured memory_bytes: 1152
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const int INF = 1 << 28;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}

int main() {
    int n, a, b;
    cin >> n >> a >> b;
    cout << min(n * a, b) << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int mod=1e9+7;

int main(){
    int d,g;
    cin >> d >> g;
    vector<int> p(d),c(d);
    vector<bool> solve(d,false),sam(d,false);
    int mn=1e9;

    for(int i = 0; i < d; i++){
        cin >> p[i] >> c[i];
    }

    for(int bit=0; bit<(1<<d); bit++){
        solve = sam;
        ll sum=0,cnt=0;
        for(int i=0; i<d; i++){
            if(bit&(1<<i)) solve[i] = true;
        }
        for(int i = 0; i < d; i++){
            if(solve[i]){
                cnt+=p[i];
                sum+=100*(i+1)*p[i]+c[i];
            }
        }
        if(sum<g){
            for(int i = d-1; i >= 0; i--){
                if(!solve[i]){
                    for(int j = 0; j < p[i]; j++){
                        sum += 100*(i+1);
                        cnt++;
                        if(sum>=g)break;
                    }
                    break;
                }
            }
        }
        if(mn>cnt&&sum>=g)mn = cnt;
    }
    ll sum = 0,cnt=0;
    for(int i = 0; i < p[d-1]; i++){
        sum += 100*d;
        cnt++;
        if(sum>=g)break;
    }
    if(mn>cnt&&sum>=g)mn = cnt;
    cout << mn << endl;
}

Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
constexpr int MOD = 1000000000 + 7;
constexpr int INF = 2000000000;
using namespace std;

int main() {
	int n;
	int ans;
	while (cin >> n&&n) {
		vector<int> p(n);
		for (int i = 0; i < n; i++) {
			cin >> p[i];
		}
		ans = p[0];
		for (int i = 0; i < n; i++) {
			int num = 0;
			for (int j = i; j < n; j++) {
				num += p[j];
				ans = max(ans, num);
			}
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 3096
def main():
    l = input()
    a, b, c = list(map(int, l.split()))
    if a > b:
        a, b = b, a
    if b > c:
        b, c = c, b
    if a > b:
        a, b = b, a
    print(a, b, c)
    return 0


if __name__ == "__main__":
    main()


Measured memory_bytes: 5596
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <set>
#include <unordered_map>
#include <algorithm>

using namespace std;

int main(){
    int a, b;
    cin >> a >> b;
    if (a % 2 != 0 && b % 2 != 0) cout << "Odd";
    else cout << "Even";
    return 0;
}


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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;


#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{
    int n,pcnt=-1,qcnt=-1;
    cin>>n;
    vector<int> p(n),q(n),v(n);
    for (int i = 0; i < n; i++)
    {
        cin>>p[i];
    }
    for (int i = 0; i < n; i++)
    {
        cin>>q[i];
    }
    for (int i = 0; i < n; i++)
    {
        v[i]=i+1;
    }
    int n2=1;
    for (int i = n; i > 0; i--)
    {
        n2*=i;
    }
    
    for (int i = 0; i < n2; i++)
    {
        if(v==p)
        {
            pcnt=i;
        }
        if(v==q)
        {
            qcnt=i;
        }
        next_permutation(v.begin(), v.end());
    }
    cout<<abs(pcnt-qcnt)<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
#define fast                          \
    ios_base::sync_with_stdio(false); \
    cout.tie(NULL);                   \
    cin.tie(NULL);

#define IN cin >>
#define OUT cout <<
#define nl "\n"
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define write(a)          \
    for (auto x : a)      \
    {                     \
        cout << x << " "; \
    }                     \
    cout << nl;
#define read(a)       \
    for (auto &x : a) \
    {                 \
        cin >> x;     \
    }
using ll = long long int;
using ld = long double;
using pll = pair<ll, ll>;
using pii = pair<int, int>;
using vll = vector<ll>;
using vi = vector<int>;
const ll mod = (ll)(1e9) + 7LL;
const ll M = 988244353LL;

void solve()
{
    int n, x, t;
    cin >> n >> x >> t;
    cout << int(ceil(double(n) / double(x)) * t) << endl;
}

int main()
{
    ll tc = 1;
    //IN tc;
    while (tc--)
    {
        solve();
    }
    return 0;
}

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

int main(){
  
  int n,m;
  cin>>n;
  long long d[n];
  for(int i=0;i<n;i++) cin>>d[i];
  cin>>m;
  long long t[m];
  for(int i=0;i<m;i++) cin>>t[i];
  sort(d,d+n);
  sort(t,t+m);
  int i=0,j=0;
  while(j<m){
    if(d[i]==t[j]){
      j++;
      i++;
    }
    else if(d[i]<t[j]){
      i++;
    }
    else break;
  }
  
  if(j==m) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  
}

Measured memory_bytes: 3328