akhauriyash/Code-Regression huggingface dataset:
if __name__ == '__main__':
    # a = int(input())
    # a, b = map(int, input().split())

    h, n = map(int, input().split())
    a = map(int, input().split())
    for i in a:
        h -= i
        if h <= 0:
            print("Yes")
            exit()

    print("No")



Measured memory_bytes: 52208
n = gets.to_i
a = gets.chomp.split.map(&:to_i)
cnt = Hash.new(0)

n.times do |i|
  cnt[a[i]] += 1
end

rm = 0
cnt.each do |k, v|
  if v > 1
    rm += v - 1
  end
end

if rm % 2 == 0
  puts n - rm
else
  puts n - rm - 1
end

Measured memory_bytes: 25780
#include <iostream>

using  namespace std;

int main() {
    int d, n;
    cin >> d >> n;

    if (n != 100) {
        cout << n;
    } else {
        cout << "101";
    }
    for (int i = 0; i < d; i++) {
        cout << "00";
    }
    cout << '\n';
    return 0;
}

Measured memory_bytes: 256
//?\???°?????? J4-170033
//????????£?????????15???
//??¨????????????n==k?????????????????????????????¶????????????????????????????????°???????????§?????????0????????????????????????k????????£????????£????????????????????????????????????????????????????????????????????¨?????¶?????????????????´???????????????????????¨??????????????????????°??????????????????¨???????????§???????????????????????¶???????????????????????????????????????sort??????n-k?????????????¶??????????????????????????????????
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define fir first
#define sec second
#define PB push_back
#define MP make_pair
#define ll long long
using namespace std;
int main(){
    int n,m;
    while(1){
        cin>>n>>m;
        if(n==0&&m==0)break;
        vector<pair<int,int> >V;
        int ans=0;
        REP(i,n){
            int a,b;
            cin>>a>>b;
            V.PB(MP((-1)*b,a));
            ans+=a*b;
        }
        sort(ALL(V));
        for(int i=0;i<V.size()&&m>0;i++){
            int a=V[i].fir*(-1);
            int b=V[i].sec;
            if(b<=m){
                m-=b;
                ans-=a*b;
            }else{
                ans-=a*m;
                break;
            }
        }
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 3204
sub i{split/ /,<>;}@c=i;for($j=0;$j<$c[2];$j++){@d=i;$d[1]<=$d[0]?${$s[$d[1]]}[@{$s[$d[1]]}]=$d[0]:0;}$e=$c[0]+1;$f=1;for($j=1;$j<=$c[1];$j++){for(sort{$a<=>$b}@{$s[$j]}){$f==$_?$f++:$f<$_&&$e>$_?$e=$_:0;}$f++;}$e--;print$e;

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

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  int n, k;
  cin >> n;
  for (k = 1; n > 0; ++k) {
    n -= k;
  }
  --k;
  cout << k << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>

char judge(int, int, int);

int main() 
{
	int pm, pe, pj;
	int number;
	
	while (true) {
		std::cin >> number;
		
		if (number == 0) {
			break;
		}
		
		for (int i = 0; i < number; i++) {
			std::cin >> pm >> pe >> pj;
			std::cout << judge(pm, pe, pj) <<std::endl;
		}
	}
	return 0;
}

char judge(int pm, int pe, int pj) {
	int avarage = (pm + pe + pj) /3;
	
	if  (pm == 100 || pe == 100 || pj == 100) {
		return 'A';
	} else if ((pm + pe) / 2 >= 90 || avarage >= 80) {
		return 'A' ;
	} else if (avarage >= 70) {
		return 'B';
	} else if (avarage >= 50 && (pm >= 80 || pe >= 80)) {
		return 'B';
	} else {
		return 'C';
	}
}

Measured memory_bytes: 1152
n = list(map(int, list(input())))
k = int(input())

digits = len(n)

dp_le = [[0 for j in range(k+1)] for i in range(digits)]
dp_lt = [[0 for j in range(k+1)] for i in range(digits)]

dp_le[0][0] = 0
dp_le[0][1] = 1
dp_lt[0][0] = 1
dp_lt[0][1] = n[0]-1

for i in range(1, digits):
    for j in range(k+1):
        if n[i] == 0:
            dp_le[i][j] = dp_le[i-1][j]
            dp_lt[i][j] = dp_lt[i-1][j]
            if j > 0:
                dp_lt[i][j] += dp_lt[i-1][j-1]*9
        else:
            dp_lt[i][j] = dp_lt[i-1][j] + dp_le[i-1][j]
            if j > 0:
                dp_le[i][j] += dp_le[i-1][j-1]
                dp_lt[i][j] += dp_lt[i-1][j-1]*9 + dp_le[i-1][j-1] * (n[i] - 1)

print(dp_le[digits-1][k] + dp_lt[digits-1][k])


Measured memory_bytes: 3064
#include <iostream>

using namespace std;

int a[123456], p[123456], r[123456];

int parent(int x) {
    return x == p[x] ? x : (x = parent(p[x]));
}

bool same(int x, int y) {
    return parent(x) == parent(y);
}

void unite(int x, int y) {
    if(!same(x, y)) {
        int xP = parent(x), yP = parent(y);
        if(r[xP] > r[yP]) {
            p[yP] = xP;
        }
        else {
            p[xP] = yP;
            if(r[xP] == r[yP])
                r[yP]++;
        }
    }
}

int main() {
    int n, m;
    cin >> n >> m;
    for(int i = 1; i <= n; i++) {
        cin >> a[i];
        p[i] = i;
        r[i] = 1;
    }
    while(m--) {
        int x, y;
        cin >> x >> y;
        unite(x, y);
    }
    int ans = 0;
    for(int i = 1; i <= n; i++) {
        if(parent(a[i]) == parent(i))
            ans++;
    }
    cout << ans << endl;

}



Measured memory_bytes: 1408
#include<cstdio>
#include<algorithm>
#include<vector>
#include<deque>
#include<string>
#include<iostream>
using namespace std;
string mon;
int P,Q,R,it;
int solve(void){//?????°???????????????????????????
	it++;
	if(mon[it]=='0'){return 0;}
	if(mon[it]=='1'){return 1;}
	if(mon[it]=='2'){return 2;}
	if(mon[it]=='P'){return P;}
	if(mon[it]=='Q'){return Q;}
	if(mon[it]=='R'){return R;}
	if(mon[it]=='-'){return 2-solve();}
	if(mon[it]=='('){
		int sk,at;
		char en;
		sk=solve();
		it++;
		en=mon[it];
		at=solve();
		it++;
		if(en=='+'){return max(sk,at);}
		else{return min(sk,at);}
	}
	return 9999;
	cout<<"BUG!!!"<<endl;
}
int main(void){//solve????§£????????????
	int ans;
	while(-1){
		mon.clear();cin>>mon;ans=0;
		if(mon=="."){return 0;}
		for(P=0;P<3;P++){for(Q=0;Q<3;Q++){for(R=0;R<3;R++){
			it=-1;//?????????+1????????????????????§????????????
			if(solve()==2){ans++;}
		}}}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 3168
def invalid_xy?(x, y)
  (x < 0 or x > 11 or y < 0 or y > 11)
end

def remove_island(x, y)
  [[1, 0], [-1, 0], [0, 1], [0, -1]].each do |dx, dy|
    next if invalid_xy?(x + dx, y + dy)
    if @map[y + dy][x + dx] == 1
      @map[y + dy][x + dx] = 0
      remove_island(x + dx, y + dy)
    end
  end
end

loop do
  @map = []
  while s = gets do
    tmp = s.chomp.split('').map(&:to_i)
    break unless tmp.count > 0
    @map << tmp
  end
  break unless @map.size == 12

  count = 0
  0.upto(11) do |x|
    0.upto(11) do |y|
      if @map[y][x] == 1
        count += 1
        remove_island(x, y)
      end
    end
  end
  puts count
end

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

#define FASTIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using ll = long long;

const int MOD = 998244353;
const ll INF = 1e16;

int main() {
    FASTIO

    int n;
    cin >> n;
    int total = 0;
    for(int i=1; i<=n; i++) {
        total += n/i;
        if(n%i == 0)
            total--;
    }
    cout << total << "\n";
        
    return 0;
}

Measured memory_bytes: 3576
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <list>
#include <stack>
#include <set>
#include <algorithm>
#include <math.h>

using namespace std;

#define dump(x) cout << (x) << endl;
typedef long long Int;

Int mod = 1e9+7;
Int MOD = 998244353;

Int n, m;
Int cost[101][101];
Int d[101];

void dijkstra(Int x) {
    for (Int i = 1; i <= n; i++) d[i] = 1e9;
    d[x] = 0;
    vector<bool> used(n+1, false);
    while (true) {
        Int v = -1;
        for (Int i = 1; i <= n; i++) {
            if (!used[i] && (v == -1 || d[i] < d[v])) v = i;
        }
        if (v == -1) break;
        used[v] = true;
        for (Int i = 1; i <= n; i++) {
            // cout << d[i] << " " << d[v] + cost[v][i] << endl;
            d[i] = min(d[i], d[v] + cost[v][i]);
        }
    }
    
}

int main() {
    cin >> n >> m;
    vector<Int> a(m), b(m), c(m);
    for (Int i = 1; i <= n; i++) {
        for (Int j = 1; j <= n; j++) {
            cost[i][j] = (i == j) ? 0 : 1e9;
        }
    }
    for (Int i = 0; i < m; i++) {
        cin >> a[i] >> b[i] >> c[i];
        cost[a[i]][b[i]] = cost[b[i]][a[i]] = c[i]; 
    }
    vector<bool> is(m, false);
    for (Int i = 1; i <= n; i++) {
        dijkstra(i);
        for (Int j = 0; j < m; j++) {
            if ((d[a[j]] + c[j] == d[b[j]]) || (d[a[j]] == d[b[j]] + c[j])) is[j] = true;
        }
    }
    Int res = 0;
    for (Int i = 0; i < m; i++) {
        if (!is[i]) res++;
    }
    dump(res);
    return 0;
}  

Measured memory_bytes: 384
#coding:utf-8
#1_7_B 2015.4.5
while True:
    n,x = map(int,input().split())
    if n == x == 0:
        break
    count = 0
    
    for i in range(1 , n + 1):
        for j in range(1 , n + 1):
            for k in range(1 , n + 1):
                if i + j + k == x and i < j < k:
                    count += 1
    print(count)

Measured memory_bytes: 6724
import java.util.Scanner;

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

    if(10 <= n)
      System.out.println(r);
    else
      System.out.println(r+(100*(10-n)));
  }
}


Measured memory_bytes: 22356
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;

/**
 * @brief nの階乗（組み合わせ数）<br>
 * intで出力できるのは13まで
 */
template<typename T>
T factorial(T n) {
  if (!n)
    return 1;
  for (T i = n - 1; i > 1; --i)
    n *= i;
  return n;
}

int main() {
  int N;
  cin >> N;
  vector<P> points(N);
  for (int i{}; i < N; ++i) {
    cin >> points[i].first >> points[i].second;
  }

  vector<int> index(N);
  iota(index.begin(), index.end(), 0);

  double distance{};
  do {
    for (int i{}; i < N - 1; ++i) {
      double dx = points[index[i]].first - points[index[i+1]].first;
      double dy = points[index[i]].second - points[index[i+1]].second;
      distance += sqrt(dx * dx + dy * dy);
    }
  } while (next_permutation(index.begin(), index.end()));

  double ans = distance / factorial(N);

  cout << fixed << setprecision(6) << ans << endl;
  return 0;
}


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

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
typedef long long ll;
template<typename T> bool chmax(T &a, T b) {if(a <= b){a = b; return true;}return false;}
template<typename T> bool chmin(T &a, T b) {if(a >= b){a = b; return true;}return false;}

int main(void){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n)cin >> a[i];
    int ans = __gcd(a[0],a[1]);
    for(int i = 2; i < n; i++){
        ans = __gcd(ans, a[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<algorithm>
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;

int main() {
	int x;
	cin >> x;
	int ans = 1;
	for (int i = 2; i * i <= x; i++) {
		int ansi = i * i;
		int k = ansi;
		k *= i;
		while (k <= x) {
			ansi = k;
			k *= i;
		}
		ans = max(ans, ansi);
	}
	cout << ans << endl;
}

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

#define ALL(a) begin(a),end(a)
#define COUNTOF(a) (sizeof(a)/sizeof(a[0]))
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 
typedef long long ll;
template<class T> istream& operator >> (istream& s, vector<T>& v) {
  for (T& x: v) s >> x;
  return s;
}
inline void Yes(bool f){cout<<(f?"Yes":"No")<<endl;}
inline void YES(bool f){cout<<(f?"YES":"NO")<<endl;}

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

    string S; cin >> S;
    vector<bool> f(26,false);

    for (const char& c: S) {
        f[c-'a'] = true;
    }

    vector<bool>::iterator it = find(ALL(f), false);
    if (it == f.end())
        cout << "None" << endl;
    else
        cout << char('a'+distance(f.begin(),it)) << endl;
}


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

int main() {
  int H,W;
  cin >> H >> W;
  vector<string> a(H);
  for(int i=0; i<H; i++)
    cin >> a.at(i);

  for(int i=0; i<W+2; i++){
    cout << '#';
  }
  cout << endl;
  for(int i=0; i<H; i++){
    cout << '#' << a.at(i) << '#' << endl;
  }
  for(int i=0; i<W+2; i++){
    cout << '#';
  }
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 24 14:57:54 2020

@author: manakamura
"""

tmp = input().split()
n,k,q = list(map(lambda a: int(a), tmp))

ppl=[]
for i in range(n):
    ppl.append(0)

for i in range(q):
    a=int(input())
#    print(a)
    ppl[a-1]+=1

#print(ppl)
#print("hofge")

for i in range(n):
    if(ppl[i]+k>q):
        print("Yes")
    else:
        print("No")
    

Measured memory_bytes: 4716
#include<iostream>
#include<algorithm>
#define int long long
using namespace std;
int a[100] = {}, b[100] = {}, c[100] = {}, d[100] = {};
signed main() {
	int N, M;
	cin >> N >> M;
	for (int i = 0; i < N; i++) {
		cin >> a[i]>>b[i];
	}
	for (int i = 0; i < M; i++) {
		cin >> c[i]>>d[i];
	}
	for (int i = 0; i < N; i++) {
		int m = 9999999999;
		int me = 99999999;
		for (int j = 0; j < M; j++) {
			if (m > (abs(a[i] - c[j]) + abs(b[i] - d[j]))) {
				m = (abs(a[i] - c[j]) + abs(b[i] - d[j]));
				me = j;
			}
		}
		cout << me + 1 << endl;
	}

	return 0;
}

Measured memory_bytes: 256
package main
         
    import (
    	"bufio"
    	"fmt"
    	"os"
    )
     
    const (
    	initialBufSize = 1e4
    	maxBufSize     = 1e6 + 7
    )
     
    var buf []byte = make([]byte, maxBufSize)
    var sc = bufio.NewScanner(os.Stdin)
     
    func init() {
    	// sc.Split(bufio.ScanWords)
    	sc.Buffer(buf, maxBufSize)
    }
     
    func main() {
    	S, T := nextLine(), nextLine()
    	var ans int
    	for i := 0; i < len(S); i++ {
    		if S[i] != T[i] {
    			ans++
    		}
    	}
    	fmt.Println(ans)
    }
     
    func nextLine() string {
    	sc.Scan()
    	return sc.Text()
    }

Measured memory_bytes: 2600
// Why I am so dumb? :c
#include <bits/stdc++.h>

#define pb push_back
#define mp make_pair

#define all(x) (x).begin(), (x).end()

#define fi first
#define se second

using namespace std;

typedef long long ll;

string s;

int ans;
    
void solve() {                   
	cin >> s;

	for (char x : s) {
		ans += (x - '0');
	}

    ans = max(ans, ((int)s.size() - 1) * 9);

    for (int i = 0; i < s.size(); ++i) {
		if (s[i] == '0') {
			continue;
		}

		int cur = 0;

		for (int j = 0; j < i; ++j) {
			cur += (s[j] - '0');
		}

		cur += (s[i] - 1 - '0');
		cur += (s.size() - i - 1) * 9;
		ans = max(ans, cur);		
    }

    printf("%d\n", ans);
}

int main() {    
    int tt = 1;

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

    return 0;
}

Measured memory_bytes: 256
while True:
    n,m = map(int,input().split())
    if n==0:
      break
    a = list(map(int,input().split()))
    lst = []
    for i in range(n-1):
        for j in range(i+1, n):
            if a[i]+a[j] <= m:
                lst.append(a[i]+a[j])
    if len(lst) == 0:
        print('NONE')
    else:
        print(max(lst))


Measured memory_bytes: 25384
n, a, b = map(int, input().split())

diff = b - a

if diff % 2 == 0:
	print(diff//2)
else:
	if a < n - b + 1:
		if diff > 0:
			print(a + (diff-1)//2)
		else:
			print(a)
	else:
		if diff > 0:
			print(n-b+1 + (diff)//2)
		else:
			print(n-b+1)
		


Measured memory_bytes: 3060
#include "bits/stdc++.h"

using namespace std;
using ll = long long;
using ii = pair<int, int>;

const int MAX_N = 1e6;
int rc[MAX_N];
int cc[MAX_N];
int h, w, m;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	set<ii> pos;
	cin >> h >> w >> m;

	for(int i = 0;i < m;i++){
		int x, y;
		cin >> x >> y;
		rc[x] += 1;
		cc[y] += 1; 
		pos.insert({x, y});
	}

	int max_val_cols = 0;
	int max_col_idx = 0;
	int max_val_rows = 0;
	int max_row_idx = 0;

	for(int i = 1;i <= h;i++){
		int row_v = rc[i];
		if (row_v > max_val_rows) {
			max_val_rows= row_v;
			max_row_idx = i;
		}
	}

	for(int i = 1;i <= w;i++){
		int col_v = cc[i];
		if (pos.count(make_pair(max_row_idx, i)))
			col_v--;
		if (col_v > max_val_cols) {
			max_val_cols = col_v;
			max_col_idx = i;
		}
	}

	int ans1 = max_val_cols + max_val_rows;

	max_row_idx = max_val_rows = max_col_idx = max_val_cols = 0;

	for(int i = 1;i <= w;i++){
		int col_v = cc[i];
		if (col_v > max_val_cols) {
			max_val_cols = col_v;
			max_col_idx = i;
		}
	}

	for(int i = 1;i <= h;i++){
		int row_v = rc[i];
		if (pos.count(make_pair(i, max_col_idx)))
				row_v--;
		if (row_v > max_val_rows) {
			max_val_rows= row_v;
			max_row_idx = i;
		}
	}

	int ans2 = max_val_cols + max_val_rows;

	cout << max(ans2, ans1) << "\n";
	return 0;
}


Measured memory_bytes: 20052
#include<stdio.h>

void dfs(int,int);
int a,b,dp[20][20];

int main(void){
  int i,j,n,c,d,flag1,flag2,max;

  while(scanf("%d %d",&a,&b),a,b){
    scanf("%d",&n);

    max = a>b?a:b;

    for(i=0;i<a;i++)
      for(j=0;j<b;j++)
	dp[i][j]=-1;

    for(i=0;i<max;i++){
      dp[i][0]=1;
      dp[0][i]=1;
}
    for(i=0;i<n;i++){
      scanf("%d %d",&c,&d);
      dp[c-1][d-1]=0;
    }

    flag1=flag2=0;
    for(i=0;i<max;i++){
      if(dp[0][i]==0)flag1=1;
      if(dp[i][0]==0)flag2=2;
      if(flag1==1)dp[0][i]=0;
      if(flag2==2)dp[i][0]=0;
}

    dfs(1,1);

    if(dp[a-1][b-1]<0)dp[a-1][b-1]=0;
    printf("%d\n",dp[a-1][b-1]);
}

  return 0;
}

void dfs(int x,int y){
  if(x==a || y==b)return ;

 if(dp[x][y]>0 || dp[x][y]<-1)return ;
  if(dp[x-1][y]>=0 && dp[x][y-1]>=0 && dp[x][y]==-1)dp[x][y]=dp[x-1][y]+dp[x][y-1];
  //if(x==a-1 && y==b-1)return ;
  dfs(x+1,y);
  dfs(x,y+1);
}

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

int main(){
    int n,h,w;
    cin >> n >> h >> w;
    int a[n],b[n];
    int cnt = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i] >> b[i];
        if(a[i] >= h && b[i] >= w){
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}





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

int main() {
    int n, m;
    cin >> n >> m;
    int l[m], r[m];
    for(int i = 0; i < m; i++) cin >> l[i] >> r[i];

    sort(l, l + m);
    sort(r, r + m);

    int lmax = l[m - 1];
    int rmin = r[0];

    int ans = rmin - lmax + 1;
    if(ans < 0) ans = 0;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
#include<iostream>

using namespace std;

typedef long long llint;

llint n, m;

bool f (llint x) {
	if (x<n) return 2*x<=m;
	return (x-n)*2+2*x<=m;
}

int main () {
	cin >> n >> m;
	llint low=0, high=10000000000000LL, mid;
	while (low<high) {
		mid=(low+high+1)/2;
		if (f(mid)) {
			low=mid;
		} else {
			high=mid-1;
		}
	}
	cout << low;
	return 0;
}

Measured memory_bytes: 256
R,G,B,N=map(int,input().split())
ans=0
naxR=N//R
naxG=N//G
for r in range(naxR+1):
    for g in range(naxG+1):
        if (N-r*R-g*G)/B>=0 and (N-r*R-g*G)%B==0:
            ans+=1
print(ans)

Measured memory_bytes: 68468
#include <bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
    enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
    ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
    *this << "[";
    for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
    ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
typedef long long ll;

void solve()
{
	ll n,m,k;
	cin>>n>>m>>k;
	vector<ll> a(n+1), b(m+1);
	for (int i=1; i<=n; i++) {
		cin>>a[i];
		a[i] += a[i-1];
	}
	for (int i=1; i<=m; i++) {
		cin>>b[i];
		b[i] += b[i-1];
	}
	ll ans = 0;
	ll j=m;
	for (int i=0; i<=n; i++) {
		if (a[i]>k) {
			break;
		}
		while (b[j]+a[i]>k) {
			j--;
		}
		ans = max(ans, j+i);
	}
	cout << ans << "\n";
}

int main()
{
	fastIO;
	int t=1;
	// cin>>t;
	while (t--) {
		solve();
	}
	return 0;
}


Measured memory_bytes: 6364
#include <stdio.h>

const int mod = 1000000007;
long long int dp[3];

int main(){
  long long int n;
  scanf("%lld", &n);

  for(dp[0] = 1; n; n >>= 1){
    int z = n & 0x1;

    long long int tmp = (2*(dp[0^z] + dp[2]) + dp[1^z]) % mod;
    dp[1^z] = (dp[2] + 2*dp[1^z]) % mod;
    dp[2] = tmp;
  }
  printf("%lld\n", dp[0]);
}


Measured memory_bytes: 128
import java.util.Scanner;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        sc.close();
        int max = 0;

        if (A >= B) {
            max = Math.max(A + (A - 1), A + B);
        } else if (A < B) {
            max = Math.max(B + (B - 1), A + B);
        }
        System.out.println(max);
    }
}

Measured memory_bytes: 21844
import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T
import Data.Bits (testBit)
import Data.List (mapAccumL)
import qualified Data.Vector.Unboxed as VU

main :: IO ()
main = do
  [n, k] <- map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  let
    fromIntToBools :: Int -> [Bool]
    fromIntToBools = flip map is . testBit
      where
        is = [39, 38..0] :: [Int]
    k' = fromIntToBools k :: [Bool]
  as <- map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  let
    maxF = snd . mapAccumL step (Just k') . counts $ as :: [Int]
      where
        step :: Maybe [Bool] -> Int -> (Maybe [Bool], Int)
        step (Just (False : bs')) c             = (Just bs', c)
        step (Just (_ : bs'))     c | 2 * c < n = (Just bs', n - c)
                                    | otherwise = (Nothing, c)
        step Nothing              c             = (Nothing, max c (n - c))
  print . fromDigitsToInt $ maxF

fromDigitsToInt :: [Int] -> Int
fromDigitsToInt = foldl step 0
  where
    step :: Int -> Int -> Int
    step ds d = 2 * ds + d
{-# INLINE fromDigitsToInt #-}

counts :: [Int] -> [Int]
counts = VU.toList . VU.accum (+) (VU.replicate 40 0) . map (flip (,) 1 . (39 -)) . concatMap (flip filter [0..39] . testBit)
{-# INLINE counts #-}

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n


Measured memory_bytes: 9084
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1591>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

ll solve(){
    ll res = 0;
    ll n,d; cin >> n >> d;
    if(d == 1) return n*(n-1)/2;
    res += d-1;
    res += (n-d)*(n-d+1)/2;
    res += (n-d-1);
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    cout << solve() << endl;
    return 0;
}



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

const int N = 55;
char s[N][N];
int n, m;

int chk(int a, int b) {
    int rv = 0;
    for(int i = -1; i <= 1; ++i)
        for(int j = -1; j <= 1; ++j) {
            int x = a + i;
            int y = b + j;
            if(x < 0 or y < 0 or x >= n or y >= m) continue;
            if(s[x][y] == '#') rv++;
        }
    return rv;
}

int main() {
    scanf("%d %d", &n, &m);
    for (int i = 0; i < n; ++i) scanf("%s", s[i]);
    for (int i = 0; i < n; ++i) for (int j = 0; j < m; ++j) if (s[i][j] == '.') {
        s[i][j] = '0' + chk(i, j);
    }
    for(int i = 0; i < n; i++) printf("%s\n", s[i]);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T> ostream& operator<<(ostream& s,const multiset<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1'000'000'007;
const ll inf=1'000'000'000'000'000'00;
const int INF=1'000'000'000;
const double EPS=1e-10;
const double PI=acos(-1);

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int a,b,c;
    cin>>a>>b>>c;
    rep(i,b){
        if((i*(a%b))%b==c){
            cout<<"YES"<<endl;
            return 0;
        }
    }
    cout<<"NO"<<endl;
}

Measured memory_bytes: 3644
#include <iostream>
#include <vector>
using namespace std;
int main()
{
    int n;
    cin >> n;
    vector<int> vec(10,99);
    for (int i = 1; i <= 9; i++)
    {
        vec[i] = 100 * i + 10 * i + i;
    }
    for (int i = 0; i < 9; i++)
    {
        if (n > vec[i] && n <= vec[i + 1])
        {
            cout << vec[i + 1] << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(){
  int i,b,dice[7],ans,len;
  char couse[101];
  for(i=1;i<=6;i++)scanf("%d",&dice[i]);
  scanf("%s",couse);
  len=strlen(couse);
  for(i=0;i<len;i++){
    if(couse[i]=='S'){
      b=dice[1];
      dice[1]=dice[5];
      dice[5]=dice[6];
      dice[6]=dice[2];
      dice[2]=b;
    }
    if(couse[i]=='W'){
      b=dice[1];
      dice[1]=dice[3];
      dice[3]=dice[6];
      dice[6]=dice[4];
      dice[4]=b;
    }
    if(couse[i]=='N'){
      b=dice[1];
      dice[1]=dice[2];
      dice[2]=dice[6];
      dice[6]=dice[5];
      dice[5]=b;
    }
    if(couse[i]=='E'){
      b=dice[1];
      dice[1]=dice[4];
      dice[4]=dice[6];
      dice[6]=dice[3];
      dice[3]=b;
    }
  }
  printf("%d\n",dice[1]);
  return 0;
}

Measured memory_bytes: 596
'use strict'


function Main(input) {
  const array = input.trim().split('\n')
  const rest = array.slice(1).map(s => s.split(' ').map(s => parseInt(s)))
  const N = parseInt(array[0])

  var xList = [0]
  var yList = [0]
  var tList = [0]

  for(var i = 0; i < N; ++i) {
    tList.push(rest[i][0])
    xList.push(rest[i][1])
    yList.push(rest[i][2])
  }

  
  var flg = true
  for(var j = 0; j < N; ++j) {
    var x = Math.abs(xList[j + 1] - xList[j])
    var y = Math.abs(yList[j + 1] - yList[j])
    var t = tList[j + 1] - tList[j]

    // 一秒で1マスしか進めないので、x+y がtより大きい時はNG
    if (t < x + y || (t % 2 !== (x + y) % 2)) {
      flg = false
      break
    }
  }

  if(flg) {
    console.log('Yes')
  } else {
    console.log('No')
  }  
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"))

Measured memory_bytes: 52712
// 解き直し.
// https://img.atcoder.jp/data/agc/003/editorial.pdf
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define repex(i, a, b, c) for(int i = a; i < b; i += c)
#define repx(i, a, b) repex(i, a, b, 1)
#define rep(i, n) repx(i, 0, n)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define pb push_back
const int MAX = 101010;
LL S[MAX], a[MAX], Norm[MAX], Pair[MAX];
vector<LL> Prime;    // 素数を保存.
vector<LL> vPrime2;  // 素数の二乗を保存.
map<LL, LL> mPrime2; // 素数の二乗を保存.

int main(){
    
    // 1. 入力情報.
    int N;
    scanf("%d", &N);
    rep(i, N) scanf("%lld", &S[i]);
    
    // 2. 素数を取得.
    repx(i, 2, 101010){
        if(a[i]) continue;
        repex(j, i * 2, 101010, i) a[j]++;
    }
    
    // 3. 素数, 素数の二乗 を 保存.
    repx(i, 2, 101010){
        LL p = (LL)i;
        if(!a[i]){
            Prime.pb(p);
            vPrime2.pb(p * p);
            mPrime2[p * p] = p; // 素数の二乗から, 素数を逆引き.
        }
    }
    // for(auto &x : Prime) printf("%d ", x);
    // puts("");
    // for(auto &x : Prime2) printf("%d ", x);
    // puts("");
    
    // 4. 標準系(Norm, Pair), 出現回数 を 保存.
    map<LL, LL> mNorm, mPair;
    rep(i, N){
        LL t = S[i];
        // Norm を 保存.
        // 同じ素因数を, 3つ以上含まなくなるまで立方数で割る.
        for(auto &x : Prime){
            LL x3 = x * x * x;
            while(t % x3 == 0) t /= x3;
            if(x3 >= t) break;
        }
        Norm[i] = t;
        
        // Pair を 保存.
        LL p = 1;
        if(t > 101010){
            if(mPrime2.count(t)) p = mPrime2[t];
            else                 p = t * t;
        }else{
            for(auto &x : Prime){
                if(t % x == 0){
                    LL x2 = x * x;
                    if(t % x2 == 0) t /= x2, p *= x;
                    else            t /= x,  p *= x2;
                }
                if(x >= t) break;
            }
        }
        Pair[i] = p;
        
        // 各標準形の出現回数を保存.
        mNorm[Norm[i]]++;
        mPair[Pair[i]]++;
    }
    // rep(i, N) printf("%lld ", Norm[i]);
    // puts("");
    // rep(i, N) printf("%lld ", Pair[i]);
    // puts("");
    
    // 5. 標準形 が Norm となるような要素数 と 標準形が Pair となるような要素数 のうち, 大きいほうをすべて加算.
    LL ans = 0;
    set<LL> nMemo, pMemo; // すでに出現したか確認.
    rep(i, N){
        LL n = Norm[i], p = Pair[i];
        if(nMemo.count(n) == 0 && nMemo.count(p) == 0 && pMemo.count(n) == 0 && pMemo.count(p) == 0){
            // 標準形 が Norm で, Norm が 1 の 場合は, 1回だけ加算.
            if(n == 1) ans++;
            else       ans += max({mNorm[n], mNorm[p], mPair[n], mPair[p]});
            nMemo.insert(n);
            nMemo.insert(p);
            pMemo.insert(n);
            pMemo.insert(p);
        }
    }
    
    // 6. 出力.
    printf("%lld\n", ans);
    return 0;
    
}

Measured memory_bytes: 51288
#include<iostream>
#include<algorithm>
#define LL long long
int K;
LL A[100010];
int main(){
	std::cin >> K;
	for (int i = 1; i <= K; i++) {
		std::cin >> A[i];
	}
	LL l = 2;
	LL u = 2;
	for (int i = K; i > 0; i--) {
		if (!(u / A[i] - (l - 1) / A[i])) {
			std::cout << -1 << std::endl;
			return 0;
		}
		l = ((l - 1) / A[i] + 1)*A[i];
		u = (u / A[i] + 1)*A[i] - 1;
	}
	std::cout << l << " " << u << std::endl;
	return 0;
}

Measured memory_bytes: 1024
n = int(input())
A = []
B = []
for i in range(n):
  a,b = map(int,input().split())
  A.append(a)
  B.append(b)

C = zip(B, A)
C = sorted(C)
B, A = zip(*C)
ans = 1
t = 0
for i, j in zip(A, B):
    t += i
    if t <= j:
        continue
    else:
        print("No")
        ans = 0
        break
if ans:
    print("Yes")



Measured memory_bytes: 49144
import java.util.ArrayList;
import java.util.Scanner;
 
public class Main{
    public static void main(String[] args){
        ArrayList<Integer> A = new ArrayList<Integer>();
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
 
        for(int i=0;i<N;i++){
            A.add(scanner.nextInt());
        }
        printList(A,N);
        insertionSort(A,N);
    }
     
    static void insertionSort(ArrayList<Integer> A,int N){
        for(int i=1;i<N;i++){
            int v = A.get(i);
            int j=i-1;
            while(j>=0 && (v < A.get(j))){
                A.set(j+1,A.get(j));
                j--;
            }
            A.set(j+1, v);
            printList(A,N);
        }
    }
    static void printList(ArrayList<Integer> A,int N){
        StringBuilder builder = new StringBuilder();
        for(int i=0;i<N;i++){
            if(i>0){
                builder.append(" ");
            }
            builder.append(A.get(i));
        }
        System.out.println(builder);
    }
}

Measured memory_bytes: 29068
#include <iostream>
using namespace std;
int main(){
    int n,data;
    int count[7];
    while(true){
        cin >> n;
        if (n == 0) {
            break;
        }
        for(int i = 0; i < 7; ++i) {
            count[i] = 0;
        }
        for(int i = 0; i < n; ++i){
            cin >> data;
            for(int j = 0; j < 7; ++j){
                if ((data/10) == j) {
                    ++count[j];
                    break;
                }
            }
            if (data>=70) {
                ++count[6];
            }
        }
        for (int i = 0; i < 7; i++) {
            cout << count[i] << endl;
        }
    }
}

Measured memory_bytes: 1160
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i = (b-1);i>=(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

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

  int n;
  cin >> n;
  vector<int> p(n);
  REP(i,n) cin >> p[i];
  int min = p[0];
  int ans = 1;
  FOR(i,1,n){
    if(min > p[i]) {
      min = p[i];
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1792
#include "bits/stdc++.h"
using namespace std;
#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define LLINF (long long) 1e18//1234567890987654321
#define INF 1234567890l
#define pb push_back
#define ins insert
#define f first
#define s second	
#define db 0
#define EPS (1e-7)    //0.0000001 the value
#define PI (acos(-1))
#define MAXN 300006
#define MAXK 26
#define MAXX 15000006
#define ll long long int
#define ld long double
#define rep0(kk, l1, l2)for(ll kk = l1; kk < l2; kk++)
#define rep1(kk, l1, l2)for(ll kk = l1; kk <= l2; kk++)
#define foritr(itr, A) for(set<ll>::iterator itr = A.begin(); itr != A.end(); itr++)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
#define FOR(ii, ss, ee) for(ll ii = ss; ii < ee; ii++)
#define cr(x) cerr << #x << " = " << x << "\n";
#define crA(x, A) cerr << #x << " = " << A[x] << "\n";
#define spacing if(db)cout << " ";
#define space " "
#define cbr cout << "hi\n"
#define mmst(x, v) memset((x), v, sizeof ((x)));
#define bg(ms) (*ms.begin())
#define ed(ms) (*prev(ms.end(), 1))
#define addedge(a, b, c, v) v[(a)].pb(pi((b), (c))); v[(b)].pb(pi((a), (c)))
#define ph push
#define btinpct(x) __builtin_popcountll(x)
#define p2(x) (1LL<<(x))
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
typedef pair <ll, ll> pi;
typedef pair <ll, pi> spi;
typedef pair <pi, pi> dpi;
inline ll rand(ll x, ll y) { ++y; return (rng() % (y-x)) + x; } //inclusivesss
ll n, m, A[11];
string dp[10006];
bool cmp(string x, string y)
{
	if(y[0]=='#') return 0;
	if(x.length() != y.length()) return x.length() < y.length();
	return x < y;
}
ll c [] = {0,2,5,5,4,5,6,3,7,6};
int main()
{
	FAST
	cin >> n >> m;
	FOR(i,0,m) cin >> A[i];
	FOR(i,0,10002) dp[i]="#";
	dp[0] = "";
	FOR(i,0,10002)
	{
		FOR(j,0,m)
		{
			if(i >= c[A[j]]) if(cmp(dp[i], dp[i-c[A[j]]] + (char)(A[j]+48))) dp[i] = dp[i-c[A[j]]] + (char)(A[j]+48);
		}
	}
	cout << dp[n] << '\n';
}


Measured memory_bytes: 45056
n=int(input())
l=list(map(int,input().split()))
l1=sorted(l, reverse=True)
l_a=[]
l_b=[]
for i in range(n):
  if i%2==0:
    l_a.append(l1[i])
  else:
    l_b.append(l1[i])
print(sum(l_a)-sum(l_b))

Measured memory_bytes: 3064
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String b = scan.next();
        if(b.equals("A")) System.out.println("T");
        else if(b.equals("T")) System.out.println("A");
        else if(b.equals("C")) System.out.println("G");
        else System.out.println("C");
        scan.close();
    }
}

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

int main(){
  int n;
  cin >> n;
  for(int i=0; i<n; i++){
    int max=0, min=0, p, q, m;
    cin >> m;
    cin >> p;
    for(int j=0; j<m-1; j++){
      cin >> q;
      if(q-p >= 0){
        if(max < (q-p))max=(q-p);
      }
      else{
        if(min < -(q-p))min=-(q-p);
      }
      p=q;
    }
    cout << max << ' ' << min << endl;
  }

  return 0;
}

Measured memory_bytes: 1160
N,M = map(int,input().split())

L = []
R = []
for _ in range(M):
  x,y = map(int,input().split())
  L.append(x)
  R.append(y)

if min(R) >= max(L):
  print(min(R)-max(L)+1)
else:
  print(0)

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

int get_digit(int N){
    int cnt=0;
    while(1){
        if(N==0){
            break;
        }
        N /=10;
        cnt++;
    }

    return cnt;
}

int main(){
    int N;
    cin >> N;
    int cnt=0;

    for(int i=1 ;i<=N;i++){
        // if( get_digit(i)%2 == 1 ){
        //     cnt++;
        // };
        if(to_string(i).size()%2 == 1){
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (ll i=(ll)from; i<(ll)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(int x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { int d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }

// ----------------------------------------------------------------------
// ----------------------------------------------------------------------

struct SegTree {
  int size;
  vector<ll> pos;
  SegTree(ll N) { size = 1; while(size<N) size<<=1; pos.resize(2*size,0); }
  ll operator[](const ll &x) const { return pos[x+size]; }

  void build() { per(i,size) operate(i); }
  void set(ll x, const ll v) { pos[x+size] = v; }
  void update(ll x, const ll v) { set(x,v); x+=size; while (x>>=1) operate(x); }
  ll query(ll a, ll b) {
    ll L = LLINF, R = LLINF;
    for (a+=size, b+=size; a<b; a>>=1, b>>=1) {
      if (a&1) { L = q(L,pos[a]); a++; }
      if (b&1) { b--; R = q(pos[b],R); }
    }
    return q(L,R);
  }
  void operate(ll i) { pos[i] = min(pos[i*2],pos[i*2+1]); }
  ll q(ll x, ll y) { return min(x,y); }
};

// ----------------------------------------------------------------------
// ----------------------------------------------------------------------

int main() {
  ll N, Q; cin >> N >> Q;

  SegTree stx(N-2); rep(i,N-2) stx.update(i,N-2);
  SegTree sty(N-2); rep(i,N-2) sty.update(i,N-2);

  ll result = (N-2)*(N-2);
  rep(i,Q) {
    ll q, x; cin >> q >> x; x-= 2;
    if (q==1) {
      ll num = stx.query(x,N-2);
      result -= num;
      sty.update(num-1,min(sty[num-1],x));
    }
    else {
      ll num = sty.query(x,N-2);
      result -= num;
      stx.update(num-1,min(stx[num-1],x));
    }
    // cout << result << endl;
    // rep(i,N) cout << stx[i] << " "; cout << endl;
    // rep(i,N) cout << sty[i] << " "; cout << endl;
  }

  cout << result << endl;
  return 0;
}

Measured memory_bytes: 11436
#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
const int mex=5000001;
#define ll long long 
#define test int t;cin>>t;while(t--)
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fo(i,a,n) for(int i=a;i<n;i++)
#define rfo(i,a,b) for(int i=a;i>=b;i--)
#define bg begin()
#define en end()
#define fi first
#define se second
#define ub upper_bound
#define lb lower_bound
#define pb push_back
#define veci vector<int>
#define veclli vector<long long int> 
#define all(x) x.begin(),x.end()
#define sci(x) scanf("%d",&x);
#define scc(x) scanf("%c",&x);
#define scs(x) scanf("%s",x);
#define debug(arr,n) for(int i=0;i<n;i++) printf("%d ",arr[i]);
#define sz(x) x.size()
#define loop(x) for(auto it=x.begin();it!= x.end();it++) 

int main()
{
  int n;
  cin>>n;
  map<ll int,int> mp;
  fo(i,0,n)
  {
      ll int x;
      cin>>x;
      mp[x]++;
  }
  if(sz(mp)==n) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}

Measured memory_bytes: 12800
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007

#define w(t) int t; cin>>t;while(t--)
int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
//w(t) {
    int a , b , c , d;
    cin >> a >> b >> c >> d;
    //int flag = 0 ;
    while (1) {
        //T
        c -= b;
        //Aoki

        if (c <= 0) {
            cout << "Yes" << "\n";
            break;
        }

        a -= d;

        if ( a <= 0) {
            cout << "No" << "\n";
            break;

        }


    }

    return 0;

}





Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define LL long long
#define PB push_back
using namespace std;
const LL mod = 1000 * 1000 * 1000 + 7;
const LL ob = (mod + 1) >> 1;

int main()
{
	string s;
	LL ans = 0;
	cin >> s;
	for(auto &x : s)
		x -= '0';
	LL sz = s.size() - 1;
	for(LL i = 0; i < (1 << sz); i++)
	{
		LL suma = 0;
		LL x = s[0];
		for(LL j = 0; j < sz; j++)
		{
			if(i & (1 << j))
			{
				suma += x;
				x = s[j + 1];
			}
			else
			{
				x *= 10;	
				x += s[j + 1];
			}
		}
		suma += x;
		ans += suma;
	}
	cout << ans;
}




Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<unordered_map>
#include<algorithm>
#include<cmath>
#include<climits>
#include<queue>
#include<set>
typedef long long ll;
using namespace std;
void trace(string&s,string& t, int i, int j,vector<vector<int>>& dp,string& res){
    // cout<<"i: "<<i<<endl;
    // cout<<"j: "<<j<<endl;
    if(i==0 || j==0){
        return ;
    }
    if(s[i-1]==t[j-1]){
        // cout<<s[i-1];
        res += s[i-1];
        trace(s,t,i-1,j-1,dp,res);
    }
    else if(dp[i][j]==dp[i-1][j]){
        trace(s,t,i-1,j,dp,res);
    }
    else{
        trace(s,t,i,j-1,dp,res);
    }
}

int main(){
    string s,t;
    cin>>s>>t;
    vector<vector<int>>dp(s.size()+1,vector<int>(t.size()+1,0));
    string res = "";
    for(int i=0;i<=s.size();i++){
        for(int j=0;j<=t.size();j++){
            if(i==0 || j==0){
                dp[i][j] = 0;
            }
            else if(s[i-1]==t[j-1]){
                dp[i][j] = dp[i-1][j-1] + 1;
            }
            else{
                dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
            }
        }
    }
    trace(s,t,s.size(),t.size(),dp,res);
    reverse(res.begin(),res.end());
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 35584
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(ll i = a; i < b; i++)
#define rrep(i, a, b) for(int i = b - 1; i >= a; i--)
typedef long long ll;
template<int MOD> struct ModInt {
    static const int Mod = MOD; unsigned x; ModInt() : x(0) { }
    ModInt(signed sig) { x = sig < 0 ? sig % MOD + MOD : sig % MOD; }
    ModInt(signed long long sig) { x = sig < 0 ? sig % MOD + MOD : sig % MOD; }
    int get() const { return (int)x; }
    ModInt &operator+=(ModInt that) { if ((x += that.x) >= MOD) x -= MOD; return *this; }
    ModInt &operator-=(ModInt that) { if ((x += MOD - that.x) >= MOD) x -= MOD; return *this; }
    ModInt &operator*=(ModInt that) { x = (unsigned long long)x * that.x % MOD; return *this; }
    ModInt &operator/=(ModInt that) { return *this *= that.inverse(); }
    ModInt operator+(ModInt that) const { return ModInt(*this) += that; }
    ModInt operator-(ModInt that) const { return ModInt(*this) -= that; }
    ModInt operator*(ModInt that) const { return ModInt(*this) *= that; }
    ModInt operator/(ModInt that) const { return ModInt(*this) /= that; }
    ModInt inverse() const { long long a = x, b = MOD, u = 1, v = 0;
        while (b) { long long t = a / b; a -= t * b; std::swap(a, b); u -= t * v; std::swap(u, v); }
        return ModInt(u); }
    bool operator==(ModInt that) const { return x == that.x; }
    bool operator!=(ModInt that) const { return x != that.x; }
    ModInt operator-() const { ModInt t; t.x = x == 0 ? 0 : Mod - x; return t; }
};
template<int MOD> ostream& operator<<(ostream& st, const ModInt<MOD> a) { st << a.get(); return st; };
template<int MOD> ModInt<MOD> operator^(ModInt<MOD> a, unsigned long long k) {
    ModInt<MOD> r = 1; while (k) { if (k & 1) r *= a; a *= a; k >>= 1; } return r; }
typedef ModInt<1000000007> mint;

const int MAXk = 61;
const ll MOD = 1e9 + 7;

int main(){
    ll N; cin >> N;
    vector<ll> A(N);
    mint ans = 0;
    rep(i, 0, N) cin >> A[i];

    rep(i, 0, MAXk){
        mint t = 0, f = 0;
        rep(j, 0, N){
            if((1LL << i) & A[j]) t = t + 1;
            else f = f + 1;
        }
        //cout << i << " "<< t << " " << f << endl;
        ans = (ans + t * f * (1LL << i));
    }
    cout << ans << endl;
}

Measured memory_bytes: 2560