akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
#define int long long
#define ll long long
//#define int  unsigned long long
#define pb push_back
//#define double long double

using namespace std;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
const int mod = 998244353;
const int N = 650055;
const int K = 700 ;
vector < int > g[N];
int mx[N], ans[N], cnt, cnt2;
void dfs3(int v, int l, int r, int p = -1){
    if (v >= l && v <= r)
        cnt2++;
    if (v > l) l = 0;
    for (auto u: g[v]){
        if (u > r || u == p) continue;
        dfs3(u, l, r, v);
    }
}
void dfs2(int v, int x, int p = -1){
    cnt++;
    for (auto u: g[v]){
        if (u == p || u > x) continue;
        dfs2(u, x, v);
    }
}
void dfs(int v, int p = -1){
    if (p != -1){
        if (v < mx[p] && p > v && p > mx[p]){
            cnt2 = 0;
            dfs3(v, mx[p], p, p);
            ans[v] = ans[p] + cnt2;
        } else
        if (v < mx[p]){
            ans[v] = ans[p];
        } else{
            cnt = 0;
            dfs2(v, max(p, mx[p]), p);
            ans[v] = ans[p] + cnt;
        }
        mx[v] = max(p, mx[p]);
    } else mx[v] = 1;
    for (auto u: g[v]){
        if (u == p) continue;
        dfs(u, v);
    }
}
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
    int n;
    cin >> n;
    for (int i = 1; i < n; i++){
        int u, v;
        cin >> u >> v;
        g[u].pb(v);
        g[v].pb(u);
    }
    dfs(1);
    for (int i = 2; i <= n; i++) cout << ans[i] << " ";
}


Measured memory_bytes: 36352
N = int(input())
l,r=1,N
while r-l>1:
  m=(l+r)//2
  s=m*(m+1)//2
  if s>=N:
    r=m
  else:
    l=m
