akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<string.h>
#define NUM 6
void N(int dice[][NUM],int k);
void E(int dice[][NUM],int k);
void S(int dice[][NUM],int k);
void W(int dice[][NUM],int k);
void turn(int dice[][NUM],int k);
void sort(int dice[][NUM],int k);
int main(void){
	int a,i,j,k,flag=0;
	char ans[4]="Yes";
	scanf("%d",&a);
	int dice1[a][6];
	for(i=0;i<a;i++){
		scanf("%d %d %d %d %d %d",&dice1[i][0],&dice1[i][1],&dice1[i][2],&dice1[i][3],&dice1[i][4],&dice1[i][5]);
		sort(dice1,i);
	}
	for(i=0;i<a;i++){
		for(j=i+1;j<a;j++){
			if(dice1[i][0]==dice1[j][0] && dice1[i][1]==dice1[j][1] && dice1[i][2]==dice1[j][2] && dice1[i][3]==dice1[j][3] && dice1[i][4]==dice1[j][4] && dice1[i][5]==dice1[j][5]){
				flag=1;
				break;
			}
		}
		if(flag==1) break;
	}
	if(flag==1) printf("No\n");
	else printf("Yes\n");
	
	return 0;
}
void N(int dice[][NUM],int k){
	int tmp;
	tmp=dice[k][0];
	dice[k][0]=dice[k][1];
	dice[k][1]=dice[k][5];
	dice[k][5]=dice[k][4];
	dice[k][4]=tmp; 
}
void E(int dice[][NUM],int k){
	int tmp;
	tmp=dice[k][0];
	dice[k][0]=dice[k][3];
	dice[k][3]=dice[k][5];
	dice[k][5]=dice[k][2];
	dice[k][2]=tmp;
}
void S(int dice[][NUM],int k){
	int tmp;
	tmp=dice[k][0];
	dice[k][0]=dice[k][4];
	dice[k][4]=dice[k][5];
	dice[k][5]=dice[k][1];
	dice[k][1]=tmp;
}
void W(int dice[][NUM],int k){
	int tmp;
	tmp=dice[k][0];
	dice[k][0]=dice[k][2];
	dice[k][2]=dice[k][5];
	dice[k][5]=dice[k][3];
	dice[k][3]=tmp;
}
void turn(int dice[][NUM],int k){
	int tmp;
	tmp=dice[k][1];
	dice[k][1]=dice[k][2];
	dice[k][2]=dice[k][4];
	dice[k][4]=dice[k][3];
	dice[k][3]=tmp;
}
void sort(int dice[][NUM],int k){
	int i,min=dice[k][0];
	//1??¢???????°??????°??????????????????
	for(i=1;i<6;i++)
		if(min>dice[k][i])
			min=dice[k][i];
	for(i=0;i<6;i++){
		if(min==dice[k][i]){
			switch(i){
			case 0:
				break;
			case 1:
				N(dice,k);
				break;
			case 2:
				W(dice,k);
				break;
			case 3:
				E(dice,k);
				break;
			case 4:
				S(dice,k);
				break;
			case 5:
				N(dice,k);
				N(dice,k);
				break;
			}
			break;
		}
	}
	//2??¢???2??????????°?????????°??????????????????
	min=dice[k][1];
	for(i=2;i<5;i++){
		if(min>dice[k][i])
			min=dice[k][i];
	}
	for(i=1;i<5;i++){
		if(min==dice[k][i]){
			switch(i){
			case 1:
				break;
			case 2:
				turn(dice,k);
				break;
			case 4:
				turn(dice,k);
				turn(dice,k);
				break;
			case 3:
				turn(dice,k);
				turn(dice,k);
				turn(dice,k);
				break;
			}
			break;
		}
	}
	return;
}

Measured memory_bytes: 580
num = int(input())
for _ in range(num):
    n = [int(i) for i in input().split()]
    b = 0
    able = 1
    for j in range(10):
        if j == 0:
            a = n[0]
        else:
            if n[j] < a:
                if n[j] < b:
                    print("NO")
                    able = 0
                    break
                else:
                    b = n[j]
            else:
                a = n[j]
    if able == 1:
        print("YES")
                

    



Measured memory_bytes: 5600
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Programminng
{
    class AOJ_Volume0031
    {
        public static void Main(string[] args)
        {
            int[] value = new int[10];
            List<int> v = new List<int>();
            for (int i = 0; i < 10; i++)
            {
                value[i] = (int)Math.Pow(2, i);
            }

            Array.Reverse(value);

            while (true)
            {
                string s = Console.ReadLine();
                if (string.IsNullOrEmpty(s)) break;

                int w = int.Parse(s);
                v.Clear();
                
                for (int i = 0; i < 10; i++)
                {
                    if (value[i] <= w)
                    {
                        w -= value[i];
                        v.Add(value[i]);
                    }
                }

                for (int i = v.Count - 1; i >= 0; i--)
                {
                    if (i == 0)
                    {
                        Console.WriteLine(v[i]);
                    }
                    else
                    {
                        Console.Write(v[i] + " ");
                    }
                }
            }
        }
    }
}

Measured memory_bytes: 5732
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;

constexpr ll infl = 1000000000000000007LL;
constexpr int inf = 1000000007;

