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

/*binarySearch()の擬似コード
    left = 0
    right = n
    while left < right
        mid = (left + right) / 2
        if A[mid] == key  //一致したら
            return mid（このプログラムでは1を返す）
        else if key < A[mid]
            right = mid
        else // key > A[mid]
            left = mid + 1*/

int binarySearch(int A[], int key, int n){
  int left, right, mid;
  left = 0;
  right = n;
  while(left < right){
    mid = (left + right) / 2;
    if(A[mid] == key) return 1;
    if(key < A[mid]) right = mid;
    else if(key > A[mid]) left = mid + 1;

  }
  return 0;
}

int main(){
  int i, n, A[N], q, key, cnt = 0;

  scanf("%d", &n);
  for(i = 0; i < n; i++){
    scanf("%d", &A[i]);
  }
  scanf("%d", &q);
  for(i = 0; i < q; i++){
    scanf("%d", &key);//q個の値をそれぞれ読み込み、binarySearchに渡す
    if( binarySearch(A, key, n) ) cnt++; //linearSearchで一致したものがあれば、1を返し、1が帰ってきたら、カウントを増やす
  }
  printf("%d\n", cnt);
  return 0;
}



Measured memory_bytes: 2248
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int price = sc.nextInt();
		
		int payment = 0;
		while(payment < price) {
			payment += 1000;
		}
		
		System.out.println(payment - price);
	}
}

Measured memory_bytes: 35608
#include <iostream>
using namespace std;
typedef long long ll;
int main() {
  ios::sync_with_stdio(false);
  ll K, A, B;
  cin >> K >> A >> B;
  if (A + 2 >= B) {
    cout << 1LL + K << endl;
    return 0;
  }
  if (A - 1 > K) {
    cout << 1LL + K << endl;
    return 0;
  }
  K -= A - 1;
  cout << A + (K/2) * (B-A) + (K%2) << endl;
}

Measured memory_bytes: 256
import sys
from itertools import permutations
N, C = map(int, sys.stdin.readline().rstrip().split())

d = []
for _ in range(C):
    d.append(tuple(map(int, sys.stdin.readline().rstrip().split())))

r_0 = []
r_1 = []
r_2 = []
for i in range(N):
    g = list(map(int, sys.stdin.readline().rstrip().split()))
    for j in range(N):
        if (i + j) % 3 == 0:
            r_0.append(g[j])
        elif (i + j) % 3 == 1:
            r_1.append(g[j])
        else:
            r_2.append(g[j])

def get_cost(r):
    cost = [0] * (C + 1)
    for c in range(1, C + 1):
        for i in r:
            cost[c] += d[i - 1][c - 1]

    return cost

cost_0 = get_cost(r_0)
cost_1 = get_cost(r_1)
cost_2 = get_cost(r_2)

ans = 10**18
for c_0, c_1, c_2 in permutations(range(1, C + 1), 3):
    total = cost_0[c_0] + cost_1[c_1] + cost_2[c_2]
    ans = min(ans, total)
print(ans)

Measured memory_bytes: 54876
#include <stdio.h>

int main(){
  char s[4];  scanf("%s", s);
  int a = 0, b = 0;
  for(int i=0; i<3; i++)
    if(s[i] == 'A')
      a = 1;
    else if(s[i] == 'B')
      b = 1;

  if(a * b)
    printf("Yes\n");
  else
    printf("No\n");

  return 0;
}
  

Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

template <typename T> inline void voutput(T &v){
    rep(i, v.size()){
        if (i) cout << " " << v[i];
        else cout << v[i];
    }
    cout << endl;
}

int MAX_B = 64;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    int T;
    cin >> T;
    rep(t, T) {
        int N;
        cin >> N;
        vector<ll> A(N);
        rep(i, N) cin >> A[i];
        string s;
        cin >> s;
        vector<ll> B(MAX_B);
        bool ans = true;
        for(int i = N - 1; i >= 0; i--) {
            if(s[i] == '0') {
                for(int j = MAX_B - 1; j >= 0; j--) {
                    if((A[i] >> j) & 1) {
                        if(B[j] == 0) {
                            B[j] = A[i];
                            break;
                        }
                        else {
                            A[i] ^= B[j];
                        }
                    }
                }
            }
            else {
                for(int j = MAX_B - 1; j >= 0; j--) {
                    if((A[i] >> j) & 1) {
                        if(B[j] == 0) {
                            ans = false;
                            break;
                        }
                        else {
                            A[i] ^= B[j];
//                            cout << i << "," << j << "::" << A[i] << "," << B[j] << endl;
                        }
                    }
                }
                if(A[i] != 0) ans = false;
                if(!ans) break;
            }
            
//            cout << i << ":";
//            voutput(B);
        }
        output(ans ? 0 : 1);
    }
    
    return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using std::cin;
using std::cout;
using std::vector;
using std::pair;
using std::map;
using std::set;
const int mod = 1e9 + 7, N = 1e5 + 1;
long long n;
int main( )
{
 std::ios::sync_with_stdio( false );
 cin >> n;
 if( n % 11 == 0 )
 {
  cout << n / 11 * 2;
  return 0;
 }
 long long ans = n / 11 * 2;
 n = n - ans / 2 * 11;
 ans += n > 6 ? 2 : 1;
 cout << ans;
 return 0;
}

Measured memory_bytes: 3688
import java.util.*;
import java.io.*;
public class Main {
    
    public static void main(String[] args) {
	Scanner in=new Scanner(System.in);
	myMaxHeap heap=new myMaxHeap();
	
	PrintWriter out=new PrintWriter(System.out);
	while(true) {
	    char odr[]=in.next().toCharArray();
	    
	    if(odr[0]=='e' && odr[1]=='n')break;
	    else if(odr[0]=='i')heap.add(Integer.parseInt(in.next()));
	    else {
		out.println(heap.remove());
	    }
	}
	in.close();
	out.flush();
	
    }
    
}

class myMaxHeap{
    private int size=0,array[]=new int[2000001];
    
