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

void show( int arr[], size_t size )
{
	cout<<arr[1];
	for( size_t i=2; i<size; i++ ){
		cout<<' '<<arr[i];
	}
	cout<<endl;
}

void bucketSort( int arr[], const size_t arr_s, const int min, const int max )
{
//	size_t cnt_s=max - min +1;
	size_t cnt_s=max+2;
	int *cnt=new int[cnt_s];

	for( size_t i=0; i<cnt_s; i++ ){//
		cnt[i]=0;
	}


	for( size_t i=1; i<arr_s; i++ ){//
		cnt[ arr[i] ]++;
	}


	for( size_t i=1; i<cnt_s; i++ ){
		cnt[i]= cnt[i] + cnt[i-1];
	}

	int *sorted=new int[arr_s];
	for( size_t i=arr_s-1; i>0; i-- ){//
		sorted[ cnt[ arr[i]]]= arr[i];
		cnt[ arr[i] ]--;
		
	}

	show(sorted, arr_s);
	
	/*
	for( size_t i=1; i<arr_s; i++ ){
		arr[i]=sorted[i];
	}
	*/

	

	delete[] cnt;delete[] sorted;

}



int main()
{
	//arr : ???????????????
	size_t arr_s;	cin>>arr_s;arr_s++;
	int *arr=new int[arr_s];

	int max=INT_MIN;
//	int min=INT_MAX;

	for( size_t i=1; i<arr_s; i++ ){
		scanf("%d", &arr[i]);

//		if( arr[i] < min ) min=arr[i];
		if( arr[i] > max ) max=arr[i];
	}



	bucketSort( arr, arr_s, 0, max );
//	show(arr, arr_s);
	
	delete[] arr;


}

Measured memory_bytes: 16700
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

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

int x,y,a,b,c,p[100100],q[100100],r[100100],que[300300];

int main(){
	int i;
	scanf("%d %d %d %d %d",&x,&y,&a,&b,&c);
	
	for(i=0;i<a;i++)scanf("%d",&p[i]);
	for(i=0;i<b;i++)scanf("%d",&q[i]);
	for(i=0;i<c;i++)scanf("%d",&r[i]);
	
	qsort(p,a,sizeof(int),cmp);
	qsort(q,b,sizeof(int),cmp);
	
	for(i=0;i<x;i++)que[i]=p[i];
	for(i=x;i<x+y;i++)que[i]=q[i-x];
	for(i=x+y;i<x+y+c;i++)que[i]=r[i-x-y];
	
	qsort(que,x+y+c,sizeof(int),cmp);
	
	long long ans=0;
	
	for(i=0;i<x+y;i++)ans+=que[i];
	
	printf("%lld",ans);
	return 0;
		
}

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

int main(){
	int a,b,c,d,e,f,mwater,msugar;
	cin>>a>>b>>c>>d>>e>>f;
	msugar=0;
	mwater=100;
	for(int i=0;   100*a*i<=f   ;i++){
		for(int j=0;   100*b*j+100*a*i<=f   ;j++){   //water

			int water=100*b*j+100*a*i;

			for(int s=0;   water+s*c<=f   ;s++){
				for(int t=0;   water+s*c+t*d<=f   ;t++){   //sugar

					int sugar=s*c+t*d;
					if(water+sugar==0)continue;
						
					if(100*sugar*(mwater+msugar)>=100*msugar*(water+sugar)&&100*sugar<=water*e){
							mwater=water;
							msugar=sugar;
						}
				}
			}
		}
	}
	
	cout<<mwater+msugar<<' '<<msugar<<endl;
    return 0;
}
				//砂糖は100*b*j+100*a*iに		e*(b*j+a*i)
		//ms=maxsugar

Measured memory_bytes: 256
//! ----------------------------------------------
//! Framework <https://github.com/vain0x/procon>
//!
//! See the bottom of file for solution.
//! ----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

/// Print values to standard error if debug mode.
#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

/// Read from standard input and parse each word.
/// - `read!(T, U, ..)` parses a line as a tuple of words.
/// - `read![[T]]` parses a line as an array of words.
/// - `read![..; N]` parses `N` lines, using `read!(..)` repeatedly.
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

/// Read a line from standard input.
#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();

    #[allow(deprecated)]
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn paint(S: &[char], mut c: char) -> usize {
    let mut count = 0;

    for i in 0..S.len() {
        if S[i] != c {
            count += 1;
        }

        c = if c == '0' { '1' } else { '0' };
    }

    count
}

fn main() {
    let S = rl().chars().collect::<Vec<_>>();

    println!("{}", min(paint(&S, '0'), paint(&S, '1')));
}


Measured memory_bytes: 4352
import sys
input = lambda : sys.stdin.readline().strip()
n,k = map(int,input().split())
a = list(map(int,input().split()))
sala = set([0,a[0]-1])
f = 0
s = a[0]-1
power = 1
length = 1
while f!=s:
    if length==power:
        power*=2
        length=0
        f = s 
    s = a[s]-1
    sala.add(s)
    length+=1
start = len(sala)-length
if k<=start:
    cur = 0 
    while k:
        k-=1
        cur = a[cur]-1
    print(cur+1)
else:
    k-=start 
    k%=length
    f = 0
    s = 0 
    while length:
        s = a[s]-1
        length-=1
    while s!=f:
        s = a[s]-1
        f = a[f]-1
    cur = f 
    while k:
        cur = a[cur]-1
        k-=1
    print(cur+1)

Measured memory_bytes: 35724
#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
#define rep(i, a, n) for (int i=(a); i<(n); i++)
#define per(i, a, n) for (int i=(a); i>(n); i--)
typedef long long ll;
const int maxn = 2e5+5;
const int mod = 1e9+7;
using namespace std;

ll dp[maxn] = {0,0,0,1,1};

void solve() {
	for(int i=5; i<3000; i++) dp[i] = (dp[i-1] + dp[i-3])%mod;
	ll n; cin >> n;
	cout << dp[n] << '\n';
}

