akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main(void){
	int a[3]={0},tmp[3]={0};
	scanf("%d%d%d",&a[0],&a[1],&a[2]);
	for(int i=0;i<3;i++){
		for(int j=i+1;j<3;j++){
			if(a[i]>a[j]){
				tmp[i]=a[j];
				a[j]=a[i];
				a[i]=tmp[i];
			}
		}
	}
	printf("%d %d %d\n",a[0],a[1],a[2]);
	return 0;
}


Measured memory_bytes: 2100
#include<bits/stdc++.h>
using namespace std;
#define ll unsigned long long
#define pb push_back
#define mk make_pair
#define REP(i,a,b) for(int i=a; i<=b; i++)
#define mod 1000000007
int main()
{
    ll n,k;
    cin >> n >> k;
    vector<int> v(n);
    REP(i,0,n-1)
        cin >> v[i];
    
    //internal inversion count
    ll int_inv = 0;
    REP(i,0,n-1)
    {
        //cout << v[i] << endl;
        REP(j,i+1,n-1)
        {
            if (v[j] < v[i])
            {
                //cout << v[j] << " ";
                int_inv += 1;
            }
        }
        //cout << endl;
    }
    //inversion count for other k-1
    ll ext_inv = 0;
    REP(i,0,n-1)
    {
        REP(j,0,n-1)
        {
            if (i != j && v[j] < v[i])
            {
                ext_inv += 1;
            }
        }
    }
   // cout << int_inv << " " << ext_inv << endl; 
    ll ans = k*(k-1)/2;
    //cout << ans << " hoi " << k*k << endl;
    ans = ans%mod;
    //cout << ans << endl;
    ans = ((ans*ext_inv)%mod + (k*int_inv)%mod)%mod;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
 
int main(void){
    int a,b,c,i,count=0;
     
    scanf("%d %d %d",&a,&b,&c);
     
    for (i=a;i<b+1;i++){
        if (c%i==0) count++;
    }
     
    printf("%d\n",count);
     
    return 0;
}

Measured memory_bytes: 596
import java.util.Scanner;

public class Main {

	private static int data[] = {1 , 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int k = scan.nextInt();
		System.out.println(data[k-1]);
	}

}



Measured memory_bytes: 21844
--{-# LANGUAGE OverloadedStrings #-}
--{-# LANGUAGE OverloadedLists   #-}
{-# LANGUAGE BangPatterns      #-} --引数に!
{-# LANGUAGE MultiWayIf        #-}
{-# LANGUAGE TupleSections     #-}

import Data.Bits
import Data.Foldable (foldlM,foldrM)
import Data.Maybe (fromJust)
import Data.List
import Data.Array.Unboxed
import Data.Array.MArray
import Data.Array.ST
import qualified Data.Vector.Unboxed as V
import Control.Monad
import Control.Monad.State
import Control.Monad.ST
import qualified Data.ByteString.Lazy.Char8 as BS
--import Debug.Trace

type DP s = STUArray s (Bool,Int,Bool,Bool,Bool) Int

modifyArray :: (MArray a e m ,Ix i) => a i e -> i -> (e -> e) -> m ()
modifyArray arr i f =  readArray arr i >>= writeArray arr i . f

dp_i :: DP s -> (Int,Int) -> ST s ()
dp_i dparr (i,c) = do
  forM_ [False,True] $ \exist7 ->
    forM_ [False,True] $ \exist5 ->
      forM_ [False,True] $ \exist3 ->
        forM_ [False,True] $ \lower -> if i == 0 && (exist3 || exist5 || exist7 || lower) then return () else do
          a <- readArray dparr (lower,i,exist7,exist5,exist3)
          if a == 0 && i /= 0 then return () else do
            --traceShowM ((lower,i,exist7,exist5,exist3),a)
            let add7T = modifyArray dparr (True,i+1,True,exist5,exist3) (+a)
                add5T = modifyArray dparr (True,i+1,exist7,True,exist3) (+a)
                add3T = modifyArray dparr (True,i+1,exist7,exist5,True) (+a)
                add7F = modifyArray dparr (False,i+1,True,exist5,exist3) (+a)
                add5F = modifyArray dparr (False,i+1,exist7,True,exist3) (+a)
                add3F = modifyArray dparr (False,i+1,exist7,exist5,True) (+a)
                add753T = add7T >> add5T >> add3T
            if lower then add753T
              else if | c > 7  -> add753T
                      | c == 7 -> add7F >> add5T >> add3T
                      | c == 6 -> add5T >> add3T
                      | c == 5 -> add5F >> add3T
                      | c == 4 -> add3T
                      | c == 3 -> add3F
                      | c < 3  -> return ()

solve :: String -> ST s Int
solve n = do
  --添え字　N以下決定,i文字目,7,5,3の存在
  let ln = length n
      ans' k = 3^k - 3*2^k + 3
  dparr <- newArray ((False,0,False,False,False),(True,ln,True,True,True)) 0
  writeArray dparr (False,0,False,False,False) 1
  forM_ (zip [0..ln-1] n) $ \(i,c) -> dp_i dparr (i,(read [c] :: Int))
  ls <- forM [False,True] $ \lower -> readArray dparr (lower,ln,True,True,True)
  --traceShowM ls
  return $ (sum ls) + (sum $ map ans' [3..ln-1])
main :: IO ()
main = do
  s <- getLine
  print $ runST $ solve s

mod' :: Int -> Int
mod' n = if n < 1000000007 then n else mod n 1000000007


Measured memory_bytes: 764
#include<iostream>
#include<string>
#include<algorithm>
#include <stdio.h>
#include<iostream>
#include<math.h>
#include<sstream>
using namespace std;
int main(){
string s;
cin >>s;
int n= s.length();
for(int i=1; i<n; i++){
bool k= ((n-i)%2==0);

if(k){
  for(int j=0;j<(n-i)/2;j++){
  if(s[j]!=s[(n-i)/2+j]) break;

  if(j==(n-i)/2 -1) {cout <<n-i<<endl; return 0;}
}
}
}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const int inf = 1e9;
const ll INF = 1e18;
const double pi = 3.14159265358979323846;
#define rep(i,n) for(ll i=0;i<n;i++)

int main(){
	ll n,c,k;cin>>n>>c>>k;
	ll t[n];
	rep(i,n) cin>>t[i];
	sort(t,t+n);
	ll ans=1,cnt=0,l=t[0]+k;
	rep(i,n){
		cnt++;
		if(cnt>c||l<t[i]){
			ans++;
			l=t[i]+k;
			cnt=1;
		}
	}
	cout<<ans<<"\n";
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cerr << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cerr<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 500010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = (1 << 30) - 1;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
mt19937 rng; //use it by rng() % mod, shuffle(all(vec), rng)
///////////////////////////////////////////////////////////////////////////////////////////////////

int H, W, K;
int S[20][1010];

int D[20][1010];
int T[20];

void solve() {
	cin >> H >> W >> K;
	rep(i, 0, H) {
		rep(j, 0, W) {
			char c; cin >> c;
			S[i][j] = c - '0';
		}
	}

	int res = H - 1 + W - 1;
	rep(bit, 0, (1 << (H - 1))) {
		int at = 0;
		vi vec; vec.pb(at);
		rep(i, 0, H - 1) {
			if(bit & (1 << i)) vec.pb(++at);
			else vec.pb(at);
		}
		memset(D, 0, sizeof(D));
		rep(i, 0, H) {
			rep(j, 0, W) {
				D[vec[i]][j] += S[i][j];
			}
		}
		bool ok = true;
		rep(i, 0, at + 1) {
			rep(j, 0, W) {
				if(D[i][j] > K) ok = false;
			}
		}
		if(!ok) continue;
		memset(T, 0, sizeof(T));
		int tmp = at;
		rep(j, 0, W) {
			bool ok = true;
			rep(i, 0, at + 1) {
				T[i] += D[i][j];
				if(T[i] > K) ok = false;
			}
			if(!ok) {
				tmp++;
				rep(i, 0, at + 1) {
					T[i] = D[i][j];
				}
			}
		}
		MIN(res, tmp);
		// debug(vec, tmp, res, tmp);
	}
	cout << res << "\n";
}

uint32_t rd() {
	uint32_t res;
#ifdef __MINGW32__
	asm volatile("rdrand %0" :"=a"(res) ::"cc");
#else
	res = std::random_device()();
#endif
	return res;
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
    cerr << fixed;
	cerr.precision(6);
	rng.seed(rd());
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
	if(!freopen("in.txt", "rt", stdin)) return 1;
#endif	
	solve();
    cerr << "Time: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}



Measured memory_bytes: 384
#include<iostream>
#include<set>
#include<algorithm>
#include<vector>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)
enum{TOP=0,FRONT,RIGHT,LEFT,BACK,BOTTOM}; 
#define rotate_swap(x,a,b,c,d) swap(x.m[a],x.m[b]);swap(x.m[b],x.m[c]);swap(x.m[c],x.m[d]);


class Dice{
public:
  int m[6];
  bool operator<(const Dice &a)const{
    rep(i,6)if (m[i] != a.m[i])return m[i] < a.m[i];
    return false;
  }
};
 
void rotate_r(Dice &x){
  rotate_swap(x,TOP,LEFT,BOTTOM,RIGHT);
}
 
void rotate_l(Dice &x){
 rotate_swap(x,TOP,RIGHT,BOTTOM,LEFT);
}
 
void rotate_f(Dice &x){
 rotate_swap(x,TOP,BACK,BOTTOM,FRONT);
}
 
void rotate_b(Dice &x){
 rotate_swap(x,TOP,FRONT,BOTTOM,BACK);
}
 
void rotate_cw(Dice &x){
  rotate_swap(x,BACK,LEFT,FRONT,RIGHT);
}
 
void rotate_ccw(Dice &x){
  rotate_swap(x,BACK,RIGHT,FRONT,LEFT);
}
 
Dice data[24];

void generate_all(Dice &x){
  rep(i,6){
   rep(j,4){
     data[i*4+j]=x;
     rotate_cw(x);
   }
   if (i%2 == 0)rotate_r(x);
   else rotate_f(x);
 }
}

main(){
  string hoge[6]={"Red","Yellow","Blue","Magenta","Green","Cyan"};
  int n;
  while(cin>>n && n){
    set<Dice> S;
    rep(i,n){
      int a[6];
      rep(j,6){
	string tmp;
	cin>>tmp;
	rep(k,6)if (hoge[k] == tmp)a[j]=k;
      }
      Dice d={a[0],a[1],a[2],a[3],a[4],a[5]};
      generate_all(d);
      bool isok=true;
      rep(j,24){
	if (S.find(data[j]) != S.end()){
	  isok=false;
	}
      }
      if (isok)S.insert(d);
    }
    cout << n-S.size() << endl;
  }
  return false;
}

Measured memory_bytes: 0
import sys
readline=sys.stdin.readline

N = int(readline())

DIV = 10 ** 9 + 7

dp = [[0] * 4 for i in range(N + 1)]

dp[0][0] = 1

for i in range(1, N + 1):
  dp[i][0] += (dp[i - 1][0] * 8) % DIV
  dp[i][0] %= DIV
  
  dp[i][1] += dp[i - 1][0] + (dp[i - 1][1] * 9) % DIV
  dp[i][1] %= DIV
  
  dp[i][2] += dp[i - 1][0] + (dp[i - 1][2] * 9) % DIV
  dp[i][2] %= DIV
  
  dp[i][3] += dp[i - 1][1] + dp[i - 1][2] + (dp[i - 1][3] * 10) % DIV
  dp[i][3] %= DIV
  
print(dp[-1][3])


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

int compare_int(const void*a, const void*b)
{
  return *(int*)a-*(int*)b;
}

int main()
{
  int n,k;
  int a[200001];
  int i;
  int b[200001];
  int c=0;
  int ans=0;
  scanf("%d%d",&n,&k);
  for(i=0;i<n;i++){
    b[i]=0;
  }
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
    if(b[a[i]-1]==0) c++;
    b[a[i]-1]++;
  }
  qsort(b,n,sizeof(int),compare_int);
  i=0;
  while(c>k){
    if(b[i]!=0){
      c--;
      ans+=b[i];
    }
    i++;
  }
  printf("%d",ans);
  return 0;
}


Measured memory_bytes: 3868
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b, c;
    cin >> a >> b >> c;
    if(a < b && b < c) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


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

int main(){
	int n = 1e5+1;
	int is[n] = {0}, temp;
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> temp;
		is[temp]++;
	}
	int ans = is[0]+is[1];
	for(int i = 1; i < (int)1e5; i++){
		ans = max(ans, is[i-1]+is[i]+is[i+1]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
#define _USE_MATH_DEFINES

#include <bits/stdc++.h>
using namespace std;
using i32 = int; using i64 = long long int; using f64 = double; using str = string;
template <typename T> using vec = vector<T>;
template <typename T> using heap = priority_queue<T, vec<T>, greater<T>>;
#define times(n, i) for (i32 i = 0; i < (n); ++i)
#define range(a, b, i) for (i32 i = (a); i < (b); ++i)
#define upto(a, b, i) for (i32 i = (a); i <= (b); ++i)
#define downto(a, b, i) for (i32 i = (a); i >= (b); --i)
#define all(xs) (xs).begin(), (xs).end()
#define sortall(xs) sort(all(xs))
#define reverseall(xs) reverse(all(xs))
#define uniqueall(xs) (xs).erase(unique(all(xs)), (xs).end())
#define even(x) (((x) & 1) == 0)
#define odd(x) (((x) & 1) == 1)
#define append emplace_back
#define findge lower_bound
#define findgt upper_bound
const i64 MOD = 1000000007;
const f64 EPS = 1e-10;

i32 n;
vec<i64> a, b;

i32 main()
{
	cin >> n;
	a.resize(n); b.resize(n);
	times(n, i) { cin >> a[i]; }
	times(n, i) { cin >> b[i]; }
	sortall(a);
	sortall(b);
	i64 ans = 1;
	times(n, i) {
		i32 cnt;
		if (a[i] < b[i]) {
			cnt = distance(a.begin(), findge(all(a), b[i])) - i;
		} else {
			cnt = distance(b.begin(), findge(all(b), a[i])) - i;
		}
		ans = (ans * cnt) % MOD;
	}
	cout << ans << endl;
    return 0;
}

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

int main(){
    int a_i, b_i, n, temp, cont = 0;
    string st;

    cin>>st;

    char chCu = st[0], cht;
    temp = st.size();
    for( a_i=0; a_i<temp; a_i++ ){
        if( st[a_i] != chCu ){
            cont++;
            chCu = st[a_i];
        }
    }

    cout<<cont<<endl;

}


Measured memory_bytes: 512
import collections

n, t = map(int, input().split())
a = list(map(int, input().split()))

minimum = a[0]
diffs = []
for i in range(1, n):
    diffs.append(a[i] - minimum)
    minimum = min(minimum, a[i])

c = collections.Counter(diffs)
print(c[max(c)])

Measured memory_bytes: 22112
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
long long x,ans;
int main()
{
	scanf("%lld",&x);
	ans=x/500*1000;
	x%=500;
	ans+=x/5*5;
	printf("%lld\n",ans);
return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<stdio.h>
// #include <ext/pb_ds/assoc_container.hpp> // Common file
// #include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
//using namespace __gnu_pbds;
using namespace std;

#define ordered_set tree<ll , null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
#define ll  long long
#define mod 1000000007
#define ve vector
#define pi pair<int,int>
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define all(v) v.begin(),v.end()
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

const int inf=1e9+5;


ll power(ll a,ll b,ll c)
{
	ll res=1;
	while(b)
	{
		if(b&1LL)
			res=(res*a)%c;
		a=(a*a)%c;
		b/=2;
	}
	return res;
}



void solve()
{ 
ll n;
    cin>>n;
   ll k=7;
       unordered_map<int,int>mp;
    ll ans=1;
    k=k%n;
    while(k!=0)
    {
        if(mp[k])
        {
         cout<<-1<<endl;
            return ;
        }
        mp[k]++;
       k=k*10+7;
        k=k%n;
       ans++;
    }
    cout<<ans<<endl;
    
}

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



Measured memory_bytes: 42656
#include<iostream>

using namespace std;

int main() {

	int W,H,x,y,r;

	cin >> W >> H >> x >> y >> r;

	if (x - r >= 0 && x + r <= W && y - r >= 0 && y + r <= H) {
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 3100
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> mp;

int main(){
	int w,h,n;
	cin>>w>>h>>n;
	int x,y;
	cin>>x>>y;
	mp now  = mp(x,y);
	int cnt = 0;
	for(int i=0;i<n-1;i++){
	cin>>x>>y;
	int dx = now.first-x;
	int dy = now.second -y;
	now = mp(x,y);
	if(dx*dy>0){
		cnt += max(abs(dx),abs(dy));
	}else{
		cnt += abs(dx)+abs(dy) ;
	}

	}
	cout<<cnt<<endl;
	return 0;
}



Measured memory_bytes: 3100
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store") // to restrict undesirable precision
#pragma GCC optimize ("-fno-defer-pop")// to pop argument of function as soon as it returns
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define sc second
#define takeline cin.ignore();
#define iactive cout.flush();
#define N 3000005
#define endl "\n"
#define mod 1000000007
#define PI 3.141592653589793
//((1.0l)*BIG MULTIPLY MAGIC?)
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//-----------------------------------------------
int main(){

	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

	ll n;
	cin>>n;
	ll k=(n%1000);
	cout<<(1000-k)%1000<<endl;
	return 0;	
}

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

int main()
{
	int n, t, a;
	cin >> n >> t >> a;

	double res = 1000;
	int ans = -1;
	for (int i = 0; i < n; i++) {
		int h;
		cin >> h;
		double tem = t - h * 0.006;
		if (a > tem) {
			if (a - tem < res) {
				res = a - tem; ans = i;
			}
		}
		else if (tem > a) {
			if (tem - a < res) {
				res = tem - a; ans = i;
			}
		}
		else {
			res = 0; ans = i;
		}
	}

	cout << ans + 1 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
#define pb(a) push_back(a)
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
//typedef tuple<ll, ll, ll> T;

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; }

void add(ll& a, ll b){a = (a+b) % MOD;}

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    vector<int> a(n);
    REP(i,n) cin>>a[i];
    int ans=0;
    for(int i=1;i<n;i++){
        if(a[i]==a[i-1]) ans++,i++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
function main(input) {
  var count = input.split("\n");
  var input = count[1].split(" ");
  var map1 = input.map(x => parseInt(x, 10));
  var kazu = 0;
  while(map1.every(y => y%2 == 0)){
  	var map1 = map1.map(z => z/2);
    kazu++;
  }
  console.log(kazu);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 29252
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int inf = 0x3f3f3f3f;
ll P=1e9+7;
ll parent[300000];
ll ranks[300000];
ll find(ll x)
{
    if(parent[x]==x)
    return x;
    return parent[x]=find(parent[x]);
}
void unions(ll x,ll y)
{
    ll xp=find(x);
    ll yp=find(y);
    //cout<<xp<<" "<<yp<<endl;
    if(xp!=yp)
    {
        if(ranks[xp]>ranks[yp])
        parent[yp]=xp;
        else 
        {
            parent[xp]=yp;
            if(ranks[xp]==ranks[yp])
            ranks[yp]++;
        }
    }
}
 void solve()
 {
     ll i,j,k,l,m,n,o,p,q,r,a[300001],prefix[300001];
     memset(ranks,0,sizeof(ranks));
     memset(a,0,sizeof(a));
     cin>>n>>m;
     //cout<<n<<" "<<m<<endl;
     for(i=1;i<=n;i++)
     {
         parent[i]=i;
         ranks[i]=0;
     }
     for(i=1;i<=m;i++)
     {
        cin>>o>>p;
        unions(o,p);
     }
     ll s=0;
     for(i=1;i<=n;i++)
     {
         o=find(i);
        // cout<<o<<" ";
         a[o]++;
         s=max(s,a[o]);
     }
     cout<<s<<endl;
 }
int main()
{
     ios_base::sync_with_stdio(false);
     cin.tie(0);
     ll t=1;
    // cin>>t;
     while(t--)
     {
         solve();
     }
    return 0;
}


Measured memory_bytes: 9904
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    string s,t;
    int k;
    cin>>s>>t;
    for(int i=s.length()-t.length();i>=0;i--){
      k=i;
      for(int j=0;j<t.length();j++){
        if(s[k]==t[j]||s[k]=='?'){k++;}
         else{break;}  
        if(j==t.length()-1){
          int m=0;
          for(int k=i;k<t.length()+i;k++){
            s[k]=t[m];m++;
          }
          for(int j=0;j<s.length();j++){
            if(s[j]=='?'){s[j]='a';}
            cout<<s[j];
          }
          cout<<endl;
          return 0;
        }    
      }    
    }
    cout<<"UNRESTORABLE"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int partition();

int a[100000] = {}, n;

int main() {
  int i, p;

  scanf("%d", &n);
  for(i = 0; i < n; i++){
    scanf("%d", &a[i]);
  }

  p = partition();

  for(i = 0; i < n; i++){
    if(i == p) printf("[%d]", a[i]);
    else printf("%d", a[i]);
    if(i != n-1) printf(" ");
  }
  printf("\n");

  return 0;
}

int partition() {
  int i, j, temp;
  i = -1;

  for(j = 0; j < n-1; j++){
    if(a[j] <= a[n-1]){
      i++;
      temp = a[i];
      a[i] = a[j];
      a[j] = temp;
    }
  }
  temp = a[i+1];
  a[i+1] = a[n-1];
  a[n-1] = temp;
  return i + 1;

}



Measured memory_bytes: 2088
#include<cstdio>
#include<vector>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<iostream>
#include<algorithm>
#include<map>
#define PI acos(-1.0)
#define pb push_back
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N=1e5+5;
const int MOD=1e9+7;
const double EPS=1e-12;
template <class T>
bool sf(T &ret){ //Faster Input
    char c; int sgn; T bit=0.1;
    if(c=getchar(),c==EOF) return 0;
    while(c!='-'&&c!='.'&&(c<'0'||c>'9')) c=getchar();
    sgn=(c=='-')?-1:1;
    ret=(c=='-')?0:(c-'0');
    while(c=getchar(),c>='0'&&c<='9') ret=ret*10+(c-'0');
    if(c==' '||c=='\n'){ ret*=sgn; return 1; }
    while(c=getchar(),c>='0'&&c<='9') ret+=(c-'0')*bit,bit/=10;
    ret*=sgn;
    return 1;
}
int sign(double x){
    return fabs(x) < EPS ? 0 : x>0 ? 1 : -1 ;
}

int main(void){
    ll n;
    sf(n);
    for(int i=0;i<=100;i++){
        if(i*4>n){
            cout <<"No"<<endl;
            return 0;
        }
        if((n-i*4)%7==0){
            cout <<"Yes"<<endl;
            return 0;
        }
    }

    return 0;
}


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

int main(){
    vector<long long> a(3);
    long long k;
    cin >> a[0]>> a[1] >> a[2] >> k;

    sort(a.begin(), a.end());

    long long sum = a[2];
    for(long long i = 0; i < k; i++) sum *= 2;

    sum += a[0] + a[1];

    cout << sum << endl;
    return 0;
}

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

using namespace std;

using ll = long long;

const ll MOD = 1000000007;

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

int a[15];
int info[15][15];

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int n; cin >> n;

    for(int i=0;i<15;i++){
        for(int j=0;j<15;j++){
            info[i][j] = -1;
        }
    }

    for(int i=0;i<n;i++){
        int a; cin >> a;
        for(int j=0;j<a;j++){
            int x, y; cin >> x >> y;
            info[i][x-1] = y;
        }
    }

    int ans = 0;

    for(int bit=0;bit<(1<<n);bit++){
        bool flag = true;
        int cnt_h = 0;
        for(int i=0;i<n;i++){
            if(!flag) break;
            // i is honest
            if(bit & (1<<i)){
                cnt_h++;
                for(int k=0;k<15;k++){
                    if(info[i][k] == 0){
                        // check k is not honest
                        if(bit & (1<<k)){
                            flag = false;
                            break;
                        }
                    }else if(info[i][k] == 1){
                        // check k is honest
                        if(!(bit & (1<<k))){
                            flag = false;
                            break;
                        }
                    }
                }
            }
        }
        if(flag){
            ans = max(ans, cnt_h);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<set>
#include<climits>
#include<bitset>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)

using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef tuple<ll, ll, ll, ll> lltpl;



/******************************************************************************************/


const int IINF = 1e9 + 7;
const ll LINF = 1e18 + 7;
const ll MOD = 1e9 + 7;


// 多次元vector生成，初期化
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);
}

// vector
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {for (T& x : vec) is >> x;return is;}
// pair
template <typename T, typename U>ostream& operator<<(ostream & os, pair<T, U> & pair_var) {	os << "(" << pair_var.first << ", " << pair_var.second << ")";return os;}
// vector
template <typename T>ostream& operator<<(ostream & os, const vector<T> & vec) {	os << "{";	for (int i = 0; i < vec.size(); i++) {os << vec[i] << (i + 1 == vec.size() ? "" : ", ");}os << "}";return os;}
// map
template <typename T, typename U>ostream& operator<<(ostream & os, map<T, U> & map_var) {os << "{";	repi(itr, map_var) {os << *itr;itr++;if (itr != map_var.end()) os << ", ";itr--;}os << "}";return os;}
// set
template <typename T>ostream& operator<<(ostream & os, set<T> & set_var) {os << "{";repi(itr, set_var) {os << *itr;itr++;if (itr != set_var.end()) os << ", ";itr--;}os << "}";return os;}

ll dp[1 << 14];

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N, M;
	cin >> N >> M;
	vector<int> a(M), b(M), c(M, 0);


	for (int i = 0; i < M; i++)
	{
		cin >> a[i] >> b[i];

		int cnt = 0;
		for (int j = 0; j < b[i]; j++)
		{
			int t;
			cin >> t;
			cnt += (1 << (t - 1));
		}
		c[i] = cnt;
	}
	for (int i = 0; i < 1 << 14 - 1; i++)
	{
		dp[i] = LINF;
	}

	dp[0] = 0;

	for (int i = 0; i < (1 << N); i++)
	{
		for (int j = 0; j < M; j++)
		{
			dp[(i | c[j])] = min(dp[(i | c[j])], dp[i] + a[j]);
		}
	}

	if (dp[(1 << N) - 1] == LINF) {
		cout << "-1" << endl;
	}
	else
	{
		cout << dp[(1 << N) - 1] << endl;
	}
}

Measured memory_bytes: 384
#include <iostream>

using namespace std;

int main(void) {
    auto getN = [](){int t;cin >> t;return t;};
    int n = getN(),c[2] = {0,0};
    for(int i =0;i < n;i++) c[getN()%2]++;
    if(c[1]%2) cout << "NO";
    else cout << "YES";
}


Measured memory_bytes: 764
import sys
sys.setrecursionlimit(10**6)

n= int(input())
s= input()

sum=0

for i in range(10):
    ix = s.find(str(i))
    if ix == -1:
        continue
    six = s[ix+1:]
    for j in range(10):
        iy = six.find(str(j))
        if iy == -1:
            continue
        siy = six[iy+1:]
        for k in range(10):
            iz = siy.find(str(k))
            if iz >= 0:
                sum+=1
print(sum)


Measured memory_bytes: 3188
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n,x = iim()
L = iil()
ans = 1
dis = 0
for item in L:
    dis += item
    if dis <= x:
        ans += 1
    else:
        break
print(ans)

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

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<array<int, 3>> dp(n);
  for (int i=0; i<n; ++i) {
    cin >> dp[i][0] >> dp[i][1] >> dp[i][2];
    if (i>0) {
      for (int j=0; j<3; ++j) {
        int best = 0;
        for (int k=0; k<3; ++k) {
          if (j != k)
            best = max(best, dp[i-1][k]);
        }
        dp[i][j] += best;
      }
    }
  }
  cout << *max_element(dp[n-1].begin(), dp[n-1].end()) << "\n";
  return 0;
}


Measured memory_bytes: 1408
/*
Author: Sagar Gupta
E mail: sagar.june97p@gmail.com
*/

#pragma comment(linker, "/STACK:268435456")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define endl ("\n")
#define deb(n) cerr << #n << " = " << (n) << '\n'
#define PI (3.14159265358979323846264338)
#define ordered_set tree<int, null_type, std::less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define MOD (1000000007ll)
using ll = long long;

vector<int> parent, len;

int find(int n)
{
    if (parent[n] == n)
        return n;
    return parent[n] = find(parent[n]);
}
void add(int u, int v)
{
    int a = find(u);
    int b = find(v);
    if (a == b)
        return;
    if (len[b] > len[a])
        swap(a, b);
    len[a] += len[b];
    parent[b] = a;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed;
    cout.precision(10);
    // Those who forgive themselves, and are able to accept their true nature...THEY ARE THE STRONG ONES

    const int mx = 1000001;
    vector<int> prime(mx);
    for (int i = 0; i < mx; i++)
    {
        prime[i] = i;
    }
    for (int i = 2; i < mx; i++)
    {
        for (int j = i + i; j < mx; j += i)
        {
            prime[j] = min(prime[j], i);
        }
    }
    // for (int i = 0;i < 10;i++) {
    //     cout << prime[i] << " ";
    // }
    // return 0;
    bool pairwise = true, setwise = true;
    int n;
    cin >> n;
    int arr[n];
    for (int i = 0; i < n; i++)
    {
        cin >> arr[i];
    }
    map<int, int> mp;
    for (int i = n - 1; i >= 0; i--)
    {

        int curr = arr[i];
        while (curr != 1)
        {
            if (mp[prime[curr]] > 0)
            {
                pairwise = false;
            }
            curr /= prime[curr];
        }
        curr = arr[i];
        while (curr > 1)
        {
            mp[prime[curr]] = 1;
            curr /= prime[curr];
        }
    }
    int gcd = arr[0];
    for (int i = 0; i < n; i++)
    {
        gcd = __gcd(gcd, arr[i]);
    }
    if (gcd != 1)
    {
        setwise = false;
    }
    if (pairwise)
    {
        cout << "pairwise coprime";
    }
    else if (setwise)
    {
        cout << "setwise coprime";
    }
    else
    {
        cout << "not coprime";
    }
    return 0;
}

Measured memory_bytes: 14772
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val length = n.toString().length

    if (n < 357) {
        println(0)
        return
    }

    val list = listOf("3", "5", "7")
    val result = mutableListOf<String>()
    fun dfs(s: String) {
        if (3 <= s.length) {
            result.add(s)

            if (s.length == length) {
                return
            }
        }
        list.forEach {
            dfs(it + s)
        }
    }

    dfs("")
    result.filter { it.contains("5") && it.contains("3") && it.contains("7") }
        .map(String::toInt)
        .filter { n >= it }
        .size.let(::println)

}



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

using namespace std;

int main(int argc, char const *argv[]) {
	int N;
	std::cin >> N;
	std::vector<tuple<int,int,int>> v;
	v.push_back(make_tuple(0,0,0));
	for (size_t i = 0; i < N; i++) {
		int a,b,c;
		std::cin >> a >> b >> c;
		v.push_back(make_tuple(a,b,c));
	}

	for (size_t i = 0; i < v.size() - 1; i++) {
		int abletime = get<0>(v[i+1]) - get<0>(v[i]);
		int dis = abs(get<1>(v[i+1]) - get<1>(v[i])) + abs(get<2>(v[i+1]) - get<2>(v[i]));
		if (abletime < dis) {
			std::cout << "No" << '\n';
			return 0;
		}
		if ((abletime - dis) % 2 != 0) {
			std::cout << "No" << '\n';
			return 0;
		}
	}
	std::cout << "Yes" << '\n';
	return 0;
}


Measured memory_bytes: 1912
import java.util.*;
 
public class Main{
    final static long mod = 1000000007;
    //
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        long ans = 0;
        for(int i = k; i <= n + 1; i++){
            ans = (ans + ((long)(n + 1 - i) * (long)(i)) + 1) % mod;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 35740
//-------------include
#include<cstdio>
#include<string>
#include<iostream>
#include<cstring>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<climits>
#include<vector>
#include<list>
#include<deque>
#include<functional>
#include<sstream>

//-------------define
#define ALL(a)  (a).begin(),(a).end()
#define PB push_back
#define MP make_pair
#define SORT(c) sort((c).begin(),(c).end())
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define CLR(a) memset((a), 0 ,sizeof(a))
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define fi first
#define se second
#define INF 1 << 28

//-------------namespace
using namespace std;

//-------------inline
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 long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;

//-------------var
int dx[]={0,-1,0,1,1,1,-1,-1};
int dy[]={1,0,-1,0,1,-1,1,-1};

int l[201][201];
int s[201][201];
int dp[1001][201];

int main()
{
  int n,m;
  while(cin >> n >> m,n){
    for(int i=0;i<200;i++){
      s[i][i] = l[i][i] = 0;
      for(int j=0;j<200;j++){
        if(i!=j)s[i][j] = l[i][j] = INF;
      }
    }

    for(int i=0;i<1000;i++){
      for(int j=0;j<200;j++){
        dp[i][j] = INF;
      }
    }

    for(int i=0;i<m;i++){
      int a,b,t;
      char p;
      cin >> a >> b >> t >> p;
      a--;b--;
      if(p=='S'){
        s[a][b] = s[b][a] = t;
      }else{
        l[a][b] = l[b][a] = t;
      }
    }

    for(int k=0;k<n;k++){
      for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
          s[i][j] = min(s[i][j], s[i][k] + s[k][j]);
          l[i][j] = min(l[i][j], l[i][k] + l[k][j]);
        }
      }
    }

    int r;
    cin >> r;

    vi v(r);
    for(int i=0;i<r;i++){
      cin >> v[i];
      v[i]--;
    }

    dp[0][v[0]] = 0;
    for(int i=1;i<r;i++){
      for(int j=0;j<n;j++){
        for(int k=0;k<n;k++){
          dp[i][k] = min(dp[i][k], dp[i-1][j] + l[v[i-1]][j] + s[j][k] + l[k][v[i]]);
        }
        dp[i][j] = min(dp[i][j], dp[i-1][j] + l[v[i-1]][v[i]]);
      }
    }

    int ans = INF;
    for(int i=0;i<n;i++){
      ans = min(ans, dp[r-1][i]);
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 2296
N = int(input())
A = list(map(int,input().split()))

def nc2(x): return x*(x-1)//2
dic = {i+1:0 for i in range(N)}
for a in A: dic[a] += 1

tmp = 0
for i in range(N):
    tmp += nc2(dic[i+1])

ans = [0] * (N+1)
for i in range(1,N+1):
    print(tmp+nc2(dic[A[i-1]]-1)-nc2(dic[A[i-1]]))

Measured memory_bytes: 38524
// ABC169C - Multiplication 3

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

typedef unsigned long long int ull;
typedef long long int ll;

int main() {
	ull A;
	cin >> A;
	string B;
	cin >> B;

	ull t = (B[0] - '0')* 100 + (B[2] - '0')* 10 + B[3] - '0';

	cout << A * t / 100 << endl;

	return 0;
}


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

using ll = long long;
using ull = unsigned long long;

const double PI = acos(-1);
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;

#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
#define REP(i,n) for (int i = 0; i<n; i++)
#define ALL(a) begin(a), end(a)

int main (void) {
    int A,B;
    cin >> A >> B;
    B += A*3;
    cout << B/2 << endl;
    return 0;
}

Measured memory_bytes: 256
x, n = map(int, input().split())
if n == 0:
  print(x)
  exit()

P = list(map(int, input().split()))
t = 100
for i in range(0,102):
  if not i in P:
    if t > abs(i - x):
      t = abs(i - x)
      ans = i

print(ans)
  

Measured memory_bytes: 9068
//#pragma comment(linker, "/STACK:102400000,102400000")
#include <fstream>
#include <iostream>
#include <functional>
#include <algorithm>
#include <cstring>
#include <vector>
#include <string>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <ctime>
#include <list>
#include <set>
#include <map>
using namespace std;

typedef long long ll;
#define eps 1e-10
#define LL_INF 0x33ffffffffffffff
#define INF 0x3f3f3f3f
#define mem(a, b) memset(a, b, sizeof(a))
#define pper(i,n,m) for(int i = n;i >= m; i--)
#define repp(i, n, m) for (int i = n; i <= m; i++)
#define rep(i, n, m) for (int i = n; i < m; i++)
#define sa(n) scanf("%d", &(n))
#define mp make_pair
#define ff first
#define ss second
#define pb push_back

const int maxn = 1e6 + 5;
const double PI = acos(-1.0);
const ll mod = 1e9 + 7;
ll po(ll a, ll b,ll mod) { ll res = 1; a %= mod; for (; b; b >>= 1) { if (b & 1)res = res*a%mod; a = a*a%mod; }return res; }
ll gcd(ll a,ll b){ if(a==0){return b;}else{ return gcd(b%a,a);}}

ll n,m,k;
ll fac[maxn],inv[maxn];

void init()
{
	fac[0] = 1;
	inv[0] = 1;
	int up = 1e6;
	for(int i=1;i<=up;i++)
	{
		fac[i] = fac[i-1]*i%mod;
		inv[i] = po(fac[i],mod-2,mod);
	}
}

ll C(ll n,ll m)
{
	return fac[n]*inv[m]%mod*inv[n-m]%mod;
}

void solve()
{
	scanf("%lld%lld%lld",&n,&m,&k);

	ll res = 0;
	ll fs = 1;
	for(ll i=0;i<=m+k;i++)
	{
		res = res+(C(i+n-1,n-1)*fs%mod*po(3,m+k-i,mod)%mod);
		res %= mod;
		//cout<<res<<" "<<(C(i+n-1,n-1)*fs%mod*po(3,m+k-i,mod)%mod)<<endl;
		//cout<<C(i+n-1,n-1)<<" "<<fs<<" "<<po(3,m+k-i,mod)%mod<<endl<<endl;
		fs = fs*2%mod;

		if(i>=m)
		{
			fs = (fs + mod - C(i,m))%mod;
		}
		if(i>=k)
		{
			fs = (fs + mod - C(i,k))%mod;
		}
	}
	printf("%lld\n",res);
}

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

Measured memory_bytes: 15872
#include<stdio.h>

void show(int *S, int &n){
	for(int i=1; i<n+1; ++i){
		if(i>1)
			printf(" ");
		printf("%d", S[i]);
	}	
	printf("\n");
}

int main(){
	int n;
	scanf("%d", &n);

	int A[n];
	int B[n+1];
	int k = 0;
	for(int i=0; i<n; ++i){
		scanf("%d", &A[i]);
		if(A[i] > k)
			k = A[i];
	}

	int C[k+1];
	for(int i=0; i<k+1; ++i)
		C[i] = 0;

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

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

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

	show(B, n);
	return 0;
}


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

using namespace std;

typedef long long ll;
typedef long double ld;

int n;
ld dp[3005][3005];
ld p[3005];
bool mark[3005][3005];

ld solve(int up, int down)
{
    if(up + down == n)
      return up > down ? 1 : 0;
    if(mark[up][down])
      return dp[up][down];
    mark[up][down] = 1;
    ld &ans = dp[up][down];
    int idx = up + down;
    return ans = solve(up + 1, down) * p[idx] + solve(up, down + 1) * (1 - p[idx]);
}

int main()
{
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  for(int i = 0; i < n; i++)
    cin >> p[i];
  cout << fixed << setprecision(12) << solve(0, 0);
  return 0;
}


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

#define int long long int
const int mxN = 3005, INF = 10;
int n;
long double p[mxN];
long double dp[mxN][mxN];

long double more_heads(int i, int heads) {
    if(i == n) {
        if(heads > n-heads)
            return 1;
        return 0;
    }
    
    if(dp[i][heads] != INF)
        return dp[i][heads];
    
    dp[i][heads] = p[i] * more_heads(i+1, heads+1) + 
                    (1-p[i]) * more_heads(i+1, heads);
    
    return dp[i][heads];
}

void solve() {
    cin >> n;
    for(int i=0; i<n; i++)
        cin >> p[i];
    
    for(int i=0; i<mxN; i++) {
        for(int j=0; j<mxN; j++) {
            dp[i][j] = INF;
        }
    }

    cout << more_heads(0, 0) << endl;
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout << fixed << setprecision(15);
    solve();
}

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

int main() {
	int N;
	cin >> N;
	bool a = false;
	for (int i = 0; i <= N; i += 4) {
		for (int j = 0; j <= N; j += 7) {
			if (N - i == j) a = true;
		}
	}
	if (a) cout << "Yes";
	else cout << "No";
}

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


void Main()
{
  ll n,d; cin >> n >> d;
  vector<ll> x(n), y(n);
  ll cnt = 0;
  rep(i,n) {
    ll x, y;
    cin >> x >> y;
    if (x*x + y*y <= d*d) cnt++;
  }
  cout << cnt << endl;
}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  Main();
  return 0;
}


Measured memory_bytes: 6328
#include<bits/stdc++.h>
using namespace std;
main()
{
string final = "CODEFESTIVAL2016";
string s;
cin>>s;
int ln=s.length(),cnt=0;
for(int i=0;i<ln;i++)
{
if(s[i]!=final[i]) cnt++;
}
cout<<cnt<<"\n";
}

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

public class Main {
    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int h = in.nextInt();
        int w = in.nextInt();
        char[][] map = new char[h][w];
        for (int i = 0; i < h; i++) {
            String line = in.next();
            for (int j = 0; j < w; j++) {
                map[i][j] = line.charAt(j);
            }
        }

        int[][] dp = new int[h][w];
        dp[0][0] = 1;
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                if (i < h - 1 && map[i + 1][j] == '.') {
                    dp[i + 1][j] += dp[i][j];
                    dp[i + 1][j] %= 1_000_000_007;
                }
                if (j < w - 1 && map[i][j + 1] == '.') {
                    dp[i][j + 1] += dp[i][j];
                    dp[i][j + 1] %= 1_000_000_007;
                }
            }
        }
        System.out.println(dp[h - 1][w - 1]);
    }
}


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

typedef long long ll;

const ll inf = 10000000;

int main() {
    string s;
    cin >> s;
    for (int i = 1; i < s.size(); i++) {
        if (s[i-1] == s[i])  {
            cout << i << " " << i+1 << endl;
            return 0;
        }
    }
    for (int i = 0; i+2 < s.size(); i++) {
        if (s[i] == s[i+2]) {
            cout << i+1 << " " << i+3 << endl;
            return 0;
        }
    }
    cout << -1 << " " << -1 << endl;
}


Measured memory_bytes: 512
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
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);}
/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    ll N; cin >> N;
    vector<ll> A(N); for(auto& in:A) cin >> in;
    
    vector<map<ll,ll>> dp(N+2);
    
    dp[1][0] = 0;
    dp[2][1] = A[0];
    for(int i = 1; i < N;i++){
        for(int j = max(0,(i-1)/2); j <= (i+1)/2; j++){
            if(dp[i].count(j)){
                if(dp[i+1].count(j) == 0) dp[i+1][j] = -LINF;
                dp[i+1][j] = max(dp[i+1][j],dp[i][j]);
                
                if(dp[i+2].count(j+1) == 0) dp[i+2][j+1] = -LINF;
                dp[i+2][j+1] = max(dp[i+2][j+1],dp[i][j]+A[i]);
            }
        }
    }
    res = max(dp[N][N/2],dp[N+1][N/2]);
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}


Measured memory_bytes: 39104
#include<bits/stdc++.h>
#define all(x) x.begin() , x.end()
#define ll long long 
#define pb push_back
#define mp make_pair

using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a , b , c ; cin>>a>>b>>c;
    int ans = min({a + b , b + c , c + a });
    cout<<ans<<endl;

}

Measured memory_bytes: 256