    myMaxHeap() {
	
    }
    
    public void add(int v) {
	size++;
	array[size]=v;
	
	formatWhenInsertion(size);
    }
    
    private void formatWhenInsertion(int i) {
	int next=i/2;
	
	if(next>=1 && array[i]>array[next]) {
	    int tt=array[next];
	    array[next]=array[i];
	    array[i]=tt;
	    
	    formatWhenInsertion(next);
	}
    }
    
    
    public int remove() {
	int res=array[1];
	
	array[1]=array[size];
	size--;
	tailor(1);
	return res;
    }
    
    public void build() {
	for(int i=size/2;i>=1;i--) {
	    tailor(i);
	}
    }
    
    private void tailor(int i) {
	int indexL=i*2,indexR=i*2+1,max=i;
	
	if(indexL<=size && array[indexL] > array[max])max=indexL;
	if(indexR<=size && array[indexR] > array[max])max=indexR;
	
	if(max!=i) {
	    //System.out.println("swap "+array[max]+" "+array[i]);
	    int tt=array[i];
	    array[i]=array[max];
	    array[max]=tt;
	    
	    tailor(max);
	}
    }
    

    public void dump(PrintWriter out) {
	for(int i=1;i<=size;i++)out.print(" "+array[i]);
	out.println();
	out.flush();
    }
}



Measured memory_bytes: 302556
//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }


int
main(void){  
  int r;

  cin >> r;

  if(r < 1200) cout << "ABC" << endl;
  else if(r < 2800) cout << "ARC" << endl;
  else cout << "AGC" << endl;
  
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
constexpr int INF = 1001001001;
using ll = long long;
using namespace std;
int main() {
    int n;
    cin >> n;
    vector<int> h(n);
    rep(i, n) cin >> h[i];
    
    vector<int> dp(n+10, INF);
    dp[0] = 0;
    dp[1] = abs(h[1] - h[0]);
    rep(i, n) {
        dp[i+2] = min(dp[i] + abs(h[i] - h[i+2]), dp[i+1] + abs(h[i+1] - h[i+2]));
    }
    
    cout << dp[n-1] << endl;
    
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, a, b) for(int i = a; i < b; i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fi first
#define se second
#define debug(x) cerr <<__LINE__<< ": " <<#x<< " = " << x << endl
#define debug_vec(v) cerr<<__LINE__<<": "<<#v<<" = ";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
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; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

void solve() {
    ll a, b, k;
    cin >> a >> b >> k;
    if (k > a) k -= a, a = 0, b = max(0LL, b - k);
    else a -= k;
    cout << a << " " << b << endl;
}

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


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf=0x7fffffff;
#define mp(a,b) make_pair(a,b)

int main(){
	int k;
	cin>>k;
	string s="";
	for(int i=0;i<k;i++){
		s+="ACL";
	}
	cout<<s;
	return 0;
}


Measured memory_bytes: 3592
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
#define ln '\n'
constexpr long long MOD = 1000000007LL;
//constexpr long long MOD = 998244353LL;
typedef long long ll;
typedef unsigned long long ull; 
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
template<class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true;} return false; }
template<class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true;} return false; }
///////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    ll N,M; cin >> N >> M;
    vector<ll> A(N);
    rep(i,N) cin >> A[i];

    ll S = accumulate(all(A),0LL);
    int cnt = 0;
    rep(i,N) {
        if (A[i]*4*M >= S) cnt++;
    }

    cout << (cnt >= M ? "Yes" : "No") << ln;
}



Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args) throws Exception{
		//BufferedInputStream bs = new BufferedInputStream(new FileInputStream(new File("data.txt")));
		//Scanner sc = new Scanner(bs);
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int W = sc.nextInt();
		int[][] items = new int[N+1][2];
		long[][] dp = new long[N+1][W+1];
		for(int i = 1; i <= N; i++) {
			for(int j = 0; j < 2; j++) {
				items[i][j] = sc.nextInt();
			}
		}
		for(int i = 1; i <= N; i++) {
			for(int j = 0; j <= W; j++) {
				if(j < items[i][0]) dp[i][j] = dp[i-1][j];
				else {
					dp[i][j] = Math.max(dp[i-1][j],dp[i-1][j-items[i][0]]+items[i][1]);
				}
			}
		}
		System.out.println(dp[N][W]);
	}
	public static void print(int[][] arr) {
		for(int[] a : arr)System.out.println(Arrays.toString(a));
	}
}


Measured memory_bytes: 140456
# import numpy as np
import sys, math, heapq
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial, gcd
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep="\n")

N = int(input())

res = pow(10, N, MOD) - (2 * pow(9, N, MOD) - pow(8, N, MOD))
res %= MOD
print(res)

Measured memory_bytes: 65272
n,m=map(int,input().split())
d={i:[] for i in range(1,n+1)}
a=['' for i in range(m)]
for i in range(1,m+1):
    p,y=map(int,input().split())
    d[p].append([i,y])
#print(d)
for p,j in d.items():
    j.sort(key=lambda x:x[1])
    for i in range(len(j)):
        a[j[i][0]-1]=format(p,'0>6')+format(i+1,'0>6')
print(*a,sep='\n')

Measured memory_bytes: 49172
seq = input().split()

stk = []
opr = ['+', '-', '*']

for e in seq:
    if e in opr:
        if e == '+':
            res = stk[-2] + stk[-1]
        elif e == '-':
            res = stk[-2] - stk[-1]
        elif e == '*':
            res = stk[-2] * stk[-1]
        stk = stk[:-2] + [res]
    else:
        stk.append(int(e))

print(stk[0])



Measured memory_bytes: 5600
#include <iostream>
#include <algorithm>
#include <cmath>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <string>
#include <cstring>
#include <climits>
#include <iomanip>

