akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <iostream>
#include <cmath>
#include <ctype.h>
#include <string> 
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
  
using namespace std;

int n, l;
int tunnel[101][2];
// tunnel[i][0]????????????i???????????¨???????????????????????????????????¨????????¢????????????

void solve()
{
    int leftnum = 0, t = 0;
    while(1){
        t++;
        // ???????????????????????????
        if(tunnel[l - 1][1] != 0){
            leftnum++;
            if(leftnum == n){
                cout << t << " " << tunnel[l - 1][1] << endl;
                return;
            }
            tunnel[l - 1][1] = 0;
        }
        for(int i = l - 2; i > 0; i--){
            tunnel[i + 1][1] = tunnel[i][1];
            tunnel[i][1] = 0;
        }
        // ???????????????????????????
        if(tunnel[1][0] != 0){
            leftnum++;
            if(leftnum == n){
                cout << t << " " << tunnel[1][0] << endl;
                return;
            }
            tunnel[1][0] = 0;
        }
        for(int i = 2; i < l; i++){
            if(tunnel[i][0] == 0) continue;
            if(tunnel[i - 1][1] != 0){
                tunnel[i - 1][0] = tunnel[i - 1][1];
                tunnel[i - 1][1] = tunnel[i][0];
            } else {
                tunnel[i - 1][0] = tunnel[i][0];
            }
            tunnel[i][0] = 0;
        }
    }
    return;
}

int main()
{
    while(1){
        cin >> n >> l;
        if(n == 0 && l == 0) break;
        for(int i = 0; i < l; i++){
            for(int j = 0; j < 2; j++){
                tunnel[i][j] = 0;
            }
        }
        char d;
        int p;
        for(int i = 0; i < n; i++){
            cin >> d >> p;
            if(d == 'L') tunnel[p][0] = i + 1;
            else tunnel[p][1] = i + 1;
        }
        solve();
    }
    return 0;
}

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

int main()
{
  int a,b,c;
  cin>>a>>b>>c;
  if((a==5 && (b==5 && c==7)) || (a==5 && b==7 && c==5)){
    cout<<"YES"<<endl;
  }
  else if(a==7 && b==5 && c==5){
    cout<<"YES"<<endl;
  }
  else cout<<"NO"<<endl;
}


Measured memory_bytes: 256
# https://atcoder.jp/contests/abc104/tasks/abc104_d
# in
# ????C?????B??????A???????
# out
# 979596887
# in
# ABCBC
# 3

MOD = (10**9) + 7
str = gets.chomp
dp_a = 0
dp_ab = 0
dp_abc = 0

dp_none = 1

a = 'A'
b = 'B'
c = 'C'
str.chars do |s|
  if s == a
    dp_a = (dp_a + dp_none)%MOD
  elsif s == b
    dp_ab = (dp_ab + dp_a)%MOD
  elsif s == c
    dp_abc = (dp_abc + dp_ab)%MOD
  else
    dp_abc = (dp_abc * 3 + dp_ab)%MOD
    dp_ab = (dp_ab * 3 + dp_a)%MOD
    dp_a = (dp_a * 3 + dp_none)%MOD
    dp_none = (dp_none * 3)%MOD
  end
end

p dp_abc

Measured memory_bytes: 2044
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
using namespace std;

int main()
{
  //入力
  int N=0;
  int T=0, A=0;
  vector<int> H;
  cin>>N;
  cin>>T>>A;
  for(int i=0; i<N; i++)
  {
    int push;
    cin>>push;
    H.push_back(push);
  }
  
  //各地点の気温の計算
  vector<double> TH;
  for(int i=0; i<H.size(); i++)
  {
    TH.push_back(T - 0.006*H[i]);
  }
  
  //A度にもっとも対称に近い地点の探索
  double tempT=fabs(TH[0]-A);
  int tempH=0;
  for(int i=1; i<TH.size(); i++)
  {
    if(fabs(TH[i]-A)<tempT)
    {
      tempT = fabs(TH[i]-A);
      tempH = i;
    }
  }
  
  //出力
  cout<<tempH+1<<endl;
  
  return 0;
}

Measured memory_bytes: 256
#! 

N = int(input())
AB = list(map(int, input().split(" ")))
P = list(map(int, input().split(" ")))

Pa = []
Pb = []
Pc = []

for i in range(N):
    Pi = P[i]
    if Pi <= AB[0]:
        Pa.append(Pi)
    elif Pi <= AB[1]:
        Pb.append(Pi)
    else:
        Pc.append(Pi)
        
temp = min(len(Pa),len(Pb))
ans = min(temp,len(Pc))

print(ans)

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

int main() {
  string s; cin >> s;
  for (int i = 1; i < s.size(); i++) {
    if (s[i-1] == 'B' && s[i] == 'C') s.replace(i-1, 2, "D");
  }
  ll ans = 0;
  ll countA = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'A' || s[i] == 'D') {
      if (s[i] == 'A') countA++;
      else ans += countA;
    } else countA = 0;
  }
  
  cout << ans << endl;     
}

Measured memory_bytes: 640
/*input
3 1
ABC
*/
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#include <bits/stdc++.h>
typedef long double ld;
typedef long long ll;
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	int n, k;
	string s;
	cin >> n >> k >> s;
	s[k - 1] = tolower(s[k - 1]);
	cout << s << "\n";
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<functional>
#include<math.h>

#define rep(i,n) for(ll i=0;i<(n);i++)
typedef long long ll;
using namespace std;

int main() {
	int n, x;
	cin >> n >> x;
	vector<int> l(n);
	rep(i, n) cin >> l[i];

	int ans = 1;
	int dis = 0;
	rep(i, n) {
		dis += l[i];
		if (dis <= x) ans++;
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    string S;
    cin >> S;
        int S1=0;
        int S2=0;
        for(int i=0;i<S.length();i++){
            if((S[i]-'0')!=(i%2))S1++;
            else if((S[i]-'0')!=((i+1)%2))S2++;
        }
        cout << min(S1,S2) << endl;
}

Measured memory_bytes: 512
def dfs( graph, u, visited )
	if visited[u] then
		return 0
	end

	visited[u] = true

	res = 1
	graph[u].each do |v|
		res += dfs( graph, v, visited )
	end

	return res
end

def solve( n, es, rem )
	m = es.size

	graph = Array.new( n ) do
		Array.new
	end


	m.times do |i|
		if i == rem then
			next
		end

		u, v = es[i]
		graph[u] << v
		graph[v] << u
	end


	visited = Array.new( N )
	return dfs( graph, 0, visited ) == N ? 0 : 1
end

N, M = gets.split.map( &:to_i )
E = Array.new( M ) do
	gets.split.map( &:to_i ).map( &:pred )
end

res = 0
M.times do |i|
	res += solve( N, E.dup, i )
end

puts res


Measured memory_bytes: 1916
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  int n,k;
  cin >> n >> k;
  k=min(n,k);
  vector<int>h(n);
  
  for(int i=0;i<n;i++) {
    cin >> h.at(i);}
  sort(h.begin(),h.end());
  
  ll sum=0;
  for(int i=0;i<n-k;i++) {
    sum+=h.at(i);}
   
  cout << sum << endl;
  return 0;
  }

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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

