akhauriyash/Code-Regression huggingface dataset:
/*
    sort three numbers
*/
 
#include <stdio.h>
 
int main(void)
{
    int min, min_i;
    int i, j;
    int array[3];
 
    scanf("%d %d %d", &array[0], &array[1], &array[2]);
 
    for (i=0; i < 3; i++){
        min = array[i];
        min_i = i;
        for (j=i+1; j < 3; j++){
            if (array[j] < min){
                min = array[j];
                min_i = j;
            }
        }
        array[min_i] = array[i];
        array[i] = min;
    }
    printf("%d %d %d\n", array[0], array[1], array[2]);
    return (0);
}

Measured memory_bytes: 1752
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int H,W;
  cin >> H >> W;
  //格納するstringを設定
  string Sb,Sn,Sa,Snum;
  Snum = "";
    for (int k=0; k < W; k++){
  Snum = Snum + ".";
    }
  Sn =  "." + Snum +  ".";
  cin >> Sa;
  Sa =  "." + Sa +  ".";
  // 外側に'.'を一周追加して、辺・頂点での場合分けを減らす方針
  for (int i=0; i < H; i++){
    Sb = Sn;
    Sn = Sa;
    
    string Vi;
    Vi = "";
    
    if (i == H-1){
    Sa = "." + Snum + ".";
    }else{
    cin >> Sa;
    Sa = "." + Sa + ".";
    }
    
  for (int j=0; j < W; j++){
    char A,B,C,D,E,F,G,H,I,Cn;
    A = Sb.at(j);
    B = Sb.at(j+1);
    C = Sb.at(j+2);
    D = Sn.at(j);
    E = Sn.at(j+1);
    F = Sn.at(j+2);
    G = Sa.at(j);
    H = Sa.at(j+1);
    I = Sa.at(j+2);
    
    int x=0;
    Cn = '.';      
    if (E == '#'){
    Cn = '#';
    }else{
    if (A == '#'){
    x++;
    }
      if (B == '#'){
    x++;
    }if (C == '#'){
    x++;
    }if (D == '#'){
    x++;
    }if (F == '#'){
    x++;
    }if (G == '#'){
    x++;
    }if (H == '#'){
    x++;
    }if (I == '#'){
    x++;
    }
    if (x == 0){
    Cn = '0';
    }else if (x == 1){
    Cn = '1';
    }else if (x == 2){
    Cn = '2';
    }else if (x == 3){
    Cn = '3';
    }else if (x == 4){
    Cn = '4';
    }else if (x == 5){
    Cn = '5';
    }else if (x == 6){
    Cn = '6';
    }else if (x == 7){
    Cn = '7';
    }else if (x == 8){
    Cn = '8';
    }
    }
      
      Vi = Vi + Cn;
    }
    
   cout << Vi << endl; 
  }
  
}

Measured memory_bytes: 3564
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define INF 1000000000
#define pb push_back
vector<ll> ans(2000001,0);
vector<int> dp(2000001,INF);
vector<int> val(2000001);
vector<ll> adj[200001];

void dfs(ll u,ll p)
{
    //cout<<"U::"<<u<<"P::"<<p<<endl;
    ll k=lower_bound(dp.begin(),dp.end(),val[u])-dp.begin();
    ll temp=dp[k];
    dp[k]=val[u];
    ans[u]=max(k,ans[p]);
    for(int j=0;j<adj[u].size();j++)
    {
        if(adj[u][j]==p)continue;
        dfs(adj[u][j],u);
    }
    dp[k]=temp;
}
int main()
{
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)cin>>val[i];
    for(int i=1;i<n;i++)
    {
        ll u,v;
        cin>>u>>v;
        adj[u].pb(v);
        adj[v].pb(u);
    }
    dp[0]=-INF;
    dfs(1,0);
    for(int i=1;i<=n;i++)
        cout<<ans[i]<<endl;
}


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

int main(){
    int n;
    cin >> n;
    set<string> ans;
    for(int i = 0; i < n; i++){
        string tmp;
        cin >> tmp;
        ans.insert(tmp);
    }
    cout << ans.size() << endl;
}

Measured memory_bytes: 19228
package main

import (
	"fmt"
	"sort"
)

func main() {
	// 994ms
	var n, m int

	fmt.Scan(&n, &m)
	x := make([]int, m)
	distance := make([]int, m-1)

	for i := 0; i < m; i++ {
		fmt.Scan(&x[i])
	}

	sort.Sort(sort.IntSlice(x))

	for i := 0; i < m; i++ {
		if i > 0 {
			distance[i-1] = x[i] - x[i-1]
		}
	}

	sort.Sort(sort.IntSlice(distance))
	ans := 0
	for j := 0; j < m-1-n+1; j++ {
		ans += distance[j]
	}

	fmt.Println(ans)
}


Measured memory_bytes: 5504
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  while (cin >> n) {
    int cnt = 0;
    for (int i = 0; i < 10; i++) {
      for (int j = 0; j < 10; j++) {
        for (int k = 0; k < 10; k++) {
          if (0 <= n - i - j - k && n - i - j - k < 10) cnt++;
        }
      }
    }
    cout << cnt << endl;
  }
}

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

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

  vector<long long> A(N);
  for(auto& x: A){
    cin >> x;
  }

  vector<long long> A_sum(N + 1);
  for(int i = 0; i < N; i++){
    A_sum[i + 1] = A[i] + A_sum[i];
  }

  auto itr = lower_bound(A_sum.begin(), A_sum.end(), A_sum[N] / 2);
  //cout << *prev(itr) << endl;
  long long ans = min(abs(A_sum[N] - 2 * (*itr)), abs(A_sum[N] - 2 * *prev(itr)));
  cout << ans << endl;
}