#define EPS 1e-7
#define LLMAX 9223372036854775807
#define INTMAX 2147483647
#define ULLMAX 18446744073709551615
#define precision(n) cout << setprecision(n) << fixed
#define forn(i, n) for (int i = 0; i<(int)n; ++i)
#define forr(i, t, n) for (int i = t; i<n; ++i)
#define rforr(i, t, n) (int i = n-1; i>=t; --i)
#define rfor(i, n) for (int i = n-1; i>=0; --i)
#define rmod(x, y) (((x%y)+y)%y)
#define pb push_back
#define emp emplace_back
using namespace std;
typedef vector<int>::iterator vit;
typedef unsigned int uint;
typedef unsigned short ushort;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
const int MAXN = 1024;

//STRUCTS


//OPERATORS


//GLOBALS


//FUNCTIONS


//PROBLEM: odds of oddness
//LINK: https://atcoder.jp/contests/abc142/tasks/abc142_a
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
		double n;
		cin >> n;
		double ans;
		precision(7);
		if (int(n)%2)
		{
			ans = ceil(n/2);
			ans /=n;
		}
		else ans = 1/2.00;
		cout << ans;



	return 0;
}

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

#define int long long
#define counter(m)     for(int i=0;i<m;i++)
#define gcd            __gcd
#define endl           "\n"
#define pb             emplace_back
#define setbits(x)     __builtin_popcountll(x)
#define zrobits(x)     __builtin_ctzll(x)
#define mod            1000000007
#define mod2           998244353
#define maxe           *max_element
#define mine           *min_element
#define inf            1e18
#define deci(x, y)      fixed<<setprecision(y)<<x
#define w(t)           int t; cin>>t; while(t--)
#define nitin          ios_base::sync_with_stdio(false); cin.tie(NULL)
#define PI             3.141592653589793238
using namespace std;

int32_t main() {
    nitin;
    int n;
    cin>>n;
    int zero=0;
    int one=0;
    int two=0;
    for(int i=0;i<n;i++)
    {
        int a;
        cin>>a;
        if(a%4==0)
            two++;
        else if(a%2==0)
            one++;
        else
            zero++;
    }
    if(one==0)
    {
        if(two+1>=zero)
        {
            cout<<"Yes"<<endl;
        }
        else{
            cout<<"No"<<endl;
        }
    }
    else{
        if(two>=zero)
        {
            cout<<"Yes"<<endl;
        }
        else{
            cout<<"No"<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3648
def q11(W):
    s = W.pop(0)
    deplicate = []
    deplicate.append(s)
    for w in W:
        if not w.startswith(s[-1]):
            return 'No'
    
        if w in deplicate:
            return 'No'
    
        deplicate.append(w)
        s = w
    return 'Yes'

N = int(input())
W = []
for _ in range(N):
    W.append(input())

print(q11(W))


Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>

int main(){
    int n, m;
    std::cin >> n >> m;
    std::vector<int> x(m);
    for(int i = 0; i < m; i++){
        std::cin >> x[i];
    }

    std::sort(x.begin(), x.end());

    // 例外処理
    if(n >= m){
        std::cout << 0 << std::endl;
        return 0;
    }

    // 区間を求める
    std::vector<int> interval(m - 1);
    for(int i = 1; i < m; i++){
        interval.push_back(x[i] - x[i - 1]);
    }

    
    std::sort(interval.begin(), interval.end(), std::greater<int>());

    int ans = x[m - 1] - x[0];
    for(int i = 0; i < n - 1; i ++){
        // 区間が大きいところから順に潰す
        ans -= interval[i];
    }

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


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

const int MAXN = 10010;
const int N = 10010;

int min[N];
std::vector<int> prime;
void init() {
    for (int i = 2; i < N; ++i) {
        if (!min[i]) {
            min[i] = i;
            prime.push_back(i);
        }
        for (int j = 0, sz = (int)prime.size(); j < sz && i * prime[j] < N; ++j) {
            min[i * prime[j]] = prime[j];
            if (i % prime[j] == 0) break;
        }
    }
}

int n;
int a[MAXN];
int id[MAXN];

bool check(int x, int p) {
    int sum = 0;
    for (int i = n; ~i; --i) {
        sum = (sum * x + a[i]) % p;
    }
    return sum == 0;
}

bool check(int p) {
    for (int i = 0; i < p; ++i) id[i] = i;
    std::random_shuffle(id, p + id);
    for (int i = 0; i < p; ++i) {
        if (!check(id[i], p)) {
            return false;
        }
    }
    return true;
}

int main() {
    srand((unsigned)time(NULL));
    init();
    scanf("%d", &n);
    int gcd = 0;
    for (int i = n; ~i; --i) {
        scanf("%d", a + i);
        gcd = std::__gcd(gcd, a[i]);
    }
    std::set<int> ans;
    if (gcd < 0) gcd = -gcd;
    for (int i = 2; i * i <= gcd; ++i) {
        if (gcd % i == 0) {
            ans.insert(i);
            while (gcd % i == 0) {
                gcd /= i;
            }
        }
    }
    if (gcd > 1) ans.insert(gcd);
    for (auto u : prime) {
        if (ans.count(u)) continue;
        if (check(u)) ans.insert(u);
    }

    for (auto u : ans) {
        printf("%d\n", u);
    }
    return 0;
}


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

#define NDEBUG
#ifdef DEBUG
#include "../cout11.h"
#undef NDEBUG
#endif
#include <cassert>

typedef long long ll;
typedef long double Double;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<long double> vD;

#define sz(a)  int((a).size())
#define pb  push_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))
#define cons make_pair


ll gcd(ll a, ll b) { while(a) swap(a, b%=a); return b; }


#define INTSPACE 12
char _buf[INTSPACE*1000000 + 3];

int loadint() {
    if (fgets(_buf, INTSPACE+3, stdin)==NULL) return 0;
    return atoi(_buf);
}

int loadvec(vector<int>& v, int N=-1) {
    if (N == -1) {
        N = loadint();
        if (N==0) return 0;
    }
    int bufsize = INTSPACE*N + 3;
    if (fgets(_buf, bufsize, stdin)==NULL) return 0;
    v.resize(N);

    int i=0;
    bool last = false;
    for (char *p=&_buf[0]; ;) {
        char *q = p;
        while (*q > ' ') ++q;
        if (*q == 0x0D || *q == 0x0A) last = true;
        *q = 0;
        v[i++] = atoi(p);
        if (last || i == N) break;
        p = q+1;
    }
    // assert(i <= N);
    return i;
}
void read_cr() {
    fgets(_buf, 256, stdin);
}

ll solve(int N,int X,vi& a) {
    vi d(N);
    rep(i,N) d[i] = abs(a[i] -  X);
    int z = d[N-1];
    rep(i,N-1) z = gcd(z, d[i]);

    return z;
}

int main() {
    int N,X; cin >> N >> X; read_cr();
    vi a(N);
    loadvec(a, N);
    cout << solve(N,X,a) << endl;
    return 0;
}


Measured memory_bytes: 2048
using System;
//F[A->B]の数を求めるときはF[B]-F[A-1]とすると楽

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] In = Console.ReadLine().Split(' ');
            long a = long.Parse(In[0]);
            long b = long.Parse(In[1]);
            long c = int.Parse(In[2]);
            long d = int.Parse(In[3]);
            long lcm = Lcm(c, d);
            //F[B]について
            long FB = b - (b / c) - (b / d) + (b / lcm);
            //F[A-1]について
            long FA = a - 1 - ((a - 1) / c) - ((a - 1) / d) + ((a - 1) / lcm);
            Console.WriteLine(FB - FA);
        }
        public static long Lcm(long a, long b)
        {
            return a * b / Gcd(a, b);
        }
        static long Gcd(long m, long n)
        {
            if (n == 0) return m;
            return Gcd(n, m % n);
        }
    }
}
//TLE
//namespace C
//{
//    class Program
//    {
//        static void Main(string[] args)
//        {
//            string[] In = Console.ReadLine().Split(' ');
//            long a = long.Parse(In[0]);
//            long b = long.Parse(In[1]);
//            long c = int.Parse(In[2]);
//            long d = int.Parse(In[3]);
//            long cc = 0;
//            long dd = 0;
//            long cdcd = 0;
//            int t = 1;
//            while (c * t <= b)
//            {
//                if (a <= c * t) cc++;
//                t++;
//            }
//            t = 1;
//            while (d * t <= b)
//            {
//                if (a <= d * t) dd++;
//                t++;
//            }
//            long cd = Lcm(c, d);
//            t = 1;
//            while (cd * t <= b)
//            {
//                if (a <= cd * t) cdcd++;
//                t++;
//            }
//            Console.WriteLine((b-a+1)-(cc+dd-cdcd));
//        }
//        public static long Lcm(long a, long b)
//        {
//            return a * b / Gcd(a, b);
//        }
//        static long Gcd(long m, long n)
//        {
//            if (n == 0) return m;
//            return Gcd(n, m % n);
//        }
//    }
//}