const int64 mod = 1e9+7;

int main(void){
	string s;
	cin >> s;
	int32 len = s.size(), lk = 7;
	REP(i, s.size()){
		if(i+len-lk >= s.size()) break;
		if(s.substr(0, i)+s.substr(i+len-lk, 7-i) == "keyence"){
			cout << "YES" << endl;
			return 0;
		}
	}
	cout << "NO" << endl;
}


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

int main() {
	char x, y;
	cin >> x >> y;
	string ans;
	if (x < y)  ans = "<";
	if (x == y)  ans = "=";
	if (x > y)  ans = ">";
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3596
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int r = sc.nextInt();
		if (n <= 9) {
			System.out.println(r + 100 * (10 - n));
		} else {
			System.out.println(r);
		}
		
	}
}




Measured memory_bytes: 21460
//by yjz
#include<bits/stdc++.h>
using namespace std;
#define FF first
#define SS second
#define PB push_back
#define MP make_pair
#define bged(v) (v).begin(),(v).end()
#define foreach(it,s) for(__typeof((s).begin()) it=(s).begin();it!=(s).end();it++)
typedef long long ll;
const int Imx=2147483647;
const ll Lbig=2e18;
const int mod=1e9+7;
//My i/o stream
struct fastio
{
	char s[100000];
	int it,len;
	fastio(){it=len=0;}
	inline char get()
	{
		if(it<len)return s[it++];it=0;
		len=fread(s,1,100000,stdin);
		if(len==0)return EOF;else return s[it++];
	}
	bool notend()
	{
		char c=get();
		while(c==' '||c=='\n')c=get();
		if(it>0)it--;
		return c!=EOF;
	}
}_buff;
#define geti(x) x=getnum()
#define getii(x,y) geti(x),geti(y)
#define getiii(x,y,z) getii(x,y),geti(z)
#define puti(x) putnum(x),putchar(' ')
#define putii(x,y) puti(x),puti(y)
#define putiii(x,y,z) putii(x,y),puti(z)
#define putsi(x) putnum(x),putchar('\n')
#define putsii(x,y) puti(x),putsi(y)
#define putsiii(x,y,z) putii(x,y),putsi(z)
inline ll getnum()
{
	ll r=0;bool ng=0;char c;c=_buff.get();
	while(c!='-'&&(c<'0'||c>'9'))c=_buff.get();
	if(c=='-')ng=1,c=_buff.get();
	while(c>='0'&&c<='9')r=r*10+c-'0',c=_buff.get();
	return ng?-r:r;
}
template<class T> inline void putnum(T x)
{
	if(x<0)putchar('-'),x=-x;
	register short a[20]={},sz=0;
	while(x)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1;i>=0;i--)putchar('0'+a[i]);
}
inline char getreal(){char c=_buff.get();while(c==' '||c=='\n')c=_buff.get();return c;}
int n,a[100111];
bool solve()
{
	ll sum=0;
	bool has1=0;
	int cnt1=0;
	for(int i=1;i<=n;i++)
	{
		sum+=a[i]-1;
		if(a[i]==1)has1=1;
		if(a[i]&1)cnt1++;
	}
	if(has1)return sum%2;
	if((n-cnt1)%2==1)return 1;
	if(cnt1==1)
	{
		int g=0;
		for(int i=1;i<=n;i++)
		{
			if(a[i]&1)a[i]--;
			g=__gcd(g,a[i]);
		}
		for(int i=1;i<=n;i++)a[i]/=g;
		return solve()^1;
	}
	return 0;
}
int main()
{
	geti(n);
	for(int i=1;i<=n;i++)
	{
		geti(a[i]);
	}
	if(solve())puts("First");else puts("Second");
	return 0;
}

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

using namespace std;

int main()
{
    long long n, k;
    cin >> n >> k;
    long long cont=0, aux=1;
    while(aux<k&&cont<n)
    {
        aux=2*aux;
        cont++;
    }
    while(cont<n)
    {
        aux=aux+k;
        cont++;
    }
    cout << aux << endl;
    return 0;
}

Measured memory_bytes: 256
mod io{
    use std::io::*;
    pub fn read<T: ::std::str::FromStr>()->T{
        let stdin=stdin();
        let ret=stdin.lock().bytes().map(|c|c.unwrap()as char)
        .skip_while(|c|c.is_whitespace())
        .take_while(|c|!c.is_whitespace())
        .collect::<String>().parse().ok().unwrap();
        ret
    }
}
use io::read;
fn main(){
    let n=read::<i32>();
    let mut a=vec!();
    for _ in 0..n{a.push(read::<i32>());}
    a.sort();
    let mut ans=0;
    for i in a{ans=i-ans}
    println!("{}",ans);
}


Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cstdint>
#include <unordered_map>
#include <sstream>
#include <boost/multiprecision/cpp_int.hpp>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define pb push_back
#define pf push_front

namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll M = 1000000007;

typedef pair<int, int> P;

