akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define ote(x) cout<<(x)<<endl
#define all(x) (x).begin(),(x).end()
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define rpz(i,e) rp(i,0,e)
using vi = vector<int>;
using vvi = vector<vi>;
using VC = vector<char>;
using VVC = vector<VC>;
// using PII = pair<int,int>;

// 事例: 文字列迷路をスタート(sh,sw)から各マスまでの最短経路をdist[][]に求める
// BFS (幅優先探索)
#define HMAX 20
#define WMAX 20
VVC S(HMAX+2, VC(WMAX+2, '#'));
vvi dist(HMAX+1, vi(WMAX+1, -1));
int dx[4]={0,-1,0,1}, dy[4]={-1,0,1,0};
void bfs(int sh, int sw){
	dist[sh][sw] = 0;
	S[sh][sw] = '_';
	queue<int> qh, qw;
	qh.push(sh), qw.push(sw);
	while(!qh.empty()){
		int ph = qh.front(); qh.pop();
		int pw = qw.front(); qw.pop();
		rpz(k, 4){
			int h = ph + dy[k], w = pw + dx[k];
			if(S[h][w] != '.') continue;
			S[h][w] = '_';
			dist[h][w] = dist[ph][pw] + 1;
			qh.push(h);
			qw.push(w);
		}
	}
	// for(auto v:dist){for(auto d:v){if(d<0)printf("__\t");else printf("%2d\t",d);}puts("");}////
	// return dist[gh][gw];
}

int main(){
	int H,W;
	cin>>H>>W;

	rp(h, 1, H+1){
		string s; cin>>s;
		rp(w, 1, W+1) if(s[w-1]=='.') S[h][w] = '.';
	}
	// for(auto v:S){for(auto x:v){cout<<x;}puts("");}//

	// rp(i,1,H+1){
	// 	rp(j,1,W+1)if(dist[i][j]>=0)cout<<dist[i][j]<<" ";else cout<<"x ";
	// puts("");}puts("---------------");//

	VVC S_temp = S;
	vvi dist_temp = dist;

	int ans = 0;
	rp(h,1,H+1){
		rp(w,1,W+1){
			S = S_temp;
			dist = dist_temp;
			if(S[h][w]=='.'){
				bfs(h,w);

	// cout<<"("<<h<<" "<<w<<")\n";///
	// rp(i,1,H+1){
	// 	rp(j,1,W+1)if(dist[i][j]>=0)cout<<dist[i][j]<<" ";else cout<<"x ";
	// puts("");}puts("---------------");//

				for(auto v:dist)
					for(auto d:v) ans = max(ans, d);
			}
		}
	}

	// for(auto v:S){for(auto x:v){cout<<x;}puts("");}//

	cout<< ans <<endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
		int b = sc.nextInt();
		if(a>b) {
			int temp = a;
			a = b;
			b = temp;
		}

		String ans = "";
		for(int i=0; i<b; i++)
			ans += a;
		System.out.println(ans);

		sc.close();
	}
}


Measured memory_bytes: 23124
#include <cmath>
#include <iostream>
#include <functional>
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <iomanip>
#include <math.h>
#include <list>
#include <numeric>
using namespace std;

int main(){    
  long long H,N,A,count;
  cin >> H >> N;
  for(int i=0;i<N;i++){
    cin >> A;
    count += A;
  }
  if(count >= H){
  cout << "Yes" << endl;
  }
  else{
  cout << "No" << endl;
  }
  
}


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

struct Vertex {
    vector<lint> edge;
    bool visited;
    lint prev;
};
vector<Vertex> g;

// 頂点sから始まる、最小閉路の頂点集合を返す
vector<lint> bfs(lint s) {
    for(auto& e : g)  e.visited = false, e.prev = -1;

    queue<lint> que;
    que.push(s);

    while(!que.empty()) {
        lint node = que.front(); que.pop();

        for(auto next : g[node].edge) {
            if(g[next].visited)  continue;
            g[next].visited = true;
            g[next].prev = node;
            que.push(next);
        }
    }

    if(g[s].prev == -1)  return {};

    lint node = s;
    vector<lint> res;
    do {
        res.push_back(node = g[node].prev);
    } while(node != s);

    return res;
}

int main() {
    lint n, m;
    cin >> n >> m;

    g.resize(n);
    for(lint i=0; i<m; i++) {
        lint a, b;
        cin >> a >> b;
        a--, b--;
        g[a].edge.push_back(b);
    }

    lint mn = 1e18;
    vector<lint> ans;
    for(lint s=0; s<n; s++) {
        auto cand = bfs(s);
        if(cand.size() == 0)  continue;
        if(cand.size() < mn) {
            mn = cand.size();
            ans = cand;
        }
    }

    cout << (mn==1e18 ? -1 : mn) << endl;
    for(auto& e : ans)  cout << ++e << endl;
}

Measured memory_bytes: 384
#include "bits/stdc++.h"

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define bit(n) (1LL << (n))
#define sz(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define en '\n'
#define pb push_back
#define mp make_pair
#define P pair<int, int>

typedef long long ll;
using namespace std;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = (int)1e9;
const ll  inf = (ll)1e18;
const int mod = 1000000007;

struct aaa {
	aaa() {
		cin.tie(0);
		ios::sync_with_stdio(0);
		cout << fixed << setprecision(20);
	};
}aaaaa;