for i in range(1,r+1):
  if i!=r*(r+1)//2-N:
    print(i)

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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main(){
    int n,m;cin>>n>>m;
    char a[n][m];
    vvi b(n,vi(m,0)),c(n,vi(m,0));
    rep(i,n)rep(j,m)cin>>a[i][j];
    rep(i,n){
        int cnt=0;
        rep(j,m){
            if(a[i][j]=='.'){
                cnt++;
                b[i][j]=cnt;
            }
            else if(a[i][j]=='#'){
                cnt=0;
            }
        }
        for(int j=m-1;j>=1;--j){
            if(b[i][j]>0&&b[i][j-1]>0){
                b[i][j-1]=b[i][j];
            }
        }
    }
    rep(i,m){
        int cnt=0;
        rep(j,n){
            if(a[j][i]=='.'){
                cnt++;
                c[j][i]=cnt;
            }
            else if(a[j][i]=='#'){
                cnt=0;
            }
        }
        for(int j=n-1;j>=1;--j){
            if(c[j][i]>0&&c[j-1][i]>0){
                c[j-1][i]=c[j][i];
            }
        }
    }
    int ans=0;
    rep(i,n){
        rep(j,m){
            ans=max(ans,b[i][j]+c[i][j]-1);
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 35584
#include <iostream>
#include <vector>
#include <cmath>
typedef unsigned long long ll;
using namespace std;


int main(void) {
    int ary[5];
    for (int i = 0; i < 5; i++) cin >> ary[i];
    
    int max_loss = 0;
    int max_loss_idx = 0;
    for (int i = 0; i < 5; i++){
        if((ary[i] % 10 != 0) && (10 - ary[i] % 10) > max_loss){
            max_loss_idx = i;
            max_loss = 10 - ary[i] % 10;
        }
    }

    int ans = 0;
    for (int i = 0; i < 5; i++){
        if (i == max_loss_idx)
            continue;
        if (ary[i] % 10 == 0) {
            ans += ary[i];
        }else{
            ans += ((ary[i]+10) / 10) * 10;
        }
    }
    ans += ary[max_loss_idx];
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 3636
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import bisect
import collections

mod = 998244353
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

def LI(): return list(map(int, sys.stdin.readline().split()))

N = int(input())
D = LI()

if D[0] != 0:
    print(0)
    sys.exit()

if 0 in D[1:]:
    print(0)
    sys.exit()


D.sort()
c = collections.Counter(D)
ans = 1
parents = 1
before = -1
for key in c.keys():
    if before + 1 != key:
        print(0)
        sys.exit()
    ans *= parents**c[key]
    ans = ans % mod
    parents = c[key]
    before = key

print(ans)


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

int n, z, w;
int a[2005];

int x[2005];
int y[2005];

int find_y(int idx);

int find_x(int idx) {
  if (x[idx] != -1) return x[idx];
  int opposite = idx == 0 ? w : a[idx - 1];
  int answer = abs(a[n - 1] - opposite);
  for (int i = idx + 1; i < n; i++) {
    answer = max(answer, find_y(i));
  }
  return (x[idx] = answer);
}

int find_y(int idx) {
  if (y[idx] != -1) return y[idx];
  int opposite = idx == 0 ? z : a[idx - 1];
  int answer = abs(a[n - 1] - opposite);
  for (int i = idx + 1; i < n; i++) {
    answer = min(answer, find_x(i));
  }
  return (y[idx] = answer);
}

int main() {
  memset(x, -1, sizeof(x));
  memset(y, -1, sizeof(y));
  cin >> n >> z >> w;
  for (int ni = 0; ni < n; ni++) {
    cin >> a[ni];
  }
  cout << find_x(0) << endl;
  return 0;
}

Measured memory_bytes: 384
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(10)

using namespace std;

typedef pair<int, int> P;

int H, W, N, sx, sy;
string S, T;

bool solve(int len, int pos, int type) {
    int left = 1;
    int right = len;
    char l = type == 0 ? 'L' : 'U';
    char r = type == 0 ? 'R' : 'D';
    REV(i, N - 1, 0) {
        if (T[i] == l) {
            right = min(right + 1, len);
        } else if (T[i] == r) {
            left = max(left - 1, 1LL);
        }
        if (S[i] == l) {
            left++;
        } else if (S[i] == r) {
            right--;
        }
        if (left > right) return false;
    }
    // return left <= pos && pos <= right;
    if (pos < left || right < pos) return false;
    return true;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    cin >> H >> W >> N >> sx >> sy;
    cin >> S >> T;

    cout << (solve(W, sy, 0) && solve(H, sx, 1) ? "YES" : "NO") << endl;

    return 0;
}


Measured memory_bytes: 1020
n = int(input())
a = map(int, input().split())
b = list(map(int, input().split()))
c = list(map(int, input().split()))
buf = -1
ans = 0
for i in a:
    ans += b[i-1]
    if buf + 1 == i:
        ans += c[buf-1]
    buf = i
print(ans)

Measured memory_bytes: 38384
n = int(input())
d = {}

for i in range(1, n+1):
  start, end = str(i)[0], str(i)[-1]
  d[(start, end)] = d.get((start, end), 0) + 1
count = 0
for key, n_key in d.items():
  count += n_key * d.get(tuple(reversed(key)), 0)
print(count)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
//using namespace std;
#define rep(i,j,n) for(ll i=(ll)(j);i<(ll)(n);i++)
#define REP(i,j,n) for(ll i=(ll)(j);i<=(ll)(n);i++)
#define per(i,j,n) for(ll i=(ll)(j);(ll)(n)<=i;i--)
#define ll long long
#define ALL(a) (a).begin(),(a).end()
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(ll)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(ll)(key)))
#define pb push_back
#define mp std::make_pair
#define endl "\n"
using std::cin;
using std::cout;
using std::vector;
using std::string;
using std::upper_bound;
using std::lower_bound;
using vi=vector<ll>;
using vii=vector<vi>;
using pii=std::pair<ll,ll>;
const ll MOD=1e9+7;
//const ll MOD=998244353;
const ll MAX=500000;
const ll INF=(1ll<<62)-1;
template<class T>
class prique :public std::priority_queue<T, std::vector<T>, std::greater<T>> {};
struct Binary_indexed_tree{
    int N;
    vi bit;
    Binary_indexed_tree(int n):N(n){
        bit.resize(N+1,0);
    }
    void add(int x,int a){
        for(x;x<=N;x+=(x&-x)) bit[x]+=a;
    }
    ll sum(int x){
        ll ret=0;
        for(x;x>0;x-=(x&-x)) ret+=bit[x];
        return ret;
    }
};
ll modpow(ll X,ll Y){
    ll sum=X,cnt=1;
    vi A;
    while(cnt<=Y){
        A.pb(sum);
        sum*=sum;
        sum%=MOD;
        cnt*=2;
    }
    int M=A.size();
    ll ret=1;
    REP(i,1,M){
        if(Y>=(1ll<<M-i)){
            Y-=(1ll<<M-i);
            ret*=A[M-i];
            ret%=MOD;
        }
    }
    return ret;
}
ll fac[MAX],finv[MAX],inv[MAX];
void COMinit(){
    fac[0]=fac[1]=finv[1]=finv[0]=inv[0]=inv[1]=1;
    rep(i,2,MAX){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=modpow(i,MOD-2);
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}
ll COM(ll n,ll r){
    if(n<r||n<0||r<0) return 0;
    return fac[n]*finv[r]%MOD*finv[n-r]%MOD;
}
int ans[MAX];
void dfs(vi &A,vii &Edge,vector<bool> &F,vi &dp,int X){
    ll P=dislow(dp,A[X]);
    ll memo=dp[P];
    dp[P]=A[X];
    ans[X]=dislow(dp,INF)-1;
    rep(i,0,Edge[X].size()){
        int Y=Edge[X][i];
        if(F[Y]){
            F[Y]=0;
            dfs(A,Edge,F,dp,Y);
        }
    }
    dp[P]=memo;
}
signed main(){
    int N; cin>>N;
    string S; cin>>S;
    ll ans=1,cnt=1,memo=0;
    if(S[0]=='W'||S[2*N-1]=='W'){
        cout<<0<<endl;
        return 0;
    }
    rep(i,1,2*N){
        if(S[i]==S[i-1]){
            if(memo==0){
                ans*=cnt;
                ans%=MOD;
                cnt--;
            }
            else{
                cnt++;
            }
            memo=1-memo;
        }
        else{
            if(memo==0){
                cnt++;
            }
            else{
                ans*=cnt;
                ans%=MOD;
                cnt--;
            }
        }
    }
    COMinit();
    if(cnt>0) ans=0;
    ans*=fac[N];
    ans%=MOD;
    cout<<ans<<endl;
}

Measured memory_bytes: 12292
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define END getchar();getchar();return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define inf 1000000007
typedef pair<int, int> P;

int par[110000], Rank[110000], SIZE;
//初期化
void init(int n) {
	for (int i = 0; i < n; i++) {
		par[i] = i;
		Rank[i] = 0;
	}
	SIZE = n;
}
//木の根を求める
int root(int x) {
	if (par[x] == x) {
	return x;
	}
	else return par[x] = root(par[x]);
}
//同じグループにあるか判定
bool same(int x, int y) {
	return root(x) == root(y);
}
//グループを合体する
void unite(int x, int y) {
	x = root(x);
	y = root(y);
	if (x == y) return;
	if (Rank[x] < Rank[y]) {
		par[x] = y;
	}
	else {
		par[y] = x;
	}
	if (Rank[x] == Rank[y]) Rank[x]++;
	SIZE--;
}

signed main() {
	int n, m, ans = 0, a[100], b[100];
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		cin >> a[i] >> b[i];
		a[i]--, b[i]--;
	}
	for (int i = 0; i < m; i++) {
		init(n);
		for (int j = 0; j < m; j++) {
			if (i != j) {
				unite(a[j], b[j]);
			}
		}
		if (SIZE > 1) ans++;
	}
	cout << ans << endl;

	END;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{
	class Program
	{
		static void Main(string[] args)
		{
			string[] str = Console.ReadLine().Split(' ');
			long A = long.Parse(str[0]);
			long B = long.Parse(str[1]);
			long K = A + B;
			if (K % 2 == 1) {
				Console.WriteLine("IMPOSSIBLE");
			}
			else Console.WriteLine(K/2);


		}
	}
}


Measured memory_bytes: 11092
# -*- coding: utf-8 -*-
n = int(input())
a = list(map(int,input().split()))
#nが奇数の場合,0,2,2,4,4,...
#nが偶数の場合,1,1,3,3,...
a.sort()
flag = True
if n %2==1:
    for n,v in enumerate(a):
        if n==0:
            if v != 0:
                flag=False
                break
        else:
            if v!=((n+1)//2)*2:
                flag=False
                break
else:
    for n,v in enumerate(a):
        if v!=(n//2)*2+1:
            flag=False
            break
if flag:
    print(2**(len(a)//2)%(10**9+7))
else:
    print(0)


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

typedef long long ll;
#define pb emplace_back
#define loop(i,s,n) for(ll i=s;i<n;i++)
#define test ll t ; cin>>t; while(t--)

ll n,W;
ll dp[102][100002];

ll knapsack(ll W,ll w[],ll v[],ll n)
{
    if(n==0 ||  W==0)   return 0;
    
    if(dp[n][W]!=-1)    return dp[n][W];
    if(w[n]<=W)  return     dp[n][W]=max(knapsack(W,w,v,n-1),v[n]+knapsack(W-w[n],w,v,n-1));
    else    return  dp[n][W]=knapsack(W,w,v,n-1);
}

int main() {
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	
	ll n,W;
	cin>>n>>W;
	ll w[n+1]={0},v[n+1]={0};
	loop(i,1,n+1)
	{
	    cin>>w[i]>>v[i];
	}
	memset(dp,-1,sizeof(dp));
	ll ans=knapsack(W,w,v,n+1);
	cout<<ans;
	return 0;
}


Measured memory_bytes: 80000
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
int main(void){
    int num_attendance;
    int *rate;
    int kinds_color=0;
    int class[9]={0};

    scanf("%d",&num_attendance);
    rate=(int *)malloc(sizeof(int)*num_attendance);
    int i;
    for(i=0;i<num_attendance;i++){
        scanf("%d",&rate[i]);
        if(rate[i]<=399){
            class[0]++;
        }
        else if(rate[i]<=799){
            class[1]++;
        }
        else if(rate[i]<=1199){
            class[2]++;
        }
        else if(rate[i]<=1599){
            class[3]++;
        }
        else if(rate[i]<=1999){
            class[4]++;
        }
        else if(rate[i]<=2399){
            class[5]++;
        }
        else if(rate[i]<=2799){
            class[6]++;
        }
        else if(rate[i]<=3199){
            class[7]++;
        }
        else if(3200<=rate[i]){
            class[8]++;
        }
    }
    for(i=0;i<8;i++){
        if(class[i]!=0){
            kinds_color++;
        }
    }
    if(kinds_color!=0){
        printf("%d ",kinds_color);
    }
    else{
        printf("1 ");
    }
    kinds_color+=class[8];
    printf("%d",kinds_color);
    return 0;
    
}

Measured memory_bytes: 128
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.run();
    }
    
    int[][] a;
    int n;
    int[] b;

    public void run() {
        // 入力情報取得
        Scanner sc = new Scanner(System.in);
        a = new int[3][3];
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                a[i][j] = sc.nextInt();
            }
        }
        n = sc.nextInt();
        b = new int[n];
        for (int i = 0; i < n; i++) {
            b[i] = sc.nextInt();
        }
        sc.close();

        // 解答処理
        solve();
    }
    
    private void solve() {
        if (check()) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
    
    private boolean check() {
        int[][] res = new int[3][3];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < 3; j++) {
                for (int k = 0; k < 3; k++) {
                    if (b[i] == a[j][k]) {
                        res[j][k] = 1;
                    }
                }
            }
        }
        if (check_row(res) || check_col(res) || check_nnm(res)) {
            return true;
        } else {
            return false;
        }
    }

    private boolean check_row(int[][] res) {
        if (res[0][0] == 1 && res[1][0] == 1 && res[2][0] == 1) {
            return true;
        } else if (res[0][1] == 1 && res[1][1] == 1 && res[2][1] == 1) {
            return true;
        } else if (res[0][2] == 1 && res[1][2] == 1 && res[2][2] == 1) {
            return true;
        } else {
            return false;
        }
    }

    private boolean check_col(int[][] res) {
        if (res[0][0] == 1 && res[0][1] == 1 && res[0][2] == 1) {
            return true;
        } else if (res[1][0] == 1 && res[1][1] == 1 && res[1][2] == 1) {
            return true;
        } else if (res[2][0] == 1 && res[2][1] == 1 && res[2][2] == 1) {
            return true;
        } else {
            return false;
        }
    }
    
    private boolean check_nnm(int[][] res) {
        if (res[0][0] == 1 && res[1][1] == 1 && res[2][2] == 1) {
            return true;
        } else if (res[0][2] == 1 && res[1][1] == 1 && res[2][0] == 1){
            return true;
       } else {
            return false;
        }
    }
}

Measured memory_bytes: 23252
a = []
while(True):
  m, f, r = map(int, input().split())
  if (m==-1)and(f==-1)and(r==-1):
    break
  
  if(m==-1)or(f==-1):
    print("F")
  elif (m+f>=80):
    print("A")
  elif (m+f>=65):
    print("B")
  elif (m+f>=50):
    print("C")
  elif (m+f>=30):
    if(r>=50):
      print("C")
    else:
      print("D")
  else:
    print("F")


Measured memory_bytes: 5596
my ($n, $k) = split / /, <>;
my $s = <>;
chomp $s;

my(@l);

my $c = 0;
my $now = 1;

for(my $i = 0; $i < length $s; $i++){
    if(substr($s, $i, 1) == $now){
        $c++;
    } else {
        push @l, $c;
        $now = 1 - $now;
        $c = 1;
    }
}

push @l, $c;

my $max = 0;

for(my $i = 0; $i < $k * 2 + 1; $i++){
    $max += $l[$i];
}

my $nowx = $max;

for(my $ex = 0, $in = $k * 2 + 1; $in <= $#l; $ex+=2, $in+=2){
    my $newnow = $nowx - $l[$ex] - $l[$ex+1] + $l[$in] + $l[$in+1];
    if($newnow > $max){$max = $newnow;}
    $nowx = $newnow;
}

print $max;


Measured memory_bytes: 3712
N = int(raw_input())
array = map(int, raw_input().split())

num = 0
min_num = array[0]

for i in range(0,N):
    if min_num >= array[i]:
        num += 1
        min_num = array[i]

print num

# num = 0
# flag = 0

# for i in range(N):
#     flag = 1
#     for j in range(i):
#         print i,j
#         if array[i] <= array[j]:
#             print "match"
#             continue
#         else:
#             print "break",array[i] , array[j]
#             flag = 0
#             break
#     if flag == 1:
#         print ":",i
#         num += 1

# print num

# num = N

# for i in range(1,N):
#        if array[i-1] < array[i]:
#            num -= 1

# print num


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

int main()
{
  int n; cin >> n;
  string s; cin >> s;
  int ans = 0;
  for(int i = 2;i < n;i++)
  {
    if(s[i] == 'C'&&s[i - 1] == 'B'&&s[i - 2] == 'A') ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import java.io.*;
public class Main {
    public static void main(String[] args) throws IOException{
        BufferedReader buf=new BufferedReader(new InputStreamReader(System.in));
        int ans=Integer.parseInt(buf.readLine());
        StringBuilder sbu=new StringBuilder();
        int j;
        for(int i=3; i <= ans; i++){
            if(i%3==0){
                sbu.append(" "+i);
            }else{
                j=i;
                while(j!=0){
                    if(j%10==3){
                        sbu.append(" "+i);break;
                    }else{
                        j=j/10;
                    }
                }
            }
        }
        System.out.println(sbu);
    }
}

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

int main() {
    int a;
    cin >> a;
    if(a % 2 == 0) {
        cout << fixed << setprecision(10);
        cout << (double)a / (a * 2) << endl;
    }
    else if(a % 2 == 1) {
        cout << fixed << setprecision(10);
        cout << ((double)a + 1) / (2 * a) << endl;
    }
}

Measured memory_bytes: 256
//大文字->小文字 tolower(),逆はtoupper()
//int a = stoi(c); 文字列をintへ
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; it++) {}
//mapのキー：it->first mapのバリュー：it->second
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//while(N)で回すとき、Nはコピーを作っておく
//小文字に対応する文字コード：S[i] - 'a'
//文字コード→小文字：(char)(数字+'a')
//グラフの距離:隣接行列で扱う
//等価なものに変換する思考
//bool型　初期値はTrue
//島渡りの問題：中間ノードに着目
//配列はvector<>を使う：意味わからないエラーがなくなる。
//背反な事象にちゃんとわける
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

// K進数でのNの桁数
ll dig(ll N, ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// a,bの最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}

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

//nC2の計算
ll C(ll N) {
	return N * (N - 1) / 2;
}

//円周率
const double PI = 3.14159265358979323846;

int main() {
	int N; cin >> N;
	int A = N / 1000;
	int B = (N % 1000) / 100;
	int C = (N % 100) / 10;
	int D = N % 10;

	if (A + B + C + D == 7) {
		cout << A << '+' << B << '+' << C << '+' << D << "=7" << endl;
		return 0;
	}
	if (A - B + C + D == 7) {
		cout << A << '-' << B << '+' << C << '+' << D << "=7" << endl;
		return 0;
	}
	if (A + B - C + D == 7) {
		cout << A << '+' << B << '-' << C << '+' << D << "=7" << endl;
		return 0;
	}
	if (A + B + C - D == 7) {
		cout << A << '+' << B << '+' << C << '-' << D << "=7" << endl;
		return 0;
	}
	if (A - B - C + D == 7) {
		cout << A << '-' << B << '-' << C << '+' << D << "=7" << endl;
		return 0;
	}
	if (A - B + C - D == 7) {
		cout << A << '-' << B << '+' << C << '-' << D << "=7" << endl;
		return 0;
	}
	if (A + B - C - D == 7) {
		cout << A << '+' << B << '-' << C << '-' << D << "=7" << endl;
		return 0;
	}
	if (A - B - C - D == 7) {
		cout << A << '-' << B << '-' << C << '-' << D << "=7" << endl;
		return 0;
	}
}

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

int main() {
 int A,B,K;
 cin >> A >> B >> K;
 
  for(int i=1;i<=K;i++){
    if((i%2) == 1){
      if((A%2) == 0){
      B += (A/2);
      A -= (A/2);
     }else{
      B += ((A-1)/2);
      A -= (A-1)/2;
      A -= 1;
     }
   }else{
      if((B%2) == 0){
      A += (B/2);
      B -= B/2;
    }else{
      A += ((B-1)/2);
      B -= (B-1)/2;
      B -= 1;
    }
   }
  }
  cout << A << " " << B << endl;
  
}

Measured memory_bytes: 256
import java.util.*;
 
public class Main {
  public static void main(String args[]) {
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    
    int[][] weights = new int[n][3];
    
    for (int i = 0; i < n; i++) {
      	for (int j = 0; j < 3; j++) {
          	weights[i][j] = scan.nextInt();
        }
    }
    scan.close();
 
    int result = solve(n, weights);
    System.out.println(result);
  }
  
  private static int solve(int n, int[][] weights){
    int[][] dp = new int[n][3];
    
    dp[0] = weights[0];
    for (int i = 1; i < n; i++) {
      	for (int j = 0; j < 3; j++) {
          int l = 0;
          int r = 1;
          	
          if(j == 0) {
            l = 1;
            r = 2;
          } else if (j == 1) {
            r = 2;
          }
          	
          	dp[i][j] = Math.max(dp[i - 1][l] + weights[i][j],
                dp[i - 1][r] + weights[i][j]);
        }
    }
    return Math.max(dp[n-1][0], Math.max(dp[n-1][1],dp[n-1][2]));
  }
}

Measured memory_bytes: 100640
N, W = map(int, input().split())
wv = [list(map(int, input().split())) for _ in range(N)]

dp = [[0] * (W + 1) for _ in range(N + 1)]

for i in range(N):
    for j in range(W + 1):
        if j + wv[i][0] <= W:
            dp[i + 1][j + wv[i][0]] = max(dp[i][j] + wv[i][1], dp[i][j + wv[i][0]])
        
        dp[i + 1][j] = max(dp[i + 1][j], dp[i][j])

print(dp[N][W])


Measured memory_bytes: 121964
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<stack>
#include<deque>
#include<set>
#include<map>
#include<utility>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

#define rep(i,n) for(int i=0; i<(n); i++)
typedef long long ll;
const int mod=1e9+7;

struct p{
  int up=0, down=0, right=0, left=0;
};

int main(){
  int n, k;
  cin >> n >> k;
  deque<int> deq;
  rep(i,n){
    int tmp;
    cin >> tmp;
    deq.push_back(tmp);
  }
  int ans=0;
  for(int i=0; i<=k && i<=n; i++){
    for(int j=0; i+j<=k && i+j<=n; j++){
      if(!i && !j)
      	continue;
      multiset<int> ms;
      deque<int> d(deq);
      int sum=0;
      rep(k,i){
        int tmp=d.front();
        d.pop_front();
        sum+=tmp;
        ms.insert(tmp); 
      }
      rep(k,j){
      	int tmp=d.back();
      	d.pop_back();
      	sum+=tmp;
      	ms.insert(tmp);
      }
      int cnt=0;
      for(auto itr=ms.begin(); *itr<0; itr++){
        if(cnt == k-i-j)
        	break;
        sum-=*itr;
        cnt++;
      }
      ans=max(ans,sum);
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <utility>
#include <map>
#include <cmath>
#include <string>

using namespace std;

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

    int cnt[27]={0};
    for(int i=0;i<4;i++){
        cnt[s[i]-'A']++;
    }
    int twocount=0;
    for(int i=0;i<27;i++){
        if(cnt[i]==2) twocount++;
    }

    if(twocount==2){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;



class Myon
{
    public Myon() { }
    public static int Main()
    {
        cin = new Scanner();
        new Myon().calc();
        return 0;
    }

    static Scanner cin;

    void calc()
    {
        var X = cin.nextInt();
        var t = cin.nextInt();
        Console.WriteLine(Math.Max(0, X-t));
    }


    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }
}

Measured memory_bytes: 13140
require 'set'
 
class Arrow
  attr_reader :source, :sink, :label

  def initialize(source, sink, label)
    @source = source
    @sink = sink
    @label = label
  end
end

def push(queue, key, value)
  size = queue.size
  index = queue.index{|target, _| target >= key} || size
  return queue[index][1] if index < size && queue[index][0] == key
  
  return nil if index > 0 && !key.start_with?(queue[index - 1][0])
  queue.slice!(index..-1) if index < size && !queue[index][0].start_with?(key)

  queue.insert(index, [key, value])
  value
end

def calc(n, arrows, start, goal)
  ins = Array.new(n){[]}
  arrows.each do |arrow|
    ins[arrow.sink] << arrow.source
  end

  reachable_from = {}
  stack = [goal]
  until stack.empty?
    node = stack.pop
    reachable_from[node] = true
    ins[node].each do |source|
      stack << source unless reachable_from[source]
    end
  end

  return nil unless reachable_from[start]
  arrows.select!{|arrow| reachable_from[arrow.sink]}

  outs = Array.new(n){[]}
  arrows.each do |arrow|
    outs[arrow.source] << arrow
  end

  max = n * arrows.map{|arrow| arrow.label.size}.max

  queue = [['', {start => true}]]
  until queue.empty?
    spell, map = queue.shift
    return spell if map[goal]

    return nil if spell.size > max

    map.each do |node, _|
      outs[node].each do |arrow|
        t = push(queue, spell + arrow.label, {})
        t[arrow.sink] = true if t
      end
    end
  end
  nil
end

loop do
  n, a, s, g = gets.split.map(&:to_i)
  break if n == 0

  arrows = (0...a).map do |i|
    x, y, lab = gets.split
    Arrow.new(x.to_i, y.to_i, lab)
  end

  puts calc(n, arrows, s, g) || 'NO'
end

Measured memory_bytes: 9900
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
// const ll MOD = 1000000007;
// const int INF = 2000000000;

const int A_MAX = 100001;

int N;
int A[A_MAX];

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N;
  for (int i = 0; i < N; i++) {
    int ai;
    cin >> ai;
    A[ai]++;
  }

  int ans = 0;

  for (int i = 2; i < A_MAX; i++) {
    ans = max(ans, A[i - 2] + A[i - 1] + A[i]);
  }

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

Measured memory_bytes: 640
#include <stdio.h>
#include <math.h>
int main()
{
  int a,b;
  char c;
  scanf("%d",&a);
  scanf(" %c",&c);
  scanf("%d",&b);
  while (!((c=='?'))){
    if (c=='+'){
      printf("%d\n",a+b);
    }else if(c=='-'){
      printf("%d\n",a-b);
    }else if(c=='*'){
      printf("%d\n",a*b);
    }else if(c=='/'){
      printf("%d\n",a/b);
    }
    scanf("%d",&a);
    scanf(" %c",&c);
    scanf("%d",&b);
  }



  return 0;
}

Measured memory_bytes: 600
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

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; }

using ll = long long;

ll r;

int main()
{
  std::cin >> r;

  std::cout << r*r << std::endl;

  return 0;
}

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

using namespace std;
using ll = long long;

int main() {
    int N = 0;
    cin >> N;
    vector<int> h(N + 1,0);
    for(int i = 0; i < N; i++) {
        cin >> h.at(i);
    }

    int ans = 0;

    for(int i = 0; i < *max_element(h.begin(), h.end()); i++) {
        for(int j = 1; j < N + 1; j++) {
            if(h.at(j) <= i && h.at(j - 1) > i) {
                ans++;
            }
        }
    }
    cout << ans << endl;

    return 0;
}

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

using ll = long long;

void solve()
{
    for (int x = 1; x <= 100; x++)
    {
        if (x <= 6)
        {
            cout << 1 << endl;
        }
        else if (x <= 11)
        {
            cout << 2 << endl;
        }
        else
        {
            ll ans = x / 11;
            ans *= 2;
            int r = x % 11;
            if (1 <= r && r <= 6)
                ans++;
            else if (7 <= r && r <= 10)
                ans += 2;
            printf("x = %d, ans = %lld\n", x, ans);
        }
    }
}

int main()
{
    ll x;
    cin >> x;

    if (x <= 6)
    {
        cout << 1 << endl;
    }
    else if (x <= 11)
    {
        cout << 2 << endl;
    }
    else
    {
        ll ans = x / 11;
        ans *= 2;
        int r = x % 11;
        if (1 <= r && r <= 6)
            ans++;
        else if (7 <= r && r <= 10)
            ans += 2;
        cout << ans << endl;
    }
    // solve();
    return 0;
}

Measured memory_bytes: 3604
//-------All power is within you,you can do Anything and Everything.---------//
 
    #include <bits/stdc++.h>
    using namespace std;
  
//*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ M $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*//
 
    #define pb push_back
    #define MP make_pair
    #define F first
    #define S second
    #define int long long
    #define fo(i,a,b) for(int i=a;i<b;i++)
    #define rfo(i,b,a) for(int i=b;i>=a;i--)
    #define deb(x) cout<<#x<<" "<<x<<endl;
    #define mem( a, val ) memset(a, val, sizeof( a ) )
    #define deci( x ) cout<<fixed<<setprecision( x );
    #define bitcount( x ) __builtin_popcountll( x )
 
    
    typedef vector<int> vi;
    typedef pair<int,int> pi; 
    
    const int MOD =  1000000007 ;
    const int MAX = 2e6 + 7;
    const int dx[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
    const int dy[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
 
//*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ V $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*//  
    
    int i,j,k,t,n,q,l,r,mid;
    
//*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ F $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*//
    
    int maxi,m,x;
    void solve()
    {
    	cin>>n>>m;
    	maxi=max(n,m);
    	cin>>x;
    	cout<<(x+maxi-1)/maxi<<endl;
        
    }
    
//*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*//
//                          GAME STARTS FROM HERE                            //
 
    int32_t main() 
      {
        
        // int start,stop=clock();
        // cout<<"time:"<<(stop-start)/double(CLOCKS_PER_SEC)*1000<<endl;
        ios_base::sync_with_stdio(0);
        cin.tie(NULL);
        
        // cin>>t;while(t--)
        solve();
        
      return 0;
      }

Measured memory_bytes: 256
// copied by Nurstan Duisengaliev
#include <bits/stdc++.h>
 
#define ll long long
#define all(x) x.begin(), x.end()
#define in insert
#define mp make_pair
#define F first
#define S second
#define ppf pop_front
#define pb push_back
#define ppb pop_back
#define pf push_front
#define pii pair <int, int>
#define boost() ios_base::sync_with_stdio(0), cin.tie(0)
#define sz(x) x.size()
 
using namespace std;
 
const int N = (int)2e5 + 123;
const int mod = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;
pair <int, int> a[N];
void solve () {
	int n;
	cin >> n;
	for (int i = 1; i <= n; i ++) {
		cin >> a[i].F;
		a[i].S = i;
	}
	sort (a + 1, a + n + 1);
	for (int i = 1; i <= n; i ++) cout << a[i].S << " ";
}
 
main () {
//	freopen (".in", "r", stdin);
//	freopen (".out", "w", stdout);
	boost ();
	int TT = 1;
//  cin >> TT;
	while (TT --) {
		solve ();
	}
	return 0;	
}

Measured memory_bytes: 1664
#include<stdio.h>
#include<stdio.h>
//小さい順にソート
long long c[200002];
void merge(int i,int j,long long *s){
  if(i!=j){
    merge(i,(i+j)/2,s);
    merge((i+j)/2+1,j,s);
    int a=i,b=(i+j)/2+1;
    int d;
    for(d=i;d<=j;d++){
      if((i+j)/2<a){
        c[d]=s[b];
        b++;
      }
      else if(j<b){
        c[d]=s[a];
        a++;
      }
      else if(s[a]<s[b]){
        c[d]=s[a];
        a++;
      }
      else{
        c[d]=s[b];
        b++;
      }
    }
    for(d=i;d<=j;d++)
      s[d]=c[d];
  }
}

int main(){
  int n,i;
  scanf("%d",&n);
  int x[n+1] , y[n+1];
  long long a[n+1] , b[n+1];
  for(i = 0; i < n ; i++){
    scanf("%d %d" , &x[i] ,&y[i]);
    a[i] = x[i] + y[i];
    b[i] = x[i] + 1000000000 - y[i];
  }
  merge( 0 , n-1 , a );
  merge( 0 , n-1 , b );
  printf("%lld\n", a[n-1] - a[0] < b[n-1] - b[0] ? b[n-1] - b[0] : a[n-1] - a[0]);
  return 0;
}


Measured memory_bytes: 7976
#include<stdio.h>
int main() {
	int x, y;
	int a, b, c=0;
	scanf("%d %d", &x, &y);
	for (int i = 0; i <= x; i++) {
		if (2 * i + 4 * (x - i) == y) {
			c = 1;
		}
	}
	if (c == 0) {
		printf("No\n");
	}
	else {
		printf("Yes\n");
	}
	return 0;
}

Measured memory_bytes: 1664
import std.stdio;
import std.ascii;
import std.range;
import std.array;
import std.functional;
import std.algorithm;
import std.conv;
import std.container;
import std.math;
import std.numeric;
import std.string;
import std.c.string;
import std.random;
import std.regex;
import std.typecons;

void main() {
    int N;
    string[] s;
    bool input() {
        scanf("%d\n", &N);
        if (N == 0) return false;
        s = new string[N];
        foreach (i; 0 .. N) {
            s[i] = readln.chomp;
        }
        return true;
    }
    void solve() {
        auto G = new int[][26];
        auto rG = new int[][26];
        bool dfs(int[][] g, int a, int b) {
            if (a == b) return true;
            foreach (n; g[a]) {
                if (dfs(g, n, b)) return true;
            }
            return false;
        }
        bool C(in string A, in string B) {
            auto L = min(A.length, B.length);
            if (B.startsWith(A)) return true;
            if (A.startsWith(B)) return false;
            foreach (i; 0 .. L) {
                char a = A[i],
                     b = B[i];
                if (a == b) continue;
                int ai = cast(int)(a - 'a'),
                    bi = cast(int)(b - 'a');
                if (dfs(G, ai, bi)) return true;
                if (dfs(rG, ai, bi)) return false;
                G[ai] ~= bi;
                rG[bi] ~= ai;
                return true;
            }
            return true;
        }
        bool check() {
            foreach (i; 0 .. N - 1) {
                //writeln(s[i], " ", s[i + 1]);
                if (!C(s[i], s[i + 1])) return false;
            }
            return true;
        }
        writeln(check ? "yes" : "no");
        //foreach (L; F) writeln(L.map!((a) => a < 0 ? '?' : a == 0 ? 'x' : 'o'));
    }
    while (input) solve;
}

Measured memory_bytes: 1484
Imports System.Collections.Generic
Imports System.Console
Imports System.Math  
Module Program
    Function divisor(n As Integer) As List(Of Integer)
        Dim res As New List(Of Integer)
        Dim sqrtN As Integer = Math.Sqrt(n)+2
        For i As Integer = 1 To sqrtN
            If (n Mod i) = 0 Then
                res.Add(i)
                If n / i <> i Then
                    res.Add(n / i)
                End If
            End If
        Next
        Return res
    End Function

 	Sub Main()
        Dim input() As String = Console.ReadLine().Split(" ")
        Dim N As Integer = input(0)
        Dim M As Integer  = input(1)
        Dim maxd As Integer = 0
        For Each d As Integer in divisor(M)
            If M / d >= N Then
                maxd = Math.Max(maxd, d)
            End If
        Next
        Console.WriteLine(maxd)
    End Sub
End Module


Measured memory_bytes: 13268
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define PB push_back
#define SP << " " <<

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;

__attribute__((constructor))
void initial(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed <<setprecision(15);
}


int main(void){
	double r;
    cin >> r;
    r = r*2*3.1415926;
    cout << r << endl;
    return 0;
}


Measured memory_bytes: 3808
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int a; cin >> a;
  string s; cin >> s;
  if (a >= 3200) cout << s << '\n';
  else cout << "red" << '\n';
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
//#include<boost/multiprecision/cpp_int.hpp>
//#include<boost/multiprecision/cpp_dec_float.hpp>
//namespace mp=boost::multiprecision;
//#define mulint mp::cpp_int
//#define mulfloat mp::cpp_dec_float_100
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
constexpr int MOD=1000000007;
//constexpr int MOD=998244353;
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcountll(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
#define fi first
#define se second
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};
const int MAX_N=2e5+5;
//struct edge{lint to,num;};

vector<int> edge[MAX_N];
bool reach[MAX_N];
lint ans[MAX_N];

int dfs(int now){
    if(reach[now]) return 0;
    reach[now]=true;
    rep(i,edge[now].size()){
    }
}

lint par[200500]; //MAX_N
lint ufsize[200050]; //MAX_N

void init(lint x){
  rep(i,x) par[i]=i,ufsize[i]=1;
}

lint root(lint x){
  if(par[x]==x) return x;
  else return par[x]=root(par[x]);
}

bool same(lint x,lint y){
  return root(x)==root(y);
}

void unite(lint x,lint y){
  x=root(x);
  y=root(y);
  if(x==y) return;
  lint s=ufsize[x]+ufsize[y];
  ufsize[x]=s,ufsize[y]=s;
  par[x]=y;
}

lint size(lint x){
  return ufsize[root(x)];
}

int main(void){
    int N,M;
    cin >> N >> M;
    int a[M],b[M];
    rep(i,M) cin >> a[i] >> b[i],a[i]--,b[i]--;
    int ans=0;
    rep(i,M){
        init(N);
        rep(j,M) if(i!=j) unite(a[j],b[j]);
        if(size(0)!=N) ans++;
    }
    cout << ans << endl;
}

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

int main(){
    int x,y;

    cin >> x >> y;
    if(x%2 == 0 || y%2 == 0){
        cout << "Even" << endl;
    }
    if(x%2 != 0 && y%2 != 0){
        cout << "Odd" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
import itertools
from functools import *
from itertools import permutations,combinations,groupby
import sys
import bisect
import string
import math
import time
import random
def Golf():
    *a,=map(int,open(0))
def S_():
    return input()
def IS():
    return input().split()
def LS():
    return [i for i in input().split()]
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def NI(n):
    return [int(input()) for i in range(n)]
def NI_(n):
    return [int(input())-1 for i in range(n)]
def StoI():
    return [ord(i)-97 for i in input()]
def ItoS(nn):
    return chr(nn+97)
def LtoS(ls):
    return ''.join([chr(i+97) for i in ls])
def GI(V,E,Directed=False,index=0):
    org_inp=[]
    g=[[] for i in range(n)]
    for i in range(E):
        inp=LI()
        org_inp.append(inp)
        if index==0:
            inp[0]-=1
            inp[1]-=1
        if len(inp)==2:
            a,b=inp
            g[a].append(b)
            if not Directed:
                g[b].append(a)
        elif len(inp)==3:
            a,b,c=inp
            aa=(inp[0],inp[2])
            bb=(inp[1],inp[2])
            g[a].append(bb)
            if not Directed:
                g[b].append(aa)
    return g,org_inp
def GGI(h,w,search=None,replacement_of_found='.',mp_def={'#':1,'.':0}):
#h,w,g,sg=GGI(h,w,search=['S','G'],replacement_of_found='.',mp_def={'#':1,'.':0}) # sample usage
    mp=[1]*(w+2)
    found={}
    for i in range(h):
        s=input()
        for char in search:
            if char in s:
                found[char]=((i+1)*(w+2)+s.index(char)+1)
                mp_def[char]=mp_def[replacement_of_found]
        mp+=[1]+[mp_def[j] for j in s]+[1]
    mp+=[1]*(w+2)
    return h+2,w+2,mp,found
def bit_combination(k,n=2):
    rt=[]
    for tb in range(n**k):
        s=[tb//(n**bt)%n for bt in range(k)]
        rt+=[s]
    return rt
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['YES','NO']

mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
u_alp=string.ascii_uppercase
ts=time.time()
#sys.setrecursionlimit(10**7)
input=lambda: sys.stdin.readline().rstrip()
 
def ran_input():
    import random
    n=random.randint(4,16)
    rmin,rmax=1,10
    a=[random.randint(rmin,rmax) for _ in range(n)]
    return n,a

show_flg=False
show_flg=True

ans=0

n=I()
a=LI()
['APPROVED','DENIED']
k=0
for i in a:
    if i%2==0 and i%3!=0 and i%5!=0:
        k=1
print(['APPROVED','DENIED'][k])




Measured memory_bytes: 39276
A,B = map(int,input().split())

import math
ans=-1

for i in range(1251):#商品の価格の取りうる最大値は1250円
    sval_A=math.floor(i*0.08)#math.floor()は小数点以下切り捨て
    sval_B=math.floor(i*0.10)
    if sval_A == A and sval_B == B:
        ans=i
        break

print(ans)

Measured memory_bytes: 63876
#include "math.h"
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
int main()
{
    long int n;
    long int r1, r2;
    cin >> n;
    r1 = floor((double)n / 1.08);
    r2 = ceil((double)n / 1.08);
    if(n == (long int)floor(r1 * 1.08))
        cout << r1 << endl;
    else if(n == (long int)floor(r2 * 1.08))
    {
        cout << r2 << endl;
    }
    else
        cout << ":(" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#define llint long long
#define inf ((llint)1e18)

using namespace std;

llint n, m, l, Q;
llint G[305][305];

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n >> m >> l;
	llint a, b, c;
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= n; j++){
			if(i == j) G[i][j] = 0;
			else G[i][j] = inf;
		}
	}
	for(int i = 1; i <= m; i++){
		cin >> a >> b >> c;
		G[a][b] = G[b][a] = c;
	}
	
	for(int k = 1; k <= n; k++){
		for(int i = 1; i <= n; i++){
			for(int j = 1; j <= n; j++){
				G[i][j] = min(G[i][j], G[i][k] + G[k][j]);
			}
		}
	}
	
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= n; j++){
			if(i == j) G[i][j] = 0;
			else{
				if(G[i][j] > l) G[i][j] = inf;
				else G[i][j] = 1;
			}
		}
	}
	
	for(int k = 1; k <= n; k++){
		for(int i = 1; i <= n; i++){
			for(int j = 1; j <= n; j++){
				G[i][j] = min(G[i][j], G[i][k] + G[k][j]);
			}
		}
	}
	
	llint s, t;
	cin >> Q;
	for(int q = 0; q < Q; q++){
		cin >> s >> t;
		if(G[s][t] >= inf) cout << -1 << "\n";
		else cout << G[s][t]-1 << "\n";
	}
	flush(cout);
	
	return 0;
}

Measured memory_bytes: 1280