akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b)for(int i=(a);i<=(b);i++)
#define repR(i,n) for(int i=n;i>=0;i--)
#define P pair<int, int>
#define sz(x) x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<int>
#define COUT(x) cout<<(x)<<endl
#define MA map<int,int>
#define SE set<int>
#define PQ priority_queue<int>
#define PQR priority_queue<int,VE,greater<int>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl

template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
	if (a.second != b.second) {
		return a.second < b.second;
	}
	else {
		return a.first < b.first;
	}
}
const long long MOD = 1000000007;
const long long INF = 1LL << 50;
// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))


signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	VE xs(n), ys(n);
	rep(i, n)cin >> xs[i] >> ys[i];
	double ans = 0;
	rep(i, n) {
		int gx = xs[i]; int gy = ys[i];
		rep(k, 4) {
			int nx = -gy; int ny = gx;
			gx = nx; gy = ny;
			int sx = 0, sy = 0;
			int px = 0, py = 0;
			int qx = 0, qy = 0;
			auto dot = [&](int x1, int y1, int x2, int y2) {
				return x1 * x2 + y1 * y2;
			};
			auto cross = [&](int x1, int y1, int x2, int y2) {
				return x1 * y2 - x2 * y1;
			};
			rep(j, n) {
				int res = dot(xs[j], ys[j], gx, gy);
				if (res < 0)continue;
				if (res > 0) {
					sx += xs[j]; sy += ys[j];
					continue;
				}
				if (cross(xs[j], ys[j], gx, gy) > 0) {
					px += xs[j]; py += ys[j];
				}
				else {
					qx += xs[j]; qy += ys[j];
				}
			}
			rep(t, 4) {
				double bx = sx, by = sy;
				if (t & 1)bx += px, by += py;
				if (t & 2)bx += qx, by += qy;
				chmax(ans, bx*bx + by * by);
			}
		}
		
	}
	cout << fixed << setprecision(15) << sqrt(ans) << endl;
	return 0;
}

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

n = s
i = 0
p = []
while True:
    i = i+1
    if i == 1:
        n = s
    elif n % 2 == 0:
        n = n/2
    else:
        n = n*3 + 1

    p.append(n)
    if len(set(p)) != len(p):
        print(i)
        break

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

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

	for (int i = n; i > 0; i--) {

		for (int j = 1; j*j <= n; j++) {

			if (j*j == i) {
				cout << i << endl;
				return 0;
			}
          
		}

	}			
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#include <bitset>
using namespace std;

typedef long long ll;
const ll INF = 1000000000;
const ll MOD = 1000000000 + 7;
const ll MAX_N = 100 + 2;
const ll MAX_W = 100000 + 2;
ll dp[MAX_N][MAX_W];
ll v[MAX_N];
ll w[MAX_N];

ll rec(ll i, ll j) {

  if (dp[i][j] != -1) return dp[i][j];
  if (i == 0) return dp[i][j] = 0;
  
  if (j - w[i] >= 0) dp[i][j] = max(rec(i - 1, j), rec(i - 1, j - w[i]) + v[i]);
  else dp[i][j] = rec(i - 1, j);
  return dp[i][j];
}

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

  ll N, W;
  cin >> N >> W;
  for (ll i = 1; i <= N; i++) cin >> w[i] >> v[i];

  memset(dp, -1, sizeof(dp));

  ll ans = rec(N, W);  
  for (ll j = 0; j <= W; j++) ans = max(ans, dp[N][j]);
  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 82864
#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
vector<int>a[310],b[310];
int f[310][310][310];
inline int read()
{
	int x=0,f=1;char ch=getchar();
	for(;ch<'0'||ch>'9';ch=getchar())if(ch=='-')f=-1;
	for(;ch>='0'&&ch<='9';x=(x<<1)+(x<<3)+ch-'0',ch=getchar());
	return x*f;
}
bool check(int r,int g,int bl)
{
	int i=max(max(r,g),bl),siz=a[i].size();
	for(int j=0;j<siz;j++)
	{
		int l=a[i][j],x=b[i][j];
		if(x!=((r>=l)+(g>=l)+(bl>=l)))return 0;
	}
	return 1;
}
int main()
{
	int n=read(),m=read(),l,r,x,ans=0;
	for(int i=1;i<=m;i++)
	{
		l=read(),r=read(),x=read();
		a[r].push_back(l),b[r].push_back(x);
	}
	f[0][0][0]=1;
	for(int r=0;r<=n;r++)
		for(int g=0;g<=n;g++)if(!g||g!=r)
			for(int b=0;b<=n;b++)if(!b||(b!=g&&b!=r))
			{
				if(!check(r,g,b))
				{
					f[r][g][b]=0;
					continue;
				}
				int i=max(max(r,g),b);
				if(i==n)
					ans=(ans+f[r][g][b])%mod;
				else
				{
					f[i+1][g][b]=(f[i+1][g][b]+f[r][g][b])%mod;
					f[r][i+1][b]=(f[r][i+1][b]+f[r][g][b])%mod;
					f[r][g][i+1]=(f[r][g][i+1]+f[r][g][b])%mod;
				}
			}
	printf("%d\n",ans);
	return 0;
}

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

using namespace std;
typedef long long ll;

int main(void) {
  int n, m, k;
  cin >> n >> m >> k;

  vector<ll> a(n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }

  vector<ll> dp(n + 1, 1e18);
  dp[0] = 0;
  for (int i = 1; i <= n; i++) {
    ll maxa = a[i], mina = a[i];
    for (int j = 1; j <= min(m, i); j++) {
      maxa = max(maxa, a[i - j + 1]);
      mina = min(mina, a[i - j + 1]);
      dp[i] = min(dp[i], dp[i - j] + k + j * (maxa - mina));
    }
  }

  cout << dp[n] << endl;

  return 0;
}