//配列が長すぎてコンパイルできない
//namespace C
//{
//    class Program
//    {
//        static void Main(string[] args)
//        {
//            long border = (long)Math.Pow(10, 18);
//            bool[] B = new bool[border+1];
//            string[] In = Console.ReadLine().Split(' ');
//            long a = long.Parse(In[0]);
//            long b = long.Parse(In[1]);
//            long c = int.Parse(In[2]);
//            long d = int.Parse(In[3]);
//            int t = 1;
//            while (c*t <= border)
//            { 
//                B[c*t] = true;
//                t++;

//            }
//            t = 1; 
//            while (d*t <= border)
//            {
//                B[d*t] = true;
//                t++;
//            }
//            long ans = 0;
//            for(long i=a; i <= b; i++)
//            {
//                if (B[i]) ans++;
//            }
//            Console.WriteLine(ans);
//        }
//    }
//}


Measured memory_bytes: 27512
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::*;
use std::str::FromStr;

#[allow(unused_macros)]
macro_rules! debug {($($a:expr),*) => {println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);}}
#[allow(unused_macros)]
macro_rules! input {(source=$s:expr,$($r:tt)*) => {let mut iter=$s.split_whitespace(); let mut next=||{iter.next().unwrap()}; input_inner! {next,$($r)*}};($($r:tt)*) => {let stdin=std::io::stdin();let mut bytes=std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next=move||->String{bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect()}; input_inner! {next,$($r)*}};}
#[allow(unused_macros)]
macro_rules! input_inner {($next:expr) => {}; ($next:expr,) => {}; ($next:expr,$var:ident:$t:tt$($r:tt)*) => {let $var=read_value!($next,$t); input_inner! {$next$($r)*}};}
#[allow(unused_macros)]
macro_rules! read_value {($next:expr,($($t:tt),*)) => {($(read_value! ($next,$t)),*)}; ($next:expr, [$t:tt; $len:expr]) => {(0..$len).map(|_|read_value! ($next,$t)).collect::<Vec<_>>()}; ($next:expr,chars) => {read_value! ($next,String).chars().collect::<Vec<char>>()}; ($next:expr,usize1) => {read_value! ($next,usize)-1}; ($next:expr,$t:ty) => {$next().parse::<$t>().expect("Parse error")};}

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);
impl<T: PartialEq> Eq for Total<T> {}
impl<T: PartialOrd> Ord for Total<T> {
    fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering {
        self.0.partial_cmp(&other.0).unwrap()
    }
}

#[allow(dead_code)]
const MAX: usize = 100006;
#[allow(dead_code)]
const INF_U32: u32 = 1 << 31;
#[allow(dead_code)]
const INF_I32: i32 = 1 << 30;
#[allow(dead_code)]
const INF_U64: u64 = 1 << 63;
#[allow(dead_code)]
const INF_I64: i64 = 1 << 62;
#[allow(dead_code)]
const MOD: i64 = 1e9 as i64 + 7;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

#[allow(unused_imports)]
use std::f64;


