akhauriyash/Code-Regression huggingface dataset:
/**
 *    author:  math2do
 *    created: 05.04.2020 14:16:10
**/

#include <bits/stdc++.h>

using namespace std;

const long long pinf = std::numeric_limits<long long>::max();

#define min(...) min({__VA_ARGS__})

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long n, k;
  cin >> n >> k;
  long long rem = (n % k);
  long long ans = 0;
  if (rem != 0) {
    ans = pinf;
    long long mul = (n / k) + 1;
    long long age = mul * k;
    ans = min(ans, rem, age - n);
  }
  cout << ans << endl; 
  return 0;
}


Measured memory_bytes: 384
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

    static class CReplacingInteger {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long n = in.nextLong();
            long k = in.nextLong();
            long mod = n % k;
            out.println(Math.min(mod, k - mod));
        }

    }
}



Measured memory_bytes: 25172
#include<bits/stdc++.h>
#define MAXN 1100000
using namespace std;

inline void read(long long &x){
    char ch;
    bool flag=false;
    for (ch=getchar();!isdigit(ch);ch=getchar())if (ch=='-') flag=true;
    for (x=0;isdigit(ch);x=x*10+ch-'0',ch=getchar());
    x=flag?-x:x;
}

inline void read(int &x){
    char ch;
    bool flag=false;
    for (ch=getchar();!isdigit(ch);ch=getchar())if (ch=='-') flag=true;
    for (x=0;isdigit(ch);x=x*10+ch-'0',ch=getchar());
    x=flag?-x:x;
}


inline void write(long long x){
    static const long long maxlen=100;
    static char s[maxlen];
    if (x<0) {   putchar('-'); x=-x;}
    if(!x){ putchar('0'); return; }
    long long len=0; for(;x;x/=10) s[len++]=x % 10+'0';
    for(long long i=len-1;i>=0;--i) putchar(s[i]);
}


long long n , m;

int main(){
    read(n);    read(m);
    if ( m==0 )
        {
            cout<<1ll*n*n<<endl;
            return 0;
        }
    long long ans=0;
    for (int i=m+1;i<=n;i++)
    {
        ans+=n/i*(i-m)+max( n%i-m+1 ,  0ll );
        //cout<<n/i*(i-m)+max( n%i-m+1 ,  0ll )<<endl;
    }
    cout<<ans<<endl;
    return 0;
}


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

int main()
{
    long long int x;
    cin >> x;

    int ans = 0;
    
    long long int y = 100;
    while (1) {
        if (y >= x)
            break;
        else {
            y = y * 1.01;
            ans++;
        }
    }

    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 3644
s = gets.chomp.chars

def rec(d, f, s)
  ret = 0
  if d == s.size
    ret = f.split('+').map(&:to_i).inject(:+)
  else
    f = f.dup
    f << s[d]
    ret += rec(d + 1, f, s)
    unless d == s.size - 1
      f << '+'
      ret += rec(d + 1, f, s)
    end
  end
  ret
end

p rec(0, '', s)

Measured memory_bytes: 1788
#include<iostream>
using namespace std;
int main()
{
  int h,m,s;

  cin >>s;

  h=s/3600;
  s=s%3600;
  s%=3600;
  m=s/60;s%=60;
  cout<<h<<":"<<m<<":"<<s<<endl;
  return 0;

}

Measured memory_bytes: 3116
S = list(input())
dir_set = set()
for s in S:
    dir_set.add(s)

if 'N' in dir_set and 'S' in dir_set and 'W' in dir_set and 'E' in dir_set:
    ### "NSFW" 全部ある場合    
    print("Yes")
elif not 'N' in dir_set and not 'S' in dir_set and 'W' in dir_set and 'E' in dir_set:
    ### "NS" はなく "EW" が両方ある場合
    print("Yes")
elif 'N' in dir_set and 'S' in dir_set and not 'W' in dir_set and not 'E' in dir_set:
    ### "NS" が両方あり "EW" がない場合
    print("Yes")
else:
    ### 上記以外
    print("No")

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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

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

  int n; std::cin >> n;
  vi L(n); rep(i, n) std::cin >> L[i];
  sort(rng(L));
  ll ans = 0;
  rep(i, n) srep(j, i+1, n) {
    int l = j, r = n;
    int len = L[i] + L[j];
    while (r-l > 1) {
      int m = (l+r) / 2;
      if (L[m] < len) l = m;
      else r = m;
    }
    ans += l - j;
  }
  std::cout << ans << "\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, begin, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    int r, D, x;
    cin >> r >> D >> x;
    vector<ll> X(11);
    X.at(0) = x;
    rep(i, 1, 11)
    {
        X.at(i) = r * X.at(i - 1) - D;
        cout << X.at(i) << endl;
    }
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#define SF scanf
#define PF printf
#define MAXN 15
using namespace std;
typedef long long ll;
int h,w,n;
int gx[10]={-2,-1,0};
int gy[10]={-2,-1,0};
map<pair<int,int> ,int> used;
ll ans[MAXN];
int main(){
	SF("%d%d",&h,&w);
	SF("%d",&n);
	for(int i=1;i<=n;i++){
		int x,y;
		SF("%d%d",&x,&y);
		for(int i=0;i<3;i++)
			for(int j=0;j<3;j++){
				int xx=x+gx[i];
				int yy=y+gy[j];
				if(xx<1||yy<1||xx+2>h||yy+2>w)
					continue;
				used[make_pair(xx,yy)]++;	
			}
	}
	map<pair<int,int>,int>::iterator it=used.begin();
	for(;it!=used.end();it++){
		ans[it->second]++;
	}
	ll sum=0;
	for(int i=1;i<=9;i++)
		sum+=ans[i];
	ans[0]=(h-2ll)*(w-2ll)-sum;
	for(int i=0;i<=9;i++)
		PF("%lld\n",ans[i]);
}

Measured memory_bytes: 56448
N = int(input())

xy_list = list()

P = tuple(map(int, input().split() ))
Q = tuple(map(int, input().split() ))

# print(P)
# print(Q)
A = tuple( i+1 for i in range(N) )
# print(A)

from itertools import permutations
A_perm = list(permutations(A, N) )

# print(A_perm)

p_num = N*2 # ありえない数を入れとく
q_num = N*2 # ありえない数を入れとく


for i, a in enumerate(A_perm):
    if tuple(a) == P:
        p_num = i
    if tuple(a) == Q:
        q_num = i

print(abs(q_num-p_num))


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

int main(){
	int N;
	cin >> N;
	vector<int> A(N);
	for(int i=0; i<N; i++) cin >> A.at(i);

	long money=1000;
	for(int i=0; i<N-1; i++){
		if(A.at(i)<A.at(i+1)){
			long stoks = money/A.at(i);
			money+=stoks*(A.at(i+1)-A.at(i));
		}
	}

	cout << money << endl;
	return 0;
}


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

public class Main {

	public static void main(String[] args) 
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		int[] a = new int[n];
		for(int i = 0; i < n; i++)
			a[i] = sc.nextInt();
		Arrays.sort(a);
		int shouldbe = 0;
		boolean flag = n%2==1;
		if(n%2==0)shouldbe=1;
		for(int i = 0; i < n; i++)
		{
			if(shouldbe != a[i])
			{
				System.out.println(0);
				return;
			}
			
			if(flag)
				shouldbe += 2;
			flag = !flag;
		}
		
		long an = 1;
		long MOD = 1000000007;
		for(int i = 0; i < n/2; i++)
		{
			an = (an*2)%MOD;
		}
		System.out.println(an);

	}

}