inline vector<long long> prime_numbers(long long n) {
    vector<long long> primes;
    for (long long i = 2; i <= n; ++i) {
        bool is_prime = true;
        for (int j = 0; j < primes.size(); ++j) {
            if (primes[j] * primes[j] > i)
                break;
            if (i % primes[j] == 0) {
                is_prime = false;
                break;
            }
        }
        if (is_prime)
            primes.push_back(i);
    }
    return primes;
}

int main() {
    ll x; cin >> x;
    auto primes = prime_numbers(x);
    for (ll y = x; true; ++y) {
        bool isprime = true;
        for (ll k : primes) {
            if (k * k > y) break;
            if (y % k == 0) isprime = false;
        }
        if (isprime) {
            cout << y << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 512
import java.util.Arrays;
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
	Scanner scn =new Scanner(System.in);
	int n = scn.nextInt();
	int k = scn.nextInt();
	int[]h = new int[n];
	for(int i=0;i<n;i++)
	{
		h[i]=scn.nextInt();
	}
	int[]dp=new int[n];
	Arrays.fill(dp, Integer.MAX_VALUE);
	dp[0]=0;
	for(int i=0;i<n;i++)
	{
		for(int j=i+1;j<=i+k;j++)
		{
			if(j<n&&dp[i]!=Integer.MAX_VALUE)
			{
				dp[j]=Math.min(dp[j], Math.abs(h[j]-h[i])+dp[i]);
			}
		}
	}
	System.out.println(dp[n-1]);
}
}

Measured memory_bytes: 59024
N = int(input())
check = False
if N % 4 == 0 or N % 7 == 0:
    check = True
else:
    for i in range(25):
        for j in range(25):
            if 4 * (i + 1) + 7 * (j + 1) == N:
                check = True
                break
if check is True:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define LL long long
#define LD long double
#define ULL unsigned long long
#define UI unsigned int
#define PII pair<int,int>
#define MPII(x,y) pair<int,int>{x,y}
#define _for(i,j,k) for(int i=j;i<=k;i++)
#define for_(i,j,k) for(int i=j;i>=k;i--)
#define efor(i,u) for(int i=head[u];i;i=net[i])
#define lowbit(x) (x&-x)
#define ls(x) x<<1
#define rs(x) x<<1|1
#define inf 0x3fffffff
//#pragma comment(linker, "/STACK:10240000000,10240000000")
using namespace std;
const int maxn = 1e6 + 5;
const int M = 1e9 + 7;
inline int mad(int a,int b){return (a+=b)>=M?a-M:a;}
int p[maxn],isp[maxn],n;
void init(){
	_for(i,2,1000){
		if(!isp[i]) for(int j=i*i;j<maxn;j+=i) isp[j]=1;
	}
	_for(i,2,maxn-1) if(!isp[i]) p[++p[0]]=i;
}
LL a,b;
LL gcd(LL a,LL b){
	return a%b?gcd(b,a%b):b;
}
int sol(LL num){
	int ret=1;
	_for(i,1,p[0]){
		if(num%p[i]==0){
			ret++;
			while(num%p[i]==0) num/=p[i];
		}
		if(num==1) break;
	}
	if(num>1) ret++;
	return ret;
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	init();
	cin>>a>>b;
	LL g=gcd(a,b);
	int an= g==1?1:sol(g);
	cout<<an;//cout<<endl<<sol(g)<<endl;
	return 0;
}


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

#define rep(i,a,b) for(int i=a;i<b;i++)
#define drep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
using namespace std;
void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

//---------------------------------------------------------------------------------------------------
ll combination(vector<vector<ll>> li, ll min, ll count, vector<ll> A, ll N, ll M) {
    ll max = 0, res;
    rep(j, min, M+1){
        A[count] = j;
        if (count!=N-1) {
            res = combination(li, j, count+1, A, N ,M);
        }else{
            ll sum = 0;
            fore(q, li) {
                if ((A[q[1]-1] - A[q[0]-1]) == q[2])  {
                    sum += q[3];
                }
            }
            res = sum;
        }
        if (max < res) max = res;
    }
    return max;
}

void _main() {
    ll N, M ,Q;
    cin >> N >> M >> Q;
    vector<vector<ll>> li;
    rep(i, 0, Q) {
        ll a,b,c,d;
        cin >> a >> b >> c >> d;
        li.push_back(vector<ll>{a,b,c,d});
    }
    vector<ll> A(N);
    ll res, max = 0;
    rep(i, 1, M+1) {
        A[0] = i;
        res = combination(li,i,1,A,N,M);
        if (res > max) max = res;
    }
    cout << max << endl;
}

Measured memory_bytes: 3696
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define eb emplace_back
typedef long double ld;

main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	string s;
	cin >> s;
	for (char c : s)
		if (c == '7') return cout << "Yes\n", 0;
	cout << "No\n";
}


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

int MAX = 210000;
int MOD = 998244353;

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

vector<long long> fac(MAX), finv(MAX), inv(MAX);
void COMinit() {
  fac.at(0) = fac.at(1) = 1;
  finv.at(0) = finv.at(1) = 1;
  inv.at(1) = 1;
  for (int i = 2; i < MAX; i++) {
    fac.at(i) = fac.at(i-1) * i % MOD;
    inv.at(i) = MOD - inv.at(MOD % i) * (MOD / i) % MOD;
    finv.at(i) = finv.at(i-1) * inv.at(i) % MOD;
  }
}
long long COM(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac.at(n) * (finv.at(k) * finv.at(n-k) % MOD) % MOD;
}

