akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>


using namespace std;
#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 repd(i,n) for (int i = (int)(n - 1); i >= 0; --i)
#define repds(i,n) for (int i = (int)(n); i > 0; --i)
#define loop(i,x,n) for (int i = (int)(x); i < (n); ++i)
#define loops(i,x,n) for (int i = (int)(x); i <= (n); ++i)
#define loopd(i,x,n) for (int i = (int)(x); i > (n); --i)
#define loopds(i,x,n) for (int i = (int)(x); i >= (n); --i)
#define itrep(i,s) for (auto i = begin(s); i != end(s); ++i)
#define itrepd(i,s) for (auto i = --end(s); i != begin(s); --i)
#define all(f,x,...) [&](decltype(x)& whole) { return (f)(begin(whole), end(whole), ##__VA_ARGS__); }(x)
#define rall(f,x,...) [&](decltype(x)& whole) { return (f)(rbegin(whole), rend(whole), ##__VA_ARGS__); }(x)
using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e17);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e17;
ll mod = static_cast<ll>(1e9 + 7);
std::ostream& endn(std::ostream& os) { return os.put(os.widen('\n')); }
template<class T> constexpr int sz(const T& a) { return (int)a.size(); }
template<class T> constexpr T pow2(const T a) { return a * a; }
template<class T, class ... Args> constexpr T mins(T& a, Args... args) { return a = min<T>({ a, args... }); }
template<class T, class... Args> constexpr T maxs(T& a, Args... args) { return a = max<T>({ a,args... }); }
template<typename A, size_t N, typename T>
void fillArray(A(&array)[N], const T& val) { std::fill((T*)array, (T*)(array + N), val); }

ll n;
int k;
void solve() {
    cin >> n >> k;

    ll ans = 0;
    while (n != 0) {
        ++ans;
        n /= k;
    }

    cout << ans << endn;

}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    cout << flush;
    return 0;
}


Measured memory_bytes: 256
R, G, B, N = map(int, input().split())

ans = 0
for i in range(int(N / R) + 1):
    for j in range(int((N - i * R) / G) + 1):
        if (N - (i * R + j * G)) % B == 0:
            ans += 1
print(ans)

Measured memory_bytes: 2940
#include <stdio.h>
#include <math.h>

int main(void)
{
    double x1, x2, y1, y2;
    
    scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);
    
    printf("%lf\n", sqrt(pow(x1 - x2, 2.0) + pow(y1 - y2, 2.0)));
    
    return 0;
}


Measured memory_bytes: 2044
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <utility>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#define MOD 1000000007
#define int long long
using namespace std;
using P = pair<int, int>;
using ll = long long;
using prique = priority_queue<int>;
signed main(){
    int n,m;
    cin>>n>>m;
    vector<pair<int,int>> town[n];
    for(int i=0;i<m;i++){
        int p,y;
        cin>>p>>y;
        town[p-1].push_back(make_pair(y, i));
    }
    vector<pair<int,string>> a;
    for(int i=0;i<n;i++){
        sort(town[i].begin(),town[i].end());
        for(int j=0;j<town[i].size();j++){
            a.push_back(make_pair(town[i][j].second,to_string(1000000+i+1).substr(1,6)+to_string(1000000+j+1).substr(1,6)));
        }
    }
    sort(a.begin(),a.end());
    for(int i=0;i<m;i++){
        cout<<a[i].second<<endl;
    }
    return 0;
}


Measured memory_bytes: 13168
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
#include <sstream>
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);
#define mod 1000000007
#define eps 1e-6
#define ll long long
#define INF 0x3f3f3f3f
#define MEM(x,y) memset(x,y,sizeof(x))
using namespace std;
int dt[][2]= {{1,0},{-1,0},{0,1},{0,-1},{0,0}};
//typedef pair<int, int> P;
//priority_queue<int, vector<int>, greater<int> > q;
int main(){
    IOS;
    int a,b,c;
    cin >> a >> b >> c;
    cout<<c<<" "<<a<<" "<<b;
}


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

int n;
int cnt[60][30];

int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; ++i) {
		double x;
		scanf("%lf", &x);
		long long v = x * 1e9 + 0.5;
		int a = 0, b = 0;
		while (v % 2 == 0) {
			++a;
			v /= 2;
		}
		while (v % 5 == 0) {
			++b;
			v /= 5;
		}
		++cnt[a][b];
	}
	long long ans = 0;
	for (int i = 0; i < 60; ++i) {
		for (int j = 0; j < 30; ++j) {
			for (int k = 0; k < 60; ++k) {
				for (int l = 0; l < 30; ++l) {
					if (i + k >= 18 && j + l >= 18) {
						ans += 1ll * cnt[i][j] * cnt[k][l];
					}
				}
			}
			if (i + i >= 18 && j + j >= 18) {
				ans -= cnt[i][j];
			}
		}
	}
	printf("%lld\n", ans / 2);
}

Measured memory_bytes: 3796
#include <bits/stdc++.h>
using namespace std;
 
const int N = 150 * 2;
 
int n, ans, a[N];
 