Measured memory_bytes: 3124
/*****************************************************
 				*	Logged in : HABIBUR RAHMAN						 *
				*	Dept	  : COMPUTER SCIENCE AND ENGINEERING	 *
				*													 *
				*	KHULNA UNIVERSITY OF ENGINEERING AND TECHNOLOGY  *
				******************************************************/


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<string> vs;
typedef pair<ll,ll> pll;
#define fast_io 			ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define all(v) 				v.begin(),v.end()
#define allr(v) 			v.rbegin(),v.rend()
#define rep(i,a,b) 			for(ll i=a;i<=b;i++)
#define rep0(i,n)			for(ll i=0;i<n;i++)
#define rrep0(i, n) 		for(ll i=(ll)(n);i>0;--i)
#define rrep(i, a, b) 		for(ll i=(ll)(a);i>=(ll)(b);--i)
#define pb(z) 				push_back(z)
#define ff					/first
#define ss 					second
#define caset 				int t;cin>>t;for(int tt=1;tt<=t;tt++)
#define sz(X) 				((ll)(X).size())
#define scan(X) 			scanf("%s", (X))
#define ms(v,val)			memset((v),(val),sizeof((v)))
#define ms0(X) 				memset((X), 0, sizeof((X)))
#define ms1(X) 				memset((X), -1, sizeof((X)))
#define m_p(a,b)            make_pair(a,b)
#define get_pos(c,x) 		(lower_bound(c.begin(),c.end(),x)-c.begin())
#define lcm(a,b)            (a*b)/__gcd(a,b)
#define INF9                1000000010
#define INF18               4000000000000000010
#define bpll(a)             __builtin_popcountll(a)
#define sqr(a)              ((a)*(a))
#define nl					"\n"
#define mod					1e9+7;
#define mx_el(v)			*max_element(all(v));
#define mn_el(v)			*min_element(all(v));
#define pcase(z,x)    		cout<<"Case "<<z<<": "<<x<<"\n"
const double pi = 2*acos(0) ;
#define display(v)			vi :: iterator it;for(it=(v).begin();it!=(v).end();it++){cout << *it << " " ;}cout << endl;
#define taking(n,v) 		for(ll i=0;i<(n);i++){ll inp;cin>>inp;(v).push_back(inp);}

void start(){
      #ifndef ONLINE_JUDGE 
      freopen("input.txt" , "r" , stdin) ;
      freopen("output.txt" , "w" , stdout) ;
      #endif
}

void solve()
{
 	ld w,h,x,y;cin>>w>>h>>x>>y;
 	cout << setprecision(10) << (w*h)/2.0 << " ";
 	w/=2,h/=2;
 	cout << (w==x&&h==y?"1":"0") << nl;
}

int main(){
	fast_io
	//start();
    //caset{
    	//cout << "Case " << tt << ": ";

		  solve();
	//}
	
	return 0;
}


Measured memory_bytes: 3768
import collections
n,ais = int(raw_input()), map(int, raw_input().split())
cc = collections.Counter()
for ai in ais:
	if ai % 4 == 0: cc[0] += 1
	elif ai % 2 == 0: cc[1] += 1
	else: cc[2] += 1

q,h = collections.deque([0]), [[2,1,0],[1],[0]] 
while(n):
	b = False
	for u in h[q[-1]] + [-1]:
		if u == -1: b = True
		if cc[u] > 0:
			q.append(u)
			
			cc[u] -=1
			n -=1
			break
	if b: break

print 'Yes' if n == 0 else 'No'

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

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

int main() {
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  ll cd = lcm(c, d);
  ll cnt_ac = (a - 1) / c;
  ll cnt_ad = (a - 1) / d;
  ll cnt_acd = (a - 1) / cd;
  ll cnt_bc = b / c;
  ll cnt_bd = b / d;
  ll cnt_bcd = b / cd;

  ll ans_b = b - cnt_bc - cnt_bd + cnt_bcd;
  ll ans_a = a - 1 - cnt_ac - cnt_ad + cnt_acd;
  cout << ans_b - ans_a << endl;

  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int a[10][10];

int main(){
	int n;
	scanf("%d",&n);
	
	int t=10;
	for(int i=1;i<=n;i++){
		if(t<=i) t*=10; 
		a[i/(t/10)][i%10]++;
	}
	
	long long int ans=0;
	
	for(int i=1;i<10;i++){
		for(int j=1;j<10;j++){
			ans+=a[i][j] * a[j][i];
		}
	}
	
	printf("%lld", ans);
	return 0;
}

Measured memory_bytes: 128
/// kazuki08
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
//#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
    return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
    o<<"{";
    for(const T& v:vc) o<<v<<",";
    o<<"}";
    return o;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);

  int n;
  cin >> n;
  if(n%2){
    cout << 2*n << endl;
  }
  else {
    cout << n << endl;
  }

return 0;
}
///....


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a,b;
int main(){
	scanf("%d%d",&a,&b);
	for(int i=0;i<=100;i++){
		if(a*i>=b+i-1){
			cout<<i<<endl;
			return 0;
		}
	}
	return 0;
}


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

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

  ll D; cin >> D;
  vector<ll> C(26); for (ll i = 0; i < 26; i++) cin >> C[i];
  vector<vector<ll>> S(365, vector<ll>(26, 0));
  for (ll i = 0; i < 365; i++) {
    for (ll j = 0; j < 26; j++) {
      cin >> S[i][j];
    }
  }
  for (ll i = 0; i < 365; i++) {
    ll ans = rand() % 26 + 1;
    cout << ans << '\n';
  }

  return 0;
}

Measured memory_bytes: 3736
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
#include <set>
#include <assert.h>
#include <sstream>
#include <string>
//#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 <>())
#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> P;
 #include <boost/multiprecision/cpp_int.hpp>

using bint = boost::multiprecision::cpp_int;
 
 


int main(){
    ll n;
    cin >> n;
    if (n%2 == 1) {cout << 0; rn 0;}
    ll ans = 0;
    int power = 1;
    while((ll)pow(5,power) <= n){
        ans += (n/(ll)pow(5,power))/2;
        power++;
    }
    cout << ans;
}






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