bool ps1(const P &element1, const P &element2)
{ //first昇順
	return element1.first < element2.first;
}
bool ps2(const P &element1, const P &element2)
{ //first降順
	return element1.first > element2.first;
}
bool ps3(const P &element1, const P &element2)
{ //second昇順
	return element1.second < element2.second;
}
bool ps4(const P &element1, const P &element2)
{ //second降順
	return element1.second > element2.second;
}
int digits(int n)
{
	int count = 0;
	while (n > 0)
	{
		n /= 10;
		count++;
	}
	return count;
}
ll combination(ll n, ll r)
{
	if (r * 2 > n)
		r = n - r;
	ll dividend = 1;
	ll divisor = 1;
	for (ll i = 1; i <= r; ++i)
	{
		dividend *= (n - i + 1);
		divisor *= i;
	}
	return dividend / divisor;
}
int GCD(int x, int y)
{
	return x ? GCD(y % x, x) : y;
}
vector<int> divisor(int n)
{
	vector<int> value;
	FOR(i, 1, pow(n, 0.5) + 1)
	{
		if (i <= sqrt(n))
		{
			if (n % i == 0)
			{
				value.push_back(i);
				if (i * i != n)
				{
					value.push_back(n / i);
				}
			}
		}
	}
	return value;
}
int main()
{
	int n, h;
	cin >> n >> h;
	vector<pair<int, int>> ab(n);
	ll sum = 0;
	rep(i, n)
	{
		cin >> ab[i].F >> ab[i].S;
	}
	sort(all(ab), ps4);
	/*rep(i,n){
		cout<<ab[i].F<<" S "<<ab[i].S<<endl;
	}*/
	stable_sort(all(ab), ps2);
	/*rep(i,n){
		cout<<ab[i].F<<" S "<<ab[i].S<<endl;
	}*/
	rep(i, n)
	{
		if (ab[i].S < ab[0].F)
		{
			ab[i].S = ab[0].F;
		}
	}

	rep(i, n)
	{
		sum += ab[i].S;
	}
	sum = max(sum, (ll)ab[0].F * n);
		//cout << sum << endl;

	if (sum < h)
	{
		int cnt = 1;
		int damage = ab[0].S;
		int tmp = h - sum;
		int c = tmp / ab[0].F;

		if (tmp > c * ab[0].F)
		{
			c++;
		}
		//cout << c << endl;
		cnt += c + n - 1;
		cout << cnt << endl;
	}
	else
	{
		
		int cnt = 0;
		int damage = 0;
		//cout<<damage<<endl;
		/*rep(i,n){
		cout<<ab[i].F<<" S "<<ab[i].S<<endl;
	    }*/
		sort(all(ab),ps4);
		rep(i, n)
		{
			if (damage >= h)
			{
				//cout<<i<<endl;
				break;
			}
			damage += ab[i].S;
			cnt++;
			//cout<<damage<<" "<<cnt<<endl;
		}
		cout << cnt << endl;
	}
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
//F6編譯，右上三角形執行，ctrl+c強制停止執行  F5開啟exe
#define ll long long
#define maxn 300005
#define mod 1000000007
using namespace std;

typedef pair<int, int> P;

int n, K;
ll dp[55][55][5005];

int main()
{
    cin >> n >> K;
    if (K % 2 != 0)
    {
        printf("0\n");
        return 0;
    }
    dp[0][0][0] = 1;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j <= i; j++)
        {
            for (int k = 0; k <= n * n; k++)
            {
                dp[i + 1][j][k + j] = (dp[i + 1][j][k + j] + dp[i][j][k]) % mod;
                dp[i + 1][j + 1][k + j + 1] = (dp[i + 1][j + 1][k + j + 1] + dp[i][j][k]) % mod;
                dp[i + 1][j][k + j] = (dp[i + 1][j][k + j] + dp[i][j][k] * 2 * j) % mod;
                if (j > 0)
                    dp[i + 1][j - 1][k + j - 1] = (dp[i + 1][j - 1][k + j - 1] + dp[i][j][k] * j * j) % mod;
            }
        }
    }
    printf("%lld", dp[n][0][K / 2]);

    return 0;
}


Measured memory_bytes: 108800
import itertools
def II(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
ans=0
N=II()
L=LI()
c = itertools.combinations(L, 3)
for v in itertools.combinations(L, 3):
    v=list(v)
    v.sort()
    if v[0]==v[1] or v[1]==v[2]:
      continue
    if v[0]+v[1]>v[2]:
      ans+=1
print(ans)

Measured memory_bytes: 9084
#include <iostream>
#include <stdio.h>
#include <cctype>
#include <algorithm>

using namespace std;

int main() {
	int counter[26];
	for(int i = 0; i < 26; i++)counter[i] = 0;
	char ch;
	while (cin >> ch) {
		int num = tolower(ch) - 'a';
		counter[num]++;
	}
	for (int i = 0; i < 26; i++) printf("%c%s%d\n", 'a' + i, " : ", counter[i]);
}


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

#define vi vector<int>
#define vvi vector<vector<int>>
#define vpii vector<pair<int, int>>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pii pair<int, int>
#define int long long int
#define inf INT_MAX
#define _inf INT_MIN
#define whilet int t;cin>>t;while(t--)
const int N = 100005;


string lca(string s, string t) {

	int m = t.size();
	int n = s.size();

	int dp[m + 1][n + 1];

	for (int i = 0; i <= m; i++) dp[i][0] = 0;
	for (int j = 0; j <= n; j++) dp[0][j] = 0;

	for (int i = 1; i <= m; i++) {
		for (int j = 1; j <= n; j++) {
			if (s[j - 1] == t[i - 1]) dp[i][j] = dp[i - 1][j - 1] + 1;
			else dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
		}
	}

	string res = "";
	int i = m, j = n;

	while (i > 0 and j > 0) {
		if (t[i - 1] == s[j - 1]) {
			res += t[i - 1];
			i--; j--; continue;
		} else {
			if (dp[i - 1][j] > dp[i][j - 1] ) i--;
			else j--;
		}
	}
	reverse(res.begin(), res.end());
	return res;
}


void solve() {

	string s, t;
	cin >> s >> t;
	cout << lca(s, t);
}

void init() {
	ios_base:: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("../input.txt", "r", stdin);
	freopen("../output.txt", "w", stdout);
#endif
}


int32_t main()
{
	init();
	// whilet solve();
	solve();
}

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

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

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

	for(int i=0; i<n; i++)
		cout << a[i] << endl;
}

Measured memory_bytes: 4372
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>