int main() {
	ll k, a, b;
	cin >> k >> a >> b;

	if (b - a <= 2) {
		cout << k + 1 << endl;
		return 0;
	}

	ll cookie = 1;
	ll turn = 0;
	
	while (1) {
		if ((cookie >= a) && (turn + 2 <= k)) {
			cookie += (b - a);
			turn += 2;
		}
		else {
			cookie++;
			turn++;
		}
		if (turn >= k) break;
	}
	cout << cookie << endl;
}

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

int main()
{    
    ll h,n;
    cin >> h >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    
    rep(i,n){
        h = h - a[i];
        if(h <= 0) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}

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

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

    string s;
    cin >> s;
    int length = s.length(), cnt = 0;
    if (s[0] == '0')
    {
        for (int i = 0; i < length; i+=2)
        {
            if (s[i] != '0')
                cnt++;
        }
        for (int i = 1; i < length; i+=2)
        {
            if (s[i] != '1')
                cnt++;
        }
    }
    else
    {
        for (int i = 0; i < length; i+=2)
        {
            if (s[i] != '1')
                cnt++;
        }
        for (int i = 1; i < length; i+=2)
        {
            if (s[i] != '0')
                cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 512
#include <cstdio>

using namespace std;

int main()
{
    int x1,x2;
    scanf( "%d %d\n", &x1, &x2 );
    if( x1 < x2 )
    {
        printf( "%d\n", x2 - x1 );
    }
    else
    {
        printf( "%d\n", x1 - x2 );
    }
    return 0;
}


Measured memory_bytes: 2724
#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rp(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

int main(){
    vector<vi> sch(26,vi(0)),tch(26,vi(0));
    string s,t;
    cin >> s >> t;
    int si=s.size();
    rp(i,si){
        char ch=s.at(i);
        sch.at(ch-'a').push_back(i);
    }
    rp(i,si){
        char ch=t.at(i);
        tch.at(ch-'a').push_back(i);
    }
    sort(all(sch));
    sort(all(tch));
    bool ok=true;
    rp(i,26){
        int n=sch[i].size();
        int m=tch[i].size();
        if(n!=m){
            ok=false;
            break;
        }
        rp(j,n){
            if(sch[i][j]!=tch[i][j])
            {
                ok=false;
                break;
            }
        }
    }
    Yes(ok);
    return 0;
}

Measured memory_bytes: 2824
#include"bits/stdc++.h"
#define ll long long
using namespace std;

int main(){
  ll n,k;
  cin>>n>>k;
  
  ll h[n];
  
  for(ll i=0;i<n;i++){
    cin>>h[i];
  }
  vector<ll>dp;
  ll INF=1e9+5;
  
  dp.assign(n,INF);
  dp[0]=0;
  
  //dp[1] = abs(h[1]-h[0]);
  
  for(ll i=0;i<n;i++){
    for(ll j=i+1;j<=i+k;j++){
      if(j<n)
     dp[j] = min(dp[j],dp[i]+abs(h[j]-h[i])) ;
    }
  }
  cout<<dp[n-1]<<endl;
  
 return 0; 
}


Measured memory_bytes: 4764
#include<iostream>
using namespace std;
int main(){
   int n,c;
   cin >> n;
   char b;
   int t[4][13] = {0};
   for(int i = 0 ; i < n ; i++){
       cin >> b >> c;
       if(b == 'S')t[0][c-1] = 1; 
       if(b == 'H')t[1][c-1] = 1; 
       if(b == 'C')t[2][c-1] = 1; 
       if(b == 'D')t[3][c-1] = 1; 
   }
   
   for(int s = 0;s < 4;s++){
       for(int e = 0;e < 13;e++){
           if(s == 0 && t[s][e] != 1) cout << "S " << e+1 << endl;
           if(s == 1 && t[s][e] != 1) cout << "H " << e+1 << endl;
           if(s == 2 && t[s][e] != 1) cout << "C " << e+1 << endl;
           if(s == 3 && t[s][e] != 1) cout << "D " << e+1 << endl;
       }
   }
   
   
   
}


Measured memory_bytes: 3080
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;

int main() {
	int N; cin >> N;
	vector<int>A(N);
	for (int i = 0; i < N; i++)cin >> A[i];
	sort(A.begin(), A.end());
	reverse(A.begin(), A.end());
	int ans = 0;
	for (int i = 0; i < N; i++) {
		ans = ans + (i % 2 ? -1 : 1)*A[i];
	}

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

Measured memory_bytes: 384
#include <stdio.h>
 
int main() {
    int c;
     
    while((c = getchar()) != EOF) {
        if(c >= 'A' && c <= 'Z') {
            c = c - 'A' + 'a';
        }else if(c >= 'a' && c <= 'z') {
            c = c - 'a' + 'A';
        }
        putchar(c);
    }
    return 0;
}

Measured memory_bytes: 524
package main

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

var isProduct = true

func main() {
	nextReader = newScanner()

	min := nextInt()
	max := nextInt()
	a := nextInt()
	b := nextInt()
	l := lcm(a, b)

	count := 0

	count += max / a
	count += max / b
	count -= max / l

	count -= (min - 1) / a
	count -= (min - 1) / b
	count += (min - 1) / l

	fmt.Println(max - min + 1 - count)

}

func lcm(x, y int) int {
	return x * y / gcd(x, y)
}

func gcd(x, y int) int {
	tmp := x % y
	if tmp > 0 {
		return gcd(y, tmp)
	} else {
		return y
	}
}

func abs(i int) int {
	return int(math.Abs(float64(i)))
}

func debugln(s ...interface{}) {
	if !isProduct {
		fmt.Println(s...)
	}
}

func debug(s ...interface{}) {
	if !isProduct {
		fmt.Print(s...)
	}
}
func debugf(f string, s ...interface{}) {
	if !isProduct {
		fmt.Printf(f, s...)
	}
}

var nextReader func() string

func newScanner() func() string {
	r := bufio.NewScanner(os.Stdin)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)
	return func() string {
		r.Scan()
		return r.Text()
	}
}
func nextString() string {
	return nextReader()
}
func nextInt64() int64 {
	v, _ := strconv.ParseInt(nextReader(), 10, 64)
	return v
}
func nextInt() int {
	v, _ := strconv.Atoi(nextReader())
	return v
}
func nextInts(n int) []int {
	r := make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt()
	}
	return r
}
func nextInt64s(n int) []int64 {
	r := make([]int64, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt64()
	}
	return r
}
func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(nextReader(), 64)
	return f
}

func maxInt(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}


Measured memory_bytes: 640
#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>
#include <numeric>

using namespace std;

long long gcd(long long a, long long b)
{
	while (b != 0) {
		long long t = b;
		b = a % b;
		a = t;
	}
	return a;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	long long n, i, j, k, ans, c00 = 0, c0x = 0, cx0 = 0, sign, g, aa, bb, MOD = 1000000007, cc, v, vv;
	cin >> n;
	vector<long long> a(n), b(n);

	map<pair<long long, long long>, pair<long long, long long>> ct;
	for (i = 0; i < n; i++) {
		cin >> a[i] >> b[i];

		if ((a[i] == 0) && (b[i] == 0)) c00++;
		else if (a[i] == 0) c0x++;
		else if (b[i] == 0) cx0++;
		else {
			sign = 1;
			if (a[i] < 0) {
				a[i] = -a[i];
				sign = -sign;
			}
			if (b[i] < 0) {
				b[i] = -b[i];
				sign = -sign;
			}

			g = gcd(a[i], b[i]);
			a[i] /= g;
			b[i] /= g;

			aa = a[i];
			bb = b[i];

			if (sign == -1) {
				a[i] = -a[i];
				bb = -bb;
			}
			bb = -bb;

			if ((ct.find({ a[i], b[i] }) == ct.end()) && (ct.find({ bb, aa }) == ct.end())) ct[{a[i], b[i]}] = { 1, 0 };
			else if (ct.find({ bb, aa }) != ct.end()) ct[{bb, aa}].second++;
			else ct[{a[i], b[i]}].first++;
		}
	}

	vector<long long> pow2(n + 1);
	pow2[0] = 1;
	for (i = 1; i <= n; i++) pow2[i] = (pow2[i - 1] * 2) % MOD;

	ans = c00;		// standalone
	cc = n - c00 - c0x - cx0;
	
	v = (pow2[c0x] + pow2[cx0] + MOD - 1) % MOD;
	vv = 1;
	for (auto p : ct) {
		vv = (vv * ((pow2[p.second.first] + pow2[p.second.second] + MOD - 1) % MOD)) % MOD;
	}

	ans = (ans + v * vv + MOD - 1) % MOD;
	cout << ans << "\n";

	return 0;
}




Measured memory_bytes: 23216
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
using namespace std;

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

	for(int i=0; i < str.size(); i++)
	cout << (char)((str[i] - 'A' + 23)%26 + 'A');
	cout << "\n";
	
	return 0;
}