int main(int argc, char * argv[]) 
{
	ios_base::sync_with_stdio(false); cin.tie(0);
#ifdef DEBUG
	freopen("C:/Users/Fish_Brother/Desktop/in", "r", stdin);
	//freopen("C:/Users/Fish_Brother/Desktop/out", "w", stdout);
#endif

	//int t; cin >> t; while(t--)
	solve();

    return 0;
}

Measured memory_bytes: 3700
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main(){
	int a, b, c, x, y;
	cin >> a >> b >> c >> x >> y;
	int min=1e9;
	for(int i=0; i<=2*x || i<=2*y; i+=2){
		int pa=max(0, x-i/2), pb=max(0, y-i/2);
		int cost=i*c+pa*a+pb*b;
		if(min>cost) min=cost;
	}
	cout << min<< endl;		
	return 0;
}

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

int main() 
{ 
    int n=0,K=0;
    cin>>n>>K;
    int arr[n];
    memset(arr,0,sizeof(arr));
    for(int i=0;i<n;i++) cin>>arr[i];
    bool dp[K+1]={false};
    for(int k=0;k<=K;k++){
        bool temp=false;
        for(int i=0;i<n;i++){
            if (k>=arr[i]&&!dp[k-arr[i]]){
                temp=true;
                break;
            }
        }
        dp[k]=temp;
    }
    if (dp[K]) cout<<"First"<<endl;
    else cout<<"Second"<<endl;
    return 0;
} 

Measured memory_bytes: 3744
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <cctype>
#include <string>

using namespace std;

int main(){
  double a,b,x;
  cin >> a >> b;
  x = ceil((a+b)/2);

  cout << x << endl;

  return 0;
}



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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<int,P> PP;

struct edge {
	int to, cost;
	edge(int t,int c):to(t),cost(c) {}
};
int dx[]={1,-1,0,0},dy[]={0,0,1,-1};

//-----------------------------------------------------------------------------

int h,w,q;
int s[2000][2000];
int fld[2000][2000],x[2000][2000],y[2000][2000];

int calc(int a,int b,int c,int d) {
	int sum=fld[c][d],X=x[c][d],Y=y[c][d];

	if(a>0) sum-=fld[a-1][d];
	if(b>0) sum-=fld[c][b-1];
	if(a>0&&b>0) sum+=fld[a-1][b-1];

	X-=x[c][b];
	if(a>0) X+=x[a-1][b]-x[a-1][d];

	Y-=y[a][d];
	if(b>0) Y+=y[a][b-1]-y[c][b-1];

	//cout<<"a "<<a<<" b "<<b<<" c "<<c<<" d "<<d<<" sum "<<sum<<" x "<<X<<" y "<<Y<<endl;

	return sum-(X+Y);
}

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

	cin>>h>>w>>q;
	REP(i,h) {
		string t;
		cin>>t;
		REP(j,w) {
			s[i][j]=t[j]-'0';
			fld[i][j]=s[i][j];
			if(s[i][j]==1) {
				if(i>0&&s[i-1][j]==1) y[i][j]=1;
				if(j>0&&s[i][j-1]==1) x[i][j]=1;
			}
		}
	}
	FOR(i,1,h) {
		fld[i][0]+=fld[i-1][0];
		x[i][0]+=x[i-1][0];
		y[i][0]+=y[i-1][0];
	}
	FOR(j,1,w) {
		fld[0][j]+=fld[0][j-1];
		x[0][j]+=x[0][j-1];
		y[0][j]+=y[0][j-1];
	}
	FOR(i,1,h) {
		FOR(j,1,w) {
			fld[i][j]+=fld[i-1][j]+fld[i][j-1]-fld[i-1][j-1];
			x[i][j]+=x[i-1][j]+x[i][j-1]-x[i-1][j-1];
			y[i][j]+=y[i-1][j]+y[i][j-1]-y[i-1][j-1];
		}
	}
	REP(i,q) {
		int a,b,c,d;cin>>a>>b>>c>>d;
		a--,b--,c--,d--;
		cout<<calc(a,b,c,d)<<endl;
	}

	return 0;
}


Measured memory_bytes: 64508
#include<bits/stdc++.h>
using namespace std;
int main(){
   int n;
   cin >> n;

   int h[n];

   for( int i=0 ; i<n ; i++ ){
      cin>>h[i];
   }
   
   int dp[n];
   dp[0] = 0;
   dp[1] = abs(h[1]-h[0]);
    
   for(int i=2 ; i<n ;i++){
        dp[i]=min(dp[i-1]+abs(h[i-1]-h[i]),dp[i-2]+abs(h[i]-h[i-2]));
   }
   cout<<dp[n-1]<<"\n";
}


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

int n,x;
vector <int> V;
long long dp[3010][3010];

int main()
{
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> x;
        V.push_back(x);
    }

    for (int L = n-1; L >= 0; L--) {
        for (int R = L; R < n; R++) {
            if (L == R) dp[L][R] = V[L];
            else{
                dp[L][R]=max(V[R] - dp[L][R - 1], V[L] - dp[L + 1][R]);
            }
        }
    }
    cout << dp[0][n-1];
}


Measured memory_bytes: 49748
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
    int n;
    cin>>n;
    int ans=n/11*2;
    if((ans/2)*11<n){
        ans++;
        if((ans/2)*11+6<n){
            ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
c = [[0 for i in range(10)] for i in range(10)]
ans = 0

for i in range(1,n+1):
    s = str(i)
    c[int(s[0])][int(s[-1])] += 1

for i in range(1,10):
    for j in range(1,10):
        ans += c[i][j]*c[j][i]

print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vi;
#define INF (1e9)

int main() {
  string S;
  cin >> S;
  string T;
  cin >> T;

  int ans = 0;
  for (int i = 0; i < S.length(); i++) {
    if (S[i] != T[i]) ans++;
  }

  cout << ans << endl;
}


Measured memory_bytes: 3832
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(obj)   (obj).begin(),(obj).end()

#define debug(var)  do{std::cout << __LINE__ << "> " << #var << ": ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

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

using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

void Main() {
	int x; cin >> x;
	if (x == 0) {
		cout << 1 << endl;
	} else {
		cout << 0 << endl;
	}
}

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


Measured memory_bytes: 3636
import sys
stdin = sys.stdin

mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))