using namespace std;
typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, f, n) for (ll i = (f); i < (n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define repv(v) for (auto it = (v).begin(); it != (v).end(); it++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define INIT    \
    cin.tie(0); \
    ios::sync_with_stdio(false);

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

ll const INF = 1LL << 60;
ll const MOD = 1000000007;

int main() {
    INIT;

    ll X, N;
    cin >> X >> N;

    vector<ll> p(N);
    rep(i, N) cin >> p[i];

    vector<ll> cnt(105, 0);
    rep(i, N) { cnt[p[i]]++; }

    ll ans = INF;
    ll idx = -1;
    reps(i, 0, 102) {
        if (cnt[i] != 0) continue;

        if (ans > abs(X - i)) {
            ans = abs(X - i);
            idx = i;
        }
    }

    cout << idx << endl;

    return 0;
}

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

int main() {
	int N,s=0,p=0;
	cin >> N;
	vector<int> A(N+1),s1(N+1),s2(N+1);

	rep(i,N) {
		cin >> A.at(i);
		s1.at(i+1) = s1.at(i)+abs(p-A.at(i));
		p = A.at(i);
	}
	A.at(N) = 0;

	p = 0;
	rep(i,N)
		s2.at(N-i-1) = s2.at(N-i)+abs(A.at(N-i)-A.at(N-i-1));

	p = 0;
	rep(i,N) {
		cout << s1.at(i)+s2.at(i+1)+abs(p-A.at(i+1)) << endl;
		p = A.at(i);
	}
}

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

int main() {
	int d;
  	cin >> d;
  if(d == 22){
    cout << "Christmas Eve Eve Eve" << endl;
  }else if(d == 23){
    cout << "Christmas Eve Eve" << endl;
  }else if(d == 24){
    cout << "Christmas Eve" << endl;
  }else if(d == 25){
    cout << "Christmas" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<math.h>
using namespace std;
typedef long long ll;
bool isPrime(ll n){
  for(ll i=2;i*i<=n;i++) if(n%i==0) return false;
  return true;
}
int main(){
  ll ans = 2;
  ll n;
  vector<ll> p;
  vector<ll> v;
  for(ll i=2;i<1000000;i++) if(isPrime(i)) p.push_back(i);
  //cout << p.size() << endl;
  while(1){
    ans=2;
    v.clear();
    cin >> n;
    if(n == 0)break;
    if(n==1) {
      cout << 1 << endl;
      continue;
    }
    //cout << n << endl;
    for(ll i = 0;p[i] <= n;i++){
      //cout << i << n << endl;
      if(i==p.size()) break;
      if(n%p[i] == 0){
        ll c=0;
        while(n%p[i]==0) {
          n/=p[i];
          c++;
        }
        //cout << p[i] << ":" << c << endl;
        v.push_back(c);
	
	if(n==1) break;
      }
       
    }
    if(n!=1) v.push_back(1);
    ll m = 0;
    ans = 1;
    for(ll i=0;i<v.size();i++){
      ans*=2*v[i]+1;
    }
    cout << (1+ans)/2 <<endl;
  }
  return 0;
}

Measured memory_bytes: 1988
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<(n);++i)
#define rep2(i,a,b) for (ll i=(a);i<(b);++i)
#define debug(x) cout << #x << '=' << x << endl
#define all(v) (v).begin(),(v).end()
const ll MOD=1e9+7;
//const ll MOD=998244353;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-1);

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

template<typename T,bool directed>
struct Dinic{
    struct edge{
        int to,rev; T cap;
        edge(int to,T cap,int rev):to(to),cap(cap),rev(rev){}
    };
    vector<vector<edge>> G;
    vector<int> level,iter;
    Dinic(int n):G(n),level(n),iter(n){}
    int add_edge(int from,int to,T cap){
        G[from].emplace_back(to,cap,G[to].size());
        G[to].emplace_back(from,directed?0:cap,G[from].size()-1);
        return G[to].back().rev;
    }
    void bfs(int s){
        fill(level.begin(),level.end(),-1);
        queue<int> que;
        level[s]=0;
        que.emplace(s);
        while(!que.empty()){
            int v=que.front(); que.pop();
            for (auto &e:G[v]){
                if (e.cap>0&&level[e.to]<0){
                    level[e.to]=level[v]+1;
                    que.emplace(e.to);
                }
            }
        }
    }
    T dfs(int v,int t,T f){
        if (v==t) return f;
        for (int &i=iter[v];i<G[v].size();++i){
            edge &e=G[v][i];
            if (e.cap>0&&level[v]<level[e.to]){
                T d=dfs(e.to,t,min(f,e.cap));
                if (d==0) continue;
                e.cap-=d;
                G[e.to][e.rev].cap+=d;
                return d;
            }
        }
        return 0;
    }
    T max_flow(int s,int t,T lim){
        T flow=0;
        while(1){
            bfs(s);
            if (level[t]<0||lim==0) break;
            fill(iter.begin(),iter.end(),0);
            while(1){
                T f=dfs(s,t,lim);
                if (f==0) break;
                flow+=f;
                lim-=f;
            }
        }
        return flow;
    }
    T max_flow(int s,int t){
        return max_flow(s,t,numeric_limits<T>::max()/2);
    }
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    vector<ll> a(N);
    ll ans=0;
    rep(i,N) cin >> a[i],ans+=a[i];
    Dinic<ll,true> D(N+2);
    rep(i,N){
        ll b=min(0LL,a[i]);
        D.add_edge(0,i+1,a[i]-b);
        D.add_edge(i+1,N+1,-b);
        ans-=b;
    }
    rep(i,N) for (int j=2*(i+1);j<=N;j+=i+1){
        D.add_edge(j,i+1,IINF);
    }
    ans-=D.max_flow(0,N+1);
    cout << ans << endl;
}

Measured memory_bytes: 256
import sys

def nextrec(coor,pt):
    if pt[2]==1:
        coor[0]=min(max(coor[0],pt[0]),coor[2])
    elif pt[2]==2:
        coor[2]=max(min(coor[2],pt[0]),coor[0])
    elif pt[2]==3:
        coor[1]=min(max(coor[1],pt[1]),coor[3])
    elif pt[2]==4:
        coor[3]=max(min(coor[3],pt[1]),coor[1])
def main(w,h,n,pts):
    rec=[0,0,w,h]
    for x in range(n):
        nextrec(rec,pts[x])
    return (rec[0]-rec[2])*(rec[1]-rec[3])

w,h,n=map(int,sys.stdin.readline().strip().split())
pts=[list(map(int,sys.stdin.readline().strip().split())) \
    for x in range(n)]

print(main(w,h,n,pts))


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

using namespace std;

int main() {
    int n;
    string a, b, c;
    cin >> n;
    cin >> a >> b >> c;

    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] == b[i] && b[i] == c[i]) continue;
        if (a[i] == b[i] || a[i] == c[i] || b[i] == c[i]) ans++;
        else ans += 2;
    }
    cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>

int main(){
    ll N;
    cin >> N;
    ll ans=0;
    for(ll i=sqrt(N)+1; i>=1; i--){
        if(i*i<=N){ans=i*i;break;}
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
  int n,m;
  cin >> n >> m;
  vector<int> a(n);
  vector<int> b(n);
  vector<int> c(m);
  vector<int> d(m);
  rep(i,n) cin >> a[i] >> b[i];
  rep(i,m) cin >> c[i] >> d[i];
  rep(i,n){
    int num = 0;
    int ps = 1000000000;
    rep(j,m){
      int s = abs(a[i]-c[j])+abs(b[i]-d[j]);
      if(s < ps){
      	num = j+1;
        ps = s;
      }
  	}
    cout << num << endl;
    ps = 1000000000;
  }
}


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

int main(){
  int a,b;
  cin >> a >> b;
  if(a>12)
    cout << b << endl;
  else if(a>5)
    cout << b/2 << endl;
  else
    cout << 0 << endl;
}

Measured memory_bytes: 764
#include<stdio.h>
int main(void)
{
  int a,b,c,d,i=1;

  scanf("%d",&a);


  for(i=1;i<a+1;i++){
    scanf("%d %d %d", &b, &c, &d);


    if(b<1||b>1000)break;
    if(c<1||c>1000)break;
    if(d<1||d>1000)break;

    if(b*b+c*c==d*d || c*c+d*d==b*b || b*b+d*d==c*c)
{
      printf("YES\n");
    }else{
      printf("NO\n");
    }

  }



  return 0;
}

Measured memory_bytes: 580
#include<bits/stdc++.h>
using namespace std;
const long long mod=1e9+7;
int N;
long long S,T;
int main(){
	cin>>N;
	for(int i=0;i<N;i++){
		long long A;
    	cin>>A;
		S=(S+A*T)%mod;
		T=(T+A)%mod;
	}
	cout<<S<<endl;
  return 0;
}

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

typedef  long long TTYPE;

typedef struct queue{
	TTYPE data;
	struct queue *next;
}Que;

typedef struct head_que{
	Que head;
	Que *last;
	int size;
}HQue;

HQue *create_HQue(){
	HQue *hq;

	if((hq = (HQue *)malloc(sizeof(HQue))) == NULL){
		printf("could not malloc:Que\n");
		return NULL;
	}

	hq->head.data = 0;
	hq->head.next = NULL;
	hq->last = &(hq->head);
	hq->size = 0;

	return hq;
}

int push_Que(HQue *x, TTYPE data){
	Que *p;

	if((p = (Que *)malloc(sizeof(Que))) == NULL){
		printf("could not malloc:Que\n");
		return -1;
	}

	p->data = data;
	p->next = NULL;
	x->last->next = p;
	x->last = p;
	x->size += 1;

	return 0;
}

void pop_Que(HQue *x){
	Que *p;

	if(x->head.next == NULL){
		return;
	}

	p = x->head.next;
	x->head.next = p->next;
	if(x->last == p){
		x->last = &(x->head);
	}
	x->size -= 1;
	free(p);
}

TTYPE access(HQue *x){
	if(x->head.next == NULL){
		printf("error\n");
		return x->head.data;
	}
	return x->head.next->data;
}

int main(){
	int k;
	TTYPE i;
	HQue *p, *q;
	p = create_HQue();
	q = create_HQue();

	scanf("%d", &k);
	for(i=1; i<10; i++){
		push_Que(p, i);
	}

	while(1){
		if(k <= p->size){
			for(i=0; i<k-1; i++){
				pop_Que(p);
			}
			printf("%lld\n", access(p));
			break;
		}
		k -= p->size;

		HQue *tmp = p;
		p = q;
		q = tmp;
		while(q->size != 0){
			TTYPE x = access(q);
			for(i=-1; i<=1; i++){
				TTYPE d = x % 10 + i;
				if(d < 0 || d > 9){
					continue;
				}

				push_Que(p, x*10+d);
			}
			pop_Que(q);
		}
	}

	return 0;
}


Measured memory_bytes: 4224
#pragma comment(linker, "/STACK:102400000,102400000")
#include <bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define SZ(x) (int)(x.size())
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,a,b) for(int i=b-1;i>=a;i--)
#define inf 1000000007
#define mod 1000000007
#define x first
#define y second
#define pi acos(-1.0)
#define DBG(x) cerr<<(#x)<<"="<<x<<"\n";
//#define dprintf(...) 
#define hash _hash
#define next _next
//#define dprintf(...) fprintf(outFile,__VA_ARGS__)
 
#define FOREACH(it,x) for(__typeof(x.begin()) it=x.begin();it!=x.end();it++)
#define ull unsigned long long
#define ll long long
#define N 100010
 
template <class T,class U>inline void Max(T &a,U b){if(a<b)a=b;}
template <class T,class U>inline void Min(T &a,U b){if(a>b)a=b;}
 
//FILE* outFile;
inline void add(int &a,int b){a+=b;while(a>=mod)a-=mod;}


int pow(int a,int b){
    int ans=1;
    while(b){
        if(b&1)ans=ans*(ll)a%mod;
        a=(ll)a*a%mod;b>>=1;
    }
    return ans;
}

int a[N<<1];
int main(){
	int T,i,j,k,ca=0,n,m,K;
	//cout<<setprecision(9)<<fixed;
	scanf("%d%d",&n,&m);
	if(m==1||m==2*n-1)puts("No");
	else{
		puts("Yes");
		int x=n-1;
		a[x]=m;
		a[x-1]=m-1;
		a[x+1]=m+1;
		j=1;
		rep(i,0,2*n-1){
			if(abs(x-i)<=1)continue;
			if(j==m-1)j+=3;
			a[i]=j++;
		}
		rep(i,0,n*2-1)printf("%d\n",a[i]);
		/*
		int sz=0;n=n*2-1;
		while(n>=3){
			sz=0;int b[3];
			rep(i,0,n-2){
				rep(j,0,3)b[j]=a[i+j];
				sort(b,b+3);
				a[sz++]=b[1];
			}
			n=sz;
		}
		DBG(a[0])//*/
	}
	//cerr<<clock()*1./CLOCKS_PER_SEC<<"ms\n";
	return 0;
}

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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;

#define INF INT_MAX/3

#define MAX_N 1000

int main(){
	cin.sync_with_stdio(false);
	int n;
	cin >> n;

	int t[n];
	int total = 0;
	rep(i, n){
		cin >> t[i];
		total += t[i];
	}

	int m;
	cin >> m;
	rep(i, m){
		int p, x;
		cin >> p >> x;
		cout << total - (t[p - 1] - x) << endl;
	}


	return 0;
}

Measured memory_bytes: 256
n = int(input())
a = []
for _ in range(n):
    a.append(list(map(int,input().split())))

d = [[a[i][0]-a[i][1],a[i][0]+a[i][1]] for i in range(n)]

d = sorted(d, key = lambda x: x[1])

b = -100000000000000000
c = 0


for i in range(n):
    if d[i][0] >= b:
        b = d[i][1]
        c = c + 1

print(c)
        
    


Measured memory_bytes: 44520
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include <climits>
#include<fstream>
using namespace std;
///////////////////library zone!!!!!!!!!!!!!!!!!!!!!!!!!!!!
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
const ll Mod = 1000000007;
struct P {
	ll pos, cost;
	bool operator<(const P &b) { return cost < b.cost; }
	bool operator>(const P &b) { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E &b) { return cost < b.cost; }
	bool operator>(const E &b) { return cost > b.cost; }
};
struct H {
	ll x, y;
	bool operator<(const H &b) {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H &b) {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H &b) { return x == b.x&&y == b.y; }
	bool operator!=(const H &b) { return (*this) != b; }
};
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j%i, i);
}
ld mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
signed main() {
	int n;
	int a[20];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a, a + n);
	int sum = 0;
	for (int i = 0; i < n - 1; i++) {
		sum += a[i];
	}
	if (sum > a[n - 1]) cout << "Yes\n";
	else cout << "No\n";
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
long long int dp1[101][4], dp0[101][4];
int main() {

	string n;
	int  k;
	cin >> n;
	cin >> k;
	int i, j;

    dp0[0][0] = 1;
	dp0[0][1] = n[0] - '0' - 1;
	dp1[0][1] = 1;
	for (i = 1; i < n.size(); i++) {
      dp0[i][0] = 1;
      dp1[i][0] = 0;
		for (j = 1; j < 4; j++) {
			dp0[i][j] = dp0[i - 1][j] + dp0[i - 1][j - 1] * 9;
			if (n[i] != '0')dp0[i][j] = dp0[i][j] + dp1[i - 1][j] + dp1[i - 1][j - 1] * (n[i] - '0' - 1);
			if (n[i] == '0') {
				dp1[i][j] = dp1[i - 1][j];
			}
			else {
				dp1[i][j] = dp1[i - 1][j - 1];
			}
		}
	}
  //for(i = 0;i<n.size();i++){
  //  cout << dp0[i][2] << ' ' <<dp0[i][3] << ' ' << dp1[i][3] << endl;
  //}
	//cout << dp0[0][k] + dp1[0][k] << endl;
  //cout << dp0[0][1] << ' ' << dp1[0][1] << ' ' << dp0[1][1] << ' ' << dp1[1][1] << ' ' << dp0[2][1] << ' ' << dp1[2][1] << endl;
	cout << (dp0[n.size() - 1][k] + dp1[n.size() - 1][k]) << endl;
	return 0;

}

