akhauriyash/Code-Regression huggingface dataset:
#[allow(unused_imports)]
use std::cmp::{Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get { 
    ([$t: ty]) => { 
        { 
            let mut line = String::new(); 
            stdin().read_line(&mut line).unwrap(); 
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        { 
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn solve() {
    let mut n = get!(usize);
    let gsb = get!([usize]; 2);
    let mut ab = Vec::new();
    for j in 0..3 {
        ab.push((gsb[0][j], gsb[1][j]));
    }

    let mut dp = vec![0; n+1];
    for i in 0..3 {
        for j in 0..n+1 {
            if ab[i].0 > j {
                dp[j] = max!(dp[j],j);
                continue;
            }
            dp[j] = max!(dp[j],j,dp[j-ab[i].0]+ab[i].1);
        }
    }
    n = dp[n];
    let mut dp = vec![0; n+1];
    for i in 0..3 {
        for j in 0..n+1 {
            if ab[i].1 > j {
                dp[j] = max!(dp[j],j);
                continue;
            }
            dp[j] = max!(dp[j],j,dp[j-ab[i].1]+ab[i].0);
        }
    }
    n = dp[n];
    println!("{}", n);
}


Measured memory_bytes: 205180
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

int main() {
    while(true){
        int x, y;
        cin >> x >> y;
        if(x == 0 && y == 0)break;
        if(x > y)swap(x,y);
        cout << x << ' ' << y << endl;
    }
    return 0;
}
 
 



Measured memory_bytes: 3056
a, b = [int(i) for i in input().split()]
small = min(a, b)
big = max(a, b)

import sys

if small == 1:
    print(1)
    sys.exit(0)

import math
import collections

# FYI: https://ja.wikipedia.org/wiki/%E8%A9%A6%E3%81%97%E5%89%B2%E3%82%8A%E6%B3%95
def prime_factorization(num, divisors=None):
    if num <= 1:
        assert False
    factors = []

    # divisorsを使い回せるようにする。
    #   - 二度生成した場合にかかる時間が許容できない場合
    #   - エラトステネスの篩などで素数テーブルを既に持っている場合
    if not divisors:
        divisors = [2] + [i for i in range(3, int(math.sqrt(num)) + 1) if i % 2 != 0]

    for d in divisors:
        # divisorsを引数で与えた場合のみ起こりうる
        if num < d:
            break
        while num % d == 0:
            factors.append(d)
            num //= d

    if num != 1:
        factors.append(num)
    return factors

divisors = [2] + [i for i in range(3, int(math.sqrt(big)) + 1) if i % 2 != 0]
small_factors = set(prime_factorization(small, divisors))
big_factors = set(prime_factorization(big, divisors))

print(len(small_factors.intersection(big_factors)) + 1)


Measured memory_bytes: 79600
import math

K = int(input())

dp = [[0] * 201 for _ in range(201)]

def dp_gcds(x,y):
    if dp[x][y] != 0:
        n = dp[x][y]
    else:
        n = math.gcd(x,y)
        dp[x][y] = n
        dp[y][x] = n
    return n
    
def gcds(x,y,z):
    n1 = dp_gcds(x,y)
    n2 = dp_gcds(n1,z)
    return n2

total = 0
for i in range(1,K+1):
    for j in range(1, K+1):
        for t in range(1, K+1):
            total += gcds(i,j,t)
print(total)

Measured memory_bytes: 68776
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let a: i64 = input();
    let b: i64 = input();
    println!("{}", (a + b) / 2 + (a + b) % 2);
}


Measured memory_bytes: 4352
#include <iostream>
#include <string>

using namespace std;
int main (){
    string s;
    cin >> s;
    int n=s.size();
    int f=(n-1)/2;
    int l=(n+3)/2;
    bool fjud=true;
    bool ljud=true;
    bool wjud=true;
    for (int i = 0; i < f/2-1; i++){
        if(s[i]!=s[f-i-1]) fjud=false;
    }

    for (int i = 0; i < l/2-1; i++){
        if(s[l-1+i]!=s[n-1-i]) ljud=false;
    }

    for (int i = 0; i < n; i++)
    {
        if(s[i]!=s[n-1-i]) wjud=false;
    }
    if(fjud*ljud*wjud) cout << "Yes\n";
    else cout << "No\n";

}

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


bool x[(int)1e6+5];

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

    int s;
    cin >> s;
    memset(x, false, sizeof(x));
    int i=1;
    x[s] = true;

    while(true){
        i++;
        if(s%2 == 0) s = s/2;
        else s = 3*s + 1;
        if(x[s]){
            cout << i << endl;
            return 0;
        }else{
            x[s] = true;
        }
    }
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ll n;
    cin>>n;
    if(n%2!=0)
        cout<<"0"<<endl;
    else
    {
        n=n/2;
        ll c=0;
        for(ll i=5;n/i>=1;i=i*5)
        {
            c+=n/i;
        }
        cout<<c<<endl;
    }
}

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

typedef complex<double> comp;

//  外積
double cross( comp a, comp b ) { return a.real()*b.imag()-a.imag()*b.real(); }

//  a1とa2を結ぶ線分と、b1とb2を結ぶ線分が交差しているか
bool inter( comp a1, comp a2, comp b1, comp b2 )
{
    return cross(a2-a1,b1-a1) * cross(a2-a1,b2-a1) <= 0 &&
           cross(b2-b1,a1-b1) * cross(b2-b1,a2-b1) <= 0;
}

int main()
{
    while ( true )
    {
        int n;  cin>>n;
        if ( n==0 )
            break;
        vector<comp> p(n);
        vector<double> r(n);
        for ( int i=0; i<n; i++ )
        {
            int x, y;  cin>>x>>y>>r[i];
            p[i] = comp(x,y);
        }

        //  両端の円の中心と交点
        vector<vector<comp> > C(n+1,vector<comp>(2));
        C[0][0] = C[0][1] = p[0];
        for ( int i=1; i<n; i++ )
        {
            comp p1 = p[i-1];
            comp p2 = p[i];
            double r1 = r[i-1];
            double r2 = r[i];
            double d = abs(p2-p1);
            double th = acos((d*d+r1*r1-r2*r2)/(2*d*r1));
            C[i][0] = p1 + polar( r1, arg(p2-p1)+th );
            C[i][1] = p1 + polar( r1, arg(p2-p1)-th );
        }
        C[n][0] = C[n][1] = p[n-1];

        //  交点C[i][j]までの最短経路
        vector<vector<double> > D(n+1,vector<double>(2,1e10));
        D[0][0] = D[0][1] = 0;

        for ( int ti=1; ti<n+1; ti++ )
        for ( int tj=0; tj<2; tj++ )
        {
            for ( int fi=0; fi<ti; fi++ )
            for ( int fj=0; fj<2; fj++ )
            {
                bool f = true;
                for ( int i=fi+1; i<ti && f; i++ )
                    if ( !inter(C[fi][fj],C[ti][tj],C[i][0],C[i][1]) )
                        f = false;
                if ( f )
                    D[ti][tj] = min( D[ti][tj], D[fi][fj]+abs(C[ti][tj]-C[fi][fj]) );
            }
        }

        printf( "%.10f\n", D[n][0] );
    }

    return 0;
}



Measured memory_bytes: 3800
#define _GLIBCXX_DEBUG //test only

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

// macro
#define rep(i,n) for(i=0;i<n;i++)
#define ll long long
#define all(v) v.begin(), v.end()

// code starts
typedef pair<ll,ll> P;

int main()
{
  int n;
  ll c;
  cin >> n >> c;
  vector<ll> x(n);
  vector<ll> y(n);
  int i;
  rep(i,n) cin >> x[i] >> y[i];
  vector<ll> vals(n);
  vals[0] = y[0]-x[0];
  ll now = x[0];
  rep(i,n-1)
  {
    vals[i+1] = vals[i]+y[i+1]-(x[i+1]-now);
    now = x[i+1];
  }
  ll ans = 0;
  set<P> sl;
  ll vsum = 0;
  for(i=n-1;i>=0;i--)
  {
    ans = max(ans,vals[i]);
    if(sl.size() >= 1)
    {
      auto it = sl.end();
      it--;
      P nowp = *it;
      ll kans = vals[i]-x[i]+nowp.first; 
      ans = max(ans,kans);
    }
    vsum += y[i];
    ll val = vsum-(c-x[i]);
    sl.insert(make_pair(val,x[i]));
  }
  

  vector<ll> lvals(n);
  lvals[n-1] = y[n-1]-(c-x[n-1]);
  ll sval = y[n-1];
  for(i=n-2;i>=0;i--)
  {
    lvals[i] = sval+y[i]-(c-x[i]);
    sval += y[i];
  }
  set<P> sr;
  vsum = 0;
  rep(i,n)
  {
    ans = max(ans,lvals[i]);
    if(sr.size() >= 1)
    {
      auto it = sr.end();
      it--;
      P nowp = *it;
      ll kans = lvals[i]-(c-x[i])+nowp.first; 
      ans = max(ans,kans);
    }
    vsum += y[i];
    ll val = vsum-x[i];
    sr.insert(make_pair(val,x[i]));
  }
  cout << ans << endl;
  
}


Measured memory_bytes: 18844
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf  1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}


long long  mod = 1000000007;

int n;
ll dp[54][54][23][29];
char v[54][23];
ll saiki(int a,int b,int c,int d){
	if(d>=27||c>=21)return 0;
	if(dp[a][b][c][d]!=-1)return dp[a][b][c][d];
	if(a==b&&c==20)return 1;
	ll ans = saiki(a,b,c,d+1);
	for(int i=a;i<=b;i++){
		bool flag = 1;
		if(d==0&&v[i][c]==0){
			if(i==b){
				ans = (ans + saiki(a,i,c+1,0))%mod;
			}else{
				ans = (ans + (saiki(a,i,c+1,0)*saiki(i+1,b,c,d+1))%mod)%mod;
			}
			flag = 0;
		}
		if(d!=0&&v[i][c]=='?'){
			if(i==b){
				ans = (ans + saiki(a,i,c+1,0))%mod;
			}else{
				ans = (ans + (saiki(a,i,c+1,0)*saiki(i+1,b,c,d+1))%mod)%mod;
			}
			flag = 0;
		}
		if(d!=0&&v[i][c]==d-1+'a'){
			if(i==b){
				ans = (ans + saiki(a,i,c+1,0))%mod;
			}else{
				ans = (ans + (saiki(a,i,c+1,0)*saiki(i+1,b,c,d+1))%mod)%mod;
			}
			flag = 0;
		}
		if(flag)break;
	}
	dp[a][b][c][d] = ans;
	return dp[a][b][c][d];
}

int main(){
	cin >> n;
	rep(i,n){
		string s;
		cin >> s;
		rep(j,s.size()){
			v[i][j] = s[j];
		}
		for(int j=s.size();j<21;j++){
			v[i][j] = 0;
		}
	}
	Fill(dp,-1);
	cout << saiki(0,n-1,0,0) << endl;
	return 0;
}

Measured memory_bytes: 18420
import math
N,P = map(int,input().split())
Max = 1
if N==1:print(P)
else:
    for m in range(1,int(math.sqrt(P))+1):
        if P%m == 0:
            if m == int(m**(1/N)+0.1)**N and Max < int(m**(1/N)+0.1):
                    Max = int(m**(1/N)+0.1)
            if P//m == int((P//m)**(1/N)+(0.1)**1)**N and Max < int((P//m)**(1/N)+(0.1)**1) :
                Max = int((P//m)**(1/N)+(0.1)**1)
    print(Max)

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

using namespace std;

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(),a.end()
#define SET(a,b) memset(a,b,sizeof(a))

#define SI(n) scanf("%d",&n)
#define PI(n) printf("%d\n",n)
#define SL(n) scanf("%lld",&n)
#define PL(n) printf("%lld\n",n)
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)

#define TRACE

#ifdef TRACE
#define TR(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define TR(...)
#endif

//FILE *fin = freopen("in","r",stdin);
//FILE *fout = freopen("out","w",stdout);
typedef long long int 	LL;
typedef long double 	LD;
typedef pair<int,int>   II;
typedef vector<int>     VI;
const int MOD = 1e9 + 7;
const int N = 100011;


int main() {
    int n; SI(n);
    int x = (-1 + (int)sqrt(1*1LL + 1LL*8*n))/ 2;
    LL p = 1 + 8LL*n;
    LL q = (LL)sqrt(p);
    if(q*q != p) x++;
    PI(x);
    return 0;
}


Measured memory_bytes: 256
import numpy as np
row = input().split()
W = int(row[0])
H = int(row[1])
N = int(row[2])
row2 = [input().split() for i in range(N)]
f = np.vectorize(int)
x = f(row2)
white = [0,0,W,H]
for i in x:
    if i[2] == 1 and white[0] < i[0]:
        white[0] = i[0]
    if i[2] == 2 and white[2] > i[0]:
        white[2] = i[0]
    if i[2] == 3 and white[1] < i[1]:
        white[1] = i[1]
    if i[2] == 4 and white[3] > i[1]:
        white[3] = i[1]
x_dis = white[2]- white[0]
y_dis = white[3]- white[1]
if x_dis >= 0 and y_dis >= 0:
    print(x_dis*y_dis)
else:
    print(0)
     

Measured memory_bytes: 12436
import java.io.IOException;
import java.io.InputStream;
import java.util.*;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int n = sc.nextInt();
		int m = sc.nextInt();
		int[] s = new int[m];
		int[] c = new int[m];
		for (int i = 0; i < m; i++) {
			s[i] = sc.nextInt() - 1;
			c[i] = sc.nextInt();
		}
		int[] ans = new int[n];
		for (int i = 0; i < m; i++) {
			if (n != 1 && s[i] == 0 && c[i] == 0) {
				System.out.println(-1);
				return;
			}
			if (ans[s[i]] != 0 && ans[s[i]] != c[i]) {
				System.out.println(-1);
				return;
			} else {
				ans[s[i]] = c[i];
			}
		}
		if (n != 1 && ans[0] == 0) {
			ans[0] = 1;
		}
		long an = 0;
		for (int i = 0; i < n; i++) {
			an += ans[i] * Math.pow(10, n - i - 1);
		}
		System.out.println(an);
	}
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;
	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}
	private int readByte() {
		if (hasNextByte()) {
			return buffer[ptr++];
		} else {
			return -1;
		}
	}
	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}
	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
			ptr++;
		}
		return hasNextByte();
	}
	public String next() {
		if (!hasNext()) {
			throw new NoSuchElementException();
		}
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	public long nextLong() {
		if (!hasNext()) {
			throw new NoSuchElementException();
		}
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || Integer.MAX_VALUE < nl) {
			throw new NumberFormatException();
		}
		return (int) nl;
	}
	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

