akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <climits>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <vector>

using namespace std;
constexpr long long int INF = std::numeric_limits<long long int>::max();
#define int long long int

void solve() {
  int N;
  cin >> N;
  vector<pair<int, int>> V;
  while (N--) {
    int A, B;
    cin >> A >> B;
    V.emplace_back(B, A);
  }

  sort(V.begin(), V.end());
  bool ok = true;
  int a = 0;
  for (auto &w : V) {
    a += w.second;
    if (a > w.first) {
      ok = false;
      break;
    }
  }

  if (ok) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  // int x;
  // cout << endl;
}

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


Measured memory_bytes: 6384
#include<bits/stdc++.h>
using namespace std;
int dp[250][150],T[250],x[250][3],D,N,MAX;
main(){memset(dp,-999999,sizeof(dp));cin>>D>>N;
for(int i=1;i<=D;i++){cin>>T[i];}
for(int i=1;i<=N;i++){cin>>x[i][0]>>x[i][1]>>x[i][2];if(T[1]>=x[i][0] && T[1]<=x[i][1]){dp[1][x[i][2]]=0;}}
for(int i=2;i<=D;i++){for(int j=1;j<=N;j++){if(T[i]>=x[j][0] && T[i]<=x[j][1]){
for(int k=0;k<=100;k++){dp[i][x[j][2]]=max(dp[i][x[j][2]],dp[i-1][k]+abs(x[j][2]-k));}
}}}
for(int i=0;i<=100;i++){MAX=max(MAX,dp[D][i]);}
cout<<MAX<<endl;}

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

int main() {
  int n,k;
  cin >> n >> k;
  vector<int> vec(n,0);
  for(int i=0; i<k; i++){
    int x;
    cin >> x;
    for(int i=0; i<x; i++){
      int y;
      cin >> y;
      vec.at(y-1)++;
    }
  }
  int ans=0;
  rep(i,n){
    if(vec.at(i)==0) ans++;
  }
  cout << ans << endl;

}

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

const int maxn=1e5+5;
int n,a[maxn];

int main()
{
	int n;
	scanf("%d",&n);
	
	map<int,int>m;
	
	for(int i=0;i<n;i++)
		scanf("%d",&a[i]),
		m[a[i]]++;
	
	int suma=0;
	
	for(auto &p:m)
	{
		if(p.first>p.second) suma+=p.second;
		if(p.first<p.second) suma+=p.second-p.first;
	}
	printf("%d\n",suma);	

	
	return 0;
}

Measured memory_bytes: 5120
#include<bits/stdc++.h>
#include <array>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
using ULL = unsigned long long;
using UL = unsigned;
using LL = long long;


void Solve() {
	UL n; cin >> n;
	ULL ans = 0;
	ULL bsum0[60] = {};
	ULL bsum1[60] = {};
	rep(i, n) {
		ULL a; cin >> a;
		rep(b, 60) {
			ULL abit = (a >> b) & 1;
			if (abit) {
				ans += bsum0[b]; ans %= 1000000007;
				bsum1[b] += 1ull << b; bsum1[b] %= 1000000007;
			}
			else {
				ans += bsum1[b]; ans %= 1000000007;
				bsum0[b] += 1ull << b; bsum0[b] %= 1000000007;
			}
		}
	}
	cout << ans << endl;
}

int main() {
	Solve();
	return 0;
}


Measured memory_bytes: 256
A = [int(a) for a in input().split()]
N = A[0]
K = A[1]

P = [int(p) for p in input().split()]

raw_max = sum(P[0:K])
maxnum = 0
sum_tmp = sum(P[0:K])

for i in range(1, N-K+1):
    sum_tmp = sum_tmp - P[i-1] + P[i+K-1]
    if(raw_max < sum_tmp):
        raw_max = sum_tmp
        maxnum = i

ev_max = [(n+1)/2 for n in P[maxnum:maxnum+K]]

print(sum(ev_max))

Measured memory_bytes: 25188
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll zero = 0;
const ll INF = 10000000000000000; //10^16
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;

int main(void){
    int N;
    cin >> N;
    queue<pair<string,char>> ans;
    
    ans.push(make_pair("a", 1));
    pair<string, int> tmp;
    while(ans.front().first.size() != N){
        tmp = ans.front();
        for(int i = 0; i < tmp.second; i++){
            ans.push(make_pair(tmp.first + (char)('a' + i) , tmp.second));
        }
        ans.push(make_pair(tmp.first + (char)('a' + tmp.second) , tmp.second + 1));
        ans.pop();
    }
    while(!ans.empty()){
        printf("%s\n", ans.front().first.c_str());
        ans.pop();
    }
    
    
    
}


Measured memory_bytes: 8832
from itertools import accumulate

mod = 10 ** 9 + 7

N, K, *A = map(int, open(0).read().split())

dp = [1] + [0] * K
for a in A:
    S = list(accumulate(dp)) + [0]
    for i in range(K + 1):
        dp[i] = (S[i] - S[max(0, i - a) - 1]) % mod

print(dp[K])

Measured memory_bytes: 117760
//ヘッダー
#include<bits/stdc++.h>
using namespace std;

//型定義
typedef long long ll;

//定数
const int INF=1e+9;
const int MOD=1e+9+7;

//REPマクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REP2(i,a,b) for(ll i=a;i<(ll)(b);i++)
#define REPD2(i,a,b) for(ll i=a;i>(ll)(b);i--)

// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

//vectorの扱い
#define ALL(x) (x).begin(),(x).end() //sortなどの引数省略
#define SIZE(x) ((ll)(x).size()) //size
#define MAX(x) *max_element(ALL(x)) //最大値
#define MIN(x) *min_element(ALL(x)) //最小値

