akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

int n,t,m[1000],l[1000],k[1000];

bool check(int x){
  int c[1001]={},used[1000]={},cnt=n;
  for(int i=0;i<t;i++,x+=c[i])
    for(int j=0;j<n&&x;j++){
      if(used[j]||i%(l[j]+k[j])>l[j])continue;
      if(i+m[j]>t)return 0;
      c[i+m[j]]++,cnt--,used[j]=1,x--;
    }
  return !cnt;
}

int main(){
  while(scanf("%d%d",&n,&t),n){
    for(int i=0;i<n;i++)scanf("%d%d%d",&m[i],&l[i],&k[i]);
    int ans=0;
    for(int i=1;i<=n&&!ans;i++)if(check(i))ans=i;
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 3136
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int H = sc.nextInt();
		int W = sc.nextInt();
		char[][] S = new char[H + 2][W + 2];
		for (int i = 1; i <= H; i++) {
			String str = sc.next();
			for (int j = 1; j <= W; j++) {
				S[i][j] = str.charAt(j - 1);
			}
		}
		String result = search(S,H,W);
		System.out.print(result);
	}

	private static String search(char[][] S, int H, int W) {
		StringBuilder result = new StringBuilder();
		//8方向探索用の配列。上から時計回りに値を格納
		int[] x = { 0, 1, 1, 1, 0, -1, -1, -1 };
		int[] y = { 1, 1, 0, -1, -1, -1, 0, 1 };
		for (int i = 1; i <= H; i++) {
			for (int j = 1; j <= W; j++) {
				if (!"#".equals(String.valueOf(S[i][j]))) {
					int count = 0;
					for (int k = 0; k < 8; k++) {
						int dx = j + x[k];
						int dy = i + y[k];
						if ("#".equals(String.valueOf(S[dy][dx]))) {
							count++;
						}
					}
					result.append(String.valueOf(count));
				}else {
					result.append("#");
				}
			}
			result.append("\n");
		}
		return result.toString();
	}
}


Measured memory_bytes: 28400
/**
 *   Author:  Wasi Ur Rahman
 *   FROM RMSTU
**/
#include            <bits/stdc++.h>
#define             fast            ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define             ll           long long
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define             fast           ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define             min3(a,b,c)    min(a,min(b,c))
#define             max3(a,b,c)    max(a,max(b,c))
#define             all(v)         v.begin(),v.end()
#define             revall(v)      v.rbegin(),v.rend()
#define             pb             push_back
#define             eb             emplace_back
#define             setbits(x)     __builtin_popcountll(x)
#define             zrobits(x)     __builtin_ctzll(x)
using namespace __gnu_pbds;
using namespace std;
typedef tree<int,null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
ordered_set os;
vector<ll> v,v1,v2,v3,v4;
/*
void solve(){
    ll a,b;
    cin >> a >> b;
    if(b >= a)
        cout << 1 << endl;
    else {
        if(a == b)
            cout << 1 << endl;
        else if(b == 1)
            cout << a << endl;
        else{
            for(ll i = 2;i*i<=b;i++){
                if(a % i == 0){
                    v.pb(i);
                }
            }
            sort(all(v));
            cout << v[0] << endl;
        }
    }

}
*/
int main(){
    fast;
    int n;
    cin >> n;
    string str;
    cin >> str;
    int len = str.size();
    int i,j;
    if(len > n){
        for(int i = 0;i<n;++i)
            cout << str[i];
        cout << "...";
    }else{
        cout << str;
    }
    cout << endl;
    return 0;
}


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

typedef long long ll;

int main(){
	int n;
	static ll a[100010];
	
	scanf("%d",&n);
	for(int i = 1; i <= n ;i ++){
		scanf("%lld",&a[i]);
	}
	
	int p = 1,q = 2,r = 3;
	ll x = a[1],y = a[2],z = 0;
	for(int i = 3; i <= n ;i ++)z += a[i];
	
	ll ret = 0;
	while(r <= n){
		if(y <= min(z,x)){
			y += a[r];
			z -= a[r];
			r ++;
		}
		else if(x <= min(y,z)){
			x += a[q];
			y -= a[q];
			q ++;
		}
		else {
			z += a[p];
			x -= a[p];
			p ++;
		}
		ret = max ( ret , min(min(x,y),z) );
	}
	
	printf("%lld\n",ret);
}

Measured memory_bytes: 1952
a,b,c = map(int,raw_input().split())
list1 = [a,b,c]
list1.sort()
ans = str(list1[0])+" "
for i in range(1,3):
    if i!=2:
        ans += str(list1[i])+" "
    else:
        ans += str(list1[i])
print ans


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

#define intt long long
#define mod 1000000007

int main()
{
	intt n,k;
	cin>>n>>k;
	intt arr[n+1];
	for(intt i=0;i<=n;i++)
	arr[i]=i;
	
	intt prefix[n+1];
	intt suffix[n+1];
	prefix[0]=arr[0];
	suffix[n]=arr[n];
	for(intt i=1;i<=n;i++)prefix[i]=prefix[i-1]+arr[i];
	for(intt i=n-1;i>=0;i--)suffix[i]=suffix[i+1]+arr[i];
	
	intt sum=0;
	for(intt j=k;j<=n+1;j++)
	{
		intt diff=suffix[n-j+1]-prefix[j-1]+1;
		sum+=(diff%mod);sum=sum%mod;
	}
	
	cout<<sum<<endl;
}