int main() {
    scanf("%d", &n);
    for(int i = 1; i <= 2 * n; i++)
        scanf("%d", a + i);
    sort(a + 1, a + 1 + 2 * n);
    for(int i = 1; i <= 2 * n; i += 2) 
        ans += a[i];
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define MAXN 100009
#define INF 1000000007
#define mp(x,y) make_pair(x,y)
#define all(v) v.begin(),v.end()
#define pb(x) push_back(x)
#define wr cout<<"----------------"<<endl;
#define ppb() pop_back()
#define tr(ii,c) for(__typeof((c).begin()) ii=(c).begin();ii!=(c).end();ii++)
#define ff first
#define ss second
#define my_little_dodge 46
#define debug(x)  cerr<< #x <<" = "<< x<<endl;
using namespace std;

typedef long long ll;
typedef pair<int,int> PII;
template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
vector<int>adj[MAXN];
int dp[MAXN];
void dfs(int nd,int pr){
	int sum=0;
	for(int i=0;i<int(adj[nd].size());i++){
		int to=adj[nd][i];
		if(to==pr)
			continue;
		dfs(to,nd);	
		sum+=max(1,dp[to]);
	}
	dp[nd]=sum;
	for(int i=0;i<int(adj[nd].size());i++){
		int to=adj[nd][i];
		if(to==pr)
			continue;
		umin(dp[nd],sum-max(1,dp[to])+dp[to]);	
	}
	//~ debug(nd);
	//~ debug(dp[nd]);
	//~ wr
}
int main(){
    //~ freopen("file.in", "r", stdin);
    int n;
    scanf("%d",&n); 
    for(int i=0;i<n-1;i++){
		int u,v;
		scanf("%d%d",&u,&v);
		adj[u].pb(v);
		adj[v].pb(u);
	}
	int root=-1;
	for(int i=0;i<n;i++)
		if(adj[i].size()>=3){
			root=i;
			break;
		}
	if(~root){
		dfs(root,-1);
		printf("%d\n",dp[root]);
	}
	else
		puts("1");
	return 0;
}


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

using ll=int64_t;
#define int ll

#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)
#define MP make_pair
#define PB push_back
#define ALL(x) x.begin(),x.end()
#ifdef MAROON_LOCAL
#define cerr (cerr<<"-- line "<<__LINE__<<" -- ")
#else
class CerrDummy{}cerrDummy;
template<class T>
CerrDummy& operator<<(CerrDummy&cd,const T&){
	return cd;
}
using charTDummy=char;
using traitsDummy=char_traits<charTDummy>;
CerrDummy& operator<<(CerrDummy&cd,basic_ostream<charTDummy,traitsDummy>&(basic_ostream<charTDummy,traitsDummy>&)){
	return cd;
}
#define cerr cerrDummy
#endif
#define REACH cerr<<"reached"<<endl
#define DMP(x) cerr<<#x<<":"<<x<<endl
#define ZERO(x) memset(x,0,sizeof(x))
#define ONE(x) memset(x,-1,sizeof(x))

using pi=pair<int,int>;
using vi=vector<int>;
using ld=long double;

template<class T,class U>
ostream& operator<<(ostream& os,const pair<T,U>& p){
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

template<class T>
ostream& operator <<(ostream& os,const vector<T>& v){
	os<<"[";
	REP(i,(int)v.size()){
		if(i)os<<",";
		os<<v[i];
	}
	os<<"]";
	return os;
}

ll read(){
	ll i;
	scanf("%" SCNd64,&i);
	return i;
}

void printSpace(){
	printf(" ");
}

void printEoln(){
	printf("\n");
}

void print(ll x,int suc=1){
	printf("%" PRId64,x);
	if(suc==1)
		printEoln();
	if(suc==2)
		printSpace();
}

string readString(){
	static char buf[3341000];
	scanf("%s",buf);
	return string(buf);
}

char* readCharArray(){
	static char buf[3341000];
	static int bufUsed=0;
	char* ret=buf+bufUsed;
	scanf("%s",ret);
	bufUsed+=strlen(ret)+1;
	return ret;
}

template<class T,class U>
void chmax(T& a,U b){
	if(a<b)
		a=b;
}

template<class T,class U>
void chmin(T& a,U b){
	if(b<a)
		a=b;
}

template<class T>
T Sq(const T& t){
	return t*t;
}

#define CAPITAL
void Yes(bool ex=true){
	#ifdef CAPITAL
	cout<<"YES"<<endl;
	#else
	cout<<"Yes"<<endl;
	#endif
	if(ex)exit(0);
}
void No(bool ex=true){
	#ifdef CAPITAL
	cout<<"NO"<<endl;
	#else
	cout<<"No"<<endl;
	#endif
	if(ex)exit(0);
}

const ll infLL=LLONG_MAX/3;

#ifdef int
const int inf=infLL;
#else
const int inf=INT_MAX/2-100;
#endif

signed main(){
	int n=read();
	int s=0,mn=inf;
	REP(i,n){
		int a=read(),b=read();
		if(a>b)chmin(mn,b);
		s+=a;
	}
	if(mn==inf)
		cout<<0<<endl;
	else
		cout<<s-mn<<endl;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll inf=1000000000000000000;
double pi=2*acos(0);
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}

int main(){
    ll n;cin>>n;
    ll ans=inf;
    for(ll i=1;i*i<=n;i++){
        if(n%i==0){
            ll u=n/i;
            ans=min(i-1+u-1,ans);
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>
using ll = long long;
using namespace std;

int const MOD = 1e9 + 7;
int main(void)
{
    int N;
    cin >> N;
    double T, A;
    cin >> T >> A;

    double minV = 1000000.0;
    int ans = 0;
    for (int i = 0; i < N; ++i)
    {
        double h;
        cin >> h;
        if (minV > abs(A - (T - 0.006 * h)))
        {
            minV = abs(A - (T - 0.006 * h));
            ans = i;
        }
    }
    cout << ans + 1 << endl;
    return 0;
}

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)

using namespace std;

int main() {
    long long L,R;
    cin >> L >> R;
    bool a[2020] = {false};
    bool isZero = false;
    for(long long i=L;i<=min(R,L+2019);i++){
        a[i%2019]=true;
    }
    if(a[0] || (a[3]&&a[673])) cout << 0 << endl;
    else{
        int minV = 2020;
        repi(i,1,2019){
            if(a[i%2019]){
                repi(j,i+1,2019){
                    if(a[j%2019]){
                        int value = (i%2019)*(j%2019)%2019;
                        if(value<minV) minV=value;
                        if(minV==0)break;
                    }
                }
                if(minV==0)break;
            }
        }
        cout << minV << endl;
    }
}


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

int main(){
    long long n, k;
    cin >> n >> k;
    long long c[n], p[n];
    long long maxc = -1e18;
    for(long long i = 0; i < n; i++) cin >> p[i], p[i]--;
    for(long long i = 0; i < n; i++) cin >> c[i], maxc = max(maxc, c[i]);

    if(maxc < 0){
        printf("%lld\n", maxc);
        return 0;
    }

    vector<bool> used(n, false);

    long long ans = 0;

    for(long long i = 0; i < n; i++){
        if(used[i] == true) continue;
        vector<long long> loop;
        loop.push_back(i);
        long long now = i;
        while(p[now] != i){
            now = p[now];
            loop.push_back(now);
        }

        long long L = loop.size();
        long long S = 0;
        for(long long j = 0; j < L; j++) S += c[loop[j]];

        for(long long a_index = 0; a_index < L; a_index++){
            long long a = loop[a_index];
            used[a] = true;
            long long dist_ab = 0;
            long long cost_ab = -c[a];
            
            for(long long b_index = a_index; b_index < a_index + L; b_index++){
                long long b = loop[b_index%L];
                cost_ab += c[b];
                long long max_cost = cost_ab + max(0ll, S)*((k-dist_ab)/L);
                ans = max(ans, max_cost);
                dist_ab++;
                if(dist_ab > k) break;
            }
        }
    }

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

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

long long INF=1e18;

int main()
{
    long long n,k,ans=0;
    cin>>n>>k;
    for(int i=0; i<n; i++)
    {
        long long a;
        cin>>a;
        if(a>=k) ans++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,ans=0;
  bool c[100001]={false};
  cin >> n;
  for (size_t i = 0; i < n; i++) {
    int temp,temp2;
    cin >> temp >> temp2;
    for (size_t l = temp; l <= temp2; l++) {
      c[l] = true;
    }
  }
  for (size_t i = 0; i < 100001; i++) {
    if(c[i]){
      ans++;
    }
  }
  cout << ans;
}


Measured memory_bytes: 384
S = input().rstrip()
be = int(S[:2])
en = int(S[2:])
flag_be = False
flag_en = False
answer = ""
if be <= 12 and be >= 1:
    flag_be = True
if en <= 12 and en >= 1:
    flag_en = True

if flag_be and flag_en:
    answer = "AMBIGUOUS"
elif flag_be == True and flag_en == False:
    answer = "MMYY"
elif flag_be == False and flag_en == True:
    answer = "YYMM"
else:
    answer = "NA"
print(answer)

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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { std::cout << #a << " = " << a << "\n"; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T, class V> istream& operator>> (istream& ist, pair<T, V>& p) { return ist >> p.first >> p.second; }
template<class T> ostream& operator<< (ostream& ost, pair<T, T>& p) { return ost << p.first << ", " << p.second; }
template<class T> istream& operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) ist >> e; return ist; }

typedef long long ll;
int const inf = INT_MAX / 2;

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

  ll sum = 0;
  for (ll k = 1; k * k <= N; ++k) {
    if (N % k == 0) {
      auto m = N / k - 1;    
      if (k < m) { sum += m; }
    }
  }
  cout << sum << endl;
}


Measured memory_bytes: 256
#include <string>
#include <algorithm>
#include <iostream>

using namespace std;

int main(){
  string s;
  cin>>s;
  s.erase(unique(s.begin(),s.end()),s.end());
  if(s[0]=='o'||s[(int)s.size()-1]=='o')cout<<'o'<<endl;
  else cout<<"x"<<endl;
  return 0;
}

Measured memory_bytes: 0
S = input()

def month(a, b):
    c = 10*a+b
    if 0 < c <= 12:
        return "yes"
    else:
        return "no"
    
L = [int(S[i]) for i in range(4)]
if month(L[0], L[1]) == "yes":
    if month(L[2], L[3]) == "yes":
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if month(L[2], L[3]) == "yes":
        print("YYMM")
    else:
        print("NA")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define int long long int
#define MOD(x) ((x % MOD_N) + MOD_N) % MOD_N
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define RFORE(i,a,b) for(int i=(b);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(c) (c).begin(),(c).end()
#define RALL(c) (c).rbegin(),(c).rend()
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SZ(c) (int)((c).size())
#define EACH(i,v) for(auto i=v.begin();i!=v.end();++i)
#define REACH(i,v) for(auto i=v.rbegin();i!=v.rend();++i)
#define LB(c,x) distance((c).begin(),lower_bound(ALL(c),x))
#define UB(c,x) distance((c).begin(),upper_bound(ALL(c),x))
#define COUNT(c,x) (lower_bound(ALL(c),x)-upper_bound(ALL(c),x))
#define UNIQUE(c) SORT(c); (c).erase(unique(ALL(c)),(c).end());
#define COPY(c1,c2) copy(ALL(c1),(c2).begin())
#define EXIST(s,e) (bool)((s).find(e)!=(s).end())
#define PB push_back
#define MP make_pair
#define DUMP(x)  cerr<<#x<<" = "<<(x)<<endl;
#define NL cerr<<endl;
using namespace std;
template<typename T,typename U> using P=pair<T,U>;
template<typename T> using V=vector<T>;
template<typename T>bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<typename T>T sum(vector<T>&v){return accumulate(ALL(v),T());}
template<typename T>T sum(vector<T>&v,int a,int b){return accumulate(v.begin()+a,v.begin()+b,T());}
template<typename T>T max(vector<T>&v){return *max_element(ALL(v));}
template<typename T>T min(vector<T>&v){return *min_element(ALL(v));}
template<typename T>T max_index(vector<T>&v){return distance((v).begin(),max_element(ALL(v)));}
template<typename T>T min_index(vector<T>&v){return distance((v).begin(),min_element(ALL(v)));}

struct edge { int to, cost; };

template<typename T>auto&operator<<(ostream&s,const vector<T>&v){s<<"[";bool a=1;for(auto e:v){s<<(a?"":" ")<<e;a=0;}s<<"]";return s;}
template<typename T,typename U>auto&operator<<(ostream&s,const pair<T,U>&p){s<<"("<<p.first<<","<<p.second<<")";return s;}
template<typename T>auto&operator<<(ostream&s,const set<T>&st){s<<"{";bool a=1;for(auto e:st){s<<(a?"":" ")<<e;a=0;}s<<"}";return s;}
template<typename T,typename U>auto&operator<<(ostream&s,const map<T,U>&m){s<<"{";bool a=1;for(auto e:m){s<<(a?"":" ")<<e.first<<":"<<e.second;a=0;}s<<"}";return s;}

const int INF = 1e18;
const int MOD_N = 1e9+7;

signed main()
{
   int N; cin >> N;
   V<int> h(N+2);
   h[0] = -1;
   REP(i, N) cin >> h[i+1];
   h[N+1] = 0;

   deque<P<int,int>> deq;
   int ans = 0;
   REP(i, N+2) {
      while (!deq.empty() && deq.back().first >= h[i]) {
         int m = deq.back().first;
         deq.pop_back();
         int id = deq.back().second;
         chmax(ans , m * (i - id - 1));
      }
      deq.push_back(MP(h[i], i));
   }
   cout << ans << endl;

   return 0;
}



Measured memory_bytes: 5300
N,K = map(int, input().split())

S = [0]*(N+1)
S[0] = 0
for n in range(1,N+1):
    S[n] = S[n-1]+n

ans = 0
for k in range(K, N+1):
    ans += ((S[N]-S[N-k])-(S[k-1]))+1
    ans %= (10**9+7)

print((ans+1)%(10**9+7))

Measured memory_bytes: 19232
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
        int a[3];
        int even=0; int odd=0;
        int ans=0;
        for(int i=0; i<3; i++) {
                cin >> a[i];
        }
        for(int i=0; i<3; i++) {
                if(a[i]%2==0) even++;
                else odd++;
        }
        if(odd==2) {
                ans++;
                for(int i=0; i<3; i++) {
                        if(a[i]%2==1) a[i]++;
                }
        }
        else if(even==2) {
                ans++;
                for(int i=0; i<3; i++) {
                        if(a[i]%2==0) a[i]++;
                }
        }
        sort(a,a+3);
        int m=a[2];
        for(int i=0; i<3; i++) {
                ans+=(m-a[i])/2;
        }
        cout << ans << endl;
}


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

int main()
{
    long long int n,k;
    cin>>n>>k;
    long long sum=0,sum1=0;
    for(long long int i=k;i<=n+1;i++)
    {
        sum1=(((n+1)*i) + 1 - (i*i))%1000000007;
        sum=(sum+sum1)%1000000007;
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 3640
char T[99][99]={"OUT OF MAIN PANEL"};
X[99],Y[99],V[99],W[99],c[99],w;
P(p,d){
	for(c[p]=0;scanf("%[^/>]>%d,%d,%d,%d<",T[w],X+w,Y+w,V+w,W+w)&&scanf("%*[^>]>%[<]",&d,c[p]++,P(w++)););
}
main(n,x,y,i){
	for(;scanf("%d\n<",&n)*n;)
		for(w=1,P(0);n--;printf("%s %d\n",T[i],c[i]))
			for(scanf("%d%d",&x,&y),i=w;--i&&x<X[i]|y<Y[i]|x>V[i]|y>W[i];);
}

Measured memory_bytes: 0
N = int(input())
a = list(map(int, input().split()))

flg = False
ret = 0
i = 1
for tmp in a:
    if(i != tmp):
        ret += 1
    else:
        i += 1
        flg = True

if not flg:
    print(-1)
else:
    print(ret)


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

int main()
{
  string S, T;
  getline(cin, S);
  getline(cin, T);

  S += S;

  for (int i = 0; i < T.length(); ++i)
  {
    for (int j = 0;;)
    {
      if (S[i + j] == T[j])
      {
        if (++j == T.length())
        {
          cout << "Yes\n";
          return 0;
        }
      }
      else
        break;
    }
  }
  cout << "No\n";
  return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
#define uid(a, b) uniform_int_distribution<int>(a, b)(rng)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
 
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 100001; 

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); 
	cout.tie(NULL);
	ll d,t,s;
	cin>>d>>t>>s;
	if(d<=t*s)
	cout<<"Yes"<<nl;
	else
	cout<<"No"<<nl;
	return 0;
}


Measured memory_bytes: 3652
import sys
input = sys.stdin.readline
from collections import deque


def read():
    N = int(input().strip())
    P = list(map(int, input().strip().split()))
    return N, P


def solve(N, P):
    ans = 0
    p = deque(P)
    q = deque()
    q.append(p.popleft())
    for i in range(1, N):
        if i == q[-1]:
            c = q.pop()
            q.append(p.popleft())
            q.append(c)
            ans += 1
        else:
            q.append(p.popleft())
    if q[-1] == N:
        c = q.pop()
        d = q.pop()
        q.append(c)
        q.append(d)
        ans += 1
    return ans


if __name__ == '__main__':
    inputs = read()
    print(solve(*inputs))


Measured memory_bytes: 20796
n,p=map(int,input().split())
a=list(map(int,input().split()))
gu=0
ki=0
for i in a:
    if i%2==0:
        gu+=1
    else:
        ki+=1
if ki:
    print(2**(n-1))
else:
    if p:
        print(0)
    else:
        print(2**n)


Measured memory_bytes: 38256
#include<bits/stdc++.h>
using namespace std;
//define
typedef pair<int,int>pi;
#define int long long
#define rep(x,y) for(int i=x;i<y;i++)
#define REP(x,y) for(int j=x;j<y;j++)
#define Rep(x,y) for(int k=x;k<y;k++)
#define all(x) x.begin(),x.end()
#define pb push_back
#define vint vector<int>
#define vvint vector<vector<int>>
#define mod 100000007
#define elif else if
#define str string

signed main(){
  int N,M,O,P=0,count=0,count2=0;
  double d;
  char c;
  string S,T;
  vint A(0);
  cin>>N>>M>>O;
  for(int i=1;i<=max(N,M);i++){
    if(N%i==0&&M%i==0){
      A.pb(i);
    }
  }
  cout<<A[A.size()-O];
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(ll i = 0; i < n; i++)
#define rep2(i,start,end) for(ll i = start; i < end; i++)
#define dwn(i,n) for(int i = n; i >= 0; i--)
#define dwn2(i,start,end) for(ll i = start; i >= end; i--)
#define pll pair<ll,ll>
#define mk(x,y) make_pair(x,y)
#define pdl pair<double, ll>
const ll N = 4e5 + 200;
const ll INF = 0x3f3f3f;
const ll Mode = 1e9 + 7;


int main(){
	ll n,m;
	string s;
	cin>>s;
	ll len = s.length();
	ll sum = 0;
	string tmp = "";
	string now = "";
	rep2(i,0,len){
		now += s[i];
		if(now != tmp){
			sum++;
			tmp = now;
			now = "";
		}
	}
	cout<<sum<<endl;
	return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SHIFT_LEFT(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f),(t)-(f)))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll sx,sy,tx,ty;
  cin>>sx>>sy>>tx>>ty;
  string ans="";
  for(int i=0;i<tx-sx;i++){
    ans.pb('R');
  }
  for(int i=0;i<ty-sy;i++){
    ans.pb('U');
  }
  for(int i=0;i<tx-sx;i++){
    ans.pb('L');
  }
  for(int i=0;i<ty-sy;i++){
    ans.pb('D');
  }
  ans.pb('D');
  for(int i=0;i<=tx-sx;i++){
    ans.pb('R');
  }
  for(int i=0;i<=ty-sy;i++){
    ans.pb('U');
  }
  ans.pb('L');
  ans.pb('U');
  for(int i=0;i<=tx-sx;i++){
    ans.pb('L');
  }
  for(int i=0;i<=ty-sy;i++){
    ans.pb('D');
  }
  ans.pb('R');
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
x, n = map(int, input().split())
if n != 0:
    p = list(map(int, input().split()))
    #for i in range(n):
    #    p.append(input().split())
    #print(p)
    #rint(type(p[0]))
    min = 1e9
    ans = 0
    for i in range(102):
        #i = i + 1
        if i in p:
            continue
        sa = abs(x - i)
        #print(sa)
        if min > sa :
            min = sa
            ans = i
if n == 0:
    print(x)
else:
    print(ans)

Measured memory_bytes: 9192
#include <bits/stdc++.h>
#define int long long
const int INF = 1e18L + 5;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;

signed main() {

    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n; cin >> n;
    int d = to_string(n).size();
    // n桁の自然数の個数は10^n-10^(n-1)個
    int j = 1;
    int ans = 0;
    if (d % 2 == 1) {
        rep(i,(d-1)/2) {
            ans += 10*j - j;
            j *= 100;
        }
        ans += n - j + 1;
    }
    if (d % 2 == 0) {
        rep(i,d/2) {
            ans += 10*j - j;
            j *= 100;
        }
    }

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

Measured memory_bytes: 256
import java.util.*;

public class Main {

    int INF = Integer.MAX_VALUE;

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long X = sc.nextLong();
        long[] x = new long[N + 1];
        long[] x1=new long[N+1];
        for (int i = 0; i < N; i++) {
            x[i] = sc.nextInt();
        }
        x[N] = X;
        Arrays.sort(x);
        long ans = INF;
        for (int i = 1; i <= N; i++) {
            ans = Math.min(Math.abs(x[i] - x[i - 1]), ans);
        }
        for (int i = 1; i <=N; i++) {
            x1[i] = x[i] - x[i - 1];
        }
        for (int i = 2; i <= N; i++) {
            ans=(long)Math.min(gcd(x1[i],x1[i-1]),ans);
        }
        System.out.println(ans);
    }

    long gcd(long m, long n) {
        if (m < n) {
            return gcd(n, m);
        }
        if (n == 0) {
            return m;
        }
        return gcd(n, m % n);
    }
    
}


Measured memory_bytes: 61200
import numpy as np
N=int(input())
h=list(map(int,input().split()))

#N=4
#h=[10,30,40,20]

dp=np.zeros(N)
#print(dp)
dp[1]=abs(h[1]-h[0])
#print(dp)

for i in range(N-2):
  dp[i+2]=min(abs(h[i+2]-h[i])+dp[i],abs(h[i+2]-h[i+1])+dp[i+1])
 # print(dp)
  #dp[2]=min(h[2]-h[0],h[1]-h[0])

#total

print(int(dp[-1]))







Measured memory_bytes: 22840
package main

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

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)

	N, M := scanInt(), scanInt()

	Map := make([][]int, N)
	for i := 0; i < N; i++ {
		Map[i] = make([]int, M)
	}

	for j := 0; j < M; j++ {
		k := scanInt()
		for i := 0; i < k; i++ {
			s := scanInt() - 1
			Map[s][j] = 1
		}
	}

	p := make([]int, M)
	for i := 0; i < M; i++ {
		p[i] = scanInt()
	}

	ans := 0
	for i := 0; i < (1 << uint(N)); i++ {
		cnt := make([]int, M)
		for k := 0; k < N; k++ {
			if i&(1<<uint(k)) > 0 {
				for j := 0; j < M; j++ {
					cnt[j] += Map[k][j]
				}
			}
		}
		flg := 1
		for j := 0; j < M; j++ {
			if cnt[j]%2 != p[j] {
				flg = 0
				break
			}
		}
		if flg == 1 {
			ans++
		}
	}
	fmt.Println(ans)
}


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

using namespace std;

int main() {
    double x1, y1, x2, y2, dist;
    cin >> x1 >> y1 >> x2 >> y2;
    dist = sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2));
    printf("%f\n", dist);
}


Measured memory_bytes: 3212
/*   _/                _/                 _/_/_/   _/
  _/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
   _/     _/    _/   _/     _/    _/  _/_/_/     _/
  _/     _/    _/   _/     _/    _/  _/    _/   _/
   _/_/   _/_/       _/_/   _/_/      _/_/     _/ */
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
using ll=long long;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=1e9+5;
const ll INF=1e18+5;
using P=pair<int,int>;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  if(s=="ARC") {
    cout << "ABC" << endl;
  }
  else {
    cout << "ARC" << endl;
  }
}

