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

typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector <ll> vi;
typedef vector <pi> vpi;
#define f first
#define s second
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0)
#define maxn 200001

vi adj[maxn];
int A[maxn];
int N;
vi vect;
int ans[maxn];

void dfs(int x,int p){
	ans[x] = vect.size();
	//cout<<x<<' ';
	aFOR(i,adj[x]){
		if (i != p){
			
			int idx = -1, val = -1;
			
			if (vect.empty()) vect.pb(A[i]);
			else{
				if (A[i] > *(--vect.end())) vect.pb(A[i]);
				else{
					idx = lower_bound(all(vect),A[i]) - vect.begin();
					val = vect[lower_bound(all(vect),A[i]) - vect.begin()];
					vect[lower_bound(all(vect),A[i]) - vect.begin()] = A[i];
				}
			}
			
			dfs(i,x);
			
			if (idx == -1) vect.pop_back();
			else vect[idx] = val;
				
		}
	}
}
int main(){
	fast;
	
	cin>>N;
	
	FOR(i,1,N) cin>>A[i];
	
	
	FOR(i,1,N - 1){
		int a,b;
		cin>>a>>b;
		adj[a].pb(b);
		adj[b].pb(a);
	}
	
	vect.pb(A[1]);
	
	dfs(1,-1);
	
	FOR(i,1,N) cout<<ans[i]<<'\n';
}



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

int main() {
  int N,M;
  cin>>N>>M;
  vector<int> A(N);
  rep(i,N){
    cin>>A.at(i);
  }
  while(M){
    sort(A.begin(), A.end(),greater<long long>());
    long long i = 1;
    A.at(0)/=2;
    M--;
    while (i<N && A.at(0)<A.at(i) && M>0) {
	  A.at(i)/=2;
	  M--;
      i++;
	}
	if (M==0) break;
  }
  long long sum=0;
  rep(i,N){
    sum+=A.at(i);
  }
  cout<<sum<<endl;
  return 0;
}

Measured memory_bytes: 640
package main

import "fmt"

func xor(x int64) (ans int64) {
	switch x % 4 {
	case 0:
		ans = x
	case 1:
		ans = 1
	case 2:
		ans = 1 ^ x
	case 3:
		ans = 0
	}
	return
}

func main() {
	var a, b int64
	fmt.Scan(&a, &b)

	fmt.Println(xor(a-1) ^ xor(b))
}


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

int N, M, X[109], A[19], B[19], C[19], dp[19][109][109];

int main() {
	cin >> N;
	for (int i = 0; i < N; i++) cin >> X[i];
	cin >> M;
	for (int i = 0; i < M; i++) { cin >> A[i] >> B[i] >> C[i]; B[i]--; C[i]--; }

	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			int L = j, R = i + j; if (R >= N) continue;

			for (int k = 0; k < M; k++) {
				if (L == R) {
					if (X[L] == A[k]) dp[k][L][R] = 1;
				}
				else {
					for (int l = L + 1; l <= R; l++) {
						if (dp[B[k]][L][l - 1] == 1 && dp[C[k]][l][R] == 1) dp[k][L][R] = 1;
					}
				}
			}
		}
	}
	if (dp[0][0][N - 1] == 1) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 3500
n, a, b = map(int, input().split())

sum_ret = 0
for i in range(1, n+1):
  s = str(i)
  sum_i = 0
  for j in range(len(s)):
    sum_i += int(s[j])
  
  if sum_i >= a and sum_i <= b:
    sum_ret += i
  
print(sum_ret)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define DBG_N(hoge) cerr<<" "<<(hoge)<<endl;
#define DBG cerr<<"!"<<endl;
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;
ll n,k;
vi A,B;
bool check(ll mid){
  ll cnt=0;
  for(int i=0;i<n;i++){
    if(B[i]*A[i]>=mid)
    cnt+=max(0LL,(B[i]*A[i]-mid)/B[i]+((B[i]*A[i]-mid)%B[i]!=0));
  }
  //cout<<mid<<" "<<cnt<<endl;
  if(cnt>k)return false;
  else return true;
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n>>k;
  A.resize(n);
  B.resize(n);
  ll sum=0;
  for(int i=0;i<n;i++){
    cin>>A[i];
  }
  for(int i=0;i<n;i++){
    cin>>B[i];
  }
  ll le=-1,ri=1e13;
  sort(ALL(A));
  sort(ALL(B),greater<ll>()); 
  while(ri-le>1){
    ll mid=(ri+le)/2;
    if(check(mid)){
      ri=mid;
    }else{
      le=mid;
    }
  }
  cout<<ri<<endl;
  return 0;
}


Measured memory_bytes: 3456
#include <iostream>
using namespace std;
int main()
{
 int A , B;
 cin>> A >> B;

 if (A>=2 && A<=13 && B==1)
    cout<<"Bob"<< endl;
 else if(A==1 && B>=2 && B<=13)
    cout<<"Alice"<<endl;
 else if (A<=13 && A>=2 && A>B)
    cout<<"Alice"<< endl;
 else if (B<=13 && B>=2 && B>A)
    cout<<"Bob"<< endl;
 else
    cout<<"Draw"<<endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
          string a;
          getline(cin,a);
          for(int i=0;a[i]!='\0';i++)
          {
                    if(islower(a[i]))
                              a[i]=toupper(a[i]) ;
          }
          cout<<a;
          cout<<endl;
return 0;
}




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