Measured memory_bytes: 8320
#include <stdio.h>
#include <iostream>
#include <vector>
#include <assert.h>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <stack>
#include <bitset>
#include <string>
#include <sstream>
#include <memory.h>
#include <time.h>
#include <string.h>
#include <stdlib.h>
#include <functional>
#include <algorithm>
using namespace std;
typedef long long ll;
int main()
{
	int n;
	scanf("%d", &n);
	vector<int> v(n);
	for (int i = 0; i < n; ++i)
		scanf("%d", &v[i]);
	vector<vector<ll> > dp(n, vector<ll>(n));
	for (int i = n - 1; i >= 0; --i)
		for (int j = i; j < n; ++j) {
			if (i == j)
				dp[i][j] = v[i];
			else
				dp[i][j] = max(-dp[i + 1][j] + v[i], -dp[i][j - 1] + v[j]);
		}
	printf("%lld\n", dp[0][n - 1]);
	return 0;
}

Measured memory_bytes: 70656
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstdlib>

using namespace std;

int main()
{

  int N;
  string S, T;
  cin >> N;
  cin >> S >> T;

  for(int i=0; i<N; i++)
    {
      cout << S[i] << T[i];
    }
  cout << endl;

  

  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
main(){
	int n,k,cnt=0;
	cin>>n>>k;
	int a[n];
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	for(int i=0;i<n;i++){
		if(a[i]>=k)cnt++;
	}cout<<cnt;
}

Measured memory_bytes: 640
#include <stdio.h>

int main(void){
    int a;
    int n, m, x, i;
    int count1 = 0, count2 = 0;
    
    scanf("%d %d %d", &n, &m, &x);
    for (i = 0; i < m; i++){
        scanf("%d", &a);
        if (x > a)
            count1 += 1;
        else
            count2 += 1;
    }
   
    printf("%d \n", (count1 > count2) ? count2 : count1);
    return 0;
}


Measured memory_bytes: 128
r,i,f,N[12];C(n){int*p=N+10;for(r+=!n;--p>N;++*p,++p[1],++p[2])(*p-=3)<0||C(n-1),(*p+=2)<0|!p[1]--|!p[2]--||C(n-1);}main(j){for(;~scanf("%c",&j);)if(j==10||!++N[j-48]){for(i=0;++i<10;N[i]--)if(++N[i]<5){for(r=0,j=10;--j;N[j]+=2)(N[j]-=2)<0||C(4);f=r?printf(" %d"+!f,i):f;}puts("0"+!!f);memset(N,f=0,40);}}

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

int main()
{
	int n = 0 , i = 1;
	cin >> n ;
	for (; i <= n ; ) // END CHECK NUM
	{
		int x=i ; // CHECK NUM
		if ( x % 3 == 0 ) cout << " " << i ;
		else
		{
			while ( x ) // INCLUDE 3
			{
				if ( x % 10 == 3 )
				{
					cout << " " << i ;
					break ;
				}
				x /= 10 ;
			}
		}
		i += 1 ;
	}
	cout << endl ;
	return 0;
}



Measured memory_bytes: 3072
# coding: utf-8
# Your code here!
count = int(input())
nums = []
nums = input().split(" ")

total = 1

for i in range(count):
    if int(nums[i]) == 0:
        total = 0
        break


for i in range(count):
    total = int(nums[i]) * total
    if total > 10**18:
        total = -1
        break
print(total)



Measured memory_bytes: 19500
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <map>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
using namespace std;

#define N_MAX   (100000)
#define LL_MAX_NUM (1LL<<60)
#define INF 1e7

typedef long long ll;
typedef long long int lli;

int main() {
    string S;
    cin >> S;
    int res = 0;
    for (int i = 0; i < S.size(); i++) {
        if (S[i] == '+') {
            res++;
        } else {
            res--;
        }
    }
    cout << res << endl;  
    return 0;
}

Measured memory_bytes: 256
<?php

while (TRUE) {
    fscanf(STDIN, '%d %d', $n, $s);
    if ($n === 0 && $s === 0) {
        break;
    }

    $stack = array(array(0, 0, -1));
    $c = 0;
    while (count($stack)) {
        $node = array_pop($stack);
        if ($node[1] === $n) {
            if ($node[0] === $s) {
                $c++;
            }
            continue;
        }
        for ($i = $node[2] + 1; $i <= 9; $i++) {
            $stack[] = array($node[0] + $i, $node[1] + 1, $i);
        }
    }

    echo $c . PHP_EOL;
}

Measured memory_bytes: 6616
import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		String str = sc.nextLine();

		String[] substr = str.split(" ", 0);

		String x = substr[0];
		String y = substr[1];
		String z = substr[2];
		sc.close();
		System.out.println(z+' '+x+' '+y );
	}
}
		


Measured memory_bytes: 21076
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String x = br.readLine();
		String[] a = x.split(" ");

		int z = Integer.parseInt(a[0]);
		int y = Integer.parseInt(a[1]);

		System.out.println(z <= y ? 0 : z - y);

	}
}


Measured memory_bytes: 21076
#include <iostream>

using namespace std;

void countingSort(int A[], int B[], int n, int k) {
    int C[k];
    for (int i = 0; i <= k; ++i) {
        C[i] = 0;
    }
    for (int j = 1; j <= n; ++j) {
        ++C[A[j]];
    }
    for (int i = 1; i <= k; ++i) {
        C[i] += C[i - 1];
    }
    for (int j = n; j >= 1; --j) {
        B[C[A[j]]] = A[j];
        --C[A[j]];
    }
}

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

    int A[n + 1];
    int k = 0;
    for (int i = 1; i <= n; ++i) {
        int e;
        scanf("%d", &e);
        A[i] = e;
        if (e > k) {
            k = e;
        }
    }
    int B[n + 1];

    countingSort(A, B, n, k);

    for (int i = 1; i <= n; ++i) {
        if (i > 1) {
            printf(" %d", B[i]);
        } else {
            printf("%d", B[i]);
        }
    }
    printf("\n");

    return 0;
}