r, g, b = ns().split()
n = int(r+g+b)
print("YES" if n % 4 == 0 else "NO")

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

typedef long long ll;

using namespace std;

#define swap(a, b)    do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while(0)
#define repd(i, a, b) for(typeof(b) i = a; i < (b); ++i)
#define rep(i, n)     repd(i, 0, n)
#define dump(x)       cerr << #x << " = " << (x) << endl
#define debug(x)      cerr << "L" << __LINE__ << ": " << #x << " = " << (x) << endl
#define YesNo(x) cout << ((x) ? "Yes" : "No") << endl
#define YESNO(x) cout << ((x) ? "YES" : "NO") << endl

bool f(pair<ll, ll> a, pair<ll, ll> b) {
	return a.first < b.first;
}

int main(int argc, const char* argv[]) {
	ll n, m;
	cin >> n >> m;

	vector<pair<ll, ll>> a(n);
	rep(i, n) cin >> a[i].first >> a[i].second;
	sort(a.begin(), a.end(), f);

	ll ret = 0;
	rep(i, a.size()) {
		if(m > a[i].second) {
			m -= a[i].second;
			ret += a[i].first * a[i].second;
		} else {
			cout << ret + a[i].first * m << endl;
			return 0; 
		}
	}

	return 0;
}


Measured memory_bytes: 1792
from collections import defaultdict
n = int(input())
d = defaultdict(int)
for i in range(n):
    word = str(input())
    d[word]+=1
print("{} {} {}".format("AC","x",d["AC"]))
print("{} {} {}".format("WA","x",d["WA"]))
print("{} {} {}".format("TLE","x",d["TLE"]))
print("{} {} {}".format("RE","x",d["RE"]))



    
    

Measured memory_bytes: 9468
W, H = map(int, input().split())

cost = [(int(input()), i, 'r') for i in range(W)] + [(int(input()), i, 'c') for i in range(H)]

cost.sort()
row = H + 1
col = W + 1
ans = 0

for c, i, t in cost:
    if t == 'r':
        ans += max(0, row) * c
        col -= 1
    else:
        ans += max(0, col) * c
        row -= 1

print(ans)

Measured memory_bytes: 33244
#include <stdio.h>




int main (void) {
    int n, n2, m, k, bh, bt, c, i, j;
    int card[200], buf[200];

    scanf("%d\n", &n);
    scanf("%d\n", &m);
    n2 = n * 2;
    for (i = 0; i < n2; i++) {
        card[i] = i + 1;
    }
    for (i = 0; i < m; i++) {
        scanf("%d", &k);
        if (k) { // cut
            for (j = 0; j < k; j++) {
                buf[j] = card[j];
            }
            for (j = 0; j < n2 - k; j++) {
                card[j] = card[j + k];
            }
            for (j = 0; j < k; j++) {
                card[j + n2 - k] = buf[j];
            }
        }
        else { // riffle shuffle
            for (j = 1, c = n, bh = 0, bt = 0; j < n2 - 1; j+=2) {
                buf[bt++] = card[j];
                card[j] = card[c++];
                buf[bt++] = card[j+1];
                card[j+1] = buf[bh++];
            }
        }
    }
    for (i = 0; i < n2; i++) {
        printf("%d\n", card[i]);
    }
    return 0;
}

Measured memory_bytes: 600
#include <iostream>

using namespace std;

int n, m;
int H[100000];
int d[100000] = {0};