template<class T, class E> struct LazySegmentTree {
    using F = function<T(T, T)>;
    using G = function<T(T, E)>;
    using H = function<E(E, E)>;
private : 
    int n, dep;
    const F f;
    const G g;
    const H h;
    T id1;
    E id0;
    vector<T> node;
    vector<E> lazy;

public : 
    LazySegmentTree (const F &f, const G &g, const H &h, const T &id1, const E &id0) :
        f(f), g(g), h(h), id1(id1), id0(id0) { }

    void init (int sz) {
        n = 1; dep = 0;
        while (n < sz) { n <<= 1; dep++; }
        node.resize(2*n, id1);
        lazy.resize(2*n, id0);
    }

    void build (vector<T> v) {
        const int sz = v.size();
        init(sz);
        for (int i = 0; i < sz; i++) node[i+n] = v[i];
        for (int i = n-1; i > 0; i--) node[i] = f(node[i<<1|0], node[i<<1|1]);
    }

    inline T reflect (int k) {
        return (lazy[k] == id0 ? node[k] : g(node[k], lazy[k]));
    }

    inline void eval (int k) {
        if (lazy[k] == id0) return;
        lazy[k<<1|0] = h(lazy[k<<1|0], lazy[k]);
        lazy[k<<1|1] = h(lazy[k<<1|1], lazy[k]);
        node[k] = reflect(k);
        lazy[k] = id0;
    }

    inline void thrust (int k) {
        for (int i = dep; i; i--) eval(k>>i);
    }

    inline void recalc (int k) {
        while (k >>= 1) node[k] = f(reflect(k<<1|0), reflect(k<<1|1));
    }

    void update (int a, int b, T x) {
        thrust(a += n);
        thrust(b += n-1);
        for (int l = a, r = b+1; l < r; l >>= 1, r >>= 1) {
            if (l&1) { lazy[l] = h(lazy[l], x); l++; }
            if (r&1) { --r; lazy[r] = h(lazy[r], x); }
        }
        recalc(a);
        recalc(b);
    }

    T query (int a, int b) {
        thrust(a += n);
        thrust(b += n-1);
        T vl = id1, vr = id1;
        for (int l = a, r = b+1; l < r; l >>= 1, r >>= 1) {
            if (l&1) vl = f(vl, reflect(l++));
            if (r&1) vr = f(reflect(--r), vr);
        }
        return f(vl, vr);
    }

};


int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    constexpr int INF = 1e9;
    
    int n, q;
    cin >> n >> q;
    auto f = [] (int a, int b) { return min(a, b); };
    auto g = [] (int a, int b) { return a + b; };
    auto h = [] (int a, int b) { return a + b; };
    LazySegmentTree<int, int> seg(f, g, h, INF, 0);
    seg.build(vector<int>(n, 0));
    
    while (q--) {
        int op, l, r;
        cin >> op >> l >> r;
        if (op) {
            cout << seg.query(l, ++r) << '\n';
        } else {
            int x;
            cin >> x;
            seg.update(l, ++r, x);
        }
    }
    return 0;
}


Measured memory_bytes: 5208
#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
inline int qp(int a, int b) {
	int res = 1;
	while (b) {
		if (b & 1) res = 1ll * res * a % mod;
		a = 1ll * a * a % mod;
		b >>= 1;
	}
	return res;
}
inline int calc2D(int a, int A, int b, int B) {
	int ans = 0;
	ans = (ans + 1ll * a * qp(b, A / a)) % mod;
	ans = (ans + 1ll * b * qp(a, B / b)) % mod;
	ans = (ans - 1ll * a * b % mod + mod) % mod;
	return ans;
}
int binom[105][105];
int f[105][105];
inline int calc3D(int a, int A, int b, int B, int c, int C) {
	int ans = 0;
	ans = (ans + 1ll * a * qp(calc2D(b, B, c, C), A / a)) % mod;
	ans = (ans + 1ll * b * qp(calc2D(a, A, c, C), B / b)) % mod;
	ans = (ans + 1ll * c * qp(calc2D(a, A, b, B), C / c)) % mod;
	ans = (ans - 1ll * a * b * qp(c, A / a * B / b) % mod + mod) % mod;
	ans = (ans - 1ll * a * c * qp(b, A / a * C / c) % mod + mod) % mod;
	ans = (ans - 1ll * b * c * qp(a, B / b * C / c) % mod + mod) % mod;
	ans = (ans + 1ll * a * b * c) % mod;
	for (int i = A / a; i; i--) {
		for (int j = B / b; j; j--) {
			f[i][j] = 1ll * binom[A / a][i] * binom[B / b][j] % mod * qp(c, (A / a - i) * (B / b - j)) % mod;
			if (i == A / a && j == B / b) continue;
			for (int k = A / a; k >= i; k--) {
				for (int l = B / b; l >= j; l--) {
					if (k != i || l != j) {
						f[i][j] = (f[i][j] - 1ll * binom[k][i] * binom[l][j] % mod * f[k][l] % mod + mod) % mod;
					}
				}
			}
			int cur = 0;
			int x = qp(b, i), y = qp(a, j);
			cur = (cur + qp((x + y - 1) % mod, C / c)) % mod;
			cur = (cur - qp(x, C / c) + mod) % mod;
			cur = (cur - qp(y, C / c) + mod) % mod;
			cur = (cur + 1) % mod;
			cur = 1ll * cur * a * b * c % mod;
			ans = (ans + 1ll * cur * f[i][j]) % mod;
		}
	}
	return ans;
}
int main() {
	int a, b, c, A, B, C;
	scanf("%d%d%d%d%d%d", &a, &b, &c, &A, &B, &C);
	if (A % a || B % b || C % c) {
		puts("0");
		return 0;
	}
	for (int i = binom[0][0] = 1; i <= 100; i++) {
		for (int j = binom[i][0] = 1; j <= i; j++) {
			binom[i][j] = (binom[i - 1][j - 1] + binom[i - 1][j]) % mod;
		}
	}
	printf("%d\n", calc3D(a, A, b, B, c, C));
	return 0;
}

Measured memory_bytes: 384
import heapq as hq
import math

N,M = map(int,input().split())
A = list(map(lambda x: int(x)* -1,input().split()))
hq.heapify(A)

for _ in range(M):
    a = math.ceil(hq.heappop(A) / 2)
    hq.heappush(A,a)

print(sum(A)* -1)

