akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <map>
#include <set>
#include <cstring>
#include <string>
#include <cctype>
#include <cassert>
#include <queue>

using namespace std;

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,b,e) for(int i = (b); i <= (e); i++)
#define INF (1001001001)
#define EPS (1e-15)

#define pr(x) do{cerr << (#x) << " = " << (x) << endl;}while(0)
#define pri(x,i) do{cerr << (#x) << "[" << i << "] = " << (x[i]) << endl;}while(0)
#define pra(x,n) rep(__i,n) pri(x,__i);
#define prar(x,b,e) repr(__i,b,e) pri(x,__i);

typedef long long ll;
typedef pair<int, int> pint;
typedef vector<int> vint;
typedef vector<pint> vpint;

ll MOD = 1000000007;

int in() {
	int a;
	scanf("%d ", &a);
	return a;
}

typedef long double ld;

struct L {
	int A, B, C;
	bool operator < (const L &other) const {
		return (ld)A / B < (ld)other.A / other.B;
	}
};

int hoge() {
	set<int> a;
	a.insert(3);
	a.insert(5);
	a.insert(9);
	cout << distance(a.begin(), a.lower_bound(90)) << endl;
	return 0;
}

int N;
vector<L> ls;

struct BIT {
	vint val;
	BIT() : val(66666, 0){}
	int get(int i) {
		int ret = 0;
		while (i) {
			ret += val[i];
			i -= i & -i;
		}
		return ret;
	}
	void add(int i) {
		while (i <= 65536) {
			val[i]++;
			i += i & -i;
		}
	}
};

ld solve() {
	sort(ls.begin(), ls.end());
	ld left = -INF * (ll)4, right = INF * (ll)4;
	rep(t,100) {
		ld X = (left + right) / 2;
		vector<pair<ld, int> > ys(N);
		ll count = 0;
		rep(i,N) {
			ld Y = -(ld)ls[i].A / ls[i].B * X + (ld)ls[i].C / ls[i].B;
			//count += distance(ys.lower_bound(Y), ys.end());
			ys[i].first = Y;
			ys[i].second = i;
		}
		sort(ys.begin(), ys.end());
		BIT b;
		rep(i,N) {
			count += i - b.get(ys[i].second + 1);
			b.add(ys[i].second + 1);
		}
		if (count >= (N * (N - 1) / 2 + 1) / 2) {
			right = X;
		}
		else {
			left = X;
		}
	}
	return left;
}

int main() {
	N = in();
	ls.resize(N);
	rep(i,N) {
		ls[i].A = in();
		ls[i].B = in();
		ls[i].C = in();
	}
	
	printf("%.15Lf ", solve());
	rep(i,N) {
		int hoge = ls[i].A;
		ls[i].A = ls[i].B;
		ls[i].B = hoge;
	}
	
	printf("%.15Lf\n", solve());
	return 0;
}


Measured memory_bytes: 2196
h,w=map(int,input().split())
ans=h*w
for i in range(1,h):
  a=w*i
  bb=w//2
  cc=(w-1)//2+1
  b=(h-i)*bb
  c=(h-i)*cc
  ans=min(ans,max(a,b,c)-min(a,b,c))
  bb=(h-i)//2
  cc=((h-i)-1)//2+1
  b=w*bb
  c=w*cc
  ans=min(ans,max(a,b,c)-min(a,b,c))
for i in range(1,w):
  a=h*i
  bb=h//2
  cc=(h-1)//2+1
  b=(w-i)*bb
  c=(w-i)*cc
  ans=min(ans,max(a,b,c)-min(a,b,c))
  bb=(w-i)//2
  cc=((w-i)-1)//2+1
  b=h*bb
  c=h*cc
  ans=min(ans,max(a,b,c)-min(a,b,c))
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)n; i++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007//1e9+7
typedef long long ll;
using namespace std;
int main()
{
  ll a;
  cin >> a;
  if(a %2 == 0){
    cout << a << endl;
  }else{
    cout << a*2 << endl;
  }
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void doIt(){
		Scanner in = new Scanner(System.in);
		data pp[][] = new data[3][8];
		for(int i=0;i<3;i++){
			for(int s=0;s<8;s++){
				int ban=in.nextInt();
				double time=in.nextDouble();
				pp[i][s]=new data(ban,time);
			}
			Arrays.sort(pp[i]);
		}
		for(int i=0;i<3;i++){
			System.out.printf("%d %.2f\n",pp[i][0].code,pp[i][0].time);
			System.out.printf("%d %.2f\n",pp[i][1].code,pp[i][1].time);
		}
		data ans[]=new data[18];
		int cnt=0;
		for(int i=0;i<3;i++){
			for(int s=2;s<8;s++){
				ans[cnt]=pp[i][s];
				cnt++;
			}
		}
		Arrays.sort(ans);
		System.out.printf("%d %.2f\n",ans[0].code,ans[0].time);
		System.out.printf("%d %.2f\n",ans[1].code,ans[1].time);
	}
	public static void main(String[] args) {
		Main.doIt();
	}
	static class data implements Comparable<data>{
		int code;
		double time;
		data(int code,double time){
			this.code=code;
			this.time=time;
		}
		public int compareTo(data o) {
			return Double.compare(this.time,o.time);//これで比べられる。
		}
	}
}

Measured memory_bytes: 20268
import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
# from math import ceil, floor, log2
# from collections import deque
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np    # cumsum
# from bisect import bisect_left, bisect_right

def solve():
    a, b, c = MI()
    K = II()

    for i in range(K):
        if a >= b:
            b *= 2
        elif b >= c:
            c *= 2

    if a < b < c:
        print('Yes')
    else:
        print('No')





if __name__ == '__main__':
    solve()


Measured memory_bytes: 9236
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll a7=1000000007;
ll inf=100000000000000000;

ll min(ll a,ll b){
    if(a<b)return a;
    return b;
}
ll max(ll a,ll b){
    if(a>b)return a;
    return b;
}