Measured memory_bytes: 3328
#include <bits/stdc++.h>
	#include <cstdio>
	#include <cstring>
	#include <cmath>
	#include <cstring>
	#include <chrono>
	#include <complex>
	#define endl "\n"	
	typedef long long LL;
	#define ld long double
	#define ll long long int
	#define vi vector<int>
	#define vll vector<ll>
	#define vvi vector < vi >
	#define pii pair<int,int>
	#define pll pair<long long, long long>
	#define mod 1000000007
	#define mod2 998244353
	#define INFINITE 1000000000000000001;
	#define all(c) c.begin(),c.end()
	#define sz(v) ((ll)(v).size())
	#define mp(x,y) make_pair(x,y)
	#define mem(a,val) memset(a,val,sizeof(a))
	#define eb emplace_back
	#define pb push_back
	#define f first
	#define s second
	#define dbg(a) cout<<#a<<" --> "<<(a)<<"\n";
	#define forn(i,n) for (ll i=0; i<(n); ++i)
	#define fornd(i,n) for (ll i=(n)-1; i>=0; --i)	
	#define forab(i,a,b) for (ll i=(a); i<=(b); ++i)
	#define read(a) ll a; cin >> a;
	#define reads(s) string s; cin >> s;
	#define readb(a, b) ll a, b; cin >> a >> b;
	#define readc(a, b, c) ll a, b, c; cin >> a >> b >> c;
	#define readarr(a, n) int a[(n) + 1] = {}; forab(i, 0, (n-1)) {cin >> a[i];}
	#define readmat(a, n, m) int a[n + 1][m + 1] = {}; forab(i, 1, n) {forab(j, 1, m) cin >> a[i][j];}
	#define readv(A,n) vll A(n,0); forn(i,n) cin>>A[i]; 
	#define print(a) cout << a << endl;
	#define printarr(a, n) forab (i, 1, n) cout << a[i] << " "; cout << endl;
	#define printv(v) for (int i: v) cout << i << " "; cout << endl;
	#define printmat(a, n, m) forab(i, 1, n) {forab (j, 1, m) cout << a[i][j] << " "; cout << endl;}
	#define precision(a) cout<<fixed<<setprecision(a);
	#define INF (1e18+5)
	#define inf (1e9+5)
	int dx[4] = { 0, 0, 1, -1 };
	int dy[4] = { 1, -1, 0, 0 };
	// 8-directions
	//int dx[]={1,1,1,0,0,-1,-1,-1};
	//int dy[]={-1,0,1,-1,1,-1,0,1};
	#define fast_io ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
	using namespace std;
	int begtime = clock();
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	mt19937_64 rngb(chrono::steady_clock::now().time_since_epoch().count()); // can give negative values too
	bool isPowerOfTwo(int x) {
    return x && (!(x & (x - 1)));
	}
	int takemod(int x) {
    return (x % mod + mod) % mod;
	}
 
	int fpow(int base, int power, int MOD) {
    int result = 1;
    base = base % MOD;
    while (power) {
        if (power & 1)
            result = (result * base) % MOD;
        base = (base * base) % MOD;
        power = power >> 1;
    }
    return result;
	}
 
	int modinv(int x) {return fpow(x, mod - 2, mod);}
	void solve()
	{
		string A,B;
		cin>>A>>B;
		forn(i,sz(A))
		{
			if(A[i]!=B[i])
			{
				cout<<"No"<<endl;
				return;
			}
		}		
		cout<<"Yes"<<endl;
	}
	int main()
	{	
		#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
		#endif
		fast_io;
		int T=1;
	//	cin>>T;
		// cin.ignore(); must be there when using getline(cin, s)
		while(T--)
		{
			solve();
		}
		#ifndef ONLINE_JUDGE
    		cerr << "Time elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
    		#endif
		return 0;
	}

	
	
	
	

Measured memory_bytes: 3680
#include<iostream>

using namespace std;

int main(){
    
    int a,b;
    cin >> a >> b;
    if(a > b){
        cout << "a > b" << endl;
    } else if(a < b){
        cout << "a < b"<< endl;
    } else{
        cout << "a == b"<< endl;
    }
    return 0;
    
}



Measured memory_bytes: 3116
sx,sy,tx,ty=map(int,input().split())
x,y=tx-sx,ty-sy
print('R'*x+'U'*y+'L'*x+'D'*(y+1)+'R'*(x+1)+'U'*(y+1)+'LU'+'L'*(x+1)+'D'*(y+1)+'R')

Measured memory_bytes: 9180
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	int N,K;
	ll h[100001];
	ll samin=INFl;
	scan(N);scan(K);
	rep(i,N){
		scan(h[i]);
	}
	sort(h,h+N);
	rep(i,N-K+1){
		samin=min(samin,h[i+K-1]-h[i]);
	}
	prin(samin);
	return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();

        if (str.charAt(str.length()-1) == 's') {
            str += "es";
        } else {
            str += "s";
        }
        System.out.println(str);
    }
}


Measured memory_bytes: 38520
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <iomanip>
#include <sstream>

using namespace std;
using ll = long long;

// inf
constexpr ll infl = 1LL << 60;
constexpr int inf = 1 << 30;

int main() {
    int N; cin >> N;
    int pt = 0, px = 0, py = 0;
    bool ans = true;
    for (int i = 0; i < N; ++i) {
        int t, x, y; cin >> t >> x >> y;
        int rt = t - pt;
        int d = abs(x - px) + abs(y - py);
        if (d > rt) {
            ans = false;
        }
        else if (d < rt && abs(d - rt) % 2) {
            ans = false; 
        }
    }
    cout << (ans ? "Yes" : "No") << endl;
}