Measured memory_bytes: 3572
#include<bits/stdc++.h>
#define int long long
using namespace std;
constexpr int mod=1e9+7;
signed main(){
    int n,k;
    cin>>n>>k;
    int ans=0;
    for(int i=k;i<=n+1;i++)
        ans+=i*(n-i+1)+1;
    cout<<ans%mod<<endl;
}


Measured memory_bytes: 3620
#include"bits/stdc++.h"
//#include<bits/stdc++.h>
using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i,a,b) for(int i=a;i<b;i++)
typedef long long ll;
//const int mod = 1e9 + 7;

bool solve(string s, int i) {
	bool flag=0;
	if (i == s.size()) { return 1; }
	if (!flag&&s.find("dreamer", i) == i) {
		flag = solve(s, i + 7);
	}
	if (!flag && s.find("dream", i) == i) {
		flag = solve(s, i + 5);
	}
	if (!flag && s.find("eraser", i) == i) {
		flag = solve(s, i + 6);
	}
	if (!flag && s.find("erase", i) == i) {
		flag = solve(s, i + 5);
	}
	if (flag)return 1;
	return 0;
}

int main() {
	string s, cp;
	cin >> s;
	bool flag = solve(s,0);
	if (flag) { print("YES"); }
	else { print("NO"); }
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,ans=(1<<10);
  cin >> n;
  int w[n];
  for(int i=0;i<n;i++)cin >> w[i];
  for(int i=0;i<n;i++){
    int s=0,s1=0;
    for(int j=0;j<n;j++){
      if(i>=j)s1+=w[j];
      else s+=w[j];
    }
    ans=min(ans,abs(s1-s));
  }
  cout << ans << endl;
}

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

