akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int order[200001];

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

	int center_pos = N/2;
	vector <pair <int, int> > X;
	for (int pos = 1; pos<= N; pos++) {
		int x;
		cin >> x;
		X.push_back(make_pair(x, pos));
	}
	std::sort(X.begin(), X.end());
	for (int i = 0; i < X.size(); i++) {
		order[X.at(i).second] = i+1;
	}
	int center_val = X.at(center_pos-1).first;
	int center_plus_val = X.at(center_pos).first;

	for (int i = 1; i <= X.size(); i++) {
		if (order[i] <= center_pos) {
			cout << center_plus_val << endl;
		} else {
			cout << center_val << endl;
		}
	}

	return 0;
}


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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

int main(){
  ll n;cin>>n;

  map<ll,ll>m;
  for(ll i=2; i*i<=n; i++){
    while(n%i==0){
      n/=i;
      m[i]++;
    }
  }
  if(n>1)m[n]++;

  vector<pll>lim;
  for(ll i=1; i<100; i++)lim.push_back({i*(i+1)/2, i});

  ll result=0;
  for(auto c:m){
    ll count = c.second;
    auto it = lower_bound(lim.begin(), lim.end(), make_pair(count, -1LL));
//cout<<(*it).first<<' '<<(*it).second<<' '<<count<<endl;
    if( (*it).first >count)it--;
    result += (*it).second;
  }

  cout<<result<<endl;

//  for(auto c:m)cout<<c.first<<' '<<c.second<<endl;

  return 0;
}


Measured memory_bytes: 3636
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cassert>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> PLL;

constexpr int dx[4] = {-1, -1, -1, 0};
constexpr int dy[4] = {1, 0, -1, -1};

bool solve() {
    int N;
    string d[255];
    cin >> N; if (N == 0) { return false; }

    for (int j = 0; j < N; ++j) {
        cin >> d[j];
    }

    int dp[255][255][4];
    for (int j = 0; j < N; ++j) {
        for (int k = 0; k < N; ++k) {
            fill(dp[j][k], dp[j][k]+4, 0);
        }
    }

    int ret = 0;

    for (int j = 0; j < N; ++j) {
        for (int k = 0; k < N; ++k) {
            if (d[j][k] == '0') { continue; }
            for (int l = 0; l < 4; ++l) {
                dp[j][k][l] = 1;

                int px = j+dx[l], py = k+dy[l];
                if (0 <= px && px < N && 0 <= py && py < N) {
                    dp[j][k][l] += dp[px][py][l];
                }

                ret = max(ret, dp[j][k][l]);
            }
        }
    }

    cout << ret << endl;
    return true;
}

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

Measured memory_bytes: 4168
N = int(input())
S = input()

pos = 0
while True:
  if pos >= len(S) - 1:
    break
  if pos <= len(S) - 2 and S[pos] == S[pos+1]:
    S = S[:pos+1] + S[pos+2:]
    continue
  else:
    pos += 1
    
print(len(S))

Measured memory_bytes: 3408
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int len = 0;
		int cnt = 0;
		char[] cs = new char[s.length()];
		for(int i = 0; i < s.length(); i++) {
			if(s.charAt(i) == 'A' || s.charAt(i) == 'C' || s.charAt(i) == 'G' || s.charAt(i) == 'T') {
				cnt++;
			} else {
				if(cnt >= len) {
					len = cnt;
				}
				cnt = 0;
			}
			if(cnt >= len) {
				len = cnt;
			}
		}
		System.out.println(len);
	}
}

Measured memory_bytes: 21588
#47
w, h, n = map(int, input().split())
w0 = 0
h0 = 0
for i in range(n):
    x, y, a = map(int, input().split())
    if a==1:
        w0 = max(w0,x)
    elif a==2:
        w = min(w,x)
    elif a==3:
        h0 = max(h0,y)
    elif a==4:
        h = min(h,y)
if w-w0<0 or h-h0<0:
    print(0)
else:
    print((w-w0)*(h-h0))

Measured memory_bytes: 3064
//#include <boost/multiprecision/cpp_dec_float.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <algorithm>
#include <bitset>
using namespace std;
//namespace mp = boost::multiprecision;
//using llll = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
//using Real = mp::number<mp::cpp_dec_float<1024>>;
using ll = long long;
const double EPS = 1e-10;
const ll MOD = 7+(1e+9);