int main(){
    ll n;cin>>n;
    vector<ll> a;
    a.push_back(1);
    ll k=1;
    while(k<=n){
        k=k*6;
        a.push_back(k);
    }
    k=1;
    while(k<=n){
        k=k*9;
        a.push_back(k);
    }
    sort(a.begin(),a.end());
    ll dp[a.size()][n+1];
    for(ll i=0;i<=n;i++){
        dp[0][i]=i;
    }
    for(ll i=1;i<=a.size()-1;i++){
        for(ll j=0;j<=n;j++){
            if(j-a[i]>=0){
                dp[i][j]=min(dp[i-1][j],dp[i][j-a[i]]+1);
            }else{
                dp[i][j]=dp[i-1][j];
            }
        }
    }
    cout<<dp[a.size()-1][n]<<endl;
    return 0;
}



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

int main() {
    ll N;
    cin >> N;
    set<ll> S;
    rep(i, N){
        ll tmp;
        cin >> tmp;
        S.insert(tmp);
    }
    if(S.size() == N) cout << "YES";
    else cout << "NO";
}


Measured memory_bytes: 9600
/*
  Author - KISHAN TIWARI
  Dream bigger. Do bigger.
  Wake up with determination. Go to bed with satisfaction.
*/
//Sometimes later becomes never. Do it now.
#include<bits/stdc++.h>
using namespace std;
#define ll           long long
#define f(i,a,b)     for(ll i=a;i<b;i++)
#define mod          1000000007
#define fi           first
#define se           second
#define pa           pair <ll,ll>
#define mp           make_pair
#define pb           push_back
#define ve           vector<ll>
#define vep          vector< pa >
#define all(a)       a.begin(), a.end()
#define sz(x)        (ll)x.size()
#define c(t)         cout<<t<<"\n"
using namespace std;
void solve()
{  ll n,x=0,a;
cin>>n;
a=n;
while(n>0)
{
    n=n/10;
    x++;
}
if(x==2)
    c(9);
else if(x==4)
    c(909);
else if(x==1)
{
    c(a);
}
else if(x==3)
{
    ll y=9+a-99;
    c(y);
}
else if(x==5)
{

    ll y=909+a-9999;
    c(y);
}
else if(x==6)
    c(90909);
}
int main()
{
    ios::sync_with_stdio(true);
   //freopen ("input.txt","r",stdin);
   //freopen ("output.txt","w",stdout);
    cin.tie(0);
    cout.tie(0);
    ll t=1;
    //cin>>t;
    while(t--)
    {

        solve();
    }
return 0;
}


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

using namespace std;

int main() {

    string s; cin >> s;
    for (int i = 1; i < int(s.size()); i++) {
        if (s[i] == s[i-1]) {
            cout << "Bad" << "\n";
            return 0;
        }       
    }
    cout << "Good" << "\n";
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
# define mod 1000000007
# define INF (1 << 29)
# define MAX_N 1000010
/* ちゃんと考えてわかって実装 */

ll kaisu(ll h){
    if(h == 1) return 1;
    else{
        return 2 * kaisu(h / 2) + 1;
    }
}

int main(void){
    ll h;
    cin >> h;
    cout << kaisu(h);
    return 0;
}

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

int main(){
    int h,w,d;
    cin >> h >> w >> d;
    int dp[90000];
    map<int,int> mx,my;
    for(int i = 0;i < h;i ++){
        for(int j = 0;j < w;j ++){
            int A;
            cin >> A;A --;
            mx[A] = i;
            my[A] = j;
        }
    }
    for(int i = 0;i < d;i ++){
        dp[i] = 0;
        for(int j = i+d;j < h*w;j += d){
            dp[j] = dp[j-d]+abs(mx[j]-mx[j-d])+abs(my[j]-my[j-d]);
        }
    }
    int q;
    cin >> q;
    for(int i = 0;i < q;i ++){
        int l,r;
        cin >> l >> r;
        l --;r --;
        cout << dp[r] - dp[l] << endl;
    }
    return 0;
}

Measured memory_bytes: 9856
#include<stdio.h>
#include<string.h>


typedef struct  {
    int first;
    int second;
    int third;
    int forth;
    int fifth;
    int sixth;
} Dice;

void NS(int *top, int *front, int *back, int *bottom, int a) {
    int tmp;
    if(a){
        // 南
        tmp = *top;
        *top = *front;
        *front = *bottom;
        *bottom = *back;
        *back = tmp;
    }else{
        // 北
        tmp = *top;
        *top = *back;
        *back = *bottom;
        *bottom = *front;
        *front = tmp;
    }
}

void EW(int *top, int *left, int *right, int *bottom, int a) {
    int tmp;
    if (a) {
        // 西
        tmp = *top;
        *top = *right;
        *right = *bottom;
        *bottom = *left;
        *left = tmp;
    }else{
        // 東
        tmp = *top;
        *top = *left;
        *left = *bottom;
        *bottom = *right;
        *right = tmp;
    }
}

int main() {
    Dice one;
    int i, l, com;
    char order[101];

    scanf("%d ", &one.first);
    scanf("%d ", &one.second);
    scanf("%d ", &one.third);
    scanf("%d ", &one.forth);
    scanf("%d ", &one.fifth);
    scanf("%d", &one.sixth);

    scanf("%s", order);

    l = strlen(order);

    for (i = 0; i < l; ++i) {
        switch(order[i]) {
            case 'N':
                com = 0;
                NS(&one.first, &one.fifth , &one.second, &one.sixth, com);
                break;
            case 'S':
                com = 1;
                NS(&one.first, &one.fifth , &one.second, &one.sixth, com);
                break;
            case 'E':
                com = 0;
                EW(&one.first, &one.forth , &one.third, &one.sixth, com);
                break;
            case 'W':
                com = 1;
                EW(&one.first, &one.forth , &one.third, &one.sixth, com);
                break;
        }
    }
    printf("%d\n", one.first);
    return 0;
}


Measured memory_bytes: 2108
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {

		Scanner scanner=new Scanner(System.in);
		long ans = 1;
		int N = scanner.nextInt();

		for(int i = 0 ; i < N ; i++) {
			long A = scanner.nextLong();
			if(A == 0) {
				ans = 0;
			} else {
				if(ans <= ((long)Math.pow(10, 18) / A) && ans >= 0) {
					ans = ans * A;
				}else {
					ans = -1;
				}
			}
		}

		System.out.println(ans);

		scanner.close();

	}

}


