akhauriyash/Code-Regression huggingface dataset:
// lcmとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF 1001001001
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define double long double
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n+1)
using namespace std;
bool my_compare(pair<ll, ll> a, pair<ll , ll> b) {
    // 基本はfirstで比較
    if(a.first != b.first){
         return a.first < b.first; // 昇順
        //return a.first > b.first; // 降順
    }

    // それ以外はsecondで比較
    if(a.second != b.second){
        return a.second > b.second;
    }else{
        // どちらも同じ
        return true;
    }
}

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

    ll a,b,c,m,n,maxi=0,f=0,mini=INF,sum=0;
    string str;
    cin>>n;
    vector<ll> v(n);
    rep(i,n) cin>>v[i];
    rep(i,n) {
        if(v[v[i]-1]==i+1) f++;
    }
    cout<<f/2<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include <cstdio>
#include <algorithm>
using namespace std;
int main() {
	int N, K, R, S, P, ans = 0;
	scanf("%d %d %d %d %d", &N, &K, &R, &S, &P);
	char T[N];
	for (int i = 0; i < N; ++i) scanf(" %c", &T[i]);
	for (int i = 0; i < K; ++i) {
		for (int j = i; j < N; j += K) {
			if (j == i || T[j] != T[j - K]) {
				if (T[j] == 'r') ans += P;
				else if (T[j] == 'p') ans += S;
				else ans += R;
			} else T[j] = 'x';
		}
	}
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	int a, b; cin >> a >> b;
	
	cout << max(0, a - 2 * b) << endl;
	
	
	return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define inf 1e16 + 1
#define ll long long
#define mm 1000000007
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define pii pair<int, int>
#define pll pair<ll, ll>

#define show(x) cout<<#x<<" "<<x<<'\n'
#define iosbase ios_base::sync_with_stdio(false); cin.tie(NULL);
#define oset tree<int , null_type, less_equal<int> , rb_tree_tag, tree_order_statistics_node_update>

using namespace std;
using namespace __gnu_pbds;

int main()
{
    iosbase;
    int n,i;
    cin>>n;
    int a[n];
    multiset<int> st;
    
    for(i=0;i<n;i++)
    {
        cin>>a[i];
        st.insert(a[i]);
    }
   int tt=0;
   int am[2];
   
   for(auto itr = st.rbegin() ; itr!=st.rend() ; itr++)
   {
       if(tt>1) break;
       am[tt++]=*itr;
   }
   for(i=0;i<n;i++)
   {
       if(a[i]==am[0]) cout<<am[1]<<'\n';
       else cout<<am[0]<<'\n';
   }
}

Measured memory_bytes: 11776
import Data.List as L
import qualified Data.ByteString.Char8 as BC
import Data.Maybe (fromJust)

readInts2 :: IO [[Int]]
readInts2 = map (map (fst . fromJust . BC.readInt) . BC.words) . BC.lines <$> BC.getContents

isInt :: (RealFrac a) => a -> Bool
isInt x = x == fromInteger (round x)

main :: IO ()
main = do
  getLine
  xss <- readInts2
  let calc x y = sqrt . fromIntegral . sum $ zipWith (\a b -> (a - b) ^ 2) x y
  let distances = [calc x y | (x:rest) <- L.tails xss, y <- rest]
  print . length $ filter (== True) $ map isInt distances

Measured memory_bytes: 508
require 'pp'

# 入力値を数値で返却する
def gets_i()
  gets.chomp.to_i
end

# 空白区切の入力値を数値の配列で返却する
def gets_i_list()
  gets.chomp.split(" ").map(&:to_i)
end

N =gets_i
abc = []
N.times do
  abc.push(gets_i_list)
end

dp = Array.new(N + 1).map{Array.new(3,0)}

(N).times do |i|
  0.upto(2) do |j|
    options = []
    options.push(dp[i][0]) if j != 0
    options.push(dp[i][1]) if j != 1
    options.push(dp[i][2]) if j != 2
    dp[i + 1][j] = options.max + abc[i][j]
  end
end
puts dp.last.max


Measured memory_bytes: 17148
#include <iostream>
#include <string>
using namespace std;
int main() {
    int l, n;
    string s;
    cin >> l >> n >> s;

    long long oocnt = 0, total_oocnt = 0;
    for ( int i=0; i<l-1; ++i ) {
	if ( s[i] == 'o' && s[i+1] == 'o' ) ++oocnt;
    }
    for ( int i=0; i<n; ++i ) {
	total_oocnt += oocnt;
	oocnt *= 2;
    }

    cout << 3*total_oocnt + l << endl;
    return 0;
}



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

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

    int N, K, Q;
    cin >> N >> K >> Q;
    vector<int> point(N + 1, 0);
    for (int i = 0, Ai; i < Q; i++) {
        cin >> Ai;
        point[Ai]++;
    }
    for (int i = 1; i <= N; i++)
        cout << (K - Q + point[i] > 0 ? "Yes\n" : "No\n");

    return 0;
}

Measured memory_bytes: 1024
#define LOCAL
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
  out << "(" << a.first << "," << a.second << ")";
  return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
  return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
  return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

struct fast_ios {
  fast_ios() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
  };
} fast_ios_;

