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

using namespace std;

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

#define each(i,a) for (auto&& i : a)
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)

const ll linf = 1e18;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    each(x,vec) is >> x;
    return is;
}
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    rep(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, const vector< vector<T> >& vec) {
    rep(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}
map<string, ll> w;
class Parser {
    string s;
    ll pos;
    bool end() {
        return pos == s.size();
    }
    void read_char(char c) {
        assert(!end() && s[pos] == c);
        ++pos;
    }
    ll M() {
        ll res = 0;
        while (!end() && s[pos] != ')') {
            ll base;
            if (s[pos] == '(') {
                read_char('(');
                base = M();
                read_char(')');
            }
            else {
                string name_s = name();
                if (w.count(name_s) == 0) throw 1;
                base = w[name_s];
            }
            res += base * number();
        }
        return res;
    }
    string name() {
        string res = "";
        assert( !end() && 'A' <= s[pos] && s[pos] <= 'Z' );
        res += s[pos++];
        while ( !end() && 'a' <= s[pos] && s[pos] <= 'z' ) {
            res += s[pos++];
        }
        return res;
    }
    ll number() {
        if ( end() || !isdigit(s[pos]) ) return 1;
        string res = "";
        while ( !end() && isdigit(s[pos]) ) {
            res += s[pos++];
        }
        return stoll(res);
    }
public:
    Parser(const string& s) : s(s), pos(0) {}
    ll parse() {
        pos = 0;
        return M();
    }
};
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    while (cin >> s, s != "END_OF_FIRST_PART") {
        ll n; cin >> n;
        w[s] = n;
    }
    while (cin >> s, s != "0") {
        try {
            cout << Parser(s).parse() << endl;
        }
        catch (int err) {
            cout << "UNKNOWN" << endl;
        }
    }
}



Measured memory_bytes: 3300
s = input()
a = s.count('a')
b = s.count('b')
c = s.count('c')

ans = ''
if a == b == c:
  ans = 'YES'
elif a == b == c - 1:
  ans = 'YES'
elif a == b - 1 == c:
  ans = 'YES'
elif a - 1 == b == c:
  ans = 'YES'
elif a == b == c + 1:
  ans = 'YES'
elif a == b + 1 == c:
  ans = 'YES'
elif a + 1 == b == c:
  ans = 'YES'
else:
  ans = 'NO'
print(ans)

Measured memory_bytes: 9104
#include <bits/stdc++.h>
using namespace std;
double x;
int main() {
    while(cin >> x, x >= 0) {
        if(x >= 256.0 || fmod(x * 16.0, 1.0) != 0.0) {
            cout << "NA" << endl;
        }
        else {
            int z = x * 16;
            for(int i = 11; i >= 0; i--) {
                if(i == 3) cout << ".";
                if(z & (1 << i)) cout << 1;
                else cout << 0;
            }
            cout << endl;
        }
    }
}

Measured memory_bytes: 3304
MOD = 10 ** 9 + 7

inv = [0] * 1000000
inv[1] = 1
for i in range(2, 1000000):
    inv[i] = (MOD - (MOD // i) * inv[MOD % i] % MOD) % MOD

fact = [0] * 1000000
finv = [0] * 1000000
fact[0] = 1
finv[0] = 1
for i in range(1, 1000000):
    fact[i] = (i * fact[i - 1]) % MOD
    finv[i] = (inv[i] * finv[i - 1]) % MOD


def modcomb(n, r):
    if n < r or r < 0:
        return 0
    return fact[n] * finv[r] % MOD * finv[n - r] % MOD


x, y = map(int, input().split())
if (2 * x - y) % 3 != 0 or (2 * y - x) % 3 != 0:
    print(0)
    exit()

a, b = (2 * x - y) // 3, (2 * y - x) // 3
print(modcomb(a + b, a))

Measured memory_bytes: 121796
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP2_5_D&lang=jp
#  Permutation Enumeration : python3
#  2018.12.01 yonezawa

import sys
input = sys.stdin.readline
from collections import deque

class enumeration:
    def __init__(self,n):
        self.n = n
        self.depth = 0
        self.wnum = 0
        self.nq = []
        self.bits = [ pow(2,i) for i in range(n+1) ]
        self.mk_permutation(0,0,0)

    def mk_permutation(self,depth,bflag,wnum):
        if self.n == depth:
            self.nq.append(wnum)
            return
        for i in range(1,self.n+1):
            if bflag & self.bits[i-1] != 0:
                continue
            self.mk_permutation(depth + 1,bflag + self.bits[i-1],wnum*10+i)  
    def printList(self):
        l = self.nq
        self.nq.sort()
        for i in l:
            c = ""
            for j in str(i):
                c += j + " "
            print(c.strip())

def main():
    n = int(input())
    i = enumeration(n)
    i.printList()


if __name__ == '__main__':
    main()


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

if c > b:
  if c < d:
    if "##" in s[a:d]:
      print('No')
    else:
      print('Yes')
  else:
    if (('##' in s[a:c]) or not('...' in s[b-2:d+1])):
      print('No')
    else:
      print('Yes')
else:
  if (('##' in s[a:c]) or ('##' in s[b:d])):
    print('No')
  else:
    print('Yes')


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

int main(){
int N,L;
  cin>>N>>L;
 vector<string>S(N);
  for(int i=0; i<N; i++){
   cin>>S[i]; }
  
  sort(S.begin(), S.end());
  
  for(int i=0; i<N; i++){
   cout<<S[i];
  }
}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}

int main2() {
  double n, m, d;
  cin >> n >> m >> d;

  double c = 0;
  if (d == 0) {
    c = n;
  } else if (2 * d <= n) {
    double a = min(n, 2*d);
    double b = n - a;
    c = b*2 + a;
  } else {
    double z = 2*d - n;
    double a = n - z;
    c = a;
  }
  double ans = c*(m-1)/(n*n);
  printf("%.10f\n", ans);
  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws)
    main2();
  return 0;
}


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