Measured memory_bytes: 888
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <map>
#include <functional>
using namespace std;
int main() {
	int A,B,C,x,ans = 0,sum;
	cin >> A >> B >> C >> x;
	
	for (int a = 0; a <= A; a++) {
		if (500 * a > x) {
			break;
		}
		for (int b = 0; b <= B; b++) {
			if (500 * a + 100 * b > x) {
				break;
			}
			for (int c = 0; c <= C; c++) {
				sum = 500 * a + 100 * b + 50 * c;
				if (sum == x) {
					ans++;
					break;
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define ll long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define sz(a) int((a).size())
#define all(a) (a).begin(), (a).end()
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPD(i,n) for(int i=(n)-1;i>=0;--i)
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define FORD(i,a,b) for(int i=(a);i>=(b);--i)
#define TLE() cerr<<"\nTime elapsed: "<<1000*clock()/CLOCKS_PER_SEC<<"ms.\n";
const ll MOD = 1E9+7;
const ll IINF = 1E18;
const int INF = 1e9;
const double EPS = 1E-9;
const double PI = atan(1.0) * 4.0;
template<class T> T getbit(T s, int i) {return s>>i&1;}
template<class T> void flipbit(T& s, int i) {s^=(1LL<<i);}
constexpr int cntbit(ll x) {return __builtin_popcountll(x);}
constexpr int lg2(ll x) {return __lg(x);} // return int(log2(x))
// mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count()); 
ll fpow(ll a,ll p){ll res=1LL;while(p){if(p&1LL) res=res*a%MOD;a=a*a%MOD;p>>=1LL;} return res;}

const int N=1e5+5;
string s,t;
int nxt[30][N];

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin>>s>>t;
	int n=sz(s);
	int m=sz(t);
	REP(c,26) nxt[c][n]=n;
	REPD(i,n){
		REP(c,26) nxt[c][i]=nxt[c][i+1];
		nxt[s[i]-'a'][i]=i;
	}
	ll res=0;
	int p=0;
	REP(i,m){
		int j=t[i]-'a';
		p=nxt[j][p];
		if(p==n){
			res+=n;
			p=nxt[j][0];
			if(p==n) exit(puts("-1\n")*0);
		}
		++p;
	}
	res+=p;
	cout<<res<<'\n';
}



Measured memory_bytes: 13964
#include <stdio.h>

int main(){
	int n[4];
	scanf("%d %d %d %d", &n[0], &n[1], &n[2], &n[3]);
	for(int i = 0; i < 4; i++){
		for(int j = i+1; j < 4; j++){
			if(n[i] > n[j]){
				int tmp = n[i];
				n[i] = n[j];
				n[j] = tmp;
			}
		}
	}
	
	//printf("%d %d %d %d", n[0], n[1], n[2], n[3]);
	if(n[0] == 1 && n[1] == 4 && n[2] == 7 && n[3] == 9) puts("YES");
	else puts("NO");
			
	return 0;
}

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

int main() {
  int a[3];
  cin >> a[0] >> a[1] >> a[2];
  sort(a, a+3);
  cout << a[0] << " " << a[1] << " " << a[2] << endl;
  return 0;
}

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

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

    string s;
    cin >> s;

    int cnt_r = 0, w = 0;
    for (auto c : s) {
        cnt_r += (c == 'R');
    }
    
    for (int i = 0; i < cnt_r; i++) {
        if (s[i] == 'W')
            w++;
    }

    cout << w << endl;
}

Measured memory_bytes: 3744
use std::io::{self, BufRead};

const M: i64 = 1000000007;

fn pow(p: i64, n: i64) -> i64 {
  let mut q = n;
  let mut m = p;
  let mut ans = 1;
  while q > 0 {
    if q % 2 == 1 {
      ans = (ans * m) % M;
    }
    q /= 2;
    m = (m * m) % M;
  }
  ans
}

fn main() {
  let stdin = io::stdin();
  let mut lines = stdin.lock().lines();
  let line = lines.next().unwrap().unwrap();
  let vs: Vec<usize> = line.split(' ').map(|x| x.parse().unwrap()).collect();
  let n = vs[0];
  let k = vs[1];

  let mut counts: Vec<i64> = vec![0; k];
  for i in 0..k {
    let x = k - i;
    let mut total = pow((k / x) as i64, n as i64);
    let mut xx = 2 * x;
    while xx <= k {
      total = (total - counts[xx as usize - 1]) % M;
      xx += x;
    }
    counts[x as usize - 1] = total
  }

  let ans = counts.iter().enumerate().map(|(i, c)| *c * (i as i64 + 1) % M).fold(0, |acc, x| (acc + x) % M);
  println!("{}", ans);
}

Measured memory_bytes: 2848
N,A,B = gets.split(" ").map(&:to_i)

nums = (0..N).to_a
sums = 0

def positons_sum(num)
  sum = 0
  until num == 0
    sum += num%10
    num = num/10
  end
  return sum
end

nums.each do |n|
  sum = positons_sum(n)
  sums += n if A <= sum && sum <= B
end

puts sums


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

int main(){
  using namespace std;
  unsigned long a, b, x;
  cin >> a >> b >> x;
  if(a * a * b > 2 * x){
    cout << setprecision(15) << atan2(b * b * a, 2 * x) * 180 / 3.14159265358L << endl;
  }else{
    cout << setprecision(15) << atan2(2 * (a * a * b - x), a * a * a) * 180 / 3.14159265358L << endl;
  }
  return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define F first
#define S second
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pi;
const ll inf = 1e18+5;
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	char a, b;
	cin >>  a >> b;
	if (a == b){
		ll ans = b-'0';
		for (ll i = 0; i < ans; i++)cout << b;
		return 0;
	}else {
		ll x = a-'0', y = b-'0';
		if (y < x){
			//y smaller
			for (ll i = 0; i < x; i++)cout << y;return 0;
		}else {
			for (ll i = 0 ;i < y; i++)cout << x;
		}
		
	}
	
}


Measured memory_bytes: 256
#include<cstdio>
#define nil -1
struct shu{
int left;
int  parent;
int right;
};
int d[100005];
shu a[100005];
void shendu(int u,int p){
d[u]=p;
if(a[u].right!=nil)shendu(a[u].right,p);
if(a[u].left!=nil)shendu(a[u].left,p+1);
}
void shuchu(int u){
printf("node %d: ",u);
printf("parent = %d, ",a[u].parent);
printf("depth = %d, ",d[u]);
if(a[u].parent==nil)printf("root, ");
else if(a[u].left==nil)printf("leaf, ");
else  printf("internal node, ");
printf("[");
int c;
for(int i=0,c=a[u].left;c!=nil;i++,c=a[c].right){
    if(i)printf(", ");
    printf("%d",c);
}
printf("]");
}
int main(){
int n;
scanf("%d",&n);
for(int i=0;i<n;i++){
    a[i].left=a[i].right=a[i].parent=nil;
}
int d,k,m;
int l=0;
for(int i=0;i<n;i++){
    scanf("%d%d",&d,&k);
    for(int j=0;j<k;j++){
        scanf("%d",&m);
        if(j==0)a[d].left=m;
        else a[l].right=m;
        l=m;
        a[m].parent=d;
    }
}
int x;
for(int i=0;i<n;i++){
    if(a[i].parent==nil)x=i;
}
shendu(x,0);
for(int i=0;i<n;i++){
    shuchu(i);
    printf("\n");
}
return 0;
}

Measured memory_bytes: 7224
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
using namespace std;
typedef long long ll;

string s[1010];
int start[1010],l[1010];

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	while(1){
		int n,m; cin >> n >> m;
		if(n==0)break;
		for(int i=0;i<n;i++){
			cin >> s[i] >> l[i] >> start[i];
			start[i]-=l[i]-1;
		}
		while(m--){
			int t; cin >> t;
			bool f=0;
			for(int i=0;i<n;i++){
				if(start[i]<=t&&t<start[i]+l[i]){
					cout << s[i] << " " << (t-start[i]+1) << endl;
					f=1;
					break;
				}
			}
			if(!f)cout << "Unknown" << endl;
		}
	}
}


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

int main() {
  int n; cin >> n;
  int ans = 0;
  for (int i = 1; i<n; i++) {
    ans += n / i;
    if (n % i == 0) ans--;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3604
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
def resolve():
    n=int(input())
    A=[int(input()) for _ in range(n)]

    # 最初の人には1円で売る
    ans=A[0]-1
    p=2
    # 以降は残りの所持金をp-1にできるようにする
    # 所持金が元々 p の場合はどうしようもないので+1する
    for a in A[1:]:
        if(a<p): # 状況変化無し
            continue
        elif(a==p):
            p+=1
        else:
            ans+=(a-1)//p
    print(ans)
resolve()

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

#define 	pi 						3.1415926536
#define 	mod 					1000000007
#define 	lli 					long long int
#define 	rep(i, n) 				for(int i = 0 ; i < n ; i++)
#define 	repn(i, n) 				for(int i = n - 1 ; i >= 0 ; i--)
#define 	loop(i, a, b)			for(int i = a ; i < b ; i++)
#define		loopn(i, a, b) 			for(int i = a ; i >= b ; i--)
#define 	mod1 					1000003
#define 	hello 					"hello"
#define 	nl 						"\n"
#define 	ws 						" "
#define 	F 						first
#define 	S 						second
#define 	pb 						push_back
#define 	mp						make_pair
#define 	B 						begin()
#define 	E 						end()
#define 	all(v) 					v.begin(), v.end()
#define 	reset(a, val) 			memset(a, val, sizeof(a))
#define 	vi 						vector<int>
#define 	vs 						vector<string>
#define 	print(a) 				for(auto i : a)cout<<i<<" ";cout<<"\n"
#define     ispresent(hmp, val)  	(hmp.find(val) != hmp.end()) //for set and map
#define 	boost 					ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

using namespace std;

//g++ -std=c++14
//fixed<<setprecision(9);
//max_element(mp.begin(), mp.end(), compare)
//greater<int>()


bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) { return (a.second < b.second); }

bool compare(const pair<string, int>&a, const pair<string, int>&b){ return a.second < b.second; }

int main()
{
	int n;
	cin>>n;
	if(n%2)
	cout<<n/2 + 1<<nl;
	else
	{
		cout<<n/2<<nl;
	}
	
}

Measured memory_bytes: 256
li=list(map(int,input().split()))

yoko=li[2]-li[0]
tate=li[3]-li[1]
s=["R"]*yoko+["U"]*tate+["L"]*yoko
s+=["D"]*(tate+1)+["R"]*(yoko+1)+["U"]*(tate+1)+["L"]
s+=["U"]+["L"]*(yoko+1)+["D"]*(tate+1)+["R"]
ans=''.join(s)

print(ans)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
const int maxN = (int)1e5 + 10;
int l[maxN];
int r[maxN];
int main() {
    srand(time(0));
    //freopen("input.txt", "r", stdin);
    ios_base::sync_with_stdio(false);
    long long ans = 0;
    int n;
    cin >> n;
    set < pair < int, int > > L;
    set < pair < int, int > > R;
    for (int i = 1; i <= n; i++) {
        cin >> l[i] >> r[i];
        L.insert(make_pair(-l[i], i));
        R.insert(make_pair(r[i], i));
    }
    int curdir = 0;
    int pos = 0;
    while (1) {
        if (L.empty()) break;
        if (curdir <= 0) {
            auto it = L.begin();
            auto t = *it;
            int ll = -t.first;
            int ind = t.second;
            if (ll < pos) break;
            ans += ll - pos;
            pos = ll;
            L.erase(it);
            R.erase(make_pair(r[ind], ind));
            curdir = 1;
        }
        else {
            auto it = R.begin();
            auto t = *it;
            int rr = t.first;
            int ind = t.second;
            if (rr > pos) break;
            ans += pos - rr;
            pos = rr;
            R.erase(it);
            L.erase(make_pair(-l[ind], ind));
            curdir = -1;
        }
    }
    ans += abs(pos);
    long long fans = ans;
    ans = 0;
    pos = 0;
    curdir = 1;
    L.clear();
    R.clear();
    for (int i = 1; i <= n; i++) {
        cin >> l[i] >> r[i];
        L.insert(make_pair(-l[i], i));
        R.insert(make_pair(r[i], i));
    }
    while (1) {
        if (L.empty()) break;
        if (curdir <= 0) {
            auto it = L.begin();
            auto t = *it;
            int ll = -t.first;
            int ind = t.second;
            if (ll < pos) break;
            ans += ll - pos;
            pos = ll;
            L.erase(it);
            R.erase(make_pair(r[ind], ind));
            curdir = 1;
        }
        else {
            auto it = R.begin();
            auto t = *it;
            int rr = t.first;
            int ind = t.second;
            if (rr > pos) break;
            ans += pos - rr;
            pos = rr;
            R.erase(it);
            L.erase(make_pair(-l[ind], ind));
            curdir = -1;
        }
    }
    ans += abs(pos);
    fans = max(fans, ans);
    cout << fans;
    return 0;
}


Measured memory_bytes: 10368
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define MOD 1000000007
#define MAX 510000
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

using namespace std;
typedef long long ll;
typedef pair<int, int> P;

//cout << fixed << setprecision(10);//
//最小公倍数//
ll gcd(ll x, ll y) {
	if (x == 0) return y;
	return gcd(y%x, x);
}
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }

//べき//
ll squ(ll n, ll p, ll m){
	if(p==0) return 1;
	if(p%2==0){
		ll t=squ(n, p/2, m);
		return t*t%m;
	}
	return n*squ(n,p-1,m);
	
}


//逆元mod(mを法とするaの逆元)//
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//Cmonp//
ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
ll COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

//nが大

ll com(ll n,ll m){
	if(n<=0 || m<=0 || n==m){
		return 1;
	}
	if(n<m){
		return 0;
	}
	ll k=1;
	for(ll i=1;i<=m;i++){
       k*=(n-i+1); 
	   k%=MOD;
	   k*=modinv(i,MOD);
	   k%=MOD;
	}

	return k;
}


//


////////////////////////////////////////////////////////////////////




int main() {
ll k,n;
cin>>k>>n;
ll a[n+1];
for(int i=1;i<=n;i++){
    cin>>a[i];
}

ll ans=100000000;

for(int i=1;i<=n;i++){
ll l=k;
if(i<=n-1){
    l=k-(a[i+1]-a[i]);
}
if(i==n){
    l=k-(k-a[n]+a[1]);
}

    ans=min(ans,l);
}


cout<<ans<<endl;
return 0;
}



Measured memory_bytes: 1792
/*BY-ADITYA OJHA
  LEARN DSA SINCERELY*/
#include <bits/stdc++.h>
#define ll long long int
#define forin for(int i=0;i<n;i++)
#define forjn for(int j=0;j<n;j++)
#define pb push_back
#define vx vector<ll> x
#define fas1  ios_base::sync_with_stdio(false)
#define fas2   cin.tie(NULL)
#define fas3   cout.tie(NULL)
using namespace std;


int main()
{
     fas1;
     fas2;
     fas3;


     ll a[32]={
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};

ll n;
cin>>n;
cout<<a[n-1]
<<endl;

     return 0;

}





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

int main() {
  int n, a, b, i, p1 = 0, p2 = 0, p3 = 0;
  cin >> n >> a >> b;
  vector<int> p(n);
  for(i = 0;i < n;i++){
    cin >> p.at(i);
  }//入力
  for(i = 0;i < n;i++){
    if(p.at(i) <= a) p1++;
    else if (a < p.at(i)&&p.at(i) <= b) p2++;
    else if (p.at(i) > b) p3++;
  }
  cout << min({p1, p2, p3}) << endl;
}

Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <vector>
#include <tuple>
#include <string>

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

  std::string S;
  std::cin >> S;
  int ms = 0;
  for(int i = 1; i < N; i++){
    int ts = 0;
    for(int j = 0; j < N-i; j++){
      if(S[j] == S[j+i]){
        ts++;
        ms = std::max(ms, ts);
        if(ts == i) break;
      }else{
        ts = 0;
      }
    }
  }
  std::cout << ms << std::endl;

  return 0;
}



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

const int INF = 1000000007;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s1, s2;
    cin >> s1 >> s2;
    int l1 = s1.size(), l2 = s2.size();
    int dp[1001][1001];
    for(int i = 0; i <= l1; i++){
        fill(dp[i], dp[i] + l2 + 1, INF);
    }
    for(int i = 0; i <= l2; i++){
        dp[0][i] = i;
    }
    for(int i = 0; i <= l1; i++){
        dp[i][0] = i;
    }
    for(int i = 1; i <= l1; i++){
        for(int j = 1; j <= l2; j++){
            if(s1[i-1] == s2[j-1]){
                dp[i][j] = dp[i-1][j-1];
            }else{
                dp[i][j] = min(min(dp[i][j-1] + 1,
                                   dp[i-1][j] + 1),
                               dp[i-1][j-1] + 1);
            }
        }
    }
    printf("%d\n", dp[l1][l2]);
    return 0;
}