Measured memory_bytes: 18784
#include<iostream>
#include<string>
#include<vector>
const int max_size = 100;
int main(){
    int A,B;
    std::cin >> A >> B;
    std::vector<std::string>grid;
    --A;
    --B;
    int amod = A % (max_size / 2);
    std::string as,base,bs;
    for(int i = 0; i < amod; ++i)
        as.push_back('.'),as.push_back('#');
    while(as.size() < max_size) as.push_back('#');
    for(int i = 0; i < max_size /2; ++i)
        base.push_back('.'),base.push_back('#');
    for(int i = 0; i < A/(max_size / 2); ++i){
        grid.push_back(base);
        grid.push_back(std::string(max_size,'#'));
    }
    grid.push_back(as);
    grid.push_back(std::string(max_size,'#'));
    grid.push_back(std::string(max_size,'.'));
    int bmod = B % (max_size / 2);
    for(int i = 0; i < bmod; ++i)
        bs.push_back('.'),bs.push_back('#');
    while(bs.size() < max_size) bs.push_back('.');
    for(int i = 0; i < B / (max_size / 2); ++i){
        grid.push_back(base);
        grid.push_back(std::string(max_size,'.'));
    }
    grid.push_back(bs);
    std::cout << grid.size() << " " << max_size << std::endl;
    for(auto s : grid)
        std::cout << s << std::endl;
    
}


Measured memory_bytes: 256
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second
const ll MAX = 300000;

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

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
ll COM(ll n,ll k){
    if (n == 1) return 1;
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

signed main(){
    COMinit();
    ll n,k;cin >> n >> k;
    if(k>=n)k=n-1;
    ll ans=0;
    REP(i,k+1){
        ans+=(COM(n,i)*COM(n-1,n-i-1));
        ans%=MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 7296
def p_factorization(n):
    if n == 1: return {}
    pf_cnt = {}
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i == 0:
            cnt = 0
            while temp%i == 0:
                cnt += 1
                temp //= i
            pf_cnt[i] = cnt

    if temp != 1: pf_cnt[temp] = 1
    return pf_cnt


n = int(input())
pf_cnts = {}
for i in range(2,n+1):
    i_pf_cnt = p_factorization(i)
    for k,v in i_pf_cnt.items():
        pf_cnts.setdefault(k,0)
        pf_cnts[k] += v

MOD = 10**9+7  
ans = 1
for k,v in pf_cnts.items():
    ans *= (v+1)
    ans %= MOD                       

print(ans)

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

// const long long MAXN = 2 *10e6;
// const long long MAXP = 10e4;



// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    cin >> N;
    long long P;
    cin >> P;
    string S;
    cin >> S;

    if(P==2 || P==5){
        // cerr << P << endl;
        long long ans =0;
        for(int i=N-1;i>=0;--i){
            int a = S[i] -'0';
            if(a%P==0){
                ans += (i+1);
            }
        }

        cout << ans << endl;
        return 0;
    }
    vector<long long> d(N+1,0);
    long long ten = 1;
    for(int i=N-1;i>=0;--i){
        int a = (S[i]-'0') * ten %P;
        d[i] = (d[i+1] + a) %P;
        ten *= 10;
        ten %= P;
    }
    vector<long long> cnt(P);
    long long ans =0;
    for(int i=0;i<=N;i++){
        ans += cnt[d[i]];
        cnt[d[i]]++;
        
    }
    
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 2180
h,w=map(int,input().split())
A=[]
for i in range(h):
    a=list(input())
    A.append(a)
ans=''
for j in range(h+2):
    for k in range(w+2):
        if j==0 or j==h+1:
            ans+='#'
        else:
            if k!=0 and k!=w+1:
                ans+=A[j-1][k-1]
            else:
                ans+='#'
    print(ans)
    ans=''
                
        

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file  
#include <ext/pb_ds/tree_policy.hpp>  
#include <functional> // for less  
using namespace         std;
#define                 int long long
#define                 double long double
#define                 pb push_back
#define                 mp make_pair
#define st(arr,a)       memset(arr,a,sizeof arr)
#define                 nl cout<<'\n'
#define bitcount(x)     __builtin_popcountll(x)
const int MOD = 1000000007ll;
#define forn(i,a,b)     for(int i=a;i<=b;i++)
#define rfor(i,a,b)     for(int i=a;i>=b;i--)
#define all(x)          x.begin() , x.end()
#define pi pair<int,int>
#define X first
#define Y second
#define N 1014159
#define  vi vector<int>
#define  v  vector
#define die exit(0)
#define alln(arr) arr+1 , arr+1+n
using namespace __gnu_pbds;  
typedef tree<int, null_type, less<int>, rb_tree_tag,  
            tree_order_statistics_node_update> oset; 

int n;

map<pi,int>m;


void solve()
{
    cin>>n;
    forn(i,1,n)
    {
    	string s = to_string(i);
    	int a,b;
    	a=s[0]-'0';
    	reverse(all(s));
    	b = s[0]-'0';
    	m[{a,b}]++;
    }
    int ans = 0;
    
    forn(i,1,9)forn(j,1,9)
    {
    	ans+=m[{i,j}]*m[{j,i}];
    }



    cout<<ans;
}


signed main() 
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); 
    int t = 1;
    //cin>>t;
    forn(i,1,t)
    {
        solve();
        nl;
    }



    return 0;

}

//       clang++ c.cpp ; ./a.out < a.txt ;  

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		while(true) {
		int h = sc.nextInt();
		int w = sc.nextInt();
		if(h == 0 || w == 0) break;
		
		for(int i = 0; i < h; i++) {
			if(i % 2 == 0) {
				for(int j = 0; j < w; j++) {
					if (j % 2 == 0)
						System.out.print("#");
					else
						System.out.print(".");
				}
				System.out.println();	
			}else{
				for(int j = 0; j < w; j++) {
					if (j % 2 == 0)
						System.out.print(".");
					else
						System.out.print("#");
				}
				System.out.println();
			}
		}
		System.out.println();
		sc.nextLine();
		}
		sc.close();
	}
}

