akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define FREE -1
#define NOT_FREE 1
#define N 8

int X[N][N];
vector<int> row(N, FREE), col(N, FREE), dpos(2*N-1, FREE), dneg(2*N-1, FREE);

void printBoard() {
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            if (X[i][j]) {
                if (row[i] != j)  return;
            }
        }
    }

    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            if (row[i] == j) {
                cout << "Q";
            } else {
                cout << ".";
            }
        }
        cout << endl;
    }
}

void recursive(int ri) {
    if (ri == N) {
        printBoard();
        return;
    }

    for (int i = 0; i < N; i++) {
        if (col[i] == NOT_FREE || dpos[ri + i] == NOT_FREE || dneg[ri - i + (N - 1)] == NOT_FREE) {
            continue;
        }

        row[ri] = i;
        col[i] = NOT_FREE;
        dpos[ri + i] = NOT_FREE;
        dneg[ri - i + (N - 1)] = NOT_FREE;

        recursive(ri + 1);

        row[ri] = FREE;
        col[i] = FREE;
        dpos[ri + i] = FREE;
        dneg[ri - i + (N - 1)] = FREE;
    }
}

int main() {
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            X[i][j] = false;
        }
    }

    int n;
    cin >> n;
    int r, c;
    for (int i = 0; i < n; i++) {
        cin >> r >> c;
        X[r][c] = true;
    }

    recursive(0);

    return 0;
}



Measured memory_bytes: 3120
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define len(x) ((long long)(x).size())
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using pll = pair<ll, ll>;
template<class T>void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T>void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T, class U>bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U>bool isin(T el, U container) { return find(all(container), el) != container.end(); }
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
template<class T>bool even(T n) { return ! (n & 1); }
template<class T>bool odd(T n) { return n & 1; }
template<class T>ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T>ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
ll intpow(ll a,ll n){ll p=1;while(n){if(n&1)p*=a;a*=a;n>>=1;}return p;}
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;



int main()
{
        ll N;
        cin >> N;
        vll a(N);
        rep(i, 0, N) cin >> a[i];
        sort(a.rbegin(), a.rend());
        ll ans = 0;
        rep(i, 1, N) {
                ans += a[i-1] - a[i];
        } 
        cout << ans << endl;
}

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

int main(void){
   
    char s;
    cin >> s;
    
    if(s == 'a' || s == 'i' || s == 'u' || s == 'e' || s == 'o'){
        cout << "vowel" <<endl;
    }
    else{
        cout << "consonant" <<endl;
    }
}

Measured memory_bytes: 3568
N = int(input())
a = list(map(int, input().split()))

x = y = z = 0

for i in range(N):
    if a[i] % 4 == 0:
        x += 1
    elif a[i] % 2 == 0:
        y += 1
    else:
        z += 1

if x >= min(1, y) + z - 1:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 20016
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());
		sc.close();
		System.out.println((a + b)/2 + (a + b)%2);
	}
}

Measured memory_bytes: 23252
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<cstdlib>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include <typeinfo>
#include <list>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(i,v.size())cout<<" "<<v[i];cout<<endl<<endl;
#define show2d(v) rep(i,v.size()){rep(j,v[i].size())cout<<" "<<v[i][j];cout<<endl;}cout<<endl;
using namespace std;
typedef long long 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;
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;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[] = {1, 0, -1, 0};

int main(int argc, char *argv[])
{
  int n,x;
  cin>>n;
  list<int> l;
  string cmd;
  for (int i=0; i<n; ++i) {
    cin>>cmd;
    if (cmd=="insert") {
      cin>>x;
      l.push_front(x);
    } else if (cmd=="delete") {
      cin>>x;
      for (auto it=l.begin(); it!=l.end(); ++it) {
        if (*it == x) {
          l.erase(it);
          break;
        }
      }
    } else if (cmd=="deleteFirst") {
      l.pop_front();
    } else if (cmd=="deleteLast") {
      l.pop_back();
    }
  }
  for (auto it=l.begin(); it!=l.end(); ++it) {
    if (it!=l.begin()) {
      cout<<" ";
    }
    cout<<*it;
  }
  cout<<endl;
  return 0;
}



Measured memory_bytes: 34396
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		
		int second = input.nextInt();
	    int min = second / 60; 
	    int hour = min / 60;
	    int min2 = min % 60; 
	    int second2 = second % 60; 
	    
	    System.out.println(hour + ":" + min2 + ":" + second2);
		
		input.close();
	}

}

Measured memory_bytes: 26344
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);

	string s, p;
	cin >> s >> p;
	string str = s + s;
	if(str.find(p) == string::npos) {
		cout << "No" << "\n";
	} else {
		cout << "Yes" << "\n";
	}
	return 0;
}


Measured memory_bytes: 3208
#include <bits/stdc++.h>
#define MOD 1000000007
typedef long long int ll;
using namespace std;

