akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define pii pair<int,int>
#define REP(i,a) for(int (i)=0; (i)<(a); (i)++)
#define RREP(i,a) for(int (i)=a-1; (i)>=(0); (i)--)
#define REP2(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
#define m0(x) memset(x,0,sizeof(x))
typedef long long ll;
using namespace std;



int main(){
	ll N; cin>>N;
	string s; cin>>s;
	vector<ll> siro(N+1,0);
	vector<ll> kuro(N+1,0);
	REP(i,N) kuro[i+1] = kuro[i] + (s[i] == '#');
	for(int i = N-1; i>=0; --i) siro[i] = siro[i+1] + (s[i] == '.');
	ll ans = N;
	REP(i,N+1){
		ans = min(ans, siro[i] + kuro[i]);
	}
	cout << ans;
  	return 0;
}


Measured memory_bytes: 3716
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N = 2e5 + 5,INF = 0x7ffffffddeadbeef,inf = INF >> 1;
int n,a[N];
map<int,ll> dp[N];
ll DP(int i,int k) {
	if(k > (i+1>>1)) return -inf;
	if(i <= 0||k==0) return 0;
	if(dp[i].count(k)) return dp[i][k];
	return dp[i][k] = max(DP(i-2,k-1) + a[i],DP(i-1,k));
}
int main() {
	cin >> n;
	for(int i = 1;i <= n;++i)	
		cin >> a[i];
	cout << DP(n,n>>1) << endl;
	return 0;
}


Measured memory_bytes: 43364
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
ll v[4][101];
int c[4];

int main() {
	int n,w;
	cin>>n>>w;
	int w0;
	cin >> w0 >> v[0][++c[0]];
	FOR(i,1,n){
		int r;
		cin >> r;
		cin >> v[r-w0][++c[r-w0]];
	}
	REP(i,4){
		sort(v[i] + 1, v[i] + 1 + c[i], greater<ll>());
		REP(j,c[i])v[i][j+1]+=v[i][j];
		c[i]++;
	}
	ll ans = 0;
	REP(i,c[0])REP(j,c[1])REP(k, c[2])REP(l,c[3]){
		ll a = (ll)v[0][i] + v[1][j] + v[2][k] + v[3][l];
		ll s = (ll)w0 * (i+j+k+l) + j + k*2 + l*3;
		if(s<=w)ans = max(ans, a);
	}
	cout << ans << endl;
	return 0;
}


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

using ll = long long;

int solve(vector<ll> values)
{
    auto S = *max_element(begin(values), end(values));
    auto small_primes = vector<ll>();
    auto small_prime_limit = static_cast<int>(cbrt(S)) + 1;
    auto large_prime_squares = unordered_map<ll, ll>();
    auto large_prime_limit = static_cast<int>(sqrt(S)) + 1;
    auto is_prime = vector<bool>(large_prime_limit+1, true);
    for (auto p = 2LL; p <= large_prime_limit; p++) if (is_prime[p])
    {
        if (p <= small_prime_limit) small_primes.push_back(p);
        else large_prime_squares[p*p] = p;
        for (auto k = 2*p; k <= large_prime_limit; k += p)
            is_prime[k] = false;
    }

    auto normalize = [&](ll x)
    {
        for (auto p : small_primes)
        {
            auto cube = p*p*p;
            while (x % cube == 0) x /= cube;
        }
        return x;
    };

    auto counts = unordered_map<ll, int>();
    for (auto x : values)
        counts[normalize(x)]++;

    auto dual = [&](ll x)
    {
        auto y = 1LL;
        for (auto p : small_primes)
        {
            if (x % (p*p) == 0) y *= p;
            else if (x % p == 0) y *= p*p;
            while (x % p == 0) x /= p;
        }
        if (large_prime_squares.count(x) == 1)
            y *= large_prime_squares[x];
        else y *= x*x;
        return y;
    };

    auto result = 0;
    for (auto kv : counts)
    {
        auto x = kv.first, y = dual(x);
        if (counts.count(y) == 0) result += counts[x];
        else if (x < y) result += max(counts[x], counts[y]);
    }
    if (counts[1]) result++;
    return result;
}

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

    auto values = vector<ll>(N);
    for (auto& x : values) scanf("%lld", &x);

    printf("%d\n", solve(values));
}


Measured memory_bytes: 6308
import string

cs = string.ascii_lowercase
def factor(n):
    b = 26
    ds = [n % b]
    n //= b
    while n:
        d = n % b
        ds.append(d)
        n //= b
    return ds

n = int(input())
lst = [sum(26**i for i in range(p+1)) - 1 for p in range(1, 12)]
lst = [0] + lst
for i in range(1, len(lst)):
    if n <= lst[i]:
        pos = n - lst[i - 1] - 1
        fp = factor(pos)
        while len(fp) < i:
            fp.append(0)
        fp.reverse()

        print(''.join(cs[d] for d in fp))
        break


Measured memory_bytes: 9768
/*
Author : N_o_o_B
Created : December 03 2019 23:02:17 
*/
#include <bits/stdc++.h>
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
*/
#define TRACE
#ifdef TRACE
#define trace(...) { cerr<<"[ "; __trace__(#__VA_ARGS__, __VA_ARGS__);}
#undef endl
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const pair<Arg1,Arg2> &x) {
    return out<<"("<<x.first<<","<<x.second<<")";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const vector<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const set<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const map<Arg1,Arg2> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
void __trace__(const string name, Arg1&& arg1){
    cerr << name << " : " << arg1 << " ] " << endl;
}
 
template <typename Arg1, typename... Args>
void __trace__(const string names, Arg1&& arg1, Args&&... args){
    const string name = names.substr(0,names.find(','));
    cerr<<name<<" : "<<arg1<<" | ";
    __trace__(names.substr(1+(int)name.size()), args...);
}
#else
    #define trace(args...)
#endif
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vll;
typedef vector<vl> vvl;
//typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> oset;
#define fori(i,n) for(int i=0;i<n;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repd(i,a,b) for(int i=a;i>=b;i--)
#define ford(i,n)  for(int i=n-1;i>=0;i--)
#define trav(x,a) for(auto& x:a)
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define sz(a) (int)a.size()
#define fi first
#define se second
clock_t time_p=clock();
void time_taken()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
//const ll mod=998244353;
const ll mod=1e9+7;
const ll INF=1e18;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    cout.precision(12);cout << fixed;
    string s;
    cin >> s;
    int n=sz(s);
    fori(i,n-1){
        if(s[i]==s[i+1]){
            cout << i+1 << " " << i+2 << endl;
            return 0;
        }
    }
    fori(i,n-2){
        if(s[i]==s[i+2]){
            cout << i+1 << " " << i+3 << endl;
            return 0;
        }
    }
    cout << "-1 -1" << endl;
    time_taken();
    return 0;
}