/**

System.out.print("#");
System.out.println();
for(int l = 1; l < h-1; l++) {
System.out.print("#");
for(int j = 1; j < w-1; j++)
	System.out.print(".");
System.out.print("#\n");
}
for(int j = 0; j < w; j++)
System.out.print("#");
*/


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


def main():
    from collections import deque

    s = deque(input())
    ans = 0

    # KeyInsight
    # 回文の判定：最初と最後の文字が一致しているかどうか
    # データ構造：文字の取り出しと削除を高速に行う
    while s:
        # 先頭の文字を取り出す
        first = s.popleft()

        if len(s) >= 1:
            # 残りが1文字以上なら，末尾の文字を取り出す
            last = s.pop()
        else:
            # 残り0文字なら終了
            print(ans)
            exit()

        # 先頭と末尾が一致なら，そのまま
        if first == last:
            pass
        # 先頭x，末尾がx以外→末尾にxを追加
        # 操作が1回増える
        elif first == 'x' and last != 'x':
            s.appendleft(first)
            s.append(last)
            s.append('x')
            ans += 1
        # 先頭x以外，末尾がx→先頭にxを追加
        # 操作が1回増える
        elif first != 'x' and last == 'x':
            s.appendleft(first)
            s.appendleft('x')
            s.append(last)
            ans += 1
        # それ以外 -1, 終了
        else:
            print(-1)
            exit()

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 4212
def inpl(): return list(map(int, input().split()))
N, K = inpl()
H = inpl()
DP = [1e10]*(N)
DP[0] = 0
for i in range(N):
    for j in range(i+1, min(N, i+K+1)):
        DP[j] = min(DP[j], DP[i]+abs(H[i] - H[j]))
print(DP[-1])

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

// #define int long long
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;

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 ll INF = 1e15;
const int MOD = 1e9+7;
const ll LINF = 1e18;

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll x,y,a,b,c; cin>>x>>y>>a>>b>>c;
  vll p(a), q(b), r(c);
  rep(i,a) cin>>p[i];
  rep(i,b) cin>>q[i];
  rep(i,c) cin>>r[i];
  sort(p.rbegin(),p.rend());
  sort(q.rbegin(),q.rend());
  sort(r.rbegin(),r.rend());
  
  ll ans=0;
  priority_queue<ll, vector<ll>, greater<ll>> que;
  rep(i,x){
    ans+=p[i];
    que.push(p[i]);
  }
  rep(i,y){
    ans+=q[i];
    que.push(q[i]);
  }
  rep(i,c){
    if(que.empty()) break;
    ll now=que.top(); que.pop();
    if(now<r[i]){
      ans-=now;
      ans+=r[i];
    }
  }
  cout<<ans<<endl;
  
  
}

Measured memory_bytes: 4852
def edit_dist(s, t):
    INF = float('inf')
    th = INF
    m, n = len(s), len(t)
    if abs(m - n) >= th:
        return INF
    dp = [[INF] * (n + 1) for _ in range(m + 1)]
    for i in range(m + 1): dp[i][0] = i
    for j in range(n + 1): dp[0][j] = j
    for i in range(m):
        for j in range(n):
            dp[i + 1][j + 1] = min(dp[i][j] + (s[i] != t[j]), dp[i][j + 1] + 1, dp[i + 1][j] + 1)
    return dp[m][n]

print(edit_dist(input(), input()))


Measured memory_bytes: 43088
#include <bits/stdc++.h>
#include <sstream>
#include <iomanip>
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vi vector <ll> 
#define qu queue <ll>
#define min_3(a,b,c) min(a,min(b,c))
#define max_3(a,b,c) max(a,max(b,c))
#define nout(ans) cout << (ans) << "\n"
#define sout(ans) cout << (ans) << " "
using namespace std;

const double pi = 3.14159265359;
const ll INF = 1e12;
const ll MOD = 1e9 + 7;
const ll N = 1e5 + 5;
/*
Decimal Places: cout << fixed << setprecision(n) << ans << endl

String to integer:
stringstream dark(s);
int x = 0; dark >> x;
*/

bool compare(const pair<int, int>&i, const pair<int, int>&j)
{
    return i.second < j.second;
}


int n; int h[N], dp[N];        

void solve()
{
    cin >> n;
    for (int i=1; i<=n; i++) cin >> h[i];
    dp[0]=0; dp[1] = h[1]; dp[2] = abs(h[2]-h[1]); dp[3] = min(abs(h[3]-h[1]),dp[2]+abs(h[3]-h[2]));
    for (int i=4; i<=n; i++) {
        int h1 = abs(h[i]-h[i-1]);
        int h2 = abs(h[i]-h[i-2]);
        dp[i] = min(dp[i-1]+h1,dp[i-2]+h2);
    } nout(dp[n]);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int t = 1;
    //cin >> t;
    for (int i=1; i<=t; i++)
    {
        solve();
    }
    return 0;
}                   

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int N; scanf("%d", &N);
  vector<int> V(2*N);
  for(auto& x: V) scanf("%d", &x);
  sort(V.begin(), V.end());
  int ans = 0;
  for(int i=0; i<N; ++i)
    ans += V[2*i];
  printf("%d\n", ans);
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
using namespace std;
typedef long long ll;