Measured memory_bytes: 21332
//  ROAD TO GREEN
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <stack>
#include <iomanip>
#include <queue>
#include <set>
#include <bitset>

#define ll long long
#define uint unsigned int
#define ull unsigned ll
#define mp make_pair
#define pb push_back
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define speedhack() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);


using namespace std;
const ll MAXN = 2e9+2;
const ll SIZE = 2e5+2;
const ll mod = 1e9+7;
int p[SIZE];

int main(){ 
	speedhack()
	double n,k;
	cin >> n >> k;
	vector<double> v;
	for(int i = 1; i <= n; i++){
		int p = i;
		int it = 0;
		while(p < k){
			p *= 2;
			it++;
		}
		double cc = 0.5; 
		v.push_back((1/n)*pow(cc,it));
	}
	double sum = 0;
	for(int i = 0; i < v.size(); i++){
		sum += v[i];
	}
	cout << fixed << setprecision(12) << sum << endl;
	return 0;
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
#define FOR(i, l, r) for (int i = l; i <= r; ++i)
#define ROF(i, l, r) for (int i = l; i >= r; --i)
#define ll long long
using namespace std;

int n, a[200010];

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

    cin >>n;
    FOR(i, 1, n - 1)
    {
        int j;
        cin >>j;
        a[j]++;
    }
    FOR(i, 1, n) cout <<a[i] <<endl;
}