ans = [0]

def hoge(n):
    global ans
    if ans[-n] != 9:
        ans[-n]+=1
        if check():
            pass
        else:
            huga(n)
    else:
        if len(ans) < n+1:
            ans = [0] * (n+1)
            ans[0] = 1
        else:
            huga(n)

def huga(n):
    global ans
    ans[-(n+1)]+=1
    for i in range(n,0,-1):
        if(ans[-(i+1)]==0):
            ans[-i] = 0
        else:
            ans[-i]=ans[-(i+1)]-1
    ans[-(n+1)]-=1
    hoge(n+1)


def check():
    global ans
    for i in range(len(ans)-1):
        if abs(ans[i]-ans[i+1])>1:
            return False
    return True
       


for i in range(K):
    hoge(1)
print(''.join(map(str,ans)))


Measured memory_bytes: 3064
import math
a,b,h,m=map(int,input().split())
#時針の角度
ho=(360/720)*(h*60+m)
#分の角度
mi=(360/60)*m
sita1=abs(mi-ho)
sita2=360-sita1
sita=min(sita1,sita2)
x=math.sqrt(a**2 + b**2 -2*a*b*math.cos(sita*math.pi/180))
print(x)


Measured memory_bytes: 9448
#1行目 品物の個数n 許容額m
#2行目　a[i](1 <= i <= n)
#どの品物の組も価格合計が m を超える場合は，代わりに NONE と出力する
while True :

  n,m = map(int,input().split())
  #もし(n,m) = (0,0)ならbreak
  if n==0:
    break
  else:
    #配列a[i]を読み込む(1<=i<=n)
    a = sorted(list(map(int, input().strip().split())))
    
    a_sum = 0
    #(最大値) + (その他1つ) <=mを探す
    for i in range(0,n-1):
      for j in range(i+1,n):
        if max(a_sum, a[i] + a[j]) <= m :
          a_sum = max(a_sum, a[i] + a[j])
    
    if a_sum ==0 :
      print("NONE")
    else :
      print(a_sum)
      
      


Measured memory_bytes: 5632
#include <iostream>
#include <sstream>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <numeric>
#include <algorithm>
#include <string>
#include <complex>
 
#include <cassert>
#include <cstdlib>
#include <cmath>
#include <cstdio>
#include <cstring>
 
#define REP(i,e) for(int i=0;i<(int)(e);i++)
#define FOR(i,b,e) for(int i=(int)(b);i<(int)(e);i++)
#define ALL(c) (c).begin(), (c).end()
#define EACH(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define RALL(c) (c).rbegin(), (c).rend()
#define ALLA(a,n) ((a)+0), ((a)+n)
 
using namespace std;
 
typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef vector<string> vstring;
typedef vector<double> vdouble;
 
template<class T>void pp(T v,int n){ REP(i,n)cout<<v[i]<< ' ' ; cout << endl; }
template<class T>void pp(T v){ EACH(it,v) cout << *it << ' ' ; cout << endl;  }
template<class T>T& ls(T& a,T b){ if(b<a) a=b; return a; }
template<class T>T& gs(T& a,T b){ if(b>a) a=b; return a; }
inline ll to_i(const string& s){ll n;sscanf(s.c_str(),"%lld",&n);return n;}
inline string to_s(ll n){char buf[32];sprintf(buf,"%lld",n);return string(buf);}

int main() {
  int n, m;
  while (cin >> n >> m) {
    vll as(n);
    REP(i,n) cin >> as[i];
    map<ll, ll> mp;
    REP(i,m) {
      int b, c;
      cin >> b >> c;
      mp[c] += b;
    }

    sort(ALL(as));
    REP(i,as.size()) {
      if (mp.empty()) continue;
      while (mp.size()) {
        auto it = mp.end(); --it;
        if (it->second == 0) mp.erase(it);
        else break;
      }
      if (mp.empty()) continue;
      auto it = mp.end(); --it;
      if (it->first > as[i]) {
        as[i] = it->first;
        (it->second)--;
      }
    }

    // pp(as);
    cout << accumulate(ALL(as), 0LL) << endl;
  }
}


Measured memory_bytes: 7296
#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (int64_t)(n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

int main() {
  int64_t a, b, x;
  cin >> a >> b >> x;
  cout << b / x - max(0L, a - 1) / x + (a == 0 ? 1 : 0) << endl;

  return 0;
}

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

using namespace std;

const int N = 2e5 + 5;


int main()
{
    int a , b;
    cin>>a>>b;
    if(a>b)
        swap(a , b);
    if(a==1 && b==2)
        cout<<3;
    else if(a==1 && b==3)
        cout<<2;
    else cout<<1;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int[] a=new int[n+2];
		int[] dist=new int[n+1];
		long sum=0;
		for(int i=1; i<=n; i++){
			a[i]=sc.nextInt();
			if(i>0){
				dist[i-1]=Math.abs(a[i]-a[i-1]);
				sum+=dist[i-1];
			}
		}
		dist[n]=Math.abs(a[n+1]-a[n]);
		sum+=dist[n];
		for(int i=1; i<=n;i++){
			System.out.println(sum-dist[i-1]-dist[i]+Math.abs(a[i-1]-a[i+1]));
		}
	}
}



Measured memory_bytes: 69612
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define lsb(x) (x & (-x))
#define uint unsigned int
    
using namespace std;

inline bool ask(vector <int> pos) 
{
	cout << "? ";
	for(auto it : pos) 
	{
		cout << it << " ";
	}
	cout << endl;

	string str;
	cin >> str;

	return str[0] == 'R';
	// Red 1
	// Blue 0
}
   