int main(void) {
    int n, m_a, m_b, a[50], b[50], c[50];
    cin >> n >> m_a >> m_b;
    for (int i = 0; i < n; i++) {
        cin >> a[i] >> b[i] >> c[i];
    }
    
    int make[2][250][250], inf = 1e9;
    for (int i = 0; i < 250*250; i++) make[0][i/250][i%250] = make[1][i/250][i%250] = inf;
    for (int i = 0; i < pow(2, min(n, 20)); i++) {
        int ic = i, a_sum = 0, b_sum = 0, c_sum = 0;
        for (int j = 0; j < min(n, 20); j++) {
            if (ic % 2 == 1) {
                a_sum += a[j];  b_sum += b[j];  c_sum += c[j];
            }
            ic /= 2;
        }
        make[0][a_sum][b_sum] = min(make[0][a_sum][b_sum], c_sum);
    }
    
    if (n <= 20) {
        int ans = inf;
        for (int i = 1; i <= 201 * 201; i++) {
            if (m_b * (i / 201) == m_a * (i % 201)) ans = min(ans, make[0][i / 201][i % 201]);
        }
        if (ans != inf) cout << ans << endl;
        else cout << -1 << endl;
    }
    else {
        for (int i = 0; i < pow(2, n - 20); i++) {
            int ic = i, a_sum = 0, b_sum = 0, c_sum = 0;
            for (int j = 0; j < n - 20; j++) {
                if (ic % 2 == 1) {
                    a_sum += a[20 + j];  b_sum += b[20 + j];  c_sum += c[20 + j];
                }
                ic /= 2;
            }
            make[1][a_sum][b_sum] = min(make[1][a_sum][b_sum], c_sum);
        }
        
        int ans = inf;
        for (int i = 0; i <= 201 * 201; i++) {
            for (int j = 1; j <= 400; j++) {
                if (m_a * j - (i / 201) <= 200 && m_a * j - (i / 201) >= 0 && m_b * j - (i % 201) <= 200 && m_b * j - (i % 201) >= 0)
                ans = min(ans, make[0][i / 201][i % 201] + make[1][m_a * j - (i / 201)][m_b * j - (i % 201)]);
            }
        }
        if (ans != inf) cout << ans << endl;
        else cout << -1 << endl;
    }
    
}

Measured memory_bytes: 768
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define MOD 1000000007

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

int main() {
    int N;
    cin>>N;
    ll ans=mod_pow(10,N);
    ans-=(2*mod_pow(9,N))%MOD;
    ans%=MOD;
    ans+=mod_pow(8,N);
    ans%=MOD;
    ans+=MOD;
    ans%=MOD;
    cout<<ans<<endl;
}

Measured memory_bytes: 3632
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; } value
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define _LIBCPP_DEBUG 0
using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string n;
  cin >> n;
  bool a = false;
  REP(i,3) {
    if(n[i] == '7') a = true;
  }
  YesorNo(a);
}

Measured memory_bytes: 3260
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using static System.Console;
using static System.Math;

class Program
{
    static void Main(string[] args)
    {
        int N = ReadLineParseInt();
        int[] h = ReadLineParseIntArray();
        int ans = -1;
        int l = 0;
        int r = N;
        int max = -1;
        while (max != 0)
        {
            bool flag = false;
            max = 0;
            for(int i = 0; i < N; i++)
            {
                max = Max(max, h[i]);
                if (!flag && h[i] != 0)
                {
                    flag = true;
                    l = i;
                }
                else if (flag && h[i] == 0)
                {
                    r = i;
                    break;
                }
            }
            for(int i = l; i < r; i++)
                h[i]--;
            ans++;
            l = 0;
            r = N;
        }
        WriteLine(ans);
    }

    static int ReadLineParseInt() => int.Parse(ReadLine());
    static int[] ReadLineParseIntArray() => ReadLine().Split(' ').Select(int.Parse).ToArray();
}

Measured memory_bytes: 13396
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		
		Scanner	sc = new Scanner(System.in);
		while(sc.hasNext()){
			String str = sc.nextLine();
		for(int i = 0 ; i < str.length() ; i++){
			if(str.charAt(i) == '@'){
				for(int j = 0 ; j < Integer.parseInt("" + str.charAt(i+1)) ; j++){
					System.out.print(str.charAt(i + 2));
				}
				i = i + 2;
			}else {
				System.out.print(str.charAt(i));
			}
		}
		System.out.println();
		}
		
		sc.close();
	}

}

Measured memory_bytes: 17156
#include <cstdio>
#include <algorithm>

using namespace std;

int sum[1000001];
bool prime[1000001];

void sieve()
{
	fill_n(prime, 1000001, true);

	prime[1] = false;

	for (int i = 2; i <= 1000000; ++i) {
		sum[i] = sum[i - 1];
		if (!prime[i]) continue;
		sum[i]++;
		for (int k = i + i; k <= 1000000; k += i) {
			prime[k] = false;
		}
	}
}

int main()
{
	sieve();

	int n;
	
	while (~scanf("%d", &n)) printf("%d\n", sum[n]);
}

Measured memory_bytes: 5904
#include<stdio.h>
int main(void)
{
	char s[100000],a[100000],b[100000];
	int n,m,i,j;
	while(1)
	{
		scanf("%d", &n);
		if(n==0)
		break;
		for(i=0; i<n; i++)
		scanf("%s %s", &a[i], &b[i]);
		scanf("%d", &m);
		for(i=0; i<m; i++)
		{
			scanf("%s", &s[i]);
			for(j=0; j<n; j++)
			{
				if(s[i]==a[j])
				{
					s[i]=b[j];
					break;
				}
			}
		}
		for(i=0; i<m; i++)
		printf("%c", s[i]);
		printf("\n");
	}
	return 0;
}


Measured memory_bytes: 2052
n,m = map(int,input().split())
ee = [list(map(int,input().split())) for _ in range(m)]

