akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC160A
{
    class Program
    {
        static void Main(string[] args)
        {
            string S = Console.ReadLine();
            if (S.Substring(2, 1) == S.Substring(3, 1) & S.Substring(4, 1) == S.Substring(5, 1))
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}


Measured memory_bytes: 25612
#include <stdio.h>
#define MAX_V 10000

int main() {
	int prime[MAX_V + 1];
	int data[10000];
	int i, k, cnt = 0, n, p1, q1;
	for(i = 2; i <= MAX_V; i++) {
		prime[i] = 1;
	}
	for(i = 2; i * i <= MAX_V; i++) {
		if(prime[i]) {
			for(k = 2 * i; k <= MAX_V; k += i) {
				prime[k] = 0;
			}
		}
	}
	while(1) {
		scanf("%d", &n);
		if(n == 0) break;
		data[cnt] = n;
		cnt++;
	}
	for(i = 0; i < cnt; i++) {
		for(k = 5; k <= data[i]; k++) {
			if(prime[k] && prime[k-2]) {
				p1 = k - 2;
				q1 = k;
			}
		}
		printf("%d %d\n", p1, q1);
	}
	return 0;
}

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

int main() {
  
  int N, K, x, t;
  cin >> N >> K;
  t = 0;
  
  for (int i = 0; i<N; i++) {
    cin >> x;
    if (K-x<x) t += K-x;
    else t += x;
  }
  cout << t*2 << endl;
      
}

Measured memory_bytes: 256
package main

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

var (
	s    = bufio.NewScanner(os.Stdin)
	w    = bufio.NewWriter(os.Stdout)
	a, n = []int{}, 0
)

func main() {
	n = nextInt(s)
	a = atoi(s)
	q := nextInt(s)
	m := atoi(s)

	for i := 0; i < q; i++ {
		j := 0
		if solve(j, m[i]) {
			fmt.Fprintln(w, "yes")
			continue
		}
		fmt.Fprintln(w, "no")
	}
	w.Flush()
}

func nextInt(s *bufio.Scanner) int {
	s.Scan()
	r, err := strconv.Atoi(s.Text())
	if err != nil {
		panic(err)
	}
	return r
}

func atoi(s *bufio.Scanner) []int {
	s.Scan()
	a := strings.Fields(s.Text())
	i := []int{}

	for _, v := range a {
		j, err := strconv.Atoi(v)
		if err != nil {
			panic(err)
		}
		i = append(i, j)
	}
	return i
}

func solve(i, m int) bool {
	if m == 0 {
		return true
	} else if i >= n {
		return false
	}
	return solve(i+1, m) || solve(i+1, m-a[i])
}



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

// #define ff              first
// #define ss              second
// #define int             long long
// #define pb              push_back
// #define mp              make_pair
// #define pii             pair<int,int>
// #define vi              vector<int>
// #define mii             map<int,int>
// #define pqb             priority_queue<int>
// #define pqs             priority_queue<int,vi,greater<int> >
// #define setbits(x)      __builtin_popcountll(x)
// #define zrobits(x)      __builtin_ctzll(x)
// #define mod             1000000007
// #define inf             1e18
// #define ps(x,y)         fixed<<setprecision(y)<<x
// #define mk(arr,n,type)  type *arr=new type[n];
// #define w(x)            int x; cin>>x; while(x--)


void aryan_p() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	return;
}




int32_t main() {


	int n , k ;
	cin >> n >> k;
	int c = 0 ;
	while (n--) {
		int i ;
		cin >> i;
		if (i >= k) {
			c++;
		}
	}
	cout << c;


	return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define INF 1 << 30
#define EPS 1e-10

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

int H, W, t[20][20];
int dy[] = {0, 1}, dx[] = {1,0}; // 横　縦

int judge(int y, int x){
  map<int, int>m;
  for(int i = -1; i < 1; i++){
    for(int j = -1; j < 1; j++){
      int ny = y+i, nx = x+j;
      if(ny < 0 || nx < 0 || t[ny][nx] == -1 || m.count(t[ny][nx])) continue;
      m[t[ny][nx]] = 1;
    }
  }
  if(m.size() < 4) return 1;
  return 0;
}

int dfs(int n){
  int i, j, res = 0;
  for(i = 0; i < H; i++) for(j = 0; j < W; j++) if(t[i][j] == -1) goto b;
 b:

  if(i == H && j == W) return 1;

  //  int tmp[20][20];
  //  rep(i, H) rep(j, W) tmp[i][j] = t[i][j];

  t[i][j] = n;
  rep(d, 2){
    int x = j+dx[d], y = i+dy[d];
    if(x < 0 || x >= W || y < 0 || y >= H || t[y][x] != -1) continue;
    t[y][x] = n;
    if(judge(i, j)) res += dfs(n+1);
    t[y][x] = -1;
  }
  //  rep(i, H) rep(j, W) t[i][j] = tmp[i][j];
  t[i][j] = -1;

  return res;
}

int main(){
  while(scanf("%d%d", &H, &W) && H+W){
    memset(t, -1, sizeof(t));
    printf("%d\n", dfs(0));
  }
  return 0;
}

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

int main(){
  string s;
  cin >>s;
  if(s[0]==s[1] && s[2]==s[3] && s[0]!=s[2]) cout << "Yes" << endl;
  else if(s[0]==s[2] && s[1]==s[3] && s[0]!=s[1]) cout << "Yes" << endl;
  else if(s[0]==s[3] && s[1]==s[2] && s[0]!=s[1]) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mod 1000000007
#define ull unsigned ll
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define pi acos(-1)
#define nui 100
#define INF 100000000000
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#define F(i,a,n) for(ll i=a;i<n;i++)
#define B(i,a,n) for(ll i=n-1;i>=a;i--)
#define tc int t;cin>>t;while(t--)
#define tcf int t;cin>>t;for(int w=1;w<=t;w++)



using namespace std;


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

ll fermat_inv(ll y) {return binpow(y, mod - 2);}



int main()
{

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    string s;
    cin >> s;
    ll sum = 0;
//   ll ans=0;
    for (ll i = 0; i < s.size(); i++)
    {
        sum += s[i] - '0';
        sum %= 9;
    }
    if (sum)
    {
        cout << "No\n";
    }
    else
    {
        cout << "Yes\n";
    }
    return 0;

}

Measured memory_bytes: 3736
#include <bits/stdc++.h>
#define d(a) cout << #a << " is " << a << endl
using namespace std;

bool state[10][10000],rflip[10];
int ccol,nr,nc,gmin;
char cc;

int main()
{
    while (scanf("%d%d",&nr,&nc)&&nr+nc) {
        gmin=10000000;
        for(int i=0;i<nr;i++)
        for(int c=0;c<nc;c++) {
            scanf(" %c",&cc);
            state[i][c]=cc-'0';
        }
        for(int btmsk=0;btmsk<1<<nr;btmsk++) {
            //d(btmsk);
            for(int i=0;i<nr;i++) rflip[i]=btmsk>>i&1;
            int ans=0;
            for(int c=0;c<nc;c++) {
                ccol=0;
                for(int i=0;i<nr;i++)
                    ccol+=state[i][c]^rflip[i];
                ans+=min(ccol,nr-ccol);
            }
            //d(ans);
            gmin=min(gmin,ans);
        }
        printf("%d\n",nr*nc-gmin);
    }
    return 0;
}



Measured memory_bytes: 3228
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stdio.h>
#include <queue>
using namespace std;
typedef long long ll;
typedef pair <int,int> p;
typedef vector<int> vi;
#define inf 1000000000
const int max_N=1e5+10;
int n,k,tmp3;
ll ans=0;
int main()
{
  cin >> n >> k;
  if(k==0)
    {
      cout << (ll)n*n << endl;
      return 0;
    }
  for(int i=1;i<=n;i++)
    {
      int p=n/i;
      int anum=p*max(0,i-k);
      int r=n-p*i;
      int rest=max(0,r-k+1);
      ans+=anum+rest;
    }
  cout << ans << endl;
  return 0;
}
 


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

int b[100050],ans,n,cnt;

int main()
{
    cin>>n;
    for (int i=1;i<=n;i++) cin>>b[i];
    sort(b+1,b+n+1);
    cnt=1;
    for (int i=2;i<=n;i++)
        if (b[i]!=b[i-1]) 
        {
            if (cnt<b[i-1]) ans+=cnt;
            else if (cnt>b[i-1]) ans+=cnt-b[i-1];
            cnt=1;
        }
        else cnt++; 
    if (cnt<b[n]) ans+=cnt;
    else if (cnt>b[n]) ans+=cnt-b[n];
    printf("%d\n",ans);
    return 0;
}


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

public class Hello
{
    public static int N, A, B, C;
    public static int[] L;
    public static void Main()
    {
        // Your code here!
        int[] a = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        N = a[0];
        A = a[1];
        B = a[2];
        C = a[3];
        L = new int[N];
        
        for(int i = 0; i < N; i++)
        {
            L[i] = int.Parse(Console.ReadLine());
        }
        
        Console.WriteLine(dfs(0,0,0,0));
        
        
        
        

        
    }
    
    public static int dfs(int depth, int a, int b, int c) //かかったコストを返す関数
    {
        if (depth == N)
        {
            if((a == 0 || b == 0)|| c == 0) return 10000000;
            else
            {
                return Math.Abs(A - a) + Math.Abs(B - b) + Math.Abs(C - c);
            }
            
        }
    
        int res = dfs(depth + 1, a, b, c);
        
        res = Math.Min(res, dfs(depth + 1, a + L[depth], b, c) + ((a != 0) ? 10 : 0));
        res = Math.Min(res, dfs(depth + 1, a, b + L[depth], c) + ((b != 0) ? 10 : 0));
        res = Math.Min(res, dfs(depth + 1, a, b, c + L[depth]) + ((c != 0) ? 10 : 0));
        
        return res;
    }
    
    
}


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

#define int long long
const double PI = 3.14159265358979323846;
typedef vector<int> vint;
typedef pair<int, int> pint;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int N;
int A[110000], B[110000], C[110000];
vint G[110000];
unordered_map<int, int> cmap[110000];
int mincost = LLONG_MAX;
bool hashigher[110000];

int ans = 0;
int dfs(int from, int to) {
    int cur = 1;
    for (int i = 0; i < G[to].size(); i++) {
        if (G[to][i] == from)continue;
        cur += dfs(to, G[to][i]);
    }
    int deg = min(cur, N - cur);
    int cost = cmap[from][to];
    ans += deg * 2 * cost;
    if (deg * 2 == N)mincost = cost;
  	if(cur<N-cur)hashigher[to]=true;
    else if(cur>N-cur) hashigher[from]=true;
    return cur;
}

signed main() {
    cin >> N;
    for (int i = 0; i < N - 1; i++) {
        cin >> A[i] >> B[i] >> C[i];
        cmap[A[i]][B[i]] = C[i];
        cmap[B[i]][A[i]] = C[i];
        G[A[i]].push_back(B[i]);
        G[B[i]].push_back(A[i]);
    }
    for (int i = 0; i < G[1].size(); i++)dfs(1, G[1][i]);
	if (mincost!=LLONG_MAX){
      cout<<ans-mincost<<endl;
      return 0;
    }
    for(int i=1;i<=N;i++){
      if(hashigher[i])continue;
      for (int j = 0; j < G[i].size(); j++) {
          mincost = min(mincost, cmap[i][G[i][j]]);
      }
    }
    cout << ans - mincost << endl;
}


Measured memory_bytes: 29440
#include <bits/stdc++.h>
#define P pair<int,int>
#define All(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
typedef long long ll;
using namespace std;
const int INF = 1e9 + 7, MOD = 1e9 + 7;
const ll LINF = 1e18;
int main() {
	ll n, cnt = 0;
	cin >> n;
	int a[n], b[n];
	for (int i = 0; i < n; i++) {
		cin >> a[i] >> b[i];
	}
	for (int i = n - 1; i >= 0; i--) {
		cnt += (b[i] - ((a[i] + cnt) % b[i])) % b[i];
		// cout << "i:" << i << " cnt:" << cnt << endl;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 1024
package main

import "fmt"

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

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

	ans := 1
	for i := n; i > 0; i-- {
		ans += min(ans, k)

	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Collections;

public class Main {
    public static void main(String args[]) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        String[] line = br.readLine().split(" ", 0);
        
        double a = 0, sum = 0;
        for (int i = 0; i < n; i++) {
            a = Double.parseDouble(line[i]);
            sum += 1 / a;
        }
        
        System.out.println(1 / sum);
    }
}

Measured memory_bytes: 21204
// #includes {{{
#ifdef MY_DEBUG
#include "header/header.hpp"
#else
#include <bits/stdc++.h>
#endif

using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define RREP(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();++i)
#define LET(x,a) __typeof(a) x(a)
//#define IFOR(i,it,c) for(__typeof((c).begin())it=(c).begin();it!=(c).end();++it,++i)
#define ALL(c) (c).begin(), (c).end()
#define MP make_pair

#define EXIST(e,s) ((s).find(e)!=(s).end())

#define RESET(a) memset((a),0,sizeof(a))
#define SET(a) memset((a),-1,sizeof(a))
#define PB push_back
#define DEC(it,command) __typeof(command) it=command

//debug

#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)

typedef long long Int;
typedef unsigned long long uInt;
typedef long double rn;

template<class T>
T inf(){
	return numeric_limits<T>::has_infinity?numeric_limits<T>::infinity():(numeric_limits<T>::max()/2);
}

typedef pair<int,int> pii;

#ifdef MY_DEBUG
#include"print.hpp"
#include"debug.hpp"
#endif
// }}}

int main(){
	int A,B;
	cin>>A>>B;
	if(A>=13){
		cout<<B<<endl;
	}else if(A>=6){
		cout<<B/2<<endl;
	}else{
		cout<<0<<endl;
	}
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args)
	{
		try
		{
			Scanner sc = new Scanner(System.in);
			while(sc.hasNext())
			{
				double a = sc.nextDouble();
				double b = sc.nextDouble();
				double c = sc.nextDouble();
				double d = sc.nextDouble();
				double e = sc.nextDouble();
				double f = sc.nextDouble();
					double y = (c*d-f*a)/(b*d-e*a);
					double x = (c*e-b*f)/(e*a-b*d);
						if(x==0)x=0.000;
						if(y==0)y=0.000;
				System.out.printf("%.3f %.3f\n", x, y);
			}
		} catch(Exception ex)
		{
			System.exit(0);
		}
	}
}

Measured memory_bytes: 20488
/*
    ????????°??§???????????¨????????????
*/

#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <limits.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iterator>
#include <vector>
#define LLU unsigned long long int
#define LL long long int
#define LD long double
using namespace std;
#define LLUmax ULLONG_MAX
#define LLmax LLONG_MAX
#define dmax INT_MAX
#define vd vector<int>
#define vLL vector<long long int>
#define vLLU vector<unsigned long long int> 
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
#define debug printf("asd\n")
#define debugd(a) printf("--%d\n",a)
#define debugdd(a,b) printf("--%d %d\n",a,b)
#define debugarr(a,b) for(int i=0 ; i<b ; i++)printf("%d ",a[i]);printf("\n")
#define newline printf("\n")
#define forin(a,b,c) for(int a=b ; a<c ; a++)
#define forde(a,b,c) for(int a=b ; a<c ; a--)


inline void scd(int &a){scanf("%d",&a);}
inline void scdd(int &a,int &b){scanf("%d %d",&a,&b);}
inline void sctd(int &a,int &b,int &c){scanf("%d %d %d",&a,&b,&c);}
inline void scdlld(long int &a,long int &b){scanf("%I64d %I64d",&a,&b);}
inline void sclld(long long int &a){scanf("%I64d",&a);}

#define scarrd(a,b) for(int i=0 ; i<b ; i++)scanf("%d",&a[i])
#define prdlld(a,b) printf("%I64d %I64d",a,b)
#define prdd(a,b) printf("%d %d",a,b)
#define prd(a) printf("%d",a)
#define prarr(a,b) for(int i=0 ; i<b ; i++)printf("%d ",a[i])
#define iniarr(a,b) for(int i=0 ; i<b ;i++)a[i]=0
#define arr(a,b) int *a=(int *)malloc(b*sizeof(int))
#define llarr(a,b) long long int *a=(long long int *)malloc(b*sizeof(long long int))
#define st(a,b) char *a=(char *)malloc(b*sizeof(char))
#define grav 9.8
#define pi 3.14159265

int main()
{
	int s[15],d[15],c[15],h[15];
	iniarr(s,15);
	iniarr(h,15);
	iniarr(c,15);
	iniarr(d,15);
	int a;
	int n;
	scd(n);
	char z;
	forin(i,0,n)
	{
		scanf("\n%c %d",&z,&a);
		//printf("--%c %d\n",z,a);
		if(z=='S')
		s[a]++;
		else if(z=='H')
		h[a]++;
		else if(z=='D')
		d[a]++;
		else if(z=='C')
		c[a]++;
	}
	//debugarr(s,15);
	//debugarr(h,15);
	//debugarr(c,15);
	//debugarr(d,15);
	forin(i,1,14)
	{
		if(s[i]==0)
		printf("S %d\n",i);
	}
	forin(i,1,14)
	{
		if(h[i]==0)
		printf("H %d\n",i);
	}
	forin(i,1,14)
	{
		if(c[i]==0)
		printf("C %d\n",i);
	}
	forin(i,1,14)
	{
		if(d[i]==0)
		printf("D %d\n",i);
	}
	return 0;
}

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<ll,pll> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

ll n;
vl x,y,d,a;

ll f(ll m){
	ll mnx=inf,mxx=-inf,mny=inf,mxy=-inf;
	for(int i=0;i<n;i++){
		ll X=x[i]+dx[d[i]]*m,Y=y[i]+dy[d[i]]*m;
		mnx=min(mnx,X);
		mxx=max(mxx,X);
		mny=min(mny,Y);
		mxy=max(mxy,Y);
	}
	return (mxx-mnx)*(mxy-mny);
}

int main(){
	cin>>n;
	x=y=d=vl(n);
	for(int i=0;i<n;i++){
		char c;
		cin>>x[i]>>y[i]>>c;
		x[i]*=2;
		y[i]*=2;
		if(c=='R') d[i]=1;
		if(c=='D') d[i]=2;
		if(c=='L') d[i]=3;
	}
	a.push_back(inf);
	a.push_back(0);
	for(int i=0;i<4;i++){
		ll A=-inf,B=inf,C=inf;
		for(int j=0;j<n;j++){
			if(d[j]==0) C=min(C,x[j]);
			else if(d[j]==2) A=max(A,x[j]);
			else B=min(B,x[j]);
		}
		if(A<=B) a.push_back(B-A);
		if(B<=C) a.push_back(C-B);
		if(A<=C) a.push_back((C-A)/2);
		for(int j=0;j<n;j++){
			int X=y[j],Y=-x[j];
			x[j]=X;
			y[j]=Y;
			d[j]=(d[j]+1)%4;
		}
	}
	sort(a.begin(),a.end());
	ll N=a.size(),res=INF;
	for(int i=0;i<N-1;i++){
		ll l=a[i],r=a[i+1];
		while(r-l>5){
			ll m1=(r-l)/3+l,m2=(m1+r)/2;
			if(f(m1)<=f(m2)) r=m2;
			else l=m1;
		}
		for(int j=l;j<=r;j++) res=min(res,f(j));
	}
	cout<<syosu(11)<<(double)res/4<<endl;
}

Measured memory_bytes: 2560
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush, heapify
import math
import itertools
import random
 
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
INF = float('inf')
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    A,B = inputMap()
    if A >= 10 or B >= 10:
        print(-1)
        sys.exit()
        
    print(A*B)
    
if __name__ == "__main__":
	main()


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

ac, wa, tle, re = 0, 0, 0, 0

for _ in range(n):
    s = input()
    if s == 'AC':
        ac += 1
    elif s == 'WA':
        wa += 1
    elif s == 'TLE':
        tle += 1
    else:
        re += 1

print('AC x ' + str(ac))
print('WA x ' + str(wa))
print('TLE x ' + str(tle))
print('RE x ' + str(re))

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

/*  using namespace  */
using namespace std;

/*  local var  */

/*  define  */
#define loop(i,j) for(int i = 0; i < j; i++)

/*  typedef  */
typedef long long ll;

/*  function  */
//None

/*  main program  */
int main()
{	
	ll N,D;
	ll ans=0;
	cin>>N>>D;
	D*=2;
	D++;
	cout<<ceil(N*1.0/D*1.0)<<endl;
}



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

using namespace std;

using ll = long long;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s, t;
	cin >> s >> t;
	int n = s.length();
	int m = t.length();
	vector< vector< vector<int> > > dp(n + 1, vector< vector<int> >(m + 1, {0, -1, -1}));

	for (int i = n - 1; i >= 0; i--) {
		for (int j = m - 1; j >= 0; j--) {
			if (s[i] == t[j]) {
				dp[i][j][0] = dp[i + 1][j + 1][0] + 1;
				dp[i][j][1] = i;
				dp[i][j][2] = j;
			} else {
				if (dp[i][j + 1][0] > dp[i + 1][j][0]) {
					dp[i][j] = dp[i][j + 1];
				} else {
					dp[i][j] = dp[i + 1][j];
				}
			}
		}
	}

	int ci = dp[0][0][1], cj = dp[0][0][2];
	while (ci != -1) {
		cout << s[ci];
		int nci = dp[ci + 1][cj + 1][1];
		int ncj = dp[ci + 1][cj + 1][2];
		ci = nci;
		cj = ncj;
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 493184
N = int(input())

MAX = 100
from collections import defaultdict
d = defaultdict(int)
from itertools import product
for x, y, z in product(range(1, 1+MAX), repeat=3):
  t = x*x + y*y + z*z + x*y + y*z + z*x
  d[t] += 1

for i in range(1, N+1):
  print(d[i])


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

int main(){
    ll a,b,ans;
    cin>>a>>b;
    if(a+b==3){
        ans=3;
    }else if(a+b==4){
        ans=2;
    }else{
        ans=1;
    }
    cout<<ans;
}

Measured memory_bytes: 3652
n = int(input())
li = [0]*5
for i in range(n):
    s = input()
    if s[0] == "M":
        li[0] += 1
    elif s[0] == "A":
        li[1] += 1
    elif s[0] == "R":
        li[2] += 1
    elif s[0] == "C":
        li[3] += 1
    elif s[0] == "H":
        li[4] += 1
total = li[0]*li[1]*li[2] + li[0]*li[1]*li[3] + li[0]*li[1]*li[4] + li[0]*li[2]*li[3] + li[0]*li[2]*li[4] + li[0]*li[3]*li[4] + li[1]*li[2]*li[3] + li[1]*li[2]*li[4] + li[1]*li[3]*li[4] + li[2]*li[3]*li[4]
print(total)

Measured memory_bytes: 9252
m=1e9+7,P[2][3333]={1};*p,*q;c,i;f(j){q[j]=*p*!~c+c*p[j];j<i&&f(j+1);q[j]=(1L*q[j]+q[j+1]+m)%m;}main(){for(gets(&c);c=1-getchar(p=P[i%2])%3;f(0))q=P[++i&1];printf("%d",*p);}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, n) for (int i = (n); i >= 0; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1 << 30;
 
int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<int>> g(n);
  rep(i, m) {
      int a, b; cin >> a >> b;
      g[a-1].push_back(b-1);
      g[b-1].push_back(a-1);
  }
  queue<int> p;
  p.push(0);
  vector<int> dist(n,-1);
  dist[0] = 0;

  while (!p.empty())
  {
    int now = p.front(); p.pop();
    for (auto v: g[now]) {
      if (dist[v] >= 0) continue;
      dist[v] = dist[now] + 1;
      p.push(v);
    }
  }
  if (dist[n-1]==2) cout << "POSSIBLE" << endl;
  else cout << "IMPOSSIBLE" << endl;
  return 0;
}

Measured memory_bytes: 16084
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N,sum = 0;
    cin >> N;
    vector<int> A(N+2);
    A[0] = 0;
    A[N+1] = 0;
    for(int i = 1;i < N+1;i ++){
        cin >> A[i];
    }
    for(int i = 1;i < N+2;i ++){
        sum += abs(A[i]-A[i-1]);
    }
    for(int i = 1;i < N+1;i ++){
        if((A[i]-A[i-1])*(A[i+1]-A[i])>0) cout << sum << endl;
        else cout << sum - 2*min(abs(A[i]-A[i-1]),abs(A[i+1]-A[i])) << endl;
    }

    return 0;
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
 
#define ll long long
 
using namespace std;
 
int main(){
  ll n, a, b, x, y;
  cin >> n >> a >> b;
  x = n / ( a + b ) * a;
  y = n % ( a + b );
  x += min( y, a );
  cout << x << "\n";
  return 0;
}

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

if N < 10 :
    print(N)
    exit()

if N < 100 :
    print(9)
    exit()

if N < 1000 :
    print(9 + (N - 99))
    exit()

if N < 10000 :
    print(909)
    exit()

if N < 100000 :
    print(909 + (N - 9999))
    exit()

print(90909)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
using namespace std;

const int R = 26;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	ll n;
	cin >> n;
	vector<int> ans;
	while (n) {
		n--;
		ans.push_back(n%R);
		n /= R;
	}
	reverse(ans.begin(), ans.end());
	for (int x : ans) cout << (char)(x + 'a');
}

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

from math import atan,tan,pi


def max_volume(theta, a, b):
    # 弧度法にする
    theta = (theta / 180) * pi
    if theta < atan(b / a):
        # 半分より上のパターン
        area = (a * b) - ((a * a * tan(theta)) / 2)
    else:
        area = b * (b / tan(theta)) / 2
    return area*a


def main():
    a, b, x = map(int, read().split())
    # ２分探索で角度を探していく
    left = 0
    right = 90

    # 問題条件の誤差が 10 ** -6なので1e-7まで探索
    while right - left > 1e-7:
        mid = (left + right) / 2
        if max_volume(mid, a, b) <= x:
            right = mid
        else:
            left = mid
    answer = (left + right) / 2
    print(answer)



if __name__ == "__main__":
    main()

Measured memory_bytes: 3188
# 写経
# https://atcoder.jp/contests/abc165/submissions/12655073
from bisect import bisect_left, bisect_right
import sys

def resolve():
    input = sys.stdin.readline
    sys.setrecursionlimit(10**9)
    INF = float('inf') 
    N = int(input())
    As = list(map(int, input().split()))
    adjL = [[] for _ in range(N)]
    for _ in range(N-1):
        u, v = map(int, input().split())
        u, v = u-1, v-1
        adjL[u].append(v)
        adjL[v].append(u)
    
    dp = [-INF]
    anss = [0] * N
    def dfs(vNow, vPar):
        A = As[vNow]
        if dp[-1] < A:
            dp.append(A)
            tp = 0
        else:
            i = bisect_left(dp, A)
            tp = 1
            iOld, AOld, = i, dp[i]
            dp[i] = A
        anss[vNow] = len(dp) - 1
    
        for v2 in adjL[vNow]:
            if v2 == vPar: continue
            dfs(v2, vNow)
    
        if tp == 0:
            dp.pop()
        else:
            dp[iOld] = AOld
    
    dfs(0, -1)

    print('\n'.join(map(str, anss)))
resolve()

Measured memory_bytes: 271268
#include<stdio.h>

int main(void)
{
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    while((a==b&&b==c)||!((a==b)||(b==c)||(a==c)))
    {
        scanf("%d%d%d",&a,&b,&c);
    }
    if(a==b)
    {
        printf("%d\n",c);
    }
    else if(b==c)
    {
        printf("%d\n",a);
    }
    else
    {
        printf("%d\n",b);
    }
    return 0;
}

Measured memory_bytes: 128
def prime(p):
    primeFlag = True
    if p == 1:
        primeFlag = False
    for i in range(2,(int(p**0.5)+1)):
        if p%i==0:
            primeFlag = False
            break
    if primeFlag:
        return True
    else:
        return False
    
Q = int(input())

memo = [0]*100001

for i in range(2,100001):
    first = prime(i)
    second = prime((i+1)//2)
    if first and second:
        memo[i] = 1

for i in range(1,100001):
    memo[i] = memo[i-1]+memo[i]

for i in range(Q):
    l,r = map(int,input().split())
    print(memo[r]-memo[l-1])

Measured memory_bytes: 93836
import java.util.Scanner; 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt(), w = sc.nextInt();
		int n = sc.nextInt();
		
		int[] arr = new int[n];
		for(int i=0; i<n; i++)
			arr[i] = sc.nextInt();
		int[][] mat = new int[h][w];
		
		
		
		int ind = 0;
		for(int i=0; i<h; i++) {
			for(int j=0; j<w; j++) {
				if(arr[ind] == 0)ind++;
				arr[ind]--;
				mat[i][i%2==0?j:w-j-1] = ind + 1;
			}
		}
		for(int i=0; i<h; i++) {
			for(int j=0; j<w; j++)
				System.out.print(mat[i][j] + (j!=w-1 ? " ": ""));
			System.out.println("");
		}
	}
}


Measured memory_bytes: 32720
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	int n;
	cin>>n;
	vector<ll> a(n);
	int cnt=0;
	ll sum=0;
	ll mi=inf;
	rep(i,n){
		cin>>a[i];
		if(a[i]<0) cnt++;
		sum+=abs(a[i]);
		chmin(mi,abs(a[i]));
	}
	if(cnt%2) sum-=2*mi;
	cout<<sum<<endl; 
}

Measured memory_bytes: 1024
//
//  main.cpp
//  0118
//
//  Created by 穎川和弘 on 2014/07/16.
//  Copyright (c) 2014年 穎川和弘. All rights reserved.
//

#include <iostream>
using namespace std;

bool board[100][101];
char map[100][101];
int fdx[] = {1, -1, 0, 0};
int fdy[] = {0, 0, -1, 1};
char chr;
int h, w;

void dfs(int x, int y) {
    if(x < 0 || y < 0 || x >= w || y >= h) return;
    if(board[y][x] || map[y][x] != chr) return;
    board[y][x] = true;
    for(int r = 0; r < 4; r++) {
        dfs(x + fdx[r], y + fdy[r]);
    }
}

int main(void) {
    cin.tie();
    ios::sync_with_stdio(false);
    
    while(true) {
        cin >> h >> w;
        if(h + w == 0) break;
        
        for(int r = 0; r < h; r++) {
            for(int c = 0; c < w; c++) {
                cin >> map[r][c];
            }
        }
        for(int r = 0; r < h; r++) {
            for(int c = 0; c < w; c++) {
                board[r][c] = false;
            }
        }
        int count = 0;
        while(true) {
            bool flag = false;
            for(int r = 0; r < h; r++) {
                for(int c = 0; c < w; c++) {
                    if(!board[r][c]) {
                        flag = true;
                        chr = map[r][c];
                        dfs(c, r);
                        count++;
                    }
                    if(flag) break;
                }
                if(flag) break;
            }
            if(!flag) break;
        }
        cout << count << endl;
    }
    return(0);
}

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

int x[10005];


int main()
{
    int a, b, k;
    cin >> a >> b >> k;
    int cnt = 0;
    for(int i = 1; i <= min(a, b); i ++){
      if(a % i == 0 && b % i == 0)
        x[cnt ++] = i;
    }
    printf("%d\n", x[cnt - k]);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<vector<int>> Matrix;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
static const int INF = 2000000000;

int main(){
  int n, m;
  cin >> n >> m;
  int ans = 0;
  vector<ll> a(n);
  ll all_a = 0;
  rep(i, n) {
    cin >> a[i];
    all_a += a[i];
  }

  rep(i, n) {
    ll now = a[i] * 4 * m;
    if (now >= all_a) ans++;
  }
  if (ans >= m) cout << "Yes\n";
  else cout << "No\n";
}


Measured memory_bytes: 256
N = int(input())
A = input().split()

nums = {}

for a in A:
    if a in nums:
        nums[a] += 1
    else:
        nums[a] = 1

pats = {}
for key in nums:
    pats[key] = nums[key] * (nums[key]-1) // 2

sum = 0
for key in pats:
    sum += pats[key]


for a in A:
    if pats[a] == 1:
        print(sum - 1)
    elif pats[a] == 0:
        print(sum)
    else:
        print(sum + (1-nums[a]))


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

int main(void){
    int N,i,j = 0;
    cin >> N;
    
    for(i = 0;i*7 <= N;i++){
        if((N - i*7) % 4 == 0){
            j = 1;
            break;
        }
    }
    if(j == 1)cout << "Yes";
    else cout << "No";
    
    cout << endl;
}

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

const char NL = '\n';
const char SP = ' ';
#define loop(i, a, b) for (int i = a; i < b; i++)

int main () {
    ios_base::sync_with_stdio(false);
    int n, k;
	cin >> n >> k;
	int a[n];
	loop (i, 0, n) {
		cin >> a[i];
	}
	loop (i, k, n) {
		if (a[i] > a[i - k]) {
			cout << "Yes" << NL;
		}
		else {
			cout << "No" << NL;
		}
	}
    return 0;
}

Measured memory_bytes: 4440
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD (1000000007)
#define INF (1e9)
#define INFL (1e18)

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template<class T>using arr=vector<vector<T>>;
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} pr(a[a.size()-1]);}
template<class T>void prarr(arr<T>& a){rep(i, a.size()) if(a[i].empty()) pr(""); else prvec(a[i]);}
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; }