int main()
{
    int n; cin >> n;
    vector<int> d(n);
    for(int i=0;i<n;i++) cin >> d[i];
    int sum = 0;
    for(int i=0;i<n-1;i++){
        for(int j=i+1;j<n;j++){
            sum += d[i]*d[j];
        }
    }

    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1000000007;
const double PI = acos(-1);

int main()
{
	ll n;
	cin >> n;
	ll sum = 0;
	vector<ll> a(n);
	for (ll i = 0; i < n; i++) {
		cin >> a[i];
		sum += a[i];
	}
	sort(a.begin(), a.end(), greater<ll>());
	ll ans = 0;
	ll idx = 0;
	for (int i = 1; i < n; i++) {
		if (i == 1) ans += a[idx];
		else ans += a[idx];
		if (i % 2 != 0) idx++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 4796
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define PI acos(-1)
typedef  long long ll;
ll gcd(ll x,ll y){
   if(y==0) return x;
   else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
   return x/gcd(x,y)*y;
}
using namespace std;

int main(){
   ll a=0,b=0;

   string s;
   cin>>s;

   int n=s.size();
   rep(i,n){
      if(s[i]=='0') a++;
      else b++;
   }
   cout<<min(a,b)*2<<endl;
   
  
return 0;
}



Measured memory_bytes: 512
#include <cstdio>
#include <algorithm>
#include <vector>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iostream>
#include <queue>
#include <bits/stdc++.h>
#define INF (1ll<<60)
#define MOD 1000000007
#define BOUND 27182818284

typedef long long ll;
typedef long long int lli;

#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)

template<class T>bool umax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool umin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

using namespace std;

// gcd
int gcd(int a, int b){
    if(a==0)
        return b;
    return gcd(b%a,a);
}
// gcd array
int findGCD(int arr[], int n){
    int result = arr[0];
    for (int i=1; i < n; i++)
        result = gcd(arr[i], result);

    return result;
}

// sort big to small
// sort(A,A+N, greater<int>());

// v.front() = -BOUND;
// v.back() = BOUND;

// Iterator
// v.begin
// v.end

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

    int answer = N;
    for(int i=0; i<=N;i++){
        int cc = 0;
        int t=i;
        while(t>0){
            cc += t%6;
            t/=6;
        }
        t=N-i;
        while(t>0){
            cc+=t%9;
            t/=9;
        }
        if(answer > cc)
            answer = cc;
    }

    cout << answer << endl;
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fast_cin ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

long long binpow(long long a, long long b, long long m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}

int main()
{
    fast_cin;
    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
    #endif

    ll N;
    cin>>N;
    ll M=1e9+7;
    ll a=binpow(10,N,M);
    ll b=binpow(8,N,M);
    ll c=binpow(9,N,M);
    c=((2%M)*(c%M))%M;
    ll ans=(M+a-c+b)%M;
    cout<<ans<<"\n";

}


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

int main() {
    string s;
    cin >> s;
    while (s != "0") {
        int sum = 0;
        for (int i=0; i<s.size(); i++) {
            sum = sum + s[i] - '0';
        }
        cout << sum << endl;
        cin >> s;
    }
}


Measured memory_bytes: 3172
#include<bits/stdc++.h>
using namespace std;
bool ok(int n)
{
	int flag = true ;
	for(int i =2;i<=sqrt(n);i++)
		if(n%i==0) flag=false;
	return flag;
}
int main()
{
	int n;
	cin>>n;
	int a,ans=0;
	for(int i = 1 ;i<=n;i++)
	{
		cin>>a;
		if(ok(a)) ans++;
	}
	cout<<ans<<endl;
	return 0;
 } 


Measured memory_bytes: 3100
def rep(s):
    a,b='',[]
    for i in range(len(s)):
        if s[i]=='C' or s[i]=='B':
            b.append(a)
            a=''
        else:
            a+=s[i]
    b.append(a)
    a=[]
    for i in range(len(b)):
        if b[i]!='':
            a.append(b[i])
    return a
s=rep(input().replace('BC','D'))
b=0
for i in s:
    a=0
    for j in i:
        if j=='A':
            a+=1
        else:
            b+=a
print(b)

Measured memory_bytes: 5796
A, B, H, M = gets.split(" ").map(&:to_i)
theta = [(30 * (H + M.quo(60)) - 6 * M).abs, 360 - (30 * (H + M.quo(60)) - 6 * M).abs].min

puts Math.sqrt(A**2 + B**2 - 2 * A * B * Math.cos(theta.quo(180.0) * Math::PI))


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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //[summary]C - Exception Handling
            int N = int.Parse(Console.ReadLine());
            var A = GetA(N).ToList();

            var numbers = new List<int>(A);

            int max = numbers.Max();

            numbers.Remove(max);
            int next = numbers.Max();

            foreach(var a in A)
            {
                int ans = max;

                if (a == max)
                {
                    ans = next;
                }

                Console.WriteLine(ans);
            }            
        }
        
        static IEnumerable<int> GetA(int N)
        {
            for(int i = 0; i < N; i++)
            {
                yield return int.Parse(Console.ReadLine());
            }
        }
    }
}

Measured memory_bytes: 21332
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define MOD 1000000007
#define MOD2 998244353
#define int long long
#define double long double
#define EPS 1e-9
//#define PI 3.14159265358979

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	int M;
	if (N > 0)
		M = A[0].size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

typedef pair< int, int > pii;
typedef long long ll;

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};
struct aabb {
	int x1, y1, x2, y2;
	aabb(int x1, int y1, int x2, int y2) : x1(x1), y1(y1), x2(x2), y2(y2) {}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

int pow2(int n) { return 1LL << n; }
template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(20);
	}
};
initializer _____;

int N, M, K, T, Q, H, W;
signed main() {
	cin >> N;
	int X, Y;
	cin >> X >> Y;
	vector< int > ans(N, 0);
	--X;
	--Y;
	rep(i, N) rep(j, N) if (i < j) {
		int tmp = j - i;
		chmin(tmp, abs(j - Y) + abs(i - X) + 1);
		ans[tmp]++;
	}
	for (int k = 1; k < N; k++)
		cout << ans[k] << endl;
	return 0;
}

Measured memory_bytes: 256
import sys
from collections import deque