Measured memory_bytes: 14532
from datetime import datetime as dt
N = int(input())
Ns = list(map(int,input().split(" ")))

l1 = len(Ns)
c = 0
for i in Ns:
    if i <= 0:
        c += 1

Ns = list(map(abs,Ns))
if c % 2 == 0:
    diff = 0
else:
    diff = min(Ns)
ans = sum(Ns) -2*diff
print(ans)

Measured memory_bytes: 14664
#include<iostream>
using namespace std;
int main(){
    string A,B,C;
    cin >> A >> B >> C;
    if(A[A.size()-1] == B[0] and B[B.size()-1] == C[0]){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
import numpy as np
# knapsack with N <= 100 and W <= 10**9
n, W = map(int, input().split())
# dp[i][j] = w' means upto i elements j such that you get min weight  w'
# then your solution will be j where w' = W
dp = np.full(fill_value=10**15+1,shape=(n,10**5+1), dtype='int64')
w, v = map(int, input().split())
dp[0,v] = w
dp[0,0] = 0
for i in range(1,n):
    w, v = map(int, input().split())
    dp[i, :v] = dp[i-1, :v]
    dp[i, v:] = np.fmin(dp[i-1, v:], dp[i-1,:-v]+w)
ans = 0
for j in range(100001):
    if dp[n-1][j] <= W:
        ans = max(ans, j)
print(ans)



Measured memory_bytes: 92284
#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define ll long long
//#define int long long
#define pb push_back
#define x first
#define ld long double
#define y second
#define mk(a,b) make_pair(a,b)
#define rr return 0
#define sqr(a) ((a)*(a))
#define all(a) a.begin(),a.end()

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;
template<class value, class cmp = less<value> >
using ordered_set = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class value, class cmp = less_equal<value> >
using ordered_multiset = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class key, class value, class cmp = less<key> >
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;

/// find_by_order()
/// order_of_key()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline int randll(int l = INT_MIN, int r = INT_MAX) {
    return uniform_int_distribution<int>(l, r)(rng);
}
main()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin >> s;
    int n = (int)s.length();
    ll ans = 0;
    for (int i = 0; i < (1 << (n - 1)); i++) {
        ll cur = s[0] - '0';
        for (int j = 1; j < n; j++) {
            if (i & (1 << (j - 1))) {
                ans += cur;
                cur = 0;
            }
            cur *= 10;
            cur += s[j] - '0';
        }
        ans += cur;
    }
    cout << ans << '\n';
}


Measured memory_bytes: 256
import math
import sys
readline = sys.stdin.readline

S = int(readline().strip())

p =10**9 +7

n = S//3

ans = 0

for i in range(1, n+1):
  si = S - 3*i
  ai = math.factorial(si+i-1)
  bi = math.factorial(si)
  ci = math.factorial(i-1)
  ai //= bi
  ai //= ci
  ans += ai
  ans %= p

print(ans)

Measured memory_bytes: 9192
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;
typedef struct {
    int to;
    ll cap;
    int rev;
} edge;

vector<vector<edge> > G;
vector<bool> used;
ll INF = 10000000000000;

//辺の追加
void add_edge(vector<vector<edge> > &G, int from, int to, ll cap) {
    G[from].push_back((edge){to, cap, G[to].size()});
    G[to].push_back((edge){from, 0, G[from].size()-1});
}


//頂点vからの増加パスのフローを返す
//頂点sの時はf=INFとする
//fは現在の頂点に来るまでの増加パス中の最小の容量
ll dfs(vector<vector<edge> > &G, int v, int t, ll f) {
    if (v == t)
        return f;
    used[v] = true;

    for (int i = 0; i < G[v].size(); i++) {
        edge &e = G[v][i];
        if (!used[e.to] && e.cap > 0) {
            //dはvからtへの増加パスのフロー
            ll d = dfs(G, e.to, t, min(f, e.cap));
            
            if (d > 0) {
                e.cap -= d;
                G[e.to][e.rev].cap += d;
                return d;
            }
        }
    }
    return 0;
}

ll max_flow(vector<vector<edge> > &G, int n, int s, int t) {
    ll flow = 0;
    used.resize(n, false);
    for (;;) {
        for (int i = 0; i < n; i++)
            used[i] = false;

        ll f = dfs(G, s, t, INF);
        if (f == 0)
            return flow;
        
        flow += f;
    }
}

int main() {
    int n;   cin >> n;
    int *a = new int[n], *b = new int[n], *c = new int[n], *d = new int[n];
    for (int i = 0; i < n; i++)
        cin >> a[i] >> b[i];

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

    G.resize(2*n+2);
    
    for (int i = 0; i < n; i++) {
        add_edge(G, 0, i+1, 1);
    }
 
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (a[i] < c[j] && b[i] < d[j]) {
                add_edge(G, i+1, j+n+1, 1);
            }
        }
    }

    for (int i = 0; i < n; i++) {
        add_edge(G, i+n+1, 2*n+1, 1);
    }


    cout << max_flow(G, 2*n+2, 0, 2*n+1) << endl;


    return 0;
}

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

namespace abc124A
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = Convert.ToInt16(Console.ReadLine());
            int b = Convert.ToInt16(Console.ReadLine());
            int c = Convert.ToInt16(Console.ReadLine());
            int d = Convert.ToInt16(Console.ReadLine());
            int e = Convert.ToInt16(Console.ReadLine());
            int k = Convert.ToInt16(Console.ReadLine());
            if(e-a>k)
            {
                Console.WriteLine(":(");
            }
            else
            {
                Console.WriteLine("Yay!");
            }
            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 13268
#include<iostream>
using namespace std;
int main(){
    string s;
    int n;
    cin>>n>>s;
    string res;
    res=s[0];
    for(int i=1;i<n;i++){
        if(s[i]!=s[i-1]){
            res+=s[i];
        }
    }
    cout<<res.size()<<endl;
    return 0;
}


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

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;
typedef tuple<ll, ll, ll, ll, ll> t5;

#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)