Measured memory_bytes: 3640
function bomb(y,x){
   var Y=yx[y][x][1];
   var X=yx[y][x][0];
   if(ring.hasOwnProperty(Y+","+X)){
      var flag=true;
      for(var k in ring){
         if(obj.hasOwnProperty(k))flag=false;
         obj[k]=true;     
      } 
      if(flag)cnt++;
   }else{
      ring[Y+","+X]=true;
      bomb(Y,X);
   }
}
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr=input.trim().split("\n");
while(true){
   var n=arr.shift()-0;
   if(n==0)break;
   var yx=[];
   for(var i=0;i<n;i++){
      var tile=arr.shift().split(" ").map(Number);
      var t=[];
      for(var j=0;j<n;j++)t[j]=[tile.shift(),tile.shift()];
      yx.push(t);
   }
   var obj={};
   var cnt=0;
   for(var i=0;i<n;i++){
      for(var j=0;j<n;j++){
         if(obj.hasOwnProperty(i+","+j))continue;
         var ring={};
         ring[i+","+j]=true;
         bomb(i,j);
      }
   }
   console.log(cnt);
}

Measured memory_bytes: 29164
#include<stdio.h>
#include<string.h>
int main()
{
    long long x,y;
    char c;
    scanf("%lld %c %lld",&x,&c,&y);
    if(c=='+')
        printf("%lld\n",x+y);
    else if(c=='-')
        printf("%lld\n",x-y);
    return 0;
}


