akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;

template <std::uint_fast64_t Modulus> class modint {
    using u64 = std::uint_fast64_t;
    
public:
    u64 a;
    
    modint(const u64 x = 0) noexcept : a(x % Modulus) {}
    u64 &value() { return a; }
    const u64 &value() const { return a; }
    modint operator+(const modint rhs) const  {
        return modint(*this) += rhs;
    }
    modint operator-(const modint rhs) const {
        return modint(*this) -= rhs;
    }
    modint operator*(const modint rhs) const {
        return modint(*this) *= rhs;
    }
    modint operator/(const modint rhs) const {
        return modint(*this) /= rhs;
    }
    modint &operator+=(const modint rhs) {
        a += rhs.a;
        if (a >= Modulus) {
            a -= Modulus;
        }
        return *this;
    }
    modint &operator-=(const modint rhs) {
        if (a < rhs.a) {
            a += Modulus;
        }
        a -= rhs.a;
        return *this;
    }
    modint &operator*=(const modint rhs) {
        a = a * rhs.a % Modulus;
        return *this;
    }
    modint &operator/=(modint rhs) {
        u64 exp = Modulus - 2;
        while (exp) {
            if (exp % 2) {
                *this *= rhs;
            }
            rhs *= rhs;
            exp /= 2;
        }
        return *this;
    }
};

modint<mod> f(modint<mod> x, int exp)
{
    modint<mod> ans;
    if (exp==0) {
        ans.a = 0;
        return ans;
    }
    else if (exp==1) {
        return x;
    }
    else if (exp%2==0){
        return f(x*x, exp/2);
    }
    else {
        return f(x*x, exp/2)*x;
    }
    
}


modint<mod> combination(int a, int b)
{
    if (a<b || a<=0 || b<0) {
        return modint<mod>(0);
    }
    if (b==0) {
        return modint<mod>(1);
    }
    modint<mod> ans;
    ans.a = 1;
    int x = 1;
    rep(i, b) {
        ans *= modint<mod>(a);
        a--;
        ans /= modint<mod>(i+1);
    }
    return ans;
}



int main(){
    ll n, k;
    cin >> n >> k;
    
    modint<mod> ans;
    ans.a = 0;
    ans += combination(2*n-1, n);
    

    if (k>=n-1) {
        cout << ans.a << endl;
        return 0;
    }
    
    vector<modint<mod>> v;
    modint<mod> temp = modint<mod>(1);
    v.push_back(temp);
    for (int i=0; i<=n-1; i++) {
        temp *= modint<mod>(n-1-i);
        temp /= modint<mod>(1+i);
        v.push_back(temp);
    }
    
    for (int i=k+1; i<=n-1; i++) {
        //ans -= combination(n, n-i)*combination(n-1, i);
        ans -= (v[i-1]+v[i])*v[i];
    }
    
    cout << ans.a << endl;
    return 0;
}


Measured memory_bytes: 2420
import java.io.*;
// import java.math.*;
// import java.util.*;
// import java.util.Map.*;
// import java.util.stream.*;

public class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader reader =
            new BufferedReader (new InputStreamReader (System.in));
        int N = Integer.parseInt (reader.readLine());
        boolean flg = false;
        for (int i = 0; i < 10; i++) {
            for (int j = 0; j < 10; j++) {
                if (i * j == N) {
                    flg = true;
                    break;
                }
            }
            if (flg)
                break;
        }
        System.out.println (flg ? "Yes" : "No");
        return;
    }
}

Measured memory_bytes: 32732
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cstdint>
#include <map>
#include <cmath>

#include <boost/range/irange.hpp>
using boost::irange;