#include <bits/stdc++.h>
using namespace std;

static const ll INF = 1e15;

static const ll mod = 1e9 + 7;

int main() {
	ll n;
	cin >> n;
	vector<ll> vs(n);
	rep(i, n) cin >> vs[i];

	ll u = 0;
	rep(i, n) {
		u ^= vs[i];
	}
	rep(i, n) {
		cout << (u ^ vs[i]) << " ";
	}
	cout << endl;
	return 0;
}
	

Measured memory_bytes: 4784
a,b,k=map(int,input().split())
if k <= (b-a+1)//2:
  for i in range(a, a+k):
    print(i)
  for i in range(b-k+1,b+1):
    print(i)
else:
  for i in range(a,b+1):
    print(i)

Measured memory_bytes: 3060
unittest
{
	assert( [ "3 2", "2", "1 3", "1", "3" ].parse.expand.solve == 1 );
	assert( [ "3 3", "1", "3", "1", "3", "1", "3" ].parse.expand.solve == 2 );
}



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

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

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto nk = input.front.split.to!( long[] );
	auto ass = new long[][ nk[ 1 ] ];
	foreach( ref as; ass )
	{
		input.popFront;
		input.popFront;
		as = input.front.split.to!( long[] );
		as[] -= 1;
	}
	return tuple( nk[ 0 ], ass );
}

auto solve( long n, long[][] ass )
{
	auto cs = new long[ n ];
	foreach( as; ass )
	{
		foreach( a; as )
		{
			cs[ a ]++;
		}
	}
	
	auto ans = 0L;
	foreach( c; cs )
	{
		ans += ( c == 0 );
	}
	return ans;
}


Measured memory_bytes: 3028
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**13
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n = I()
    t = -1
    for i in range(1, 10**3):
        if i * (i+1) // 2 == n:
            t = i + 1
            break
    if t < 0:
        return 'No'
    a = [[] for _ in range(t)]
    k = 0
    for i in range(t):
        for j in range(i+1, t):
            k += 1
            a[i].append(k)
            a[j].append(k)
    r = ['Yes', str(len(a))]
    for c in a:
        r.append('{} {}'.format(len(c), ' '.join(map(str, c))))

    return '\n'.join(r)


print(main())


Measured memory_bytes: 12612
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n) ;i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
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(int argc, char const *argv[]) {
  ll n,k,ans=0;
  cin >> n >> k;
  vector<ll> h(n);
  rep(i,n) cin >> h[i];
  sort(all(h));
  reverse(all(h));

  if(n<=k) cout << "0" << endl;
  else{
    rep(i,k) h[i]=0;
    rep(i,n){
      ans+=h[i];
    }
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 1792
#define __mode_debug__
/*   ξ
     ll
   ＿ll＿
 ／  ∞  ＼
│*  Ａ  *│
│*  Ｃ  *│
│*  祈  *│
│*  願  *│
│*      *│
 ￣￣￣￣￣    */
//C++14 (GCC 5.4.1)
#include <bits/stdc++.h>
using namespace std;
#ifdef __mode_debug__
    #define DBG
#else
    #define DBG if(false)
#endif

#define LLINF (1LL<<60)
typedef long long ll;
#define mod 1000000007

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define rrepd(i,a,b) for(int i=(a);i>=(b);i--)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)

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

template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); }

//DUMP
//  ostream vector<T> , vector<vector<T>> , set<T> ,queue<T> , priority_queue<T> , pair<T,U> , map<T,U>
template<class T> ostream& operator<<(ostream&os,vector<T>&vec){os<<"{ ";rep(i,vec.size()) os<<((i==0)?"":", ")<<i<<":"<<vec[i];os<<" }";return os;}
template<class T> ostream& operator<<(ostream&os,vector<vector<T>>&vec){os<<"{"<<endl;rep(i,vec.size())os<<"\t   "<<i<<":"<<vec[i]<<((i==vec.size()-1)? "":",")<<endl;os<<"\t }";return os;}
template<class T> ostream& operator<<(ostream&os,set<T>&p){os<<"{ ";repi(itr,p)  os<<((itr==p.begin())?"":", ")<<*itr;os<<" }";return os;}
template<class T> ostream& operator<<(ostream&os,queue<T>&p){queue<T> q(p);os<<"[< "<<(q.empty()?" <]":"");while(!q.empty()){os<<q.front();q.pop();os<< (q.empty() ? " <]" : ", ");}return os;}
template<class T> ostream& operator<<(ostream&os,priority_queue<T>&p){priority_queue<T> q(p);os<<"[< "<<(q.empty()?" <]":"");while(!q.empty()){os<<q.top();q.pop();os<< (q.empty() ? " <]" : ", ");}return os;}
template<class T,class U> ostream& operator<<(ostream&os,pair<T,U>&p){os<<"("<<p.first<<","<<p.second<<")";return os;}
template<class T,class U> ostream& operator<<(ostream&os,map<T,U>&p){os<<"{ ";repi(itr,p)os<<((itr==p.begin())?"":", ")<<itr->first<<":"<<itr->second;os<<" }";return os;}
void dump_f(string &nm){cerr<<endl;}
template<class T,class... Ts> void dump_f(string &nm,T &&x,Ts&&... ts){int l=nm.find_first_of(',');string name(nm,0,l),nx(nm,l+1,-1);cerr<<"  "<<name<<"\t:"<<x<<endl;dump_f(nx,forward<Ts>(ts)...);}
template<class... Ts> void dump_m(int &&ln,string &&nm,Ts&&... ts){cerr<<"[ln:"<<ln<<"]"<<endl;dump_f(nm,forward<Ts>(ts)...);}
#define dump(...) DBG dump_m(__LINE__,#__VA_ARGS__,__VA_ARGS__)

#define lower_bound_idx(V,c) distance(V.begin(),lower_bound(V.begin(),V.end(),c))