Measured memory_bytes: 4396
#include<bits/stdc++.h>
using namespace std;
struct Point{
    long long x,y;
    Point():x(0),y(0){}
    Point(long long _x,long long _y):x(_x),y(_y){}
    bool operator<(Point other)const{
        if(x==other.x)return y<other.y;
        return x<other.x;
    }
};
struct Vector{
    long long x,y;
    Vector(long long _x,long long _y):x(_x),y(_y){}
};
Vector to_vector(Point a,Point b){
    return Vector(b.x-a.x,b.y-a.y);
}
long long cross(Vector a,Vector b){
    return (a.x*b.y)-(a.y*b.x);
}
bool ccw(Point a,Point b,Point c){
    return cross(to_vector(a,b),to_vector(a,c))>0;
}
bool collinear(Point a,Point b,Point c){
    return cross(to_vector(a,b),to_vector(a,c))==0;
}
vector<Point> convex_hull(vector<Point> point){
    vector<Point> hull;
    sort(point.begin(),point.end());
    for(int i=0;i<2;i++){
        int start=hull.size();
        for(auto p:point){
            while(hull.size()>=start+2
                &&!ccw(hull[hull.size()-2],hull[hull.size()-1],p)
                &&!collinear(hull[hull.size()-2],hull[hull.size()-1],p))hull.pop_back();
            hull.push_back(p);
        }
        hull.pop_back();
        reverse(point.begin(),point.end());
    }
    return hull;
}
int n;
int main(){
    scanf("%d",&n);
    vector<Point> point;
    for(int i=0;i<n;i++){
        long long x,y;
        scanf("%lld %lld",&x,&y);
        point.push_back(Point(x,y));
    }
    vector<Point> hull=convex_hull(point);
    int start=0;
    for(int i=1;i<hull.size();i++){
        if(hull[i].y<hull[start].y||(hull[i].y==hull[start].y&&hull[i].x<hull[start].x))start=i;
    }
    printf("%d\n",hull.size());
    for(int i=start;i<hull.size();i++){
        printf("%lld %lld\n",hull[i].x,hull[i].y);
    }
    for(int i=0;i<start;i++){
        printf("%lld %lld\n",hull[i].x,hull[i].y);
    }
    return 0;
}