fn main() {
    input!{x:i64,y:i64};
    let mut abs = (x.abs()-y.abs()).abs();
    let xa = x.abs();
    let ya = y.abs();

    if x>=0 && y>0 && xa>ya {abs+=2;}
    else if x>=0 && y<0 && xa<ya {abs+=1;}
    else if x>=0 && y<=0 && xa>=ya {abs+=1;}
    else if x<0 && y>=0 && xa<ya {abs+=1;}
    else if x<0 && y>0 && xa>=ya {abs+=1;}
    else if x<0 && y<0 && xa<ya {abs+=2;}
    println!("{}",abs);
}


Measured memory_bytes: 4352
#include <iostream>
#include<bits/stdc++.h>
#define int unsigned long long int
#define vi vector<int>
#define vvi vector<vector<int>>
using namespace std;

int32_t main() {
	// your code goes here
	int t,x=1;
	
	  //cout<<"Case #"<<x++<<":\n";
	  int n,i,j,k;
cin>>n;
vi a(n+1),prod(n+1,1);
for(i=0;i<n;i++)
{cin>>a[i];

}

int prof=1000;
for(i=0;i<n;i++)
{
    for(j=i+1;j<n;j++)
    {
        if(a[j]<a[j-1])
        break;
    }
    j--;
    prof=a[j]*(prof/a[i])+prof-a[i]*(prof/a[i]);
    i=j;
}
	  
	    
cout<<prof<<"\n";	  
	
	
	return 0;
}


Measured memory_bytes: 3632
#include <stdio.h>

const long long mod = 998244353;
const long long inv2 = (mod + 1) / 2;

int N, S; long long D[3030];

int main()
{
	scanf ("%d %d", &N, &S);
	
	D[0] = 1;
	for (int i = 0; i < N; i++) D[0] = D[0] * 2 % mod;
	
	while (N--){
		int x; scanf ("%d", &x);
		for (int i = S - x; i >= 0; i--){
			D[i + x] = (D[i + x] + D[i] * inv2) % mod;
		}
	}

	printf ("%lld\n", D[S]);

	return 0;
}


Measured memory_bytes: 3240
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>

using namespace std;

int main(){
	long long int A,B,K,cnt=0;
	cin>>A>>B>>K;
	
	while(1){
		if(A%2!=0){
			A--;
		}
		if(A%2==0){
			A=A/2;
			B+=A;
		}
		cnt++;
		if(cnt>=K){
			break;
		}
		if(B%2!=0){
			B--;
		}
		if(B%2==0){
			B=B/2;
			A+=B;
		}
		cnt++;
		if(cnt>=K){
			break;
		}
	}
	cout<<A<<" "<<B<<endl;
	return 0;
}

Measured memory_bytes: 256
s = input()
for i in range(len(s)):
    if i%2==1:
        if s[i]=="L" or s[i]=="U" or s[i]=="D":
            pass
        else:
            print("No")
            break
    else:
        if s[i]=="R" or s[i]=="U" or s[i]=="D":
            pass
        else:
            print("No")
            break
else:
    print("Yes")

Measured memory_bytes: 3064
using System.Linq;
using System.Collections.Generic;

public class Hello{
    public static void Main(){
        // Here your code !
        string input;
        input = System.Console.ReadLine();
        string[] abc = input.Split(' ');
        int[] nums = abc.ToList().ConvertAll<int>(x => int.Parse(x)).ToArray();
        string result = "NO";
        for (int i=0; i<nums[1]; i++)
        {
            if (nums[2] == (nums[0] * i ) %  nums[1])
            {
                result = "YES";
            }
        }

        System.Console.WriteLine(result);
    }

    public static string First (string word)
    {
        return word.Substring(0,1);
    }

    public static string Last (string word)
    {
        return word.Substring(word.Length-1,1);
    }
}


Measured memory_bytes: 11220
using System;
using System.Linq;

namespace ConsoleApp12
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ') ;
            int X = int.Parse(input[0]);
            int Y = int.Parse(input[1]);
            int YD = Y / 2;
            Console.WriteLine(X + YD);
        }
    }
}


Measured memory_bytes: 13140
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <cassert>
#include <memory>
#include <stack>
#include <set>
#include <map>

#define MAX_SIZE 100000000
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

int main() {
  string A,B,C; cin>>A>>B>>C;
  reverse(A.begin(), A.end());
  reverse(B.begin(), B.end());
  reverse(C.begin(), C.end());
  auto s = A.back();
  A.pop_back();
  for(;;) {
    if(s == 'a') {
      if(A.empty()) { break; }
      s = A.back();
      A.pop_back();
    } else if(s == 'b') {
      if(B.empty()) { break; }
      s = B.back();
      B.pop_back();
    } else if(s == 'c') {
      if(C.empty()) { break; }
      s = C.back();
      C.pop_back();
    }
  }

  cout << (char)toupper(s) << endl;
}


Measured memory_bytes: 256
object Main extends App{
  import scala.io.StdIn
  val a =  for(i <- 1 to 3) yield StdIn.readLine().split(" ").map(_.toInt)
  val n = StdIn.readInt()
  val nums = for (i <- 1 to n) yield StdIn.readInt()
  val bingoPattern = Seq(((0,0),(0,1),(0,2)), ((1,0),(1,1),(1,2)), ((2,0),(2,1),(2,2)), ((0,0),(1,0),(2,0)),
                        ((0,1),(1,1),(2,1)), ((0,2),(1,2),(2,2)), ((0,0), (1,1), (2,2)), ((0,2),(1,1),(2,0)))
  val isBingo = bingoPattern.map {
    case (p1, p2, p3)
      if nums.contains(a(p1._1)(p1._2)) && nums.contains(a(p2._1)(p2._2)) && nums.contains(a(p3._1)(p3._2))
      => "Bingo"
    case _ => "No"
  }
  println(if (isBingo.contains("Bingo")) "Yes" else "No")
}