int main() {
  long long N, M, K; cin >> N >> M >> K;
  COMinit();
  long long ans = 0;
  for (int i = 0; i <= K; i++) {
    long long tmp = (M * COM(N-1, i) % MOD) * modpow(M-1, N-i-1, MOD) % MOD;
    ans = (ans + tmp) % MOD;
  }
  cout << ans << endl;
}

Measured memory_bytes: 8084
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define rep(I, N) for (int I = 1; I <= (N); ++I)
#define repp(I, N) for (int I = 0; I < (N); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORR(I, A, B) for (int I = (A); I >= (B); I--)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
const int N = 2e5 + 5;
const double eps = 1e-7;
const int mod = 1e9 + 7;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;

int main() {
    int w,h,x,y;
    cin >> w >> h >> x >> y;
    double ans = (double)w * h / 2.0;
    if((y * 2 == h) && (x * 2 == w))
    {
        printf("%.9f 1\n", ans);
    }
    else 
    {
        printf("%.9f 0\n", ans);
    }
    return 0;
}


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

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  int h, a;
  cin >> h >> a;
  cout << (h + a - 1) / a << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)
 
int n;
int a,b;


int main(){
    scanf("%d%d%d",&n,&a,&b);
    ll ans=pom(2,n,MOD)-1;
    
    ll temp=1;
    rep(i,1,a+1)temp=temp*(n+1-i)%MOD*invp(i,MOD)%MOD;
    ans-=temp;
    rep(i,a+1,b+1)temp=temp*(n+1-i)%MOD*invp(i,MOD)%MOD;
    ans-=temp;
    
    ans%=MOD;
    ans+=MOD;
    printf("%lld",ans%MOD);
}

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

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int A, B, K;
	cin >> A >> B >> K;
	bool frag = false;
	if(K % 2 == 1) {
		frag = true;
	}
	
	for(int i = 0; i < K; i++) {
		if(A % 2 == 1) {
			A = A - 1;
		}
		B = B + A/2;
		A = A/2;
		
		if(frag && i == K-1) {
			break;
		}
		
		i++;
		if(B % 2 == 1) {
			B = B - 1;
		}
		A = A + B/2;
		B = B/2;
	}
	
	cout << A << " " << B << endl;
		

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long n,y,x;
	cin>>n;
	x=n/100;
	y=x*105;
	if (n<=y)
	{
		cout<<1<<endl;
	}
	else
	{
		cout<<0<<endl;
	}
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
#define INF 2000000007
#define LINF 100000000000000007
#define MOD 1000000007
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define repb(i, n) for (int i = n - 1; i >= 0; i--)
#define MODE 0
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long ll;
typedef pair<int,int> P;
struct edge{int to,cost;};
int ceil2(int a,int b){if(a%b){return a/b+1;}else{return a/b;}}
using namespace std;

double n,k;
string s;
signed main(){
	cin>>n;
	double ans=(n/3.0)*(n/3.0)*(n/3.0);
	printf("%.12lf",ans);
}


Measured memory_bytes: 256
import scala.math._
import scala.annotation._
import scala.collection._
import scala.collection.{mutable => mut}
import scala.util.control.Breaks.{breakable,break}

object Main {
  def main(args: Array[String]) {
    val sc = new java.util.Scanner(System.in)

    val n, k = sc.nextInt
    println(
      if(n >= 2 * k - 1) "YES" else "NO"
    )
  }
}

Measured memory_bytes: 25656
#include "bits/stdc++.h"
using namespace std;

#define int long long
#define F first
#define S second
#define sz(x) ((int)x.size())
#define rep(i,a,n) for (int i = a; i <= n; ++i)
#define all(v)  v.begin(), v.end()
#define pb push_back
#define P pair < int, int >
#define E cout << '\n'

const int mod = 1e9 + 7;
const int N = 3e5 + 5;

int a[N];
 
inline void solve() {
	string s;
	cin >> s;
	sort(all(s));
	if (s[0] == s[1] && s[2] == s[3] && s[0] != s[3]) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}

}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
    int t = 1;
    //cin >> t; while(t--)
                solve();
    return 0;
}

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

using namespace std;
using ll =long long;

#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cout << #x << " = " << (x) << endl;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
bool coY() {cout <<"Yes"<<endl;}
bool coN(){cout <<"No"<<endl;}

const ll INF = 1LL << 60;

ll n,m;
string s;
//Write From this Line

