akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cstring>
#include<string>
using namespace std;
int main() {
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		int x;
		cin>>x;
		if(x%2!=0)continue;
		if(x%3&&x%5)return puts("DENIED"),0;
	}
	puts("APPROVED");
	return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
PS = [list(input().split()) for _ in range(M)]

C0 = [0 for _ in range(N + 1)]  # 正答フラグ
C1 = [0 for _ in range(N + 1)]  # WA数

for p, s in PS:
    if C0[int(p)] == 0:
        if s == "AC":
            C0[int(p)] = 1  # 正解フラグを1にする
        else:
            C1[int(p)] += 1  # wa数を増やす


num_ac = sum(C0)
num_wa = sum([i * j for i, j in zip(C0, C1)])

print(num_ac, num_wa)


Measured memory_bytes: 32688
import copy
n,m,x = map(int,input().split())
ca = [0]*n
for i in range(n):
    ca[i] = list(map(int,input().split()))
ans = 10**8

for i in range(1 << n):
    sum = 0
    result = [0]*m
    for j in range(n):
        if (i >> j) & 1 == 1:
            for k in range(m):
                result[k] += ca[j][k+1]
            sum += ca[j][0]
    if min(result) >= x and ans > sum:
        ans = copy.deepcopy(sum)

if ans == 10**8:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 69392
from collections import deque

def main():
    n, p = map(int, input().split())
    q = deque([])
    score = 0
    cnt = 0
    for i in range(n):
        nt = list(map(str, input().split()))
        nt[1] = int(nt[1])
        q.append(nt)
    while q:
        tmp = q.popleft()
        if tmp[1] > p:
            score += p
            tmp[1] -= p
            cnt += 1
            q.append(tmp)       
        else:
            score += tmp[1]
            cnt += 1
            print(tmp[0], score)

if __name__ == '__main__':
    main()


Measured memory_bytes: 14596
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline



def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N] = [int(input_raw[0])]
    input_raw = read_func().strip().split()
    count = 0
    max_H = 0
    H = [int(input_raw[i]) for i in range(N)]
    for i in range(N):
        if H[i] >= max_H:
            count += 1
            max_H = H[i]
    print count


if __name__ == '__main__':
    main()


Measured memory_bytes: 2932
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int Ans = 0;

		for (int i=1; i<=N; i++){
			if (String.valueOf(i).length() % 2 ==  1){
				Ans++;
			}
		}
		System.out.println(Ans);
	}
}

Measured memory_bytes: 28372
#include <iostream>
#include <cmath>
using namespace std;
int main(){
  int n;
  int ans=0;
  cin >> n;
  int x[n];
  int m=0;
  for(int i=0;i<n;i++){
    cin >> x[i];
    if(m<x[i]) m = x[i];
  }
  for(int i=0;i<n;i++) ans+=pow(x[i]-1,2);
  for(int j=1;j<=m;j++){
    int h = 0;
    for(int i=0;i<n;i++) h+=pow(x[i]-j,2);
    if(ans > h) ans = h;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import sys
s=sys.stdin
f=lambda:s.readline()
while 1:
 n=int(f())
 if n==0:break
 d={}
 for _ in[0]*n:
  k,v=f().strip().split()
  d[k]=v
 a=''
 for _ in[0]*int(f()):
  e=f().strip()
  a+=d[e]if e in d else e
 print(a)


Measured memory_bytes: 6476
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int D = input.nextInt();
		int N = input.nextInt();
		if (D==0) {
			if (N<=99) System.out.println(N);
			else System.out.println(101);
		}else if (D==1) {
			if (N<=99) System.out.println(100*N);
			else System.out.println(10100);
		}
		else if (D==2) {
			if (N<=99) System.out.println(10000*N);
			else {
				N++;
				System.out.println(10000*N);
			}
		} 
	}
}

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

using namespace std;
 
#define int1(a) scanf("%d",&a)
#define int2(a,b) scanf("%d %d",&a,&b)
#define int3(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define int4(a,b,c,d) scanf("%d %d %d %d",&a,&b,&c,&d)
 
#define lint1(a) scanf("%lld",&a)
#define lint2(a,b) scanf("%lld %lld",&a,&b)
#define lint3(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define lint4(a,b,c,d) scanf("%lld %lld %lld %lld",&a,&b,&c,&d)
#define lli long long int
 
#define pint(x) printf("%d",x)
#define plint(x) printf("%lld",x)
#define endl '\n'
#define nl printf("\n");
#define ps printf(" "); 
 
#define all(x) x.begin(),x.end()
#define pb push_back
#define Set(a, s) memset(a, s, sizeof (a))
#define mod1 (lli)(1e9 + 7)
#define mod2 (lli)(1e9 + 9)
#define EPS 1e-9

#define fore(i,n) for(int i=n; i>=0; i--)
#define fors(i,a,n) for(int i=a; i<n; i++)
#define fora(i,ele) for(auto i: ele)
 
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
 
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<lli> vli;
 
template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
 
double tick(){static clock_t oldt,newt=clock();double diff=1.0*(newt-oldt)/CLOCKS_PER_SEC;oldt=newt;return diff;}
float roundoff(float val, float p){ return floor(val*pow(10.0,p)+0.5)/pow(10.0,p);}
lli power(lli a, lli b, lli mod){lli x=1,y=a; while(b > 0){if(b&1){x=(x*y)%mod;}y = (y*y)%mod; b /= 2;}return x;}
 