Measured memory_bytes: 128
# -*- coding: utf-8 -*-
import sys
from heapq import heappush,heappop,heapify
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

N=int(input())
X,Y=[],[]
for i in range(N):
    x,y=map(int,input().split())
    X.append((y,i))
    Y.append((x,i))
X.sort(key=lambda t:t[0])
Y.sort(key=lambda t:t[0])
edge=[[] for i in range(N)]
for i in range(N-1):
    edge[X[i][1]].append((abs(X[i][0]-X[i+1][0]),X[i+1][1]))
    edge[X[i+1][1]].append((abs(X[i][0]-X[i+1][0]),X[i][1]))
    edge[Y[i][1]].append((abs(Y[i][0]-Y[i+1][0]),Y[i+1][1]))
    edge[Y[i+1][1]].append((abs(Y[i][0]-Y[i+1][0]),Y[i][1]))

def prim(n,edges):
    used=[False]*n
    used[0]=True
    edgelist=[]
    for edge in edges[0]:
        heappush(edgelist,edge)
    cost=0
    while edgelist:
        minedge=heappop(edgelist)
        if used[minedge[1]]:
            continue
        v=minedge[1]
        used[v]=True
        for edge in edges[v]:
            if not used[edge[1]]:
                heappush(edgelist,edge)
        cost+=minedge[0]
    return cost