Measured memory_bytes: 1172
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {

	public static void main(String[] args) throws IOException{
		BufferedReader br =new BufferedReader(new InputStreamReader(System.in));
		String str =br.readLine();
		String[] stra = str.split(" ");
		
		double a = Double.parseDouble(stra[0]);
		double p = 3.1415926535897932384626433 ;
		System.out.printf("%.8f %.8f",a*a*p,2*p*a);
	}

}

Measured memory_bytes: 17080
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
#c=[]
d=[]
e=[]
dif=0
nsum=0
psum=0
cnt=0


for i in range(n):
  dif=a[i]-b[i]
#  c.append(dif)
  if dif<0:
    d.append(dif)
    nsum+=dif
  elif dif>0:
    e.append(dif)
#c.sort()
#d.sort()
e.sort()
#print(nsum)
if abs(nsum)>sum(e):
  print(-1)
else:
  i=-1
  while abs(nsum)>psum:
    cnt+=1
    psum+=e[i]
    i-=1
  print(len(d)+cnt)

Measured memory_bytes: 18492
X, N = map(int,input().split())
if N == 0:
  print(X)
  exit(0)
  
A = list(map(int, input().split()))

for i in range(101):
  minans = X - i
  maxans = X + i
  if minans not in A:
    print(minans)
    exit(0)
  elif maxans not in A:
    print(maxans)
    exit(0)

Measured memory_bytes: 9196
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { for (auto &vi: vec) os << vi << " "; return os; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<typename T >inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T> inline void add(T &a, int b) { a += b; if (a >= mod) a -= mod; }


void solve();

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

  int T;
  // cin >> T;
  T = 1;

  while (T--) {
    solve();
  }
}
void solve() {
  int n;
  cin >> n;
  int a = n / 100;
  int b = n % 100;
  // cout << a << " " << b << endl;

  bool A = (a >= 1 && a <= 12);
  bool B = (b >= 1 && b <= 12);
  if (A && B) cout << "AMBIGUOUS" << endl;
  else if (B) cout << "YYMM" << endl;
  else if (A) cout << "MMYY" << endl;
  else cout << "NA" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <stack>
#include <iomanip>
#include <string>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

// ---- BEGIN LIBRARY CODE ----
// ---- END LIBRARY CODE ----
void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    int N, M;
    cin >> N >> M;
    int L = 1, R = N;
    VEC(Pii) gates(M);
    FOR(i, 0, M) {
        cin >> gates[i].first >> gates[i].second;
        L = max(L, gates[i].first);
        R = min(R, gates[i].second);
    }

    int ret = 0;
    if (L <= R) {
        ret = R + 1 - L;
    }
    cout << ret << endl;
    return 0;
};


