akhauriyash/Code-Regression huggingface dataset:
"use strict";

const input = require("fs").readFileSync("/dev/stdin", "utf8");
const rows = input.trim().split("\n");

const header = rows.shift().split(" ").map(Number);
const N = header[0];
const M = header[1];

const HList = rows.shift().split(" ");
const HMap = {};
HList.forEach((H, index) => {
  HMap[index + 1] = Number(H);
});

const falseMap = {};
rows.forEach((row) => {
  const pair = row.split(" ").map(Number);
  const A = pair[0];
  const B = pair[1];
  const HA = HMap[A];
  const HB = HMap[B];
  if (HA < HB) {
    falseMap[A] = true;
  } else if (HA > HB) {
    falseMap[B] = true;
  } else if (HA === HB) {
    falseMap[A] = true;
    falseMap[B] = true;
  }
});

const result = N - Object.keys(falseMap).length;
console.log(result);


Measured memory_bytes: 64296
#include <stdio.h>
int main(){
  int a,b,c;
  scanf("%d%d%d",&a,&b,&c);
  if(a==5&&b==5&&c==7){
    printf("YES");
  }
     else if(a==7&&b==5&&c==5){
    printf("YES");
     }
        else if(a==5&&b==7&&c==5){
    printf("YES");
        }
  else{
    printf("NO");
  return 0;
  }
}

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

int main() {
  int N;
  cin >> N;
  if (N % 1000 % 111 == 0 || (N - N % 10) % 111 == 0) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main(){
    int N;
    cin >> N;
    vector<int> a(N),b(N),c(N);
    for (int i = 0; i < N;i++){
        cin >> a[i] >> b[i] >> c[i];
    }
    vector<vector<int> > dp(N,vector<int>(3,0));
    dp[0][0] = a[0];
    dp[0][1] = b[0];
    dp[0][2] = c[0];
    for (int i = 1; i < N;i++){
        dp[i][0] = max(dp[i - 1][1], dp[i - 1] [2]) + a[i];
        dp[i][1] = max(dp[i - 1][0], dp[i - 1] [2]) + b[i];
        dp[i][2] = max(dp[i - 1][0], dp[i - 1] [1]) + c[i];
    }
    cout << max({dp[N - 1][0], dp[N - 1][1], dp[N - 1][2]}) << endl;
    return 0;
}

Measured memory_bytes: 6912
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  int N, a;
  cin >> N;
  a = N % 10;
  if(a == 2 ||a == 4 ||a == 5 ||a == 7 ||a == 9){
    cout << "hon" <<endl;
}
else if(a == 0 ||a == 1 ||a == 6 ||a == 8){
  cout << "pon" <<endl;
}
  else if(a == 3){
    cout << "bon" <<endl;
  }
}

Measured memory_bytes: 3624
float c[8];j;int f(i){return c[i+1]*(c[(i+2)%6]-c[6])+c[(i+3)%6]*(c[6]-c[i])+c[7]*(c[i]-c[(i+2)%6]);}main(){for(;~scanf("%f",c+j++);j%8||puts(f(j=0)*f(2)>0&&f(2)*f(4)>0?"YES":"NO"));}

Measured memory_bytes: 0
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <iostream>
#include <climits>
#include <cfloat>


using namespace std;