int main(){
  ll n,k,ans=0;
  cin>>n>>k;
  vector<ll>v(n,0);
  vector<ll>a(n,0);
  vector<ll>b(n,0);
  for(ll i=0;i<n;i++){
    cin>>v[i];
  }
  for(ll i=0;i<n;i++){
    for(ll j=0;j<n;j++){
      if(v[i]>v[j]){
        if(i<j)a[i]++;
        else b[i]++;
      }
    }
  }
  ll p=0,q=0;
  p=(k*(k-1)/2)%MOD;
  q=(k*(k+1)/2)%MOD;
  ll aa=0,bb=0;
  for(ll i=0;i<n;i++){
    aa=(aa+a[i])%MOD;
    bb=(bb+b[i])%MOD;
  }
  ans=((p*bb)%MOD+(q*aa)%MOD)%MOD;
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <cstdio>
#include <numeric>
#include <iomanip>

using namespace std;

using ll = long long;

ll K, N;
vector<ll> A;

int main()
{
    cin >> K >> N;
    A.resize(N);
    for(int i = 0;i < N;i++)
    {
        cin >> A[i];
    }
    ll m = (K - A[N-1]) + A[0];
    for(int i = 0;i < N-1;i++)
    {
        m = max(m, A[i+1] - A[i]);
    }

    cout << K - m << endl;
    return 0;
}

Measured memory_bytes: 2424
#include<iostream>
#include<vector>
#include<sstream>
#include<string>
#include<numeric>
#include <algorithm>
#include<math.h>
#include<cstdio>
#include<string.h>
#include<unistd.h>
#include <array>
#include <map> 




using namespace std;
typedef long long ll;
struct point{
  int x;
  int y;

};
int gcd(int a, int b)
{
	return a == 0 ? b : gcd(b % a, a);
}
int lcm( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}//lcm
int input(){
  int x;
  cin>>x;
  return x;
}

int moji(char in)
{
    int ans = (int)in-(int)'a';
    if((ans < 0) || (ans > 25)){
        ans = 26;
    }
    return ans;
}
const int VV=10;//場合に応じてVVの値のみ変更する必要あり
//dijkstra(s)sがスタート地点でそこからの最短距離を配列dで表す。正の重みのみ使用可能
int cost[VV][VV];
int d[VV];
bool used[VV];
void dijkstra(int s){
  fill(d,d+VV,100000);
  fill(used,used+VV,false);
  d[s]=0;
  while(true){
    int v=-1;
    for(int u=0;u<VV;u++){
      if(!used[u]&&(v==-1||d[u]<d[v]))v=u;
    }
    if(v==-1)break;
    used[v]=true;
    for(int u=0;u<VV;u++){
      d[u]=min(d[u],d[v]+cost[v][u]);
    }
  }

}

int compare_int(const void *a, const void *b)//qsort(quick sort利用時に使用)
{
    return *(int*)a - *(int*)b;
}

int binary_searchh(long long x,long long k[],int n){
  int l=0;
  int r=n;
  while(r-l>=1){
    int i=(l+r)/2;
    if(k[i]==x)return i;
    else if(k[i]<x)l=i+1;
    else r=i;
  }
  return -1;
}

struct File {
    int aa;
    int bb;

    File(const int& aa, const int& bb)
        : aa(aa), bb(bb) {}
};

bool operator<(const File& a, const File& b)
{
    // ファイル種別、ファイル名の順番で優先順位を付けて比較
    return std::tie(a.aa, a.bb) < std::tie(b.aa, b.bb);
}

long long kaijo(long long x){
  long long l=10*10*10*10*10*10*10*10*10+7;
  long long sum=1;
  for(int i=x;i>0;i--){
    sum*=i;
    if(sum>l){
      sum%=l;
    }
  }
  return sum;
}






int main(){
  long long N;
  cin>>N;
  double x[N];
  string u[N];
  for(int i=0;i<N;i++){
    cin>>x[i]>>u[i];
  }
  double sum=0;
  for(int i=0;i<N;i++){
    if(u[i]=="JPY"){
      sum+=x[i];
    }else{
      sum+=x[i]*380000.0;

    }
  }
  cout<<sum<<endl;



  
}



  

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int INF=1001001001;
int main() {//解説動画の写し
  int n,x,y;
  cin >>n>>x>>y;
  --x;
  --y;
  vector<int>ans(n);
  for(int sv=0;sv<n;sv++){
    vector<int>dist(n,INF);
    queue<int>q;
    auto push=[&](int v,int d){
      if(dist[v]!=INF)return ;
      dist[v]=d;
      q.push(v);
    };
    push(sv,0);
    while(!q.empty()){
      int v=q.front();q.pop();
      int d=dist[v];
      if(v-1>=0)push(v-1,d+1);
      if(v+1<n)push(v+1,d+1);
      if(v==x)push(y,d+1);
      if(v==y)push(x,d+1);
    }
    rep(i,n)ans[dist[i]]++;
  }
  rep(i,n)ans[i]/=2;
  for(int i=1;i<=n-1;i++){
    cout<<ans[i]<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
const ll inf=1e9+7;
const ll INF=1e18;

int main(){
    int n,m;cin>>n>>m;
    int x,y,z;
    vvin p(n+1);
    rep(i,m){
        cin>>x>>y>>z;
        p[x].push_back(y);
        p[y].push_back(x);
    }
    vbo already(n+1,false);
    int ans=0;int num;
    queue<int> q;
    rep2(i,1,n+1){
        if(!already[i]){
            ans++;
            q.push(i);
            while(q.size()){
                num=q.front();q.pop();
                already[num]=true;
                for(auto tmp:p[num])if(!already[tmp])q.push(tmp);
            }
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 9444
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <map>
using namespace std;
long long a[100005], b[100005];
int main() {
    int n;
    cin >> n;
    long long sum = 0;
    long long res = 1000000009ll;
    for (int i = 1; i <= n; ++i) {
	scanf("%lld%lld", &a[i], &b[i]);
	sum += b[i];
	if (a[i] > b[i]) {
	    res = min(res, b[i]);
	}
    }
    if (res == 1000000009ll) {
	cout << 0;
	return 0;
    }
    printf("%lld", sum - res);
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)

                    
using ll = long long;
using ull = unsigned long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const ll mod = 1e9+7;
void chmod(ll &M){
  if(M >= mod) M %= mod;
  else if(M < 0){
     M += (abs(M)/mod + 1)*mod;
    M %= mod;
}
}
ll modpow(ll x, ll n){
   if(n==0) return 1;
  ll res=modpow(x, n/2);
 if(n%2==0) return res*res%mod;
else return res*res%mod*x%mod;
}
int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };
long long GCD(long long a, long long b) {
  if (b == 0) return a;
  else return GCD(b, a % b);
}

using namespace std;
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
int main()
{
    int N;
    cin >> N;
    if ((N % 10) == 2 or (N % 10) == 4 or (N % 10) == 5 or (N % 10) == 7 or (N % 10) == 9) cout << "hon" << endl;
    else if ((N % 10) == 3) cout << "bon" << endl;
    else cout << "pon" << endl; 
}


Measured memory_bytes: 3580
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
using namespace std;
const int N = 105;
const int INF = 0x3f3f3f3f;
typedef long long ll;
#define lson l, m, rt<<1
#define rson m+1, r, rt<<1|1
const int MOD = 1e9+7;


int h[N];
int Has[N]; int tot;
ll dp[N][N];

ll Pow(ll x, ll y) {
	if(y <= 0) return 1;
	ll result = 1;
	while(y) {
		if(y & 1)
			result = result * x % MOD;
		y >>= 1;
		x = x*x % MOD;
	}
	return result;
}

int main() {
	int n;
	while(~scanf("%d", &n)) {
		tot = 0;
		memset(dp, 0, sizeof(dp));
		h[0] = 0;
		dp[0][0] = 1;

		for(int i = 1; i <= n; ++i) {
			scanf("%d", &h[i]);
			Has[++tot] = h[i];
		}
		sort(Has + 1, Has + tot + 1);
		tot = unique(Has+1, Has + tot + 1) - Has - 1;
		
		for(int i = 1; i <= n; ++i) {
			h[i] = lower_bound(Has + 1, Has + tot + 1, h[i]) - Has;
		}
		
		
		for(int i = 1; i <= n; ++i) {
			dp[i][0] = dp[i-1][0] * 2 % MOD;
			for(int j = h[i] + 1; j <= h[i-1]; ++j) dp[i][0] = (dp[i][0] + dp[i-1][j] * 2 % MOD) % MOD;

			ll tmpPow = Pow(2, Has[h[i]] - Has[h[i-1]]);
			for(int j = 1; j <= h[i]; ++j) {
				dp[i][j] = dp[i-1][j] * tmpPow % MOD;
			}

			for(int j = h[i-1] + 1; j <= h[i]; ++j) {
				dp[i][j] = (dp[i][j] + j==1? ( dp[i-1][0] * ( Pow(2, Has[j]) - 2) % MOD * Pow(2, Has[h[i]] - Has[j]) % MOD ) :
											 ( dp[i-1][0] * ( Pow(2, Has[j]-Has[j-1]) - 1) % MOD * 2 % MOD * Pow(2, Has[h[i]]-Has[j]) % MOD ) 
											 ) %MOD;
			}
		}


		ll result = 0;
		for(int i = 0; i <= tot; ++i) {
			result = (result + dp[n][i]) % MOD;
		}
		printf("%lld\n", result);
	}
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <cstring>
    #include <chrono>
    #include <complex>
    #define endl "\n"
    #define int long long int
    #define vi vector<int>
    #define vll vector<ll>
    #define vvi vector < vi >
    #define pii pair<int,int>
    #define pll pair<long long, long long>
    #define mod 1000000007
    #define inf 1000000000000000001;
    #define all(c) c.begin(),c.end()
    #define mp(x,y) make_pair(x,y)
    #define mem(a,val) memset(a,val,sizeof(a))
    #define eb emplace_back
    #define f first
    #define s second

    using namespace std;
int power(int base, int exp)
{
    if (exp == 0)
       return 1;
    else if (exp == 1)
       return base;
    else
    {
       int calc;
       if (exp % 2 == 0)
       {
         calc = power(base, exp/2);
         calc =(calc* calc)%mod;
       }
       else
       {
         calc = (base*power(base, exp-1))%mod;
       }
       return calc%mod;
    }
}
    int32_t main()
    {
        std::ios::sync_with_stdio(false);
        int x,n;
        cin>>x>>n;
        int a[n];
        for(int i=0;i<n;i++)
        {
            cin>>a[i];

        }

        int b[102]={0};
        for(int i=0;i<n;i++)
            b[a[i]]++;
        int diff=INT_MAX;
        int element=-1;
        for(int i=0;i<=101;i++)
        {
            if(b[i]==0 && abs(i-x)<diff)
            {
                diff=abs(i-x);
                element=i;
                //cout<<i<<" "<<diff<<" "<<element<<endl;
            }
            else if(b[i]!=0)
                continue;
            else
                break;
        }
        cout<<element<<endl;
        return 0;
    }


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

#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)
 
typedef long long ll;
using namespace std;
 
int main(){
  int n;
  int count = 0,c = 0;
  
  cin >> n;

  int a[n];
  rep(i,0,n){
    cin >> a[i];
    
    if(a[i]%2 == 0){
      count++;
    }
  }

  while(count == n){
    count = 0;
    rep(i,0,n){
      a[i] = a[i]/2;

      if(a[i]%2 == 0){
      count++;
      }
    }
    c++;  
  }
  
  printf("%d\n", c);
  return 0;
}

Measured memory_bytes: 256
from collections import  deque
import time
N = int(input())
dic = {}
A = [[int(j) for j in input().split()] for i in range(N - 1)]
for i in range(N - 1):
    a, b = A[i]
    if a in dic.keys():
        dic[a].append(b)
    else:
        dic[a] = [b]
    if b in dic.keys():
        dic[b].append(a)
    else:
        dic[b] = [a]

ans1 = 0
for k, v in dic.items():
    ans1 = max(ans1, len(v))
no = 0
Used = [[] for i in range(N + 1)] #頂点において使った番号を記録
q = deque()

q.append((1, dic[1], 1))
dicans = {}

while len(q) > 0:
    i, l, c= q.popleft()
    num = c
    for k in l:
        if k < i:
            continue
        num += 1
        if num > ans1:
            num = 1
        dicans[(i, k)] = num
        q.append((k, dic[k], num))

print(ans1)

for a, b in A:
    print(dicans[(a, b)])


Measured memory_bytes: 63796
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define mod 1000000007
#define inf 1000000000000000000

ll power(ll x,ll y,ll m) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2, m) % m; 
    p = (p * p) % m; 
    return (y%2 == 0)? p : (x * p) % m; 
}

ll modInv(ll x){
    return power(x,mod-2,mod)%mod;
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
    
    ll n,m;
    cin>>n>>m;
    
    ll vis[n+1]={0};
    ll wa[n+1]={0};
    ll ac=0,wa2=0;
    for(int i=0;i<m;i++)
    {
        ll p;
        string v;
        cin>>p>>v;
        if(vis[p]==0)
        {
            if(v=="WA")
            {
                wa[p]++;
            }
            else
            {
                ac++;
                wa2=wa2+wa[p];
                vis[p]=1;
            }
           // cout<<p<<" "<<v<<" "<<ac<<" "<<wa2<<" "<<wa[p]<<endl;
        }
    }
    cout<<ac<<" "<<wa2<<endl;
    return 0;
}

Measured memory_bytes: 1792
//問題URL
//

//解き方メモ
//
    
#include<iostream>
using namespace std;

int main(){
  long n,result;

  cin >> n;
  
  for(long i=1;i*i<=n;i++){
    result = i*i;
  }

  cout << result << endl;

  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace At
{
    class Program
    {
        static void Main(string[] args)
        {
            var x = ReadInts();
            WriteLine(Math.Ceiling(x.Average()));
        }

        private static string Read() { return ReadLine(); }
        private static string[] Reads() { return (Read().Split()); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 11220
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define null nullptr
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define mp make_pair
#define test int t; cin>>t; while(t--)
#define FAST                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)

using namespace std;

typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef pair<int,int> pii;
typedef unordered_map<int,int> mp;

const int mod = 1e9+7;



int32_t main(){
    FAST;

    int n;  cin >> n;

    double ans = 0;

    for(int x=0;x<n;x++){
        double t;   cin >> t;
        ans += pow(t,-1);
    }

    cout << fixed << setprecision(18);

    cout << pow(ans,-1);

    return 0;
}


Measured memory_bytes: 256
N=int(input())
for i in range(1,15):
    if 26**i>=N:
        n=i
        break
    else:
        N-=26**i
l=[0]*n
N-=1
for i in range(n):
    l[i]=N%26
    N//=26
for i in l[::-1]:
    print(chr(ord("a")+i),end="")

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

#define mx 1000
#define mod 1000007
#define ll long long

using namespace std;

int main(int argc, char const *argv[])
{
    ios::sync_with_stdio(false);

    int n, m;
    ll ans = 0;
    cin >> n >> m;
    int x[m + 5], subt[m + 5];

    for (int i = 0; i < m; i++)
        cin >> x[i];

    sort(x, x + m);

    for (int i = 1; i < m; i++)
        subt[i - 1] = x[i] - x[i - 1], ans += (ll)subt[i - 1];
    m--;
    sort(subt, subt + m, greater<int>());
    for (int i = 0; i < n - 1 && m; i++)
        ans -= subt[i], m--;
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 1024
from collections import deque

N = int(input())
A = [int(input()) for _ in range(2 ** N)]

Q = deque(A)

while len(Q) > 1:
    x = Q.popleft()
    y = Q.popleft()

    if x > y:
        Q.append(x - y)
    elif x == y:
        Q.append(x)
    else:
        Q.append(y - x)

print(Q.popleft())


Measured memory_bytes: 20036
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
	int a,b,c;
	cin >> a >> b >> c;
	if(a<=c&&b>=c){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}

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


void solve(long long N, long long M_a, long long M_b, std::vector<long long> a, std::vector<long long> b, std::vector<long long> c){
    vector<vector<vector<ll>>> dp(N+1, vector<vector<ll>>(500, vector<ll>(500, 1e9)));
    dp[0][0][0] = 0;
    for(int i = 0;i < N;i++){
        for(int j = 0;j < 500;j++){
            for(int k = 0;k < 500;k++){
                dp[i+1][j][k] = min(dp[i][j][k], dp[i+1][j][k]);
                if(j+a[i] >= 500 || k+b[i] >= 500)continue;
                dp[i+1][j+a[i]][k+b[i]] = min(dp[i][j][k] + c[i], dp[i+1][j+a[i]][k+b[i]]);
            }
        }
    }
    ll ans = 1e18;
    for(int i = 0;i < 500;i++){
        for(int j = 0;j < 500;j++){
            if(i == 0 || j == 0){
                if(i == M_a && j == M_b){
                   // cout<<i<<" "<<j<<" "<<dp.back()[i][j]<<endl;
                    ans = min(ans, dp.back()[i][j]);
                }
            }else{
                if(M_a == i / __gcd(i, j) && M_b == j / __gcd(i, j)){
                   // cout<<i<<" "<<j<<" "<<dp.back()[i][j]<<endl;
                    ans = min(ans, dp.back()[i][j]);
                }
            }
        }
    }
    if(ans == 1e9){
        cout<<-1<<endl;
        return;
    }
    cout<<ans<<endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long M_a;
    scanf("%lld",&M_a);
    long long M_b;
    scanf("%lld",&M_b);
    std::vector<long long> a(N);
    std::vector<long long> b(N);
    std::vector<long long> c(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&a[i]);
        scanf("%lld",&b[i]);
        scanf("%lld",&c[i]);
    }
    solve(N, M_a, M_b, std::move(a), std::move(b), std::move(c));
    return 0;
}


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

#define pb push_back
#define pf push_front
#define pp pop_back
#define sz(a) (int)(a.size())
#define mp make_pair
#define F first
#define S second
#define next _next
#define prev _prev
#define left _left
#define right _right
#define y1 _y1
#define all(x) x.begin(), x.end()
#define what_is(x) #x << " is " << (x)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int N = (int)1e5 + 123;
const ll INF = (ll)1e18 + 123;
const int inf = (int)1e9 + 123;
const int MOD = (int)1e9 + 7;

void megaRandom() {
    unsigned int FOR;
    asm("rdtsc" : "=A"(FOR));
    srand(FOR);
}

int n, a[11];

int gcd(int a, int b) {
    if(b == 0) return a;
    else return gcd(b, a % b);
}

int main() {
    cin >> n;
    int mlt = 1;
    for(int i = 1; i <= n; i ++) {
        cin >> a[i];
        mlt = mlt * a[i] / gcd(mlt, a[i]);
    }
    cout << mlt << '\n';
    return 0;
}



Measured memory_bytes: 3112
n,y = gets.split(" ").map(&:to_i)
result = [-1,-1,-1]
sihei  = [0,0,0]
flg = 0

def calc(array)
    total = (array[0]*10000) + (array[1]*5000) +(array[2]*1000)
end

def gassan(array)
    count = 0
    array.each do |i|
        count = count + i
    end
    return count
end

(0..n).each do |i|
    sihei[2] = i
    (0..(n-sihei[2])).each do |j|
        sihei[1] = j
        sihei[0] = n - sihei[1] - sihei[2]
        flg = sihei if y == calc(sihei) 
        break if y == calc(sihei) and n >= gassan(sihei)
    end
    break if y == calc(sihei) and n >= gassan(sihei)
end

if y == calc(flg)
    puts flg.join(" ")
else
    puts result.join(" ")
end

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

typedef vector<int> VEC;

const int MAXN = 1e5+10;

struct Vec
{
	VEC Son;
	int col=-1;
	bool vis;
}node[MAXN];

bool flag=0;
long long cnt[2];

bool dfs(int now,int fa,int c)
{
	if(node[now].col!=-1)	return node[now].col==c;
	node[now].col=c;
	cnt[c]++;
	for(auto x:node[now].Son)
	{
		if(fa==x)	continue;
		if(!dfs(x,now,!c))	return false;
	}
	return true;
}
void addedge(int u,int v)
{
	node[u].Son.push_back(v);
}
int main()
{
	long long  m;
	long long n;
	scanf("%lld%lld",&n,&m);
	int u,v;
	if(n<=3)
	{
		printf("0");
		return 0;
	}
	for(long long i=0;i<m;++i)
	{
		scanf("%d%d",&u,&v);
		addedge(u,v);
		addedge(v,u);
	}
	if(dfs(1,-1,0))	printf("%lld",cnt[0]*cnt[1]-m);
	else printf("%lld",n*(n-1)/2-m);
	return 0;
}

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

public static partial class Program
{
    public static void Main()
    {
        var nx = CRL().ArrayLongs();
        var n = nx[0];
        var x = nx[1];
        var axis = CRL().ArrayLongs();
        for (int i = 0; i < n; i++)
        {
            axis[i] = Diff(x, axis[i]);
        }

        long gcd = axis[0];
        for (int i = 1; i < n; i++)
        {
            gcd = GCD(axis[i], gcd);
        }

        CWL(gcd);
    }
}

public static partial class Program
{
    //テンプレここから
    private static long ToInt(this string str) => long.Parse(str);
    private static long[] ToInt(this IEnumerable<string> strs) => strs.Select(x => x.ToInt()).ToArray();
    public static long[] ArrayLongs(this string str, char opr = ' ') => str.Split(opr).ToInt();
    public static string CRL() => Console.ReadLine();
    public static void CWL(object obj) => Console.WriteLine(obj);
    public static long Diff(long a, long b) => Math.Abs(Math.Max(a, b) - Math.Min(a, b));
    public static long Sign(this long i) => Math.Sign(i);
    public static bool IsEven(this long i) => i % 2 == 0;
    public static bool IsEven(this int i) => i % 2 == 0;
    public static long[] dx = new long[] { 0, -1, 0, 1 };
    public static long[] dy = new long[] { -1, 0, 1, 0 };
    public static long mod = 1000000007;
    public static string alphabet = "abcdefghijklmnopqrstuvwxyz";
    public static long ToLong(this char c) => c.ToString().ToInt();
    public static long[] Sort(this long[] array)
    {
        var list = array.ToList();
        list.Sort();
        return list.ToArray();
    }
    public static long GCD(long a, long b) => b == 0 ? a : GCD(b, a % b);
    public static long LCM(long a, long b) => a * b / GCD(a, b);
    //テンプレここまで
}


Measured memory_bytes: 22880
#include <cstdio>
#include <algorithm>

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

using namespace std;

int calc(int x,int y,int b,int p){
	return ((b>=5 && p>=2)?0.8:1)*(x*b+y*p);
}

int main(){
	int n; scanf("%d",&n);
	rep(_,n){
		int x,y,b,p; scanf("%d%d%d%d",&x,&y,&b,&p);
		printf("%d\n",min(calc(x,y,b,p),calc(x,y,max(b,5),max(p,2))));
	}
	return 0;
}



Measured memory_bytes: 2732
#include "bits/stdc++.h"
using namespace std;

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

int main() {
	ll a, b, c, d;
	ll x1, x2, x3, x4;
	ll ans;
	cin >> a >> b >> c >> d;
	x1 = a * c;
	x2 = b * c;
	x3 = a * d;
	x4 = b * d;
	ans = max(x1, x2);
	ans = max(ans, x3);
	ans = max(ans, x4);

	if (ans < 0 && x1 < 0 && x2 > 0 || ans < 0 && x3 < 0 && x4>0)ans = 0;
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3636
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }

    static class Task {
    	int N, M, ans = 0;
    	boolean[] box;
    	int[] ball; 
    	
        void solve(InputReader in, PrintWriter out) {
        	N = in.nextInt();
        	M = in.nextInt();
        	
        	box = new boolean[N];
        	Arrays.fill(box, false);
        	box[0] = true;
        	
        	ball = new int[N];
        	Arrays.fill(ball, 1);
        	
        	for (int i = 0; i < M; ++i) {
        		int x = in.nextInt() - 1;
        		int y = in.nextInt() - 1;
        		
        		if (box[x]) {
        			box[y] = true;
        			if (ball[x] < 2) box[x] = false;
        		}
        		
        		ball[x]--;
        		ball[y]++;
        	}
        	
        	for (boolean red : box) {
        		if (red) ans++;
        	}
        	
        	out.println(ans);
        }
    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] nextIntArray(int size) {
            int[] arr = new int[size];
            for (int i = 0; i < size; i++) {
                arr[i] = nextInt();
            }
            return arr;
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        long[] nextLongArray(int size) {
            long[] arr = new long[size];
            for (int i = 0; i < size; i++) {
                arr[i] = nextLong();
            }
            return arr;
        }
    }
}


Measured memory_bytes: 40860
use itertools::Itertools;
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
        k: u32,
        a: [[u32]; k],
    }
    let has_snacks = a
        .iter()
        .fold(vec![], |acc, curr| [acc, curr.to_vec()].concat())
        .iter()
        .unique()
        .cloned()
        .collect::<Vec<u32>>()
        .len();
    println!("{}", n - has_snacks);
}


Measured memory_bytes: 2288
#include <regex>
#include "bits/stdc++.h"
#define FOR(i, s, e) for (int i = int(s); i < int(e); ++i)
#define REP(i, e) FOR(i, 0, e)
#define INF (INT_MAX / 2)
#define LINF (LLONG_MAX / 2)
#define EPS (1.0e-8)
#define mkpr make_pair
const int MGN = 10;
const int ARY_SZ_MAX = (int)1e7;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>;
using vc = vector<char>; using vvc = vector<vc>;
using vb = vector<bool>; using vvb = vector<vb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>; using psl = pair<string, ll>;

bool is_bingo(const vvb& h) {
  // 横
  REP(i,3) {
    if (h[i][0] && h[i][1] && h[i][2]) return true;
  }
  // 縦
  REP(j,3) {
    if (h[0][j] && h[1][j] && h[2][j]) return true;
  }

  // 斜め
  if (h[0][0] && h[1][1] && h[2][2] ||
      h[0][2] && h[1][1] && h[2][0]) return true;

  return false;
}


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

  vvi A(3, vi(3));
  REP(i,3){
    REP(j,3) cin>>A[i][j];
  }

  int N; cin>>N;
  vi B(N); REP(i,N) cin>>B[i];

  vvb h(3, vb(3, false));

  REP(i,N) {    
    REP(j,3) {
      REP(k,3) {
        if (B[i] == A[j][k]) {
          h[j][k] = true;
          break;
        }
      }
    }    
  }

  string ans = is_bingo(h) ? "Yes" : "No";
  cout << ans << endl;


  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <time.h> 
#define ll long long int
#define F first
#define S second
#define pb push_back
#define sd(x) scanf("%d",&x)
#define sd2(x,y) scanf("%d%d",&x,&y);
#define sdl(x) scanf("%lld",&x)
#define sd2l(x,y) scanf("%lld%lld",&x,&y);
#define sz(x) (int)(x.size())
#define nax 100010
#define inf 1001000100
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MOD 1000000007
#define mp make_pair
#define pc pair<char ,int>
#define pi pair<int ,int>
#define pii pair <pi,pi>
using namespace std;
vector< int > v[nax];
int vis[nax];
int done[nax];
int len[nax];
void dfs(int s)
{
  int ma = 0;
  vis[s] = 1;
  for(int i = 0; i < sz(v[s]); i++)
  { 
      if(done[v[s][i]])
      {
        ma = max(ma, len[v[s][i]]);
        continue;
      }
      if(!vis[v[s][i]])
      {
        dfs(v[s][i]);
        ma = max(ma , len[v[s][i]]);
      }
  }
  done[s] = 1;
  len[s] = ma + 1;

}
int main(int argc, char const *argv[])
{
  //freopen("input.txt","r",stdin);
  //freopen("output.txt","w",stdout);
  int n, m, a, b;
  sd2(n, m);
  for(int i = 1; i <= m; i++)
  {
      sd2(a, b);
      v[a].pb(b);
  }
  for(int i = 1;  i <= n; i++)
  {
      if(!vis[i])
        dfs(i);
  }
  int ma = 0;
  for(int i = 1; i <= n; i++)
    ma = max(ma , len[i]);

  printf("%d\n", ma - 1);
  return 0;
} 

Measured memory_bytes: 9600
//#pragma GCC optimize ("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
#define pb push_back
#define F first
#define S second
#define ins insert
#define mp make_pair
#define fo(i, n1, n, x) for(int i = n1; i <= n; i += x)
#define foo(i, n, n1, x) for(int i = n; i >= n1; i -= x)
#define bit __builtin_popcount
#define md (l + ((r - l) / 2))
#define all(x) x.begin(),x.end()
#define eb emplace_back
#define ub upper_bound
#define lb lower_bound
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;


using ll = long long;

#define int ll


const int N = 2e5 + 11, mod = 1e9 + 7, mod2 = 998244353;
const int MAX = 1e5 + 11;
const int INF1 = 2e9 + 11;
const ll INF2 = 2e18 + 11;
const double INF3 = 1e8 + 11;
const int base = 500;
const int P = 31;
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};
const double EPS = 1e-4;
const double PI = acos(-1.0);


template<typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }


typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <int> vi;


mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int n, k,f[N];
int mult(int a, int b) {
    a%=mod;
    b%=mod;
    a*=b;
    a%=mod;
    return a;
}
int binpow(int a, int n) {
	int res = 1;
	while (n) {
		if (n & 1)
			res *= a,res%=mod;
		a *= a;
		a%=mod;
		n >>= 1;
	}
	return res;
}
int c(int n, int k) {
    int res=f[n];
    res = mult(res, mult(binpow(f[k],mod-2),binpow(f[n-k],mod-2)));
    return res;
}
void add(int &a, int b) {
    a+=b;
    if (a<0) a+=mod;
    a%=mod;
}
main() {
    file("threesum");
    ios;
    cin >> n >> k;
    f[0]=1;
    fo(i,1,n,1) f[i]=(f[i-1]*i)%mod;
    chmin(k,n);
    int ans=0;
    fo(i, 0, k, 1) add(ans,mult(c(n,i),c(n-i+i-1,i)));
    cout<<ans;
    cerr << "\nTime elapsed: " << (clock() + 0.0) / CLOCKS_PER_SEC;
    return 0;
}
/**

*/


Measured memory_bytes: 1792
S = gets.chomp
T = gets.chomp

s = Hash.new{|h, k| h[k] = 0}
t = Hash.new{|h, k| h[k] = 0}
S.each_char{|ss| s[ss] += 1}
T.each_char{|tt| t[tt] += 1}
ans = 'Yes'
if s.size != t.size then
  ans = 'No'
else
  (0...S.size).each{|i|
    (ans = 'No'; break) if s[S[i]] != t[T[i]]
  }
end

puts ans


Measured memory_bytes: 2632
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 0xccccccc;
const ll LINF = 0xcccccccccccccccLL;
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);}
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}