Measured memory_bytes: 1024
from collections import Counter
    
n = int(input())
v = list(map(int, input().split()))

a = Counter(v[0::2]).most_common()
b = Counter(v[1::2]).most_common()
a.append([0,0])
b.append([0,0])
if a[0][0] != b[0][0]:
    print(n - (a[0][1] + b[0][1]))
else:
    print(min(n-(a[1][1]+b[0][1]), n-(a[0][1]+b[1][1])))


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

int main(){
    int n; cin >> n;
    for(int i = 9; i > 1; i--){
        if(n % i == 0){
            n = n / i;
            break;
        }
    }
    if(n < 10){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

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

int main(){
    int n; cin>>n;
    vector<int>d(n);
    for(int i=0;i<n;i++){
        cin>>d.at(i);
        }
    sort(d.begin(),d.end());
    double ans=d.at(0);
    for(int i=1;i<n;i++){
        ans=(ans+d.at(i))/2;
        }
        cout<<ans<<endl;
        }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int a;
    cin >> a;
    int b;
    cin >> b;
    long long s = 0;
    long long s2 = 0;
    int N = 1e4+100;
    vector <int> d(b), e(b),f(N, 1e18);
    //vector <vector <int> > f(b+1,vector<int>(b+1));
    for(int i = 0; i < b; ++i)cin >> d[i] >> e[i];
    //f[0][0] = 0;
    f[0] = 0;
    
    for(int i = 0; i < b; ++i){
        for(int j = 0; j <= N; ++j){
            f[j] = min(f[max(j-d[i], 0LL)] + e[i], f[j]);
        }
    }
    cout << f[a] << '\n';    
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int v[105];
int w[105];
int dp[10005];// 获得k价格需要花费多少容量 
const int inf=1000000005;
int main(){
	int n,W;cin>>n>>W;
	fill(dp,dp+10002,inf);
	dp[0]=0;
	for(int i=1;i<=n;i++)cin>>v[i]>>w[i];
	for(int i=1;i<=n;i++)
		for(int j=10000;j>=v[i];j--)
			dp[j]=min(dp[j],dp[j-v[i]]+w[i]);
	for(int i=10000;i>=0;i--)
		if(dp[i]<=W){
			cout<<i<<endl;
			return 0;
		}
	return 0;
}


Measured memory_bytes: 3144
#include <iostream>
#define INF 2000000000
#define N 100
using namespace std;
int main(){
  int n,a[N],b[N],c[N],cnt,minv,r,i,j;
  cin >> n;
  for(i=0;i<n;i++) cin >> a[i] >> b[i],c[i]=0;
  for(i=1;i<=31;i++){
    minv=INF;
    for(j=0;j<n;j++){
      if(a[j]<=i&&i<=b[j]&&c[j]==0){
	if(minv>b[j]-i){
	  minv=b[j]-i;
	  r=j;
	}
      }
    }
    if(minv!=INF) c[r]=1;
  }
  cnt=0;
  for(i=0;i<n;i++){
    if(c[i]==1) cnt++;
  }
  cout << 50*31+50*cnt << endl;
  return 0;
}

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

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

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

struct edge {
	int to,cost;
	edge(int t,int c):to(t),cost(c) {}
};

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

ll mypow(ll x,ll n,ll m) {	//xのn乗をmで割った余り
	if(n==0) return 1;
	if(n%2==0) return mypow(x*x%m,n/2,m);
	else return x*mypow(x,n-1,m)%m;
}

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


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

	int r,g,b;
	cin>>r>>g>>b;
	int n=r*100+g*10+b;
	cout<<(n%4?"NO":"YES")<<endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <bitset>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

ll xor_sum(ll num) {
    if (num < 0) return 0;
    if (num % 2 == 1) return (num + 1) / 2 % 2;
    return (num / 2 % 2) ^ num;
}

int main() {
    ll A, B;
    cin >> A >> B;
    cout << (xor_sum(A - 1) ^ xor_sum(B)) << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <cstdio>
#include <vector>

std::vector<int> A, B;

int main(void){
    int n; scanf("%d", &n);
    A.resize(n); for(int i = 0; i < n; ++i) scanf("%d", &A[i]);
    B.resize(n); for(int i = 0; i < n; ++i) B[A[i] - 1] = i + 1;
  
    printf("%d", B[0]); for(int i = 1; i < n; ++i) printf(" %d", B[i]); putchar('\n');
    return 0;
}

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

using namespace std;

const double EPS = 1e-7;
const int N = 20, M = 1e4+5, OO = 0x3f3f3f3f;

int coun;
string s;
int main(){
    cin >> s;
    int sz = s.size();
    for(int i = 0, j = sz-1; i < sz/2; ++i, --j)
    {
        if(s[i] != s[j])
        {
            coun++;
        }
    }
    printf("%d", coun);
    return 0;
}


Measured memory_bytes: 256
'''
研究室PCでの解答
'''
import math
#import numpy as np
import queue
import bisect
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)
mod = 10**9+7
dir = [(-1,0),(1,0),(0,-1),(0,1)]
alp = "abcdefghijklmnopqrstuvwxyz"


def main():
    k = int(ipt())
    t = k//50
    rs = k%50
    print(50)
    ans = []
    for i in range(rs):
        ans.append(str(100-rs+t))
    for i in range(50-rs):
        ans.append(str(49-rs+t))

    print(" ".join(ans))

    return None

if __name__ == '__main__':
    main()


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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
typedef long long ll;


int main() {
    int N; cin >> N;
    vector<int> X(N); 
    REP(i,N) cin >> X[i];

    vector<int> Y(X);
    sort(ALL(Y));
    int l = Y[N/2-1], r = Y[N/2];

    REP(i,N){
        if(X[i] >= r) cout << l << endl;
        else if(X[i] <= l) cout << r << endl;
    }

    return 0;
}

Measured memory_bytes: 4820
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n; i >= 0; i--)
#define inf LLONG_MAX
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    ll n; cin >> n;
    vector<pair<ll, ll>> v(n);
    rep(i, n) {
        ll a, b; cin >> a >> b;
        v[i] = {b, a};
    }

    sort(all(v));
    ll sum = 0;
    rep(i, n) {
        sum += v[i].second;
        if (sum > v[i].first) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3328
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
#define DBG(X) cout << #X << "=" << (X) << '\n';
#define SAY(X) cout << (X) << '\n';
#else
#define DBG(X)
#define SAY(X)
#endif

#define M_PI       3.14159265358979323846

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int solve()
{
    int X;

    cin >> X;

    vector<int> values = {100, 101, 102, 103, 104, 105};

    vector<int> money(X + 1, false);
    money[0] = true;

    for (int m = 0; m <= X; ++m)
    {
        for (int v : values)
        {
            if (v <= m)
                money[m] = money[m] || money[m - v];
        }
    }

    return money[X];
}

int main()
{
    cout << solve() << endl;

    return 0;
}

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

using namespace std;

int A,B,C;
long long K;

int main(){

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

cin>>A>>B>>C;

cin>>K;

if(K%2) cout<<B-A<<endl;
else cout<<A-B<<endl;

}


Measured memory_bytes: 256
l=list(input())
a,b,c,d=map(str,l)
x=0
y=0
z=0
for i in range(2**3):
    if (i>>0)&1:
        x="+"
    else:
        x="-"
    if (i>>1)&1:
        y="+"
    else:
        y="-"
    if (i>>2)&1:
        z="+"
    else:
        z="-"
    ans=a+x+b+y+c+z+d
    if eval(ans)==7:
        print(ans+"=7")
        exit()


Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;


int main(){
	int n;
	cin >> n ;
	vector<long long int> v(n);
	for(int i=0;i<n;++i){
		cin >> v[i];
	}
	
	bool f = false;
	long long int cnt = 0;
	long long int m = 10e9+4;
	long long int sum = 0;
	for(int i=0;i<n;++i){
		m = min(m,abs(v[i]));
		if(v[i] < 0){
			cnt++;
			sum += -1*v[i];
		}else{
			sum += v[i];
		}
		if(v[i] == 0) f = true;
	}
	
	//cout << f << " " << cnt << " " << sum <<endl;
	if(f || cnt%2 == 0) cout << sum << endl;
	else{
		cout << sum - m*2 << endl;
	}
	
	return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#define ll long long
#define pb push_back
#define rep(i,n) for (int i=0;i<n;i++)
#define INF 1e9+7
#define vec vector<int>

using namespace std;




int main() {
    ll q; cin >>q;
    vector<pair<int,ll>> qu(q);
    rep(i,q){
        cin >>qu[i].first;
        if (qu[i].first==2) qu[i].second=0;
        else cin >>qu[i].second;

    }
    vector<ll> x;
    rep(i,q){
        if (qu[i].first==0){
            x.pb(qu[i].second);
        }
        if (qu[i].first==1){
            cout<<x[qu[i].second]<<endl;
        }
        if (qu[i].first==2){
            x.pop_back();
        }
    }


}


Measured memory_bytes: 8116
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;
const ll MOD=1e9+7;

/*

*/

int main(void){
	double sum=0;
	ll n,a[110],id=0;
	cin>>n;
	rep(i,n){
		cin>>a[i];
		sum+=a[i];
	}
	sum/=n;
	rep(i,n){
		if(abs(a[id]-sum)>abs(a[i]-sum))id=i;
	}
	cout<<id<<endl;
	return 0;
}

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

static const int N = 1000;

int longestCommonSubsequence(string X, string Y)  {
  int c[N + 1][N + 1];
  int m = X.size();
  int n = Y.size();
  int max1 = 0;
  X = ' ' + X;
  Y = ' ' + Y;
  for (int i = 0; i <= m; i++) 
    c[i][0] = 0;
  for (int j = 1; j <= n; j++)
    c[0][j] = 0;
  
  for (int i = 1; i <= m; i++)  {
    for (int j = 1; j <= n; j++)  {
      if (X[i] == Y[j])  {
        c[i][j] = c[i - 1][j - 1] + 1;
      } 
      else {
        c[i][j] = max(c[i - 1][j], c[i][j - 1]);
      }
      max1 = max(max1, c[i][j]);
    }
  }
  return max1;
}
 
int main()  {
  string s1, s2;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++)  {
    cin >> s1 >> s2;
  cout << longestCommonSubsequence(s1, s2) << endl;
  }
  return 0;
}

Measured memory_bytes: 7072
#include<iostream>
#include<algorithm>
using namespace std;
 
int main(void){
  long N;
  long x;
  long a[110];
  cin >> N >> x;
  for(int i=0;i<N;i++) cin >> a[i];
  sort(a,a+N);
  long count=0;
  long sum=0;
  for(int i=0;i<N;i++){
    sum+=a[i];
    if(sum>x)break;
    count++;
  }
  if(sum < x) count--;
  cout << count;
  return 0;
}

Measured memory_bytes: 256
class BinaryTree {
  constructor(n) {
    this.nodes = [];
    for (let i = 0; i < n; i++) this.nodes[i] = {id: i + 1, parentId: -1, leftId: -1, rightId: -1}
  }

  get root() { return this.nodes.find(n => n.parentId === -1); }

  find(id) { return this.nodes[id - 1] || {}; }

  getByPostorder() {
    let res = [];
    const postorder = (id) => {
      if (id === -1) return;
      let n = this.find(id);
      postorder(n.leftId);
      postorder(n.rightId);
      res.push(id);
    };
    postorder(this.root.id);
    return res;
  }
}

(function main(){
  const lines = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n');
  const n = Number(lines.shift());
  const preOrder = lines.shift().split(' ').map(Number);
  const inOrder = lines.shift().split(' ').map(Number);

  let tree = makeTree(preOrder, inOrder);
  console.log(tree.getByPostorder().join(' '));
})();

function makeTree(preOrder, inOrder) {
  let tree = new BinaryTree(preOrder.length);
  const innerMakeTree = (p, i) => {
    let midId = p[0];
    let midIdx = i.indexOf(midId);
    if (midIdx === -1) return;
    if (midIdx > 0) {
      tree.find(midId).leftId = p[1];
      tree.find(p[1]).parentId = midId;
      innerMakeTree(p.slice(1, midIdx + 1), i.slice(0, midIdx))
    }
    if (midIdx < i.length - 1) {
      tree.find(midId).rightId = p[midIdx + 1];
      tree.find(p[midIdx + 1]).parentId = midId;
      innerMakeTree(p.slice(midIdx + 1), i.slice(midIdx + 1))
    }
  }
  innerMakeTree(preOrder, inOrder);
  return tree;
}



Measured memory_bytes: 15432
#include<stdio.h>
int main(){
  int i,s,a=0,b=0;
  for(i=0;i<8;i++){
    scanf("%d",&s);
    if(i/4)b+=s;
    else   a+=s;
  }
  if(a<b)printf("%d\n",b);
  else   printf("%d\n",a);
  return 0;
}

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

int main(){
    int A, B, C, N, M ,K;
    int sum = 0;
    int t = 0;
    string s, s1;
    cin >> A;
    if(A==3 || A==5 || A==7) cout << "YES" << endl;
    else cout << "NO" << endl;

//    vector<int> X();

//    for(int i = 0; i < ; i++){}
//    for(int j = 0; j < ; j++){}

//    cout <<  << endl;
}

Measured memory_bytes: 256
x,y=map(int,input().split())
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
c=[2]
if a.count(x)+a.count(y)==2 or b.count(x)+b.count(y)==2 or c.count(x)+c.count(y)==2:
  print("Yes")
else:
  print("No")

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

int main(){
  vector<int> A(5);
  int k;
  for(int i = 0; i < 5; i++) cin >> A.at(i);
  cin >> k;
  if(A.at(4) - A.at(0) > k){
    cout << ":(" << endl;
  }else{
    cout << "Yay!" << endl;
  }
}

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

class Program
{
  static void Main(string[] args)
  {
    string s = Console.ReadLine();
    string t = Console.ReadLine();

    List<uint> compared = new List<uint>();

    //Must <=
    for (int i = 0; i <= s.Length - t.Length; i++)
    {
        compared.Add(CompareStrings(i, s, t));
    }

    Console.WriteLine(compared.Min());

    return;
  }

  static uint CompareStrings(int startIdx, string s, string t)
  {
      uint ret = 0;

      for (int i = 0; i < t.Length; i++)
      {
        if(s[startIdx + i] != t[i])
        {
          ret++;
        }
      }

      return ret;
  }
}

Measured memory_bytes: 26596
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <map>
#include <set>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstring>
#include <math.h>

using namespace std;

#define Rep(i,a,b) for(int i = a; i < b; i++)
#define rep(i,b) Rep(i,0,b)
#define rrep(i,a) for(int i = a; i >= 0; i--)
#define allof(a) (a).begin(), (a).end()

typedef long long ll;
const int inf = 1e9 + 7;
const ll infll = 1ll << 60ll;
const ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

/*
// 最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

// 最小公倍数
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}*/

#define MAX_V 100010
#define MAX_E 200010

struct UnionFind {
private:
	const int n;
	int __size;
	vector<int> uf;
public:
	// 初期化 UnionFind uni(n) のように宣言すれば良い
	UnionFind(int _n) : n(_n), __size(_n), uf(_n, -1) {}
	// find (木の根を求める)
	int find(int x) { return (uf[x] < 0) ? x : uf[x] = find(uf[x]); }
	// x と y が同じ集合に属するかどうか
	bool same(int x, int y) { return find(x) == find(y); }
	// x が属する集合の要素数
	int size(int x) { return -uf[find(x)]; }
	// 集合はいくつあるか
	int size() { return __size; }
	// x と y の属する集合を併合
	bool unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y) return false;
		__size--;
		if (uf[y] < uf[x]) swap(x, y);
		uf[x] += uf[y]; uf[y] = x;
		return true;
	}
};

