akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
 
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define mod 1000000007
#define inf 1e18+42
#define endl "\n"

#define out1(a) cout<<#a<<" "<<a<<endl
#define out2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define out3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl

#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)
#define fori(it,A) for(auto it=A.begin();it!=A.end();it++)

#define ft first
#define sd second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define zero(x) memset(x,0,sizeof(x));
 
using namespace std;

int binpow(int a, int b) {
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

vector<int> func( int n )
{
    vector<int> div;
    // div.pb(1);
    for ( int i = 1 ; i <= sqrt(n) ; i++ )
    {
        if ( n % i == 0 )
        {
            div.pb(i);
            if ( i != n/i )
            {
                div.pb(n/i);
            }
        }
    }

    return div;
}

//START OF CODE ->->->->->->->

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

    vector<int> a(n+1);

    rep(i,1,a.size())
    {
        cin>>a[i];
    }

    vector<int> ans(n+1);
    vector<int> ans2(n+1);
    repr(i,n,1)
    {
        vector<int> div = func(i);
        if ( a[i] != (ans[i]%2) )
        {
            rep(j,0,div.size())
            {
                ans[div[j]]++;
            }
            ans2[i] = 1;
        }
        else
        {
            ans2[i] = 0;
        }
        
    }

    vector<int> pos;
    rep(i,1,ans2.size())
    {
        if( ans2[i] == 1 )
        {
            pos.pb(i);
        }
    }
    
    cout<<pos.size()<<endl;
    rep(i,0,pos.size())
    {
        cout<<pos[i]<<" ";
    }
    cout<<endl;
}

//END OF CODE ->->->->->->->->

signed main()
{
    fast;
    int t = 1;
    // cin>>t;

    while(t--)
    {
        solve();
    }
    return 0;
}



Measured memory_bytes: 6516
#include<stdio.h>

int main(){

int x[32][2]={};
int w,n;

scanf("%d",&w);
scanf("%d",&n);
for(int i=0;i<=w;i++)
x[i][0]=i;

for(int i=0;i<n;i++)
{
int a1,a2;
scanf("%d,%d",&a1,&a2);
int t=x[a1][0];x[a1][0]=x[a2][0];x[a2][0]=t;
}

for(int i=1;i<=w;i++)
printf("%d\n",x[i][0]);

return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int ketawa(int N){
  int wa =0;
  while(N != 0){
    wa = wa+N%10;
    N /= 10;
  }
  return wa;
}

int main(){
  int a,b,n;
  cin >>n>>a>>b;
  int ans=0;
  for(int i=1;i<=n;i++){
    int k = ketawa(i);
    if(k >= a && k <= b) ans += i;
  }
  cout << ans << endl;
}
    

Measured memory_bytes: 256
#include<stdio.h>

int main (void){

int a,b,c;

int i;

int count=0;

scanf("%d %d %d",&a,&b,&c);

for(i=a;i<=b;i++){

if(c%i==0){

count++;

}

}

printf("%d\n",count);

return 0;

}

Measured memory_bytes: 596
/*  Author:  Hariom_Pandey
    Created: 1/10/2020 5:46:56 PM
*/
#include "bits/stdc++.h"
using namespace std;
#define Hariom_Pandey  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

int32_t main(){

    Hariom_Pandey
    int num,cnt=0;
    string str="ABC",str2;
    cin>>num;
    cin>>str2;

    for(int i=0; str2[i]; i++){
        if(str2[i]=='A' and str2[i+1]=='B' and str2[i+2]=='C' ) {
            cnt++;
            i+=2;
        }

    }

    cout<<cnt<<"\n";
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int S,T,D;
long W[1<<17];
main()
{
	cin>>S>>T>>D;
	for(int i=0;i<D;i++)cin>>W[i];
	for(int i=1;i<D;i++)W[i]+=W[i-1];
	T-=S;
	long M=0;
	for(int i=0;i<D;i++)
	{
		if(T>=W[i])
		{
			cout<<i+1<<endl;
			return 0;
		}
		M=min(M,W[i]);
	}
	if(W[D-1]>=0)
	{
		cout<<-1<<endl;
		return 0;
	}
	long d=(M-T-W[D-1]-1)/-W[D-1];
	long ans=d*D;
	T-=W[D-1]*d;
	for(int i=0;i<D;i++)
	{
		if(T>=W[i])
		{
			cout<<ans+i+1<<endl;
			return 0;
		}
	}
}



Measured memory_bytes: 3900
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <map>
#include <unordered_map>
#include <string.h>
#include<iomanip>
#include <iterator>
#include <locale>

#define all(a) a.begin(),a.end()
#define VV(T) vector<vector< T > >
#define rep(i,N) for(int i = 0; i <N; i++)
#define repsg(i,s,g) for(int i = s; i <g; i++)
#define name(x) #x
using namespace std;


const int INF = 10000000;
const long long INFL = (1LL<<40);
const int MOD = pow(10,9)+7;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

typedef long long ll,LL;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
typedef pair<int,int> pii;
typedef pair<LL, LL> pLL;


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x: vec) is >> x;
    return is;
}
// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
    for(int i=0; i<vec.size(); i++){
        os << vec[i] << ( i+1 == vec.size() ? "" : " " );
    }
    return os;
}

template< typename T >
struct edge{
    int src, to;T cost;
    edge(int to,T cost) :src(-1),to(to),cost(cost){}
    edge(int src, int to, T cost) :src(src),to(to),cost(cost){}edge
    &operator=(const int &x){
        to =x;
        return *this;
    }
    operator int() const{ return to;}
};

double dist (double a, double b,  double c, double d){
    
    return sqrt((a-c)*(a-c) + (b-d)*(b-d));
    
}