//head



int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int k;
	cin >> k;
	rep(i, k) cout << "ACL";
	cout << endl;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define INF 1000000000

void solve_abc110_c() {
	string S, T;
	string ans = "Yes";

	cin >> S >> T;

	map<char, ll> ms, mt;
	vector<ll> ls(S.size()), lt(T.size());
	ll cnt = 0, num = 0;

	rep(i, S.size()) {
		auto itr = ms.find(S[i]);
		if (itr == ms.end()) {
			cnt++;
			num = cnt;
			ms.emplace(S[i], num);
		}
		else {
			num = itr->second;
		}
		ls[i] = num;
	}

	cnt = 0;
	rep(i, T.size()) {
		auto itr = mt.find(T[i]);
		if (itr == mt.end()) {
			cnt++;
			num = cnt;
			mt.emplace(T[i], num);
		}
		else {
			num = itr->second;
		}
		lt[i] = num;
	}

	rep(i, S.size()) {
		if (ls[i] != lt[i]) {
			ans = "No";
			break;
		}
	}

	cout << ans << "\n";
}

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

	solve_abc110_c();

	return 0;
}


Measured memory_bytes: 3988
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll LINF = (1LL << 60) - 1LL;
constexpr double eps = 1e-9;
constexpr ll MOD = 1000000007LL;
template <typename T> bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
};
template <typename T> bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
};
template <typename T> ostream &operator<<(ostream &os, vector<T> v) {
    for (int i = 0; i < v.size(); i++) {
        os << v[i] << (i + 1 == v.size() ? "\n" : " ");
    }
    return os;
}
template <typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a, make_v<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);
    }
};
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, d;
    cin >> n >> d;
    cout << n / (2 * d + 1) + (n % (2 * d + 1) > 0) << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#define MAX 2000001