Measured memory_bytes: 50952
#include<stdio.h>

int main(){
   int K,A,B;
     scanf("%d",&K);
     scanf("%d %d",&A,&B);
     int i; 
for ( i = A; i <= B; i++){
   
    if (i % K == 0)
    {
     printf("OK");
     break;
    }
}
if(i>B){
printf("NG");
}


return 0;
}


Measured memory_bytes: 1728
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n = int(readline())
    s = str(readline().rstrip().decode('utf-8'))
    ls1 = [0] * 1000
    ls2 = [0] * 1000
    ls3 = [0] * 1000
    for i in range(n):
        t = [s[i]]
        if not ls1[int("".join(t))]:
            ls1[int("".join(t))] = True
            for j in range(i + 1, n):
                t = [s[i], s[j]]
                if not ls2[int("".join(t))]:
                    ls2[int("".join(t))] = True
                    for k in range(j + 1, n):
                        t = [s[i], s[j], s[k]]
                        ls3[int("".join(t))] = True
    print(ls3.count(True))


if __name__ == '__main__':
    solve()


Measured memory_bytes: 42332
//============================================================================
// Name        : abc116b.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<cmath>
#include<list>
#include<set>
#include<map>

using namespace std;

int main() {
	int s;
	int n;
	cin >> s;
	n = s;
	map<int, bool> mp;
	mp[n] = true;
	for(int i = 2; i <= 1000000; ++i){
		if(n % 2 == 0){
			n = n / 2;
		}
		else {
			n = 3 * n + 1;
		}
		if(mp[n] == true){
			cout << i << endl;
			return 0;
		}
		mp[n] = true;
	}


	return 0;
}


Measured memory_bytes: 256
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from heapq import heappop
import heapq

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, K = MAP()
V = LIST()
V = deque(V)

# R = A + B
max_R = min(N, K)
# A, B 全探索
ans = 0
for R in range(1, max_R+1):
    for i in range(0, R+1):
        minus_count = 0

        v = deepcopy(V)
        #print("v:", v)
        pocket = []
        heapq.heapify(pocket)
        A = i
        B = R - i
        #print("a,b:", A, B)
        for a in range(A):
            a_pop = v.popleft()
            if a_pop < 0:
                minus_count += 1
            pocket.append(a_pop)
        for b in range(B):
            b_pop = v.pop()
            if b_pop < 0:
                minus_count += 1
            pocket.append(b_pop)
        # abundant abandon
        dump = K - R
        # pocketの中に捨てなくていいものもあるとき
        dump_time = min(minus_count, dump)
        #print("minus_count:", minus_count)
        #print("time:", dump_time)
        #print("pocket_b:", pocket)

        pocket.sort(reverse=True)
        # OK
        if dump_time > 0:
            for d in range(dump_time):
                x = pocket.pop()
        #        print("pop", x)
        
        # NG
        #if dump_time > 0:
        #    for d in range(dump_time):
        #        x = heappop(pocket) 
        #        print("X", x)

        wa = sum(pocket)
        #print("pocket_c:", pocket)
        if ans <= wa:
            ans = wa
        #print(ans)
print(ans)
        





Measured memory_bytes: 5204
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <cmath>
#include <limits>
#include <bitset> 
#include <iterator> 
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include<deque>
#include <regex>
#include <list>
#include <unordered_set>
#define rep(i,n) for(ll i=0;i<(n); ++i)
#define per(i,n) for(ll i=n-1;i>=0; --i)
#define all(x) (x).begin(),(x).end()
#define _GLIBCXX_DEBUG
using namespace std;
template<class T> inline bool dpmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool dpmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
typedef long long ll;
const ll MOD = 1000000007;
ll getDigit(ll n) {
	ll cnt = 0;
	while (n != 0) {
		n /= 10;
		cnt++;
	}
	return cnt;
}
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
typedef pair<double, long long> pair_t;
bool comp(const pair_t& a, const pair_t& b) {
	if (a.first == b.first)return  a.second > b.second;
	else {
		return a.first > b.first;
	}
}