using namespace std;

#define INF 1000007
#define MOD 1000000007
#define int long long int
#define maxn 100
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)

int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}

int lcm(int a, int b) { return a / gcd(a, b) * b; }

int mpow(int N, int P, int M)  //繰り返し自乗法
{
    if (P == 0)
        return 1;
    if (P % 2 == 0) {
        int t = mpow(N, P / 2, M);
        return t * t % M;
    }
    return N * mpow(N, P - 1, M) % M;
}

int counter(int x) {           //bit計算
    if (x == 0) return 0;
    return counter(x >> 1) + (x & 1);
}

vector<bool> prime(maxn + 1, true); //素数テーブル
void prime_table(void) {
    prime[0] = false;
    prime[1] = false;
    for (int i = 2; i * i <= maxn; i++) {
        if (!prime[i]) {
            continue;
        }
        for (int j = i + i; j <= maxn; j += j + i) {
            prime[j] = false;
        }
    }
}

bool IsPrime(int num) {   //素数判定
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2) {
        if (num % i == 0) {
            return false;
        }
    }

    return true;
}

int H, W, K;
int ans[301][301];
int c[301];

int fl(int x, int y) {
    if (y > H) return 0;
    if (ans[y][x] == 0) {
        ans[y][x] = fl(x, y + 1);
    }
    return ans[y][x];
}

int fl2(int x, int y) {
    if(y < 0) return 0;
    if (ans[y][x] == 0) {
        ans[y][x] = fl2(x, y - 1);
    }
    return ans[y][x];
}

signed main() {
    cin >> H >> W >> K;
    string s[H];
    rep(i, H) {
        rep(j, W) {
            ans[i][j] = 0;
        }
    }
    rep(i, H) {
        c[i] = 0;
    }
    rep(i, H) {
        cin >> s[i];
        rep(j, W) {
            if (s[i][j] == '#') {
                c[i]++;
            }
        }
    }
    int start = 0;
    int now = 0;
    for (int i = 0; i < H; i++) {
        if (c[i] == 0) {
            continue;
        }
        int count = 0;
        now++;
        for (int j = 0; j < W; j++) {
            ans[i][j] = now;
            if (s[i][j] == '#') {
                count++;
                if (count < c[i]) {
                    now++;
                }
            }
        }
    }

    for (int i = 0; i < H - 1; i++) {
        if (c[i] == 0) {
            for (int j = 0; j < W; j++) {
                fl(j, i);
            }
        }
    }
    if (c[H - 1] == 0)
        rep(i, W) {
            ans[H - 1][i] = ans[H - 2][i];
        }

    for (int i = H - 1; i > 0; i--) {
        if (c[i] == 0) {
            for (int j = 0; j < W; j++) {
                fl2(j, i);
            }
        }
    }
    if (ans[0][0] == 0)
        rep(i, W) {
            ans[0][i] = ans[1][i];
        }
    rep(i, H) {
        rep(j, W) {
            cout << ans[i][j] << " ";
        }
        cout << endl;
    }
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
  
#define FOR(i,a,b) for( ll i = (a); i < (ll)(b); i++ )
#define REP(i,n) FOR(i,0,n)
#define YYS(x,arr) for(auto& x:arr)
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort( (x).begin(),(x).end() )
#define REVERSE(x) reverse( (x).begin(),(x).end() )
#define UNIQUE(x) (x).erase( unique( ALL( (x) ) ) , (x).end() )
#define PW(x) (1LL<<(x))
#define SZ(x) ((ll)(x).size())
#define SHOW(x) cout << #x << " = " << x << endl
 
#define pb emplace_back
#define fi first
#define se second

using namespace std;
 
typedef long double ld;
typedef long long int ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<vpl> gr;
typedef vector<vl> ml;
typedef vector<vd> md;
typedef vector<vi> mi;
 
const ll INF = (ll)1e9 + 10;
const ll INFLL = (ll)1e18 + 10;
const ld EPS = 1e-8;
const ll MOD = 1e9+7;

template<class T> T &chmin( T &a , const T &b ){ return a = min(a,b); }
template<class T> T &chmax( T &a , const T &b ){ return a = max(a,b); }
template<class T> inline T sq( T a ){ return a * a; }
ll in(){ ll x; scanf( "%lld" , &x ); return x; }
 
// head

int h, w;
string s;

int main(){

  h = in();
  w = in();
  REP( i , h ){
    REP( j , w ){
      cin >> s;
      if( s == "snuke" ){
	cout << (char)('A' + j) << i+1 << endl;
	return 0;
      }
    }
  }

  return 0;
}


Measured memory_bytes: 764
#include <iostream>
#include <vector>
#include <algorithm>

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

int main() {
    int X, Y, Z, K;
    cin >> X >> Y >> Z >> K;
    vector<ll> A(X), B(Y), C(Z);
    rep(i, X) cin >> A[i];
    rep(i, Y) cin >> B[i];
    rep(i, Z) cin >> C[i];

    sort(A.rbegin(), A.rend());
    sort(B.rbegin(), B.rend());
    sort(C.rbegin(), C.rend());

    vector<ll> ABC;
    rep(a, X) 
        rep(b, Y) {
            if ((a + 1) * (b + 1) > K) break;
            rep(c, Z) {
                if ((a + 1) * (b + 1) * (c + 1) > K) break;
                ABC.push_back(A[a] + B[b] + C[c]);
            }
    }
    sort(ABC.rbegin(), ABC.rend());

    rep(i, K) cout << ABC[i] << endl;
    
    return 0;
}

Measured memory_bytes: 3920
#include<iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<map>
#include<set>
#include<iomanip>

using namespace std;
using ll = long long;

const int MOD = 1e9 + 7;
const int MAX = 1e9;
const ll LLMAX = 1e18;
const int INF = numeric_limits<int>::max();
const ll LLINF = numeric_limits<ll>::max();
const double PI = acos(-1.0);

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, a, n) for (int i = a; i <= (n); ++i)

