akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
#define PI 3.14159265359
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define SIZE_OF_ARRAY(array) (sizeof(array) / sizeof(array[0]))

int main() {
  int X;
  cin >> X;

  if (X == 3 || X == 5 || X == 7)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int h = Integer.parseInt(sc.next());
        int w = Integer.parseInt(sc.next());
        String[][] table = new String[h][w];
        for (int i = 0; i < h; i++) {
            String[] line = sc.next().split("");
            for (int j = 0; j < w; j++) {
                table[i][j] = line[j];
            }
        }
        String rowBreakLine = makeBrankLine(w);
        String columnBreakLine = makeBrankLine(h);
        
        List<Integer> brankRowNums = new ArrayList<>();
        for (int i = 0; i < h; i++) {
            StringBuilder sb = new StringBuilder();
            for (int j = 0; j < w; j++) {
                sb.append(table[i][j]);
            }
            if (rowBreakLine.equals(sb.toString())) {
                brankRowNums.add(new Integer(i));
            }
        }
        
        List<Integer> brankColumnNums = new ArrayList<>();
        for (int j = 0; j < w; j++) {
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < h; i++) {
                sb.append(table[i][j]);
            }
            if (columnBreakLine.equals(sb.toString())) {
                brankColumnNums.add(new Integer(j));
            }
        }
        
        for (int i = 0; i < h; i++) {
            StringBuilder sb = new StringBuilder();
            for (int j = 0; j < w; j++) {
                if (!isSkip(j, brankColumnNums)) {
                    sb.append(table[i][j]);
                } 
            }
            if (!isSkip(i, brankRowNums)) {
                System.out.println(sb.toString());
            }    
        }
    }

    private static String makeBrankLine(int max) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < max; i++) {
            sb.append(".");
        }
        return sb.toString();
    }

    private static boolean isSkip(int num, List<Integer> skipNums) {
        for (Integer i : skipNums) {
            if (num == Integer.valueOf(i)) {
                return true;
            }
        }
        return false;
    }
}

Measured memory_bytes: 27544
using System;
using static System.Console;
using System.Collections.Generic;

namespace abc174
{
    class Program
    {
        static void Main()
        {
            var k = int.Parse(ReadLine());
            var set = new HashSet<int>();
            var num = 7;
            var count = 1;
            while (true)
            {
                num = num % k;
                if (num == 0)
                {
                    WriteLine(count);
                    return;
                }
                if (set.Contains(num))
                {
                    WriteLine(-1);
                    return;
                }
                set.Add(num);
                num = num * 10 + 7;
                ++count;
            }
        }
    }
}


Measured memory_bytes: 60508
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  int x=abs(a-c);
  int y=abs(a-b);
  int z=abs(b-c);
    if(x<=d)
  {
    cout<<"Yes"<<endl;
  }else{

  if(y<=d && z<=d)
  {
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }

  }
  return 0;
}


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

const int maxn = 2050;
bitset<maxn * maxn> f;

int main () {
    int n, su = 0;
    scanf("%d", &n); f[0] = 1;
    for (int i = 1; i <= n; ++i) {
        int x; scanf("%d", &x); su += x; f |= (f << x);
    }
    for (int i = su / 2; i >= 0; --i) if (f[i]) return printf("%d\n", su - i), 0;
}


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

using LL = long long;
using LD = long double;
 
LL mod = 1e9+7;

int main()
{
	string s;
	cin >> s;
	LL p= 0;
	for (auto e : s) {
		if (e == '7') {
			p = 1;
		}
	}

	if (p) {
		cout << "Yes\n";
	}
	else {
		cout << "No\n";
	}


}

Measured memory_bytes: 3620
# coding=UTF-8
from collections import deque
from operator import itemgetter
from bisect import bisect_left, bisect
import itertools
import sys
import math
sys.setrecursionlimit(10**6)
input = sys.stdin.readline
# 文字列には注意


def main():
    n = int(input())
    buka = [0] * n
    a = [int(x) for x in input().split()]
    for i in range(n-1):
        buka[a[i] - 1] += 1
    for i in range(n):
        print(buka[i])


if __name__ == '__main__':
    main()


Measured memory_bytes: 35036
#include  "bits/stdc++.h"
using namespace std;
 
#define IOS         ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
#define mem(a,v)    memset((a), (v), sizeof (a))
#define mp(a , b)   make_pair(a , b)
#define eb(a)       emplace_back(a)
#define anal         '\n'
#define mod 1000000007

typedef long long ll;



int main(){
     
 IOS;


 // # #-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
   
    int n;
    cin >> n;
    int x = n % 10;
    if(x == 2 || x == 4 || x == 5 || x == 7 || x == 9){
    	cout << "hon";
    }
    else if(x == 3){
    	cout << "bon";
    }
    else{
    	cout << "pon";
    }
       
    
return  0 ;      
}        





Measured memory_bytes: 3608
#include<bits/stdc++.h>
typedef  long long int ll;
typedef  long double ld;
#define sync ios_base::sync_with_stdio(false); cin.tie(NULL) 
#define input(arr,n) for(ll i1=0;i1<n;i1++ )cin>>arr[i1]
#define  pb(x) push_back(x)
#define si(a) scanf("%lld",&a)
#define pi(a) printf("%lld",a)
#define mod 1000000007
#define f first
#define s second 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
//recursions\
#pragma comment(linker, "/stack:200000000")
//loops\
#pragma GCC optimize("unroll-loops")
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,greater_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>//s.order_of_key(val) *s.find_by_order(ind)
using namespace std;
int main()
{
	sync;
	ll a,b;
	cin>>a>>b;
	cout<<max(a+b,max(a-b,a*b));
	}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
  
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
#include <string>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <unordered_set>
#include <list>
#include <tuple>
#include <iomanip>
#include <climits>
#include <cstdlib>
#include <cassert>
#include <numeric>
#include <cmath>
#include <bitset>
#include <random>
#include <regex>