int main()
{
    int n; cin >> n;
    n %= 1000;

    if(n==0) pr(n);
    else pr(1000-n);
    return 0;}

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

int main(void) {
  int N;
  cin >> N;
  vector<long long> A(N);
  multiset<long long> A_set;
  long long A_max = -1;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    A_set.insert(A[i]);
    A_max = max(A_max, A[i]);
  }
  sort(A.begin(), A.end());

  int ans = 0;
  vector<bool> flag(A_max + 2, true);
  for (int i = 0; i < N; i++) {
    if (flag[A[i]]) {
      if (i == N - 1 || A[i] != A[i + 1]) ans++;
      for (int j = A[i]; j < A_max + 2; j += A[i]) {
        flag[j] = false;
      }
    }
  }

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

Measured memory_bytes: 14332
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 

typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
using namespace std;


int main(int argc, char* argv[])
{
    int n;
    scanf("%d", &n);
    vector<int> t(n), a(n);

    int max=0;
    int max_left=0, max_right=-1;
    int i;
    for(i=0; i<n; i++) {
        scanf("%d", &t[i]);
        if(max<t[i]) {
            max=t[i]; max_left=i;
        }
    }
    for(i=0; i<n; i++) {
        scanf("%d", &a[i]);
        if(max==a[i]) max_right=i;
    }
    if(max_right<0 || max_left>max_right) {
        printf("0\n"); return 0;
    }

    ll ans=1;
    for(i=1; i<max_left; i++) {
        if(t[i-1]==t[i]) {
            ans = ans * t[i] %MOD;
        }
    }
    for(i=max_left+1; i<max_right; i++) {
        if(t[i]!=max) {
            printf("0\n"); return 0;
        }
        ans = ans * max %MOD;
    }
    for(i=max_right+1; i<n-1; i++) {
        if(a[i]==a[i+1]) {
            ans = ans * a[i] %MOD;
        }
    }
    printf("%lld\n", ans);

    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+11;
struct Edge{
	int nxt,to,w;
}edge[N<<2];
int dist[N],n,num_edge,head[N],k,ans;
bool vis[N];
void add_edge(int from,int to,int w){
	edge[++num_edge].nxt=head[from];
	edge[num_edge].to=to;
	edge[num_edge].w=w;
	head[from]=num_edge;
}
void spfa(){
	queue<int> Q;
	memset(dist,127/3,sizeof(dist));
//	printf("%d",dist[1]);
	Q.push(1);vis[1]=1;dist[1]=0;
	while(!Q.empty()){
		int u=Q.front();Q.pop();vis[u]=0;
		for(int i=head[u];i;i=edge[i].nxt){
			int v=edge[i].to;
			if(dist[v]>dist[u]+edge[i].w){
				dist[v]=dist[u]+edge[i].w;
				vis[v]=1;
				Q.push(v);
			}
		}
	}
}
int main(){
//	freopen("ex.in","r",stdin);
	scanf("%d",&k);
	for(int i=1;i<k;++i) add_edge(i,(i+1)%k,1);
	for(int i=1;i<k;++i) add_edge(i,(i*10)%k,0);
	spfa();
	printf("%d",dist[0]+1);
	return 0;
}

Measured memory_bytes: 4480
#
N = input().rstrip()

#
ans = sum([int(x) for x in N])
for i in range(len(N)-1):
    A = str(int(N[:-(i+1)]) - 1)
    A += '9'*(i+1)
    #print(A)
    ans = max(ans, sum([int(x) for x in A]))
print(ans)


Measured memory_bytes: 3060
import java.io.*;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        char[] ch = sc.next().toCharArray();
        String ans = "AC";
        
        if (ch[0] != 'A') {
            ans = "WA";
        } else {
            int index = 0;
            for (int i = 1; i < ch.length; i++) {
                if (ch[i] == 'C') {
                    index = i;
                }
            }
            if (!(index >= 2 && index <= ch.length - 2)) ans = "WA";
            for (int i = 1; i < index; i++) {
                if (!(ch[i] >= 97 && ch[i] <= 122)) ans = "WA";
            }
            for (int i = index + 1; i < ch.length; i++) {
                if (!(ch[i] >= 97 && ch[i] <= 122)) ans = "WA";
            }
        }
        
        out.println(ans);
        
        out.flush();
    }
}

