akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) long long((x).size())
#define OUT(x) cout << (x) << endl
typedef long long ll;
typedef vector<ll> V;
typedef vector<vector<ll>> VV;
typedef pair<ll, ll> P;
typedef map<string, ll> M;
typedef unordered_map<ll, ll> HM;
typedef set<ll> S;
typedef multiset<ll> MS;
typedef queue<ll> Q;

int main(){
    ll n; cin>>n;
    ll t[n],a[n];
    for(ll i=0; i<n; i++)
        cin >> t[i] >> a[i];
    ll currT = t[0], currA = a[0];
    for(ll i=1; i<n; i++){
        ll x = t[i], y = a[i];
        if(x < currT || y < currA){
            x *= max(currT/t[i], currA/a[i]);
            y *= max(currT/t[i], currA/a[i]);
        }
        if(x < currT || y < currA){
            x += t[i];
            y += a[i];
        }
        currT = x;
        currA = y;
    }
    OUT(currT+currA);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll MOD = 1000000007;

struct edge{
    int from, to;
    ll cost;
    edge(int f, int t, ll c) : from(f), to(t), cost(c) {}
    bool operator<(const edge& right) const {
        return cost < right.cost;
    }
};

class UnionFind{
public:
    vector<int> par;
    vector<int> rank;
    UnionFind(int n){
        init(n);
    }
    void init(int n){
        par.resize(n);
        for(int i=0;i<n;i++){
            par[i] = i;
        }
        rank.assign(n, 0);
    }
    int find(int x){
        if(par[x] == x){
            return x;
        }else{
            return par[x] = find(par[x]);
        }
    }
    void unite(int x,int y){
        x = find(x);
        y = find(y);
        if(x == y) return;

        if(rank[x] < rank[y]){
            par[x] = y;
        }else{
            par[y] = x;
            if(rank[x] == rank[y]) rank[x]++;
        }
    }
    bool same(int x,int y){
        return find(x)==find(y);
    }
};

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

    ll s = 0;
    vector<ll> X(N);
    for(int i=0;i<N;i++){
        cin >> X[i];
        s += X[i];
    }

    vector<edge> edges;
    for(int i=0;i<M;i++){
        int a, b;
        ll y;
        cin >> a >> b >> y;
        a--;
        b--;
        edges.emplace_back(a, b, y);
    }

    sort(edges.begin(), edges.end());
    UnionFind uf(N);
    vector<ll> weight_sum(N, 0);
    for(int i=0;i<N;i++){
        weight_sum[i] = X[i];
    }
    vector<ll> ans_sum(N, 0);

    int ans = 0;
    for(edge& e : edges){
        if(!uf.same(e.from, e.to)){
            ll ans_total = ans_sum[uf.find(e.from)] + ans_sum[uf.find(e.to)];
            ll weight_total = weight_sum[uf.find(e.from)] + weight_sum[uf.find(e.to)];
            uf.unite(e.from, e.to);
            weight_sum[uf.find(e.from)] = weight_total;
            ans_sum[uf.find(e.from)] = ans_total;
        }
        if(e.cost <= weight_sum[uf.find(e.from)]){
            ans_sum[uf.find(e.from)] = 0;
        }else{
            ans_sum[uf.find(e.from)]++;
        }
    }

    cout << ans_sum[uf.find(0)] << endl;

    return 0;
}

Measured memory_bytes: 4976
#include <bits/stdc++.h>
#define PII pair<int,int>
#define ll long long
#define maxn 1000010
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int h, n;
	int s=0,tmp;
	cin >> h >> n;
	while (n--)
	{
		cin >> tmp;
		s += tmp;
	}
	if (s >= h)
		cout << "Yes";
	else
		cout << "No";
}


Measured memory_bytes: 256
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define VVVI vector<vector<vector<ll>>>
#define VVVVI vector<vector<vector<vector<ll>>>>
#define REP(i,n) for(ll i=0,_n=(n);(i)<(ll)_n;++i)
#define REPR(i,n) for(ll i=(ll)(n)-1;0<=(i);--i)
#define RANGE(i,a,b) for(ll i=(ll)a,_b=(ll)(b);(i)<_b;++i)
#define RANGER(i,a,b) for(ll i=(ll)(b)-1,_a=(ll)(a);(_a)<=i;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
#define FI first
#define SE second
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template<typename T>void maxUpdate(T& a, T b) {a = max(a, b);}
template<typename T>void minUpdate(T& a, T b) {a = min(a, b);}