print(prim(N,edge))

Measured memory_bytes: 112732
starting = true
loop do
  a, b = gets.split.map(&:to_i)
  break if a.zero? and b.zero?
  puts unless starting
  starting = false
  c = 0
  (a..b).each do |y|
    if (y % 4).zero? && !(y % 100).zero? || (y % 400).zero?
      c += 1
      p y
    end
  end
  puts 'NA' if c.zero?
end

Measured memory_bytes: 8944
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int r=sc.nextInt();
		int D=sc.nextInt();
		int x=sc.nextInt();
		int i;
		for(i=0;i<10;i++) {
			x=r*x-D;
			System.out.println(x);
		}
	}

}


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

#define MAX_N 500000
struct Node {
	int key;
	Node *parent;
	Node *left;
	Node *right;
	Node() :key(0), parent(NULL), left(NULL), right(NULL) {}
	~Node(){}
};

Node *root, *NIL;

Node* find(Node *u, int key) {
	while (u != NIL && key != u->key) {
		if (key < u->key) u = u->left;
		else u = u->right;
	}
	return u;
}

void insert(int key) {
	Node *y = NIL;
	Node *x = root;
	Node *z;

	z = new Node;
	z->key = key;
	z->left = NIL;
	z->right = NIL;

	while (x != NIL) {
		y = x;
		if (z->key < x->key) {
			x = x->left;
		}
		else {
			x = x->right;
		}
	}
	z->parent = y;
	if (y == NIL) {
		root = z;
	}
	else {
		if (z->key < y->key) {
			y->left = z;
		}
		else {
			y->right = z;
		}
	}
	return;
}

