akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <deque>
#include <queue>
#include <cassert>
#include <stack>
#include <iomanip>
#include <utility>
#include <math.h>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;



int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin >> s;
    char c = s[s.size() - 1];
        if (c == '2' || c == '4' || c == '5' || c == '7' || c == '9' ) {
            cout << "hon";
        }
        if (c == '0' || c == '1' || c == '6' || c == '8') {
            cout << "pon";
        }
        if (c == '3') {
            cout << "bon";
        }

}

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

using namespace std;
using ll = long long;

int main() {
  ll N;
  cin >> N;
  vector<vector<ll>> A(N,vector<ll>(N-1));
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < N - 1; ++j) {
      cin >> A[i][j];
    }
  }
  vector<ll> done(N,0);
  vector<ll> next_candidate(N, 1);
  vector<bool> fight(N,false);
  ll n=0;
  ll day = 1;
  while(true){
    vector<ll> candidate;
    for (int i = 0; i < N; ++i) {
      if(done[i]<N-1 && next_candidate[i]==day)
        candidate.push_back(i);
    }
    bool con=false;
    for (auto i:candidate) {
      if(fight[i]) {
        next_candidate[i]++;
        continue;
      }
      ll enemy=A[i][done[i]]-1;
      if(i==A[enemy][done[enemy]]-1 && !fight[enemy]){
        fight[i]=true;
        fight[enemy]=true;
        done[i]++;
        if(done[i]>=N-1)
          n++;
        done[enemy]++;
        if(done[enemy]>=N-1)
          n++;
        con=true;
        next_candidate[i]++;
      }else{
        ll d = distance(A[enemy].begin()+done[enemy],find(A[enemy].begin()+done[enemy],A[enemy].end(),i+1));
        next_candidate[i]=day+d+1;
      }
    }
    if(!con){
      cout << -1 << endl;
      return 0;
    }
    if(n==N)
      break;
    fill(fight.begin(),fight.end(),false);
    day++;
  }
  cout << day << endl;
}


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

int main() {
    int c, n;
    cin >> c >> n;
    vector<string> p(n);
    for(int i = 0; i < n; ++i) {
        cin >> p[i];
    }
    int incorrect = 0;
    for(int i = 0; i < n / 2; ++i) {
        for(int j = 0; j < n / 2; ++j) {
            incorrect += p[i][j] != p[i][n - j - 1] || p[i][j] != p[n - i - 1][j];
        }
    }

    int ans = incorrect == 0;
    for(int i = 0; i < c - 1; ++i) {
        int d; cin >> d;
        for(int j = 0; j < d; ++j) {
            int r, c; cin >> r >> c;
            r--; c--;
            if(p[n - r - 1][c] == p[r][c] && p[r][c] == p[r][n - c - 1]) incorrect += 1;
            p[r][c] = (p[r][c] == '0') ? '1' : '0';
            if(p[n - r - 1][c] == p[r][c] && p[r][c] == p[r][n - c - 1]) incorrect -= 1;
        }
        ans += incorrect == 0;
    }

    cout << ans << endl;
}



Measured memory_bytes: 3912
if __name__=="__main__":
    n, k = map(int, input().split())
    p = [int(x) for x in input().split()] 

    e = []
    esum = 0.0
    for i in range(k):
        e1 = float(p[i]+1.0)/2.0
        e.append(e1)
        esum += e1

    esum_prev = esum
    esum_max = esum

    for i in range(k,n):
        e1 = float(p[i]+1.0)/2.0
        e.append(e1)
        esum = esum_prev - e[i-k] + e1
        esum_max = max(esum_max, esum)
        esum_prev = esum  

    print(esum_max)

Measured memory_bytes: 25188
#include "stdio.h"


int main(){
	int i,max1 = 0,max2 = 0,max3 = 0;
	int Hill[10];
	for(i = 0;i < 10;i++){
		scanf("%d",&Hill[i]);
	}
	for(i = 0;i < 10;i++){
		if(max1 < Hill[i]){
			max3 = max2;
			max2 = max1;
			max1 = Hill[i];
		}
		else if(max2 < Hill[i]){
			max3 = max2;
			max2 = Hill[i];
		}
		else if(max3 < Hill[i])max3 = Hill[i];
	}
	printf("%d\n%d\n%d\n",max1,max2,max3);
}

Measured memory_bytes: 1028
#include "bits/stdc++.h"
using namespace std;

// GNU C Compiler
//template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

// type
using ll = int_fast64_t;
using ull = uint_fast64_t;
using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
//using pair<T1, T2> = p12;

//container
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())
#define ALL(v) v.begin(),v.end()

//repetition
#define REP(n) for(int i=0; i<(n); i++)
#define REPj(n) for(int j=0; j<(n); j++)
#define REPinit(i,a,n) for(int i=(a); i<(n); i++)
#define REPinitj(j,a,n) for(int j=(a); j<(n); j++)

//algorithm
//#define SORT(c) sort((c).begin(),(c).end())

//constant

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//Optimizer
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

/* 
	add utility Algorithm
*/

int main(int argc, char const *argv[])
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int N;
    cin >> N;

    string S;
    cin >> S;

    char prevColor = S[0];
    int ans = 1;

    REPinit(i, 1, N) {
        if (prevColor != S[i]) {
            ans++;
            prevColor = S[i];
        }
    }

    cout << ans << endl;

    return 0;
}


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

using namespace std;
#define ll long long
#define pb push_back
#define eb emplace_back
#define all(vr) vr.begin(),vr.end()
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fi first
#define se second
#define mp make_pair
const int N=1e5+10;

int main()
{
    //freopen("ss.inp","r",stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    cout<<(1000-n%1000)%1000;
    return 0;
}


Measured memory_bytes: 3608
#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
    int i,j;
    for(i = 1; i <= 9; i ++)
    { 
		for(j = 1; j <= 9; j ++)
		{
			printf("%dx%d=%d\n",i,j,i*j); 
		}
	}  
    return 0;
}