Measured memory_bytes: 512
s=input()
n=len(s)
def isk(S):
  l=len(S)
  f=1
  for i in range(l//2+1):
    if S[i]==S[l-i-1]:
      f*=1
    else:
      f=0
  if f:
    return True
  else:
    return False
  
if isk(s) and isk(s[:(n-1)//2]) and isk(s[(n+1)//2:]):
  print('Yes')
else:
  print('No')

Measured memory_bytes: 61912
#include <bits/stdc++.h>
using namespace std;
int main() {

 double n,k;

cin>>n>>k;
 double x=(1.0/n),ans=0;
for(int i=1;i<=n;i++)
{
     double x=(1.0/n);
    int now=i;
    while(now<k)
    {
        now*=2.0;
        x/=2.0;
    }
ans+=x;
}
  printf("%0.12f",ans);
}


Measured memory_bytes: 256
unittest
{
	assert( [ "4 4", "1 1", "4 4", "..#.", "..#.", ".#..", ".#.." ].solve == 1 );
	assert( [ "4 4", "1 4", "4 1", ".##.", "####", "####", ".##." ].solve == -1 );
	assert( [ "4 4", "2 2", "3 3", "....", "....", "....", "...." ].solve == 0 );
	assert( [ "4 5", "1 2", "2 5", "#.###", "####.", "#..##", "#..##" ].solve == 2 );
}



import std.container;
import std.conv;
import std.format;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.solve.writeln;
}

auto solve( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto h = 0L;
	auto w = 0L;
	input.front.formattedRead!"%s %s"( h, w );
	auto cy = 0L;
	auto cx = 0L;
	input.popFront;
	input.front.formattedRead!"%s %s"( cy, cx );
	cy--;
	cx--;
	auto dy = 0L;
	auto dx = 0L;
	input.popFront;
	input.front.formattedRead!"%s %s"( dy, dx );
	dy--;
	dx--;
	auto sss = new dchar[][]( h, w );
	foreach( ref ss; sss )
	{
		input.popFront;
		ss = input.front.to!( dchar[] );
	}
	
	auto dss = dijkstraGridEx( sss, cy, cx );
	return ( dss[ dy ][ dx ] == long.max ) ? -1 : dss[ dy ][ dx ];
}

// 正のグリッドマップの始点指定最短経路探索（ダイクストラ法）
auto dijkstraGridEx( T, T W = '#' )( T[][] css, long sy, long sx )
{
	auto dss = new long[][]( css.length, css[ 0 ].length );
	foreach( ref ds; dss ) ds[] = long.max;
	dss[ sy ][ sx ] = 0;
	auto uss = new bool[][]( css.length, css[ 0 ].length );
	
	auto queue = heapify!( ( a, b ) => b[ 2 ] < a[ 2 ] )( [ tuple( sy, sx, dss[ sy ][ sx ] ) ] );
	while( !queue.empty )
	{
		auto fy = queue.front[ 0 ];
		auto fx = queue.front[ 1 ];
		auto fd = queue.front[ 2 ];
		queue.popFront();
		
		if( uss[ fy ][ fx ] ) continue;
		uss[ fy ][ fx ] = true;
		
		// 徒歩
		foreach( p; [ [ -1, 0 ], [ 1, 0 ], [ 0, -1 ], [ 0, 1 ] ] )
		{
			auto ty = fy + p[ 0 ];
			auto tx = fx + p[ 1 ];
			
			if( ty < 0 || css.length <= ty || tx < 0 || css[ ty ].length <= tx ) continue;		// マップ外
			if( css[ ty ][ tx ] == W ) continue;												// 壁
			if( dss[ ty ][ tx ] <= fd ) continue;												// 探索済
			
			dss[ ty ][ tx ] = fd;
			queue.insert( tuple( ty, tx, fd ) );
		}
		
		// ワープ
		foreach( py; -2L .. 3L )
		{
			foreach( px; -2L .. 3L )
			{
				auto ty = fy + py;
				auto tx = fx + px;
				auto td = fd + 1;
				
				if( ty < 0 || css.length <= ty || tx < 0 || css[ ty ].length <= tx ) continue;		// マップ外
				if( css[ ty ][ tx ] == W ) continue;												// 壁
				if( dss[ ty ][ tx ] <= td ) continue;												// 探索済
				
				dss[ ty ][ tx ] = td;
				queue.insert( tuple( ty, tx, td ) );
			}
		}
	}
	return dss;
}


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

typedef long long LL;

using namespace std;

int N,M;
struct Event
{
	int len,L,R;	
};
vector<Event>E;

Event Make(int len,int L,int R)
{
	return (Event){len,L,R};
}

int Tr[300010];
int lowbit(int x){return x&-x;}
int getsum(int x){int S=0;while(x){S+=Tr[x];x-=lowbit(x);}return S;}
void add(int x,int y){while(x<=M){Tr[x]+=y;x+=lowbit(x);}}

bool cmp(Event A,Event B)
{
	return A.len<B.len;
}

int main()
{
	scanf("%d%d",&N,&M);
	for (int i=1;i<=N;i++)
	{
		int LL,RR;
		scanf("%d%d",&LL,&RR);
		E.push_back(Make(RR-LL+1,LL,RR));
	}
	sort(E.begin(),E.end(),cmp);
	int now = 0;
	int cnt = N;
	for (int i=1;i<=M;i++)
	{
		while(now<E.size() && E[now].len<i)
		{
			Event tmp = E[now];
			add(tmp.L,1);
			add(tmp.R+1,-1);
			now++;
			cnt--;
		}
		int ans = cnt;
		for (int j=i;j<=M;j+=i) ans+=getsum(j);
		printf("%d\n",ans);
	}
}

Measured memory_bytes: 6512
#include<iostream>
#include<vector>
#include<algorithm>
#include<tuple>
#include<utility>

using namespace std;

typedef long long int64;

int main(void){
    int64 N;
    int64 ans=0;
    cin>>N;
    vector<int64> A(N),B(N),C(N);
    for(int64 i=0;i<N;i++){
        cin>>A[i];
    }
    for(int64 i=0;i<N;i++){
        cin>>B[i];
        ans+=B[i];
    }
    for(int64 i=0;i<N-1;i++){
        cin>>C[i];
        
    }
    for(int64 i=0;i<N-1;i++){
        if(A[i]+1==A[i+1]){
            ans+=C[A[i]-1];
        }
    }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
//#define ll long long
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 (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) REP(i, 0, n)
#define rep_rev(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
ll t1,t2,t3;
const ll mod = 998244353;
const int INF = 1e9;
const ll INFLONG = 1e18;

int main(){
  ll x,k,d;
  cin >> x >> k >> d;
  x = abs(x);
  t1 = x / d;
  ll ans;
  if(t1 > k){
    ans = x - d * k;
  }else{
    t2 = x - d * t1;
    k -= t1;
    if(k % 2 != 0){
      ans = abs(t2 - d);
    }else{
      ans = t2;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3632
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<cmath>
#include<numeric>
#include<iomanip>

using namespace std;
using ll =long long;
const int mod = 1000000007;
int gcd(ll a, ll b) {

	if (b == 0) {

		return a;
	}
	else {
		a = a%b;
		gcd(b, a);
	}
}
class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% mod + mod) % mod) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint & a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint & operator-=(const mint & a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint & operator*=(const  mint & a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint & a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint & a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint & a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}
	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint & a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint & a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream & os, const mint & m) {
		os << m.x;
		return os;
	}
};
int main() {
	ll N;
	cin >> N;
	vector<ll>A(N), B(N);
	vector<pair<ll,ll>>X;
	for (int i = 0; i < N; i++) {
		cin >> A[i] >> B[i];
	}
	for (int i = 0; i < N; i++) {

		X.push_back(make_pair(B[i],A[i]));
	}
	sort(X.begin(), X.end());
	ll sum=0;
	for (int i = 0; i < N; i++) {
		sum += X[i].second;
		if (sum > X[i].first) {
			cout << "No";
			return 0;
		}

	}
	cout << "Yes";
}

Measured memory_bytes: 9200
#include <stdio.h>
int main(){
  
    int N,i,a;
    double H[1000],Ta[1000],Tb[1000];
    double T,A,x,max=1000;
  
    scanf(" %d", &N);
    scanf(" %lf %lf", &T, &A);
  
    for(i = 0; i < N; ++i){
      scanf(" %lf", &H[i]);
    }
  
    for(i = 0; i < N; ++i){
      Ta[i] = T - H[i] * 0.006;
    }
  
    for(i = 0; i < N; ++i){
      x = A - Ta[i];
      if(x < 0){
        Tb[i] = Ta[i] - A;
      }
      else {
        Tb[i] = A - Ta[i];
      }
    }
  
    for(i = 0; i < N; ++i){
      if(Tb[i] < max){
        max = Tb[i];
        a = i + 1;
      }
    }
  
    printf("%d\n", a);
  
    return 0;
}
  
  
        

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

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


#define pb push_back
#define ff first
#define ss second
#define INF int(2e9) + 9
#define BIG_INF ll(9e18)
#define SIZE 300010
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define len(v) int((v).size())
#define BACK(v) ll((v).back())
#define sqr(x) (x) * (x)
#define cube(x) (x) * (x) * (x)
#define filein freopen("input.txt", "r", stdin)
#define fileout freopen("output.txt", "w", stdout);


ll binpow(ll a, ll b, ll MOD = BIG_INF)
{
    ll res = 1;

    while(b)
    {
        if(b & 1)
            res *= a;
        a *= a;
        b >>= 1;
        a %= MOD;
        res %= MOD;
    }

    return res % MOD;
}

const ll mod = 1e9 + 7;

int T = 1;
int n, m, k;

int cntR[SIZE], cntC[SIZE];


map<pii, int> used;

void solve()
{

    cin >> n >> m >> k;
    int maxR = 0, maxC = 0, r = 0, c = 0;
    while(k--)
    {
        int x, y;
        cin >> x >> y;
        cntR[x]++;
        cntC[y]++;
        if(maxR < cntR[x])
        {
            maxR = cntR[x];
            r = x;
        }

        if(maxC < cntC[y])
        {
            maxC = cntC[y];
            c = y;
        }

        used[{x, y}] = 1;
    }
    int ans = 0;
//    cout << maxR << ' ' << r << '\n';
    for(int i = 1; i <= n; i++)
    {
        ans = max(ans, maxC + cntR[i] - used[{i, c}]);
    }

    for(int i = 1; i <= m; i++)
    {
        ans = max(ans, maxR + cntC[i] - used[{r, i}]);
    }

    cout << ans;

    return;
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
//    filein;fileout;
//
//    cin >> T;

    while(T--)
    {
        solve();
    }
    return 0;
}



Measured memory_bytes: 62220
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 functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))
ZIP = lambda: zip(*(MAP() for _ in range(n)))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    N = INT()
    print(ceil(N/1000)*1000-N)


if __name__ == '__main__':
    main()


Measured memory_bytes: 10048
import sys
import math

INF = 10**9+7

stdin = sys.stdin
def na(): return map(int, stdin.readline().split())
def ns(): return stdin.readline().strip()
def nsl(): return list(stdin.readline().strip())
def ni(): return int(stdin.readline())
def nil(): return list(map(int, stdin.readline().split()))

a = b = INF
n = ni()

x = int(math.sqrt(n) // 1 + 1)
for i in reversed(range(x)):
    if((n/i) == (n//i)):
        a = i
        b = n // i
        break

ans = max(len(str(a)), len(str(b)))
print(ans)



Measured memory_bytes: 3064
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
using namespace std;

int main()
{
    int len;
    cin>>len;

    string s;
    cin>>s;

    int maxx=-1;
    for(int i=1;i<=len;++i)
    {
        string ll;
        string rr;
        int cnt=0;
        for(int a=0;a<i;++a)
        {
            ll+=s[a];
        }


        for(int b=i;b<len;++b)
        {
            rr+=s[b];
        }

        for(int k=0;k<26;++k)
        {
            if(ll.find('a'+k)!=-1 && rr.find('a'+k)!=-1)
            cnt++;
        }

        if(cnt>maxx)
            maxx=cnt;
    }

    cout<<maxx<<endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ld long double
#define ll long long
#define st first
#define nd second
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define pb push_back
using namespace std;
const int N = (1<<19), M = (1<<11);
int L=1e5;
vector<pii> calced[M];
vector<pii> backpack(vector<pii> items) {
	int sz = items.size();
	vector<pii> res;
	if(items.empty()) return res;
	for(int mask=0; mask<(1<<sz); ++mask) {
		int V=0, W=0;
		for(int i=0; i<sz; ++i) { 
			if(((1<<i)&mask)!=0) {
				V += items[i].st;
				W += items[i].nd;
			}
		}
		if(W <= L) res.push_back({W, V});
	}
	sort(res.begin(), res.end());
	int mx = -1;
	vector<pii> Res;
	for(auto i: res) {
		if(i.nd > mx) {
			Res.push_back(i);
			mx = i.nd;
		}
	}
	return Res;
}
int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n;
	cin>>n;
	vector<int> v(n+1), w(n+1);
	for(int i=1; i<=n; ++i) {
		cin>>v[i]>>w[i];
	}
	for(int i=1; i<M; ++i) {
		if(i>n) break;
		int V = i;
		vector<pii> items;
		while(V) {
			items.push_back({v[V], w[V]});
			V /= 2;
		}
		calced[i] = backpack(items);
	}
	int q;
	cin>>q;
	while(q--) {
		int V;
		cin>>V>>L;
		//int V1 = V;
		//cerr<<"V: "<<V<<'\n';
		if(V==1) {
			if(w[1] <= L) cout<<v[1]<<'\n';
			else cout<<0<<'\n';
			continue;
		}
		vector<pii> items;
		while(log2(V)>10) {
			items.push_back({v[V], w[V]});
			V /= 2;
		}
	//	int sz = items.size();
		/*if(V1==12) {
		for(auto i: items) {
			cerr<<i.st<<' '<<i.nd<<'\n';
		}
		}*/
		vector<pii> res1 = calced[V];
		//cerr<<V<<' '<<calced[V].size()<<'\n';
		//for(auto i: calced[V]) {
		//	cerr<<i.st<<' '<<i.nd<<'\n';
		//}
		vector<pii> res2 = backpack(items);
		int Size = res2.size();
		int j = Size-1;
		int Ans = 0;
		for(auto i: res1) {
			if(i.st > L) break;
			//i.nd --> value
			//i.st --> weight
			// i.st -- increasing
			while(j >= 0 && i.st + res2[j].st > L) { 
				j--;
			}
			if(j==-1) {
			//if(V1==12)
			//cerr<<" "<<i.st<<' '<<i.nd<<'\n';
				Ans = max(Ans, i.nd);
			}
			else {
			//if(V1==12)
			//cerr<<" "<<i.st<<' '<<i.nd<<"  "<<res2[j].st<<' '<<res2[j].nd<<'\n';
				Ans = max(Ans, i.nd + res2[j].nd);
			}
		}
		cout<<Ans<<'\n';
	}
}


Measured memory_bytes: 27144
#include<stdio.h>
#include<stdlib.h>
int main()
{
	int a,b,c,p,q,r,s,nq,ns;
	while(scanf("%d%d%d",&a,&b,&c),a)
	{
		for(r=1;r<=(a+1)/2;++r)if(a%r==0)
		{
			p=a/r;for(s=-abs(c);s<=abs(c);++s)if(!c || s&&c%s==0)
			{
				if(c) q=c/s;
				else
				{
					if(b%r==0)q = b/r;
					else continue;
				}
				if(p==r&&q<s)nq=s,ns=q;
				else nq=q,ns=s;
				if(b==p*ns+r*nq)
				{
					printf("%d %d %d %d\n",p,nq,r,ns);
					goto E;
				}
			}
		}
		puts("Impossible");
E:;
	}
	return 0;
}

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

#define int long long
typedef vector<int> vint;
typedef pair<int, int> pint;
const double PI = 3.141592653589793238462643383279;
const int DY[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int DX[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
template<typename T, typename U> inline bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> inline bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
struct Init {
    Init() {
        cout << fixed << setprecision(20);
    };
} init;

int N;
vint b;
signed main() {
    cin >> N;
    b.push_back(LLONG_MAX);
    for (int i = 0; i < N - 1; i++) {
        int a;
        cin >> a;
        b.push_back(a);
    }
    b.push_back(LLONG_MAX);
    int ans = 0;
    for (int i = 0; i < N; i++) {
        ans += min(b[i], b[i + 1]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
{-# OPTIONS_GHC -O2 #-}
import qualified Control.Arrow         as A
import qualified Data.ByteString.Char8 as BSC8
import qualified Data.Vector.Unboxed   as VU


getI :: BSC8.ByteString -> Maybe (Int, BSC8.ByteString)
getI = fmap (A.second BSC8.tail) . BSC8.readInt
getAB :: IO (Int, Int)
getAB = (\vec -> (vec VU.! 0, vec VU.! 1)) . VU.unfoldrN 2 getI <$> BSC8.getLine

main :: IO ()
main = do
  (n, m) <- getAB
  print $ (n * (n - 1) + m * (m - 1)) `div` 2


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

namespace ConsoleApp6
{
	class Program
	{
		static void Main(string[] args)
		{
			string abc = Console.ReadLine();
			string[] num = abc.Split(' ');

			int a = int.Parse(num[0]);
			int b = int.Parse(num[1]);
			int c = int.Parse(num[2]);
			int count = 0;

			for(int x = a; x <= b; x++)
			{
				if(c % x == 0)
				{
					count++;
				}
			}

			Console.WriteLine("{0}", count);
		}
	}
}


Measured memory_bytes: 17996
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...)
#endif

struct rollinghash {
    long long base1, base2, mod1, mod2;
    vector<long long> hash1, hash2, pow1, pow2;

    rollinghash(string s) {
        int n = s.size();
        base1 = 1009;
        base2 = 1007;
        mod1 = 1000000007;
        mod2 = 1000000009;
        hash1.assign(n + 1, 0);
        hash2.assign(n + 1, 0);
        pow1.assign(n + 1, 1);
        pow2.assign(n + 1, 1);

        for (int i = 0; i < n; i++) {
            hash1[i + 1] = (hash1[i] + s[i]) * base1 % mod1;
            hash2[i + 1] = (hash2[i] + s[i]) * base2 % mod2;
            pow1[i + 1] = pow1[i] * base1 % mod1;
            pow2[i + 1] = pow2[i] * base2 % mod2;
        }
    }

    pair<long long, long long> get(int l, int r) {  // [l, r]
        long long t1 = ((hash1[r] - hash1[l] * pow1[r - l]) % mod1 + mod1) % mod1;
        long long t2 = ((hash2[r] - hash2[l] * pow2[r - l]) % mod2 + mod2) % mod2;
        return make_pair(t1, t2);
    }
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s, t;
    cin >> s >> t;
    string x = s;
    int n = s.size(), m = t.size();
    x += s;
    while (x.size() < m + n) {
        x += s;
    }
    x.resize(n + m);
    rollinghash rh(x), tt(t);
    pair<ll, ll> val = tt.get(0, m);
    vector<int> to(n, -1);
    for (int i = 0; i < n; i++) {
        if (rh.get(i, i + m) == val) {
            to[i] = (i + m) % n;
        }
    }
    vector<bool> was(n);
    debug(to);
    function<void(int, int)> loop = [&](int v, int p) {
        if (to[v] == p) {
            cout << -1 << '\n';
            exit(0);
        }
        if (to[v] == -1 || was[v]) return;
        was[v] = true;
        loop(to[v], p);
    };
    for (int i = 0; i < n; i++) {
        loop(i, i);
    }
    vector<int> cnt(n);
    function<void(int)> dfs = [&](int v) {
        if (to[v] == -1 || cnt[v] != 0) return;
        dfs(to[v]);
        cnt[v] = cnt[to[v]] + 1;
    };
    for (int i = 0; i < n; i++) {
        dfs(i);
    }
    cout << *max_element(cnt.begin(), cnt.end()) << '\n';
    return 0;
}


Measured memory_bytes: 67656
let n = Int(readLine()!)!

let a = readLine()!.characters.split{$0 == " "}.map{ Int(String($0))! }
let b = readLine()!.characters.split{$0 == " "}.map{ Int(String($0))! }
let c = readLine()!.characters.split{$0 == " "}.map{ Int(String($0))! }

var ret = 0

for i in 0..<a.count {
  ret += b[a[i] - 1]
  if (i != 0) && (a[i] == a[i - 1] + 1) {
    ret += c[a[i - 1] - 1]
  }
}

print(ret)

Measured memory_bytes: 4080
# -*- coding: utf-8 -*-

"""
本番終了後、ちょっと修正版
"""

from collections import defaultdict
from math import sqrt

# 素因数分解
def fact_prime(num):
    d = defaultdict(int)
    # 終点はルート切り捨て+1
    end = int(sqrt(num)) + 1
    for i in range(2, end+1):
        cnt = 0
        # 素因数分解：小さい方から割れるだけ割って素数をカウント
        while num % i == 0:
            num //= i
            d[i] += 1
        # 1まで分解したら終了
        if num == 1:
            break
    # 最後に残ったnumは素数(ただし1^1は1^0なので数に入れない)
    if num != 1:
        d[num] += 1
    return d

N, P = map(int, input().split())

if N == 1:
    print(P)
    exit()
d = fact_prime(P)
ans = 1
for k, v in d.items():
    if v >= N:
        ans *= k ** (v // N)
print(ans)


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

int main() {
  int A, B, C, X;
  cin >> A >> B >> C >> X;
  int cnt=0;
  
  for(int i=0; i<=A; i++){
    for(int j=0; j<=B; j++){
      for(int k=0; k<=C; k++){
        if(X == (500*i + 100*j + 50*k))
          cnt++;
      }
    }
  }
  
  cout << cnt << endl;
  
  return 0;
}

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

typedef long long ll;
const int N = 200005;

ll a[N];

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	
	ll n;
	cin>>n;
	
	string ans = "";
	
	while(n){
		n--;
		int r = n%26;
		char c = 'a' + r;
		ans = c + ans;
		n = (n-r)/26;
	}
	
	cout<<ans;
	
	return 0;
}


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

const int MAX_N=10001000;
bool prime[MAX_N];
int num[MAX_N];
int main(){

prime[0]=prime[1]=false;

	for(int i=2;i<MAX_N;i++){
		prime[i]=true;
	}


	for(int i=2;i*i<MAX_N;i++){
		if(prime[i]){
			for(int j=i*i;j<MAX_N;j+=i)
			prime[j]=false;
		}
	}
	
	int cnt=0,tmp=MAX_N;
	
	
	
	

	
	int n,ans;
	while(true){
		cin>>n;
		if(n==0)break;
		
		for(int i=n-8;i>=0;i--){
		if(prime[i]&&prime[i+2]&&prime[i+6]&&prime[i+8]){
			cout<<i+8<<endl;
			break;
		}
		}
	}
	
	
	return 0;
}

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

int main() {
    int n;
    string s;
    cin >> n >> s;

    for (int i = 0; i < s.size(); i++) {
        if (s.at(i) + n > 'Z') {
            cout << (char)('A' + (s.at(i) + n - 'Z' - 1));
        } else {
            cout << (char)(s.at(i) + n);
        }
    }

    cout << endl;

    return 0;
}


Measured memory_bytes: 3624
import Control.Monad (replicateM)
import Data.Char (intToDigit)

f :: Int -> [[Int]] -> Int -> Int
f n sc x 
    | length strX > n = -1
    | and [strX !! (s - 1) == intToDigit c | [s, c] <- sc] = x
    | otherwise = f n sc (x + 1)
  where strX = show x

main = do
    [n, m] <- map read . words <$> getLine :: IO [Int]
    sc <- replicateM m (map read . words <$> getLine) :: IO [[Int]]
    print $ f n sc (if n == 1 then 0 else 10 ^ (n - 1))


Measured memory_bytes: 636
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		// 整数の入力
		int a = sc.nextInt();
		String s = sc.next();
		String[] S = s.split("");
		int cnt = 0;

		for(String str:S){
			if(str.equals("R"))cnt++;
			else cnt--;
		}

		// 出力
		System.out.println(cnt>0?"Yes":"No");
	}
}

Measured memory_bytes: 23764
#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 <iomanip>
using namespace std;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
typedef vector <int> vi;
typedef pair<int,int> ii;
typedef long long ll;
typedef long double ld;
const int mod = 1e9 + 7;
const ll inf = 3e18 + 5;
int add(int a, int b) { return (a += b) < mod ? a : a - mod; }
int mul(int a, int b) { return 1LL * a * b % mod; }

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

  string s;
  cin >> s;
  string t[2] = {"RUD", "LUD"};
  for(int i = 0; i < int(s.size()); i++){
    if(t[i % 2].find(s[i]) == string::npos) return cout << "No", 0;
  }
  cout << "Yes";
}

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

#define REP(i, n) for(ll i = 0; i < n; i++)
#define ALL(x) (x).begin(),(x).end()
#define MSG(x) cout << x << endl;
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
using ll = long long;

int main(int argc, char *argv[]) {
    vector<ll> v(3);
    cin >> v[0] >> v[1] >> v[2];
    
    sort(v.begin(), v.end(), greater<>());
    
    if (((v[0] * 3) % 2) == ((v[0] + v[1] + v[2]) % 2)) {
    	cout << (v[0] * 3 - (v[0] + v[1] + v[2])) / 2 << endl;
    } else {
    	cout << ((v[0] + 1) * 3 - (v[0] + v[1] + v[2])) / 2 << endl;    
    }
    
    return 0;
}

Measured memory_bytes: 256
#ifdef MY_LOCAL
#define MY_NAMESPACE(ns) namespace ns {
#define MY_NAMESPACE_    }
#define MY_DEBUG(s)      s
#else
#define MY_NAMESPACE(ns) 
#define MY_NAMESPACE_    
#define MY_DEBUG(s)      
#endif

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <tuple>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

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

#define EPS (1e-7)
#define IINF ((int)1e9)


MY_NAMESPACE(testbed)
bool ABC167F_order(pll const& lhs, pll const& rhs)
{
	// first:  open
	// second: close

	int lhs_sign = 0;
	if (lhs.first > lhs.second)
		lhs_sign = 1;  // more open
	else if (lhs.first < lhs.second)
		lhs_sign = -1;  // more close

	int rhs_sign = 0;
	if (rhs.first > rhs.second)
		rhs_sign = 1;
	else if (rhs.first < rhs.second)
		rhs_sign = -1;

	if (lhs_sign != rhs_sign)
		return lhs_sign > rhs_sign;

	if (lhs_sign >= 0)
	{
		if (lhs.second != rhs.second)
			return lhs.second < rhs.second;
		else
			return lhs.first > rhs.first;
	}
	else
	{
		//if (lhs.second != rhs.second)
		//	return lhs.second > rhs.second;
		//else
			return lhs.first > rhs.first;
	}
}

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

	int n;
	cin >> n;
	vector<pll> num_live_open_and_close(n);
	for (int i = 0; i < n; i++)
	{
		string s;
		cin >> s;
		for (auto it = s.begin(); it != s.end(); it++)
		{
			if (*it == '(')
			{
				num_live_open_and_close[i].first++;
			}
			else  // *it==')'
			{
				if (num_live_open_and_close[i].first > 0)
					num_live_open_and_close[i].first--;
				else
					num_live_open_and_close[i].second++;
			}
		}
	}

	sort(num_live_open_and_close.begin(), num_live_open_and_close.end(), ABC167F_order);

	ll level = 0;
	for (auto it = num_live_open_and_close.begin(); it != num_live_open_and_close.end(); it++)
	{
		level -= it->second;
		if (level < 0)
		{
			cout << "No" << "\n";
			return 0;
		}
		level += it->first;
	}
	if (level == 0)
		cout << "Yes" << "\n";
	else
		cout << "No" << "\n";
	return 0;
}
MY_NAMESPACE_

Measured memory_bytes: 18744
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

using P = pair<int, int>;

int main()
{
    string s;
    cin >> s;

    rep(i, 26)
    {
        char c = i + 'a';
        int midx = -1;
        int m = 100'000;
        int a = 0;
        queue<P> buf;

        for (int i = 0; i <= s.size(); i++) {
            if (i > 0) {
                if (s[i - 1] == c) {
                    a++;
                } else {
                    a--;
                }
            }
            if (midx != -1) {
                if (a - m > 0) {
                    cout << midx + 1 << " " << i << endl;
                    return 0;
                }
            }

            buf.push(make_pair(a, i));
            if (i > 0) {
                int idx;
                int v;
                tie(v, idx) = buf.front();
                buf.pop();

                if (m > v) {
                    m = v;
                    midx = idx;
                }
            }
        }
    }

    cout << -1 << " " << -1 << endl;
    return 0;
}

Measured memory_bytes: 512
#!/usr/bin/python3
# -*- coding: utf-8 -*-
m1, d1 = map(int, input().split())
m2, d2 = map(int, input().split())
if m1 + 1 == m2:
    print(1)
elif m1 == 12 and m2 == 1:
    print(1)
else:
    print(0)

Measured memory_bytes: 3060
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val N = sc.nextInt()
  val x :: xs = List.fill(N)(sc.nextInt() - 1)
  val B = Array.fill(N)(sc.nextInt())
  val C = Array.fill(N - 1)(sc.nextInt())
  val (_, sum) = xs.foldLeft((x, B(x))) {
    case ((l, acc), r) =>
      r -> (acc + B(r) + (if (l + 1 == r) C(l) else 0))
  }
  println(sum)
}


Measured memory_bytes: 55520
N, K = $stdin.read.split.map(&:to_i)
ans = Float::INFINITY
0.upto(2**N-1) do |i|
  s = i.to_s(2).reverse
  num = 1
  for j in 0...N
    if s[j] == "1"
      num *= 2
    else
      num += K
    end
  end
  #p s: s, num: num
  ans = num if num < ans
end
p ans


Measured memory_bytes: 1788
#include<stdio.h>

#define MAX 20000000

int H, A[MAX+1];

void maxHeapify(int i){
  int l, r, largest, change;
  l = 2*i;
  r = 2*i+1;
  if(l <= H && A[l] > A[i]){
    largest = l;
  }else largest = i;

  if(r <= H && A[r] > A[largest])
    largest =r;

  if(largest != i){
    change = A[i];
    A[i] = A[largest];
    A[largest] = change;

    maxHeapify(largest);
  }
}


int main(){
  int i;

  scanf("%d", &H);

  for(i=1;i<=H;i++) scanf("%d", &A[i]);

  for(i=H/2;i>=1;i--)maxHeapify(i);

  for(i=1;i<=H;i++){
    printf(" %d", A[i]);
  }

  printf("\n");
  return 0;
}
    



Measured memory_bytes: 3640
N = int(input())
A = list(map(int, input().split()))
B = []
C = []
D = []
for i in range(N):
  if A[i] % 2 == 0: 
    C.append(A[i])
  elif A[i] % 2 != 0:
    B.append(A[i])
for i in (range(len(C))):
  if C[i] % 3 == 0 or C[i] % 5 == 0:
    D.append(C[i])
if len(C) >= 1:
  if len(C) == len(D):
    print('APPROVED')  
  else:
    print('DENIED')
  
else:
  if len(A) == len(B):
    print('APPROVED')

Measured memory_bytes: 3064
#include <iostream>
#include <string>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int i;
  double x[10];
  string u[10];
  while(i<n)
  {
    cin>>x[i]>>u[i];
    i++;
  }
  double ans=0;
  i=0;
  while(i<n)
  {
   if(u[i]=="JPY")
   {
     ans+=x[i];
  }
    else
    {
      ans+=(x[i]*380000.0);
    }
    i++;
  }
  cout<<ans<<endl;
  return 0;
}

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

#define lpsbd(i, s, b, d) for(size_t i = (s); i < (b); i+=(d))
#define lpsb(i, s, b) for(size_t i = (s); i < (b); i++)
#define lpn(i, n) for(size_t i = 0; i < (n); i++)
#define fa(i, x) for(auto &i: x)
#define vcd(t, n, d) vector<t>(n, d)
#define vc(t, n) vector<t>(n)
#define all(x) (x).begin(), (x).end()

using namespace std;
using ll = long long;

const ll MOD = 1000000007;

int main(void)
{
    ll N;
    cin >> N;
    cout << N*(N-1)/2 << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO ?????????????????????????????????????????????
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		

		while(true){
			String[] tmpArray = br.readLine().split(" ");
			int n = Integer.parseInt(tmpArray[0]);
			int r = Integer.parseInt(tmpArray[1]);

			if(n == 0 && r == 0){
				break;
			}
			
			//??±????????????
			int[] hanafuda = new int[n];
			for(int i = 0; i < n; i++){
				hanafuda[i] = i + 1;
			}
			
			for(int i = 0 ; i < r ; i++){
				tmpArray = br.readLine().split(" ");
				int p = Integer.parseInt(tmpArray[0]);
				int c = Integer.parseInt(tmpArray[1]);
				
				shuffleDeck(hanafuda, p, c);
			}
			
			System.out.println(hanafuda[hanafuda.length - 1]);

		}
	}
	
	static void shuffleDeck(int[] deck, int p, int c){
		int[] tmpDeck;
		
		tmpDeck = Arrays.copyOfRange(deck, deck.length - p - c + 1, deck.length - p + 1);
		
		//???????????????????????????????????¨???
		for(int i = deck.length - p - c + 1; i <= deck.length - c - 1 ; i++){
			deck[i] = deck[i+c];
		}
		
		//??????????????????????????????????????????
		for(int i = deck.length - c; i < deck.length ; i++){
			deck[i] = tmpDeck[i - deck.length + c];
		}
	}

}

Measured memory_bytes: 28716
#include <stdio.h>

int main(void){
  unsigned long long int x=0;
  unsigned long long int y=100;
  unsigned long int cnt=0;
  scanf("%lld", &x);
  while(y < x){
    y += y*0.01;
//    printf("%d\n",y);
    cnt += 1;
  }
  printf("%ld", cnt);
  return 0;
}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll prev = 0;
    vector<ll> A(5);
    ll k;
    rep(i, 5) cin >> A[i];
    cin >> k;
    rep(i, 4) {
        rep2(j, i + 1, 5) {
            if(A[j] - A[i] > k) {
                cout << ":(" << endl;
                return 0;
            }
        }
    }
    cout << "Yay!" << endl;
    return 0;
}


Measured memory_bytes: 3532
n, k = list(map(int, input().split(' ')))

dk = [None] * k
ak = [None] * k
for i in range(k):
    dk[i] = int(input())
    ak[i] = list(map(int, input().split(' ')))

c = [False] * n

for i in range(k):
    for a in ak[i]:
        c[a - 1] = True

ans = c.count(False)

print(ans)



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

#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <set>
#include <vector>
#include <string.h> // for memset in CF judge.
using namespace std;
#define _CRT_SECURE_NO_DEPRECATE // suppress some compilation warning messages (for VC++ users)
// Shortcuts for "common" data types in contests
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef set<int> si;
typedef map<string, int> msi;
// To simplify repetitions/loops, Note: define your loop style and stick with it!
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define REP(i, a, b) \
for (int i = int(a); i <= int(b); i++) // a to b, and variable i is local!
#define forn(i,n) \
for (int i =0; i<(n); i++)
#define TRvi(c, it) \
for (vi::iterator it = (c).begin(); it != (c).end(); it++)
#define TRvii(c, it) \
for (vii::iterator it = (c).begin(); it != (c).end(); it++)
#define TRmsi(c, it) \
for (msi::iterator it = (c).begin(); it != (c).end(); it++)
#define INF 2000000000 // 2 billion
// If you need to recall how to use memset:
#define MEMSET_INF 127 // about 2B
#define MEMSET_HALF_INF 63 // about 1B
//memset(dist, MEMSET_INF, sizeof dist); // useful to initialize shortest path distances
//memset(dp_memo, -1, sizeof dp_memo); // useful to initialize DP memoization table
//memset(arr, 0, sizeof arr); // useful to clear array of integers
int a[10000005];
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	ll n; cin >> n;
	memset(a, 0, sizeof a);
	ll ans = 0;
	for(ll i = 1; i <= n; i++) {
		ll j = i;
		while (j <= n ) {
			a[j]++;
			j += i;
		}
	}
	for(ll i= 1; i <= n; i++) {
		ans += a[i] * i;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 42672
#include<iostream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
using ll = long long;
using P = pair<int, int>;
#include<algorithm>
#include<math.h>
#include<map>
#include<queue>

int main() {
	ll n, m;
	cin >> n >> m;
	priority_queue<ll>q;
	rep(i, n) {
		int c;
		cin >> c;
		q.push(c);
	}
	rep(i, m) {
		int buffer;
		buffer = q.top(); q.pop();
		buffer /= 2;
		q.push(buffer);
	}
	ll sum(0);
	rep(i, n) {
		sum += q.top(); 
		q.pop();
	}
	cout << sum;
	return 0;
}

Measured memory_bytes: 1400
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define mod2 998244353 
#define PI 3.14159265
#define ll long long
#define ld long double
#define pi pair<ll,ll>
#define pb push_back
#define vi vector<ll>
#define sz size()
#define fi first
#define se second
#define lz length()
#define all(x) (x).begin(),(x).end()
#define scf(x) scanf("%lld",&x)
#define rep(i,n) for(ll i=0;i<n;i++)
const int INF = (int)1e9;
const ll IINF=1LL<<62;
const int maxn=10000005;
int divr[maxn];
/*ll modexpo(ll a,ll b)
{
     ll res=1LL;
     while(b>0)
     {
          if(b&1)res=(res*a)%mod;
          a=(a*a)%mod;
          b>>=1;
     }
     return res;
}*/
void divisor()
{for(int i=2;i<sqrt(maxn);i++)
     {
          if(!divr[i])
          {
               for(int j=i*i;j<maxn;j+=i)if(!divr[j])divr[j]=i;     
          }
     }
     for(int i=1;i<maxn;i++)if(!divr[i])divr[i]=i;
}
 
/*const int N=1000005;
ll n;
struct line {
    long long m, c;
    long long eval(long long x) { return m * x + c; }
    long double intersectX(line l) { return (long double) (c - l.c) / (l.m - m); }
};
vector<pair<pi,ll>> rect;
deque<line> dq;
*/
 
 
 
 
 












int main()
{
     int a[5];
     for(int i=0;i<5;i++)cin>>a[i];
     for(int i=0;i<5;i++)
     {
          if(a[i]==0){cout<<i+1;return 0;}
     }
     
}







 
 

















Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())

using namespace std;
using ll = long long;

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 int INF = 1001001001;
const long long INFL = (1LL<<60);
const double eps = (1e-9);

bool master(int x, vector<int>& s) {
  for (int y : s) {
    if (x > y) return false;
  }
  return true;
}

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

  int n, m, x;
  cin >> n >> m >> x;

  vector<pair<int, vector<int>>> ca;
  rep(i, n) {
    int c; cin >> c;
    vector<int> a(m);
    rep(j, m) cin >> a[j];
    ca.emplace_back(c, a);
  }

  int ans = INF;

  for (int i = 0; i < (1<<n); i++) {
    int cost = 0;
    vector<int> s(m, 0);
    for (int j = 0; j < n; j++) {
      if ((i>>j) & 1) {
        cost += ca[j].first;
        for (int k = 0; k < m; k++) {
          s[k] += ca[j].second[k];
        }
      }
    }
    if (master(x, s)) chmin(ans, cost);
  }

  if (ans == INF) cout << -1 << endl;
  else cout << ans << endl;

  return 0;
}


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

int main() {
    int n,k; cin >> n >> k;
    vector<int> h(n);
    for(int i=0;i<n;i++){
        cin >> h[i];
    }
    ll dp[100010];
    dp[0]=0; //初期条件
    for(int i=1;i<n;i++){
        ll mina = 1e9; ll j=1;
        while(i-j>=0 && j<=k){
            ll minv = dp[i-j]+abs(h[i]-h[i-j]);
            mina = min(minv,mina);
            j++;
         }
        dp[i] = mina;
      
     
    }
    cout << dp[n-1] << endl;
}

Measured memory_bytes: 1408