akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize ("-O3")
#ifdef LOCAL
  #include "helper_funcs.hpp"
#else
  #include <bits/stdc++.h>
#endif
// #include <ext/pb_ds/assoc_container.hpp>
using namespace std;
// using namespace __gnu_pbds;
#define frn(i,a,b) for(ll i=a;i<b;i++)
#define rfrn(i,a,b) for(ll i=a;i>b;--i)
#define forn(i,a,b) for(ll i=a;i<=b;i++)
#define rforn(i,a,b) for(ll i=a;i>=b;--i)
#define frt(it,v) for(auto &it:v)
#define MP make_pair
#define F first
#define S second
#define PB push_back
#define SQ(a) (a)*(a)
#define SUM(n) ((n)*(n+1))/2
// #define SqSUM(n) ((n)*(n+1)*(2*n+1))/2
// #define GMSUM(a,r,n) (a*pow(r,n)-a)/(r-1)
#define ciel(x, y) (((x) / (y)) + ((x) % (y) != 0))
#define input(v,a,b) for(ll i = a ; i<b ; i++) cin>>v[i]
#define output(v,a,b) cout<<"["<<#v<<"]: "; for(ll i = a ; i<b ; i++) cout<<v[i]<<" "; cout<<ln
#define cout_p(x, p) cout << fixed << setprecision((p)) << x << endl
#define dbg(x) cerr << #x << "is" << (x) << endl
#define leadzero(a) __builtin_clz(a)      // count leading zeroes
#define trailzero(a) __builtin_ctz(a)     // count trailing zeroes
#define bitcount(a) __builtin_popcount(a) // count set bits (add ll)
#define ln "\n"
const long long int md = 998244353;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pi;
typedef vector<ll> v1;
typedef vector<vector<ll > > vv2;
#define M 32
#ifndef M_PI
  #define M_PI 3.14159265358979323846
#endif
typedef bitset<M> btst;
typedef priority_queue<int, vector<int>, greater<int>> min_heap;
typedef priority_queue<int, vector<int>> max_heap;
// typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
//     indexed_set;
const ll MAX = LONG_MAX;
const ll lrg = 1000000007;

template<typename ll = long long int>
ll power(ll a,ll n,ll md)
{
  ll cp=n;
  ll vl=1,ac=a;
  while(cp>0){
    if(cp%2!=0)
    {
      vl = (vl * ac)%md;
    }
    ac = (ac %md * ac%md)%md;
    cp/=2;
  }
  return vl;
}

template<typename ll = long long int>
bool is_prime(ll n)
{
  ll c=0;
  for(ll i=2; i <= ll(sqrt(n)); ++i)
  {
    if(n%i==0)
      c++;
  }
  if(c==0)
    return true;
  else
    return false;
}

unordered_map<long long int,map<long long int,long long int > > pf;

template<typename ll = long long int>
map<ll,ll> find_primfcts(ll n)
{
  if(pf.find(n)!=pf.end())
    return pf[n];
  map<ll,ll> fcts;
  fcts[1]=0;
  if(n==1)
    return fcts;
  for(ll i=2; i <= ll(sqrt(n)); ++i)
  {
    if(n%i!=0)
      continue;
    if(!is_prime(i))
    {
      if(is_prime(n/i))
        fcts[n/i]=1;
      continue;
    }
    if(is_prime(n/i))
      fcts[n/i]=1;
    ll cnt=0,vl=i;
    while(n%vl==0)
    {
      cnt++;
      vl=vl*i;
    }
    fcts[i]=cnt;
  }
  if(is_prime(n))
    fcts[n]=1;
  pf[n]=fcts;
  return fcts;
}



void solve()
{
  ll n;
  cin>>n;
  map<ll,ll> pf = find_primfcts(n);
  ll sm=0;
  frt(it,pf)
  {
    ll s = it.second;
    ll c=1;
    while(s-c>=0)
    {
      sm++;
      s-=c;
      c++;
    }
  }
  cout<<sm;
}

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); 
  int t=1,cp;
  // cin>>t;
  cp=t;
  while(t--){
   // cout<<"Case #"<<cp-t<<": ";
   solve();
   cout<<endl;
  }
  return 0;
}

Measured memory_bytes: 3684
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define space " "
#define MOD (long long) 1000000007
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename T> void __f(const char* variable_name, T&& value){cout << variable_name << ": " << value << endl;}
template <typename T1, typename... T2> void __f(const char* names, T1&& arg1, T2&&... args){const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << ": " << arg1 << " |";__f(comma + 1, args...);}

const ll N = 5e5 + 5;
ll *v;
ll n, m;

void solve(){
    cin >> n >> m;
    vector<ll> arr(n);
    ll total = 0;
    for(auto &i : arr){
        cin >> i;
        total += i;
    }
    sort(arr.begin(), arr.end());
    double thresh = (double)total / (4 * m);
    ll done = 0;
    // trace(thresh);
    while(arr.size() > 0 && done < m){
        double x = arr.back();
        arr.pop_back();
        if(x < thresh){
            cout << "No" << endl;
            return;
        }
        done++;
    }
    cout << "Yes" << endl;
}

int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    ll t = 1;
    // cout << "\n\nBLAH BLAH BLAH\n\n";
    // cin >> t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("YES")
#define p_no() p("NO")

template < typename T >
void vprint(T &V){
	for(auto v : V){
    	cout << v << " ";
	}
	cout << endl;
}

