akhauriyash/Code-Regression huggingface dataset:
#pragma region _head

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<iomanip>
#include<queue>
#include<stack>
#include<numeric>
#include<utility>
#include<regex>

void Init() {
	std::cin.tie(0); std::ios::sync_with_stdio(false);
	struct Init_caller { Init_caller() { Init(); } }caller;
}

#pragma region _define

#define int LL
#define f(i,a,b) for(LL i=a;i<b;i++)
#define f_vI(v,n) f(i,0,n)cin>>v[i]
#define f_v2I(v1,v2,n) f(i,0,n)cin>>v1[i]>>v2[i]
#define f_v3I(v1,v2,v3,n) f(i,0,n)cin>>v1[i]>>v2[i]>>v3[i]
#define f_vO(v,n) f(i,0,n)cout<<v[i]<<endl
#define ei else if
#define all(a) a.begin(),a.end()
#define size(s) ((LL)s.size())
#define F first
#define S second
#define check() cout<<"! ! !"
#define endl "\n"
#define _y() cout<<"Yes"<<endl
#define _Y() cout<<"YES"<<endl
#define _n() cout<<"No"<<endl
#define _N() cout<<"NO"<<endl
#define int_INF 1<<29
#define ll_INF 1LL<<60
#define MOD 1000000007

#pragma endregion

#pragma region _using

using namespace std;

using LL = long long;
using st = string;
using vi = vector<LL>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vd = vector<double>;
using vvd = vector<vd>;
using vvvd = vector<vvd>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<st>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using qi = queue<LL>;
using qc = queue<char>;
using qs = queue<st>;
using si = stack<LL>;
using sc = stack<char>;
using ss = stack<st>;
using pi = pair<LL, LL>;
using ppi = pair<pi, LL>;
using mll = map<LL, LL>;
using mcl = map<char, LL>;
using vpi = vector<pi>;
using vppi = vector<ppi>;

#pragma endregion

struct edge {
	int from, to, cost;
};

void y_n(bool p) {
	p ? _y() : _n();
}

void Y_N(bool p) {
	p ? _Y() : _N();
}

LL gcd(LL a, LL b) {
	LL r;
	while ((r = a % b) != 0) {
		a = b;
		b = r;
	}
	return b;
}
LL lcm(LL a, LL b) {
	return (a / gcd(a, b) * b);
}

//素数判定
bool is_prime(int n) {
	for (int i = 2; i*i <= n; i++) {
		if (n % i == 0) {
			return false;
		}
	}
	return true;
}

//階乗計算
LL factorial(LL n) {
	LL a = 1, ret = 1;
	while (a < n) {
		a++;
		ret *= a;
		ret %= MOD;
	}
	return ret;
}


#pragma endregion 


/*****************************************************************************/
signed main(void) {
	int n, a, b;
	cin >> n >> a >> b;
	vi v(n);
	f_vI(v, n);
	sort(all(v), greater<int>());
	double ave = 0;
	f(i, 0, a) {
		ave += v[i];
	}
	ave /= (double)a;
	cout << fixed << setprecision(10) << ave << endl;

	int C[51][51] = { 0 };
	C[0][0] = 1;
	f(i, 1, 51) {
		f(j, 0, i+1) {
			C[i][j] += C[i - 1][j];
			if (j > 0) {
				C[i][j] += C[i - 1][j - 1];
			}
		}
	}
	int ans = 0;
	int num = 0;
	f(i, 0, n) {
		if (v[i] == v[a - 1])num++;
	}
	if (v[0] == v[a - 1]) {
		f(i, a, b+1) {
			ans += C[num][i];
		}
	}
	else {
		int A = 0;
		f(i, 0, a) {
			if (v[i] == v[a - 1]) {
				A++;
			}
		}
		ans = C[num][A];
	}
	cout << ans;
	return 0;
}

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

typedef long long int ll;
typedef unsigned long long int ull;
#define rep(i,n) for(ll i=0;i<(n);i++)

using namespace std;



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

    if(n == 1)  cout << abs(a[n-1]-y) << endl;
    else        cout << max(abs(a[n-1]-y), abs(a[n-1]-a[n-2])) << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define db double
#define pint pair<int,ll>
#define mk make_pair
#define pb push_back
#define eb emplace_back
#define ins insert
#define fi first
#define se second
#define Rep(x,y,z) for(int x=y;x<=z;x++)
#define Red(x,y,z) for(int x=y;x>=z;x--)
using namespace std;
char buf[1<<12],*pp1=buf,*pp2=buf,nc;int ny;
inline char gc() {return pp1==pp2&&(pp2=(pp1=buf)+fread(buf,1,1<<12,stdin),pp1==pp2)?EOF:*pp1++;}
//inline char gc(){return getchar();}
inline int read(){
	int x=0;for(ny=1;nc=gc(),(nc<48||nc>57)&&nc!=EOF;)if(nc==45)ny=-1;if(nc<0)return nc;
	for(x=nc-48;nc=gc(),47<nc&&nc<58&&nc!=EOF;x=(x<<3)+(x<<1)+(nc^48));return x*ny;
}
int last;ll ans;
int main(){
//	freopen("std.in","r",stdin);
//	freopen("std.out","w",stdout);
	for(int n=read(),x;n;n--){
		x=read();
		if(last&&x)ans++,x--;
		ans+=x/2,x%=2,last=x;
	}cout<<ans<<'\n';
	return 0;
}




Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//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; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