input = sys.stdin.readline

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

def slide_min(P,K):
	q = deque()
	q.append(0)
	slide_minl = []
	for i in range(1,len(P)):
		while P[i]<P[q[-1]]:
			q.pop()
			if len(q)==0: break
		q.append(i)

		if i>=K-1:
			slide_minl.append(P[q[0]])
			if q[0]<=i-K+1:
				q.popleft()

	return slide_minl

def slide_max(P,K):
	q = deque()
	q.append(0)
	slide_maxl = []
	for i in range(1,len(P)):
		while P[i]>P[q[-1]]:
			q.pop()
			if len(q)==0: break
		q.append(i)

		if i>=K-1:
			slide_maxl.append(P[q[0]])
			if q[0]<=i-K+1:
				q.popleft()

	return slide_maxl

minl = slide_min(P,K)
maxl = slide_max(P,K)

if N==K:
	ans = 1
else:
	ans = 1
	for i in range(K,N):
		last = P[i]
		pre = P[i-K]
		if pre!=minl[i-K] or last!=maxl[i-K+1]:
			ans += 1
			# print(i)

	count = 0
	i = 0
	while i<N-1:
		upnum = 0
		while P[i]<P[i+1]:
			upnum += 1
			i += 1
			if i==N-1: break
		if upnum>=K-1:
			count += 1
		i += 1

	ans = ans-max(count-1,0)

print(ans)

Measured memory_bytes: 92368
import bisect

N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]

A.sort()
C.sort()
#ある一つのBについて、それ以下のAの個数とそれ以上のCの個数を二分探索で求める
ans = 0
for i in range(N):
    lw_a = bisect.bisect_left(A, B[i])
    up_c = N - bisect.bisect_right(C, B[i])
    ans += lw_a * up_c
print(ans)

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



bool check(vector <int> a, int k, int gcd, int sum) {
    vector <int> b;
    for (auto x: a) {
        b.emplace_back(x - (x / gcd) * gcd);
    }
    int dem = 0;
    sort(b.begin(), b.end());
    int n = b.size();
    int i = 0, j = n - 1;
    while (i < j) {
        int d = min(b[i], gcd - b[j]);
        b[j] += d;
        b[i] -= d;
        dem += d;
        while (i < n && b[i] % gcd == 0) {
            i++;
        }
        while (j >= 0 && b[j] % gcd == 0) {
            j--;
        }
    }
    return dem <= k;
}

int main() {
    int n, k;
    cin >> n >> k;
    vector <int> a(n, 0);
    int sum = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        sum += a[i];
    }
    vector <int> uoc;
    for (int i = 1; i <= sqrt(sum); i++) {
        if (sum % i == 0) {
            uoc.emplace_back(i);
            int x = sum / i;
            if (x != i) {
                uoc.emplace_back(x);
            }
        }
    }
    sort(uoc.rbegin(), uoc.rend());
    for (auto _uoc: uoc) {
        if (check(a, k, _uoc, sum)) {
            cout << _uoc;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 256
import math
import sys

def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:


        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result





arr_data = getinputdata()

s = arr_data[0][0]

str="abcdefghijklmnopqrstuvwxyz"

for v in str:
    
#    print(v)
    
    if v not in s:
        
        print(v)
        
        break
else:
    print("None")
        
        



Measured memory_bytes: 3316
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int A,B,C,D;
    int left,right;
    
    cin >> A >> B >> C >> D;
    left = A + B;
    right = C + D;
    
    if(left > right) cout << "Left" << endl;
    else if(left == right) cout << "Balanced" << endl;
    else cout << "Right" << endl;

}

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

res = []
for i in range(N):
    for j in range(N-i-1, -1, -1):
        if B[j] == j+1:
            res.append(j+1)
            B = B[:j]+B[j+1:]
            break
    else:
        break

if len(res) == N:
    res.reverse()
    for r in res:
        print(r)
else:
    print(-1)

Measured memory_bytes: 9112
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
#include <iomanip>
using namespace std;
const double PI = acos(-1.0);
const string alp = "abcdefghijklmnopqrstuvwxyz";
const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const int INTMAX = 2147483647;
const int INTMIN = -2147483648;
const unsigned int UINTMAX = 4294967295;
const long LONGMAX = 9223372036854775807;
const long LONGMIN = -9223372036854775808;
const unsigned long ULONGMAX = 18446744073709551615;
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n+1)
#define SUM(c) accumulate((c).begin(),(c).end(),0)
#define UNIQ(c) (c).erase(unique((c).begin(), (c).end()), (c).end());
#define Yn(b) puts(b?"Yes":"No")
#define YN(b) puts(b?"YES":"NO")
#define fsp(c) fixed << setprecision(c)

bool isprime(int p) {
  if (p==1) return false;
  FOR(i,2,p) {
    if (p%i==0) return false;
  }
  return true;
}

int dig(int n, int a) {return n/(int)pow(10,a)%10;}
int digl(long n, int a) {return n/(long)pow(10,a)%10;}
int digsum(int n) {int r=0;REP(i,10){r+=dig(n,i);}return r;}
int digsuml(long n) {int r=0;REP(i,19){r+=digl(n,i);}return r;}
int dignum(int n) {return n?to_string(n).length():0;}
int dignuml(long n) {return n?to_string(n).length():0;}

double cutl(int i,double n,double r) {
  if (i<=0||n<=i) return 0;
  return r*sqrt(1-((double)i-n/2)*((double)i-n/2)*4/n/n);
}