using namespace std;
  
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define Fixed fixed << setprecision(14)
#define int int64_t
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9+7; 
constexpr int mod2 = 998244353;
constexpr int dy[] = {0,1,0,-1,1,-1,-1,1};
constexpr int dx[] = {1,0,-1,0,1,1,-1,-1};
 
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class A, class B> inline A updiv(const A a,const B b){ return (a + b - 1) / b; }
template <class A, class B> inline A gcd(const A a,const B b){ return b ? gcd(b,a % b) : a; }
template <class A, class B> inline A lcm(const A a,const B b){ return a / gcd(a,b) * b; }

template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class A,class B> using umap = unordered_map<A,B>;


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

    int n, k;
    cin >> n >> k;

    cout << min(n % k, k - n % k) << '\n';

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int a,b,c,d,e,ave;
	scanf("%d",&a);
	scanf("%d",&b);
	scanf("%d",&c);
	scanf("%d",&d);
	scanf("%d",&e);
        if(a<40){
		a=40;
	}
	if(b<40){
		b=40;
	}
	if(c<40){
		c=40;
	}
	if(d<40){
		d=40;
	}
	if(e<40){
		e=40;
	}
	ave=(a+b+c+d+e)/5;
	printf("%d\n",ave);
	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
//make_tuple emplace_back next_permutation push_back make_pair second first setprecision

#if MYDEBUG
#include "lib/cp_debug.h"
#else
#define DBG(...) ;
#endif

using LL = long long;
constexpr LL LINF=334ll<<53;
constexpr int INF=15<<26;
constexpr LL  MOD=1E9+7;

struct Problem{
    LL n,m;
    vector<LL> fac;
    Problem(LL n,LL m):n(n),m(m),fac(1e5+1){};

    void solve(){
        fac[0]=1;
        for(int i=1; i<=1e5; ++i){
            fac[i]=fac[i-1]*i%MOD;
        }
        if(abs(n-m)>1)cout << 0 <<"\n";
        else if (n==m)cout << fac[n]*fac[m]*2%MOD <<"\n";
        else cout << fac[n]*fac[m]%MOD <<"\n";
    }
};

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    long long n=0,m;
    cin >> n >> m;
    Problem p(n,m);
    p.solve();
    return 0;
}



Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#define ll long long
using namespace std;

int main() {
  ll N;
  cin >> N;
  std::vector<ll> vec(3*N-1);
  ll a,i = 0;
  while(cin >> a) {
    vec[i] = a;
    i++;
  }
  std::vector<ll> A(N),B(N),C(N-1);
  for (ll j = 0; j < N; ++j) {
    A[j] = vec[j];
    B[j] = vec[N+j];
    if (j < N-1) C[j] = vec[2*N+j];
  }
  ll retval = 0;
  for (ll l = 0; l < N; ++l) {
    retval += B[A[l]-1];
    if (l+1 < N && A[l+1] - A[l] == 1) retval += C[A[l]-1];
  }
  cout << retval << endl;
}

Measured memory_bytes: 256
A,B,C,D=map(int,input().split())
def gcd(a,b):
  while b!=0:
    a,b=b,a%b
  return a

 #最小公倍数
def lcm(a,b):
  return a*b//gcd(a,b)