const int INF = 0x3f3f3f3f;
const float pi = 3.14159265;
 
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};
//int dx[]={1,-1,0,0}; int dy[]={0,0,1,-1};
 
lli n,w;
 vector<vli> knap;
vector<vli> dp; 
 
lli go(lli wl, lli idx){
	//trace2(wl,idx);
	if(wl<=0) return 0;
	else if(idx>=n) return 0;
	if(dp[wl][idx]!=0) return dp[wl][idx];
	
	if(wl<knap[idx][0]) return dp[wl][idx] = go(wl,idx+1);
	else return dp[wl][idx] = max(go(wl-knap[idx][0],idx+1)+knap[idx][1], go(wl,idx+1));
	
}


 
int main(void) {
    ios_base::sync_with_stdio(true);
    cin.tie(NULL);
    cout.tie(NULL);
	//srand (time(NULL));
	/*
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
	*/
    // cout<<"Execution time : "<<tick()<<"\n";
    lint2(n,w);
    
    dp.resize(1e5+2);
    
    fors(i,0,1e5+1){
		dp[i].resize(101,0);
	}
   
    
    fors(i,0,n){
		vli arr(2);
		
		int2(arr[0],arr[1]);
		knap.pb(arr);
	}
   
	
	cout<<go(w,0);
    return 0;
}


Measured memory_bytes: 82304
#include <bits/stdc++.h>
using namespace std;
int main() {
	int a, b;
	cin >> a >> b;
	if (b <= -1) {
		if ((b - a + 1) % 2 == 0) {
			cout << "Positive" << endl;
		}
		else cout << "Negative" << endl;
	}
	else if (a >= 1) cout << "Positive" << endl;
	else cout << "Zero" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
//typedef pair<int,int> P;
typedef pair<ll, ll> P;
//typedef pair<int, pair<int, int>> P;
//typedef pair<ll, pair<int, int>> P;
//typedef tuple<int,int,int> T;
ll INFL = 1000000000000000010;//10^18 = 2^60
int INF = 2147483600;//10^9
int INFM =100000000;
ll MOD  = 1000000007;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main(){
    int N;
    cin >> N;
    if(N <= 1199){
        cout << "ABC" << endl;
    }else if(N <= 2799){
        cout << "ARC" << endl;
    }else{
        cout << "AGC" << endl;
    }
    
    
    
}

Measured memory_bytes: 256
#include<stdio.h>
#define NA 100
#define WH 0
#define GA 1
#define BL 2

int n, M[NA][NA];
int color[NA], d[NA], f[NA], tt;

void DfsVisit(int u){
  int v;

  color[u]= GA;
  d[u] = ++tt;

  for(v=0; v<n; v++)
  {
    if(M[u][v] == 0) continue;
    if(color[v] == WH)
    {
      DfsVisit(v);
    }
  }
  color[u]=BL;
  f[u] = ++tt;
}

void Dfs(){
  int u;

  for(u=0; u<n; u++) color[u]=WH;
  tt=0;

  for(u=0; u<n; u++)
  {
    if(color[u] == WH) DfsVisit(u);
  }
  for(u=0; u<n; u++)
  {
    printf("%d %d %d\n", u+1, d[u], f[u]);
  }
}

int main(){
  int u, v, k, i, j;

  scanf("%d", &n);
  for(i=0; i<n; i++){
    for(j=0; j<n; j++) M[i][j]=0;
  }

  for(i=0; i<n; i++)
  {
    scanf("%d %d", &u, &k);
    u--;
    for(j=0; j<k; j++)
    {
      scanf("%d", &v);
      v--;
      M[u][v]=1;
    }
  }

  Dfs();

  return 0;
}



Measured memory_bytes: 2112
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int N = sc.nextInt();
		int[] L = sc.nextIntList(2 * N);
		Arrays.sort(L);
		int ret = 0;
		for (int i = 0; i < 2 * N; i += 2) {
			ret += L[i];
		}
		System.out.println(ret);
	}

}

class FastScanner {
	public static String debug = null;

	private final InputStream in = System.in;
	private int ptr = 0;
	private int buflen = 0;
	private byte[] buffer = new byte[1024];
	private boolean eos = false;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				if (debug != null) {
					buflen = debug.length();
					buffer = debug.getBytes();
					debug = "";
					eos = true;
				} else {
					buflen = in.read(buffer);
				}
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen < 0) {
				eos = true;
				return false;
			} else if (buflen == 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
	}

	public boolean isEOS() {
		return this.eos;
	}

	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		return (int) nextLong();
	}

	public long[] nextLongList(int n) {
		return nextLongTable(1, n)[0];
	}

	public int[] nextIntList(int n) {
		return nextIntTable(1, n)[0];
	}

	public long[][] nextLongTable(int n, int m) {
		long[][] ret = new long[n][m];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				ret[i][j] = nextLong();
			}
		}
		return ret;
	}

	public int[][] nextIntTable(int n, int m) {
		int[][] ret = new int[n][m];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				ret[i][j] = nextInt();
			}
		}
		return ret;
	}
}

Measured memory_bytes: 8016
#include <iostream>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <cmath>
#define INF 100000000000
#define MOD 1000000007
#define ll long long int
//#define int long long int
using namespace std;