int main(){
  long n,m;
  string s1,s2;
  cin >> n;
  m=20;
  REP1(i,100000){
    s1=to_string(i);
    s2=to_string(n/i);
    if (i*(n/i)==n){
      if (max(s1.length(),s2.length())<m) m=max(s1.length(),s2.length());
    }
  }
  cout << m;
  return 0;
}

Measured memory_bytes: 256
s = gets
a = s[0..1]
b = s[2..3]

if ("01".."12").cover?(a) && ("01".."12").cover?(b)
  puts "AMBIGUOUS"
elsif !("01".."12").cover?(a) && !("01".."12").cover?(b)
  puts "NA"
elsif ("01".."12").cover?(a) && !("01".."12").cover?(b)
  puts "MMYY"
elsif !("01".."12").cover?(a) && ("01".."12").cover?(b)
  puts "YYMM"
end


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

int main()
{
  string s;
  ll Ans = 0;
  cin >> s;
  int n = s.size();
  for (int bit = 0; bit < (1 << n - 1); bit++)
  {
    string ss = "";
    for (int i = 0; i < n; i++)
    {
      ss += s[i];
      if (bit >> i & 1)
      {
        Ans += stoll(ss);
        ss = "";
      }
    }
    Ans += stoll(ss);
  }
  cout << Ans << endl;
}


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

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rept(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(int)(n);(i)++)
#define repst(i,s,n) for(int (i)=(s);(i)<=(int)(n);(i)++)
#define repr(i,n) for(int (i)=(n);(i)>=0;(i)--)
#define each(itr,v) for(auto (itr):(v))
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp(x,y) make_pair((x),(y))
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln "\n"
#define show(x) cout << #x << " = " << x ln
#define dbg(x) cout<<#x"="<<x ln

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int> > mat;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int inf = (int)1e9;
const ll linf = (ll)1e18;
const int mod = (int)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

int n, m, a, b, ans;
vector<vi> e(8);

void dfs(int v, int c, int f) {
	if (c==n-1) {
		ans++;
		return;
	}
	rep(i,e[v].size()) {
		int to = e[v][i];
		if (!(f>>to & 1)) dfs(to,c+1,f|(1<<v));
	}
}

int main() {
	cin >> n >> m;
	rep(i,m) {
		cin >> a >> b;
		a--, b--;
		e[a].pb(b), e[b].pb(a);
	}
	dfs(0,0,0);
	cout << ans << ln;
}

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

#define all(x) (x).begin(),(x).end()
#define rep(i,l,r) for(int i=(int)(l);i<(int)(r);i++)

typedef long long ll;
const ll MOD = 1e9 + 7;
const ll inf = 1LL<<60;
const double eps = 1e-9;


int main()
{
    int n, sum=0;
    cin >> n;
    vector <int> d(n);
    for (int i = 0; i < n; i++) cin>> d[i];
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (i == j) continue;
            sum += d[i] * d[j];
        }
    }
    cout << sum/2 << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn = 500050, alp = 27;
