akhauriyash/Code-Regression huggingface dataset:
#include <vector>
#include <iostream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>

using namespace std;

template<typename T, typename S>
istream& operator >> (istream& is, pair<T, S>& p) {
    is >> p.first >> p.second;
    return is;
}

template<typename T>
istream& operator >> (istream& is, vector<T>& v) {
    for (auto& x : v) {
        is >> x;
    }
    return is;
}

template<typename T>
ostream& operator << (ostream& os, const vector<T>& v) {
    for (auto& x : v) {
        os << x << " ";
    }
    os << "\n";
    return os;
}

bool dfs(int v, int64_t s, const vector<vector<pair<int, int64_t>>>& e, vector<int>& used, vector<int64_t>& ans, vector<int>& comp) {
    used[v] = 1;
    comp.push_back(v);
    ans[v] = s;
    for (auto [u, a] : e[v]) {
        if (!used[u]) {
            if (!dfs(u, a - s, e, used, ans, comp)) return false;
        } else {
            if (ans[u] + s != a) return false;
        }
    }
    return true;
}

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

#ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int R, C, N;
    cin >> R >> C >> N;
    vector<vector<pair<int, int64_t>>> e(R + C);
    for (int i = 0; i < N; ++i) {
        int r, c, a;
        cin >> r >> c >> a;
        --r, --c;
        e[r].push_back({R + c, a});
        e[R + c].push_back({r, a});
    }
    vector<int> used(R + C);
    vector<int64_t> ans(R + C);
    vector<int64_t> AA, BB;
    for (int i = 0; i < R + C; ++i) {
        if (!used[i]) {
            vector<int> comp;
            if (!dfs(i, 0, e, used, ans, comp)) {
                cout << "No";
                return 0;
            }
            vector<int> A, B;
            for (auto j : comp) {
                if (j < R) A.push_back(ans[j]);
                else B.push_back(ans[j]);
            }
            if (A.empty() || B.empty()) continue;
            int64_t minA = *min_element(A.begin(), A.end());
            int64_t minB = *min_element(B.begin(), B.end());
            if (minA + minB < 0) {
                cout << "No";
                return 0;
            }
            AA.push_back(minA);
            BB.push_back(minB);
        }
    }
    set<pair<int64_t, int>> As, Bs;
    for (int i = 0; i < AA.size(); ++i) {
        As.insert({AA[i], i});
        Bs.insert({BB[i], i});
    }
    for (int t = 0; t <= R + C; ++t) {
        int64_t minA = As.begin()->first;
        int ia = As.begin()->second;
        int64_t minB = Bs.begin()->first;
        int ib = Bs.begin()->second;
        if (minA + minB >= 0) {
            cout << "Yes";
            return 0;
        }
        if (ia == ib) {
            cout << "No";
            return 0;
        }
        int64_t s = minA + minB;
        As.erase({AA[ia], ia});
        AA[ia] -= s;
        As.insert({AA[ia], ia});
        Bs.erase({BB[ia], ia});
        BB[ia] += s;
        Bs.insert({BB[ia], ia});
    }
    cout << "No";
}


Measured memory_bytes: 30428
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 1000005
#define inf 1e9
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