Measured memory_bytes: 59636
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
vector<int> dx = {-1, -1, -1, 0, 0, 1, 1, 1};
vector<int> dy = {-1, 0, 1, -1, 1, -1, 0, 1};

int main () {
    ll n; cin >> n;
    ll ans = 0;
    for (ll i = 1; i <= n; i++) {
        ll m = n/i;
        ans += i*m*(m+1)/2;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3656
N,M = map(int,input().split())
H = list(map(int,input().split()))
bad_flag = [0]*N
for i in range(M):
    a,b = map(int,input().split())
    if(H[a-1] > H[b-1]):
        bad_flag[b-1] = 1
    elif(H[a-1] < H[b-1]):
        bad_flag[a-1] = 1
    else:
        bad_flag[a-1] = 1
        bad_flag[b-1] = 1
print(bad_flag.count(0))

Measured memory_bytes: 19980
#include<iostream>
using namespace std;
 
int main(void){
	int i = 0;
 	string s;
	cin >> s;
  
  int N = s.size();
  int half = N / 2;
  int j = half - 1;
  while (j >= 0){
      if (s[j] != s[N-j-1]) i++;
      j--;
  }
  
    printf("%d",i);
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
typedef long long LL;
const int N=100005;
const int MOD=1e9+7;
int add (int x,int y)   {x=x+y;return x>=MOD?x-MOD:x;}
int mul (int x,int y)   {return (LL)x*y%MOD;}
int dec (int x,int y)   {x=x-y;return x<0?x+MOD:x;}
int Pow (int x,int y)
{
	if (y==0) return 1;
	if (y==1) return x;
	int lalal=Pow(x,y>>1);
	lalal=mul(lalal,lalal);
	if (y&1) lalal=mul(lalal,x);
	return lalal;
}
char ss[N];
int f[N];
int pos[N];
int pre[N][3];
int sum[N];
int suf[N][3];
int main()
{
	scanf("%s",ss+1);int n=strlen(ss+1);
	for (int u=1;u<=n;u++) sum[u]=(sum[u-1]+ss[u]-'a'+1)%3;
	pre[0][1]=pre[0][2]=1;pre[0][0]=-1;
	for (int u=1;u<=n;u++)
	{
		pre[u][0]=pre[u-1][0];
		pre[u][1]=pre[u-1][1];
		pre[u][2]=pre[u-1][2];
		pre[u][sum[u-1]]=u-1;
	}
	f[0]=1;
	for(int u=1;u<=n;u++) 
	{
		pos[u]=pos[u-1];
		if(ss[u]==ss[u-1]) pos[u]=u;
	}
	if (pos[n]==0)
	{
		printf("1\n");
		return 0;
	}
	f[0]=1;
	for(int u=1;u<=n;u++) 
	{
		int id=pos[u]-1;
		f[u]=f[u-1];
		int val=(ss[u]=='a')?2:1;
		if(~id) 
		{
		
			id=pre[id][(sum[u]-val+3)%3];
				//printf("YES!:%d\n",id);
			if(~id) f[u]=add(f[u],f[id]);
		}
		if(sum[u]==0&&u!=n) f[u]=add(f[u],1);
		
		//printf("%d %d %d\n",u,f[u],sum[u]);
	}
	printf("%d\n",f[n]);
	return 0;
}

Measured memory_bytes: 2688
#include <stdio.h>
#include <string.h>

int main(){
  int m,i,j,len,h;
  char a[201],tem[201];

  while(1){
    scanf("%s",a);
    len=strlen(a);
    if(!strcmp(a,"-")) break;

    scanf("%d",&m);
    for(i=0;i<m;i++){
      scanf("%d",&h);
      for(j=0;j<len;j++){
	tem[j]=a[j];
	a[j]=a[j+h];
      }
      tem[h]='\0';
      for(j=len-1;j>=len-h;j--) a[len-h+(len-j)-1]=tem[len-j-1];
    }
    printf("%s\n",a);
  }

  return 0;
}

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

// Optimization
//#pragma GCC optimize("O3")
#define endl '\n'

// Shortcut

#define int long long
#define eb emplace_back
#define pb push_back
#define pob pop_back
#define mp make_pair
#define upb upper_bound
#define lwb lower_bound
#define fi first
#define se second
#define For(i, l, r) for (int i = l; i < r; i++)
#define ForE(i, l, r) for (int i = l; i <= r; i++)
#define Ford(i, r, l) for (int i = r; i > l; i--)
#define FordE(i, r, l) for (int i = r; i >= l; i--)
#define Fora(i, a) for (auto i : a)

// I/O & Debug

#define PrintV(a) for (int iiii = 0; iiii < a.size(); iiii++) cout << a[iiii] << ' ';
#define PrintVl(a) for (int iiii = 0; iiii < a.size(); iiii++) cout << a[iiii] << endl;
#define PrintA(a, n) for (int iiii = 0; iiii < n; iiii++) cout << a[iiii] << ' ';
#define PrintAl(a, n) for (int iiii = 0; iiii < n; iiii++) cout << a[iiii] << endl;
#define Ptest(x) return cout << x, 0;
#define gl(s) getline(cin, s);
#define setpre(x) fixed << setprecision(x)
/*
#define debug(args...){ string _sDEB = #args; replace(_sDEB.begin(), _sDEB.end(), ',', ' '); stringstream _ssDEB(_sDEB); istream_iterator<string> _itDEB(_ssDEB); DEB(_itDEB, args); }
void DEB(istream_iterator<string> it) {}
template<typename T, typename... Args>
void DEB(istream_iterator<string> it, T a, Args... args){
    cout << *it << " = " << a << endl;
    DEB(++it, args...);
}
*/

// Functions

//#define isvowel(a) (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u')
#define bend(a) a.begin(), a.end()
#define rbend(a) a.rbegin(), a.rend()
#define mset(a) memset(a, 0, sizeof(a))
#define m1set(a) memset(a, 1, sizeof(a))
#define mn1set(a) memset(a, -1, sizeof(a))
#define mmset(a) memset(a, 0x3f, sizeof(a))
#define gcd __gcd
#define __builtin_popcount __builtin_popcountll
//mt19937 rando(chrono::steady_clock::now().time_since_epoch().count());

// Data Structure

#define pque priority_queue
#define mts multiset
#define y0 _y0_
#define y1 _y1_
#define div divi
typedef long long ll;
typedef long double ld;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <ld> vld;
typedef vector <string> vs;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <vi > vvi;
typedef vector <vll > vvll;
typedef vector <pii > vpii;
typedef vector <pll > vpll;

const int N = 3e5 + 5, mod = 1e9 + 7, mod1 = 998242353, mod2 = 1e9 + 9;
const ll inf = 1e18 + 7;

int n;

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin >> n;
    cout << n * (n - 1) / 2;
}

/*
==================================+
INPUT:                            |
------------------------------    |

------------------------------    |
==================================+
OUTPUT:                           |
------------------------------    |

------------------------------    |
==================================+
*/

Measured memory_bytes: 256
#include <cstdio>
typedef long long ll;

using namespace std;

int main(){
  ll c1 = 0;
  ll c2 = 0;
  int q; scanf("%d", &q);
  while(q --> 0){
    int p, n; char c[2];
    scanf("%d%s%d", &p, c, &n);
    if(c[0] == '(') c1 += n;
    if(c[0] == ')') c2 += n;
    puts(c1 == c2 ? "Yes" : "No");
  }
  return 0;
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define REP(i, n) FOR(i, 0, n)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define RREP(i, n) RFOR(i, n, 0)
#define MFOR(i, m) for(auto i=(m).begin();i!=(m).end();i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())

typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1 << 30;

template<typename T>
void printv(vector<T> const& s) {
  REP(i, SZ(s)) {
    cout << s[i] << " ";
  }
  cout << endl;
}

int main () {
  cin.tie(0);
  cout << setprecision(10);

  string s; cin >> s;

  int ans = SZ(s);
  REP(i, SZ(s)-1) {
    if(s[i] != s[i+1]) {
      ans = min(ans, max(i+1, SZ(s)-i-1));
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
string a;
stack<char> s;
int main ()
{
    cin >> a;
    int end = a.length();
    int ans = end;
    for(int i = 0; i < end; ++i)
    {
        if(!s.empty() && s.top() == 'S' && a[i] == 'T')
            ans -= 2, s.pop();
        else 
            s.push(a[i]);
    }
    cout << ans << endl;
    return 0;
}

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

long long n;
string s;

bool solve();

int main() {
  cin >> n >> s;
  if(solve())
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

bool solve() {
  if(n % 2) return 0;
  string x, y;
  for(int i = 0; i < n; ++i)
    if(i < n / 2)
      x += s[i];
    else
      y += s[i];
  return x == y;
}

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

int main() {
	vector<vector<int>> c(3, vector<int>(3));
	rep(i, 3) rep(j, 3) cin >> c[i][j];
	vector<int> C(3);
	rep(i, 3) rep(j, 3) C[i] += c[i][j];
	rep(a1, 101) rep(a2, 101) rep(a3, 101) {
		int A = a1 + a2 + a3;
		bool ok = true;
		rep(l, 3) {
			int b = C[l] - A;
			int tb = b / 3;
			if (b < 0 || b % 3 != 0) ok = false;
			if (tb < 0 || tb > 100) ok = false;
			if (a1 + tb != c[l][0] && a2 + tb != c[l][1] && a3 + tb != c[l][2]) ok = false;
		}
		if (ok) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <utility>
#include <functional>
#include <deque>
#include <cctype>
#include <stack>
#include <bitset>

using ll = long long;
typedef unsigned long long ull;
typedef std::pair<ll, ll>P;

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

const ll mod = 1000000007;
const ll INF = 1 << 30;
const ll INF2 = 8000000000000000000LL;
bool fl = true;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
std::string abc = "abcdefghijklmnopqrstuvwxyz";
struct edge { ll to, cost; };
struct edge1 { ll from, to, cost; };
double pai = 3.141592653589793;
int n, v[1010], w[1010], s, dp[1010][10100];

int rec(int i, int j) {
	if (dp[i][j] != -1)return dp[i][j];
	int res;
	if (i == n)res = 0;
	else if (j < w[i])res = rec(i + 1, j);
	else res = std::max(rec(i + 1, j), rec(i + 1, j - w[i]) + v[i]);
	return dp[i][j] = res;
}

int main() {
	std::cin >> n >> s;
	for (int i = 0;i < n;i++) {
		std::cin >> v[i] >> w[i];
	}
	for (int i = 0;i < 1010;i++) {
		for (int j = 0;j <= s;j++)dp[i][j] = -1;
	}
	std::cout << rec(0, s) << std::endl;
}


Measured memory_bytes: 42968
#![allow(unused_imports)]
#![cfg_attr(feature = "cargo-clippy", allow(redundant_field_names))]

use std::{cmp, fmt};
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::io::{self, BufWriter, Read, Write};
use std::ops::{Add, Div, Mul, Sub};
use std::str::{self, FromStr};

fn main() {
    let (n, m, x, a): (usize, usize, usize, Vec<usize>) = {
        let mut sc = InputScanOnce::new(io::stdin(), 1024);
        let (n, m, x) = (sc.next(), sc.next(), sc.next());
        (n, m, x, sc.vec(m))
    };
    let mut w = vec![false; n + 1];
    for &i in &a {
        w[i] = true;
    }
    let r1 = w[1..x].iter().filter(|&&p| p).count();
    let r2 = w[x + 1..n + 1].iter().filter(|&&p| p).count();
    println!("{}", cmp::min(r1, r2));
}

struct InputScanOnce {
    buf: Vec<u8>,
    pos: usize,
}

#[allow(dead_code)]
impl InputScanOnce {
    fn new<R: Read>(mut reader: R, estimated: usize) -> Self {
        let mut buf = Vec::with_capacity(estimated);
        let _ = io::copy(&mut reader, &mut buf).unwrap();
        InputScanOnce { buf: buf, pos: 0 }
    }

    #[inline]
    fn next<T: FromStr>(&mut self) -> T
    where
        T::Err: fmt::Debug,
    {
        let mut start = None;
        loop {
            match (self.buf[self.pos], start.is_some()) {
                (b' ', true) | (b'\n', true) => break,
                (_, true) | (b' ', false) | (b'\n', false) => self.pos += 1,
                (_, false) => start = Some(self.pos),
            }
        }
        let target = &self.buf[start.unwrap()..self.pos];
        unsafe { str::from_utf8_unchecked(target) }.parse().unwrap()
    }

    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T>
    where
        T::Err: fmt::Debug,
    {
        (0..n).map(|_| self.next()).collect()
    }

    fn pairs<T1: FromStr, T2: FromStr>(&mut self, n: usize) -> Vec<(T1, T2)>
    where
        T1::Err: fmt::Debug,
        T2::Err: fmt::Debug,
    {
        (0..n).map(|_| (self.next(), self.next())).collect()
    }

    fn trios<T1: FromStr, T2: FromStr, T3: FromStr>(&mut self, n: usize) -> Vec<(T1, T2, T3)>
    where
        T1::Err: fmt::Debug,
        T2::Err: fmt::Debug,
        T3::Err: fmt::Debug,
    {
        (0..n)
            .map(|_| (self.next(), self.next(), self.next()))
            .collect()
    }

    fn mat<T: FromStr>(&mut self, m: usize, n: usize) -> Vec<Vec<T>>
    where
        T::Err: fmt::Debug,
    {
        (0..m).map(|_| self.vec(n)).collect()
    }

    fn strings_as_mat<T, F: FnMut(u8) -> T>(&mut self, h: usize, mut f: F) -> Vec<Vec<T>> {
        (0..h)
            .map(|_| {
                let l = self.next::<String>();
                l.as_bytes().iter().cloned().map(&mut f).collect()
            })
            .collect()
    }
}


Measured memory_bytes: 4352
#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<queue>
#include<cassert>
#include<tuple>
#include<set>
#include<map>
#include<list>
#include<bitset>

#define PB push_back
#define ALL(a)  (a).begin(),(a).end()
#define all(v) begin(v), end(v)
#define DWN(a)  (a).begin(),(a).end(), greater<int>()
#define rep(i, m) for (int i = 0; i < m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)

using namespace std;

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

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
const int INF = (int)1e9;
const ll inf = (ll)1e18;
const ll MOD{ (ll)1e9 + 7 };

int N;
ll H, W;
map<ll, ll> cnt;
map<int, ll> ans;

int main()
{
	cin >> H >> W >> N;
	rep(i, N) {
		ll a, b;
		cin >> a >> b;
		for (ll y = max(1LL, a - 2); y < min(a, H - 2) + 1; y++) {
			for (ll x = max(1LL, b - 2); x < min(b, W - 2) + 1; x++) {
				cnt[y * 1000000001LL + x]++;
			}
		}
	}
	for (auto p : cnt) {
		ans[p.second]++;
	}
	ll sum = 0;
	REP(i, 1, 10) {
		sum += ans[i];
	}
	ans[0] = (H - 2) * (W - 2) - sum;
	rep(i, 10) {
		cout << ans[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 56448
import java.util.Scanner;

public class Main {

	static long bignum = 1000000000+7;

	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);

		int k = sc.nextInt();
		String s = sc.next();
		String[] ss = s.split("");

		if(ss.length<=k) {
			System.out.println(s);
		}else {
			for(int i =0;i<k;i++) {
				System.out.print(ss[i]);
			}
			System.out.println("...");
		}




	}


	static long divn(int target, int times) {//10_9+7のあまり累乗版
		int sqtimes = (int)Math.sqrt(times);
		long ans = 1;
		for(int i =0;i<sqtimes;i++) {
			ans = (ans * target)%(1000000000+7);
		}
		long holder = ans;
		ans = 1;
		for(int i =0;i<sqtimes;i++) {
			ans = (ans*holder)%(1000000000+7);
		}
		for(int i=0;i<times - sqtimes*sqtimes;i++) {
			ans = (ans * target)%(1000000000+7);
		}
		return ans;
	}

	static long div(long a) {//10_9+7のあまり
		if(a<0)a+=1000000000+7;
		return a%(1000000000+7);
	}

}
/*
class City{
	int order;
	int prefecture;
	int year;
	int number;
	City(int order,int prefecture, int year){
		this.order = order;
		this.prefecture = prefecture;
		this.year = year;
	}
}
*/


Measured memory_bytes: 35668
#include <stdio.h>
#include <stdlib.h>

#define INF 100000000
#define N_MAX 100
#define P_MAX 10000

int MIN(int x, int y);

int n;                             /* ?????????????????° */
int r;                             /* ??????????????? */
int k;                             /* ???????????¨??´??\??\?¶??????????????????????????????° */
int t;                             /* ??????????????\?¶??????± */
int p;                             /* ?????±??????????????° */
int s;                             /* ??????????????????????????? */
int d;                             /* ???????????????????????? */
int v;                             /* TTL */
int rute[N_MAX + 1][N_MAX + 1];    /* ???????????? */
int ans[P_MAX];                    /* ?????? */

int main(void)
{
    int i, j, l;

    /* ????????? */
    for (i = 0; i < N_MAX + 1; ++i){
        for (j = 0; j < N_MAX + 1; ++j){
            rute[i][j] = INF;
        }
    }

    scanf("%d", &n);
    for (i = 1; i <= n; i++){
        scanf("%d%d", &r, &k);
        for (j = 1; j <= k; j++){
            scanf("%d", &t);
            rute[r][t] = 1;
        }
    }

    /* ????????????????????? */
    for (l = 1; l <= n; l++){
        for (i = 1; i <= n; i++){
            for (j = 1; j <= n; j++){
                rute[i][j] = MIN(rute[i][j], rute[i][l] + rute[l][j]);
            }
        }
    }

    /* ?????±???????????±?????????????????¨?????? */
    scanf("%d", &p);
    for (i = 0; i < p; ++i)
    {
        scanf("%d%d%d", &s, &d, &v);
        if (rute[s][d] + 1 <= v){
            ans[i] = rute[s][d] + 1;
        }
        else
        {
            ans[i] = 0;
        }
    }

    for (i = 0; i < p; ++i)
    {
        if (ans[i] == 0){
            printf("NA\n");
        }
        else
        {
            printf("%d\n", ans[i]);
        }
    }

    return (0);
}
int MIN(int x, int y){

    if (x < y){
        return(x);
    }
    else{
        return(y);
    }

}

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

using namespace std;

const int mxN = 1e5+1;
vector<int> adj[mxN];

int dp[mxN];
int dfs(int s)
{
    if(dp[s] != -1)
        return dp[s];
    int h = 0;
    for(int child : adj[s])
        h = max(h, dfs(child)+1);
    return dp[s] = h;
}

int32_t main()
{
	int n, m, u, v;
	cin >> n >> m;
	memset(dp, -1, sizeof dp);
	for(int i = 0; i < m; i++)
	{
	    cin >> u >> v;
	    adj[u].push_back(v);
	}
	int res = 0;
	for(int i = 1; i <= n; i++)
	{
	    res = max(res, dfs(i));
	}
	cout << res << "\n";
  	return 0;
}

Measured memory_bytes: 11404
import sys
import bisect

stdin = sys.stdin
 
ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))
rs = lambda: stdin.readline().rstrip()  # ignore trailing spaces

N = ri()
INF = 10 ** 18
A = [10 ** 10 - ri() for _ in range(N)]
dp = [INF] * (N+1)
for a in A:
    i = bisect.bisect_right(dp, a)
    dp[i] = a

print(bisect.bisect_left(dp, INF))
#39 答え見る


Measured memory_bytes: 7840
# -*- coding: utf-8 -*-
import numpy as np

def main():
    n = int(input())
    h = np.array(input().split(), dtype='int')

    ans = 0
    i = 0

    while i < n:
        times_move = 0
        for j in range(n - i - 1):
            if h[i + j] < h[i + j + 1]:
                break
            else:
                times_move += 1
        if times_move > ans:
            ans = times_move
        if n - i - 1 <= ans:
            break
        i += times_move + 1

    print(ans)


main()

Measured memory_bytes: 24684
N = int(input())
def b(N):
    a = False
    for x1 in range(N//4+1):
        cake = x1*4

        if (N-cake) % 7 == 0:
            a = True
        else:
            pass
    if a:
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    b(N)


Measured memory_bytes: 2940
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main()
    {
        Console.WriteLine(Solve());
        //Solve();
        return;
    }

    public static string Solve()
    {
        int[] input = ReadInts();
        int N = input[0], K = input[1];
        string S = Read();
        int ans = 0;
        for (int i = 0; i < N - 1; i++)
        {
            if (S[i] == S[i + 1])
            {
                ans++;
            }
        }
        ans += K * 2;
        ans = Math.Min(ans, N - 1);
        return ans.ToString();
    }

    private static string Read() { return Console.ReadLine(); }
    private static int ReadInt() { return int.Parse(Read()); }
    private static long ReadLong() { return long.Parse(Read()); }
    private static double ReadDouble() { return double.Parse(Read()); }
    private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
    private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
    private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
}


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

int main(){
    // 2019 = 3 * 673
    int l,r;
    int ans = 2018;
    cin >> l >> r;
    int L = l / 2019;
    int R = r / 2019;
    l = l % 2019;
    r = r % 2019;
    // 要素に2019の倍数を含んでいる場合ANS=0
    if(L < R)ans = 0;
    else {
        for(int i = l;i < r+1;i++){
            for(int j = i+1;j<r+1;j++){
                int tmp = (i*j)%2019;
                ans = min(ans,(i*j)%2019);
            }
        }
    }
    cout << ans << endl;
}

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

int main(){
  int n, m;
  cin >> n >> m;
  vector<int> g[n];
  rep(i,m){
    int a, b;
    cin >> a >> b;
    a--; b--;
    g[a].push_back(b);
  }
  vector<vector<int>> d(n,vector<int>(n,INF));
  rep(i,n){
    queue<int> que;
    que.push(i);
    d[i][i] = 0;
    while(!que.empty()){
      int q = que.front();
      que.pop();
      rep(j,g[q].size()){
        if(d[i][g[q][j]] > d[i][q] + 1){
          d[i][g[q][j]] = d[i][q] + 1;
          que.push(g[q][j]);
        }
      }
    }
  }
  int ans = INF;
  int x = -1, y = -1;
  rep(i,n){
    for(int j = i + 1; j < n; j++){
      if(d[i][j] + d[j][i] < ans){
        ans = d[i][j] + d[j][i];
        x = i; y = j;
      }
    }
  } 
  if(ans == INF) cout << -1 << endl;
  else {
    vector<int> use(n,0);
    int p = x;
    use[p]++;
    for(int i = 1; i <= d[x][y]; i++){
      rep(j,g[p].size()){
        if(d[g[p][j]][y] == d[x][y]-i) {
          p = g[p][j];
          use[p]++;
          break;
        }
      }
    }
    for(int i = 1; i <= d[y][x]; i++){
      rep(j,g[p].size()){
        if(d[g[p][j]][x] == d[y][x]-i) {
          p = g[p][j];
          use[p]++;
          break;
        }
      }
    }
    cout << ans << endl;
    rep(i,n){
      if(use[i]) cout << i+1 << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 4352
H, W = map(int, input().split())
a = [[]]
for _ in range(H):
    temp = ["#"] + list(input())
    a.append(temp)

removed_rows = []
removed_cols = []
for row in range(1, H+1):
    is_all_dot = 1
    for col in range(1, W+1):
        if a[row][col] == "#":
            is_all_dot = 0
    if is_all_dot:
        removed_rows.append(row)
for col in range(1, W+1):
    is_all_dot = 1
    for row in range(1, H+1):
        if a[row][col] == "#":
            is_all_dot = 0
    if is_all_dot:
        removed_cols.append(col)

for row in range(1, H+1):
    if row in removed_rows:
        continue
    for removed_col in removed_cols:
        a[row][removed_col] = ""
    ans = "".join(a[row][1:])
    print(ans)

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

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

int main(){
	int W,H,C;
	cin>>W>>H>>C;
	int g=gcd(W,H);
	cout<<W/g*H/g*C<<endl;

	return 0;
}

Measured memory_bytes: 3080
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define show(x) {for(auto i: x){cout << i << " ";} cout<<endl;}
#define showm(m) {for(auto i: m){cout << m.x << " ";} cout<<endl;}
typedef long long ll;
typedef pair<int, int> P;
ll gcd(int x, int y){ return y?gcd(y, x%y):x;}
ll lcm(ll x, ll y){ return (x*y)/gcd(x,y);}

bool cmp(const P &a, const P &b){
    if (a.second == b.second){
        return a.first < b.first;
    } else {
        return a.second < b.second;
    }
}


int main()
{
    int n, m;
    cin >> n >> m;
    vector<P> war(m);
    rep(i, m){ cin >> war[i].first >> war[i].second;}

    sort(war.begin(), war.end(), cmp);

    // rep(i, m){
    //     cout << war[i].first << ":" << war[i].second << endl;
    // }
    

    int point = 0;
    int ans = 0;
    rep(i, m){
        if (war[i].first >= point){
            point = war[i].second;
            ans++;
        }
    }

    cout << ans << endl;
}



Measured memory_bytes: 1152
read = input
A = list(map(int, read().split()))
n = A[-1]
A = A[:3]
A.sort(reverse=True) # descending
ans = 0
if A[1] == A[2] and A[1] == 1: #deal with 1 1
    for i in range(n+1):
        tmp = i*A[0]
        if tmp > n:break
#         print(ans, i, A)
        ans += (n-tmp) - 0 + 1
else :
    for i in range(n+1):
        for j in range(n+1):
            tmp = i * A[0] + j * A[1]
            if tmp > n:break
            tmp = n - tmp
            if tmp % A[2] == 0:
    #             print(i, j, tmp//A[2])
                ans += 1
print(ans)

Measured memory_bytes: 3064
package main

import (
	"fmt"
	"math"
)

func main() {
	var l, n int

	fmt.Scanf("%d %d", &n, &l)

	total := 0

	for i := 0; i < n; i++ {
		total += l + i
	}

	if l == 0 || (l < 0 && math.Abs(float64(l)) < float64(n)) {
		// Nop
	} else {
		if l < 0 {
			total -= l + n - 1
		} else {
			total -= l
		}
	}

	fmt.Print(total)
}


Measured memory_bytes: 512
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>

using namespace std;
using ll = long long int;
#define rep(i,n) for(int i = 0; i < n; i++)
#define FOR(i, a, b)  for(int i = (a); i < (b) ; i++)

#define pb push_back
#define SORT(v,n) sort(v, v+n)
#define ALL(x) (x).begin(),(x).end()
#define debug(x) cerr << #x << ": " << x << '\n'
#define elif else if
#define itn ll
#define int ll
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
///                →,↑,←,↓,↗,↖,↙,↘
int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };


signed main() {
	ios::sync_with_stdio(false);
	int n, m;
	int i;
	cin >> n >> m;
	vector<int> ans(n + 1,0);
	rep(i, m) {
		int a, b;
		cin >> a >> b;
		ans[a]++;
		ans[b]++;
	}
	rep(i, n) {
		cout << ans[i+1] << '\n';
	}
	return 0;
}

Measured memory_bytes: 256
class UF():
  def __init__(self, n):
    self.parents = [-1] * n

  def find(self,n):
    if self.parents[n] < 0:
      return n
    else:
      self.parents[n] = self.find(self.parents[n])
      return self.parents[n]

  def union(self, u, v):
    p1, p2 = self.find(u), self.find(v)
    if p1 == p2: return

    if self.parents[p1] > self.parents[p2]:
      p1,p2 = p2,p1

    self.parents[p1] += self.parents[p2]
    self.parents[p2] = p1

  def same(self, u, v):
    return self.find(u) == self.find(v)

V,E = map(int,input().split())
edges = []
for i in range(E):
  s,t,w = map(int,input().split())
  edges.append((w,s,t))
edges.sort(key=lambda x: x[0])

uf = UF(V)
ans = 0
for i in range(E):
  w,s,t = edges[i]
  if not uf.same(s,t):
    uf.union(s,t)
    ans += w

print(ans)


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


int main(){
int  a , b;
cin >> a>> b ;
int ans = a*b-a-b+1;
cout << ans << endl;
}

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

using namespace std;

typedef long long ll;

int N;
ll K;
ll A[500];
ll ruisekiwa[501];
ll goukei;
ll amari[500];

vector<ll> candidate;

void yakusu(ll X) {
	ll waru = 1;
	while (waru * waru <= X) {
		if (X % waru == 0) {
			candidate.push_back(waru);
			if(waru * waru != X)
				candidate.push_back(X / waru);
		}
		waru++;
	}
	sort(candidate.begin(), candidate.end());
}

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

	yakusu(goukei);

	for (int i = candidate.size() - 1; i >= 0; i--) {
		for (int j = 0; j <= N; j++)ruisekiwa[j] = 0;
		for (int j = 0; j < N; j++)amari[j] = A[j] % candidate[i];
		sort(amari, amari + N);
		for (int j = 1; j <= N; j++)ruisekiwa[j] = ruisekiwa[j - 1] + amari[j - 1];
		
		if (candidate[i] == 1) {
			cout << 1 << endl;
			return 0;
		}

		for (int j = 1; j < N; j++) {

			ll a = -ruisekiwa[j], b = candidate[i] * (N - j) - (ruisekiwa[N] - ruisekiwa[j]);

			if ((a + b) % candidate[i] == 0 &&
				max(-a, b) <= K) {
				cout << candidate[i] << endl;
				return 0;
			}
		}
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define N 140000
#define mod 1000000007
#define pp pair<ll,ll>
typedef long long int ll;
typedef long double ld;
#define MP make_pair

#define endl "\n"
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<n;i++)
#define rrep(i,n) for(ll i=n-1;i>=0;i--)
#define repb(i,n) for(ll i=1;i<n-1;i++)     
void fastIO(void);

void decimal(int);
ll modmulti(ll, ll, ll);
ll modadd(ll, ll, ll);
ll modpower(ll, ll, ll);
ll gcd(ll, ll );
ll modinv(ll, ll);

ll coun(ll a){
   ll ans=0;
   while(a!=0){
      a = a/10;
      ans++;
   }
   return ans;
   }

int main()
{  
   ll n;
   cin>>n;
   ll count=0;
   for(int i=1;i<=n;i++){
      if(coun(i)%2==1)
         count++;
   }
   cout<<count<<endl;
}























void fastIO(void)
{  ios_base::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
}

void decimal(int n){
   cout<<fixed;
   cout<<setprecision(n);
}
ll modmulti(ll a, ll b, ll m){
   return ((a%m)*(b%m))%m;
}
ll modadd(ll a, ll b, ll m){
   return ((a%m)+(b%m))%m;
}
ll modpower(ll a, ll n, ll m){
   if(n==0)
      return 1;
   ll result = 1;
   while(n>0){
      if(n%2==1)
         result = modmulti(result,a,m);
      a = modmulti(a,a,m);
      n = n/2;
   }
   return result;
}
ll gcd(ll a, ll b){
   if(b==0)
      return a;
   return gcd(b,a%b);
}
ll modinv(ll a, ll m){
   return modpower(a,m-2,m);
}


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

int main(){
    int N,X,L;
    cin >> N >> X;
    int D[N + 1] = {};
    D[0] = 0;
    int ans = 1;
    for (int i = 1;i < N + 1;i++){
        cin >> L;
        D[i] = D[i - 1] + L;
        if (D[i] <= X) ans += 1;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import numpy as np

N, M, C = map(int, input().split())
B = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(N)]

B = np.array(B)
A = np.array(A)
vec = A.dot(B) + C
ans = np.sum(vec > 0)
print(ans)

Measured memory_bytes: 12508
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, 1000000009)
	sc.Split(bufio.ScanWords)

	n := oneInt()

	for i := 0; i < n; i++ {
		t, x, y := oneInt(), oneInt(), oneInt()

		d := x + y
		if t < d || (t-d)%2 != 0 {
			fmt.Println("No")
			return
		}
	}
	fmt.Println("Yes")
}

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

func oneStr() string {
	sc.Scan()
	return sc.Text()
}

func scanNums(len int) (nums []int) {
	for i := 0; i < len; i++ {
		nums = append(nums, oneInt())
	}
	return nums
}

func scanStrings(len int) (strs []string) {
	for i := 0; i < len; i++ {
		strs = append(strs, oneStr())
	}
	return strs
}

func abs(a int) int {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func pow(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func min(nums []int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums []int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func strSearch(a []string, b string) bool {
	for i := 0; i < len(a); i++ {
		if a[i] == b {
			return true
		}
	}
	return false
}

func sortAsc(a []int) []int {
	sort.Ints(a)
	return a
}

func sortDesc(a []int) []int {
	sort.Sort(sort.Reverse(sort.IntSlice(a)))
	return a
}

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

func lcm(a, b int) int {
	if a == 0 && b == 0 {
		return 0
	}
	return a * b / gcd(a, b)
}

func sum(nums []int) int {
	sum := 0
	for i := 0; i < len(nums); i++ {
		sum += nums[i]
	}
	return sum
}

func cumSum(nums []int) []int {
	sums := []int{0}

	for i := 0; i < len(nums); i++ {
		sums = append(sums, sums[i]+nums[i])
	}
	return sums
}

func sumOfEachDigit(num int) int {
	sum := 0
	for num > 0 {
		sum += num % 10
		num /= 10
	}
	return sum
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ff              first
#define fo(i,n)         for(i=0;i<n;i++)
#define Fo(i,k,n)       for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define deb(x)          cout << #x << "=" << x << endl
#define deb2(x, y)      cout << #x << "=" << x << "," << #y << "=" << y << endl
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(x)            int x; cin>>x; while(x--)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

const int N = 3e5, M = N;
//=======================

vi g[N];

void solve() {
	int i, j, n, m;
	int x, t;
	cin >> n >> x >> t;
	int ans = 0;
	int xx = 0;
	while (xx < n)
	{
		ans += t;
		xx += x;
	}
	cout << ans << "\n";
}

int32_t main()
{
	FIO;
#ifndef ONLINE_JUDGE
	freopen("input1.txt", "r", stdin);
	freopen("output1.txt", "w", stdout);
#endif
	solve();
	return 0;
}

void ipgraph(int n, int m) {
	int i, u, v;
	while (m--) {
		cin >> u >> v;
		u--, v--;
		g[u].pb(v);
		g[v].pb(u);
	}
}

void dfs(int u, int par) {
	for (int v : g[u]) {
		if (v == par) continue;
		dfs(v, u);
	}
}

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

#define pp push_back
#define pf push_front
#define mp make_pair
#define fs first
#define sc second
#define sf scanf

using namespace std;

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

const int N = (int) 1e5;
const int INF = (int) 1e9 + 7;

int main(int argc, char *argv[])
{
	// ios_base::sync_with_stdio(false);
	// cin.tie(NULL);

	ll x;
	sf("%lld", &x);
	for (ll i = -1000; i <= 1000; ++i) {
		for (ll j = -1000; j <= 1000; ++j) {
			if (pow(i, 5) - pow(j, 5) == x) {
				printf("%lld %lld", i, j);
				return 0;
			}
		}
	}


	return 0;
}


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

using namespace std;

int main()
{
    int n, i, j, a, b, l, cnt = 1;

    string s;

    cin >> n >> s;

    s.erase(unique(s.begin(), s.end()), s.end());

    cout << s.size() << endl;

    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(long long i=0;i<x;i++)
#define repn(i,x) for(long long i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
vector<pair<string,P> >vec;

void solve(long long N, long long K, vector<long long> D){	
	rep(i, 100000) {
		if (i < N) continue;
		ll d, now = i;
		bool flg = true;
		rep(j, 5) {
			if (now == 0) d = -1; else d = now%10;
			rep(k, K) {
				if (d == D[k]) flg = false;
			}
			now /= 10;
		}
		if (flg) {
			cout << i << endl;
			break;
		}
	}
}

int main(){	
	long long K;
	long long N;
	scanf("%lld",&N);
	scanf("%lld",&K);
	vector<long long> D(K-1+1);
	for(int i = 0 ; i <= K-1 ; i++){
		scanf("%lld",&D[i]);
	}
	solve(N, K, D);
	return 0;
}



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

int a,b;
bool CheckPalin(string s){
  int x = s.size();
  for (int i=0;i<x/2;i++){
    if (s[i] != s[x-i-1]){
      return false;
    }
  }
  return true;
}

int main(){
  cin >> a >> b;
  int ans;
  for (int i=a;i<=b;i++){
    string s = to_string(i);
    if (CheckPalin(s)){
      ans += 1;
    }
  }
  cout << ans;

  return 0;
}

Measured memory_bytes: 256