int main(){
    string T;
    cin>>T;
    REP(i,T.size()){
        if(T[i]=='?') cout<<"D";
        else cout<<T[i];
    }
    cout<<endl;
}

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

int main()
{
  int N;
  cin >> N;
  string color;
  
  for(int i = 0; i < N; i++)
  {
    cin >> color;
    if(color == "Y")
    {
      cout << "Four" << endl;
      break;
    }
    if(i == (N-1) && color != "Y")
      cout << "Three" << endl;
    
  }

}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <queue>
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <iomanip> // std::std::setprecision(X)
#include <limits>  //std::numeric_limits<int>::max(), min()

typedef long long ll;

int main (void) {
  int N; std::cin >> N;
  for(int i=0; (4*i)<=N; i++) {
    if ( (N-4*i) % 7 == 0 ) {
      std::cout << "Yes" << std::endl;
      return 0;
    }
  }
  std::cout << "No" << std::endl;

  return 0;
}


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

a = [int(input()) for _ in range(N)]

ans = [a[0]]

for i in range(1, N):

    if  ans[len(ans) - 1] >= a[i]:
        ans.append(a[i])
    elif ans[0] < a[i]:
        ans[0] = a[i]
    elif ans[len(ans) - 2] >= a[i]:
        ans[len(ans) - 1] = a[i]
    else:
        l = 0
        h = len(ans) - 1
        m = (l + h) // 2
        while True:
            if ans[m] >= a[i]:
                l = m
                m = (l + h) // 2
                continue

            if ans[m - 1] < a[i]:
                h = m
                m = (l + h) // 2
                continue
            break
        ans[m] = a[i]

print(len(ans))


Measured memory_bytes: 7836
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define FOR0(i,n) for(i=0;i<n;i++)
#define FOR(i,j,n) for(i=j;i<n;i++)
#define FORD(i,j,k) for(i=j;i>=k;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define inf 1000000000
#define ninf -1000000000
#define endl '\n' 
#define she_told_me_dont_worry ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// Use cout.flush() for interactive problems.
// Use this for increased stack size: g++ -o a.exe -Wl,--stack=256000000 -O2 source.cpp
inline long long  MAX2(long long  a, long long int b){return (a)>(b)?(a):(b);}
inline long long  MAX3(long long  a, long long  b,long long  c){return (a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c));}
inline long long  MIN2(long long  a, long long  b){return (a)<(b)?(a):(b);}
inline long long  MIN3(long long  a, long long b,long long c){return (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c));}
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< ii > vii;
int main()
{
    she_told_me_dont_worry
    string s;
    cin>>s;
    deque< char> dq;
    int i, n = s.size();
    FOR0(i, n) dq.push_back(s[i]);
    int q;
    cin>>q;
    int flip = 0;
    while(q--)
    {
        int t;
        cin>>t;
        if(t == 1) 
            flip ^= 1;
        else 
        {
            int f;
            char c;
            cin>>f>>c;
            f--;
            f ^= flip;
            if(!f) dq.push_front(c);
            else dq.push_back(c);
        }
    }
    s.clear();
    int si = dq.size();
    FOR0(i, si) 
    {
        s.push_back(dq.front());
        dq.pop_front();
    }
    if(flip) reverse(s.begin(), s.end());
    cout<<s<<endl;
    cerr <<endl<< "Time elapsed : " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
}

Measured memory_bytes: 1168
def get(x):
    cnt = 0
    while x % 2 == 0:
        cnt += 1
        x = x/2
    return cnt
n = int(input())
at = 1
ans = 0
for i in range(1,n+1):
    a = get(i)
    if ans < a:
        ans = a
        at = i
print(at)