int main()
{
	while (true)
	{
		int n;
		scanf("%d\n", &n);
		if (n == 0)
			break;

		int t = 0;
		while (n >= 5)
		{
			n /= 5;
			t += n;
		}
		printf("%d\n", t);
	}

	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
#define fore(i,a,b) for(ll i=(a);i<=(b);++i)
#define rep(i,n) fore(i,0,(n)-1)
#define rfore(i,a,b) for(ll i=(b);i>=(a);--i)
#define rrep(i,n) rfore(i,0,(n)-1)
#define all(x) (x).begin(),(x).end()
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
template<class T>
bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>
bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
template<class T>
ll sum(const T& a){return accumulate(all(a),0LL);}

void solve(){
    ll n;cin>>n;
    cout<<n*n*n<<endl;
}

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


Measured memory_bytes: 3092
/*input
3
SRSRRSRRRSRRRR
*/
#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;
typedef tree<long long, null_type, less_equal<long long>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
typedef long long int ll;
#define ld double
#define pii pair<ll,ll>
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
const ll maxn=6e5+5;
const ll maxlg=__lg(maxn)+2;
const ll INF64=4e18;
const int INF=0x3f3f3f3f;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld eps=1e-9;
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define MP make_pair
ll mult(ll a,ll b){
    ll res=0LL;
    while(b){
        if(b&1) res=(res+a)%MOD;
        a=(a+a)%MOD;
        b>>=1;
    }
    return res%MOD;
}
ll mypow(ll a,ll b){
    ll res=1LL;
    while(b){
        if(b&1) res=res*a%MOD;
        a=a*a%MOD;
        b>>=1;
    }
    return res;
}
int ans[13][maxn];
string nxt[13][maxn];
int main(){
    int lvl;
    string t;
    cin>>lvl>>t;
    string s="";
    for(int i=0;i<sz(t);){
        if(t[i]=='S'){
            int c=i;
            while(t[i]=='S'){
                ++i;
            }
            if((c-i)%2) s+='S';
        }
        else{
            s+='R';
            ++i;
        }
    } 
    ans[0][0]=0;
    nxt[0][0]=s;
    int suff=1;
    REP1(i,lvl){
        REP(bt,3){
            REP(sf,suff){
                int cur=bt;
                int n=bt*suff+sf;
                for(auto x:nxt[i-1][sf]){
                    if(x=='S'){
                        if(cur) cur=3-cur;
                        if(sz(nxt[i][n]) and nxt[i][n].back()=='S'){
                            nxt[i][n].pop_back();
                        }
                        else{
                            nxt[i][n].pb('S');
                        }
                    }
                    else{
                        ++cur;
                        if(cur==3){
                            nxt[i][n].pb('R');
                            cur=0;
                        }
                    }
                }
                ans[i][n]=ans[i-1][sf]+cur*suff;
            }
        }
        suff*=3;
    }
    REP(i,mypow(3,lvl)){
        cout<<ans[lvl][i]<<' ';
    }
}

Measured memory_bytes: 255288
N,T=map(int,raw_input().split(' '))
t=map(int,raw_input().split(' '))

X=0

for i in range(N):
    if i==N-1:
        X+=T
    elif t[i+1]-t[i]>T:
        X+=T
    else:
        X+=(t[i+1]-t[i])

print X

Measured memory_bytes: 20036
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INFLL LLONG_MAX // 9223372036854775807
#define EPS 1e-9
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
using namespace std;

int main(){
    Init();
    ll n, m, k, ans = 0; cin >> n >> m >> k;
    vi a(n), b(m);
    rep(i, n) cin >> a[i];
    rep(i, m) cin >> b[i];

    vi sumTimeA(n+1);
    vi sumTimeB(m+1);
    repf(i, m){
        sumTimeB[i] = sumTimeB[i-1]+b[i-1];
        if(sumTimeB[i] <= k) ans = i;
    }

    repf(i, n){
        sumTimeA[i] = sumTimeA[i-1]+a[i-1];
        if(sumTimeA[i] > k) break;
        auto Idx = upper_bound(all(sumTimeB), k-sumTimeA[i])-sumTimeB.begin(); Idx--;
        chmax(ans, i+Idx);
    }
    cout << ans << endl;
}

Measured memory_bytes: 9536
// ACM-ICPCà\I2010 D. ®ç®ç

#include <iostream>
#include <string>
#include <queue>
#include <cstring>

using namespace std;

char dx[] = {0, 1, 0, -1};
char dy[] = {1, 0, -1, 0};

int w, h;
string s[60];
bool check[60][10];

bool isStable(int _y, int _x, int *rootM, int *rootCnt){
    bool res = true;
    int M = 2, cnt = 4, XL = 100, XR = -100;
    queue< pair<int, int> > qu; qu.push(make_pair(_y,_x));
    while(!qu.empty()){
        pair<int, int> p = qu.front(); qu.pop();
        int y = p.first, x = p.second;
        if(check[y][x]) continue;
        check[y][x] = true;
        M += x;
        if(y==h-1||(s[y+1][x]!='.'&&s[y+1][x]!=s[y][x])){
            XL = min(XL, x  );
            XR = max(XR, x+1);
        }
        if(y!=0&&!check[y-1][x]&&s[y-1][x]!='.'&&s[y-1][x]!=s[y][x])
            if(!isStable(y-1, x, &M, &cnt)) return false;
        for(int k=0;k<4;k++){
            int ny = y+dy[k], nx = x+dx[k];
            if(ny<0||h<=ny||nx<0||w<=nx) continue;
            if(s[ny][nx]=='.'||s[ny][nx]!=s[y][x]) continue;
            qu.push(make_pair(ny, nx));
        }
    }
    *rootM   += M;
    *rootCnt += cnt;
    return cnt*XL < M && M < cnt*XR;
}

int main(){
    int dM, dC;
    while(cin >> w >> h, w){
        for(int i=0;i<h;i++) cin >> s[i];
        memset(check, false, sizeof(check));
        for(int i=0;i<w;i++)
            if(s[h-1][i]!='.'){
                printf("%sSTABLE\n", isStable(h-1, i, &dM, &dC) ? "" : "UN");
                break;
            }
    }
}

Measured memory_bytes: 0
#include<cstdio>
const int MAXN = 100000;
int A[MAXN + 5], B[MAXN + 5], N;
int main() {
	scanf("%d", &N);
	for(int i=1;i<=N;i++)
		scanf("%d", &A[i]), B[A[i]] = i;
	for(int i=1;i<=N;i++)
		printf("%d%c", B[i], (i == N) ? '\n' : ' ');
}

Measured memory_bytes: 1536
import java.util.*;
public class Main {

	public static void main(String[] args) 
	{
		// TODO Auto-generated method stub
		Scanner in=new Scanner(System.in);
        long a=in.nextLong();
        long ans=100,ctr=0;
        while(ans<a)
        {
        	ans=ans+(long)(0.01*ans);
        	ctr++;
        }
        System.out.println(ctr);
	}

}


Measured memory_bytes: 35836
N,K=map(int,input().split())
ans=0
ans1=0
if K%2!=0:
    for i in range(1,N+1):
        if i%K==0:
            ans+=1
    print(ans**3)
else:
    for i in range(1,N+1):
        if int(i%K)==int(K/2):
            ans1+=1
        elif i%K==0:
            ans+=1
    print(ans**3+ans1**3)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
const int N=4010;
int w[N],ne[N],la[N],t=1,ban[N];
void link(int x,int y){
	w[++t]=y;
	ne[t]=la[x];
	la[x]=t;
}
int n,m;
int pu[N],pv[N],res[N];
int px[N],py[N],t1,tag[N],now,used[N],tnx[N];
vector<int> q[N];
int dfs(int x,int fa,int tar){
	if (x==tar)return 1;
	for (int y=la[x];y;y=ne[y]){
		int z=w[y];
		if (z==fa)continue;
		if (dfs(z,x,tar)){
			q[y/2].push_back(now);
			return 1;
		}
	}
	return 0;
}
int z1,z2,yy;
void find(int x,int fa){
	int cnt=0;
	for (int y=la[x];y;y=ne[y]){
		int z=w[y];
		if (z==fa||ban[y])continue;
		find(z,x);
		cnt++;
		if (z1==z)yy=y;
	}
	if (!cnt)z1=x,z2=fa;
}
int mrk[N],ans;
int go(int x,int fa,int tar){
	if (x==tar)return 1;
	for (int y=la[x];y;y=ne[y]){
		int z=w[y];
		if (z==fa)continue;
		if (go(z,x,tar)){
			mrk[y>>1]++;
			return 1;
		}
	}
	return 0;
}
int main(){
	cin>>n>>m;
	for (int i=1;i<n;i++){
		int x,y;
		scanf("%d%d",&x,&y);
		link(x,y);
		link(y,x);
	}
	for (int i=1;i<=m;i++){
		now=i;
		scanf("%d%d",&pu[i],&pv[i]);
		px[i]=pu[i],py[i]=pv[i];
		dfs(px[i],0,py[i]);
	}t=m;
	for (int i=1;i<n;i++){
		find(1,0);
		if (tag[yy>>1])ans+=2;
		else {
			int cnt=0,d1=0,d2=0;
			for (auto x:q[yy>>1])
				if (!used[x])cnt++,d2=d1,d1=x;
			ans+=min(cnt,2);
			if (cnt>=2){
				used[d1]=used[d2]=1;
				memset(mrk,0,sizeof mrk);
				used[d1]=used[d2]=1;
				go(px[d1],0,py[d1]);
				go(px[d2],0,py[d2]);
				for (int i=1;i<n;i++)
					if (mrk[i]==2)tag[i]=1;
				int u=0,v=0;
				for (int i=1;i<=n;i++){
					int cnt=0;
					for (int y=la[i];y;y=ne[y])
						cnt+=mrk[y>>1]==1;
					if (cnt==1)v=u,u=i;
				}
				if (!u){
					if (px[d1]==px[d2])
						res[d2]=1;
				}
				else {
					px[++t]=u;
					py[t]=v;
					if (py[d1]==u||px[d1]==v)res[d1]=1;
					if (py[d2]==u||px[d2]==v)res[d2]=1;
					tnx[d1]=tnx[d2]=t;
					now=t;
					dfs(px[t],0,py[t]);
				}
			}
		}
		ban[yy]=ban[yy^1]=1;
		for (auto x:q[yy>>1]){
			if (px[x]==z1)px[x]=z2;
			if (py[x]==z1)py[x]=z2;
		}
	}
	cout<<ans<<endl;
	for (int i=t;i>=1;i--){
		if (tnx[i])res[i]^=res[tnx[i]];
	}
	for (int i=1;i<=m;i++){
		if (!res[i])printf("%d %d\n",pu[i],pv[i]);
		else printf("%d %d\n",pv[i],pu[i]);
	}
}

Measured memory_bytes: 7040
#include <iostream>
#include <vector>
int main(){
  int n, a, b;
  std::cin >> n;
  if (floor(ceil(n / 1.08) * 1.08) == n){
  	std::cout << ceil(n / 1.08) << std::endl;
  }else{
  	std::cout << ":(" << std::endl;
  }
}

Measured memory_bytes: 3292
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define fi first
#define se second
using namespace std;
const ll INF = 1LL<<60;
const int inf = 1<<30;
inline void fastio() {ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);}
const int maxn = 2e5+5;
char s[maxn];
unsigned short f[maxn][2020];
int main()
{
    fastio();
    cin>>s+1;
    int n = strlen(s+1);
    for(int i=1;i<=n;i++) s[i]=s[i]-'0';
    for(int i=1;i<=n;i++) f[i][s[i]]=1;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<2019;j++)
        {
            f[i+1][(10*j+s[i+1])%2019] += f[i][j];
        }
    }
    ll ans = 0;
    for(int i=4;i<=n;i++) ans += f[i][0];
    cout<<ans<<endl;
    return 0;
}


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