int main(){
    double A, B, C, D, E, F;
    cin >> A >> B >> C >> D >> E >> F;

    int solution, solvent;
    double tmp = -1;
    for(int a=0; 100*A*a<=F; a++){
        for(int b=0; 100*(A*a+B*b)<=F; b++){
            if(a == 0 && b == 0) continue;
            for(int c=0; 100*(a*A+b*B)+c*C<=F; c++){
                for(int d=0; 100*(A*a+B*b)+(C*c+D*d)<=F; d++){
                    if((C*c+D*d) <= E*(A*a+B*b)){
                        if( (double)(C*c+D*d)/(100*A*a+100*B*b+C*c+D*d) > tmp ){
                            tmp = (double)(C*c+D*d)/(100*A*a+100*B*b+C*c+D*d);
                            solution = (100*A*a+100*B*b+C*c+D*d);
                            solvent = (C*c+D*d);
                        }
                    }
                }
            }
        }
    }

    printf("%d %d\n", solution, solvent);
}

Measured memory_bytes: 256
q,m,d,b;main(n){for(;scanf("%d%d",&n,&q)*n;printf("%d\n",b)){int c[100]={b=0};for(;n--;)for(scanf("%d",&m);m--;++c[d]>=q&&(c[d]-c[b])*100>d-b?b=d:0)scanf("%d",&d);}}

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

using namespace std;

typedef long long ll;
#define sint(a) scanf("%d",&a)
#define sint2(a,b) scanf("%d %d",&a,&b)
#define sll(a) scanf("%lld",&a)
#define sll2(a,b) scanf("%lld %lld",&a,&b)
#define mem(a,i) memset(a,i,sizeof(a))

int main()
{
    int n;
    string s;
    cin>>n>>s;
    n%=26;
    for(int i=0;i<s.length();i++)
    {
        int k=s[i]-'A'+n;
        k%=26;
        s[i]='A'+k;
    }
    cout<<s;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define ALL(a)    a.begin(), a.end() 
#define rep(i, K, N)  for(long long int i = K; i < N; i++)
#define ll long long int
using namespace std;

int main(){
ll N, X, T;cin >> N >> X >> T;

if(N%X == 0)cout << (N/X)*T;
  
else cout << (N/X + 1)*T;


}

Measured memory_bytes: 3628
N,M = map(int, input().split())
a = []

for n in range(N):
    a.append(list(map(int, input().split())))
    
c = [int(input()) for n in range(M)]

for n in range(N):
    res = 0
    for m in range(M):
        res += a[n][m] * c[m]
    print(res)



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

int main() {
    cin.tie(0)->sync_with_stdio(false);

	int n, k; cin >> n >> k;
	vector<ll> x(n);
	REP(i, n) cin >> x[i];

	ll res = 1e18;
	REP(i, n - k + 1) {
		ll l = abs(x[i]) + abs(x[k-1+i] - x[i]);
		ll r = abs(x[k-1+i]) + abs(x[k-1+i] - x[i]);
		res = min(res, min(l, r));
	}
	cout << res << '\n';
    return 0;
}


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

int main(){
    int n, k, x;
    cin >> n >> k;
    int ans = 0;
    rep(i, n){
        cin >> x;
        ans += min(x, k-x)*2;
    }
    cout << ans << endl;
    return 0;
}

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

#define INF 1000000000
int n,a[21],ans;

void dfs(int diff,int k){
  if (k==n)
    ans=min(ans,abs(diff));
  else{
    dfs(diff+a[k],k+1);
    dfs(diff-a[k],k+1);
  }
}

int main(){
  while(cin>>n,n){
    for(int i=0;i<n;i++)
      cin>>a[i];
    ans=INF;
    dfs(0,0);
    cout<<ans<<endl;
  }
}

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

int main()
{
  ll a,x,y,z,b,n;
  cin>>a>>b>>n;

  x=((a*(b-1))/b)-(a*((b-1)/b));
  y=((a*n)/b) - (a*(n/b));

  if(n>=b-1)
        cout<<x;
  else
    cout<<y;

 return 0;

}


Measured memory_bytes: 3620
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A
def A():
    n = I()
    print(n*800-200*(n//15))

#B
def B():
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

def J():
    return

def K():
    return

#Solve
if __name__ == "__main__":
    A()


Measured memory_bytes: 38512
import sys
from collections import deque

a, b, c = sys.stdin.read().split()

def main():
    deck = dict([('a', deque(a)), ('b', deque(b)), ('c', deque(c))])

    p = 'a'
    while True:
        if deck[p]:
            p = deck[p].popleft()
        else:
            return p.upper()

if __name__ == '__main__':
    ans = main()
    print(ans)

Measured memory_bytes: 3316
N = int(input())
p = list(map(int,input().split()))
ans = 0
for i in range(N):
  if p[i] == i+1:
    p[i] = -1
  else:
    p[i] = 0
    
for j in range(N-1):
  if p[j] == -1:
    ans += 1
    p[j] = 0
    p[j+1] = 0
if p[N-1] == -1:
  ans += 1
print(ans)
    


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

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

  string ans = "APPROVED";
  for (int i = 0; i < N; i++) {
    int A;
    cin >> A;
    if (A % 2 == 0) {
      if (A % 3 == 0) continue;
      if (A % 5 == 0) continue;
      ans = "DENIED";
      break;
    }
  }
  cout << ans << endl;
}


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

flag=0
zoro=0
for i in range(x):
    a,b = map(int, input().split())
    if a==b:
        zoro+=1
    else:
        zoro=0
    if zoro>=3:
        flag=1
if flag==1:
    print("Yes")
else:
    print("No")

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

inline int parent(int i) {return i >> 1;}
inline int left(int i) {return i << 1;}
inline int right(int i) {return (i << 1) + 1;}

void maxHeapify(vector<int> & heap, int i){
    int H = heap.size() - 1;
    auto L = left(i);
    auto R = right(i);
    int largest = (L <= H && heap[L] > heap[i]) ? L : i;
    if (R <= H && heap[R] > heap[largest]) largest = R;
    if (largest != i){
        int tmp = heap[i];
        heap[i] = heap[largest];
        heap[largest] = tmp;
        maxHeapify(heap, largest);
    }
}

void buildMaxHeap(vector<int> & heap){
    for (int i = (heap.size() - 1)/2; i != 0; --i) maxHeapify(heap, i);
}


int main()
{
    ios::sync_with_stdio(false);
    int H = 0;
    cin >> H;
    vector<int> heap(H + 1);
    heap[0] = 0;
    for (auto it = heap.begin() + 1; it != heap.end(); ++it) cin >> *it;
    buildMaxHeap(heap);
    for (auto it = heap.begin() + 1; it != heap.end(); ++it) cout << ' ' << *it;
    cout << endl;
    return 0;
}

Measured memory_bytes: 4900
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)*}
    };
}

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

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