Measured memory_bytes: 2940
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

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

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

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

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

    int n, m; cin>>n>>m;
    vector<bool> use(10, false);
    for(int i=0; i<m; i++){
        int a; cin>>a;
        use[a] = true;
    }

    vector<int> match = {-1, 2, 5, 5, 4, 5, 6, 3, 7, 6};

    vector<int> dp(n+1, -inf);
    dp[0] = 0;
    for(int i=1; i<=9; i++){
        if(!use[i]) continue;
        for(int j=0; j<=n; j++){
            if(j - match[i] >= 0) chmax(dp[j], dp[j - match[i]] + 1);
        }
    }

    string ans;
    for(int i=n; i>0; ){
        for(int j=9; j>=1; j--){
            if(!use[j]) continue;
            if(i - match[j] >= 0 && dp[i - match[j]] + 1 == dp[i]){
                i -= match[j];
                ans += to_string(j);
                break;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
 
const int MAX_V = 10000;
int prime[10001];
 
int main(){
    int v, q1;
    for(int i = 2;i <= MAX_V;i++){
        prime[i] = 1;
    }
    for(int i = 2; i * i <= MAX_V;i++){
        if(prime[i]){
            for(int k = 2 * i;k <= MAX_V; k += i){
                prime[k] = 0;
            }
        }
    }
    while(scanf("%d", &v) != EOF){
        if(v == 0) break;
        for(int i = v;i >= 2;i--){
            if(prime[i]){
                if(prime[i-2]){
                    q1 = i;
                    break;
                }
            }
        }
        printf("%d %d\n", q1 - 2, q1);
    }
    return 0;
}

Measured memory_bytes: 1740
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
struct team{int i, u, a, p;team(int,int,int,int);};
team::team(int _i, int _u, int _a, int _p)
	:i(_i), u(_u), a(_a), p(_p) {}

bool tsort(const team& l, const team& r){
	if(l.a == r.a){
		if(l.p == r.p)return l.i < r.i;
		return l.p < r.p;
	}
	return l.a > r.a;
}

int main(){
	int n;
	while(std::cin >> n, n){
		int i, u, a, p;
		std::vector<team> v;
		while(n--){
			std::cin >> i >> u >> a >> p;
			team t = team(i, u, a, p);
			v.push_back(t);
		}
		
		std::sort(v.begin(), v.end(), tsort);
		
		int steam = 0;
		std::map<int, int> m;
		std::vector<team>::iterator it = v.begin();
		while(it != v.end()){
			int mteam = 0;
			if(steam < 10)mteam = 3;
			else if(steam < 20)mteam = 2;
			else if(steam < 26)mteam = 1;

			if(m[(*it).u] < mteam){
				std::cout << (*it).i << std::endl;
				steam++, m[(*it).u]++;
			}
			it++;
		}
	}
}

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

using ll = int64_t;

#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 rng(a) a.begin(), a.end()
#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 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);

  string s; std::cin >> s;
  int len = s.size(), ans = 0;
  rep(i, len / 2) {
    if (s[i] != s[len - 1 - i])
      ans++;
  }
  std::cout << ans << "\n";
}


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

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

    long long ans = N-1;
    for (long long i=1; i*i<=N; i++)
        if (N%i==0)
            ans = min(ans, (i-1)+(N/i-1));
    cout<<ans<<endl;
}


Measured memory_bytes: 256
class Art
  attr_reader :size, :value
  def initialize(s, v)
    @size = s
    @value = v
  end
end

n = gets.to_i
arts = Array.new(n){
  a, b = gets.split(' ').map(&:to_i)
  Art.new(a, b)
}.sort_by{|a| a.size}
artSumValues = Array.new(n){|i|
  arts[i].value
}
for i in 1 ... n
  artSumValues[i] += artSumValues[i - 1]
end
min = -arts[0].size
max = artSumValues[0]
for i in 1 ... n
  if min > artSumValues[i - 1] - arts[i].size
    min = artSumValues[i - 1] - arts[i].size
  end
  if max < artSumValues[i] - arts[i].size - min
    max = artSumValues[i] - arts[i].size - min
  end
end
puts max


Measured memory_bytes: 54964
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const long long MOD = 1e9+7;
int n, k;

int main() {
    cin >> n >> k;
    long long ans = 0;
    for(long long i = k; i <= n+1; ++i) {
        long long kmin = (0+(i-1))*i/2;
        long long kmax = ((n-i+1)+n)*i/2;
        long long sum = (kmax-kmin)+1;
        sum %= MOD;
        ans += sum;
        ans %= MOD;
    }

    cout << ans << endl;
}

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

const int RLEN=1<<18|1;
inline char nc() {
	static char ibuf[RLEN],*ib,*ob;
	(ib==ob) && (ob=(ib=ibuf)+fread(ibuf,1,RLEN,stdin));
	return (ib==ob) ? -1 : *ib++;
}
inline int rd() {
	char ch=nc(); int i=0,f=1;
	while(!isdigit(ch)) {if(ch=='-') f=-1; ch=nc();}
	while(isdigit(ch)) {i=(i<<1)+(i<<3)+ch-'0'; ch=nc();}
	return i*f;
}

const int N=1e5+50;
int n,a[N],p[N][2],f[N];

int main() {
	n=rd();
	for(int i=1;i<=n;i++) a[i]=rd();
	for(int i=1;i<=n;i++) {
		p[i][0]=p[i-1][0];
		p[i][1]=p[i-1][1];
		if(a[i]>a[i-1]) p[i][1]=i-1;
		if(a[i]<a[i-1]) p[i][0]=i-1;
		f[i]=f[min(p[i][0],p[i][1])]+1;
	}  cout<<f[n]<<'\n';
}

Measured memory_bytes: 2048
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;


int main(){

    int n, k;
    string s;
    cin >> n >> k;
    cin >> s;

    vector<int> Nums;
    int cnt = 0;
    int now = 1;
    for (int i = 0; i < n; i++) {
        if (s[i] == (char)('0' + now)) cnt++;
        else {
            Nums.push_back(cnt);
            now  = 1 - now;
            cnt = 1;
        }
    }
    if (cnt != 0) Nums.push_back(cnt);
    if (Nums.size() % 2 == 0) Nums.push_back(0);

    int Add = 2 * k + 1;
    int ans = 0;
    for (int i = 0; i < Nums.size(); i += 2) {

        int temp = 0;
        int left = i;
        int right = min(i + Add, (int)Nums.size());
        for (int j = left; j <  right; j++) {
            temp += Nums[j];
        }
        ans = max(ans, temp);
    }

    cout << ans << '\n';

}


Measured memory_bytes: 1020
#
# File    : A.rb
# Author  : Kazune Takahashi
# Created : 5/19/2019, 8:46:54 PM
# Powered by Visual Studio Code
#

n, k = gets.chomp.split(" ").map{|i| i.to_i}
s = gets.chomp
s[k - 1] = s[k - 1].downcase
puts s


Measured memory_bytes: 1788
import qualified Data.Vector.Unboxed as VU
import qualified Data.ByteString.Char8 as BS
import Control.Monad
import Data.List
import Data.Char

data Op = Add | Sub

instance Show Op where
    show Add = "+"
    show Sub = "-"

apply :: Op -> Int -> Int -> Int
apply Add x y = x + y
apply Sub x y = x - y

data Expr = Val Int | App Op Expr Expr

instance Show Expr where
    show (Val n)     = show n
    show (App o l r) = brak l ++ show o ++ brak r
                        where brak (Val n) = show n
                              brak e       = show e

eval :: Expr -> Int
eval (Val n) = n
eval (App o l r) = apply o (eval l) (eval r)



main :: IO ()
main = do
    [a,b,c,d] <- map digitToInt <$> getLine
    let m = do
        i1 <- [Add,Sub]
        i2 <- [Add,Sub]
        i3 <- [Add,Sub]
        let xxx = App i3 (App i2 (App i1 (Val a) (Val b)) (Val c)) (Val d)
        guard $ eval xxx == 7
        return $ show xxx ++ "=7"
    putStrLn $ head m

readInt :: BS.ByteString -> Maybe (Int,BS.ByteString)
readInt xs = do
    (x,ys) <- BS.readInt xs
    return (x,BS.tail ys)

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

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    if(a<=c and c <= b){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
def solve():
    n = int(input())
    s = ''
    t = 1
    if n == 0:
        print(0)
        return
    while n != 0:
        a = abs(n % 2)
        s = str(a) + s
        n -= a * t
        n = int(n / 2)
        t *= -1
    print(s)


solve()


Measured memory_bytes: 38512
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define pb push_back
#define all(x) x.begin(), x.end()
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<ll>;
using vvi = vector<vi>;
const ll mod = 1000000007;
int main() {
	ios::sync_with_stdio(0);
	cout.tie(0);
	cin.tie(0);
	ll k, ans = 0;
	string s;
	cin >> s >> k;
	ll n = s.size();
	set<char> cc(all(s));
	if(cc.size()==1) {
		cout << (s.size()*k)/2;
		return 0;
	}
	s += s;
	s+='!';
	ll l = 0;
	for(ll i = 1; i < s.size(); i++) {
		if(s[i]!=s[i-1]) {
			if(i <= n) {
				if(l == 0) {
					ans += (i-l)>>1;
				} else {
					ans += ((i-l)>>1)*1ll*(k - (i==n));
				}
			} else if(l < n) {
				ans += (k-1)*((i-l)>>1);
			} else if(i+1 == s.size()){
				if(k > 1) {
				ans += (i-l)>>1;
				}
			} else if(l==n) {
				ans += (k-1) *1ll* ((i-l)>>1);
			}
			l=i;
		}
	}
	cout << ans;
}


Measured memory_bytes: 256
#!/usr/bin/env python3

from collections import deque

K = int(input())

d = [float('inf')] * K
d[1] = 1
q = deque([1])
while q:
    n = q.popleft()
    l, r = map(lambda x: (x) % K, [n * 10, n + 1])

    if d[l] > d[n]:
        d[l] = d[n]
        q.appendleft(l)

    if d[r] > d[n] + 1:
        d[r] = d[n] + 1
        q.append(r)

print(d[0])


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

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

    string s;
    string ans;

    cin >> s;
    for (int i = 0; i < s.size(); i++)
    {
        if (s[i] == '1' || s[i] == '0')
        {
            ans += s[i];
        }
        else
        {
            if (ans.size() > 0)
            {
                ans.erase(ans.end() - 1);
            }
        }
    }
    cout << ans << endl;

    return 0;
}

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))