int main() {
  string s;
  cin >> s;
  if (s.size() == 6 && s[4] == s[5] && s[2] == s[3]) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        try {
            String line = br.readLine();
            while(line!=null) {

                int x = Integer.parseInt(line);
                int a = 0, b = 0, c = 0, d = 0, i = 0, count = 0;
                while (i < 10000) {
                    if (a == 10) {
                        a = 0;
                        b++;
                    }
                    if (b == 10) {
                        b = 0;
                        c++;
                    }
                    if (c == 10) {
                        c = 0;
                        d++;
                    }
                    if (a + b + c + d == x) {
                        count++;
                    }
                    a++;
                    i++;
                }
                System.out.println(count);
                line = br.readLine();
            }

        } catch (Exception e) {
            System.out.println(e);
        }
    }
}

Measured memory_bytes: 24824
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define debug2(x, y)                       \
  cerr << "(" << #x << "," << #y << ") = " \
       << "(" << x << "," << y << ")\n"
#define all(x) x.begin(), x.end()
#define each(a, x) for (auto& a : (x))
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define int long long
#define yn(x) puts((x ? "Yes" : "No"))
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
const int MX = 1e5 + 5, INF = 5LL << 57, MOD = 1e9 + 7;

int N, M;
string S;
vi va, vb;

void input() {
  ;
  ;
  cin >> N >> M;
}
void solve() {
  int ans = 0;
  while (N) {
    N /= M;
    ans++;
  };
  cout << ans << endl;
  ;
}
signed main() {
  cout << setprecision(12);
  input();
  solve();
  return 0;
}

Measured memory_bytes: 256
from collections import deque

S = deque(input())
Q = int(input())
rev = False
for _ in range(Q):
    q = input().split()
    if q[0] == '1':
        rev = not rev
    else:
        if q[1] == '1':
            if rev:
                S.append(q[2])
            else:
                S.appendleft(q[2])
        else:
            if rev:
                S.appendleft(q[2])
            else:
                S.append(q[2])
if rev:
    S.reverse()

print(''.join(S))


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

#define int long long
#define a(a, b) ((a) = ((a) + (b) + M) % M)
#define f(a) for (int i = 1; i <= a; i++)

const int N = 200000 + 10;
const int M = 998244353;

int n;
char s[N];
int c, q;

inline int w (int b, int p) {
    int r = 1;
    while (p) { if (p & 1) r = r * b % M; b = b * b % M; p >>= 1; }
    return r;
}

signed main() {
    scanf("%s", s + 1); n = strlen(s + 1);
    f(n - 1) c += s[i] != s[i + 1];
    f(n) (q += s[i] - 'a') %= 3;
    int r = !c;
    if (c) {
        int t = w(2, n - 1); r = w(3, n - 1);
        a(r, (c == n - 1) - t);
        if (n % 3 == 0){
            t = w(2, (n - 3) / 3);
            if (!q) t = ((M - t) * 2ll + (n == 3 ? M - 1 : 0)) % M;
            a(r, t);
        }
    }
    printf("%lld\n",r);
}

Measured memory_bytes: 384
import sys


def partition(a, p, r):
    x = a[r]
    i = p - 1
    for j in range(p, r):
        if a[j] <= x:
            i += 1
            a[i], a[j] = a[j], a[i]
    a[i + 1], a[r] = a[r], a[i + 1]
    return i + 1


n = int(sys.stdin.readline())
a = [int(v) for v in sys.stdin.readline().split()]
index = partition(a, 0, n - 1)
print(' '.join(f'[{v}]' if i == index else v
               for i, v in enumerate(map(str, a))))



Measured memory_bytes: 16212
k,n = map(int,input().split())
a =list(map(int,input().split()))
kyori = [0]*n
# print(a)
for i in range(1,n):
    # print(i)
    kyori[i]=a[i]-a[i-1]
kyori[0]=a[0]+(k-a[n-1])
print(k-max(kyori))

Measured memory_bytes: 26444
#include <bits/stdc++.h>
using namespace std;
 
const int inf = 0x3f3f3f3f;
 
struct edge {
	int to, cap;
	char flag; // 0: r -> l   1: u -> d
	edge(): flag(-1) {}
	edge(const int &t, const int &c, const char &f): to(t), cap(c), flag(f) {}
} ge[60000];
int n, m;
vector <int> gl[10010];
int depth[10010], q[10010];
int iter[10010];
 
int N, M;
char a[110][110];
char dir[4][2] = { 1, 0, 0, 1, -1, 0, 0, -1 };
char chr[4][2] = { 'v', '^', '>' , '<', '^', 'v', '<', '>' };
void AddEdge(const int &from, const int &to, const int &cap, const char &flag);
int MaxFlow(const int &from, const int &to);
int dfs(const int &from, const int &to, const int &flow);
 
void GetAns(int from, int to, char flag) {
	a[from / M][from % M] = chr[flag][0], a[to / M][to % M] = chr[flag][1];
}
 