#define VMAX 10000

int main(){
  unsigned short *A, *B;
  int C[VMAX+1];
  int n, i, j;

  scanf("%d", &n);

  A = malloc(sizeof(short)*n+1);
  B = malloc(sizeof(short)*n+1);

  for(i=0;i<=VMAX;i++){
    C[i]=0;
  }

  for(i=0;i<n;i++){
    scanf("%hu",&A[i+1]);
    C[A[i+1]]++;
  }

  for(i=1;i<=VMAX;i++){
     C[i]=C[i]+C[i-1];
  }

  for(j=1;j<=n;j++){
    B[C[A[j]]]=A[j];
    C[A[j]]--;
  }

  for(i=1;i<=n;i++){
    if(i>1)printf(" ");
    printf("%d",B[i]);
  }
  
  printf("\n");

  return 0;
}


Measured memory_bytes: 9596
#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <complex>
#include <set>
#include <list>
#include <iomanip>
#include <map>
#include <limits.h>
#include <memory.h>


using namespace std;
static const double EPS = 1e-10;
typedef long long ll;
typedef unsigned long long ull;
#define FOR(i,n) for(int i=0;i<(int)n;++i)
#define FORNUM(p, x) for (int num = p; num < (int)(x); ++num)
#define FORI(p, x) for (int i = p; i < (int)(x); ++i)
#define FORJ(p, x) for (int j = p; j < (int)(x); ++j)
#define FORK(p, x) for (int k = p; k < (int)(x); ++k)
#define FORL(p, x) for (int l = p; l < (int)(x); ++l)