main(){
  string num;
  int d[10];

  while(cin >> num ){
    for ( int i = 0; i < 10; i++ ) d[i] = num[i]-'0';
    for ( int e = 8; e >= 0; e-- ){
      for ( int i = 0; i <= e; i++ ){
	d[i] = (d[i]+d[i+1])%10;
      }
    }
  cout << d[0] << endl;
  }

}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
int main() {
	queue<string> a;
	string b, c;
	int d, e;
	while (true) {
		cin >> b;
		if (b =="-") break;
		for (int i = 0; i < b.size(); i++) {
			c = b[i];
			a.push(c);
		}
		cin >> d;
		for (int i = 0; i < d; i++) {
			cin >> e;
			for (int j = 0; j < e; j++) {
				c = a.front();
				a.pop();
				a.push(c);
			}
		}
		for (int i = 0; i < b.size(); i++) {
			c = a.front();
			cout << c;
			a.pop();
		}
		cout << "\n";
	}
}


Measured memory_bytes: 3104
#include<iostream>
#include<string>
#include<map>
#include<vector>
using namespace std;
int n,b,c;
vector<int> v[15];
string s;
int main()
{
	cin>>n;
	cin>>s;
	for(int i=0;i<s.size();i++)
		v[s[i]-'0'].push_back(i);
	long long ans=0;		
	for(int i=0;i<10;i++)
	{
		for(int o=0;o<10;o++)
		{
			for(int j=0;j<10;j++)
			{
				if(v[i].size()==0 ||v[o].size()==0 ||v[j].size()==0)
					continue;
				if(i==o && o==j)
				{
					if(v[i].size()>=3)
						ans++;
					continue;	
				}
				if(i==o)
				{
					if(v[i].size()<2)
						continue;	
					if(v[j][v[j].size()-1]>v[i][1])
						ans++;	
				}
				else if(o==j)
				{
					if(v[o].size()<2)
						continue;
					if(v[j][v[j].size()-2]>v[i][0])
						ans++;	
				}
				else if(i==j)
				{
					if(v[j].size()<2)
						continue;
					int h=v[i][0];
					int l=0,r=v[o].size(),w;
					while(r-l!=1)
					{
						w=(l+r)/2;
						if(v[o][w]<h)
							l=w;
						else
							r=w;	
					}
					w=(l+r)/2;
					if(v[j][v[j].size()-1]>=v[o][w] && v[i][0]<v[o][w])
						ans++;
					else if(w+1<v[o].size())
						if(v[j][v[j].size()-1]>=v[o][w+1] && v[i][0]<v[o][w+1])
							ans++;
				}
				else
				{
					int h=v[i][0];
					int l=0,r=v[o].size(),w;
					while(r-l!=1)
					{
						w=(l+r)/2;
						if(v[o][w]<h)
							l=w;
						else
							r=w;	
					}
					w=(l+r)/2;
					if(v[j][v[j].size()-1]>=v[o][w] && v[i][0]<v[o][w])
						ans++;
					else if(w+1<v[o].size())
						if(v[j][v[j].size()-1]>=v[o][w+1] && v[i][0]<v[o][w+1])
							ans++;		
				}
			}
		}
	}		
	cout<<ans<<endl;	
} 

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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