int main() {
	scanf("%d%d", &N, &M);
	const int s = N * M, t = N * M + 1;
	for (int i = 0; i < N; ++i)
		scanf("%s", a[i]);
 
	for (int i = 0; i < N; ++i)
		for (int j = i & 1; j < M; j += 2)
			if (a[i][j] == '.') {
				if (i + 1 < N && a[i + 1][j] == '.')
					AddEdge(i * M + j, (i + 1) * M + j, 1, 0);
				if (j + 1 < M && a[i][j + 1] == '.')
					AddEdge(i * M + j, i * M + j + 1, 1, 1);
				if (i > 0 && a[i - 1][j] == '.')
					AddEdge(i * M + j, (i - 1) * M + j, 1, 2);
				if (j > 0 && a[i][j - 1] == '.')
					AddEdge(i * M + j, i * M + j - 1, 1, 3);
			}
	for (int i = 0; i < N; ++i)
		for (int j = 0; j < M; ++j)
			if (a[i][j] == '.')
				if (i + j & 1)
					AddEdge(i * M + j, t, a[i][j] == '.', -1);
				else
					AddEdge(s, i * M + j, a[i][j] == '.', -1);
	printf("%d\n", MaxFlow(s, t));
 
	for (int i = 0; ge[i].flag != -1; i += 2)
		if (!ge[i].cap)
			GetAns(ge[i ^ 1].to, ge[i].to, ge[i].flag);
	for (int i = 0; i < N; ++i)
		printf("%s\n", a[i]);
	return 0;
}
 
 
void AddEdge(const int &from, const int &to, const int &cap, const char &flag) {
	ge[m] = edge(to, cap, flag);
	gl[from].push_back(m++);
	ge[m] = edge(from, 0, -1);
	gl[to].push_back(m++);
}
 
int MaxFlow(const int &from, const int &to) {
	int flow = 0;
	while (true) {
		memset(depth, -1, sizeof(depth));
		depth[from] = 0;
		int h = 0, t = 1; q[h] = from;
		while (h < t) {
			int u = q[h++];
			for (int i = 0; i < gl[u].size(); ++i) {
				edge &e = ge[gl[u][i]];
				if (e.cap > 0 && depth[e.to] == -1)
					q[t++] = e.to, depth[e.to] = depth[u] + 1;
			}
		}
		if (depth[to] == -1)
			return flow;
 
		memset(iter, 0, sizeof(iter));
		int f;
		while (f = dfs(from, to, inf))
			flow += f;
	}
}
 