a=lcm(C,D)
ans=B-A+1-(-((A-1)//(C))+B//(C)-((A-1)//(D))+B//(D)-(B//(a))+(A-1)//(a))
print(ans)


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

int main() {
    int N;
    cin>>N;
    vector<pair<long, long> > dishes(N);
    long tmpa, tmpb;
    for(int i=0;i<N;++i){
        cin>>tmpa>>tmpb;
        dishes[i] = make_pair(tmpa+tmpb, tmpa);
    }
    sort(dishes.begin(), dishes.end());
    long a=0;
    long b=0;
    for(int i=0;i<N;++i){
        if(i%2==0) a += dishes[N-i-1].second;
        else b += dishes[N-i-1].first - dishes[N-i-1].second;
    }
    cout<<a-b<<endl;
}


Measured memory_bytes: 1792
#include<stdio.h>

int main(){
	int a[100][100];
	int b[100][100];
	long int c[100][100]={0};
	int n,m,l;
	int i,j,k;
	
	scanf("%d %d %d",&n,&m,&l);
	
	   //??????A?????\???  n*m
	for(i=0;i<n;i++){
		for(j=0;j<m;j++){
			scanf("%d",&a[i][j]);
		}
	}
	   //??????B?????\???  m*l
	for(j=0;j<m;j++){
		for(k=0;k<l;k++){
			scanf("%d",&b[j][k]);
		}
	}
	
	   //?????? C   n*l
	for(i=0;i<n;i++){
		for(k=0;k<l;k++){
			for(j=1;j<=m;j++){
				c[i][k]+=(a[i][j-1]*b[j-1][k]);
			}
		}
	}
	
	for(i=0;i<n;i++){
		for(k=0;k<l;k++){
			printf("%ld",c[i][k]);
			if(k!=l-1)   printf(" ");
		}
		printf("\n");
	}
	
	return 0;
}

Measured memory_bytes: 768
//#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

// ??¨??????????????????????????????
vector<int> sieve_of_eratosthenes(int n)
{
    vector<int> primes(n);
    for (int i=2; i<n; ++i)
        primes[i] = i;
    for (int i=2; i*i<n; ++i)
        if (primes[i])
            for (int j=i*i; j<n; j+=i)
                primes[j] = 0;

    primes.erase(remove(primes.begin(), primes.end(), 0), primes.end());
    return primes;
}


int main()
{
    int a, d, n;
    while(cin>>a>>d>>n, a) {
        vi primes = sieve_of_eratosthenes(999999);
        int c = 0;
        for(int i=a;;i+=d) {
            auto it = lower_bound(ALL(primes),i);
            if(it!=primes.end()&&*it==i) {
                c++;
                if(c==n) {
                    cout << *it << endl;
                    break;
                }
            }
        }
    }
    return 0;
}

Measured memory_bytes: 6908
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define pb push_back
#define xx first
#define yy second
#define sz(x) ((int)x.size())
#define all(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define repp(i,k,n) for(int i=k;i<n;i++)
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> iv;
typedef pair<int,int> iip;
typedef map<int,int> mii;
template <typename T>
void dbg(T t){cerr<<t<<endl ;}
template<typename T, typename... Args>
void dbg(T t, Args... args) {cerr << t <<" ";dbg(args...) ;}

int t[]={0,0,1,1,2,2,3,3,4};
int main()
{   ios::sync_with_stdio(0);cin.tie(0);
    int n,a;
    int odd = 0;
    cin >> n; 
    rep(i,n){
        cin >> a;
        odd += (a&1); 
    }
    ll ans = 1 ,ans2 =1 ;
    rep(i,n){
        ans *=3; 
    }
    rep(i,n - odd){
        ans2 *=2;
    }
    cout<<ans  - ans2<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ALL(x) x.begin(), x.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
using ll = long long;
using lld = long double;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
using PII = pair<int, int>;
random_device rnd;
mt19937 mt(rnd());

const int IINF = 1 << 30;
const ll INF = 1ll << 60;
const ll MOD = 1e9 + 7;
vector<PII> h;
map<int, int> h2;
map<int, vector<int>> g;
map<int, bool> used;
bool check(ll x, ll a, ll b)
{
    return (a * a * a * a * a) - (b * b * b * b * b) == x;
}
int main()
{
    ll x;
    cin >> x;
    rep(i, -200, 200)
    {
        rep(j, -200, 200)
        {
            if (check(x, i, j))
            {
                cout << i << " " << j << endl;
                return 0;
            }
        }
    }
    return 0;
}

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

int main() {
    string s;
    while(cin>>s, s!="0") {
        if(s.length() == 1) {
            cout<<"0"<<endl;
            continue;
        }
        
        int tr = 0;
        vector<vector<int> > rr(11, vector<int>(0));
        rr[0].push_back(0);
        for(int i=1; i<=s.length(); ++i) {
            tr += (s[i-1] - '0')*(i%2 ? 1 : -1) + 11;
            tr %= 11;
            rr[tr].push_back(i);
        }

        int ans = 0;
        for(int i=0; i<11; ++i) {
            for(int j=0; j<rr[i].size(); ++j) {
                if(j == s.length()) continue;
                if(s[rr[i][j]] == '0') continue;
                ans += rr[i].size()-j-1;
            }
        }

        cout<<ans<<endl;
    }
}

Measured memory_bytes: 1488
//Contribted By - Rahul Roy
import java.util.*;
import java.lang.*;
import java.io.*;

class Main {
	
	static long M = (long)1e9+7;
	public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
	public static void main(String sp[])throws IOException{
		FastReader sc = new FastReader();
		long h = sc.nextLong();
		long n = sc.nextLong();
		long sum =0 ;
		for(int i=0;i<n;i++)
			sum += sc.nextLong();
		if(h-sum<=0)
			System.out.println("Yes");
		else System.out.println("No");
	}
	
	public static class pair{
		int x =0;
		int y=0;
	}
	
	public static class comp implements Comparator<pair>{
		public int compare(pair o1, pair o2){
			if(o1.x==o2.x)
				return o1.y-o2.y;
			return o1.x-o2.x;
		}
	}

	
	
	
	
		
		
	public static class FastReader {
		BufferedReader br;
		StringTokenizer st;


		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (Exception r) {
					r.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());//converts string to integer
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception r) {
				r.printStackTrace();
			}
			return str;
		}
	}
}
/* class Triplet{
	int threeSumClosest(ArrayList<Integer> arr, int target) {
        int flag=0,n = arr.size();
        int res=0;
        
        Collections.sort(arr);
		
        for(int i = 0 ; i < n-2 ; ++ i ) {  
            
            int j = i+1, k = n-1;
            
            while(j<k) {
                int sum=arr.get(i)+arr.get(j)+arr.get(k);   // get the sum of the triplet
                
                if(flag==0){  // if its your 1st triplet updated res
                    res=sum;
                    flag=1;
                }
                
                if(Math.abs(sum-target)<=Math.abs(res-target)) {   // compare the difference if sum is closer to target then res
                    if(Math.abs(sum-target)==Math.abs(res-target)){
                        if(res<sum)
                            res=sum;
                    }
                    else
                        res=sum;
                }
                
                if(target>sum)  // if sum is smaller than target
                    j++;
                else        // if sum is greater than target
                    k--;
            }
        }
        return res; // return the answer 
    }
} */

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

int main(){
  int N;
  cin >> N;
  vector<ll> A(N);

  ll ans = 1;
  for(int i = 0; i < A.size(); i++){
    cin >> A.at(i);
    
  }
  sort(A.begin(), A.end());
  for(int i = 0; i < A.size(); i++){
    if(A.at(i) == 0){
      ans = 0;
      break;
    }
    if(A.at(i) > 1000000000000000000/ans){
      ans = -1;
      break;
    }
    else{
      ans *= A.at(i);
    }   
  }

  cout << ans << endl;
}

Measured memory_bytes: 3992
#include <iostream>
#include <string>

int main()
{
	std::string A;
  	std::string B;
  	std::string C;
  	std::cin >> A >> B >> C;
  	int alice = 0;
  	int bob = 0;
  	int charlie = 0;
  	char last = 'a';
  	while(true)
    {
    	if(last == 'a')
        {
          	if(alice == A.size())
            {
            	std::cout << 'A';
              	return 0;
            }
          	last = A[alice];
          	++alice;
        }
      	else if(last == 'b')
        {
          	if(bob == B.size())
            {
            	std::cout << 'B';
              	return 0;
            }
        	last = B[bob];
          	++bob;
        }
      	else if(last == 'c')
        {
          	if(charlie == C.size())
            {
            	std::cout << 'C';
              	return 0;
            }
        	last = C[charlie];
          	++charlie;
        }
    }
  	return -1;
}

Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <cmath>
#include <tuple>
#include <bitset>
#include <utility>
#include <climits>
#include <iomanip>

#define push emplace_back
#define each(i, x) for (auto i=0; i < x; i++)
using ull = unsigned long long;
constexpr auto mod = 1000000007;
constexpr auto INF = ULLONG_MAX;

using namespace std;
template <typename T> inline void dump(const T& x) { cout << "[" << x << "]" << endl; }
template <typename T> inline void dump(const vector<T>& x) { for (const auto v : x) { cout << v << " "; } cout << endl; }
template <typename T> inline void sort_asc(vector<T>& x) { std::sort(x.begin(), x.end()); }
template <typename T> inline void sort_desc(vector<T>& x) { std::sort(x.begin(), x.end(), greater<T>()); }
template <typename T> inline T max_value(vector<T>& x) { return *max_element(x.begin(), x.end()); }
template <typename T> inline T min_value(vector<T>& x) { return *min_element(x.begin(), x.end()); }
template <typename T> inline T sum_value(vector<T>& x) { return accumulate(x.begin(), x.end(), 0ULL); }

int main() {
  int h, a;
  cin >> h >> a;

  int result = 0;
  while (h > 0) {
    h -= a;
    result++;
  }

  cout << result << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define MOD			1000000007
#define FOR(i,l,r)	for(int i=l;i<=r;i++)
#define REP(i,n)	for(int i=1;i<=n;i++)
#define REP0(i,n)	for(int i=0;i<n;i++)
#define PB			push_back
#define MP			make_pair
#define PII			pair<int,int>
#define VI			vector<int>
#define ALL(x)		(x).begin(),(x).end()
#define MAKE1(a)	int a;
#define MAKE2(a,b)	int a,b;
#define MAKE3(a,b,c) int a,b,c;
#define MAKE4(a,b,c,d) int a,b,c,d;
#define DR1(a)		MAKE1(a);cin>>a;
#define DR2(a,b)	MAKE2(a,b);cin>>a>>b;
#define DR3(a,b,c)	MAKE3(a,b,c);cin>>a>>b>>c;
#define DR4(a,b,c,d) MAKE4(a,b,c,d);cin>>a>>b>>c>>d;
#define int long long
signed main(){
	DR2(a,b);
	if((a+b)%2)	puts("IMPOSSIBLE");
	else		cout<<(a+b)/2<<endl;
	return 0;
}

Measured memory_bytes: 256
#define rep(i, a, b) for(int i = a; i < (int)(b); i++)
#include <bits/stdc++.h>

typedef long long ll;
using namespace std;
template<class T> inline void chmax(T &a, const T &b) {if(a < b) a = b;}
template<class T> inline void chmin(T &a, const T &b) {if(a > b) a = b;}
const long long INF = 1LL<<60;
const long long MOD = (ll)1e9+7;
const long long MAX = (ll)1e5+100;


int main(void) {
   ll N,K;
   cin>>N>>K;
   int a = N - K;
   if (K==1) cout<<0<<endl;
   else cout<<a<<endl;
   return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<set>
#include<tuple>
#include<cmath>


#define MOD 1000000007
#define INF 1001001001
#define MIN -1001001001
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back
#define PF push_front

typedef long long ll;

using namespace std;

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

int main(){
    int N;
    cin>>N;
    vector <int> s(N);
    rep(i,0,N)cin>>s[i];
    vector <int>dp(10001,0);
    dp[0]=1;
    rep(i,0,N){
        for(int j=10000;j>=0;j--){
            if(dp[j]>0)dp[j+s[i]]++;
        }
    }
    for(int i=10000;i>=0;i--){
        if(dp[i]>0){
            if(i%10 == 0){
                if(i != 0)continue;
            }
            cout<<i;
            break;
        }
    }
    return 0;
}

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

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

    string alphabet = "abcdefghijklmnopqrstuvwxyz";
    int start, end, cnt;
    bool find = false;
    for (int i = 0; i < 26; ++i) {

        start = -1;
        end = -1;
        cnt = 0;

        for (int j = 0; j < s.length(); ++j) {
            if (s[j] == alphabet[i]) {
                if (j < s.length() - 1 && s[j] == s[j + 1]) {
                    start = j + 1;
                    end = j + 2;
                    find = true;
                } else if (j < s.length() - 2 && s[j] == s[j + 2]) {
                    start = j + 1;
                    end = j + 3;
                    find = true;
                }
            }
        }

        if (find) break;
    }

    cout << start << ' ' << end << endl;
    return 0;
}

Measured memory_bytes: 512
using System;

namespace ABC129
{
    class A
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');

            int[] n = new int[input.Length];
            for (int i = 0; i < input.Length; i++)
            {
                n[i] = int.Parse(input[i]);
            }

            Array.Sort(n);

            Console.WriteLine(n[0] + n[1]);
        }
    }
}


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

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

    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    int cnt[n]={};
    for(int i=0;i<n;i++){
        if(a[i]==0){
            int res=1e9;
            int l=i-1;
            while(l>=0){
                if(a[l]==0) break;
                if(a[l]<0) res = min(res,-a[l]);
                if(a[l]>0){
                    cnt[l]=max(cnt[l],min(a[l],res));
                }
                res--;
                l--;
                
            }
            l=i+1,res=1e9;
            while(l<n){

                if(a[l]==0) break;
                if(a[l]<0) res = min(res,-a[l]);
                if(a[l]>0){
                    cnt[l]=max(cnt[l],min(a[l],res));
                }
                res--;
                l++;
            }
        }
    }
    int ans=0;
    for(int i=0;i<n;i++) ans+=cnt[i];
    cout<<ans<<endl;
    
}


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