using Graph = vector< vector<int> >;

struct edge { int u, v, cost; };

bool comp(const edge& e1, const edge& e2) {
	return e1.cost < e2.cost;
}

edge es[MAX_E];
int V, E; // 頂点数と辺数

int kruskal() {
	sort(es, es + E, comp); // edge.costが小さい順にソートする

	UnionFind uni(V);
	int res = 0;
	rep(i, E) {
		edge e = es[i];
		if (!uni.same(e.u, e.v)) {
			uni.unite(e.u, e.v);
			res += e.cost;
		}
	}
	return res;
}

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

	int n;
	cin >> n;
	vector<pair<pair<int, int>, int>> xy(n);
	rep(i, n) {
		int x, y;
		cin >> x >> y;
		x--; y--;
		xy[i].first.first = x;
		xy[i].first.second = y;
		xy[i].second = i;
	}

	auto yx = xy;
	rep(i, n) {
		int x = xy[i].first.first;
		int y = xy[i].first.second;
		yx[i].first.first = y;
		yx[i].first.second = x;
	}

	sort(allof(xy));
	sort(allof(yx));

	E = n * 2 - 2;
	V = n;


	/*
	rep(i, n) {
		cout << xy[i].second << "番目 " << xy[i].first.first << ", " << xy[i].first.second << endl;
	}
	rep(i, n) {
		cout << xy[i].second << "番目 " << yx[i].first.first << ", " << yx[i].first.second << endl;
	} // できてた */
	
	rep(i, n - 1){
		es[i].u = xy[i].second;
		es[i].v = xy[i + 1].second;
		es[i].cost = min(abs(xy[i].first .first - xy[i + 1].first.first), abs(xy[i].first.second - xy[i + 1].first.second));
	}

	rep(i, n - 1) {
		es[i + n - 1].u = yx[i].second;
		es[i + n - 1].v = yx[i + 1].second;
		es[i + n - 1].cost = min(abs(yx[i].first.first - yx[i + 1].first.first), abs(yx[i].first.second - yx[i + 1].first.second));
	}

	int ans = kruskal();

	cout << ans << endl;

	return 0;
}

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

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

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

    vector<int> a(n);
    rep(i, n) cin >> a.at(i);
    
    sort(a.begin(), a.end());
    int cnt = 0;
    int i = 0;
    while (x>=a.at(i)){
        x -= a.at(i);
        cnt++;
        i++;
        if(i==n){
            if(x>0)
                cnt--;
            break;
        }
    }
    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define lowbit(x) ((x)&(-x))