Measured memory_bytes: 8272
import sys

N = int(sys.stdin.readline().strip())

l = list(map(int, sys.stdin.readline().strip().split(" ")))

odd_num = len(list(filter(lambda x: x % 2 == 1, l)))
even_num = len(list(filter(lambda x: x % 2 == 0, l)))

if odd_num % 2 == 1:
    print("NO")
else:
    print("YES")
    

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

int main()
{
    int n;
    string s;
    cin >> n >> s;
    
    int ans = 0;
    while(s.find("ABC") != string::npos){
        auto itr = s.find("ABC");
        s.erase(itr, 3);
        ans++;
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import itertools
import math
 
N = int(input())
X = [list(map(int, input().split())) for _ in range(N)]

l = [i for i in range(N)]
ssum = 0
for v in itertools.permutations(l):
  distance = 0
  pre = X[v[0]]
  for n in v:
    distance += math.sqrt((pre[0]-X[n][0])**2+(pre[1]-X[n][1])**2)
    pre = X[n]
  ssum += distance

print(ssum/math.factorial(N))

Measured memory_bytes: 73920
#include <bit>
#include <bitset>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <iomanip>

typedef long double ld;
typedef long long ll;

using namespace std;


/* TEMPLATE ENDS HERE */

#define MAXN (1 << 20)
#define EPS (1e-10)

#define N 20

int n;
ll a[MAXN];
int cnt[N][N];

int cntdiv(ll x, int k) {
	int ret = 0;
	while (x && (x % k == 0)) {
		x /= k;
		ret++;
	}
	return min(ret, N - 1);
}

int main() {
	cout << fixed << setprecision(12);	
	cin >> n;
	for (int i = 0; i < n; i++) {
		ld x;
		cin >> x;
		a[i] = (ll)((x + EPS) * 1e9);
	}
	for (int i = 0; i < n; i++) {
		cnt[cntdiv(a[i], 2)][cntdiv(a[i], 5)]++;		
	}
	ll ret = 0;
	for (int i = 0; i < n; i++) {
		int ii = cntdiv(a[i], 2);
		int jj = cntdiv(a[i], 5);
		cnt[ii][jj]--;
		for (int ti = 0; ti < N; ti++) {
			for (int tj = 0; tj < N; tj++) {
				if (ii + ti < 18 || jj + tj < 18) {
					continue;
				}
				ret += cnt[ti][tj];
			}
		}
		cnt[ii][jj]++;
	}
	cout << ret / 2 << endl;
	return 0;
}


ll MOD = ((ll)1e9 + 7);

struct mod {
	ll x;

	mod(ll tx = 0) {
		x = tx;
		x %= MOD;
	}
	
	mod& operator=(const ll & tx) {
		x = tx % MOD;
		return *this;
	}
	
	mod& operator=(const mod & m2) {
		x = m2.x;
		return *this;
	}

	mod operator+(const mod& m2) const {
		return mod((x + m2.x) % MOD);
	}

	mod& operator+=(const mod& m2) {
		x += m2.x;
		x %= MOD;
		return *this;
	}

	mod operator-(const mod & m2) const {
		return mod((x - m2.x + MOD) % MOD);
	}

	mod& operator-=(const mod & m2) {
		x -= m2.x;
		x = (x + MOD) % MOD;
		return *this;
	}

	mod operator*(const mod & m2) const {
		return mod((x * m2.x) % MOD);
	}

	mod& operator*=(const mod & m2) {
		x *= m2.x;
		x %= MOD;
		return *this;
	}

	mod mypow(ll k) const {
		mod ret = 1;
		mod cur = x;
		while (k) {
			if (k & 1) {
				ret *= cur;
			}
			cur *= cur;
			k >>= 1;
		}
		return ret;
	}

	mod inv() const {
		return mypow(MOD - 2);
	}

	mod operator/(const mod & m2) const {
		return (*this) * m2.inv();
	}

	mod& operator/=(const mod & m2) {
		x *= m2.inv().x;
		x %= MOD;
		return *this;
	}

	bool operator<(const mod & m2) const {
		return x < m2.x;
	}
};

ostream &operator<<(ostream & os, const mod & m) {
	return os << m.x;
}



Measured memory_bytes: 5216
#include <iostream>
using namespace std;
int main(void){
  bool debug=false;
  
  unsigned int* mask = new unsigned int[32];
  mask[0] = 1;
  for(int i = 1; i < 32; i++){
    mask[i] = (mask[i - 1] << 1) + 1;
    if(debug){
      cout << "mask[" << i << "]=" << mask[i] << endl;
      
    }
  }
  int N;
  cin >> N;
  unsigned int* A = new unsigned int[N];
  for(int i = 0; i < N; i++){
    cin >> A[i];
    
  }
  int count = 0;
  for(int i = 0; i<N;i++){
    for(int j=0; j<32;j++){
      if(0 != (mask[j] & A[i])){
        count += j;
        break;
        
      }
    }
  }
  cout << count << endl;
  return 0;
  
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int a[4];
  int m;
  cin >>a[1]>>a[2]>>a[3];
  m=abs(a[2]-a[1])+abs(a[3]-a[2]);
  if (m>abs(a[3]-a[1])+abs(a[2]-a[3])) m=abs(a[3]-a[1])+abs(a[2]-a[3]);
  if (m>abs(a[1]-a[2])+abs(a[3]-a[1])) m=abs(a[1]-a[2])+abs(a[3]-a[1]);
  if (m>abs(a[3]-a[2])+abs(a[1]-a[3])) m=abs(a[3]-a[2])+abs(a[1]-a[3]);
  if (m>abs(a[1]-a[3])+abs(a[2]-a[3])) m=abs(a[1]-a[3])+abs(a[2]-a[3]);
  if (m>abs(a[2]-a[3])+abs(a[1]-a[2])) m=abs(a[2]-a[3])+abs(a[1]-a[2]);
  cout <<m<<endl;
  return 0;
}

Measured memory_bytes: 256
using System;
using System.CodeDom;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
//using System.Data;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Runtime.InteropServices;
using System.Runtime.Remoting.Contexts;
using System.Runtime.Remoting.Messaging;
using System.Security.Principal;
using System.Text;
class Simple {
    private int N;
    private int[] T, A;
    void Solve() {        
        //input
        N = io.Int;
        T = new int[N];
        A = new int[N];        
        for(int i = 0; i < N; ++i) {
            T[i] = io.Int;
            A[i] = io.Int;            
        }
        //cal
        var a = 1L;
        var b = 1L;
        for(int i = 0; i < N; ++i) {            
            f(ref a,ref b,T[i],A[i]);       
        }
        var ans = a + b;
        //ret
        Console.WriteLine(ans);
    }
    private Func <long, long, bool> isDivisiable = (v, n) => v % n == 0;
    void f(ref long a, ref long b, int ratioA, int ratioB) {
        var ta = a / ratioA;
        var tb = b / ratioB;
        var ok_A = isDivisiable(a, ratioA);
        var ok_B = isDivisiable(b, ratioB);
        if(ok_A && ok_B) {
            if(ta == tb) {
                //ok
            } else {
                if(ta < tb)  
                    a = tb * ratioA; 
                else  
                    b = ta * ratioB; 
            }
        } else {
            if(!ok_A) 
                a = (ta + 1) * ratioA; 
            if(!ok_B) 
                b = (tb + 1) * ratioB; 
            f(ref a,ref b,ratioA,ratioB);
        }
    }
    long calRatio(long n, long a, long b) { return n % gcd(a, b); }
    long gcd(long a, long b) {
        if(a < b) swap(ref a, ref b);
        return a % b == 0 ? b : gcd(b, a % b);
    }
    void swap(ref long a, ref long b) {
        long t = b;
        b = a;
        a = t;
    }
    SimpleIO io = new SimpleIO();
    public static void Main(string[] args) => new Simple().Stream();
    void Stream() {
        Solve();
        io.writeFlush();
    }
}
class SimpleIO {
    string[] nextBuffer;
    int BufferCnt;
    char[] cs = new char[] {' '};
    StreamWriter sw = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
    public SimpleIO() {
        nextBuffer = new string[0];
        BufferCnt = 0;
        Console.SetOut(sw);
    }
    public string Next() {
        if(BufferCnt < nextBuffer.Length) return nextBuffer[BufferCnt++];
        string st = Console.ReadLine();
        while(st == "") st = Console.ReadLine();
        nextBuffer = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        BufferCnt = 0;
        return nextBuffer[BufferCnt++];
    }
    public string String => Next();
    public char Char => char.Parse(String);
    public int Int => int.Parse(String);
    public long Long => long.Parse(String);
    public double Double => double.Parse(String);
    public void writeFlush() { Console.Out.Flush(); }
}


Measured memory_bytes: 13140
//code by lynmisakura.wish to be accepted!
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;

class UnionFind {
    static const int MAX_N = 200020;
public:
    //UnionFind
    int par[MAX_N];
    int ufrank[MAX_N];
    int ufsize[MAX_N];
    UnionFind(int ufsize_of_tree) {
        for (int i = 0; i < ufsize_of_tree; i++)
        {
            par[i] = i;
            ufrank[i] = 0;
            ufsize[i] = 1;
        }
    }
    int find(int x) {
        if (par[x] == x) return x;
        else return par[x] = find(par[x]);
    }
    void unite(int x, int y) {
        x = find(x);
        y = find(y);
        if (x == y) return;
        if (ufrank[x] < ufrank[y]) {
            par[x] = y;
            int sx = ufsize[x], sy = ufsize[y];
            ufsize[x] = ufsize[y] = sx + sy;
        }
        else {
            par[y] = x;
            if (ufrank[x] == ufrank[y]) ufrank[x]++;
            int sx = ufsize[x], sy = ufsize[y];
            ufsize[x] = ufsize[y] = sx + sy;
        }
    }
    bool same(int x, int y) {
        return find(x) == find(y);
    }
}; 

int main(void){
	int N,M;scanf("%d %d",&N,&M);
	UnionFind UF(N);
	int ans = N;
	for (int i = 0; i < M; ++i)
	{
		int x,y,z;scanf("%d %d %d",&x,&y,&z);
		if(!UF.same(x,y)){
			UF.unite(x,y);ans--;
		}
	}

	printf("%d\n", ans);
}


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

#define MAX_SIZE 101

int main()
{
    int n, m, l;
    int A[MAX_SIZE][MAX_SIZE], B[MAX_SIZE][MAX_SIZE];
    long long C[MAX_SIZE][MAX_SIZE];
    cin >> n >> m >> l;

    for(int i = 1; i <= n; i++)
    {
        for(int j = 1; j <= m; j++)
        {
            cin >> A[i][j];
        }
    }

    for(int i = 1; i <= m; i++)
    {
        for(int j = 1; j <= l; j++)
        {
            cin >> B[i][j];
        }
    }

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

    for(int i = 1; i <= n; i++)
    {
        for(int j = 1; j <= l; j++)
        {
            for(int k = 1; k <= m; k++)
            {
                C[i][j] += A[i][k] * B[k][j];
            }
        }
    }

    for(int i = 1; i <= n; i++)
    {
        for(int j = 1; j <= l; j++)
        {
            if(j - 1) cout << " ";
            cout << C[i][j];
        }
        cout << endl;
    }

}


Measured memory_bytes: 3260
program main
  implicit none
  integer :: n, k, j
  real(8) :: res
  read (*, *) n, k
  res = 0.0d0
  do j = 1, n
    res = res + 0.5 ** d(j, k)
  end do
  write (*, "(f12.10)") res / dble(n)
  contains
  pure integer function d(j, k)
    integer, intent(in) :: j, k
    do d = 0, 100
      if (2 ** d * j >= k) return
    end do
  end function d
end program main



Measured memory_bytes: 384
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n=INT()
    l=LIST()
    ct=0
    for i in range(n-1):
        for k in range(i+1,n):
            ct+=l[i]*l[k]
    print(ct)
if __name__ == '__main__':
    do()

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] a = new int[n];
        int min = Integer.MAX_VALUE;
        int idx = 0;
        for (int i = 0; i < n; i++) {
            int temp = Integer.parseInt(sc.next());
            a[i] = temp;
            if (min > temp) {
                min = temp;
                idx = i;
            }
        }
        int ans = Integer.MAX_VALUE;
        for (int i = 0; i < n; i++) {
            if (i == idx) {
                continue;
            }
            ans = Math.min(ans, getGcd(a[i], min));
        }
        System.out.println(ans);
    }

    private static int getGcd(int x, int y) {
        return y == 0 ? x : getGcd(y, x % y);
    }
}

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