//ユークリッドの互除法
ll gcd(ll x, ll y) {
  if (y == 0) return x;
  return gcd(y, x%y);
}
int main() {
    ios::sync_with_stdio(false);//stdoutとcoutの同期解除
    cin.tie(nullptr);//cinとcoutの同期解除
    
    ll A,B;
    cin >>A>>B;
    
    //-----------------------------------
    ll x=gcd(A,B);
    ll ans = A*B/x;
    cout << ans <<endl;
    return (0);
}

Measured memory_bytes: 256
g1 = [1,3,5,7,8,10,12]
g2 = [4,6,9,11]
x,y = map(int, input().split())
if x in g1 and y in g1 or x in g2 and y in g2:
    ans = 'Yes'
else:
    ans ='No'
print(ans)

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

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

    if (abs(a-c) <= d) {
        cout << "Yes" << endl;
        return 0;
    }

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

    cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
import math
def main():
  num = list(map(int,input().split()))
  a = num[0]
  b = num[1]
  h = num[2]
  m = num[3]
  if((30*h+0.5*m)-(6*m)>0):
    deg=(30*h+0.5*m)-(6*m)
  else:
    deg=(6*m)-(30*h+0.5*m)
  ans=(a*a)+(b*b)-2*a*b*math.cos(math.radians(deg))
  print(math.sqrt(ans))
  
main()

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

typedef long long int ll; 