using S = array<long long, 3>;
using F = bool;

S op(S a, S b){ return S{a[0] + b[0], a[1] + b[1], a[2] + b[2] + a[1] * b[0]};}
S e(){ return S{0, 0, 0};}
S mapping(F f, S x){ return f? x : S{x[1], x[0], x[0] * x[1] - x[2]};}
F composition(F f, F g){ return f == g;}
F id(){ return true;}

int main()
{
    int N, Q;
    cin >> N >> Q;
    vector<S> A(N, e());
    int Ai;
    for(int i=0;i<N;i++){
        cin >> Ai;
        if     (Ai == 0) A[i][0]++;
        else if(Ai == 1) A[i][1]++;
        else{ abort();}
    }
    lazy_segtree<S, op, e, F, mapping, composition, id> seg(A);

    int t, l, r;
    vector<long long> res;
    for(int i=0;i<Q;i++){
        cin >> t >> l >> r;
        l--;
        if(t == 1){
            seg.apply(l, r, false);
        }else if(t == 2){
            res.push_back(seg.prod(l, r)[2]);
        }else{ abort();}
    }
    for(auto v : res) cout << v << endl;

    return 0;
}

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


int main(){

    int N;
    cin >> N;

    //vector<int> A(N,0);
    int id;
    vector<int> buka(N+1,0);

    for(int i=1;i<N;i++){
        //cin >> A[i];
        cin >> id;
        buka[id]++;
    }

    

    for(int i=1;i<=N;i++){
        cout << buka[i] << endl;    
    }

    return 0;
}