Measured memory_bytes: 22228
#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
#define vsort(vec) sort(vec.begin(), vec.end())
#define vreverse(vec) reverse(vec.begin(), vec.end())
using ll =long long;
const ll INF =1001001001;

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

//素数判定
ll isprime(ll n){
  bool prime=true;
  for(int i=2;i<n;i++){
    if(n%i==0){
      prime=false; break;
    }
  }
if(prime){cout<<n<<" is prime"<<endl;
         }else{cout<<n<<" is not prime"<<endl;}

}
//階乗　20くらいが限界
ll factorial(ll n){
  ll a=1;ll b=n;
  for(int i=0;i<n;i++){
    a*=b;
    b--;
  }
  return a;
}

//組み合わせ　nCr
ll comb(ll a,ll b){
  ll c;
  c=factorial(a)/(factorial(a-b)*factorial(b));
  return c; 
}




/*10億7。　　　100000007
2*2行列 H*W
vector<vector<int>> vec(H,vector<int>(W));
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
cin>>vec[i][j];
  }
}

文字列→数列
string S;int A=atoi(S.c_str());
数列→文字列
int A;string S=to_string(A);
数字判定　isdigit(a)
pair宣言　pair<int,int> p(5,7);
ソート　sort(vec.begin(),vec.end());
*/


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

  
  ll N;cin>>N;
  vector<int> vec(N);
  for(int i=0;i<N;i++){
    cin>>vec[i];
  }
  
  bool AP=true;
  for(int i=0;i<N;i++){
    if(vec[i]%2==0){
      if(vec[i]%3!=0&&vec[i]%5!=0){
        AP=false;break;
      }
    }
  }
  if(AP){
    cout<<"APPROVED"<<endl;
  }else{
    cout<<"DENIED"<<endl;
  }
  
  
}