int main() {
    vector<int> ix = {1, 2, 3, 4, 5};
    vector<int> x(5); rep(i, 5) cin >> x[i];
    
    rep(i, 5) {
        if (ix[i] != x[i]) {
            cout << ix[i] << endl;
            return 0;
        }
    }
}


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

string to_string(string s) { return '"' + s + '"'; }
string to_string(char c) { string s = "'"; s += c; return s + "'"; }
string to_string(const char* s) { return to_string((string) s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; } 
template <typename A>
string to_string(A v) {
    bool first = true; 
    string res = "{";
    for (const auto &x : v) {
        if (!first) res += ", ";
        first = false;
        res += to_string(x);
    }
    res += "}"; 
    return res;
}
istream_iterator<string> eos;
void dbg_out(istream_iterator<string> it) { cerr << endl; }
template <typename Head, typename... Tail>
void dbg_out(istream_iterator<string> it, Head H, Tail... T) {
    cerr << *it << " = " << to_string(H);
    if(++it != eos) cerr << ", ";
    dbg_out(it, T...);
}
#ifdef LOCAL
    #define dbg(...) { string _s = #__VA_ARGS__; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); dbg_out(_it, __VA_ARGS__); }
#else
    #define dbg(...)
#endif

#define int long long
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define ff first
#define ss second
#define MP make_pair
#define sz(v) ((int)(v).size())
#define fr(i, j, k) for(int i = j; i < k; i++)
#define nl "\n"
typedef pair<int, int> pii;
typedef vector <int> vi;

pii dir[8] = { {-1, 0}, {1, 0}, {0, -1}, {0, 1}, {1, 1}, {-1, -1} , {-1, 1}, {1, -1} };

const int inf = (1LL << 60), mod = 1e9+7, nn = 2e5+5;

void solve(){
    string s;
    cin >> s;
    int n = sz(s);
    fr(i, 0, n) {
        if(s[i] == '?') {
            if(i-1 >= 0 && s[i-1] == 'P') s[i] = 'D';
            else if(i+1 < n && (s[i+1] == '?' || s[i+1] == 'D')) s[i] = 'P';
            else s[i] = 'D';
        }
    }
    cout << s << nl;
}

int32_t main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int T = 1;
    // cin >> T;
    for(int tc = 1; tc <= T; tc++){
        // cout << "Case #" << tc << ": ";
        solve();
    }
    return 0;
}

Measured memory_bytes: 3744
using System;
using System.Collections.Generic;

namespace ABC115_C_Christmas_Eve
{
	internal class Program
	{
		public static void Main(string[] args)
		{
			string[] input = Console.ReadLine().Split(' ');
			int n = int.Parse(input[0]);
			int k = int.Parse(input[1]);
			
			List<int> hList = new List<int>(n);
			for(int i = 0; i < n; i++)
				hList.Add(int.Parse(Console.ReadLine()));
			
			hList.Sort();
			int hMin = hList[0];
			int hMax = hList[k - 1];
			for (int i = 0; i < n - k + 1; i++)
			{
				if (hList[i] == hList[i + k - 1])
				{
					hMin = hList[i];
					hMax = hList[i];
					break;
				}
				if (hList[i + k - 1] - hList[i] < hMax - hMin)
				{
					hMin = hList[i];
					hMax = hList[i + k - 1];
				}
			}
			
			Console.WriteLine(hMax - hMin);
		}
	}
}


Measured memory_bytes: 15452
#include <iostream>
using namespace std;
 
int main()
{
  string S;
  
  cin >> S;
  int N = S.size();
 
  int N1 = N;
  int N2 = (N - 1)/2;
  int N3start = (N + 3)/2;
 
  // 条件１
  for(int i = 0; i < (N1 - 1)/2; ++i)
  {
    if(S[i] != S[N-1-i])
    {
      cout << "No" << endl;
      return 0;
    }
  }
  
  // 条件2
  string S2 = S.substr(0, N2);
  for(int i = 0; i < N2/2; ++i)
  {
    if(S2[i] != S2[N2-1-i])
    {
      cout << "No" << endl;
      return 0;
    }
  }
  
  // 条件3
  string S3 = S.substr(N3start - 1);
  int N3 = S3.size();
  for(int i = 0; i < N3/2; ++i)
  {
    if(S3[i] != S3[N3-1-i])
    {
      cout << "No" << endl;
      return 0;
    }
  }
 
  cout << "Yes" << endl;
 
  return 0;
}


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

Measured memory_bytes: 5172
#include <bits/stdc++.h>
#include <cstring>
#include <iostream>
#include <algorithm>
#define EPS 1.0e-9
#define PI acos(-1.0)
#define INF 30000000
#define MOD 1000000009
#define mem(a,b) memset((a),b,sizeof(a))
#define TS printf("!!!\n")
#define pb push_back
#define pai pair<int,int>
//using ll = long long;
//using ull= unsigned long long;
//std::ios::sync_with_stdio(false);
using namespace std;
//priority_queue<int,vector<int>,greater<int>> que; 
typedef long long ll;
typedef unsigned long long ull;
const int MAXN=1e5+5;
int a[MAXN];
int main()
{
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	int n,k,g=0;
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		g=__gcd(g,a[i]);
	}
	for(int i=1;i<=n;i++)
	{
		if(a[i]>=k&&(a[i]-k)%g==0)
			return 0*puts("POSSIBLE");
	}
	return 0*puts("IMPOSSIBLE");
	return 0;
}


Measured memory_bytes: 640
#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<algorithm>
#include<deque>
#include<cstdio>

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int cm = 80100;
char cn[cm], * ci = cn, ct;
inline int getint() {
	int A = 0;
	while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}
inline int getint2() {
	int pn = 1;
	if ((ct = *ci++) == '-') { pn = -1; ct = *ci++; }
	int A = ct - '0';
	while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return pn * A;
}