int main(void)
{
	ll n,k,arr[10000];
	cin >> n >> k;

	for(ll i=0;i<n;i++)
		cin >> arr[i];

	sort(arr,arr+n);

	ll sum=0;
	for(ll i=0;i<k;i++)
		sum+=arr[i];

	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 3652
use std::io;
use std::str::FromStr;
use std::cmp::max;

type Cake = (i64, i64, i64);

fn input_tuple() -> (usize, usize) {
  let mut line: String = String::new();
  io::stdin().read_line(&mut line);
  let vec: Vec<usize> = line.split_whitespace().map(|s| s.parse().unwrap()).collect();
  (vec[0], vec[1])
}

fn input_tuple_three() -> (i64, i64, i64) {
  let mut line: String = String::new();
  io::stdin().read_line(&mut line);
  let vec: Vec<i64> = line.split_whitespace().map(|s| s.parse().unwrap()).collect();
  (vec[0], vec[1], vec[2])
}

fn calc(a: i64, b: i64, c: i64, cake: &Cake) -> i64 {
  cake.0 * a + cake.1 * b + cake.2 * c
}

fn main() {
  let (n, m) = input_tuple();
  let mut cakes: Vec<Cake> = Vec::new();
  for _ in 0..n {
    cakes.push(input_tuple_three());
  }
  let mut ans = 0;
  
  let mut tmp = 0;
  cakes.sort_by(|x, y| calc(1, 1, 1, y).cmp(&calc(1, 1, 1, x)));
  for i in 0..m {
    tmp += calc(1, 1, 1, &cakes[i]);
  }
  ans = max(tmp, ans);

  let mut tmp = 0;
  cakes.sort_by(|x, y| calc(-1, 1, 1, y).cmp(&calc(-1, 1, 1, x)));
  for i in 0..m {
    tmp += calc(-1, 1, 1, &cakes[i]);
  }
  ans = max(tmp, ans);

  let mut tmp = 0;
  cakes.sort_by(|x, y| calc(1, -1, 1, y).cmp(&calc(1, -1, 1, x)));
  for i in 0..m {
    tmp += calc(1, -1, 1, &cakes[i]);
  }
  ans = max(tmp, ans);

  let mut tmp = 0;
  cakes.sort_by(|x, y| calc(1, 1, -1, y).cmp(&calc(1, 1, -1, x)));
  for i in 0..m {
    tmp += calc(1, 1, -1, &cakes[i]);
  }
  ans = max(tmp, ans);

  let mut tmp = 0;
  cakes.sort_by(|x, y| calc(-1, -1, 1, y).cmp(&calc(-1, -1, 1, x)));
  for i in 0..m {
    tmp += calc(-1, -1, 1, &cakes[i]);
  }
  ans = max(tmp, ans);

  let mut tmp = 0;
  cakes.sort_by(|x, y| calc(1, -1, -1, y).cmp(&calc(1, -1, -1, x)));
  for i in 0..m {
    tmp += calc(1, -1, -1, &cakes[i]);
  }
  ans = max(tmp, ans);

  let mut tmp = 0;
  cakes.sort_by(|x, y| calc(-1, 1, -1, y).cmp(&calc(-1, 1, -1, x)));
  for i in 0..m {
    tmp += calc(-1, 1, -1, &cakes[i]);
  }
  ans = max(tmp, ans);

  let mut tmp = 0;
  cakes.sort_by(|x, y| calc(-1, -1, -1, y).cmp(&calc(-1, -1, -1, x)));
  for i in 0..m {
    tmp += calc(-1, -1, -1, &cakes[i]);
  }
  ans = max(tmp, ans);

  // println!("{:?}", cakes);
  println!("{}", ans);

}

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

LL a[2000005];
int main()
{
	LL n, t;
	LL ans = 0;
	cin >> n >> t;
	cin >> a[0];
	for(int i = 1; i < n; i++){
		cin >> a[i];
		ans += min(t, a[i] - a[i - 1]);
	}
	ans += t;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define rrep(i,n) for(int i=(int)n-1;i>=0;--i)
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T& a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U& u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U& u,const V... v){for(auto& e:u)fill_v<T>(e,v...);}

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

    int a, b, c;
    cin >> a >> b >> c;
    int k;
    cin >> k;
    int cnt = 0;
    while (a >= b) b *= 2, cnt++;
    while (b >= c) c *= 2, cnt++;
    if (cnt <= k) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 3648
// Package main provides
//
// File:  d.go
// Author: ymiyamoto
//
// Created on Wed Dec  5 00:45:04 2018
//
package main

import "fmt"

type pos struct {
	x, y int
}

type move struct {
	from pos
	to   pos
}

func (m *move) println() {
	fmt.Println(m.from.y+1, m.from.x+1, m.to.y+1, m.to.x+1)
}

var h, w int

func main() {
	fmt.Scan(&h, &w)

	board := make([][]int, h)
	for i := range board {
		board[i] = make([]int, w)
	}

	for i := range board {
		for j := range board[i] {
			fmt.Scan(&board[i][j])
		}
	}

	var arr []move
	for i := range board {
		for j := range board[i] {
			if board[i][j]%2 == 1 && j+1 < len(board[i]) {
				board[i][j]--
				board[i][j+1]++
				arr = append(arr, move{from: pos{y: i, x: j}, to: pos{y: i, x: j + 1}})
			}
		}
	}

	for i := range board {
		last := len(board[i]) - 1
		if i+1 < len(board) && board[i][last]%2 == 1 {
			board[i][last]--
			board[i+1][last]++
			arr = append(arr, move{from: pos{y: i, x: last}, to: pos{y: i + 1, x: last}})
		}
	}

	fmt.Println(len(arr))
	for i := range arr {
		arr[i].println()
	}
}


Measured memory_bytes: 25344
#include "bits/stdc++.h"
#define rep(i, N) for(int (i) = 0; (i) < (N); (i)++)
#define debug(var) std::cout << #var << " : " << var;

long long func(long long a, long long b) {
	if (a % b == 0) {
		return a / b - 1;
	}
	else {
		return a / b;
	}
}

int main() {

	std::cin.tie(nullptr); std::ios::sync_with_stdio(false);

	int N, L; std::cin >> N >> L;
	int sum = 0;
	int diff = INT_MAX;
	int min = 0;
	rep(i, N) {
		sum += (L + i);
	}
	rep(i, N) {
		if (abs(sum - (sum - L - i)) < diff) {
			min = L + i;
			diff = abs(sum - (sum - L - i));
		}
	}

	std::cout << sum - min;

	return 0;

}

Measured memory_bytes: 256
def solve(s):
    n = len(s)
    res = 0
    i = 0
    num = 0
    while i < n-1:
        if s[i] == "A":
            num += 1
            i += 1
        elif s[i:i+2] == "BC":
            res += num
            i += 2
        else:
            num = 0
            i += 1
    return res

s = input()
print(solve(s))

Measured memory_bytes: 9340
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author NikuKyabe
 */

#include <iostream>
#include <fstream>

#include "bits/stdc++.h"

using namespace std;
#define int long long


class AMultiplication1 {
public:
    void solve(std::istream &in, std::ostream &out) {
      int a, b;
      in >> a >> b;
      out << a * b << endl;
    }
};


signed main() {
  ios::sync_with_stdio(false);
  cout.tie(0);
  cout << fixed;
  AMultiplication1 solver;
  std::istream &in(std::cin);
  std::ostream &out(std::cout);
  solver.solve(in, out);
  return 0;
}


Measured memory_bytes: 3648
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define forever while (true)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
template<typename A> using V = std::vector<A>;
template<typename A> using F = std::function<A>;
template<typename A, typename B> using P = std::pair<A, B>;
using pii = P<int, int>;
using vi = V<int>;
using vd = V<double>;
using vs = V<std::string>;
using vpii = V<pii>;
using vvi = V<vi>;
using vvpii = V<vpii>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
template<typename T> std::istream &operator>>(std::istream &is, std::vector<T> &v) { for (T &x : v) is >> x; return is; }
using namespace std;
// clang-format on

main {
  string s;
  while (cin >> s, s != "0") {
    int x = 0;
    for (auto &c : s) x += c - '0';
    cout << x << endl;
  }
}

Measured memory_bytes: 3200
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
#include <map>
#include <stack>
using namespace std;
typedef long long int lli;
#define urept(soeji, start, n) for (int soeji = start; soeji < n; soeji++)
#define drept(soeji, start, n) for (int soeji = start; soeji > n; soeji--)
int main(void)
{
    int N;
    cin >> N;
    int tmp;
    vector<int> h, cp;
    for (int i = 0; i < N; i++)
    {
        cin >> tmp;
        h.push_back(tmp);
    }
    int bigger = 0;
    for (int i = 0; i < N; i++)
    {
        bigger = max(h[i], bigger);
        if (bigger - h[i] >= 2)
        {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 3916
using System;
using System.Linq;

namespace ARC089C
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());

            int[] before = {0, 0, 0};
            for (int i = 0; i < n; i++)
            {
                int[] query = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
                int distance = Math.Abs(before[2] - query[2]) + Math.Abs(before[1] - query[1]);
                if (distance > query[0] - before[0] || distance % 2 != (query[0] - before[0]) % 2)
                {
                    Console.WriteLine("No");
                    return;
                }

                before = query;
            }

            Console.WriteLine("Yes");
        }
    }
}

Measured memory_bytes: 15312
import java.util.Scanner;

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

		int N = sc.nextInt();

		int A[] = new int[N];
		for (int i = 0; i < N; i++) {
			A[i] = sc.nextInt();
		}

		int count = 0;

		boolean flag = true;
		while (flag) {
			flag = false;
			for (int i = N - 1; i >= 1; i--) {
				if (A[i] < A[i - 1]) {
					int x = A[i - 1];
					A[i - 1] = A[i];
					A[i] = x;
					count++;
					flag = true;
				}
			}
		}

		for (int i = 0; i < N - 1; i++) {
			System.out.print(A[i] + " ");
		}
		System.out.println(A[N - 1]);
		System.out.println(count);
	}
}



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

int main(){
  int N;cin>>N;
  int ans=0,sum=0;
  for(int i=0;i<N;i++)
  {
    int L[i];
    cin>>L[i];
    sum=L[i]+sum;
    ans=max(ans,L[i]);
    
  }
  if(ans<sum-ans)
  {
    cout<<"Yes"<<endl;
  }
  else
  {
   cout<<"No"<<endl;
  }
}

Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val price = sc.nextInt()

  val n1 = price / 100
  val n2 = price % 100
  if (n2 / 5.0 <= n1) {
    println(1)
  } else {
    println(0)
  }
}