using namespace std;

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

    string s;
    cin >> s;
    uint64_t k;
    cin >> k;
    
    if(k <= s.size())
    {
        const auto ir = irange<uint64_t>(0, k);
        if(all_of(begin(ir), end(ir), [&](auto i){ return s[i] == '1'; }))
        {
            cout << "1\n";
            return 0;
        }
    }
    cout << *find_if(begin(s), end(s), [](char c){ return c != '1'; }) << '\n';

    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() {
  map<int,int> map;
  int n,k;
  cin>>n>>k;
  rep(i,n){
    map[i]=0;
  }
  
  rep(i,k){
    int d;
    cin>>d;
    rep(i,d){
      int x;
      cin>>x;
      map[x-1]=1;//入力人数を0始まりに修正
    }
  }
  int sum=0;
  rep(i,n){
    if(map[i]==0){sum++;}
  }
  cout<<sum;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  ll A,B,N;
  cin >> A >> B >> N;
  if(B-1<N){
  cout << A*(B-1)/B - A*((B-1)/B) << endl;}
  else
  {
    cout << A*N/B - A*(N/B) << endl;
  }
  
  return 0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const double PI = acos(-1);

int main()
{
	ll a;
	double b;
	cin >> a >> b;
	ll b2 = round(b * 100);
	cout << a * b2 / 100 << endl;
}

Measured memory_bytes: 3772
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll qq(ll a,ll b,ll &x,ll&y){
    if(b==0){
        x=1;
        y=0;
        return a;
    }
    else{
        ll ans=qq(b,a%b,y,x);
        y -=a/b*x;
        return ans;
    }
}
int main(){
    ll c,d,x,y;
    cin>>c>>d;
    qq(c,d,x,y);
    cout<<x<<" "<<y<<endl;
    return 0;
}



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

const int MOD = 1e9+7;
typedef long long ll;
using namespace std;

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

  ll sum = 0;
  for (ll i = 1; i <= n; i++) {
    if (i % 3 == 0 || i % 5 == 0) {
      continue;
    }
    sum += i;
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 3568
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double


int main()
{
    ll x,k,d;
    cin>>x>>k>>d;

    x=abs(x);

    ll q=min(k, x/d);
    k-=q;
    x= x- (q*d);

    if(k%2)
        k=1;
    else
        k=0;
    if(k)
        x-=d;

    cout<<abs(x);
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;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 repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	int n,k;
	int ans=0;
	cin >>n>>k;
	Vi x(n);
	rep(i,n){
		cin>>x[i];
	}
	rep(i,n){
		ans+=2*min(abs(x[i]),abs(x[i]-k));
	}
	cout<<ans<<endl;
}

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

#define pb push_back

 
int solve() {
    
    int n;
    cin>>n;
    int cnt[10][10]={};
    for(int i=1;i<=n;i++){
        int x = (to_string(i)[0]-'0');
        int y = i%10;
        ++cnt[x][y];
    }

    int s=0;
    for(int i=0;i<10;i++){
        for(int j=0;j<10;j++){
            s+=cnt[i][j]*cnt[j][i];
        }
    }
    cout<<s<<endl;

}
 
 
int main()
{
    int test = 1, tc = 0;
    //scanf("%d", &test);
   // (void)getchar();
    //cin >> test;
    while (test--) {
        //printf("Case %d: ", ++tc);
        solve();
    }
    return 0;
}

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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
const ll mod = 1e9+7;


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

    ll n,x;cin>>n>>x;
    vll l(n); REP(i,n) cin>>l[i];
    ll count = 1;
    ll dis=0;
    REP(i,n){
        dis+=l[i];
        if(dis<=x) count++;
    }
    cout<<count<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <functional>
using namespace std;

int main(){
    int n, a, b;
    cin >> n >> a >> b;
    int p[n];
    for(int i = 0; i < n; i++){
        cin >> p[i];
    }
    int first = 0;
    int second = 0;
    int third = 0;
    for(int i = 0; i < n; i++){
        if(p[i] <= a){
            first++;
        }else if(p[i] <= b){
            second++;
        }else{
            third++;
        }
    }
    
    cout << min(min(first, second), third) << endl;
    
    return 0;
}


Measured memory_bytes: 888
#include<cstdio>
#include<iostream>
#define nc getchar
using namespace std;
inline void read(int &x) {
	char b = nc(); x = 0;
	for (; !isdigit(b); b = nc());
	for (; isdigit(b); b = nc()) x = x * 10 + b - '0';
}
int n, T, a[100005], mn, d, ans;
int main() {
	read(n); read(T);
	for (int i = 1; i <= n; ++i) read(a[i]);
	mn = a[1];
	for (int i = 2; i <= n; ++i) {
		mn = min(mn, a[i]);
		int t = a[i] - mn;
		if (t > d) d = t, ans = 1;
		else if (t == d) ++ans;
	} printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 640
import itertools
n,m = map(int,input().split())
s = [list(map(int, input().split())) for _ in range(m)]
p = list(map(int, input().split()))
ans = 0

for bit in range(1 << n):
    ptn = bin(bit)[2:].rjust(n,'0')
    light = True
    for j in range(m):
        tmp = 0
        for k in range(1, s[j][0] + 1):
            if ptn[s[j][k] - 1] == '1':
                tmp += 1
        if tmp % 2 != p[j]:
            light = False
    if light:
        ans += 1

print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int mp[105][105];
int main(){
	int n,k;
	cin>>n>>k;
	int mx=(n-1)*(n-2)/2;
	if(mx<k){
		puts("-1");
		return 0;
	}
	int cnt=0;
	memset(mp,0,sizeof(mp));
	for(int i=2;i<=n;i++)
		mp[1][i]=mp[i][1]=1;
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			if(!mp[i][j]&&mx>k)
				mp[i][j]=mp[j][i]=1,--mx;
		}
	}
	for(int i=1;i<=n;i++)
		for(int j=i+1;j<=n;j++)
			cnt+=mp[i][j];
	printf("%d\n",cnt);
	for(int i=1;i<=n;i++)
		for(int j=i+1;j<=n;j++)
			if(mp[i][j])
				printf("%d %d\n",i,j);
} 

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

typedef long long ll;
const ll mod = 1e9+7;

ll Pow(ll a, ll b)
{
    ll res=1ll;
    a = a%mod;
    while (b)
    {
        if (b & 1)
            res = (1ll*res * a) % (1ll*mod);
        a = (1ll*a * a) % (1ll*mod);
        b >>= 1ll;
    }
    return 1ll*res%mod;
}

ll mod_inv(ll k){
    //fermat's little theorem to calculate a^-1
    return (Pow(k, mod-2))%mod;
}

ll nCr_mod (ll n, ll r) {
    // if (r*2>n)  r=n-r;
	
	if(r==0) return 1;
    if(n-r < r) r = n-r; //nCr = nC(n-r)
    ll p=1, k=1; //nCr= p/k
    while(r) {
        p = (p*n)%(mod);
        k = (k*r)%(mod);
        n--;
        r--;
    }

    return (p*mod_inv(k))%(1ll*mod);
}

int main() {
	ll n, a, b;
    cin >> n >> a >> b;
    // nC0 + nc1 + ... + nCn = 2^n
    // 2^n - nCa - nCb - nC0 = 2^n - nCa - nCb - 1;
    ll value = 1ll;
    ll div_count = n/30; //2^29 < (10^9 + 7) < 2^30
    ll div_value = Pow(2ll, 30ll)%mod;
    for(ll i=1; i<=div_count; i++) {
        value = (value*div_value)%mod;
    }
    ll div_count_remainder = n%30;
    value = (value*Pow(2ll, div_count_remainder))%mod;
    value = ((value - nCr_mod(n,a) - nCr_mod(n,b) - 1)%mod + mod)%mod;
    cout << value << endl;
    return 0;
}

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

def prime(n): # nまでの素数を列挙
    import math
    num_list = [i + 1 for i in range(2,n,2)]
    list_prime = [2]
    limit = math.sqrt(n)
    if n == 2:
        return list_prime
    else:
        while True:
            p = num_list[0]
            if p >= limit:
                return list_prime + num_list
            list_prime.append(p)
            num_list = [num for num in num_list if num % p != 0]

prime_list = prime(55555)
ans_list = [p for p in prime_list if p % 5 == 4]
ans = ans_list[:n]
for i in range(n):
    ans[i] = str(ans[i])
print(" ".join(ans))


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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplece_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second

//int dxy[5] = {0, 1, 0, -1, 0};
// assign avl ncm dijkstra geo2 kruskal graph uf lca BIT
// matrix dinic next_combination topcoder lcm

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

    Int(n);
    vector<string> st(2);
    cin >> st[0] >> st[1];

    int ans, ptr = 0;
    bool bef;
    if (st[0][0] == st[1][0]) {
        ans = 3;
        bef = false;
        ptr = 1;
    } else {
        ans = 6;
        bef = true;
        ptr = 2;
    }
    for (; ptr < n; ptr++) {
        if (st[0][ptr] == st[1][ptr]) {
            if (bef) {
                bef = false;
            } else {
                ans *= 2;
            }
        } else {
            if (bef) {
                ptr++;
                bef = false;
                ans *= 3;
            } else {
                ptr++;
                ans *= 2;
            }
            bef = true;
        }
        ans %= MOD;
    }
    std::cout << ans << std::endl;







    return 0;
}