Measured memory_bytes: 1096
N=int(input())
numbers=[]
for _ in range(N):
    a,b,c=input().split()
    numbers.append([int(a),int(b),int(c)])
dp = [[0 for i in range(3)] for j in range(N+1)]
def chmax(a,b):
    if a>=b:
        return a
    else:
        return b
for i in range(1,N+1):
    for j in range(3):
        K=[a for a in range(3) if a!=j]
        for k in K:
            dp[i][k]=chmax(dp[i][k],dp[i-1][j]+numbers[i-1][k])
print(max(dp[-1]))


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

int main(){
	int n;
	scanf("%d", &n);
	int ans = 0;
	for (int i = 0, l, r; i < n; ++ i){
		scanf("%d%d", &l, &r);
		ans += r - l + 1;
	}
	return printf("%d\n", ans), 0;
}

Measured memory_bytes: 256
import numpy as np
N, K = list(map(int, input().split()))
A = np.array(list(map(int, input().split()))) - 1
mem = {}

c = 0 # 現在の場所
cK = 0 # 現在の回数
flg = True
mem[c] = 0
for k in range(1, K+1):
    c = A[c] # k回目の移動先
    if c in mem:
        T = k - mem[c]
        cK = k
        flg = False
        break
    mem[c] = k

if flg:
    print(c+1)
else:
    iterN = int(np.mod(int(K - cK), int(T)))
    for i in range(iterN):
        c = A[c]
    print(c+1)

Measured memory_bytes: 51056
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define IT iterator
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
#define debug puts("wzpakking")
#define y1 ysghysgsygsh
using namespace std;

int main(){
	int h1,m1,h2,m2,k;
	scanf("%d%d%d%d%d",&h1,&m1,&h2,&m2,&k);
	printf("%d\n",h2*60+m2-h1*60-m1-k);
}

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

typedef long long ll;

const int maxn = 110, maxw = 1e5 + 5;
int N, W, v[maxn], w[maxn];
ll dp[maxn][maxw];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    cin >> N >> W;
    for (int i = 1; i <= N; i++) {
        cin >> w[i] >> v[i];
    }
    for (int i = 1; i <= N; i++) {
        for (int j = 0; j <= W; j++) {
            dp[i][j] = dp[i - 1][j];
            if (j < w[i]) {
                continue;
            }
            dp[i][j] = max(dp[i][j], v[i] + dp[i - 1][j - w[i]]);
        }
    }
    cout << dp[N][W];

    return 0;
}

Measured memory_bytes: 81780
/**
*
* Author: Mouhanad
* Lang: GNU C++14
*
**/
#include<bits/stdc++.h>
using namespace std;

#define F first
#define S second
#define ii pair < int , int >
#define LS pair < ll , string >
typedef long long ll;
const int inf = 1<<30;
const int N =100100;
ll n , a[N] , q ;
ll chek ( ll st ){
bool sol = 1;
ll R = st ;
for ( int i = n; i >= 1 ; i-- ){

   st = (st+a[i]-1)/a[i] *a[i] ;
   R = (R/a[i])*a[i]+a[i]-1LL;
  if ( st > R ) sol = 0 ;
 }
if ( sol ) return printf("%lld %lld", st , R ), 0;
return -1 ;
}
int main ( ){

 scanf("%lld",&n);
 for  ( int i = 1 ; i <= n ;i++ ) scanf("%lld",a+i);
/* if ( a[n] != 2 ) {
    printf("-1");
    return 0;
 }*/
 bool sol =1 ;

 ll st = chek(2);
 if ( st != -1 ){
    return 0 ;
 }

 printf("-1");

return 0 ;
}


Measured memory_bytes: 1024
/* UserName - ankit_S
  author -Ankit kumar
*/

#include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long 
const ll int MOD=1e9+7;

int main()
{
    FAST
    ll int n;
    cin>> n;
    vector<ll int> arr(n);
    for(int i=0;i<n;i++){
    	cin>> arr[i];
   	}
    ll int dp[n][n][2];
    ll int ans=0;
    for(int len=1;len<=n;len++){
        for(int i=0;i<n;i++){
            int j=len+i-1;
            if(j>=i && j<n){
                if(i==j){
                    dp[i][j][0]=arr[i];
                    dp[i][j][1]=0;
                }
                else{
                    ll int x=arr[i]+dp[i+1][j][1];
                    ll int y=arr[j]+dp[i][j-1][1];
                    //cout<<x<<" "<< y<<" "<<len<<i<<" "<<j<<" "<< endl;
                    dp[i][j][0]=max(x,y);
                    ans=max(ans,dp[i][j][0]);
                    if(dp[i][j][0]==x)dp[i][j][1]=dp[i+1][j][0];
                    else dp[i][j][1]=dp[i][j-1][0];
                }
            }
        }
    }
    cout<<dp[0][n-1][0] -dp[0][n-1][1]<<endl;
    return 0;
}


Measured memory_bytes: 85356
#!/usr/bin/env python

n, m = map(int, input().split())
a = [0 for _ in range(m)]
b = [0 for _ in range(m)]
for i in range(m):
    a[i], b[i] = map(int, input().split())
    a[i] -= 1
    b[i] -= 1

class UnionFind():
    def __init__(self, n): 
        self.n = n 
        self.par = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]
        self.sizes = [1 for _ in range(n)]

    def root(self, x): 
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.root(self.par[x]) # 圧縮経路
            return self.par[x]
            # return root(par[x]) # 圧縮しない場合

    def same(self, x, y): 
        return self.root(x) == self.root(y)

    def unite(self, x, y): 
        rx = self.root(x)
        ry = self.root(y)
        if rx == ry: 
            return

        # par[rx] = ry # naiveな連結

        # 低い木を高い方にくっつける。
        if self.rank[rx] < self.rank[ry]:
            self.par[rx] = ry
            self.sizes[ry] += self.sizes[rx]
        else:
            self.par[ry] = rx
            self.sizes[rx] += self.sizes[ry]

        # rx木とry木の高さが同じならば、rx木を深くする。
        if self.rank[rx] == self.rank[ry]:
            self.rank[rx] += 1

    def size(self, x): 
        '''
        xが属するグループのサイズを返す
        (連結成分の大きさ)
        '''
        return self.sizes[self.root(x)]

    def roots(self):
        '''
        全ての頂点の根のlistを返す   
        '''
        return [self.root(i) for i in range(self.n)]

    def connected(self):
        ''' 
        連結成分の数を返す
        '''
        #return len(set(self.par))
        return len(set(self.roots()))