int main() 
{
#if 0
    ifstream cin("A.in");
    ofstream cout("A.out");
#endif
   	int i, j, n;
    //ios::sync_with_stdio(false);
    //cin.tie(0), cout.tie(0);

	cin >> n;

	vector <int> pos(n), sol(2 * n + 1, -1);
	iota(pos.begin(), pos.end(), 1);
	bool a = ask(pos);
	bool b = (a ^ 1);

	int l = 1, r = n + 1;
	while(l + 1 < r) 
	{
		int mid = (l + r) / 2;
		iota(pos.begin(), pos.end(), mid);
		if(ask(pos) == a)
			l = mid;
		else
			r = mid;
	}
	i = l + 1;
	//cerr << i << "\n";

	int pa = l;
	for(j = 1; j <= 2 * n; j++) 
	{
		if(j < i || j >= i + n) 
		{
			iota(pos.begin(), pos.end(), i);
			pos[n - 1] = j;
			sol[j] = ask(pos);
		}
	}	

	for(j = 1; j <= 2 * n; j++)
	{
		if(sol[j] == -1)
		{
			iota(pos.begin(), pos.end(), i);
			pos[j - i] = pa;
			sol[j] = (ask(pos) ^ 1);
		}
	}
	
	cout << "! ";
	for(i = 1; i <= 2 * n; i++) 
	{
		if(sol[i] == 1) 
			cout << "R";
		else
			cout << "B";
	}
	cout << endl;
	

	return 0;
}


Measured memory_bytes: 724
#include<stdio.h>