int main(){
    string s;
    cin>>s;
    cout<<s[0]<<s.size()-2<<s[s.size()-1]<<endl;



return 0;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
#define ll long long
#define si short int
using namespace std;
#define MOD 1000000007

int main(){
	int N, K;
	cin >> N >> K;
	si arr[N+1];
	ll dp[N+5];

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

	memset(dp, 0, sizeof(dp));
	dp[2] = abs(arr[2]-arr[1]);

	for(int i=3;i<=N;i++){
		ll min_cost = dp[i-1] + abs(arr[i]-arr[i-1]);
		for(int j=1;j<=min(K,i-1)-1;j++){
			min_cost = min(min_cost, dp[i-j-1] + abs(arr[i] - arr[i-j-1]));
		}
		dp[i] += min_cost;
	}

	cout << dp[N];

}

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

using namespace std;

#define int long long
#define ALL(x) (x).begin(),(x).end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

typedef pair<int,int> PI;
typedef pair<int,pair<int,int>> PII;
static const int INF=1010000000000000017LL;
static const double eps=1e-12;
static const double pi=3.14159265358979323846;
static const int dx[4]={1,-1,0,0};
static const int dy[4]={0,0,1,-1};
static const int ddx[8]={1,-1,0,0,1,1,-1,-1};
static const int ddy[8]={0,0,1,-1,1,-1,1,-1};

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

int N;
int A[200005];
vector<int> v;
int ans;

signed main(){
    cin>>N;
    for(int i=0;i<N;++i)cin>>A[i];
    sort(A,A+N,greater<int>());
    if(N<=3){
        for(int i=0;i<N-1;++i)ans+=A[i];
        cout<<ans<<endl;
    }
    else {
        for(int i=0;i<2;++i){
            ans+=A[i];
        }
        for(int i=0;i<3;++i)v.push_back(min(A[i],A[(i+1)%3]));
        int t=3;
        while(t<N){
            vector<int> nv;
            //cout<<ans<<endl;
            for(int i=0;i<v.size();++i){
                if(t+i>=N)break;
                //cout<<v[i]<<endl;
                ans+=v[i];
            }
            for(int i=0;i<v.size();++i){
                if(t+i>=N)break;
                nv.push_back(A[t+i]);
                nv.push_back(A[t+i]);
            }
            t+=v.size();
            v.clear();
            for(int i=0;i<nv.size();++i)v.push_back(nv[i]);
        }
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 8768
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define P pair<ll, ll>
using namespace std;

int main(){
	ll N,M;cin >> N >> M;
	ll ans=0;
	vector<P> A(N);
	rep(i,N){
		cin >> A[i].first >> A[i].second;
	}
	sort(A.begin(),A.end());
	rep(i,N){
		ll X=min(M,A[i].second);

		ans+=X*A[i].first;
		M-=X;
	}
	cout << ans << endl;
}


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

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORTASC(c) sort((c).begin(),(c).end())
#define SORTDESC(c,t) sort((c).begin(),(c).end(), std::greater<t>());
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define VMAX(a) *max_element(ALL(a))
#define VMIN(a) *min_element(ALL(a))
#define OUT(a) cout << (a) << endl;
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double PI  = acos(-1.0);

template <class T, class S>
using umap = std::unordered_map<T, S>;
using ll = long long;
using namespace std;

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

    cin >> a >> b >> k;

    ll ct = 0;

    for (ll i = max(a, b); i > 0; i--){
        if (a%i==0 && b%i==0){
            ct++;
            if (ct == k){
                cout << i << endl;
                return 0;
            }
        }
    }

    return 0;
}

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

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

using namespace std;

signed main(){
  int a[5];
  int N;
  cin >> N;
  cin>>a[0]>>a[1]>>a[2]>>a[3]>>a[4];
 
  sort(a, a+5);
  if((N%a[0])==0){
    cout << ((N/a[0]))+4 << endl;
  }else{
    cout << ((N/a[0])+1)+4 << endl;
  }
  return 0;
}


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

int const N = 1e3 + 7;
int ar[N];
int main()
{
	int n, k; cin >> n >> k;
	for (int i = 0; i < n; ++i)
		cin >> ar[i];
	sort(ar, ar+n);

	int res = 0;
	for (int i = 0; i < k; ++i)
		res += ar[i];
	cout << res << '\n';
	return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define sz(arr) (int)arr.size()
#define all(arr) arr.begin(), arr.end()

using namespace std;

void _cin() {}
template <class Head, class... Tail>
void _cin(Head&& head, Tail&&... tail) {
  cin >> head;
  _cin(forward<Tail>(tail)...);
}

#define Cin(T, ...) \
  T __VA_ARGS__;    \
  _cin(__VA_ARGS__)

int main() {
  Cin(int, a, b);

  cout << (max({a + b, a - b, a * b})) << endl;

  return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
edge = [list(map(int, input().split())) for _ in range(M)]
INF = 10 ** 9
g = [[INF] * (N + 1) for _ in range(N + 1)]
for i in range(1, N + 1):
    g[i][i] = 0
for a, b, c in edge:
    g[a][b] = c
    g[b][a] = c
for k in range(1, N + 1):
    for i in range(1, N + 1):
        for j in range(1, N + 1):
            g[i][j] = min(g[i][j], g[i][k] + g[k][j])

ans = 0
for a, b, c in edge:
    if g[a][b] != c:
        ans += 1
print(ans)

Measured memory_bytes: 3568
N,W=map(int,input().split())
w=[]
v=[]
for i in range(N):
    a,b=map(int,input().split())
    w.append(a)
    v.append(b)
dp=[[10**22]*(N*(10**3)+1) for i in range(N+1)]
dp[0][0]=0
for i in range(1,N+1):
    for j in range(N*(10**3)+1):
        if j>=v[i-1]:
            dp[i][j]=min(dp[i-1][j-v[i-1]]+w[i-1],dp[i-1][j])
        else:
            dp[i][j]=dp[i-1][j]
for i in range(N*(10**3),-1,-1):
    if dp[N][i]<=W:
        print(i)
        break


Measured memory_bytes: 145032
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define int long long
#define all(a) a.begin(), a.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    int n = s.size(), ans = INF;
    rep(i, 0, n - 2){
        string t = s.substr(i, 3);
        int tmp = stoi(t);
        chmin(ans, abs(753 - tmp));
    }
    cout << ans << endl;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

#define print(a) {for(auto xxxxx : (a)) cout << xxxxx << ' '; cout << '\n';}
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

ll next(){ll x; cin >> x; return x;}
const int maxn = 1e5 + 3, intf = 2e9;
const ll inf = 2e18, mod = 998244353;
const ld eps = 1e-6;


void solve(){
	string s; cin >> s;
	int M = 2019;
	vector <int> cnt(M , 0);
	ll ans = 0;
	for (int i = 0; i < s.size(); i ++){
		int x = s[i] - '0';
		vector <int> c(M , 0);
		for (int j = 0; j < M; j ++){
			c[(j*10 + x) % M] += cnt[j];
		}
		c[x]++;

		ans += c[0];

		swap(c , cnt);
	}

	cout << ans;
}


signed main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cout.precision(20);
    
    for (int t = 1; t--;) {
    	solve();
    }

	return 0;
}
/*


*/



Measured memory_bytes: 3784
N = int(input())
A = list(map(int, input().split()))

ANS = 'APPROVED'
for i in range(len(A)):
    if A[i] % 2 == 0:
        if A[i] % 3 == 0 or A[i] % 5 == 0:
            pass
        else:
            ANS = 'DENIED'

print(ANS)

Measured memory_bytes: 3060
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>

using namespace std;


int main()
{
	int n, m;
	cin >> n;
	string s;
	map<string, int> q;
	for (int i = 0; i < n; i++)
	{
		cin >> s;
		if (q.count(s) == 0)
			q[s] = 1;
		else
			q[s] += 1;
	}
	cin >> m;
	string t;
	for (int i = 0; i < m; i++)
	{
		cin >> t;
		if (q.count(t) == 0)
			q[t] = -1;
		else
			q[t] -= 1;
	}
	int mx = 0;
	map<string, int>::iterator it;
	for (it = q.begin(); it != q.end(); it++)
	{
		mx = max(mx, it->second);
	}
	cout << mx << endl;
}



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

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 main() {
  string s;
  cin >> s;
  if(s[2] == s[3] && s[4] == s[5]) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define MOD 1000000007
#define INF 1 << 30

using namespace std;
typedef long long ll;

int main(void) {
	int a, num, k, i, ans = 0;
	cin >> num >> k;
	for (i = 0; i < num; i++) {
		cin >> a;
		if (a >= k)
			ans++;
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define pb push_back
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef priority_queue<ll> PQI;
typedef priority_queue<P> PQP;
typedef vector<vector<P>> pvec;
typedef vector<vector<ll>> vvec;
typedef vector<ll> vec;
const vector<int> dx = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> dy = {1, 0, -1, 0, 1, -1, 1, -1};
const int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30);
const int INF = (1LL << 60);
const double EPS = (1 >> 30);
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}



signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);
    //---------------------------------------------
    
    int n;
    cin>>n;
    vector<int> a(n);
    REP(i,n) cin >> a[i];
    reverse(all(a));
    rep(i,n){
        cout<<a[i];
        if(i!=n-1) cout<<" ";
    }
    cout<<endl;
}


Measured memory_bytes: 3140
#include <bits/stdc++.h>
#define inf 1000000007
#define mod 1000000007
//#pragma GCC optimize(2)
//#define int long long
using namespace std;
int n,h[100005];
signed main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	ios::sync_with_stdio(false);
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>h[i];
	int ans=0,cnt=0;
	for(int i=1;i<=n;i++)
		if(i==1||h[i]<=h[i-1])
			cnt++;
		else
		{
			ans=max(ans,cnt);
			cnt=1;
		}
	ans=max(ans,cnt);
	cout<<ans-1<<endl;
	return 0;
}


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

using namespace std;

#define FOR(i,n) for(int i=0; i<n; ++i)
#define FORR(i,a,n) for(int i=a; i<n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

const int INF = 0x3f3f3f3f;

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<int,int> PI;
typedef pair<ll,ll> PL;
 
//int in() { int x; scanf("%d", &x); return x; }
//ll lin() { ll x; scanf("%lld", &x); return x; }
//void printfv(VI a){ int n = a.size(); FOR(i, n) cout << a[i] << " "; }


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

    ll n;
    cin >> n;

    string s;
    while(0 < n){
    	n--;
    	s += 'a' + (n%26);
    	n /= 26;
    }

    reverse(ALL(s));
    cout << s;

    return 0;
}