uf = UnionFind(n)
for i in range(m):
    uf.unite(a[i], b[i])

ans = uf.connected()-1
print(ans)


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

using namespace std;


void solve() {
    long long X; cin >> X;

    long long money = 100;

    long long year = 0;
    while (money < X) {
        money *= 1.01;
        year++;
    }

    cout << year << endl;
}


int main() {
    solve();
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
constexpr lint MOD = 1000000007;

lint power(lint x, lint n)
{
    lint ans = 1;
    while (n)
    {
        if (n & 1) (ans *= x) %= MOD;
        (x *= x) %= MOD;
       n >>= 1;
    }
   return ans;
}

lint solve(lint H, lint W)
{
    return (power(2, H) + power(2, W) + power(2, __gcd(H, W)) - 3 + MOD) % MOD;
}

int main()
{
    lint H, W, T;
    cin >> H >> W >> T;
    lint ret = solve(H / __gcd(H, T), W / __gcd(W, T));
    cout << power(ret, __gcd(H, T) * __gcd(W, T)) << endl;
}


Measured memory_bytes: 256
/*  -*- coding: utf-8 -*-
 *
 * b.cc: B - Power Socket
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

/* typedef */

/* global variables */

/* subroutines */

/* main */

int main() {
  int a, b;
  scanf("%d%d", &a, &b);

  printf("%d\n", ((b - 1) + (a - 2)) / (a - 1));
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

struct Node {
  int number;
  int parent = -1;
  int sibling = -1;
  int left_child;
  int right_child;
  int degree;
  int depth;
  int height;
  string type;
};

std::vector<Node> nodes;

void check_parent() {
  for (Node node : nodes) {
    if (node.left_child != -1) {
      nodes[node.left_child].parent = node.number;
    }
    if (node.right_child != -1) {
      nodes[node.right_child].parent = node.number;
    }
  }
}

void check_sibling() {
  for (Node node : nodes) {
    if (node.parent == -1) {
      continue;
    }
    Node pn = nodes[node.parent]; // parent node
    if (pn.left_child == node.number) {
      nodes[node.number].sibling = pn.right_child;
    } else if (pn.right_child == node.number) {
      nodes[node.number].sibling = pn.left_child;
    } else {
      nodes[node.number].sibling = -1;
    }
  }
}

void check_degree() {
  for (Node node : nodes) {
    int cnt = 0;
    if (node.right_child != -1) {
      cnt++;
    }
    if (node.left_child != -1) {
      cnt++;
    }

    nodes[node.number].degree = cnt;
  }
}

void check_depth_height() {
  for (Node node : nodes) {
    int parent = node.parent;
    int depth = 0;
    while (parent != -1) {
      depth++;
      if (depth > nodes[parent].height) {
        nodes[parent].height = depth;
      }
      parent = nodes[parent].parent;
    }
    nodes[node.number].depth = depth;
  }
}

void check_type() {
  for (Node node : nodes) {
    if (node.parent == -1) {
      nodes[node.number].type = "root";
    } else if (node.left_child == -1 && node.right_child == -1) {
      nodes[node.number].type = "leaf";
    } else {
      nodes[node.number].type = "internal node";
    }
  }
}

void sort_node() {
  sort(nodes.begin(), nodes.end(),
       [](const Node &x, const Node &y) { return x.number < y.number; });
}

int main() {
  // input
  int n;
  cin >> n;

  // nodeをn個入力
  rep(i, n) {
    Node node;
    cin >> node.number;
    cin >> node.left_child;
    cin >> node.right_child;
    nodes.push_back(node);
  }

  // process
  sort_node();
  // for (Node node : nodes) {
  //   std::cout << "left: " << node.left_child << " right :" <<
  //   node.right_child
  //             << '\n';
  // }
  check_parent();
  check_sibling();
  check_degree();
  check_depth_height();
  check_type();

  // output
  for (Node node : nodes) {
    std::cout << "node " << node.number << ": parent = " << node.parent
              << ", sibling = " << node.sibling << ", degree = " << node.degree
              << ", depth = " << node.depth << ", height = " << node.height
              << ", " << node.type << endl;
  }

  return 0;
}



Measured memory_bytes: 3200
#include<bits/stdc++.h>
#define re register
int mod,fac[210],inv[210],f[210];
int main()
{
	re int n,k,ans=0;
	scanf("%d%d%d",&n,&k,&mod);
	fac[0]=1;
	for(re int i=1;i<=n;i++)fac[i]=1ll*i*fac[i-1]%mod;
	inv[1]=1;
	for(re int i=2;i<=n;i++)inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod;
	for(re int i=n-k-1;i<n;i++)
	{
		re int k1=k-(n-i-1);
		for(re int i1=std::max(1,i-k1);i1<i&&i1<=k1;i1++)
		{
			re int i2=i-i1;
			memset(f,0,sizeof(f));
			for(re int i=0;i<i2;i++)if(i2-i<=k1&&i+i1<=k1)f[i]=1;
			for(re int i=1;i<i1;i++)
			{
				for(re int j=0;j<=i2;j++)
				{
					f[j+1]=(f[j]+f[j+1])%mod;
					if(!(i2-j+i<=k1&&j+i1-i<=k1))f[j]=0;
				}
			}
			for(re int j=0;j<=i2;j++)ans=(ans+1ll*inv[i+1]*f[j])%mod;
		//	printf("****%d %d %d %lld\n",i,i1,i2,1ll*ans*fac[n]%mod);
		}
	}
	if(k==n-1)ans++;
	ans=1ll*ans*fac[n]%mod;
	printf("%d\n",ans);
}

Measured memory_bytes: 3804
import java.util.*;
import java.io.PrintWriter;

public class Main{
	static int[] c=new int[26];
	static int[] lastD=new int[26];
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		long startTime = System.currentTimeMillis();
		Random rd=new Random();
		Random rc=new Random();
		Random prob=new Random();
		int d=sc.nextInt();
		for(int i=0; i<26; i++){
			c[i]=sc.nextInt();
		}
		int[][] s=new int[d][26];
		for(int i=0; i<d; i++){
			for(int j=0; j<26; j++){
				s[i][j]=sc.nextInt();
			}
		}
		int maxSati=-1000000;
		int maxInd=-1;
		int[] ans=new int[d];
		TreeSet<Integer>[] memo=new TreeSet[26];
		for(int i=0; i<26; i++){
			memo[i]=new TreeSet<>();
			memo[i].add(0);
			memo[i].add(d+1);
		}
		//j:何日目
		long endSati=0;
		for(int j=0; j<d; j++){
			//i:どの大会をやるか
			for(int i=1; i<=26; i++){
				int sati=0;
				sati+=s[j][i-1];
				sati-=subSati(j+1,i-1);
				if(maxSati<sati){
					maxSati=sati;
					maxInd=i;
				}
			}
			ans[j]=maxInd;
			memo[maxInd-1].add(j+1);
			lastD[maxInd-1]=j+1;
			endSati+=maxSati;
			maxSati=-1000000;
			maxInd=-1;
		}
		double T0=2e3;
		double T1=6e2;
		double TL=1800;
		double T=T0;
		long endTime=0;
		long count=0;
		while(endTime-startTime<1800){
			count++;
			if(count%100==0){
				double time=(endTime-startTime)/TL;
				if(time>=1){
					break;
				}
				T=Math.pow(T0,1-time)*Math.pow(T1,time);
			}
			int tmpd=rd.nextInt(d)+1;
			int tmpc=rc.nextInt(26)+1;
			long oldSati=endSati;
			endSati-=s[tmpd-1][ans[tmpd-1]-1];
			endSati+=s[tmpd-1][tmpc-1];
			endSati-=c[ans[tmpd-1]-1]*(tmpd-memo[ans[tmpd-1]-1].lower(tmpd))*(memo[ans[tmpd-1]-1].higher(tmpd)-tmpd);
			endSati+=c[tmpc-1]*(tmpd-memo[tmpc-1].lower(tmpd))*(memo[tmpc-1].higher(tmpd)-tmpd);
			if(oldSati<endSati || prob.nextDouble()<=Math.pow(Math.E,(endSati-oldSati)/T)){
				memo[ans[tmpd-1]-1].remove(tmpd);
				memo[tmpc-1].add(tmpd);
				ans[tmpd-1]=tmpc;
			}else{
				endSati=oldSati;
			}
			endTime = System.currentTimeMillis();
		}
		PrintWriter pw=new PrintWriter(System.out);
		for(int i:ans){
			pw.println(i);
		}
		pw.flush();
	}
	static int subSati(int d,int ii){
		int ret=0;
		for(int i=0; i<26; i++){
			if(i==ii) continue;
			ret+=c[i]*(d-lastD[i]);
		}
		return ret;
	}
	
}


Measured memory_bytes: 66740
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define pb push_back
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
typedef long long ll;
typedef pair<char, char> c_c;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
const int INF = 1000000007;
const ll LLINF = 1000000000000000007LL;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n;
    cin >> n;
    if(n < 10 || n%2 == 1){
        cout << 0 << endl;
        return 0;
    }

    

    ll cnt = 10;
    ll ans = 0;
    while(cnt <= n){
        ans += n/cnt;
        cnt *= 5;
    }
    cout << ans << endl;

    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, c) for(ll i = 0; i < (ll)c; i++)