cnt = 0
for p in range(m):
    e = ee[:p] + ee[p+1:]
    dist = [[float("inf")]*n for _ in range(n)]
    
    for i in range(m-1):
        s,t = e[i]
        dist[s-1][t-1]=1
        dist[t-1][s-1]=1

    for i in range(n):
        dist[i][i]=0
    #[print(*dist[l]) for l in range(n)]
    #print("-------------------------")

    for k in range(n):
        for i in range(n):
            for j in range(n):
                if dist[i][k] != float("inf") and dist[k][j] != float("inf"):
                   dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j])
    #[print(*dist[l]) for l in range(n)]
    #print("-------------------------")

    flag = True
    for i in range(n):
        if flag == False:
            break
        for j in range(n):
            if dist[i][j]==float("inf"):
                cnt += 1
                flag = False
                break
print(cnt)
 

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

A = []


for i in range(N):
    A.append(list(map(str, input().split())))
    del A[i][0]

if N != 1:
    ans = set(A[0]) & set(A[1])

if N >= 3:
    for i in range(2,N):
        ans = ans & set(A[i])

if N >= 2:
    print(len(ans))
else:
    print(len(A[0]))

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

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

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

    sort(p, p + N);

    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        if (i == N - 1)
        {
            ans += p[i] / 2;
        }
        else
        {
            ans += p[i];
        }
    }
    cout << ans << endl;
}


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

#define ll long long
#define INF 99999999
#define rep(i,n) for(int i=0,temp=(int)(n);i<temp;++i) //vec.size()がnの時等の高速化
#define loop(i,start,end) for(int i=start,temp=(int)(end);i<end;++i)
#define rfor(v,x) for(const auto& x : v) //xは値を表す
#define all(x) (x).begin(),(x).end()
#define SORT(v, n) sort(v, v+n)
#define vsort(v) sort(v.begin(), v.end())
#define vfsort(v,lambda) sort(v.begin(),v.end(),lambda)
#define vint vector<int>
#define vvint vector<vector<int>>
#define vin(v) rep(i,v.size()) {cin >> v[i];}

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; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int ctoi(char c) {return c-'0';}
//(lambda (x y) (< x y)) => [](int x, int y) -> int { return x<y; }

bool dfs(int n,int i,int j){
  if(i*4+j*7==n) return true;
  if(i*4>n||j*7>n) return false;
  return dfs(n,i+1,j) || dfs(n,i,j+1);
}


int main(){
  int n;cin >> n;
  //4*i+7*j==n
  if(dfs(n,0,0)) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define LL long long
#define fo(i,a,b) for(int i=(a);i<=(b);++i)
#define fd(i,a,b) for(int i=(a);i>=(b);--i)
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define TASK "E - Knapsack 2"
using namespace std;
///---------------------------------------------------
const int N = 105;
LL n, a[N], v[N], w[N], F[N][100005], oo, res, W;
///---------------------------------------------------
void nhap(){
    cin>>n>>W;
    fo(i,1,n) cin>>w[i]>>v[i];
    memset(F,0x3f,sizeof(F));
    oo = F[0][0];
}
///---------------------------------------------------
void solve(){
    F[0][0] = 0;
    fo(i,1,n) fo(j,0,100000){
        F[i][j] = F[i-1][j];
        if (j>=v[i] && F[i-1][j-v[i]]+w[i]<=W)
            F[i][j] = min(F[i][j], F[i-1][j-v[i]]+w[i]);
    }
    fo(i,1,100000) if (F[n][i]<oo) res = i;
    cout<<res;
}
///---------------------------------------------------
int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    nhap();
    solve();
}


Measured memory_bytes: 82304
#include<stdio.h>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
int n,d;
int main(){
	scanf("%d%d",&n,&d);
	d=d*2+1;
	printf("%d\n",(n-1)/d+1);
}

Measured memory_bytes: 128
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

N = ini()
A = inl()


def solve():
    cnt = 0
    for i in range(N):
        if (i + 1) % 2 == 1 and A[i] % 2 == 1:
            cnt += 1

    return cnt


print(solve())


Measured memory_bytes: 9196
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
#define REP(i,a,b) for(i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
#define ll long long
#define ull unsigned ll
typedef long double ld;
#define ALL(a) (a).begin(),(a).end()
#define ifnot(a) if(not a)
#define dump(x)  cerr << #x << " = " << (x) << endl
using namespace std;

void reader(int &a) { scanf("%d", &a); }
void reader(double &a) { scanf("%lf", &a); }
void reader(char a[]) { scanf("%s", a); }
void reader(char &a) { scanf(" %c", &a); }
void reader(ll &a) { scanf("%lld", &a); }
void reader(ull &a) { scanf("%llu", &a); }
// void reader(string& a){cin >> a;};
template<class T, class U> void reader(T& t, U& u) { reader(t); reader(u); }
template<class T, class U, class V> void reader(T& t, U& u, V& v) { reader(t); reader(u); reader(v); }

void writer(const int a, char c) { printf("%d", a); putchar(c); }
void writer(const ll a, char c) { printf("%lld", a); putchar(c); }
void writer(const ull a, char c) { printf("%llu", a); putchar(c); }
void writer(const double a, char c) { printf("%.20lf", a); putchar(c); }
void writer(const char a[]) { printf("%s", a); };
void writer(const char a[], char c) { printf("%s", a); putchar(c); };
void writer(const char a, char c) { putchar(a); putchar(c); };
template<class T> void writerLn(T t) { writer(t, '\n'); }
template<class T, class U> void writerLn(T t, U u) { writer(t, ' '); writer(u, '\n'); }
template<class T, class U, class V> void writerLn(T t, U u, V v) { writer(t, ' '); writer(u, ' '); writer(v, '\n'); }
template<class T> void writerArr(T x[], int n) { int i; if (!n) { putchar('\n'); return; }rep(i, n - 1) writer(x[i], ' '); writer(x[n - 1], '\n'); }
template<class T> void writerVec(vector<T> x) { int n = x.size(); int i; if (!n) { putchar('\n'); return; }rep(i, n - 1) writer(x[i], ' '); writer(x[n - 1], '\n'); }