void inorder(Node *u) {
	if (u == NIL) return;
	inorder(u->left);
	printf(" %d", u->key);
	inorder(u->right);
	return;
}

void preorder(Node *u) {
	if (u == NIL) return;
	printf(" %d", u->key);
	preorder(u->left);
	preorder(u->right);
	return;
}

int main() {
	int n = 0;
	scanf("%d", &n);

	for (int i = 0; i < n; i++) {
		string order;
		cin >> order;
		if (order == "insert") {
			int key;
			scanf("%d", &key);
			insert(key);
		}
		else if (order == "find") {
			int key;
			scanf("%d", &key);
			Node *t = find(root, key);
			if (t != NIL) printf("yes\n");
			else printf("no\n");
		}
		else {
			inorder(root);
			printf("\n");
			preorder(root);
			printf("\n");
		}
	}

	return 0;
}

Measured memory_bytes: 22076
x, y = map(int, input().split())

a = [300000, 200000, 100000]

cnt = 0
if 1 <= x <= 3:
    cnt += a[x - 1]
if 1 <= y <= 3:
    cnt += a[y - 1]
if x == 1 and y == 1:
    cnt += 400000
print(cnt)


Measured memory_bytes: 2940
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
int main(){
  int n, x, i, ans=1, len=0;
  cin >> n >> x;
  int l[n];
  for(i=0; i<n; i++)
    cin >> l[i];
  for(i=0; i<n; i++){
    if(len+l[i]<=x){
      len+=l[i];
      ans++;
    }
    else {
      cout << ans;
      return 0;
    }
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 256
h, w, k = map( int, input().split() )
c = []
for _ in range( h ):
    c_i = str( input() )
    c.append( c_i )

ans = 0

c_h = [ 0 for _ in range( h ) ] # c[ i ] = i行目にある#の個数
c_w = [ 0 for _ in range( w ) ] # c[ j ] = j列目にある#の個数
all_black = 0

for i in range( h ):
    for j in range( w ):
        if c[ i ][ j ] == "#":
            c_h[ i ] += 1
            c_w[ j ] += 1
            all_black += 1

def count_black( list_h, list_w ):
    cnt = all_black
    for i in list_h:
        cnt -= c_h[ i ]
    for j in list_w:
        cnt -= c_w[ j ]
    for i in list_h:
        for j in list_w:
            if c[ i ][ j ] == "#":
                cnt += 1
    return cnt

def solve( i, list_h, j, list_w ):
    if i < h:
        solve( i + 1, list_h, j, list_w )
        solve( i + 1, list_h + [ i ], j, list_w )
    else:
        if j < w:
            solve( i, list_h, j + 1, list_w )
            solve( i, list_h, j + 1, list_w + [ j ] )
        else:
            if k == count_black( list_h, list_w ):
                global ans
                ans += 1

solve( 0, [], 0, [] )
print( ans )

Measured memory_bytes: 9284
import math

a,b,h,m = map(int, input().split())

long = 360*m/60
short = 360*h/12 + 30*m/60
deg = min(abs(long-short), 360-abs(long-short))

print((a**2+b**2-2*a*b*math.cos(math.radians(deg)))**(1/2))

Measured memory_bytes: 9540
#include<iostream>
#include<vector>
#include<cstdio>
#include<cmath>
using namespace std;

struct data{
	int number;
	double weight;
	double tall;
};

int main(){
	data dt;
	while(scanf("%d,%lf,%lf",&dt.number,&dt.weight,&dt.tall)!=EOF){
		if(dt.weight/pow(dt.tall,2)>=25)cout<<dt.number<<endl;
	}
	return 0;
}

Measured memory_bytes: 1228
#include <bits/stdc++.h>
using namespace std;
char con[205][205];
vector<int>adj[205];
bool vis[205], col[205];
int dist[205][205];
void dfs(int x){
	//cout<<x<<endl;
	vis[x]=true;
	for(int y:adj[x]){
		if(vis[y]) continue;
		col[y]=1^col[x];
		dfs(y);
	}
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			cin>>con[i][j];
			if(con[i][j]=='1'){
				adj[i].push_back(j);
				dist[i][j]=1;
			}
			else if(i==j) dist[i][j]=0;
			else dist[i][j]=1000;
		}
	}
	col[1]=0;
	dfs(1);
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			if(con[i][j]=='1' && col[i]==col[j]){
				cout<<-1;
				return 0;
			}
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			for(int k=1;k<=n;k++){
				dist[j][k]=min(dist[j][k], dist[j][i]+dist[k][i]);
			}
		}
	}
	int ans=0;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			ans=max(ans, dist[i][j]);
		}
	}
	cout<<ans+1;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int b,c,n,m,s=0,re;
    cin>>n>>m;
    re = n%m;
    b = abs(re-m);
    //cout<<re<<" "<<b<<endl;
    if(re <= b)
    {
        cout<<re<<endl;
    }
    else
    {
        cout<<b<<endl;
    }


}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define iii tuple<int, int, int>
#define ii pair<int, int>
#define fi first
#define vi vector<int>
#define vvi vector<vector<int>>
#define se second