using namespace std;

int main(){
  int N, m;
  cin >> N >> m;
  vector<pair<int, int>> cd(m);

  int c, d;
  for(int i = 0; i < m; i++){
    cin >> c >> d;
    cd[i] = make_pair(c, d);
  }

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

  int ans = N + 1;
  int start = 0;
  int end = 0;
  for(int i = 0; i < m; i++){
    auto temp = cd[i];
    if(temp.first < end){
      end = max(end, temp.second);
    }
    else{
      ans += (end - start) * 2;
      start = temp.first;
      end = temp.second;
    }
  }

  ans += (end - start) * 2;

  cout << ans << endl;
}



Measured memory_bytes: 3104
#include <iostream>
#include <cstring>
using namespace std;
char str[10005];
int main()
{	
	int n; cin >>n; 
	cin >> str;
	int k = strlen(str);
	for( int i = 0  ;i < k ; i++)
	{
		str[i] = (str[i] + n - 'A') % 26 + 'A';
		cout << str[i];
	}
		
	return 0;
}

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

int main(){
	map<int,bool> memo;
	
	int n;
	cin>>n;
	int c=0;
	
	for(int i=0;i<n;i++){
		int p[3];
		cin>>p[0]>>p[1]>>p[2];
		sort(p,p+3);
		int k=((p[0]-1)*1000+(p[1]-1))*1000+(p[2]-1);
		if(memo.find(k)!=memo.end()){
			c++;
		}else{
			memo[k]=true;
		}
	}
	cout<<c<<endl;
	return 0;

}