bool check(int x,int y,vector<string> a,vector<string> b ){
    for(auto i = 0; i<b.size();i++){
        for(auto j =0; j<b.size();j++){
            if(a[x+i][y+j]!= b[i][j]) return false;
        }
    }
    return true;
}

int dist(pii a, pii b){
    return abs(a.first-b.first) + abs(a.second-b.second);
}


int main() {
    int a, b, c, d;cin>>a>>b>>c>>d;
    if(b<c) {cout<<0<<endl; return 0;}
    if(d<a)  {cout<<0<<endl; return 0;}
    else cout<<min(b,d)-max(a,c)<<endl;
    return 0;
}







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

using ll = long long;
#define ld long double
#define ull unsigned long long int

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  // (i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define pb push_back
#define ret return

typedef pair<int, int>    pii;
typedef vector<int>       vi;
typedef vector<vi>        vii;
typedef vector<long long> vl;

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    // cout << fixed << setprecision(5);

    // 入力
    int n;
    cin >> n;

    // 処理
    int cnt = 0;
    rep(i, 30) {
        rep(j, 30) {
            if (i * 4 + j * 7 == n) {
                cnt++;
            }
        }
    }

    // 出力
    cout << (cnt > 0 ? "Yes" : "No") << endl;
    return 0;
}


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

using namespace std;
int main() {
    int n=0,i,j,k,movedmemory,ans=0;
    char down1,up1,up2;
    string s;
    cin>>s;
    n=s.length();
    if(n==1){
        cout << 0 << endl;
        return 0;
    }
    /*do {
        movedmemory=0;

        for (i = 1; i < n-2; i++) {
            up1=s[i+1];
            up2=s[i+2];
            down1=s[i-1];
            if (s[i] != up1) {
                if (down1!=up2){
                    movedmemory++;
                    ans+=2;
                    s.erase(i,2);
                    n-=2;
                    break;
                }
            }
        }
    }while(movedmemory>0);*/
    do {
        movedmemory=0;
        for (i = 0; i < n-1; i++) {
            up1=s[i+1];
            if (s[i] != up1) {
                movedmemory++;
                    ans+=2;
                    s.erase(i,2);
                    n-=2;
                    break;
            }
        }
    }while(movedmemory>0);
    std::cout << ans << std::endl;
    return 0;
}

Measured memory_bytes: 512
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int count = 0;

        String a = sc.next();
        for (int i = 0; i < a.length(); i++) {
            char chara = a.charAt(i);
            if (chara == '1') {
                count++;
            }

        }

        System.out.println(count);
        sc.close();
    }
}

Measured memory_bytes: 21204
s=input()
t=input()
n=len(s)-len(t)+1
lst=[]
for i in range(n):
    tot=0
    ss=s
    for j in range(len(t)):
        if ss[i+j]==t[j] or ss[i+j]=="?":
            tot+=1
    if tot==len(t):
        ss=list(ss)
        t=list(t)
        for j in range(len(t)):
            ss[i+j]=t[j]
        ss="".join(ss)
        t="".join(t)
        ss=ss.replace("?","a")
        lst.append(ss)
lst.sort()
print(lst[0] if len(lst)!=0 else "UNRESTORABLE" )

Measured memory_bytes: 3064
/**
 *     author: qodjf
 *     created: 04.17.2020 00:29:18
 */
#include <bits/stdc++.h>
using namespace std;

string to_string(string s) { return '"' + s + '"'; }

string to_string(const char *s) { return to_string((string)s); }

string to_string(bool b) { return (b ? "true" : "false"); }

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifndef ONLINE_JUDGE
#define dbg(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define dbg(...) 42
#endif

#define mst(x, a) memset(x, a, sizeof(x))

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;
const int INF = 0x3f3f3f3f;
const ll LLINF = 0x3f3f3f3f3f3f3f3f;
const ll MOD = 1e9 + 7;

ll mul(ll a, ll b) { return a * b % MOD; }

ll add(ll a, ll b) { return (a + b) % MOD; }

ll sub(ll a, ll b) { return (a - b + MOD) % MOD; }

ll my_pow(ll a, ll b) {
  ll r = 1;
  while (b) {
    if (b & 1) r = mul(r, a);
    a = mul(a, a);
    b >>= 1;
  }
  return r;
}

ll my_inv(ll a) { return my_pow(a, MOD - 2); }

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

ll N, K;

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

  ll ans = 0;
  for (int i = 0; i < N; i++) {
    ll x = 0;
    for (int j = N - 1; j > i; j--) {
      if (a[j] < a[i]) {
        x++;
      }
    }
    ans = add(ans, mul(x, K));
    for (int j = i - 1; j >= 0; j--) {
      if (a[j] < a[i]) {
        x++;
      }
    }
    ans = add(ans, mul(x, mul(K, mul(K - 1, (MOD + 1) / 2))));
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
main () {
	long long n=0;
	cin>>n;
	if (n%2==1) {
		cout<<0<<endl;
		return 0;
	}
	
	n=n/2;
	
	long long ans=0;
	for (long long k=5; n/k>0; k*=5) 
		ans+=n/k;
	
	cout<<ans<<endl;
}

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

int main(){
	int a,b;
    cin>>a>>b;
    if((a==3&&b==1)||(a==1&&b==3)||(a==3&&b==3)||(a==1&&b==1)){
    	cout<<"Yes"<<endl;
    }else{
    	cout<<"No"<<endl;
    }
  return 0;
}

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

#define FastRead        ios_base::sync_with_stdio(false);cin.tie(NULL);
#define endl            "\n"
#define sq(x)           ((x)*(x))
#define pi              acos(-1.0)
#define NUM             1000005

typedef long long ll;


int main()
{
    FastRead

    ll n, k,mx = -1, gcd;

    cin >> n >> k;

    for(ll i=0;i<n;i++)
    {
        ll temp;
        cin >> temp;

        if(i==0)
            gcd = temp;
        else
            gcd = __gcd(gcd, temp);

        mx = max(mx, temp);
    }

    if(k > mx || k % gcd)
        cout<<"IMPOSSIBLE"<<endl;
    else
        cout<<"POSSIBLE"<<endl;
}


Measured memory_bytes: 3648
// aising2020_a
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF (ll)(1e9)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    int L, R, D;
    cin >> L >> R >> D;

    int ans = 0;
    REPN(i, L, R+1){
        if (i % D == 0){
            ans++;
        }
    }
    print(ans);

    return 0;
}