#define MOD 1000000007LL
#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N;
	while(cin>>N) {
		VI hs(N);
		REP(i, N) cin>>hs[i];
		ll ans = 0;
		REP(i, N) {
			ll ok=1;
			REP(j, i) if(hs[j]>hs[i]) ok=0;
			if(ok) ans++;
		}
		
		cout<<ans<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
#!/usr/bin/ruby                                                                                                                                   
# -*- coding: utf-8 -*-                                                                                                                           

while (change = 1000 - gets.to_i()) != 1000
  res = 0
  coins = [500, 100, 50, 10, 5, 1]
  coins.each {|x|
    res += change / x
    change %= x
  }
  puts res
end

Measured memory_bytes: 6084
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 3e3 + 5;
const int P = 998244353;
typedef long long ll;
template <typename T> void chkmax(T &x, T y) {x = max(x, y); }
template <typename T> void chkmin(T &x, T y) {x = min(x, y); } 
template <typename T> void read(T &x) {
	x = 0; int f = 1;
	char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
	x *= f;
}
int dp[MAXN][MAXN];
void update(int &x, int y) {
	x += y;
	if (x >= P) x -= P;
}
int main() {
	int a, b, c, d; read(a), read(b), read(c), read(d);
	dp[a][b] = 1;
	for (int j = b + 1; j <= d; j++)
		dp[a][j] = 1ll * dp[a][j - 1] * a % P;
	for (int i = a + 1; i <= c; i++) {
		int sum = 0;
		for (int j = b; j <= d; j++) {
			update(dp[i][j], 1ll * dp[i - 1][j] * j % P);
			update(dp[i][j], sum);
			sum = 1ll * sum * i % P;
			update(sum, 1ll * dp[i - 1][j] * j % P);
		}
	}
	cout << dp[c][d] << endl;
	return 0;
}


Measured memory_bytes: 38780
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

const int N = 200010;
const int INF = 1e9;
int n;
int f[(1<<26)+10];
char s[N];

int main()
{
	scanf("%s", s+1); n = strlen(s+1);
	for (int i = 1; i < 1<<26; i ++){
		//if (__builtin_popcount(i) <= 1) f[i] = 1;
		f[i] = INF;
	}
	int st = 0, lst;
	for (int i = 1; i <= n; i ++){
		lst = st;
		st ^= 1<<s[i]-'a';
		f[st] = min(f[st], f[lst]+1);
		for (int j = 0; j < 26; j ++)
			f[st] = min(f[st], f[st^(1<<j)]+1);
	}
	if (!st) puts("1");
	else printf("%d\n", f[st]);
	return 0;
}

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

#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef long long ll ;
typedef long double ld ;

const ll MOD = 1E9 + 7, INF = 2E18 + 5 ;
const double PI = 2 * acos(0.0) ;
const long double EPS = 1.0E-14 ;

int main()
{
    ll n, d, ans = 0, val, x, y ;
    cin >> n >> d ;
    d = d * d ;
    for (int i = 0; i < n; i++) {
        scanf("%lld %lld", &x, &y) ;
        val = (x * x) + (y * y) ;
        if (val <= d)   ans++ ;
    }
    cout << ans ;

    return 0 ;
}


Measured memory_bytes: 3660
#include <cstdio>
typedef long long ll;

int n;
ll a[55],s;

int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;++i)scanf("%lld",&a[i]);
    while(true)
    {
        int Mp=0;
        ll Mv=0;
        for(int i=1;i<=n;++i)if(a[i]>Mv)Mv=a[Mp=i];
        if(Mv<n)break;
        ll Cnt=Mv/n;
        s+=Cnt;
        for(int i=1;i<=n;++i)
            if(i!=Mp)a[i]+=Cnt;
            else a[i]%=n;
    }
    printf("%lld\n",s);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const int inf = 1e9;
const ll INF = 1e18;
const double pi = 3.14159265358979323846;
#define rep(i,n) for(ll i=0;i<n;i++)

int main(){
	int n,k;cin>>n>>k;
	int ans=(n-1)/(k-1);
	if((n-1)%(k-1)!=0) ans++;
	cout<<ans<<"\n";
}

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

using namespace std;

int main()
{
    int n;
    cin>>n;
    int a[n];
    int cnt=0,sum=0;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        if(a[i]%2==0)
        {
            cnt++;
            if(a[i]%3==0||a[i]%5==0)
            sum++;
        }
    }
    if(cnt==sum)
        cout<<"APPROVED\n";
    else
        cout<<"DENIED\n";
    return 0;

}


Measured memory_bytes: 256
import sys
n,k = map(int,input().split())
a = list(map(int,input().split()))

dp = [sys.maxsize]*n
dp[0]=0


for i in range(n):
  for j in range(i+1,i+k+1):
    if j<n:
      dp[j] = min(dp[j],dp[i]+abs(a[i]-a[j]))
      
print(dp[n-1])

Measured memory_bytes: 52448
#include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<28;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-10;
const ll mod=1e9+7;
const vi emp;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,-0};
const int DX[8]={-1,-1,-1,0,0,1,1,1},DY[8]={1,0,-1,1,-1,1,0,-1};

int n;

int main(){
	while(1){
		int n;
		cin>>n;
		if(!n) break;
		vi a(2*n,2);
		for(int i=0;i<n;i++){
			int A;
			cin>>A;
			a[A-1]=1;
		}
		int N=n,M=n,now=-1,flag=1;
		while(N&&M){
			bool tmp=1;
			for(int i=now+1;i<2*n;i++) if(flag==a[i]){
				if(flag==1){
					flag=2;
					N--;
				}
				else{
					flag=1;
					M--;
				}
				a[i]=0;
				now=i;
				tmp=0;
				break;
			}
			if(tmp){
				if(flag==1) flag=2;
				else flag=1;
				now=-1;
			}
		}
		cout<<M<<endl<<N<<endl;
	}
}

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

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

  bool x=true;
  int begin=0;
  int end=str.size()-1;
  int a,b;
  bool begin_a=false;
  bool end_z=false;
  while(!begin_a){
    if (str.at(begin)=='A'){
      a=begin;
      begin_a=true;
    }
    else begin++;
  }
  while(!end_z){
    if (str.at(end)=='Z'){
      b=end;
      end_z=true;
    }
    else end--;
  }
  cout << end-begin+1 << endl;
}

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

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = LLONG_MAX;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

#define int long long

inline void my_io() {

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

	cout << fixed << setprecision(16);

	//cout << setprecision(10) << scientific << ans << endl;
}