int nxt[maxn][alp], p[alp][maxn];
int main(){
	string s; cin >> s;
	int len = s.size();
	for(int i = 0; i <= len; i++) for(int j = 0; j < alp; j++) p[j][i] = nxt[i][j] = maxn;
	for(int i = 0; i < len; i++) nxt[i][s[i] - 'a'] = i + 1;
	for(int i = len - 1; i >= 0; i--){
		for(int j = 0; j < alp - 1; j++){
			if(nxt[i][j] != maxn){
				nxt[i][j + 1] = min(nxt[i][j + 1], nxt[nxt[i][j]][j]);
			}
		}
		if(nxt[i][alp - 1] != maxn){
			for(int j = 0; j < alp - 1; j++) nxt[i][j] = min(nxt[i][j], nxt[nxt[i][alp-1]][j]);
		}
	}
	// empty -> (z, z) | (empty, empty)
	// ch -> (ch - 1, ch - 1) | (ch, empty) | (empty, ch)
	for(int i = 0; i < len; i++){
	//	cout << "node " << i << endl;
		for(int j = 0; j < alp; j++){
			if(nxt[i][j] == maxn) continue;
	//		cout << "edge " << j << " to " << nxt[i][j] << endl;
		}
	//	cout << endl;
	}
	for(int i = 0; i < len; i++) p[0][i] = nxt[i][alp-1];
	for(int i = 1; i < alp; i++) for(int j = 0; j < len; j++) if(p[i - 1][j] != maxn) p[i][j] = p[i - 1][p[i - 1][j]];
	int q; cin >> q;
	while(q--){
		int l, r; cin >> l >> r; l--; r--;
		for(int i = alp - 1; i >= 0; i--) if(p[i][l] <= r + 1) l = p[i][l];
		if(l == r + 1) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 106756
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

int diff(int a, int b) {
	if (a == b) return 0;
	return abs(a - b);
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);

	int n, i, j, k, best = 1000000, x, y, z, ss;
	vector<int> a(3);
	cin >> n >> a[0] >> a[1] >> a[2];
	vector<int> l(n), s(4), id(n), ct(4);
	for (i = 0; i < n; i++) cin >> l[i];

	for (i = 0; i < (2 << (n * 2)); i++) {
		s.assign(4, 0);
		ct.assign(4, 0);
		x = i;
		for (j = 0; j < n; j++) {
			id[j] = x % 4;
			x /= 4; 
			s[id[j]] += l[j];
			ct[id[j]]++;
		}

		if ((s[0] == 0) || (s[1] == 0) || (s[2] == 0)) continue;

		for (x = 0; x < 3; x++) {
			for (y = 0; y < 3; y++) {
				if (x == y) continue;
				z = 3 - x - y;

				ss = diff(a[x], s[0]) + diff(a[y], s[1]) + diff(a[z], s[2]) + (ct[0] + ct[1] + ct[2] - 3) * 10;
				best = min(best, ss);
			}
		}

	}

	cout << best << "\n";

	return 0;
}

Measured memory_bytes: 256
def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [input().split() for _ in range(n)]
def s4(n):return [[x for x in s] for s in s2(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]
def t3(n):return [tuple(int(x) for x in input().split()) for _ in range(n)]
def p0(b,yes="Yes",no="No"): print(yes if b else no)
# from sys import setrecursionlimit
# setrecursionlimit(1000000)
# from collections import Counter,deque,defaultdict
# import itertools
# import math
# import networkx as nx
# from bisect import bisect_left,bisect_right
# from heapq import heapify,heappush,heappop
n,a,b=n1()

def comb(n,k):
    nCk = 1
    MOD = 10**9+7

    for i in range(n-k+1, n+1):
        nCk *= i
        nCk %= MOD

    for i in range(1,k+1):
        nCk *= pow(i,MOD-2,MOD)
        nCk %= MOD
    return nCk

MOD = 10**9+7
a1=comb(n, a)
b1=comb(n, b)
ans=pow(2,n,MOD)-a1-b1-1
print(ans%MOD)

Measured memory_bytes: 39152
# coding: utf-8
import math

a,b,h,m = map(int, input().split())
# 短針が0から進んだ角度
tankakudo = 30 * h + 0.5 * m
# print(tankakudo)
# 長針が0から進んだ角度
chokakudo = 6 * m
# print(chokakudo)

if tankakudo > chokakudo:
    naskakudo = tankakudo - chokakudo
else:
    naskakudo = chokakudo - tankakudo
    
if naskakudo > 180:
    naskakudo = 360 - naskakudo

Answer = math.sqrt(a ** 2 + b ** 2 - 2 * a * b * math.cos(math.radians(naskakudo)))
print("{:.20f}".format(Answer))

Measured memory_bytes: 9516
#include <stdio.h>
int main(void){
    int n, d, x;
    scanf("%d", &n);
    scanf("%d%d", &d, &x);
    int a[n];
    for (int i = 0; i < n; i++){
        scanf("%d", &a[i]);
    }

    int ans = x;
    for (int i = 0; i < n; i++){
        for (int j = 1; j < d + 1; j++){
            for (int h = 0; h < d + 1; h++){
                if (h * a[i] + 1 == j){
                    ans += 1;
                }
            }
        }
    }
    printf("%d\n", ans);

    return 0;
}


Measured memory_bytes: 128
#include <algorithm>
#include <cstdio>

static const size_t n_max = 200000;
static int S[n_max], L[n_max], R[n_max];
static long long c = 0;

void merge_sort(size_t i, size_t j) {
  switch (j - i) {
    case 0:
    case 1:
      break;
    case 2:
      if (S[i+1] < S[i]) {
        c++;
        std::swap(S[i], S[i+1]);
      }
      break;
    default:
      size_t k = (i + j) / 2;
      merge_sort(i, k);
      merge_sort(k, j);
      std::copy(S + i, S + k, L);
      std::copy(S + k, S + j, R);
      for (size_t l = i, p = 0, q = 0;; l++) {
        if (p < k - i && q < j - k) {
          if (L[p] <= R[q])
            S[l] = L[p++];
          else {
            c += k - i - p;
            S[l] = R[q++];
          }
        } else if (p < k - i)
          S[l]= L[p++];
        else if (q < j - k)
          S[l] = R[q++];
        else
          break;
      }
      break;
  }
}

int main() {
  size_t n;
  scanf("%zu", &n);
  for (size_t i = 0; i < n; i++)
    scanf("%d", S + i);
  merge_sort(0, n);
  printf("%lld\n", c);
  return 0;
}

Measured memory_bytes: 4308
# coding: utf-8
# Your code here!


N,M = map(int,input().split())
#print(N,arr)
def euclid(N,M):
    #print(N,M)
    if M > N:
        N,M = M,N
    while M > 0:
        r = N % M
        N = M
        M = r
        
    return N
    
ans = euclid(N,M)
print(ans)


Measured memory_bytes: 5604
n = gets.to_i

if n < 10 
    puts n # 1..n
elsif n < 100
    puts 9 # 1..9
elsif n < 1000
    puts n - 90 # 1..9, 100..n
elsif n < 10000
    puts 909 # 1..9, 100..999
elsif n < 100000
    puts n - 9090 # 1..9, 100..999, 10000..n
elsif n == 100000
    puts 90909 # 1..9, 100..999, 10000..99999
end


Measured memory_bytes: 1788
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

from collections import deque

"""
・最小カット
・頂点でカットする場合には、v_in, v_outに分ける
・v_in, v_outの間に容量1の辺
・sourceから、ヤギ_outに容量無限大の辺
・外周_outから、sinkに容量無限大の辺
"""

class Dinic:
    def __init__(self, N, source, sink):
        self.N = N
        self.G = [[] for _ in range(N)]
        self.source = source
        self.sink = sink

    def add_edge(self, fr, to, cap):
        n1 = len(self.G[fr])
        n2 = len(self.G[to])
        self.G[fr].append([to, cap, n2])
        self.G[to].append([fr, 0, n1]) # 逆辺を cap 0 で追加
        
    def add_edge_undirected(self, fr, to, cap):
        n1 = len(self.G[fr])
        n2 = len(self.G[to])
        self.G[fr].append([to, cap, n2])
        self.G[to].append([fr, cap, n1])
        
    def bfs(self):
        level = [0] * self.N
        G = self.G; source = self.source; sink = self.sink
        q = deque([source])
        level[source] = 1
        pop = q.popleft; append = q.append
        while q:
            v = pop()
            lv = level[v] + 1
            for to, cap, rev in G[v]:
                if not cap:
                    continue
                if level[to]:
                    continue
                level[to] = lv
                if to == sink:
                    self.level = level
                    return
                append(to)
        self.level = level
        
    def dfs(self,v,f):
        if v == self.sink:
            return f
        G = self.G
        prog = self.progress
        level = self.level
        lv = level[v]
        E = G[v]
        for i in range(prog[v],len(E)):
            to, cap, rev = E[i]
            prog[v] = i
            if not cap:
                continue
            if level[to] <= lv:
                continue
            x = f if f < cap else cap
            ff = self.dfs(to, x)
            if ff:
                E[i][1] -= ff
                G[to][rev][1] += ff
                return ff
        return 0
    
    def max_flow(self):
        INF = 10**18
        flow = 0
        while True:
            self.bfs()
            if not self.level[self.sink]:
                return flow
            self.progress = [0] * self.N
            while True:
                f = self.dfs(self.source, INF)
                if not f:
                    break
                flow += f
        return flow

H,W = map(int,readline().split())
S = b''.join(read().split())

# v_i-in: 2i
# v_i-out: 2i+1
source = 2*H*W
sink = source+1

INF = 10**12

dinic = Dinic(2*H*W+2,source,sink)
add = dinic.add_edge
for i in range(H*W):
    h,w = divmod(i,W)
    if S[i] == ord('.'):
        add(i+i,i+i+1,1)
    else:
        add(source,i+i+1,INF)
    for dh,dw in ((1,0),(-1,0),(0,1),(0,-1)):
        h1 = h + dh; w1 = w + dw
        if 0 <= h1 < H and 0 <= w1 < W:
            j = h1 * W + w1
            add(i+i+1,j+j,1)
        else:
            # 画面外
            add(i+i+1,sink,INF)

f = dinic.max_flow()
answer = f if f < INF else -1
print(answer)

Measured memory_bytes: 76248
from itertools import permutations
n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]
N = list(range(n))

ans = 0
cnt = 0
for v in permutations(N):
    x = 0
    for i in range(n-1):
        a = v[i]
        b = v[i+1]
        x += ((xy[a][0]-xy[b][0])**2 + (xy[a][1]-xy[b][1])**2) ** 0.5
    cnt += 1
    ans += x
print(ans/cnt)

Measured memory_bytes: 3188
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <numeric>
#include <cmath>

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

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

const ll MOD = 1000000007;
const int INF = 1<<30;
//const ll INF = (ll)1e18 + 1;

ll f(ll n, ll x){
  if (n == -1) return 0;
  return n / x + 1;
}

int main(){
  ll a, b, x; cin >> a >> b >> x;
  cout << f(b, x) - f(a - 1, x) << endl;
}


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

long modpow(long a, long n, long mod) {
    long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

// a^{-1} mod を計算する
long modinv(long a, long mod) {
    return modpow(a, mod - 2, mod);
}

struct compare1 { 
    bool operator()(const pair<long, long>& value,  
                                const long& key) 
    { 
        return (value.first < key); 
    } 
    bool operator()(const long& key,  
                    const pair<long, long>& value) 
    { 
        return (key < value.first); 
    } 
}; 

int main()
{
    int N; cin >> N;
    int d[105];
    REP(i, N) cin >> d[i];
    set<int> mochi;
    REP(i, N) mochi.insert(d[i]);
    cout << mochi.size() << endl;
    return 0;
}



Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int d = Integer.parseInt(sc.next());
		sc.close();
		System.out.print("Christmas");
		for(int i = d;i <25;i++) {
			System.out.print(" Eve");
		}
	}
}