const ll mod = 1e9 + 7;
const ll inf = 1e18;

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

    // input
    ll N;
    cin >> N;

    map<ll, ll> mp;
    FOR(i, 0, N){
        ll d;
        cin >> d;
        mp[d]++;
    }

    ll M;
    cin >> M;

    map<ll, ll> mp2;
    FOR(i, 0, M){
        ll d;
        cin >> d;
        mp2[d]++;
    }

    for(auto p : mp2){
        ll difficulty = p.first;
        ll count = p.second;

        if(mp[difficulty]<count){
            p_no();
            return 0;
        }
    }
    
    p_yes();
    return 0;
}

Measured memory_bytes: 25216
# -*- coding: utf-8 -*-
"""
Created on Sun Jul  8 10:56:33 2018

@author: maezawa
"""
n = int(input())
adj = [[] for _ in range(n)]
d = [-1 for _ in range(n)]
d[0] = 0


for j in range(n):
    ain = list(map(int, input().split()))
    u = ain[0]
    k = ain[1]
    for i in range(k):
        adj[u-1].append(ain[i+2]-1)
    adj[u-1].sort()
    #print(*adj[u-1])

stack = [0]

while stack:
    #print(stack)
    current = stack[-1]
    flag = 0
    for k in adj[current]:
        if d[k] < 0:
            d[k] = d[current]+1
            stack.append(k)
            flag = 1
        elif d[k] > d[current]+1:
            d[k] = d[current]+1
            stack.append(k)
            flag = 1
    if flag == 0:
        stack.pop()

    #print('current = {}, t = {}'.format(current, t))
    #print('stack', *stack)

for i in range(n):
    print('{} {}'.format(i+1, d[i]))



Measured memory_bytes: 5632
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  int n;
  cin >> n;
  ll ans = 0;
  for (int i = 1; i <= n; ++i) {
    if (i % 3 == 0 || i % 5 == 0) continue;
    ans += 1ll * i;
  }
  cout << ans << endl;
  return 0;
}

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

using namespace std;

int main(){
    int n, x, y;
    cin >> n >> x >> y; 

    vector<int> ks(n);

    for(int i=1; i <= n-1; i++){
        for(int j=i+1; j<=n; j++){
            int m = min({j-i, abs(x-i) + 1 + abs(y-j), abs(y-i) + 1 + abs(x-j)});
            ks[m]++;
        }
    }

    for(int k=1;k<n;k++){
        cout << ks[k] << endl;
    }
}

Measured memory_bytes: 3620
import math

N, D = map(int, input().split())
X = [0]*N
for i in range(N):
    x = list(map(int, input().split()))
    X[i] = x

ans = 0
for i in range(N-1):
    for j in range(i+1, N):
        dis = 0
        for x1, x2 in zip(X[i], X[j]):
            dis += (x1 - x2)**2
        if math.sqrt(dis) == int(math.sqrt(dis)):
            ans += 1

print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <cstdio>
#include <string.h>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
   int n,o;

int main(void){
   cin>>n;
   for(int i=0;i<n;i++){
       int a;
       cin>>a;
       if(a%2==0)o++;
       
   }
   int ans=1;
   for(int i=0;i<n;i++)ans*=3;
       int h=1;
    for(int i=0;i<o;i++,h*=2);
   
   cout<<ans-h<<endl;
}


Measured memory_bytes: 256
N = int(input())
if N == 0:
  print(0)
else:
  ans = ''
  flag = False
  while flag == False:
    if N%2 == 0:
      ans = '0'+ans
      N = N/(-2)
    else:
      ans = '1'+ans
      N -= 1
      if N == 0:
        flag = True
      else:
        N = N/(-2)
  print(ans)

Measured memory_bytes: 3064
# B - Snake Toy
def main():
    _, k = map(int, input().split())
    l = list(map(int, input().split()))
    cnt = 0
    l.sort(reverse=True)

    for i in range(k):
        cnt += l[i]
    else:
        print(cnt)



if __name__ ==  "__main__":
    main()

Measured memory_bytes: 9164
#include<iostream>

using namespace std;