signed main() {
	string s;

	cin >> s;

	vector<ll> ans(s.size(), 0);

	ll now = 0;
	ll start = 0;

	if (s[s.size() - 1] == 'L') {
		s = s + "R";
	}
	else {
		s = s + "L";
	}

	REP(i, s.size() - 1) {
		if (s[i] != s[i + 1]) {
			if (now == 0) {
				FOR(j, start, i + 1) {
					if ((i - j) % 2 == 0) {
						ans[i]++;
					}
					else {
						if (i + 1 < s.size() - 1) {
							ans[i + 1]++;
						}
					}
				}
			}
			else {
				FOR(j, start, i + 1) {
					if ((i - j) % 2 == 0) {
						ans[start]++;
					}
					else {
						ans[start - 1]++;
					}
				}
			}
			start = i + 1;
			now = (now + 1) % 2;
		}
	}

	cout << ans << endl;
}

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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

ll L[10];
//! [bitで表される竹を使って][長さiの竹を作るための]=MP
ll mp[300][5];

int main()
{
    int N, S[3];
    cin >> N;
    REP(i, 3)
    {
        cin >> S[i];
    }
    REP(i, N)
    {
        cin >> L[i];
    }

    int m = pow(2, N);
    FOR(i, m, 1)
    {
        ll sum = 0;
        int n = 0;
        REP(j, N)
        {
            if (((i >> j) & 1) == 0)
                continue;
            n++;
            sum += L[j];
        }
        REP(j, 3)
        {
            mp[i][j] = 10 * (n - 1) + abs(sum - S[j]);
        }
    }

    ll min = INF;
    FOR(i, m, 1)
    {
        FOR(j, m, 1)
        {
            FOR(k, m, 1)
            {
                bool f = false;
                REP(l, N)
                {
                    int s = 0;
                    s = ((i >> l) & 1) + ((j >> l) & 1) + ((k >> l) & 1);
                    if (s > 1)
                    {
                        f = true;
                        break;
                    }
                }
                if (f)
                    continue;
                min = std::min(min, mp[i][0] + mp[j][1] + mp[k][2]);
            }
        }
    }
    cout << min << endl;
    return 0;
}

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

int main() {
    int n;
    cin >> n;
    n %= 10;

    if(n == 3) {
        cout << "bon" << endl;
    }else if(n == 0 || n == 1 || n == 6 || n == 8) {
        cout << "pon" << endl;
    }else{
        cout << "hon" << endl;
    }
    return 0;
}

Measured memory_bytes: 3612
class Rational
  def ok?
    self >= 0 && denominator == 1
  end
end

x, y = gets.split.map(&:to_i)

tsuru = Rational(4 * x - y, 2).ok?
kame = Rational(-2 * x + y, 2).ok?

puts (tsuru && kame) ? "Yes" : "No"

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

int f(long long sz,long long k, vector<long long> &a)
{
	long long tot = 0;
	for(auto x : a)
		tot += (x-1)/sz;
	//cout << tot << " " << k << " " << sz << endl;
	return tot <= k;
}

int main()
{
	long long n,k;
	cin >> n >> k;
	vector<long long> a(n,0);
	for(auto &x: a)
		cin >> x;

	long long  l = 1;
	long long r = 1000000000;
	while(l < r)
	{
		long long mid = (l + r)/2;
		if(f(mid,k,a))
			r = mid;
		else
			l = mid+1;
	}

	cout << r << endl;

}

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

using namespace std;

int main()
{
    int array[100];
    int arr[100];
    int k,s;
    cin>>k>>s;
    int g=s;
    int m=k-1;
    for (int i=0;i<k;i++){
        array[i]=s--;
    }
    sort(array,array+k);
     for (int i=0;i<k;i++){
       cout<<array[i]<<' ';
     }
      for (int i=0;i<k-1;i++){
            arr[i]=++g;
            cout<<arr[i]<<' ';
      }
}



Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
long long a[100000];
int main(){
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++)scanf("%lld",&a[i]);
    std::sort(a,a+n);
    long long ans=0;
    if(n%2==0){
        int m=n/2;
        for(int i=0;i<m;i++)ans-=2*a[i];
        for(int i=m;i<n;i++)ans+=2*a[i];
        ans+=a[m-1]-a[m];
    }else{
        int m=n/2; //2*m+1=n
        for(int i=0;i<m;i++)ans-=2*a[i];
        for(int i=m+1;i<n;i++)ans+=2*a[i];
        if(a[m+1]-a[m]>a[m]-a[m-1])ans+=a[m-1]-a[m];
        else ans+=a[m]-a[m+1];
    }
    printf("%lld",ans);
    return 0;
}

Measured memory_bytes: 896
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.util.*
import kotlin.math.abs
import kotlin.math.max
import kotlin.math.min

val MOD = 1_000_000_007L

class Solver(stream: InputStream, private val out: java.io.PrintWriter) {
  fun solve() {
    val A = nl()
    out.println(A + A * A + A * A * A)
  }













































  private val isDebug = try {
    // なんか本番でエラーでる
    System.getenv("MY_DEBUG") != null
  } catch (t: Throwable) {
    false
  }

  private var tokenizer: StringTokenizer? = null
  private val reader = BufferedReader(InputStreamReader(stream), 32768)
  private fun next(): String {
    while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {
      tokenizer = StringTokenizer(reader.readLine())
    }
    return tokenizer!!.nextToken()
  }