#define rep(i, n) for(int i=0; i < n; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

using namespace std;
using ll=long long;



int main(){
  int D,G;
  cin >> D >> G;
  vector<int> p(D),c(D);

  rep(i,D) cin >> p[i] >> c[i];

  int ans= 1000;
  rep(tmp,(1<<D)){
    bitset<10> s(tmp);
    //ある完答パターン
    int perfect=0;
    int pnum=0;
    rep(i,D){
      if(s[i]){
        //perfect score at a certain lvl
        perfect += c[i]+p[i]*(i+1)*100;
        pnum += p[i];
      }
    }
    //cout << perfect << ' '<<pnum << '\n';
    //完答しすぎはbreak
    if(perfect>=G){ans=min(ans,pnum);continue;}
    //足りない場合
    reps(i,D){
      if(!s[D-i]){
        reps(j,p[D-i]-1){
          perfect += (D-i+1)*100;
          //cout << perfect << '\n';
          pnum ++;
          if(perfect >= G) goto done;
        }
      }
    }
    if(perfect<G) continue;
    done:
    ans = min(ans,pnum);
    //cout << ans << '\n';
  }
  cout << ans << '\n';
}

Measured memory_bytes: 256
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <memory.h>
#include <cmath>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <ctime>
#include <iostream>
#include <functional>
#include <complex>
#include <stdlib.h>
#include <random>
#pragma comment(linker, "/STACK:836777216")

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<pii, int> p3i;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<p3i> v3i;
typedef vector<vii> vvii;
typedef vector<p3i> vp3i;
typedef long double ld;
typedef vector<ld> vld;