int N, M;
std::multiset<int, std::greater<int>> s;

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

  std::cin >> N >> M;

  for(int i=0;i<N;++i){
      int A;
      std::cin >> A;

      s.emplace(A);
  }

  for(int i=0;i<M;++i){
      int A = *s.begin();
      s.erase(s.begin());
      s.emplace(A / 2);
  }

  ll res = std::accumulate(s.begin(), s.end(), 0ll);
  std::cout << res << std::endl;
}


Measured memory_bytes: 4992
from heapq import heappop, heappush

N, H = map(int, input().split())
a = [None] * N
b = [None] * N
for i in range(N):
    a[i], b[i] = map(int, input().split())

a.sort()
b.sort()
q = []
for i in range(N):
    if b[i] > a[-1]:
        heappush(q, -b[i])

ans = 0
while q:
    H += heappop(q)
    ans += 1
    if H <= 0:
        print(ans)
        exit()

print(ans + (H+a[-1]-1)//a[-1])

Measured memory_bytes: 20988
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
typedef long long ll;
typedef vector<vector<ll>> vvl;
typedef vector<ll> vl;
typedef vector<vector<char>> vvc;
typedef vector<char> vc;
typedef pair<ll,ll> pll;
typedef priority_queue<string> priquest;
typedef priority_queue<string,vector<string>,greater<string>> rpriquest;
ll max(ll x,ll y){
if(x>y)return x;
else return y;
}
ll min(ll x,ll y){
  return x+y-max(x,y);
}

const ll big=1000000007;
ll exp(ll a, ll b){
  if(b==0)return 1;
  if(a==1||a==0)return a;
  if(b%2==0){
    int t =exp(a,b/2);
    return t*t%big;
  }
  else return exp(a,b-1)*a%big;
}

int main(){
    ll n;cin >> n;
    ll ans=1;
    rep(i,n){
        ans*=(i+1);
        ans%=big;
    }
    cout << ans << endl;
}

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

#define lli long long int
#define pi pair<int,int>
#define mod 1000000007

int min_cost(vector<int> &height)
{
	int n=height.size();

	vector<int> cost(n,0);

	cost[1]=abs(height[1]-height[0]);

	for(int i=2;i<n;i++)
	{
		cost[i]=min(cost[i-1]+abs(height[i]-height[i-1]),cost[i-2]+abs(height[i]-height[i-2]));
	}

	return cost[n-1];
}

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


	int n;
	cin>>n;
	vector<int> height(n);
	for(int i=0;i<n;i++)
		cin>>height[i];

	cout<<min_cost(height)<<endl;
	return 0;
}

Measured memory_bytes: 3936
import random as rng
import itertools as it
import collections as col
import heapq as hq
import sys
import copy as cp
sys.setrecursionlimit(10**9)


def dump_impl(*objects):
    print(*objects, file=sys.stderr)


def dump_dummy(*objects):
    pass


dump = dump_impl if "DEBUG" in sys.argv else dump_dummy


def f(s, m, n):
    if(len(s) == n):
        print(s)
        return
    for i in range(m):
        # dump(i)
        f(s+chr(i+ord('a')), m if i < m-1 else (m+1), n)


n = int(input())
dump(n)
ans = set()
# for si in f('a', 2, n):
#    pass  # print(si)
f('a', 2, n)


Measured memory_bytes: 58076
#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <math.h>
#include <complex>
using namespace std;

int x[105];
int main() {
    int n;
    scanf("%d", &n);
    int sum = 0;
    int square_sum = 0;
    for (int i = 0; i < n; i++) {
        scanf("%d", &x[i]);
        sum += x[i];
        square_sum += (x[i] * x[i]);
    }
    int a = n;
    int b = -2 * sum;
    int c = square_sum;
    int y = (-b)/(2*a);
    printf("%d\n", min(a*y*y + b*y + c, a*(y+1)*(y+1) + b*(y+1) + c));
}


Measured memory_bytes: 760
/*
	*#*#*#* Author GaryMr *#*#*#*
########################################################################
	是否可以简化问题：
	是否可以化具体为抽象
	字符串问题是否可以用数学模拟递归过程（取c[i]或不取来算结果）
	二分？左闭右开？
	long long？
	逆向思维？
	dp？
	贪心？
	匹配括号 左减右>=0
	多组数据清空？
	dp优化用g？
	线段树：大小为n的8倍
	线段树：左闭右开！
	线段树：find： if(l>=b||r<=a) return 0x3f3f3f3f; if(r<=b&&l>=a) return tree[k];
	线段树：满二叉树 
	循环跳出条件 
	代数设出每个值寻找关系？
	优先队列：priority_queue<类型> q;   
	priority_queue<类,vector<类>, less<类> > pq1; 　　　 // 使用递减	
	priority_queue<类，vector<类>, greater<类> > pq2; 　　// 使用递增
	判断括号，判断是否长度为偶数
	1<<ceil(log2(double(n)))
*/
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;a++)
#define rl(a,b,c) for(int a=b;a>=c;a--)
#define niv vector<int>
#define IT iterator
#define FIR first
#define SEC second
using namespace std;
const int MAX=0x3f3f3f3f;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
int gcd(int a,int b){
	if(b==0) return a;
	return gcd(b,a%b);
}
int main(){
	int n,k,a[100001];
	cin>>n>>k;
	int maxheight=-MAX;
	rb(i,1,n){
		cin>>a[i];
		maxheight=max(maxheight,a[i]);
	}
	if(maxheight<k){
		cout<<"IMPOSSIBLE";
		return 0;
	}
	int lastminimum=gcd(a[1],a[2]);
	rb(i,1,n){
		lastminimum=gcd(lastminimum,a[i]);
			if(k%lastminimum==0){
				cout<<"POSSIBLE";
				return 0;
			}
	}
	cout<<"IMPOSSIBLE";
	return 0;
}

Measured memory_bytes: 640
import math
N = int(input())
x = list(map(int,input().split()))
y = list(map(int,input().split()))

p_1 = sum((abs(x[i]-y[i])) for i in range(N))