  private fun ni() = next().toInt()
  private fun nl() = next().toLong()
  private fun ns() = next()
  private fun na(n: Int, offset: Int = 0): IntArray {
    return map(n) { ni() + offset }
  }
  private fun nal(n: Int, offset: Int = 0): LongArray {
    val res = LongArray(n)
    for (i in 0 until n) {
      res[i] = nl() + offset
    }
    return res
  }

  private fun na2(n: Int, offset: Int = 0): Array<IntArray> {
    val a  = Array(2){IntArray(n)}
    for (i in 0 until n) {
      for (e in a) {
        e[i] = ni() + offset
      }
    }
    return a
  }

  private inline fun map(n: Int, f: (Int) -> Int): IntArray {
    val res = IntArray(n)
    for (i in 0 until n) {
      res[i] = f(i)
    }
    return res
  }

  private inline fun debug(msg: () -> String) {
    if (isDebug) System.err.println(msg())
  }

  private fun debug(a: LongArray) {
    debug { a.joinToString(" ") }
  }

  private fun debug(a: IntArray) {
    debug { a.joinToString(" ") }
  }

  private fun debug(a: BooleanArray) {
    debug { a.map { if (it) 1 else 0 }.joinToString("") }
  }

  private fun debugDim(A: Array<LongArray>) {
    if (isDebug) {
      for (a in A) {
        debug(a)
      }
    }
  }
  private fun debugDim(A: Array<IntArray>) {
    if (isDebug) {
      for (a in A) {
        debug(a)
      }
    }
  }

  /**
   * 勝手にimport消されるのを防ぎたい
   */
  private fun hoge() {
    min(1, 2)
    max(1, 2)
    abs(-10)
  }
}

fun main() {
  val out = java.io.PrintWriter(System.out)
  Solver(System.`in`, out).solve()
  out.flush()
}

Measured memory_bytes: 34736
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <stdio.h>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional> //operator[]
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;

const ll MOD = 1000000007;

ll powmod(ll x, ll n){
    ll ret=1;
    while(n>0){
        if(n&1){
            ret*=x;
            ret%=MOD;
            n-=1;
        }
        else{
            x*=x;
            x%=MOD;
            n>>=1;
        }
    }
    return ret;
}


signed main(){
    ll n,k; cin >> n >> k;
    ll num[k+1];
    rep(i,k+1) num[i]=0;
    ll ans=0;
    for(ll i=k;i>0;i--){
        //gcd=i
        ll x=k/i;
        ll res=powmod(x,n);
        for(ll j=2;i*j<=k;j++){
            res-=num[i*j];
            res=(res+MOD)%MOD;
        }
        num[i]=res;
        ans+=(res*i)%MOD;
        ans%=MOD;
    }
    cout << ans << endl;
    
}


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

#define what_is(x)    cerr<<#x<<" is "<<x<<"\n";
#define rep(i,a,n)    for(int i=a; i<=n; ++i)
#define rep1(i,a,n)   for(int i=a; i>=n; --i)
#define pb            push_back
#define mp            make_pair
#define int           long long
#define fr            first
#define sc            second
#define vc            vector
#define sz(v)         (int)v.size()
#define all(x)        (x).begin(),(x).end()
#define rall(x)       (x).rbegin(),(x).rend()
#define M             1000000007
#define MM            998244353
#define PI            3.14159265358979
#define INF           1000000000000000

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef map<int,int> mii;

int n,m,ans; string str;

int solve(){
    cin>>n>>m;
    m*=2; m++;
    cout<<(n+m-1)/m;
    return 0;
}

signed main() {
    ios::sync_with_stdio(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t=1;
    //cin>>t;
    while(t--) solve();
    return 0;
}

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


int main(){
    long n,m,x;
    cin>>n>>m>>x;
    long ans=1000000000;
    vector<vector<long>> matrix(n,vector<long>(m+1));
    for(int i=0;i<n;i++){
        for(int j=0;j<m+1;j++){
            long y;cin>>y;
            matrix.at(i).at(j)=y;
        }
    }
    for(int i=0;i<1<<n;i++){
        vector<long> array(m+1);
        bool rep=1;
        for(int j=0;j<n;j++){
            if(i&(1<<j)){
                for(int k=0;k<m+1;k++)array.at(k)+=matrix.at(j).at(k);
            }
        }
        for(int j=1;j<m+1;j++){
            if(array[j]<x)rep=0;
        }
        if(rep)ans=min(ans,array.at(0));
    }
    if(ans!=1000000000)cout<<ans<<endl;
    else cout<<-1<<endl;
}

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

using namespace std;

int n;
int a[100010];
int val[100010];

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

    for(int i = 0; i < n; i++) scanf("%d", &a[i]);

    sort(a, a + n);
    
    memset(val, -1, sizeof(val));

    int idx = 0;
    for(int i = 0; i < n; i++){
        val[idx] = a[i];
        idx = (idx + 3) % n;
        if(val[idx] != -1) idx++;
    }

    bool ok = ((val[n - 1] ^ val[1]) == val[0]) && ((val[n - 2] ^ val[0]) == val[n - 1]);

    for(int i = 1; i < n - 1; i++)
        ok &= ((val[i - 1] ^ val[i + 1]) == val[i]);

    if(ok) printf("Yes\n");
    else printf("No\n"); 

    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
inline int Abs(int x)
{
	return x>0?x:-x;
}
int n,a[100005],f[100005];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	f[2]=Abs(a[2]-a[1]);
	for(int i=3;i<=n;i++)
		f[i]=min(f[i-1]+Abs(a[i]-a[i-1]),f[i-2]+Abs(a[i]-a[i-2]));
	printf("%d",f[n]);
}