int main() {
	vector<ll>dp(pow(10, 7));
	ll n;
	cin >> n;
	vector<ll>h(n);
	rep(i, n)cin >> h[i];
	rep(i, n)dp[i] = INF;

	dp[0] = 0;
	dp[1] = abs(h[1] - h[0]);
	for (ll i = 2; i < n; i++) {
		dpmin(dp[i], min(dp[i - 1] + abs(h[i] - h[i - 1]),dp[i - 2] + abs(h[i] - h[i - 2])));
	}
	cout << dp[n - 1] << endl;
}


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

int main()
{
    long a, b;
    cin >> a >> b;
    if(b < 0)
    {
        if((b-a) % 2 == 0)
            cout << "Negative\n";
        else 
            cout << "Positive\n";
    }
    else if(a <= 0)
    {
        cout << "Zero\n";
    }
    else 
        cout << "Positive\n";
}




Measured memory_bytes: 256
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <assert.h>
#include <string.h>

using namespace std;

namespace
{
	int n, k;
	int x1[50], yy[50], d1[50], x2[50], y2[50], d2[50];
	int cx1[50], cy1[50], cd1[50], cx2[50], cy2[50], cd2[50];

	int compd[123][123][123];
}

//w1,w2???????????????????????§???????????§???????????????
vector<int> compress(int *w1, int *w2)
{
	vector<int>ws;
	for (int i = 0; i < n; ++i)
	{
		ws.push_back(w1[i]);
		ws.push_back(w2[i]);
	}
	sort(ws.begin(), ws.end());
	ws.erase(unique(ws.begin(), ws.end()), ws.end());
	for (int i = 0; i < n; ++i)
	{
		w1[i] = find(ws.begin(), ws.end(), w1[i]) - ws.begin();
		w2[i] = find(ws.begin(), ws.end(), w2[i]) - ws.begin();
	}
	return ws;
}

int main()
{
	scanf("%d %d", &n, &k);
	for (int i = 0; i < n; ++i)
	{
		scanf("%d %d %d %d %d %d", x1 + i, yy + i, d1 + i, x2 + i, y2 + i, d2 + i);
	}
	
	auto xsv = compress(x1, x2);
	auto ysv = compress(yy, y2);
	auto dsv = compress(d1, d2);
	int xs = xsv.size();
	int ys = ysv.size();
	int ds = dsv.size();

	memset(compd, 0, sizeof(compd));

	//??????????¨????
	for (int i = 0;i < n;++i)
	{
		const int hash[8][3] = { {0,0,0},{0,0,1},{0,1,0},{0,1,1},{1,0,0},{1,0,1},{1,1,0},{1,1,1}, };
		for (int p = 0; p < 8; ++p)
		{
			compd
				[hash[p][0] ? x1[i] : x2[i]]
				[hash[p][1] ? yy[i] : y2[i]]
				[hash[p][2] ? d1[i] : d2[i]] =
					(hash[p][0]^hash[p][1]^hash[p][2]) ? 1 : -1;
		}
	}
	
	//?´????????????¨???
	for (int x = 0; x < xs; ++x)
	{
		for (int y = 0; y < ys; ++y)
		{
			for (int d = 1; d < ds; ++d)
			{
				compd[x][y][d] += compd[x][y][d - 1];
			}
		}
	}
	for (int x = 0; x < xs; ++x)
	{
		for (int y = 1; y < ys; ++y)
		{
			for (int d = 0; d < ds; ++d)
			{
				compd[x][y][d] += compd[x][y - 1][d];
			}
		}
	}
	for (int x = 1; x < xs; ++x)
	{
		for (int y = 0; y < ys; ++y)
		{
			for (int d = 0; d < ds; ++d)
			{
				compd[x][y][d] += compd[x - 1][y][d];
			}
		}
	}

	long long ans = 0;
	for (int x = 0; x < xs; ++x)
	{
		for (int y = 0; y < ys; ++y)
		{
			for (int d = 0; d < ds; ++d)
			{
				assert(compd[x][y][d] >= 0);
				if (compd[x][y][d] >= k)
				{
					long long tmp = (long long)(xsv[x + 1] - xsv[x]) * (long long)(ysv[y + 1] - ysv[y]) * (long long)(dsv[d + 1] - dsv[d]);
					ans += tmp;
				}
			}
		}
	}
	printf("%lld\n",ans);

	return 0;
}

Measured memory_bytes: 9976
n, k = map(int, input().split())
a = list(map(int, input().split()))
mod = pow(10, 9) + 7
numcnt = [0] * 2001
for i in a:
    numcnt[i] += 1
for i in range(1, 2001):
    numcnt[i] += numcnt[i - 1]