#define ll long long
#define upd_max(maxer, updater) if (maxer < updater) maxer = updater;
#define upd_min(miner, updater) if (miner > updater) miner = updater;
const int inf = 1000000000; // 10^9

int main(){
    string s;
    ll n, a, b, kaigai = 0, kokunai = 0;

    cin >> n >> a >> b >> s;

    rep(i, n){
        if(s[i] == 'a'){
            if(kokunai + kaigai < a + b){
                cout << "Yes" << endl;
                kokunai++;
            }
            else cout << "No" << endl;
        }
        else if(s[i] == 'b'){
            if(kokunai + kaigai < a + b && kaigai < b){
                cout << "Yes" << endl;
                kaigai++;
            }
            else cout << "No" << endl;
        }
        else{
            cout << "No" << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 896
#define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
#include <random>
using ll = long long;
using ull = unsigned long long;
using namespace std;
#define int long long
#define CONTAINS_VEC(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
#define CONTAINS_SET(m, a) (m).find((a)) != m.end()
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }

//---------- 約数列挙 ----------
vector<int> yakusu(int n)
{
	vector<int> v;
	for (int i = 1; i * i <= n; i++)
	{
		if (n % i == 0)
		{
			v.push_back(i);
			if (i != n / i)
			{
				v.push_back(n / i);
			}
		}
	}
	sort(v.begin(), v.end());
	return v;
}

//---------- 素数列挙 ----------
vector<bool> GetIsPrimeList(int max)
{
	vector<bool> list;
	for (int i = 0; i <= max; i++)
	{
		list.push_back(true);
	}
	for (int i = 2; i < sqrt(max); i++)
	{
		if (list[i])
		{
			for (int j = 0; i * (j + 2) < max; j++)
			{
				list[i * (j + 2)] = false;
			}
		}
	}
	list[0] = false;
	list[1] = false;
	return list;
}

//---------- 最大公約数 ----------
int gcd(int x, int y)
{
	int r;
	while ((r = x % y) != 0)
	{
		x = y;
		y = r;
	}
	return y;
}

int N;
int A[1000001];

bool flg[1000001];
vector<bool> p_list;

bool IsPairwise()
{
	for (int i = 0; i < N; i++)
	{
		if (flg[A[i]]) return false;

		if (p_list[A[i]])
		{
			flg[A[i]] = true;
			continue;
		}

		auto yaku = yakusu(A[i]);
		for (int j = yaku.size() - 1; j >= 1; j--)
		{
			int y = yaku[j];
			if (flg[y]) return false;

			int cur = y;
			while (true)
			{
				flg[cur] = true;
				cur += y;
				if (cur > 1000000) break;
				
			}
		}
	}

	return true;
}


bool IsSetWize()
{
	int g = A[0];
	for (int i = 1; i < N; i++)
	{
		g = gcd(g, A[i]);
	}
	return g == 1;
}


signed main()
{
	cin >> N;
	REP(i, N)
	{
		cin >> A[i];
	}

	ARY_SORT(A, N);
	ARY_REVERSE(A, N);

	p_list = GetIsPrimeList(1000000);

	if (IsPairwise())
	{
		cout << "pairwise coprime" << endl;
	}
	else if (IsSetWize())
	{
		cout << "setwise coprime" << endl;
	}
	else
	{
		cout << "not coprime" << endl;
	}
}



Measured memory_bytes: 12564
#include<bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = 0; i < (n); i++)
 
int main(){
    int N;
    cin >> N;
    map<int,int> MOdd,MEven;
    bool flag = true;
    for(int i=0;i<N;i++){
        int v;
        cin >>v;
        flag ? MOdd[v]++ : MEven[v]++;
        flag ^= 1;
    }

    priority_queue<pair<int,int>> QOdd,QEven;
    auto begin = MOdd.begin(), end = MOdd.end();
    for (auto iter = begin; iter != end; iter++) {
        QOdd.push(make_pair(iter->second,iter->first));
    }
    begin = MEven.begin(), end = MEven.end();
    for (auto iter = begin; iter != end; iter++) {
        QEven.push(make_pair(iter->second,iter->first));
    }
    QOdd.push(make_pair(0,0));
    QEven.push(make_pair(0,0));

    auto FirstOdd = QOdd.top(),FirstEven = QEven.top();
    QOdd.pop(); QEven.pop();
    auto SecondOdd = QOdd.top(),SecondEven = QEven.top();
    if(FirstOdd.second == FirstEven.second){
        cout << min(N-FirstOdd.first-SecondEven.first,N-FirstEven.first-SecondOdd.first);
    }else{
        cout << N-FirstOdd.first-FirstEven.first;
    }

    return 0;
}

Measured memory_bytes: 6136
# Touitsu
n = int(input())
a = input()
b = input()
c = input()
ans = 0
for i in range(n):
    if a[i] == b[i] == c[i]:
        continue
    elif a[i] == b[i]:
        ans += 1
    else:
        if a[i] == c[i] or b[i] == c[i]:
            ans += 1
        else:
            ans += 2
print(ans)


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

using namespace std;


int main(){
    int n; cin >> n;
    map <string, int> a;
    while(n--){
        string s;
        cin >> s;
        a[s] += 1;
    }
    int max = 0;
    for(auto it = a.begin(); it != a.end(); it++){
        int num = it->second;
        if(num > max) max = num;
    }
    for(auto it = a.begin(); it != a.end(); it++){
        if(it->second == max) cout << it->first << endl;
    }
    return 0;
}

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

class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//        StringTokenizer st = new StringTokenizer(br.readLine());

//        int n = Integer.parseInt(st.nextToken());
        String s = br.readLine();
        String[] arr = s.split(" ");
        char a = arr[0].charAt(0);
        char b = arr[1].charAt(0);

        if(a=='H')
            System.out.println(b);
        else{
            if (b=='H')
                System.out.println('D');
            else
                System.out.println('H');
        }


    }


}