Measured memory_bytes: 21844
// Creator-->>>  :)
//SUNEET KUMAR - IIITA 
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define gcd __gcd
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define min3(a,b,c) min(a,min(b,c))
#define mai3(a,b,c) mai(a,mai(b,c))
#define all(i) i.begin(),i.end()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define set_bit __builtin_popcount //gives number of set_bits
#define ff first
#define ss second
#define cases(t) int t; cin>>t; rep(casn,1,t+1)
#define el cout<<endl;
#define deci(n) int n; cin>>n;
#define decs(n) string n; cin>>n;
#define sz(v) v.size()
#define repit(m) for(auto it=m.begin();it!=m.end();it++)
#define ins insert

//SUNEET KUMAR -->  ਸੁਨੀਤ 
int power(int a,int n)//binary expo
{
    int r;
    if(n==0)
        return 1;
    else if(n==1)
        return a;
    else
        r=power(a,n/2);
    if(n%2==0)
        return ((r)%mod)*((r)%mod)%mod;
    else
        return ((((r)%mod)*((r)%mod))%mod*((a)%mod))%mod;
}
int mai(int a,int b)
{
    if(a>b)
    return a;
    else 
    {
        return b;
    }
}
int madd(int a,int b)
{
    int ans;
    ans=(a%mod+b%mod)%mod;
    return ans;
}
int mmult(int a,int b)
{
    int ans=1;
    ans=((a%mod)*(b%mod))%mod;
    return ans;
}
int modinverse(int a)
{
    return power(a,mod-2);
}
 int dp[100006];