Measured memory_bytes: 5120
#include <iostream>
using namespace std;
int main()
{
	int x, y;
	cin >> x >> y;
	if (x == y)
	{
		cout << -1 << endl;
	}
	else if (x % y == 0)
	{
		cout << -1 << endl;
	}
	else
	{
		cout << x << endl;
	}
	return 0;
}

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

using namespace std;
using llong = long long;
using ldbl = long double;
using P = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

const llong inf = llong(1e18)+7;
const llong mod = 1e9+7;

int main(){
	llong n;
	vector<llong> h;

	cin >> n;
	llong maxi = 0;
	llong in, ans = 0;
	for(int i = 0; i < n; i++) {
		cin >> in;
		if (i == 0 || in >= maxi)
			ans++;
		maxi = max(maxi, in);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
import Control.Arrow
import Control.Monad
import Data.Bits
import Data.Char
import Data.List

main :: IO ()
main = do
  [a, b, k] <- getInts
  mapM_ print [x | x <- [a..b], x < a + k || b - k < x]

getInts :: IO [Int]
getInts = map read . words <$> getLine


Measured memory_bytes: 764
n = gets.to_i
h = Hash.new(0)
max = 0

n.times do
  s = gets.chomp
  h[s] += 1
  max = h[s] if max < h[s]
end

result = []
h.each do |k, v|
  result.push(k) if v == max
end

result.sort.each {|s| puts s }

Measured memory_bytes: 33944
#include "bits/stdc++.h"
using namespace std;
typedef long long LL;
const LL MOD = 1000000007LL;
const double EPS = 1e-10;
typedef pair<int, int> PP;
double add(double a, double b) {
	if (abs(a + b) < EPS*(abs(a) + abs(b))) return 0;
	return a + b;
}
struct P {
	double x, y;
	P() {}
	P(double x, double y) :x(x), y(y) {}
	P operator+(P p) const {
		return P(add(x, p.x), add(y, p.y));
	}
	P operator-(P p) const {
		return P(add(x, -p.x), add(y, -p.y));
	}
	double dot(P p) const {
		return add(x*p.x, y*p.y);
	}
	double det(P p) const {
		return add(x*p.y, -y*p.x);
	}
	double norm() const {
		return sqrt(add(x*x, y*y));
	}
};
bool cmp_x(const P& p, const P& q) {
	if (p.x != q.x) return p.x < q.x;
	return p.y < q.y;
}
vector<P> covex_hull(P* ps, int n) {
	sort(ps, ps + n, cmp_x);
	int k = 0;
	vector<P> qs(n * 2);
	for (int i = 0; i < n; i++) {
		while (k > 1 && (qs[k - 1] - qs[k - 2]).det(ps[i] - qs[k - 1]) <= 0) k--;
		qs[k++] = ps[i];
	}
	for (int i = n - 2, t = k; i >= 0; i--) {
		while (k > t && (qs[k - 1] - qs[k - 2]).det(ps[i] - qs[k - 1]) <= 0) k--;
		qs[k++] = ps[i];
	}
	qs.resize(k - 1);
	return qs;
}
map<PP, double> ans;
P ps[100], _ps[100];
int main() {
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) {
		int x, y;
		cin >> x >> y;
		ps[i] = P(x, y);
		_ps[i] = ps[i];
	}
	vector<P> qs = covex_hull(_ps, N);
	double PI = acos(-1);
	for (int i = 0; i < qs.size(); i++) {
		P a = qs[i] - qs[(i - 1 + qs.size()) % qs.size()];
		P b = qs[i] - qs[(i + 1) % qs.size()];
		double t = a.dot(b) / (a.norm()*b.norm());
		double theta = PI - acos(t - EPS);
		ans[PP((int)qs[i].x, (int)qs[i].y)] = theta / (2 * PI);
	}
	for (int i = 0; i < N; i++) {
		printf("%.15lf\n", ans[PP(ps[i].x, ps[i].y)]);
	}
}

Measured memory_bytes: 256
# include <bits/stdc++.h>
# define pf push_front
# define pb push_back
# define mp make_pair
# define pr printf
# define se second
# define si size()
# define sc scanf
# define fi first
# define er erase
# define be begin
# define ss size
# define Int __int64
# define INF 100000000000000008
# define MOD 1000000007
# define MN 500500
# define eps 0.0000000000000000018
# define mem(a) memset(a,0,sizeof(a))
# define cpy(b,a) memcpy(b,a,sizeof(a))
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
using namespace std;

int main() {
	int r,b,g,ans;
	cin>>r>>b>>g;
	ans=b*10+g;
	if(ans%4)
		cout<<"NO";
	else cout<<"YES";
	return 0;
}
/* and its only us now */


Measured memory_bytes: 256
import numpy as np
import scipy.sparse as sps
import scipy.misc as spm
import collections as col
import functools as func
import itertools as ite
import fractions as frac
import math as ma
import cmath as cma
import copy as cp
import sys
def sinput(): return sys.stdin.readline().strip()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(n=0):
    if n: return [0 for _ in range(n)]
    else: return list(imap())
def farr(): return list(fmap())
def sarr(n=0):
    if n: return ["" for _ in range(n)]
    else: return sinput().split()
def barr(n): return [False for _ in range(n)]
sys.setrecursionlimit(10**7)
MOD = 10**9 + 7; EPS = sys.float_info.epsilon
PI = np.pi; EXP = np.e; INF = np.inf

s = sinput()
n = len(s) - 1

sum = 0
for i in range(2**n):
    plus = ["" for i in range(n)] + [""]
    for j in range(n):
        if i>>j&1: plus[j] = "+"
    equa = ""
    for k in range(n+1): equa += s[k] + plus[k]
    sum += eval(equa)

print(sum)


Measured memory_bytes: 19496
#include <bits/stdc++.h>
using namespace std;
int n,cnt;
string str;
int main() {
    cin>>n;
    cin>>str;
    for (int i=2; i<n; i++) {
        if (str[i]=='C' and str[i-1]=='B' and str[i-2]=='A') cnt++;
    }
    cout<<cnt<<'\n';
}

Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#define MOD 1000000007
typedef long long ll;
using namespace std;

int main(){
  int n;
  cin>>n;
  if(n==3||n==5||n==7) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;

  return 0;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;
#define int long long
#define All(v) (v.begin(),v.end())
int gcd(int a, int b) {
	if (b == 0)return a;
	return gcd(b, a%b);
}
int lcm(int a, int b) {
	return a / gcd(a, b)*b;
}
int modpow(int a,int b){
    if(!b)return 1;
    if(b%2)return modpow(a,b-1)*a%MOD;
    return modpow(a,b/2)*modpow(a,b/2)%MOD;
}
int fac(int a){
    int Ans=1;
    for(int i=1;i<=a;i++){
        Ans*=i;
        Ans%=MOD;
    }
    return Ans;
}//kaijo
int comb(int a,int b){
    return fac(a)*modpow(fac(a-b),MOD-2)%MOD*modpow(fac(b),MOD-2)%MOD;
}
signed main(){
	int n;
	int a[110];
	cin>>n;
	int ans=0;
	rep(i,n){
		cin>>a[i];
		if(a[i]%2==0)ans++;
		
	}
	cout<<ans<<endl;
	return 0;
}




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

int  main(){
  ll h,n,a;
  cin >> h;
  n=0;
  a=1;
  while(h!=0){
    h=h/2;
    n+=1;
    a=a*2;
  }
  cout << a-1;
}

Measured memory_bytes: 256
X = int(input())

def is_prime(n):
  if n ==2:
    return 2
  for i in range(2,n):
    if n % i ==0:
      return False
    elif i**2 > n:
      return True

while 1:
  if is_prime(X):
    print(X)
    break
  else:
    X += 1



Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//cout << fixed << setprecision(17) << res << endl;

ll gcd(ll a, ll b){
    return b?gcd(b, a%b):a;
}

int main() {
    ll n;
    ll x;
    cin >> n >> x;
    vector<ll> X(n);
    for (auto & x : X) cin >> x;
    X.push_back(x);
    sort(X.begin(), X.end());
    vector<ll> D(n);

    for (ll i = 0; i < n; ++i) {
        D[i] = X[i+1] - X[i];
    }

    ll cur = D[0];
    for (ll i = 1; i < n; ++i) {
        cur = gcd(cur, D[i]);
    }
    cout << cur << endl;
}


Measured memory_bytes: 1792
#include<iostream>
#include<stdio.h>
using namespace std;
int main(void) {
	int a;
	int b;
	int c;
	int k;
	int i;
	scanf("%d%d%d%d", &a,&b,&c,&k);
	for (i = 0; i < k; i++) {
		if (b > a) {
			break;
		}
		b = b * 2;

	}for (; i < k; i++) {
		if (c > b) {

			break;
		}
		c = c * 2;
	}if (a < b && b < c) {
		printf("Yes");
	}
	else {
		printf("No");
	}




	return 0;
}

Measured memory_bytes: 3748
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Collections;
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());
        Integer[] a = new Integer[N];
        int pA = 0;
        int pB = 0;
        int result = 0;
        for (int i = 0; i < N; i++) {
            a[i] = Integer.parseInt(sc.next());
        }

        Arrays.sort(a, Collections.reverseOrder());

        // Aliceの点数
        for (int i = 0; i < N; i += 2) {
            pA += a[i];
            if (N > i + 1) {
                pB += a[i + 1];
            }
        }

        result = pA - pB;

        PrintWriter out = new PrintWriter(System.out);
        out.println(result);

        sc.close();
        out.flush();
    }
}