Measured memory_bytes: 4052
m=input();n=int(m);s=n**.5;a=[];i=6
while n%2==0:a+=[2];n//=2
while n%3==0:a+=[3];n//=3
while i<s:
 if n%(i-1)==0:a+=[i-1];n//=i-1
 elif n%(i+1)==0:a+=[i+1];n//=i+1
 else:i+=6
if n>1:a+=[n]
elif n==int(m):a+=[m]
print(m+':',*a)


Measured memory_bytes: 5636
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const [A, B] = input[0].map(Number);

  if (A === B) {
    return "Draw";
  } else if ((A > B && B !== 1) || A === 1) {
    return "Alice";
  } else {
    return "Bob";
  }
};

console.log(main(read()));


Measured memory_bytes: 29556
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>

using namespace std;


int main()
{
	string str[100],str2[200000],strmemo="";
	long long int n, m, a, b, c, now[200][200] = {},x[200006],y[200006],X=0,Y=0;
	const long long int mod = 1000000007;
	cin >> n >>m;
	
	cout <<n-m+1<< endl;
}

Measured memory_bytes: 1792
# include <iostream>
# include <vector>
# include <cstdio>
using namespace std;
struct info
{
	int st;
	int ed;
	bool vis = false;
};
int Time = 1;
vector<int> a[105];
info *ans;
void dfs(int i)
{
	ans[i].st = Time++;
	ans[i].vis = true;
	for(int j = 0;j < a[i].size();j++) if(!ans[a[i][j]].vis) dfs(a[i][j]);
	ans[i].ed = Time++;
}
int main(void)
{
	int n,cnt,k,u;
	scanf("%d",&n);
	ans = new info [n+1];
	for(int w = 0;w < n;w++)
	{
		scanf("%d %d",&u,&cnt);
		for(int i = 0;i < cnt;i++)
		{
			scanf("%d",&k);
			a[u].push_back(k);
		}
	}
	for(int i = 1;i <= n;i++) if(!ans[i].vis) dfs(i);
	for(int i = 1;i <= n;i++) printf("%d %d %d\n",i,ans[i].st,ans[i].ed);
	return 0;
}


Measured memory_bytes: 3268
H, W, A, B = [int(_) for _ in input().split()]
mod = 10**9 + 7

X = [i for i in range(H + W + 1)]
X[0] = 1
for i in range(2, H + W + 1):
    X[i] = X[i - 1] * i % mod

