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

#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define F first
#define S second
#define SZ(a) (int)((a).size())
#define pb push_back
#define mp make_pair
#define ALL(a) (a).begin(),(a).end()
using namespace std;

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

#define PR(...) do{cerr << "line : " << __LINE__ << endl; pr(#__VA_ARGS__, __VA_ARGS__);}while(0);
template<class T>
void pr(const string& name, T t){
  cerr << name << ": " << t << endl;
}

template<typename T, typename ... Types>
void pr(const string& names, T t, Types ... rest) {
  auto comma_pos = names.find(',');
  cerr << names.substr(0, comma_pos) << ": " << t << ", ";
  
  auto next_name_pos = names.find_first_not_of(" \t\n", comma_pos + 1);
  pr(string(names, next_name_pos), rest ...);
}

template<class T,class U> ostream& operator<< (ostream& o, const pair<T,U>& v){return o << "(" << v.F << ", " << v.S << ")";}
template<class T> ostream& operator<< (ostream& o, const vector<T>& v){o << "{";rep(i,SZ(v)) o << (i?", ":"") << v[i];return o << "}";}
template<class T> ostream& operator<< (ostream& o, const set<T> &v){o << "{";for(auto e : v) o << e << ", ";return o << "}";}
template<class T, class U> ostream& operator<< (ostream& o, const map<T,U> &v){o << "{";for(auto e : v) o << e.F << ": " << e.S << ", ";return o << "}";}

//                < v > ^
const int dx[] = {0,1,0,-1, 1, 1, -1, -1};
const int dy[] = {-1,0,1,0, 1, -1, 1, -1};
#define endl '\n'

template<long long mod=(int)1e9+7, int sz = 200000>
struct NCR{
  /*
    ref
    http://twilog.org/anta_prg/date-131128

    verify 
    weak
    http://arc039.contest.atcoder.jp/submissions/407546
  */
  
  long long fact[sz];
  long long ifact[sz];
  
  inline long long inv(long long p){
    long long n = mod - 2;
    long long ret = 1;
    while(n){
      if(n&1) ret = ret * p % mod;
      p = p * p % mod;
      n /= 2;
    }
    return ret;
  }
  
  NCR(){
    fact[0] = 1;
    for(int i = 0; i < sz; ++i){
      fact[i + 1] = fact[i] * (i + 1) % mod;
    }
    ifact[sz-1] = inv(fact[sz-1]);
    for(int i = sz - 1; i > 0; --i){
      ifact[i - 1] = ifact[i] * i % mod;
    }
  }

  long long ncr(int n, int k){
    if(n < k || k < 0) return 0;
    return fact[n] * ifact[k] % mod * ifact[n - k] % mod;
  }
};


NCR<> ncr;

const ll mod = 1e9 + 7;

int main(int argc, char *argv[])
{
  ll h, w, a, b;
  cin >> h >> w >> a >> b;
  ll ans = ncr.ncr(h + w - 2, h - 1);

  for (ll i = 1; i <= b; ++i) {
    ans -= ncr.ncr(h - a + i - 2, i - 1) * ncr.ncr(w + a - i - 1, a - 1) % mod;
    ans += mod;
    ans %= mod;
  }

  cout << ans << endl;
}


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

#define in freopen("input.txt", "r" ,stdin)
#define out freopen("fenceplan.out", "w" ,stdout)
#define ll long long
#define pb push_back
#define fr first
#define sc second
const int mod = 1e9+7;
using namespace std;

ll n, u , v;
vector<ll> g[100005];
ll d1[100005];
ll d2[100005];
int main (){
    //in;
    //out;
    ios_base::sync_with_stdio(0);
    cin >> n >> u >> v;
    for (int i = 1; i <= n; i++) {
        ll a , b;
        cin >> a >> b;
        g[a].pb (b);
        g[b].pb (a);
    }
    for (int i = 1; i <= n; i++) d1[i] = d2[i] = -1;
    queue<ll> q1, q2;

    d1[v] = 0;
    q1.push(v);
    while (!q1.empty()) {
        ll v = q1.front();
        q1.pop();
        for (auto to : g[v]) {
            if (d1[to] != -1) continue;
            d1[to] = d1[v] + 1;
            q1.push(to);
        }
    }

    d2[u] = 0;
    q2.push(u);
    ll ans = 0;
    while (!q2.empty()) {
        ll v = q2.front();
        q2.pop();
        if (d2[v] < d1[v] and ans < d1[v]) ans = d1[v];
        for (auto to : g[v]){
            if (d2[to] != -1) continue;
            d2[to] = d2[v] + 1;
            q2.push(to);
        }
    }

    cout << ans-1;
}


Measured memory_bytes: 8064
#include <bits/stdc++.h>
typedef long long ll;