typedef vector<double> vec;
typedef vector<vec> mat;

mat b(2,vec(3));



int main() {
	string a,b;
	cin>>a>>b;
	if(a.length()>b.length())
		cout << "GREATER" << endl;
	else if(a.length()<b.length())
		cout << "LESS" << endl;
	else if(a>b)
		cout << "GREATER" << endl;
	else if(a<b)
		cout << "LESS" << endl;
	else 
		cout << "EQUAL" << endl; 



	return 0;
}




Measured memory_bytes: 256
//C
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

//C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

//Others
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;
}
const int dx[8] = { -1,0,1,-1,1,-1,0,1 };
const int dy[8] = { 1,1,1,0,0,-1,-1,-1 };


//LOVE NyantakoGG	https://www.youtube.com/channel/UC6XdFs8T6Ei54O0FYl3PVVA


using namespace std;



int main() {
	int N;
	cin >> N;
	cout << (int)pow(floor(sqrt(N)), 2) << endl;
}


Measured memory_bytes: 256
n = int(input())
l = list(map(int,input().split()))
count = 0
for i in range(n):
    a = l[i]
    for j in range(n-i-1):
        b = l[i+1+j]
        for k in range(n-i-j-2):
            c = l[i+1+j+1+k]
            if a != b and a != c and b != c:
                test = [a,b,c]
                test.sort()
                if test[2] < test[0] + test[1]:
                    count += 1