fn main() {
    input!{
        x: u64,
        a: u64,
        b: u64,
    }
    println!("{}", (x - a) % b);
}


Measured memory_bytes: 4352
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define E "\n"

using namespace std;
const long long MOD = (long long)1e9 + 7;

string s;

int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> s;
    bool flag = false;
    for (int i = 0; i < 3; i++) {
        if (s[i] == '7') flag = true;
    }
    if (flag) cout << "Yes";
    else cout << "No";
    //system("pause");
    return 0;
}

Measured memory_bytes: 3636
<?php

    $line1_sub = str_split(trim(fgets(STDIN)));
    $line2_sub = str_split(trim(fgets(STDIN)));
    $line1 = $line1_sub;
    $line2 = $line2_sub;


    $count = count($line1_sub);
    for($i=0;$i<$count;$i++){
        $array1 = implode($line1);
        $array2 = implode($line2);
        // var_dump($array1);
        // var_dump($array2);
        if(strpos($array1,$array2)!== false){
            echo "Yes\n";
            exit;
        }
        $line1 = str_split($array1);
        $char = $line1[$count-1];

        unset($line1[$count-1]);
        
        // var_dump($line1);
        array_unshift($line1,$char);
        // var_dump($line1);
        // $line1 = str_split($line1);
        // // $line = array_unshift($line1,$ine[$count-1])
     }
     echo "No\n";
?>


Measured memory_bytes: 9292
import java.util.*;

public class Main{
    
    static final int MOD = (int)1e9+7;
    
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        int k = Integer.parseInt(sc.next());
        int[] a = new int[n];
        int mlen = 0;
        int plen = 0;
        for(int i=0; i<n; i++){
            a[i] = Integer.parseInt(sc.next());
            if(a[i] < 0){
                mlen++;
            }else{
                plen++;
            }
        }
        
        Arrays.sort(a);
        
        long ans = 1;
        if(plen == 0){
            if(k%2==1){
                for(int i=0; i<k-1; i+=2){
                    long tmp = a[n-1-i];
                    tmp *= a[n-2-i];
                    tmp %= MOD;
                    ans *= tmp;
                    ans %= MOD;
                }
                ans *= a[n-k];
                ans %= MOD;
            }else{
                for(int i=0; i<k; i+=2){
                    long tmp = a[i];
                    tmp *= a[i+1];
                    tmp %= MOD;
                    ans *= tmp;
                    ans %= MOD;
                }
            }
        }else{
            int l = 0;
            int r = n-1;
            if(k%2==1){
                ans *= a[r];
                ans %= MOD;
                r--;
                k--;
            }
            while(k>0){
                long m = a[l];
                m *= a[l+1];
                long p = a[r];
                p *= a[r-1];
                if(m >= p){
                    ans *= m%MOD;
                    ans %= MOD;
                    l+=2;
                }else{
                    ans *= p%MOD;
                    ans %= MOD;
                    r-=2;
                }
                k-=2;
            }
        }
        
        System.out.println((ans+MOD)%MOD);
        
    }
    
}


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