p_2 = math.sqrt(sum(((x[i]-y[i])**2 for i in range(N))))

p_3 = (sum(abs(x[i]-y[i])**3 for i in range(N)))**(1/3)

p_m = max(abs(x[i]-y[i]) for i in range(N))

print(p_1)
print(p_2)
print(p_3)
print(p_m)


Measured memory_bytes: 5700
#include <iostream>

int main() {
	int x, y;
	std::cin >> x >> y;

	int p[206] = { -100, 3, 2, 1 };

	std::cout << (x == 1 && y == 1 ? 10 : p[x] + p[y]) * 100000 << std::endl;
}

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

int main(){
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL); cerr.tie(NULL);
    long long k,n;
    cin >> k >> n;
    long long arr[n+1];
    arr[0] = 0;
    long long res = 0;
    long long maxim = 0;
    for(long long i = 1;i<=n;i++){
        cin >> arr[i];
        maxim = max(maxim,arr[i]-arr[i-1]);
        if(i > 1)res += arr[i]-arr[i-1];
    }
    res += k-arr[n]+arr[1];
    maxim = max(maxim, k-arr[n]+arr[1]);
    cout << res-maxim;
}

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

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>istream &operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
//template <typename T, typename S>ostream &operator<<(ostream &os, pair<T, S> &p) {os << p.first << " " << p.second;return os;}

template <typename T> void printvv(const vector<vector<T>> &v) {
	cerr << endl;
	rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
		if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
			cerr << "INF";
		}
		else
			cerr << v[i][j];
		cerr << (j == v[i].size() - 1 ? '\n' : ' ');
	}
	cerr << endl;
}

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T, class U>bool chmin(T& a, U b) { if (a > b) { a = b; return true; }return false; }
template <class T, class U>bool chmax(T& a, U b) { if (a < b) { a = b; return true; }return false; }

signed main(signed argc, char *argv[]) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(12);

	int N; cin >> N;
	vector<int>A(3); rep(i, 0, 3) { cin >> A[i]; }
	vector<int>B(3); rep(i, 0, 3) { cin >> B[i]; }
	auto AtoB = [&](int M) {
		vector<int>dp(M + 1);
		rep(i, 0, 3) {
			rep(j, A[i], dp.size()) {
				chmax(dp[j], dp[j - A[i]] + B[i]);
			}
		}
		int ret = M;
		auto m = max_element(all(dp));
		chmax(ret, (*m) + M - (m - dp.begin()));
		return ret;
	};


	int x = AtoB(N);
	swap(A, B);
	int y = AtoB(x);
	cout << y << endl;

	return 0;
}


Measured memory_bytes: 195584
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>

using namespace std;
typedef long long ll;

const int INF = 0x7fffffff;
const int _INF = 0x7fffffff + 1;
const int maxn = 200000;

char s[maxn + 5];

int main()
{
    cin>>s;
    int ida, idz = 0;
    int len = strlen(s);
    for(int i = 0; i < len; i++)
    {
        if(s[i] == 'A')
        {
            ida = i;
            break;
        }
    }
    for(int i = 0; i < len; i++)
    {
        if(s[i] == 'Z')
        {
            if(i > idz)
                idz = i;
        }
    }
    printf("%d", idz - ida + 1);
    return 0;
}


Measured memory_bytes: 384
#include<cstdio>
#include<iostream>
#include<set>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>

using namespace std;

const int CMax = 202;
const int Inf = 1000000002;

int n, m, r, sk, v, u, c, dist[CMax][CMax], ats = Inf;
vector < pair <int,int> > G[CMax];
vector <int> t;

void Dijkstra(int source) {
    vector <int> Q;

    for (int i = 1; i <= n; i++) {
        dist[source][i] = Inf;
        Q.push_back(i);
    }

    dist[source][source] = 0;

    while (!Q.empty()) {
        int u = 0, prevD = Inf, index = 0;

        for (int i = 0; i < Q.size(); i++){
            if (dist[source][Q[i]] < prevD){
                prevD = dist[source][Q[i]];
                u = Q[i];
                index = i;
            }
        }

        Q.erase(Q.begin() + index);

        for (int i = 0; i < G[u].size(); i++){
            if (dist[source][u] + G[u][i].second < dist[source][G[u][i].first]){
                dist[source][G[u][i].first] = dist[source][u] + G[u][i].second;
            }
        }
    }
}

void Solve(int pr, int len, int pos, bool check[CMax])
{
    for (int i = 0; i < t.size(); i++){
        if (check[i]){
            check[i] = false;
            Solve(t[i], len + dist[pr][t[i]], pos + 1, check);
            if (pos == r-2) {
                ats = min(ats, len + dist[pr][t[i]]);
            }

            check[i] = true;
        }
    }
}

int main(){
    scanf("%d %d %d", &n, &m, &r);
    for (int i = 0; i < r; i++){
        scanf("%d", &sk);
        t.push_back(sk);
    }
    for (int i = 0; i < m; i++){
        scanf("%d %d %d", &u, &v, &c);
        G[u].push_back(make_pair(v, c));
        G[v].push_back(make_pair(u, c));
    }

    for (int i = 0; i < t.size(); i++) {
        Dijkstra(t[i]);
    }

    bool check[CMax];

    for (int i = 0; i <= n; i++){
        check[i] = true;
    }

    for (int i = 0; i < t.size(); i++) {
        check[i] = false;
        Solve(t[i], 0, 0, check);
        check[i] = true;
    }

    cout << ats << endl;
}


Measured memory_bytes: 768
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scan(&n)
	
	mcs := make([]int,n)
	for i := 0; i < n; i++ {
		fmt.Scan(&mcs[i])
	}
	
	sort.Ints(mcs)
	cnt := 1
	for i := 1; i < n; i++ {
		if mcs[i-1] == mcs[i] {
			continue
		}
		cnt++
	}
	fmt.Println(cnt)
}

Measured memory_bytes: 512
#include<cstdio>
#include<queue>
#include<set> 
#include<cstdlib> 
#include<cstring>
#include<climits>
#include<cstring>
#include<iostream>
#include<algorithm>
const int inf = 0x3f3f3f3f;
using namespace std;