const int mod = 1e9+7;
int main()
{ 
	cin >> n ;

	map<int,vector<pair<int,bool>>> testify;
	rep(i,n){
		int a ;
		cin >> a ;//a個の証言を持っているよ
		rep(j,a){
			//i人目の証言
			int x, y;
			cin >> x >> y;//x人目の人はy(0なら嘘つき、1なら正直者である)
			x -- ; // １ずらしとく
			testify[i].emplace_back(x,y);
		}
	}
	//bit全探索
	int ans = 0 ;
	for(int mask = 0 ; mask < (1 << n) ; mask ++){
		//010101なら、０番目の証言を真、１番目を偽
		//ビットが立っている人の証言を真としたとき、
		vector<bool> honest(n,false);
		int tmp = 0 ;
		bool flag = false;
		for(int i = 0 ; i < n ; i ++){
			if( (mask >> i) & 1) {
				honest[i] = true ;
				tmp ++; 
			}
		}
		for(int i = 0 ; i < n ; i++){//x.secondがtrueだったらx.secondの証言を見る
			if(honest[i]){
				for(auto x:testify[i]){
					if(x.second == honest[x.first]){
						//ok;
					}
					else{
						goto SKIP;
					}
				}
			}
		}
		//	for(int i = 0 ; i < n ; i ++){
		//		if( (i >> mask) & 1) {
		//			//i番目のビットが立っているかどうか判断できた
		//			//今みたいなのはtestify[i]
		//			for(auto x:testify[i]){
		//				//言うのはx.firstの人がx.secondである。
		//				if( honest[x.first] != x.second ){
		//					//証言に矛盾あり
		//					flag = false;
		//					goto SKIP;
		//				}else{
		//					flag = true;
		//				}
		//			}
		////		}
		//	}
		ans =max(ans,tmp);
SKIP:
		continue;
	}
	cout << ans << endl;
}



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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a*b/gcd(a, b);
}

int main()
{
    cout << fixed << setprecision(15);
    double T, X;
    cin >> T >> X;

    cout << T/X << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <set>
#include <sstream>
#include <numeric>
#include <bitset>
#include <complex>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cctype>
#include <cassert>
using namespace std;

typedef long long ll;
static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
bool ISINT(double x){return fabs(x-(int)round(x))<EPS;}
bool ISEQ(double x,double y){return fabs(x-y)<EPS;}
string itos(ll x){stringstream ss;ss<<x;return ss.str();}
#define foreach(itr,c) for(__typeof(c.begin()) itr=c.begin();itr!=c.end();itr++)

int M, N;
int P[10001];
int C[501], E[501];
int dp[501][10001];

void solve(){
  for(int i = 0; i < 501; i++)
    fill(dp[i], dp[i] + 10001, INT_MAX);

  dp[0][0] = 0;

  for(int i = 0; i < N; i++){
    for(int j = 0; j <= M; j++){
      if(dp[i][j] == INT_MAX) continue;

      int nj = min(M, j + C[i]);
      dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
      dp[i + 1][nj] = min(dp[i + 1][nj], dp[i][j] + E[i]);
    }
  }

  sort(P, P + M, greater<int>());

  int res = 0;
  int sum = accumulate(P, P + M, 0);
  int box = INT_MAX;

  for(int i = M; i > 0; i--){
    box = min(box, dp[N][i]);
    if(box != INT_MAX){
      res = max(res, sum - box);
    }
    sum -= P[i - 1];
  }

  cout << res << endl;
}

int main(void){
  while(cin >> M >> N){
    for(int i = 0; i < M; i++){
      cin >> P[i];
    }
    for(int i = 0; i < N; i++){
      cin >> C[i] >> E[i];
    }
    solve();
  }
}

Measured memory_bytes: 20800
#include <iostream>
#include <string>
#include <vector> 
#include <algorithm>
#include <cmath>
#include <map>
#include <numeric>
#include <queue>
using namespace std;
typedef long long ll;

int main(){
   int a,b,c;cin>>a>>b>>c;
   if(a*c<=b)cout<<c;
   else cout<<b/a;
}

Measured memory_bytes: 256
#include <iostream>
#include <climits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <deque>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
using namespace std;

const int MAX = 100001;
const int MOD = 1000000007;

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

int ceil(int x, int y){
  return (x % y == 0) ? x / y : x / y + 1;
}

ll gcd(ll x, ll y){
  return y ? gcd(y, x % y) : x;
}

void swap(ll *a, ll *b){
  ll tmp = *a;
  *a = *b;
  *b = tmp;
}

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

  ll a, b;
  cin >> a >> b;

  if(a > b) swap(&a, &b);

  vector< ll > c;
  for(ll i = 1; i * i <= a; i++){
    if(a % i != 0) continue;
    ll j = a / i;
    if(b % i == 0) c.push_back(i);
    if(i != j && b % j == 0) c.push_back(j);
  }

  sort(c.begin(), c.end());

  // debug
  //for(ll i: c) cout << i << endl;

  int i = 1;
  while(i < c.size()){
    vector< int > r;
    for(int j = i + 1; j < c.size(); j++){
      if(c[j] % c[i] == 0) r.push_back(j);
    }
    int k = 0;
    for(int j: r){
      c.erase(c.begin() + j - k);
      ++k;
    }
    ++i;
  }

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

  return 0;
}


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

#define deb(x) cout << #x << " " << x << endl;

typedef long long int ll;

char grid[1002][1002];
ll dp[1002][1002];

ll path(ll n, ll m, ll i, ll j){

    if (i==n-1 && j==m-1)
        return 1%1000000007;

    if (dp[i][j]!=-1)
        return dp[i][j]%1000000007;

    if (i>=0 && i<n && j>=0 && j<m && grid[i][j]=='.'){
        dp[i][j] = path(n, m, i, j+1) + path(n, m, i+1, j);
        return dp[i][j]%1000000007;
    }
    
    return 0%1000000007;

}

int main(){

    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        // freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    ll n, m;
    cin >> n >> m;

    memset(dp, -1, sizeof(dp));

    for (ll i=0; i<n; i++){
        for (ll j=0; j<m; j++){
            cin >> grid[i][j];
        }
    }

    ll ans = path(n, m, 0, 0);

    cout << ans << endl;

   return 0;
}