int dfs(const int &from, const int &to, const int &flow) {
	if (from == to)
		return flow;
	for (int &i = iter[from]; i < gl[from].size(); ++i) {
		edge &e = ge[gl[from][i]], &e1 = ge[gl[from][i] ^ 1];
		if (e.cap > 0 && depth[e.to] == depth[from] + 1) {
			int f = dfs(e.to, to, min(flow, e.cap));
			if (f) {
				e.cap -= f;
				e1.cap += f;
				return f;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 5280
#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int a,b;
  std::vector<int> data(3);
  cin>>a>>b;

  data.at(0)=a+b;
  data.at(1)=a-b;
  data.at(2)=a*b;

  sort(data.begin(),data.end());
  reverse(data.begin(),data.end());

  cout<<data.at(0)<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <set>
#include <sstream>
#include <bitset>
#include <string>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)


ll modpow(ll x, ll n) {
    if (n == 0) {
        return 1;
    } else if (n % 2 == 0) {
        ll h = modpow(x, n / 2);
        return h * h % MOD;
    } else {
        return x * modpow(x, n - 1) % MOD;
    }
}

int gcd(int a,int b)  {
	if (a%b==0)  return(b);
	else return(gcd(b,a%b));
}

int main() {
    string S; cin >> S;
    int ans = 700;
    rep(i, S.size()){
      if(S[i]=='o') ans += 100;
    }
    cout << ans << endl;
    return 0;
}


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

int k, s;

void solve(){
  long long ans = 0;
  for(int x = 0; x <= k; x++){
    for(int y = 0; y <= k; y++){
      if(0 <= s-x-y && s-x-y <= k) ans++;
    }
  }
  cout << ans << endl;
}

int main(){
  cin >> k >> s;
  solve();
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int dx[] = { -1, 0, 1, 0 }; const int dy[] = { 0, 1, 0, -1 };

int main() {
	int w, h,answ,ansh;
	while (cin >> h >> w, w | h){
		int a = w*w + h*h;
		int max = 10000000;
		for (int j = 1; j <= 150;j++){
			for (int i = j+1; i <= 150; i++){
				int b = i*i + j*j;
				if (a <= b&&b<max){
					if (a==b&&j>h||a<b){
						max = b;
						answ = i;
						ansh = j;
					}
				}
			}
		}
		cout << ansh << " " << answ << endl;
	}
}

Measured memory_bytes: 1160
#include <stdio.h>

int main(void){
    int n,ch,sm[200002],tt[200002],ans=0,s[100000],t[100000],c[100000];
    scanf("%d%d",&n,&ch);
    for (int i=0; i<n; i++){
        scanf("%d%d%d",&s[i],&t[i],&c[i]);
    }
    for (int i=0; i<200002; i++){
        sm[i]=0;
    }
    for (int i=1; i<=ch; i++){
        for (int j=0; j<200002; j++){
            tt[j]=0;
        }
        for (int j=0; j<n; j++){
            if (c[j]==i){
                tt[s[j]*2-1]++;
                tt[t[j]*2]--;
            }
        }
        for (int j=1; j<200002; j++){
            tt[j]+=tt[j-1];
        }
        for (int j=0; j<200002; j++){
            if (tt[j]>0){
                sm[j]++;
            }
        }
    }
    for (int i=0; i<200002; i++){
        if (ans<sm[i]){
            ans=sm[i];
        }
    }
    printf("%d\n",ans);
	return 0 ;
}

Measured memory_bytes: 2944
import math
import queue
from collections import defaultdict
 
def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):#階乗
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):#コンビネーション
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def printQueue(q):
	r=q
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)

a = readInts()+readInts()+readInts()

n = readInt()
b = []
for i in range(n):
	b = readInt()
	if b in a:
		c = a.index(b)
		a[c] = 0

for i in [0,3,6]:
	if a[i]+a[i+1]+a[i+2]==0:
		print("Yes")
		exit()
for i in [0,1,2]:
	if a[i]+a[i+3]+a[i+6]==0:
		print("Yes")
		exit()
if a[0]+a[4]+a[8]==0 or a[2]+a[4]+a[6]==0:
	print("Yes")
	exit()

print("No")

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

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

	int n;
	int num = 1;
	int ten;
	cin >> n;
	while (num <= n){
		ten = num;
		if (num % 3 == 0 || num % 10 == 3){
			cout << " " << num;
		}
		else{
			while (ten != 0){
				if (ten % 10 == 3){
					cout << " " << num;
					break;
				}
				ten /= 10;
			}
		}
		num++;
	}
	cout << "\n";

	return 0;
}


Measured memory_bytes: 3200
a,b=map(int,input().split())
if a<=0<=b:
    print("Zero")
elif 0<a and 0<b:
    print("Positive")
elif a<0 and b<0 and (b-a+1)%2==0:
    print("Positive")
elif a<0 and b<0 and (b-a+1)%2==1:
    print("Negative")


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define rep(i,a) for(int i=0;i<(a);i++)
#define MOD 1000000007

int main(){
  while(1){
    int n; cin>>n;
    if(n==0) break;
    int width[n]={}, height[n]={};
    int maw=0,miw=0,mah=0,mih=0;
    rep(i,n-1){
      int x,y;
      cin>>x>>y;
      if(y==0||y==2){
        width[i+1]=width[x]+(y==2?1:-1);
        miw=min(miw,width[i+1]);
        maw=max(maw,width[i+1]);
        height[i+1]=height[x];
      }else{
        height[i+1]=height[x]+(y==3?1:-1);
        mih=min(mih,height[i+1]);
        mah=max(mah,height[i+1]);
        width[i+1]=width[x];
      }
    }
    cout<<abs(maw-miw)+1<<" "<<abs(mah-mih)+1<<endl;
  }
  return 0;
}



Measured memory_bytes: 3084
import numpy as np
 
mod = 10 ** 9 + 7
 
N = int(input())
A = np.array(list(map(int, input().split())))
 
 
tmp = 0
for n in range(len(bin(max(A)))-2):   # 最大桁数は、最も大きい数値の2進数の桁数
    num_1 = np.count_nonzero((A >> n)&1)   # 1の数をカウント
    num_0 = N - num_1                      # 0の数をカウント
    mul = num_1 * num_0   # 0 XOR 1の回数
    tmp += ((2 ** n)*mul) % mod
ans = tmp%mod
print(ans)

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

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(ll (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(ll (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000
#define MOD 1000000007

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

pair<ll,ll> ans[1 << 20];
ll ret[1 << 20];

pair<ll,ll> toptwo(pair<ll,ll> A,pair<ll,ll> B){
	ll fir = max(A.FI,B.FI);
	ll sec = max(min(A.FI,B.FI),max(A.SE,B.SE));
	return MP(fir,sec);
}	

int main(){
	
	int n;cin >> n;
	vector<ll> v(1>>n);
	
	REP(i,1<<n){
		ll tmp;cin >> tmp;
		ans[i].FI = tmp;
	}
	
	REP(i,n){
		for(int j = 0;j < (1<<n);j++){
			if(j & (1 << i)){
				ans[j] = toptwo(ans[j],ans[j^(1<<i)]);
			}
		}
	}
	
	REP(i,1<<n){
		ret[i] = ans[i].FI + ans[i].SE;
	}
	
	REP(i,1<<n){
		ret[i+1] = max(ret[i+1],ret[i]);
	}
	
	for(int i = 1;i < (1<<n);i++){
		cout << ret[i] << endl;
	}
	
	return 0;
}


Measured memory_bytes: 13312
n = int(input())
a = list(map(int,input().split()))
ans = "APPROVED"

for i in range(n):
    if a[i] % 2 == 0:
        if a[i] % 3 != 0 and a[i] % 5 != 0:
            ans = "DENIED"
            
print(ans)


Measured memory_bytes: 2940
#include<stdio.h> 
#define M 10001
#define NIL -1
void Preorder(int);
void Inorder(int);
void Postorder(int);
typedef struct Node{int p,l,r;}Node;
Node Tree[M];
int s;

int main(){
  int i,u,l,r,id;
  
  scanf("%d",&s);
  for(i = 0; i < s; i++){
    Tree[i].p = NIL;
  }
  
  for(i = 0; i < s; i++){
    scanf("%d %d %d",&id,&l,&r);     
    Tree[id].l = l;
    Tree[id].r = r;
    if(l != NIL) Tree[l].p = id;
    if(r != NIL) Tree[r].p = id;
  }
  
  for(i = 0; i < s; i++){
    if(Tree[i].p == NIL) u = i;
  }
  printf("Preorder\n");
  Preorder(u);
  printf("\nInorder\n");
  Inorder(u);
  printf("\nPostorder\n");
  Postorder(u);
  printf("\n");
  return 0;
}


void Preorder(int u){ 
  if(u == NIL) return;
  printf(" %d",u);
  Preorder(Tree[u].l);
  Preorder(Tree[u].r);
}

void Inorder(int u){ 
  if(u == NIL) return;
  Inorder(Tree[u].l);
  printf(" %d",u);
  Inorder(Tree[u].r);
}

void Postorder(int u){ 
  if(u == NIL) return;
  Postorder(Tree[u].l);
  Postorder(Tree[u].r);
  printf(" %d",u);
}



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

int main() {
    string S, T;
    cin >> S >> T;
    bool ans = false;

    for (int i = 0; i < S.size(); ++i) {
        if (S == T) {
            ans = true;
            break;
        }
        S = S.back() + S.substr(0, S.size() - 1);
    }
    if (ans) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
#include<math.h>
using namespace std;

int main() {
	int n,i;
	cin>>n;
	int a[n];
	long int ans=0,now=1;
	
	for(i=0;i<n;i++){
		cin>>a[i];
	}
	
	ans+=a[0]-1;
	for(i=1;i<n;i++){
		if(a[i]==now+1){
			now++;
		}
		else if(a[i]>now+1){
			if(a[i]%(now+1)==0){
				ans+=a[i]/(now+1)-1;
			}
			else{
				ans+=a[i]/(now+1);
			}
		}
	}
	
	cout<<ans<<endl;
}

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

namespace ABC172
{
    class C
    {
        static void Main(string[] args)
        {
            // var CA = Enumerable.Repeat(0, (int)N).Select(_ => Console.ReadLine().Split().Select(long.Parse).ToArray()).ToArray();
            var NMK = Console.ReadLine().Split().Select(long.Parse).ToArray();
            var A = Console.ReadLine().Split().Select(long.Parse).ToArray();
            var B = Console.ReadLine().Split().Select(long.Parse).ToArray();

            var N = NMK[0]; var M = NMK[1]; var K = NMK[2];

            var Acs = new long[N + 1];
            for (int i = 0; i < N; i++)
            {
                Acs[i + 1] = A[i] + Acs[i];
            }
            //Console.WriteLine(string.Join(" ", Acs));

            var Bcs = new long[M + 1];
            for (int i = 0; i < M; i++)
            {
                Bcs[i + 1] = B[i] + Bcs[i];
            }
            var Bcsmax = Bcs.Max();
            //Console.WriteLine(string.Join(" ", Bcs));


            var max = 0;
            var tmpmax = 0;
            for (int i = 0; i < N + 1; i++)
            {
                if (K < Acs[i]) continue;
                tmpmax = i;
                var tmp = K - Acs[i];
                //var b = Array.BinarySearch(B, tmp);
                if (0 <= Array.BinarySearch(Bcs, tmp))
                {
                    tmpmax += Array.BinarySearch(Bcs, tmp);
                }
                else
                {
                    //if (Bcsmax <= tmp) tmpmax += ~Array.BinarySearch(Bcs, tmp);
                    //else 
                    tmpmax += ~Array.BinarySearch(Bcs, tmp) - 1;
                    //Console.WriteLine(Bcsmax);
                }
                max = Math.Max(max, tmpmax);
            }
            Console.WriteLine(max);
        }
    }
}


Measured memory_bytes: 73316
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <tuple>
#include <cmath>
using namespace std;

int main(int argc, const char * argv[]) {
  int64_t n;
  cin >> n;
  for(int64_t i = n; i >= 1; i--){
    if(pow((int64_t)sqrt(i),2) == i){
      cout << i << endl;
      return 0;
    }
  }
  cout << 1 << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef		long long       ll;
typedef		vector<ll>      vll;
#define     fi              first
#define     se              second
#define		pb              push_back
#define		nn              "\n"
#define		all(p)          p.begin(),p.end()
#define		zz(v)           (ll)v.size()
#define 	S(a)            scanf("%lld",&a)
#define 	SS(a,b)         scanf("%lld %lld",&a,&b)
#define 	SSS(a,b,c)      scanf("%lld %lld %lld",&a,&b,&c)
#define		ss              ' '
#define     pii             pair<ll,ll>
const double eps = 1e-8;

ll ar[100010];
ll dp[100010];
ll n,k;

int main()
{
    memset(dp,-1,sizeof(dp));
    cin>>n>>k;
    for(ll i=1; i<=n; i++)
        cin>>ar[i];
    dp[1]=0;
    dp[0]=1e6;
    for(ll i=2; i<=n; i++)
    {
        ll ans=INT_MAX;
        for(ll j=1; j<=k; j++)
        {
            if(i-j>=0)
            {
                ans=min(ans,abs(ar[i]-ar[i-j])+dp[i-j]);
            }
            else
                break;
        }
        dp[i]=ans;
    }
    cout<<dp[n]<<ss;
}








Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const int MOD = 1000000007;
const int INF = 1e9;

const int mod = 1000000007;
const int inf = 1e9;
#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    vector<char> a(3);
    for(int i = 0; i < 3; i++) cin >> a[i];
    sort(a.begin(), a.end());
    if(a[0] == 'a' && a[1] == 'b' && a[2] == 'c') cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
x = list(map(int, input().split()))
ans=[0]*(n-k+1)
# zip関数は多い元は無視する.
for i, a, b in zip(range(n), x, x[k-1:]):
    ans[i] = b-a + min(abs(a), abs(b))
print(min(ans))

Measured memory_bytes: 14380
n = list(map(int,input().split()))
x1 = n[0]
x2 = n[2]
y1 = n[1]
y2 = n[3]
x3 = x2 + y1 - y2
y3 = y2 + x2 - x1
x4 = x1 + y1 - y2
y4 = y1 + x2 - x1
print(x3,y3,x4,y4)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define MOD 1000000007
using namespace std;
int main() {
    int a, b;
    cin >> a >> b;
    for(int i = 0; i < 9000000; i++) {
        if((i * 8) / 100 == a && (i * 10) / 100 == b) {
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define x first
#define y second
#define pb push_back
#define eb emplace_back
#define all(a) (a).begin(),(a).end()
#define SZ(a) (int)(a).size()
#define FOR(i, a, b) for(int i=(a); i<=(b); ++i)
#define iFOR(i, a, b) for(int i=(a); i>=(b); --i)
#define make_unique(a) sort(all((a))), (a).resize(unique(all((a)))-(a).begin())

using namespace std;

typedef pair<int,int> PII;
typedef long long LL;
typedef double DD;
typedef long double LD;
typedef pair<LL,LL> PLL;
typedef pair<DD,DD> PDD;
typedef vector<int> VI;
typedef vector<LL> VL;

int main(){
	int i,j,k,l,a,b,c,d;
	scanf("%d%d",&a,&b);
    c = 0;
    FOR(i, 1, b) scanf("%d",&d), c+=d;
    printf("%d",max(-1, a-c));
	return 0;
}
/*
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 */


Measured memory_bytes: 3824
#include <iostream>
#include <algorithm>

int main(){
  int x, y;
  std::cin >> x >> y;

  if(x < y) std::swap(x, y);
  int r = 0;

  while(y > 0){
    r = x % y;
    x = y;
    y = r;
  }

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


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

int main() {
  int H, W;
  cin >> H >> W;
  for(int i=0; i<(W+2); i++)
    cout << '#';
  cout << endl;
  for(int j=0; j<H ; j++){
    cout <<'#';
    for(int i=0; i<W; i++){
      char a;
      cin >> a;
      cout << a;
    }
    cout << "#" << endl;
  }
  
  for(int i=0; i<(W+2); i++)
    cout << '#';
  cout << endl;
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
using namespace std;
// typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define ll long long 
#define scn(n) scanf("%d",&n)
#define lscn(n) scanf("%lld",&n)
#define lpri(n) printf("%lld",n)
#define pri(n) printf("%d",n)
#define pln() printf("\n")
#define priln(n) printf("%d\n",n)
#define lpriln(n) printf("%lld\n",n)
#define rep(i,init,n) for(int i=init;i<n;i++)
#define pb push_back     
#define mp make_pair
#define F first
#define S second
#define gcd __gcd
#define inf INT_MAX
#define ninf INT_MIN   
#define linf LLONG_MAX
#define lninf LLONG_MIN   
const ll mod=1e9+7;
const int N=1e5+4;

int main()
{
	ll n,s; lscn(n); lscn(s);

	if(s > n)
	{
		pri(-1); return 0;
	}

	ll ans = LLONG_MAX;

	if(n == s)
	ans = n+1;

	// if(s == 1)
	// ans = n;

	for(ll i=2;i*i <= n;i++)
	{
		ll sum = 0;

		ll temp = n;

		while(temp)
		{
			sum += temp%i; temp/=i;
		}

		if(sum == s)
		ans = min(ans,i);
	}

	ll val = n-s;

	for(ll i=1;i*i<=val;i++)
	if(val%i == 0)
	{
		ll x = i, y = val/i;

		if(x <= s and (s-x) < y+1)
		{
			assert((y+1)*x + (s-x) == n);

			// cout<<x<<" "<<s-x<<" "<<y+1<<endl;

			ans = min(ans,y+1);
		}
	}

	if(ans == LLONG_MAX)
	ans = -1;

	lpri(ans);

	return 0;
}


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

class _C
{
	void _()
	{

		var s = _Ss();

		string S = s[0];
		string ss = "";
		for (int i=0;i<S.Length;i++)
		{
			var c = S[i];
			if (c == 'B')
			{
				if (ss.Length==0) {
				}
				else {
					ss=ss.Remove(ss.Length-1,1);
				} 
			}
			else {
				ss += c;
			}
		}

		Console.WriteLine(ss);
		
	}

	static void Main(string[] args)
  {
    new _C()._();
  }

  #region

  string _S()
  {
    return Console.ReadLine();
  }

  string[] _Ss()
  {
    return Console.ReadLine().Split();
  }

  int[] _N(int n)
  {
    var x = new int[n];
    for (var i = 0; i < n; i++)
    {
      x[i] = int.Parse(Console.ReadLine());
    }
    return x;
  }

  int[] _Ns()
  {
    var ss = Console.ReadLine().Split();

    var x = new int[ss.Length];
    for (var i = 0; i < ss.Length; i++)
      x[i] = int.Parse(ss[i]);

    return x;
  }
  #endregion
}

Measured memory_bytes: 2648
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int main() {
    int h, w; cin >> h >> w;
    int n; cin >> n;
    vint a(n);
    rep(i,n) cin >> a[i];
    vint tmp;
    rep(i,n) {
        rep(j,a[i]) tmp.push_back(i+1);
    }
    vvint field(h,vint(w));
    rep(i,h)rep(j,w) {
        if (!(i&1)) field[i][j] = tmp[i*w+j];
        else field[i][w-j-1] = tmp[i*w+j];
    }
    rep(i,h) {
        rep(j,w) cout << field[i][j] << " ";
        cout << endl;
    }

}

Measured memory_bytes: 384
import sys

def check(cards):
    ones, twos, threes, fours = 0, 0, 0, 0
    for i in range(1, 14):
        c = cards.count(i)
        if c == 1: ones += 1
        elif c == 2: twos += 1
        elif c == 3: threes += 1
        elif c == 4: fours += 1
    
    if fours:
        return 'four card'
    if threes and twos:
        return 'full house'
    if ones == 5:
        for i, v in enumerate(cards[:-1]):
            if not v == cards[i + 1] - 1:
                break
        else: return 'straight'
        if cards == [1, 10, 11, 12, 13]:
            return 'straight'
    if threes:
        return 'three card'
    if twos == 2:
        return 'two pair'
    if twos:
        return 'one pair'
    return 'null'

def solve():
    for line in sys.stdin:
        cards = sorted(map(int, line.split(',')))
        print(check(cards))

if __name__ == "__main__":
    solve()



Measured memory_bytes: 5600
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
typedef vector<string> vstring;
#define _GLIBCXX_DEBUG
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
const int INF = 1 << 30;
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
#define stp(x)  setprecision(x)
int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  vlong a(n);
  vint count(32,0);
  rep(i,n){
      cin>>a[i];
      ll cp=a[i];
      int fg=0;
      while(cp!=0){
          count[fg]+=cp%2;
          cp/=2;
          fg++;
      }
  }

  rep(i,n){
      ll ans=0;
      ll fg=0;

      for(int j=0;j<33;j++){
          int tmp=a[i]%2;
          if((tmp==0 && count[j]%2==1) || (tmp==1 && count[j]%2==0)){
              ans+=pow(2,j);
          }
          a[i]/=2;
          
      }
      cout<<ans<<' ';
  }
  return(0);
}


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

using namespace std;

int main()
{

    int length;     cin >> length;

    int* arr = new int[length];
    int* ext = new int[length];
    for (int i = 0; i < length; i++){
        cin >> arr[i];
        ext[i] = arr[i];
    }

    sort(ext, ext+length);

    for (int i = 0; i < length; i++){

        if (arr[i] == ext[length-1]){
            cout << ext[length-2] << endl;
        }

        else {
            cout << ext[length-1] << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,int> pdi;
typedef pair<double,double> pdd;
typedef pair<double,ll> pdl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<vl> vvl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<pdd> vdd;
typedef vector<pdi> vdi;
typedef vector<pdl> vdl;
typedef vector<string> vs;
#define fi first
#define se second
const ll INFLL=LLONG_MAX;
const int INF=INT_MAX;
const ll MAXLL=0x3f3f3f3f3f3f3f3f;
const int MAX=0x3f3f3f3f;
const ll MOD=1000000007;
const ll mod=998244353;
#define eb emplace_back
#define emp emplace
#define mp(a,b) make_pair(a,b)
template<class T> using min_heap=priority_queue<T,vector<T>,greater<T> >;
template<class T>
void sort(vector<T>& v){
	sort(v.begin(),v.end());
}
template <class T, class U>
void sort(vector<T>& v,U func){
	sort(v.begin(),v.end(),func);
}
template<class T>
void rsort(vector<T>& v){
	sort(v.rbegin(),v.rend());
}
template <class T>
int lb_index(vector<T>& v,T k){
	return lower_bound(v.begin(),v.end(),k)-v.begin();
}
template <class T>
int ub_index(vector<T>& v,T k){
	return upper_bound(v.begin(),v.end(),k)-v.begin();
}
template<class T>
bool is_sorted(vector<T>& v){
	return is_sorted(v.begin(),v.end());
}
template<class T>
bool sorted(vector<T>& v){
	return is_sorted(v);
}
void precompute(){

	return;
}
void solve(){
	ll n;
	cin>>n;
	if(n&1||n<10){
		cout<<0;
		return;
	}
	ll ans=0;
	ll p=2;
	for(ll i=1;;i++){
		if(p<2||n/p==0)break;
		p*=5;
		ans+=n/p;
	}
	cout<<ans;
	return;
}

int main(){
	ios::sync_with_stdio(0);
	int numberofsubtestcases=1;
//	cin>>numberofsubtestcases;
	precompute();
	for(int looping=1;looping<=numberofsubtestcases;looping++){
//		cout<<"Case #"<<looping<<": ";
		solve();
	}
	return 0;
}




Measured memory_bytes: 3648
#include<iostream>
#include<algorithm>

using namespace std;
int main(){
	char s[19];
	cin>>s;
	
	for(int i=0; i<19; i++){
		if(s[i] == ','){
			cout<<" ";
			continue;
		}
		cout<<s[i];
	}
	cout<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cmath>
#include <iomanip>
#include <string>

typedef long long ll;
using namespace std;
const int mod = 1000000007;

int main() {

    int N;
    cin >> N;
    string S;
    cin >> S;

    int ans = 0;
    string A = "ABC";
    for (int i = 0; i < N - 2; i++) {
        if (A == S.substr(i, 3)) {
            ans++;
            i += 2;
        }
    }

    cout << ans << '\n';

}


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

public class Main{
    static StringTokenizer st;
    static BufferedReader br;  
    static PrintWriter out;
 
    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
 
        int K = nextInt();
        
        long sum = 0;

        for (int i=1; i<=K; i++) {
            for (int j=1; j<=K; j++) {
                for (int k=1; k<=K; k++) {
                    sum += gcd(j, gcd(i, k));
                }
            }
        }
        System.out.println(sum);
    }

    public static int gcd(int a, int b) {
        if(b==0) return a;

        return gcd(b, a%b);
    }
      
    public static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
    public static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

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

    static String next() throws IOException {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine().trim());
        return st.nextToken();
    }
}

Measured memory_bytes: 32916
use std::io;
use std::cmp;


fn main() {
    let (n, k) = {
        let i = read::<usize>();
        (i[0], i[1])
    };

    let mut hn = Vec::new();
    for _ in 0..n {
        hn.push(read_one::<usize>());
    }
    hn.sort();

    let mut ans = 100_000_000_000;
    for i in 0..n - k + 1{
        let min = hn[i];
        let max = hn[i + k - 1];
        ans = cmp::min(ans, max - min);
    }

    println!("{}", ans);
}


#[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>
#include <algorithm>

using namespace std;

int h, w;
int bd[1500][1500];
int dp[1500][1500];

int solve() {
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (bd[i][j])
        dp[i+1][j+1] = 0;
      else {
        dp[i+1][j+1] = 1;
        int k = min(dp[i][j], min(dp[i+1][j], dp[i][j+1]));
        dp[i+1][j+1] = k + 1;
      }
    }
  }

  int ret = 0;
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      ret = max(ret, dp[i+1][j+1] * dp[i+1][j+1]);
    }
  }
  
  return ret;
}

int main(int argc, char *argv[])
{
  scanf(" %d %d", &h, &w);
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      scanf(" %d", bd[i] + j);
    }
  }
  printf("%d\n", solve());
  return 0;
}

Measured memory_bytes: 18028
#pragma GCC optimize(2)
#include <bits/stdc++.h>
using namespace std;

typedef long long LL;
#define dbg(x) cout << #x"=" << x << endl; 

int main(){ 
    //freopen("in.txt", "r", stdin);
    int N;
    cin >> N;
    int ans = 0;
    for(int i = 1; i <= N; ++i){
        int x = i;
        int cnt = 0;
        while(x){
            x /= 10;
            ++cnt;
        }
        if(cnt&1) ++ans;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using Pair = pair<int64_t, int64_t>;
constexpr int64_t kInf = INT64_MAX / 2L;

// std::cout << std::setprecision(20) << 1.1 << endl;

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

  int64_t N;
  cin >> N;
  // const int64_t L = static_cast<int64_t>(T.length());
  vector<int64_t> A(N);
  for (int64_t i = 0; i < N; ++i) {
    cin >> A[i];
  }
  sort(A.begin(), A.end());
  reverse(A.begin(), A.end());

  int64_t result = A[0];
  // cerr << "hoge " << A[0] << endl;
  using mypair = pair<int64_t, Pair>;
  multiset<mypair, std::greater<mypair>> nextscore_pair;
  nextscore_pair.insert(mypair(A[1], Pair(0, 1)));
  nextscore_pair.insert(mypair(A[1], Pair(0, 1)));
  for (int64_t i = 2; i < N; ++i) {
    result += nextscore_pair.begin()->first;
    // cerr << "hoge " << nextscore_pair.begin()->first << endl;
    const int64_t next_1 = nextscore_pair.begin()->second.first;
    const int64_t next_2 = nextscore_pair.begin()->second.second;
    nextscore_pair.erase(nextscore_pair.begin());
    nextscore_pair.insert(mypair(A[i], Pair(i, next_1)));
    nextscore_pair.insert(mypair(A[i], Pair(i, next_2)));
  }
  cout << result << endl;
  return 0;
}


Measured memory_bytes: 17184
#include<iostream>
#include<vector>
#include<algorithm>
#include <queue>
#include<string>
#include<utility>

#define lli long long
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.rend()
#define rep0(i,j) for(lli i=0;i<j;i++)
#define rep1(i,j) for(lli i=1;i<=j;i++)
#define rep0d(i,j) for(lli i=j-1;i>=0;i--)
#define MAX 1000000007
typedef struct tree Tree;

using namespace std;


bool cmpf(pair<lli, lli> left, pair<lli, lli> right) {
	return left.first < right.first;
}

struct tree {
	queue<lli> leaf;
	lli num;
};

Tree t[200001];

void dfs(lli n, lli num) {
	t[n].num += num;
	while (!t[n].leaf.empty()) {
		dfs(t[n].leaf.front(), t[n].num);
		t[n].leaf.pop();
	}

}
int main() {
	double a;
	cin >> a;
	cout << ((int)(1+a)/2)/a;
}


Measured memory_bytes: 136320