signed main()
{
     deci(n);
     deci(k);
     int a[n+4];
     for(int i=1;i<=n;i++)
     {
         cin>>a[i];
     }

    //  dp[0]=1;
     for(int i=1;i<=k;i++)
     {
         for(int j=1;j<=n;j++)
         {
             if(i>=a[j]&&dp[i-a[j]]==0)
             {
                 dp[i]=1;
             }
         }
     }
     
     if(dp[k]==1)
     {
         cout<<"First";el
     }
     else
     {
         cout<<"Second";el
     }
}


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

#include <atcoder/all>

using namespace std;
using namespace atcoder;

using ll = long long;
using pii = pair<int, int>;
template <class T>
using V = vector<T>;
template <class T>
using VV = V<V<T>>;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (int i = m; i < (n); i++)
#define per(i, b) per2(i, 0, b)
#define per2(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define ALL(c) (c).begin(), (c).end()
#define SZ(x) ((int)(x).size())

constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }

template <class T, class U>
void chmin(T& t, const U& u) {
    if (t > u) t = u;
}
template <class T, class U>
void chmax(T& t, const U& u) {
    if (t < u) t = u;
}

template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
    os << "(" << p.first << "," << p.second << ")";
    return os;
}

template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "{";
    rep(i, v.size()) {
        if (i) os << ",";
        os << v[i];
    }
    os << "}";
    return os;
}

#ifdef LOCAL
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << H;
    debug_out(T...);
}
#define debug(...) \
    cerr << __LINE__ << " [" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define dump(x) cerr << __LINE__ << " " << #x << " = " << (x) << endl
#else
#define debug(...) (void(0))
#define dump(x) (void(0))
#endif

int main() {
    string s;
    cin >> s;
    V<int> sa = suffix_array(s);
    V<int> lcp = lcp_array(s, sa);
    ll n = s.size();
    ll ans = n * (n + 1) / 2;
    for (auto x : lcp) ans -= x;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 15548
#include <stdio.h>

int main(void)
{
  int a, b, c, d, e, f;
  int sum = 0;

  scanf("%d", &a);
  scanf("%d", &b);
  scanf("%d", &c);
  scanf("%d", &d);
  scanf("%d", &e);
  scanf("%d", &f);

  if(a <= b && a <= c && a <= d){
    sum = b + c + d;
  }
  else if(b <= a && b <= c && b <= d){
    sum = a + c + d;
  }
  else if(c <= a && c <= b && c <= d){
    sum = a + b + d;
  }
  else {
    sum = a + b + c;
  }

  if (e <= f){
    sum += f;
  }
  else {
    sum += e;
  }

  printf("%d\n", sum);

  return (0);

}

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

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

  int n,m;
  cin>>n>>m;
  std::vector< pair<int, int> > vii(m);
  for(int i=0;i<m;i++){
    int a,b;
    cin>>a>>b;
    vii[i] = {b,a};
  }
  int res=0;
  sort(vii.begin(), vii.end());
  int pr=-1;
  for(int i=0;i<m;i++){
    int r = vii[i].first;
    int l = vii[i].second;
    if(pr<=l) {
      res++;
      pr = r;
    }else{
      continue;
    }
  }
  cout<<res<<endl;

  return 0;
}


Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ABC155 {
    public class B {
        public static void Main() {
            Console.ReadLine();
            var strs = Console.ReadLine().Split(' ').Select(int.Parse);

            if(strs.Where(x=>x%2==0).All(x=>x%3==0 || x%5 == 0)) {
                Console.WriteLine("APPROVED");
                return;
            }
            Console.WriteLine($"DENIED");

        }
    }
}