Measured memory_bytes: 12592
//Practice more and more
//learn for better
#define bn begin()
#define en end()
#define mx 5000010
#define pb push_back
#define PI (2.0*acos(0.0))
#define ALL(a) a.begin(),a.end()
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rep(a,b) for(int a=0;a<b;++a)
#define fastio ios::sync_with_stdio(false)
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<int>  vi;
typedef vector<ll>   vll;
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
	int a,b,n,i,t,tmp;
	vector<int> v;
	cin>>a>>b;
	for(i=0;i<a;i++)
	{
		cin>>n;
		v.pb(n);
	}
	ll sum=0;
	sort(ALL(v));
	for(i=0;i<b;i++)
	sum+=v[i];
	cout<<sum<<endl;
	


	return 0;
}

Measured memory_bytes: 3612
N = int(input())
nums = list(map(int, input().split()))
ans = 10**14
for start in [-1, 1]:
  before = start
  cnt = 0
  sum_n = 0
  for num in nums:
    sum_n += num
    if before*sum_n >= 0:
      if before < 0:
        cnt += abs(1-sum_n)
        sum_n = 1
      else:
        cnt += abs(-1-sum_n)
        sum_n = -1
    before = sum_n
  ans = min(ans, cnt)
print(ans)

Measured memory_bytes: 14372
// AtCoder-Template.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second
#define FOR(i,N) for(auto i=0; i<N; ++i)
#define FORREV(i,N,_cnt) for(auto i=N-1,cnt=_cnt; cnt > 0; --i, --cnt)
#define ALL(x) x.begin(), x.end()

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
template <class T> inline void chmin(T& a, const T& b) { if (b < a) a = b; }
template <class T> inline void chmax(T& a, const T& b) { if (b > a) a = b; }
/* clang-format on */

constexpr ll MOD = ll(1e9 + 7);

class Factorial {
public:
	Factorial() = delete;
	static ll myPow(ll x, ll n, ll m) {
		if (n == 0)
			return 1;
		if (n % 2 == 0)
			return myPow(x * x % m, n / 2, m);
		else
			return x * myPow(x, n - 1, m) % m;
	}

	Factorial(ll N) : N(N) {
		// 1 ... N までの
		FAC.resize(N  +1  );
		DEFAC.resize(N+1 );

		FAC[0] = FAC[1] = 1;
		FOR(i, N)
			(FAC[i + 1] = FAC[i] * (i + 1)) %= MOD;

		DEFAC[N] = myPow(FAC[N], MOD - 2, MOD);
		//REV(i, N, 0)
		FOR(_i, N-1) {
			auto i = N - 1 - _i;
			(DEFAC[i - 1] = DEFAC[i] * (i)) %= MOD;
		}
	}
	ll getComb(ll N, ll B) {
		if (N < B) {
			throw "[Factorial]::getComb  nCb  b is larger than b.";
		}
		return (FAC[N] * DEFAC[N - B] * DEFAC[B]) % MOD;
	}
	ll getFact(ll N) {
		return FAC[N] % MOD;
	}
	vector<ll> FAC;
	vector<ll> DEFAC;
	ll N;
}; 
int main() {
#ifdef DEBUG
	ifstream ifs("in.txt");
	cin.rdbuf(ifs.rdbuf());
#endif
	ll N, M; cin >> N >> M; ll ans = 0;
	Factorial f(N + M + 1);
	if (N == M) {// N M N M , M N M N
		(ans = f.getFact(N) % MOD * f.getFact(M)) %= MOD;
		(ans *= 2LL) %= MOD;
	}
	else if (N + 1 == M) { // N M N M N
		(ans = f.getFact(N) % MOD * f.getFact(M)) %= MOD;
	}
	else if (N == M + 1) { 
		(ans = f.getFact(N) % MOD * f.getFact(M)) %= MOD;
	}
	else {
		ans = 0;
	}

	while (ans < 0) ans += MOD;
	cout << ans % MOD << endl;
	return 0;
}


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