Measured memory_bytes: 20052
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
    int n,x;
    cin >> n >> x;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin >> a[i];
    }
    sort(a,a+n);
    int count = 0;
    bool just = false;
    for(int i=0; i<n;i++)
    {
        int tmp = x - a[i];
        if(tmp == 0)
        {
            count++;
            just = true;
            break;
        }
        else if(tmp < 0)
        {
            count++;
            break;
        }
        else if(tmp > 0)
        {
            x = tmp;
            count++;
        }
    }
    if(just)
    {
        cout << max(0,count) << endl;
    }
    else
    {
        cout << max(0,count -1) << endl;
    }
}

Measured memory_bytes: 256
const main = (input:String) => {
    const std: string[] = input.split('\n')
    const n: number = ~~std.shift()
    const d: number[] = std.shift().split(' ').map(Number).sort((a,b) => a-b)
    const dLeft: number[] = d.slice(0, n/2)
    const dRight: number[] = d.slice(n/2, n)
    const leftMax = dLeft.slice(-1)[0]
    const rightMin = dRight[0]
    if (leftMax === rightMin) return console.log(0)
    console.log(rightMin - leftMax)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8').trim());


Measured memory_bytes: 28376
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) throws IOException {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int q = Integer.parseInt(br.readLine());
      String[] query;
      MyList list = new MyList();

      for(int i=0; i<q; i++) {
        query = br.readLine().split(" ");
        switch( query[0] ) {
          case "0" :
            list.insert( Integer.parseInt(query[1]) );
            break;
          case "1" :
            list.move( Integer.parseInt(query[1]) );
            break;
          case "2" :
            list.erase();
            break;
          default :
            System.out.println("n:" + i + " is failed.");
        }
      }

      System.out.println ( list.getAllElements() );
    }
  }
}

class Node {
  Node next,prev;
  int key;

  public Node(int key) {
    this.key = key;
  }
}

class MyList {
  Node nil;
  Node current;
  int size;

  public MyList() {
    nil = new Node(0);
    nil.next = nil.prev = nil;
    size = 0;
    
  }