int ball[11], r[11], l[11];
int a, b;

bool DFS(int stp){
	if(stp == 10)
		return true;
	if(ball[stp] > l[a]){
		l[++a] = ball[stp]; 
		return DFS(stp + 1); 
	}
	if(ball[stp] > r[b]){
		r[++b] = ball[stp];
		return DFS(stp + 1);
	}
	return false;
}

int main()
{
	ios::sync_with_stdio(false);
	int t;
	cin >> t; 
	while(t--){
		a = 0;
		b = 0;
		for(int i = 0; i < 10; i++){
			cin >> ball[i];
		}
		l[a] = 0;
		r[b] = 0;
		cout << ((DFS(0) == 1)?"YES" : "NO") << endl;
//		for(int i = 0; i <= a; i++)
//			cout << l[i] << " ";
//		cout << endl;
//		for(int i = 0; i <= a; i++)
//			cout << r[i] << " ";
//		cout << endl;
		
	}
	
	return 0;
}

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

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: u32 = read();
    let mut a: Vec<u32> = (0..n).map(|_| read()).collect();
    a.sort_by(|x, y| x.cmp(y).reverse());

    let mut alice = 0;
    let mut bob = 0;

    for (i, &x) in a.iter().enumerate() {
        if i % 2 == 0 {
            alice += x;
        } else {
            bob += x;
        }
    }
    println!("{}", alice - bob);
}


Measured memory_bytes: 2044
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