int main()
{
	ll q,h,s,d;
	cin >> q >> h >> s >> d;
	ll n;
	cin >> n;
	ll ans = 0;
	if(n>=2)
	{
		ans += (n/2)*min(q*8,min(h*4,min(s*2,d)));
		n = n%2;
		
	}

	ans += n*min(q*4,min(h*2,s));
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <string>
using namespace std;
int main(void){
    string s;
    int n,x,y,f=0,p=0;
    map<int, bool> a,b,c;
    cin>>s>>x>>y;
    n=s.length();
    b[0]=true;
    for(int i=0;i<n;i++){
        if(s[i]=='F'){
            f++;
        }
        if(s[i]=='T'||i==n-1){
            if(p==0){
                a[f]=true;
                p=1;
            }else if(p==1&&f!=0){
                c=map<int, bool>();
                for(auto u=a.begin();u!=a.end();u++){
                    if(u->second==true){
                        c[u->first+f]=c[u->first-f]=true;
                    }
                }
                a=c;
            }else if(f!=0){
                c=map<int, bool>();
                for(auto u=b.begin();u!=b.end();u++){
                    if(u->second==true){
                        c[u->first+f]=c[u->first-f]=true;
                    }
                }
                b=c;
            }
            p=3-p;
            f=0;
            
        }
    }
    if(a[x]&&b[y]){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}


Measured memory_bytes: 768
package main

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

var stdin = bufio.NewScanner(os.Stdin)
var H int

func nextInt() int {
	stdin.Scan()
	i, _ := strconv.Atoi(stdin.Text())
	return i
}

func maxHeapify(A []int, i int) {
	left := 2 * i
	right := 2*i + 1
	if left > H {
		return
	}
	var largest int
	if left <= H && A[left] > A[i] {
		largest = left
	} else {
		largest = i
	}
	if right <= H && A[right] > A[largest] {
		largest = right
	}

	if largest != i {
		A[i], A[largest] = A[largest], A[i]
		maxHeapify(A, largest)
	}
}

func buildMaxHeap(A []int) {
	for i := H / 2; i > 0; i-- {
		maxHeapify(A, i)
	}
}

func main() {
	stdin.Split(bufio.ScanWords)
	H = nextInt()
	heap := make([]int, H+1)

	for i := 1; i <= H; i++ {
		heap[i] = nextInt()
	}

	buildMaxHeap(heap)
	for i := 1; i <= H; i++ {
		fmt.Printf(" %d", heap[i])
	}
	fmt.Println()
}



Measured memory_bytes: 9996
//<============ Author --> @venom ============>//
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fo(i,n)           for(int i=0;i<n;i++)
#define int               long long
#define pb                emplace_back
#define mp                make_pair
#define ff                first
#define ss                second
#define all(x)            x.begin(), x.end()
#define sortall(x)        sort(all(x))
#define sortrev(x)        sort(all(x), greater<int>())
#define w(x)              int x; cin>>x; while(x--)
#define trunc(x,y)        fixed<<setprecision(y)<<x
#define mk(arr, n, type)  type *arr=new type[n];
#define PI                3.1415926535897932384626
#define mod               1000000007
#define inf               1e9 + 5
#define FIO               ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
typedef pair<int, int>    pi;
typedef vector<int>       vi;
typedef vector<pi>        vpi;
typedef vector<vi>        vvi;
typedef tree<int, null_type, less<int>, rb_tree_tag,
        tree_order_statistics_node_update> indexed_set;
const int N = 3e5, M = N;
int mpow(int base, int exp);
int gcd(int a, int b) {if (a == 0) return b; return gcd(b % a, a);}
//<----------------------------------------------------------------------------->//
void fastIO()
{
  fastIO();
#ifndef ONLINE_JUDGE
  // for getting input from input.txt
  freopen("input.txt", "r", stdin);
  // for writing output to output.txt
  freopen("output.txt", "w", stdout);
#endif
}

struct item
{
  int wt;
  int val;
};

int solve(vector<item> ar, int n, int W)
{
  int maxVal = 1000 * n;
  int dp[n + 1][maxVal + 1];

  // base case
  for (int x = 1; x <= maxVal; x++)
    dp[1][x] = inf;

  dp[1][0] = 0;
  dp[1][ar[1].val] = ar[1].wt;

  for (int i = 2;  i <= n; i++)
  {
    for (int j = 0; j <= maxVal; j++)
    {
      dp[i][j] = dp[i - 1][j];

      if (ar[i].val > j)
        continue;

      dp[i][j] = min(dp[i][j], dp[i - 1][j - ar[i].val] + ar[i].wt);
    }
  }

  int ans = 0;

  for (int x = 0; x <= maxVal; x++)
  {
    if (dp[n][x] <= W)
      ans = x;
  }

  return ans;
}

int32_t main()
{
  FIO;

  int n, w;
  cin >> n >> w;

  vector<item> v(n + 1);

  for (int i = 1; i <= n; i++)
  {
    cin >> v[i].wt >> v[i].val;
  }

  cout << solve(v, n, w);

  return 0;
}

int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((int)result * base) % mod;
    base = ((int)base * base) % mod;
    exp >>= 1;
  }
  return result;
}

Measured memory_bytes: 78336
var input = '';
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk) {
  input += chunk;
  var text = 'ABC';
  if (input >= 1000 && input <= 1998) {
    text = 'ABD';
  }
  console.log(text)
});

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

namespace atcoder
{
	class Program
	{
		static int In => int.Parse(Console.ReadLine());
		static int[] Ins => Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
		static void Out(bool b) => Console.WriteLine(b ? "Yes" : "No");

		static void Main(string[] args)
		{
			bool ans = false;
			String str = Console.ReadLine();
			for(int i = 0;i < str.Length-1;i++)
			{
				if (str[i] == 'A' && str[i + 1] == 'C') ans = true;
			}
			Out(ans);
			//Console.ReadLine();
		}
	}
}


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

int main(void) {
  int n,r;
  cin >> n >> r;
  if (n>=10) cout << r << endl;
  else cout << r+100*(10-n) << endl;

  
               
   
}

Measured memory_bytes: 256
using System;

public class Program
{
    public void Solve()
    {
        var sc = new Scanner();
        int N = sc.NextInt();
        Console.WriteLine(N / 100 == N % 10 ? "Yes" : "No");
    }

    public static void Main(string[] args)
    {
        new Program().Solve();
    }
}

class Scanner
{
    public Scanner()
    {
        _pos = 0;
        _line = new string[0];
    }