Measured memory_bytes: 13396
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<queue>
#include<set>
#include<map>
using namespace std;
template<typename __T>
inline void read(__T &x)
{
    x=0;
    int f=1;char c=getchar();
    while(!isdigit(c)){if(c=='-')	f=-1;c=getchar();}
    while(isdigit(c))	{x=x*10+c-'0';c=getchar();}
    x*=f;
}
template<typename T>
T rabs(T a)
{
	return a>0?a:-a;
}
int n;
int a[200005];
long long s[200005];
long long que(int l,int r)
{
	return l?s[r]-s[l-1]:s[r];
}
long long ans=1234567998765ll;
int main()
{
	read(n);
	for(int i=0;i<n;i++)
		read(a[i]);
	s[0]=a[0];
	for(int i=1;i<n;i++)
		s[i]=s[i-1]+a[i];
	for(int i=1;i<n-2;i++)
	{
		int pos1=lower_bound(s,s+i+1,s[i]/2)-s;
		int pos2=lower_bound(s+i+1,s+n,(s[n-1]+s[i])/2)-s;
		for(int p1=pos1-1;p1<=pos1;p1++)
		{
			if(p1<0 || p1>=i)	continue;
			for(int p2=pos2-1;p2<=pos2;p2++)
			{
				if(p2>=n || p2<=i)	continue;
				long long a1=que(0,p1);
				long long a2=que(p1+1,i);
				long long a3=que(i+1,p2);
				long long a4=que(p2+1,n-1);
			//	cout<<' '<<p1<<' '<<i<<' '<<p2<<' '<<n-1<<endl;
			//	cout<<a1<<' '<<a2<<' '<<a3<<' '<<a4<<endl;
				ans=min(ans,max(a1,max(a2,max(a3,a4)))-min(a1,min(a2,min(a3,a4))));
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 2560
#include <algorithm>  //sort,二分探索,など
#include <array>
#include <bitset>         //固定長bit集合
#include <cmath>          //pow,logなど
#include <complex>        //複素数
#include <deque>          //両端アクセスのキュー
#include <functional>     //sortのgreater
#include <iomanip>        //setprecision(浮動小数点の出力の誤差)
#include <iostream>       //入出力
#include <map>            //map(辞書)s
#include <numeric>        //iota(整数列の生成),gcdとlcm(c++17)
#include <queue>          //キュー
#include <set>            //集合
#include <stack>          //スタック
#include <string>         //文字列
#include <unordered_map>  //イテレータあるけど順序保持しないmap
#include <unordered_set>  //イテレータあるけど順序保持しないset
#include <utility>        //pair
#include <vector>         //可変長配列

using namespace std;
typedef long long ll;

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPD(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORD(i, a, b) for (ll i = (a); i >= (b); i--)
#define ALL(x) (x).begin(), (x).end()  // sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())  // sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> A(N);
  int sum = 0;
  for (int i = 0; i < N; ++i) {
    cin >> A[i];
    sum += A[i];
  }
  int count = 0;
  cin >> count;
  for (int i = 0; i < N; ++i) {
    if (A[i] * 4 * M >= sum) count++;
  }
  if (count >= M)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


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

int main(void){
    int a,b;
    cin >> a >> b;
    int d=a/b;
    int r=a%b;
    double f= double(a)/double(b);
    cout << d;
    cout << " ";
    cout << r;
    cout << " ";
    cout << fixed << setprecision(5) << f;
    cout << endl;
}


Measured memory_bytes: 3268
#include <cstdio>
#include <algorithm>
using namespace std;

int a[10];
bool cmp(const int &a, const int &b) {
    return a % 10 < b % 10;
}

int main() {
    for (int i = 0; i < 5; i++) {
        scanf("%d", &a[i]);
    }
    sort(a, a + 5, cmp);
    int ans = 0;
    bool chuxian = false;
    for (int i = 0; i < 5; i++) {
        if (a[i] % 10 == 0) ans += a[i];
        else if (!chuxian) {
            ans += a[i];
            chuxian = true;
        } else {
            ans += (10 - (a[i] % 10)) + a[i];
        }
    }
    printf("%d\n", ans);
    return 0;
}

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

int main() {
    long long int N,K;
    cin>>N>>K;
    vector<long long int>H(N);
    for(long long int i=0;i<N;i++){
    	cin>>H.at(i);
    }
    sort(H.begin(),H.end());
    reverse(H.begin(),H.end());
    
    long long int sum=0;
    
    for(long long int i=K;i<N;i++){
    	sum+=H.at(i);
    }
    cout<<sum<<endl;
	return 0;
}

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

int main(){int D, G;
cin >> D >> G;
vector<int> p(D); vector<int> c(D);
rep(i, D) cin >> p.at(i) >> c.at(i);

int ans = 1e5;
rep(i, (1 << D)){
    int tmpscr = 0; int tmpnum = 0;
    rep(j, D){
        if(i & (1 << j)){
            tmpscr += p.at(j) * (j + 1) * 100 + c.at(j);
            tmpnum += p.at(j);
        }
    }
    if(tmpscr >= G) ans = min(ans, tmpnum);
    else{
        int s = D - 1;
        while(i & (1 << s)) s--;
        for(int k = 1; k < p.at(s); k++){
            tmpscr += (s + 1) * 100;
            tmpnum++;
            if(tmpscr >= G){
                ans = min(ans, tmpnum);
                break;
            }
        }
    }
}

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

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

using namespace std;

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

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

	vector<int> upper(n);
	for (int i = 0; i < n; i++)
	{
		cin >> upper[i];
	}

	vector<int> lower(n);
	for (int i = 0; i < n; i++)
	{
		cin >> lower[i];
	}

	vector<int> upper_sum(n + 1);
	vector<int> lower_sum(n + 1);
	for (int i = 0; i < n; i++)
	{
		upper_sum[i + 1] = upper_sum[i] + upper[i];
		lower_sum[i + 1] = lower_sum[i] + lower[i];
	}

	int ans = -INT_MAX;
	for (int i = 0; i < n; i++)
	{
		ans = max(ans, upper_sum[i + 1] - upper_sum[0] + lower_sum[n] - lower_sum[i]);
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < (int)b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    set<int> st;
    st.insert(a);
    st.insert(b);
    st.insert(c);
    if (st.size() == 2) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


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

using namespace std;
#define int int64_t
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define reps(i, a, n) for (int i = (a); i < (n); --i)
#define all(x) (x).begin(), (x).end()
#define gsort(x, n) sort((x), (x + n) greater<int>())
#define rv(s) reverse((s).begin(), (s).end())
#define setout(n, x) setw(n) << setfill(x)
#define Fixed(n) fixed << setprecision(n)
#define pb(x, a) (x).push_back(a)
#define fb(x, a) (x).flont_back(a)
#define eb(x, a) (x).emplaes_back(a)
using pii = pair<int, int>;
constexpr int INF = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const long long mod = 1e9 + 7;

signed main()
{
   cin.tie(nullptr);
   ios_base::sync_with_stdio(false);

   int n,a,b,cnt=0;
   cin>>n;
   vector<pair<int,int>> x;

   rep(i,0,n){
      cin>>a>>b;
      x.emplace_back(b,a);
   }

   sort(all(x));

   for(auto i : x){
      cnt += i.second;
      if(i.first < cnt){
         cout<<"No\n";
         return 0;
      }
   }

   cout<<"Yes\n";
   return 0;
}

Measured memory_bytes: 6384