Measured memory_bytes: 31396
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());
#define PAU system("pause")

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<vb> vvb;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 28);
const ll LINF = 1e18;
const double PI = acos(-1);

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, W;
	cin >> N >> W;
	vll dp(W + 1, 0);
	REP(i, N) {
		int w, v;
		cin >> w >> v;
		vll cur = dp;
		REP(j, W) {
			if (w + j > W)break;
			cur[j + w] = max(cur[j + w] ,dp[j] + v);
		}
		dp = cur;
	}
	ll ans = 0;
	REP(i, W + 1) {
		ans = max(ans, dp[i]);
	}
	cout << ans << endl;
	PAU;
	return 0;
}


Measured memory_bytes: 2048
#ifdef LOCAL111
	#define _GLIBCXX_DEBUG
#else
	#define NDEBUG
#endif
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
const int INF = 1e9;
using namespace std;
template<typename T, typename U> ostream& operator<< (ostream& os, const pair<T,U>& p) { cout << '(' << p.first << ' ' << p.second << ')'; return os; }

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#ifdef LOCAL111
	#define DEBUG(x) cout<<#x<<": "<<(x)<<endl
	template<typename T> void dpite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
#else
	#define DEBUG(x) true
	template<typename T> void dpite(T a, T b){ return; }
#endif
#define F first
#define S second
#define SNP string::npos
#define WRC(hoge) cout << "Case #" << (hoge)+1 << ": "
template<typename T> void pite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}

typedef long long int LL;
typedef unsigned long long ULL;
typedef pair<int,int> P;

void ios_init(){
	//cout.setf(ios::fixed);
	//cout.precision(12);
#ifdef LOCAL111
	return;
#endif
	ios::sync_with_stdio(false); cin.tie(0);	
}

int main()
{
	ios_init();
	LL n,m;
	while(cin >> n >> m) {
		LL ans = 0;
		LL t = min(n,m/2);
		ans += t;
		n -= t;
		m -= 2*t;
		ans += m/4;
		cout << ans << endl;
	}
	return 0;
}


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

using namespace std;

int main()
{
  int n;
  while(cin >> n, n){
    int m = (n-1) / 2;
    bool sq[10001] = {false};
    int a[5001] = {0};
    for(int i = 1; i < n; i++) sq[(i*i)%n] = true;
    for(int i = 0; i < n; i++){
      if(!sq[i]) continue;
      for(int j = 0; j < n; j++){
	if(i == j) continue;
	if(!sq[j]) continue;
	int d = i - j;
	if(d < 0){
	  if(d + n > m) a[n-(d+n)]++;
	  else a[d+n]++;
	} else {
	  if(d > m) a[n-d]++;
	  else a[d]++;
	}
      }
    }
    for(int i = 1; i <= m; i++) cout << a[i] << endl;
  }
  return 0;
}

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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
using ll = long long;
using ld = long double;
const int MOD = 1e9+7;
const ll INF = 1LL << 60;


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

    if(s == "hi" || s == "hihi" || s == "hihihi" || s == "hihihihi" || s == "hihihihihi") cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 3564
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,k;
	cin>>n>>k;
	int a[n];
	for(int i=0;i<n;i++)
        cin>>a[i];
    int dp[n];
	for(int i=0;i<n;i++)
        dp[i]=INT_MAX;
	dp[0]=0;
	dp[1]=abs(a[0]-a[1]);
	for(int i=2;i<n;i++)
    {
        for(int j=1;j<=k;j++)
        {
            if(i-j<0)break;
            dp[i]=min(dp[i],dp[i-j]+abs(a[i-j]-a[i]));
        }
    }
    cout<<dp[n-1]<<endl;
}


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

int main(void){
    // Your code here!
    int N, K;
    int H[100000];
    int h;
    int count;
    
    cin >> N >> K;
    count = 0;
    
    for (int i = 0; i < N; i++){
        cin >> h;
        if(h >= K)count++;
    }

    cout << count << endl;

}


Measured memory_bytes: 256
def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

a = gets.chomp
b = gets.chomp
(0..(a.size-b.size)).each do |i|
  i = a.size - i - 1
  f = false
  b.size.times do |j|
    next if(a[i-j] == "?")
    if(b[b.size-j-1] != a[i-j])
      f = true
      break
    end
  end
  next if f
  a[(i-b.size+1)..i] = b
  a.gsub!(/\?/,"a")
  puts a
  exit
end
puts "UNRESTORABLE"