    const char Separator = ' ';
    private int _pos;
    private string[] _line;

    #region スペース区切りで取得

    public string Next()
    {
        if (_pos >= _line.Length)
        {
            _line = Console.ReadLine().Split(Separator);
            _pos = 0;
        }

        return _line[_pos++];
    }

    public int NextInt()
    {
        return int.Parse(Next());
    }

    public long NextLong()
    {
        return long.Parse(Next());
    }

    public double NextDouble()
    {
        return double.Parse(Next());
    }

    #endregion

    #region 型変換

    private int[] ToIntArray(string[] array)
    {
        var result = new int[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = int.Parse(array[i]);
        }

        return result;
    }

    private long[] ToLongArray(string[] array)
    {
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = long.Parse(array[i]);
        }

        return result;
    }

    private double[] ToDoubleArray(string[] array)
    {
        var result = new double[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = double.Parse(array[i]);
        }

        return result;
    }

    #endregion

    #region 配列取得

    public string[] Array()
    {
        if (_pos >= _line.Length)
            _line = Console.ReadLine().Split(Separator);

        _pos = _line.Length;
        return _line;
    }

    public int[] IntArray()
    {
        return ToIntArray(Array());
    }

    public long[] LongArray()
    {
        return ToLongArray(Array());
    }

    public double[] DoubleArray()
    {
        return ToDoubleArray(Array());
    }

    #endregion
}

Measured memory_bytes: 13140
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define VVVI vector<vector<vector<ll>>>
#define VVVVI vector<vector<vector<vector<ll>>>>
#define REP(i,n) for(ll i=0,_n=(n);(i)<(ll)_n;++i)
#define REPR(i,n) for(ll i=(ll)(n)-1;0<=(i);--i)
#define RANGE(i,a,b) for(ll i=(ll)a,_b=(ll)(b);(i)<_b;++i)
#define RANGER(i,a,b) for(ll i=(ll)(b)-1,_a=(ll)(a);(_a)<=i;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
#define FI first
#define SE second
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template<typename T>void maxUpdate(T& a, T b) {a = max(a, b);}
template<typename T>void minUpdate(T& a, T b) {a = min(a, b);}