Measured memory_bytes: 35780
let hand a =
    let t = (a.(0),a.(1),a.(2),a.(3),a.(4)) in
    match t with
    (i,j,k,l,m) when (i,j,k,l,m) = (i,i,i,i,m)
                     || (i,j,k,l,m) = (i,j,j,j,j) -> print_endline "four card"
    | (i,j,k,l,m) when (i,j,k,l,m) = (i,i,k,k,k)
                     || (i,j,k,l,m) = (i,i,i,l,l) -> print_endline "full house"
    | (i,j,k,l,m) when (i,j,k,l,m) = (i,i,i,l,m)
                     || (i,j,k,l,m) = (i,j,j,j,m)
                     || (i,j,k,l,m) = (i,j,k,k,k) -> print_endline "three card"
    | (i,j,k,l,m) when (i,j,k,l,m) = (i,i,k,k,m)
                     || (i,j,k,l,m) = (i,i,k,l,l)
                     || (i,j,k,l,m) = (i,j,j,l,l) -> print_endline "two pair"
    | (i,j,k,l,m) when (i,j,k,l,m) = (i,i,k,l,m)
                     || (i,j,k,l,m) = (i,j,j,l,m)
                     || (i,j,k,l,m) = (i,j,k,k,m)
                     || (i,j,k,l,m) = (i,j,k,l,l) -> print_endline "one pair"
    | (i,j,k,l,m) when (i,j,k,l,m) = (i,(i+1),(i+2),(i+3),(i+4))
                     || (i,j,k,l,m) = (1,10,11,12,13)
                        -> print_endline "straight"
    | _ -> print_endline "null"