Measured memory_bytes: 1024
# 小さいのを2つ選んで最後の1つをにぶたん
# なぜかTLEなる
from bisect import bisect_left
n = int(input())
l = sorted(list(map(int, input().split())))
ans = 0
for i in range(n):
    for j in range(i + 1, n):
        # ok, ng = j, n
        # while (ng - ok) > 1:
        #     mid = (ng + ok) // 2
        #     if l[i] + l[j] > l[mid]:
        #         ok = mid
        #     else:
        #         ng = mid
        # ans += ok - j
        # ↑とやってることは同じはずなんだけどなぜかTLEなるので組み込みのやつを使ってみる
        a = bisect_left(l, l[i] + l[j])
        ans += a - 1 - j
print(ans)


Measured memory_bytes: 9364
n, W = map(int, input().split())
dp = [W + 1] * (1010 * (n + 1))

dp[0] = 0
v_max = 0
for i in range(n):
    w, v = map(int, input().split())
    v_max += v
    for j in range(v_max, v - 1, -1):
        dp[j] = min(dp[j - v] + w, dp[j])

ans = 0
for i in range(v_max, -1, -1):
    if dp[i] <= W:
        ans = max(ans, i)
print(ans)

Measured memory_bytes: 41564
#include<bits/stdc++.h>
using namespace std;
#define int long long int
int32_t main()
{
  	ios_base::sync_with_stdio(0);
  	cin.tie(0);
    set<string> st;
    int n;
    cin >> n;
    for(int i=0; i<n; i++)
    {
        string tmp;
        cin >> tmp;
        st.insert(tmp);
    }
    cout << st.size() << endl;
    return 0;
}


Measured memory_bytes: 19200
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define eps 1e-10
#define MAXN 100005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
	if(c == '-') f = -1;
	c = getchar();
    }
    while(c >= '0' && c <= '9') {
	res = res * 10 +c - '0';
	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
	out(x / 10);
    }
    putchar('0' + x % 10);
}
int N,a[MAXN];
int64 L,sum;
vector<int> ans;
void Solve() {
    read(N);read(L);
    for(int i = 1 ; i <= N ; ++i) {read(a[i]);}
    for(int i = 1 ; i < N ; ++i) {
	if(a[i] + a[i + 1] >= L) {
	    puts("Possible");
	    for(int j = 1 ; j < i ; ++j) ans.pb(j);
	    for(int j = N - 1 ; j > i ; --j) ans.pb(j);
	    ans.pb(i);
	    for(auto t : ans) {
		out(t);enter;
	    }
	    return;
	}
    }
    puts("Impossible");
}

int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
    return 0;
}


Measured memory_bytes: 1784
N = int(input())
S = input()
from collections import defaultdict

ans = 0
L = "abcdefghijklmnopqrstuvwxyz"
for i in range(1,N):
    tmp = 0
    zen = S[:i]
    kou = S[i:]
    for j in L:
        if j in zen and j in kou:
            tmp += 1
    if tmp > ans:
        ans = tmp
print(ans)

Measured memory_bytes: 39792
#include <stdio.h>