#define pb push_back
#define mp make_pair
#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 sz(v) (int)(v).size()
#define all(v) (v).begin(), (v).end()
#define rv(v) reverse(all(v))
#define CL(v, val) memset((v), (val), sizeof((v)))
#define SORT(a) sort(all(a))
#define un(v) SORT(v), (v).resize(unique(all(v)) - (v).begin())
#define eps 1.0e-9
#define X first
#define Y second
#define bit(n) (1 << (n))
#define bit64(n) (ll(1) << (n))
#define sqr(x) ((x) * (x))

vector<ll> getLastNum(int len, int dig) {
	vector<ll> ans;
	for (int d = dig - 1; d <= dig + 1; d++) {
		if (d < 0 || d >= 10) {
			continue;
		}

		if (len == 1) {
			if (d != 0) 
				ans.pb(d);
		}
		else {
			vector<ll> tmp = getLastNum(len - 1, d);
			REP(j, sz(tmp)) {
				ans.pb(tmp[j] * 10 + d);
			}
		}
	}

	return ans;
}

vector<ll> getNum(int len) {
	vector<ll> ans;
	FOR(i, (len > 1 ? 0 : 1), 10) {
		if (len > 1) {
			vector<ll> tmp = getLastNum(len - 1, i);
			REP(j, sz(tmp)) {
				ans.pb(tmp[j] * 10 + i);
			}
		}
		else {
			ans.pb(i);
		}
	}

	SORT(ans);

	return ans;
}

int main(void) {
	int n;
	scanf("%d", &n);
	int len = 1;
	while (true) {
		vector<ll> ans = getNum(len);
		if (n <= sz(ans)) {
			printf("%lld\n", ans[n - 1]);
			break;
		}

		n -= sz(ans);
		len++;
	}

	scanf("%d", &n);
}

Measured memory_bytes: 2164
import java.util.Arrays;
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];
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(sc.next());
		}
		Arrays.sort(a);
		System.out.println(a[n / 2] - a[n / 2 - 1]);
	}

}


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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'

// n回繰り返し
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順
#define rep1(i,n) for(int i = 1; i <= ((int)(n)); i++) // 1-indexed昇順
#define rrep(i,n) for(int i = ((int)(n)-1); i >= 0; i--)  // 0-indexed降順
#define rrep1(i,n) for(int i = ((int)(n)); i >= 1; i--)   // 1-indexed降順
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii;  // 2次元配列
typedef vector<ll> vll;
typedef vector<double> vd;
typedef pair<int, int> PII;

template<typename T>
using vec = vector<T>;
template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

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

const ld Pi = std::acos(-1.0L);
const ll infll = (1LL<<62)-1;
const int inf = (1<<30)-1;
const int mod = 1000000007;
// const int mod = 998244353;


/*FUNCs=================================================*/
int n, a,b,c;
int table[8+2];
int l[8+2];
int answer = inf;
void dfs(int depth) {
    if(depth == n) {  // 選び終わったら
        int asum = 0, bsum = 0, csum = 0, MP = 0;
        rep(i,n) {  // 全ての竹に対して
            if(table[i] == 0) {
                if(asum != 0) MP += 10;
                asum += l[i];
            }
            else if(table[i] == 1) {
                if(bsum != 0) MP += 10;
                bsum += l[i];
            }
            else if(table[i] == 2) {
                if(csum != 0) MP += 10;
                csum += l[i];
            }
            else continue;
        }
        if(asum==0 || bsum==0 || csum==0) return;  // A,B,Cは最低1つ選ばなければならない
        MP +=  abs(a-asum) + abs(b-bsum) + abs(c-csum);
        chmin(answer, MP);
        return;
    }
    rep(i,4) {  // 各竹に対する選択を行う
        table[depth] = i;
        dfs(depth+1);
    }
//    cout << "depth:" << depth << ". finish" << '\n';
    return;
}