int main()
{
    cin >> n >> m;
    for (int i = 0; i < n; i++)
    {
        d[i] = 0;
        cin >> H[i];
    }
    for (int i = 0; i < m; i++)
    {
        int a, b;
        cin >> a >> b;

        d[a - 1] = max(d[a - 1], H[b - 1]);
        d[b - 1] = max(d[b - 1], H[a - 1]);
    }
    int ret = 0;
    for (int i = 0; i < n; i++)
    {
        if (H[i] > d[i])
            ret++;
    }
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 3920
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<vector>
using namespace std;

int pind=0;
vector<int> s;

int find(int u, int *H){
    int i=0;
    while(H[i]!=u){
        i++;
    }
    return i;
}

void reconstruction(int l, int r, int *Pr, int *In){
    if(l>=r) return;
    int ind = find(Pr[pind], In);
    int k=pind;
    pind++;
    reconstruction(l, ind, Pr, In); 
    reconstruction(ind+1, r, Pr, In);
    //printf(" %d", Pr[k]);
    s.push_back(Pr[k]);
}



int main(){
    int n, i, k, j;
    int *Pr, *In;
    scanf("%d", &n);
    Pr = (int*)malloc(sizeof(int)*n);
    In = (int*)malloc(sizeof(int)*n);
    for(i=0;i<n;i++){
        scanf("%d", &Pr[i]);
    }
    for(i=0;i<n;i++){
        scanf("%d", &In[i]);
    }

    reconstruction(0, n, Pr, In);
    for(j=0;j<n;j++){
        if(j==n-1) printf("%d\n", s[j]);
        else printf("%d ", s[j]);
    }

    free(Pr);
    free(In);



}


Measured memory_bytes: 3280
/*
[abc133] A - T or T
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;

int N, A, B;

ll solve() { return min(N * A, B); }

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

    cout << solve() << endl;

    return 0;
}


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

typedef long long LL;
typedef vector<long long> VLL;
typedef vector<string> VS;
typedef vector<pair<LL, LL> > VP;
 
 
#define For(in) for (LLi i = 0; i < (n); i++)
#define FOR(in) for(LLi i=1; i <= (n); i++)
#define pb push_back
#define srt(v) sort(v.begin(), v.end())
#define rev(v) reverse(v.begin(), v.end())
#define uniq(v) v.erase(unique(v.begin(), v.end()), v.end());
#define no "NO"
#define yes "YES"
#define con continue;


int main()
{
    ios_base::sync_with_stdio(false);
	long long t, q;
	
	//seive();
	LL a=0,b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,r=0,u=0,w=0,x=0,y=0,z=0;
	//LL aa[10000];
	LL flag=0, flag1=0, co=0, co1=0, co2=0, co3=0, x1=0, x2=0, y1=0, y2=0, z1=0, z2=0;
	LL ma=0, mi=100000000;
	LL mid=0, temp=0, stop=0, start=0, ans=0;
	double pi= 3.141592653589793;
	double d1=0.0, d2, d3, d4;
	VLL v,v1,v2,v3,v4,v5,v6,v7,v8,v9,v10;
	VS vs, vs1, vs2, vs3, vs4;
	VP vp, vp1,vp2;
	char ch, ch1, ch2[1001];
	string str, str1, str2, str3, str4, str5;
	pair<LL, LL> pa;
	list<LL> li, li1;
	map<LL, LL> mp, mp1;
	set<LL> st;
	map<LL ,LL> :: iterator imll;
	VLL :: iterator ivl, low, up;
	set<LL> :: iterator it;
	VP :: iterator ivp;
	
	cin>>str;
	if((str[0]-'0')==0)
	{
		cout<<"Yes"<<endl;
		return 0;
	}
	
	
	for(i=0; i<str.size(); i++)
	{
		x+= (str[i]-'0');
	}
	
	if(x%9==0)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	
	
	
	
	
	

	return 0;
 
}



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

#define lli long long int
#define Sort(n) sort(n.begin(), n.end())
#define Reve(n) reverse(n.begin(), n.end())
#define YES puts("YES")
#define NO puts("NO")

//素数
bool IsPrime(lli num)
{
  if (num < 2) return false;
  else if (num == 2) return true;
  else if (num % 2 == 0) return false;
  long double sqrtNum = sqrt(num);
  for (lli i = 3; i <= sqrtNum; i += 2)
  {
    if (num % i == 0)return false;
  }
  return true;
}
//各桁の和
lli Sum(lli n)
{
  lli sum=0;
  if (n<0) return 0;
  while (n>0)
  {
    sum += n%10;
    n /= 10;
  }
  return sum;
}

int main(void)
{
  lli n, sum = 0;
  cin >> n;
  vector<lli> a(n);
  for(int i = 0;i < n;i++) {
    cin >> a.at(i);
  }
  Sort(a);
  Reve(a);
  for(int i = 0;i < n;i++) {
    if(i % 2 == 0) {
      sum += a.at(i);
    }
    else {
      sum -= a.at(i);
    }
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 256
# ABC073D - joisino's travel (210ms)
from heapq import heapify, heappop, heappush
from itertools import permutations


def dijkstra(source: int) -> list:
    dist = [float("inf")] * (N + 1)
    undetermined = N  # vertex_0 won't appear in 1-idx graph
    queue = [(0, source)]
    heapify(queue)
    while queue:
        cost, v = heappop(queue)
        if cost > dist[v]:
            continue
        dist[v] = cost
        for next_cost, u in G[v]:
            if cost + next_cost < dist[u]:
                heappush(queue, (cost + next_cost, u))
        undetermined -= 1
        if not undetermined:
            return dist


def main():
    global G, N
    N, M, R, *RABC = map(int, open(0).read().split())
    visit, ABC = RABC[:R], RABC[R:]
    G = [[] for _ in range(N + 1)]
    for v, u, cost in zip(*[iter(ABC)] * 3):
        G[v].append((cost, u)), G[u].append((cost, v))
    dist = {v: dijkstra(v) for v in visit}
    ans = float("inf")
    for perm in permutations(visit):
        cur = sum(dist[v][u] for v, u in zip(perm, perm[1:]))
        ans = min(ans, cur)
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 9836
#include <stdio.h>
#include <string.h>
#include <ctype.h>

int main(void){
	char s[201], tmp[201], num[201];
	int h, l;
	int i, j, n;

	scanf("%s", s);
	while(1){
		if(!strcmp(s, "-"))
			break;
		scanf("%d", &n);
		l = strlen(s);
		//printf("n= %d l=%d s=%s\n", n, l, s);

		for(j=0; j<n; j++){
			scanf("%d", &h);
			//printf("i=%d h=%d\n", i, h);
			for(i=h; i<l; i++){
				tmp[i-h] = s[i];
			}
			//printf("tmp=%s\n", tmp);
			for(i=0; i<h; i++){
				tmp[i+l-h] = s[i];
			}
			for(i=0; i<l; i++)
				s[i] = tmp[i];
		}
		for(i=0; i<l; i++)
			printf("%c", s[i]);
		printf("\n");
			scanf("%s", s);
	}

	return 0;
}

Measured memory_bytes: 568
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	int n; scanf("%d", &n); std::vector<int> a(n);
	for(int i = 0; i < n; i++) scanf("%d", &a[i]);
	
	int zero = 0;
	std::vector<int> A, B;
	for(int i = 0; i < n; i++) {
		if(a[i] < 0) A.push_back(a[i]);
		else if(a[i] > 0) B.push_back(a[i]);
		else if(a[i] == 0) zero++;
	}
	
	if(zero and A.empty()) A.push_back(0), zero--;
	while(zero--) B.push_back(0);
	
	int ma = -(1 << 30);
	std::vector<std::pair<int, int>> ans;
	if(n == 2) {
		if(a[0] - a[1] > a[1] - a[0]) {
			ans.push_back({a[0], a[1]});
			ma = a[0] - a[1];
		} else {
			ans.push_back({a[1], a[0]});
			ma = a[1] - a[0];
		}
	} else if(B.empty()) {
		sort(begin(A), end(A)); reverse(begin(A), end(A));
		
		for(int i = 0; i < (int)A.size() - 1; i++) {
			ans.push_back({A[i], A[i + 1]});
			A[i + 1] = A[i] - A[i + 1];
		}
		ma = A.back();
	} else if(A.empty()) {
		sort(begin(B), end(B));
		
		for(int i = 1; i < (int)B.size() - 1; i++) {
			ans.push_back({B[i], B[i + 1]});
			B[i + 1] = B[i] - B[i + 1];
		}
		ans.push_back({B[0], B.back()});
		ma = B[0] - B.back();
	} else {
		if(B.size() == 1) {
			for(int i = 0; i < A.size(); i++) {
				ans.push_back({B[0], A[i]});
				B[0] = B[0] - A[i];
			}
			ma = B[0];
		} else {
			ans.push_back({A[0], B[1]});
			B[1] = A[0] - B[1];
			for(int i = 1; i < (int)B.size() - 1; i++) {
				ans.push_back({B[i], B[i + 1]});
				B[i + 1] = B[i] - B[i + 1];
			}
			ans.push_back({B[0], B.back()});
			B[0] = B[0] - B.back();
			for(int i = 1; i < A.size(); i++) {
				ans.push_back({B[0], A[i]});
				B[0] = B[0] - A[i];
			}
			ma = B[0];
		}
	}

	printf("%d\n", ma);
	for(auto v: ans) printf("%d %d\n", v.first, v.second);
	assert(ans.size() == n - 1);
	return 0;
}


Measured memory_bytes: 3828
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << endl;}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << endl;
}
const int mod = 1e9 + 7;

int main(){
	ll n; cin >> n;
	ll ans = 0;
	vpl v(n); rep(i,n) cin >> v[i].first >> v[i].second;
	sort(all(v));
	ll now = -inf;
	rep(i,n){
		if(v[i].first-v[i].second >= now){
			ans++;
			now = v[i].first + v[i].second;
		}else{
			chmin(now,v[i].first + v[i].second);
		}
	}
	cout << ans << endl;
}

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

const int mxN = 1e5;
vector<int>adj[mxN];
bool vis[mxN];

void dfs(int s)
{
    vis[s] = true;

    for(int i = 0; i < adj[s].size(); i++)
    {
        if(!vis[adj[s][i]])
            dfs(adj[s][i]);
    }
}

void solve()
{
    int N,M;
    cin>>N>>M;

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

        adj[a].pb(b);
        adj[b].pb(a);
    }

    int count = 0;

    for(int i = 0; i < N; i++)
        if(!vis[i])
        {
            count++;
            dfs(i);
        }

    cout<<count - 1<<endl;
}

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

    solve();

    return 0;
}

Measured memory_bytes: 9660
/**
 * @Author:      H S-J
 * @DateTime:    2018-01-07 20:01:27
 * @Description: 
 */
#include <bits/stdc++.h>
using namespace std;
#define MST(a, b) memset(a, b, sizeof(a));
#define CLR(a) MST(a, 0);
#define DBG(x) cout << '#' << " = " << (x) << endl;
#define ALL(x) x.begin(), x.end()
#define INS(x) inserter(x, x.begin())
#define lson(x) (x) << 1
#define rson(x) (x) << 1|1
#define pb push_back
#define rep(x, y, z) for (int x = y; x < z; ++x)
#define ech(x, y, z) for (auto x = z.begin(), y = z.end(); x != y; ++x)
#define lowbit(x) (x & (-x))
#define opr operator
#define _st first
#define _nd second
#define prior_q1(x) priority_queue<x>
#define prior_q2(x) priority_queue<x, vector<x>, greater<x> >
typedef long long LL;
typedef stringstream strstm;
struct FastIO {
    static const int S = 1310720;
    int wpos;
    char wbuf[S];
    FastIO() : wpos(0) {}
    inline int xchar() {
        static char buf[S];
        static int len = 0, pos = 0;
        if (pos == len)
            pos = 0, len = fread(buf, 1, S, stdin);
        if (pos == len) return -1;
        return buf[pos ++];
    }
    inline int xuint() {
        int c = xchar(), x = 0;
        while (c <= 32) c = xchar();
        for (; '0' <= c && c <= '9'; c = xchar()) x = x * 10 + c - '0';
        return x;
    }
    inline int xint() {
        int s = 1, c = xchar(), x = 0;
        while (c <= 32) c = xchar();
        if (c == '-') s = -1, c = xchar();
        for (; '0' <= c && c <= '9'; c = xchar()) x = x * 10 + c - '0';
        return x * s;
    }
    inline LL xlongint() {
        LL s = 1, c = xchar(), x = 0;
        while (c <= 32) c = xchar();
        if (c == '-') s = -1, c = xchar();
        for (; '0' <= c && c <= '9'; c = xchar()) x = x * 10 + c - '0';
        return x * s;
    }
    inline void xstring(char *s) {
        int c = xchar();
        while (c <= 32) c = xchar();
        for (; c> 32; c = xchar()) * s++ = c;
        *s = 0;
    }
    inline void wchar(int x) {
        if (wpos == S) fwrite(wbuf, 1, S, stdout), wpos = 0;
        wbuf[wpos ++] = x;
    }
    inline void wint(LL x) {
        if (x < 0) wchar('-'), x = -x;
        char s[24];
        int n = 0;
        while (x || !n) s[n ++] = '0' + x % 10, x /= 10;
        while (n--) wchar(s[n]);
    }
    inline void wstring(const char *s) {
        while (*s) wchar(*s++);
    }
    ~FastIO() {
        if (wpos) fwrite(wbuf, 1, wpos, stdout), wpos = 0;
    }
} io;
set<int> mset;
int main(int argc, char const *argv[]) {
	ios::sync_with_stdio(0);cin.tie(0);
    int n; cin >> n;
    rep(i, 0, n) {
        int tmp; cin >> tmp;
        mset.insert(tmp);
    }
    cout << mset.size() << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


int ans[2005];

int main(){

	int N,X,Y;
	scanf("%d %d %d",&N,&X,&Y);

	int dist;

	for(int i = 0; i < N; i++){

		ans[i] = 0;
	}

	for(int from = 1; from <= N-1; from++){
		for(int to = from+1; to <= N; to++){

			dist = min(to-from,abs(X-from)+abs(to-Y)+1);
			ans[dist]++;
		}
	}

	for(int i = 1; i < N; i++){

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

	return 0;
}


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

a_list = list(map(int, input().split()))
# print(a_list)

a_list = sorted(a_list, reverse=True)
# print(a_list)

alice = 0
bob = 0
for i in range(len(a_list)):
    if i % 2 == 0:
        alice += a_list[i]
    else:
        bob += a_list[i]
print(alice - bob)

Measured memory_bytes: 8780
n = int(input())
data = [input() for x in range(n)]

temp_list = {}

#dictionaryの初期化
for x in list(set(data)):
    temp_list[x] = 0

for x in data:
    temp_list[x] += 1

max_value = max(temp_list.values())
sort_keys = sorted(temp_list.keys())

for x in sort_keys:
    if temp_list[x] == max_value:
        print(x)

Measured memory_bytes: 44556
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<ll,ll> P;
#define pb push_back
#define mp make_pair
#define fr(i,n) for(int i=0;i<n;i++)
#define Fr(i,n) for(int i=0;i++<n;)
#define ifr(i,n) for(int i=n-1;i>=0;i--)
#define iFr(i,n) for(int i=n;i>0;i--)

const ll MOD=1e9+7;

ll ad(ll x,ll y=0){
  return (x+y)%MOD;
}

ll mlt(ll x,ll y=1){
  return (x*y)%MOD;
}

ll pwr(ll x,ll y){
  ll pw[32]={},w=1;
  pw[0]=x;
  fr(i,31) pw[i+1]=mlt(pw[i],pw[i]);
  fr(i,32){
    w=mlt(w,1+(y%2)*(pw[i]-1));
    y/=2;
  }
  return w;
}

int main(){
  ll a[100010]={},c[100010]={},q1[100010]={},q2[100010]={},n,ans=0,kari;
  string s;
  cin>>s;
  n=s.length();
  fr(i,n){
    a[i+1]=a[i];
    if(s[i]=='A') a[i+1]++;
    q1[i+1]=q1[i];
    if(s[i]=='?') q1[i+1]++;
  }
  ifr(i,n){
    c[i]=c[i+1];
    if(s[i]=='C') c[i]++;
    q2[i]=q2[i+1];
    if(s[i]=='?') q2[i]++;
  }
  fr(i,n){
    if(s[i]=='B'||s[i]=='?'){
      if(q1[i]==0) kari=a[i];
      else kari=mlt(pwr(3,q1[i]-1),3*a[i]+q1[i]);
      if(q2[i+1]==0) kari=mlt(kari,c[i+1]);
      else kari=mlt(kari,mlt(pwr(3,q2[i+1]-1),3*c[i+1]+q2[i+1]));
      ans=ad(ans,kari);
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3584
#include<iostream>
#include<cstdio>
#include<cstring> 
using namespace std;
int n,a[200005],b[200005],ans1,ans2,r[100005],dz,sc[100005],xc[100005];
int main(){
	
	cin >> n;
	for(int i=1;i<=n;i++)
	{
		cin >> a[i] >> b[i];
	  sc[a[i]]++;
	  xc[b[i]]++;
	  r[a[i]]++;
	  r[b[i]]--;
	  dz=max(dz,b[i]);
	}
	for(int i=1;i<=dz;i++)
	{
		sc[i]+=sc[i-1];
		xc[i]+=xc[i-1];
	 } 
	 for(int i=1;i<=n;i++)
	 ans1=max(ans1,sc[b[i]-1]-xc[a[i]]);
	for(int i=1;i<=dz;i++)
	{r[i]+=r[i-1];
	ans2=max(ans2,r[i]);
	}
	cout << ans1 << " " << ans2  <<endl;
	 return 0;
} 



Measured memory_bytes: 5800
const println = (value) => console.log(value)
const readInt = (input) => parseInt(input, 10)
const readIntList = (input) => input.split(' ').map(n => parseInt(n, 10))

function main(input) {
    const [n, d] = readIntList(input)
    let ans = 1
    while (true) {
        if (ans * 2 * d + ans  >= n) {
            break
        }
        ans++
    }
    println(ans)
}

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


Measured memory_bytes: 29528
//** aman**/
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define dl          double
#define hell        1000000007
#define endl        '\n'
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define lb lower_bound
#define ub upper_bound
#define bs          binary_search
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
int main(){
	ll n;cin>>n;
	ll sum=0;
	for(ll i=1;i*i<=n;i++){
		if(n%i==0){
			ll m1=n/i-1;
			if(i<m1)sum+=m1;
			if((n/i)!=i){
				m1=i-1;
				if(i<m1)sum+=m1;
			}
		}
		//cout<<sum<<endl;
	}
	cout<<sum<<endl;
}

Measured memory_bytes: 256
K = int(input())
if K % 2 == 0 or K % 5 == 0:
    print(-1)
    exit()

val = 7
ans = -1
for i in range(1, K + 1):
    if val % K == 0:
        ans = i
        break
    val %= K
    val *= 10
    val += 7
print(ans)

Measured memory_bytes: 63236
#include <stdio.h>
#define max(x,y) ((x)>(y)?(x):(y))
#define min(x,y) ((x)<(y)?(x):(y))
#define FOR(i,m,n) for(i=m;i<n;i++)

int main(void)
{
	int a,b,c,d,x=0;
	scanf("%d %d %d %d",&a,&b,&c,&d);
	if(a==1||b==1||c==1||d==1){
		if(a==4||b==4||c==4||d==4){
			if(a==7||b==7||c==7||d==7){
				if(a==9||b==9||c==9||d==9){
					x=1;
				}
			}
		}
	}
	if(x==1){
		printf("YES\n");
	}else{
		printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 128
import java.util.*;
import java.util.Map.Entry;

import javax.swing.text.Segment;

import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main //implements Runnable
{
//    static int dx[]={-1,0,1,0};
//    static int dy[]={0,-1,0,1};

    public static void main(String[] args)   throws Exception, IOException{        
        long mod=1000000007;
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);

        int n=sc.nextInt();
        int d[]=new int[n];
        for (int i = 0; i < d.length; i++) {
			d[sc.nextInt()-1]=i+1;
		}
        for (int i = 0; i < d.length; i++) {
			out.print(d[i]+" ");
		}
        
        out.println();
     	out.flush();
    }
    
    static void ret(String ans) {
    	System.out.println(ans);
    	System.exit(0);
    }
    
    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }

    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }
}

//class P {
//	int x, y;
//	P(int  x, int y) {
//	  this.x=x;
//	  this.y=y;
//	}
//}

class P implements Comparable<P>{
    int a,b;
    P(int a, int b) {
    	this.b=b;
    	this.a=a;
    }

    public int compareTo(P p){
        return p.a-a;//des
    }
}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public int[] nextIntArray(int size) throws IOException{
        int r[] = new int[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextInt(); 
        }
        return r;
    }
    public long[] nextLongArray(int size) throws IOException{
        long r[] = new long[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextLong(); 
        }
        return r;
    }
    public char[] getCharSet() throws IOException{
        return this.nextString().toCharArray();
    }    
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


Measured memory_bytes: 40152
#include <iostream>

using namespace std;

int a[100010], h, n;

int main() {
	scanf("%d%d", &h, &n);
	long long ans = 0;
	for (int i = 1; i <= n; ++i) {
		scanf("%d", &a[i]);
		ans += a[i];
	}
	if (ans >= h) printf("Yes");
	else printf("No");
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

int main(){
    int n,k;
    cin >> n >> k;
    vector<long> h;
    for(int i=0;i<n;++i){
        long t;
        cin >> t;
        h.push_back(t);
    }
    sort(h.begin(),h.end(),greater<long>());
    for(int i=0;i<min(k,n);++i){
        h[i] = 0;
    }
    cout << accumulate(h.begin(), h.end(), 0L) << endl;
    return 0;
}

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

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int[] l = new int[N];
        long sum = 0;
        for (int i = 0; i < N; i++) {
            l[i] = scan.nextInt();
            sum += l[i];
        }
        Arrays.sort(l);
        boolean answer = l[N-1] < sum - l[N-1] ? true : false;
        System.out.printf(answer ? "Yes" : "No");
    }
}


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

using namespace std;

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

#define all(v) v.begin(), v.end()

#define rep(i, n) for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 1; i < n; i++)

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T& a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T& a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
const long long INF = 1LL << 60;

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);

  ll n;
  cin >> n;
  n %= 10;
  if (n == 3) {
    cout << "bon" << endl;
  } else if (n == 0 || n == 1 || n == 6 || n == 8) {
    cout << "pon" << endl;
  } else {
    cout << "hon" << endl;
  }

  return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef pair<long long, long long> pLL;
typedef long long ll;
int MOD = 1000000007;

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

int main(){
  int N;
  cin >> N;
  int A[N];
  int first;
  int all;
  int a,b,c;
  int tmp;
  for(int i=0; i<N; i++) cin >> A[i];
  if(N <= 2) cout << max(A[0],A[1]) << endl;
  else{
    a = gcd(A[0], A[1]);
    b = gcd(A[0], A[2]);
    c = gcd(A[1], A[2]);
    all = gcd(a, A[2]);
    if(a > b){
      first = a;
    }else{
      first = b;
    }
    if(c > first){
      first = c;
    }
    for(int i=3; i<N; i++){
      tmp = gcd(first, A[i]);
      if(tmp > all){
        first = tmp;
      }else{
        first = all;
      }
      all = gcd(all, A[i]);
    }
    cout << first << endl;
  }
  return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<complex>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using Complex = complex<double>;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1145141919810364364LL;
double PI = acos(-1.0);
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)



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

	int N;
	cin >> N;
	puts((N + 1) / 2);
	return 0;
}


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

int main(){
  long long N;
  cin >> N;
  vector<long long> V(N+1,0);
  
  for(int i=1;i<=N;i++){
    for(int j=i;j<=N;j+=i){
      V[j] += j;
    }
  }
  
  long long ans=0;
  for(int i=1;i<=N;i++) ans += V[i];
  cout << ans << endl;
  return 0;
}


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

int main(){
	ios::sync_with_stdio(false);

	int x, n = 0;
	for (int i = 0; i < 3; i++){
		cin >> x;
		n = n*10 + x;
	}
	cout << (n % 4 ? "NO" : "YES");
	return 0;
}

Measured memory_bytes: 256
A,B,C,K = map(int,input().split())
sum = 0;
if A <= K:
	sum += A;
	K -= A
else:
	sum += K;
	K -= K
if B <= K:
	K -= B
else:
	K -= K
if C <= K:
	sum -= C
	K -= C
else:
	sum -= K
	K -= K
print(sum)

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

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

    vector<vector<int>> jobs(M+1, vector<int>());

    int A, B;
    for(int i = 0; i < N; i++ ){
        cin >> A >> B;
        if( A <= M ){
            jobs[A].push_back(B);
        }
    }

    multiset<int> rewards;

    int total = 0;
    for(int i = 1; i <=M; i++ ){
        for(auto r : jobs[i]){
            rewards.insert(r);
        }

        if( !rewards.empty() ){
            total += *(rewards.rbegin());
            rewards.erase(--rewards.end());
        }
    }

    cout << total << endl;
    return 0;
}


Measured memory_bytes: 7808
import sys

printf = sys.stdout.write

word = map(str, raw_input().split(', '))

count = []
new_word = []
for i in range(len(word)):
    for j in range(len(word[i])):
        if word[i][j].islower():
            new_word.append(chr(ord(word[i][j]) - 32))
        elif word[i][j].isupper(): 
            new_word.append(chr(ord(word[i][j]) + 32))
        else:
            new_word.append(word[i][j])
    new_word.append(", ")


for i in range(len(new_word) - 1):
    printf(new_word[i])
    
print ""

Measured memory_bytes: 6456
#include <bits/stdc++.h>
using namespace std;
int dp[100001];
void dfs(vector<vector<int> > &list,int vert,bool vis[]){
    vis[vert]=true;
    for(int j=0;j<list[vert].size();j++){
        if(vis[list[vert][j]]==false)
        dfs(list,list[vert][j],vis);
        dp[vert]=max(dp[vert],dp[list[vert][j]]+1);
    }
}
int main() {
    int n,m;
    cin>>n>>m;
    int x,y;
    vector<vector<int>> list(n+1);
    for(int i=0;i<m;i++){
        cin>>x>>y;
        list[x].push_back(y);
    }
    bool vis[n+1]={false};
    for(int i=1;i<=n;i++){
        if(vis[i]==false)
        dfs(list,i,vis);
    }
    int ans=0;
    for(int i=1;i<=n;i++){
        ans=max(ans,dp[i]);
    }
    cout<<ans;
    
	return 0;
}

Measured memory_bytes: 8960
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::str::FromStr;
use std::io::*;
use std::collections::*;
use std::cmp::*;

struct Scanner<I: Iterator<Item = char>> {
    iter: std::iter::Peekable<I>,
}

macro_rules! exit {
    () => {{
        exit!(0)
    }};
    ($code:expr) => {{
        if cfg!(local) {
            writeln!(std::io::stderr(), "===== Terminated =====")
                .expect("failed printing to stderr");
        }
        std::process::exit($code);
    }}
}

impl<I: Iterator<Item = char>> Scanner<I> {
    pub fn new(iter: I) -> Scanner<I> {
        Scanner {
            iter: iter.peekable(),
        }
    }

    pub fn safe_get_token(&mut self) -> Option<String> {
        let token = self.iter
            .by_ref()
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            Some(token)
        }
    }

    pub fn token(&mut self) -> String {
        self.safe_get_token().unwrap_or_else(|| exit!())
    }

    pub fn get<T: FromStr>(&mut self) -> T {
        self.token().parse::<T>().unwrap_or_else(|_| exit!())
    }

    pub fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.get()).collect()
    }

    pub fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }

    pub fn char(&mut self) -> char {
        self.iter.next().unwrap_or_else(|| exit!())
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.get::<String>().chars().collect()
    }

    pub fn mat_chars(&mut self, row: usize) -> Vec<Vec<char>> {
        (0..row).map(|_| self.chars()).collect()
    }

    pub fn line(&mut self) -> String {
        if self.peek().is_some() {
            self.iter
                .by_ref()
                .take_while(|&c| !(c == '\n' || c == '\r'))
                .collect::<String>()
        } else {
            exit!();
        }
    }

    pub fn peek(&mut self) -> Option<&char> {
        self.iter.peek()
    }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin.bytes().map(|c| c.unwrap() as char));
    let a: usize = sc.get();
    println!("{}", a + a*a + a*a*a);
}