ll dat[10200];
bool yatta[5000];
int P[5000], C[5000];

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


	fread(cn, 1, cm, stdin);

	int N = getint(), K = getint();
	rep(i, N) P[i] = getint() - 1;
	rep(i, N) C[i] = getint2();

	ll kotae = -2e18;
	rep(i, N) if (!yatta[i]) {
		int L = 0;
		auto kari = dat;
		kari[0] = 0;
		int j = i;
		while (!yatta[j]) {
			yatta[j] = 1;
			kari[L + 1] = kari[L] + C[j];
			L++;
			j = P[j];
		}
		ll hue = kari[L];
		for (int j = L + 1; j <= L + L; j++) {
			kari[j] = kari[j - L] + hue;
		}
		ll amari = K % L;
		ll wari = K / L;
		if (hue > 0) {
			if (amari > 0) {
				deque<int> dq;
				rep1(i, L + amari - 1) {
					while (dq.size() && kari[dq.back()] <= kari[i]) dq.pop_back();
					dq.push_back(i);
					if (i < amari) continue;
					while (dq.size() && dq.front() <= i - amari) dq.pop_front();
					chmax(kotae, hue * wari + kari[dq.front()] - kari[i - amari]);
				}
			}			
			if (wari > 0) {
				deque<int> dq;
				rep1(i, L + L - amari - 1) {
					while (dq.size() && kari[dq.back()] <= kari[i + amari]) dq.pop_back();
					dq.push_back(i + amari);
					if (i < L - amari) continue;
					while (dq.size() && dq.front() <= i + amari - L) dq.pop_front();
					chmax(kotae, hue * (wari - 1) + kari[dq.front()] - kari[i + amari - L]);
				}
			}
		}
		else {
			deque<int> dq;
			int are = min(K, L);
			rep1(i, L + are - 1) {
				while (dq.size() && kari[dq.back()] <= kari[i]) dq.pop_back();
				dq.push_back(i);
				if (i < are) continue;
				while (dq.size() && dq.front() <= i - are) dq.pop_front();
				chmax(kotae, kari[dq.front()] - kari[i - are]);
			}
		}
	}

	printf("%lld\n", kotae);


	Would you please return 0;
}

Measured memory_bytes: 3288
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <random>



using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)

