Measured memory_bytes: 256
<?php
$string_tmp = array();
// 回答保存用
$ans_set = array();
// 入力受付処理
while ($line = fgets(STDIN)) {
   $tmp[] = trim($line);
}
// INIT処理
$max_lenge = 8;
foreach($tmp as $val){
    // データセットをデクリメント
    $max_lenge--;
    // 1があるかどうかを確認
    if(preg_match('/1/',$val)){
        $string_tmp[] = $val;
    }// 一つデータセットを見終わった時の処理
     // 見つかった行数によって図形を判別
    if($max_lenge < 0){
        $ans_set[] = judge($string_tmp);
        // INIT 処理
        $string_tmp = array();
        $max_lenge = 8;
    }
}
$ans_set[] = judge($string_tmp);
foreach($ans_set as $val){
    echo $val."\n";
}
function judge($string_tmp){
    $ans;
    $tmp_length = count($string_tmp);
        if($tmp_length == 4){
            $ans = "B";
        }elseif($tmp_length == 1){
            $ans = "C";
        }elseif($tmp_length == 2){
            $ans = judge_line2($string_tmp);
        }elseif($tmp_length == 3){
            $ans = judge_line3($string_tmp);
        }
    return $ans;
}
// ラインが二列だった時の図形判別用
function judge_line2($string_tmp){
    $pos = strpos($string_tmp[0], "1");
    $pos2 = strpos($string_tmp[1], "1");
    if($pos == $pos2){
        return "A";
    }elseif ($pos < $pos2) {
        return "E";
    }else{
        return "G";
    }
}// ラインが三列だった時の図形判別用    
function judge_line3($string_tmp){
    $pos = strpos($string_tmp[0], "1");
    $pos2 = strpos($string_tmp[1], "1");
    if($pos > $pos2){
        return "D";
    }else{
        return "F";
    }
}


Measured memory_bytes: 9424
#include <cstdio>
#include <algorithm>
#include <map>

#define Rep(i, n) for (int i = 1; i <= n; i ++)
#define RepG(i, x) for (int i = head[x]; i; i = edge[i].next)
#define RepG0(i, x) for (int i = head0[x]; i; i = edge0[i].next)
#define mp(a, b) make_pair(a, b)

using namespace std;

const int N = 400010;

struct Edge{int to, next;} edge[N * 42], edge0[N * 42];
int head[N], num, d[N], head0[N], num0;
map<int, bool> m[N], m0[N];
void add_edge(int a, int b) { edge[++ num] = (Edge){b, head[a]}, head[a] = num, m[a][b] = true; }
void add_edge0(int a, int b) { edge0[++ num0] = (Edge){a, head0[b]}, head0[b] = num0, m0[a][b] = true;}

int f[N];
int f_f(int x) { return f[x] == x ? x : f[x] = f_f(f[x]);}

pair<int, int> q[N];

int main()
{
	int n, a, b;
	scanf("%d", &n);
	Rep(i, n - 1) { 
		scanf("%d%d", &a, &b); 
		add_edge(a, b); add_edge(b, a); 
		d[a] ++, d[b] ++;
	}
	Rep(i, n - 1) { 
		scanf("%d%d", &a, &b); 
		add_edge0(a, b); add_edge0(b, a); 
		d[a] ++, d[b] ++;
	}
	int he = 0, ta = 0, cnt = 0;
	Rep(i, n) f[i] = i;
	
	Rep(i, n) RepG(j, i)if (m0[edge[j].to][i])
		q[++ ta] = mp(i, edge[j].to);
	
	while (he != ta) {
		int fx = f_f(q[++ he].first), fy = f_f(q[he].second);
		if (fx == fy) continue;
		cnt ++;
		if (d[fx] < d[fy]) swap(fx, fy);
		RepG0(i, fy){
			int fv = f_f(edge0[i].to);
			if (fv == fx || fv == fy) continue;
			if (m[fx][fv]) q[++ ta] = mp(fx, fv);
			add_edge0(fx, fv); add_edge0(fv, fx);
		}
		RepG(i, fy){
			int fv = f_f(edge[i].to);
			if (fv == fx || fv == fy) continue;
			if (m0[fx][fv]) q[++ ta] = mp(fx, fv);
			add_edge(fx, fv); add_edge(fv, fx);
		}
		f[fy] = fx;
	}
	
	if (cnt == n - 1) printf("YES\n");
	else printf("NO\n");
	
	return 0;
}

/*
5
2 1
3 1
4 3
5 4
2 1
3 2
4 3
5 1

*/