int main()
{
	int n, i, b, f, r, v,j;
	int A[3][10], B[3][10], C[3][10], D[3][10];

	for (i=0;i<3;i++)
	{
		for (j=0;j<10;j++)
		{
			A[i][j] = 0;
			B[i][j] = 0;
			C[i][j] = 0;
			D[i][j] = 0;
		}
	}

	cin >> n;
	for (i=0;i<n;i++)
	{
		cin >> b >> f >> r >> v;
		switch (b)
		{
		case 1:
			A[f - 1][r - 1] += v;
			break;
		case 2:
			B[f - 1][r - 1] += v;
			break;
		case 3:
			C[f - 1][r - 1] += v;
			break;
		case 4:
			D[f - 1][r - 1] += v;
			break;
		}
	}
	for (i=0;i<3;i++)
	{
		for (j=0;j<10;j++)
		{
			cout << " " << A[i][j];
		}
		cout << endl;
	}
	cout << "####################" << endl;
	for (i = 0; i < 3; i++)
	{
		for (j = 0; j < 10; j++)
		{
			cout << " " << B[i][j];
		}
		cout << endl;
	}
	cout << "####################" << endl;
	for (i = 0; i < 3; i++)
	{
		for (j = 0; j < 10; j++)
		{
			cout << " " << C[i][j];
		}
		cout << endl;
	}
	cout << "####################" << endl;
	for (i = 0; i < 3; i++)
	{
		for (j = 0; j < 10; j++)
		{
			cout << " " << D[i][j];
		}
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 3104
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

vector<bool> num(100010, true);	// trueなら素数

void eratosthenes(int n) {	// n以下の素数を求める
 	
 	num[0] = num[1] = false;	// 0と1を除外
 	
 	for (int i = 2; i*i <= n; i++) { // 2から√nまで探索
 		if (num[i]) {
 			for (int j = i*i; j <= n; j += i) {	// iの倍数をfalseにする
 				num[j] = false;
 			}
 		}
 	}
 }

int main()
{

    int a;

    cin >> a;

    eratosthenes(100010);

    if (num[a]) {
        cout << a << endl;
        return (0);
    }

    while (num[a] == false) {
        a++;
        if (num[a]) {
            cout << a << endl;
            break;
        }
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
 
using namespace std;
 
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,k;
    cin >> n >> k;
    vi vec(n);
    forn(i,n) {
        cin >> vec[i];
    }
    sort(all(vec));
    reverse(all(vec));

    int l = 1;
    int r = vec[0]+1;
    int ans = INT_MAX;
    while (l<=r) {
        int mid = (l+r)/2;  
        bool ok = true;
        int cnt = 0;

        forn(i,n) {
            if (vec[i] <= mid) {
                break;
            }
            cnt += vec[i] / mid;
            if (cnt > k) {
                ok = false;
                break;
            }
        }
        if (ok) {
            ans = min(mid, ans);
            r = mid -1;
        }
        else {
            l = mid + 1;
        }
    }
    if (ans == INT_MAX) {
        ans = vec[0];
    }
    cout << ans;
    
    
    
    return 0;
} 

Measured memory_bytes: 3968
#include <bits/stdc++.h>
using namespace std;
int n;
string s,pre;
int main() 
{
    cin>>n;
    int a=0,b=n,c=n/2;
    cout<<0<<endl;
    cin>>pre;
    s=pre;
    while(s!="Vacant") 
	{
        cout<<c<<endl;
        cin>>s;
        if((pre==s)^(a%2==c%2))
		{
            b=a; 
			a=c;
        } 
		else{
			a=c;
		}
        c=(a+b)/2;
        pre=s;
    }
}

Measured memory_bytes: 852
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
#include <ccomplex>
#include <unordered_map>
#include <cstring>
#include <iostream>
#include <numeric>
#include <sstream>
#include <set>
#include <map>
#include <iomanip>

using namespace std;
#define MAX 1LL << 60
#define MOD 1000000007

typedef long long ll;

#define rep(i, s, e) for(ll i = s; i < e; i++)
#define repR(i, s, e) for(ll i = s; i > e; i--)
#define reft0(i, j) setfill('0') << setw(i) << j
#define fix(i) fixed << setprecision(i)


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; }
template<class T> inline ll gcd(T a, T b){ if (a % b == 0){ return b; } else{ return gcd(b, a%b); } }
template<class T> inline ll lcm(T a, T b){ return a * b / gcd(a, b); }
template<class T> inline ll fact(T a){ if (a <= 1){ return 1; } else{ return a * fact(a - 1); } }
template<class T> inline ll comb(T a, T b){ return a == 0 ? 0 : fact(a) / fact(b) / fact(a - b); }

int main(){
    ll N;
    vector<ll> H;
    cin >> N;
    rep(i, 0, N){
        ll temp;
        cin >> temp;
        H.push_back(temp);
    }
    rep(i, 1, N){
        if ((H[N - i] - H[N - i - 1]) < -1){
            cout << "No" << endl;
            return 0;
        }
        else if ((H[N - i] - H[N - i - 1]) == -1){
            H[N - i - 1]--;
        }
    }
    
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 1400
s=input()
if s[-7:]=="keyence":
  print("YES")
elif s[0]=="k" and s[-6:]=="eyence":
  print("YES")
elif s[:2]=="ke" and s[-5:]=="yence":
  print("YES")
elif s[:3]=="key" and s[-4:]=="ence":
  print("YES")
elif s[:4]=="keye" and s[-3:]=="nce":
  print("YES")
elif s[:5]=="keyen" and s[-2:]=="ce":
  print("YES")
elif s[:6]=="keyenc" and s[-1]=="e":
  print("YES")
elif s[:7]=="keyence":
  print("YES")
else:
  print("NO")

Measured memory_bytes: 3064
#include <complex>
#include <cmath>
#include <iostream>
#include <stdio.h>
#include <cassert>

using namespace std;

typedef complex<double> xy_t;
xy_t P[110];
char c;
double x,y ;
int N = 0 ;
double s = 0.0;

int main() {
    // ??\???
    while(cin >> x >> c >> y){
        P[N] = xy_t(x,y);
        N++ ;
    }
    //?¨????
    for (int i=0; i+2<N; ++i){
        xy_t a = P[i+1] - P[0];
        xy_t b = P[i+2] - P[0];
        s = s + (conj(a)*b).imag()/2 ;
    }
    printf("%.6f\n", abs(s)) ;
}

Measured memory_bytes: 1244
{-# LANGUAGE BangPatterns        #-}
{-# LANGUAGE FlexibleContexts    #-}
{-# LANGUAGE MultiWayIf          #-}
{-# LANGUAGE RankNTypes          #-}
{-# LANGUAGE ScopedTypeVariables #-}
import           Control.Monad.State
import qualified Data.ByteString.Char8 as BS
import           Data.Char
import           Data.List
import qualified Data.Vector.Unboxed   as VU

main :: IO ()
main = do
  [n,w] <- readLnAsListWith unconsInt
  wvs <- readLnAsUVecWith2Tuple unconsInt n

  print $ VU.maximum $ solve n w wvs



solve :: Int -> Int -> VU.Vector (Int,Int) -> VU.Vector Int
solve n w wvs = go 0 (VU.replicate (w+1) 0)
  where go m wvec
          | m == n = wvec
          | otherwise =
              let (wt,vt) = wvs VU.! m
              in go (m+1) $ VU.generate (w+1) $ \i ->
                if i - wt < 0
                then wvec VU.! i
                else max (wvec VU.! i) (vt + wvec VU.! (i-wt))

unconsInt :: StateT BS.ByteString Maybe Int
unconsInt = StateT $ BS.readInt . BS.dropWhile isSpace

readLnAsListWith :: StateT BS.ByteString Maybe a -> IO [a]
readLnAsListWith !st = unfoldr (runStateT st) <$> BS.getLine

-- for unboxed vector
readLnAsUVecWith :: VU.Unbox a => StateT BS.ByteString Maybe a -> Int -> IO (VU.Vector a)
readLnAsUVecWith !st !n = VU.unfoldrN n (runStateT st) <$> BS.getLine

-- example: 1D tuple vector
readLnAsUVecWith2Tuple :: VU.Unbox a => StateT BS.ByteString Maybe a -> Int -> IO (VU.Vector (a,a))
readLnAsUVecWith2Tuple !st !n = VU.replicateM n $ (\vec -> (vec VU.! 0, vec VU.! 1)) <$> readLnAsUVecWith st 2


Measured memory_bytes: 84844
/* 
 * Project: AtCoder Beginners Contest 095 B - Bitter Alchemy
 * Author: toms74209200 <https://github.com/toms74209200>
 *
 * Created on 2020/06/12
 * Copyright (c) 2020 toms74209200
 * 
 * This software is released under the MIT License.
 * http://opensource.org/licenses/mit-license.php
 */
#include <cstdio>
#include <algorithm>
#include <numeric>
using namespace std;

int n, x;
int m[1000];

void solve() {

    sort(m, m+n);
    int last = x - accumulate(m, m+n, 0);
    int sum = last / m[0] + n;
    printf("%d\n", sum);

}

int main() {

    scanf("%d", &n);
    scanf("%d", &x);
    for (int i=0;i<n;i++) {
        scanf("%d", &m[i]);
    }

    solve();

}

Measured memory_bytes: 384
def solve():
    n,k = map(int,input().split())
    res = 0
    for i in range(k+1,n+1):
        res+=(i-k)*(n//i)
        if n%i>=k:
            if k==0:
                res+=n%i
            else:
                res+=n%i-k+1
    print(res)
if __name__=='__main__':
    solve()

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

int main(){
  string s;
  cin >> s;
  bool bad = false;
  rep(i,3){
    if(s[i] == s[i+1]) bad = true;
  }
  
  if(bad) cout << "Bad";
  else cout << "Good";
  return 0;
}

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

using namespace std;


//repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define euc_dis(x, y) sqrt(x*x + y*y)

#define pb push_back
#define mp make_pair
#define INF 999999999
#define MOD 1000000007
#define sp ' '


//typedef
typedef long long ll;
typedef pair<int, int> pint;
typedef pair<long, long> pll;
typedef map<int, int> mint;
typedef set<int> sint;
typedef vector<int> vint;
typedef vector<char> vchr;
typedef vector<long long> vll;
typedef vector<string> vstr;


ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll a, ll b, ll c){ll ans=1; rep(i, b){ans=ans*a%c;} return ans;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

template<typename T>
void ppp(T n){cout << n << endl;}
template<typename T>
void dpp(T n){cerr << n << endl;}
template<typename T>
void vpp(T a){rep(i,a.size()){cout << a[i] << endl;}}
template<typename T>
void vdp(T a){rep(i,a.size()){cerr << a[i] << endl;}}

const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int ddx[8] = {1,0,-1,0,1,-1,-1,1};
const int ddy[8] = {0,1,0,-1,1,1,-1,-1};

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;

    pair<int, bool> p[n];
    rep(i, n) {
        int tmp;
        cin >> tmp;
        if(i+1 == tmp) p[i] = make_pair(tmp, false);
        else p[i] = make_pair(tmp, true);
    }

    int cnt = 0;

    rep(i, n){
        if(!p[i].second){
            swap(p[i], p[i+1]);
            ++cnt;
            p[i].second=true;
            p[i+1].second=true;
        }
    }


    ppp(cnt);


    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <cassert>
using namespace std;

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

int main(){
    int H, W;
    cin >> H >> W;
    vector<string> A(H);
    for(int i=0; i<H; i++)
        cin >> A[i];

    int cnt = 0;
    queue<pair<int, int>> que;
    for(int i=0; i<H; i++)
        for(int j=0; j<W; j++)
            if(A[i][j] == '#'){
                que.push(make_pair(i, j));
                cnt++;
            }
    int ans = 0;
    while(cnt < H*W){
        queue<pair<int, int>> que_new;
        ans++;
        while(!que.empty()){
            auto yx = que.front();
            que.pop();
            int y = yx.first;
            int x = yx.second;
            for(int k=0; k<4; k++){
                int y2 = y + dy[k];
                int x2 = x + dx[k];
                if(y2 < 0 || y2 >= H || x2 < 0 || x2 >= W) continue;
                if(A[y2][x2] == '#') continue;
                A[y2][x2] = '#';
                que_new.push(make_pair(y2, x2));
                cnt++;
            }
        }
        que = que_new;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 9600
from math import sqrt
import itertools
N = int(input())
dis = [input().split() for i in range(N)]
lst = [x for x in range(N)]

p_lst = list(itertools.permutations(lst))

ans = 0
for i in p_lst:
    for j in range(N-1):
        ans += sqrt((int(dis[i[j]][0]) - int(dis[i[j+1]][0]))**2
                  + (int(dis[i[j]][1]) - int(dis[i[j+1]][1]))**2)

print(ans/len(p_lst))

Measured memory_bytes: 74364
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <istream>
#include <set>
#include <queue>
#define rep0(i,n) for (int i = 0; i <= (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)
#define REP(a,b) for (int i = a; i <= (b); ++i) 
#define MOD 1000000007
#define ra 380000
using namespace std;
typedef long long ll;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	long double a = 0;
	long double ans = 0;
	string s;
	rep0(i, n - 1) {
		cin >> a >> s;
		if (s == "BTC")a *= ra;
		ans += a;
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
  int r;
  cin >> r;
  
  if(r < 1200) cout << "ABC" << endl;
  if(1200 <= r && r < 2800) cout << "ARC" << endl;
  if(2800 <= r) cout << "AGC" << endl;
  
}

Measured memory_bytes: 256
s = input()
s = s[:-1]
while len(s) != 1:
    if len(s)%2 == 0:
        i = int(len(s)/2)
        if s[:-i] == s[i:]:
            print(len(s))
            break
        else:
            s = s[:-1]
    else:
        s = s[:-1]

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

#if DEBUG
template <typename T>
void debug(const T& value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(const T& value, const Ts&... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                        \
  do {                                  \
    cerr << #__VA_ARGS__ << ": ";       \
    debug(__VA_ARGS__);                 \
    cerr << " (L" << __LINE__ << ")\n"; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define rd(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << '\n';
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define wt(...) write_to_cout(__VA_ARGS__);

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

using ll = long long;

template <typename T>
using V = std::vector<T>;
template <typename T>
using VV = V<V<T>>;

using namespace std;

int main() {
  rd(int, a, b, c, x, y);
  int ans = numeric_limits<int>::max();
  for (int i = 0; i <= max(x, y); ++i) {
    int sum = i * 2 * c;
    if (x > i) sum += (x - i) * a;
    if (y > i) sum += (y - i) * b;
    ans = min(ans, sum);
  }
  wt(ans);
}


Measured memory_bytes: 3596
#include <iostream>
#include <cstring>

using namespace std;

const int D = 1e3;

int main() {
    int n, c;
    cin >> n >> c;
    int d[c][c];
    for (int i = 0; i < c; i++) {
        for (int j = 0; j < c; j++) {
            cin >> d[i][j];
        }
    }

    int cnt[3][c];
    memset(cnt, 0, sizeof(cnt));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            int a;
            cin >> a;
            cnt[(i+j)%3][a-1]++;
        }
    }

    int ans = D * n * n;
    for (int x = 0; x < c; x++) {
        for (int y = 0; y < c; y++) {
            for (int z = 0; z < c; z++) {
                if (x != y && y != z && z != x) {
                    int cur = 0;
                    for (int t = 0; t < c; t++) {
                        cur += cnt[0][t] * d[t][x];
                        cur += cnt[1][t] * d[t][y];
                        cur += cnt[2][t] * d[t][z];
                    }
                    ans = cur < ans ? cur : ans;
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Collections;
static class Extensions
{
    public static int ToInt(this string s) => int.Parse(s);
    public static long ToLong(this string s) => long.Parse(s);
    public static char ToChar(this string s) => char.Parse(s);
    public static double ToDouble(this string s) => double.Parse(s);
    public static int[] ToIntArray(this string s) => s.Replace(',', ' ').Split(' ').Select(x => x.ToInt()).ToArray();
    public static long[] ToLongArray(this string s) => s.Replace(',', ' ').Split(' ').Select(x => x.ToLong()).ToArray();
    public static double[] ToDoubleArray(this string s) => s.Replace(',', ' ').Split(' ').Select(x => x.ToDouble()).ToArray();
}

class Program
{
    static string[] ReadLines(int n) => Enumerable.Range(0, n).Select(s => Console.ReadLine()).ToArray();

    static void Main()
    {
        int[] pqr = Console.ReadLine().ToIntArray();

        int min = int.MaxValue;

        for(int i = 0; i < pqr.Length; i++)
        {
            for(int j = i + 1; j < pqr.Length; j++)
            {
                

                min = Math.Min(pqr[i] + pqr[j], min);
            }
        }

        Console.WriteLine(min);
    }
}

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

using namespace std;
deque<string> q;
int main()
{
    string s;
    int n, fao;
    cin >> n >> fao;
    fao=n;
    while(n--)
    {
        cin >> s;
        q.push_back(s);
    }
    sort(q.begin(), q.end());
    for(n=0;n<fao;n++) cout<<q[n];
    return 0;
}


Measured memory_bytes: 256
use strict;
use warnings;

sub main {
    chomp(my $s = <STDIN>);
    print solver($s);
}
main() unless caller;

sub solver {
    my ($s) = @_;
    my $max = length($s);
    my $ap = index($s, "A");
    my $zp = index(reverse($s), "Z");
    $max = $max - $ap - $zp;
    return $max;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S; cin >> S;
    int cnt[27] = {};
    rep(i, S.length()) {
        cnt[S[i] - 'a']++;
    }
    rep(i, 27) {
        if (cnt[i] % 2 == 1) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl; 

    return 0;
}


Measured memory_bytes: 256
t = input().split(" ")
H = int(t[0])
W = int(t[1])
list1 = []
for i in range(H):
    t = str(input())
    list1.append(t)
erase_index = []
for i in range(H):
    W_count = 0
    for j in range(W):
        if list1[i][j] == '.':
            W_count += 1
    if W_count == W:
        erase_index.append(i)
erase_char = []
for i in range(W):
    H_count = 0
    for j in range(H):
        if list1[j][i] == '.':
            H_count += 1
    if H_count == H:
        erase_char.append(i)
for i in range(len(erase_index)):
    list1.pop(erase_index[len(erase_index)-1-i])
ans = []
for i in zip(*list1):
    ans.append(list(i))
for i in range(len(erase_char)):
    ans.pop(erase_char[len(erase_char)-1-i])
answer = []
for i in zip(*ans):
    answer.append(list(i))
for i in range(len(answer)):
    s = ""
    for j in range(len(answer[i])):
        s += str(answer[i][j])
    print(s)

Measured memory_bytes: 3316
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val a = (0 until n).map { sc.next().toInt() }
    println(problem(n, a))
}

fun problem(n: Int, a: List<Int>): Int {
    val results = mutableListOf<Int>()
    fun computePattern(i: Int, multi: Int) {
        if (i == n) {
            results.add(multi)
            return
        }
        computePattern(i + 1, multi * a[i])
        computePattern(i + 1, multi * (a[i] + 1))
        computePattern(i + 1, multi * (a[i] - 1))
    }
    computePattern(0, 1)
    return results.filter { it % 2 == 0 }.count()
}

Measured memory_bytes: 37384
#include<bits/stdc++.h>
#define ull unsigned long long int
#define ll long long
#define f(i,n) for(int i = 0;i<n ;i++)
#define ii pair<int,int>
#define vii vector<ii>
#define vi vector<int>
#define vl vector<ll>
#define mii map<int,int>
#define uii unordered_map<int,int>
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define pb push_back
#define INF 0x3f3f3f3f
#define print(x) cout<<x<<"\n";
#define printv(v) for(auto it : v) cout<<it<<" ";


//#include<boost/multiprecision/cpp_int.hpp>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
//(Uncomment when needed and be sure it not give TLE bcoz it requires time)
//#pragma GCC optimize "trapv"//to check integer overflow and gives RE.
//typedef tree<pair<int,int>,null_type, 
//less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update>   ordered_set;
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN NEEDED)\
#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("O3")
//uncoment for large int requirement
//using boost::multiprecision::cpp_int;
//using namespace _gnu_pbds;

using namespace std;
const long long int MOD = 1e9+7;
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
//use it with unordered_map<T,T,custom_hash> safe_map

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

int main()
{fast_io

int t;
//cin>>t;
t = 1;
while(t--)
{
 string s;
 string te;
 cin>>s>>te;
 ll n = te.length();
 ll ans = INT_MAX;
 for(int i  = 0 ;i+n-1<s.length();i++){
     ll tmp = 0 ; 
     for(int j = 0  ; j<te.length();j++){
         if(s[i+j]==te[j]){
             tmp++;
         }
     }
     ans = min(ans,n-tmp);
 }
 cout<<ans<<endl;
}
}


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

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    int k = n, ans = 0;;
    for (int i = 0; i < n; i++) {
        if (i && a[i] == a[i - 1]) {
            a[i] = ++k;
            ans++;
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
#![allow(unused_imports, dead_code, unused_variables, unused_mut, unused_parens)]

use std::cmp;
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::mem::swap;
use permutohedron::LexicalPermutation;
const INF: i32 = std::i32::MAX;
const MOD: i32 = 1e9 as i32 + 7;

struct Get<R: std::io::BufRead> {
    stdin: R,
    v: Vec<String>,
    i: usize,
}
impl<R: std::io::BufRead> Get<R> {
    pub fn new(stdin: R) -> Self {
        Get {
            stdin: stdin,
            v: Vec::new(),
            i: 0,
        }
    }
    fn split_line(&mut self) {
        self.i = 0;
        self.v.clear();
        let mut buf = String::new();
        self.stdin.read_line(&mut buf).unwrap();
        let buf = buf.trim().to_owned();
        let mut ws = buf.split_whitespace();
        loop {
            let x = ws.next();
            if x.is_none() {
                break;
            }
            let x = x.unwrap().to_owned();
            self.v.push(x);
        }
    }
    #[allow(dead_code)]
    pub fn once<T: std::str::FromStr>(&mut self) -> T {
        if self.i == self.v.len() {
            self.split_line();
        }
        let elem = &self.v[self.i];
        self.i += 1;
        elem.parse().unwrap_or_else(|_| panic!())
    }
    #[allow(dead_code)]
    pub fn line<T: std::str::FromStr>(&mut self) -> String {
        self.i = 0;
        self.v.clear();
        let mut buf = String::new();
        self.stdin.read_line(&mut buf).unwrap();
        let buf = buf.trim().to_owned();
        buf
    }
}

fn main() {
    let stdin = std::io::stdin();
    let stdin = std::io::BufReader::new(stdin.lock());
    let get = Get::new(stdin);
    solve(get);
}

fn solve<R: std::io::BufRead>(mut get: Get<R>) {
    let mut x: i32 = get.once();
    
    println!("{}", 10 - x / 200);
}

Measured memory_bytes: 2172
#include<bits/stdc++.h>
using namespace std;
#define rp(i,j) for(long long i=0;i<j;i++)
#define rep(i,j,k) for(long long i=j;i<k;i++)
#define mod 1000000007
#define NIL -1
#define MAX 50
const int INFTY=(1<<21);
typedef long long ll;
int H,W;
int c[MAX][MAX];
int checked[MAX][MAX]={0};
void dfs(int x,int y){
    if(x<0||x>=H||y<0||y>=W||c[x][y]==0)return;
    if(checked[x][y]==1)return;
    checked[x][y]=1;
    rep(i,-1,2){
        rep(j,-1,2){
            dfs(x+i,y+j);
        }
    }
}
int main(){
    while(1){
        int ans=0;
        cin>>W>>H;
        if(H==0&&W==0)break;
        else {
            rp(i,H){
                rp(j,W){
                    cin>>c[i][j];
                    checked[i][j]=0;
                }
            }
            rp(i,H){
                rp(j,W){
                    if(c[i][j]==1&&checked[i][j]==0){
                        dfs(i,j);
                        ans++;
                    }
                }
            }
        }
        cout<<ans<<endl;
    }
}


Measured memory_bytes: 3092
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
int dx[4]={-1,0,1,0};
int dy[4]={0,1,0,-1};
#define INF 1<<21
using pii = std::pair<int,int>;
#define SORT(v) std::sort(v.begin(), v.end())
int main(){
    int N;
    std::cin >> N;
    std::vector<int> a(N);
    for (int i = 0; i < N; i++) {
        std::cin >> a[i];
    }
    std::vector<int> color(9);
    for (int i = 0; i < N; i++) {
        if (a[i] >= 1 && a[i] <= 399) {
            color[1]++;
        }
        else if (a[i] >= 400 && a[i] <= 799) {
            color[2]++;
        }
        else if (a[i] >= 800 && a[i] <= 1199) {
            color[3]++;
        }
        else if (a[i] >= 1200 && a[i] <= 1599) {
            color[4]++;
        }
        else if (a[i] >= 1600 && a[i] <= 1999) {
            color[5]++;
        }
        else if (a[i] >= 2000 && a[i] <= 2399) {
            color[6]++;
        }
        else if (a[i] >= 2400 && a[i] <= 2799) {
            color[7]++;
        }
        else if (a[i] >= 2800 && a[i] <= 3199) {
            color[8]++;
        }
        else {
            color[0]++;
        }
    }
    int ans = 0;
    for (int i = 1; i < 9; i++) {
        if (color[i] > 0) {
            ans++;
        }
    }
    if (ans != 0) {
        std::cout << ans << " " << ans + color[0] << std::endl;
    }
    else {
        std::cout << 1 << " " << ans + color[0] << std::endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var stdin = initStdin()

func initStdin() *bufio.Scanner {
	var stdin = bufio.NewScanner(os.Stdin)
	stdin.Split(bufio.ScanWords)
	return stdin
}

func nextString() string {
	stdin.Scan()
	return stdin.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(nextString())
	return i
}

func nextInt64() int64 {
	i, _ := strconv.ParseInt(nextString(), 10, 64)

	return i
}

func main() {
	W := nextInt()
	H := nextInt()
	x := nextInt()
	y := nextInt()

	area := float64(W) * float64(H) / 2.0
	var multiple string

	if float64(x) == float64(W)/2 && float64(y) == float64(H)/2 {
		multiple = "1"
	} else {
		multiple = "0"
	}

	fmt.Printf("%.6f %s\n", area, multiple)
}


Measured memory_bytes: 640
#include <stdio.h>
#include <string.h>

char S1[20] = {"CODEFESTIVAL2016"};
char S[20];

int main() {

	int len = strlen(S1);

	scanf("%s",S);

	int i;

	int ans = 0;

	for (i = 0; i < len; i++) {
		if (S1[i] != S[i]) { ans++; }
	}
	printf("%d\n",ans);

	return 0;
}

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

int main(){
    int n,a;
    cin>>n;
    set<int> st;
    for(int i{};i<n;++i){
        cin>>a;
        st.insert(a);
    }
    puts(st.size()==n?"YES":"NO");
}

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

using namespace std;
using ll = long long;
using ld = long double;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define ALL(a) (a).begin(),(a).end()
#define CHMIN(a, b) a = min((a),(b))
#define CHMAX(a, b) a = max((a),(b))
#define ZP(a, len) cout << setfill('0') << setw(len) << right << a << endl;
const int INF = 1e9;
const int MOD = 1e9 + 7;

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

    rep(bit, 1 << s.length() - 1) {
        int total = s[0] - '0';
        string ans = s.substr(0, 1);
        rep(i, s.length() - 1) {
            if (bit & (1 << i)) {
                total += s[i + 1] - '0';
                ans += "+" + s.substr(i + 1, 1);
            } else {
                total -= s[i + 1] - '0';
                ans += "-" + s.substr(i + 1, 1);
            }
        }
        if (total == 7) {
            cout << ans + "=7" << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 256
fn main() {
    let vec = read_line();
    if vec[2] <= vec[0] + vec[1] {
        println!("Yes");
    } else {
        println!("No");
    }
}

fn read_line() -> Vec<i32> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    let v = s.trim()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect();
    return v
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define int long long int
 
#define pi pair<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define vp vector<pi>
#define vvp vector<vp>

int t=1,T;
int mod = 1e9+7;
const int INF = 1000000000;
 
//---------------------------------------------------------------------------
 
void print(vector<int> a){
    for(int x : a){
        cout << x <<' ';
    }
    cout << endl;
    return;
}
 
void print2d(vector<vector<int>> &v){
    for(int i=0;i<v.size();i++){
        for(int x:v[i]){
            cout << x <<' ';
        }
        cout <<endl;
    }
}
 
int power(int a, int b){
    if(b==0) return 1;
    int x = power(a, b/2);
    x = (x*x);
    return b&1 ? (x*a) : x;
}
 
void swap(int &n, int &m){
    n=n^m;
    m=n^m;
    n=n^m;
}
 
//---------------------------------------------------------------------------
void solve(){
    int n;cin >> n;
}
 
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int a,b,c,d;
    cin >> a >> b >> c>> d;
    cout <<max(max(max(a*c,b*d),b*c),a*d);
 
    return 0;
}
 
/*
set
map
erase
clear
stack
insert
count
queue
front
vector
begin
end
string
push_back
push
pop
pop_back
first
second
rbegin
rend
make_pair
*/

Measured memory_bytes: 3652
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#include<math.h>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin,(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    set<int>s;
    FOR(i,1,7){
        s.insert((int)pow(2,i));
    }
    int n;
    cin >> n;
    if(n < 2){
        cout << n << endl;
        return 0;
    }
    for(int i=n;i >= 2;i--){
        if(s.find(i)!=s.end()){
            cout << i << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#define rep(i, n) for (int i = 0; i < n; i++)
#define rep1(i, n) for (int i = 1; i <= n; i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl;

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<long long, long long> pll;

const int INF = 1 << 30;
const long long INFL = 1LL << 62;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 70000;

struct mint {
    ll x;
    mint(ll x=0):x((x%MOD+MOD)%MOD){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {if ((x+=a.x)>=MOD) x-=MOD; return *this;}
    mint& operator-=(const mint a) {if ((x+=MOD-a.x)>=MOD) x-=MOD; return *this;}
    mint& operator*=(const mint a) {(x*=a.x)%=MOD; return *this;}
    mint operator+(const mint a) const {mint res(*this); return res+=a;}
    mint operator-(const mint a) const {mint res(*this); return res-=a;}
    mint operator*(const mint a) const {mint res(*this); return res*=a;}
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(MOD-2);}
    mint& operator/=(const mint a) { return (*this) *= a.inv();}
    mint operator/(const mint a) const {mint res(*this); return res/=a;}
};

int main() {
	ll n, k;
	cin >> n >> k;

	if(n == 1) {
		cout << 1 << endl;
		return 0;
	}

	ll base[N];
	ll last;
	for(int i = 1; i <= sqrt(n) + 2; i++) {
		base[i] = i;
		if(n / i <= i) {
			last = i;
			break;
		}
	}
	int start, ref;
	if(n / last == last) {
		start = last + 1;
	}
	else if(n / last < last) {
		start = last;
	}
	int i_max;
	for(int i = start, ref = last - 1; ref >= 1;i++, ref--) {
		base[i] = n / ref;
		i_max = i;
	}
	// if n=10, base={1,2,3,5,10}
	for(int i = i_max; i >= 2; i--) {
		base[i] = base[i] - base[i - 1];
	}
	// if n=10, base={1,1,1,2,5}

	vector<vector<mint>> dp(k + 1, vector<mint>(i_max + 2));
//	mint dp[101][N];
	for(int i = 1; i <= i_max; i++) {
		dp[1][i] = base[i];
	}
	for(int i = 2; i <= k; i++) {
		dp[i][i_max + 1] = 0;
		for(int j = i_max; j >= 1; j--) {
			dp[i][j] = dp[i][j + 1] + dp[i - 1][i_max - j + 1];
		}
		for(int j = 1; j <= i_max; j++) {
			dp[i][j] *= base[j];
		}
	}
//	cout << i_max << endl;

	mint ans = 0;
	for(int i = 1; i <= i_max; i++) {
		ans += dp[k][i];
	}
	cout << ans.x << endl;
}


Measured memory_bytes: 51328
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<cstring>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
#include<time.h>
#include<cassert>
#include<functional>
#include<numeric>
#include<tuple>

using namespace std;
using ll = long long;
using ld = long double;
#define int long long
#define all(a) (a).begin(),(a).end()
#define EPS (1e-7)
#define fs first
#define sc second
#define xx first
#define yy second.first
#define zz second.second
#define H pair<int, int>
#define P pair<int, pair<int, int>>
#define Q(i,j,k) mkp(i,mkp(j,k))
#define R pair<pair<int, int>, pair<int, int>>
#define S(i,j,k,l) mkp(mkp(i,j),mkp(k,l))
#define rep(i,n) for(int (i) = 0 ; (i) < (n) ; (i)++)
#define rng(i,s,n) for(int (i) = (s) ; (i) < (n) ; (i)++)
#define req(n,i) for(int (i) = (n) - 1 ; (i) >= 0 ; (i)--)
#define mkp make_pair
#define mem(x,k) memset(x,k,sizeof(x))
#define vec vector
#define pb emplace_back
#define lb lower_bound
#define ub upper_bound
#define crdcomp(b) sort(all((b)));(b).erase(unique(all((b))),(b).end())
#define ssp(i,n) (i==n-1?"\n":" ")
#define ctoi(c) (int)(c-'a')
#define itoc(c) (char)(c+'a')
#define itn int
#define pri_que priority_queue
#define pp(x,y) pb(H{x,y})
#define ppp(x,y,z) pb(Q(x,y,z))
#define pppp(x,y,z,w) pb(S(x,y,z,w))
#define cyes cout<<"Yes\n"
#define cno cout<<"No\n"
const int mod = 1e9 + 7;
const int Mod = 998244353;
const ll inf = 3 * 1e18;
const int Inf = 15 * 1e8;
const vec<int>dx{ -1,1,0,0 }, dy{ 0,0,-1,1 };
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; }
ll read() { ll u, k = scanf("%lld", &u); return u; }
string reads() { string s; cin >> s; return s; }
ll gcd(ll i, ll j) { return j ? gcd(j, i % j) : i; }
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
ll bitcount(ll x) {
	int sum = 0; for (int i = 0; i < 60; i++)if ((1ll << i) & x) sum++;
	return sum;
}
/*const int fn_ = 1000005;
ll fact_[fn_], comp_[fn_];
ll comb(ll x, ll y, ll Mod = mod) {
	if (!fact_[0]) {
		fact_[0] = 1; comp_[0] = 1;
		for (int i = 1; i < fn_; i++) {
			fact_[i] = fact_[i - 1] * i % Mod;
			comp_[i] = mod_pow(fact_[i], Mod - 2, Mod);
		}
	}
	if (x < y) return 0;
	return fact_[x] * comp_[x - y] % Mod * comp_[y] % Mod;
}*/
//--------------------------------------------------------------
signed main() {
	int n = read();
	vec<int>a;
	rep(i, n) a.pb(read());
	rep(i, n) {
		if (a[i] % 2 == 0) {
			if (!(a[i] % 3 == 0 || a[i] % 5 == 0)) {
				cout << "DENIED\n";
				return 0;
			}

		}
	}
	cout << "APPROVED\n";
}

Measured memory_bytes: 256