Measured memory_bytes: 25416
#include<cstdio>
#include<cstring>
#include<algorithm>
typedef long long ll;
typedef long double ld;
ld Max(ld a,ld b){return a>b?a:b;}
inline ll read()
{
	ll x=0,f=1;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-') f=-1;c=getchar();}
	while(c>='0'&&c<='9'){x=(x<<3)+(x<<1)+c-'0';c=getchar();}
	return x*f;
}
ll k,a;
ld MAA,uu;
ll rr(ll x)
{
	ll now=0;
	while(x) now+=x%10,x/=10;
	return now;
}
bool check(ll x)
{
	//printf("%lldzx\n",x);
	ll g=1;
	while(g<=x)
	{
		//printf("%lld %lld %lld %lld %lld %lf %lf\n",g,(x+g),rr(x+g),x,rr(g),(double)1.0*(x+g)/rr(x+g),(double)1.0*x/rr(x));
		if((ld)(x+g)*rr(x)<(ld)x*rr(x+g))return 0;
		g=(g<<3)+(g<<1);
	}
	return 1;
}
int main()
{
	//printf("%lf\n",(double)2/1);
	scanf("%lld",&k);
	while(k--)
	{
		ll r=1;
		while(1)
		{
			if(check(r+a))
			{
				a+=r;
				break;
			}
			r=(r<<3)+(r<<1);
		}
		printf("%lld\n",a);
	}
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 1e9;
const int maxN = 100 * 100 + 9;
const double EPS = 1e-9;

int n, m;
ll v[maxN][3];

void read(){
  cin >> n >> m;
  for(int i = 0; i < n; i++)
    for(int j = 0; j < 3; j++)
      cin >> v[i][j];
}

void solv(){
  ll fres = 0;
  for(int bitmask = 0; bitmask < (1 << 3); bitmask++){
    vector<ll> a(n);
    for(int i = 0; i < n; i++){
      for(int j = 0; j < 3; j++)
        if(bitmask & (1 << j))  a[i] += v[i][j];
        else a[i] -= v[i][j];
    }

    sort(a.begin(), a.end());
    ll cur = 0;
    for(int i = n - 1; i >= n - 1 - m + 1; i--)
      cur += a[i];
    fres = max(fres, cur);
  }

  cout << fres << '\n';
}

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

  #ifdef DEBUG
    freopen("in.txt", "r", stdin);
  #endif

  read();
  solv();

  return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var h, w, a, b int
	fmt.Scan(&h, &w, &a, &b)

	for i := 0; i < h; i++ {
		for j := 0; j < w; j++ {
			s := 1
			if j < a && i < b {
				s = 0
			}
			if j >= a && i >= b {
				s = 0
			}
			fmt.Print(s)
		}
		fmt.Println()
	}
}


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