Y = X.copy()
Y[-1] = pow(Y[-1], mod - 2, mod)
for i in range(H + W, 1, -1):
    Y[i - 1] = i * Y[i] % mod


def comb(x, y):
    return X[x] * Y[y] * Y[x - y] % mod


ans = 0
for i in range(B, min(B + H - A, W)):
    ans += comb(H - A + B - 1, i) * comb(W + A - B - 1, W - i - 1)
    ans %= mod
print(ans)

# http://arc058.contest.atcoder.jp/data/arc/058/editorial.pdf


Measured memory_bytes: 18968
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;

namespace atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var lrd = Console.ReadLine().Split(' ').Select(num => int.Parse(num)).ToArray();
            var d = lrd[2];
            var result = 0;
            for (var i = lrd[0]; i <= lrd[1]; i++)
            {
                if (i % d == 0) result++;
            }
            Console.WriteLine(result);
        }
    }
}

Measured memory_bytes: 28228
<?php
	$str = trim( fgets( STDIN ) );
	$n = strlen( $str );
	$output = array();
	for( $i=0; $i<$n; $i++ ) {
		if( 'a' <= $str[$i] && $str[$i] <= 'z' ) {
			array_push( $output, strtoupper( $str[$i] ) );
		} else if( 'A' <= $str[$i] && $str[$i] <= 'Z' ) {
			array_push( $output, strtolower( $str[$i] ) );
		} else {
			array_push( $output, $str[$i] );
		}
	}
	print implode( '', $output );
?>

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

using namespace std;

int main()
{
	int A, B, C, D;
	cin >> A >> B >> C >> D;
	int m1 = max(A, C);
	int m2 = min(B,D);
	if (m1 >= m2) cout << "0" << endl;
	else cout << (m2 - m1) << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int n,c[10]={0},i,a,j;
	while(1){
		scanf("%d",&n);
		if(n==0){
		break;
		}
		for(i=1;i<=n;i++)
		{
			scanf("%d",&a);
			c[a]++;
		}
		for(i=0;i<10;i++)
		{
			if(c[i]>0){
			for(j=1;j<=c[i];j++){
			printf("*");
			}
		}
			else{
				printf("-");
			}
			printf("\n");
		}
		for(i=0;i<10;i++)
		{
			c[i]=0;
		}
	}
return 0;
}


Measured memory_bytes: 2036
use std::io;

fn main() {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).expect("");
    let n:u32 = buf.trim().parse().ok().unwrap();
    let mut c0 = 0_u32;
    let mut c1 = 0_u32;
    let mut c2 = 0_u32;
    let mut c3 = 0_u32;
    for i in 0..n {
        let mut buf = String::new();
        io::stdin().read_line(&mut buf).expect("");
        let s = buf.trim();
        if s == "AC" {
            c0 += 1;
        } else if s == "WA" {
            c1 += 1;
        } else if s == "TLE" {
            c2 += 1;
        } else if s == "RE" {
            c3 += 1;
        }
    }
    println!("AC x {}", c0);
    println!("WA x {}", c1);
    println!("TLE x {}", c2);
    println!("RE x {}", c3);
}

Measured memory_bytes: 2136
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define pow(x,y) modpow(x,y)
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

template <class T = int>T in(){
    T x;
    cin >> x;
    return (x);
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    int X = in(),Y = in(),A = in(),B = in(),C = in();
    vector<ll> p(A);
    vector<ll> q(B);
    vector<ll> r(C);
    REP(i,A)p[i] = in<ll>();
    REP(i,B)q[i] = in<ll>();
    REP(i,C)r[i] = in<ll>();
    sort(ALL(p),greater<>());
    sort(ALL(q),greater<>());
    sort(ALL(r),greater<>());
    int ps = X-1;
    int qs = Y-1;
    int rs = 0;
    while(1){
        if(rs >= C)break;
        if(ps == -1 || qs == -1){
            if(qs != -1){
                if(q[qs] < r[rs]){
                    q[qs] = r[rs];
                    rs++;
                    qs--;
                }else{
                    break;
                }
            }else if(ps != -1){
            if(p[ps] < r[rs]){
                p[ps] = r[rs];
                rs++;
                ps--;
            }else{
                break;
            }
            }else{
                break;
            }
        }else{
        if(p[ps] > q[qs]){
            if(q[qs] < r[rs]){
                q[qs] = r[rs];
                rs++;
                qs--;
            }else{
                break;
            }
        }else{
            if(p[ps] < r[rs]){
                p[ps] = r[rs];
                rs++;
                ps--;
            }else{
                break;
            }
        }
        }
    }
    ll answer = 0;
    REP(i,X)answer += p[i];
    REP(i,Y)answer += q[i];
    cout << answer << "\n";
}

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