using namespace std;

using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); return a / gcd(a, b) * b; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

void solve() {
  int n, k, s;
  cin >> n >> k >> s;
  vi32 ans(n);
  if (s == 1e9) {
    rep(i, k) ans[i] = 1e9;
    repi(i, k, n) ans[i] = 1;
  } else {
    rep(i, k) ans[i] = s;
    repi(i, k, n) ans[i] = 1e9;
  }
  cout << ans << endl;
}


Measured memory_bytes: 1792
I=N=9**9
P,*L='x+y,',
M,*R='x-y,',
U,*D=[],
for t in[*open(0)][1:]:*z,u=t.split();exec(u+'+=[*map(int,z)],')
for*A,S in(D,U,'x,y,'),(L,R,'y,x,'),(U,R,P+M),(L,D,P+M),(L,U,M+P),(D,R,M+P):
 n=-I
 for x,y,r in eval('sorted((%sQ)for Q,P in enumerate(A)for x,y in P)'%S):
  if r:n,p=x,y
  elif x==n:N=min(N,y-p)
print(N%I*5or'SAFE')

Measured memory_bytes: 72268
#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rp(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

void solve(){
    int m;
    cin >> m;
    print(48-m);
    return;
}
int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    solve();
    return 0;
}

Measured memory_bytes: 3604
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <sstream>
#include <queue> 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> 
#include <numeric>  
#include <functional>
#include <cassert>
#include <bitset>
#include <cctype>  
#include <iomanip> 
#include <limits>  
#include <regex>
// std::numeric_limits<int>::max(), min()
// std::setprecision(X)
// std::islower(), std::isupper(), std::tolower, std::toupper
// std::accumulate(m.begin(), m.end(), 0LL);
// std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
// std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
// if ( std::regex_match(S, std::regex("(dream|dreamer|erase|eraser)*")) ) std::cout << "YES" << std::endl;
 
#define rep(i, n) for(int i = 0; i < (int)(n);    i++)
#define sz(x) ((int)(x).size())
#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; }
typedef long long ll;

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


class DIJKSTRA {

  typedef long long ll;
  typedef std::pair<ll,ll> P;
  struct Edge { ll to; ll cost; };

  private:
    std::vector<std::vector<Edge>> G; // j-th Edge connected with vertex i : G[i][j]
    std::vector<ll> D;  // result
    std::vector<ll> C;  // # of paths
    bool directed;

  public:
    DIJKSTRA ( ll N , bool dir = false ) : directed (dir) {
      G.resize(N);
      D.assign(N, std::numeric_limits<ll>::max());
      C.assign(N, 0);
    }