Measured memory_bytes: 3156
let getQQList (n: int64) =
    let sqrtn = float n |> sqrt |> int64
    [| for a in 1L..sqrtn do
       if n % a = 0L then yield a + (n / a) - 2L |]

let n = stdin.ReadLine() |> int64
let ans = getQQList n |> Array.sort |> Array.head

printfn "%d" ans

Measured memory_bytes: 14940
#include <bits/stdc++.h>
#define sz(arr) (int)(arr).size()
#define rng(arr) arr.begin(), arr.end()
#define show(x) cout << #x << " = " << x << endl;
#define rep(i, n) for (int i = 0; i < (n); ++i)

using namespace std;
typedef long long int ll;

void _cin() {}
template <class Head, class... Tail>
void _cin(Head&& head, Tail&&... tail) {
  cin >> head;
  _cin(forward<Tail>(tail)...);
}

#define Cin(T, ...) \
  T __VA_ARGS__;    \
  _cin(__VA_ARGS__)

#define Cins(T, n, xs) \
  vector<T> xs(n);     \
  for (int i = 0; i < n; ++i) cin >> xs[i]

void Main();
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(15);
  Main();
  return 0;
}

void Main() {
  Cin(string, s);
  int n = sz(s);
  vector<int> a(n + 1);

  rep(i, n) if (s[i] == '<') a[i + 1] = max(a[i + 1], a[i] + 1);
  for (int i = n - 1; i >= 0; --i)
    if (s[i] == '>') a[i] = max(a[i], a[i + 1] + 1);

  ll ans = 0;
  rep(i, n + 1) ans += a[i];
  cout << ans << endl;
}

Measured memory_bytes: 2844
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	const double eps=1e-11;
	static void Main(){
		Sc sc=new Sc();
		var n=sc.I;
		Console.WriteLine("{0}",8-(n-400)/200);
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),int.Parse);}
	public int[] Ia3(int a){return Array.ConvertAll((Console.ReadLine()+" "+a.ToString()).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),long.Parse);}
	public long[] La3(int a){return Array.ConvertAll((Console.ReadLine()+" "+a.ToString()).Split(),long.Parse);}
	public double[] Da2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),double.Parse);}}
	public double[] Da3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),double.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

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