int main(){
	int N;
	int d[100] = {0};
	scanf("%d", &N);
	for (int i = 0; i < N; i++) {
		scanf("%d", &d[i]);
	}
	
	int D[101] = { 0 };
	for (int i = 0; i < N; i++) {
		D[d[i]]++;
	}

	int ans = 0;
	for (int i = 1; i <= 100; i++) {
		if (D[i] > 0) {
			ans++;
		}
	}

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

	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <numeric>
#include <regex>
#include <climits>

#define FOR(i, f, n) for(int (i) = (f); (i) < (n); (i)++)
#define RFOR(i, f, n) for(int (i) = (f); (i) >= (n); (i)--)
#define REP(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define RREP(i, n) for(int (i) = (n); (i) >= 0; (i)--)
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for(int (i) = (n); (i) >= 0; (i)--)
#define forin(i, a) for(auto i: (a))
#define p(...) printf(__VA_ARGS__); cout << endl;
#define in(...) __VA_ARGS__; input__(__VA_ARGS__);
#define input(...) in(__VA_ARGS__)
#define out(...) output__(__VA_ARGS__);
#define output(...) out(__VA_ARGS__)
#define list_input(x, n) x[(n)]; for(int (i) = 0; (i) < (n); (i)++) cin >> x[i];
#define lambda(a, b, c) [](auto const &a, auto const &b){ return c ;}
#define key(t, x, compare) [](const t &a, const t &b){ return a x compare b x ;}
#define unless(a) if(!(a))

using namespace std;

using pii = pair<int, int>;

template <class... T>
void input__(T &...a) {
  for(auto v: {&a...}) {
    cin >> *v;
  }
}

void output__(){
  cout << endl;
}

template <class Head, class... T>
void output__(Head const &v, T const &...a) {
  if(sizeof...(a) == 0) {
    cout << v;
  } else {
    cout << v << " ";
  }
  output__(a...);
}

struct point {
  int x, y;
};

int main(){
  int in(n);
  vector<point> red(n);
  rep(i, n) {
    int in(x, y);
    red[i] = {x, y};
  }

  vector<point> blue(n);
  rep(i, n) {
    int in(x, y);
    blue[i] = {x, y};
  }

  sort(blue.begin(), blue.end(), lambda(left, right, left.x < right.x));
  sort(red.begin(), red.end(), lambda(left, right, left.y > right.y));

  int result = 0;
  rep(i, n) {
    rep(j, n) {
      if(red[j].x < blue[i].x and red[j].y < blue[i].y) {
        result++;
        red[j].x = INT_MAX;
        break;
      }
    }
  }
  out(result);
}


Measured memory_bytes: 256
void main() {
	auto ip = readAs!(int[]), A = ip[0], B = ip[1], K = ip[2];
	int[] res;
	foreach(i; A..A+K) { if(i > B) break; else res ~= i; }
	foreach(i; B-K+1..B+1) { if(i < A) break; else res ~= i; }
	res = res.sort().uniq.array;
	foreach(i; res) if(res[$-1] == i) "%d".writef(i); else "%d ".writef(i);
	writeln;
}

// ===================================

import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
ll mp[110][110];
ll INF = 1e10;
char c[110][110];
queue<P> que;
ll BFS(int H,int W)
{
	que.push(P(0,0));
	//初始化 
//	cout<<"here\n";
	for(int i=0;i<H;i++)
		for(int j=0;j<W;j++)
			mp[i][j] = INF;
//	cout<<"here\n";
	mp[0][0] = 0;
	//两个方向增加的步数。 
	int dx[2] = {1,0};
//	cout<<"here\n";
	int dy[2] = {0,1};
//	cout<<"here\n";
    if(c[0][0] == '#')
			mp[0][0]++;
	//BFS 
	while(que.size())
	{
		P p = que.front();
		que.pop();
		//两个方向遍历。 
		for(int i=0;i<2;i++)
		{
			ll x,y;
			//现在的坐标 
			x = p.first+dx[i];
			y = p.second+dy[i];
			ll step = mp[p.first][p.second];
            if((c[p.first][p.second] == '.')
			  &&(c[x][y] == '#'))
				step++;
			if(x<H&&y<W&&mp[x][y] > step/*== INF*/)/*关键是这里的判断条件。
												因为可能重复BFS。（重复路过）*/ 
			{
				mp[x][y] = step;
				que.push(P(x,y));
			}
		}
	}
	return mp[H-1][W-1];
}
int main()
{
	ll H,W;
	cin>>H>>W;
	for(int i=0;i<H;i++)
	{
		for(int j=0;j<W;j++)
			cin >> c[i][j];
	}
	ll ans=BFS(H,W);
	cout<<ans<<endl;
	return 0;
}

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

int main() {
  ll n;
  cin >> n;
  ll ans = INT64_MAX;
  for (ll i = 1; i < sqrt(n) + 1; i++) {
    if (n % i == 0) {
      ll b = n / i;
      ans = min(i + b - 2, ans);
    }
  }
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <tuple>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>
#include <random>
#define INF 1000000000
#define LINF 9000000000000000000
#define mod  1000000007

#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pi;

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

/*---------------------------------------------------*/

int main(){
  int N;
  int h[100005];
  cin >> N;
  rep(i, N) cin >> h[i];

  int cost[100005];
  cost[0] = 0;
  cost[1] = abs(h[0] - h[1]);
  for(int i = 2; i < N; i++){
    cost[i] = min(cost[i - 1] + abs(h[i] - h[i - 1]), cost[i - 2] + abs(h[i] - h[i - 2]));
  }
  cout << cost[N - 1] << endl;
}

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

int main() {
	int a, x = 0, y = 0; cin >> a;
	for (int i = 0; i < a; i++) {
	    string b , c;
	    cin >> b >> c;
	    if (b > c) x += 3;
	    else if (b < c) y += 3;
	    else x++, y++; 
	}
	cout << x << " " << y << endl;
}



Measured memory_bytes: 3192
from collections import deque
from heapq import heapify, heappop as pop, heappush as push

N = int(input())
a = list(map(int, input().split()))

l = a[:N]
m = deque(a[N:N*2])
r = [x * -1 for x in a[N*2:]] # 中身は負

heapify(l)
heapify(r)

ll = [sum(l)]
for em in m:
    l_min = pop(l)
    if l_min < em:
        ll.append(ll[-1] - l_min + em)
        push(l, em)
    else:
        ll.append(ll[-1])
        push(l, l_min)

rr = [sum(r)] # 中身は負
for em in reversed(m):
    r_max = pop(r) * -1
    if r_max > em:
        rr.append(rr[-1] + r_max - em)
        push(r, em * -1)
    else:
        rr.append(rr[-1])
        push(r, r_max * -1)

print(max(a + b for a, b in zip(ll, reversed(rr))))

Measured memory_bytes: 120392
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9 + 7;

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n; cin >> n;
    vector<vector<int>> G(n + 1);
    for (int i = 0; i < n - 1; ++i) {
        int x, y; cin >> x >> y;
        G[x].emplace_back(y);
        G[y].emplace_back(x);
    }
    vector<vector<ll>> dp(n + 1, vector<ll>(2));
    function<void(int, int)> dfs = [&] (int u, int p) {
        dp[u][0] = dp[u][1] = 1;
        for (int& v : G[u]) {
            if (v == p) continue;
            dfs(v, u);
            (dp[u][0] *= (dp[v][0] + dp[v][1]) % MOD) %= MOD;
            (dp[u][1] *= dp[v][0]) %= MOD;
        }
    };
    dfs(1, 0);
    cout << (dp[1][0] + dp[1][1]) % MOD << '\n';
}

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

using namespace std;

int main() {
  string s;
  vector<int> a, b;
  int n, k;
  cin >> n >> k >> s;
  int c = 0, z = 0;
  if (s[0] == '0') {
    a.push_back(0);
  }
  for (int i = 0; i < s.size(); ++i) {
    if (s[i] == '1') {
      ++c;
      if (i && s[i - 1] != s[i]) {
        b.push_back(z);
        z = 0;
      }
    } else {
      ++z;
      if (i && s[i - 1] != s[i]) {
        a.push_back(c);
        c = 0;
      }
    }
  }
  if (c) {
    a.push_back(c);
  } else {
    b.push_back(z);
    a.push_back(0);
  }
  
  k = min(k + 1, (int)a.size());
  int sum = 0;
  for (int i = 0; i < k; ++i) {
    sum += a[i];
    if (i) {
      sum += b[i - 1];
    }
  }
  int ans = sum;
  for (int i = k; i < a.size(); ++i) {
    sum += a[i] - a[i - k] + b[i - 1] - b[i - k];
    ans = max(ans, sum);
  }
  cout << ans << endl;
}


Measured memory_bytes: 1020
#include <iostream>
#include <string>
using namespace std;
int main(){
int N,M,MAX=0,max;

cin >> N;
string Blue[N];
for(int i=0;i<N;i++){
  cin >> Blue[i];
}

cin >>M;
string Red[M];
for(int i=0;i<M;i++){
  cin >>Red[i];
}

for(int i=0;i<N;i++){
  max=0;
  for(int j=0;j<N;j++){
    if(Blue[i]==Blue[j]) max+=1;
  }
  for(int j=0;j<M;j++){
    if(Blue[i]==Red[j]) max-=1;
  }
  if(MAX<max) MAX = max;
}
cout << MAX << endl;
return 0;
}

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

ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
//sort(a, a + N, greater<ll>())   // descend
//sort(a, a+N)                    //  ascend

/* 
void comb(vector<vector <ll> > &v) {
	ll mod=1000000007;
	rep (i,0,v.size()) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	rep (k,1,v.size()) {
		rep (j,1,k) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j])%mod;
		}
	}
}
/*main内でnCn~nC0 生成 **
vector<vector<ll> > v(n + 1, vector<ll>(n + 1, 0));
comb(v);
*/


int main(){
	ll n;
	cin>>n;
	ll a[220000];
	rep(i,1,n+1)cin>>a[i];
	ll b[220000]={0};
	ll cnt=0;
	ll m=0;
	irep(i,n,0){
		for(ll j=i;j<=n;j+=i)cnt+=b[j];	
		cnt=cnt%2;
		if(a[i]!=cnt){b[i]=1;m++;}
		cnt=0;
	}
	cout<<m<<endl;
	rep(i,1,n+1) if(b[i]==1)cout<<i<<endl;
}






Measured memory_bytes: 4480
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho10
#define ll long long
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#define sz size
#define f first
#define s second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define endl '\n'
#define mod 1000000007
#define modul 998244353
#define PI 3.14159265359
#define CODE_START  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
ll n,a[200005],ans[2000005],viz[2000005];
vector<ll>v;
int32_t main(){
CODE_START;
cin>>n;
for(ll i=1;i<=n;i++)
{
    cin>>a[i];
    viz[a[i]]++;
    if(viz[a[i]]==1){
        v.pb(a[i]);
    }
    if(viz[a[i]]>=2){
        ans[a[i]]=-1;
    }
}
for(ll k=0;k<v.size();k++)
{
    ll x=v[k];
    for(ll j=2*x;j<=1000000;j=j+x)
    {
        if(viz[j]>=1){
            ans[j]=-1;
        }
    }
}
ll rs=0;
for(ll i=1;i<=n;i++)
{
    if(ans[a[i]]==0){
        rs++;
    }
}
cout<<rs<<endl;
}


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

cnt2 = 0  # 2で割り切れる回数
cnt4 = 0  # 4で割り切れる回数

for i in range(N):
    if a[i] % 4 == 0:
        cnt4 += 1
    elif a[i] % 2 == 0:
        cnt2 += 1

if N-max(cnt2-1, 0) <= cnt4*2+1:
    print('Yes')
else:
    print('No')



Measured memory_bytes: 14252
N = int(input())
D1 = []
D2 = []
for i in range(N):
    d1,d2 = map(int,input().split())
    D1.append(d1)
    D2.append(d2)

for i in range(N-2):
    if(D1[i] == D2[i]):
        if(D1[i+1] == D2[i+1]):
            if(D1[i+2] == D2[i+2]):
                print("Yes")
                exit()

print("No")

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

using namespace std;
using ll = long long;
using PII = pair<ll, ll>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
 
template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
    out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
    out<<'['; for(T i: a) {out<<i<<',';} out<<']'; return out;
}
template<class T, class S>
ostream &operator <<(ostream& out,const map<T,S>& a){
    out<<'['; for(auto i: a) {out<<i<<',';} out<<']'; return out;
}
template<class T>
ostream &operator <<(ostream& out,const set<T>& a){
    out<<'['; for(auto i: a) {out<<i<<',';} out<<']'; return out;
}
template<class T, class S>
ostream &operator <<(ostream& out,const unordered_map<T,S>& a){
    out<<'['; for(auto i: a) {out<<i<<',';} out<<']'; return out;
}
template<class T>
ostream &operator <<(ostream& out,const unordered_set<T>& a){
    out<<'['; for(auto i: a) {out<<i<<',';} out<<']'; return out;
}