int main(){
    int N,M;
    cin >> N >> M;
    string A[50],B[50];
    for(int i=0;i<N;i++){
        cin >> A[i];
    }
    for(int i=0;i<M;i++){
        cin >> B[i];
    }

    for(int i=0;i<=N-M;i++){
        for(int j=0;j<=N-M;j++){
            bool flg=true;
            for(int h=0;h<M;h++){
                if(A[i+h].substr(j,M)!=B[h]) flg=false;
            }

            if(flg){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }

    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
bag = []
shi = []
for i in range(N):
    s, p = input().split()
    p = int(p)
    shi.append(s)
    
    bag.append((s, p, i))

sorted_bag = sorted(bag, key=lambda x:x[0])
sorted_shi = sorted(list(set(shi)))


dic = {}
for s, p, i in bag:
    if s not in dic.keys():
        dic[s] = [[p, i+1]]
    else:
        dic[s].append([p, i+1])

for s in sorted_shi:
    if len(dic[s]) == 1:
        print(dic[s][0][1])
    else:
        so = sorted(dic[s], key=lambda x:x[0])[-1::-1]
        for e in so:
            print(e[1])

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  double n,d,d2;
  int counter;
  cin >> n >> d;
  counter = 0;
  double x[200000],y[200000];
  for(int i = 0; i < n;i++){
      cin >> x[i] >> y[i];
  }

  d2 = d*d;

  for(int i = 0; i < n;i++){
    if (d2 >= (x[i]*x[i] + y[i]*y[i])) {
        counter++;
     }
  }

  cout << counter << endl;

}

Measured memory_bytes: 6900
#include <stdio.h>

int count = 0;

int mergeSort(int *arr, int left, int right) {
    if (left  < right) {
        int mid = (left + right) >> 1;
        mergeSort(arr, left, mid);
        mergeSort(arr, mid+1, right);
        merge(arr, left, mid, right);
    }
}

int merge(int *arr, int left, int mid, int right) {
    int i,j, k;
    int nl = mid-left+1;
    int nr = right-mid;
    int arrL[nl], arrR[nr];
    
    for (i=0; i<nl; i++) arrL[i] = arr[i+left];
    for (j=0; j<nr; j++) arrR[j] = arr[j+mid+1];
    
    i = j = 0;
    k = left;
    while (i < nl && j < nr) {
        count++;
        if (arrL[i] <= arrR[j]) {
            arr[k++] = arrL[i++];
        } else {
            arr[k++] = arrR[j++];
        }
    }
    
    while (i < nl) {
        count++;
        arr[k++] = arrL[i++];
    }
    
    while (j < nr) {
        count++;
        arr[k++] = arrR[j++];
    }
}


int main(void){
    int n;
    scanf("%d", &n);
    
    int arr[n];
    for (int i=0; i<n; i++) {
        scanf("%d", &arr[i]);
    }
    
    mergeSort(arr, 0, n-1);
    
    for (int i=0; i<n; i++) {
        if (i != 0) printf(" ");
        printf("%d", arr[i]);
    }
    
    printf("\n%d\n", count);
}



Measured memory_bytes: 5768
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<iomanip>


using namespace std;
typedef long long ll;
typedef vector<ll> v;
typedef vector<vector<ll>> vv;


#define MOD 1000000007
#define INF 1001001001
#define MIN -1001001001
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back
#define PF push_front
#define all(x) (x).begin(),(x).end()


int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


int main(){
    ll N,H,W;
    cin>>N>>H>>W;
    ll ans =0;
    rep(i,0,N){
        ll a,b;
        cin>>a>>b;
        if(a >= H && b>=W)ans++;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
typedef long long ll;
typedef long double ld;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main(void)
{
    string s, t;
    ll i, ans=0;

    cin >> s >> t;

    for(i=0; i<s.size(); i++){
        if(s[i]!=t[i]) ans++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3868
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
int a[100000], ans[100000];
int main()
{
    int n,tmp=0,sum=0,i;
    scanf("%d",&n);
    for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
        if(i%2==0)
            tmp+=a[i];
        sum+=a[i];
    }
    ans[0]=tmp*2-sum;
    for(i=0;i<n;i++)
	{
        if(i!=0)
    		ans[i]=(a[i-1]-(ans[i-1]/2))*2;
        printf("%d ",ans[i]);
    }
    return 0;
}

Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
#define Add(x, y) x = (x + (y)) % mod
#define Mult(x, y) x = (x * (y)) % mod

//0-indexed BIT
class BIT
{
    using T = int;
private:
    T _sum(int i) {
        if (!i) return 0;
        return data[i] + _sum(i - (i & -i));
    }

    void _add(int i, T x) {
        if (i > N) return;
        data[i] += x;
        _add(i + (i & -i), x);
    }

public:
    vector<T> data;
    int N;

    BIT(int N): data(vector<T>(N + 1, 0)), N(N) {}

    //sum of [0,i]
    //sum(-1)=0
    T sum(int i) { return _sum(i + 1); };

    void add(int i, T x) { _add(i + 1, x); };

};

signed main(){

    int N; cin >> N;
    vec a(N); cin >> a;

    int M = N * (N + 1) / 2;

    int x0 = 0, x1 = 1000000001;
    while(x1 - x0 > 1){
        int x = (x0 + x1) / 2;
        BIT b(2 * N + 1);
        int S = 0, tmp = 0;
        b.add(tmp + N, 1);
        REP(i, N){
            if(a[i] >= x) tmp++;
            else tmp--;
            S += b.sum(tmp + N);
            b.add(tmp + N, 1);
        }

        if(S >= (M + 1) / 2) x0 = x;
        else x1 = x;
    }
    Out(x0);

    return 0;
}


Measured memory_bytes: 2664
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)

int main() {
    string s;
    cin >> s;

    bool E = false, W = false, S = false, N = false;
    for(int i = 0; i < s.size(); i++){
        if(s[i]=='E'){E = true;}
        else if(s[i]=='W'){W = true;}
        else if(s[i]=='S'){S = true;}
        else if(s[i]=='N'){N = true;}
    }
    if(!E^W && !S^N){cout << "Yes" << endl;}
    else{cout << "No" << endl;}

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define  mes(a, b)  memset(a, b, sizeof a)
#define pb push_back
typedef unsigned long long int ull;
typedef long long int ll;
const int    maxn = 2e5 + 20;
const int    maxm = 1e5 + 10;
const ll     mod  = 1e9 + 7;
const ll     INF  = 1e18 + 100;
const int    inf  = 0x3f3f3f3f;
const double pi   = acos(-1.0);
const double eps  = 1e-8;
using namespace std;
int a[maxn];
int main(){
    int c,n;cin >> c >> n;
    for(int i = 1;i <= n;i++) cin >> a[i];
    sort(a + 1,a + 1 + n);
    int maxx = 0;
    for(int i = 2;i <= n;i++){
        int dis = abs(a[i] - a[i - 1]);
        if(dis > c/ 2) dis = c - dis;
        maxx = max(maxx,dis);
    }
    int dis = abs(a[1] - a[n]);
    if(dis > c/ 2) dis = c - dis;
    maxx = max(maxx,dis);
    printf("%d\n",c - maxx);
}

Measured memory_bytes: 1024
#include <stdio.h>
int main(void){
    
    int n,number;
    while(scanf("%d",&n)!=EOF){
        number=n%39;
        if(number==0){
            number=39;
        }
        if(number>=1&&number<=9){
        printf("3C0%d\n",number);
        }
        else
        printf("3C%d\n",number);
        
    }
}


Measured memory_bytes: 2052
#include <stdio.h>
int main(void){
    int n,i,next=1;
    int a[200000];
    scanf("%d",&n);
    for (i=0;i<n;i++){
        scanf("%d",&a[i]);
    };
    for (i=0;i<n;i++){
        if(a[i]==next){
            next++;
        };
    };
    if(next==1){
        printf("-1");
    }
    else{
        printf("%d",n-next+1);
    };
    return 0;
};


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

int main()
{int N;
  string g;
int co =0,ci=0;
cin >> N >> g;
for(char p : g)
if(p == 'R')
co++;

for(int i = 0;i<co;i++)
if(g[i] == 'R')
ci++;

cout << co-ci;
}

Measured memory_bytes: 3720
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	int cake[] = new int[16];
	public static void main(String args[]){
		boolean message = true;
		int a,b;

		try{
				BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
				String[] line = br.readLine().split(" ");

				a = Integer.parseInt(line[0]);
				b = Integer.parseInt(line[1]);

				if((a<1) && (a >16)){
					message = false;
				}else if ((b<1) && (b >16)){
					message = false;
				}else if (a>8 ||b>8){
					message =false;

				}


				if(message){
					System.out.println("Yay!");
				}else{
					System.out.println(":(");
				}
		}catch(Exception e){

		}
	}

}


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

using ll = long long;
using pii = pair<ll, ll>;

int main() {
    ll n, d, a; cin >> n >> d >> a;
    vector<pii> enemy(n);
    for(int i = 0; i < n; ++i) {
        cin >> enemy[i].first >> enemy[i].second;
    }

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

    deque<pii> st;
    ll damage = 0, ans = 0;
    for(int i = 0; i < n; ++i) {
        const ll x = enemy[i].first, h = enemy[i].second;
        while(!st.empty() && st.front().first < x) {
            damage -= a * st.front().second;
            st.pop_front();
        }
        const ll cnt = (max(h - damage, 0LL) + a - 1) / a;
        ans += cnt;
        damage += cnt * a;
        st.emplace_back(x + 2 * d, cnt);
    }

    cout << ans << endl;
}


Measured memory_bytes: 6656
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdint.h>
#include<tgmath.h>
#include<stdbool.h>
#include<sys/queue.h>
#include<time.h>
#define ll long long
#define min(a, b) ((a) > (b) ? (b) : (a))
#define max(a, b) ((a) > (b) ? (a) : (b))

const ll mod = 1000000007ll;
ll power(ll x, ll y){
    if(y == 0ll)return 1ll;
    ll res = 1ll, tmp = x;
    while(y){
        if(y&1){
            res *= tmp;
            res %= mod;
        }
        tmp *= tmp;
        tmp %= mod;
        y >>= 1;
    }
    return res;
}

ll COM(ll x, ll y){
    if(x < y) return 0ll;
    if(x < 0 || y < 0) return 0ll;
    ll res = 1;
    for(int i=0; i<y; i++){
        res *= x - i;
        res %= mod;
        res *= power(y-i, mod-2);
        res %= mod;
    }
    return res;
}

int n, k;
main(){
    scanf("%d%d", &n, &k);
    for(int i=1; i<=k; i++){
        ll ans = COM(n-k+1, i) * COM(k-1, i-1) % mod;
        printf("%lld\n", ans);       
    }
    return 0;
}

Measured memory_bytes: 128
#include <vector>
#include <iostream>
#include <unordered_map>
#include <map>
#include <iomanip>
#include <functional>
#include <algorithm>
#include <cassert>
#include <cmath>
#include <string>
#include <sstream>
using namespace std;

#ifndef MDEBUG
#define NDEBUG
#endif

#define x first
#define y second
#define ll long long
#define d double
#define ld long double
#define pii pair<int,int>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define pll pair<ll,ll>
#define pss pair<string,string>
#define psi pair<string,int>
#define pis pair<int,string>
#define psl pair<string,ll>
#define pls pair<ll,string>
#define wh(x) (x).begin(),(x).end()
#define ri(x) int x;cin>>x;
#define rii(x,y) int x,y;cin>>x>>y;
#define rl(x) ll x;cin>>x;
#define rv(v) for(auto&_cinv:v) cin>>_cinv;
#define wv(v) for(auto&_coutv:v) cout << _coutv << ' '; cout << endl;
#define ev(v) for(auto&_cerrv:v) cerr << _cerrv << ' '; cerr << endl;
#define MOD 1000000007

namespace std { 
template<typename T,typename U>struct hash<pair<T,U>>{hash<T>t;hash<U>u;size_t operator()(const pair<T,U>&p)const{return t(p.x)^(u(p.y)<<7);}};
}
// auto fraclt = [](auto&a,auto&b) { return (ll)a.x * b.y < (ll)b.x * a.y; };
template<typename T,typename F>T bsh(T l,T h,const F&f){T r=-1,m;while(l<=h){m=(l+h)/2;if(f(m)){l=m+1;r=m;}else{h=m-1;}}return r;}
template<typename T,typename F>T bsl(T l,T h,const F&f){T r=-1,m;while(l<=h){m=(l+h)/2;if(f(m)){h=m-1;r=m;}else{l=m+1;}}return r;}
template<typename T> T gcd(T a,T b) { if (a<b) swap(a,b); return b?gcd(b,a%b):a; }
template<typename T> void fracn(pair<T,T>&a) {auto g=gcd(a.x,a.y);a.x/=g;a.y/=g;}
template<typename T> struct Index { int operator[](const T&t){auto i=m.find(t);return i!=m.end()?i->y:m[t]=m.size();}int s(){return m.size();} unordered_map<T,int> m; };

#define M 400
#define MOD 1000000007

ll PREF[M+1][M+1];
ll DP[M+1][M+1];

int main(int,char**) {
    ios_base::sync_with_stdio(false);

    for (int i = 0; i <= M; i++) {
        PREF[i][0] = 0;
        DP[0][i] = 0;
    }
    DP[0][0] = 1;

    for (int i = 1; i <= M; i++) {
        ll c = 1;
        for (int j = 0; j <= M; j++) {
            PREF[j][i] = (PREF[j][i-1] + c) % MOD;
            c = c*i % MOD;
   //         if (j < 5 && i < 5) cout << j << ' ' << i << '=' << PREF[j][i] << endl;
        }
    }

    ri(N); ri(C);
    vector<int> A(N); rv(A);
    vector<int> B(N); rv(B);

    for (int i = 1; i <= N; i++) {
        for (int j = 0; j <= C; j++) {
            DP[i][j] = 0;
            for (int k = 0; k <= j; k++) {
                DP[i][j] = (DP[i][j] + DP[i-1][k] * (MOD + PREF[j-k][B[i-1]] - PREF[j-k][A[i-1]-1])) % MOD;
            }
 //           cout << i << ' ' << j << ' '<< DP[i][j] << endl;
        }
    }

    cout << DP[N][C] << endl;



}

Measured memory_bytes: 2816
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
// #define mt make_tuple
//typedef tuple<pii,int,int> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-7;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
ll dp[20][1000][2][2];
int main(){
	dp[0][0][0][0]=1;
	
	string s;
	cin>>s;
	int n=s.size();
	
	rep(i,n)rep(j,1000)rep(k,2)rep(l,2)rep(x,10){
		if(!k&&s[i]-'0'<x)continue;
		int I=i+1,J=j*10+x,K=k||(x<s[i]-'0'),L=l;
		if(J/100==51&&J%10==3)L=true;
		dp[I][J%1000][K][L]+=dp[i][j][k][l];
	}
	ll out=0;
	rep(i,1000)rep(j,2)out+=dp[n][i][j][1];
	cout<<out<<endl;
}








Measured memory_bytes: 3788
import java.util.Scanner;
public class Main{
	public static void main(String[] args) { 
		Scanner sc = new Scanner(System.in);
		while(true){
			int w = sc.nextInt();
			int h = sc.nextInt();
			if(w==0&&h==0)break;
			int n = sc.nextInt();
			
			boolean map[][]=new boolean[w+1][h+1];
			for(int i=0;i<n;i++)map[sc.nextInt()][sc.nextInt()]=true;
			
			
			//今いる場所を記録
			int dp[][]=new int[w+1][h+1];
			dp[1][1]=1;
			for(int i=1;i<=w;i++){
				for(int j=1;j<=h;j++){
					if(map[i][j]){
						dp[i][j]=0;
					}else if(i==1&&j==1){
						dp[i][j]=1;
					}else if(i==1){
						dp[i][j]=dp[i][j-1];
					}else if(j==1){
						dp[i][j]=dp[i-1][j];
					}else{
						dp[i][j]=dp[i][j-1]+dp[i-1][j];
					}				
					//System.out.println(i+""+j+" "+dp[i][j-1]+" "+dp[i-1][j]+" "+dp[i][j]);
				}
			}
			System.out.println(dp[w][h]);
		}
	}
}

Measured memory_bytes: 20372
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC target("avx,avx2,fma,sse,sse2")
#pragma GCC optimization ("unroll-loops")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

using ll = long long;
int N = 1e5+7;
typedef tree<int, null_type,less<int>,rb_tree_tag,
tree_order_statistics_node_update> new_data;
vector<bool>a(N,true);
void prime()
{
    a[0]=false;
    a[1]=false;
    for(int i=4;i<=N;i+=2)a[i]=false;
    for(int i=3;i*i<=N;i+=2)
    {
        if(a[i])
        {
            for(int j=(i*i);j<=N;j+=(2*i))a[j]=false;
        }
    }
}
int main()
{
    prime();
    int x;
    cin>>x;
    for(int i=x;;i++)
    {
        if(a[i]==true)cout<<i<<endl,exit(0);
    }
}


Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
using namespace std;

#define LL long long

const int MAXN = 1000000 + 3;
const LL MOD = 1000000000 + 7;
LL a[MAXN];

bool cmp(int x, int y){
    return abs(x) > abs(y);
}

LL cal(int N, int K, int pre, int next){
    LL ret = 1;
    for (int i = 0; i < K; i ++)
        if (i != pre)
        {
            ret = (ret * a[i]) % MOD;
        }
    ret = (ret * a[next]) % MOD;
    return ret;
}

LL calReplaceNeg(int N, int K, int &pre, int &next){
    int ret;
    for (pre = K - 1; pre >= 0 ; pre --){
        if (a[pre] < 0){
            break;
        }
    }
    for (next = K; next < N; next ++){
        if (a[next] > 0){
            break;
        }
    }
    if (pre >= 0 && next < N){
        ret = cal(N, K, pre, next);
        ret = (ret + MOD) % MOD;
        return ret;
    }
    return -1;
}

LL calReplacePos(int N, int K, int &pre, int &next){
    int ret;
    for (pre = K - 1; pre >= 0 ; pre --){
        if (a[pre] > 0){
            break;
        }
    }
    for (next = K; next < N; next ++){
        if (a[next] < 0){
            break;
        }
    }
    if (pre >= 0 && next < N){
        ret = cal(N, K, pre, next);
        ret = (ret + MOD) % MOD;
        return ret;
    }
    return -1;
}

LL calNotPosRes(int N, int K){
    for (int i = 0; i < N; i ++)
        if (a[i] == 0){
            return 0;
        }
    LL ret = 1;
    for (int i = N - 1; i >= N - K; i --){
        ret = (ret * a[i]) % MOD;
    }
    return (ret + MOD) % MOD;
}

int main()
{
    int N, K, sign, pre1, next1, pre2, next2;
    cin >> N >> K;
    for (int i = 0; i < N; i ++){
        cin >> a[i];
    }

    sort(a, a + N, cmp);
    LL ans = 1;
    sign = 0;
    for (int i = 0; i < K; i ++){
        if (a[i] < 0){
            sign ^= 1;
        }
        ans = (ans * a[i]) % MOD;
    }
    if (sign == 0){
        cout << ans;
    }
    else{
        LL res1 = calReplaceNeg(N, K, pre1, next1);
        LL res2 = calReplacePos(N, K, pre2, next2);
        if (res1 < 0 && res2 < 0){
            cout << calNotPosRes(N, K);
        }
        else{
            LL max_value;
            if (res1 < 0)
                max_value = res2;
            else if (res2 < 0)
                max_value = res1;
            else
                max_value = a[next1] * a[pre2] > a[next2] * a[pre1] ? res1 : res2;
            cout << max_value;
        }
    }
    system("pause");
    return 0;
}

Measured memory_bytes: 5264
N, A, B, C = map(int, input().split())
L = [int(input()) for _ in range(N)]


def ten_to_n(X, n):
    if (int(X / n)):
        return ten_to_n(int(X / n), n) + str(X % n)
    return str(X % n)

ans = float("inf")
for i in range(4**N):
    I = ten_to_n(i, 4)
    a, b, c = 0, 0, 0
    temp = 0
    for j in range(min(len(I), N)):
        J = I[-j-1]
        if J == "1":
            a += L[j]
            temp += 10
        elif J == "2":
            b += L[j]
            temp += 10
        elif J == "3":
            c += L[j]
            temp += 10
    if a == 0 or b == 0 or c == 0:
        continue
    temp += abs(A - a) + abs(B - b) + abs(C - c) - 30
    ans = min(ans, temp)
print(ans)

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

int main() {
  
  char b;
  cin >> b;
  
  if (b == 'A') {cout << 'T';}
  if (b == 'T') {cout << 'A';}
  if (b == 'C') {cout << 'G';}
  if (b == 'G') {cout << 'C';}
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MAX_N 100
using namespace std;
int n, f[MAX_N+5][11], p[MAX_N+5][11], cur[11], cnt[MAX_N+5], ans = -2147483647;
int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)	for (int j = 1; j <= 10; j++)	scanf("%d", &f[i][j]);
	for (int i = 1; i <= n; i++)	for (int j = 0; j <= 10; j++)	scanf("%d", &p[i][j]);
	for (int sta = 1; sta < (1<<10); sta++) {
		memset(cnt, 0, sizeof cnt);
		for (int i = 1; i <= 10; i++)	cur[i] = ((sta&(1<<i-1)) > 0);
		for (int i = 1; i <= n; i++)	for (int j = 1; j <= 10; j++)
			if (f[i][j] && cur[j])	cnt[i]++;
		int sum = 0;
		for (int i = 1; i <= n; i++)	sum += p[i][cnt[i]];
		ans = max(ans, sum);
	}
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  int a[n];
  map<int,int> mp;
  for(int i=0;i<n;i++){
    cin>>a[i];
    mp[a[i]]=i;
  }
  int c=1,m=0,mc=mp[1];
  for(int i=2;i<=n;i++){
    if(mc<mp[i]){
      c++;
      mc=mp[i];
    }else{
      m=max(m,c);
      mc=mp[i];
      c=1;
    }
  }
  m=max(m,c);
  cout<<n-m;
}
      

Measured memory_bytes: 12416
// https://atcoder.jp/contests/abc155/tasks/abc155_b

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(vector<ll> v);
template <typename T>
void drop(T a);

const ll INF = 1e18;

void solve() {
  ll N;
  cin >> N;

  rep(i, N) {
    ll a;
    cin >> a;

    unless(a % 2 == 0) continue;
    unless(a % 3 == 0 || a % 5 == 0) drop("DENIED");
  }

  cout << "APPROVED" << endl;
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

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

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

void print_ints(vector<ll> v) {
  rep(i, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N, A, B;
  cin>>N;
  if(N==1) {
    cout<<"Hello World"<<endl;
  }
  else {
    cin>>A>>B;
    cout<<A+B<<endl;
  }
}



Measured memory_bytes: 3560
#include<bits/stdc++.h>
using namespace std ;
#define ll long long int 
#define pb push_back 
#define mp make_pair 
int main(){
	ios_base::sync_with_stdio(false) ;
	cin.tie(NULL) ;
  string s ;
  cin >> s ;
  int n = s.length() ;
  int cnt = 0 ;
  for(int i = 0 ; i < n ; i++){
    if(s[i] == 'o' ) 
      	cnt++ ;
  }
  if(cnt + 15 - n >= 8){
    cout << "YES" ;
  }
  else
    cout << "NO" ;
}

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

int main() {
	// your code goes here
	long long int n,ans,a,b ;
	cin>>n;
	for(long long int i = 1;i<=1000;i++)
	{
		for(long long int j = -1000;j<=1000;j++)
		{
			ans = pow(i,5) - pow(j,5);
			if(n == ans)
			{
			a=i; b=j;
			goto end;
		}}
	}
	end:
	cout<<a<<" "<<b;
	return 0;
}

Measured memory_bytes: 4112
using System;
using System.Linq;
class Program
{
    static void Main()
    {
        int[] input = Console.ReadLine().Split().Select(i => int.Parse(i)).ToArray();
        //int a=int.Parse(Console.ReadLine());
        //string a = Console.ReadLine();
        Console.WriteLine(input[1]==input[0]?input[2]:input[1]==input[2]?input[0]:input[1]);
        Console.ReadLine();
    }
}

Measured memory_bytes: 13268
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る 
	input = input.split("\n");
	//文字列から10進数に変換するときはparseIntを使います
	x = parseInt(input[0], 10);
	//console.log(x);

	y = parseInt(Math.sqrt(x));
	//console.log(y);
	console.log(y*y);

}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 21704
require 'pp'
$DEBUG ? define_method(:dpp){|e|pp e} : define_method(:dpp){|e|}

# 空白区切の入力値を数値の配列で返却する
def gets_i_list()
  gets.chomp.split(" ").map(&:to_i)
end
# list = gets_i_list

N, M, X = gets_i_list

ca_list = N.times.map do
  gets_i_list
end

ans = []
1.upto(N) do |i|
  ca_list.combination(i).to_a.each do |ca_combi|
    total = Array.new(M + 1,0)
    ca_combi.each do |ca|
      ca.each_with_index do |a, j|
        total[j] += a
      end
    end
    cost = total.shift
    as = total.select{|e| e >= X}
    if as.size == M
      ans.push(cost)
    end
  end
end
if ans.empty?
  puts "-1"
else
  puts ans.min
end

Measured memory_bytes: 14952
#include<bits/stdc++.h>
using namespace std ;
int main()
{
    int x = 0 ;
    int y = 0 ;
    int money[5] = {0} ; //{ X_money , Y_money , Y_Little , Y_over , JOI }
    for ( int i = 0 ; i < 5 ; i++ )
    {
        cin >> money[i] ;
    }
    x = money[0] * money[4] ;
    y = money[1] + abs(money[2]-money[4]) * money[3] ;
    if ( money[2]-money[4] > 0 ) y = money[1] ;

    cout << min( x,y ) << endl ;
    return 0 ;
}

Measured memory_bytes: 3096
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(n); ++i)
#define repr(i, a, b) for (int i=a; i<(b); ++i)
#define reprev(i, n) for (int i=n-1; i>=0; --i)
#define reprrev(i, a, b) for (int i=b-1; i>=(a); --i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    cout << fixed << setprecision(10);
    
    string s; cin >> s;
    ll ss = s.size();

    // int a_count = 0;
    // int bc_count = 0;
    ll ans = 0;
    ll cnt = 0;
    /*
    int i = 0;
    while (i < ss-1) {
        if (s[i] == 'A') {
            a_count += 1;
            i += 1;
        } else if (s[i] == 'B' && s[i+1] == 'C') {
            ans += a_count;
            i += 2;
            // bc_count = 0;
        } else {
            a_count = 0;
            i += 1;
        }
    }*/
    rep(i, ss){
        if(i + 1 < ss && s[i] == 'B' && s[i + 1] == 'C'){
            ans += cnt;
            i += 1;
        }
        else if (s[i] == 'A') ++cnt;
        else{
            cnt = 0;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
n = gets.to_i
w = gets.split.map(&:to_i)

ans = 10**9
(0..n-1).each do |t|
  s1 = w[0..t].inject(:+)
  s2 = t != n-1 ? w[t+1..-1].inject(:+) : 0
  ans = (s1-s2).abs if (s1-s2).abs < ans
end

puts ans

Measured memory_bytes: 1788
alf = ([chr(i) for i in range(ord("A"), ord("Z") + 1)])
N = int(input())
s = str(input())
S = list(s)
ans = []
for i in S:
    num1 = alf.index(i)
    num2 = num1 + N
    if num2<= 25:
        ans.append(alf[num2])
    else:
        ans.append(alf[num2-26])
Ans = "".join(ans)
print(Ans)

Measured memory_bytes: 3188
# -*- coding: utf-8 -*-
def inpl(): return tuple(map(int, input().split()))
INF = float("inf")
V, E = inpl()
 
edges = [inpl() for _ in range(E)]
 
def belman_ford(V, edges, r):
    "If glaph contains negative cycles then return True"
    D = [-INF]*(V+1)
    D[r] = 0
#    if V == 1: # 今回は常にV>=2
#        return False, [0]
    
    for _ in range(V): # 最長でも1からNへの移動はN-1回
        update = False
        for s, t, d in edges:
            if D[t] < D[s] + d:
                D[t] = D[s] + d
                update = True
        if not update:
            break
    else:
        NEGs = [False]*(V+1)
        for s, t, d in edges:
            if D[t] < D[s] + d:
                D[t] = D[s] + d
                NEGs[t] = True
                NEGs[s] = True
        return True, D, NEGs
                
    return False, D, [False]*(V+1)
  
isNEGATIVE, D, NEGs = belman_ford(V, edges, 1)
 
"""
3 = 4 < 1 > 5 なら閉路があっても問題なし 
"""   
if NEGs[-1]:
    print("inf")
else:
    print(D[-1])

Measured memory_bytes: 3392