vector<string> split(const string &str, char sep) { vector<string> v; stringstream ss(str); string buffer; while (getline(ss, buffer, sep)) { v.push_back(buffer); }return v; }
// #define int ll
bool test = 0;
int dx[] = { 0,1,0,-1 };
int dy[] = { 1,0,-1,0 };
#define INF (1 << 28)
ull mod = (int)1e9 + 7;
//.....................
#define MAX 22

int N, Q;

int W, H;
char room[MAX][MAX];
int startx, starty;
void dfs(int y, int x, bool visited[][MAX], int& cnt) {
	int i;
	rep(i, 4) {
		int ny = y + dy[i];
		int nx = x + dx[i];
		if (ny < 0 || H <= ny) continue;
		if (nx < 0 || W <= nx) continue;
		if (visited[ny][nx]) continue;
		if (room[ny][nx] == '#') continue;
		cnt++;
		visited[ny][nx] = true;
		dfs(ny, nx, visited, cnt);
	}
}
signed main(void)
{
	int i, j, k, l;
	while (1) {
		bool visited[MAX][MAX] = {};
		int cnt = 0;
		cin >> W >> H;
		if (W == 0) break;
		rep(i, H) cin >> room[i];
		rep(i, H) rep(j, W) {
			if (room[i][j] == '@') {
				starty = i; startx = j;
			}
		}
		visited[starty][startx] = true;
		dfs(starty, startx, visited, cnt);
		cout << cnt+1 << endl;
	}
	return 0;
}

Measured memory_bytes: 2996
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <stack>
#include <queue>
#include <bitset>
#include <numeric>
#ifdef DEBUG
#include "./Lib/debug.hpp"
#else
#define dump(...)
#pragma GCC optimize ("O3")
template<class T>inline auto d_val(T a, T b) { return a; }
#endif

/* (=＾o＾=) */
#define int ll

/* macro */
#define FOR(i, b, e) for(ll i = (ll)(b); i < (ll)(e); ++i)
#define RFOR(i, b, e) for(ll i = (ll)(e-1); i >= (ll)(b); --i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define REPC(x,c) for(const auto& x:(c))
#define REPI2(it,b,e) for(auto it = (b); it != (e); ++it)
#define REPI(it,c) REPI2(it, (c).begin(), (c).end())
#define RREPI(it,c) REPI2(it, (c).rbegin(), (c).rend())
#define REPI_ERACE2(it, b, e) for(auto it = (b); it != (e);)
#define REPI_ERACE(it, c) REPI_ERACE2(it, (c).begin(), (c).end())
#define ALL(x) (x).begin(),(x).end()
#define cauto const auto&
/* macro func */
#define SORT(x) do{sort(ALL(x));}while(false)
#define RSORT(x) do{sort((x).rbegin(),(x).rend());}while(false)
#define UNIQUE(v) do{v.erase( unique(v.begin(), v.end()), v.end() );}while(false)
#define MAX(x,y) do{x = std::max(x,y);}while(false)
#define MIN(x,y) do{x = std::min(x,y);}while(false)
#define BR do{cout<<"\n";}while(false)

/* type define */
using ll = long long;
using PAIR = std::pair<ll, ll>;
using VS = std::vector<std::string>;
using VL = std::vector<long long>;
using VVL = std::vector<VL>;
using VVVL = std::vector<VVL>;
using VD = std::vector<double>;

/* using std */
using std::cout;
constexpr char endl = '\n';
using std::cin;
using std::sort;
using std::pair;
using std::string;
using std::stack;
using std::queue;
using std::vector;
using std::list;
using std::map;
using std::unordered_map;
using std::multimap;
using std::unordered_multimap;
using std::set;
using std::unordered_set;
using std::unordered_multiset;
using std::multiset;
using std::bitset;
using std::priority_queue;

/* constant value */
constexpr ll MOD = 1000000007;
//constexpr ll MOD = 998244353;

/* Initial processing  */
struct Preprocessing { Preprocessing() { std::cin.tie(0); std::ios::sync_with_stdio(0); }; }_Preprocessing;

/* define hash */
namespace std { template <>	class hash<std::pair<ll, ll>> { public:	size_t operator()(const std::pair<ll, ll>& x) const { return hash<ll>()(1000000000 * x.first + x.second); } }; }

/* input */
template<class T> std::istream& operator >> (std::istream& is, vector<T>& vec) { for (T& x : vec) is >> x; return is; }

//=============================================================================================


signed main() {
	ll n;
	cin >> n;
	VL v = VL(n);
	cin >> v;

	VL p(n, -1);
	REPC(x, v) {
		auto it = std::lower_bound(ALL(p), x) - p.begin() - 1;
		p[it] = x;
	}

	ll ans = 0;
	REPC(x, p)if (x > -1) { ++ans; }
	cout << ans << endl;
}

Measured memory_bytes: 1792
N = int(input())
P = list(map(int, input().split()))

idxs = [0] * (N+1)
for i in range(N):
    idxs[P[i]] = i

ans = 0
last = N+10
for i in range(1,N+1):
    if idxs[i] < last:
        ans += 1
        last = idxs[i]
    else:
        continue

print(ans)

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

int main(void)
{
    int x, a, b;
    cin >> x;
    cin >> a;
    cin >> b;

    cout << (x - a) % b;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma gcc optimize("ofast")
using namespace std;

#define ll long long //data types used often, but you don't want to type them time by time
#define ull unsigned long long
#define ui unsigned int
#define mod 998244353
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0); //to synchronize the input of cin and scanf
#define INF LONG_MAX
#define PI 3.1415926535897932384626
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define rep(x,j,n)for(int x=j;x<n;x++)
typedef vector<pair<ll,ll>> vpi;
typedef vector<ll> vi;
typedef vector<vi> vvi;