template<ll MOD, ll B>
struct rollingHash{
    vector<ll> hash,p;
    rollingHash(){}
    rollingHash(const string &s){
        const int n=s.size();
        hash.assign(n+1,0); p.assign(n+1,1);
        for(int i=0;i<n;i++){
            hash[i+1]=(hash[i]*B+s[i])%MOD;
            p[i+1]=p[i]*B%MOD;
        }
    }
    // [l,r)
    ll get(int l,int r){
        ll res=hash[r]+MOD-hash[l]*p[r-l]%MOD;
        return res>=MOD?res-MOD:res;
    }
};
constexpr ll mod1 = 1000000007, b1 = 1009;
constexpr ll mod2 = 1000000009, b2 = 1007;
using rh1 = rollingHash<mod1, b1>;
using rh2 = rollingHash<mod2, b2>;

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

    ll n;
    string s;
    cin >> n >> s;

    rh1 hash1(s);
    rh2 hash2(s);

    auto check = [&](ll mid) {
        set<PII> st;
        REP(i, n) {
            if(i >= mid-1) {
                ll v1 = hash1.get(i-mid, i), v2 = hash2.get(i-mid, i);
                st.insert({v1, v2});
            }
            if(i+mid<=n) {
                ll v1 = hash1.get(i, i+mid), v2 = hash2.get(i, i+mid);
                // cerr << PII(v1, v2) << endl;
                if(st.find({v1, v2}) != st.end()) return true;
            }
        }
        return false;
    };

    ll lb=0, ub=n+1;
    while(ub-lb > 1) {
        ll mid = (lb+ub)/2;
        // cerr << lb << " " << mid << " " << ub << endl;
        if(check(mid)) lb = mid;
        else ub = mid;
    }

    cout << lb << endl;

    return 0;
}

Measured memory_bytes: 768
while True:
    n, x = input().split()
    n = int(n)
    x = int(x)
    if n == 0 and x == 0:
        break


    count = 0
    for i in range(1,n-1):
        for j in range(i+1, n):
            """
            # ?????????????????¨???????????????????????????????????§k???x-(i+j)??§?¨?????????????
            # ?????????k????????????(j+1???n)?????????????????????OK???
            for k in range(j+1, n+1):
                if (i+j+k) == x:
                    #print(i, j, k)
                    count += 1
            """
            k = x - (i+j)
            if k < j+1: # k????°???????????????????????????´??????j??????????????§?¢?????????????????????????????????§break??????
                break
            if k <= n:
                count += 1
    print(count)

