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

int main() {
  int n;
  std::cin >> n;
  std::vector<int64_t> a(n);
  for (auto &i : a) {
    std::cin >> i;
  }

  std::vector<int64_t> b(n);
  for (int i = 0; i < n; i++) {
    b[i] = std::abs(a[i]);
  }

  auto get_max = [&](const auto s, const auto e) {
    int r = s;
    int64_t val = b[r];

    for (int i = s; i < e; i++) {
      if (val < b[i]) {
        r = i;
        val = b[i];
      }
    }
    return r;
  };

  int s = 0, e = n;

  while (s != e) {
    const auto i = get_max(s, e);
    if (0 < a[i]) {
      e = i;
    } else if (a[i] < 0) {
      s = i + 1;
    } else {
      s = e;
    }
  }

  std::vector<std::pair<int, int>> ans;
  for (int i = s - 1; 0 < i; i--) {
    if (a[i] < a[i - 1]) {
      ans.push_back({i, i - 1});
      a[i - 1] += a[i];
    }
    if (a[i] < a[i - 1]) {
      ans.push_back({i, i - 1});
      a[i - 1] += a[i];
    }
  }

  for (int i = e; i < n - 1; i++) {
    if (a[i + 1] < a[i]) {
      ans.push_back({i, i + 1});
      a[i + 1] += a[i];
    }
    if (a[i + 1] < a[i]) {
      ans.push_back({i, i + 1});
      a[i + 1] += a[i];
    }
  }

  std::cout << ans.size() << std::endl;
  for (const auto &i : ans) {
    std::cout << i.first + 1 << " " << i.second + 1 << std::endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  double W,H,x,y;
  double m;
  int ans;
  cin>>W>>H>>x>>y;
  ans=0;
  m=W*H/2;
  ans=(2*x==W)*(2*y==H);
  //if(x==0||y==0||x==W||y==H)ans=0;
  cout<<m<<" "<<ans<<endl;
}





Measured memory_bytes: 256
// Make a Sequence
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1249 

#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<numeric>

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;

using namespace std;

int N, M, P;

const int NONE = 0;
const int BLACK = 1;
const int WHITE = 2;
const int MAX = 10;

int field[MAX][MAX][MAX];
int height[MAX][MAX];

vector<int> dx;
vector<int> dy;
vector<int> dz;

inline bool is_out_of_range(int x, int y, int z) {
    return (x < 0 || x >= N || y < 0 || y >= N || z < 0 || z >= N);
}

inline void put_ball(int x, int y, int player) {
    field[x][y][height[x][y]] = player;
    height[x][y]++;
}

inline bool judge(int x, int y, int z, int player) {
    for (int d = 0; d < 26; ++d) {
        int nx = x, ny = y, nz = z, cnt = 0; 
        while (!is_out_of_range(nx, ny, nz)) {
            if (field[nx][ny][nz] != player) break;
            cnt++;
            if (cnt == M) return true;
            nx += dx[d];
            ny += dy[d];
            nz += dz[d];
        }
    }
    return false;
}

void init() {
    fill_n((int *)field, sizeof(field) / sizeof(int), NONE); 
    fill_n((int *)height, sizeof(height) / sizeof(int), 0); 
}

int main() {

    for (int i = -1; i <= 1; ++i) {
        for (int j = -1; j <= 1; ++j) {
            for (int k = -1; k <= 1; ++k) {
                if (i == 0 && j == 0 && k == 0) continue;
                dx.push_back(i);
                dy.push_back(j);
                dz.push_back(k);
            }
        }
    }

    while (cin >> N >> M >> P) {
        if (N == 0) break;
        init();
        string winner = "";
        int win_turn = 0;
        for (int turn = 1; turn <= P; ++turn) {
            int player = (turn % 2 != 0) ? BLACK : WHITE;
            int x, y;
            cin >> x >> y;
            x--; y--;
            if (winner != "") continue;
            put_ball(x, y, player);

            for (int x = 0; x < N; ++x) {
                for (int y = 0; y < N; ++y) {
                    for (int z = 0; z < N; ++z) {
                        if (!judge(x, y, z, player)) continue;
                        winner = (player == BLACK) ? "Black" : "White";
                        win_turn = turn;
                    }
                }
            }
        }

        if (winner == "") {
            cout << "Draw" << endl;
        } else {
            cout << winner << " " << win_turn << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 2996
#include <stdio.h>
#include <stdlib.h>

int main(void) {
	int i, n;
	char *s;
	int k_n[26] = {0};
	int k_b[26] = {0};
	int k_e[26] = {0};
	int k_f[26] = {0};
	int kind = 0;
	int max = 0;
	
	scanf("%d", &n);
	s = malloc(sizeof(char) * n);
	scanf("%s", &s[0]);
	
	for (i = 0; i < n; i++) {
		k_n[s[i] - 'a']++;
		if (k_f[s[i] - 'a'] == 0) {
			k_b[s[i] - 'a'] = i;
			k_f[s[i] - 'a'] = 1;
		}
		k_e[s[i] - 'a'] = i;
	}
	
	kind = 0;
	for (i = n - 1; i >= 0; i--) {
		if (k_n[s[i] - 'a'] > 1) {
			if (k_e[s[i] - 'a'] == i) {
				kind++;
			}else if (k_b[s[i] - 'a'] == i) {
				kind--;
			}
			max = max < kind ? kind : max;
		}
	}
	
	printf("%d\n", max);

	return 0;
}

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

int main() {
  
    long long a, b;
    cin >> a >> b;

    bitset<32> bs_a(a), bs_b(b);

    cout << (bs_a & bs_b) << endl;
    cout << (bs_a | bs_b) << endl;
    cout << (bs_a ^ bs_b) << endl;

    return 0;
}


Measured memory_bytes: 3172
#include<vector>
#include<iostream>

using namespace std;

class Cake;

vector<Cake> pieces;

class Cake {
public:
  int w;
  int d;

  Cake(int w, int d) {
    this->w = w;
    this->d = d;
  }

  void cut(int s) {
    int t = s%(w+d);
    int a, b;
    if(t<w) {
      // vertical
      if(t<w-t) {
	a = t;
	b = w-t;
      } else {
	a = w-t;
	b = t;
      }
      pieces.push_back(Cake(a, d));
      pieces.push_back(Cake(b, d));
    }
    else {
      // horizontal
      t -= w;
      if(t<d-t) {
	a = t;
	b = d-t;
      } else {
	a = d-t;
	b = t;
      }
      pieces.push_back(Cake(w, a));
      pieces.push_back(Cake(w, b));
    }
  }
};

bool area(const Cake &a, const Cake &b) {
  return a.w*a.d < b.w*b.d;
}

int main() {
  while(1) {
    int n, w, d;
    cin >> n;
    cin >> w;
    cin >> d;

    if(n==0 && w==0 && d==0) break;

    pieces.clear();
    pieces.push_back(Cake(w, d));

    for(int i=0; i<n; i++) {
      int p, s;
      cin >> p;
      cin >> s;
      // p Í 1` ÈÌÅ
      p-=1;
      vector<Cake>::iterator it = pieces.begin()+p;
      Cake cake = pieces.at(p);
      pieces.erase(it);
      cake.cut(s);
    }

    // sort
    int count=0;
    for(int i=0; i<10000; i++) {
      for(int j=0; j<pieces.size(); j++) {
	int s = pieces.at(j).w * pieces.at(j).d;
	if(s==i) {
	  cout << s;
	  count++;
	  if(pieces.size()!=count) {
	    cout << ' ';
	  }
	}
      }
      //sort(pieces.begin(), pieces.end(), area);
    }


    /*
    for(int i=0; i<pieces.size(); i++) {
      cout << (pieces.at(i).w * pieces.at(i).d);
      cout << ' ';
    }
    */
    cout << "\n";
  }
}

Measured memory_bytes: 900
#include <bits/stdc++.h>
#define mp make_pair
using namespace std;
typedef long long ll;
typedef pair<int,int> pii; typedef set<int> si; typedef set<int>::iterator sit; const int N=100005;
int n; int bl[N]; si s[N]; queue<pii> q; map<ll,int> g;
inline void swap(int &x,int &y){ x^=y^=x^=y; }   
int find(int u){ return bl[u]==u?u:(bl[u]=find(bl[u])); }
inline ll getID(int x,int y){ if(x>y) swap(x,y); return 1ll*n*y+x; }
void addEdge(int u,int v){ s[u].insert(v); s[v].insert(u); ll eid=getID(u,v); int t=g[eid]+1; g[eid]++; if(t==2) q.push(mp(u,v)); }
void removeEdge(int u,int v){ s[u].erase(v); s[v].erase(u); g.erase(getID(u,v)); }
void readData(){ scanf("%d",&n); int u,v; for(int i=1;i<=(n-1)<<1;i++){ scanf("%d%d",&u,&v); addEdge(u,v); } }
bool solve(){
    for(int i=1;i<=n;i++) bl[i]=i;
    for(int i=1;i<n;i++){
        int u,v; if(q.empty()) return false;
        u=q.front().first; v=q.front().second; q.pop(); u=find(u); v=find(v); if(s[u].size()>s[v].size()) swap(u,v); bl[u]=v; removeEdge(u,v);
        for(sit i=s[u].begin(),j;i!=s[u].end();i=j){ j=i; j++; int x=*i; x=find(x); removeEdge(u,x); addEdge(v,x); }
    }
    return true;
}
int main(){ readData(); puts(solve()?"YES":"NO"); return 0; }

Measured memory_bytes: 38656
s = input()

ss = ""
cnt = 0
for e in s:
    if e == "x":
        cnt += 1
    else:
        ss += e

if ss == ss[::-1]:
    l = 0
    r = len(s) - 1
    ans = 0
    while r > l:
        if s[l] == s[r] == "x":
            l += 1
            r -= 1
        elif s[l] == "x":
            l += 1
            ans += 1
        elif s[r] == "x":
            r -= 1
            ans += 1
        else: # s[l] == s[r]
            l += 1
            r -= 1

else:
    ans = -1

print(ans)


Measured memory_bytes: 3316
use std::fmt::Debug;
use std::io;
use std::io::{Read, Stdin};
use std::str;
use std::str::FromStr;

fn main() {
    let mut sc = Scanner::new();
    let h = sc.parse::<usize>();
    let w = sc.parse::<usize>();
    let rows = (0..h).map(|_| sc.parse::<String>()).collect::<Vec<_>>();
    for _ in 0..w + 2 {
        print!("#");
    }
    println!("");
    for row in rows {
        println!("#{}#", row);
    }
    for _ in 0..w + 2 {
        print!("#");
    }
    println!("");
}


struct Scanner {
    stdin: Stdin,
    buf: Vec<u8>,
}

impl Scanner {
    fn new() -> Scanner {
        Scanner {
            stdin: io::stdin(),
            buf: Vec::with_capacity(256),
        }
    }

    fn parse<T: FromStr>(&mut self) -> T
        where <T as FromStr>::Err: Debug
    {
        self.buf.clear();
        let mut it = self.stdin.lock().bytes();
        let mut c = it.next().unwrap().unwrap();
        while c == ' ' as u8 || c == '\n' as u8 {
            c = it.next().unwrap().unwrap();
        }
        while !(c == ' ' as u8 || c == '\n' as u8) {
            self.buf.push(c);
            c = it.next().unwrap().unwrap();
        }
        str::from_utf8(&self.buf).unwrap().parse::<T>().unwrap()
    }
}


Measured memory_bytes: 4352
#include <stdio.h>
int main(){
	int Time;
	scanf(" %d",&Time);
	int a,b,c;
	a=b=c=0;
	a=Time/3600;
	b=Time/60-a*60;
	c=Time-a*3600-b*60;
	printf("%d:%d:%d\n",a,b,c);
	return 0;
}


Measured memory_bytes: 2112
n = int(input())

a=1
b=1
c=1

for i in range(n):
  a = (a * 10) % 1000000007
for i in range(n):
  b = (b * 9) % 1000000007
for i in range(n):
  c = (c * 8) % 1000000007

print((a-b-b+c)% 1000000007)

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

const int N = 305;
const int mod = 1e9 + 7;

int n, m, dp[N][N][N];

void add(int &x, int y) {
    x += y; while(x >= mod) x -= mod; while(x < 0) x += mod;
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    cin >> n >> m;

    dp[0][1][1] = 1;

    for (int i = 0; i < m; ++i) {
        for (int j = 1; j <= n; ++j) {
            for (int k = 1; k <= j; ++k) {
                if (!dp[i][j][k]) continue;
                add(dp[i + 1][j + 1][k], 1LL * dp[i][j][k] * (n - j) % mod);
                add(dp[i + 1][j][k], 1LL * dp[i][j][k] * (j - k) % mod);
                add(dp[i + 1][j][j], 1LL * dp[i][j][k] * k % mod);
            }
        }
    }
    
    cout << dp[m][n][n] << endl;
}

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

int main()
{
	int N;

	cin >> N;

	int H[N + 1];

	for (int i = 1; i <= N; i++)
	{
		cin >> H[i];
	}

	if (N == 1)
	{
		cout << "Yes" << endl;
		return 0;
	}
	else
	{
		for (int i = N; i > 1; i--)
		{
			if (H[i - 1] > H[i])
			{
				H[i - 1] = H[i - 1] - 1;

				if (!(H[i - 1] <= H[i]))
				{
					cout << "No" << endl;
					return 0;
				}
			}
		}

		cout << "Yes" << endl;

		return 0;
	}
}


Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.AGC_037
{
    class A
    {
        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            SetOut(sw);

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            string s = Read();
            int cnt = 0;
            bool nowDouble = true;
            for (int i = 0; i < s.Length; i++)
            {
                if (nowDouble)
                {
                    nowDouble = false;
                    cnt++;
                }
                else
                {
                    if (s[i] == s[i - 1])
                    {
                        nowDouble = true;
                        if (i < s.Length - 1) cnt++;
                        i++;
                    }
                    else
                    {
                        cnt++;
                    }
                }
            }
            WriteLine(cnt);
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


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

int main() {
  string s; cin >> s;
  vector<int> d(3, 0);
  for(int i = 0; i < s.size(); ++i) {
    d[s[i] - 'a']++;
  }
  sort(d.begin(), d.end());
  if(d[2] - d[0] <= 1) {
    std::cout << "YES" << std::endl;
  } else {
    std::cout << "NO" << std::endl;
  }
  return 0;
}


Measured memory_bytes: 512
using System;
using System.Linq;

namespace CSharp
{
    class Program
    {
        public static void Main()
        {
            var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var N = input[0];
            var K = input[1];

            var result = new double[N];
            for (int i = 0; i < N; i++)
            {
                var score = i + 1;
                result[i] = 1.0 / N;
                while (score < K)
                {
                    score *= 2;
                    result[i] *= 0.5;
                }
            }
            Console.WriteLine(result.Sum());
        }
    }
}

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

int main(){
    int n;
    cin >> n;
    for(int i=0;i<n;i++){
        int u,k,p,a[100+10]={};
        cin >> u >> k;
        for(int j=0;j<k;j++){
            cin >> p;
            a[p-1]=1;
        }
        cout << a[0];
        for(int l=1;l<n;l++) cout << " " << a[l];
        cout << endl;
    }
}

Measured memory_bytes: 3096
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<cmath>
using namespace std;
#define REP(i, limit) for(int i=0; i< limit; ++i)
#define FOR(i, j, limit) for(int i=j; i< limit; ++i)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ECHO(x) cout<<x<<endl;
#define LL long long
int INF = 2147483647;
LL LINF = 9223372036854775807;
LL MOD = 1000000007;
typedef pair<int, int>P;
typedef pair<LL, LL>PL;
typedef vector<int> vi;
typedef vector<LL> vl;



int main(){
  int n, m;
  cin>>n>>m;
  int a[n], b[m];
  REP(i, n) cin>>a[i];
  REP(i, m) cin>>b[i];
  sort(a, a+n);
  sort(b, b+m);
  REP(i, n-1){
    if(a[i]==a[i+1]){
      cout<<0<<endl;
      return 0;
    }
  }
  REP(i, m-1){
    if(b[i]==b[i+1]){
      cout<<0<<endl;
      return 0;
    }
  }
  LL ans=1, x;
  int *aub, *alb, *bub, *blb;
  for(int i=m*n; i>0; --i){
    aub = upper_bound(a, a+n, i);
    alb = lower_bound(a, a+n, i);
    bub = upper_bound(b, b+m, i);
    blb = lower_bound(b, b+m, i);
    if(aub-alb==1 && bub-blb==1){
      x=1;
    }
    else if(aub-alb==1){
      x=b+m-blb;
    }
    else if(bub-blb==1) {
      x=a+n-alb;
    }
    else {
      x=(a+n-alb)*(b+m-blb) - m*n+i;
    }
    ans=ans*x;
    if(ans<0)ans=0;
    ans %=MOD;
  }
  cout<<ans<<endl;

  return 0;
}


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

using namespace std;
typedef long long ll;
const int N = 200010;
const int MOD = 998244353;
int _w;

void add_mod( int &a, int b ) {
	a += b;
	a -= a >= MOD ? MOD : 0;
}

void sub_mod( int &a, int b ) {
	a -= b;
	a += a < 0 ? MOD : 0;
}

int mu[N];

int calc_mu( int x ) {
	int ans = 1;
	for( int i = 2; i*i <= x; ++i )
		if( x % i == 0 ) {
			x /= i;
			ans = -ans;
			if( x % i == 0 ) return 0;
		}
	if( x != 1 ) ans = -ans;
	return ans;
}

void init_mu() {
	for( int i = 1; i < N; ++i )
		mu[i] = calc_mu(i);
}

int n, a[N];
char str[N];

vector<int> fac;

void factor( int x ) {
	for( int i = 1; i <= x; i += 2 )
		if( x % i == 0 )
			fac.push_back(x/i);
	sort(fac.begin(), fac.end());
}

int get_num( int len ) {
	int x = 0;
	for( int i = 1; i <= len; ++i ) {
		x = (x * 2 + a[i]) % MOD;
	}
	return x;
}

int chk[N];

int check( int len ) {
	for( int i = 1; i <= len; ++i ) {
		chk[i] = a[i];
		for( int j = len+i; j <= n; j += len )
			chk[j] = 1 - chk[j-len];
	}
	for( int i = 1; i <= n; ++i ) {
		if( chk[i] < a[i] )
			return 1;
		else if( chk[i] > a[i] )
			return 0;
	}
	return 1;
}

int calc( int len ) {
	int rtn = get_num(len);
	add_mod(rtn, check(len));
	return rtn;
}

int ans[N];

void solve() {
	for( int len : fac ) {
		int tmp = calc(len);
		// printf( "calc(%d) = %d\n", len, tmp );
		add_mod( ans[len], tmp );
		for( int j = len+len; j <= n; j += len ) {
			if( mu[j/len] == 1 ) {
				add_mod( ans[j], tmp );
			} else if( mu[j/len] == -1 ) {
				sub_mod( ans[j], tmp );
			}
		}
	}
	int tot = 0;
	for( int i : fac ) {
		add_mod( tot, int(1LL * ans[i] * i * 2 % MOD) );
		// printf( "ans[%d] = %d\n", i, ans[i] );
	}
	cout << tot << endl;
}

int main() {
	_w = scanf( "%d", &n );
	_w = scanf( "%s", str+1 );
	for( int i = 1; i <= n; ++i )
		a[i] = str[i] - '0';
	factor(n);
	init_mu();
	solve();
	return 0;
}


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

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define rrev(i, m, n) for(int (i)=(n)-1; (i)>=(m); (i)--)
#define erev(i, m, n) for(int (i)=(n); (i)>=(m); (i)--)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define pb            push_back
template<class T, class S> inline pair<T, S> mp(T x, S y){ return make_pair(x, y); }
template<class T, class S> inline bool minup(T& m, S x){ return m>(T)x ? (m=(T)x, true) : false; }
template<class T, class S> inline bool maxup(T& m, S x){ return m<(T)x ? (m=(T)x, true) : false; }

static const int    INF = 1000000000;
static const ll     MOD = 1000000007LL;
static const double EPS = 1E-12;

const int MAX_N = 123456;
bool flag[2*MAX_N+1];
int prime[2*MAX_N+1];
int n;

int getPrime(int MAX_N = MAX_N, bool flag[] = flag, int prime[] = prime)
{
  int ptr = 0;
  prime[ptr++] = 2;
  for(int i=4; i<=MAX_N; i+=2) flag[i] = true;
  for(int i=3; i<=MAX_N; i+=2){
    if(!flag[i]){
      prime[ptr++] = i;
      for(int j=2*i; j<=MAX_N; j+=i) flag[j] = true;
    }
  }
  return ptr;
}


int main()
{
  int ptr = getPrime(2 * MAX_N);

  while(cin >> n, n){
    cout << upper_bound(prime, prime + ptr, 2 * n) - upper_bound(prime, prime + ptr, n) << endl;

  }
  return 0;
}

Measured memory_bytes: 1488
import java.util.*;
import java.io.*;

public class Main {	
	public static void main(String[] args) {
		FastScanner fs = new FastScanner();
        int N = fs.nextInt();
		int M = fs.nextInt();
		int A[] = new int[N];
		int ans = 0;
		int x = 0;
		for(int i=0; i<N; i++){
			A[i] = fs.nextInt();
			x += A[i];
		}
		Arrays.sort(A);
		double y =  x/(4*M);

		for(int i=0; i<M; i++){
		if(A[N-1-i]*(4*M)<x){
		System.out.println("No");
		return;
		}else{ 
		continue;
		}
	    }
	System.out.println("Yes");
		

	}

	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");

		public String next() {
			while (!st.hasMoreElements())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) {
				a[i]=nextInt();
			}
			return a;
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

	}
}


Measured memory_bytes: 21204
# -*- coding: utf-8 -*-

N, K = map(int, input().split())
d = [0]*K

C = [0]*N
for i in range(K):
    d[i]=int(input())
    A=list(map(int, input().split()))
    for j in range(N):
        for k in range(d[i]):
            if A[k]==j+1:
                C[j]=1
                break

count=0
for i in range(N):
    if C[i]==0:
        count=count+1

#print("{}".format(C))
print("{}".format(count))


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

int main(void) {
  ll N;
  cin >> N;
  vector<ll> A(N), B(N), C(N);
  REP(i, 0, N) cin >> A[i] >> B[i] >> C[i];

  vector<vector<ll>> dp(N, vector<ll>(3, 0));
  dp[0][0] = A[0];
  dp[0][1] = B[0];
  dp[0][2] = C[0];

  REP(i, 1, N) {
    dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + A[i];
    dp[i][1] = max(dp[i - 1][2], dp[i - 1][0]) + B[i];
    dp[i][2] = max(dp[i - 1][0], dp[i - 1][1]) + C[i];
  }

  cout << max({ dp[N - 1][0], dp[N - 1][1], dp[N - 1][2] }) << endl;
}

Measured memory_bytes: 8064
#include <iostream>
#include <cstdio>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <complex>
#include <map>
#include <climits>
#include <sstream>
using namespace std;

#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second
#define mkp make_pair

static const double PI=6*asin(0.5);
typedef long long ll;
typedef complex<double> CP;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vint;
static const int INF=1<<24;

template <class T>
void initvv(vector<vector<T> > &v,int a,int b, const T  &t = T()){
	v.assign(a,vector<T>(b,t));
}

//v.erase(unique(v.begin(),v.end()),v.end());


int main(){
	int n;
	while(cin>>n,n){
		string s;
		cin>>s;
		vector<pii> v;
		rep(i,n){
			int a,b;
			cin>>a>>b;
			v.PB(mkp(a,b));
		}
		reverse(ALL(v));
		rep(i,n){
			int a=v[i].F,b=v[i].S;
			// cin>>a>>b;
			if(a>b){
				swap(a,b);
			}
			// swap(s[a-1],s[b-1]);
			int t=abs(a-b);
			// cout<<t<<endl;
			int aa=s[a-1]-'a';
			int bb=s[b-1]-'a';
			aa+=t;
			bb+=t;

			aa%=26;
			bb%=26;
			s[a-1]='a'+aa;
			s[b-1]='a'+bb;
			// cout<<s[a-1]<<" "<<s[b-1]<<endl;
			swap(s[a-1],s[b-1]);
		}
		cout<<s<<endl;
	}
}

Measured memory_bytes: 1208
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector> 
#include <cstring>
#include <queue>
#include <ctime>
#include <set>
using namespace std;
typedef long long ll;
typedef unsigned long long ull; 
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;

const ll INF = 10e8;
const int maxN = 1<<18;

const int maxH = 1010; 
const int MOD = 1000000007;
const int maxK = 12;

char a[20]; 
int main()
{
	
	scanf("%s",a+1);
	int flag = 1;
	if(a[1] == 'Y' && a[2] == 'A'&& a[3] == 'K' && a[4] == 'I')
		puts("Yes");
	else
		puts("No"); 
	return 0;
}  

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    string s;
    cin >> s;
    ll n = len(s);
    ll ans = 0;
    rep(i, n) {
        if (i < (n / 2)) {
            if (s[i] == 'g') ans++;
        }
        else {
            if (s[i] == 'p') ans--;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 512
# from math import factorial,sqrt,ceil
# from itertools import permutations as permus
# from fractions import gcd
# from collections import deque,Counter
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

import numpy as np
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix

# strlist = "abcdefghijklmnopqrstuvwxyz"
n = int(input())
times = n
X = []
U = []
for _ in range(times):
    x,u = input().split()
    X.append(float(x))
    u = 1 if u == "JPY" else 380000
    U.append(u)

ans = np.dot(np.array(X),np.array(U))


print(ans)
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))


Measured memory_bytes: 12600
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.stdlib;

void main() {
    auto N = readln.chomp.to!int;
    long ans = 0;
    foreach (i; 1..N+1) foreach (j; 1..N+1) foreach(k; 1..N+1) {
        ans += gcd(gcd(i, j), k);
    }

    ans.writeln;
}

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

int main(){
	long long N,A,B,x;
  cin >> A >> B >> N;
	if(N < B - 1){
     x = N;
    } else{
        x = B - 1;
      }
  long long ans = A * x / B - A * (x / B);
  cout << ans << endl;
	
return 0;
}

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

using ll = long long;

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

    ll n,m;
    cin>>n>>m;

    vector<pair<ll,ll>> a(n);
    for(int i=0;i<n;i++)
    {
        int ia,ib;
        cin>>ia>>ib;
        a[i]=make_pair(ia,ib);
    }

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

    ll ans=0;

    for(int i=0;m>0;i++)
    {
        ans+=a[i].first*min(a[i].second,m);
        m-=a[i].second;
    }

    cout<<ans<<"\n";

    return 0;
}


Measured memory_bytes: 4676
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 200005
#define INF 1000000005LL
#define MOD 1000000007

using namespace std;
typedef long long ll;
typedef pair <int,int> P;

int N;
int A[SIZE];
ll K;

int main()
{
	ll A,B;
	cin >> N;
	rep(i,0,N){
		cin >> A >> B;
		ll AB = A*B;
		ll l = 0,r = INF;
		while(r-l > 1){
			ll m = (l+r)/2;
			if(m*m < AB)l = m;
			else r = m;
		}
		//cout << l << endl;
		ll ans;
		if(A == B)ans = l*2;
		else if(l*(l+1)<AB){
			ans = l*2-1;
		}else{
			ans = l*2-2;
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int algae(int,int,int);
int x;
int main()
{
    int r,D,y;
    cin>>r;
    cin>>D;
    cin>>x;

    for(int i=0;i<10;i++) {
        x=algae(r,D,x);
        cout<<x<<"\n";
    }
    return 0;

}

int algae(int r,int d,int x) {
    int z;
    if(r>1 && r<6 && d>0 && d<101) {
        z=r*x-d;
        x=z;
    }
    return x;
}

Measured memory_bytes: 3496
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>

int main (void) {
    int a, b, c;
    int ans;

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

    ans = a + b + c;

    if ( a >= b && a >= c )
        ans += 9 * a;
    else if ( b >= a && b >= c )
        ans += 9 * b;
    else if ( c >= a && c >= b )
        ans += 9 * c;
    else
        assert(1);

    printf("%d\n", ans);
    return EXIT_SUCCESS;
}


Measured memory_bytes: 128
#include<stdio.h>
#define MAX 2000000
#define INFTY (1<<30)

int n, A[MAX+1];

void swap(int *a, int *b){
  int temp;
  temp = *a;
  *a = *b;
  *b = temp;
}

void maxHeapify(int i){
  int l, r, largest;
  l = 2 * i;
  r = 2 * i + 1;

  if(l <= n && A[l] > A[i]) largest = l;
  else largest = i;
  if(r <= n &&A[r] > A[largest]) largest = r;

  if(largest != i){
    swap(&A[i], &A[largest]);
    maxHeapify(largest);
  }
}

int extract(){
  int maxv;
  if(n < 1) return -INFTY;
  maxv = A[1];
  A[1] = A[n--];
  maxHeapify(1);
  return maxv;
}

void increaseKey(int i, int key){
  if(key < A[i]) return;
  A[i] = key;
  while(i > 1 && A[i/2] < A[i]){
    swap(&A[i], &A[i/2]);
    i = i / 2;
  }
}

void insert(int key){
  n++;
  A[n] = -INFTY;
  increaseKey(n, key);
}

int main(){
  int key;
  char com[10];

  while(1){
    scanf("%s",com);
    if(com[0] == 'e' && com[1] == 'n') break;
    if(com[0] == 'i'){
      scanf("%d",&key);
      insert(key);
    }
    else printf("%d\n",extract());
  }

  return 0;
}

Measured memory_bytes: 4696
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <iostream>
#include <queue>
#include <list>
#include <stack>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;

int main(){
  ios::sync_with_stdio(false);
  int N, K;
  cin >> N >> K;
  vector<int> v(26,0);
  rep(i,N){
    string P;
    cin >> P;
    v[P[0]-'A']++;
  }

  priority_queue<int, vector<int> > que;
  rep(i,v.size()){
    if(v[i] > 0) que.push(v[i]);
  }

  int ret = 0;
  bool flg = true;
  while(!que.empty()){
    vector<int> x;
    rep(i,K){
      if(que.size() == 0){ flg = false; break; }
      int t = que.top(); que.pop();
      x.push_back(t-1);
    }
    if(!flg) break;
    ret++;
    rep(i,x.size()){
      if(x[i]>0) que.push(x[i]);
    }
  }
  
  cout << ret << endl;
  
  return 0;
}



Measured memory_bytes: 256
/**
 *      purpose : SoundHound Inc. Programming Contest 2018 -Masters Tournament- A
 *      author  : kyomukyomupurin
 *      created : 2018-10-25 23:58:59
**/

#include <bits/stdc++.h>
using namespace std;
#define int64 long long
#define print(x) cout << (x) << '\n'

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int a, b; cin >> a >> b;
    if (a + b == 15) print('+');
    else if (a * b == 15) print('*');
    else print('x');
    
    return 0;
}

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

static const int MAX = 100000;
static const int INF = (1<<29);
int N,M;
vector< int > G[MAX];
bool V[MAX];
int indeg[MAX];
list< int > out;

void bfs(int num){
  queue<int> que;
  que.push(num);
  while(!que.empty()){
    int now = que.front(); que.pop();
    out.push_back(now);
    for(int i=0;i<G[now].size();i++){
      int v = G[now][i];
      indeg[v]--;
      if(indeg[v] == 0 && !V[v]){
	V[v] = true;
	que.push(v);
      }
    }
  }
}

void tsort(){
  for(int i=0;i<N;i++){
    indeg[i] = 0;
    V[i] = false;
  }
  for(int i=0;i<N;i++){
    for(int j=0;j<G[i].size();j++) indeg[G[i][j]]++;
  }
  for(int i=0;i<N;i++){
    if(indeg[i] == 0 && !V[i]) bfs(i);
  }
  for(list<int>::iterator it = out.begin();it != out.end();it++){
    cout << *it << endl;
  }
}

int main(){
  cin >> N >> M;
  for(int i=0;i<M;i++){
    int s,t; cin >> s >> t;
    G[s].push_back(t);
  }
  tsort();
}

Measured memory_bytes: 4328
import sys

def ep(*params):
    print(*params,file=sys.stderr)

(A,B) = list(map(int,input().split()))

    

aa = int((A / 8 * 100))
bb = int(B / 10 * 100)
ep(aa,bb)

sa = set()
sb = set()
for a in range(aa-13,aa+14):
    if int(a * 0.08) == A:
        sa.add(a)
for b in range(bb-11,bb+12):
    if int(b * 0.10) == B:
        sb.add(b)
ep(sa,sb,sa&sb)
s = sa&sb
if len(s) > 0:
    print(min(s))
else:
    print(-1)

Measured memory_bytes: 3064
#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
import heapq
from fractions  import gcd
#input=sys.stdin.readline
import bisect
n=int(input())
arr=[list(input().split()) for _ in range(n)]
yaxis={}
xaxis={}
s1axis={}
s2axis={}
t1axis={}
t2axis={}

t=list()

for i in range(n):
    x,y,u=arr[i]
    x=int(x)
    y=int(y)
    if u=="U" or u=="R":
        if x+y not in s1axis:
            s1axis[x+y]=[[y,u]]
        else:
            s1axis[x+y].append([y,u])
    if u=="D" or u=="L":
        if x+y not in s2axis:
            s2axis[x+y]=[[y,u]]
        else:
            s2axis[x+y].append([y,u])
    if u=="U" or u=="L":
        if y-x not in t1axis:
            t1axis[y-x]=[[y,u]]
        else:
            t1axis[y-x].append([y,u])
    if u=="D" or u=="R":
        if y-x not in t2axis:
            t2axis[y-x]=[[y,u]]
        else:
            t2axis[y-x].append([y,u])
    if u=="U" or u=="D":
        if x in xaxis:
            xaxis[x].append([y,u])
        else:
            xaxis[x]=[[y,u]]
    else:
        if y in yaxis:
            yaxis[y].append([x,u])
        else:
            yaxis[y]=[[x,u]]

for s in xaxis:
    s=sorted(xaxis[s],key=lambda x: x[0])
    for k in range(1,len(s)):
        if s[k-1][1]=="U" and s[k][1]=="D":
            time=(s[k][0]-s[k-1][0])*5
            heapq.heappush(t,time)
for s in yaxis:
    s=sorted(yaxis[s],key=lambda x: x[0])
    for k in range(1,len(s)):
        if s[k-1][1]=="R" and s[k][1]=="L":
            time=(s[k][0]-s[k-1][0])*5
            heapq.heappush(t,time)
for s in s1axis:
    s=sorted(s1axis[s],key=lambda x: x[0])
    for k in range(1,len(s)):
        if s[k-1][1]=="U" and (s[k][1]=="R" or s[k][1]=="L"):
            time=10*(s[k][0]-s[k-1][0])
            heapq.heappush(t,time)

for s in s2axis:
    s=sorted(s2axis[s],key=lambda x: x[0])
    for k in range(1,len(s)):
        if s[k-1][1]=="L" and s[k][1]=="D":
            time=10*(s[k][0]-s[k-1][0])
            heapq.heappush(t,time)
 
for s in t1axis:
    s=sorted(t1axis[s],key=lambda x: x[0])
    for k in range(1,len(s)):
        if s[k-1][1]=="U" and s[k][1]=="L":
            time=10*(s[k][0]-s[k-1][0])
            heapq.heappush(t,time)

for s in t2axis:
    s=sorted(t2axis[s],key=lambda x: x[0])
    for k in range(1,len(s)):
        if s[k-1][1]=="R" and s[k][1]=="D":
            time=10*(s[k][0]-s[k-1][0])
            heapq.heappush(t,time)
if not t:
  print("SAFE")
else:
  print(heapq.heappop(t))

Measured memory_bytes: 261868
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
typedef long long ll;
int main() {
    int n;
    cin >> n;
    n%=10;
    string ans = "hon";
    if(n==3) ans = "bon";
    else if(n==0||n==1||n==6||n==8) ans = "pon";
    cout << ans << endl;
}


Measured memory_bytes: 3620
#include<iostream>
#include<string>
using namespace std;
typedef long long ll;
#define fr(i,n) for(int i=0;i<n;i++)

int main(){
  bool fl=false;
  int k;
  char c = 'z'+1;
  string s;
  cin >> s;
  if(s == "zyxwvutsrqponmlkjihgfedcba") cout << -1;
  else if(s.size() !=26){
    fr(i,26){
      fr(j,s.size()){
        if(s[j] == 'a'+i) fl = true;
      }
      if(fl == false){k=i;break;}
      fl = false;
    }
  s.push_back('a'+k);
    cout << s;
  }
  else{
    for(int i=25;i>=0;i--){
      fr(j,26){
        if(i<j){
          if(s[i]<s[j]){fl=true;c = min(c,s[j]);}
        }
      }
    if(fl==true){k=i;break;}
    }
  fr(i,k) cout <<s[i];
    cout << c;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define uniq(v) v.erase(unique(v.begin(),v.end()),v.end())
#define lb(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define ub(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
using Pair = pair<ll,pair<int,int>>;
#define pq priority_queue<Pair, vector<Pair>, greater<Pair>> 
const ll mod=1000000007;
//const ll mod=998244353;
const ld pi=acos(-1.0);
const ll INF = 1LL<<61;
template<class T>bool chmax(T &a, const T &b) { 
  if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) {
  if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる



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

  string s;
  cin>>s; 
  int n=s.size();

  rep(i,n){
    if(i%2==0) cout << s[i];
  }

  cout << endl;
}

Measured memory_bytes: 3716
#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
int inv2,inv6,inv3;
void add(int &x,int y){
	x+=y;
	if(x>=mod){
		x-=mod;
	}
}
void sub(int &x,int y){
	x-=y;
	if(x<0){
		x+=mod;
	}
}
int mul(int x,int y){
	return (1ll*x*y)%mod;
}
int C2(int x){
	return mul(mul(x,x-1),inv2);
}
int C3(int x){
	return mul(x,mul(x-1,mul(x-2,inv6)));
}
int binpow(int x,int y){
	int tich=1;
	while(y){
		if(y&1){
			tich=mul(tich,x);
		}
		x=mul(x,x);
		y>>=1;
	}
	return tich;
}
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int h,w,num,i,j,k,l,tich=1,n,ans;
	cin>>h>>w>>num;
	n=h+w;
	for(i=1;i<=num;i++){
		tich=mul(tich,n-i+1);
	}
	ans=0;
	inv2=binpow(2,mod-2),inv3=binpow(3,mod-2),inv6=binpow(6,mod-2);
	j=mul(C2(num),binpow(C2(n),mod-2));
	k=mul(C3(num),binpow(C3(n),mod-2));
	k=mul(k,mul(inv3,n-2));
	add(j,k);
	add(ans,mul(j,mul(w,h)));
	j=mul(num,binpow(n,mod-2));
	k=mul(C2(num),binpow(C2(n),mod-2));
	k=mul(k,mul(inv2,n-1));
	add(j,k);
	add(ans,mul(j,n));
	add(ans,num);
	ans=mul(ans,tich);
	cout<<ans;
}

Measured memory_bytes: 256
//This code was made by Chinese_zjc_.
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#define int long long
#define INF 0x3fffffffffffffff
using namespace std;
int n;
signed main()
{
	std::ios::sync_with_stdio(false);
	cin>>n;
	for(int i=1;i<=9;++i)
	{
		if(n%i==0&&n/i<10)
		{
			cout<<"Yes";
			return 0;
		}
	}
	cout<<"No";
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, a, b) for(int i = a; i < b; i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fi first
#define se second
#define debug(x) cerr <<__LINE__<< ": " <<#x<< " = " << x << endl
#define debug_vec(v) cerr<<__LINE__<<": "<<#v<<" = ";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

void solve() {
    int n;
    cin >> n;
    bool flag = 1;
    rep(i, n) {
        int a;
        cin >> a;
        if (a % 2 == 0) {
            if (a % 3 == 0 || a % 5 == 0) continue;
            else {
                flag = 0;
                break;
            }
        }
    }
    if (flag) cout << "APPROVED" << endl;
    else cout << "DENIED" << endl;
}

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


Measured memory_bytes: 3652
#include<iostream>
#include <algorithm>
#include<functional>//greaterの使用
using namespace std;
#define MAX_LIST 1000000

int main(){
	bool prime[MAX_LIST];
	for(int i=0;i<MAX_LIST;i++){
		prime[i]=1;
	}
	prime[0]=prime[1]=0;
	for(int i=0;i*i<MAX_LIST;i++){
		if(prime[i]==1){
			for(int j=i*2;j<MAX_LIST;j=j+i){
				prime[j]=0;
			}
		}
	}
	int prime_num[MAX_LIST];
	prime_num[0]=1;
	for(int i=1;i<MAX_LIST;i++){
		prime_num[i]=prime_num[i-1]+prime[i];
	}
	
	
	int n;
	while(cin>>n,n){
		int ans=0;
		ans=prime_num[2*n]-prime_num[n];
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 6040
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    double a, b, c; cin >> a >> b >> c;
    double S = a * b * sin(c * M_PI / 180) / 2;
    double L = a + b + sqrt(pow(a, 2) + pow(b, 2) - 2 * a * b * cos(c * M_PI / 180));
    double h = b * sin(c * M_PI / 180);
    printf("%.8f\n%.8f\n%.8f\n", S, L, h);
    return 0;
}


Measured memory_bytes: 3400
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();

		int ac = 0;
		int wa = 0;

		int[] isAC = new int[n + 1];
		int[] cntWA = new int[n + 1];

		for (int i = 0; i < m; i++) {
			int p = sc.nextInt();
			String s = sc.next();
			if ("WA".equals(s)) {
				if (isAC[p] == 0) {
					cntWA[p]++;
				}
			} else {
				isAC[p] = 1;
			}
		}

		for (int i = 1; i <= n; i++) {
			ac += isAC[i];
			if (isAC[i] == 1) {
				wa += cntWA[i];
			}
		}

		System.out.println(ac + " " + wa);

		sc.close();
	}

}



Measured memory_bytes: 66112
#[allow(unused_macros)]
macro_rules! parse_line {
    ( $t:ty ) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            iter.next().unwrap().parse::<$t>().unwrap()
        }
    );

    ( $( $t:ty), +) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ( $(iter.next().unwrap().parse::<$t>().unwrap()),* )
        }
    );
}

#[allow(unused_macros)]
macro_rules! read_line {
    () => {{
        let mut line = String::new();
        ::std::io::stdin().read_line(&mut line).unwrap();
        line.pop();
        line
    }};
}

#[allow(unused_macros)]
macro_rules! parse_vec {
    ( $t:ty ) => {{
        let mut line = String::new();
        ::std::io::stdin().read_line(&mut line).unwrap();
        let iter = line.split_whitespace();
        iter.map(|v| v.parse::<$t>().unwrap()).collect::<Vec<_>>()
    }};
}

const FACT_MAX: usize = 300000;
const MOD: i64 = 1000000007;

#[allow(dead_code)]
fn pow_mod(base: i64, power: i64, modulo: i64) -> i64 {
    let mut base = base;
    let mut power = power;
    let mut ans = 1;
    while power > 0 {
        if power & 1 == 1 {
            ans = ans * base % modulo;
        }
        power >>= 1;
        base = base * base % modulo;
    }
    ans
}

thread_local! {
    #[allow(unused)]
    pub static FACT: Vec<i64> = {
        let mut fac: Vec<i64> = vec![1; FACT_MAX+1];

        for i in 1..FACT_MAX+1 {
            fac[i] = (fac[i-1] * i as i64) as i64 % MOD;
        }
        fac
    };

    #[allow(unused)]
    pub static RFACT: Vec<i64> = {
        let mut rfac = vec![1; FACT_MAX+1];
        rfac[FACT_MAX] = FACT.with(|fact| {
            pow_mod(fact[FACT_MAX], MOD-2, MOD)
        });

        for i in (1..FACT_MAX).rev() {
            rfac[i] = (rfac[i+1] * (i+1) as i64) % MOD;
        }
        rfac
    }
}

#[allow(dead_code)]
fn combi(n: usize, m: usize) -> i64 {
    FACT.with(|fact| RFACT.with(|rfact| fact[n] * rfact[n - m] % MOD * rfact[m] % MOD))
}

fn solve(n: usize, k: usize) -> Vec<i64> {
    if n == k {
        let mut ans = vec![0; k];
        ans[0] = 1;
        return ans;
    }

    let mut ans = Vec::new();
    for i in 1..(k + 1) {
        let blue = combi(k - 1, i - 1);
        let red0 = if (i < 2) || (n - k - 1 < i - 2) {
            0
        } else {
            combi(n - k - 1, i - 2)
        };
        let red1 = if n - k - 1 < i - 1 {
            0
        } else {
            combi(n - k - 1, i - 1)
        };
        let red2 = if n - k - 1 < i {
            0
        } else {
            combi(n - k - 1, i)
        };

        ans.push((blue * ((red0 + (red1 * 2) % MOD) % MOD + red2) % MOD) % MOD);
    }

    ans
}

fn main() {
    let (n, k) = parse_line!(usize, usize);

    for v in solve(n, k) {
        println!("{}", v);
    }
}

#[test]
fn solve_test() {
    assert_eq!(solve(5, 3), vec![3, 6, 1]);
    assert_eq!(solve(2000, 3), vec![1998, 3990006, 327341989]);
}


Measured memory_bytes: 12540
## ABC 054 b
import sys
from numpy import array as npa

n,m = (int(_) for _ in input().split())
a = npa([list(input()) for i in range(n)])
b = npa([list(input()) for i in range(m)])

for i in range(n-m+1):
    for j in range(n-m+1):
        if ((b[:, :] == a[i:i+m, j:j+m]).all()):
            print('Yes')
            sys.exit(0)

print('No')

Measured memory_bytes: 12484
paper=[[0 for i in range(10)] for j in range(10)]
while 1:
    try:
        x,y,s=map(int,input().split(","))
        if s==1:
            r=[[-1,0],[1,0],[0,0],[0,-1],[0,1]]
        elif s==2:
            r=[[-1,-1],[-1,0],[-1,1],[0,-1],[0,0],[0,1],[1,-1],[1,0],[1,1]]
        elif s==3:
            r=[[-2,0],[-1,-1],[-1,0],[-1,1],[0,-2],[0,-1],[0,0],[0,1],[0,2],[1,-1],[1,0],[1,1],[2,0]]
        for i in r:
            if y+i[0]<0 or y+i[0]>9 or x+i[1]<0 or x+i[1]>9:pass
            else:
                paper[y+i[0]][x+i[1]]+=1
    except:break
ans=0
dark=0
for i in paper:
    for j in i:
        if j==0:ans+=1
        else:dark=max(dark,j)
print(ans)
print(dark)


Measured memory_bytes: 5608
#include <bits/stdc++.h>
#include <bits/stdint-intn.h>

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

using namespace std;

int main() {
  int64_t x;
  std::cin >> x;

  int64_t sum = 0;
  int64_t t = 0;
  while (sum < x) {
    t++;
    sum += t;
  }

  std::cout << t << std::endl;
  return 0;
}


Measured memory_bytes: 3608