int main(int argc, char const *argv[]) {
    ll K, S;
    std::cin >> K >> S;
    ll z;
    ll count = 0;
    for (size_t x = 0; x < K + 1; x++) {
        for (size_t y = 0; y < K + 1; y++) {
            z = S - x - y;
            if (0 <= z && z <= K) {
                count++;
                // std::cout << x << y << z << '\n';
            }
        }
    }

    std::cout << count << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fastIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;

int main()
{
  fastIO
	long a,b,c,k;
	cin >>a>>b>>c>>k;
	if (k <= a){
		cout << k;
	}
	else if (k > a && k <= a+b){
		cout << a;
	}
	else if (k > a + b){
		cout << a - (k - a - b);
	}
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(x)(x).begin(), (x).end() // 昇順ソート
#define rall(v)(v).rbegin(), (v).rend() // 降順ソート
#define INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair < ll, ll >
#define F first
#define S second
const int MOD = 1000000007;
template < class T > bool chmax(T & a,const T & b) { if (a < b) { a = b; return true; } return false; }
template < class T > bool chmin(T & a,const T & b) { if (a > b) { a = b; return true; } return false; }
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main() {
    int N;cin >> N;
    vector<LL> A(N);rep(i,N)cin >> A[i];

    map<LL,int> m;
    rep(j,N){
        LL tmp = j - A[j];
        m[tmp]++;
    }

    LL ans = 0;
    rep(i,N){
        LL tmp = A[i] + i;
        if(m[tmp] > 0){
            ans += m[tmp];
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 27492
package main

import (
	"fmt"
)

func main() {
	var A,V,B,W,T int
	fmt.Scan(&A,&V,&B,&W,&T)
	oituku := V - W
	sum := B - A
	if sum < 0 {
		sum = -sum
	}
	for i:=0; i<T; i++ {
		sum -= oituku
	}
	if sum<=0 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


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


class Program
{
    static void Main(string[] args)
    {
        string[] str = Console.ReadLine().Split(' ');
        int counter1 = 0, counter2 = 0;
        for(int i = 0; i < 3 ;++i)
        {
            if (str[i] == "5")
                counter1++;
            else if (str[i] == "7")
                counter2++;
        }

        if (counter1 == 2 && counter2 == 1)
            Console.WriteLine("YES");
        else
            Console.WriteLine("NO");

        
    }
}

Measured memory_bytes: 11092
from math import sqrt
def solve():
    N = int(input())

    mn = float('inf')
    for A in range(int(sqrt(N))+1,0,-1):
        if N % A == 0:
            B = N // A
            mn = min(f(A,B), mn)

    print(mn)

def f(A,B):
    return max(len(str(A)), len(str(B)))
    
if __name__ == '__main__':
    solve()

Measured memory_bytes: 39024
#include <bits/stdc++.h>
#define rep(a,n) for (ll a = 0; a < (n); ++a)
using namespace std;
typedef long long ll;
using ll = long long;
typedef pair<ll,ll> P;
typedef pair<P,ll> PP;
using Graph = vector<vector<ll> >;
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; }
const ll INF = 1e18;

//入力
ll n,k;
vector<ll>a;

// auto mod ll
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const ll mod = 1000000007;
//const ll mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}


// combination mod prime
// mintが必要
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
  vector<mint> fact, ifact;
  combination(ll n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (ll i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (ll i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(ll n, ll k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};


int main(){
    cin >> n >> k;
    a.resize(n);
    rep(i,n)cin>>a[i];
    vector<ll>t(n,0);
    for(ll i=0;i<n;i++){
        for(ll j=i+1;j<n;j++){
            if(a[i]>a[j])t[i]++;
        }
    }
    vector<ll>s(n,0);
    for(ll i=0;i<n;i++){
        for(ll j=0;j<n;j++){
            if(a[i]>a[j])s[i]++;
        }
    }
    mint ans = 0;
    rep(i,n){
        mint now = 1;
        now *= t[i];
        now *= k;
        mint now2 = 1;
        now2 *= k;
        now2 *= k-1;
        now2 /=2;
        now2 *=s[i];
        ans += now;
        ans += now2;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3628
N = int(input())
S = input()

count = 0
for i in range(1, N-1):
    A = list(set(S[:i]))
    B = list(set(S[i:]))
    C = 0
    for a in A:
        if a in B:
            C += 1
    if count < C:
        count = C

print(count)

Measured memory_bytes: 3064
int main(void) {
  int a,b,x,i;
  int ans;

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

ans=x-a;

for ( i = 0; ans>=b; i++) {
  ans=ans-b;
}

printf("%d",ans );

  return 0;
}



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

int main() {
  int n, q;
  string s;
  cin >> n >> q >> s;

  vector<ll> x(n + 1);
  for (int i = 1; i < n; ++i) x[i] = x[i - 1] + (s[i - 1] == 'A' && s[i] == 'C');

  int l, r;
  rep(i, q) {
    cin >> l >> r;
    r--, l--;
    cout << x[r] - x[l] << endl;
  }

  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define inf 1000000000000000
#define bpc(x) __builtin_popcountll(x)
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define rep(n) for(ll i = 0; i < n; i++)
#define repi(i,n) for(ll i = 0; i < n; i++)

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 

using namespace std;

int main()
{
   FAST/**/
   
   ll dp[20][10];
   memset(dp,0,sizeof(dp));
   rep(10)
        dp[1][i] = 1;
   for(ll i=2;i<15;i++)
   {
       for(ll j=0;j<10;j++)
            for(ll k1=0;k1<10;k1++)
            {
                if(abs(j-k1)>1)
                    continue;
                dp[i][j]+=dp[i-1][k1];    
            }
   }
   
   ll k;
   cin>>k;
   
   vector<ll> num;
   vector<ll> dp1;
   dp1.pb(0);
   ll prev = 0;
   for(ll i=1;i<15;i++){
       ll sum = 0;
        for(ll j=1;j<10;j++)
            sum+=dp[i][j];
        dp1.pb(sum+prev);
        prev = sum+prev;
   }
   ll maxi = 0;
   for(ll j=1;j<15;j++)
   {
       if(dp1[j]>=k)
       {
           maxi = j;
           break;
       }
   }
   //cout<<dp[2][1]<<"\n";
   k-=dp1[maxi-1];
   for(ll i=maxi;i>0;i--)
   {
       //cout<<"at "<<i<<" = "<<k<<"\n";
       if(i == maxi)
       {
           for(ll j=1;j<10;j++)
           {
                if(dp[i][j]>=k)
                {
                    num.pb(j);
                    break;
                }
                k-=dp[i][j];
           }
       }
       
       else
       {
           for(ll j=max(num.back()-1,0ll);j<=min(num.back()+1,9ll);j++)
           {
                if(dp[i][j]>=k)
                {
                    num.pb(j);
                    break;
                }
                k-=dp[i][j];
           }
       }
   }
   rep(num.size())
        cout<<num[i];
   
   
   return 0;        
}  
   

Measured memory_bytes: 256
import sys
N=int(input())
a=list(map(int,input().split()))
rain=[[] for _ in range(N)]
tot=sum(a)
i=0
tmp=tot
while i!=N-1:
  tmp-=2*a[i]
  i+=2
rain[-1]=str(tmp)
for i in range(-2,-N-1,-1):
  rain[i]=str(2*a[i]-int(rain[i+1]))
print(' '.join(rain))

Measured memory_bytes: 19772
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rrep(i,n) for (int i = (int)(n)-1; i>=0; --i)
#define For(i,a,b) for(auto i=(a);i<=(b);++i)
#define rFor(i,a,b) for(auto i=(b);i>=(a);--i)
#define call(var) cerr<<#var<<"="<<var<<"\n";
#define dup(x,y) (((x)+(y)-1)/(y))
#define all(x) (x).begin(),(x).end()
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 double pi = acos(-1);
template<class t,class u> inline bool chmax(t&a,u b){if(a<b){a=b;return true;}return false;}
template<class t,class u> inline bool chmin(t&a,u b){if(b<a){a=b;return true;}return false;}


void cerrall(const vector<bool>& a){rep(i,a.size()) cerr << i << " " << (a[i]? "True" : "False") << "\n"; cerr << "\n";}
template<class T> void cerrall(const vector<T>& a){for(auto& t : a) cerr << t << " "; cerr << "\n";}
template<class T> void cerrall(const set<T>& a){for(auto& t : a) cerr << t << " "; cerr << "\n";}
template<class T> void cerrall(const multiset<T>& a){for(auto& t : a) cerr << t << " "; cerr << "\n";}
template<class T, class U> void cerrall(const vector<pair<T,U>>& a){rep(i,a.size()) cerr << i << " : " << a[i].first << " " << a[i].second << "\n";}
template<class T, class U> void cerrall(const map<T,U>& a){for(auto& t : a) cerr << t.first << " " << t.second << "\n";}
template<class T, class U> void cerrall(const unordered_map<T,U>& a){for(auto& t : a) cerr << t.first << " " << t.second << "\n";}

template<class T> istream& operator>>(istream& is, vector<T>& a){rep(i,a.size()) is >> a[i]; return is;}
template<class T> ostream& operator<<(ostream& os, vector<T>& a){rep(i,a.size()) os << a[i] << " "; return os;}

template<class T, class U> istream& operator>>(istream& is, pair<T,U>& p){is >> p.first >> p.second; return is;}
template<class T, class U> ostream& operator<<(ostream& os, const pair<T,U>& p){os << "("<< p.first << "," << p.second << ")"; return os;}
template<class T, class U> ostream& operator<<(ostream& os, const map<T,U>& mp){for(auto& t : mp) os << t.first << " " << t.second << "\n"; return os;}

int main(){
    int n;cin >> n;
    vl a(n+1);
    cin >> a;
    if(n == 0 && a[0] == 1){
        cout << 1 << endl;
        return 0;
    }
    if(a[0] != 0){
        cout << -1 << endl;
        return 0;
    }

    vl rui(n+1);
    rui[n] = 0;
    for(int i=n-1;i>=0;--i){
        rui[i] = rui[i+1] + a[i+1];
    }

    vl setu(n+1);
    setu[0] = 1;
    setu[n] = 0;
    for(int i=1;i<=n;++i){
        setu[i] = min(setu[i-1] * 2 - a[i], rui[i]);

        if(setu[i] < 0){
            cout << -1 << endl;
            return 0;
        }
    }
    if(a[n] > setu[n-1] * 2){
        cout << -1 << endl;
        return 0;
    }else if(a[n] < setu[n-1]){
        cout << -1 << endl;
        return 0;
    }
    //cout << setu << endl;

    ll ans = 0;
    for(int i=0;i<=n;++i){
        ans += setu[i] + a[i];
    }

    cout << ans << endl;
}

Measured memory_bytes: 5640
//=======================//
// coder: Andy - Tohrumi //
//=======================//

#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(); cin.tie(0); cout.tie(0);
#define int long long
#define maxn 200010
#define pb push_back
#define fi first
#define se second

const int mod = 1e9+7;

typedef vector<int> vi;		typedef vector<int> vl;
typedef pair<int, int> ii; 	typedef vector<ii> vii;

// code start here //

int dp[maxn], pos[maxn], l[maxn], r[maxn];
bool check[maxn];

signed main() {
	fastio;
	int n, k, c;	cin >> n >> k >> c;
	string str;	cin >> str;
	for (int i = 1; i <= n; i++)
	{
		if (str[i-1] == 'o')
		{
			pos[i] = i;
			if (i-1-c < 0)	dp[i] = 1;
			else dp[i] = dp[i-1-c] + 1;
		}
		else 
		{
			pos[i] = pos[i-1];
			dp[i] = dp[i-1];
		}
	}
	if (dp[n] != k)
	{
		return 0;
	}
	vector<int> ans[k+1];
	vector<int> arr[k+1];
	int len = dp[n];
	for (int i = 1; i <= n; i++)
	{
		if (str[i-1] == 'o')
		arr[dp[i]].pb(i);
	}
	for (int i = 0; i <= maxn; i++)	l[i] = mod;
	for (int i = 0; i < arr[len].size(); i++)
	{
		check[arr[len][i]] = true;
		l[len] = min(l[len], arr[len][i]);
		r[len] = max(r[len], arr[len][i]);
	}
	
	for (int i = len-1; i >= 1; i--)
	{
		for (int j = 0; j < arr[i].size(); j++)
		{
			int u = arr[i][j];
			if (u + c + 1 <= r[i+1])	
			{
				check[u] = true;
				l[i] = min(l[i], u);
				r[i] = max(r[i], u);
			}
			
		}
	}
	for (int i = 1; i <= n; i++)
	{
		if (check[i])
		ans[dp[i]].pb(i);
	}
	for (int i = 1; i <= len; i++)
	{
		if (ans[i].size() == 1)	cout << ans[i][0] << endl;
	}
//	sort(ans.begin(), ans.end());
//	for (int i = 0; i < (int)ans.size(); i++)	cout << ans[i] << endl;
}


Measured memory_bytes: 31784
#include <bits/stdc++.h>
using namespace std;
#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++)


int main() {
  int n,m;
  cin >> n>>m;
  
  int ans;
  if(m%n==0){
    ans=m/n;
  }
  rep2(i,1,sqrt(m)+1){
    if(m%i==0){
      if(n<=m/i){
        ans=max(ans,i);
      }
      if(n<=i){
        ans=max(ans,m/i);
      }
    }
  }
  
  cout<<ans<<endl;
  
}

Measured memory_bytes: 256
s = input()
win = s.count('o')

if len(s) == 15:
    if win >= 8:
        print('YES')
    else:
        print('NO')
else:
    s_len = 15 - len(s)
    win_f = s_len + win
    if win_f >= 8:
        print('YES')
    else:
        print('NO')

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
string S[101000];
string T;

int A,B;

int canless(string P,string Q) {
	int i;
	FOR(i,P.size()) {
		if(i>=Q.size()) return 0;
		if(P[i]=='?') {
			if(Q[i]=='?' || (Q[i]>='b' && Q[i]>='z')) return 1;
		}
		else if(Q[i]=='?') {
			if(P[i]!='z') return 1;
		}
		if(P[i]<Q[i]) return 1;
		if(P[i]>Q[i]) return 0;
	}
	return 1;
	
}

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	FOR(i,N) cin>>S[i];
	cin>>T;
	FOR(i,N) {
		if(canless(S[i],T)) A++;
		if(canless(T,S[i])) B++;
	}
	
	for(i=N+1-B;i<=A+1;i++) _P("%d%c",i,(i==A+1)?'\n':' ');
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
int a[110];
int main()
{
    int n,x,i,cou=0,ch=0;
    scanf("%d %d",&n,&x);
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    sort(a,a+n);
    for(i=0;i<n;i++){
        if(a[i]<=x){
            ch++;
            cou++;
            x-=a[i];
        }
    }
    if(x&&ch&&cou==n) cou--;
    printf("%d",cou);
    return 0;
}


Measured memory_bytes: 256
package main

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

//============================================================
var sc = bufio.NewScanner(os.Stdin)
func setScSplit() { sc.Split(bufio.ScanWords) }
func readStr() string {
  sc.Scan()
  return sc.Text()
}
func readInt() int {
  i, _ := strconv.Atoi(readStr())
  return i
}
func readFloat() float64 {
  f, _ := strconv.ParseFloat(readStr(), 64)
  return f
}
//=============================================================

func main(){
    setScSplit()
    s := readStr()
    fmt.Println("2018"+s[4:])
}




Measured memory_bytes: 640
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""

# Written by NoKnowledgeGG @YlePhan

#import math
#mod = 10**9+7
def main():
  s = input()
  s_l = len(s)
  
  for i in range(s_l):
    if s[i] == 'A':
      st = i
      break
  for i in range(s_l-1,-1,-1):
    if s[i] == 'Z':
      en = i
      break
  print(en - st + 1)
  
  
if __name__ == '__main__':
  main()

Measured memory_bytes: 3548
s=list(input())
t=list(input())
ans=len(t)
for i in range(len(s)-len(t)+1):
    count=len(t)
    for j in range(len(t)):
        if s[i+j]==t[j]:
            count-=1
    if count<ans:
        ans=count
print(ans)

Measured memory_bytes: 9064
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main(){
    int n;
    cin>>n;
    int a[n];
    rep(i,n){
        cin>>a[i];
        a[i]--;
    }
    bool b[n]={};
    set<int> s;
    int now=0,ans=0;
    while(1){
        if(b[now]){cout<<-1<<endl;return 0;}
        if(now==1){cout<<ans<<endl;return 0;}
        ans++;
        b[now]=true;
        now=a[now];
    }
    return 0;
}

Measured memory_bytes: 768
import sys
sys.setrecursionlimit((2**31)-1)
from fractions import gcd
from collections import deque
n,X = [int(i) for i in input().split()]
x = [int(i) for i in input().split()]
x.append(X)
x = sorted(x)
k = x[0]
x = deque([i-k for i in x])
x.popleft()

def gcdn():
    if len(x)==1:
        return
    p=x.pop()
    q=x.pop()
    x.append(gcd(p,q))
    gcdn()

gcdn()
print(x[0])

Measured memory_bytes: 93332
#include<cstring>
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main()
{
	vector<string> str;
	int N, L;
	cin >> N >> L;
	for(int i=0; i<N; i++){
		string tmp;
		cin >> tmp;
		str.push_back(tmp);
	}
	sort(str.begin(), str.end());
	string ans;
	for(auto s: str){
		ans += s;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    // give one ball to everyone
    // then you're left with n-k balls
    // at this point give those n-k balls to one person
    // so one person has n-k+1 balls
    // and everyone else has 1 ball 
    // so the max difference is n-k 
    // unless theres only one person. 
    int n, k;
    cin>> n >>k;
    if (k==1) {
        cout << 0 <<endl;
    } else {
        cout << n-k <<endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
#include<string>
#include<vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <cmath>
#include <limits>
using namespace std;


int main()
{
	int n;
	cin >> n;
	vector<int>a(n);
	for (int& x : a)cin >> x;
	sort(a.begin(), a.end());
	cout << a[a.size() - 1] - a[0] << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int pre, n, a[100010];
long long ans;
int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    for (int i = 1; i <= n; i++) {
        if (a[i] && pre) a[i]--, ans++;
        ans += a[i] / 2;
        pre = a[i] % 2;
    }
    printf("%lld\n", ans);
    return 0;
}

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

int main() {
	long long n, p;
	string s;
	cin >> n >> p >> s;
	long long ans = 0;
	if (p == 2 || p == 5) {
		for (int i = 0; i < n; i++) {
			if ((s[i]-'0')%p==0) ans += i+1;
		}
	} else {
		int a[10000] = {1};
		int z = 1;
		int x = 0;
		for (int i = n-1; i >= 0; i--) {
			x += z * (s[i]-'0') % p;
			x %= p;
			ans += a[x];
			a[x]++;
			z = z*10%p;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 644
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

#define FOR(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define IFOR(i, a, b) for(int (i)=(a);(i)<=(b);(i)++)
#define RFOR(i, a, b) for(int (i)=(a);(i)>=(b);(i)--)

using namespace std;

int main() {
    int n;
    cin >> n;
    int ki = 0, gu = 0;
    FOR(i, 0, n) {
        int t;
        cin >> t;
        if (t % 2 == 0)
            gu++;
        else
            ki++;
    }

    cout << (ki % 2 == 0 ? "YES" : "NO") << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<bitset>
#include<vector>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<iomanip>
#include <functional>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int INF = 1 << 28;
const double EPS = 1e-10;
//cout << fixed << std::setprecision(9)
//memset(a, 0, sizeof(a));
//--------------------------

int a, b, c, d;

int main()
{
	cin >> a >> b >> c >> d;
	cout << max(a*b, c*d) << endl;

	return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.buffer.readline
import numpy as np

def main():
    N,M = map(int,input().split())
    point = np.array([list(map(int,input().split())) for _ in range(N)])
    
    ans = 0
    for i in range(2**3):
        pn = np.full(3,1,dtype=int)
        for j in range(3):
            pn[j] = (-1)**(i>>j)
        use = point*pn
        s = np.sum(use,axis=1)
        srev = np.sort(s)[::-1]
        ans = max(ans,np.sum(srev[:M]))
        
    print(int(ans))

if __name__ == "__main__":
    main()


Measured memory_bytes: 21544
object Main {
  def main(args: Array[String]) {
    val sum = io.StdIn.readLine.toInt
    val candidates = for (j <- (1 until sum)) yield (j, sum - j)
    println(candidates.map(t => sumOfEachRank(t._1) + sumOfEachRank(t._2)).min)
  }

  def sumOfEachRank(n: Int): Int =
    n.toString.map(_.asDigit).sum
}


Measured memory_bytes: 68584
while True:
    H, W = map(int, input().split())
    
    if H == 0 and W == 0:
        break
    
    for i in range(H):
        for j in range(W):
            if (i + j) % 2 == 0:
                print("#", end = '')
            else:
                print(".", end = '')
        print()
    print()


Measured memory_bytes: 7000
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		int count=0;
		if(s.charAt(0) == '1')count++;
		if(s.charAt(1) == '1')count++;
		if(s.charAt(2) == '1')count++;
		
		System.out.println(count);			
	}

}


Measured memory_bytes: 22612
package main

import (
	"fmt"
	"sort"
)

func main() {
	var N int
	fmt.Scan(&N)
	x := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scan(&x[i])
	}
	y := make([]int, N)
	copy(y, x)
	sort.Ints(y)
	m1, m2 := y[-1+N/2], y[N/2]
	for _, v := range x {
		if v <= m1 {
			fmt.Println(m2)
		} else {
			fmt.Println(m1)
		}
	}
}


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

int n, x, ans, p;

int abs(int a, int b) { return (a < b ? b - a : a - b); }
int GCD(int a, int b) { return (b == 0 ? a : GCD(b, a % b)); }

int main(){
	cin >> n >> x >> ans;
	ans = abs(x - ans);
	for (int i = 1; i < n; ++i){
		cin >> p;
		p = abs(x - p), ans = GCD(ans, p);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cassert>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
#include <cmath>
#include <bitset>
#include <functional>
#include <limits>
#include <map>
using namespace std;

typedef long long ll;
#define rep2(i, n) for(ll i = 2; i <=(ll)(n); i++)
#define rep1(i, n) for(ll i = 1; i <=(ll)(n); i++)
#define rep0(i, n) for(ll i = 0; i <=(ll)(n); i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

ll pow(ll a, ll n) { //compute a^n with o(logn)
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a;
        a = a * a;
        n >>= 1;
    }
    return res;
}

ll pow(ll a, ll n, ll mod) { //compute a^n (mod mod) with o(logn)
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

const int MAX = 199;
const int MOD = 1000000007;
ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

//順列計算
ll PER(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[n - k] % MOD) % MOD;
}

int main(){
    ll n;
    cin >> n;
    bool isZoro[n];
    rep0(i,n-1){
        int x,y;
        cin >> x >> y;
        if(x == y) isZoro[i] = true;
        else isZoro[i] = false;
    }
    rep0(i, n-3){
        if(isZoro[i] && isZoro[i+1] && isZoro[i+2]){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3136
a,b=map(int, input().split())
s = input()
for i in range(len(s)):
  if i == a:
    if s[i] != "-":
      print("No")
      break
  else:
    if not "0" <= s[i] <= "9":
      print("No")
      break
else:
  print("Yes")

Measured memory_bytes: 9080
#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

int main()
{
    char s[110];
    int a[27];
    while(scanf("%s",s)!=EOF)
    {
        memset(a,0,sizeof(a));
        for(int i=0;i<strlen(s);i++)
        {
            a[s[i]-'a']++;
        }
        int flag=0;
        for(int i=0;i<27;i++)
        {
            if(a[i]!=0&&a[i]%2!=0)
            {
                flag=1;
                break;
            }
        }
        if(flag)
        {
            printf("No\n");
        }
        else
        {
            printf("Yes\n");
        }
    }
    return 0;
}


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

int main(void)
{
    long long int a,b,c,i,j,k,n;
    string s;
    char C[5];
    
    cin >> s;

    s.at(3)++;

    cout << s;

    return 0;
}

Measured memory_bytes: 256
// package com.company;

import java.util.*;
import java.io.*;

public class Main {
    static Scanner input = new Scanner(System.in);


    public static void main(String[] args) {
        String ans = "";
        int x = input.nextInt();
        int y = input.nextInt();
        int s = input.nextInt();

        while (x != 0 || y!= 0 || s != 0) {
            int max = 0;
        
            for (int ax = 1; ax <= s/2; ax++) {
                int bx = s - ax;
                // double vat = (double) (100 + x) / 100;
                int a = (int) Math.ceil((double) ax / (100 + x) * 100 );
                int b = (int) Math.ceil((double) bx / (100 + x) * 100);
                
                // int axx = (int) Math.floor(a * vat);
                // int bxx = (int) Math.floor(b * vat);
                int ss =(int) (Math.floor((double) a * (100 + x) / 100) + Math.floor((double) b * (100 + x) / 100));
                // int ss = axx + bxx;

                // System.out.println("ss = " + ss) ;
                if (ss != s) continue;

                int ay = (int) Math.floor(a * (100 + y) / 100);
                int by = (int) Math.floor(b * (100 + y) / 100);
                int sum = ay + by;
                
                // System.out.println("ax = " + ax + " bx = " + bx + " sum = " + (ax + bx)) ;
                // System.out.println("a = " + a + " b = " + b + " sum = " + (a + b)) ;
                // System.out.println("ay = " + ay + " by = " + by + " sum = " + (ay + by)) ;
                max = Math.max(max, sum);
            }
            
            ans += max + "\n";

            x = input.nextInt();
            y = input.nextInt();
            s = input.nextInt();
        }
        
        System.out.println(ans.trim());
    }
}


Measured memory_bytes: 30464
import sys
import math
N, K = map(int, input().split())
res = 0

for n in range(1,N+1):
  if(n >= K):
    res = res/N + (N-K+1)/N
    print('{:.14g}'.format(res))
    sys.exit()
  res += pow(1/2, math.ceil(math.log2(K/n)))

print('{:.14g}'.format(res / N) )

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
typedef long long ll;
// #define MULTIPLE_TESTS 1

void readArray(vector<ll>& arr, int n) {
    arr.resize(n);
    for (auto &a: arr) {
        cin >> a;
    }
}

void readParallelArrays(vector<ll>& arr1, vector<ll>& arr2, int n) {
    arr1.resize(n);
    arr2.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> arr1[i];
        cin >> arr2[i];
    }
}

void sortArray(vector<ll>& arr) {
    sort(arr.begin(), arr.end());
}

void solve() {
    int n;
    cin >> n;
    vector<ll> A, B;
    readParallelArrays(A, B, n);
    sortArray(A);
    sortArray(B);
    ll ans;
    if (n & 1) {
        int mid = n/2;
        ans = B[mid] - A[mid] + 1;
    } else {
        int mid1 = (n - 1)/2;
        int mid2 = n/2;
        ll A_mid = (A[mid1] + A[mid2]);
        ll B_mid = (B[mid1] + B[mid2]);
        ans = (B_mid - A_mid + 1);
    }
    cout << ans << endl;
}

int main() {
    FAST_IO;
    int t = 1;
    #ifdef MULTIPLE_TESTS
    cin >> t;
    #endif

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

    return 0;
}

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

int main()
{
    string s;
    cin >> s;
    regex re[8] = {};
    re[0] = ".*keyence";
    re[1] = "k.*eyence";
    re[2] = "ke.*yence";
    re[3] = "key.*ence";
    re[4] = "keye.*nce";
    re[5] = "keyen.*ce";
    re[6] = "keyenc.*e";
    re[7] = "keyence.*";
    bool matched = false;
    for(auto r: re) matched |= regex_match(s, r);

    if(matched)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 256
from collections import Counter
n = int(input())
S = [input() for _ in range(n)]


S_Counters= [ Counter(s) for s in S]

for i in range(26):
    s =chr(ord("a")+i)
    val = min([counter[s] for counter in S_Counters])
    print(s*val ,end='')
print()

Measured memory_bytes: 3436
#include <math.h>
#include <assert.h>
#include <algorithm>
#include <set>
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <string>
#include <cstring>
#include <functional>
#include <stack>
#include <array>
#include <random>
#include <chrono>
#include <climits>
#include <bitset>
using namespace std ;
#define ld long double
#define int long long
#define ii pair<int,int>
#define FAST_IO ios_base::sync_with_stdio(false) ;cin.tie(NULL);cout.tie(NULL); clock_t beg = clock()
#define dbg(x) cerr << #x << " is " << x << endl;
#define ms(x,a) memset(x,(int)(a),sizeof(x))
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define vi vector<int >
#define pb push_back
#define endl '\n'
#define ff first
#define ss second
const int N = 3e5+7 ;
//const int INF = 1e18 ;
const int MOD = 1e9 + 7 ;
vector<int> fact;
vector<int> ifact;
vector<int> inv;
vector<int> pow2;
//const int MOD = 998244353;
int add(int a, int b)
{
	a+=b;
	while(a>=MOD) a-=MOD;
	return a;
}
void radd(int &a, int b)
{
	a=add(a,b); 
}
int mult(int a, int b)
{
	return (a*1LL*b)%MOD;
}
void rmult(int &a, int b)
{
	a=mult(a,b);
}
int modpow(int a, int b)
{
	int r=1;
	while(b)
	{
		if(b&1) r=mult(r,a);
		a=mult(a,a);
		b>>=1;
	}
	return r;
}
int choose(int a, int b)
{
	if(a<0||b<0) return 0;
	if(a<b) return 0;
	if(b==0) return 1;
	if(a==b) return 1;
	return mult(fact[a],mult(ifact[b],ifact[a-b]));
}
int inverse(int a)
{
	return modpow(a,MOD-2);
}
void init(int _n)
{
	fact.clear(); ifact.clear(); inv.clear(); pow2.clear();
	fact.resize(_n+1);
	ifact.resize(_n+1);
	inv.resize(_n+1);
	pow2.resize(_n+1);
	pow2[0]=1;
	ifact[0]=1;
	fact[0]=1;
	for(int i=1;i<=_n;i++)
	{
		pow2[i]=add(pow2[i-1],pow2[i-1]);
		fact[i]=mult(fact[i-1],i);
		//ifact[i]=mult(ifact[i-1],inv[i]);
	}
	ifact[_n] = inverse(fact[_n]);
	for(int i=_n-1;i>=1;i--)
	{
		ifact[i] = mult(ifact[i + 1], i + 1);
	}
	for(int i=1;i<=_n;i++)
	{
		inv[i] = mult(fact[i-1],ifact[i]);
	}
}


void solve(){
	int n , a , b ;
	cin >> n >> a >> b ;
	int tot = modpow(2,n) ;
	radd(tot,MOD-1) ;
	int denom = 1 ;
	int num = 1 ;
	int nn = n ;
	for(int i = 1 ; i <= a ; i++){
		rmult(denom, i) ;
		rmult(num,nn--) ;
	}
	radd(tot,MOD-mult(num,inverse(denom))) ;
	nn = n ;
	denom = 1 ;
	num = 1 ; 
	for(int i = 1 ; i <= b ; i++){
		rmult(denom, i) ;
		rmult(num,nn--) ;
	}
	radd(tot, MOD-mult(num,inverse(denom))) ;
	cout << tot ;
}

int32_t main(){
	FAST_IO ;
	int t = 1 ;
	//init(N) ;
//	cin >> t ;
	while(t--){
		solve() ;
	}
    cerr << "\nExecution time: " << (clock() - beg) / 1000 << '\n';
}


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

using namespace std;

typedef long long ll;

const int MAXN = 2e5 + 7;
const ll INF = 2e9;

set<int> st;
map<int, int> wa;

int32_t main() {
	ios::sync_with_stdio(false); cin.tie(0);
	int n, m;
	cin >> n >> m;
	int ans1 = 0, ans2 = 0;
	for (int i = 0; i < m; i++) {
		int x;
		string op;
		cin >> x >> op;
		if (op == "AC") {
			if (!st.count(x)) {
				ans1++;
				st.insert(x);
			}
		} else if (op == "WA") {
			if (!st.count(x)) {
				wa[x]++;
			}
		}
	}
	for (auto x : wa) {
		if (st.count(x.first)) {
			ans2 += x.second;
		}
	}
	cout << ans1 << ' ' << ans2 << '\n';
	return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPP(i, n) for(int i = 1; i <= n; ++i)
#define REPR(i, n) for(int i = n-1; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define ALL(v) v.begin(), v.end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1000000007;
const ll INF = 1000000000;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,a,b; cin >> n >> a >> b;
    vector<ll> x(n), s(n);
    REP(i,n) {
        cin >> x[i];
        if(i>0) s[i-1] = (x[i] - x[i-1])*a;
    }
    ll ans = 0;
    REP(i,n-1) ans += min(s[i], b);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Numerics;


namespace AtCoderWorkspace
{
    class Program
    {
        static void Main(string[] args)
        {
            var cin = new Scanner();
            var N = cin.nextInt();

            var ans = 0;
            for (int i = 1; i <= N; i++)
            {
                if (Digit(i) % 2 == 1) ans++;
            }
            
            
            Console.WriteLine(ans);
        }

        static int Digit(int num)
        {
            return (num == 0) ? 1 : ((int)Math.Log10(num) + 1);
        }
    }





    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }
}


Measured memory_bytes: 13140
#include <stdio.h>
int main(int argc, char *argv[])
{
	int a,b,i,c;
	while(scanf("%d%d",&a,&b)!=EOF){
		c=1;
		for(i=a;i>0;i--){
			if((c*2)>(c+b))c+=b;
			else c*=2;
		}
		printf("%d\n",c);
	} 
	return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cassert>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <cmath>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
using namespace std;
#define REP(i, n) for (int64_t i = 0; i < (int64_t)n; i++)
#define REP_FOR(i, a, b) for (int64_t i = (int64_t)a; i < (int64_t)b; i++)
#define REP_REV(i, a, b) for (int64_t i = (int64_t)a; i > (int64_t)b; i--)
#define FORALL(v) (v).begin(), (v).end()
#define mp(a, b) make_pair(a, b)
#define eb(x) emplace_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int64_t, int64_t> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int64_t> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int64_t infi = 1147483600;
const ll infl = 4e18 + 5;
const char EOL = '\n';
const ll MOD = 998244353;

int main() {
    ll n;
    cin >> n;
    vector<ll> A(n+1, 0);
    vector<ll> B(n,0);
    for (auto &a : A) {
        cin >> a;
    }
    for (auto &b : B) {
        cin >> b;
    }
    ll rest = 0;
    ll sum = 0;
    for (ll i = 0; i < n; ++i) {
        ll p = min(A[i], B[i]);
        ll q = min(B[i] - p, A[i+1]);
        A[i+1] -= q;
        sum += p + q;
    }
    cout << sum << endl;
}


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

// ?????¬???????????¬??????
#pragma region MACRO
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define PED cout << "\n"
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define ILP while(true)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#pragma endregion

// ???
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long double> vld;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<string> vs;
#pragma endregion

// Effective std
#pragma region ESTD
template<typename C, typename T> int count(C& c, T t) { return count(ALL(c), t); }
template<typename C, typename F> int count_if(C& c, F f) { return count_if(ALL(c), f); }
template<typename C, typename T> void erase(C& c, T t) { remove(ALL(c), t), c.end(); }
template<typename C> void remove(vector<C>& c, unsigned int index) { c.erase(c.begin()+index); }
template<typename C, typename T, typename U> void replace(C& c, T t, U u) { replace(ALL(c), t, u); }
template<typename C, typename F, typename U> void replace_if(C& c, F f, U u) { (ALL(c), f, u); }
template<typename C> void reverse(C& c) { reverse(ALL(c)); }
template<typename C> void sort(C& c) { sort(ALL(c)); }
template<typename C, typename Pred> void sort(C& c, Pred p) { sort(ALL(c), p); }
#pragma endregion

// ?????°
#pragma region CONST_VAL
constexpr int PI = (2*acos(0.0));
constexpr int EPS = (1e-9);
constexpr int MOD = (int)(1e9+7);
constexpr int INF = 100000000;
#pragma endregion


int main()
{
    int q;
    cin >> q;
    rep(i,q) {
        int ans = 0;
        string tmp;
        cin >> tmp;
        string tmp2 = tmp;

        while(tmp.size() != 1) {
            int mmax = -1;
            REP(i,1,tmp.size()) {
                string st1, st2;
                rep(j,i) st1 += tmp[j];
                REP(j,i,tmp.size()) st2 += tmp[j];
                mmax = max(mmax, stoi(st1)*stoi(st2));
            }
            ans++;
            tmp = to_string(mmax);
            if(tmp==tmp2) {
                ans--;
                break;
            }
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 3268
#include <iostream>

using namespace std;

int main()
{
	int n;

	while (true)
	{
		cin >> n;

		if (n == -1) { break; }

		if (n == 0)
		{
			cout << "0" << endl;
		}
		else
		{
			int t = (1 << 20);

			for (int i = 0; i < 10; i++)
			{
				t /= 4;

				if (n / t)
				{
					cout << (n / t) % 4;
				}
			}

			cout << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 3004