Measured memory_bytes: 256
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.format;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;

alias sread = () => readln.chomp();
alias Point2 = Tuple!(long, "y", long, "x");

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

enum MOD = (10 ^^ 9) + 7;

void main()
{
    long N, K;
    scan(N, K);
    long[10 ^^ 5 + 1] B;
    foreach (_; 0 .. N)
    {
        long a, b;
        scan(a, b);
        B[a] += b;
    }
    long sum;
    foreach (i; 0 .. 10 ^^ 5 + 1)
    {
        sum += B[i];
        if (K <= sum)
        {
            writeln(i);
            return;
        }
    }
}


Measured memory_bytes: 2044
N,C=map(int,input().split())
D=[list(map(int,input().split())) for i in range(C)]
c_=[list(map(int,input().split())) for i in range(N)]
c=[[] for i in range(3)]
for i in range(N):
    for j in range(N):
        k=((i+1)+(j+1))%3
        c[k].append(c_[i][j])
d=[[0]*C for i in range(3)]
for i in range(C):
    for j in range(3):
        for k in range(len(c[j])):
            d[j][i]+=D[c[j][k]-1][i]
ans=10**17
for i in range(C):
    for j in range(C):
        for k in range(C):
            if (i-j)*(j-k)*(k-i)==0:
                continue
            ans=min(ans,d[0][i]+d[1][j]+d[2][k])