Measured memory_bytes: 7688
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	string s;
	cin >> s;
	
	if( s.size() % 2 == 1 ) {
		cout << "No" << endl;
		return 0;
	}
	
	int cnt = 0;
	for(int i = 0; i < s.size() - 1; ++i) {
		if( s[i] == 'h' && s[i + 1] == 'i' ) {
			cnt++;
		}
	}
	
	if( cnt == s.size() / 2 ) cout << "Yes" << endl;
	else cout << "No" << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
   int a, b, c, d, s;

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

   if(a>=b)
      s=b;
   else 
      s=a;

   if(c>=d)
      s=s+d;
   else
      s=s+c;

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

   return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<stdio.h>
#include<stack>
using namespace std;

int main(void) {
	string S;
	cin >> S;
	int ans = 0;
	stack<int> tower;
	for (int i = 0; i < S.size(); i++) {
		if (tower.empty() || S[i] == tower.top()) {
			tower.push(S[i]);
		} else {
			tower.pop();
			ans += 2;
		}
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 4248
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int PREP = (cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(9), 0);
//int SEGV = getenv("D") || (exit(system("D= SEGFAULT_SIGNALS=all catchsegv ./prog.exe") >> 8), 0);
int main() {
    int N; cin >> N;
    vector<int> A(N); for (auto &a : A) cin >> a;
    map<int, int> M;
    for (int i = 0; i < N; i++) {
        M[i - A[i]] += 1;
    }
    Int ans = 0;
    for (int i = 0; i < N; i++) {
        M[i - A[i]] -= 1;
        ans += M[i + A[i]];
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  string a, b;
  cin >> a >> b;
  string c = a, d = b;
  reverse(c.begin(), c.end());
  reverse(d.begin(), d.end());
  cout << (a == d && b == c ? "YES" : "NO") << '\n';
  return 0;
}

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

int main(){
    long n,q,s,t;
    cin>>n>>q>>s>>t;
    vector<int> a(n+1);
    vector<long> dif(n,0);
    long ans=0;
    for (int i = 0; i <= n; ++i) {
        cin>>a[i];
        if(i==0)continue;
        long tt;
        dif[i-1]=a[i-1]-a[i];
        if(a[i-1]<a[i])tt=s*(a[i-1]-a[i]);
        else tt=t*(a[i-1]-a[i]);
        ans+=tt;
    }

    for (int i = 0; i < q; ++i) {
        long l,r,x;
        cin>>l>>r>>x;
        long tl=0,tr=0;

        if(dif[l-1]<0)tl=s*(dif[l-1]);
        else tl=t*(dif[l-1]);
        if(r+1<=n) {
            if (dif[r]<0)tr = s * (dif[r]);
            else tr = t * (dif[r]);
        }
        ans-=tl;ans-=tr;

        dif[l-1]-=x;
        if(r+1<=n)dif[r]+=x;

        if(dif[l-1]<0)tl=s*(dif[l-1]);
        else tl=t*(dif[l-1]);
        if(r+1<=n) {
            if (dif[r]<0)tr = s * (dif[r]);
            else tr = t * (dif[r]);
        }
        ans+=tl;ans+=tr;
        cout<<ans<<endl;
    }

    return 0;
}


Measured memory_bytes: 5208
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;

void main()
{
	int[3] pasta;
	int[2] drink;
	foreach (i; 0..3) {
		pasta[i] = readln.chomp.to!int;
	}
	foreach (i; 0..2) {
		drink[i] = readln.chomp.to!int;
	}

	writeln(pasta.array.sort[0]+drink.array.sort[0]-50);
}

Measured memory_bytes: 1040
L,R = map(int,input().split())
j = 0
ans = []
max_len=min(2020,R-L+1)
for i in range(max_len):
    for j in range(i+1,max_len):
        k = ((i+L)*(j+L))%2019
        ans.append(k)
print(min(ans))

Measured memory_bytes: 75440
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	static void Main(){
		Sc sc=new Sc();
		var s=sc.Ia;
		int n=s[0],m=n-1;
		var li=new List<int>[n+1];
		for(int i=1;i<=n;i++){li[i]=new List<int>();}
		for(int i=0;i<m;i++){
			var e=sc.Ia;
			li[Max(e[0],e[1])].Add(Min(e[0],e[1]));
		}
		long ans=0,p=0;
		for(int i=1;i<=n;i++){
			p+=i;
			for(int j = 0;j<li[i].Count;j++) {p-=li[i][j];}
			ans+=p;
		}
		Console.WriteLine("{0}",ans);
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),long.Parse);}
	public double[] Da2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),double.Parse);}}
	public double[] Da3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),double.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

Measured memory_bytes: 59344
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

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

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

int main() {
  int D, N;
  cin >> D >> N;
  if (N == 100)
    cout << int(pow(100, D)) * 101 << endl;
  else
    cout << int(pow(100, D)) * N << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>
#include <cstdint>



#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rrep(i, n) for(ll i = (ll)(n-1); i >= 0; i--)
#define repi(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rrepi(i,a,b) for(ll i=(ll)(b);i>=(ll)(a);i--)

#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;cin>>s;
  ll l=s.length();
  ll res=0;
  string key="keyence";
  rep(i,l)repi(j,i,l+1){
    string t;
    t=s.substr(0,i)+s.substr(j,l-j);
    if(t.length()!=7)continue;
    if(t==key)res=1;
  }
  if(res)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL<<60;

int main(){
    ll a[3];
    for(int i=0;i<3;i++) cin >> a[i];
    sort(a,a+3);
    ll ans = a[2] - a[1];
    a[0] += ans;
    ans += ((a[2] - a[0] + 1) / 2);
    if((a[2] - a[0]) % 2) ++ ans;
    cout << ans << endl;
}

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

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

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

int H,W;

int field[2010][2010];
int row[2010][2010];
int col[2010][2010];

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

    for(int i = 0;i < H;i++) {
        string s;
        cin>>s;
        for(int j = 0;j < W;j++) {
            if(s[j] == '.') {
            } else {
                field[i][j] = -1;
            }
        }
    }

    int ans = 0;
    for(int i = 0;i < H;i++) {
        int cont = 1;
        for(int j = 0;j < W;j++) {
            if(field[i][j] == -1) {
                cont = 1;
            } else {
                row[i][j] = cont++;
            }
        }
        for(int j = W-1;j >= 1;j--) {
            if(field[i][j] == -1)
                continue;
            if(field[i][j-1] == -1)
                continue;
            row[i][j-1] = row[i][j];
        }
    }

    for(int i = 0;i < W;i++) {
        int cont = 1;
        for(int j = 0;j < H;j++) {
            if(field[j][i] == -1) {
                cont = 1;
            } else {
                col[j][i] = cont++;
            }
        }
        for(int j = H-1;j >= 1;j--) {
            if(field[j][i] == -1)
                continue;
            if(field[j-1][i] == -1)
                continue;
            col[j-1][i] = col[j][i];
        }
    }

    for(int i = 0;i < H;i++) {
        for(int j = 0;j < W;j++) {
            ans = max(ans,row[i][j]+col[i][j]-1);
        }
    }

    cout<<ans<<endl;

    return 0;
}


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

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a.at(i);
    }
    for (int i = 0; i < n; i++)
    {
        if (a.at(i) % 2 == 0)
        {
            if (a.at(i) % 3 != 0 && a.at(i) % 5 != 0)
            {
                cout << "DENIED" << endl;
                return 0;
            }
        }
    }
    cout << "APPROVED" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for (ll i=0; i<(n); ++i)