int main(){
  int N,M;
  int ans=0;
  int i,j;
  
  scanf("%d %d",&N,&M);
  
  for(i=2;i<=N;i++) ans += i-1;
  for(i=2;i<=M;i++) ans += i-1;
  
  printf("%d\n",ans);
  
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, n) for (int i = 1; i <= (n); i++)
using ll = long long;
ll x[10000001];
int main() {
    int N;
    cin >> N;
    for (int i = 1; i <= N; i++) {
        x[i] = 1;
    }
    for (int i = 2; i <= N; i++) {
        for (int j = i; j <= N; j+=i) {
            x[j]++;
        }
    }
    ll ans = 0;
    for (int i = 1; i <= N; i++) {
        ans += i * x[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 81660
//              +-- -- --++-- +-In the name of ALLAH-+ --++-- -- --+              \\

#include <bits/stdc++.h>

#define F first
#define S second
#define _sz(x) (int)x.size()

using namespace std ;
using ll = long long ;
using ld = long double ;
using pii = pair <int , int> ;

int const N = 1e5 + 20 ;
int n , a[N] ;
ll ans ;

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

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

	for (int i = 0 ; i < n ; i ++) {
		if (i && a[i] && a[i - 1]) ans ++ , a[i - 1] -- , a[i] -- ;
		ans += (a[i] >> 1) ;
		a[i] &= 1 ;
	}

	cout << ans << '\n' ;
}


Measured memory_bytes: 640
from bisect import bisect_right

N = int(input())
A = sorted(int(x) for x in input().split())
B = sorted(int(x) for x in input().split())
C = sorted(int(x) for x in input().split())

b2c = [0] * (N+1)
for i in range(N):
    b = B[i]
    j = bisect_right(C, b)
    b2c[i] = N - j
    #print("B[%d]=%5d"%(i,b), "C[%d]=%5d"%(j, C[j]), "bc=%d"%(N-j))

for i in range(N-1)[::-1]:
    b2c[i] += b2c[i+1]
    pass
#print(b2c)

total = 0
for i in range(N):
    a = A[i]
    a2b = bisect_right(B, a)
    t = b2c[a2b]
    #print("%d:t=%d"%(i, t),a2b)
    total+=t

print(total)
    



Measured memory_bytes: 24180
h,w=map(int,input().split())
import math
#パターン1
min1=float("inf")
i=0
while 1:
  kouho=[h*i,math.ceil(h/2)*(w-i),(h//2)*(w-i)]
  sa=max(kouho)-min(kouho)
  if sa<min1:
    min1=sa
  else:break
  i+=1

min2=float("inf")
i=0

#パターン2
while 1:
  kouho=[w*i,math.ceil(w/2)*(h-i),(w//2)*(h-i)]
  sa=max(kouho)-min(kouho)
  if sa<min2:
    min2=sa
  else:break
  i+=1

min3=w*(math.ceil(h/3)-h//3)
min4=h*(math.ceil(w/3)-w//3)


print(min(min1,min2,min3,min4))


Measured memory_bytes: 3064
"use strict";
function main(input) {
    let line = input.split(/\r?\n/g);
    let S = new Set(line[0].slice(0, line[0].length));
    console.log(1 < S.size ? "Yes" : "No");
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 11468
const input = require("fs").readFileSync("/dev/stdin", "utf8")
 
;(input => {
    const rows = input.split('\n')
    const N = rows[0] - 0
 
    const A = rows[1].split(' ').map(Number)
    A.sort((a, b) => a - b)
 
    const mem = []
    let count = 0
 
    for (let i = 0; i < N; i ++) {
        if (mem[A[i]] === 1) {
            count--
            mem[A[i]] = 0
            continue
        } else if (mem[A[i]] === 0) {
            continue
        } else {
            mem[A[i]] = 1
        }
        for (let j = 2; A[i] * j <= A[N - 1]; j++) {
            mem[A[i] * j] = 0
        }
        count++
    }
    console.log(count)
 
})(input)

Measured memory_bytes: 78520
#include <bits/stdc++.h>
#define vec vector
#define sz(c) int(c.size())
#define FOR(i, a, b) for (int i = a; i < (b); ++i)
#define DOWN(i, a, b) for(int i = (a) - 1; i >= (b); --i)
#define cerr2 cerr << __func__ << ":" << __LINE__ << ": "
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vec<int> vi;
const char eol = '\n';

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

  ll Q, H, S, D, N;

  cin >> Q >> H >> S >> D;
  cin >> N;

  ll price1 = min(Q * 4, min(H * 2, S));
  ll price2 = D;

  ll ans;
  if (2 * price1 <= price2) {
    ans = N * price1;
  } else {
    ans = N / 2 * price2;
    if (N % 2 != 0) {
      ans += price1;
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {

    static class Task {

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int k = in.nextInt();
            if (k % 2 == 0 || k % 5 == 0) {
                out.println(-1);
                return;
            }

            long cur = 7;
            int count = 1;
            while (cur % k != 0) {
                cur = (cur * 10 + 7) % k;
                count++;
            }

            out.println(count);
        }
    }

    private static void sort(double[] arr) {
        Double[] objArr = Arrays.stream(arr).boxed().toArray(Double[]::new);
        Arrays.sort(objArr);
        for (int i = 0; i < arr.length; i++) {
            arr[i] = objArr[i];
        }
    }

    private static void sort(int[] arr) {
        Integer[] objArr = Arrays.stream(arr).boxed().toArray(Integer[]::new);
        Arrays.sort(objArr);
        for (int i = 0; i < arr.length; i++) {
            arr[i] = objArr[i];
        }
    }

    private static void sort(long[] arr) {
        Long[] objArr = Arrays.stream(arr).boxed().toArray(Long[]::new);
        Arrays.sort(objArr);
        for (int i = 0; i < arr.length; i++) {
            arr[i] = objArr[i];
        }
    }

    private static void solve() {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task task = new Task();
        task.solve(1, in, out);
        out.close();
    }

    public static void main(String[] args) {
        new Thread(null, () -> solve(), "1", 1 << 26).start();
    }

    static class InputReader {

        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

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

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

    }

}

Measured memory_bytes: 33972
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<string> VS;
typedef vector< vector<int> > VVI;
typedef vector< vector<ll> > VVL;
typedef pair<int,int> PII;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound

int main(){
  int N,M;
  cin>>N>>M;
  VI A(M),B(M);
  rep(i,M) cin>>A[i]>>B[i];
  VI cnt(N+1);
  rep(i,M){
    cnt[A[i]]++;
    cnt[B[i]]++;
  }
  int ans=1;
  rep(i,N+1) if(cnt[i]%2) ans=0;
  if(ans) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#include <stdio.h>
typedef long long ll;
using namespace std;
ll a7=1000000007;
ll inf=1000000000000000;
typedef pair<ll,ll> l_l;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back


ll min(ll a,ll b){
    if(a<b)return a;
    return b;
}
ll max(ll a,ll b){
    if(a>b)return a;
    return b;
}
string memo[2000];
string bi(ll i,ll j){
    if(memo[i]!="") return memo[i];
    string ans="";
    ll x=i;
    while(i>0){
        if(i%2==1){
            ans='1'+ans;
        }else{
            ans='0'+ans;
        }
        i=i/2;
    }
    while(ans.size()<j){
        ans='0'+ans;
    }
    memo[x]=ans;
    return ans;
}

int main(){
    ll h,w,k;cin>>h>>w>>k;
    ll dp[h+1][w];
    rep(i,0,h){
        rep(j,0,w-1){
            dp[i][j]=0;
        }
    }
    dp[0][0]=1;
    string s;
    bool b;
    
    rep(i,1,h){
        rep(k,0,pow(2,w-1)-1){
            s=bi(k,w-1);
            b=false;
            rep(j,0,w-3){
                if(s[j]=='1' && s[j+1]=='1'){
                    b=true;
                }
            }
            if(b==false){
            //cout<<k<<' '<<s<<endl;
            
            rep(j,0,w-2){
                if(s[j]=='1'){
                    dp[i][j]+=dp[i-1][j+1];
                    dp[i][j+1]+=dp[i-1][j];
                    j++;
                }else{
                    dp[i][j]+=dp[i-1][j];
                }
            }
            if(s[w-2]=='0'){
                dp[i][w-1]+=dp[i-1][w-1];
            }
            rep(j,0,w-1){
                dp[i][j]=dp[i][j]%a7;
            }
            }
        }
    }
    
    ll ans=dp[h][k-1];
    if(w==1){
        cout<<1<<endl;
    }else{
        cout<<ans<<endl;
    }
    /*rep(i,0,h){
        rep(j,0,w-1){
            cout<<dp[i][j]<<' ';
        }
        cout<<endl;
    }
    rep(k,0,pow(2,w-1)-1){
        cout<<memo[k]<<endl;
    }*/
    return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define ff first
#define ss second
#define mod 1000000007
int main(void){
    // Your code here!
 ll i,n;
 cin >> n;
 ll a[2005],s[2005];
 a[0]=a[1]=a[2]=0;
 s[0]=s[1]=s[2]=0;
 for(i=3;i<=2004;i++)
 {
  a[i]=(1+s[i-3])%mod;
  s[i]=(s[i-1]+a[i])%mod;
 }
 cout << a[n];
 return 0;
}

Measured memory_bytes: 3660
n,k = map(int,input().split())
count = 0
if k%2 == 1:
    for i in range(1,n+1):
        if i%k==0:
            count += 1
    print(count**3)
else:
    half = 0
    for i in range(1,n+1):
        if i%k==0:
            count += 1
        elif i%k==k//2:
            half += 1
    #print(count, half)
    print((count**3)+(half**3))

Measured memory_bytes: 38896
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<ll, int> P;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int n;
ll k;
ll a[100100];

ll solve() {
    ll x = 0;
    for (int i = 40; i >= 0; i--) {
        ll b = (1LL<<i);
        if (x+b > k) continue;
        int cnt = 0;
        for (int j = 0; j < n; j++) {
            cnt += ((a[j]>>i) & 1);
        }
        if (cnt * 2 < n) {
            x += b;
        }
    }

    ll res = 0;
    for (int i = 0; i < n; i++) {
        res += (x ^ a[i]);
    }
    return res;
}

void input() {
    cin >> n >> k;
    for (int i = 0; i < n; i++) cin >> a[i];
}

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

    input();
    cout << solve() << endl;
}


Measured memory_bytes: 4344
n,m,k=input().split()
a=input().split()
b=input().split()
ta=0
cnta=0
while int(cnta)<int(n) and ta+int(a[cnta])<=int(k) :
    ta= ta+ int(a[cnta])
    cnta=cnta+1
tb=0
cntb=0
while cntb<int(m) and ta+tb+int(b[cntb])<=int(k):
    tb = tb+ int(b[cntb])
    cntb=cntb+1 
ans=cnta+cntb

while cnta-1>=0:
    ta=ta-int(a[cnta-1])
    cnta=cnta-1
    while cntb<int(m) and ta+tb+int(b[cntb])<=int(k):
        tb= tb+ int(b[cntb])
        cntb=cntb+1
    ans=max(ans,cnta+cntb)
print(ans)


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

int N, K;
const int n = 200010;
int A[n];

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

    for (int i = 0; i < n; i++)
    {
        A[i] = 0;
    }

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

    int k = 0;
    int B[N];

    for (int i = 0; i < N; i++)
    {
        B[i] = 0;
    }

    int j = 0;
    for (int i = 0; i < n; i++)
    {
        if (A[i] != 0)
        {
            k++;
            B[j] = A[i];
            j++;
        }
    }

    if (k < K)
    {
        cout << 0 << endl;
        return 0;
    }

    sort(B, B + k);

    int to_be_modified = k - K;

    int ans = 0;

    for (int i = 0; i < to_be_modified; i++)
    {
        ans += B[i];
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>
#include <stdlib.h>

long *tree[200010];

int main(void) {

  long n,m,a,b;
  scanf("%ld %ld", &n, &m);
  long tree_s[n+1];
  for (long i = 1; i <= n; i++) {
    tree_s[i] = 0;
  }
  for (long i = 0; i < m; i++) {
    scanf("%ld %ld", &a, &b);
    tree[a] = realloc(tree[a], sizeof(long)*(tree_s[a]+1));
    tree[a][tree_s[a]] = b;
    tree_s[a]++;
    tree[b] = realloc(tree[b], sizeof(long)*(tree_s[b]+1));
    tree[b][tree_s[b]] = a;
    tree_s[b]++;
  }
  long visited[n+1],queue[n];
  visited[1] = 1;
  for (long i = 2; i <= n; i++) {
    visited[i] = 0;
  }
  queue[0] = 1;
  long head = 1,tail = 0,start = 0, end = 0,cur,next,count = 1,max = 0;
  int flag;
  while (1) {
    flag = 0;
    for (long i = start; i <= end; i++) {
      cur = queue[i];
      for (long j = 0; j < tree_s[cur]; j++) {
        next = tree[cur][j];
        if (visited[next] == 1) {
          continue;
        }
        visited[next] = 1;
        tail++;
        queue[tail] = next;
        count++;
        flag = 1;
      }
    }
    if (flag == 1) {
      start = end+1;
      end = tail;
    } else {
      if (count > max) {
        max = count;
      }
      if (end == n-1) {
        break;
      }
      count = 1;
      for (long i = head+1; i <= n; i++) {
        if (visited[i] == 0) {
          visited[i] = 1;
          tail++;
          queue[tail] = i;
          head = i;
          break;
        }
      }
      start = end+1;
      end = start;
    }
  }
  printf("%ld\n", max);

  return 0;
}

Measured memory_bytes: 21136
N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]

ans = 0
for i in range(N):
    if A[i] >= B[i]:
        ans += B[i]
    elif A[i] + A[i+1] > B[i]:
        ans += B[i]
        A[i+1] = A[i] + A[i+1] - B[i]
    else:
        ans += A[i] + A[i+1]
        A[i+1] = 0
print(ans)


Measured memory_bytes: 18624
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<tuple>
#include<utility>
#include<stack>
using namespace std;

using ll=long long int;


int main() {

	ll n, sum = 0;
	cin >> n;

	ll num = n;

	while (num > 0) {
		sum += num % 10;
		num /= 10;
	}

	if (n % sum == 0)cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}





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

int main(){
  int n;
  cin >> n;
  map<int,int> mp;
  for (int i = 1;i <= 100;i++){
    for (int j = 1; j <= 100;j++){
      for (int k = 1; k <= 100;k++){
        int val = i*i + j*j + k*k + i*j + j*k + k*i;
        mp[val]++;
      }
    }
  }
  rep(i,n+1){
    if (i == 0) continue;
    if (mp.count(i)){
      cout << mp[i] << endl;
    }
    else{
      cout << 0 << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 5308
# NとDを定義
N, D = map(int, input().split())

# 原点からの距離がD以下となる点の個数を格納する変数の定義
dist_count = 0

# 原点からの距離がD以下の点の個数を評価
for i in range(N):
    # 座標の入力を定義
    x, y = map(int, input().split())
    # 原点からの距離がD以下となるか判定
    if x**2 + y**2 <= D**2:
        dist_count += 1

# 結果の出力
print(dist_count)

Measured memory_bytes: 9184
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (long long i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PL = pair<long long, long long>;
using Pxy = pair<double, double>;
using T = tuple<int, int, bool>;
const int INF = 1001001007;
const int mod = 1000000007;
//const int MOD = 998244353;
const ll inf = 1e18;
template <typename AT>
void printvec(vector<AT> &ar){
    rep(i,ar.size()-1) cout << ar[i] << " ";
    cout << ar[ar.size()-1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar){
    rep(i,ar.size()){
        rep(j,ar[0].size()-1) cout << ar[i][j] << " ";
        cout << ar[i][ar[0].size()-1] << endl;
    }
}
template <typename S>
bool range(S a, S b, S x){
    return (a <= x && x < b);
}

int main() {
    int n, t; cin >> n >> t;
    vector<P> ar(n);
    rep(i,n) cin >> ar[i].first >> ar[i].second;
    sort(ar.begin(), ar.end());
    vector<vector<int>> dp(n,vector<int>(t));
    rep(i,n) dp[i][0] = 0;
    rep(i,t){
        if (i >= ar[0].first){
            dp[0][i] = ar[0].second;
        }
    }
    repp(i,n,1){
        repp(j,t,1){
            int c = 0;
            if (j >= ar[i].first){
                c = dp[i-1][j-ar[i].first] + ar[i].second;
            }
            dp[i][j] = max({dp[i-1][j],dp[i][j-1],c});
        }
    }
    int ans = 0;
    repp(i,n,1) ans = max(ans, ar[i].second + dp[i-1][t-1]);
    cout << ans << endl;
}

Measured memory_bytes: 35584
#include <iostream>
#include <string.h>
#include <math.h>
using namespace std;

int main(){
    int a, b, c;
    cin>>a>>b>>c;

    if(a<=c && c<=b){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin python3
# -*- coding: utf-8 -*-

import sys

def main():
    N = int(input())
    L = 0
    print(L)
    sys.stdout.flush()
    Ls = input()
    if Ls == "Vacant":
        exit()
    U = N-1
    print(U)
    sys.stdout.flush()
    Us = input()
    if Us == "Vacant":
        exit()
    for _ in range(18):
        mid = (U+L)//2
        if mid%2==1:
            mid-=1
        if mid==L:
            mid+=1
        print(mid)
        sys.stdout.flush()
        ms = input()
        if ms == "Vacant":
            exit()
        if Ls==ms:
            L=mid
        if Us==ms:
            U=mid

if __name__ == '__main__':
    main()

Measured memory_bytes: 9104
import java.util.Scanner;

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

        String a = sc.next();
        String s = sc.next();
        String c = sc.next();
        char A = a.charAt(0);
        char S = s.charAt(0);
        char C = c.charAt(0);
        System.out.print(A);
        System.out.print(S);
        System.out.print(C);
    }
}

Measured memory_bytes: 21844
n=int(input())
a=[0]*n
b=[0]*n
for i in range(n):
    a[i],b[i]=input().split()
    b[i]=int(b[i])
for char in 'SHCD':
    for i in range(1,14):
        flag=0
        for j in range(n):
            if a[j]==char and b[j]==i:
                flag=1
                break
        if flag==0:
            print(char,i)


Measured memory_bytes: 5600