    void Path ( ll i, ll j, ll x ) {
      G[i].push_back( {j,x} );
      if ( !directed ) G[j].push_back( {i,x} );
    }

    void Run (ll start) {
      std::priority_queue<P, std::vector<P>, std::greater<P>> pq;
      pq.push( P(0, start) );
      D[start] = 0;
      C[start] = 1;
      while( !pq.empty() ) {
        auto cur = pq.top(); pq.pop();
        int d = cur.first;
        int v = cur.second;
        if ( D[v] < d ) continue;
        for(auto&& e : G[v]) {
          if ( D[e.to] > D[v] + e.cost ) {
            D[e.to] = D[v] + e.cost;
            pq.push( P(D[e.to], e.to) );
            C[e.to] = C[v];
          }
          else if ( D[e.to] == D[v] + e.cost ) C[e.to] += C[v];
        }
      }
      return;
    }

    ll Get ( ll i ){ return D[i]; }

    ll GetPaths ( ll i ) { return C[i]; }
};


int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  ll N; std::cin >> N;
  DIJKSTRA dij(N, false);
  rep(i,N-1) {
    ll a,b,c; std::cin >> a >> b >> c; a--,b--;
    dij.Path(a,b,c);
  }
  
  ll Q, K; std::cin >> Q >> K; K--;
  std::vector<ll> ans(Q);
  dij.Run(K);
  rep(i,Q) {
    ll x,y; std::cin >> x >> y; x--,y--;
    ans[i] = dij.Get(x) + dij.Get(y);
  }

  rep(i,Q) std::cout << ans[i] << std::endl;

  return 0;
}


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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a, b) accumulate(all(a), b)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define ios() cin.tie(0), ios::sync_with_stdio(false)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
typedef unsigned long long ull;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
ll const INF = 1e18;

template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}



signed main(){
    int n;
    cin >> n;
    vector<int> v(n);
    for(auto& i : v) cin >> i;
    int m = 0, ans = 0;
    for(auto i : v){
        if(i >= m) ans++;
        chmax(m, i);
    }
    cout << ans << endl;

    return 0;
}

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

using namespace std;


#define PI 3.14159265
#define int long long


main(){

	int n; cin >> n;


	vector <int> h(n);

	for(int i = 0; i < n; i++){
		cin >> h[i];
	}

	int ans = 0;
	while(true){
		int cnt = 0;

		bool stop = true;

		for(int i = 0; i < n; i++){
			if(h[i]){
				int j = i;
				while(h[j]){
					j++;
				}

				cnt++;
				i = j;
			}
		}

		for(int i = 0; i < n; i++){
			if(h[i]){
				stop = false;
				h[i]--;
			}
		}

		ans += cnt;

		if(stop) break;

	}


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

Measured memory_bytes: 256
a,b = list(map(int,input().split()))
judge = False
for x in range(10000):
    tax_a = int(0.08*x)
    tax_b = int(0.1*x)
    if tax_a == a and tax_b == b:
        print(x)
        judge = True
        break
    
if judge == False:
    print(-1)

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


#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;


bool dfs(int a, int layer, const vector<vi>& g, vi& btoa,
			vi& A, vi& B) {
	if (A[a] != layer) return 0;
	A[a] = -1;
	trav(b, g[a]) if (B[b] == layer + 1) {
		B[b] = -1;
		if (btoa[b] == -1 || dfs(btoa[b], layer+2, g, btoa, A, B))
			return btoa[b] = a, 1;
	}
	return 0;
}

int hopcroftKarp(const vector<vi>& g, vi& btoa) {
	int res = 0;
	vi A(g.size()), B(btoa.size()), cur, next;
	for (;;) {
		fill(all(A), 0);
		fill(all(B), -1);
		/// Find the starting nodes for BFS (i.e. layer 0).
		cur.clear();
		trav(a, btoa) if(a != -1) A[a] = -1;
		rep(a,0,sz(g)) if(A[a] == 0) cur.push_back(a);
		/// Find all layers using bfs.
		for (int lay = 1;; lay += 2) {
			bool islast = 0;
			next.clear();
			trav(a, cur) trav(b, g[a]) {
				if (btoa[b] == -1) {
					B[b] = lay;
					islast = 1;
				}
				else if (btoa[b] != a && B[b] == -1) {
					B[b] = lay;
					next.push_back(btoa[b]);
				}
			}
			if (islast) break;
			if (next.empty()) return res;
			trav(a, next) A[a] = lay+1;
			cur.swap(next);
		}
		/// Use DFS to scan for augmenting paths.
		rep(a,0,sz(g)) {
			if(dfs(a, 0, g, btoa, A, B))
				++res;
		}
	}
}

vector<vector<int> > g;
vector<int> btoa;

vector<vector<pair<int,int> > > edges;
int main(){
	int n;
	cin >> n;
	g.resize(n);
	btoa.resize(n, -1);
	for(int i = 1; i < n; i++){
		int c;
		cin >> c;
		for(int a = 0; a < c; a++){
			int d;
			cin >> d;
			d--;
			g[i].push_back(d);
		}
	}
	g[0].push_back(0);
	if(hopcroftKarp(g, btoa) < n){
		cout << -1 << '\n';
		return 0;
	}
	vector<int> a(n);
	vector<int> b(n);
	for(int i = 0; i < n; i++){
		a[btoa[i]] = i;
	}

	edges.resize(n);
	for(int i = 1; i < n; i++){
		for(int r : g[i]){
			edges[r].push_back({a[i], i});
		}
	}
	vector<int> bfs;
	bfs.push_back(0);
	int s = 0;
	vector<int> vis(n, 0);
	vis[0] = 1;
	int cnt = 1;
	while(s < bfs.size()){
		int x = bfs[s];
		s++;
		for(auto r : edges[x]){
			if(vis[r.first]) continue;
			vis[r.first] = 1;
			cnt++;
			b[r.second] = x;
			bfs.push_back(r.first);
		}
	}
	if(cnt < n){
		cout << -1 << '\n';
		return 0;
	}
	for(int i = 1; i < n; i++){
		cout << a[i] + 1 << " " << b[i] + 1 << '\n';
	}
}

Measured memory_bytes: 15456
#include<stdio.h>
int main()
{   int num;
    int n,i;
    scanf("%d",&n);
    int arr[200010]={0};
    for(i=2; i<=n; i++)
    {scanf("%d",&num);
    arr[num]++;}

    for(i=1; i<=n; i++)

        printf("%d\n",arr[i]);

}


Measured memory_bytes: 2516
import java.util.Scanner;
 
public class Main {
  public static void main(String[] args) {
    
    Scanner sc = new Scanner(System.in);
    int num1 = sc.nextInt();
    int num2 = sc.nextInt();
    
    int count = 0;
    
    // 判定&計算
    if(num1 > num2) {
      if(num1 - num2 >= 2) {
        count = num1;
        num1 -= 1;
        count += num1;
      }else{
        count = num1 + num2;
      }
    }else if(num2 > num1){
      if(num2 - num1 >= 2) {
        count = num2;
        num2 -= 1;
        count += num2;
      }else{
        count = num1 + num2;
      }
    }else{
      count = num1 + num2;
    }
      
    // 出力  
    System.out.println(count);
   }
 }

Measured memory_bytes: 22868
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long s=0,i;
    string a;
    cin>>a;
    for(i=0;i<a.size();i++)
    {
        s=s+a[i]-'0';
    }
    if(s % 9 ==0)
    {
        printf("Yes\n");
    }
    else
    {
        printf("No\n");

    }
}


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