#define rep1(i,n) for (ll i=1; i<=(n); ++i)
typedef long long ll;
bool debug=false;
string yes = "Yes";
string no = "No";
const ll mod = 998244353;
const double e = 0.000000001;

int main(){
  ll n,m; cin >> n >> m;
  vector<vector<ll>> v(n);
  rep(i,m){
      ll a,b; cin >> a >> b; a--; b--;
      v[a].push_back(b);
      v[b].push_back(a);
  }
  vector<ll> ans(n,-1);
  queue<ll> q;
  q.push(0);
  while(!q.empty()){
    auto p=q.front(); q.pop();
    vector<ll> next = v[p];
    for(auto u:next){
      if(u==0||ans[u]!=-1) continue;
      ans[u]=p+1;
      q.push(u);
    }
  }
  rep(i,n){
      if(i==0) cout << yes;
      else cout << ans[i];
      cout << endl;
  }
  return 0;
}
/*
  auto bfs = [&](auto bfs, ll prev, ll cur)->void{
      for(auto next:v[cur]){
          if(next==prev) continue;
          if(ans[next]!=-1) continue;
          ans[next]=cur+1;
          bfs(bfs, cur, next);
      }
  };
*/
/*
  ll a,b,h,m; cin >> a >> b >> h >> m;
  double shita = abs(5*h-11*m)*M_PI/30;
  double ans=sqrt((double)a*a+(double)b*b-(double)2*a*b*cos(shita));
  printf("%.12f",ans);
  */

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

using namespace std;

#define int int64_t

signed main()
{
    //freopen("input.txt", "r", stdin);
    ios::sync_with_stdio(0);
    cin.tie(0);
    int k;
    cin >> k;
    int m = k % 50;
    cout << 50 << endl;
    for(int i = 0; i < 50; i++)
        if(i < m)
            cout << 49 + k / 50 - m + 1 + 50 << ' ';
        else
            cout << 49 + k / 50 - m << ' ';
    cout << endl;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"io/ioutil"
	"os"
	"strings"
)

func main() {
	b, _ := ioutil.ReadAll(os.Stdin)
	d := strings.Split(string(b), "\n")
	s := d[0]
	t := d[1]
	sm := make(map[byte]int)
	tm := make(map[byte]int)
	for i := 0; i < len(s); i++ {
		if sm[s[i]] != tm[t[i]] {
			fmt.Println("No")
			return
		}
		sm[s[i]] = i + 1
		tm[t[i]] = i + 1
	}
	fmt.Println("Yes")
}


Measured memory_bytes: 1920
#include<bits/stdc++.h>
#define FOR(i,a,b) for(int i = (a);i<(b);i++)
#define ROF(i,a,b) for(int i = (a);i>(b);i--)
#define MST(a,x) memset(a,x,sizeof(a))
#define ll long long
#define PB push_back
#define PH push
#define MP make_pair
#define FT first
#define SD second
#define N 100005
#define M 51
#define INF 100000000000000007
#define MOD 1000000007
#define MOD2 1000000009
#define eps 1e-14
using namespace std;
inline int Max(int a,int b)
{
    return (((b-a)>>(32-1))&(a^b))^b;
}
inline int Min(int a,int b)
{
    return (((b-a)>>(32-1))&(a^b))^a;
}

int a[N];
ll sum[N];
ll dp[N][2];
int main()
{
    int n,k;
    while(cin>>n>>k)
    {
        sum[0] = 0;
        FOR(i,0,n)cin>>a[i+1],sum[i+1] = sum[i]+a[i+1];
        FOR(i,0,n+1)dp[i][0] = 0,dp[i][1] = -INF;
        FOR(i,1,n+1)
        {
            dp[i][0] = max(dp[i][0],dp[i-1][0]+max(a[i],0));
            dp[i][1] = max(dp[i][1],dp[i-1][1]+max(a[i],0));
            if(i>=k)
            {
                dp[i][1] = max(dp[i][1],max(dp[i-k][0],dp[i-k][1])+sum[i]-sum[i-k]);
                dp[i][1] = max(dp[i][1],max(dp[i-k][0],dp[i-k][1]));
            }
            //cout<<i<<" "<<dp[i][0]<<" "<<dp[i][1]<<endl;
        }
        cout<<dp[n][1]<<endl;
    }
    return 0;
}


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

using namespace std;