print(ans)


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

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> X(M);
    for (int i = 0; i < M; i++) cin >> X[i];
    sort(X.begin(), X.end());

    vector<int> dist(M-1);
    for (int i = 0; i < M-1; i++) dist[i] = X[i+1] - X[i];
    sort(dist.begin(), dist.end());

    long long ret = X[M-1] - X[0];

    for (int i = 0; i < N-1; i++) {
        if (M-2-i < 0) break;
        ret -= dist[M-2-i];
    }

    cout << ret << endl;
    return 0;
}

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

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

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

	int N; char c;
	bool ans = false;

	cin >> N;

	for (int i = 0;i < N;i++){
		cin >> c;
		if(c == 'Y') ans = true;
	}

	if(ans) cout << "Four\n";
	else cout << "Three\n";

	return 0;

}


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

int main(){
//srandom((unsigned long)time(NULL));

long long n;
cin>>n;
//vector<string> s;
map<string,int> mp;
for(long long i=0;i<n;i++){
    string x;
    cin>>x;
    sort(x.begin(),x.end());
    //s.emplace_back(x);
    mp[x]++;
}
long long ans=0;
for(auto& p : mp ){
    int s =p.second;
    ans+= (long long)s*(s-1)/2;

}
cout<<ans<<endl;


return 0;
}