inline int read()
{
	int x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

int main()
{
	ll d,t,s; cin>>d>>t>>s;
	t*=s; if(d>t) puts("No"); else puts("Yes");
	return 0;
}

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

struct UnionFind{
    vector<int> par;
    UnionFind(int N) : par(N){
        for(int i = 0; i < N; i++){
            par[i] = -1;
        }
    }
    int root(int x){
        if(par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    void unite(int x, int y){
        int rx = root(x);
        int ry = root(y);
        if(rx == ry) return;
        else{
            if(par[rx] > par[ry]) swap(rx, ry);
            par[rx] += par[ry];
            par[ry] = rx;
       }
    }
    bool same(int x, int y){
        return root(x) == root(y);
    }
    void check(){
        for(auto x : par){
            cout << x << " ";
        }
        cout << endl;
    }
};

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

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

    UnionFind UF(N);

    for(int i = 0; i < M; i++){
        int x, y;
        cin >> x >> y;
        x--; y--;
        UF.unite(x, y);
    }

    int ans = 0;
    for(int i = 0; i < N; i++){
        if(UF.same(i, p[i])){
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
//#define cerr if (false) cerr
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define dbv(v) cerr << #v << "="; for (auto _x : v) cerr << _x << ", "; cerr << endl
#define dba(a, n) cerr << #a << "="; for (int _i = 0; _i < (n); ++_i) cerr << a[_i] << ", "; cerr << endl
template <typename A, typename B>
ostream& operator<<(ostream& os, const pair<A, B>& x) {
	return os << "(" << x.first << "," << x.second << ")";
}
typedef long long ll;
typedef long double ld;
char str[200005];
int main() {
	scanf("%s", str);
	int n = strlen(str);
	int las = 0;
	int ones = 0, blocks = 0;
	string s;
	for (int i = 0; i < n; ++i) {
		if (str[i] == '1') ++ones;
		else s += '0';
		if (str[i] != str[i + 1]) {
			if (str[i] == '1') {
				int len = i - las + 1;
				if (len & 1) s += '1';
				blocks += len / 2;
			}
			las = i + 1;
		}
	}
	int zeros = n - ones;
	ll ans = 0;
	for (int i = 1; i <= ones; ++i) ans += (i + 1) / 2;
	ans += (ll)zeros * blocks;
	int cur = 0;
	for (int i = 0; i < s.size(); ++i) {
		if (s[i] == '1') {
			if ((i + 1) & 1) ans += (cur + 1) / 2;
			else ans += cur / 2;
			ans += zeros - cur;
		} else ++cur;
	}
	printf("%lld\n", ans);
}

Measured memory_bytes: 4120
/*************************************************************************
>>> Author: WindCry1
>>> Mail: lanceyu120@gmail.com
>>> Website: https://windcry1.com
>>> Date: 12/30/2019 11:03:37 PM
*************************************************************************/
//#pragma GCC optimize(3)
//#pragma GCC diagnostic error "-std=c++11"
#include <cstring>
#include <cmath>
#include <cstdio>
#include <cctype>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <iostream>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <complex>
#include <stack>
#include <bitset>
#include <iomanip>
#include <list>
#include <sstream>
#include <fstream>
#if __cplusplus >= 201103L
#include <unordered_map>
#include <unordered_set>
#endif
#define endl '\n'
#define ll long long
#define ull unsigned long long
#define DEBUG(x) cout<<#x<<" : "<<x<<endl;
#define lowbit(x) x&(-x)
#define ls u<<1
#define rs u<<1|1
using namespace std;
template<typename T> inline T MIN(const T &a,const T &b) {return a<b?a:b;}
template<typename T> inline T MAX(const T &a,const T &b) {return a>b?a:b;}
template<typename T,typename ...Args> inline T MIN(const T &a,const T &b,Args ...args) {return MIN(MIN(a,b),args...);}
template<typename T,typename ...Args> inline T MAX(const T &a,const T &b,Args ...args) {return MAX(MAX(a,b),args...);}
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
const double eps = 1e-8;
const int INF = 0x3f3f3f3f;
const int mod = 1e9+7;
const int dir[4][2]={-1,0,1,0,0,-1,0,1};
int p[100010],punish[100010];
string s[100010];
bool flag[100010];
int main(){
	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#ifdef WindCry1
	freopen("C:\\Users\\LENOVO\\Desktop\\in.txt","r",stdin);
#endif
	int n,m;cin>>n>>m;
	for(int i=1;i<=m;i++){
		cin>>p[i]>>s[i];
		if(!flag[p[i]] and s[i]=="WA"){
			punish[p[i]]++;
		}
		if(!flag[p[i]] and s[i]=="AC"){
			flag[p[i]]=1;
		}
	}
	int sum=0,pun=0;
	for(int i=1;i<=n;i++) {
		if(flag[i]) sum++,pun+=punish[i];
	}
	cout<<sum<<" "<<pun<<endl;
	return 0;
}



Measured memory_bytes: 6656
/**
 *   author: sahushivam
 *   created: 16 November 2019 (Saturday)  17:28:46
**/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,a,b) for(int i = a; i<b; i++)
#define MOD 1000000007
#define INF 1e18
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define int long long

signed main(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    int t=1;
    cin>>t;
    cout<<t*t<<endl;	
return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
using namespace std;
int main() {
	int x, a, b;
	scanf("%d%d%d",&x,&a,&b);
	int ans = -a + b;
	if (ans <= 0) {
		printf("delicious");
	}
	else if (ans <= x) {
		printf("safe");
	}
	else {
		printf("dangerous");
	}
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <random>
#include <set>
#include <stack>
#include <time.h>

//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#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,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define SORTR(x) sort(x.begin(),x.end(),greater<int>())
#define rn return
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple

using namespace std;
using ll = long long;
typedef std::pair<int,int> pii;
typedef std::vector<int> vi;
typedef std::vector<pii> vii;

#define PI 3.14159265358979323846264338327950L
const int mod = 1000000007;


void solve(){
    int n;
    cin >> n;
    map<string,int> m;
    m["AC"] = 0;
    m["WA"] = 0;
    m["TLE"] = 0;
    m["RE"] = 0;
    rep(i,n){
        string s;
        cin >> s;
        m[s]++;
    }
    cout << "AC x " << m["AC"] << endl;
    cout << "WA x " << m["WA"] << endl;
    cout << "TLE x " << m["TLE"] << endl;
    cout << "RE x " << m["RE"] << endl;
}

int main(){
    int T;
    T = 1;
    while(T--){
        solve();
        cout << endl;
    }
}






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

#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
typedef long long ll;
typedef pair<int,int> P;

template<typename A,typename B> inline void chmin(A &a,B b){if(a>b) a=b;}
template<typename A,typename B> inline void chmax(A &a,B b){if(a<b) a=b;}
//-----------------------------------------------------------------------

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

    string s;
    while(true)
    {
        getline(cin,s);
        if(s[0]=='.') break;

        stack<char> St;

        bool ok=true;
        REP(i,s.size()){
            if(s[i]=='(') St.push(s[i]);
            if(s[i]=='[') St.push(s[i]);
            if(s[i]==')'){
                if(St.empty() || St.top()!='('){ ok=false;break;}
                else St.pop();
            }
            if(s[i]==']'){
                if(St.empty() || St.top()!='['){ ok=false;break;}
                else St.pop();
            }
        }
        if(!St.empty()) ok=false;
        cout<<(ok?"yes":"no")<<endl;

    }
}

Measured memory_bytes: 3120
#define _USE_MATH_DEFINES
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <functional>

/*
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };
*/

using namespace std;

int main()
{
    int n;
    cin >> n;
    int x;
    int min = 2000000000;
    int ans = -2000000000;
    while (n--)
    {
        cin >> x;
        ans = std::max(ans, x - min);
        min = std::min(min, x);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long   signed int LL;
typedef long long unsigned int LU;
#define incID(i, l, r) for(LL i = (l)    ; i <  (r); ++i)
#define incII(i, l, r) for(LL i = (l)    ; i <= (r); ++i)
#define decID(i, l, r) for(LL i = (r) - 1; i >= (l); --i)
#define decII(i, l, r) for(LL i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec(i, n)  decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
template<typename T> bool setmin  (T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmax  (T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
LL mo(LL a, LL b) { assert(b > 0); a %= b; if(a < 0) { a += b; } return a; }
LL fl(LL a, LL b) { assert(b > 0); return (a > 0 ? a / b : (a - b + 1) / b); }
LL ce(LL a, LL b) { assert(b > 0); return (a < 0 ? a / b : (a + b - 1) / b); }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
#define bit(b, i) (((b) >> (i)) & 1)
#define BC __builtin_popcountll
#define SC static_cast
#define SI(v) SC<int>(v.size())
#define SL(v) SC<LL >(v.size())
#define RF(e, v) for(auto & e: v)
#define ef else if
#define UR assert(false)

// ---- ----

int n, m, s[2000], t[2000], dp[2000], sum[2001], MOD = 1e9 + 7;

int main() {
	cin >> n >> m;
	inc(i, n) { cin >> s[i]; }
	inc(i, m) { cin >> t[i]; }
	
	inc(i, n) {
		dec(j, m) { if(s[i] == t[j]) { (dp[j] += sum[j] + 1) %= MOD; } }
		inc(j, m) { sum[j + 1] = (sum[j] + dp[j]) % MOD; }
	}
	
	cout << (sum[m] + 1) % MOD << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
int main() {
  string s;
  cin >> s;
  int r = 0, b = 0;
  rep(i,s.size())
  {
    if (s[i] == '0') {
      r++;
    } else {
      b++;
    }
  }
  cout << min(r, b) * 2;
}


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

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define dump_1(x1) cerr << #x1 << ": " << x1 << endl
#define dump_2(x1, x2) \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define dump_3(x1, x2, x3)                                                \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << endl
#define dump_4(x1, x2, x3, x4)                                            \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << ", " #x4 << ": " << x4 << endl
#define dump_5(x1, x2, x3, x4, x5)                                        \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#define dump(...) \
  CHOOSE((__VA_ARGS__, dump_5, dump_4, dump_3, dump_2, dump_1, ~))(__VA_ARGS__)
#define check(s) cerr << s << endl

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define unique(v) v.erase(unique(v.begin(), v.end()), v.end());

using namespace std;

using ll = long long;

vector<int> dx = {0, 1, 0, -1};
vector<int> dy = {1, 0, -1, 0};

const ll LINF = 2e18;
const int INF = 1e9;

void solve(ll A, ll B, ll K) {
  rep(i, K) {
    if (i % 2 == 0) {
      if (A % 2 != 0) --A;
      B += A / 2;
      A -= A / 2;
    } else {
      if (B % 2 != 0) --B;
      A += B / 2;
      B -= B / 2;
    }
  }
  cout << A << " " << B << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  ll A;
  scanf("%lld", &A);
  ll B;
  scanf("%lld", &B);
  ll K;
  scanf("%lld", &K);
  solve(A, B, K);
  return 0;
}


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

using namespace std;
string s;
int main(){
    int t=1;while(t--){
        cin >> s ;
        int a=0,b=0;
        for(int i=0;i<3;++i){
            if(s[i]=='A')a++;
            else b++;
        }
        if(a==3 || b==3) cout << "No" << endl;
        else cout << "Yes" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MOD	1000000007
#define int	long long
#define pii pair<int,int> 
#define vi vector<int>
using namespace std;

int dp[105][4][2];

string s;
int n;

int solve(int pos, int left, int flag){
	if(left < 0)
		return 0;
	if(pos == n){
		return left == 0;
	}
	if(dp[pos][left][flag] != -1)
		return dp[pos][left][flag];
	int ans = 0;
	ans = solve(pos+1,left,(flag | (s[pos]-'0')) > 0);
	int max_digit = s[pos] - '0';
	if(flag)
		max_digit = 9;
		
	for(int i = 1; i <= max_digit; i++){
		if(i == max_digit){
			ans += solve(pos+1,left-1,flag);
		}
		else
			ans += solve(pos+1,left-1,1);
	}
	//cout << "dp[" << pos << "][" << left << "][" << flag << "] = " << ans << endl;
	return dp[pos][left][flag] = ans;
}

int getAns(int k){
	memset(dp,-1,sizeof dp);
	return solve(0,k,0);
}

int32_t main(){
	cin >> s;
	int k;
	cin >> k;
	n = s.size();
	
	if(n < k){
		cout << 0;
		return 0;
	}
	
	//if(n < 7){
		//int no = stoi(s);
		//int ans = 0;
		//for(int i = 1; i <= no; i++){
			//string p = to_string(i);
			//int cnt = 0;
			//for(auto x : p)
				//if(x != '0')
					//cnt++;
			//if(cnt == k)
				//ans++;
		//}
		//cout << ans << endl;
		//return 0;
	//}
	cout << getAns(k) << endl;
	
	
	return 0;
}



Measured memory_bytes: 256
import sys
import math
import fractions
from collections import deque
from collections import defaultdict
sys.setrecursionlimit(10**7)

N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
point = 0
point += A[0]

cnt = 1
for a in A[1:]:
    for _ in range(2):
        point += a
        cnt += 1
        if cnt == N-1:
            break
    if cnt == N-1:
        break

if N == 2:
    print(A[0])
else:
    print(point)


Measured memory_bytes: 98184
X, K, D = map(int, input().split())
X = abs(X)
if K*D <= X:
    print(X-K*D)
    exit()

a = int(X/D)
b = K - a
result = X-D*a
if b%2==1:
    result = min(abs(result+D), abs(result-D))
print(result)

Measured memory_bytes: 9164
#include<stdio.h>
int main()
{
    int n,i,a[3];
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d%d%d",&a[0],&a[1],&a[2]);
        if(a[0]*a[0]+a[1]*a[1] == a[2]*a[2]|| a[0]*a[0]+a[2]*a[2] == a[1]*a[1] || a[2]*a[2]+a[1]*a[1] == a[0]*a[0]){
            printf("YES\n");
        }
        else {
            printf("NO\n");
        }
    }
    return 0;
}

Measured memory_bytes: 580
import math
inf = math.inf

def merge(A, left, mid, right):
    global cnt
    
    L = []
    R = []
    for i in A[left:mid]:
        L.append(i)
    for i in A[mid:right]:
        R.append(i)
    L.append(inf)
    R.append(inf)
    i = 0
    j = 0
    for k in range(left, right):
        cnt += 1
        if L[i] <= R[j]:
            A[k] = L[i]
            i += 1
            
        else:
            A[k] = R[j]
            j += 1

def mergeSort(A, left, right):
    if right - left > 1:
        mid = (left + right) // 2
        mergeSort(A, left, mid)
        mergeSort(A, mid, right)
        merge(A, left, mid, right)

_ =input()
A = list(map(int, input().rstrip().split(" ")))
cnt = 0
mergeSort(A, 0, len(A))

print(" ".join(list(map(str, A))))
print(cnt)
    


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

int main() {
  int a,b,c,d,e;
  cin >> a >> b;
  c = a + b;
  d = a - b;
  e = a * b;
  if(c >= d && c >= e)
    cout << c << endl;
  else if(d >= c && d >= e)
    cout << d << endl;
  else
    cout << e << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>
#include <iomanip>
#include <random>


#define FOR_LT(i, beg, end) for (int i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (int i = beg; i <= end; i++)
#define FOR_DW(i, beg, end) for (int i = beg; end <= i; i--)

using namespace std;

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

	int k; cin >> k;
	int n; cin >> n;

	vector<int> hs(n); for (auto& h : hs) { cin >> h; }
	sort(hs.begin(), hs.end());

	int maxd = 0;
	FOR_LT(i, 0, n - 1) {
		maxd = max(maxd, hs[i + 1] - hs[i]);
	}
	maxd = max(maxd, hs[0] + (k - hs[n - 1]));

	cout << k - maxd << endl;


	return 0;
}

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

using namespace std;

#define int long long
#define endl '\n'
#define maxn 100010
const int MOD = 1000000007;

void solve() {
    int n;
    cin >> n;

    vector<int> v(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
    int o = 1;
    deque<int> d;
    for (int i = 0; i < n; i++) {
        if (o)
            d.push_back(v[i]);
        else
            d.push_front(v[i]);
        o ^= 1;
    }
    if(o == 0)
        reverse(d.begin(), d.end());
    for(auto x: d)cout << x << " ";
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
//    cin >> t;

    while (t--)
        solve();
    return 0;
}

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

#define rep(i,s,n) for(ll i = (s); i < (n); i++)
#define rep0(i,n) rep(i,0,n)
#define rep1(i,n) rep(i,1,n+1)
#define repR(i,s,n) for(ll i = (n-1); i >= (s); i--)
#define repR0(i,n) repR(i,0,n)
#define repR1(i,n) repR(i,1,n+1)

#define BR "\n"
#define SP " "
#define SHOW(x) for(int i = 0; i < x.size(); i++) { cout << x[i] << SP; } cout << BR;
#define SHOW2(x) for(int j = 0; j < x.size(); j++) { SHOW(x[j]); } cout << BR;
#define fcout cout << fixed << setprecision(18)

ll MOD = 998244353;

ll powMod(ll x, ll a) {
  if (a == 0) return 1;
  if (a == 1) return x;

  ll temp = powMod(x, a / 2);
  temp = (temp * temp) % MOD;
  if (a % 2 == 1) return (temp * x) % MOD;
  else return temp;
}
int main() {
  int N;
  cin >> N;

  ll m = 0;
  vector<ll> D(N), C(N, 0);
  rep0(i, N) {
    cin >> D[i];
    C[D[i]]++;
    m = max(m, D[i]);
  }
  if (C[0] != 1 || D[0] != 0) {
    cout << 0 << BR;
    return 0;
  }

  ll ans = 1;
  rep1(i, m) {
    ll c0 = C[i - 1];
    ll c1 = C[i];
    if (c0 == 0) ans = 0;
    ans = (ans * powMod(c0, c1)) % MOD;
  }

  cout << ans << BR;
  return 0;
}

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

int main() {
	int d;
	cin >> d;
	if (d == 25) cout << "Christmas" << endl;
	else if (d == 24) cout << "Christmas Eve" << endl;
	else if (d == 23) cout << "Christmas Eve Eve" << endl;
	else if (d == 22) cout << "Christmas Eve Eve Eve" << endl;
	return 0;
}


Measured memory_bytes: 256
if __name__ == '__main__':
    split = input().split(' ')
    n = int(split[0]) - 1
    a = int(split[1]) - 1
    b = int(split[2]) - 1
    c = int(split[3]) - 1
    d = int(split[4]) - 1
    s = input()
    isOK = False
    if c < d:
        isOK = not ('##' in s[a:c] or '##' in s[b:d])
    else:
        isOK = (not ('##' in s[a:c] or '##' in s[b:d])) and ('...' in s[b-1:d+2])
    print('Yes' if isOK else 'No')


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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;
typedef vector < vector<ll> > Mat;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N;

int main(){
  cin >> N;
  int ans = 0;
  for (int C = 1; C < N; C++){
    int now = N - C;

    for (int i = 1; i * i <= now; i++){
      if (now % i != 0) continue;
      if (i * i == now) ans++;
      else ans += 2;
    }
  }
  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>
#include <iomanip>

using namespace std;
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define reppe(i,a,b) for(int i = (int)(a) ; i <= (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)
#define repme(i,a,b) for(int i = (int)(a) ; i >= (int)(b) ; --i)
#define rad_to_deg(rad) (((rad)/2.0/M_PI)*360.0)
typedef long long ll;

long long GCD(long long a, long long b){if(b==0)return a;return GCD(b,a%b);}

int main() {
    string sa, sb, sc; cin >> sa >> sb >> sc;
    map<char, string> m;
    m['a'] = sa;
    m['b'] = sb;
    m['c'] = sc;
    char turn = 'a';
    while (true) {
        if (turn == 'a') {
            if (sa.size() == 0) {
                cout << "A" << endl;
                return 0;
            }
            turn = sa[0];
            // cout << "A throw " << sa[0] << endl;
            sa = sa.substr(1,sa.size() - 1);
        } else if (turn == 'b') {
            if (sb.size() == 0) {
                cout << "B" << endl;
                return 0;
            }
            // cout << "B throw " << sb[0] << endl;
            turn = sb[0];
            sb = sb.substr(1,sb.size() - 1);
        } else if (turn == 'c') {
            if (sc.size() == 0) {
                cout << "C" << endl;
                return 0;
            }
            // cout << "C throw " << sc[0] << endl;
            turn = sc[0];
            sc = sc.substr(1,sc.size() - 1);
        }
    }
}

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

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        long a = scan.nextLong();
        long b = scan.nextLong();
        if (a == 0 || b == 0) {
            System.out.println("Zero");
            return;
        }
        if (a * b < 0) {
            System.out.println("Zero");
            return;
        }
        if (0 < a) {
            System.out.println("Positive");
            return;
        }
        long count = b - a + 1;
        if (count % 2 == 0) {
            System.out.println("Positive");
            return;
        }
        System.out.println("Negative");
    }
}


Measured memory_bytes: 21844
n = int(input())
AC, WA, TLE, RE = 0,0,0,0

for i in range(n):
    s = input()
    if s == "AC":
        AC += 1
    elif s == "WA":
        WA += 1
    elif s == "TLE":
        TLE += 1
    else:
        RE += 1

print("AC x {}\nWA x {}\nTLE x {}\nRE x {}".format(AC,WA,TLE,RE))

Measured memory_bytes: 9196
import fractions

N = int(input())
A = list(map(int, input().split()))

left = [0] * (N+1)
right = [0] * (N+1)
for i in range(N):
    left[i+1] = (fractions.gcd(left[i], A[i]))
    right[N-i-1] = (fractions.gcd(right[N - i],A[N - 1 - i]))

ans = 0
for i in range(N):
    ans = max(ans, fractions.gcd(left[i], right[i+1]))
    
print(ans)


Measured memory_bytes: 16124
#define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>

using namespace std;

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

void printData(int stage[8][8],int n){
	printf("Data %d:\n",n+1);
	for(int i=0;i<8;i++){
		for(int j=0;j<8;j++){
			cout << stage[i][j];
		}
		cout << endl;
	}
}

void bfs(int stage[8][8],int sx,int sy){
	queue<P> que;
	que.push(P(sx,sy));

	while(!que.empty()){
		int x = que.front().first;
		int y = que.front().second;

		que.pop();
		stage[y][x] = 0;
		for(int i=-3; i<=3; i++){
			for(int j=-3;j<=3;j++){
				if(i*j != 0 || (i==j && i==0)) continue;

				int dx = x+i;
				int dy = y+j;

				if(dx < 0 || dx >=8 || dy < 0 || dy >= 8) continue;

				if(stage[dy][dx] == 1){
					que.push(P(dx,dy));
				}
			}
		}
	}
}



int main(){

	string str;
	int stage[8][8];

	int n=0;

	getline(cin,str);
	sscanf(str.c_str(),"%d",&n);
	getline(cin,str);

	for(int idx=0;idx<n;idx++){
		for(int i=0;i<8;i++){
			getline(cin,str);
			for(int j=0;j<8;j++){
				stage[i][j]=str[j]-'0';
			}

		}

		int x,y;

		getline(cin,str);
		sscanf(str.c_str(),"%d",&x);

		getline(cin,str);
		sscanf(str.c_str(),"%d",&y);

		bfs(stage,x-1,y-1);
		printData(stage,idx);

		getline(cin,str);
	}
}

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

public class Main {
    public static void main(String[] args) throws Exception {
        // Here your code !
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int cnt = Integer.parseInt(br.readLine());
        int num = 0;
        
        for (int i = 0; i < cnt ; i++){
            int n = Integer.parseInt(br.readLine());
            if(isPrime(n))num = num + 1;
        }
        System.out.println(num);
    }
    
    public static boolean isPrime(int x){
        int j = 0;
        if(x==2)return true;
        if(x%2==0 | x<2)return false;
        j = 3;
        while(j <= Math.sqrt(x)){
            if(x%j==0)return false;
            j = j + 2;
        }
        return true;
    }
};


Measured memory_bytes: 30252
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <cctype>
using namespace std;

class Cube {
public:
	int f[6];
	Cube() {}
	void roll_z() { roll(1, 2, 4, 3); }
	void roll_y() { roll(0, 2, 5, 3); }
	void roll_x() { roll(0, 1, 5, 4); }
	void roll(int i, int j, int k, int l) {
		int t = f[i]; f[i] = f[j]; f[j] = f[k]; f[k] = f[l]; f[l] = t;
	}
};

bool eq(Cube c1, Cube c2) {
	for (int i = 0; i<6; i++)
		if (c1.f[i] != c2.f[i])return false;
	return true;
}

bool equal(Cube c1, Cube c2) {
	for (int i = 0; i<6; i++) {
		for (int j = 0; j<4; j++) {
			if (eq(c1, c2))return true;
			c1.roll_z();
		}
		if (i % 2 == 0)c1.roll_y();
		else c1.roll_x();
	}
	return false;
}

int main() {
	Cube c1, c2;
	for (int i = 0; i<6; i++) {
		cin >> c1.f[i];
	}
	for (int i = 0; i<6; i++) {
		cin >> c2.f[i];
	}
	if (equal(c1, c2))cout << "Yes" << endl;
	else cout << "No" << "\n";

	return 0;
}

Measured memory_bytes: 3072
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define puts(i) cout << i << endl
#define INF INT_MAX
#define INFL LLONG_MAX
typedef long long ll;
using namespace std;


int main(){
  string sa,sb,sc;
  cin >> sa >> sb >> sc;

  char turn='a';
  ll x=0,y=0,z=0;
  for(ll i=1;i;i++){
    if(sa.size()==x && turn=='a'){
      cout << 'A' << endl;
      return 0;
    }
    else if(sb.size()==y && turn=='b'){
      cout << 'B' << endl;
      return 0;
    }
    else if(sc.size()==z && turn=='c'){
      cout << 'C' << endl;
      return 0;
    }

    if(turn=='a'){
      turn=sa.at(x);
      x++;
    }
    else if(turn=='b'){
      turn=sb.at(y);
      y++;
    }
    else if(turn=='c'){
      turn=sc.at(z);
      z++;
    }



  }

  }


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

using namespace std;

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

	int a, b, c, d, e, k;
	cin >> a >> b >> c >> d >> e >> k;
	if (e - a > k)
		cout << ":(" << endl;
	else
		cout << "Yay!" << endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
S = []
i = 0

if(N % 2 == 0):
  S.append("0")

while N!= 0:
  j = 0
  while N % 2** (i+ 1) == 0:
    i+= 1
    j+= 1
  for k in range(max(j- 1, 0)):
    S.insert(0, "0")
  S.insert(0, "1")
  N-= (-2)** i
  
ans = ""

for i in range(len(S)):
  ans+= S[i]
  
print(ans)
  

Measured memory_bytes: 3064
import java.util.Scanner;
class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int W= scan.nextInt();
        int H = scan.nextInt();
        int x = scan.nextInt();
        int y = scan.nextInt();
        int r = scan.nextInt();
        if(((x - r)>=0) && ((x + r)<=W) && ((y - r)>=0) && ((y + r)<=H) ){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }

        
    }
}


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

int main(){
  string N;
  cin >> N;
  unsigned long long result = 0;
  for(char c : N){
    int tmp = c - '0';
    result += tmp;
  }
  cout << (result % 9 == 0 ? "Yes" : "No") << endl;
}


Measured memory_bytes: 3732
#include<stdio.h>
#include<string.h>
int main()
{
   char S[20];
   int C=0;
   scanf("%s",S);
   if(S[0]==S[1] ) ++C;
   if(S[0]==S[2] ) ++C;
   if(S[0]==S[3] ) ++C;
   if(S[1]==S[2] ) ++C;
   if(S[1]==S[3] ) ++C;
   if(S[2]==S[3] ) ++C;
   if(C==2)
   {
       printf ("Yes");
   }
   else
    printf("No");
   return 0;
}





Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
bitset<4000005>b;int n,a,s,t;
int main()
{
    scanf("%d",&n);for(int i=1;i<=n;i++) scanf("%d",&a),s+=a,b|=b<<a,b[a]=1;
    for(int i=1;i<=s;i++) if(b[i]&&i>=(s+1)/2) return !printf("%d\n",i);
}

Measured memory_bytes: 1664
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;

int N;

int Q(int ans) {
	string S;
	cout << ans << endl;
	cin >> S;
	if (S[0] == 'V')return -1;
	else return S[0] == 'M' ? 1 : 0;
}


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

	cin >> N;
	int L = 0, R = N - 1, F = Q(0);
	if (F == -1)return 0;
	while (L <= R) {

		int M = (L + R) / 2;
		int P = Q(M);
		if (P == -1)return 0;
		if (P == F) {
			if (M % 2)R = M - 1;
			else L = M + 1;
		}
		else {
			if (M % 2)L = M + 1;
			else R = M - 1;
		}
	}


	return 0;
}



Measured memory_bytes: 852
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector> 
#include<utility>
using namespace std;
#define INF 0x3f3f3f3f
#define ft first
#define sd second
#define MAX 1000*2+16 
vector<int> arr[MAX];
int x[MAX],vis[MAX];
int dist[105][105];
int N,M,L;
void floyd()
{
	int k,i,j;
	for(i=0;i<N;i++)
		dist[i][i]=0;
	for(k=0;k<N;k++)
		for(i=0;i<N;i++)
			for(j=0;j<N;j++)
				dist[i][j]=min(dist[i][j],dist[i][k]+dist[k][j]);				
}

int dfs(int v)
{
	vis[v]=1;
	for(int i=0;i<arr[v].size();i++)
	{
		int m=arr[v][i];
		int w=x[m];
		if(w<0||(!vis[w]&&dfs(w)))
		{
			x[v]=m;
			x[m]=v;
			return 1;
		}	
	}
	return 0;
}
int V;
int solve()
{
	int ans=0;
	memset(x,-1,sizeof(x));
	for(int i=0;i<V;i++)
	{
		if(x[i]<0)
		{
			memset(vis,0,sizeof(vis));
			ans+=dfs(i);
		}
	}
	return ans;
}
void add(int u,int v)
{
	arr[u].push_back(v);
	arr[v].push_back(u);
}
int p[1050],t[1050]; 
int main()
{
	while(scanf("%d%d%d",&N,&M,&L)!=EOF&&N)
	{
		V=L*2;
		memset(dist,INF,sizeof(dist));
		int i,m1,m2,m3;
		for(i=0;i<M;i++)
		{
			scanf("%d%d%d",&m1,&m2,&m3);
			dist[m1][m2]=dist[m2][m1]=m3;
		}
		floyd();
		for(i=0;i<L;i++)
		{
			scanf("%d%d",&m1,&m2);
			p[i]=m1;
			t[i]=m2;
		}
		for(i=0;i<L;i++)
		{
			for(int j=0;j<L;j++)
			{
				if(i!=j&&dist[p[i]][p[j]]+t[i]<=t[j])
				{
					add(i*2,2*j+1);
				}
			}
		}
		printf("%d\n",L-solve());
		for(i=0;i<V;i++)arr[i].clear();
	}
	return 0;
}


Measured memory_bytes: 11136
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>

using namespace std;

#define REP(i,n) for(int i=0;i<int(n);i++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
typedef long long ll;
typedef pair<int,int> P;

int main(void){
	          int i;

	          cin.tie(0);  ios_base::sync_with_stdio(false);

	          int N,A,B;
	          cin >> N >> A >> B;
	          cout <<  min(A,B) << ' ' << max(0,A+B-N) << endl;

	          return 0;
}


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

int main() {
  string S;
  cin>>S;
  int a=0;
  if(S.at(0)=='1'){
    a++;
  }
  if(S.at(1)=='1'){
    a++;
  }
  if(S.at(2)=='1'){
    a++;
  }
  cout<<a<< endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int                 long long   
#define double              long double
#define endl                "\n"
#define pb                  push_back
#define PI                  3.1415926535897932384626433832795l
#define F                   first
#define S                   second
#define mp                  make_pair
#define f(i,n)              for(int i=0;i<n;++i)
#define loop(i,a,b)         for (int i=a ; i<b ;++i)
#define fastio              ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v)              (v).begin(),(v).end()
#define rall(v)             (v).rbegin(),(v).rend()
#define gcd(a,b)            __gcd((a),(b))
#define fill(a,value)       memset(a,value,sizeof(a));
#define minn(v)             *min_element(v.begin(), v.end());
#define maxx(v)             *max_element(v.begin(), v.end());
#define print(x)            cout<<(x)<<endl;
typedef pair<int,int> pii;  
typedef vector<int> vi;
signed main() 
{
    fastio;
    int n;
    cin>>n;
    print((n-2)*180)
    return 0;
    
    
}

Measured memory_bytes: 3628
#include <stdio.h>
#include <string.h>

int main(){
  char str[100];

  scanf("%s", str);

  int cnt =0;
  int i = 0;

  cnt = strlen(str);

  int down = cnt - 1;
  int up = 0;
  int result = 0;
  while(down - up > 0){
    if(str[up] != str[down]){
      result++;
    }
    up++;
    down--;
  }

  printf("%d\n", result);

  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll N, K; cin >> N >> K;
  vector<ll> H(N, 0);
  for(auto &i : H) cin >> i;
  sort(H.begin(), H.end(), greater<ll>());
  ll ans = 0;
  for(ll i = K; i < N; i++){
    ans += H[i];
  }
  cout << ans << endl;
}

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

int main(){
    string s;
    long long k;
    char ans;
    cin >> s >> k;
    for (int i = 0; i < s.size(); i++) {
        k -= pow((s[i] - '0'), 500000000000000);
        if (k <= 0) {
            ans = s[i];
            break;
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int N; cin >> N;
	int last = 0;
	for (int i = 0; i < N; i++) {
		int v; cin >> v;
		int nv = max(last, v-1);
		if (nv <= v) {
			last = nv;
		} else {
			cout << "No\n";
			exit(0);
		}
	}
	cout << "Yes\n";

	return 0;
}


Measured memory_bytes: 256
///Bismillahir-Rahmanir-Rahim
#include <bits/stdc++.h>
#define        ll                              long long int
#define        FOR(x,y,z)                      for(int x=y;x<z;x++)
#define        pii                             pair<int,int>
#define        pll                             pair<ll,ll>
#define        CLR(a)                          memset(a,0,sizeof(a))
#define        SET(a)                          memset(a,-1,sizeof(a))
#define        N                               1000010
#define        M                               1000000007
#define        pi                              acos(-1.0)
#define        ff                              first
#define        ss                              second
#define        pb                              push_back
#define        inf                              (1e9)+1000
#define        eps                             1e-9
#define        ALL(x)                          x.begin(),x.end()
using namespace std;
int dx[]={0,0,1,-1,-1,-1,1,1};
int dy[]={1,-1,0,0,-1,1,1,-1};
template < class T> inline T biton(T n,T pos){return n |((T)1<<pos);}
template < class T> inline T bitoff(T n,T pos){return n & ~((T)1<<pos);}
template < class T> inline T ison(T n,T pos){return (bool)(n & ((T)1<<pos));}
template < class T> inline T gcd(T a, T b){while(b){a%=b;swap(a,b);}return a;}
template <typename T> string NumberToString ( T Number ) { ostringstream ss; ss << Number; return ss.str(); }
inline int nxt(){int aaa;scanf("%d",&aaa);return aaa;}
inline ll lxt(){ll aaa;scanf("%lld",&aaa);return aaa;}
inline double dxt(){double aaa;scanf("%lf",&aaa);return aaa;}
template <class T> inline T bigmod(T p,T e,T m){T ret = 1;
for(; e > 0; e >>= 1){
    if(e & 1) ret = (ret * p) % m;p = (p * p) % m;
} return (T)ret;}
#ifdef sayed
     #define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template < typename Arg1 >
    void __f(const char* name, Arg1&& arg1){
        cerr << name << " is " << arg1 << std::endl;
    }
    template < typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names+1, ',');
        cerr.write(names, comma - names) << " is " << arg1 <<" | ";
        __f(comma+1, args...);
    }
#else
    #define debug(...)
#endif
///******************************************START******************************************
int ar[N];
bool isOk(ll n,ll i) {
    if(i==0) return false;
    if((n%i)==(n/i)) return true;
    return false;
}
int main(){
    #ifdef sayed
    //freopen("out.txt","w",stdout);
    // freopen("in.txt","r",stdin);
    #endif
    //ios_base::sync_with_stdio(false);
    //cin.tie(0);
    ll n = lxt();
    ll sum = 0;
    for(ll i = 1;i*i<=n;i++) {
        if(n%i==0) {
            if(isOk(n,i-1)) sum+=i-1;
            if(i*i!=n) {
                ll u = n/i;
                if(isOk(n,u-1)) sum+=(u-1);
            }

        }
    }

    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 256
/*
     Author:Raghav Bansal
     IIIT Una
                  */
#include <bits/stdc++.h>
#define int long long int
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define BOLT ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define X first
#define Y second
#define endl "\n"
using namespace std;
const int N = 2e5 + 1;
int dp[N][4];
int vis[N][4];
vector<int> v;
int n;
int dfs(int x, int state) {
	if (x <= 0)
		return 0;
	if (vis[x][state])
		return dp[x][state];
	vis[x][state] = 1;
	int &an = dp[x][state];
	if (state == 0) {
		an = v[x] + max({dfs(x - 2, 0), dfs(x - 3, 1), dfs(x - 4, 2)});
	} else if (state == 1) {
		an = v[x] + max(dfs(x - 2, 1), dfs(x - 3, 2));
	} else {
		an = v[x] + dfs(x - 2, 2);
	}
	return an;
}
void solve() {
	cin >> n;
	v.pb(0);
	for (int i = 1; i <= n; i++) {
		int x;
		cin >> x;
		v.pb(x);
	}
	if (n & 1) {
		cout << max({dfs(n, 0), dfs(n - 1, 1), dfs(n - 2, 2)}) << endl;
	} else {
		cout << max({dfs(n, 1), dfs(n - 1, 2)}) << endl;
	}
}
int32_t main() {
	BOLT;
	int t;
	t = 1;
	while (t--)
	{
		solve();
	}
}

Measured memory_bytes: 21988
import bisect
n = int(input())

ls = list(map(int,input().split()))

ls.sort()
count = 0
for i in range(n):
    for j in range(i + 1,n):
        t = ls[i] + ls[j]
        index = bisect.bisect_left(ls,t)
        count += max(0,index - j - 1)

print(count)


Measured memory_bytes: 3316
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
const int N=25,M=45,K=195,E=6,G=(1<<19)+5,md=1000000007,INF=0x3f3f3f3f;
int n,m;
int u[K],v[K],fr[N],nxt[M],em[M],fac[K],facn[K],nyc[K],f[2][G],g[G],h[2][G],fe[G],faw[N];
int dep[N],fa[E][N];
vector<int>dir[G];
inline void addedge(int u,int v,int i)
{
	nxt[i]=fr[u];
	fr[u]=i;
	em[i]=v;
}
void dfs0(int d)
{
	for(int j=fr[d];j!=0;j=nxt[j])
		if(em[j]!=fa[0][d])
		{
			fa[0][em[j]]=d;
			dep[em[j]]=dep[d]+1;
			faw[em[j]]=j>>1;
			dfs0(em[j]);
		}
}
inline int pow_fa(int a,int b)
{
	int i=0;
	while(b>0)
	{
		if(b&1)
			a=fa[i][a];
		i++;
		b>>=1;
	}
	return a;
}
inline int lca(int a,int b)
{
	if(dep[a]<dep[b])
		swap(a,b);
	a=pow_fa(a,dep[a]-dep[b]);
	for(int i=4;i>=0;i--)
		if(fa[i][a]!=fa[i][b])
		{
			a=fa[i][a];
			b=fa[i][b];
		}
	if(a==b)
		return a;
	else
		return fa[0][a];
}
int main()
{
	scanf("%d%d",&n,&m);
	fac[0]=facn[0]=fac[1]=facn[1]=nyc[1]=1;
	for(int i=2;i<=m;i++)
	{
		fac[i]=(ll)fac[i-1]*i%md;
		nyc[i]=(ll)(md-md/i)*nyc[md%i]%md;
		facn[i]=(ll)facn[i-1]*nyc[i]%md;
	}
	if(m==n-1)
	{
		int ans=(ll)(n-1)*m*(m+1)/2%md*fac[n-2]%md;
		printf("%d\n",ans);
		return 0;
	}
	for(int i=1;i<=m;i++)
	{
		scanf("%d%d",&u[i],&v[i]);
		if(i<n)
		{
			addedge(u[i],v[i],i*2);
			addedge(v[i],u[i],i*2+1);
		}
	}
	dfs0(1);
	for(int i=1;(1<<i)<=n;i++)
		for(int j=1;j<=n;j++)
			fa[i][j]=fa[i-1][fa[i-1][j]];
	for(int s=0;s<(1<<n-1);s++)
		for(int i=1;i<n;i++)
			if(s&(1<<i-1))
				fe[s]++;
			else
				dir[s].push_back(i);
	for(int i=n;i<=m;i++)
	{
		int s=0;
		int e=lca(u[i],v[i]);
		int x=u[i];
		while(x!=e)
		{
			s|=1<<faw[x]-1;
			x=fa[0][x];
		}
		x=v[i];
		while(x!=e)
		{
			s|=1<<faw[x]-1;
			x=fa[0][x];
		}
		g[s]++;
	}
	for(int i=1;i<n;i++)
		for(int j=0;j<(1<<n-1);j++)
			if(j&(1<<i-1))
				g[j]+=g[j^(1<<i-1)];
	int now=1,la=0;
	h[0][0]=1;
	for(register int i=1;i<=m;i++)
	{
		for(register int s=0;s<(1<<n-1);s++)
		{
			if(h[la][s]==0)
				continue;
			if(fe[s]+g[s]>=i)
			{
				f[now][s]=(f[now][s]+(ll)f[la][s]*(fe[s]+g[s]-i+1)%md)%md;
				h[now][s]=(h[now][s]+(ll)h[la][s]*(fe[s]+g[s]-i+1)%md)%md;
			}
			for(register auto j:dir[s])
			{
				f[now][s|(1<<j-1)]=((ll)f[now][s|(1<<j-1)]+f[la][s]+(ll)i*h[la][s]%md)%md;
				h[now][s|(1<<j-1)]=(h[now][s|(1<<j-1)]+h[la][s])%md;
			}
			f[la][s]=h[la][s]=0;
		}
		now^=1;
		la^=1;
	}
	printf("%d\n",f[la][(1<<n-1)-1]);
	return 0;
}

Measured memory_bytes: 60544