int main() {
	int a, b, c, d, e, f;
	cin >> a >> b >> c >> d >> e >> f;
	int sugar_water = 0;
	int sugar = 0;
	double density = 0;
	for (int i = 0; i * a * 100 <= f; i++) {
		for (int j = 0; (i * a + j * b) * 100 <= f; j++) {
			for (int k = 0; (i * a + j * b) * 100 + k * c <= f; k++) {
				for (int l = 0; (i * a + j * b) * 100 + k * c + l * d <= f; l++) {
					int w = (i * a + j * b) * 100;
					int need = e * (i * a + j * b);
					int s = k * c + l * d;
					if (s > need) break;
					if (s + w == 0) continue;
					double den = double(100.0 * s) / double(s + w);
					if (den >= density) {
						density = den;
						sugar = s;
						sugar_water = s + w;
					}
				}
			}
		}
	}
	cout << sugar_water << " " << sugar << endl;
}

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

using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define vp vector<pair<int, int>>
#define vll vector<long long>
#define inf 1000000100
#define infll 1LL << 50

ll gcd(ll a, ll b)
{
    if(b == 0)
    {
        return a;
    }
    return gcd(b, a%b);
}

ll lcm(ll a, ll b)
{
    ll g = gcd(a, b);
    return a/g * b; //prevent overflow
}

/////////////////////////  END OF TEMPLATE ////////////////////////////////////////


int main()
{
    int n;
    cin >> n;
    vll v;
    for(int i = 0; i < n; ++i)
    {
        ll a;
        cin >> a;
        v.pb(a);
    }

    sort(v.rbegin(), v.rend());
    ll first = 0, second = 0, c = 0;
    for(int i = 1; i < n; ++i)
    {
        if(v[i] == v[i-1])
        {
            if(c == 0)
            {
                first = v[i];
            }
            else
            {
                second = v[i];
            }
            c++;
            i++;
            if(c == 2)
            {
                break;
            }
        }
    }

    if(c == 2)
    {
        ll ans = first*second;
        cout << ans << endl;
    }
    else
    {
        cout << 0 << endl;
    }

}


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

const long long MOD=1000000007;

int main(){
  int H,W; cin >> H >> W;
  string S[2000];
  for(int i=0; i<H; i++) cin >> S[i];
  
  int yoko[2000][2000];
  int tate[2000][2000];
  
  for(int i=0; i<H; i++){
    int temp=0;
    for(int j=0; j<W; j++){
      if(S[i][j]=='#'){
        temp=0;
      }else{
        temp++;
      }
      yoko[i][j]=temp;
    }
    temp=0;
    for(int j=W-1; j>=0; j--){
      if(S[i][j]=='#'){
        temp=0;
      }else{
        temp++;
      }
      yoko[i][j]+=temp;
    }
  }
  for(int j=0; j<W; j++){
    int temp=0;
    for(int i=0; i<H; i++){
      if(S[i][j]=='#'){
        temp=0;
      }else{
        temp++;
      }
      tate[i][j]=temp;
    }
    temp=0;
    for(int i=H-1; i>=0; i--){
      if(S[i][j]=='#'){
        temp=0;
      }else{
        temp++;
      }
      tate[i][j]+=temp;
    }
  }
  int result=0;
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      result=max(result,yoko[i][j]+tate[i][j]-3);
    }
  }
  cout << result << endl;
}

Measured memory_bytes: 35584
#define _USE_MATH_DEFINES

#include <vector>
#include <list>
#include <map>
#include <string>
#include <iostream>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <utility>
#include <ctgmath>
#include <queue>
#include <set>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
const ll mod = 1000000007;
const ll inf = 10e17;
const ld eps = 10e-9;



ll solve(void);
ll gcd(ll x, ll y);

int main(void)
{
	// 追加２, 以降 cin の入力元が 'input.txt' になる
	//std::ifstream in("in.txt");
	//std::cin.rdbuf(in.rdbuf());
	while (solve())
	{
	}
	return 0;
}

ll mulmod(ll x, ll y)
{
	return (x * y) % mod;
}

ll submod(ll x, ll y)
{
	return (x - y + 100 * mod) % mod;
}

ll power(ll n, ll r)
{
	if ( r == 0 ) { return 1; }
	if ( r == 1 ) { return n; }
	if ( n == 0 ) { return 0; }
	if ( n == 1 ) { return 1; }

	if (r % 2 == 0)
	{
		ll y = power(n, r/2);
		return mulmod(y, y);
	}
	else
	{
		ll y = power(n, (r-1)/2);
		return n * mulmod(y, y) % mod;
	}
}

ll gcd(ll x, ll y)
{
	if (y == 1) { return 1;}
	if (x % y == 0) { return y; }
	return gcd(y, x % y);
}

vector<ll> perm;
vector<ll> inv;
void init_inv(ll m)
{
	perm.resize(m);
	inv.resize(m);
	
	perm[0] = 1;
	inv[0] = 1;

	for (ll i = 1; i < m; i++)
	{
		perm[i] = mulmod(perm[i-1], i);
	}
	
	for (ll i = 1; i < m; i++)
	{
		inv[i] = power(perm[i], mod - 2);
	}
}

ll ncr(ll n, ll r)
{
	// n (n-1) ... (n-r)
	if ( r == n || r == 0 ) { return 1; }

	ll ans = 1;
	//for (ll i = 0; i < r; i++)
	//	ans = mulmod(ans, n - i);

	// return mulmod(ans, inv[r]);
	return mulmod(perm[n], mulmod(inv[n-r], inv[r]));
}

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

	bool b = false;
	map<ll, ll> mp;
	for (ll i = 0; i < n; i++)
	{
		ll t;
		cin >> t;
		if (mp.find(t) != mp.end())
		{
			cout << "NO" << endl;
			return 0;
		}
		mp[t] = 0;
	}

	cout << "YES" << endl;

	return 0;
}



Measured memory_bytes: 12800