Measured memory_bytes: 3632
def main():
    class unionfind():
        # size:要素数,tree：unionfind木
        def __init__(self, size):  # self,要素数
            self.size = size
            self.tree_root = list(range(self.size))
            self.tree_depth = [1]*self.size
            self.tree_size = [1]*self.size

        # rootを探す
        def root(self, index):
            temp_list = []
            temp = self.tree_root[index]
            while index != temp:
                temp_list.append(index)
                index = temp
                temp = self.tree_root[index]
            for i in temp_list:
                self.tree_root[i] = index
            return index

        # 結合
        def unite(self, index1, index2):
            r1 = self.root(index1)
            r2 = self.root(index2)
            if r1 != r2:
                d1, d2 = self.tree_depth[r1], self.tree_depth[r2]
                if d1 <= d2:
                    self.tree_root[r1] = r2
                    self.tree_depth[r2] = max(d1+1, d2)
                    self.tree_size[r2] += self.tree_size[r1]
                else:
                    self.tree_root[r2] = r1
                    self.tree_depth[r1] = max(d2+1, d1)
                    self.tree_size[r1] += self.tree_size[r2]

        # 同じか判定
        def same(self, index1, index2):
            r1 = self.root(index1)
            r2 = self.root(index2)
            return r1 == r2

    n, m, k = map(int, input().split())
    ab = [list(map(int, input().split())) for _ in [0]*m]
    cd = [list(map(int, input().split())) for _ in [0]*k]
    u = unionfind(n)

    for a, b in ab:
        u.unite(a-1, b-1)

    friend = [u.tree_size[u.root(i)]-1 for i in range(n)]

    for a, b in ab:
        friend[a-1] -= 1
        friend[b-1] -= 1
    for c, d in cd:
        if u.same(c-1, d-1):
            friend[c-1] -= 1
            friend[d-1] -= 1
    print(*friend)