int main() {
  vector<int> vec(3);
  cin>>vec.at(0)>>vec.at(1)>>vec.at(2);
  if(vec.at(0)==7) {
    if(vec.at(1)==5&&vec.at(2)==5) {
      cout<<"YES"<<endl;
    }
    else cout<<"NO"<<endl;
  }
  else if(vec.at(1)==7) {
    if(vec.at(0)==5&&vec.at(2)==5) {
      cout<<"YES"<<endl;
    }
    else cout<<"NO"<<endl;
  }
  else if(vec.at(2)==7) {
    if(vec.at(1)==5&&vec.at(0)==5) {
      cout<<"YES"<<endl;
    }
    else cout<<"NO"<<endl;
  }
  else {
    cout<<"NO"<<endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <array>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>
#include <random>

using namespace std;
using lli = long long int;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0)
{ v = vector<T>(n+o); for (lli i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (lli i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

lli n, l;
lli a[100001];
int main() {
  cin >> n >> l; read_n(a, n);

  lli i=1;
  for (; i<n; ++i) {
    if (a[i-1] + a[i] >= l) break;
  }
  cerr << i << endl;

  if (i == n) {
    cout << "Impossible\n";
  } else {
    cout << "Possible\n";
    for (lli j=1; j<i; ++j) cout << j << '\n';
    for (lli j=n-1; j>=i; --j) cout << j << '\n';
  }
  return 0;
}


Measured memory_bytes: 1536
import std.stdio;
import std.string;
import std.conv;
import std.array;
import std.range;
import std.algorithm;



void main() {
    string input;

    while ((input = readln.chomp).length != 0) {
        int[] tehai = new int[](9);
        int[] yama = new int[](9);
        int[] ans;

        fill(yama, 4);
        foreach (i; 0..13) {
            int index = (input[i] - '0').to!int;
            tehai[index-1]++;
            yama[index-1]--;
        }

        ans = agari(tehai, yama);
        if (ans.length == 0) {
            writeln(0);
        } else {
            writeln(ans.map!(to!string).join(" "));
        }
    }
}

/*
 * 何を自摸れば、上がれるかを判定する。
 * 上がることのできる牌を見つけたら、それをすべて配列に格納して返す。
 * 上がることができなければ、空の配列が返される。
 */
int[] agari(int[] tehai, int[] yama) {
    int[] ans;

    foreach (i; 0..tehai.length) {
        if (yama[i] == 0) continue;

        tehai[i]++;
        foreach (j; 0..tehai.length) {
            if (tehai[j] < 2) continue;

            tehai[j] -= 2;
            if (yaku(tehai, 0)) ans ~= (i + 1).to!int;
            tehai[j] += 2;
        }
        tehai[i]--;
    }

    return ans;
}

/*
 * 手持ちの牌で役が作れるかを判定する。
 * 順子、刻子の順番で試行し、組み合わせが４個できた時点で true を返し、組み合わせが４個できる前に順子、刻子ともに見つからなかったときは false を返す。
 */
bool yaku(int[] haipai, int num_yaku) {
    if (num_yaku >= 4) return true;

    int[] tehai;
    foreach (i; 0..haipai.length) {
        /* 順子が成立するかの判定 */
        if (i >= 2 && haipai[i - 2] > 0 && haipai[i - 1] > 0 && haipai[i] > 0) {
            tehai = haipai.dup;
            tehai[i - 2]--;
            tehai[i - 1]--;
            tehai[i]--;
            return yaku(tehai, ++num_yaku);
        }

        /* 刻子が成立するかの判定 */
        if (haipai[i] >= 3) {
            tehai = haipai.dup;
            tehai[i] -= 3;
            return yaku(tehai, ++num_yaku);
        }
    }

    return false;
}

Measured memory_bytes: 1088
#include <stdio.h>
#include <math.h>
#define MAX(a,b) a>b?a:b
int main()
{
	int a,h,m,s;
	scanf("%d",&a);
	h = a/3600;a%=3600;
	m = a/60;a%=60;
	s = a;
	printf("%d:%d:%d\n",h,m,s);
	
	return 0;
}

Measured memory_bytes: 592
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;
import java.util.Collections;
import java.util.ArrayList;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        MonstersBattleRoyale solver = new MonstersBattleRoyale();
        solver.solve(1, in, out);
        out.close();
    }

    static class MonstersBattleRoyale {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();

            ArrayList<Integer> list = new ArrayList<>();
            for (int i = 0; i < n; i++) {
                list.add(in.nextInt());

            }

            while (list.size() != 1) {
                Collections.sort(list);
                ArrayList<Integer> tmp = new ArrayList<>();
                tmp.add(list.get(0));
                for (int i = 1; i < list.size(); i++) {
                    Integer min = list.get(0);
                    if (list.get(i) % min == 0) {
                    } else {
                        tmp.add(list.get(i) % min);
                    }
                }
                list = tmp;
            }
            out.println(list.get(0));
        }

    }
}



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

class DLinkedList{

private:
	struct node{
		int key;
		node *prev;
		node *next;
	};
	node* dummy;

public:
	DLinkedList();
	virtual ~DLinkedList();

	node* listSearch(int key);
	void printList();
	void deleteNode(node *t);
	void deleteFirst();
	void deleteLast();
	void deleteKey(int key);
	void insertKey(int key);

};

DLinkedList::DLinkedList(){
	dummy = new node;
	dummy->next = dummy;
	dummy->prev = dummy;
}

DLinkedList::~DLinkedList(){
	node* i = dummy->next;
	while(1){
		if (i == dummy) break;
		i = i->next;
		delete i->prev;
	}
	delete dummy;
}

void DLinkedList::insertKey(int key){
	node* x = new node;
	x->key = key;
	x->prev = dummy;
	x->next = dummy->next;
	x->next->prev = x;
	dummy->next = x;
}

void DLinkedList::deleteNode(node *t){
	if (t == dummy) return;
	t->prev->next = t->next;
	t->next->prev = t->prev;
	delete t;
}

DLinkedList::node* DLinkedList::listSearch(int key){
	for (node* i = dummy->next; i != dummy; i = i->next){
		if (key == i->key) return i;
	}
	return dummy;
}

void DLinkedList::deleteKey(int key){
	deleteNode(listSearch(key));
}

void DLinkedList::deleteFirst(){
	deleteNode(dummy->next);
}

void DLinkedList::deleteLast(){
	deleteNode(dummy->prev);
}

void DLinkedList::printList(){
	node* cur = dummy->next;
	int isf = 1;
	while (1){
		if (cur == dummy) break;
		if (isf == 0)  printf(" ");
		printf("%d", cur->key);
		cur = cur->next;
		isf = 0;
	}
	printf("\n");
}

int main(){
	int key, n, i;
	int size = 0;
	char com[20];
	int np = 0, nd = 0;
	scanf("%d", &n);
	{
		DLinkedList list;
		for (i = 0; i < n; i++){
			scanf("%s%d", com, &key);
			if (com[0] == 'i') { list.insertKey(key); np++; size++; }
			else if (com[0] == 'd') {
				if (strlen(com) > 6){
					if (com[6] == 'F') list.deleteFirst();
					else if (com[6] == 'L') list.deleteLast();
				}
				else {
					list.deleteKey(key); nd++;
				}
				size--;
			}
		}
	
		list.printList();
	}

	return 0;
}


Measured memory_bytes: 34472
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,ans=0;
	cin>>n;
	range(i,1,n+1){
		ll t=i,cnt=0;
		while(t){
			cnt++;
			t/=10;
		}
		if(cnt%2==1)ans++;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

bool can(string a, int b, string c, int d) {
  if(b == a.size() && d == c.size()) return true;
  if(c[d] == 'A' && can(a, b, c, d+1)) return true;
  if(b == a.size()) return false;
  if(a[b] != c[d]) return false;
  return can(a, b+1, c, d+1);
}

void solve() {
  string s;
  cin >> s;
  bool ret = can(s, 0, "AKIHABARA", 0);
  if(ret) cout << "YES\n";
  else cout << "NO\n";
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  /*
  int t;
  cin >> t;
  for(int i = 1; i <= t; i++) {
    cout << "Case #" << i << ": ";
    solve();
  }
  */
  solve();
}


Measured memory_bytes: 256
// Insertion Sort  挿入ソート

#include <stdio.h>

void insertionSort(int *A, int N) {
    int v, i, j, k;

    // 標準出力で表示する
    for(k = 0; k < N; k++) {
        printf("%d", A[k]);
        if(k == N - 1) // 最後の要素の後は空白ではなく改行
            printf("\n");
        else
            printf(" ");
    }

    // 挿入ソート
    for(i = 1; i < N; i++) {
        v = A[i];  // 移動対象の値
        j = i - 1; // 移動対象の今いるidxの左の値
        while(j >= 0 && A[j] > v) {
            A[j + 1] = A[j]; // 左の値を右にずらす
            j--;
        }
        A[j + 1] = v; //挿入先まできたら値を入れる

        // 標準出力で表示する
        for(k = 0; k < N; k++) {
            printf("%d", A[k]);
            if(k == N - 1) // 最後の要素の後は空白ではなく改行
                printf("\n");
            else
                printf(" ");
        }
    }
}

int main(int argc, char const *argv[]) {
    const int MAX = 100;
    int A[MAX];
    int N;
    scanf("%d", &N);

    for(int i = 0; i < N; i++)
        scanf("%d", &A[i]);

    insertionSort(A, N);

    return 0;
}



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

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

    int x, y;
    cin >> x >> y;

    const int r = y - 2 * x;
    const int c = x - r / 2;
    const bool ok = r >= 0 && (r % 2 == 0) && c >= 0;
    cout << (ok ? "Yes" : "No") << '\n';

    return 0;
}


Measured memory_bytes: 3632
#include<iostream>
#define INF 100000000
using namespace std;
/*int min(int a,int b){
  return a<b?a:b;
  }*/
int main(){
  int n,m;
  while(cin>>n>>m){
    if(n==0&&m==0) break;
    int d0[m+1][m+1],d1[m+1][m+1];
    for(int i=1;i<=m;i++){
      for(int j=1;j<=m;j++){
    d0[i][j] = INF;
    d1[i][j] = INF;
      }
    }
    int a,b,cost,time;
    for(int i=0;i<n;i++){
      cin >> a >> b >> cost >> time;
      d0[a][b] = cost;
      d0[b][a] = cost;
      d1[a][b] = time;
      d1[b][a] = time;
    }
    for(int i=1;i<=m;i++){
      for(int j=1;j<=m;j++){
    for(int k=1;k<=m;k++){
      d0[j][k] = min(d0[j][k],d0[j][i]+d0[i][k]);
      d1[j][k] = min(d1[j][k],d1[j][i]+d1[i][k]);
    }
      }
    }
    int s,p,q,r;
    cin >> s;
    for(int i=0;i<s;i++){
      cin >> p >> q >> r;
      if(p==q) cout << 0 << endl;
      else if(r==0) cout << d0[p][q] << endl;
      else cout << d1[p][q] << endl;
    }
  }
  return 0;
}

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

int main() {
	int k;
	cin>>k;
	queue<ll> lun;
	for(ll i=1;i<=9;i++)lun.push(i);
	rep(i,k-1){
		ll top=lun.front();
		lun.pop();
		if(top%10==0){
			lun.push(top*10);
			lun.push(top*10+1);
		}else if(top%10==9){
			lun.push(top*10+8);
			lun.push(top*10+9);
		}else{
			int a=top%10;
			lun.push(top*10+a-1);
			lun.push(top*10+a);
			lun.push(top*10+a+1);
		}
	}
	
	cout<<lun.front()<<endl;
	
}


Measured memory_bytes: 1792