using namespace std;

typedef long long ll;
typedef long double Double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

// chmax, chmin
template<class T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}

template<class T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}

const long long MOD = 1000000007;


int dp[2010][2010][2];


vector<long long> s, t;

map<int, vector<int> > vs;

vector<int>::iterator memo[2010][2010];
bool ok[2010][2010];

vector<int>::iterator lb(int a, int b) {
    if (ok[a][b]) return memo[a][b];
    ok[a][b] = true;
    return memo[a][b] = lower_bound(vs[s[a]].begin(), vs[s[a]].end(), b);
}

int f(int a, int b, bool should_choose) {
    if (should_choose && b == t.size()) return 0;
    if (a == s.size() && b == t.size()) return 1;
    if (a == s.size()) return 1;
    if (dp[a][b][should_choose] != -1) return dp[a][b][should_choose];


    int ans = 0;
    if (!should_choose) {
        ans += f(a + 1, b, false);
    }

    if (should_choose) {
        int nxt = *++lb(a, b);
        assert(s[a] == t[b]);
        ans += f(a + 1, b + 1, false);
        if (ans >= 1000000007) ans -= 1000000007;
        ans += f(a, nxt, true);
        if (ans >= 1000000007) ans -= 1000000007;
    } else {
        int nxt = *lb(a, b);
        ans += f(a, nxt, true);
        if (ans >= 1000000007) ans -= 1000000007;
    }


    return dp[a][b][should_choose] = ans;
}

void solve(long long N, long long M, std::vector<long long> S,
           std::vector<long long> T) {
    memset(dp, -1, sizeof(dp));
    for (int i = 0; i < T.size(); i++) {
        vs[T[i]].push_back(i);
    }
    for (int i = 0; i <= 100000; i++)
        vs[i].push_back(M);

    s = S;
    t = T;
    cout << f(0, 0, 0) << endl;
}

int main() {
    long long N;
    scanf("%lld", &N);
    long long M;
    scanf("%lld", &M);
    std::vector<long long> S(N);
    for (int i = 0; i < N; i++) {
        scanf("%lld", &S[i]);
    }
    std::vector<long long> T(M);
    for (int i = 0; i < M; i++) {
        scanf("%lld", &T[i]);
    }
    solve(N, M, std::move(S), std::move(T));
    return 0;
}


Measured memory_bytes: 78592
#include <cassert>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <iostream>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)

typedef long long ll;

ll vs[100000+10];
ll dp[100000+10];