typedef long long LL;


void run_case() {
    int n, a;
    cin >> n;
    bool flag = true;
    for(int i = 0; i < n; ++i) {
        cin >> a;
        if(a%2==0&&(a%3)&&(a%5)) flag = false;
    }
    if(flag) cout << "APPROVED";
    else cout << "DENIED";
}

int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    //cout.setf(ios_base::showpoint);cout.precision(8);
    run_case();
    cout.flush();
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
string Z(string s){int i;for(i=0;i<s.size()-1;i++)if(s[i]!='0')break;return s.substr(i);}
string SUB(string s,string t) {
  while(s.size()>t.size())t='0'+t;int c=0;
  rrep(i,s.size()) {
    if(c){if(s[i]=='0'){s[i]='9';c=1;}else{s[i]=(char)(s[i]-1);c=0;}}
    if(s[i]<t[i]){s[i]=(char)(s[i]-t[i]+10+'0');c=1;}
    else s[i]=(char)(s[i]-t[i]+'0');
  }
  return Z(s);
}

vector<int> calc(int n) {
  vector<int> p;
  for(int i=1; i*i<=n; i++) {
    if(n%i==0) {
      p.push_back(i);
      if(i*i!=n) p.push_back(n/i);
    }
  }
  sort(p.begin(),p.end());
  return p;
}
int main() {
  string s;
  cin >> s;
  int ans=8;
  vector<int> p=calc(s.size());
  rep(i,p.size()-1) {
    if(p[i]==2) continue;
    string Ma="0",Mi="";Mi+=(char)('9'+1);
    for(int j=0; j<s.size(); j+=p[i]) {
      string t=s.substr(j,p[i]);
      Ma=max(Ma,t);
      Mi=min(Mi,t);
    }
    string t=SUB(Ma,Mi);
    if(t.size()==1) ans=min(ans,t[0]-'0');
  }
  rep(k,10) {
    int Ma=0,Mi=100,c=0;
    rrep(i,s.size()) {
      int x=s[i]-'0';
      if(x<=k) {
        i--;
        if(i<0) {
          Ma=100,Mi=0;
          break;
        }
        x+=(s[i]-'0')*10;
      }
      Ma=max(Ma,x);
      Mi=min(Mi,x);
      c++;
    }
    if(c>1) ans=min(ans,Ma-Mi);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3392
#include<stdio.h>
int main(void){
    int m,f,r;
    while(1){
        scanf("%d %d %d",&m,&f,&r);
        if(m==-1&&f==-1&&r==-1) break;
        if(m==-1||f==-1){
            printf("F\n");
        }else if(m+f>=80){
            printf("A\n");
        }else if(m+f>=65&&80>m+f){
            printf("B\n");
        }else if(m+f>=50&&65>m+f||r>=50){
            printf("C\n");
        }else if(m+f>=30&&50>m+f){
            printf("D\n");
        }else if(m+f<30){
            printf("F\n");
        }
    }
    return 0;
}


Measured memory_bytes: 2076
from bisect import bisect_left
S = input()
T = input()

set_s = set(S)
set_t = set(T)
len_t = len(T)
if len(set_s & set_t) != len(set_t):
  print(-1)  
else:  
  dic = {c:[] for c in set_s}
  dic_len = {}
  for i,s in enumerate(S):
    dic[s].append(i)
    
  for k in dic:
    dic_len[k] = len(dic[k])
  
  si = 0
  cnt = 0
  for t in T:    
    i = bisect_left(dic[t],si)
    if i == dic_len[t]:
      si = 0
      cnt += 1
      i = bisect_left(dic[t],si)
        
    if dic[t][i] == si:
      si += 1
    else:      
      si = dic[t][i] + 1
              
  print(cnt * len(S) + si)

Measured memory_bytes: 7668
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define BIT(X, i) ((X>>i)&1)
#define REP(i, a, b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
#define r_all(a) (a).rbegin(), (a).rend()
#define in(x) cin>>x
#define ina(x, n) rep(x_i,n) cin>>x[x_i]
#define outa(x, n) rep(x_i,n) cout<<x[x_i]<<" \n"[x_i==n-1]

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> pll;
typedef vector<pll> vll;
typedef priority_queue<ll> pq;

const int MOD = 1e9+7;
const int INF = (1<<30);
const ll INFL = (1L<<62);

int main() {
  ll n; in(n);
  vl a(n+1); ina(a,n+1);
  vl b(n); ina(b,n);

  ll ans = 0;
  rep(i,n) {
    ll l = min(a[i], b[i]);
    ans += l;
    a[i] -= l; b[i] -= l;

    ll r = min(a[i+1], b[i]);
    ans += r;
    a[i+1] -= r; b[i] -= r;
  }
  cout << ans << endl;
  return 0;
}


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

void solve(void){
  int Digits, N, K;
  
  Digits = 1;
  
  cin >> N >> K;
  
  while (N >= K){
    N /= K;
    Digits++;
  }
  
  cout << Digits << endl;
  
  return;
}

int main(int argc, const char * argv[]) {

    // cinを高速にするためのおまじない
    cin.tie(0);
    ios::sync_with_stdio(false);

  solve();
  
  return 0;
}

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

int main() {
  int N;
  cin >> N;
  
  vector<int> prices(N);
  int max_price = 0;
  
  for (int i = 0; i < N; i++) {
    cin >> prices[i];
  }
  
  sort(prices.begin(), prices.end(), greater<int>());
  
  int total = 0;
  
  for (int i = 0; i < N; i++) {
    if (i == 0) {
      prices[i] = prices[i] / 2;
    }
    total += prices[i];
  }
  
  cout << total << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdlib>
#include<string>
#include<math.h>
#include<algorithm>
#include<stdio.h>
#include<numeric>
//--------------------
#define MOD 1000000007 
using namespace std;
//--------------------
int main(){

	long N, M, X, Y; cin >> N >> M >> X >> Y;

	string res = "War";

	long x[100000], y[100000];

	for (int i = 1; i <= N; i++) cin >> x[i];
	for (int i = 1; i <= M; i++) cin >> y[i];

	long xmax = -100000, ymin = 100000;

	for (int i = 1; i <= N; i++) { if (xmax < x[i]) xmax = x[i]; }
	for (int i = 1; i <= M; i++) { if (ymin > y[i]) ymin = y[i]; }

	if (xmax < ymin && X < ymin && xmax < Y) res = "No War";

	cout << res << endl;

}

Measured memory_bytes: 256
import java.math.BigDecimal;
import java.util.Scanner;


public class Main {
	Scanner sc = new Scanner(System.in);
	
	void run(){
		int n = sc.nextInt(), i;
		for(i=0;i<n;i++){
			BigDecimal a = sc.nextBigDecimal();
			BigDecimal b = sc.nextBigDecimal();
			String p = a.add(b).toString();
			if(p.length() > 80)
				p = "overflow";
			System.out.println(p);
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 20124
package main                         

import (
  "fmt"
)

func main() {
  var n int
  fmt.Scan(&n)

  col := make(map[string]struct{})
  for i := 0; i < n; i++ {
    var c string
    fmt.Scan(&c)
    col[c] = struct{}{}
  }

  if len(col) == 3 {
    fmt.Printf("Three\n")
  } else {
    fmt.Printf("Four\n")
  }
}
                                     


Measured memory_bytes: 512
import java.util.*;

public class Main{
      
      public static void main(String[] args) {
          
           Scanner sc = new Scanner(System.in);
       
           int N = sc.nextInt();
           
           long ans = 1L;
           
           for(int i = 0;i < N;i++){
               long T;
               T = sc.nextLong();
               ans = lcm(ans,T);
           }
           
           System.out.println(ans);
           
      }
        
      static long gcd(long a,long b){
          if(b == 0) return a;
          return gcd(b,a%b);
      }
      
      static long lcm(long a,long b){
          long g = gcd(a,b);
          return a/g*b;
      } 
     
}       


Measured memory_bytes: 22100
#include <bits/stdc++.h>
#define REP(i,  n) for (int i  =  0; i < (int)(n); ++i)
#define REPR(i,  n) for (int i  =  n - 1; i >= 0; --i)
using namespace std;
#define int long long int
//------------ATCODER TEMPLATE-------------

signed main() {
  int N; cin >> N;
  vector<pair<int, int>> p1(N), p2(N);
  double sum_x = 0, sum_y = 0;
  REP(i, N) {
    int x, y; cin >> x >> y;
    p1[i] = {x + y, x - y};
    p2[i] = {x - y, x + y};
  }
  sort(p1.begin(), p1.end());
  sort(p2.begin(), p2.end());

  int ans = 0;
  ans = max(ans, abs(p1[0].first - p1[N-1].first));
  ans = max(ans, abs(p2[0].first - p2[N-1].first));
  ans = max(ans, abs(p1[0].second - p1[N-1].second));
  ans = max(ans, abs(p2[0].second - p2[N-1].second));
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 9520