Measured memory_bytes: 105728
n = int(input())
t = input()
op = [[int(c == 'R') for c in t]]
ans = [0]

for d in range(n):
    k = 3 ** d
    nop = []
    nans = []
    for g in range(3):  # d桁目の数
        for i in range(k):  # d桁目未満の数
            opg = op[i]
            opn = []
            h = g
            for o in opg:
                if o == 0:
                    if len(opn) > 0 and opn[-1] == 0:
                        opn.pop()
                    else:
                        opn.append(0)
                    if h == 1:
                        h = 2
                    elif h == 2:
                        h = 1
                else:
                    if h == 2:
                        h = 0
                        opn.append(1)
                    else:
                        h += 1
            nop.append(opn)
            nans.append(h * k + ans[i])

    op = nop
    ans = nans

print(*ans)


Measured memory_bytes: 207604
import java.util.*;
import java.lang.*;
import java.io.*;


public class Main {
    public static long gcd(long a, long b){
        if(a<b) return gcd(b,a);
        if(b==0) return a;
        if(a%b==0) return b;
        return gcd(b,a%b);
    }
    public static long lcm(long a, long b){
        return (a/gcd(a,b))*b;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		
		String S = sc.next();
		String T = sc.next();
		long L = lcm(M,N);
		
		boolean ok = true;
		for(int n=0;n<N;n++){
			long l = L/N * n;
			if(l%(L/M)!=0) continue;
			int m = (int) (l/(L/M));
			//System.out.println(l+" "+S.charAt(n)+" "+T.charAt(m));
			if(S.charAt(n)!=T.charAt(m)) ok = false;
		}
		System.out.println(ok ? L : -1);
		
    }
}


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