ll modexp(ll a,ll b,ll m)
{
	ll r=1;
	a=a%m;
	while(b>0)
	{
		if(b&1)
		    r=(r*a)%m;
		b>>1;
		a=(a*a)%m;
	}
	return r%m;
}


int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	vi arr = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	ll k; cin>>k;
	k--;
	cout<<arr[k]<<endl;
	return 0;
}


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

import numpy as np

N, K = map(int, input().rstrip().split(' '))

x = np.arange(N) + 1
c = np.ceil(np.log2(K / x)).astype(int)
c = c[np.where(c > 0)]
if len(c) == 0:
    print(1)
else:
    cumprod = np.cumprod([0.5] * int(c[0]+1))
    print(2 * np.sum(cumprod[c]) / N + (N - len(c)) / N)


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

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

const int Max = 2e6 + 10;
const int Mod = 1e9 + 7;
const ll Inf = 1LL << 62;

int main() {
	string s, t;
	int cnt = 0;
	cin >> s >> t;
	for(int i = 0; i < s.size(); i++) {
		cnt += (s[i] != t[i]);
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 3856
using System;
class Program {
  static void Main (string[] args) {
    // スペース区切りの整数の入力
    string[] input = Console.ReadLine ().Split (' ');
    int a = int.Parse (input[0]); //pizaA
    int b = int.Parse (input[1]); //pizaB
    int c = int.Parse (input[2]); //pizaAB
    int x = int.Parse (input[3]); //aの枚数
    int y = int.Parse (input[4]); //bの枚数

    int minab = 0;
    int manycost = 0;
    int maxab = 0;
    if (x > y) { //xの方が多いとき
      minab = y;
      maxab = x;
      manycost = a;
    } else {
      minab = x;
      maxab = y;
      manycost = b;
    }

    //int ca,cb
    int count = 0;
    if (a + b > 2 * c) {
      for (int i = 0; i < minab * 2; i++) {
        count += c;
      }
    } else {
      count = a * x + b * y;
      goto disp;
    }
    // Console.WriteLine (c);
    //Console.WriteLine (count);

    if (manycost > 2 * c) {
      count += (maxab - minab ) * c*2;
    } else {
      count += manycost * (maxab - minab);
    }

    disp:

      Console.WriteLine (count);
  }
}

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

#define lengthof(array) (sizeof(array) / sizeof(*array))
#define dump(a) (cerr << (#a) << " = " << (a) << endl)
#define FOR(it,c) for(__typeof((c).begin())it=(c).begin(); it!=(c).end();++it)
#define RFOR(it,c) for(__typeof((c).rbegin())it=(c).rbegin(); it!=(c).rend();++it)

template<class T> inline void chmax(T& a, const T& b) { if(b > a) a = b; }
template<class T> inline void chmin(T& a, const T& b) { if(b < a) a = b; }

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

template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	copy(v.begin(), v.end(), ostream_iterator<T>(os, " "));
	return os;
}

const int MAX_N = 7;

int p, q, a, n;
int tmp[MAX_N];
int size = 0;
int product = 1;

inline pair<int, int> add(int n1, int d1, int n2, int d2) {
	int deno = d1 / __gcd(d1, d2) * d2;
	int nume = deno / d1 * n1 + deno / d2 * n2;
	const int g = __gcd(nume, deno);
	return make_pair(nume / g, deno / g);
}

inline int dfs(int nume, int deno) {
	if(nume == p && deno == q)
		return 1;

	if(size == n || nume * q > deno * p)
		return 0;

	int res = 0;
	for(int i = (size ? tmp[size - 1] : 1); product * i <= a; ++i) {
		const pair<int, int> check = add(nume, deno, n - size, i);
		if(check.first * q < check.second * p)
			break;

		product *= i;
		tmp[size++] = i;
		const pair<int, int> result = add(nume, deno, 1, i);
		res += dfs(result.first, result.second);
		product /= i;
		--size;
	}

	return res;
}

int main() {
	while(scanf("%d %d %d %d", &p, &q, &a, &n), p) {
		const int g = __gcd(p, q);
		p /= g;
		q /= g;
		printf("%d\n", dfs(0, 1));
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1192
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#define INF          1e9
#define INFLL        1e18
#define EPS          1e-9
#define MOD          1000000007
#define REP(i,n)     for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)    for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)    for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)   for(ll i=(n);i>0;--i)
#define REPC(i,obj)  for(auto i:obj)
#define ALL(obj)     (obj).begin(),(obj).end()
#define SETP(n)      cout<<fixed<<setprecision(n)
#define VV(T,h,w)    vector<vector<T>>(h,vector<T>(w))
#define VVI(T,h,w,i) vector<vector<T>>(h,vector<T>(w,i))
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

int main()
{
    ll n = in(), m = in();

    vector<ll>a(n);
    REP(i, n)scanf("%lld", &a[i]);
    sort(ALL(a));

    vector<pair<ll, ll>>bc(m);
    REP(i, m) {
        ll b, c; scanf("%lld%lld", &b, &c);
        bc[i] = make_pair(c, b);
    }
    sort(ALL(bc), greater<pair<ll, ll>>());

    ll inow = 0, ans = 0;
    REP(i, m) {
        ll b = bc[i].second, c = bc[i].first;
        for (ll j = 0; j < min(b, n - inow); ++j) {
            ans += max(a[j + inow], c);
        }
        inow += b;
    }
    for (ll j = inow; j < n; ++j)ans += a[j];

    cout << ans << endl;
}

Measured memory_bytes: 2688
#include <stdio.h>

int main() {
  int a, b, c, d = 0;
  scanf("%d%d%d", &a, &b, &c);
  for (int i = a; i <= b; ++i) {
    if (c % i == 0) ++d;
  }
  printf("%d\n", d);
}


Measured memory_bytes: 2692