Measured memory_bytes: 11136
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define PI 				acos(-1)
#define mp				make_pair
#define pb				push_back
#define all(a)			(a).begin(), (a).end()
#define sz(a)			a.size()
#define srt(a)			sort(all(a))
#define mem(a, h)		memset(a, (h), sizeof(a))
#define f 				first
#define s 				second
#define MOD1			998244353
#define fore(i, b, e)	for(int i = b; i < e; i++)
#define forg(i, b, e, m)	for(int i = b; i < e; i+=m)
int in(){int r=0,c;for(c=getchar();c<=32;c=getchar());if(c=='-') return -in();for(;c>32;r=(r<<1)+(r<<3)+c-'0',c=getchar());return r;}

using namespace std;
using namespace __gnu_pbds;

typedef long long 		ll;
typedef unsigned long long 		ull;
typedef pair<int, int>  ii;
typedef vector<int>     vi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
const int tam = 100010;
const int MOD = 1e9+7;
const double EPS = 1e-9;

int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	//freopen("qwe.txt", "r", stdin);
	//freopen("asd.txt", "w", stdout);
	int n;
	ll coun[300];
	mem(coun, 0);
	int posi[] = {'M', 'A', 'R', 'C', 'H'};
	string s;
	cin>>n;
	while(n--)
	{
		cin>>s;
		coun[s[0]]++;
	}
	ll res = 0;
	fore(i, 0, 5)
	{
		fore(j, i + 1, 5)
		{
			fore(k, j + 1, 5)
			{
				res += coun[posi[i]] * coun[posi[j]] * coun[posi[k]];
			}
		}
	}
	cout<<res<<'\n';
	return 0;
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?) ARRAY OUT OF BOUNDSS2

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<math.h>
#include <stdio.h>
#include<vector>
#include<stdlib.h>
//#include <algorithm>
#include <limits>
#include<string>
#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll;
using namespace std;
#define llMAX numeric_limits<long long>::max()
#define intMAX numeric_limits<int>::max()
#define ll long long
#define d_5 100000
int main(void){
  int N,k;
  cin >> N >> k;
  ll x[N],y[N];
  rep(i,N){
    cin >> x[i] >> y[i];
  }
  ll maxw,maxh,minw,minh;
  ll minarea;
  ll resultminarea = llMAX;
  for(int a=0;a<N-3;a++){
    for(int b=a+1;b<N-2;b++){
      for(int c=b+1;c<N-1;c++){
        for(int d=c+1;d<N;d++){
          maxh=max(y[a],y[b]);
          maxh=max(maxh,y[c]);
          maxh=max(maxh,y[d]);
          maxw=max(x[a],x[b]);
          maxw=max(maxw,x[c]);
          maxw=max(maxw,x[d]);
          minh=min(y[a],y[b]);
          minh=min(minh,y[c]);
          minh=min(minh,y[d]);
          minw=min(x[a],x[b]);
          minw=min(minw,x[c]);
          minw=min(minw,x[d]);
          minarea=(maxh-minh)*(maxw-minw);
          if(minarea>=resultminarea){
            continue;
          }
          int count=0;
          rep(i,N){
            if(x[i]<=maxw&&x[i]>=minw&&y[i]<=maxh&&y[i]>=minh){
              count+=1;
            }
          }
          if(count>=k){
            resultminarea=minarea;
          }
        }
      }
    }
  }
  for(int a=0;a<N-2;a++){
    for(int b=a+1;b<N-1;b++){
      for(int c=b+1;c<N;c++){
          maxh=max(y[a],y[b]);
          maxh=max(maxh,y[c]);
          maxw=max(x[a],x[b]);
          maxw=max(maxw,x[c]);
          minh=min(y[a],y[b]);
          minh=min(minh,y[c]);
          minw=min(x[a],x[b]);
          minw=min(minw,x[c]);
          minarea=(maxh-minh)*(maxw-minw);
          if(minarea>=resultminarea){
            continue;
          }
          int count=0;
          rep(i,N){
            if(x[i]<=maxw&&x[i]>=minw&&y[i]<=maxh&&y[i]>=minh){
              count+=1;
            }
          }
          if(count>=k){
            resultminarea=minarea;
        }
      }
    }
  }
  for(int a=0;a<N-1;a++){
    for(int b=a+1;b<N;b++){
          maxh=max(y[a],y[b]);
          maxw=max(x[a],x[b]);
          minh=min(y[a],y[b]);
          minw=min(x[a],x[b]);
          minarea=(maxh-minh)*(maxw-minw);
          if(minarea>=resultminarea){
            continue;
          }
          int count=0;
          rep(i,N){
            if(x[i]<=maxw&&x[i]>=minw&&y[i]<=maxh&&y[i]>=minh){
              count+=1;
            }
          }
          if(count>=k){
            resultminarea=minarea;
      }
    }
  }
  cout << resultminarea;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(){
	string S;
	cin >> S;
    int price=700;
	for (int i=0;i<3;i++){
   		if(S.at(i)=='o') {
    		price+=100; 
    	}
    }
  	cout << price << endl;
}


Measured memory_bytes: 256
N=int(input())
D={}
for i in range(1,N+1):
    i=str(i)
    D[(i[0],i[-1])]=D.get((i[0],i[-1]),0)+1
ans=0
for i in range(1,N+1):
    i=str(i)
    ans+=D.get((i[-1],i[0]),0)
print(ans)

Measured memory_bytes: 40428