int main(void) {
  int n, k;
  scanf("%d%d", &n, &k);
  REP(i, n) {
    scanf("%lld", &vs[i]);
    dp[i] = 1e18;
  }
  dp[0] = 0;
  REP(i, n) {
    for(int j = 1; j <= k; ++j) {
      if(i+j >= n) {
        break;
      }
      dp[i+j] = min(dp[i+j], dp[i] + abs(vs[i+j]-vs[i]));
    }
  }
  cout << dp[n-1] << endl;
  return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
//#include<boxes.h>
using namespace std;
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define int ll
#define sz size()
#define x first
#define y second
#define pi pair <int, int>
#define pii pair <pi, int>
#define vi vector <int>
const ll nmax=1e5+2;
const ll mod = 1000000007;
string s;
int n;
int dp[100005][13];

int32_t main(){
    ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
    cin>>s;
    n=s.size();
    dp[0][0]=1;
    for(int i=1; i<=n; i++){
        char c=s[i-1];
        if(c>='0' && c<='9'){
            int xd=c-'0';
            for(int m=0; m<13; m++){
                dp[i][(10*m+xd)%13]+=dp[i-1][m];
                dp[i][(10*m+xd)%13]%=mod;
            }
        }
        else{
            for(int xd=0; xd<=9; xd++){
                for(int m=0; m<13; m++){
                    dp[i][(10*m+xd)%13]+=dp[i-1][m];
                    dp[i][(10*m+xd)%13]%=mod;
                }
            }
        }
    }
    cout<<dp[n][5];
}

Measured memory_bytes: 10604
package main

import "fmt"

func main() {
	var n string
	var K int
	fmt.Scan(&n, &K)

	dp := [101][2][4]int{}
	dp[0][0][0] = 1

	for i := 0; i < len(n); i++ {
		c := int(n[i] - '0')
		for smaller := 0; smaller <= 1; smaller++ {
			for k := 0; k <= 3; k++ {
				limit := c
				if smaller == 1 {
					limit = 9
				}
				for d := 0; d <= limit; d++ {
					ns := smaller
					if d < c {
						ns = 1
					}

					nk := k
					if d != 0 {
						nk++
					}
					if K < nk {
						continue
					}

					dp[i+1][ns][nk] += dp[i][smaller][k]
				}
			}
		}
	}

	l := len(n)
	ans := dp[l][0][K] + dp[l][1][K]
	fmt.Println(ans)
}


Measured memory_bytes: 512
/*
 * main.c
 *
 *  Created on: 2020/03/28
 *      Author: family
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MAX(a,b) (a > b ? a : b)
#define MIN(a,b) (a > b ? b : a)
typedef long long int ll;
typedef unsigned long long int ull;

int sort_inc(const void *a, const void *b) { return (*(int*)a - *(int*)b);}
int sort_dec(const void* a, const void* b) { return (*(int*)b - *(int*)a);}
int sort_dec_ll(const void *a, const void *b) {
    ll da = *(ll*)a, db = *(ll*)b;    int val = 0;
    if(da > db) { val = -1; }
    else if (da == db) { val = 0; }
    else { val = 1; }
    return val;
}
int sort_inc_ll(const void *a, const void *b) {
    ll da = *(ll*)a, db = *(ll*)b;    int val = 0;
    if(da > db) { val = 1; }
    else if (da == db) { val = 0; }
    else { val = -1; }
    return val;
}
int sort_dic(const void *a, const void *b) {
    char *pa = (char *)a;    char *pb = (char *)b;    int i = 0, val = 0, N = 10;
    for (i = 0; i < N; i++) {
    	char da = pa[i], db = pb[i];
    	if (da == db) continue;
  		if (da > db) val = 1; else val = -1;
        break;
    }
    return val;
}

void yesno(int ans) {
	if (ans == 1) {	printf("Yes\n");
	} else {		printf("No\n");	}
	return;
}

void okng(int ans) {
	if (ans == 1) { printf("OK\n");
	} else { 		printf("NG\n");	}
	return;
}

int main()
{
	int N = 0;
	scanf("%d", &N);

	int ans = 0;
	if (N >= 1800) {
		ans = 1;
	} else if (N>=1600) {
		ans = 2;
	} else if (N>=1400) {
		ans = 3;
	} else if (N>=1200) {
		ans = 4;
	} else if (N>=1000) {
		ans = 5;
	} else if (N>=800) {
		ans = 6;
	} else if (N>=600) {
		ans = 7;
	} else {
		ans = 8;
	}

	printf("%d\n",ans);
	//yesno(ans);
	//okng(ans);
	return 0;
}


Measured memory_bytes: 1728
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.NoSuchElementException; public class Main { int N,T; int[] imos; public void solve() { N = nextInt(); T = nextInt(); imos = new int[T + 2]; for(int i = 0;i < N;i++){ int l = nextInt(); int r = nextInt(); imos[l]++; imos[r]--; } int ans = imos[0]; for(int i = 0;i < T + 1;i++){ imos[i + 1] += imos[i]; ans = Math.max(ans,imos[i + 1]); } out.println(ans); } public static void main(String[] args) { out.flush(); new Main().solve(); out.close(); } /* Input */ private static final InputStream in = System.in; private static final PrintWriter out = new PrintWriter(System.out); private final byte[] buffer = new byte[2048]; private int p = 0; private int buflen = 0; private boolean hasNextByte() { if (p < buflen) return true; p = 0; try { buflen = in.read(buffer); } catch (IOException e) { e.printStackTrace(); } if (buflen <= 0) return false; return true; } public boolean hasNext() { while (hasNextByte() && !isPrint(buffer[p])) { p++; } return hasNextByte(); } private boolean isPrint(int ch) { if (ch >= '!' && ch <= '~') return true; return false; } private int nextByte() { if (!hasNextByte()) return -1; return buffer[p++]; } public String next() { if (!hasNext()) throw new NoSuchElementException(); StringBuilder sb = new StringBuilder(); int b = -1; while (isPrint((b = nextByte()))) { sb.appendCodePoint(b); } return sb.toString(); } public int nextInt() { return Integer.parseInt(next()); } public long nextLong() { return Long.parseLong(next()); } public double nextDouble() { return Double.parseDouble(next()); } }


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

void _main() {
  int N;
  ll K;
  cin >> N >> K;
  vector<pair<int,int>> ab(N);
  rep(i, 0, N) cin >> ab[i].first >> ab[i].second;
  sort(all(ab));

  rep(i, 0, N) {
    K -= ab[i].second;
    if (K < 1) {
      cout << ab[i].first << endl;
      return;
    }
  }
}

Measured memory_bytes: 1024
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>

#define rep(i,x,y) for (int i=x;i<=y;i++)
#define dep(i,y,x) for (int i=y;i>=x;i--)
#define sz(x) (int)(x.size())