using namespace std;
using namespace __gnu_pbds;

template <typename T>
using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

void solve() {
    ll n;
    cin >> n;
    if (n & 1) {
        cout << "0\n";
        return;
    }
    n /= 10;
    ll x = 1, res = 0;
    while (x <= n) {
        res += n / x;
        x *= 10;
    }
    x = 5;
    while (x <= n) {
        res += n / x;
        x *= 5;
    }
    x = 10;
    while(x <= n){
        res -= n / x;
        x *= 10;
    }
    cout << res << '\n';
}

int main() {
    ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
    // freopen("in", "r", stdin);

    int t = 1;
    // cin >> t;
    while (t--) solve();

    return 0;
}

Measured memory_bytes: 256
import java.util.*;

import static java.lang.String.format;

/**
 * Created by Seiya on 2016/10/16.
 */
public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        long a = scanner.nextLong();
        long b = scanner.nextLong();
        long c = scanner.nextLong();
        int cnt = 0;
        if(a % c == 0)cnt = 1;
        System.out.println(b / c -  a / c + cnt);

    }
}




Measured memory_bytes: 9936
/* ***************************************
Author        :Scau.ion
Created Time  :2016/09/24 20:03:18 UTC+8
File Name     :ion.cpp
*************************************** */

#include <bits/stdc++.h>

#define LL long long
#define ULL unsigned long long
#define PB push_back
#define MP make_pair
#define PII pair<int,int>
#define VI vector<int>
#define VPII vector<PII>
#define X first
#define Y second
#define IOS ios::sync_with_stdio(0);cin.tie(0);
#define IN freopen("in", "r", stdin);
#define OUT freopen("out", "w", stdout);

using namespace std;

const int maxn=100010;

int a[maxn];

int main()
{
	int n;
    scanf("%d",&n);
    int ans=0;
    for (int j=1;j<=n;++j)
    {
        scanf("%d",&a[j]);
        if (a[j]<j&&a[a[j]]==j) ++ans;
    }
    printf("%d\n",ans);
	return 0;
}


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

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

  int half;
  if (S.size() % 2 == 0){
    half = S.size() / 2;
  }
  else
  {
    half = (S.size() - 1) / 2;
  }
  
  int cnt = 0;
  for (int i = 0; i < half; i++){
    if (S.at(i) != S.at(S.size() - 1 - i )) cnt += 1;
  }

  cout << cnt << endl;
}