;;

let () =
    let rec read () =
        try let line = Scanf.scanf " %d,%d,%d,%d,%d\n" (fun v w x y z -> [|v;w;x;y;z|]) in
        Array.sort compare line;
        hand line;
        read ()
        with End_of_file -> ()
    in read ()
;;

Measured memory_bytes: 2240
n,m=map(int,input().split())
l=list(map(int,input().split()))
tmp=[0]*n

for i in range(m):
    a,b=map(int,input().split())
    if l[a-1] > l[b-1]:
        tmp[b-1]=-1
    if l[a-1] < l[b-1]:
        tmp[a-1]=-1
    if l[a-1] == l[b-1]:
        tmp[b-1]=-1
        tmp[a-1]=-1

print(tmp.count(0))

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

#define ll long long
#define ld long double
#define pi 3.14159265359

int main(){
    int N, M; cin >> N >> M;
    vector<int> s(M);
    vector<char> c(M);
    for (int i = 0; i < M; i++) {
        cin >> s.at(i) >> c.at(i);
    }
    int ans = -1;
    for (int i = 0; i < pow(10, N); i++) {
        string I = to_string(i);
        bool J = true;
        if (I.size() == N) {
            for (int j = 0; j < M; j++) {
                if (I.at(s.at(j) - 1) != c.at(j)) {
                    J = false;
                    break;
                }
            }
        }
        else {
            continue;
        }
        if (J) {
            ans = i;
            break;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

#define MAX 200000
#define INF 2000000000
typedef long long LO;
int L[MAX/2+2],R[MAX/2+2];

LO merge(int A[],int n,int left,int mid,int right){
  int i,j,k;
  int n1=mid-left,n2=right-mid;
  LO cnt=0;
  for(i=0;i<n1;i++)L[i]=A[left+i];
  for(i=0;i<n2;i++)R[i]=A[mid+i];
  L[n1]=R[n2]=INF;
  i=j=0;
  for(k=left;k<right;k++){
    if(L[i]<=R[j])A[k]=L[i++];
    else {
      A[k]=R[j++];
      cnt+=n1-i;
    }
  }
  return cnt;
}

LO mergeSort(int A[],int n,int left,int right){
  int mid;
  LO k1,k2,k3;
  if(left<right-1){
    mid=(left+right)/2;
    k1=mergeSort(A,n,left,mid);
    k2=mergeSort(A,n,mid,right);
    k3=merge(A,n,left,mid,right);
    return k1+k2+k3;
  }else return 0;

}

int main(){
  int A[MAX],n,i;
  
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&A[i]);

  printf("%lld\n",mergeSort(A,n,0,n));

  return 0;
}

Measured memory_bytes: 2160
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,ll> pll;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

    int main(){
      int n,a,b;
      cin >> n >> a >> b;
      int p[n];
      rep(i,n)cin >> p[i];
      int c[3]={};
      rep(i,n){
       if(p[i]<=a)c[0]++;
        else if(a<p[i] && p[i]<=b)c[1]++;
        else c[2]++;
      }
      sort(c,c+3);
      cout << c[0] << endl;
      return 0;}

Measured memory_bytes: 256
//#define DEB1 //input from input.txt
//#define NDEBUG
#include <iostream>
#include <algorithm>
#include <string>
#include <fstream>
#include <vector>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <thread>
#include <mutex>
#include <iomanip>
#include <cassert>

#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define INF(a) memset(a, 0x3f, sizeof(a))
#define ALL(t) (t).begin(),(t).end()
#define FILL(a,c) fill(a, a+ sizeof(a)/sizeof(*a),c)
#define FILL2D(A,c) fill(A[0], A[0] +sizeof(A)/sizeof(**A),c)
#define FILL3D(A,c) fill(A[0][0], A[0][0] +sizeof(A)/sizeof(***A),c)
#define REP(i,m) for(int i=0;i<(m);++i)
// closed interval, inverse repeat
#define CIREP(i,start,fin) for(int i=(start);i>=(fin);i--)
#define CREP(i,start,fin) for(int i=(start);i<=(fin);i++)
#define RNG(i,start,fin) for(int i=(start);i<(fin);i++)
#define IN(a, x, b) (a<=x && x<b)
#define PB push_back
#define SZ(x) (int)(x).size()

using namespace std;

using LL = long long;
using PAIR = pair<int, int>;
using PAIRLL = pair<LL,LL>;
using VI = vector<int>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VVI = vector<VI>;
const LL LINF = 1001002003004005006ll;
/* 
template<typename T>inline istream& operator>>(istream&i,vector<T>&v)
{REP(j,SZ(v))i>>v[j];return i;}

template<typename T>string join(const vector<T>&v)
{stringstream s;REP(i,SZ(v))s<<' '<<v[i];return s.str().substr(1);}

template<typename T>inline ostream& operator<<(ostream&o,const vector<T>&v)
{if(SZ(v))o<<join(v);return o;}
*/

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




/*
constant values
*/

//const int dx[] = {1,0,-1,0};
//const int dy[] = {0,1,0,-1};
//const int MX = 31001;

//const ll INF= 1LL<<60 ;//INF = 1001001001001; //1e9


// Main program
void solve(){
    int N;
    vector<pair<LL, LL> > pairs;
    cin >> N;
    LL x,r;
    REP(i,N){
        cin >> x >> r;
        pairs.PB(make_pair(x-r,x+r));
    }
    sort(pairs.begin(), pairs.end());

    REP(i,N){
        cerr << pairs[i].first << " " <<  pairs[i].second << endl;
    }

    int ans=1;
    LL L,R;
    L = pairs[0].first;
    R = pairs[0].second;
    CREP(i,1,N-1){
        LL a,b;
        a = pairs[i].first;
        b = pairs[i].second;
        // add new robot
        if(a >= R){
            ++ans;
            R = b;
            continue;
        }
        //change R to back;
        if(b <= R){
            R = b;
            continue;
        }
    }
    cout << ans << endl;

    return;

}



// ----------------------------------------------
int main(){

#ifdef DEB1
    cout << "DEBUG MODE"  << endl;
    ifstream in("input.txt"); //for debug
    cin.rdbuf(in.rdbuf()); //for debug
#endif

    int T=1; 

    for (int i = 0; i < T; ++i) {
        solve();
    }

    return 0;
}

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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double dd;
#define all(v) v.begin(),v.end()
#define endl "\n"
#define clr(n, r) memset(n,r,sizeof(n));

void fast() {

    cin.tie(0);
    cin.sync_with_stdio(0);
}







int main() {
    fast();
    int a,b,c,d;cin>>a>>b>>c>>d;
    cout<<max(a*b,c*d);
}

Measured memory_bytes: 256
if __name__ == '__main__':
    N = int(input())
    H = [int(n) for n in input().split()]
    nums = H[::-1]
    ret = 'Yes'
    for idx, n in enumerate(nums[1:]):
        if n >= nums[idx] + 2:
            ret = 'No'
        elif n == nums[idx] + 1:
            nums[idx + 1] -= 1
    print(ret)

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

using namespace std;

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("-ffloat-store")

#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define endl "\n"

#define sz(a) ((int)(a).size())
#define all(v) (v).begin(), (v).end()
#define tr(c, it) for (auto(it) = (c).begin(); (it) != (c).end(); it++)
#define pres(c, val) ((c).find(val) != (c).end())      //
#define cpres(c, val) (find(all(c), val) != (c).end()) //

#define pb push_back
#define mp make_pair
#define F first
#define S second

#define forf(i, a, b) for (int i = (a); i < (b); i++)
#define forb(i, a, b) for (int i = (b); i >= (a); i--)
#define fo(i, n) forf(i, 0, n)
#define fob(i, n) forb(i, 0, n - 1)

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair<int, int>> vpii;

const int INF = 9e18;
// const int N = 1e9 + 7;
const int N = 998244353;

const auto start_time = std::chrono::high_resolution_clock::now();

void zark() {
  #ifdef ZARK
  auto end_time = std::chrono::high_resolution_clock::now();
  std::chrono::duration<double> diff = end_time - start_time;
  cerr << "Time Taken : " << diff.count() << "s\n";
  #endif
}

#ifdef ZARK
#include "/home/aranjan/Desktop/CP/header.h"
#else
#define dbg(args...)
#endif

/* ------------------ Actual Coding Starts ------------------ */

void solve() {
  int k,a,b;
  cin>>k>>a>>b;
  if((a/k)*k == a || (a/k)*k+k <= b) cout <<"OK\n";
  else cout << "NG\n";
}

int32_t main() {
  fastio;
  #ifdef ZARK
  freopen("input.in", "r", stdin);
  #endif

  // freopen("txt.in", "r", stdin);
  // freopen("txt.out", "w", stdout);
  // cout << fixed << setprecision(35);

  solve();
  zark();
  return 0;
}


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

#define ONLINE_JUDGE
#define ll long long
#define PI 3.14159265359
#define fore(i, l, r) for(int i = int(l); i < int(r); ++i)
#define pb(a) push_back(a)

//////////// Solution /////////////////////////////////

void solve() {
	int n,a,b,c;
	cin >> n >> a >> b >> c;
	int l[10];
	for (int i = 0; i < n; ++i) {
		cin >> l[i];
	}
	int ans = 1e9;
	for (int maska = 1; maska < (1<<n); ++maska) {
		for (int maskb = 1; maskb < (1<<n); ++maskb) {
			for (int maskc = 1; maskc < (1<<n); ++maskc) {
				bool fl = true;
				//cout << "###: " << bitset<10>(maska) << ' ' << bitset<10>(maskb) << ' ' << bitset<10>(maskc) << '\n';
				for (int i = 0; i < n; ++i) {
				/*	cout << (maska & (1<<i)) << ' ' << (maskb & (1<<i)) << ' ' << (maskc & (1<<i)) << '\n';
					cout << ( ((maska & (1<<i)) != 0) + ((maskb & (1<<i)) != 0) + ((maskc & (1<<i)) != 0) ) << '\n';
					cout << '\n';*/
					if (( ((maska & (1<<i)) != 0) + ((maskb & (1<<i)) != 0) + ((maskc & (1<<i)) != 0) ) > 1) {
						fl = false;
						break;
					}
				}
				if (!fl) 
					continue;
				int la = 0, lb = 0, lc = 0, m = 0;
				for (int i = 0; i < n; ++i) {
					if (maska & (1<<i)) {
						la += l[i];
						m += 10;
					}
					if (maskb & (1<<i)) {
						lb += l[i];
						m += 10;
					}
					if (maskc & (1<<i)) {
						lc += l[i];
						m += 10;
					}
				}
				m -= 30;
				m += abs(a-la) + abs(b-lb) + abs(c-lc);
				ans = min(ans,m);
			}
		}
	}

	cout << ans << '\n';	
}	

/////////// End Solution ///////////////////////////////////////

//////// Initialization ////////////////////////////////////

int main() {

	#ifndef ONLINE_JUDGE
	FILE *FIN = freopen("/home/danil/prog/input.txt", "r", stdin);
	clock_t time_start = clock();
	#endif

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

	solve();

	#ifndef ONLINE_JUDGE
	fclose(FIN);
	cerr << "\x1b[031m\n-----------------\nTime=" << (ll)((double)(clock()-time_start) / CLOCKS_PER_SEC * 1000) << "ms\n\x1b[0m";
	#endif

	return 0;
}

//////// End Initialization ///////////////////////////////////////

Measured memory_bytes: 256
//include
//------------------------------------------
#include <bits/stdc++.h>
using namespace std;
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
// chmax chmin
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; }

#define INF (ll) 1000000007

int main() {

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

    if(N == 2) cout << 2*B[0] << endl;
    else{
        int A[N], ans=B[0];
        FOR(i,1,N-1) ans += min(B[i], B[i-1]);
        ans += B[N-2];
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 256