Measured memory_bytes: 1788
#define DEBUG 0
/**
 * File    : A.cpp
 * Author  : Kazune Takahashi
 * Created : 7/7/2019, 8:52:44 PM
 * Powered by Visual Studio Code
 */
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <functional>
#include <random>
#include <chrono>
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
using ll = long long;
void Yes()
{
  cout << "Yes" << endl;
  exit(0);
}
void No()
{
  cout << "No" << endl;
  exit(0);
}
const int MAX_SIZE = 1000010;
class mint
{
public:
  static ll MOD;
  ll x;
  mint() : x(0) {}
  mint(ll x) : x(x % MOD) {}
  mint operator-() const { return x ? MOD - x : 0; }
  mint &operator+=(const mint &a)
  {
    if ((x += a.x) >= MOD)
    {
      x -= MOD;
    }
    return *this;
  }
  mint &operator-=(const mint &a) { return *this += -a; }
  mint &operator*=(const mint &a)
  {
    (x *= a.x) %= MOD;
    return *this;
  }
  mint &operator/=(const mint &a) { return (*this *= power(MOD - 2)); }
  mint operator+(const mint &a) const { return mint(*this) += a; }
  mint operator-(const mint &a) const { return mint(*this) -= a; }
  mint operator*(const mint &a) const { return mint(*this) *= a; }
  mint operator/(const mint &a) const { return mint(*this) /= a; }
  bool operator<(const mint &a) const { return x < a.x; }
  bool operator==(const mint &a) const { return x == a.x; }
  const mint power(ll N)
  {
    if (N == 0)
    {
      return 1;
    }
    else if (N % 2 == 1)
    {
      return *this * power(N - 1);
    }
    else
    {
      mint half = power(N / 2);
      return half * half;
    }
  }
};
ll mint::MOD = 1e9 + 7;
istream &operator>>(istream &stream, mint &a) { return stream >> a.x; }
ostream &operator<<(ostream &stream, const mint &a) { return stream << a.x; }
mint inv[MAX_SIZE];
mint fact[MAX_SIZE];
mint factinv[MAX_SIZE];
void init()
{
  inv[1] = 1;
  for (int i = 2; i < MAX_SIZE; i++)
  {
    inv[i] = (-inv[mint::MOD % i]) * (mint::MOD / i);
  }
  fact[0] = factinv[0] = 1;
  for (int i = 1; i < MAX_SIZE; i++)
  {
    fact[i] = mint(i) * fact[i - 1];
    factinv[i] = inv[i] * factinv[i - 1];
  }
}
mint choose(int n, int k)
{
  if (n >= 0 && k >= 0 && n - k >= 0)
  {
    return fact[n] * factinv[k] * factinv[n - k];
  }
  return 0;
}
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
// const double epsilon = 1e-10;
// const ll infty = 1000000000000000LL;
// const int dx[4] = {1, 0, -1, 0};
// const int dy[4] = {0, 1, 0, -1};

int main()
{
  // init();
  int N, A, B;
  cin >> N >> A >> B;
  cout << min(N * A, B) << endl;
}

Measured memory_bytes: 23680
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var isProduct = true

func main() {
	nextReader = newScanner()

	s := nextString()

	prev := rune(' ')
	for _, t := range s {
		if prev == t {
			fmt.Println("Bad")
			return
		}
		prev = t
	}

	fmt.Println("Good")
}

func debugln(s ...interface{}) {
	if !isProduct {
		fmt.Println(s...)
	}
}

func debug(s ...interface{}) {
	if !isProduct {
		fmt.Print(s...)
	}
}
func debugf(f string, s ...interface{}) {
	if !isProduct {
		fmt.Printf(f, s...)
	}
}

var nextReader func() string

func newScanner() func() string {
	r := bufio.NewScanner(os.Stdin)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)
	return func() string {
		r.Scan()
		return r.Text()
	}
}
func nextString() string {
	return nextReader()
}
func nextInt64() int64 {
	v, _ := strconv.ParseInt(nextReader(), 10, 64)
	return v
}
func nextInt() int {
	v, _ := strconv.Atoi(nextReader())
	return v
}
func nextInts(n int) []int {
	r := make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt()
	}
	return r
}
func nextInt64s(n int) []int64 {
	r := make([]int64, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt64()
	}
	return r
}
func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(nextReader(), 64)
	return f
}

func maxInt(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}


Measured memory_bytes: 640
#include<stdio.h>
int main()
{
	int a[4];
	for (int i = 0; i < 4; i++)
	{
		scanf("%1d", &a[i]);
	}
	if (a[0]+a[1]+a[2]+a[3]==7)
	{
		printf("%d+%d+%d+%d=7", a[0], a[1], a[2], a[3]);
	}
	else if (a[0] + a[1] + a[2] - a[3] == 7)
	{
		printf("%d+%d+%d-%d=7", a[0], a[1], a[2], a[3]);
	}
	else if (a[0] + a[1] - a[2] + a[3] == 7)
	{
		printf("%d+%d-%d+%d=7", a[0], a[1], a[2], a[3]);
	}
	else if (a[0] + a[1] - a[2] - a[3] == 7)
	{
		printf("%d+%d-%d-%d=7", a[0], a[1], a[2], a[3]);
	}
	else if (a[0] - a[1] + a[2] + a[3] == 7)
	{
		printf("%d-%d+%d+%d=7", a[0], a[1], a[2], a[3]);
	}
	else if (a[0] - a[1] + a[2] - a[3] == 7)
	{
		printf("%d-%d+%d-%d=7", a[0], a[1], a[2], a[3]);
	}
	else if (a[0] - a[1] - a[2] - a[3] == 7)
	{
		printf("%d-%d-%d-%d=7", a[0], a[1], a[2], a[3]);
	}
	else if (a[0] - a[1] - a[2] + a[3] == 7)
	{
		printf("%d-%d-%d+%d=7", a[0], a[1], a[2], a[3]);
	}
	else
	{
		return 0;
	}
	return 0;
}

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

void fnInput(vector<int>& rvnBinHeap)
{
  int nMaxSiz;
  cin >> nMaxSiz;
  rvnBinHeap.resize(nMaxSiz + 1);

  for (int i = 1; i < nMaxSiz + 1; ++i)
    cin >> rvnBinHeap[i];
}

void fnBinaryHeap(const vector<int>& cnrvnBinHeap)
{
  for (int i = 1; i < cnrvnBinHeap.size(); ++i)
  {
    cout << "node " << i << ": key = " << cnrvnBinHeap[i] << ", ";
    int nParnt = i / 2;
    int nLeft = i * 2;
    int nRigt = nLeft + 1;
    if (nParnt >= 1)
      cout << "parent key = " << cnrvnBinHeap[nParnt] << ", ";
    if (nLeft < cnrvnBinHeap.size())
      cout << "left key = " << cnrvnBinHeap[nLeft] << ", ";
    if (nRigt < cnrvnBinHeap.size())
      cout << "right key = " << cnrvnBinHeap[nRigt] << ", ";
    cout << endl;
  }
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<int> vnBinHeap; 

  fnInput(vnBinHeap);
  fnBinaryHeap(vnBinHeap);
  return 0;
}

Measured memory_bytes: 3128