Measured memory_bytes: 3624
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using TP = tuple<ll,ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(18);
}
signed main(){
  init_io();
  string s,t;
  cin >> s >> t;
  ll n = s.size();
  for(int i=0;i<n;i++){
    if(s[i]!=t[i]){
      cout <<"No\n";
      return 0;
    }
  }
  cout << "Yes\n";
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define rrep(i,n) RFOR(i,n,0)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

typedef pair<int, int> pii;

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

	int n;
	cin >> n;

	int a[n];
	rep(i,n) cin >> a[i];

	sort(a,a+n);

	pii b[n-1];
	rep(i,n-1) b[i] = make_pair(min(a[i],a[n-1]-a[i]),i);

	sort(b,b+n-1);

	cout << a[n-1] << " " << a[b[n-2].second] << endl;
}

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

int main() {
  double a,b,n;
  
  cin >> a >> b >> n;
  
  double c = -a/b;
  if(b == 1){
    cout << 0 << endl;
  }
  else if(n < b-1){
    cout << floor(a*n/b)  << endl;
  }
  else{
    cout << a + floor(c) << endl;
  }
	return 0;
}


Measured memory_bytes: 3824
#include <bits/stdc++.h>
#define debug(x) cerr << #x << ": " << x << endl
#define debugArray(x, n)                           \
  for (long long hoge = 0; (hoge) < (n); ++(hoge)) \
  cerr << #x << "[" << hoge << "]: " << x[hoge] << endl
using namespace std;

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long N, M, K;
  cin >> N >> M >> K;
  long long A[N + 1], B[M + 1];
  for (int i = 0; i < N; i++) cin >> A[i + 1];
  for (int j = 0; j < M; j++) cin >> B[j + 1];
  for (int i = 1; i < N; i++) A[i + 1] += A[i];
  for (int j = 1; j < M; j++) B[j + 1] += B[j];

  A[0] = 0;
  B[0] = 0;
  int ans = 0;
  for (int i = 0; i <= N; i++) {
    int x = A[i];
    if (x > K) break;
    int j = lower_bound(B, B + M + 1, K + 1 - x) - B - 1;

    ans = max(ans, i + j);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 6772
#include<stdio.h>

#define ABS(x) (((x)<0)?(-(x)):(x))

int main(void){
  int n,a[100000];
  int i,j,k;
  int max,m;
  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",a+i);
  for(i=1,max=a[0];i<n;i++) if(max<a[i]) max=a[i];
  for(i=1,m=a[0];i<n;i++){
    if(a[i]==max) continue;
    if(m==max) m=a[i];
    if(ABS(max/2-m)>ABS(max/2-a[i])) m=a[i];
  }
  printf("%d %d\n",max,m);
  return 0;
}


Measured memory_bytes: 512
program ABC155_A
  integer::a,b,c
  read(*,*)a,b,c
  if((a==b .and. a/=c) .or. (b==c .and. a/=c) .or. (c==a .and. a/=b)) then
     write(*,*)'Yes'
  else
     write(*,*)'No'
  end if
end program ABC155_A

Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <unistd.h>
#include <sys/time.h>
#include <stdlib.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<P, ll> T;
typedef pair<long double , ll> Ps;
typedef pair<ll, bool> Pb;

const ll INF = 1e18;
const ll fact_table = 3200008;
long double Pi = 3.1415926535897932384626;

priority_queue <ll> pql;
priority_queue <P> pqp;
priority_queue <P> bag;
//big priority queue
priority_queue <ll, vector<ll>, greater<ll> > pqls;
priority_queue <P, vector<P>, greater<P> > pqps;
//small priority queue
//top pop

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

#define endl "\n"
#ifdef ENJAPMA
#undef endl
#endif
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define CLEAR(a) a = decltype(a)();
#define pc(x) cout << x << ",";
#define rep(i, n) for (ll i = 0; i < (n); i ++)

// const ll mod = 998244353ll;
const ll mod = 1000000007ll;

ll mypow(ll a, ll b, ll mod) {ll x = 1; while (b) {while (!(b & 1)) {(a *= a) %= mod; b >>= 1;}(x *= a) %= mod; b--;} return x;}
void YES(bool cond) { if (cond) { p("YES");} else { p("NO");} return;}
void Yes(bool cond) { if (cond) { p("Yes");} else { p("No");} return;}

ll line_count = 0;

void line(){

    line_count ++;
    string s = (line_count % 2) ? "v-v-v-v-v-v-v-v-v-v" : "^-^-^-^-^-^-^-^-^-^";
    cout << endl << s << endl << endl;
}

/*
ll fact[fact_table + 5],rfact[fact_table + 5];

void c3_init(){
    fact[0] = rfact[0] = 1;
    for(ll i=1; i<=fact_table; i++){
        fact[i] = (fact[i-1]*i) % mod;
    }
    rfact[fact_table] = mypow(fact[fact_table],mod - 2, mod);
    for(ll i=fact_table; i>=1; i--){
       rfact[i-1] = rfact[i] * i;
       rfact[i-1] %= mod;
    }
    return;}
ll c3(ll n,ll r){
    return (((fact[n] * rfact[r]) % mod ) * rfact[n-r]) % mod;}
*/

bool multicase = false;

ll n, m, k, num, a, b, c, d, e, h, q, ans, sum;
string s;
bool used[500005];

void solve() {
    for(ll i=1;i<=5;i++){
        cin >> a;
        if(a != i){
            p(i);
            return;
        }
    }

    return;
}

int main() {
    // init();
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll q, testcase = 1;
    if (multicase) {
        cin >> q;
    } else {
        q = 1;
    }
    while (q--) {
        // pu("Case ");pu("#");pu(testcase);pu(": ");
        solve();
        testcase++;
    }
    // solve();
    return 0;
}
















Measured memory_bytes: 3620
using System;
namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] In = Console.ReadLine().Split(' ');
            int l = int.Parse(In[0]);
            int r = int.Parse(In[1]);
            r = (int)Math.Min(r, l + 4038);//これでl~rの範囲が大きくても絞れる
            long ans = 2018;
            for(long i=l; i <= r; i++)
            {
                for(long j = i + 1; j <= r; j++)
                {
                    long x = (i * j) % 2019;
                    ans = (int)Math.Min(ans, x);
                }
            }
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 27448