int main(){
    ll n, k;
    cin >> n >> k;
    vector<bool> f(10, true);
    REP(i, k){
        ll d;
        cin >> d;
        f[d] = false;
    }
    for(ll ans = n;; ans++){
        bool ok = true;
        for(ll tmp = ans; tmp > 0; tmp /= 10){
            if(!f[tmp % 10]){
                ok = false;
                break;
            }
        }
        if(ok){
            cout << ans << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
/*
ID:torchwr1
LANG:C++
TASK:
*/
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
char c[3][60];
long long a[3][60],b[60];
long long f[60];
int main()
{
	long long n;
	cin>>n;
	for(long long i=1;i<=2;i++)
	{
		for(long long j=1;j<=n;j++)
		{
			cin>>c[i][j];
		}
	}
	long long cnt=0;
	for(long long i=1;i<=2;i++)
	{
		for(long long j=1;j<=n;j++)
		{
			if(c[i][j]!=c[i][j-1]&&c[i][j]!=c[i][j+1])
			{
				if(i==1)
				{
					a[1][j]=a[2][j]=++cnt;
				}
			}
			else
			{
				if(c[i][j]==c[i][j+1])
				{
					a[i][j]=a[i][j+1]=++cnt;
				}
			}
		}
	}
	for(int i=1;i<=cnt;i++)
	{
		if(a[1][i]==a[2][i])
		{
			if(i==1) f[i]=3;
			else if(a[1][i-1]!=a[2][i-1])
			{
				f[i]=f[i-1];
			}
			else if(a[1][i-1]==a[2][i-1])
			{
				f[i]=f[i-1]*2;
			}
		}
		else
		{
			if(i==1) f[i]=6;
			else
			{
				if(a[1][i]==a[1][i-1])
				{
					f[i]=f[i-1];
				}
				else
				{
					if(a[1][i-1]!=a[2][i-1])
					{
						f[i]=f[i-1]*3;
					}
					else if(a[1][i-1]==a[2][i-1])
					{
						f[i]=f[i-1]*2;
					}
				}
			}
		}
		f[i]%=1000000007;
	}
	/*for(int i=1;i<=2;i++)
	{
		for(int j=1;j<=n;j++) cout<<a[i][j];
		cout<<endl;
	}
	for(int i=1;i<=n;i++) cout<<f[i]<<endl;*/
	cout<<f[n];
	return 0;
}

Measured memory_bytes: 256
// STRIVER_79 
// Lets goto the next level 
// AIM 6* at CC and CM at CF *__* 

#include <algorithm>
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define mod (int)(1e9 + 7)
#define all(a) a.begin(),a.end()
#define for0(i, n) for (int i = 0; i < n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define bloop(i,a,b) for (int i = a ; i>=b;i--)
#define tc(t) int t; cin >> t; while (t--)
#define int long long
#define ll long long 
#define pb emplace_back
#define fio ios_base::sync_with_stdio(false), cin.tie(NULL)
#define in(x) scanf("%intd", &x)
#define rr return 0
#define prec(n) fixed<<setprecision(n)
#define maxheap priority_queue<int>
#define minheap priority_queue<int, vector<int>, greater<int> >
#define inf (int)(1e18)
#define ini(a, i) memset(a, i, sizeof(a))
#define fi first
#define se second
#define kitna se
#define endl "\n"
#define pi pair<int, int>
#define LL long long 
const int MAXN = (int)((1e5) + 10);
int gcd(int a,int b) { if (a == 0) return b; return gcd(b%a, a);}
int max(int a,int b){if(a>b) return a; else return b;}
int min(int a,int b){if(a<b) return a; else return b;}  
bool isPrime(int N){ for(int i=2;i*i<=N;++i){if(N%i==0) return false;}return true;}
int cbrt(int x){ int lo=1,hi=min(2000000ll,x);while(hi-lo>1){int mid=(lo+hi)/2;if(mid*mid*mid<x){lo=mid;}else hi=mid;}if(hi*hi*hi<=x) return hi;else return lo;} 
const int dx[4] = {-1, 1, 0, 0};
const int dy[4] = {0, 0, -1, 1};
const int nax =  (int)(1*1e5+10);

// int SPF[N+5];

// void SOF()
// {
//     SPF[1] = 1;
//     for (int i=2; i<N; i++)
//         SPF[i] = i;
//     for (int i=4; i<N; i+=2)
//         SPF[i] = 2;
 
//     for (int i=3; i*i<N; i++)
//         {
//         if (SPF[i] == i)
//             {
//             for (int kon=i*i; kon<N; kon+=i)
//                 if (SPF[kon]==kon)
//                    SPF[kon] = i;
//             }
//         }
// }
int n,m; 
int a[1002][1002]; 
int dp[1002][1002]; 

int func(int x, int y)
{
	if(x==(n-1) && y==(m-1))
		return 1;
	else if(x>=n || y>=m)
		return 0;
	else if(dp[x][y]!=-1) return dp[x][y];
	else if(a[x][y]==1) return 0; 
	else
	{
		dp[x][y] = (func(x+1,y) + func(x,y+1))%mod;
		return dp[x][y];
	}
}







signed main(){

int t=1; 
//cin >> t;
// string s; 
// getline(cin,s);

while(t--)
{
	ini(dp,-1); 
	cin >> n >> m;
	for0(i,n)
	{
		string s;
		cin >> s; 
		for0(j,m)
		{
			if(s[j]=='.') a[i][j] = 0;
			else a[i][j] = 1;
		}
	}

	cout << func(0,0)%mod; 
	
}

rr;
}

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

int solve(const std::vector<std::vector<int>> &connection, std::vector<bool> &seenTable, int current)
{
    if (seenTable[current])
        return 0;

    seenTable[current] = true;

    bool all = true;
    for (auto s : seenTable)
    {
        if (!s)
        {
            all = false;
            break;
        }
    }

    if (all)
    {
        seenTable[current] = false;
        return 1;
    }

    int result = 0;
    for (auto& c : connection[current])
    {
        result += solve(connection, seenTable, c);
    }

    seenTable[current] = false;
    return result;
}

int main()
{
    int N, M;
    std::cin >> N >> M;
    std::vector<bool> seenTable(N, false);
    std::vector<std::vector<int>> connection(N);


    for (int i=0; i<M; ++i)
    {
        int am, bm;
        std::cin >> am >> bm;
        connection[am - 1].emplace_back(bm - 1);
        connection[bm - 1].emplace_back(am - 1);
    }

    std::cout << solve(connection, seenTable, 0) << std::endl;
}


Measured memory_bytes: 256
# /user/bin/python
# -*- coding: utf-8 -*-
import sys
import math

A,B,C,X,Y = map(int, input().split())
X = float(X)
Y = float(Y)

ans = 0
if A+B > 2*C:
  mn = min(X,Y)
  ans += 2*C*int(mn)
  X -= mn
  Y -= mn

if A > 2*C and X > 0:
  ans += 2*C*math.ceil(X)
  X = 0

if B > 2*C and Y > 0:
  ans += 2*C*math.ceil(Y)
  Y = 0

if X > 0:
  ans += A*math.ceil(X)

if Y > 0:
  ans += B*math.ceil(Y)

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
const long long mod = pow(10, 9) + 7;
const long long MOD = 998244353;
const long long INF = 1LL << 60;
const int inf = pow(10, 9) + 7;
template <class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, int B) {return (A + (B - 1)) / B;}
long long divCeil(int A, long long B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, long long B) {return (A + (B - 1)) / B;}

int main()
{
  string a, b;
  cin >> a >> b;
  
  int N = stoi(a + b);
  string ans = "No";
  
  for (int i = 0; i * i <= N; i++)
  {
    if (i * i == N)
    {
      ans = "Yes";
      break;
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
#define ll long long
#define F first
#define S second
#define FF first.first
#define FS first.second
#define pb push_back
using namespace std;
const ll N=1000006, INF=1e16, MOD=1000000007;
     
ll n, q=1, a[N], b[N], c[N], m, x, y, z, X, Y, Z, o, u, h, w, mx, mn, ans, Ans, k;
string s, S;
vector <ll> v[N];
pair<ll, ll> p[N];

int main(){ios_base::sync_with_stdio(false), cin.tie(0);
                    
//    cin>>q;
                        
    while(q--){
        
        cin>>n>>k;
        for (int i=1; i<=n; i++){
        	(a[i]=a[i-1]+i)%=MOD;
        	(b[i]=b[i-1]+n-i+1)%=MOD;
		}
        for (int i=k; i<=n; i++){
        	ans+=b[i];
        	ans-=a[i-1]-1;
        	ans=(ans+MOD)%MOD;
		}
		cout<<ans+1;
	}
	return 0;
}

Measured memory_bytes: 30224
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	Scanner sc = new Scanner(System.in);

	void run() {
		boolean[] isPrime = new boolean[1121];
		Arrays.fill(isPrime, true);
		isPrime[0] = isPrime[1] = false;
		for (int i = 2; i * i <= 1120; i++) {
			if (!isPrime[i]) continue;
			for (int j = i * 2; j <= 1120; j += i) isPrime[j] = false;
		}
		ArrayList<Integer> l = new ArrayList<Integer>();
		for (int i = 1; i <= 1120; i++) {
			if (isPrime[i]) l.add(i);
		}

		int[][] dp = new int[15][1121];
		dp[0][0] = 1;
		for (int i = 0; i < l.size(); i++) {
			for (int j = 13; j >= 0; j--) {
				for (int k = 0; k <= 1120; k++) {
					if (dp[j][k] != 0 && k + l.get(i) <= 1120) {
						dp[j + 1][k + l.get(i)] += dp[j][k];
					}
				}
			}
		}
		for (;;) {
			int n = sc.nextInt();
			int k = sc.nextInt();
			if ((n | k) == 0) return;
			System.out.println(dp[k][n]);
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 18632
import collections

N = int(input())
A = list(map(int, input().split()))
B = {}
C = {}

for i in range(N):
    if i-A[i] in B:
        B[i-A[i]] += 1
    else:
        B[i-A[i]] = 1
    if i+A[i] in C:
        C[i+A[i]] += 1
    else:
        C[i+A[i]] = 1
#print(B)
#print(C)
ans = 0
for i in B:
    #print(i) i=Key
    if i in C:
        ans += B[i]*C[i]
print(ans)

Measured memory_bytes: 57728
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;

int CheckAnswer(int, string);
int Atoi(const string);

int main(){
  int i, j, m, n;
  string s;
  vector<int> data;

  while(1){
    cin >> m >> n;
    if(m == 0 && n == 0) break;

    for(i=0; i<m; ++i)
      data.push_back(i+1);

    for(i=0, j=0; i<n; ++i, ++j){
      cin >> s;

      if(data.size() != 1){
	if(CheckAnswer(i+1, s) == 0){
	  data.erase(data.begin()+j);
	  --j;
	}
	if(j >= data.size()-1) j = -1;
      }
    }

    for(i=0; i<data.size()-1; ++i)
      cout << data[i] << " ";
    cout << data[data.size()-1] << endl;

    data.clear();
  }

  return 0;
}

int CheckAnswer(int n, string s){
  int x, ans = 0;

  if(n%15 == 0){
    if(s == "FizzBuzz") ans = 1;
  }else if(n%5 == 0){
    if(s == "Buzz") ans = 1;
  }else if(n%3 == 0){
    if(s == "Fizz") ans = 1;
  }else{
    if(s != "FizzBuzz" || s != "Buzz" || s != "Fizz"){
      x = Atoi(s);
      if(x == n) ans = 1;
    }
  }

  return ans;
}

int Atoi(const string c){
  int i, x=0, digit=1;

  for(i = c.size()-1; i >= 0; --i){
    x = x + (c[i] - 48) * digit;
    digit *= 10;
  }
  return x;
}

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


int main(){

int n[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int a;
cin >> a;

cout << n[a-1] << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,x,n) for(int i=x;i<(int)n;i++)
#define rep(i,n) REP(i,0,n)
#define sp(p) cout<<setprecision(16)<<fixed<<p<<endl;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(rall(a))
#define UNIQ(a) unique(all(a))
#define UNIQNUM(a) UNIQ(a)-a.begin()
#define UNIQIT(a) a.erase(UNIQ(a), a.end());
#define VOUT(v,i) cout<<#v<<": ";for(int i=0;i<(int)v.size();i++){cout<<v[i]<<" ";}cout<<"\n";
#define vout(v) VOUT(v,z);
#define vmin(v) *min_element(all(v))
#define vmax(v) *max_element(all(v))
#define vsum(v) accumulate(all(v), 0LL);
#define MOUT(m,r,c) rep(i,r){rep(j,c){cout<<m[i][j]<<" ";}cout<<endl;}
#define mout(m) MOUT(m,m.size(),m[0].size())
#define debg(a) cout<<#a<<": "<<a<<endl;
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
#define digit(a) to_string(a).length();
template<class T>inline int out(const T &t){ print(t); putchar('\n'); return 0; }
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef vector<ll> V;
// const long long MOD=1000000007;
const long long INF = 1e18;
#define EPS (1e-7)
#define PI (acos(-1))
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) { a = b; return true; }
    return false;
}
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) { a = b; return true; }
    return false;
}


void solve(long long N, long long K, std::vector<long long> H){
    RSORT(H);
    ll sum=(K<N)?accumulate(H.begin()+K, H.end(), 0LL):0;
    cout << sum << "\n";
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    std::vector<long long> H(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&H[i]);
    }
    solve(N, K, std::move(H));
    return 0;
}


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



#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)

using namespace std;

template <class T>
using vec = std::vector<T>;
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

const long long INF = 1LL<<60;

int lcm(int a,int b){
    //最小公倍数
    return a/__gcd(a,b) * b;
}

struct edge{int from, to,cost;};

// int型の2次元配列(3×4要素の)の宣言
// vector<vector<int>> data(3, vector<int>(4));

string S;
int k;

int main()
{
    cin>>k>>S;
    int len=S.size();

    if(len<=k){
        cout<<S<<endl;
    }else{
        cout<<S.substr(0,k)<<"..."<<endl;
    }

    return 0;

}




Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-12;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	int w, h, n;
	cin >> w >> h >> n;
	vector<vi> v(w, vi(h));
	while (n--)
	{
		int x, y, a;
		cin >> x >> y >> a;
		if (a == 1) REP(i, x)REP(j, h) v[i][j] = 1;
		if (a == 2) FOR(i, x, w)REP(j, h) v[i][j] = 1;
		if (a == 3) REP(i, w)REP(j, y) v[i][j] = 1;
		if (a == 4) REP(i, w)FOR(j, y, h) v[i][j] = 1;
	}
	int ans = 0;
	REP(i, w)REP(j, h) ans += 1 - v[i][j];
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
H, W, D = map(int, input().split())

#盤面を取得
lst = [0] * (H * W + 1)
for i in range(1, H + 1):
    tmp = list(map(int, input().split()))
    for j in range(1, W + 1):
        lst[tmp[j - 1]] = [i, j]
#前処理

#xからyに移動するのにかかるコストを返す関数
def cost(x, y): 
    return abs(lst[x][0] - lst[y][0]) + abs(lst[x][1] - lst[y][1])

check_lst = [False] * (H * W + 1)
cost_lst = [0] * (H * W + 1)
for i in range(1, D + 1):
    if check_lst[i]:
        continue
    check_lst[i]  = True
    tmp = i
    while tmp + D <= H * W:
        cost_lst[tmp + D] = cost_lst[tmp] + cost(tmp, tmp + D)
        check_lst[tmp + D] = True
        tmp += D

#出力
Q = int(input())
for _ in range(Q):
    L, R = map(int, input().split())
    print (cost_lst[R] - cost_lst[L])


Measured memory_bytes: 17800
#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);
  // ABC073C - Write and Erase
  int N; cin >> N;
  vector<int> A;
  REP(i, N){
    int a; cin >> a;
    A.push_back(a);
  }
  sort(A.begin(), A.end());
  int ans = 0;
  int tmp = A[0], cnt = 1;
  for(int i = 1; i < N; i++){
    if(tmp == A[i]){
      cnt++;
    }else{
      if(cnt%2 == 1) ans++;
      tmp = A[i];
      cnt = 1;
    }
  }
  if(cnt%2 == 1) ans++;
  cout << ans << endl;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int main() {
    int N; cin >> N;
    vector<vector<pair<int, int>>> G(N);
    for (int i = 0; i < N - 1; i++) {
        int a, b; cin >> a >> b; a--, b--;
        G[a].emplace_back(b, i);
        G[b].emplace_back(a, i);
    }
    int M; cin >> M;
    vector<Int> B(M);
    function<Int(int, int, Int)> recur = [&](int u, int v, Int acc) -> Int {
        if (u == v) return acc;
        for (auto& edge : G[u]) if (~acc & (1LL << edge.second)) {
            auto r = recur(edge.first, v, acc | (1LL << edge.second));
            if (r != 0) return r;
        }
        return 0;
    };
    for (int i = 0; i < M; i++) {
        int u, v; cin >> u >> v; u--, v--;
        B[i] = recur(u, v, 0);
    }
    vector<Int> TWO(N);
    TWO[0] = 1;
    for (int i = 1; i < TWO.size(); i++) TWO[i] = TWO[i - 1] * 2;
    Int ans = 0;
    for (int i = 0; i < (1 << M); i++) {
        Int bits = 0;
        for (int j = 0; j < M; j++) if (i & (1LL << j)) {
            bits |= B[j];
        }
        int mcnt = __builtin_popcountll(i);
        int ncnt = __builtin_popcountll(bits);
        ans += (mcnt % 2 ? -1 : +1) * TWO[N - 1 - ncnt];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n, a[1000][1000], b[1000], i, bingo[100][100]={0};
    for(i=0;i<3;i++){
        for(int j=0;j<3;j++){
            cin >> a[i][j];
        }
    }
    cin >> n;
    for(i=0;i<n;i++){
        cin >> b[i];
    }
    for(int k=0;k<n;k++){
        for(i=0;i<3;i++){
            for(int j=0;j<3;j++){
                if(b[k]==a[i][j]){
                    bingo[i][j]++;
                }
            }
        }
    }
    if(bingo[0][0]==1 && bingo[0][1]==1 && bingo[0][2]==1) cout << "Yes" <<endl;
    else if(bingo[0][0]==1 && bingo[1][1]==1 && bingo[2][2]==1) cout << "Yes" <<endl;
    else if(bingo[0][0]==1 && bingo[1][0]==1 && bingo[2][0]==1) cout << "Yes" <<endl;
    else if(bingo[1][0]==1 && bingo[1][1]==1 && bingo[1][2]==1) cout << "Yes" <<endl;
    else if(bingo[2][0]==1 && bingo[2][1]==1 && bingo[2][2]==1) cout << "Yes" <<endl;
    else if(bingo[0][1]==1 && bingo[1][1]==1 && bingo[2][1]==1) cout << "Yes" <<endl;
    else if(bingo[0][2]==1 && bingo[1][2]==1 && bingo[2][2]==1) cout << "Yes" <<endl;
    else if(bingo[0][2]==1 && bingo[1][1]==1 && bingo[2][0]==1) cout << "Yes" <<endl;
    else cout << "No" <<endl;
    return 0;
}

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

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

	
	cin >> a >> b >> c;

	if (((a + b) == c) || ((a + c) == b) || ((b + c) == a)) {

		cout << "Yes";
	}
	else {

		cout << "No";

	}


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i < (ll)(n); i++)
const ll mo = 1000000007;
const ll INF = 1 << 30;
ll ans = 0;
ll ch[10][10];
ll ko[10] = {};

int main()
{
    ll h, w;
    cin >> h >> w;
    rep(i, 10) rep(j, 10)
    {
        cin >> ch[i][j];
    }
    rep(i, h) rep(j, w)
    {
        ll te;
        cin >> te;
        if (te >= 0)
            ko[te]++;
    }
    ll cost[10] = {};
    queue<pair<int, int>> q;
    rep(k, 10)
    {
        ll minn = ch[k][1];
        rep(i, 10)
        {
            if (i != 1 && i != k)
                q.push({i, ch[k][i]});
        }
        while (!q.empty())
        {
            pair<int, int> p = q.front();
            q.pop();
            if (p.first == 1 && minn > p.second)
            {
                minn = p.second;
            }
            if (p.second < minn)
            {
                rep(i, 10)
                {
                    if (i != p.first)
                        q.push({i, p.second + ch[p.first][i]});
                }
            }
        }
        cost[k] = minn;
    }
    rep(i,10){
        ans+=cost[i]*ko[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
mod = 10 ** 9 + 7
A = list(map(int, input().split()))
B = [0 for i in range(N)]
for a in A:
  B[a] += 1
f = 0
if N % 2 == 0:
  ans = 1
  for i in range(1, N, 2):
    if B[i] != 2:
      f = 1
      break
    else:
      ans = ans * 2 % mod
  if f == 1:
    print(0)
  else:
    print(ans)
else:
  ans = 1
  if B[0] != 1:
    f = 1
  if f ==0:
    for i in range(2, N + 1, 2):
      if B[i] != 2:
        f = 1
        break
      else:
        ans = ans * 2 % mod
  if f == 1:
    print(0)
  else:
    print(ans)

Measured memory_bytes: 90028