print(count)


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

int main(){

    int a,b;cin >> a >> b;
    int sum = 0;

    if(max(a,b)==a){
        sum+=a;
        --a;
        sum += max(a,b);
    }else{
        sum+=b;
        --b;
        sum+=max(a,b);
    }

    cout << sum << endl;

    return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
 
int main(){
    int n;
    cin>>n;
    bool t=true;
    for (int i=0; i<n; i++){
        int a;
        cin>>a;
        if (a%2==0){
            if (a%3!=0){
                if (a%5!=0){
                    t=false;
                }
            }
        }
    }
    if (t){
        cout<<"APPROVED"<<endl;
    }
    else{
        cout<<"DENIED"<<endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <iostream>

using namespace std;

int main(){
  string S;int sum = 0;
  getline(cin,S);
  for (int i  = 0;i < 4;i++){
    if (S[i] == '-'){
      sum -= 1;
    }else{
      sum += 1;
    }
  }
  cout << sum <<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[100006];
bool flag = false;
int gcd(int a, int b)
{
	return b == 0 ? a : gcd(b, a%b);
}
int main()
{
	int maxn = 0;
	int n, k; scanf("%d%d", &n, &k);
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
		if (k == a[i]) {
			printf("POSSIBLE\n");
			return 0;
		}
		maxn = max(maxn, a[i]);
	}
	if (maxn < k) {
		printf("IMPOSSIBLE\n");
		return 0;
	}
	int sub = a[0];
	for (int i = 1; i < n; i++) {
		sub = gcd(a[i], sub);
	}
	if ((maxn - k) % sub == 0)printf("POSSIBLE\n");
	else printf("IMPOSSIBLE\n");
}

Measured memory_bytes: 640
#![allow(unused_imports)]
#![allow(dead_code)]
use proconio::input;
use proconio::fastout;
use proconio::marker::{Chars};

#[fastout]
fn main() {
    input! {
        a:i32,b:i32,
    }
    let v=vec![a+b,a-b,a*b];
    let mx=v.into_iter().fold(std::i32::MIN,i32::max);
    println!("{}",mx);
}

Measured memory_bytes: 2192
pub fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

pub fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

pub fn read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

pub fn read_col<T: std::str::FromStr>(n: usize) -> Vec<T> {
    (0..n).map(|_| read()).collect()
}

fn main() {
    let nm: Vec<usize> = read_vec();
    let n = nm[0];
    let m = nm[1] as u32;
    let s: String = read();
    let cv: Vec<char> = s.chars().collect();
    let mut v: Vec<u32> = vec![];
    let mut tmp = 1;
    for i in 1..n + 1 {
        if cv[i] != cv[i - 1] {
            v.push(tmp);
            tmp = 1;
        } else {
            tmp += 1;
        }
    }
    v.push(tmp - 1);

    let l = v.len();

    let mut i = l;
    let mut cnt = m;

    let mut ans: Vec<u32> = vec![];

    while i > 0 {
        let id = i - 1;
        if id % 2 == 0 {
            if v[id] > cnt {
                ans.push(m);
                v[id] -= cnt;
                cnt = m;
            } else {
                cnt -= v[id];
                i -= 1;
            }
        } else {
            if v[id] >= m {
                println!("-1");
                return;
            } else if v[id] >= cnt {
                ans.push(m - cnt);
                cnt = m;
            } else {
                cnt -= v[id];
                i -= 1;
            }
        }
    }
    ans.push(m - cnt);

    for i in (0..ans.len()).rev() {
        print!("{}", ans[i]);
        if i == 0 {
            println!("");
        } else {
            print!(" ");
        }
    }
}


Measured memory_bytes: 4476
n = int(input())
P = [int(x) for x in input().split()]

b = [None] * (n + 1)
b[P[0]] = 1
bs = {1}

for p, pprev in zip(P[1:], P):
    bp = b[pprev] + (pprev - p) * 20000 + 1
    while bp in bs:
        bp += 1
    b[p] = bp
    bs.add(bp)

offset = 1 - min(b[1:])
b = [i + offset for i in b[1:]]

print(' '.join([str(20000 * i) for i in range(1, n + 1)]))
print(' '.join([str(i) for i in b]))


Measured memory_bytes: 46368