int main()
{
    double a,b,x;
    cin>>a>>b>>x;
    double ans=0;
    if(x>((a*a*b)/2))
    {
        ans=(atan(2*((a*a*b)-x)/(a*a*a)))*(90/acos(0));
    }
    else{
        ans=90-((atan((2*x)/(a*b*b)))*(180/acos(-1)));
    }
    printf("%.9f",ans);
    return 0;
}



Measured memory_bytes: 512
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String S = sc.next();
        char before = ' ';
        int cnt = 0;
        for (int i = 0; i < N; i++){
            if (before == S.charAt(i)){
                continue;
            }
            cnt++;
            before = S.charAt(i);
        }
        System.out.println(cnt);
    }
}

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

#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n)-1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef long double ld;

const ll N = (ll)5e5 + 2;
const ll MOD = (ll)1e9 + 7;
const ll MOD1 = (ll)998244353;
const ll inf = (ll)1e18 + 6;

template <class T>
bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template <class T>
bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

ll add(ll x, ll y)
{
    x += y;
    if (x >= MOD)
        return x - MOD;
    return x;
}

ll sub(ll x, ll y)
{
    x -= y;
    if (x < 0)
        return x + MOD;
    return x;
}

ll mult(ll x, ll y)
{
    return (x * y) % MOD;
}

ll bin_pow(ll x, ll p)
{
    if (p == 0)
        return 1;
    if (p & 1)
        return mult(x, bin_pow(x, p - 1));
    return bin_pow(mult(x, x), p / 2);
}

ll rev(ll x)
{
    return bin_pow(x, MOD - 2);
}

int main()
{

    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(20);
    cout << fixed;
#ifdef LOCAL_DEFINE
    freopen("input.txt", "rt", stdin);
#endif
    ll n, m;
    cin >> n >> m;
    vll A(m);
    forn(i, m) cin >> A[i];
    cout << max(n - accumulate(all(A), 0), -1LL) << "\n";
}


Measured memory_bytes: 3700
import numpy
inp = input().split()
l = list()
for i in range(int(inp[0])):
	l1 = input().split()
	l1 = [int(s) for s in l1]
	l.append(l1)
l3 = []

a1 = []
a2 = []
a3 = []
a4 = []
a5 = []
a6 = []
a7 = []
a8 = []
for ll in l:
	a1.append(ll[0]+ll[1]+ll[2])
	a2.append(ll[0]+ll[1]-ll[2]) 
	a3.append(ll[0]-ll[1]+ll[2]) 
	a4.append(ll[0]-ll[1]-ll[2]) 
	a5.append(-ll[0]+ll[1]+ll[2]) 
	a6.append(-ll[0]+ll[1]-ll[2]) 
	a7.append(-ll[0]-ll[1]+ll[2]) 
	a8.append(-ll[0]-ll[1]-ll[2]) 

def temp(li):
	li.sort()
	li.reverse()
	count = 0
	for i in range(int(inp[1])):
		count += li[i]
	l3.append(count)

temp(a1)
temp(a2)
temp(a3)
temp(a4)
temp(a5)
temp(a6)
temp(a7)
temp(a8)

print(max(l3))

Measured memory_bytes: 21540
#include<stdio.h>
void quicksort(int a[],int s,int t){
  if(s<t){
    int i=s,j=t,p=a[s];
    while(1){
      while(a[i]<p)i++;
      while(p<a[j])j--;
      if(i>=j)break;
      a[i]^=a[j]^=a[i]^=a[j];
      i++;j--;
    }
    quicksort(a,s,i-1);quicksort(a,j+1,t);
  }
}
int main(){
  int n,a[100],i;
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&a[i]);
  quicksort(a,0,n-1);
  printf("%d",a[n-1]-a[0]);
}


Measured memory_bytes: 128
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

#define MAX_N	(30)
#define MAX_CAN	(10000)

#define DELTA	((double)1e-6)

/* typedef */

typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
typedef long long ll;

struct can_t {
  double r, x, y, z;
};

struct pt_t {
  double x, y, z;
};

/* classes */

class LessCan {
public:
  bool operator()(const can_t& lc, const can_t& rc) const {
    return lc.r < rc.r;
  }
};

/* global variables */

static pt_t signs[] = {
  { 1, 1, 1}, { 1, 1, -1}, { 1, -1, 1}, { 1, -1, -1},
  {-1, 1, 1}, {-1, 1, -1}, {-1, -1, 1}, {-1, -1, -1}
};

static int n;
static pt_t pts[MAX_N];

static can_t candidate[MAX_CAN], new_candidate[MAX_CAN];

/* subroutines */

double max_r(double x, double y, double z) {
  double max_r2 = 0.0;

  for (int i = 0; i < n; i++) {
    pt_t& p = pts[i];
    double dx = x - p.x;
    double dy = y - p.y;
    double dz = z - p.z;
    double r2 = dx * dx + dy * dy + dz * dz;
    if (max_r2 < r2) max_r2 = r2;
  }

  return sqrt(max_r2);
}

double solve_by_partition() {
  candidate[0].x = 50.0;
  candidate[0].y = 50.0;
  candidate[0].z = 50.0;

  int count = 1;
  double size = 100.0;
  double min_sofar = 1e50;
  double root3 = sqrt(3.0);

  while (size > DELTA) {
    size /= 2;
    int k = 0;

    for (int i = 0; i < count; i++) {
      for (int d = 0; d < 8; d++) {
        can_t c = candidate[i];
        double sizeh = size / 2;
        c.x += signs[d].x * sizeh;
        c.y += signs[d].y * sizeh;
        c.z += signs[d].z * sizeh;
        c.r = max_r(c.x, c.y, c.z);
        if (min_sofar > c.r) min_sofar = c.r;
        if (c.r > min_sofar + sizeh * root3) continue;
        if (k >= MAX_CAN) break;

        new_candidate[k] = c;
        k++;
      }
      if (k >= MAX_CAN) break;
    }

    count = k;
    for (int i = 0; i < count; i++)
      candidate[i] = new_candidate[i];

    sort(candidate, candidate + count, LessCan());
  }

  return min_sofar;
}