main()


Measured memory_bytes: 60560
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int n;
long long ans = 0, a = 0, mx;
signed main(){
    cin >> n;
    for(int i = 1; i <= n; ++i){
        cin >> a;

        if(a >= mx) {
            mx = a;
        }else{
            ans += (mx-a);
        } 
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,w;
    cin>>n>>w;
    long long wt[n+1], v[n+1];
    for(int i=0;i<n;i++)
    {
        cin>>wt[i];
        cin>>v[i];
    }
    long long val[n+1][w+1];
    
    for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=w;j++)
        {
            if(i==0||j==0){
            val[i][j]=0;
            }
            else if(j>=wt[i-1])
            {
                val[i][j] = max(v[i-1]+val[i-1][j-wt[i-1]],val[i-1][j]);
            }
            else
            {
                val[i][j] = val[i-1][j];
            }
            
        }
    }
    // for(int i=0;i<=n;i++)
    // {
    //     for(int j=0;j<=w;j++)
    //     {
    //         cout<<val[i][j]<<" ";
    //     }
    //     cout<<endl;
    // }
    cout<<val[n][w]<<endl;
}

Measured memory_bytes: 79104
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<map>
using namespace std;
typedef long long int ll;
 
ll gcd(ll a, ll b){
    if (b == 0) return a;

    return gcd(b, a % b);
}

int main(){
    int N, K;
    cin >> N >> K;

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

    ll ans_sum = 0;
    ll sum = 0;
    for(int i = 0; i <= N-K; i++){
        if(i == 0) for(int j = 0; j < K; j++) sum += p[j];
        else{
            sum += p[i + K - 1];
            sum -= p[i - 1];
        }

        if(sum > ans_sum) ans_sum = sum;
    }

    printf("%f", ((float)ans_sum / 2.0 + K * (float)0.5));
}

Measured memory_bytes: 1024
<?php
$n=trim(fgets(STDIN));
$a=explode(" ",trim(fgets(STDIN)));
$i=0;
while($i<$n){
  if($a[$i]%2==0){
    if($a[$i]%3!=0&&$a[$i]%5!=0){
      echo "DENIED";
      exit;
    }
  }
  ++$i;
}
echo "APPROVED";

Measured memory_bytes: 4728
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
/*
 execution in cmd of windows:
 
 
  g++ p1.cpp -o p1
  
  
  p1
 
 */
typedef double dd;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define nl <<"\n"
#define con continue
#define br break
#define vll vector<ll>
#define vpll vector<pair<ll,ll> >
ll mx=INT_MAX;
ll mi=INT_MIN;
#define mem0(a)         memset(a,0,sizeof(a))
#define mem1(a)         memset(a,-1,sizeof(a))
#define all(v) v.begin(), v.end()
#define fsort(v) sort(all(v))  
#define rsort(v) sort(v.rbegin(),v.rend())
#define rev(v) reverse(all(v))
#define maxc(v) max_element(all(v))
#define minc(v) min_element(all(v))
#define sumv(v,x) accumulate(v.begin(),v.end(),x);
const ll mod = 998244353;
const ll inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3fLL;
#define io { ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0); }
#define cer cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
#define cs ll t;cin>>t;while(t--)


int main()
{
        io;
        //////////////////////////////////
        
        ll n,i,j,s=0;
        cin>>n;
        vector<string> vs(n);
        vll v(4,0);
        for(i=0;i<n;i++)
        {
        	cin>>vs[i];
        	if(vs[i][0]=='A') v[0]++;
        	if(vs[i][0]=='W') v[1]++;
        	if(vs[i][0]=='T') v[2]++;
        	if(vs[i][0]=='R') v[3]++;
        }

        cout<<"AC x " <<v[0] nl<<"WA x "<<v[1] nl<<"TLE x "<<v[2] nl<<"RE x "<<v[3];
    	//////////////////////////////////
        cer;
}


Measured memory_bytes: 6364
#!/usr/bin/env python
# coding: utf-8