#define MOD 1000000007LL
#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N;
	while(cin>>N) {
		VI P(N);
		REP(i, N) cin>>P[i];
		VI w(P);
		sort(ALL(w));
		string ans = "NO";
		if(P==w) ans="YES";
		REP(i, N) RANGE(j, i+1, N) {
			VI PP(P);
			swap(PP[i], PP[j]);
			if(PP==w) ans="YES";
		}
		
		cout<<ans<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
S = str(input())

ans = 0
N = len(S)
for i in range(2**N):
  pattern = bin(i)[2:].zfill(N)
  formula = ''
  for j in range(N):
    mark = ''
    if pattern[j] == '1' and j < N-1:
      mark = '+'
    formula += S[j]+mark
  ans += eval(formula)

print(ans//2)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repI(i, d, n) for (int i = (d); i < (n); ++i)
#define reps1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using M = map<int, int>;
using Ml = map<ll, ll>;
ll const INF = 1ll<<61;
double pi = 3.141592653589793238;

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

  switch(n % 10) {
    case 2 :
    case 4 :
    case 5 :
    case 7 :
    case 9 :
      cout << "hon" << endl;
      break;
    case 0 :
    case 1 :
    case 6 :
    case 8 :
      cout << "pon" << endl;
      break;
    case 3 :
      cout << "bon" << endl;
      break;
    default : break;
  }

  return 0;
}


Measured memory_bytes: 3628
#include <stdio.h>

int main()
{
    int n,s;
    scanf("%d",&n);
    s=n%10;
    if(s==3)
    printf("bon\n");
    else if(s==0 || s==1 || s==6 || s==8)
    printf("pon\n");
    else
     printf("hon\n");
    return 0;
}

Measured memory_bytes: 1636
import sys
n=int(input())
h=list(map(int,input().split()))
h.reverse()

for i in range(1,n):
    if h[i-1]==h[i]-1:
        h[i]=h[i]-1
    if h[i-1]<h[i]-1:
        print('No')
        sys.exit()

print('Yes')

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

int N;

void solve() {
  int result = 0;
  for (int i = 1; i <= N; i++) {
    string keta = to_string(i);
    if (keta.size() % 2 == 1) {
      result++;
    }
  }
  cout << result << '\n';
}

int main() {
  cin >> N;
  solve();
  return 0;
}


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

typedef long long ll;

const int INF = 1000000000;
const int MOD = 1000000007;

int main(int argc, char *argv[]) {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    string S; cin >> S;
    vector<int> alpha(26, 0);
    rep(i, S.size()) alpha[S[i] - 'A']++;
    bool flg = true;
    rep(i, 26) if (alpha[i] != 0 && alpha[i] != 2) flg = false;
    cout << (flg ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

map<int,int> memo;
int main(void){
  SPEEDUP
  cout << setprecision(15);
  int N,K;cin >> N >> K;
  int x;
  rep(i,N){
    cin >> x;
    memo[x]++;
  }
  vector<PII> v(memo.size());
  int index = 0;
  for(auto itr = memo.begin(), m_end = memo.end(); itr != m_end; ++itr){
    v[index] = PII(itr->second,itr->first);
    ++index;
  }
  sort(all(v),greater<PII>());
  int count = 0;
  rep(i,min(index,K)) count+=v[i].first;
  cout << N - count << endl;
  return 0;
}


Measured memory_bytes: 11264
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

//const MAX:usize = 100006;
//const INF:u64 = u64::max_value();

fn main() {
    let s:String = read();

    println!("{}", 
        match &s[..] {
            "Sunny" => "Cloudy",
            "Cloudy" => "Rainy",
            _ => "Sunny",
        });
    
}

Measured memory_bytes: 4352
N = int(input())
es = [[] for _ in range(N)]
for i in range(N-1):
    a,b = map(int, input().split())
    es[a-1].append(b-1)
    es[b-1].append(a-1)

C = list(map(int, input().split()))
C.sort(reverse=True)
D = [0 for _ in range(N)]
stack = es[0]
D[0] = C[0]
cnt_c = 1
while stack:
    new_stack = []
    for i in stack:
        if D[i] == 0:
            D[i] = C[cnt_c]
            cnt_c += 1
            new_stack.extend(es[i])
    if len(new_stack) == 0:
        break
    else:
        stack = new_stack

print(sum(D) - C[0]) # ｃの最大のやつは辺の値になれないので引く
print(*D)

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

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

int main() {
	int w, h, x, y;
	cin >> w >> h >> x >> y;
	cout << (double)h * w / 2 << endl;
	if (x == (double)w / 2 && y == (double)h / 2) cout << 1 << endl;
	else cout << 0 << endl;
	return 0;
}


Measured memory_bytes: 3740
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#include<algorithm>//next_permutation
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
#define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define small "abcdefghijklmnopqrstuvwxyz"
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

ll gcd(ll a,ll b){
  if(b == 0) return a;
  return gcd(b , a % b);
}

const ll MOD = 1000000007;
const ll MAX = 2000001;

ll mod(ll a){
  return a % MOD;
}

ll lcm(ll a,ll b){
  return (a*b)/gcd(a,b);
}

ll fac[MAX], finv[MAX], inv[MAX];

void nCrprep() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll nCr(ll n, ll r){
    if (n < r) return 0;
    if (n < 0 || r < 0) return 0;
    return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
}

ll nCrcheep(ll n,ll r){
  if(r == 0) return 1;
  else if(r == 1) return n;
  else return nCrcheep(n-1,r-1)*n/r;
}

vector<pair<ll,ll>> prime_factorize(ll n){
  vector<pair<ll,ll>> res;
  
  for(ll i=2; i*i <= n; i++){
    if(n % i != 0) continue;
    
    ll ex = 0;
    while(n % i == 0){
      ex++;
      n /= i;
    }
    
    res.push_back({i,ex});
  }
  
  if(n != 1) res.push_back({n,1});
  
  return res;
  
}




int main(){
  ll n; cin >> n; 
  vl num(n);
  
  rep(i,n) cin >> num[i];
  
  ll nowmax = num[0];
  
  ll sum = 0;
  
  rep(i,n){
    sum += max(nowmax - num[i],0LL);
    nowmax = max(nowmax,num[i]);
  }
  
  cout << sum << endl;
  
  
}

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

int main() {
  int x, y, z, k;
  cin >> x >> y >> z >> k;
  vector<ll> a(x), b(y), c(z);
  rep(i, x) cin >> a[i];
  rep(i, y) cin >> b[i];
  rep(i, z) cin >> c[i];
  vector<ll> ab;
  rep(i, x)rep(j, y) ab.push_back(a[i] + b[j]);
  sort(ab.rbegin(), ab.rend());
  ab.resize(k);
  vector<ll> abc;
  rep(i, ab.size())rep(j, z) abc.push_back(ab[i] + c[j]);
  sort(abc.rbegin(), abc.rend());

  rep(i, k) cout << abc[i] << endl;
}

Measured memory_bytes: 43368
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		char[] S = sc.next().toCharArray();
		int x = 0, xMax = 0;
		for(int i = 0; i < N; i++) {
			if(S[i] == 'I') {
				x++;
				if(x >= xMax) xMax = x;
			}
			if(S[i] == 'D') x--;
		}
		System.out.println(xMax);
	}
}

Measured memory_bytes: 21204
#include <cstdio>
#include <climits>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdio>
#include <climits>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <cstring>
#include <set>
#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
long long MOD = 1000000007;
long long INF = 1000000000000000; //10^15
typedef long long ll;
typedef unsigned long long ull;

int main(void) {

  int k;
  cin >> k;
  
  vector<ll> a(k);
  rep(i, k) cin >> a[i];
  if (a[k - 1] != 2) {
    cout << -1 << endl;
    return 0;
  }

  pair< ll, ll > sec[100010];
  sec[k].first = 2; sec[k].second = 3;
  for (int i = k - 1; i >= 1; i--) {
    ll l = sec[i + 1].first, r = sec[i + 1].second;
    l = ((l - 1LL) / a[i - 1] + 1LL) * a[i - 1];
    r = (r / a[i - 1] + 1LL) * a[i - 1] - 1;
    //cout << l << " " << r << endl;
    if (!(l <= r)) {
      cout << -1 << endl;
      return 0;
    }
    sec[i].first = l; sec[i].second = r;
  }
  cout << sec[1].first << " " << sec[1].second << endl;

  return 0;
  
}


Measured memory_bytes: 2688