/* main */

int main() {
  for (;;) {
    cin >> n;
    if (n == 0) break;

    for (int i = 0; i < n; i++) {
      cin >> pts[i].x >> pts[i].y >> pts[i].z;
    }

    printf("%.5lf\n", solve_by_partition());
  }
  
  return 0;
}

Measured memory_bytes: 1888
#include<stdio.h>
int main() {
  char ch;
  int i, count1, count0;
  i=count1=count0=0;
  while((ch=getchar())!='\n')
  {
    if(i%2==0) {
      if(ch=='0') count1++;
      else count0++;
      }
      else {
        if(ch=='0') count0++;
        else count1++;
      }
     i++;
    }
    
   if(count0 <= count1) printf("%d", count0);
   else printf("%d", count1);
    return 0;
}

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

#define F first
#define S second

int dx[] = { 0 , 0, 1, -1, -1, -1, 1, 1};
int dy[] = { 1, -1 , 0, 0, 1, -1, 1, -1};
const double EPS= 1e-8 ;
const double PI  = acos(-1.0);
#define inf INT_MAX
ll gcd(ll a, ll b) { return !b ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }

int n ; 
int a[100005] ; 
ll dp[100005]; 

ll solve ( int ind )
{
	if ( ind ==n-1 )return 0 ; 
	
	if ( dp [ind] != -1 ) return dp[ind]; 
	
	ll & res = dp[ind]; 
	ll res1=1e10 , res2 =1e10 ; 
	if ( ind +1 <n ) 
	res1 = solve ( ind + 1)+ abs ( a[ind] - a[ind+1])  ; 
	if ( ind + 2 <n ) 
	res2 = solve ( ind+2 ) +abs ( a[ind] - a[ind+2]); 
	res = min ( res1 , res2 ); 
	return res ; 
	
}



int main()
 {
 
 cin>>n ; 
  
 for (int i = 0; i < n ; i++)
 {
	 cin>>a[i] ; 
	 
 }
 memset ( dp , -1 , sizeof( dp ) ) ; 
 ll ans = solve ( 0 ) ; 
 
  
cout<< ans << endl; 


 return 0 ;
}






 
 
 
 
 
 

 


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

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n;
	int s[n], sum = 0;
	for (int i = 0; i < n; i++) {
		cin >> s[i];
		sum += s[i];
	}
	sort (s, s + n);
	int i = 0;
	if (sum % 10) cout << sum;
	else {
		while (i < n && s[i] % 10 == 0)
			i++;
		if (i == n) 
			cout << 0;
		else 
			cout << sum - s[i];
	}
}

Measured memory_bytes: 256
str=str(input())
k="keyence"
for i in range(8):
  l=str.find(k[0:i])
  r=str.rfind(k[i:7])
  if(l==0 and r==len(str)-(7-i) and l-r<=0):
    print("YES")
    break
else:
  print("NO")


Measured memory_bytes: 3060
function Main(input){
    input = input.split("\n");
    var arr = input[1].split(" ").map(Number).sort(function(a,b){return a-b;});
    console.log(Math.abs(arr[(arr.length/2)-1]-arr[arr.length/2]))
}Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());

Measured memory_bytes: 28376
#include<bits/stdc++.h>
using namespace std ;
int main (){
    string a , b ;
    int c , cnt = 0 , j ;
    cin >> a >> b ;
    c = a.size() ;

    for (int i = 0 , j = 0  ; i < c ; i ++ , j ++ ) {
        if (a[i] != b[j])
            cnt ++ ;
    }
    cout << cnt << endl ;

}


Measured memory_bytes: 3916
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL, LL> PII;

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

template <typename T>
function<T(T, T)> op_max = [](T a, T b) -> T { return max(a, b); };
template <typename T>
function<T(T, T)> op_min = [](T a, T b) -> T { return min(a, b); };

template <typename T>
function<T(T, T)> op_sum = [](T a, T b) -> T { return a + b; };

using namespace std;
//********************  dumps ************************//

template <typename T>
void dump(const T &data, vector<int> &iter)
{
  cout << data << " ";
}
template <typename T>
void dump(const vector<T> &data, vector<int> &iter)
{
  for (auto elem : data)
    dump(elem, iter);
  cout << endl;
}

template <typename T>
void dump(const vector<vector<T>> &data, vector<int> &iter)
{
  for (auto elem : iter)
  {
    cout << "[" << elem << "]";
  }
  cout << endl;
  for (int i = 0; i < data.size(); i++)
  {
    iter.push_back(i);
    dump(data[i], iter);
    iter.pop_back();
  }
  cout << endl;
}

template <typename T>
void dump(const vector<T> &data, int dummy)
{
  for (int i = 0; i < data.size(); i++)
  {
    cout << "[" << i << "] " << data[i] << endl;
  }
}
template <typename T>
void dump(const T &data)
{ // T : data, U = base type val.
  vector<int> iter;
  dump(data, iter);
}
///////////////////////////////////////////////

const string YES = "Yes";
const string NO = "No";

void solve(long long D, long long T, long long S)
{

  cout << ((T * S >= D) ? YES : NO) << endl;
}

int main()
{
  cout << setprecision(10);
  long long D;
  scanf("%lld", &D);
  long long T;
  scanf("%lld", &T);
  long long S;
  scanf("%lld", &S);
  solve(D, T, S);
  return 0;
}


Measured memory_bytes: 3692
#include <iostream>
#include <stdio.h>
using namespace std;

int main(void){
    int H,W;
    while(1){
        cin>>H>>W;
        if (H==0 and W==0){
            return 0;
        }
        for(int i=0;i<H;i++){
            for(int j=0;j<W;j++){
                printf("#");
            }
            printf("\n");
        }
        printf("\n");
    }
}



Measured memory_bytes: 3072