  public String getAllElements() {
    StringBuilder buf = new StringBuilder(size*5);

    if(size > 0){
      current = nil.next;
      for(int i=0; i<size; i++){
        buf.append(current.key).append("\n");
        current = current.next;
      }
    }
    buf.setLength(buf.length()-1);

    return buf.toString();
  }
  public void insert(int x) {
    if(size == 0) {
      current = new Node(x);
      nil.next = current;
      nil.prev = current;
      current.prev = nil;
      current.next = nil;
      size++;
    }
    else {
      Node add = new Node(x);
      
      current.prev.next = add;
      add.prev = current.prev;

      add.next = current;
      current.prev = add;

      current = add;
      size++;
    }
  }
  public void move(int d){
    if( d > 0 ) {
      for(int i=0; i<d; i++)
        current = current.next;
    } else if( d < 0 ) {
      for(int i=0; i>d; i--)
        current = current.prev;
    }
  }
  public void erase() {
      current.prev.next = current.next;
      current.next.prev = current.prev;
      current = current.next;
      size--;
  }
}


Measured memory_bytes: 110024
H, W, D = map(int,input().split())
dist = [0]*(H*W+1)#dist[i]はiからi+Dまでの距離
pos = [[0,0] for i in range(H*W+1)]
for i in range(H):
  A = list(map(int,input().split()))
  for j in range(W):
    pos[A[j]] = [i+1, j+1]
    
for i in range(H*W+1-D):
  dist[i] = abs(pos[i][0]-pos[i+D][0])+abs(pos[i][1]-pos[i+D][1])

distances = [[] for i in range(D)]#あまりがiの距離
for i in range(1,H*W+1-D):
  distances[i%D]+=[dist[i]]
distances2 = [[0] for i in range(D)]#累積和に直す
for i in range(D):
  for j in range(len(distances[i])):
    distances2[i]+=[distances2[i][-1]+distances[i][j]]

Q = int(input())
for i in range(Q):
  L, R = map(int, input().split())
  l, r = (L-1)//D, (R-1)//D
  print(distances2[L%D][r]-distances2[L%D][l])

Measured memory_bytes: 29692
#include <bits/stdc++.h>
#define INF 1000000000
using namespace std;

int main()
{
  int N;
  cin >> N;
  int each_len = 0, num_group, num_part;
  num_part = N * 2;
  for (int i = 1; i * (i + 1) < num_part + 1; ++i)
  {
    if (i * (i + 1) == num_part)
    {
      each_len = i;
      break;
    }
  }
  if (each_len == 0)
  {
    cout << "No" << endl;
    return 0;
  }
  num_group = num_part / each_len;
  vector<vector<int>> graph(each_len);
  int cnt = 1;
  // cout << each_len << ' ' << num_part << ' ' << num_group << endl;
  for (int i = 1; i < each_len + 1; ++i)
  {
    for (int j = 0; j < i; ++j)
    {
      graph.at(i - 1).push_back(cnt);
      cnt += 1;
    }
  }

  vector<vector<int>> ans;
  for (int i = 0; i < each_len; ++i)
  {
    int h = i;
    int w = i;
    vector<int> temp = graph.at(h);
    for (int j = i + 1; j < each_len; ++j)
    {
      temp.push_back(graph.at(j).at(w));
    }
    ans.push_back(temp);
  }
  vector<int> temp;
  for (int i = 0; i < each_len; ++i)
  {
    temp.push_back(graph.at(i).at(i));
  }
  ans.push_back(temp);

  cout << "Yes" << endl;
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); ++i)
  {
    cout << each_len << ' ';
    for (int j = 0; j < each_len; ++j)
    {
      cout << ans.at(i).at(j) << ' ';
    }
    cout << endl;
  }
  // for (int i = 0; i < each_len; ++i)
  // {
  //   for (int j = 0; j < graph.at(i).size(); ++j)
  //   {
  //     cout << graph.at(i).at(j) << ' ';
  //   }
  //   cout << endl;
  // }
}


Measured memory_bytes: 2944
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define rep(i, s, n) for (i64 i = (s), i##_limit = (n); i < i##_limit; ++i)
#define repr(i, s, t) for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define var(type, ...) \
    type __VA_ARGS__;  \
    read(__VA_ARGS__);
#ifndef DBG
#define dump(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U>
inline bool chmax(T &a, const U &b) {
    return b > a && (a = b, true);
}
template <class T, class U>
inline bool chmin(T &a, const U &b) {
    return b < a && (a = b, true);
}
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> makeV(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeV(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeV<T>(initValue, args...))>(
        sz, makeV<T>(initValue, args...));
}

template <class T>
inline istream &operator>>(istream &is, vector<T> &vec) {
    for (auto &e : vec) is >> e;
    return is;
}

inline void read() {}

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

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail &&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream &operator<<(ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = {" ", ""};
    for (const auto &e : vec) os << e << delim[&e == &vec.back()];
    return os;
}

template <class Container>
struct Rev {
    Container &x_;
    inline Rev(Container &x) : x_(x) {}
    inline auto begin() { return rbegin(x_); }
    inline auto end() { return rend(x_); }
};
// }}} End Header

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

    var(int, H, W);
    vector<string> mat(H);
    read(mat);

    bool ng = false;
    rep(i, 0, H) rep(j, 0, W) if (mat[i][j] == '#') {
        bool can = false;
        if (i + 1 < H) can |= mat[i + 1][j] == '#';
        if (j + 1 < W) can |= mat[i][j + 1] == '#';
        if (i - 1 >= 0) can |= mat[i - 1][j] == '#';
        if (j - 1 >= 0) can |= mat[i][j - 1] == '#';
        ng |= !can;
    }

    print((!ng) ? "Yes" : "No");

    return 0;
}


Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.Stack;

//Zero Division Checker
public class Main{

	class R{
		boolean[] p;
		public R() {
			p = new boolean[256];
		}
	}
	