/*MAIN==================================================*/
signed main(){
    int START_TIME = clock();
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化
    // cout << fixed << setprecision(15);

    cin >> n >> a >> b >> c;
    rep(i,n) cin >> l[i];

    /**
     * 各lを、Aに使う、Bに使う、Cに使う、使わない、で全探索
     */
     dfs(0);

     cout << answer << '\n';

    // printf("ExecutionTime: %d /ms\n",1000*(int)((clock()-START_TIME)/CLOCKS_PER_SEC));
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LL long long
#define maxn 200005
using namespace std;
map<int ,int> mp;
int main()
{
    LL x;
    cin>>x;
    LL ans=0;
    ans=(x/500)*1000;
    ans+=((x%500)/5)*5;
    cout<<ans<<endl;
}


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

using namespace std;

template<typename T>
struct ring4 {
    T elem[4];

    ring4() {}

    ring4(T a, T b, T c, T d) {
        elem[0] = a;
        elem[1] = b;
        elem[2] = c;
        elem[3] = d;
    }

    T operator[](int x) {
        return elem[x % 4];
    }

    bool operator==(ring4<T> &r) {
        for (int i = 0; i < 4; ++i)
            if (this->elem[0] == r[i])
                for (int j = 1; j < 4; ++j) {
                    if (this->elem[j] != r[i + j]) break;
                    if (j == 3)return true;
                }
        return false;
    }

    bool operator!=(ring4<T> &r) {
        return !(*this == r);
    }

    int indexOf(T v) {
        for (int i = 0; i < 4; ++i) {
            if (elem[i] == v) return i;
        }
        return -1;
    }
};

template<typename T>
struct dice {
    map<T, ring4<T> > faces;
    T u;
    T s;

    dice() {}
    dice(T f1, T f2, T f3, T f4, T f5, T f6) {
        u = f1;
        s = f2;
        faces[f1] = ring4<T>(f5, f4, f2, f3);
        faces[f2] = ring4<T>(f1, f4, f6, f3);
        faces[f3] = ring4<T>(f1, f2, f6, f5);
        faces[f4] = ring4<T>(f1, f5, f6, f2);
        faces[f5] = ring4<T>(f1, f3, f6, f4);
        faces[f6] = ring4<T>(f2, f4, f5, f3);
    }

    T U() {
        return u;
    }

    T S() {
        return s;
    }

    T E() {
        return faces[u][faces[u].indexOf(s) + 1];
    }

    T N() {
        return faces[u][faces[u].indexOf(s) + 2];
    }

    T W() {
        return faces[s][faces[s].indexOf(u) + 1];
    }

    T D() {
        return faces[s][faces[s].indexOf(u) + 2];
    }

    void rollTo(char direction) {
        T tmpS = s, tmpU = u;
        switch (direction) {
            case 'N':
                s = D();
                u = tmpS;
                break;
            case 'E':
                u = W();
                break;
            case 'S':
                u = N();
                s = tmpU;
                break;
            case 'W':
                u = E();
                break;
            default:;
        }
    }
};

int main() {
    int n, face[6];
    cin >> n;
    vector<dice<int> > v(n);
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < 6; ++j) cin >> face[j];
        v[i] = dice<int>(face[0], face[1], face[2], face[3], face[4], face[5]);
    }
    for (int l = 0; l < n; ++l) {
        for (int r = l + 1; r < n; ++r) {
            if (v[l].faces[v[l].u] == v[r].faces[v[l].u] && v[r].faces[v[l].s].indexOf(v[l].D()) != -1) {
                cout<<"No"<<endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}



Measured memory_bytes: 3140
w = int(input())
n = int(input())
goal = [i for i in range(1,w+1)]
for i in range(n):
    a,b = [int(j) for j in input().split(',')]
    goal[a-1],goal[b-1] = goal[b-1],goal[a-1]
for po in goal:
    print(po)

Measured memory_bytes: 5600
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define Nmax 200010
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;

int main() {
	int N,A,B;
	cin >> N >> A >> B;
	if(N*A <= B) cout << N*A << endl;
	else cout << B << endl;
	return 0;
}

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

ll A[200][200];
int V;
const ll INF = pow(10, 18);

void warshallFloyd(){
    for (int k = 0; k < V; k++){
        for (int i = 0; i < V; i++){
            for (int j = 0; j < V; j++){
                if(A[i][k] == INF || A[k][j] == INF)continue;
                A[i][j] = min(A[i][j], A[i][k] + A[k][j]);
            }
        }
    }
    return;
}

int main() {
    cin >> V;
    int E; cin >> E;
    rep(i, V){
        rep(j, V){
            if(i == j){
                A[i][j] = 0;
            } else {
                A[i][j] = INF;
            }
        }
    }
    rep(i, E){
        int s, t, d; cin >> s >> t >> d;
        A[s][t] = d;
    }

    warshallFloyd();

    rep(i, V){
        if(A[i][i] < 0){
            cout << "NEGATIVE CYCLE" << endl;
            return 0;
        }
    }

    rep(i, V){
        rep(j, V){
            if(A[i][j] == INF){
                cout << "INF";
            } else {
                cout << A[i][j];
            }
            if(j == V-1){
                cout << endl;
            } else {
                cout << " ";
            }
        }
    }

    return 0;
}


Measured memory_bytes: 3256
#include <iostream>
#include <stdio.h>
#include <set>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <limits>

typedef long long int lli;
#define rep(i,s,N) for(int i=s;i<N;i++)
using namespace std;


int main(void)
{
	int N; cin >> N;
	vector<pair<lli, lli>> M(N);
	rep(i, 0, N) {
		lli X, L; cin >> X >> L;
		M[i].first = X + L;
		M[i].second = -X + L;
	}
	sort(M.begin(), M.end());

	//int remove = 0;
	lli ans = 1;
	lli right = M[0].first;
	rep(i, 1, N) {
		if (right <= -M[i].second) {
			right = M[i].first;
			ans++;
		}
	}
	//lli ans = N - remove;
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1920
// Aizu 2197: Sum of Consecutive Integers
// 2017.9.20 bal4u@uu

#include <stdio.h>
#include <math.h>

int ptbl[] = {
         3,   5,   7,  11,  13,  17,  19,  23,  29,
   31,  37,  41,  43,  47,  53,  59,  61,  67,  71,
   73,  79,  83,  89,  97, 101, 103, 107, 109, 113,
  127, 131, 137, 139, 149, 151, 157, 163, 167, 173,
  179, 181, 191, 193, 197, 199, 211, 223, 227, 229,
  233, 239, 241, 251, 257, 263, 269, 271, 277, 281,
  283, 293, 307, 311, 313, 317, 331, 337, 347, 349,
  353, 359, 367, 373, 379, 383, 389, 397, 401, 409,
  419, 421, 431, 433, 439, 443, 449, 457, 461, 463,
  467, 479, 487, 491, 499, 503, 509, 521, 523, 541,
  547, 557, 563, 569, 571, 577, 587, 593, 599, 601,
  607, 613, 617, 619, 631, 641, 643, 647, 653, 659,
  661, 673, 677, 683, 691, 701, 709, 719, 727, 733,
  739, 743, 751, 757, 761, 769, 773, 787, 797, 809,
  811, 821, 823, 827, 829, 839, 853, 857, 859, 863,
  877, 881, 883, 887, 907, 911, 919, 929, 937, 941,
  947, 953, 967, 971, 977, 983, 991, 997, 0 };

int number_of_odd_divisors(int n)
{
	int ans, i, d, p, sw;
	int *pp;

	 if ((n & 1) == 0) {
		do n >>= 1;
	    while ((n & 1) == 0);
	}
	if (n <= 1) return 1;
	ans = 1;
	for (pp = ptbl; *pp > 0; pp++) {
		if (n % *pp) continue;
		d = *pp, p = 1;
		do n /= d, p++;
		while (n % d == 0);
		ans *= p;
	}
	if (n > 1) {
		int b = (int)sqrt((double)n);
		for (i = 1009, sw = 0; n > 1; ) {
			if (i > b) { ans *= 2; break; }
			if (n % i == 0) {
				p = 1;
				do n /= i, p++;
				while (n % i == 0);
				ans *= p;
			}
			if (sw) i += 2, sw = 0;
			else    i += 4, sw = 1;
		}
	}
	return ans;
}

int main()
{
	int n;
	while (scanf("%d", &n) && n)
		printf("%d\n", number_of_odd_divisors(n)-1);
	return 0;
}

Measured memory_bytes: 1804
a,b,c= map(int,[input() for i in range(3)])
X = int(input())
flag = 0

for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if X == 500*i+100*j+50*k:
        flag += 1
print(flag)

Measured memory_bytes: 3064