ans = 0
for i in range(n):
    cnt = 0
    for j in range(i + 1, n):
        if a[i] > a[j]:
            cnt += 1
    ans += cnt * k
    ans %= mod
    ans += numcnt[a[i] - 1] * (k * (k - 1) // 2)
    ans %= mod
print(ans)

Measured memory_bytes: 9280
#include<vector>
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include <iostream>
#include <algorithm>
#include <map>
#include <cmath>
#include<queue>
#include <sstream>
#include <set>

const long long INF = 1000000007;
using namespace std;
typedef long long llong;

//int isalpha(char ch): ch がアルファベットなら true を返す
//int isdigit(char ch): ch が数字なら true を返す
//int islower(char ch): ch が小文字なら true を返す
//int isupper(char ch): ch が大文字なら true を返す
//int tolower(char ch): ch の小文字を返す
//int toupper(char ch): ch の大文字を返す

//string型
//size()	文字数を返す
//Insert()	（指定した場所に）文字・文字列を挿入する
//erase()	（指定した場所の）文字・文字列を削除する
//clear()	すべての文字を削除する
//substr()	文字列の（指定した）部分文字列を返す
//replace()	（指定した）部分文字列を新しい文字列に置換する
//c_str()変換
//文字列の比較は、<=や==などを使え
//replace関数を使い、簡単に文字列を置換
//リバース関数：reverse(str.begin(), str.end());
//map<type, type> dict;で宣言
//グラフ理論用変数
//vector<vector<llong> > graph(N);

//ソート
//降順sort(v.begin(), v.end(), std::greater<Type>());

//大文字から小文字へんかん
//w[i] = w[i]-'A'+'a';

//vector
//assignメソッド　引数：サイズ、値
//与えられたサイズと値でvectorを初期化する

//queueクラス
//find()次に取り出す値の表示をする。
//pop()値を取り出す。戻り値はなし
//push()キューに値をプッシュする

//priority_queueクラス

//切り上げ
//ceil
//floor

int main(){
    llong N;
    cin >> N;
    vector<llong> A(N,0);
    for(int i=0; i<N; i++){
        cin >> A[i];
    }
    llong ans=0;
    unsigned char flg=0;
    while(1){
        for(int i=0;i<N; i++){
            if(A[i]%2==0){
                A[i] = A[i]/2;
            }else{
                flg = 1;
            }
        }
        if(flg==0){
            ans++;
        }else{
            break;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3160
# coding: utf-8
# Your code here!

n = input()

n = int(n[-1])

if n == 2 or n == 4 or n == 5 or n == 7 or n == 9:
    print('hon')
elif n == 0 or n == 1 or n == 6 or n == 8:
    print('pon')
else:
    print('bon')


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

#define int long long int
#define ff first
#define ss second
#define pb push_back
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const int mod = 1e9 + 7;
const int cmod = 998244353;
const int N = 4e5 + 5;
const int inf = 1e16 + 2;


/*
 */
void solve(int Case) {
    int a , b , c , k;
    cin >> a >> b >> c >> k;
    while(b <= a and k) {
        b *= 2LL;
        k --;
    }
    while(c <= b and k) {
        c *= 2LL;
        k --;
    }
    if(a < b and b < c) {
        cout << "Yes" << '\n';
    }
    else cout << "No" << '\n';
    
}
/*
 */

int32_t main()
{
    fastio
    int testcase = 1;
    //cin >> testcase;
    int Case = 1;
    while(testcase --) {
        solve(Case ++);
    }
    return 0;
}
 



Measured memory_bytes: 3644
s = str(input())

if 1 <= int(s[0]+s[1]) <= 12:
    if  1 <= int(s[2]+s[3]) <= 12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
elif  1 <= int(s[2]+s[3]) <= 12:
    print('YYMM')
else:
    print('NA')


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 vector<int> vec{0,1,3,1,2,1,2,1,1,2,1,2,1};
 int a,b,c;
 cin>>a>>b>>c;
 
 if(a<=c&&c<=b)
 	cout<<"Yes"<<endl;
 else
 	cout<<"No"<<endl;
 
 
 return 0;
 }

Measured memory_bytes: 256
n,a,b = list(map(int,input().split()))
sum = 0
for i in range(n + 1):
    sum_i = 0
    for k in str(i):
        sum_i = sum_i + int(k)
    if a<= sum_i and sum_i <= b:
        sum = sum + i
print(sum)


Measured memory_bytes: 2940
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>

using namespace std;

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

long long int INF = 1e18;
long long int MOD = 1e9 + 7;

int main(){
	
	int N, K;
	cin >> N >> K;
	
	int ans = 0;
	int S = 0;
	int cur = 0;
	
	for(int i = 0; i < N; i++){
		cur += 1;
		if(S <= cur * K){
			ans += 1;
			S += cur;
			cur = 0;
		}
	}
	
	cout << ans << endl;
	
	return 0;
}



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

int main(){
    //input
    long long H,W;
    cin >> H >> W;
    long long c[10][10];
    long long i,j,k;
    for(i=0; i<10; i++){
        for(j=0; j<10; j++){
            cin >> c[i][j];
        }
    }
    long long A[H][W];
    for(i=0; i<H; i++){
        for(j=0; j<W; j++){
            cin >> A[i][j];
        }
    }

    //calc
    long long sum=0;
    for(k=0; k<10; k++){
        for(i=0; i<10; i++){
            for(j=0; j<10; j++){
                c[i][j] = min(c[i][j],c[i][k]+c[k][j]);
            }
        }
    }
    for(i=0; i<H; i++){
        for(j=0; j<W; j++){
            if(A[i][j]>=0){
                sum += c[A[i][j]][1];
            }
        }
    }
    //answer
    cout << sum << endl;
    system("pause");
    return 0;
}

Measured memory_bytes: 760
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using Graph = vector<vector<int>>;
const int INF = 1e9 + 1;
const ll LLINF = 1e18;
const int MOD = 1e9 + 7;

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

    int N;
    cin >> N;
    vector<int> a(N);
    for (int i = 0; i < N; ++i)
        cin >> a[i];

    int minsum = INF;
    for (int i = -100; i <= 100; ++i) {
        int sum = 0;
        for (int j = 0; j < N; ++j)
            sum += (a[j] - i) * (a[j] - i);
        minsum = min(minsum, sum);
    }

    cout << minsum << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std ;
#define ll long long int 
#define pb push_back 
#define mp make_pair 
#define pii pair <int , int > 
#define pll pair < ll , ll >
int main(){
	ios_base::sync_with_stdio(false) ;
	cin.tie(NULL) ;
	string s ;
	cin >> s ;
	int n = s.length() ;
	int i = 1 ;
	vector <string> k ;
	string tt ;
	tt.pb(s[0]) ; 
	k.pb(tt) ;
	int j = 0 ;
	while(i < n){
		string t ;
		t.pb(s[i]) ;
		i++ ;
		while(i < n && k[j] == t){
			t.pb(s[i]) ;
			i++ ;
		}
		if(k[j] != t){
			// cout << k[j] << " " << t << '\n' ;
			k.pb(t) ;
		}
		j++ ;
	}
	cout << k.size() ;
}

Measured memory_bytes: 11016
#include <bits/stdc++.h>
using namespace std;
typedef  long long int ll;
#define len(x)           x.length()
#define pb                push_back
#define mp                make_pair
#define all(x)            (x).begin(),(x).end()
#define M                 1000000007
#define MM                998244353
#define ff                first
#define ss                second
#define pii               pair<int,int>
#define mii               map<int,int>
#define psi               pair<string,int>
#define pis               pair<int,string>
#define GCD(x,y)          (__gcd((x), (y)))
#define LCM(x,y)          (((x)/__gcd((x), (y)))*(y))
#define mem0(x)           memset(x, 0, sizeof (x))
#define mem1(x)           memset(x, -1, sizeof (x))
#define IOS ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);

//coded by Avijit Mandal

int main(){
   IOS;
   ll n,x,y,i,j,a,b,c;
   cin>>x>>y>>a>>b>>c;
   ll A[a],B[b],C[c];
   for(i=0;i<a;i++)cin>>A[i];
   for(i=0;i<b;i++)cin>>B[i];
   for(i=0;i<c;i++)cin>>C[i];
   sort(A,A+a,greater<int>());
   sort(B,B+b,greater<int>());
   vector<ll> res;
   for(i=0;i<x;i++)res.pb(A[i]);
   for(i=0;i<y;i++)res.pb(B[i]);
   for(i=0;i<c;i++)res.pb(C[i]);
   sort(res.begin(),res.end(),greater<int>());
   ll sum=0;
   for(i=0;i<x+y;i++){
      sum+=res[i];
   }
   cout<<sum<<"\n";



}


Measured memory_bytes: 8304
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef long double D;
typedef complex<D> P;
#define F first
#define S second
const ll MOD=1000000007;
//const ll MOD=998244353;

template<typename T,typename U>istream & operator >> (istream &i,pair<T,U> &A){i>>A.F>>A.S; return i;}
template<typename T>istream & operator >> (istream &i,vector<T> &A){for(auto &I:A){i>>I;} return i;}
template<typename T,typename U>ostream & operator << (ostream &o,const pair<T,U> &A){o<<A.F<<" "<<A.S; return o;}
template<typename T>ostream & operator << (ostream &o,const vector<T> &A){ll i=A.size(); for(auto &I:A){o<<I<<(--i?" ":"");} return o;}


ll mod_pow(ll a,ll x){
  ll ret=1;
  while(x>0){
    if(x&1){(ret*=a)%=MOD;}
    (a*=a)%=MOD;
    x>>=1;
  }
  return ret;
}


int main(){
  ll N,K,a;
  cin>>N>>K;
  a=N;
  vector<ll> A;
  for(ll i=1;i*i<=N;i++){
    if(N%i==0){
      A.push_back(i);
      if(i*i!=N){A.push_back(N/i);}
    }
  }
  sort(A.begin(),A.end());
  vector<ll> dp(A.size(),0);
  for(int i=0;i<(int)A.size();i++){
    dp[i]=mod_pow(K,(A[i]+1)/2);
    for(int j=0;j<i;j++){
      if(A[i]%A[j]==0){dp[i]-=dp[j];}
    }
    dp[i]%=MOD;
  }
  ll ans=0;
  for(int i=0;i<A.size();i++){
    if(A[i]%2==0){ans+=dp[i]*A[i]%MOD*((MOD+1)/2)%MOD;}
    else{ans+=dp[i]*A[i]%MOD;}
  }
  ans%=MOD;
  if(ans<0){ans+=MOD;}
  cout<<ans<<endl;
  
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

        System.out.println((a < b && b < c) ? "Yes" : "No");
    }
}

Measured memory_bytes: 26132
#include <iostream>
#include <string>
#include<vector>
#include<algorithm>
#include<math.h>
#include<limits.h>
#include<string>
#include<iomanip>
using namespace std;

long long  mod = 1000000007;

long max(long x, long y) {
	return x > y ? x : y;
}

long min(long x, long y) {
	return x < y ? x : y;
}

long factorial(long n) {
	if (n == 1) {
		return 1;
	}
	else {
		return n * factorial(n - 1);
	}
}

long long  fel(long long  n,long long  f) {

		if (f == 1) {
			return n % mod;
		}
		else if (f % 2 == 0) {
			return (fel(n,f / 2) * fel(n,f / 2)) % mod;
		}
		else {
			return ((n  * fel(n,f / 2) %mod) * fel(n,f / 2))% mod;
		}
	

}


int main()
{
    long long x,y;
	long long nm;
	cin >> x;
	cin >> y;
	/*vector<vector<double>> a(2, vector<double>(n));
	vector<int> b(n);
	*/
	nm = 2*1000000 / 3;

	/*long long kai;
	kai = 1;
	for (long long i = 1; i <= nm; i++) {
		kai = (kai * i) % mod;
	}*/

    long long n, m;
	n = x - (x + y) / 3;
	m = y - (x + y) / 3;

	//cout << fel(kai,mod-2);

	if ((x + y) % 3 == 0 && n*m>=0) {
		long long sum = 1;
		for (long long i = 1; i <= (n + m); i++) {
			sum = (sum * i) % mod;
		}
		sum = (sum * 288540294) % mod;
			for (long long i = nm; i > n; i--) {
				sum = (sum * i)%mod;
		}
			sum = (sum * 288540294) % mod;
			for (long long i = nm; i > m; i--) {
				sum = (sum * i) % mod;
			}
			cout << sum;
	}
	else {
		cout << 0;
	}

}

Measured memory_bytes: 256
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

#define EPS 1e-10
#define INF 1000000000
#define mp make_pair
#define pb push_back

typedef vector<int> vi;
typedef vector<vi> vii;
typedef pair<int,int> pii;
typedef long long ll;

int calcATP(int p, int vat) {
  return (int)(p * (100 + vat) / 100);
}

int main() {
  while (1) {
    int x, y, s, ans = 0;
    cin >> x >> y >> s;
    if (!x && !y && !s) {
      break;
    }
    for (int i = 1; i < s; i++) {
      int p0 = calcATP(i, x);
      for (int j = s - p0; j > 0 && i <= j; j--) {
        int p1 = calcATP(j, x);
        if (p0 + p1 == s) {
          int p = calcATP(i, y) + calcATP(j, y);
          ans = max(ans, p);
        } else if (p0 + p1 < s) {
          break;
        }
      }
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 1160
#include <stdio.h>

main(){
  int s[100000],t[50000],i,j,n,q,count=0,L,R,M;
  
  scanf("%d",&n);
  
  for(i=0;i < n;i++) scanf("%d",&s[i]);
  
  scanf("%d",&q);
  
  for(j=0;j < q;j++) scanf("%d",&t[j]);
  
 
  for(j=0;j<q;j++){
    L = 0;
    R = n;
   
   
  while(L<R){
    M = (L+R)/2;
    if(s[M] == t[j]){
      count++;
      break;
    }
    if(s[M] < t[j]){
      L = M+1;
    }
    if(s[M] > t[j]){
      R = M;
    }
  }
  }

 printf("%d\n",count);
 
 return 0;
  
}

Measured memory_bytes: 1184
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
	int N, M;
	cin >> N >> M;
	string A[N], B[N];
	rep(i, N) cin >> A[i];
	rep(i, M) cin >> B[i];
	int c = N - M + 1;
	rep(i, c) {
		rep(j, c) {
			bool flag = true;
			rep(m, M) {
				rep(n, M) {
					// cout << A[m][n];
					if (A[m + i][n + j] != B[m][n]) flag = false;
				}
				// cout << endl;
			}
			if (flag) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;


    return 0;
}


Measured memory_bytes: 256
if __name__ == '__main__':
    n = int(input())
    list1=[]
    for i in range(n):
        a =input()
        list1.append(a)

    m = int(input())
    list2=[]
    for i in range(m):
        a =input()
        list2.append(a)

    max= 0
    set1 = set(list1) | set(list2)

    for i in set1:
        count= list1.count(i)-list2.count(i)

        if count > max:
            max=count
    print(max)

Measured memory_bytes: 3064
from collections import Counter
import math

N=int(input())

A=list(map(int,input().split()))

answer=0
A.sort(reverse=True)

Amax=A[0]
limit=1
while(True):
  if limit>Amax:
    break;
  limit*=2

Acounter=Counter(A)
#print(Acounter)

while(limit!=1):
  eraserlist=[]
  for number,count in Acounter.items():
    if limit-number in Acounter.keys():
      if number==limit-number:
        dec=math.floor(Acounter[number]/2)
        Acounter[number]-=dec*2
      else:
        dec=min(Acounter[number],Acounter[limit-number])
        Acounter[number]-=dec
        Acounter[limit-number]-=dec
        if Acounter[limit-number]==0:
          eraserlist.append(limit-number)
      if Acounter[number]==0:
        eraserlist.append(number)
      answer+=dec
    if number>=limit/2:
      eraserlist.append(number)
  for i in range(len(eraserlist)):
    if eraserlist[i] in Acounter.keys():
      Acounter.pop(eraserlist[i])
  limit=int(limit/2)
print(answer)
#print(Acounter)

Measured memory_bytes: 33296
from sys import setrecursionlimit

setrecursionlimit(2 * 10 ** 9)

n, a, b = map(int, input().split())
mod = 10 ** 9 + 7

ans = pow(2, n, mod) - 1


def cmb(n, r):
    p, q = 1, 1
    for i in range(1, r + 1):
        p *= (n - i + 1)
        p %= mod
        q *= i
        q %= mod
    return p * pow(q, mod - 2, mod)


ans -= cmb(n, a)
ans -= cmb(n, b)


print(int(ans % mod))


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
#include <queue>
#include <map>
#include <set>
using namespace std;
using Int = int64_t;
using P = pair<Int, Int>;
const Int INF = 1<<30;
const Int MOD = (Int)1e9 + 7;
const Int MAX_N = (Int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl
#define debug2(x, y) cout << #x << ": " << x << ", " << #y << ": " << y << endl;
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2>& p) { os << p.first << " " << p.second; return os; }
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) { for(int i = 0; i < (int) v.size(); i++) os << v[i] << (i + 1 != v.size() ? " " : ""); return os; }

void solve()
{
    Int x, k, d;
    cin >> x >> k >> d;

    Int ans = 1e17;

    if(x > 0)
    {
        Int cnt = (x + d - 1) / d;
        if(cnt <= k)
        {
            k -= cnt;
            if(k % 2LL && k > 0)
            {
                ans = min(ans, abs(x - cnt * d + d));
            }
            else
            {
                ans = min(ans, abs(x - cnt * d));
            }
            
        }
        else // x - k * d
        {
            ans = min(ans, abs(x - k * d));
        }
        
    }
    else
    {
        Int cnt = (abs(x) + d - 1) / d;
        if(cnt <= k)
        {
            k -= cnt;
            if(k % 2LL && k > 0)
            {
                ans = min(ans, abs(x + cnt * d - d));
            }
            else
            {
                ans = min(ans, abs(x + cnt * d));
            }
        }
        else
        {
            ans = min(ans, abs(x + k * d));
        }
    }

    cout << ans << endl;
    
}

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


Measured memory_bytes: 3540
#include <stdio.h>

int main(void){
    double W,H,x,y;
    scanf("%lf %lf %lf %lf",&W,&H,&x,&y);
    printf("%lf ",W*H/2.0);
    if(x==W/2.0&&y==H/2.0){
        printf("1\n");
    }else printf("0\n");
    return 0;
}

Measured memory_bytes: 1740
import itertools
N,M,Q = (int(x) for x in input().split())
l = []
ABCD = []
for i in range(1,M+1):
  l.append(i)
A = list(itertools.combinations_with_replacement(l, N))
for j in range(Q):
    a,b,c,d = (int(x) for x in input().split())
    ABCD.append((a,b,c,d))
max = 0
for i in range(len(A)):
  cnt = 0
  for j in range(Q):
    a = ABCD[j][0]
    b = ABCD[j][1]
    if A[i][b-1]-A[i][a-1] == ABCD[j][2]:
      cnt += ABCD[j][3]
     # print(A[i],ABCD[j],cnt,max)
  if max < cnt:
     max = cnt
print(max)

Measured memory_bytes: 21496
#include<bits/stdc++.h>
using namespace std;
int main () {
  long long gojou[120];
  for (int i = 0; i < 120; i ++) {
    long long k = (long long)i;
    k = k * k * k * k * k;
    gojou[i] = k;
  }
  long long X;
  cin >> X;
  for (int i = 0; i < 120; i ++) {
    for (int j = 0; j < 120; j ++) {
      if (gojou[i] - gojou[j] == X) {
        cout << i << ' ' << j << endl;
        return 0;
      }
      if (gojou[i] + gojou[j] == X) {
        cout << i << ' ' << -j << endl;
        return 0;
      }
    }
  }
}



Measured memory_bytes: 3636
// D - Digit Sum Replace
#include <bits/stdc++.h>

using namespace std;

int main(int argc, char *argv[])
{
	ios::sync_with_stdio(false); cin.tie(0);
	int m;
	cin >> m;
	vector<long long> d(m), c(m);
	for (int i = 0; i < m; i++) cin >> d[i] >> c[i];

	vector<pair<int, int> > t(10, pair<int, int>(1, 0));
	for (int i = 0; i < t.size(); i++)
		for (int k = i; ; ) {
			k += i;
			t[i].first++; t[i].second++;
			if (k >= 10) {
				k = k / 10 + k % 10;
				t[i].second++;
			}
			if (k == i) break;
		}

	long long ans = 0;
	for (int i = 0; i < m; i++)
		while (c[i] >= t[d[i]].first) {
			ans += (c[i] / t[d[i]].first) * t[d[i]].second;
			c[i] = c[i] / t[d[i]].first + c[i] % t[d[i]].first;
		}

	int k = -1;
	for (int i = 0; i < m; i++) {
		if (c[i] == 0) continue;
		for ( ; c[i] > 0; c[i]--)
			if (k < 0) {
				k = d[i];
			} else {
				ans++;
				k += d[i];
				if (k >= 10) {
					k = k / 10 + k % 10;
					ans++;
				}
			}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3456
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
#ifdef LOCAL_TEST
	freopen("in", "r", stdin);
	freopen("out", "w", stdout);
#endif
	string s;
	cin >> s;
	stack<char> st;
	for(auto& c : s) {
		if(c == 'T' && st.size() > 0 && st.top() == 'S') st.pop();
		else st.push(c);
	}
	cout << st.size() << endl;
	return 0;
}

Measured memory_bytes: 644
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;
import java.util.Scanner;

public class Main implements Runnable {
  static int V;
  static List<List<Integer>> G;
  static List<List<Integer>> rG;
  static List<Integer> vs;
  static boolean[] used;
  static int[] cmp;

  public static void main(String[] args) {
    new Thread(null, new Main(), "", 16 * 1024 * 1024).start();
  }
  
  public void run() {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int e = sc.nextInt();
    V = n;
    G = new ArrayList<List<Integer>>(n);
    rG = new ArrayList<List<Integer>>(n);
    vs = new ArrayList<Integer>();
    used = new boolean[n];
    cmp = new int[n];

    for(int i = 0; i < n; i++) {
      G.add(new ArrayList<Integer>());
      rG.add(new ArrayList<Integer>());
    }

    for(int i = 0; i < e; i++) {
      int from = sc.nextInt();
      int to = sc.nextInt();
      G.get(from).add(to);
      rG.get(to).add(from);
    }

    for(int i = 0; i < V; i++) {
      used[i] = false;
    }
    vs.clear();

    for(int i = 0; i < V; i++) {
      if(!used[i]) dfs(i);
    }

    for(int i = 0; i < V; i++) {
      used[i] = false;
    }

    int k = 0;  
    for(int i = vs.size() - 1; i >= 0; i--) {
      if(!used[vs.get(i)]) rdfs(vs.get(i), k++);
    }

    int q = sc.nextInt();
    for(int i = 0; i < q; i++) {
      int s = sc.nextInt();
      int t = sc.nextInt();
      if(cmp[s] == cmp[t]) {
        System.out.println(1);
      }
      else{
        System.out.println(0);
      }
    }
  }

  static void dfs(int v) {
    used[v] = true; 
    for(int i = 0; i < G.get(v).size(); i++) {
      if(!used[G.get(v).get(i)]) dfs(G.get(v).get(i));
    }
    vs.add(v);
  }
  
  static void rdfs(int v, int k) {
    used[v] = true;
    cmp[v] = k;
    for(int i = 0; i < rG.get(v).size(); i++) {
      if(!used[rG.get(v).get(i)]) rdfs(rG.get(v).get(i), k);
    }
  }
}

Measured memory_bytes: 104560
import java.util.*

fun main(args: Array<String>) {
    val (n, m) = readLine()!!.split(' ').map { it.toInt() }
    val g = Array<MutableList<Int>>(n) { _ -> mutableListOf() }
    (1..m).forEach { _ ->
        val (x, y) = readLine()!!.split(' ').map { it.toInt() - 1 }
        g[x].add(y)
        g[y].add(x)
    }
    var ans = Array(g.size - 1) { _ -> 0 }
    var used = Array(g.size) { _ -> false }
    val que = ArrayDeque<Int>()
    que.add(0)
    used[0] = true
    while (que.isNotEmpty()) {
        val v = que.pop()
        g[v].forEach { to ->
            if (!used[to]) {
                used[to] = true
                ans[to - 1] = v
                que.add(to)
            }
        }
    }
    println("Yes")
    ans.forEach { println(it+1) }
}

Measured memory_bytes: 84704
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
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; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, w_max; cin >> n >> w_max;
    vector<int> w(n), v(n); rep (i, n) cin >> w[i] >> v[i];

    vector<vector<ll> > dp(n + 1, vector<ll>(200001));
    ll MAX_DP = 1000000000000;
    rep (i, n + 1) {
        rep (j, 100001) {
            dp[i][j] = MAX_DP;
        }
    }
    dp[0][0] = 0;
    
    rep (i, n) {
        rep (j, 100001) {
            chmin(dp[i + 1][j + v[i]], dp[i][j] + w[i]);
            chmin(dp[i + 1][j], dp[i][j]);
        }
    }

    int ans = 0;
    rep (i, 100001) {
        if (dp[n][i] <= w_max) ans = i;
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 159744
N = input()
length = len(N)
count = 0
for i in range(1, length, 2):
    count = count + 10 ** i - 1 - 10 ** (i - 1) + 1

if length % 2 != 0:
    count = count + int(N) - 10 ** (length - 1) + 1

print(count)

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

using namespace std;

//#define _FILES
#define PB push_back
#define MP make_pair
#define X first
#define Y second

const int MAXN = 100005;

int a[MAXN], c[MAXN];

int main()
{
    ios_base::sync_with_stdio(false);

    #ifdef _FILES
        freopen("","r",stdin);
        freopen("","w",stdout);
    #endif // _FILES
    int n;
    cin >> n;
    for (int i=0;i<n;i++)
    {
        cin >> a[i];
        c[a[i]]++;
    }
    sort(a, a + n);

    if (a[n - 1] - a[0] > 1)
    {
        cout << "No" << endl;
        return 0;
    }

    if (a[0] == a[n-1])
    {
        if ((a[0] == 1) || (a[0] == n - 1) || (2 * a[0] <= n))
        {
            cout << "Yes" << endl;
        }
        else
        {
           cout << "No" << endl;
        }
        return 0;
    }

    if ((a[0] >= c[a[0]]) && (c[a[n-1]] / 2 + c[a[0]] > a[0]))
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep2(i, m, n) for(int i=int(m); i<int(n); i++)
#define rep(i, n) rep2(i, 0, n)
#define ALL(a) a.begin(), a.end()
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
const int INF = 1<<30;
const ll INFll = ll(1<<62);
const ld EPS = 1e-10;
const int MOD = int(1e9)+7;
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;
}

int main() {
  int N, M; cin >> N >> M;
  V A(M), C(M);
  rep(i, M) {
    cin >> A[i];
    int b; cin >> b;
    rep(j, b) {
      int c; cin >> c;
      c--;
      C[i] |= 1<<c;
    }
  }

  int bit_max = 1<<N;
  VV dp(M+1, V(bit_max, INF));
  rep(m, M+1) dp[m][0] = 0;

  rep(m, M) rep(bi, bit_max) {
    dp[m+1][bi] = dp[m][bi];
    chmin(dp[m+1][bi], dp[m][bi&~C[m]] + A[m]);
  }

  if (dp[M][bit_max-1] == INF) cout << -1;
  else cout << dp[M][bit_max-1];
  cout << endl;
  return 0;
}


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

using namespace std;

#define ios         ios_base::sync_with_stdio(false);
#define ll          long long
#define ld          long double
#define db(x)       cout << "[" << #x << ": " << (x) << "]\n"
#define db2(x,y)    cout << "[" << #x << ": " << (x) << "]  [" << #y << ": " << (y) << "]\n"
#define db3(x,y,z)  cout << "[" << #x << ": " << (x) << "]  [" << #y << ": " << (y) << "]  [" << #z << ": " << (z) << "]\n"
#define cn          23
#define sn          1007
#define bn          200007
#define M           100000007
#define inf         LLONG_MAX


int main()
{
        ios;
        ll a,b,c,d; cin >> a >> b >> c >> d;
        ll ac = a*c, ad = a*d, bc = b*c, bd = b*d;
        cout << max(max(max(ac,ad),bc),bd);
}


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

long long dp[110][100010];
int w[110], v[110];

long long rec(int i, int sum_w) {
    if(dp[i][sum_w] != -1) return dp[i][sum_w];
    if(i == 0) return 0;
    long long res = 0;
    res = max(res, rec(i-1, sum_w));
    if(sum_w >= w[i-1]) res = max(res, rec(i-1, sum_w - w[i-1]) + v[i-1]);
    return dp[i][sum_w] = res;
}

int main() {
    int N, W; cin >> N >> W;
    for(int i = 0; i < N; ++i) cin >> w[i] >> v[i];
    for(int i = 0; i < 110; ++i) for(int sum_w = 0; sum_w <= 100010; ++sum_w) dp[i][sum_w] = -1;
    
    cout << rec(N, W) << endl;
}


Measured memory_bytes: 86144
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <iterator>
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include <random>
#include <cassert>
#include <limits>

using namespace std;

#define mp make_pair
#define pb push_back
#define repi(i, p, q) for (long long i = p; i < q; i++)
#define repd(i, p, q) for (long long i = p; i >= q; i--)
#define INF 2000000000
#define MOD 1000000007

typedef map<int, int> M;
typedef map<long, long> ML;
typedef map<long long, long long> MLL;
typedef pair<int, int> P;
typedef pair<long, long> PL;
typedef pair<long long, long long> PLL;
typedef int I;
typedef double D;
typedef long double LD;
typedef long L;
typedef long long LL;

int main()
{
    long double t, x;
    cin >> t >> x;
    cout << (t / x);
    return 0;
}

Measured memory_bytes: 256