	void run(){
		Scanner sc = new Scanner(System.in);
		int m = sc.nextInt();
		Map<String, Integer> ref = new HashMap<String, Integer>();
		int[] lb = new int[m], ub = new int[m];
		for(int i=0;i<m;i++){
			ref.put(sc.next(), i);
			lb[i] = sc.nextInt(); ub[i] = sc.nextInt();
		}
		int n = sc.nextInt();
		boolean res = true;
		Stack<R> r = new Stack<R>();
		while(n--!=0){
			String s = sc.next();
			R v = new R();
			if(ref.containsKey(s)){
				int id = ref.get(s);
				for(int i=lb[id];i<=ub[id];i++)v.p[i] = true;
			}
			else if("/".equals(s)){
				R b = r.pop(), a = r.pop();
				if(b.p[0]){
					res = false; break;
				}
				for(int x=0;x<256;x++)if(a.p[x])for(int y=0;y<256;y++)if(b.p[y])v.p[(x/y)%256] = true;
			}
			else if("+".equals(s)){
				R b = r.pop(), a = r.pop();
				for(int x=0;x<256;x++)if(a.p[x])for(int y=0;y<256;y++)if(b.p[y])v.p[(x+y)%256] = true;
			}
			else if("-".equals(s)){
				R b = r.pop(), a = r.pop();
				for(int x=0;x<256;x++)if(a.p[x])for(int y=0;y<256;y++)if(b.p[y])v.p[(x-y+256)%256] = true;
			}
			else if("*".equals(s)){
				R b = r.pop(), a = r.pop();
				for(int x=0;x<256;x++)if(a.p[x])for(int y=0;y<256;y++)if(b.p[y])v.p[(x*y)%256] = true;
			}
			else{
				v.p[Integer.parseInt(s)] = true;
			}
			r.add(v);
		}
		System.out.println(res?"correct":"error");
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 12000
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define vl vaector<long>
#define vll vector<long long int>
#define vC  vector<char>
#define FastIO ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__)
ll pow(ll x, ll y,ll m) { ll res = 1;x=x%m; while (y > 0) { if (y & 1) res = ((res%m) * (x%m))%m; y = y >> 1; x = ((x%m) * (x%m))%m; } return res%m; }
template <typename Arg1> void ZZ(const char* name, Arg1&& arg1){std::cerr << name << " = " << arg1 << endl;}
template <typename Arg1, typename... Args>void ZZ(const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr(names + 1, ',');
	std::cerr.write(names, comma - names) << " = " << arg1;
	ZZ(comma, args...);
}
const ll INF = 0xFFFFFFFFFFFFFFFL;
clock_t time_p=clock();
void abhigyan10()
{time_p=clock()-time_p;cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";}
ll seed;
mt19937 rng(seed=chrono::steady_clock::now().time_since_epoch().count());
inline ll rnd(ll l=0,ll r=INF){return uniform_int_distribution<ll>(l,r)(rng);}
#define clrbuf cin.ignore(numeric_limits<streamsize>::max(),'\n');
#define preciset(x) cout<<setprecision(x)<<fixed;
const ll mod =1000000007;
int dp[3005][3005];
int main()
{
        FastIO
        string x1,x2;
        cin>>x1>>x2;
        int i,j,l=x1.length(),l2=x2.length();
        //db(x1,x2,l,l2);
        for(i=0;i<l;i++)
        {
        	for(j=0;j<l2;j++)
        	{
        		
        		if(x1[i]==x2[j])
        			dp[i+1][j+1]+=1+dp[i][j];
        		else
        			dp[i+1][j+1]=max(dp[i][j+1],dp[i+1][j]);
        		
        	}
        }
        i=l;j=l2;int k=dp[l][l2];
        string ans="";
        
        while(i>=1 && j>=1)
        {
        	if(x1[i-1]==x2[j-1])
        	{
        		 ans=x1[i-1]+ans;
        		i--;j--;k--;
        	}
        	else
        	{
        		if(dp[i][j-1]>dp[i-1][j])
        			j--;
        		else
        			i--;
        	}
        

        }
        cout<<ans;
return 0;
}




Measured memory_bytes: 35456
#include <iostream>
#include <cstdio>

int main() {
  int x1, y1;
  std::cin >> x1 >> y1;
  int x2, y2;
  std::cin >> x2 >> y2;

  int x_offset = x2 - x1;
  int y_offset = y2 - y1;

  int x3 = x2 - y_offset, y3 = y2 + x_offset;
  int x4 = x1 - y_offset, y4 = y1 + x_offset;

  printf("%d %d %d %d\n", x3, y3, x4, y4);
  return 0;
}

Measured memory_bytes: 3740
#include <bits/stdc++.h>
using namespace std;
string s,s2;
int dp[3][100007],n,m,q,a,b,c,d;
int main(){
    cin>>s>>s2;
    for(int i=0;i<s.size();i++){
        dp[1][i+1]=dp[1][i];
        if(s[i]=='A'){
            dp[1][i+1]++;
        }
        else{
            dp[1][i+1]+=2;
        }
    }
    for(int i=0;i<s2.size();i++){
        dp[2][i+1]=dp[2][i];
        if(s2[i]=='A'){
            dp[2][i+1]++;
        }
        else{
            dp[2][i+1]+=2;
        }
    }
    cin>>q;
    while(q--){
        cin>>a>>b>>c>>d;
        int cur=dp[1][b]-dp[1][a-1];
        int cur2=dp[2][d]-dp[2][c-1];
        if(cur>cur2) swap(cur,cur2);
        int dif=cur2-cur;
        //cout<<cur<<" "<<cur2<<endl;
        if(dif%3==0){
            cout<<"YES";
        }
        else cout<<"NO";
        cout<<endl;
    }
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define SP << " " 
#define LLi long long int

using namespace std;

int imax=2147483647;
long long int llimax=9223372036854775807;

//int型vectorを出力
void PV(vector<int> pvv) {
	rep(i, pvv.size()) cout << pvv[i] SP;
	cout << endl;
}

//LLi型vectorを出力
void PVL(vector<LLi> pvv) {
	rep(i, pvv.size()) cout << pvv[i] SP;
	cout << endl;
}

int main(){

	int n, a=0, b=0, c=0, d=0;
	string s;

	cin>> n;

	rep(i, n) {
		cin>> s;
		if(s=="AC") a++;
		if(s=="WA") b++;
		if(s=="TLE") c++;
		if(s=="RE") d++;
		
	}

	cout<< "AC x " << a << endl;
	cout<< "WA x " << b << endl;
	cout<< "TLE x " << c << endl;
	cout<< "RE x " << d << endl;
 
	return 0;
}

Measured memory_bytes: 3628
import itertools
import numpy as np

N, M, X = map(int, input().split())

C_A_list = []
for i in range(N):
    C_A = [int(x) for x in input().split()]
    C_A_list.append(C_A)

all_list = []
for i in range(1, len(C_A_list)+1):
    for j in itertools.combinations(C_A_list, i):
        all_list.append(list(j))

cost_list = []
for comb in all_list:
    comb_ = np.array(comb)
    if [i >= X for i in sum(comb_)[1:]] == [True] * M :
        cost_list.append(sum(comb_)[0])

if len(cost_list) > 0:
    print(min(cost_list))
else:
    print(-1)

Measured memory_bytes: 27488
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

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

    int X;
    cin >> X;
    cout << ((X % 100 <= X / 100 * 5) ? 1 : 0) << endl;

    return 0;
}

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

int main(){
	char a[8][8];
	while(cin){
		for(int i=0;i<8;i++){
			for(int j=0;j<8;j++) a[i][j] = '0';
			for(int j=0;j<8;j++) cin >> a[i][j];
		}
		int x = 0;
		int y = 0;
		int z = 0;
		for(int i=0;i<8;i++){
			for(int j=0;j<8;j++){
				if(a[i][j]=='1'){
					if(j<7 and a[i][j+1]=='1') x++;
					if(i<7 and a[i+1][j]=='1') y++;
					if(i<7 and j<7 and a[i+1][j+1]=='1') z++;
				}
			}
		}
		if     (x==3 and y==0 and z==0) cout << "C" << endl;
		else if(x==0 and y==3 and z==0) cout << "B" << endl;
		else if(x==2 and y==2 and z==1) cout << "A" << endl;
		else if(x==1 and y==2 and z==0) cout << "D" << endl;
		else if(x==2 and y==1 and z==0) cout << "G" << endl;
		else if(x==2 and y==1 and z==2) cout << "E" << endl;
		else if(x==1 and y==2 and z==2) cout << "F" << endl;
	}
}

Measured memory_bytes: 1136
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
#include <set>

using namespace std;

typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define Fst first
#define Snd second
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)
#define repv(t,it,v) for(vector<t>::iterator it = v.begin() ; it != v.end() ; ++it)

int N;
vector<int> V[100010];
int ans = 0;

int dfs(int p , int q){
	int a = 0;
	int b = 0;
	repv(int,it,V[q]){
		if(p == (*it)) continue;
		int x = dfs(q,(*it));
		if(x > a){
			b = a;
			a = x;
		} else if(x > b){
			b = x;
		}
	}
	ans = max(ans , a + b + ((int)V[q].size() == 2 ? 1 : 0));
	return a + ((int)V[q].size() == 2 ? 1 : 0);
}

int main(){
	scanf("%d" , &N);
	repp(i,1,N){
		int a,b;
		scanf("%d%d" , &a , &b);
		V[a].PB(b);
		V[b].PB(a);
	}
	int z = 0;
	repp(i,1,N+1){
		if((int)V[i].size() == 1) ++z;
	}
	dfs(-1,1);
	printf("%d\n" , ans + z);
	return 0;
}


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

int a,b,c;

int main(){
	cin>>a>>b>>c;
	cout<<c<<' '<<a<<' '<<b<<endl;
}

Measured memory_bytes: 256
N = int(input())
Z = [2,3,5,7,11,13,17]
for i in range(2, 1500):
    flag = 0
    for j in Z[::]:
        if i % j == 0:
            flag = 1
            break
    if flag == 1:
        continue
    else:
        Z.append(i)
Z = [i for i in Z if i % 10 == 1]
print(' '.join(map(str, Z[:N])))



Measured memory_bytes: 2940
#pragma region RegionDefs
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define reps(i,l,r) for(int i=(l),i##_len=(r);i<i##_len;++i)
#define repr(i,l,r) for(int i=(r)-1,i##_left=(l);i>=i##_left;--i)
#define all(x) begin(x),end(x)
using namespace std;
typedef long long ll;
const ll INF = 1e9;
template<class T=ll> using V = vector<T>;
template<class T=ll> using PQ = priority_queue<T>;
template<class T=ll> using PQG = priority_queue<T, V<T>, greater<T>>;
const ll MOD = 1000000007LL;
void in() {}
template<class Head, class... Tail>
void in(Head&& head, Tail&&... tail) { cin >> head; in(move(tail)...); }
#define IN(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define TIN(T, ...) T __VA_ARGS__; in(__VA_ARGS__)
#define VIN(T, v, n) V<T> v(n); for(auto& _elem:v)cin>>_elem
template<class T>bool chmax(T &a, const T &b) {if (a<b) {a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) {if (a>b) {a=b; return 1;} return 0;}
template<class T>
string join(vector<T>& v, string delim="") { ostringstream os; rep(i,v.size())i?os<<delim<<v[i]:os<<v[0]; return os.str(); }
#pragma endregion RegionDefs

void solve()
{
    IN(n);
    VIN(ll, a, n);
    ll res = 0;
    ll m = 0;
    reps(i, 1, n) {
        ll v = max(a[i-1]-a[i], 0LL);
        res += v;
        a[i] += v;
    }
    cout << res << endl;
}

int main()
{
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(numeric_limits<double>::max_digits10);

    solve();

    return 0;
}

Measured memory_bytes: 4780
use std::io;


fn main() {
    let (a, b) = {
        let i = read::<usize>();
        (i[0], i[1])
    };
    println!("{}", ((a + b) as f64 / 2.0).ceil());
}


#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_one<T>() -> T
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

Measured memory_bytes: 4352
#include<cstdio>
int main()
{
  int a,n,m=0,s=0;
  scanf("%d",&n);
  while (n--) {
    scanf("%d",&a);
    s+=a;
    if (a>m) m=a;
  }
  if (2*m<s) printf("Yes"); else printf("No");
  return 0;
}


Measured memory_bytes: 128