int main()
{
    long long x;
    cin >> x;

    long long ans = 0;
    long long a = 100;
    while(a < x){
        ++ ans;
        a += a / 100;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3636
x, m, d = map(int, input().split())
x = abs(x)
mn = float('inf')
if x // d > m:
    mn = x-m*d
else:
    m -= x//d
    if m % 2 == 0:
        mn = x %d
    else:
        mn = abs(x%d -d)
print(mn)

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

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<double> VEC;
typedef vector<VEC> MAT;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define MT(a,b,c) MP(a, MP(b, c))
#define T1 first
#define T2 second.first
#define T3 second.second

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define EPS 1.0e-9

char a[301000];
VI v;
int main(){
	memset(a, 1, sizeof(a));
	a[0]=0;
	a[1]=0;
	FOR(i, 2, 301000){
		if(i%7!=1 && i%7!=6){
			a[i]=0;
			continue;
		}
		if(a[i])v.PB(i);
		for(int j=2; i*j<301000; j++)a[i*j]=0;
	}
	int n;
	while(cin>>n, n!=1){
		printf("%d:", n);
		REP(i, v.size()){
			if(!(n%v[i]))printf(" %d", v[i]);
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 1624
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
  ll n;
  cin >> n;
  ll power=1,mod=1e9+7;
  for(ll i=1;i<=n;i++){
    power*=i;
    power%=mod;
  }
  cout << power;
}
      

Measured memory_bytes: 3568
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))

A.sort()

if N % 2 == 1:
    w = -2*sum(A[:N//2]) +A[N//2] +A[N//2 + 1] + 2*sum(A[N//2 + 2:])
    m = -2*sum(A[:N//2-1]) - A[N//2 - 1] - A[N//2] + 2*sum(A[N//2+1:])
    print(max(w, m))
else:
    print(-2*sum(A[:N//2-1]) - A[N//2-1] + A[N//2] + 2*sum(A[N//2+1:]))

Measured memory_bytes: 7504
s = gets.chomp
k = gets.chomp.to_i
h = Hash.new([])
s.split('').each_index do |i|
  h[s[i]] += [i]
end
count = 0
sub = []
size = s.size
sorted_h = h.sort
sorted_h.each do |e|
  e.last.sort_by { |i| s[i..-1] }.each do |i|
    0.upto(size) do |j|
      c = s[i..i+j]
      if i+j < size && !sub.include?(c)
        sub.push c
        count += 1
        if count == k
          puts sub.sort.last
          exit
        end
      end
    end
  end
end


Measured memory_bytes: 54780
import kotlin.math.*
import java.util.*

fun main(args: Array<String>) {
  val n = readLine()!!.toInt()
  val s = readLine()!!
  var r = 0L
  var g = 0L
  var b = 0L
  for (c in s) {
    when (c) {
      'R' -> r++
      'G' -> g++
      else -> b++
    }
  }
  var ans = r * g * b
  for (i in 1..n - 2) {
    for (k in i + 2..n) {
      if ((i + k) % 2 != 0) continue
      val j = (i + k) / 2
      if (s[i - 1] != s[j - 1] && s[j - 1] != s[k - 1] && s[k - 1] != s[i - 1]) ans--
    }
  }
  println(ans)
}


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

from random import *
from functools import reduce,partial

def readline():
    return list(map(int,input().split(' ')))

def identity(x):
    """Return the input itself."""
    return x

def constant(c):
    """Return an function which always
    returns the input constant c."""
    def const_function(const,*args):
        return const
    return partial(const_function,c)

def inc(c = 1):
    """Return a function which reads an input x and returns x + c as output.
    By default, c equals 1."""
    return lambda x: x + c

def add(*args):
    """Return the sum of the input."""
    def add2(x,y): return x + y
    return reduce(add2,args)

def mapv(f,*lst):
    """Return a vector of the result of map."""
    return list(map(f,*lst))

def vector(*args):
    """Return a vector of input parameters."""
    return args

def sequence(n,f = constant(0)):
    """Return a vector of length n, and initialize the i'th
    item with f(i).By default the vector will initialized with 0."""
    return [f(i) for i in range(0,n)]

def matrix(n,m,f = constant(0)):
    """Return a 2-dim vector which contains n vectors with length m.
    The j's item of vector i will be initialized by f(i,j).By default,
    the vector will be initialized with 0."""
    return [[f(i,j) for j in range(0,m)] for i in range(0,n)]

def flat(v):
    """Return a flat vector which contains the elements of v in their
    origin order.If the input is not a vector, return a vector which
    only contains the input."""
    if not isinstance(v,list): return [v]
    if not v: return []
    return reduce(add,mapv(flat,v))

def partition(v,f = identity):
    """Partition vector v by f(v[i]).
    e.g. partition([1,2,3,1,2,3],identity()) == {1:[1,1,1], 2:[2,2], 3:[3]}
    By default, the vector will be partitioned by identity function."""
    result = {}
    for item in v:
        key = f(item)
        s = result.get(key)
        if s:
            s.append(item)
        else:
            result.update({key:[item]})
    return result

def getValue(key):
    """Return a function which returns the value of key in a hash-map.
    If the key do not exist, it will throw an error."""
    return lambda x: x[key]

def mapValue(f,m):
    """Replace each value in hash-map m with f(value).
    Return the new hash-map."""
    res = {}
    for key in m:
        res.update({key: f(m[key])})
    return res

n = int(input())
a = readline()
f = sequence(n)
g = sequence(n)
f[0],g[0] = 1,1
for i in range(1,n):
    f[i] = min(f[i-1],g[i-1] + 1)
    g[i] = min(g[i-1],f[i-1] + 1)
    if a[i] > a[i-1]:
        g[i] = min(f[i-1]+1,g[i-1]+1)
    if a[i] < a[i-1]:
        f[i] = min(f[i-1]+1,g[i-1]+1)
print(min(f[n-1],g[n-1]))


Measured memory_bytes: 15148
#m-solutions2020 b
import sys  
input = sys.stdin.readline


A,B,C = list(map(int,input().split()))
K= int(input())

cnt = 0
while B<=A:
    B *= 2
    cnt +=1
while C<=B:
    C *=2
    cnt +=1
print('Yes' if cnt <=K else 'No')
    


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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n,m; cin>>n>>m;
  if(abs(n-m)>1){
    cout<<0<<endl;
    return 0;
  }
  
  ll ans=1;
  reps(i,n) (ans*=i)%=MOD;
  reps(i,m) (ans*=i)%=MOD;
  
  if(n==m) (ans*=2)%=MOD;
  cout<<ans<<endl;
  
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
   public static void main(String args[]){
      //declaration and initialization
      Scanner sc = new Scanner(System.in);
      String input[];
       
      //variables for each problem
      String answer;
      int a;
      int b;
      int c;
      int temp;
       
      //reading the intput
      input = sc.nextLine().split(" ",0);
       
      //assginment
      a = Integer.parseInt(input[0]);
      b = Integer.parseInt(input[1]);
      c = Integer.parseInt(input[2]);
       
      //evaluation
      //bubble sort
      if(a > b){
         temp = a;
         a = b;
         b = temp;
      }
       
      if(b > c){
         temp = b;
         b = c;
         c = temp;
      }
       
      if(a > b){
         temp = a;
         a = b;
         b = temp;
      }
             
     //output
     System.out.println(a + " " + b + " " + c);
       
       
       
   }//main
       
}//class

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

# define REP(i,n) for (int i=0;i<(n);++i)
# define rep(i,a,b) for(int i=a;i<(b);++i)
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define all(v) v.begin(),v.end()
# define showVector(v) REP(i,v.size()){p(v[i]);p(" ")} pl("")
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;}
typedef long long int ll;
typedef pair<int,int> P_ii;
typedef pair<double,double> P_dd;

template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}

template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}


const int MOD = 1000000007;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;

void addM(long long &a, long long b) {
    a += b;
    if (a >= MOD) a -= MOD;
}

void mulM(long long &a, long long b) {
    a = ((a%MOD)*(b%MOD))%MOD ;
}

// a^b mod M
long myPow(long a,long b,int M) {
    long ret = 1;
    long tmp = a;
    while(b>0) {
        if((b&1)==1) ret = (ret * tmp) % M;
        tmp = (tmp * tmp) % M;
        b = b>>1;
    }
    return ret;
}

 // nCk mod M
int nCk(int n,int k,int M) {
    long ret = 1;
    int mi = min(k, n-k);
    for(int i=1;i<=mi;i++) {
        ret = (ret * myPow(i,M-2,M)) % M;
    }
    for(int i=n-mi+1;i<=n;i++) {
        ret = (ret * i) % M;
    }
    return (int)ret;
};

int main() {
    string s;
    cin >> s;
    string t = s + s;
    string u = t + s;

    ll K;
    cin >> K;

    ll num1 = 0;
    REP(i, s.size() - 1){
        if(s[i] == s[i + 1]){
            s[i + 1] = '-';
            num1++;
        }
    }

    ll num2 = 0;
    REP(i, t.size() - 1){
        if(t[i] == t[i + 1]){
            t[i + 1] = '-';
            num2++;
        }
    }

    ll num3 = 0;
    REP(i, u.size() - 1){
        if(u[i] == u[i + 1]){
            u[i + 1] = '-';
            num3++;
        }
    }

    if(num2 - num1 == num3 - num2){
        cout << num1 + (num2 - num1) * (K - 1) << endl;
    } else {
        cout << num1 + (num3 - num1) * (K - 1) / 2 + (num2 - num1) * (K - 1) % 2 << endl;
    }

    return 0;
}

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

using namespace std;

#define PI 3.1415926535897932

int main(){
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    printf("%s\n",c%__gcd(a,b)==0?"YES":"NO");
    return 0;
}


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

int main(){
    int A,B;
    cin>>A>>B;
    if((A+B)%2){
        cout<<"IMPOSSIBLE"<<endl;
    }else{
        cout<<(A+B)/2<<endl;
    }
    return 0;
}

Measured memory_bytes: 888
// https://atcoder.jp/contests/dp/tasks/dp_p

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define DUMP(a, n) REP(i, n) printf("%d%c", a[i], i + 1 == n ? '\n' : ' ')
#define DUMP2D(a, n, m) REP(i, n) REP(j, m) printf("%d%c", a[i][j], j + 1 == m ? '\n' : ' '); puts("")

const int N_MAX = 1e5;
const int MOD = 1e9+7;

//------------------------------------------------------------------------------
const int V_MAX = 1e5;

int V;
vector<int> G[V_MAX];
ll dp[V_MAX][2];

void add_edge(int from, int to) {
  G[from].push_back(to);
  G[to].push_back(from);
}

void dfs(int p, int v) {
  dp[v][0] = 1;
  dp[v][1] = 1;
  REP(i, G[v].size()) {
    int u = G[v][i];
    if (u == p) continue;
    dfs(v, u);
    dp[v][0] = dp[v][0] * ((dp[u][0] + dp[u][1]) % MOD) % MOD;
    dp[v][1] = dp[v][1] * dp[u][0] % MOD;
  }
}

//------------------------------------------------------------------------------
int N;
int x[N_MAX];
int y[N_MAX];

void solve() {
  V = N;
  REP(i, N - 1) add_edge(x[i] -  1, y[i] - 1);
  dfs(-1, 0);
  ll ans = (dp[0][0] + dp[0][1]) % MOD;
  printf("%lld\n", ans);
}

void input() {
  scanf("%d", &N);
  REP(i, N - 1) scanf("%d%d", x + i, y + i);
}

int main() {
  input();
  solve();
  return 0;
}


Measured memory_bytes: 14976
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<n;++i)
#define FOR(i,a,b) for(int i=a;i<b;++i)
char c[60][60];
int a[60][60];
int flag, w, h;

void dfs(int y,int x){
  if(c[y][x] == 'B'){
    if(flag == 0 || flag == 1) flag = 1;
    else flag = 3;    
    a[y][x] = 9;
  }else if(c[y][x] == 'W'){
    if(flag == 0 || flag == 2) flag = 2;
    else flag = 3;
    a[y][x] = 9;
  }else if(a[y][x]==0){
    a[y][x] = 4;
    FOR(i,y-1,y+2) if(i>=0 && i<h) dfs(i,x);
    FOR(j,x-1,x+2) if(j>=0 && j<w) dfs(y,j);
  }
}
int main(){
  int bl, wh;
  while(cin>>w>>h, w){
    bl = 0; wh = 0;
    REP(i, h) REP(j, w){
      cin>>c[i][j];
      a[i][j]=0;
    }
    
    REP(i, h) REP(j, w){
      if(c[i][j] == 'B' || c[i][j] == 'W' || a[i][j]) continue;
      flag = 0;
      dfs(i,j);
      
      if(flag) REP(k,h) REP(l,w){
          if(a[k][l] == 4) a[k][l] = flag;
        }
    }
    REP(i,h) REP(j,w){
      if(a[i][j] == 1) bl++;
      if(a[i][j] == 2) wh++;
    }
    cout<<bl<<" "<<wh<<endl;
  }
  return 0;
}

Measured memory_bytes: 3204
## coding: UTF-8

N, X, M = map(int,input().split())

fresh = [True] * M #まだついたことのない場所をTrueにしている
fresh[X] = False
turn = [-1] * M #なん回目におとづれたか記録する
turn[X] = 0
status = True


#print(fresh, turn)

def search_loop():
    log = [X] #訪れた地点を記録するもの
    last  = X #最後に訪れた地点を記録するもの（ここから次に行くところを検索する）
    counter = 0
    loop_count = -1
    loop_start = -1
    while status:
        #next_spot = A[last - 1]
        next_spot = (last * last) % M 
        counter += 1
        #print(next_spot)
        if(fresh[next_spot]):
            #処理を書く
            log.append(next_spot)
            last = next_spot
            fresh[next_spot] = False
            turn[next_spot] = counter
        else:
            log.append(next_spot)
            last = next_spot
            fresh[next_spot] = False
            loop_count = counter - turn[next_spot]
            loop_start = turn[next_spot]
            #最後の人処理をする
            break
    #print(len())
    return log, last, turn, counter, loop_count, loop_start

#print(search_loop())

ret = search_loop()
#print(ret)
log = ret[0]
last = ret[1]
turn = ret[2]
counter = ret[3]
loop_count = ret[4]
loop_start = ret[5]
#print(log)
#print(loop_count)
#print(loop_start)

#print(log, last, turn)
#print(N, counter)
if(N <= len(log)):
    ans = sum(log[:N])
else:
    ans = sum(log[:loop_start])
    #ans = -1
    #print(log[loop_start:len(log)-1])
    sum_loop = sum(log[loop_start:len(log)-1])
    mawaru_kaisuu = (N-loop_start) // loop_count
    #print(mawaru_kaisuu)
    ans += (sum_loop * mawaru_kaisuu)
    nokori = (N-loop_start) - (loop_count*mawaru_kaisuu)
    ans += sum(log[loop_start:loop_start+nokori]) 


print(ans)



Measured memory_bytes: 69964
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define rep(i,n) for(int i=0;i<n;i++)
int gcd(int a, int b){
    int r=1;
    while(r!=0){
        r=a%b;
        a=b;
        b=r;
    }
    return a;
}
void revStr(char* str){
    int size = strlen(str);
    int i,j;
    char tmp = {0};
    for(i = 0, j = size - 1; i < size / 2; i++, j--){
        tmp = str[i];
        str[i] = str[j];
        str[j] = tmp;
    }return;
}
typedef struct{
    int a,b;
}data;

//昇順
int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}
//構造体降順
int comp( const void *c1, const void *c2 )
{
  data test1 = *(data *)c1;
  data test2 = *(data *)c2;
  int tmp1 = test1.b;   /* b を基準とする */
  int tmp2 = test2.b;
  return tmp2 - tmp1;
}


int kai(int n){
    if(n==0){
        return 1;
    }
    int sum=1;
    for(int i=1;i<=n;i++){
        sum*=i;
    }
    return sum;
}

int main(){
    int N,M;
    scanf("%d%d",&N,&M);
    int kind[M];
    rep(i,M){
        kind[i]=0;
    }
    rep(i,N){
        int K;
        scanf("%d",&K);
        rep(j,K){
            int temp;
            scanf("%d",&temp);
            kind[temp-1]++;
        }
    }
    int sum=0;
    rep(i,M){
        if(kind[i]==N){
            sum++;
        }
    }
    printf("%d",sum);
}


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

using namespace std;
using ll = long long;

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

int main() {
  int n, k;
  string s;
  cin >> n >> k;
  cin >> s;

  s[k - 1] = s[k - 1] + ('a' - 'A');
  cout << s << endl;
  return 0;
}


Measured memory_bytes: 3604