Measured memory_bytes: 2052
#include<bits/stdc++.h>
using namespace std;
#define int long long 
const int INF = 1e9;
const int MOD = INF+7;
#define rep(i,N) for(int (i)=0;(i)<(N);++(i))
#define rrep(i,N) for(int (i)=(N-1);(i)>0;--i)
#define FOR(i,j,N) for(int (i)=(j);(i)<(N);++(i))
#define put(n) cout<<(n)<<endl;
#define all(v) v.rbegin(),v.rend()
#define MP make_pair
#define pb push_back
using P = pair<int,int>;

signed main(){
    int X,Y,Z,K;
    cin >> X >> Y >> Z >> K;
    vector<int> A(X),B(Y),C(Z);
    rep(i,X) cin >> A[i];
    rep(i,Y) cin >> B[i];
    rep(i,Z) cin >> C[i];

    sort(all(A));
    sort(all(B));
    sort(all(C));

    priority_queue<vector<int>,vector<int>,greater<int>> Q;
    priority_queue<int> que;

    rep(i,X)rep(j,Y) que.push(A[i] + B[j]);
    //while(Q.size() < K) Q.pop();
    //auto q = Q;

    int cnt = 0;
    while(!que.empty()){
        int MAX = que.top();que.pop();
        int i=0;
        while(i<Z){
            int M = MAX + C[i];
            if(Q.size() == K){
                int mi = Q.top();
                if(mi < M) Q.pop();
                else break;
            }
            Q.push(M);
            i++;
        }
    }

    vector<int> ans;
    while(!Q.empty()){
        int a = Q.top();Q.pop();
        ans.push_back(a);
    }

    reverse(ans.begin(),ans.end());

    for(auto a : ans) put(a);

}


Measured memory_bytes: 10608
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <numeric>
#include <limits>
#include <cmath>
#include <iomanip>
 
#define ALL(a)  (a).begin(),(a).end()
 
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
 
int main() {
    char a;

    cin >> a;

    printf("%c\n", a+1);
    return 0;    
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include <vector>
#include <algorithm>
#include<cstdlib>
#include <queue>
#include <cmath>
#include <iomanip>
#include<list>
#include <utility>
#define T long long


int main(){
	int k,a,b;
	std::cin >> k>>a>>b;
	for(int i=1;i*k<=b;i++){
		if(a<=k*i){
			std::cout << "OK"<<std::endl;
			return 0;
		}
	}
	std::cout << "NG"<<std::endl;
}


Measured memory_bytes: 3636