Measured memory_bytes: 3632
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<string>
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

int main(){


int N,x;
cin >> N >> x;

vector<int>A;
int a;
rep(i,N){
cin >>a;
A.push_back(a);
}
    
sort(A.begin(),A.end());
int i=0;
int ans=0;
while(x>0 && i<N){
    x-=A[i];
    i++;
    ans++;
}
if(x!=0){
    ans--;
}

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
using namespace std;
const int N = 105;
const int W = 1e5+5;
int v[N],w[N],n,weight;
long long dp[N][W];
int INF=0x3f3f3f3f;
long long solve (int i,int rem){
if(i==n)return 0;
long long &ret=dp[i][rem];
if(~ret)return ret;
ret=max(solve(i+1,rem),w[i]<=rem?v[i]+solve(i+1,rem-w[i]):0);
return ret;
}
int main(){
    IO;
    memset(dp,-1,sizeof(dp));
    cin>>n>>weight;
    for(int i=0;i<n;++i)cin>>w[i]>>v[i];
    cout<<solve(0,weight);
}


Measured memory_bytes: 82304
let a, b = Scanf.scanf " %d %d" @@ fun a b -> a, b
let f s = String.(init (length s) @@ fun i -> s.[length s - i - 1])
let ans = ref 0
let _ = for i = a to b do if f @@ string_of_int i = string_of_int i then incr ans done; Printf.printf "%d\n" !ans

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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); }

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N; cin >> N;
    vector<int> L(N);
    rep(i, N) cin >> L[i];
    sort(all(L));
    int cnt = 0;
    rep(i, N) for (int j = i+1; j < N; j++) {
        int x = lower_bound(all(L), L[i]+L[j]) - L.begin();
        cnt += x - (j + 1);
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
<?php
//$N = trim(fgets(STDIN));
list($M,$D) =  explode(" ",trim(fgets(STDIN)));

$ret=0;
for($i=1;$i<=$M;$i++) {
  for($j=1;$j<=$D;$j++) {
    $d1 = $j % 10;
    $d2 = intdiv($j,10);
    if (($d1 >=2) && ($d2 >=2)) {
      if ($d1*$d2 == $i) {
        $ret++;
      }
    }
  }
}
printf("%d\n",$ret);


Measured memory_bytes: 4728
import java.math.BigInteger;
import java.util.Scanner;

public class Main 
{
	static long p = 1000000007;
	static long[] fact = new long[200000];
	static long[] factinv = new long[200000];
	static BigInteger bip = new BigInteger(Long.toString(p));
	
	static long val(int h, int w)
	{
		int n = h+w;
		int r = h;
		
		//find out nCr
		long l = (((fact[n]*factinv[r])%p)*factinv[n-r])%p;
		if(l<0)l+=p;
		return l;
	}

	public static void main(String[] args) 
	{
		long ma = 0;
		fact[0] = 1;
		for(int i = 1; i < 200000; i++)
		{
			fact[i] = (fact[i-1]*i)%p;
			if(fact[i] < 0)
				fact[i]+=p;
			
			BigInteger bi = new BigInteger(Long.toString(fact[i]));
			factinv[i] = bi.modInverse(bip).longValue();
			
			ma=Math.max(ma, factinv[i]);
		}
		factinv[0] = 1;
//		System.out.println("DONE");
		
		
		Scanner sc = new Scanner(System.in);
		long sum = 0;
		{
			int h = sc.nextInt();
			int w = sc.nextInt();
			int a = sc.nextInt();
			int b = sc.nextInt();
			
			int colh = h - a;
			
			int trh = h-a;
			
			for(int i = 0; i < colh; i++)
			{
				long colv = val(w-b-1, a+i);
				long mul = val(trh-i-1,b-1);
				sum = (sum +(colv*mul)%p)%p;
			}
		}
		System.out.println(sum);

	}

}


Measured memory_bytes: 72828
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
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 << 30;

int main() {
  int64 a, b;
  scanf("%lld%lld", &a, &b);
  puts(abs(a - b) <= 1 ? "Brown" : "Alice");
  return 0;
}


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

template<class t> void vin(vector<t>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

int main() {
    string str; ll k;
    cin >> str >> k;
    int cur = 0;
    if (str.size() == 1 or k == 1) {
        cout << str[0] << endl;
    }
    else {
        int tmp = 0;
        char ans = '1';
        for (int i=0; i<str.size(); ++i) {
            if (str[i] == '1') tmp++;
            else {
                ans = str[i];
                break;
            }
        }
        if (tmp >= k) {
            cout << 1 << endl;
        }
        else {
            cout << ans << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    long long n;
    cin >> n;
    if (n % 2 == 1) {
        cout << 0 << endl;
    } else {
        long long answer = 0;
        long long m = 10;
        while (m <= n) {
            answer += n / m;
            m *= 5;
        }
        cout << answer << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define lb(x) (x&-(x))
const int N = 101010;

int main(){
	string s;
	cin>>s;
	if(s[0]==s[1]&&s[1]==s[2]||s[1]==s[2]&&s[2]==s[3])
	 cout<<"Yes"<<endl;
	 else cout<<"No"<<endl;




    return 0;
}


Measured memory_bytes: 256
MOD = 10**9 + 7#prime
n = int(input())
a = list(map(int, input().split()))

primes = {}

for val in a:
    p = 2
    while p * p <= val:
        if val % p == 0:
            cnt = 0
            while val % p == 0:
                cnt += 1
                val //= p
            if p not in primes:
                primes[p] = cnt
            else:
                primes[p] = max(cnt, primes[p])
        p += 1

    if val != 1:
        if val not in primes:
            primes[val] = 1


lcm = 1
for p in primes:
    lcm = lcm * pow(p, primes[p], MOD) % MOD

   
def inv(x):
    return pow(x, MOD-2, MOD)

ans = 0
for val in a:
    ans += lcm * inv(val) % MOD
    ans %= MOD

print(ans)

         


Measured memory_bytes: 46428
void main() {
    int[] xy = readln.split.to!(int[]);
    int x = xy[0], y = xy[1];
    bool ok = true;
    int[] d30 = [4, 6, 9, 11];
    if (xy.any!"a == 2") {
        ok = false;
    } else if (d30.canFind(x) != d30.canFind(y)) {
        ok = false;
    }
    writeln(ok ? "Yes" : "No");
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define call(var) cout<<#var<<"="<<var<<endl;
#define dup(x,y) (((x)+(y)-1)/(y))
using ll=long long;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;
const int INTMAX = 2147483647;
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;}

int main(){
    auto isprime=[](int n){
        if(n == 1) return false;
        for(int i=2;i*i<=n;++i){
            if(n%i==0) return false;
        }
        return true;
    };
    vi table(100000+1,0);
    for(int i=1;i<=100000;++i){
        if(i&1 && isprime(i) && isprime((i+1)/2)){
            table[i] = table[i-1] + 1;
        }else{
            table[i] = table[i-1];
        }
    }

    int q;cin >> q;
    while(q--){
        int l,r;cin >> l >> r;
        cout << table[r] - table[l-1] << endl;
    }
}

Measured memory_bytes: 1024
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <utility>
#include <iomanip>

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

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

signed main(){
    string st;
    cin >> st;

    bool s, e, n, w;
    s = e = n = w = false;
    for(char c: st){
        switch(c){
            case 'S': s = true;
                      break;
            case 'E': e = true;
                      break;
            case 'N': n = true;
                      break;
            case 'W': w = true;
                      break;
            default:  break;
        }
    }
    if(s == n && e == w){
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
     int n, maxHeight=0, sum=0;
     cin >> n;
     int h[n];
     for (int i=0; i<n; i++) cin >> h[i];
     
     for(int j=0; j<n; j++) {
     
     	if(maxHeight <= h[j]) {
     	
     	  maxHeight = h[j];
     	  sum++;
     	}
     }
     
     cout << sum << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<map>
#include<cstdio>
#include<cmath>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define P pair<int,int>
#define ll __int64
//#define __int64 long long
string s;
int ax,ay;
int ns;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int t[10000];
int t2[10000];

const int M=5000;
const int T=5000;
int cnt,pos,pos2;
short m[4001][M*2];

bool dfs(int p,int x){
	if(m[p][x+T]!=-1)return m[p][x+T];

	if(p==pos){
		return m[p][x+T]=x==ax;
	}


	bool ret=0;

		ret|=dfs(p+1,x+t[p]);
		ret|=dfs(p+1,x-t[p]);

	return m[p][x+T]=ret;
}

bool dfs2(int p,int y){

	if(m[p][y+T]!=-1)return m[p][y+T];

	if(p==pos2){
		return m[p][y+T]=y==ay;
	}


	bool ret=0;

		ret|=dfs2(p+1,y+t2[p]);
		ret|=dfs2(p+1,y-t2[p]);

	return m[p][y+T]=ret;
}


int main(){
	cin>>s>>ax>>ay;
	ns=s.size();

	rep(i,ns+1){
		if(s[i]=='F'){
			cnt++;
		}
		else{
			if((pos+pos2)%2)t2[pos2++]=cnt;
			else t[pos++]=cnt;
			cnt=0;
		}
	}
	bool a1,a2;
	rep(i,4001)rep(j,M*2)m[i][j]=-1;
	a1=dfs(1,t[0]);
	rep(i,4001)rep(j,M*2)m[i][j]=-1;
	 a2=dfs2(0,0);
	if(a1&&a2)cout<<"Yes";
	else cout<<"No"<<endl;
	
	return 0;
}


Measured memory_bytes: 78592
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <ctype.h>
#include <math.h>
using namespace std;


int main ()
{

int a,b;
cin >> a >> b;

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

 return 0;
}












Measured memory_bytes: 3604
def main():
  # オーダー 10^n * M
  n, m = list(map(int, input().split()))
  data = []
  for _ in range(m):
    l = list(map(int, input().split()))
    data.append(l)

  # 二重要素を削除
  data = list(map(list, set(map(tuple, data))))

  # 同じ key が存在したら -1 を返すように
  keys = []
  for d in data:
    if d[0] in keys:
      print(-1)
      return
    else:
      keys.append(d[0])

  # 全探索
  for i in range(10 ** n):
    i_str = str(i)
    flag = True

    for d in data:
      # そもそも桁数が違う
      if len(i_str) < d[0]:
        flag = False
        break

      # 指定の数字が違う
      if i_str[d[0] - 1] != str(d[1]):
        flag = False
        break
    
    # 桁数チェック
    if flag and len(i_str) == n:
      print(i)
      return

  print(-1)

if __name__ == "__main__":
  main()

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

#define MAX 100000
#define INF INT_MAX

int main() {
	int A, B, M;
	int a[MAX], b[MAX];
	int mina = INF, minb = INF;
	int ans;
	cin >> A >> B >> M;
	for (int i = 0; i < A; i++) {
		cin >> a[i];
		mina = min(mina, a[i]);
	}
	for (int i = 0; i < B; i++) {
		cin >> b[i];
		minb = min(minb, b[i]);
	}
	ans = mina + minb;
	for (int i = 0; i < M; i++) {
		int x, y, c;
		cin >> x >> y >> c;
		ans = min(ans, a[x - 1] + b[y - 1] - c);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main()
{
    int N;
    long long K;
    long long A[100000];
    long long i;
    long long j;
    long long sum;
    long long a_sum;
    long long ans;
    long long max;
    long long bin[64];
    int index;

    scanf("%d %lld", &N, &K);
    a_sum = 0;
    for(i = 0; i < N; i++) {
        scanf("%lld", &A[i]);
        a_sum += A[i];
    }

    ans = 0;
    index = 0;
    for(i = 1; i <= K; i*=2) {
        sum = 0;
        for(j = 0; j < N; j++) {
            sum += (A[j] ^ i) - A[j];
        }
        bin[index] = sum;
        index += 1;
    }

    ans = 0;
    max = 0;
    for(i = index-1; i >= 0; i--) {
        if(bin[i] > 0 && (max+pow(2,i)) <= K) {
            ans += bin[i];
            max += pow(2, i);
        }
    }

    printf("%lld\n", ans + a_sum);

    return 0;
}

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

constexpr int inf = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3fLL;

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

    int n, k; cin >> n >> k;
    vector<bool> ok(10, true);
    for (int i = 0; i < k; i++) {
        int d; cin >> d;
        ok[d] = false;
    }

    while (true) {
        int i = n;
        bool flag = true;
        while (i) {
            int d = i % 10;
            flag &= ok[d];
            i /= 10;
        }
        if (flag) {
            cout << n << endl;
            break;
        }
        n++;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define db double
using namespace std;
int t,n,m,x;
const int maxn=1e5+10;
int a[1005];
int b[2][maxn]; 
int main(){
	int n;
	cin>>n;
	cout<<(1000-n%1000)%1000<<endl; 
} 

Measured memory_bytes: 3620
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
int main()
{
    int x;
    while(scanf("%d",&x) != EOF)
    {
        if(x < 1200) printf("ABC\n");
        else printf("ARC\n");
    }
    return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

func convert(n int) (m int) {
	if n != 1 {
		m = n - 1
	} else {
		m = 13
	}
	return
}

func main() {
	var a, b int
	fmt.Scan(&a, &b)
	var result string
	switch {
	case convert(a) > convert(b):
		result = "Alice"
	case convert(a) == convert(b):
		result = "Draw"
	case convert(a) < convert(b):
		result = "Bob"
	}
	fmt.Println(result)
}


Measured memory_bytes: 512
<?php /*atcoder.php*/

$at = new Atcoder();
$at->main();
unset($at);

class Atcoder{
	private function lineIn(){
		$buf = fgets(STDIN);
		return $this->killNewLine($buf);
	}
  	private function killNewLine($buf = null){
		$buf = str_replace("\r\n", "", $buf);
		$buf = str_replace("\n", "", $buf);
		$buf = str_replace("\r", "", $buf);
		return $buf;
	}

	public function main(){
		$s = array();
		
		for($i = 0; $i < 6; $i++){
			$s[] = $this->lineIn();
		}

		for($i = 0; $i < 5; $i++){
			for($j = 0; $j < 5; $j++){
				if($i == $j){
					continue;
				}else{
					$buf = abs($s[$i] - $s[$j]);
					if($buf > $s[5]){
						echo ":(\n";
						return false;
					}
				}
			}
		}
		echo "Yay!\n";
		return true;
	}
}
?>


Measured memory_bytes: 4728
use proconio::{input, fastout};
use std::cmp::*;

#[fastout]
fn main() {
    input!{
        n: usize,
        m: usize,
        x: usize,
        mat: [[usize; m+1]; n],
    }
    let mut c: Vec<usize> = Vec::new();
    for i in 0..n {
        c.push(mat[i][0]);
    }
    
    let inf = 12*100005;
    let mut ans = inf;
    for i in 0..(1<<n) {
        let mut sum = 0;
        let mut und: Vec<usize> = vec![0;m+5];
        let mut flag = true;
        for j in 0..n {
            if (i>>j) & 1 == 1 {
                sum += c[j];
                for k in 0..m {
                    und[k] += mat[j][k+1];
                }   
            }
        }
        for l in 0..m {
            if und[l] < x {
                flag = false;
            }
        }
        if flag == true {
           ans = min(ans, sum);
        }
    }
    if ans==inf {
        println!("-1");
        return;
    }
    println!("{}", ans);

}


Measured memory_bytes: 2208
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"
#include "string"

using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i,n) for(int i = 0; i < n; i++)

int main() {
	int n;
	cin >> n;
	map<string, int> mp;
	rep(i, n) {
		string s;
		cin >> s;
		mp[s]++;
	}
	cout << "AC x " << mp["AC"] << endl;
	cout << "WA x " << mp["WA"] << endl;
	cout << "TLE x " << mp["TLE"] << endl;
	cout << "RE x " << mp["RE"] << endl;
	return 0;
}

Measured memory_bytes: 3632
#include <vector>
#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<pll> vp;
#define fr first
#define sc second
 
const int maxn=131073;
 
int n,tot;
ll dis[maxn];
int son[maxn][2],num[maxn];
ll l,r=1ll*maxn*maxn,limit;
 
vp f[maxn];
 
int read() {
    int x=0,f=1;char ch=getchar();
    for(;ch<'0'||ch>'9';ch=getchar())if(ch=='-')f=-1;
    for(;ch>='0'&&ch<='9';ch=getchar())x=x*10+ch-'0';
    return x*f;
}
 
vp dp(vp a,vp b) {
    vp res;res.clear();
    int x=a.size(),y=b.size(),st1=0,st2=0;
    if(!y)return res;
    while(st1!=x) {
        while(st2!=y&&a[st1].sc+b[st2].fr<=limit)st2++;
        if(st2)st2--;
        if(a[st1].sc+b[st2].fr<=limit)res.push_back(make_pair(a[st1].fr,b[st2].sc));
        st1++;
    }
    return res;
}
 
void insert(vp &a,pll b) {
    if(a.empty())a.push_back(b);
    else if(a.back().fr==b.fr)a.back().sc=min(a.back().sc,b.sc);
    else if(b.sc<a.back().sc)a.push_back(b);
}
 
vp merge(vp a,vp b) {
    vp res;res.clear();
    int x=a.size(),y=b.size(),st1=0,st2=0;
    while(st1!=x&&st2!=y) {
        if(a[st1].fr<b[st2].fr)insert(res,a[st1++]);
        else insert(res,b[st2++]);
    }
    while(st1!=x)insert(res,a[st1++]);
    while(st2!=y)insert(res,b[st2++]);
    return res;
}
 
void dfs(int u) {
    if(!num[u]) {
        f[u].clear();
        f[u].push_back(make_pair(dis[u],dis[u]));
        return;
    }
    dfs(son[u][0]),dfs(son[u][1]);limit+=dis[u]*2;
    vp tmp1=dp(f[son[u][0]],f[son[u][1]]);
    vp tmp2=dp(f[son[u][1]],f[son[u][0]]);
    f[u]=merge(tmp1,tmp2);
    limit-=dis[u]*2;
}
 
bool check() {
    dfs(1);
    if(!f[1].empty())return 1;
    return 0;
}
 
int main() {
    n=read();
    for(int i=2;i<=n;i++) {
        int fa=read(),v=read();
        dis[i]=dis[fa]+v;
        son[fa][num[fa]++]=i;
    }
    while(l<r) {
        limit=(l+r)>>1;
        if(check())r=limit;
        else l=limit+1;
    }
    printf("%lld\n",r);
    return 0;
}

Measured memory_bytes: 30452
#include <stdio.h>

int main(void)
{
	int H = 10, W = 10;
	int i, j;

	while (H != 0 && W != 0)
	{
		scanf("%d %d", &H, &W);

		if (H == 0 && W == 0) break;
		for (i = 0; i < H; i++)
		{
			for (j = 0; j < W; j++)
			{
					printf("#");
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}

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

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

using namespace std;
//using namespace __gnu_pbds;

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

#define si(a)           scanf("%d",&a)
#define sii(a,b)        scanf("%d %d",&a,&b)
#define siii(a,b,c)     scanf("%d %d %d",&a,&b,&c)

#define sl(a)           scanf("%lld",&a)
#define sll(a,b)        scanf("%lld %lld",&a,&b)
#define slll(a,b,c)     scanf("%lld %lld %lld",&a,&b,&c)

#define un(x)           x.erase(unique(all(x)), x.end())
#define xx              first
#define yy              second
#define pb              push_back
#define mp              make_pair
#define all(v)          v.begin(),v.end()
#define D(x)            cerr << #x " = " << x << '\n'
#define DBG             cerr << "Hi!" << '\n'

#define CLR(a)          memset(a,0,sizeof(a))
#define SET(a)          memset(a,-1,sizeof(a))

#define PI              acos(-1.0)

//inline int setBit(int n,int pos) { return n = n | (1 << pos); }
//inline int resetBit(int n,int pos) { return n = n & ~(1 << pos); }
//inline bool checkBit(int n,int pos) { return (bool)(n & (1 << pos)); }
//inline int countBit(int n) { return __builtin_popcount(n); }


//int fx[] = {+0, +0, +1, -1, -1, +1, -1, +1};
//int fy[] = {-1, +1, +0, +0, +1, +1, -1, -1}; //Four & Eight Direction

/******************************************************************************************/

//const int MAX = 300010;
//const int INF = 0x3f3f3f3f;
//const double inf = 1.0/0.0;
//const int MOD = 1000000007;


string s;

int main() {
//    freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);



    int w;
    cin >> s;
    cin >> w;
    for(int i=0;i<s.size();i+=w) cout << s[i];
    puts("");

    return 0;
}




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

#ifdef MYDEBUG
#define dbp(x) cout<<#x<<": "<<x<<endl
#define dbp2(x,y) cout<<#x<<","<<#y<<": "<<x<<","<<y<<endl
#define dbp3(x,y,z) cout<<#x<<","<<#y<<","<<#z<<": "<<x<<","<<y<<","<<z<<endl
#define ifcin(x) std::ifstream cin(x)
#else
#define dbp(x)
#define dbp2(x,y)
#define dbp3(x,y,z)
#define ifcin(x)
#endif
#define ll long long
#define ull unsigned long long
#define eps 1e-14
#define all(x) x.begin(), x.end()
#define rep(i, from, to) for(int i=from; i<to; ++i)
#define REP(i, from, to) for(int i=from; i<=to; ++i)
using std::vector;
using std::cout;
using std::cin;
using std::endl;
using std::max;
using std::min;
using std::swap;
using std::string;
using std::fill;
using std::pair;
using std::sort;
using std::reverse;
using std::pair;
using std::greater;
using std::priority_queue;

template<typename T>
std::ostream& operator<<(std::ostream& out, const vector<T>& v) {
  out << "[";
  size_t last = v.size() - 1;
  for (size_t i = 0; i < v.size(); ++i) {
    out << v[i];
    if (i != last)
      out << ",";
  }
  out << "]";
  return out;
}
ll N, A, B;
const int maxn = 110;
vector<ll> h;
ll sum = 0;
ll maxi = 0;

bool enough(ll T) {
  ll base = T * B; //intはオーバーフローする(Bの最大とTの最大が噛み合うと10^18
  ll add = A - B;
  ll cnt = 0; //intはオーバーフローする
  auto it = std::upper_bound(h.begin(), h.end(), base); //T回のBで死ななくなる地点をさがす
  for (; it != h.end(); ++it) {
    cnt += (*it - base + add - 1) / add; //(h-base)/addの切り上げ除算は(h-base+add-1)/add
  }
  return cnt <= T;
}

void solve() {
  cin >> N >> A >> B;
  h = vector<ll>(N);
  rep(i,0,N)
  {
    cin >> h[i];
    maxi = max(maxi, h[i]);
  }
  sort(all(h));
  ll L = 0, R = maxi + 1;
  ll mid;
  while (R - L > 1) { //答えを満たす中で最小⇔upper_bound⇔(L, R]に答えがある
    mid = (L + R) / 2;
    (enough(mid) ? R : L) = mid;
  }
  cout << R << endl;
}

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


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

using namespace std;

int main() {
	string s;
	cin >> s;
	int n = s.size();
	vector<int> p(n, 0);
	for (int l = 0, r = 0; l < n; l = r) {
		int pos = -1;
		while (r < n && (pos == -1 || s[r] == 'L')) {
			if (pos == -1 && s[r] == 'L') {
				pos = r;
			}
			r++;
		}
		p[pos] = (pos - l) / 2;
		p[pos - 1] = (r - pos) / 2;
		int tmp = p[pos] + (r - pos - p[pos - 1]);
		p[pos - 1] += pos - l - p[pos];
		p[pos] = tmp;
	}
	for (int i = 0; i < n; i++) {
		cout << p[i] << " \n"[i == n - 1];
	}
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
    using namespace std;
    #define rep(i, n) for (int i = 0; i < (int)(n); i++)
     
    int main() {
      int A,B;
      cin >> A >> B;
      if ( A * B % 2 == 0) {
        cout << "Even" << endl;
      }
      else {
        cout << "Odd" << endl;
      }
      
      
	}

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


def main():
    N = int(input())
    ans = [0] * (6 * 10**4 + 10)

    for x in range(1, 101):
        for y in range(1, 101):
            for z in range(1, 101):
                ans[x**2 + y**2 + z**2 + x * y + y * z + x * z - 1] += 1

    for i in range(N):
        print(ans[i])


if __name__ == "__main__":
    main()


Measured memory_bytes: 9540
main :: IO ()
main = do
  s <- getLine
  putStrLn . toString . none' $ s

none'
  :: String -> Maybe Char
none' x 
  = if null fx then Nothing
               else Just $ head fx
  where
    fx = dropWhile (`elem` x) ['a' .. 'z']

toString
  :: Maybe Char -> String
toString (Just c) = [c]
toString Nothing  = "None"

Measured memory_bytes: 7164
#include <iostream>
#include <cstdio>
#include <cstring>
typedef long long lint;

template <class T> inline T nxi(){
	T x=0;
	char c;
	while((c=getchar())>'9'||c<'0');
	while(x=x*10-48+c,(c=getchar())>='0'&&c<='9');
	return x;
}

int main(){
#ifndef ONLINE_JUDGE
//	freopen("a.in","r",stdin);
#endif
	lint n=nxi<lint>();
	int ans=0;
	bool f=1;
	for(;n/10;n/=10){
		ans+=9;
		f&=n%10==9;
	}
	printf("%lld\n",ans+n-1+f);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int dp[100005];
bool flag[100005];
void bfs(int k);
int main(void)
{
    int n;
    scanf("%d",&n);
    memset(dp,0x3f,sizeof(dp));
    memset(flag,0,sizeof(flag));
    bfs(n);
    printf("%d\n",dp[0]);
    return 0;
}
void bfs(int k)
{
    dp[1] = 1;
    queue<int>que;
    que.push(1);
    flag[1] = true;
    while(!que.empty())
    {
        int id = que.front();
        flag[id] = false;
        que.pop();
        if(dp[(id*10)%k] > dp[id])
        {
            dp[(id*10)%k] = dp[id];
            if(!flag[(id*10)%k])
            {
                flag[(id*10)%k] = true;
                que.push((id*10)%k);
            }
        }
        if(dp[(id + 1)%k] > dp[id] + 1)
        {
            if(!flag[(id + 1)%k])
            {
                flag[(id + 1)%k] = true;
                dp[(id + 1)%k] = dp[id] + 1;
                que.push((id + 1)%k);
            }
        }
    }
}


Measured memory_bytes: 896
#include <iostream>
#include <cstdint>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<ll>> vvll;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define mes(a) cout << (a) << endl
#define dmes(a, b) cout << (a) << " " << (b) << endl
#define re0 return 0
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define rSort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
struct io
{
    io()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
};
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-19;




signed main() {
    ll n, k;
    cin >> n >> k;
    
    double r = 0.0;
    double tmp = 0.0;
    
    rrep(i, n) {
        tmp = (double)1;
        for(ll j=i; j < k; j*=2) {
            tmp /= 2;
        }
        r += tmp;
    }
    printf("%.10lf", (double)r/n);
    
    
    
}


Measured memory_bytes: 3772
#include<iostream>
#include<string.h>
using namespace std;

#define N 25

class Node {
public:
    int parent = -1;
    int sibling = -1;
    int depth = 0;
    int height = 0;
    int degree = 0;
    int left;
    int right;
};

void depther(Node *, int, int);
void heighter(Node *, int, int);

int main() {

    int n;
    cin>>n;
    int id, l, r;
    Node list[N];
    
    for(int i = 0; i < n;  i++) {
        cin>>id>>l>>r;
        list[id].left = l;
        list[id].right = r;
        if(l != -1) {
            list[id].degree++;
            list[l].parent = id;
            list[l].sibling = r;
        }
        if(r != -1) {
            list[id].degree++;
            list[r].parent = id;
            list[r].sibling = l;
        }
    }
    
    for(int i = 0; i < n; i++) {
        if(list[i].parent == -1) depther(list, i, 0);
    }
    
    for(int i = 0; i < n; i++) {
        if(list[i].left == -1 && list[i].right == -1) heighter(list, i, 0);
    }
  
    char status[14] = "";
    int j;
    for(int i = 0; i < n; i++) {
        if(list[i].parent == -1) strcpy(status, "root");
        else if(list[i].degree == 0) strcpy(status, "leaf");
        else strcpy(status, "internal node");
        
        cout<<"node "<<i<<": parent = "<<list[i].parent<<", sibling = "<<list[i].sibling<<", degree = "<<list[i].degree<<", depth = "<<list[i].depth<<", height = "<<list[i].height<<", "<<status<<endl;
    }

  return 0;
}

void depther(Node *list, int a, int dep) {
    list[a].depth = dep;
    dep++;
    if(list[a].left != -1) depther(list, list[a].left, dep);
    if(list[a].right != -1) depther(list, list[a].right, dep);
}

void heighter(Node *list, int a, int hei) {
    if(list[a].height < hei) list[a].height = hei;
    hei++;
    if(list[a].parent != -1) heighter(list, list[a].parent, hei);
}



Measured memory_bytes: 3120
def main():
    K, N = map(int, input().split())
    A = list(map(int, input().split()))
    t = 0
    p = A[0]
    for i in A[1:]:
        t = max(t, i - p)
        p = i
    t = max(t, A[0] + K - A[-1])
    return K - t
print(main())



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

using ll = long long;

int main() {
  int n;
  cin >> n;
  
  vector<ll> a(n);
  for(int i = 0; i < n; i++) cin >> a.at(i);
  
  ll l = 0, r = 1, keep = a.at(0), ans = 0, ans_keep = 1;
  while(l < n){
    if(r == n){
      ans += ans_keep;
      ans_keep--;
      l++;
    }
    else if((keep & a.at(r)) == 0){
      keep = (keep ^ a.at(r));
      ans_keep++;
      r++;
    }
    else{
      ans += ans_keep;
      keep = (keep ^ a.at(l));
      ans_keep--;
      l++;
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a[15][15]={0},b=0,c=0,x,y,t;
  string s[50];
  while(scanf("%d,%d,%d",&x,&y,&t)!=EOF){
    if(t==3){a[x+2][y+2]++;a[x+1][y+2]++;a[x][y+2]++;a[x+3][y+2]++;a[x+4][y+2]++;a[x+2][y+1]++;a[x+2][y]++;a[x+2][y+3]++;a[x+2][y+4]++;a[x+3][y+3]++;a[x+3][y+1]++;a[x+1][y+3]++;a[x+1][y+1]++;}
    else if(t==2){a[x+2][y+2]++;a[x+1][y+2]++;a[x+3][y+2]++;a[x+2][y+1]++;a[x+2][y+3]++;a[x+3][y+3]++;a[x+3][y+1]++;a[x+1][y+3]++;a[x+1][y+1]++;}
    else {a[x+2][y+2]++;a[x+1][y+2]++;a[x+3][y+2]++;a[x+2][y+1]++;a[x+2][y+3]++;}
  }
  for(int i=2;i<12;i++){
    for(int j=2;j<12;j++){
      if(!a[i][j])c++;
      b=max(b,a[i][j]);
    }
  }
  cout<<c<<endl<<b<<endl;
}

Measured memory_bytes: 3048
#include <bits/stdc++.h>
#define all(x) (x).begin() , (x).end()
#define rall(x) (x).rbegin() , (x).rend()
#define fi first
#define se second
#define pb push_back
#define read(type, ...)type __VA_ARGS__; macro_scan(__VA_ARGS__);

using namespace std;

template<typename T> void macro_scan(T& t){cin>>t;};
template<typename F, typename ...R>void macro_scan(F& f , R& ...r){
  cin>>f;macro_scan(r...);
}
void deb(){
    cerr<<endl;
}
template<typename T , typename... t>
void deb(T a , t...b){
    cerr<<a<<" ";
    deb(b...);
}
template<typename T>
void dev(vector<T>v){
    int c = 0;
    for(auto i : v){
        cerr<<i<<" ";
        c++;
    }
    cerr<<endl;
}


int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    read(int , a , b, c);
    swap(a , b);
    swap(a , c);
    cout<<a<<" "<<b<<" "<<c<<"\n";
}




Measured memory_bytes: 256
#!/usr/bin/env python3

N, M = map(int, input().split())
mod = 10 ** 9 + 7

table = [1]
tmp = 1
for i in range(1, N + M + 1):
    tmp *= i
    tmp %= mod
    table.append(tmp)

if abs(N - M) > 1:
    print(0)
elif abs(N - M) == 1:
    print(table[N] * table[M] % mod)
else:
    print(2 * table[N] * table[M] % mod)

Measured memory_bytes: 11028