def main():
    A, B, C, D, E, F = [int(x) for x in input().split()]
    max_rate = E / (100 + E)
    best_weight, best_suger, best_rate = A*100, 0, 0.0
    for a in range(F//100 +1):
        for b in range((F-a*A)//100 + 1):
            water = (a*A+b*B)*100
            if water > F:
                continue
            for c in range((F-water)//C + 1):
                d = min((F - water - c*C) // D, int((E*water-100*c*C) / (100*D)))
                if d < 0:
                    continue
                suger = c*C + d*D
                if water + suger > F:
                    continue
                if water + suger == 0:
                    rate = 0.0
                else:
                    rate = suger / (water + suger)
                if rate > max_rate:
                    continue
                if rate > best_rate:
                    best_weight = water + suger
                    best_suger = suger
                    best_rate = rate
    print(best_weight, best_suger)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>
#include <set>
#include <map>
#include <iomanip>
#include <cassert>
#include <functional>
#include <cstring>

using namespace std;

typedef pair<int, int> P;
#define mp make_pair
#define FOR(i, a, b) for(int (i)=a;(i)<(b);++(i))
#define rep(i, n)  FOR(i,0,n)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort((v).begin(), (v).end());					//小さい順
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());		//大きい順
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define all(c) (c).begin(),(c).end()
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define Print(p) cout<<(p)<<endl
#define F first
#define S second
#define pb1 push_back
#define mod 1000000007LL
#define INF 1234567890

const int maxn = 2e5 + 10;


//initialization here
//

//
//initialization finish


// your function is here
//



//
// your function finished



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

	// your code is here
	//
	int n; cin >> n;
	Print(n*(n + 1) / 2);


	//
	// your code finished

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <array>
#include <cmath>
#include <iterator>
#include <utility>
#include <set>
#include <random>
#include <map>
#include <stack>
#include <queue>
#include <list>

using namespace std;

int main() {
    int n, k, x, y;
    cin >> n >> k >> x >> y;
    if (n <= k)
    {
        cout << n*x << endl;
    }
    else
    {
        cout << k*x + (n - k)*y << endl;
    }

}

Measured memory_bytes: 256
a, b = map(int, input().split())

positive = "Positive"
negative = "Negative"
zero = "Zero"

if a > 0 and b > 0:
    print(positive)
elif (a <= 0 and b >= 0) or (a >= 0 and b <= 0):
    print(zero)
else:
    if (b - a) % 2:
        print(positive)
    else:
        print(negative)


Measured memory_bytes: 3060
#include <stdio.h>
const int MOD=1e9+7;
int main(){
    int n,k;
    long long int ans=1;
    scanf("%d%d",&n,&k);
    if(n>k)printf("0\n");
    else {
        for(int i=0;i<n;i++){
            ans*=k-i;
            ans%=MOD;
        }
        printf("%lld\n",ans);
        
    }
}


Measured memory_bytes: 2752
#include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
#include <tuple>

using namespace std;

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

long long int INF = 1e18;
long long int mod = 1000000007;
double Pi = 3.1415926535897932384626;

vector<ll> G[500005];
vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop

int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "RULD";
//↓,→,↑,←

#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<x;
#define re(i,n) for(i=0;i<n;i++);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define deba(x) cout<< #x << " = " << x <<endl

ll rui(ll number1,ll number2){
    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){
    if(number1 > number2){
        swap(number1 , number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1 , number1);
    }
}

ll  fact[400000];
ll rfact[400000];

ll minverse(ll x) {
    return rui(x, mod-2);
}
 
void c3_init(){
    fact[0]  = rfact[0] = 1;
    for(ll i=1; i<400000; i++){
        fact[i] = (fact[i-1]*i) % mod;
        rfact[i] = minverse(fact[i]);
    }
}

ll c3(ll n, ll abc){
    return (((fact[n] * rfact[abc])%mod) * rfact[n-abc])%mod;
}

ll solve(ll h,ll w){
	return c3(h+w-2,w-1)%mod;
}

ll i,j,k,ii,jj;
ll n,m;
ll a,b,c,d,e,g,h,r,w;
ll l,ans,sum;
ll num;
ll x[500005],y[500005],z[500005];
bool dame,flag,ok;

int main(){
	cin >> h >> w >> a >> b;
	ans = 0;
	c3_init();
	for(i=1;i<=h-a;i++){
		ans += (solve(i,b) * solve(h+1-i,w-b)) % mod;
		ans %= mod;
		//p(ans);
	}
	p(ans);



    return 0;
}

Measured memory_bytes: 31488
from collections import deque

[N, M] = [ int(x) for x in input().split() ]

G = dict()
for i in range(1,N+1):
    G[i] = set()

for i in range(M):
    [A,B] = [ int(x) for x in input().split() ]
    G[A].add(B)
    G[B].add(A)

ans = dict()

Q = deque([1])
visited = set()
while Q:
    room = Q.popleft()
    
    if room not in visited:
        visited.add(room)
        
        for r in G[room]:
            if r not in ans:
                ans[r] = room
            Q.append(r)
for i in range(2, N+1):
    if i not in ans:
        print('No')
        exit()

ans[1] = 'Yes'
for i in range(1, N+1):
    print(ans[i])

Measured memory_bytes: 82188
h,w = gets.chomp.split.map(&:to_i)

map = []
h.times do
  map.push gets.chomp
end

h.times do |i|
  w.times do |j|
    next if map[i][j] == '.'
    next if i > 0 && map[i-1][j] == '#'
    next if i < h-1 && map[i+1][j] == '#'
    next if j > 0 && map[i][j-1] == '#'
    next if j < w-1 && map[i][j+1] == '#'
    puts "No"
    exit
  end
end

puts "Yes"


Measured memory_bytes: 1788
#include<bits/stdc++.h>
#include <math.h>
#include<iostream>
#include <string>
using namespace std;
typedef long long ll;
#define pb pushback
#define fr(i,n) for(int i=0;i<n;i++)
#define ifr(i,n) for(int i=n-1;i>=0;i--)

int main() {
    int n,k;
	cin >> n>>k;
    if((n-1)*(n-2)/2<k){cout << -1 << endl;}
    else{
      int m =(n-1)*(n-2)/2-k+n-1;
      cout << m << endl;
      fr(i,n-1){
        cout << 1 <<" "<<i+2<< endl;
      }
      int x=(n-1)*(n-2)/2-k;
      int y=0;
      for(int i =2;i<n+1;i++){
        for(int j=i+1;j<n+1;j++){
          if(y==x)break;
          cout << i <<" "<<j <<endl;
          y++;
        }
      }
   }
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<string>
#include<string.h>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>
#include<stack>
#include<set>
#include<climits>
#include<deque>
#include<tuple>
#include<iomanip>
using namespace std;
#define int                  int64_t
#define double               long double
#define vi                   vector<int>
#define di                   deque<int>
#define si                   set<int>
#define vpii                 vector<pair<int,int>>
#define pi                   pair<int,int>
#define pub                  push_back
#define puf                  push_front
#define pob                  pop_back
#define pof                  pop_front
#define all(a)               (a).begin(),(a).end()
#define rall(a)              (a).rbegin(),(a).rend()
#define PI                   3.1415926535897932384626433832795
#define read(a)              for(auto& x:a) cin>>x
#define speak(a)             for(auto x:a) cout<<x<<' '
#define rep(i,s,n)           for(int i=s;i<n;++i)
#define repe(i,s,n)          for(int i=s;i<=n;++i)
#define repr(i,n,s)          for(int i=n;i>=s;--i)
#define endl                 '\n'
#define gap                  ' '
#define MAX                  LLONG_MAX
#define MIN                  LLONG_MIN
#define min3(a,b,c)          min(a, min(b, c))
#define max3(a,b,c)          max(a, max(b, c))
#define MOD                  1000000007
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;cin>>n;
    int a[n],c=0;read(a);
    rep(i,1,n-1)
    {
        if(a[i]>a[i-1] and a[i]<a[i+1]) c++;
        else if(a[i]>a[i+1] and a[i]<a[i-1]) c++;
    }
    cout<<c;
}


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

int main(){
  string s;
  cin >> s;
  int a;
  int amin=999;
  for(int i=0;i<s.size()-2;i++){
    a=(s[i]-'0')*100+(s[i+1]-'0')*10+(s[i+2]-'0');
    amin=min(amin,abs(753-a));
     
  }
  cout << amin << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>
#include <climits>
#include <iterator>
#include <iomanip>
#include <stack>
#include <set>
#include <cstdio>
#include <bitset>
#include <functional>
#include <tuple>
#include <list>
#include <deque>
using namespace std;
const constexpr int INF = 1e9;
typedef pair<int, int> P;

#define FOR(i, a, n) for (ll i = (ll)a; i<(ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)

typedef long long ll;
typedef vector<int> VI;
const constexpr ll MOD = 1e9 + 7;
const int BITSIZE = 100010;

struct Less{
    bool operator()(const pair<int, int>& x, const pair<int, int>& y) const {
        return x.first < y.first;
    }
};
struct More {
	bool operator()(const pair<int, int>& x, const pair<int, int>& y) const {
		return x.first > y.first;
	}
};

int GCD(int a, int b){
    if(a<b) swap(a, b);
    if(b==0) return a;
    return GCD(b, a%b);
}
//1-indexed
int bit[100010];

int bit_query(int i) {
	int res = 0;
	for (; i >= 1; i -= i & -i) res = max(res, bit[i]);
	return res;
}

void bit_set(int x, int v) {
	for (; x <= BITSIZE; x += x & -x) {
		bit[x] = max(bit[x], v);
	}
}

ll pow_mod(ll a, ll b){
    ll sum =1;
    while(b>0){
        if(b&1){
            sum *= a%MOD;
        }
        a = a* a%MOD;
        b >>= 1;
    }
    return sum;
}


vector<ll> v1, v2;

map<ll, ll> a;
map<ll, ll> b;
int main() {
    cin.tie(0);
   	ios::sync_with_stdio(false);
    int n; cin >> n;
    REP(i, n) {
        int m; cin >> m;
        if(i%2==0){
            v1.push_back(m); //偶数番目 0indexed
        }else{
            v2.push_back(m); //奇数番目
        }
    }     
    
    REP(i, v1.size()){
        a[v1[i]]++;
    }
    REP(i, v2.size()){
        b[v2[i]]++;
    }
    
    ll t=0;
    
    ll maxidx1=0;
    ll maxV1=0;
    ll subm1=0;
    for(auto it=a.begin(); it!=a.end(); ++it){
        if((*it).second>maxV1){
            subm1 = maxV1;
            maxidx1 = (*it).first;
            maxV1 = (*it).second;
        }
    }
    ll maxidx2=0;
    ll maxV2=0;
    ll subm2=0;
    
    for(auto it=b.begin(); it!=b.end(); ++it){
        if((*it).second>maxV2&&(*it).first!=maxidx1){
            subm2 = maxV2;
            maxidx2 = (*it).first;
            maxV2 = (*it).second;
        }
    }
    t=n-maxV1-maxV2;
    
    maxidx1=0;
    maxV1=0;
    subm1=0;
    for(auto it=b.begin(); it!=b.end(); ++it){
        if((*it).second>maxV1){
            subm1 = maxV1;
            maxidx1 = (*it).first;
            maxV1 = (*it).second;
        }
    }
    maxidx2=0;
    maxV2=0;
    subm2=0;
    
    for(auto it=a.begin(); it!=a.end(); ++it){
        if((*it).second>maxV2&&(*it).first!=maxidx1){
            subm2 = maxV2;
            maxidx2 = (*it).first;
            maxV2 = (*it).second;
        }
    }
    
    cout << min(t, n-maxV1-maxV2) << endl;
	return 0;
}

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

class Program
    {
        static void Main(string[] args)
        {
            //?????°??????
            string[] get_numdata;
            var num_table =new List<List<int>>();            
            var tmp_numlist= new List<int>();
            var sum_list = new List<int>();
            int[] tmp_numtable;
            int get_column, get_line;
            int tmp_sum;


            //??£??\
            get_numdata =Console.ReadLine().Split();
            get_column = int.Parse(get_numdata[0]);
            get_line = int.Parse(get_numdata[1]);
            tmp_numtable = new int[get_line];

            for(int column = 0; column < get_column; column++)
            {
                get_numdata=Console.ReadLine().Split();
                tmp_numtable = get_numdata.Select(s => int.Parse(s)).ToArray();
                foreach (int add_num in tmp_numtable)
                {
                    tmp_numlist.Add(add_num);
                }
                num_table.Add(tmp_numlist);
                tmp_numlist = new List<int>();                        
            }

            //????¨???????
            for (int column = 0; column < get_column; column++)
            {
                tmp_sum = num_table[column].Sum();
                num_table[column].Add(tmp_sum);
            }

            for (int line = 0; line <= get_line; line++)
            {
                tmp_sum = 0;
                for (int column = 0; column< get_column; column++)
                {
                    tmp_sum += num_table[column][line];
                }
                sum_list.Add(tmp_sum);
            }
            num_table.Add(sum_list);

            //????????????
            for (int column = 0; column <= get_column; column++)
            {
                for (int line = 0; line <= get_line; line++)
                {
                    if (line == 0) Console.Write(num_table[column][line]);

                    else Console.Write(" {0}", num_table[column][line]);

                }
                Console.WriteLine();
            }
            Console.Read();
        }
    }

Measured memory_bytes: 10020
def a_xor_circle(N, A):
    """
    N枚の帽子のそれぞれには整数 a_i が書かれている。
    円環状に並んだN頭のラクダのそれぞれに1枚ずつ帽子を被せたい。
    どのラクダについても以下の条件が成立するような帽子の被せ方が存在するか判定せよ。
    ・両隣のラクダが被っている帽子に書かれた数のbitwise-xorが自身の被る帽子の値と等しい

    条件より、x_{i+1} = x_i ^ x_{i+2} で、両辺に x_{i+1} との排他的論理和を取ると
    x_i ^ x_{i+1} ^ x_{i+2} = 0 が成立する。同じことをして、
    x_{i+1} ^ x_{i+2} ^ x_{i+3} = 0 が成立する。この2つの式の両辺それぞれ
    排他的論理和を取ると、 x_i ^ x_{i+3} = 0 すなわち x_i = x_{i+3} である。
    だから、以下の場合、条件を満たす被せ方がある。
    ・全部の帽子の数が0 (この場合、ラクダの数は関係ない)
    ・xが書かれた帽子 : 0が書かれた帽子 = 2 : 1 (x, x, 0 を並べる)
    ・x^y^z=0 となる相異なる3整数が 1:1:1 の割合 (x, y, z を並べる)
    """
    from collections import Counter
    num_count = Counter(A)
    if len(num_count) == 1:
        # 1種類の数が0かどうか調べればいい
        return 'Yes' if num_count[0] != 0 else 'No'
    elif len(num_count) == 2:
        # 帽子の値が「xと0」の2種類になっているか、その割合が2:1になっているか
        count_zero = 0
        for k, v in num_count.items():
            if k == 0:
                count_zero = v
            else:
                count_other = v
        return 'Yes' if count_other == 2 * count_zero else 'No'
    elif len(num_count) == 3:
        # 3つの値がxorを取って0になるか、それらの割合が1:1:1になっているか
        x, y, z = num_count.keys()
        count_x, count_y, count_z = num_count.values()
        cond = (x ^ y ^ z == 0, count_x == count_y and count_y == count_z)
        return 'Yes' if all(cond) else 'No'
    return 'No'

N = int(input())
A = [int(i) for i in input().split()]
print(a_xor_circle(N, A))

Measured memory_bytes: 14116
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)
#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI (3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>void tf(bool b,S t,T f){if(b)puta(t);else puta(f);}
void YN(bool b){tf(b,"YES","NO");}
void Yn(bool b){tf(b,"Yes","No");}
void yn(bool b){tf(b,"yes","no");}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1;for(auto s:t){os<<(a?"":" ")<<s;a=0;}return os;}
template<class S>auto&operator>>(istream&is,vector<S>&t){for(S&a:t)cin>>a;return is;}

/*他のライブラリを入れる場所*/


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    rep(i,10001){
        ll d=n-i*100;
        if(0<=d and d<=5*i){puta(1);return 0;}
    }
    puta(0);
    return 0;
}

Measured memory_bytes: 256