using namespace std;

typedef long long LL; 
typedef unsigned long long uLL;

const LL INF=(1e18)+7;

LL a,b,c,ans;

int main()
{
 scanf("%lld%lld%lld",&a,&b,&c);

 ans=INF;
 if (a&1) ans=min(ans,b*c); else ans=0;
 if (b&1) ans=min(ans,a*c); else ans=0;
 if (c&1) ans=min(ans,a*b); else ans=0;

 printf("%lld\n",ans);

 // system("pause");
 return 0;
}


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

int a, b, q;
long long s[100010], t[100010];

#define abs llabs

long long minNibA(long long x){
  long long ans = LLONG_MAX;

  int left = -1, right = a;

  while(right-left > 1){
    int mid = (right + left) / 2;
    if(s[mid] < x) left = mid;
    else right = mid;
  }

  if(left > -1){
    ans = min(ans, abs(s[left]-x));
  }

  if(right < a){
    ans = min(ans, abs(s[right]-x));
  }

  return ans;
}

long long minNibB(long long x){
  long long ans = LLONG_MAX;

  int left = -1, right = b;
  while(right-left > 1){
    int mid = (right + left) / 2;
    if(t[mid] < x) left = mid;
    else right = mid;
  }

  if(left > -1){
    ans = min(ans, abs(t[left]-x));
  }

  if(right < b){
    ans = min(ans, abs(t[right]-x));
  }

  return ans;
}


int main(){
  cin >> a >> b >> q;
  for(int i = 0;i < a;i++){
    cin >> s[i];
  }

  for(int i = 0;i < b;i++){
    cin >> t[i];
  }

  sort(s, s+a);
  sort(t, t+b);

  long long x;
  for(int p = 0;p < q;p++){
    cin >> x;

    long long ans = LLONG_MAX;

    int left = -1, right = a;
    while(right-left > 1){
      int mid = (right + left) / 2;
      if(s[mid] < x) left = mid;
      else right = mid;
    }

    if(left > -1){
      ans = min(ans, abs(s[left]-x)+minNibB(s[left]));
    }

    if(right < a){
      ans = min(ans, abs(s[right]-x)+minNibB(s[right]));
    }


    left = -1; right = b;
    while(right-left > 1){
      int mid = (right + left) / 2;
      if(t[mid] < x) left = mid;
      else right = mid;
    }

    if(left > -1){
      ans = min(ans, abs(t[left]-x)+minNibA(t[left]));
    }

    if(right < b){
      ans = min(ans, abs(t[right]-x)+minNibA(t[right]));
    }

    cout << ans << endl;
  }

  return 0;
}



Measured memory_bytes: 2816
#include<stdio.h>

int main(){
    int A, B;
    int add, sub, mul;

    scanf("%d %d", &A, &B);

    add = A+B;
    sub = A-B;
    mul = A*B;

    if(sub<= add && mul <= add){
        printf("%d", add);
    }else if(add<= mul && sub <= mul){
        printf("%d", mul);
    }else{
        printf("%d", sub);
    }

    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <cmath>
#define N 1000
using namespace std;
main () {
	int n, s[N];
	while (cin >> n, n) {
		double m = 0, a = 0;
		for (int i=0; i<n; i++) {
			cin >> s[i];
			m += s[i];
		}
		m /= n;
		for (int i=0; i<n; i++) a += (s[i]-m)*(s[i]-m);
		a /= n;
		printf("%.6f\n", sqrt(a));
	}
}

Measured memory_bytes: 3168
#include <cstdio>
#include <iostream>

using namespace std;

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

	string s, t;
	cin >> s >> t;

	for(int i = 0; i < n; ++i){
		cout << s[i] << t[i];
	}
	cout << endl;

	return 0;
}


Measured memory_bytes: 256
package main

import (
    "fmt"
    "bufio"
    "os"
    )
    
var r = bufio.NewReader(os.Stdin)

func main(){
   var a,b int 
   fmt.Fscan(r, &a)
   fmt.Fscan(r, &b)
   if a > b {
       fmt.Println("a > b")
   }
   if a < b {
       fmt.Println("a < b")
   }
   if a == b {
       fmt.Println("a == b")
   }
}


Measured memory_bytes: 1124
//package AtCoder;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;

public class Main {
	static int INF = (int) 1e9;
	static ArrayList<Integer>[] adjList;

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		int res = 0 ;
		int n = sc.nextInt();
		
		for(int i = 1 ; i <= n ; i++) {
			int t = sc.nextInt();
			res += ( i%2!=0 && t%2!=0 )? 1 : 0;
		}
		System.out.println(res);
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}

		public Scanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

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

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}

	public static int gcd(int a, int b) {
		if (a == 0)
			return b;

		return gcd(b % a, a);
	}

	public static void shuffle(int[] a) {
		int n = a.length;
		for (int i = 0; i < n; i++) {
			int r = i + (int) (Math.random() * (n - i));
			int tmp = a[i];
			a[i] = a[r];
			a[r] = tmp;
		}
	}

	public static long square(long l) {
		return l * l;
	}
}


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

using namespace std;
long long a[10005];

int jjj(int n)
{
	if(n == 1) return 0;
	int da = 0;
	if(n % 2 == 1) return 0;
	while(n % 2 == 0)
	{
		n /= 2;
		da++;
	}
	return da;
}

int main() 
{
	int n;
	scanf("%d", &n);
	int jxf = 0;
	for(int i = 1; i <= n; i++) 
	{
		scanf("%d", &a[i]);
		jxf += jjj(a[i]);
	}
	printf("%d\n", jxf);
	return 0;
}

Measured memory_bytes: 384