int main() {
int h,w,c;
cin>>h>>w;
Graph g(h);
rep(i,h)cin>>g[i];
rep(i,h)rep(j,w){
  if(g[i][j]=='#')c++;
}
queue<P> q;
vector<vector<int>> dist(h,vector<int>(w,-1)); 
q.push(make_pair(0,0));
int dx[4]={0,0,-1,1};
int dy[4]={1,-1,0,0};
while(!q.empty()){
  P ab=q.front();
  ll x=ab.first;
  ll y=ab.second;
  q.pop();
  rep(i,4){
    int nx=x+dx[i];
    int ny=y+dy[i];
    if(nx<0||ny<0||nx>=h||ny>=w)continue;
    if(g[nx][ny]=='#')continue;
    if(dist[nx][ny]!=-1)continue;
    dist[nx][ny]=dist[x][y]+1;
    q.push(make_pair(nx,ny));
  }
}
if(dist[h-1][w-1]==-1){
  cout<<-1<<endl;
}else{
  cout<<h*w-dist[h-1][w-1]-c-2<<endl;
}
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
  
#define check cnt=0;for(j=0;j<6;j++)if(d[q][j]==d[r][j])cnt++;
#define m tmp=d[r][1];d[r][1]=d[r][3];d[r][3]=d[r][4];d[r][4]=d[r][2];d[r][2]=tmp;
#define y tmp=d[r][0];d[r][0]=d[r][3];d[r][3]=d[r][5];d[r][5]=d[r][2];d[r][2]=tmp;
  
bool same(int d[][6],int q,int r){
 int tmp,cnt,j,a=1,i,k;
 check if(cnt==6)a=0;
  
 while(a){
  for(i=0;i<5;i++){
   for(k=0;k<4;k++){
    check if(cnt==6)break;
    m
   }
   check if(cnt==6)break;
   tmp=d[r][0];
   d[r][0]=d[r][1];
   d[r][1]=d[r][5];
   d[r][5]=d[r][4];
   d[r][4]=tmp;
  }
  if(cnt==6)break;
  y
  for(k=0;k<4;k++){
   check if(cnt==6)break;
   m
  }
  if(cnt==6)break;
  y y
  for(k=0;k<4;k++){
   check if(cnt==6)break;
   m
  }
  a=0;
 }
  
 if(cnt==6)return true;
 return false;
}

int main(){
 int n,judge=0;
 cin >> n;
 int d[n][6];
  
 for(int i=0;i<n;i++)for(int j=0;j<6;j++)cin >> d[i][j] ;
  
 for(int q=0;q<n-1;q++)for(int r=q+1;r<n;r++)if(same(d,q,r))judge++;

 if(judge>0)cout << "No" << endl ;
 else cout << "Yes" << endl ;
  
 return 0;
}

Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1e18

int main() {
    string s;
    string front = "", back = "";
    cin >> s;
    bool b = 0;
    int Q;
    cin >> Q;
    for (int i = 0; i < Q; i++) {
        int T;
        cin >> T;
        if (T == 1) b = !b;
        if (T == 2) {
            int F;
            char C;
            cin >> F >> C;
            F--;
            if (F == b)
                front = C + front;
            else
                back = back + C;
        }
    }
    string ans = front + s + back;
    if (b) reverse(ans.begin(), ans.end());
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1512
// بِسمِ اللہِ  الرَّحم?نِ  الرَّ حِیم
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define MOD 1000000007
#define ll long long
#define pb push_back
#define all(v) v.begin(),v.end()
#define INF 1e18
#define N 9999999
typedef pair<ll,ll> pll;
ll power(ll a,ll b)
{
    if(b==1)return a;
    if(b==0)return 1;
    ll temp=power(a,b/2);
    ll ans=temp*temp;
    if(b&1)
        ans*=a;
    return ans;
}
ll power(ll a,ll b,ll p)
{
    a=a%p;
    if(b==1)return a;
    if(b==0)return 1;

    ll temp=power(a,b/2,p);
    ll ans=(temp*temp)%p;
    if(b&1)
        ans=(a*ans)%p;
    return ans;
}
ll inv(ll a)
{
    return power(a,MOD-2,MOD);
}
//code begins

signed main()
{

//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);

    ios_base::sync_with_stdio (false);
    ll t;
    t=1;
//    cin>>t;
    while(t--)
    {
        ll a,b,c;cin>>a>>b>>c;
        set<ll> s;
        s.insert(a);
        s.insert(b);
        s.insert(c);
        if(s.size()==2)
            cout<<"Yes\n";
        else
            cout<<"No\n";
    }
}


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

int main(void) {

    unsigned long money;
    scanf("%lu",&money);
    unsigned long max = money;
    unsigned long internal_m = 100;

    unsigned long count = 0;

    while(internal_m < max){
        internal_m = (unsigned long)((long double)internal_m * 1.01);
        count++;
    }

    printf("%lu\n",count);

    return 0;
}

Measured memory_bytes: 2152
#include <stdio.h>

int main(void) {
    long long N, x, p, i, j;
    scanf("%lld", &N);
    if (N%2==1) {
        printf("0");
        return 0;
    }
    x=0; j=1;
    while (1) {
        p=2;
        for (i=1; i<=j; i++) p*=5;
        if (N/p!=0) x+=N/p;
        else break;
        j++;
    }
    printf("%lld", x);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int n,m;

int main(){
	cin>>n>>m;
	cout<<(500*n>=m?"Yes":"No")<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <queue>
#include <iomanip>
#define rep(i, a, b) for (long long i = (a); i < (b); i++)
#define rep2(r, aa, bb) for (long long r = (aa)-1; r >= (bb); r--)
 
using namespace std;
 
 int main(){
    long long n , m, ac=0, wa=0;
    cin >> n >> m;
    vector <int> ch(n+1, 0);
    rep(i,0,m){
        int v;
        string vv;
        cin >> v >> vv;
        if(ch[v]!=-1){
            if(vv=="WA"){
                ch[v]++;
            }else{
                ac++;
                wa+=ch[v];
                ch[v]=-1;
            }
        } 
    }
    cout << ac << " " << wa << endl;
 }

Measured memory_bytes: 640
#include <stdio.h>
int main(void)
{
    int a,b,c;
    int temp;
    
    scanf("%d %d %d",&a,&b,&c);

    if(a>b){
        temp=a;
        a=b;
        b=temp;
    }if(b>c){
        temp=b;
        b=c;
        c=temp;
    }if(a>b){
        temp=a;
        a=b;
        b=temp;
    }
    printf("%d %d %d\n",a,b,c);

    return 0;
}


Measured memory_bytes: 2100
#include<bits/stdc++.h>
//#include<iostream>
//#include<cstdio>
//#include<cstring>
//#include<string>
//#include<queue>
//#include<cmath>
//#include<algorithm>
#define debug1 cout<<"?"<<endl;
#define debug2 cout<<"?"<<i<<endl;
#define PII pair<int,int>
typedef long long ll;
const int maxn=2e5+9;
const double pi=acos(-1);
const int mod=1e9+7;
const int INF=0x3f3f3f3f;
const double ep=1e-7;
using namespace std;
int main()
{
	ll a,b,c;
	scanf("%lld%lld%lld",&a,&b,&c);
	if(c-a-b<0)puts("No");
	else if(4*a*b<(c-a-b)*(c-a-b))puts("Yes");
	else puts("No");
}

Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
#include<string>
using namespace std;
#define ll long long
int main()
{
    ll n;
    string str;
    cin>>n;
    cin>>str;
    ll count=0;
    for(ll i=0;i<=n-3;i++)
    {
        if(str[i]!='A')
         continue;
         else
         {
             if(str[i+1]=='B' && str[i+2]=='C')
              count++;
         }
    }
    cout<<count<<endl;
    
     return 0;
    
}

Measured memory_bytes: 256
n = gets.to_i
as = gets.split.map(&:to_i)

ans = []

n.times do |i|
  if i.odd?
    ans.push(as[i])
  else
    ans.unshift(as[i])
  end
end

puts n.odd? ? ans.join(" ") : ans.reverse!.join(" ")


Measured memory_bytes: 25572
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#define rep(i,n) for (int i = 0; i <= (n); ++i)
#define rip(i,n) for (int i = 1; i <= (n); ++i)
using namespace std;
int main() {
	int a, b;
	cin >> a >> b;
	int ans;
	if (a > b) {
		ans = a + (a - 1);
	}
	else if (b > a) {
		ans = b + (b - 1);
	}
	else {
		ans = a + b;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Data.SqlTypes;
using System.IO.Pipes;
using System.Linq;

class Program
{ 
	public static int Main()
	{
		Scanner cin = new Scanner();
	  int n = cin.nextInt(), a = cin.nextInt(), b = cin.nextInt(), c = cin.nextInt(), d = cin.nextInt();
	  int japanese = a / c;
	  if (a % c != 0)
	  {
	    ++japanese;
	  }
	  int math = b / d;
	  if (b % d != 0)
	  {
	    ++math;
	  }
    Console.WriteLine(n - Math.Max(japanese, math));
		return 0;
	}

}

class Scanner {
	string[] s;
	int i;

	char[] cs = new char[] { ' ' };

	public Scanner() {
		s = new string[0];
		i = 0;
	}

	public string next() {
		if (i < s.Length) return s[i++];
		do {
			s = Console.ReadLine().Split(cs, StringSplitOptions.RemoveEmptyEntries);
		} while ((s.Length == 1 && s[0] == "") || s.Length == 0);
		i = 0;
		return s[i++];
	}

	public int nextInt() {
		return int.Parse(next());
	}

	public long nextLong() {
		return long.Parse(next());
	}

	public double nextDouble() {
		return double.Parse(next());
	}

}

Measured memory_bytes: 5612
#include <iostream>
#include <vector>
#include <map>
using namespace std;

typedef pair<string, int> P;

int main(){
  int n, t;
  vector<P> v;
  
  cin >> n >> t;
  
  int h1, m1, h2, m2;
  char c; string str;
  cin >> h1 >> c >> m1 >> str;
  if( n == 1 ) {
    cout << 0 << endl;
    return 0;
  }
  for(int i=0; i<n; i++) {
    cin >> h1 >> c >> m1 >> str;
    cin >> h2 >> c >> m2 >> str;
    int A = h2*60+m2 - (h1*60+m1);
    if( A >= t ) {
      v.push_back( make_pair( str, A ) );
    }
  }

  cout << v.size() << endl;
  for(int i=0; i<v.size(); i++) {
    cout << v[i].first << " " << v[i].second << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1224
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  ll N;
  cin >> N;
  vector<ll> vec(5);
  ll m = 0;
  REP(i, 5) {
    cin >> vec[i];
    if (vec[i] < N) {
      ll tmp = (N + vec[i] - 1) / vec[i];
      m = max(m, tmp);
    }
  }
  if (m != 0) {
    cout << m + 4 << endl;
  } else {
    cout << 5 << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MAX (ll)(5e5 + 7)
#define INF (ll)(1e18)
#define MOD (ll)(1e9 + 7)

using namespace std;
using ll = long long;
using cd = complex<double>;
using p = pair<ll,  ll>;
using pp = pair<pair<ll, ll>, pair<ll, pair<ll, ll>>>;

int f[MAX];
int mult (int a, int b) {
	return (a * 1LL * b) % MOD;
}

int add (int a, int b) {
	b = (b + MOD) % MOD;
	return (a + b) % MOD;
}

int pw (int a, int b) {
	int r = 1;
	while (b) {
		if (b & 1) {
			r = mult (r, a);
		}
		b >>= 1;
		a = mult (a, a);
	}
	return r;
}

int nck (int n, int k) {
	if (k > n || n < 0 || k < 0) {
		return 0;
	}
	return mult (f[n], pw (mult (f[n - k], f[k]), MOD - 2));
}

int npk (int n, int k) {
	if (k > n || n < 0 || k < 0) {
		return 0;
	}
	return mult (f[n], pw (f[n - k], MOD - 2));
}

int main () {
	int n, m;
	cin >> n >> m;
	f[0] = 1;
	for (int i = 1; i < MAX; i++) {
		f[i] = mult (f[i - 1], i);
	}
	if (m < n) {
		cout << "0\n";
		return 0;
	}
	int ans = mult (f[m], pw (pw (f[m - n], 2), MOD - 2));
	int a =  0;
	for (int i = 0; i <= n; i++) {
		int xx = mult (nck (n, i), f[m - i]);
		if (i & 1) {
			a = add (a, -xx);
		}
		else {
			a = add (a, xx);
		}
	}
	cout << mult (ans, a) << "\n";
}


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

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



int main(){
    int N,i;
    int v[50];
    float price = 0;
    scanf("%d",&N);
    for(i = 0;i < N ; i++){
        scanf("%d",&v[i]);
    }
    qsort(v, N, sizeof(int), compare_int);
    price = v[0];
    for(i = 1 ; i < N ; i++){
        price = (v[i] + price)/2;
    }
    printf("%f",price);
    return 0;



}

Measured memory_bytes: 128
/*input
byebye
*/
#include <bits/stdc++.h>
using namespace std;
int freq[200005],n,dp[200005],i;
unordered_map<int,int> best;
inline int get(int k){
	return best.find(k)!=best.end()?best[k]:dp[i-1];
}
int main(){
	#ifdef ONLINE_JUDGE
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	#endif
	long long q,m,k,h,ans=0,sum=0,p,x,y;
	string s;
	cin>>s;
	n=s.size();
	s='.' + s;
	for(int i=1;i<=n;++i)
		freq[i]=freq[i-1]^(1<<(s[i]-'a'));
	for(best[0]=0,i=1;i<=n;++i){
		dp[i]=1+get(freq[i]);
		for(int j=0;j<26;++j)
			dp[i]=min(dp[i],1+get(freq[i]^(1<<j)));
		if(best.find(freq[i])==best.end()) best[freq[i]]=dp[i];
		else best[freq[i]]=min(best[freq[i]],dp[i]);
	}
	cout<<dp[n];
}

Measured memory_bytes: 10236
n, a, b, c, d = map(int, input().split())
s = input()

ans = 'Yes'
if s[a:c].find('##') > -1:
    ans = 'No'
elif s[b:d].find('##') > -1:
    ans = 'No'
else:
    if d < c:
        if s[b-2:d+1].find('...') == -1:
            ans = 'No'

print(ans)


Measured memory_bytes: 3516
#include<bits/stdc++.h>
#include<vector>
#define int long long
#include<string>
#define float long double
using namespace std;
   signed main()
 {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n,s=0;
  cin>>n;
  for(int i=1;i<n;i++)
    s=s+i;
  cout<<s;
}


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

int main()
{
    int N;
    string S;
    bool x = false;

    cin >> N;

    for (int i = 0; i < N; i++)
    {
        //Enter P W G Y
        cin >> S;
        if (S == "Y") x=true;
    }

    if (x) cout << "Four" << endl;
    else cout << "Three" << endl;
}


Measured memory_bytes: 256