int main() {
    int x[3];
    rep(i, 3) {
        cin >> x[i];
    }
    sort(x, x+3);

    cout << 10*x[2] + x[1] + x[0];
    
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
 
namespace aizu
{
    class OnlineJudge
    {
        static void Main()
        {
            string input;
            Stack<double> num;
            Dictionary<string, Func<double,double,double>> operate = new Dictionary<string, Func<double, double, double>> {
                {"+", (v1, v2) => v2 + v1}, {"-", (v1, v2) => v2 - v1}, {"*", (v1, v2) => v2 * v1}, {"/", (v1, v2) => v2 / v1},
            };
            while((input = Console.ReadLine()) != null) {
                num = new Stack<double>();
                foreach(var val in input.Split()) {
                    if(!"+-*/".Contains(val)) {
                        num.Push(double.Parse(val));
                    }
                    else {
                        num.Push(operate[val](num.Pop(), num.Pop()));
                    }
                }
                Console.WriteLine("{0:F6}", num.Peek());
            }
        }
    }
}

Measured memory_bytes: 6660
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<int> a(n), b(n), c(n);
	rep(i,n) cin >> a[i];
	rep(i,n) cin >> b[i];
	rep(i,n) cin >> c[i];
	sort(a.begin(), a.end());
	sort(c.begin(), c.end());
	ll ans = 0;
	rep(i,n){
		ll lw = n - (lower_bound(c.begin(), c.end(), b[i]+1) - c.begin());
		ll up = lower_bound(a.begin(), a.end(), b[i]) - a.begin();
		//if(lw != 0) --lw;
		//cout << up << " " << lw << endl;
		ans += up * lw;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4520
#include <iostream>
using namespace std;
int main() {
  int n, k, x, y;
  cin >> n >> k >> x >> y;
  int ans = 0;
  for(int i = 1; i <= n; i++) {
    if(i <= k) ans += x;
    else ans += y;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
using System;

class Program
{
    static void Main(string[] args)
    {
        var sc = Console.ReadLine().Split();
        var s = long.Parse(sc[0]);
        var c = long.Parse(sc[1]);

        var x = Math.Min(s, c / 2);
        var y = (c - 2 * x) / 4;
        Console.WriteLine(x + y);
    }
}


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

using namespace std;

typedef long long ll;

const int N = 1e6 + 500;
const int M = 2e3 + 50;
const int MOD = 1e9 + 7;

int a, b, n, dp[2 * M][2 * M], uz[2 * M][2 * M], ch[4 * M][2 * M], sol;

void precompute(){
    for(int i = 0;i<4 * M;i++)
        ch[i][0] = 1;
    for(int i = 0;i<2 * M;i++)
        ch[i][i] = 1;
    for(int i = 1;i<4 * M;i++)
        for(int j = 1;j<min(2 * M, i);j++)
            ch[i][j] = (ch[i - 1][j] + ch[i - 1][j - 1]) % MOD;
}

void solve(){
    for(int i = 1;i<2 * M;i++){
        for(int j = 1;j<2*M;j++){
            dp[i][j] = (dp[i][j] + dp[i - 1][j] + dp[i][j - 1]) % MOD;
            sol = (sol + (ll)uz[i][j] * dp[i][j] % MOD) % MOD;
        }
    }
}

int main(){
    precompute();
    scanf("%d", &n);
    for(int i = 0;i<n;i++){
        scanf("%d%d", &a, &b);
        sol = (sol - ch[2 * a + 2 * b][2 * a] + MOD) % MOD;
        dp[M - a][M - b]++;
        uz[M + a][M + b]++;
    }
    solve();
    printf("%d\n", (ll)sol * 500000004 % MOD);
}


Measured memory_bytes: 230528
n = int(input())
a = list(map(int,input().split()))
count = 0
for i in range(n):
    if a[i] % 2 == 0 and a[i] % 3 != 0 and a[i] % 5 != 0:
        count+=1
if count == 0:
    print("APPROVED")
else:
    print("DENIED")

Measured memory_bytes: 3060
#include "bits/stdc++.h"
using namespace std;
const int N = 2e5 + 5;
const int mod = 1e9 + 7;
int n;
pair < int , int > arr[N];
pair < int , int > tmp[N];
int lft[N];
int rgt[N];
int dp[N];
int ptr;
int main(){
    scanf("%d" , &n);
    for(int i = 1 ; i <= n ; ++i){
        scanf("%d %d" , &arr[i].second , &arr[i].first);
    }
    sort(arr + 1 , arr + 1 + n);
    for(int i = 1 ; i <= n ; ++i){
        tmp[i] = make_pair(arr[i].second , i);
    }
    sort(tmp + 1 , tmp + 1 + n);
    int mx = tmp[1].second;
    for(int i = 1 ; i <= n ; ++i){
        mx = max(mx , tmp[i].second);
        rgt[i] = mx;
    }
    int mn = tmp[n].second;
    for(int i = n ; i >= 1 ; --i){
        mn = min(mn , tmp[i].second);
        lft[i] = mn;
    }
    ptr = 1;
    long long ans = 0;
    long long sum = 0;
    for(int i = 1 ; i <= n ; ++i){
        while(rgt[ptr] + 1 < lft[i]){
            sum -= dp[ptr];
            ++ptr;
        }
        sum %= mod;
        sum += mod;
        sum %= mod;
        dp[i] = (sum + (lft[i] == 1)) % mod;
        ans += dp[i] * (rgt[i] == n);
        sum = (sum + dp[i]) % mod;
    }
    printf("%lld\n" , ans % mod);
}

Measured memory_bytes: 5760
#include<bits/stdc++.h>
 
using namespace std;
 
inline long long read(){
	char ch=getchar();long long x=0,f=1;
    while(ch<'0' || ch>'9') {
       if(ch=='-') f=-1;
	  	  ch=getchar();
	}
    while(ch<='9' && ch>='0') {
	   x=x*10+ch-'0';
	   ch=getchar();
	}
    return x*f;
}
 
long long x[100010],l[100010],r[100010],lv[100010],lvx[100010],rv[100010],rvx[100010]; 
 
int main(){
	int n=read();long long c=read();
	long long ans=0;
	for(int i=1;i<=n;i++){
		x[i]=read();
		r[i]=read();
		r[i]+=r[i-1];
		rv[i]=max(rv[i-1],r[i]-x[i]);
		rvx[i]=max(rvx[i-1],r[i]-2*x[i]);
	}
	for(int i=n;i>=1;i--){
		l[i]=r[n]-r[i-1];
		lv[i]=max(lv[i+1],l[i]-c+x[i]);
		lvx[i]=max(lvx[i+1],l[i]-2*c+2*x[i]);
	}
	for(int i=0;i<=n;i++){
		ans=max(ans,rvx[i]+lv[i+1]);
		ans=max(ans,rv[i]+lvx[i+1]);
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 5760
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <map>
#include <vector>
using namespace std;
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define COUT(a) cout << a;
#define ENDL cout << "\n";
int main() {
    int n,m,a,b,sum=0,all=0;
    scanf("%d\n",&n);
    int t[n];
    REP(i,n) {
        scanf("%d",&t[i]);
        all+=t[i];
    }
    scanf("%d\n",&m);
    vector<pair<int,int> > drink(m);
    REP(i,m) {
        scanf("%d %d\n",&a,&b);
        drink[i] = make_pair(a,b);
    }
    REP(i,m){
        COUT(drink[i].second - t[drink[i].first-1] + all)
        ENDL
    }
}

Measured memory_bytes: 256
import java.util.*;
import java.util.ArrayList;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      ArrayList<Integer> list = new ArrayList<Integer>();
      int a =sc.nextInt();
      int b = sc.nextInt();
      int c = sc.nextInt();
      int number = 3;
      if(a == b){
      	number--;
      }
      if(a == c){
      	number --;
      }
      if(b == c){
      	number --;
      }
      if(number ==0){
      	number=1;
      }
      System.out.println(number);
    }
}


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

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

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define FORR(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)

#define DEBUG(x) cout << #x << ": " << (x) << endl
#define DEBUG_VEC(v)                               \
  cerr << #v << ": ";                              \
  REP(__i, (v).size()) cerr << ((v)[__i]) << ", "; \
  cerr << endl
#define PRINT(x) cout << x << endl
#define all(x) x.begin(), x.end()

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

  double pi = 3.14159;

  cout << setprecision(7) << 2 * pi * R << endl;
}


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

using namespace std;
using ll=long long;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, a, n) for(int i = (a); i < (n); i++)

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  int n,d;cin>>n>>d;
  vector<vector<int>> vec(n,vector<int>(d));
  rep(i,n)rep(j,d)cin>>vec[i][j];
  int ans=0;
  rep(i,n){
    rep2(j,i+1,n){
	    int norm=0;
	    rep(k,d){
	      int diff=abs(vec[i][k]-vec[j][k]);
	      norm+=diff*diff;
	    }
	    bool flag=false;
	    rep(k,norm+1){
	      if(k*k==norm)flag=true;
	    }
	    if(flag)++ans;
	  }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define F first
#define S second

using namespace std;
using P = pair<int,int>;
using ivec = vector<int>;
using Graph = vector<vector<P>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }


const int MOD=1000000007;
int INF=100100100100100;

int a[100010],b[100010],c[100010];
signed main(){
  int n,k;cin>>n>>k;
  if(2*k-n>1){
    cout<<-1<<endl;
    return 0;
  }
  
  int m=(n+1)/2;
  if(n%2==0){
    rep(i,m)a[i]=m+i,b[i]=4*m+i,c[i]=5*m+2*i;
    rep(i,m)a[m+i]=2*m+i,b[m+i]=3*m+i,c[m+i]=5*m+2*i+1;
  }
  else{
    rep(i,m)a[i]=m+i,b[i]=4*m-2+i,c[i]=5*m-2+2*i;
    rep(i,m-1)a[m+i]=2*m+i,b[m+i]=3*m-1+i,c[m+i]=5*m-1+2*i;
  }
  rep(i,n)cout<<a[i]-m+k<<" "<<b[i]-m+k<<" "<<c[i]-m+k<<endl;
  return 0;
}


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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n,k = LI()
h = [0] + LI()

dp = [[inf]*(n-k+1) for _ in range(n+1)]
dp[0][0] = 0
for i in range(1,n+1):
    for j in range(1,n-k+1):
        for l in range(i):
            dp[i][j] = min(dp[i][j],dp[l][j-1] + max(0,h[i]-h[l]))

ans = inf
for i in range(n+1):
    ans = min(ans,dp[i][n-k])
print(ans)

Measured memory_bytes: 47068
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main() {
	vector<pair<int, int>>tasks;
	int n;
	cin >> n;
	int a, b;
	for (int i = 0; i < n; i++) {
		cin >> a >> b;
		tasks.emplace_back(b, a);
	}
	sort(tasks.begin(), tasks.end());
	int sum = 0;
	int flag = 0;
	for (int i= 0; i < n; i++) {
		sum += tasks[i].second;
		if (tasks[i].first < sum) {
			flag = 1;
			break;
		}
	}
	if (flag == 0) {
		printf("Yes");
	}
	else {
		printf("No");
	}
}


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

using namespace std;

#define OnlineJudge1

#define loop(x,a,n) for(int x = a;x < n;x++)
#define NumofDigits(n) ((int)log10(n)+1)
#define CountofNumber(array,n,x)  (upper_bound(array, array+n, x)-lower_bound(array, array+n, x))
#define readline(s) getline(cin,s)
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define EPS 1e-7
#define modulo ll (1e9 + 7)
const long double PI = 3.141592653589793238L;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<int,ll> pill;
typedef pair<ll,ll> pll;

#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)

#define time__(d) \
    for ( \
        auto blockTime = make_pair(chrono::high_resolution_clock::now(), true); \
        blockTime.second; \
        debug("%s: %lld ms\n", d, chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - blockTime.first).count()), blockTime.second = false \
    )

void init(){
    cin.tie(0);
    ios::sync_with_stdio(0);
#ifdef OnlineJudge
    freopen("in.txt","r",stdin);
    freopen("out.txt","w",stdout);
#endif
}

int main(){
    init();
    int n;  cin >> n;
    int arr[n];
    multiset<int> s;
    for(int i = 0;i < n;i++){
        cin >> arr[i];
        s.insert(arr[i]);
    }

    for(int i = 0;i < n;i++){
        auto it = s.find(arr[i]);
        s.erase(it);
        cout << *(s.rbegin());
        s.insert(arr[i]);

        if(i != n - 1)
            cout << '\n';
    }
}

Measured memory_bytes: 11776
#include <bits/stdc++.h>
#define int long long int
#define ii pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
using namespace std;
#define output(x) for (auto a:x) cout<<a<<" ";cout<<endl;
#define output2(x) for (auto a:x) cout<<a.fi<<" "<<a.se<<endl;
#define PI 3.14159265
#define all(x) x.begin(),x.end()

// DEBUG TEMPLATE
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
  *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
  
// DEBUG TEMPLATE ENDS

#define MOD 1000000007
int power(int x,int y,int mod = MOD) 
{ 
  int ret = 1;
  x = x % mod;
  while (y){
    if(y&1) ret = (ret*x)%mod;
    y = y>>1;
    x = (x*x)%mod;
    } 
    return ret%mod; 
}

int num(int l,int r,int d){
  if (l>r) return 0;
  return ((r-l)/d + 1);
}

int sum(vector<int> x){
  int ret = 0;
  for (auto y:x) ret = (ret+y)%MOD;
  return ret%MOD;
}

vector<int> spf(1e7+5,0);

int func(int x){
  int ret = 1;
  if (x == 1) return 1;
  if (spf[x] == x) return 2;

  while (x != 1){
    int cur = spf[x];
    int occ = 1;
    while (x%cur == 0){
      x/=cur;
      occ++;
    }
    ret*=occ;
  }
  return ret;
}

void solve()
{ 
  for (int i=2;i<1e7+1;i++){
    if (spf[i]!=0) continue;
    spf[i] = i;
    for (int j=i*i;j<1e7+1;j+=i)
      spf[j] = i;
  }
  int n;
  cin>>n;
  int ans = 0;
  for (int i=1;i<=n;i++){
    ans = (ans + i*func(i));
  }
  cout<<ans<<endl;
}


/*
  
*/
signed main(){
  int t = 1;
  // cin>>t;
  while (t--)
  solve();
}
// Check MOD values plox :(


Measured memory_bytes: 81220
import math


def read():
    A, B, N = map(int, input().split())
    return A, B, N


def solve(A, B, N):
    if N >= B-1: 
        x = max(B - 1, 0)
    else:
        x = N
    y = math.floor(A * x / B) - A * math.floor(x / B)
    return y

if __name__ == '__main__':
    inputs = read()
    print("{}".format(solve(*inputs)))


Measured memory_bytes: 9188
#include <stdio.h>

int main(void) {
	int N;
	scanf("%d", &N);
	int A[N];
	int B[N];
	int C[N];
	int i;
	for(i = 0; i < N; i++) {
		scanf("%d", &A[i]);
	}
	for(i = 0; i < N; i++) {
		scanf("%d", &B[i]);
	}
	for(i = 0; i < N; i++) {
		scanf("%d", &C[i]);
	}
	int sum = 0;
	for (i = 0; i < N; i++) {
		sum += B[A[i] - 1];
		if (i - 1 >= 0 && A[i] - A[i - 1] == 1) {
			sum += C[A[i - 1] - 1];
		}
	}
	printf("%d", sum);
	return 0;

}

Measured memory_bytes: 128
import sys
import math
import collections
import bisect
import itertools

# import numpy as np

sys.setrecursionlimit(10 ** 7)
INF = 10 ** 20
# MOD = 10 ** 9 + 7
MOD = 998244353

ni = lambda: int(sys.stdin.readline().rstrip())
ns = lambda: map(int, sys.stdin.readline().rstrip().split())
na = lambda: list(map(int, sys.stdin.readline().rstrip().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().rstrip().split()))


# ===CODE===

def main():
    h, w, m = ns()

    hm = [0 for _ in range(h)]
    wm = [0 for _ in range(w)]

    m_pos = {}

    for _ in range(m):
        hi, wi = ns()
        hi, wi = hi - 1, wi - 1
        hm[hi] += 1
        wm[wi] += 1

        if hi in m_pos.keys():
            m_pos[hi].add(wi)
        else:
            m_pos[hi] = {wi}

    h_max = []
    w_max = []

    tmax = -1
    for i, hi in enumerate(hm):
        if hi > tmax:
            tmax = hi
            h_max = [i]
        elif hi == tmax:
            h_max.append(i)

    tmax = -1
    for i, wi in enumerate(wm):
        if wi > tmax:
            tmax = wi
            w_max = [i]
        elif wi == tmax:
            w_max.append(i)

    ans = 0
    breakflg = False

    for hi in h_max:
        for wi in w_max:
            if wi in m_pos[hi]:
                ans = max(ans, hm[hi] + wm[wi] - 1)
            else:
                ans = max(ans, hm[hi] + wm[wi])
                breakflg = True
                break
        if breakflg:
            break

    print(ans)


if __name__ == '__main__':
    main()


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

int main() {
    string s;
    cin >> s;
    string ans;
    for (char c : s) {
        if (c != 'B') ans += c;
        else if (!ans.empty()) ans.pop_back();
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#encoding=utf-8

while True:
	x, num = map(int,raw_input().split())
	if x == num == 0:
		break
	count = 0
	for a in xrange(10):
		if num == a and x == 1:
			count += 1
		if x > 1:
			for b in xrange(a + 1,10):
				if num == a+b and x == 2:
					count += 1
				if x > 2:
					for c in xrange(b + 1,10):
						if num == a+b+c and x == 3:
							count += 1
						if x > 3:
							for d in xrange(c + 1,10):
								if num == a+b+c+d and x == 4:
									count += 1
								if x > 4:
									for e in xrange(d + 1,10):
										if num == a+b+c+d+e and x == 5:
											count += 1
										if x > 5:
											for f in xrange(e + 1,10):
												if num == a+b+c+d+e+f and x == 6:
													count += 1
												if x > 6:
													for g in xrange(f + 1,10):
														if num == a+b+c+d+e+f+g and x == 7:
															count += 1
														if x > 7:
															for h in xrange(g + 1,10):
																if num == a+b+c+d+e+f+g+h and x == 8:
																	count += 1
																if x > 8:
																	for i in xrange(h + 1,10):
																		if num == a+b+c+d+e+f+g+h+i and x == 9:
																			count += 1
																			
	print count

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

using namespace std;

int main()
{
    int n;
    cin>>n;
    vector<int>sides(n);
    for( auto &i: sides){
        cin>>i;
    }
    int ctr=0;
    for(int i=0;i<n;++i){
        for(int j=i+1;j<n;++j){
            for(int k=j+1;k<n;++k){
                if((sides[i]-sides[j])!=0&&(sides[j]-sides[k])!=0&&(sides[k]-sides[i])!=0){
                    if(sides[i]+sides[j]>sides[k] && sides[i]+sides[k]>sides[j] && sides[j]+sides[k]>sides[i]){
                        ctr++;
                    }
                }
            }
        }
    }
    cout<<ctr<<endl;
    return 0;
}


Measured memory_bytes: 3580
import collections as col

N = int(input())
v = [int(x) for x in input().split()]
v1,v2 = sorted(v[::2]), sorted(v[1::2])

c1,n1 = col.Counter(v1).most_common()[0]
c2,n2 = col.Counter(v2).most_common()[0]

if c1 != c2:
    print(N - n1 - n2)
else:
    if n1 + n2 == N:
        print(int(N/2))
    else:
        c12,n12 = col.Counter(v1).most_common()[1]
        c22,n22 = col.Counter(v2).most_common()[1]
        if n1 + n22 > n12 + n2:
            print(N - n1 - n22)
        else:
            print(N - n12 - n2)
        

Measured memory_bytes: 17628
#include <stdio.h>

int main() {
	int a, b, c, d, p, res, x, y;
	scanf("%d %d %d %d %d", &a, &b, &c, &d, &p);
	x = a * p;
	y = b;
	if( c < p ) y += (p - c) * d;
	if( x > y ) {
		res = y;
	} else {
		res = x;
	}
	printf("%d\n",res);
	return 0;
}

Measured memory_bytes: 596
#include <algorithm>
#include <iostream>
#include <cstring>
using namespace std;
long h[200001];
int main(){
  int n, k;
  long long sum = 0;
  memset(h, 0, sizeof(h));
  cin >> n >> k;
  for(int i = 0; i < n; i++)
    cin >> h[i];
  sort(h, h + n);
  if (k >= n)
    cout << 0 << endl;
  else{
    for(int i = 0 ; i < n - k; i++)
    	sum += h[i];
      
    cout << sum << endl;
  }
  return 0;
}
    
  

Measured memory_bytes: 1792
#include <iostream>
#include <string>

using namespace std;

int main(void) {
	string s;
	cin >> s;
	if (s[0] == s[1] || s[1] == s[2] || s[2] == s[3])
		printf("Bad\n");
	else
		printf("Good\n");
	return 0;
}

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

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0
#define speed() cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(false)
// #define exit(a, b) return cout << a, b;

#define PB push_back
#define MP make_pair

#define sd(n) scanf("%lld", &n)
#define pdn(n) printf("%lld\n", n);
#define pds(n) printf("%lld ", n);
#define endl '\n'

#define forn(a, b, i) for (int i = a; i < b; i += 1)
#define all(v) v.begin(), v.end() 

#define print(stuff) cout << stuff << endl
#define len(stuff) (int) stuff.size()

#define int long long
#define float long double 
#define ll long long
#define ld long double

using vi = vector<int>;
using vb = vector<bool>;
using pii = pair<int, int>;
using mii = map<int, int>;

const int inf = (int) 1e16;
const int upper = (int) 3e5 + 50;
// const int M = (ll) 1e9 + 7;
const int mod = (ll) 998244353;
const double eps =  1e-8;

int diff (string &a, string &b) {
	int ans = 0;
	for (int i = 0; i < len(a); i++) {ans += (a[i] != b[i]);} return ans;
}

signed main () {
	start_routine();
	speed();
	#ifndef ONLINE_JUDGE
	// freopen("input.txt", "r", stdin);	 
	// freopen("output.txt", "w", stdout);
	// freopen("errlog.txt", "w", stderr);
	#endif	

	string a; cin >> a;
	int n = len(a);
	string b(n, '0'), c(n, '0');
	for (int i = 0; i < len(a); i += 1) {
		b[i] = char(i % 2 + '0');
		c[i] = char((i + 1) % 2 + '0');
	}
	cout << min(diff(a, b), diff(a, c));
 	end_routine();		
}


Measured memory_bytes: 592
import sys
 
cnt = {}
 
for line in sys.stdin:
  for l in line:
    if l.isalpha():
      c = l.lower()
      cnt[c] = cnt.get(c,0)+1
 
for i in range(26):
  c = chr(ord('a')+i)
  print( c, " : ", cnt.get(c,0), sep = '' )


Measured memory_bytes: 5576
import java.util.*;
import java.util.Scanner;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int ans = 0;
        for(int i=a; i<=b; i++) {
            if(c%i == 0) ans++;
        }
        
        System.out.println(ans);

    }
}



Measured memory_bytes: 26296
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

#ifdef LOCAL
#define show(x) cerr << "LINE" << __LINE__ << " : " << #x << " = " << (x) << endl
#else
#define show(x) true
#endif

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);		//DON'T USE scanf/printf/puts !!
	cout << fixed << setprecision(20);
	
	int N;
	cin >> N;
	V<ll> s(N);
	rep(i,N) cin >> s[i];
	ll ans = 0;
	rep1(d,N-1){
		int l = 0, r = N-1;
		ll sco = s[0] + s[N-1];
		while(true){
			if(l+d == r) break;
			if(l+d == r-d) break;
			if(r-d < d) break;
			l += d, r -= d;
			sco += s[l]+s[r];
			chmax(ans,sco);
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <memory>
#include <queue>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(long long int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;

class Tree{
public:
    Tree(long long int tree_size):nodes(tree_size,-1),parent(tree_size){

    }
    void add_edge(long long int a,long long int b){
        parent[a].push_back(b);
        parent[b].push_back(a);
    }

    void habatan(vector<long long int> v){
        queue<long long int> q;
        long long int loop=0;
        q.push(0);
        
        while(!q.empty()){
            nodes[q.front()] = v[loop];
            
            loop++;
            for(auto x:parent[q.front()]){
                if(nodes[x]==-1){
                    q.push(x);
                }
            }
            q.pop();
        }
    }
    void print(){
        REP(i,nodes.size()-1){
            cout << nodes[i] << " ";
        }
        cout << nodes[nodes.size() - 1] << endl;
    }
private:
    vector<long long int> nodes;
    vector<vector<long long int>> parent;
};

int main(){

    long long int n;
    cin >> n;
    long long int tmpa, tmpb;
    Tree tree(n);
    REP(i,n-1){
        cin >> tmpa >> tmpb;
        tree.add_edge(tmpa-1, tmpb-1);
    }
    vector<long long int> cv(n);
    REP(i,n){
        cin >> cv[i];
    }
    sort(cv.begin(), cv.end(), greater<long long int>());
    long long int sum = 0;
    FOR(i,1,n){
        sum += cv[i];
    }
    cout << sum << endl;
    tree.habatan(cv);
    tree.print();

    return 0;
}


Measured memory_bytes: 1400
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <iomanip>
#include <cmath>
#include <map>
#include <set>
#include <ctype.h>
#include <numeric>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
const ll MOD = 1e9 + 7;
const int INF = 1e9;

int dx4[4] = { 0, -1, 1, 0 };
int dy4[4] = { -1, 0, 0, 1 };
int dx8[8] = { 0, -1, 1, 0, -1, 1, -1, 1 };
int dy8[8] = { -1, 0, 0, 1, -1, -1, 1, 1 };

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> x(n);
  int ans = INF;

  for (int i = 0; i < n; ++i) cin >> x[i];
  for (int i = 0; i + k - 1 < n; ++i) ans = min(ans, min(abs(x[i]), abs(x[i + k - 1])) + abs(x[i + k - 1] - x[i]));
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <cmath>
#include <cstring>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <algorithm>
#include <numeric>

typedef long long ll;
const ll INF = 1e18;

int main(int argc, char* argv[])
{
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);

  ll N;
  std::cin >> N;
  std::vector< ll > va(N, 0);
  for (ll i = 0; i < N; i++) {
    std::cin >> va[i];
  }

  std::vector< ll > vsum(N, 0);
  vsum[0] = va[0];
  for (ll i = 1; i < N; i++) {
    vsum[i] += vsum[i-1] + va[i];
  }

  ll ans = 0;
  ll right = -1;
  ll sum = 0;
  for (ll left = 0; left < N; left++) {
    if (right < left) {
      right = left;
    }
    while (right < N && (sum ^ va[right]) == sum + va[right]) {
      sum += va[right];
      right++;
    }
    ans += right - left;
    sum -= va[left];
  }

  std::cout << ans << std::endl;

  return 0;
}


Measured memory_bytes: 3456