akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define mod 1000000007
#define MAX 1000000000000000
#define all(v) v.begin(),v.end()
#define rep(i,a,b) for(i=(ll)a;i<(ll)b;i++)
#define revrep(i,a,b) for(i=(ll)a;i>=(ll)b;i--)
#define ii pair<ll,ll>
#define MP make_pair
#define pb push_back
#define f first
#define se second
#define ll long long int
#define vi vector<ll>
ll modexp(ll a,ll b){ ll res = 1; while(b > 0){  if(b & 1) res = (res * a)%mod;  a = (a * a)%mod;  b/=2;  }  return res; }
#define rs resize
typedef tree< ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update > OST;
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

const ll N = 100009;
ll n,k;
int main()
{
    std::ios_base::sync_with_stdio(false); cin.tie(NULL);
    cin>>n>>k;
    cout<<(n % k == 0 ? 0 : 1);
    return 0;
}

Measured memory_bytes: 764
#include<stdio.h>
#define NILL -1

typedef struct
{
    int parent;
    int r; //sibling
    int l; //child
} TREE;

TREE t[100000];
int d[100000];

void depth(int node,int p)
{
    d[node] = p;
    if(t[node].r != NILL) depth(t[node].r,p);
    if(t[node].l != NILL) depth(t[node].l,p+1);
}

int main()
{
  int v,k;
  int vi;
  int child,sibl;
  int n;
  int i,j;
  
  scanf("%d",&n);
  
  for(i=0;i < n;i++){
    t[i].l = NILL;
    t[i].r = NILL;
    t[i].parent = NILL;
  }

  for(i=0;i < n;i++){

    scanf("%d%d",&v,&k);
    
    for(j=0;j < k;j++){

      scanf("%d",&vi);
      
      if(j == 0) t[v].l = vi;
      else t[child].r = vi;

      child = vi;
      t[vi].parent = v;
    }
  }

  //根を調べる
  for(i=0;i < n;i++){
    if(t[i].parent == NILL) sibl = i;
  }
  depth(sibl,0);

  for(i=0;i < n;i++){
    printf("node %d: parent = %d, depth = %d, ",i,t[i].parent,d[i]);
    if(t[i].parent == NILL) printf("root,");
    else if(t[i].l == NILL) printf("leaf,");
    else printf("internal node,");

    int vv=t[i].l;
    printf(" [");
    for(j=0;vv != NILL; vv=t[vv].r,j++){
      if(j) printf(", ");
      printf("%d",vv);
    }
    printf("]\n");
  }
  return 0;
}



Measured memory_bytes: 6396
N, W = map(int, input().split())
V = 10**5
INF = 10**18
dp = [INF]*(V+1)

dp[0] = 0
for i in range(N):
    w, v = map(int, input().split())
    for j in range(V, v-1, -1):
        if dp[j-v] + w <= W:
            dp[j] = min(dp[j], dp[j-v] + w)
for i in range(V, -1, -1):
    if dp[i] < INF:
        print(i)
        break

Measured memory_bytes: 41836
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i,a,b) for(int i=int(a); i<int(b); ++i)
#define FORD(i,a,b) for(int i=int(a); i<int(b); --i)
#define REP(i,N) for(int i=0; i<int(N); ++i)
#define REPD(i,N) for(int i=0; i<int(N); --i)
#define PB push_back
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7
#define MAXR 100000 //配列の最大のrenge

int main() {
    ll a,b,x; cin>>a>>b>>x;
    ll A = (a+x-1)/x;
    ll B = b/x;
    cout << B-A+1;
}

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

using namespace std;
using namespace __gnu_cxx;

#define REP(i,n) for( (i)=0 ; (i)<(n) ; (i)++ )
#define rep(i,x,n) for( (i)=(x) ; (i)<(n) ; (i)++ )
#define REV(i,n) for( (i)=(n) ; (i)>=0 ; (i)-- )
#define FORIT(it,x) for( (it)=(x).begin() ; (it)!=(x).end() ; (it)++ )
#define foreach(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define rforeach(it,c) for(__typeof((c).rbegin()) it=(c).rbegin();it!=(c).rend();++it)
#define foreach2d(i, j, v) foreach(i,v) foreach(j,*i)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define SZ(x) ((int)(x).size())
#define MMS(x,n) memset(x,n,sizeof(x))
#define mms(x,n,s) memset(x,n,sizeof(x)*s)
#define pb push_back
#define mp make_pair
#define NX next_permutation
#define UN(x) sort(all(x)),x.erase(unique(all(x)),x.end())
#define CV(x,n) count(all(x),(n))
#define FIND(x,n) find(all(x),(n))-(x).begin()
#define ACC(x) accumulate(all(x),0)
#define PPC(x) __builtin_popcountll(x)
#define LZ(x) __builtin_clz(x)
#define TZ(x) __builtin_ctz(x)
#define mxe(x) *max_element(all(x))
#define mne(x) *min_element(all(x))
#define low(x,i) lower_bound(all(x),i)
#define upp(x,i) upper_bound(all(x),i)
#define NXPOW2(x) (1ll << ((int)log2(x)+1))
#define PR(x) cout << #x << " = " << (x) << endl ;

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

const int OO = (int) 2e9;
const double eps = 1e-9;

const int N = 102;
const int K = 100005;
const int mod = (int) 1e9 + 7;

int n, k;
int a[N];
int dp[N][K];

int main() {
	std::ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
#ifndef ONLINE_JUDGE
//	freopen("in.txt", "rt", stdin);
//	freopen("out.txt", "wt", stdout);
#endif
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	dp[n][0] = 1;
	for (int i = n - 1; i >= 0; i--) {
		for (int j = 0; j <= k; j++) {
			(dp[i][j] += dp[i + 1][j]) %= mod;
			if (j > 0)
				(dp[i][j] += dp[i][j - 1]) %= mod;
			if (j + a[i] + 1 <= k)
				dp[i][j + a[i] + 1] = (dp[i][j + a[i] + 1] - dp[i + 1][j] + mod) % mod;
		}
	}
	cout << dp[0][k] << endl;
	return 0;
}


Measured memory_bytes: 39296
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <assert.h>
#include <deque>
using namespace std;

typedef unsigned long long UL;
typedef long long LL;
typedef long double LD;
#define LP(i, a, b) for (LL i = int(a); i < int(b); i++)
#define LPE(i, a, b) for (LL i = int(a); i <= int(b); i++)
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef vector<vector<PII> > WAL;
typedef vector<vector<int> > SAL;
#define Ep 1e-8
#define INF 1e9
#define LINF 1e18

LL const MOD = 1e9 + 7;
LL const MaxSize = 1e5 + 5;
//LL const MOD = 998244353;

LL N, M, S, T;

SAL g;
queue<int> q;
int d[3 * MaxSize];

int main() {
	ios_base::sync_with_stdio(false);
	//freopen("/Users/georgeli/A_1.in", "r", stdin);
	cin >> N >> M;

	g = SAL(3 * N);

	LP(i, 0, M)
	{
		int u, v;
		cin >> u >> v;
		u--;
		v--;
		g.at(u).push_back(v + N);
		g.at(u + N).push_back(v + 2 * N);
		g.at(u + 2 * N).push_back(v);
	}
	cin >> S >> T;
	S--;
	T--;

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

	q.push(S);
	d[S] = 0;

	while (!q.empty()) {
		int v = q.front();
		q.pop();

		LP(i, 0, g.at(v).size())
		{
			int u = g.at(v)[i];

			if (d[u] >= 0)
				continue;
			//cout << u << " " << v;

			d[u] = d[v] + 1;
			q.push(u);
		}
	}

	if(d[T] >= 0)
		cout << d[T] / 3;
	else
		cout << -1 << endl;

	return 0;

}


Measured memory_bytes: 17920
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define erep(i, n) for (ll i = 0; i <= (ll)(n); ++i)
#define FOR(i,a,b) for (ll i = (a); i < (ll)(b); ++i)
#define EFOR(i,a,b) for (ll i = (a); i <= (ll)(b); ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } }

typedef pair<int, int> P;
ll modnum = 1e9+7;

struct UnionFind {
    /**
     * parで親の頂点番号と、サイズを同時に管理する
     * 根ではない頂点のparは親となる頂点の値が入ってる
     * 根にはサイズ数が入っている。区別できるようにサイズはマイナスの値で入っている
     * そのため、初期値はすべて-1になる(mergeの際にmergeされる側の根に、mergeする方の根が加算される)
     */
    vector<int> par;

    /**
     * コンストラクタ
     * 最初は全ての頂点が、別グループで初期化する
     * @param n : 全ての頂点数
     */
    UnionFind(int n) : par(n, -1) { }

    /**
     * 頂点xが属するグループの根になる頂点の番号を返す
     * @param x : 頂点番号
     * @return 頂点xが属するグループの根になる頂点の番号
     */
    int root(int x) {
        // 負の値ということは、根である
        if (par[x] < 0) return x;
        return par[x] = root(par[x]);
    }

    /**
     * 頂点xとyをマージする(1つのグループにする)
     * @param x : マージしたい頂点番号
     * @param y : マージしたい頂点番号
     * @return Bool値を返す, マージ成功した場合は`true`, すでに同じグループだった場合は`false`を返す
     */
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        // サイズが大きいほうにマージする
        // 以下は必ずxが大きいほう(サイズはマイナスの値が入ってるので)にするように調整している
        if (par[x] > par[y]) swap(x, y);
        // xのサイズに、yのサイズを加算する
        par[x] += par[y];
        // yの根をxに更新する
        par[y] = x;
        return true;
    }

    /**
     * 頂点xとyが同じ木に属するかを判定する
     * @param x : 頂点番号
     * @param y : 頂点番号
     * @return xとyが同じ木に属するのであれば`true`, そうでないのであれば`false`を返す
     */
    bool same(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }

    /**
     * 頂点xが属する木のサイズ(その木に属する頂点の個数)を返す
     * @param x : 頂点番号
     * @return 頂点xが属する木のサイズ
     */
    int size(int x) {
        // サイズはマイナスで入ってるので、-をかけて返す
        return -par[root(x)];
    }
};

int main() {
    int n,m; cin >> n >> m;
    UnionFind tree(n);

    vector<int> p(n);
    vector<P> xy(n);
    rep(i, n) {
        cin >> p[i];
        p[i]--;
    }

    rep(i, m) {
        int x,y; cin >> x >> y;
        x--;
        y--;
        tree.merge(x,y);
    }

    ll ans = 0;
    rep(i, n) {
        if(tree.root(i) == tree.root(p[i])) {
            ans++;
        }
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
n=int(input())
l=list(map(int, input().split()))

z=[]
for i in range(n):
    x,y=0,l[i]
    for j in range(10**9):
        if y%2==0:
            x+=1
            y=y//2
        else:
            z.append(x)
            break

print(sum(z))

Measured memory_bytes: 4148
def main():
    k = int(input())
    gcds = []
    for i in range(1, k+1):
        for j in range(1, k+1):
            gcds.append(gcd(i, j))
    ans = {i:0 for i in set(gcds)}
    for i in gcds:
        ans[i] += 1
    out = 0
    for i, v in ans.items():
        for j in range(1, k+1):
            out += gcd(i, j)*v
    print(out)

def gcd(x, y):
    r = x % y
    while r:
        x, y, r = y, r, y%r
    return y

if __name__ == "__main__":
    main()

Measured memory_bytes: 9372
def solve():
    K, S = map(int, input().split())
    
    lower = S - 2 * K
    if lower < 0:
        lower = 0
    
    cnt = 0
    for x in range(lower, K + 1):
        lower = S - K - x
        if lower < 0:
            lower = 0
        upper = S - x
        if upper > K:
            upper = K
        for y in range(lower, upper + 1):
            cnt += 1
    
    print(cnt)

solve()

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fi first
#define se second
#define pb push_back
#define pr pair<int,int>
#define mod 1000000007
#define endl "\n"

int power(int a,int b,int m=mod)
{
	if(b==0)	return 1;
	if(b==1)	return a;
	int res=power(a,b/2,m);
	res=(res*res)%m;
	if(b&1)	res=(res*a)%m;
	return res;
}
int modinv(int a,int m=mod){ return power(a,m-2,m);}
int add(int a,int b,int m=mod){	int c=(a%m+b%m);	if(c>=m)	c-=m;	return c;}
int sub(int a,int b,int m=mod){	int c=(a%m-b%m);	if(c<0)		c+=m;	return c;}
int mul(int a,int b,int m=mod){	return (a*b)%m;}
//	x<<1 => x*2		x>>1 => x/2;	cout<<flush;
//	cout<<fixed<<setprecision(10)<<ans<<endl;


void solve()
{
	int a,v,b,w,t;
	cin>>a>>v>>b>>w>>t;
	bool ans=false;
	if(w>=v)
	{
		cout<<"NO"<<endl;
		return;
	}
	if((a+v*t)>=(b+w*t) && a<b)
		ans=true;
	if((a-v*t)<=(b-w*t) && a>b)
		ans=true;
	if(ans)
		cout<<"YES"<<endl;
	else
		cout<<"NO"<<endl;
}

int32_t main()
{
	ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
	int t=1;//cin>>t;
	for(int i=1;i<=t;i++){	solve();}
	return 0;
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define RFOR(i,a,b) for(int i=(b-1); i>=(a); i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define pb push_back
using ll = long long;
using D = double;
using LD = long double;
using P = pair<int, int>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main(){
    ll n; cin >> n;
    string ans = "";
    while(n > 0){
        ll p = n / 26, q = n % 26;
        ans += 'a' + ((q+25)%26);
        if(q != 0) n = p;
        else n = p-1;
    }
    reverse(ALL(ans));
    cout << ans << endl;
}


Measured memory_bytes: 3616
/*
                       _oo0oo_
                      o8888888o
                      88" . "88
                      (| -_- |)
                      0\  =  /0
                    ___/`---'\___
                  .' \\|     |// '.
                 / \\|||  :  |||// \
                / _||||| -:- |||||- \
               |   | \\\  -  /// |   |
               | \_|  ''\---/''  |_/ |
               \  .-\__  '-'  ___/-. /
             ___'. .'  /--.--\  `. .'___
          ."" '<  `.___\_<|>_/___.' >' "".
         | | :  `- \`.;`\ _ /`;.`/ - ` : | |
         \  \ `_.   \_ __\ /__ _/   .-` /  /
     =====`-.____`.___ \_____/___.-`___.-'=====
                       `=---='
                   JAY KHODIYAR MAA
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 JENISH MONPARA S.      IIT PATNA      ADITI GOEL IS LOVE
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// while(scanf("%d",&n)!=EOF)

#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#define ii int64_t
#define lli long long int
#define li long int
#define deb(x) cout<<"\nhi"<<x<<"\n"
#define mod 1000000007
#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;

ii c(ii x)
{
    return ((x)*(x-1))/2;
}


int main()
{
    fio;
    
    map<ii,ii> m;
    ii n,i,j,sum=0,x;
    cin>>n;
    ii a[n+3];
    vector<bool> v(n+3,true);
    for(i=0;i<n;i++)
    {
        cin>>a[i];m[a[i]]++;
    }
    for(i=0;i<n;i++)
    {
        if(v[a[i]])
        {sum+=c(m[a[i]]);v[a[i]]=false;}
        
        //cout<<sum<<endl;
        
    }
    for(i=0;i<n;i++)
    {
        cout<<sum-c(m[a[i]])+c(m[a[i]]-1)<<"\n";
        
    }
    
}


Measured memory_bytes: 11136
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>

using namespace std;

int main() {
	int a, b; cin >> a >> b;
	int c = a + b;
	c = max(c, a - b);
	c = max(c, a * b);

	cout << c << endl;
	return 0;
}


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


#define ll long long
#define ull unsigned ll
#define vi vector <int>
#define ii pair <int, int>
#define vii vector <ii>
#define vll vector <ll>
#define vull vector <ull>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define INF (int)1e9
#define EPS 1e-9
#define pb emplace_back
#define PI acos(-1.0)
#define endl "\n"
#define mp make_pair
#define DEBUG 0

int main ()

{
    fast;
    
    int n;
    cin >> n;
    
    ll sum = 0;
    for (int i=1; i<=n; i++)
    {
        for (int j=1; j<=n; j++)
        {
            for (int k=1; k<=n; k++)
            {
                int gcd = __gcd(i, j);
                gcd = __gcd(gcd, k);
                sum += gcd;
            }
        }
    }
    
    cout << sum << endl;


    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
  int tc;
  
  cin >> tc;
  while(tc--) {
    int start, dur, n;
    cin >> start >> dur >> n;
    int ans = -1;
    for(int i=0; i<n; i++) {
      int mom = start, inte = 0, kind, dif;
      double rat;
      cin >> kind >> rat >> dif;
      for(int j=0; j < dur; j++) {
	inte += rat * mom;
	if(kind) {
	  mom += inte; inte = 0;
	}
	mom -= dif;
      }
      mom += inte;
      ans = max(ans, mom);
    }
    cout << ans << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1232
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,ans=0;
    cin>>a>>b;
    int n[100001];
    for(int i=1;i<=a;i++)
    {
    	cin>>n[i];
		if(n[i]>=b)
    		ans++;
	}
	cout<<ans;
}

Measured memory_bytes: 640
// 2020-06-28 21:12:24
#include<bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = long long;
using ld = long double;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }

const ll C = 26;
ll D;
vector<ll> cs(C), ts;
void answer() {
  cin >> D;
  rep(i, C) cin >> cs[i];
  vector<vector<ll> > ss(D, vector<ll>(C, 0));
  rep(i, D) rep(j, C) cin >> ss[i][j];
  ts.assign(D, 0);
  rep(i, D) cin >> ts[i], ts[i]--;
  map<ll, ll> last;
  rep(i, C) last[i] = 0;
  ll ans = 0;
  rep(i, D) {
    ll d = i + 1;
    ans += ss[i][ts[i]];
    last[ts[i]] = d;
    rep(j, C) ans -= cs[j] * (d - last[j]);
    cout << ans << '\n';
  }
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}

Measured memory_bytes: 3756
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <cassert>
using namespace std;
typedef long long ll;


int main() {
	int n; cin >> n;
	vector<ll> a(n);
	for (int i = 0; i < n; i++) cin >> a[i];
	ll ans = 0;
	for (int i = 0; i < n; i++) {
		ans += a[i] / 2;
		if (i < n - 1 && a[i] & 1 && a[i + 1] > 0) {
			ans++;
			a[i + 1]--;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>
#include <cmath>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define ENDL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
/* libraries */

signed main() {
	int n,k;
	std::cin >> n >> k;
	std::vector<int> h(n);
	rep(i,n) std::cin >> h[i];
	std::sort(all(h));
	k=std::min(k,n);
	int sum=0;
	rep(i,n-k) {
		sum+=h[i];
	}
	print(sum);

	return 0;
}


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

bool CheckBingo(int i, int j, int k, bool check[9])
{
	return (check[i] && check[j] && check[k]);
}

int main()
{
	int A[9];
	bool check[9];
	int n = 0;

	for (int i = 0; i < 9; ++i) {
		cin >> A[i];
		check[i] = false;
	}
	cin >> n;
	for (int i = 0; i < n; ++i) 
	{
		int tmp = 0;
		cin >> tmp;
		for (int j = 0; j < 9; ++j) 
		{
			if (A[j] == tmp) 
			{
				check[j] = true;
				break;
			}
		}
	}

	if (CheckBingo(0, 1, 2, check)
		|| CheckBingo(3, 4, 5, check)
		|| CheckBingo(6, 7, 8, check)
		|| CheckBingo(0, 3, 6, check)
		|| CheckBingo(1, 4, 7, check)
		|| CheckBingo(2, 5, 8, check)
		|| CheckBingo(0, 4, 8, check)
		|| CheckBingo(2, 4, 6, check)
		)
	{
		cout << "Yes";
	}
	else
	{
		cout << "No";
	}
	return 0;
}


Measured memory_bytes: 256
//int a = stoi(c); 文字列をintへ
//小文字から大文字
//transform(a.begin(), a.end(), a.begin(), ::toupper);
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; it++) {}
//mapのキー：it->first mapのバリュー：it->second
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//while(N)で回すとき、Nはコピーを作っておく
//小文字に対応する文字コード：S[i] - 'a'
//文字コード→小文字：(char)(数字+'a')
//グラフの距離:隣接行列で扱う
//等価なものに変換する思考
//bool型　初期値はTrue
//島渡りの問題：中間ノードに着目
//配列はvector<>を使う：意味わからないエラーがなくなる。
//背反な事象にちゃんとわける
//チェックリストはマップを使う
//数が大きい時の比較はstring型で行う
//全て0になったか調べたい->0になるたびにcntする
//またはかかつか
//例外処理は最初にする
//x = p^m + q^n...の約数の個数:(n+1)*(m+1)....
//N!のどの素因数で何回割れるか
//⇔1~Nまでの数がそれぞれどの素因数で何回割り切れるかの和
//パズルの問題->一般化して全探索
//数が大きい時のせぐふぉはコードテストで試してみる
//スペルミスに注意
//stack<ll> s;
//s.push(要素);s.top();s.pop();
//queue<ll> q;
//q.push(要素);q.front();q.pop();
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

//円周率
const double PI = 3.14159265358979323846;
//割るやつ
const ll M = (pow(10, 9) + 7);

// K進数でのNの桁数
ll dig(ll N, ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// a,bの最大公約数
ll gcd(ll a, ll 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;
}

//nC2の計算
ll C(ll N) {
	return N * (N - 1) / 2;
}

//階乗計算
ll f(ll n) {
	if (n == 0 || n == 1) return 1;
	else return (n%M) * (f(n - 1) % M);
}

//Nをdで何回割れるか
ll divcnt(ll N, ll d) {
	ll ans = 0;
	while (1) {
		if (N%d == 0) {
			ans++;
			N /= d;
		}
		else break;
	}

	return ans;
}

//素数判定
bool prime(ll 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;
}

//フィボナッチ数列
vector<ll> memo(pow(10, 6) + 1);
ll fibo(ll n) {
	if (n == 1) return 1;
	else if (n == 2) return 1;
	else if (memo[n] != 0) return memo[n];
	else return memo[n] = fibo(n - 1) + f(n - 2);
}

int main() {
	ll A, B, N; cin >> A >> B >> N;
	ll x = min(N, B - 1);
	cout << (A * x) / B - A * (x / B) << endl;
}


Measured memory_bytes: 10968
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    array<int, 5> v{};
    while(cin >> v[0], v[0]){
        array<int, 3> cnt{};
        for (int i = 1; i < 5; ++i) cin >> v[i];
        for (int i = 0; i < 5; ++i) cnt[v[i]-1]++;
        if((!!cnt[0]+!!cnt[1]+!!cnt[2]-1)%2 == 0) {
            for (int i = 0; i < 5; ++i) puts("3");
            continue;
        }
        if(cnt[0] && cnt[1]){
            for (int i = 0; i < 5; ++i) puts(v[i] == 1 ? "1" : "2");
        }else if(cnt[0] && cnt[2]){
            for (int i = 0; i < 5; ++i) puts(v[i] == 1 ? "2" : "1");
        }else {
            for (int i = 0; i < 5; ++i) puts(v[i] == 2 ? "1" : "2");
        }
    }
    return 0;
}


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

using namespace std;

typedef long long LL;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<LL> vl;
typedef vector<vector<LL>> vvl;
typedef vector<vector<vector<LL>>> vvvl;


const int inf = 1e9+7;
const LL INF = 1e18+5;
const int mod = 1e9+7;
const int mxN = 1e5+5;
const int mxM = 1e5+5;

int main(){
    #ifndef ONLINE_JUDGE
    freopen("E:\\Coding\\Programming\\input.txt", "r", stdin);
    freopen("E:\\Coding\\Programming\\output.txt", "w", stdout);
    #endif
    LL x,k,d;
    cin>>x>>k>>d;
    LL q = x/d;
    q = abs(q);
    if(k>=q){
        LL r = x%d;
        if(r==0){
            if((q&1)==(k&1)){
                cout<<r<<endl;
            }else{
                cout<<d<<endl;
            }
        }else{
            if(k>q){
                if(q&1){
                    if(k&1){
                        cout<<abs(r)<<endl;
                    }else{
                        cout<<min(abs(r+d),abs(r-d))<<endl;
                    }
                }else{
                    if(k&1){
                        cout<<min(abs(r-d),abs(r+d))<<endl;
                    }else{
                        cout<<abs(r)<<endl;
                    }
                }
            }else{  
                cout<<abs(r)<<endl;
            }
        }
    }else{
        cout<<min(abs(x-k*d),abs(x+k*d))<<endl;
    }

}

Measured memory_bytes: 3616
#include<stdio.h>
#include<map>
#include<vector>
using namespace std;
#define MAX 100000
#define NIL -1
#define root 0
#define BITS 30

struct Edge {
    int n, c, d;
};

vector<Edge> T[MAX];
int N, Q;
vector<int> parent[BITS];
int depth[MAX];
int Distance[MAX];
map<int, int> cnum[MAX];
map<int, int> cdist[MAX];
int CNUM[MAX], CDIST[MAX];
vector<int> need[MAX];
int bitlen;

void make_tree(int node, int p, int dep) {
    depth[node] = dep;
    parent[0][node] = p;

    for (auto i=T[node].begin(); i!=T[node].end(); ++i) {
        if ((*i).n == p) continue;
        make_tree((*i).n, node, dep+1);
    }
}

void initialize() {
    bitlen = 1;
    while ((1<<bitlen) < N) bitlen++;
    for (int i=0; i<bitlen; i++) parent[i].resize(N);

    make_tree(0, 0, 0);

    for (int k=0; k<bitlen-1; k++) {
        for (int v=0; v<N; v++) {
            if (depth[v]==0) continue;
            if (parent[k][v] == 0) {
                parent[k+1][v] = 0;
            } else {
                parent[k+1][v] = parent[k][parent[k][v]];
            }
        }
    }
}

int lca(int u, int v) {
    if (depth[u] > depth[v]) swap(u, v);
    for (int k=0; k<bitlen; k++) {
        if ( ((depth[v]-depth[u]) >> k) & 1) v = parent[k][v];
    }
    if (u == v) return u;
    for (int k=bitlen-1; k>=0; k--) {
        if (parent[k][u] != parent[k][v]) {
            u = parent[k][u];
            v = parent[k][v];
        }
    }
    return parent[0][u];
    /*
    while(depth[u]!=depth[v]) {
        u = parent[u];
    }
    while(u!=v) {
        u = parent[u];
        v = parent[v];
    }
    return u;
    */
}

void dps(int r, int dist) {
    Distance[r] = dist;
    for (auto color = need[r].begin(); color!=need[r].end(); ++color) {
        cnum[r][*color] = CNUM[*color];
        cdist[r][*color] = CDIST[*color];
    }

    for (auto i=T[r].begin(); i!=T[r].end(); ++i) {
        if ((*i).n==parent[0][r]) continue;
        CNUM[(*i).c]++;
        CDIST[(*i).c] += (*i).d;
        dist += (*i).d;
        dps((*i).n, dist);
        CNUM[(*i).c]--;
        CDIST[(*i).c] -= (*i).d;
        dist -= (*i).d;
    }

}

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

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

    int a, b, c, d;
    for (int i=0; i<N-1; i++) {
        scanf("%d%d%d%d", &a, &b, &c, &d);
        a--, b--, c--;
        T[a].push_back({b, c, d});
        T[b].push_back({a, c, d});
    }

    initialize();

    int X[MAX], Y[MAX], U[MAX], V[MAX], L[MAX];
    for (int i=0; i<Q; i++) {
        scanf("%d%d%d%d", &X[i], &Y[i], &U[i], &V[i]);
        X[i]--, U[i]--, V[i]--;

        L[i] = lca(U[i], V[i]);

        need[U[i]].push_back(X[i]);
        need[V[i]].push_back(X[i]);
        need[L[i]].push_back(X[i]);
    }

    dps(root, 0);

    for (int i=0; i<Q; i++) {
        int x = X[i], y = Y[i], l = L[i], u = U[i], v = V[i];
        int dl = Distance[l] - cdist[l][x] + cnum[l][x]*y;
        int du = Distance[u] - cdist[u][x] + cnum[u][x]*y;
        int dv = Distance[v] - cdist[v][x] + cnum[v][x]*y;
        int d = du + dv - 2 * dl;
        printf("%d\n", d);
    }

    return 0;
}

Measured memory_bytes: 58424
# 簡単な問題なのだが３０分くらいかかった
# 図に書いて法則を正確に理解すること!

x1,y1,x2,y2 = map(int, input().split())
X = x2 - x1
Y = y2 - y1
print(x2-Y,y2+X,x2-Y-X,y2+X-Y)


Measured memory_bytes: 2940
# coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
read = sys.stdin.read

#n,m = [int(i) for i in readline().split()]
#d = [int(i) for i in readline().split()]


a,b = readline().split()

p = a*int(b)
q = b*int(a)

print(min(p,q))
    








Measured memory_bytes: 2940
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <float.h>
#include <iomanip>
#include <iostream>
using namespace std;

int main()
{
    int A,B,C,D;
    cin>>A>>B>>C>>D;

    if((A+B)>(C+D)){
        cout<<"Left"<<endl;
    }else if((A+B)==(C+D)){
        cout<<"Balanced"<<endl;
    }else{
        cout<<"Right"<<endl;
    }

    return 0;
}


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

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

  auto t = s;
  sort(t.begin(), t.end());
  int r = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'W' && t[i] == 'R') r++;
  }
  cout << r << endl;
}


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

#pragma region Macro
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define SORT(v) sort(v.begin(), v.end())
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define vi vector<int>
#define vvi vector<vector<int>>
#define chmax(x,y) (x = max(x,y))
#define chmin(x,y) (x = min(x,y))

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#pragma endregion

void solve(){
	#define int ll
	// ここに処理を記述
	// コンパイル時はエイリアス「gpp」--> c++17でコンパイル
	
	ll x, k, d;
	cin >> x >> k >> d;

	if(k < abs(x) / d){
		cout << abs(x) - k * d << endl;
	}
	else{
		int now = abs( (abs(x) % d) - d );
		int left = k - (abs(x) / d) - 1;
		if(left % 2 == 0){
			cout << now << endl;
		}
		else{
			cout << abs(now - d) << endl;
		}
	}

}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	
	solve();
	return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int a, b;
    cin >> a >> b;

    int plus = a + b;
    int minus = a - b;
    int mul = a * b;
  
    cout << max(max(plus, minus), mul) << endl;
}

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

#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define SUBL freopen("/home/ajinkya/Desktop/input.txt","r",stdin); freopen("/home/ajinkya/Desktop/output.txt","w",stdout); 
#define ll long long
#define ull unsigned long long
#define FI(i,a,n) for(int i=a; i<=n; i++)
#define RFI(i,n,a) for(int i=n; i>=a; i--)
#define FLL(i,a,n) for(ll i=a; i<=n; i++)
#define RFLL(i,n,a) for(ll i=n; i>=a; i--)
#define vi vector<int>
#define vll vector<ll>
#define all(v) v.begin(),v.end()
#define pll pair<ll,ll>
#define pi pair<int, int>
#define GCD(a,b) __gcd(a,b)
#define MP make_pair
#define PB push_back
#define PF push_front
#define LB lower_bound
#define UB upper_bound
#define debug(x) cout << x << endl
#define MOD 1000000007
#define INF LLONG_MAX
#define PI 3.14159265359
using namespace std;




int main()
{
    fastio 
    // SUBL
  	int n, a[50];
  	cin >> n;
  	FI(i,1,n) cin >> a[i];
  	int ans=0;
  	FI(i,2,n-1) if((a[i]-a[i-1])*(a[i+1]-a[i])>0) ans++;
  	cout << ans;
    return 0;
}         	

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <memory.h>
using namespace std;
typedef long long ll;
const int N = 100005;
const int mod = 1e9 + 7;
string s;
int fl[2];
int x[2];
int dp[9000];
int main(){
    cin >> s;
    int n = (int)s.size();
    cin >> x[0] >> x[1];
    
    vector< int > vec[2];
    int l = 0;
    int direction = 0;
    for(int i = 0; i < n; ++i){
        if(s[i] == 'T'){
            if(i > l)
                vec[direction].push_back(i - l);
            direction ^= 1;
            l = i + 1;
        }
        else{
            
        }
    }
    if(n - 1 >= l){
        vec[direction].push_back(n - l);
    }
    for(int dir = 0; dir < 2; ++dir){
        int sum = 0;
        for(auto it : vec[dir]){
            sum += it;
        }
        sum += x[dir];
        if(sum % 2 == 0 && sum >= 0){
            int r = sum / 2;
            memset(dp, 0, sizeof(dp));
            dp[0] = 1;
            int ff = (s[0] != 'T' && dir == 0);
            if(ff){
                dp[0] = 0;
                dp[vec[0][0]] = 1;
            }
            for(int j = 0; j < (int)vec[dir].size(); ++j){
                if(ff && !j) continue;
                auto it = vec[dir][j];
                for(int i = 9000 - 1; i >= it; --i){
                    if(dp[i - it]) dp[i] = 1;
                }
            }
            fl[dir] = dp[r];
        }
    }
    if(fl[0] && fl[1]){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
N, M = map(int, input().split())
A = [int(i) for i in input().split()]
BC = []
for _ in range(M):
    B, C = map(int, input().split())
    BC.append([B, C])
BC = sorted(BC, key=lambda x: x[1], reverse=True) # ２つめの要素で降順にする
 
A_dash = [] # 変更する用の値のリスト
for ij in BC:
    i, j = ij # ２重リストを分解する
    A_dash.extend([j]*i)
    if len(A_dash) >= N:
        break
A_dash = A_dash[:N] # 最大N個まで変更
 
A_dash.extend(A)
A_dash = sorted(A_dash, reverse=True)[:N] 
# もともとの数列にくっつけて、降順ソートしてN個まで取り出す
 
print(sum(A_dash))

Measured memory_bytes: 29500
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
const int MAX = 510000;

int main() {
  int A, B;
  string S;
  cin >> A >> B >> S;
  bool OK = true;
  for (int i=0; i<S.size(); i++) {
    if (i==A&&S[i]!='-') {
      OK = false;
      break;
    }
    else if (i!=A&&S[i]=='-') {
      OK = false;
      break;
    }
  }
  if (OK) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
typedef pair<int,int> pii;
typedef long long ll;

void fastStream(){cin.tie(0);std::ios_base::sync_with_stdio(0);}

int N, A, B;
int ary[1000010];
int ans[1000010];

// 0....0 -> 0...1 or 0...1 -> 0....0 の全列挙
void rec(int *seq, int len, int cnt, int back){
    if(cnt == 0) return;
    if(!back){
        for(int i = 0; i < len; i++)
            seq[i] *= 2;
        for(int i = 0; i < len; i++)
            seq[2 * len - 1 - i] = seq[i] + 1;
    }
    else{
        for(int i = 0; i < len; i++)
            seq[i + len] = seq[i] * 2;
        for(int i = 0; i < len; i++)
            seq[i] = seq[len - 1 - i + len] + 1;
    }
    rec(seq, len * 2, cnt - 1, back);
}

int main(){

    cin >> N >> A >> B;
    const int X = A ^ B;
    if(__builtin_popcount(X) % 2){
        deque<int> ord; // 元の場所が値、インデックスが現在の場所
        int one_cnt = 0;
        for(int i = 0; i < N; i++){
            if((X >> i) & 1){
                ord.push_back(i);
                one_cnt++;
            }
            else{
                ord.push_front(i);
            }
        }
        
        int sz = 0;
        int pos = 0;
        int upper = 0;
        while(1){
            // あと1つうめる　
            if(N - pos == 1){
                ans[sz++] = upper | 0;
                ans[sz++] = upper | 1;
                break;
            }
            // あと1つうめる
            else if(N - pos == 2){
                ans[sz++] = upper | 0b00;
                ans[sz++] = upper | 0b01;
                ans[sz++] = upper | 0b11;
                ans[sz++] = upper | 0b10;
                break;
            }

            // 現在の一番上の桁を0に固定
            ary[0] = 0;
            rec(ary, 1, (N - 1 - pos), 0);
            for(int i = 0; i < (1 << (N - 1 - pos)); i++){
                ans[sz++] = upper | ary[i];
            }

            // 次に、現在の場所を1にして、その上で計算を行う
            upper |= (1 << (N - 1 - pos));
            pos++;

            if(pos == one_cnt){
                ary[0] = 1;
                rec(ary, 1, (N - pos), 1);
                for(int i = 0; i < (1 << (N - pos)); i++){
                    ans[sz++] = upper | ary[i];
                }
                break;
            }
            else{
                ary[0] = 0;
                rec(ary, 1, (N - 1 - pos), 1);
                for(int i = 0; i < (1 << (N - 1 - pos)); i++){
                    ans[sz++] = upper | ary[i];
                }
                // 次に、現在の場所を1にして、その上で計算を行う
                upper |= (1 << (N - 1 - pos));
                pos++;
            }
        }

        cout << "YES" << endl;
        // 最後に得られた数列を元に戻す
        for(int i = 0; i < sz; i++){
            int before = 0;
            int after = ans[i];
            for(int j = 0; j < N; j++){
                if((after >> j) & 1){
                    before |= (1 << ord[j]);
                }
                else{
                    before &= ~(1 << ord[j]);
                }
            }
            cout << (before ^ A) << " ";
        }
        cout << endl;
    }
    else{
        cout << "NO" << endl;
    }

    return 0;
}


Measured memory_bytes: 5632
#include<stdio.h>
int main ()
{
	int A, B, C, D, x;
	scanf("%d%d%d%d", &A, &B, &C, &D);
	if(A>=B && C>=D)
	{
		x=B+D;
		printf("%d", x);
	} 
	else if(A>=B && C<=D)
	{
		x=B+C;
		printf("%d", x);
	}
	else if(A<=B && C<=D)
	{
		x=A+C;
		printf("%d", x);
	}
	else if(A<=B && C>=D)
	{
		x=A+D;
		printf("%d", x);
	}
	return 0;
	
}

Measured memory_bytes: 1708
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long S,x,y,n=1000000000;
    cin>>S;
    x=(n-S%n)%n;
    y=(S+x)/n;
    cout<<"0 0 1000000000 1 "<<x<<" "<<y<<endl;
}

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

const long long N = 1e3 + 17;
ll a[N], b[N], cnt, ans, lnt, n, m, r1, r0, l1, l0, sum, mx, h, c[N], t[N], mn = N, x, y, k;
pair<ll,ll>pr[N];
vector<ll>v,v2;
map<ll,ll>mp;
bool used[N];
char ch[1005];
ll prime[N] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53};

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    cin >> n;
    for(ll i = 0; i < n; i ++)
    {
        cin >> a[i];
    }
    mx = a[0];
    for(ll i = 0; i < n; i ++)
    {
        if(a[i] >= mx)
        {
            cnt ++;
            mx = a[i];
        }
    }
    cout << cnt;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#define REP(i,n) for(int i=0;i<n;++i)
using namespace std;

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, m, k, e, sum = 0;
  bool a[30], b[30];

  REP(i, 30)
    a[i] = true;

  cin >> n >> m;
  for(int i = 0; i < n; ++i) {
    cin >> k;
    REP(l, m)
      b[l] = false;
    for(int j = 0; j < k; ++j) {
      cin >> e;
      b[e - 1] = true;
    }
    REP(l, m)
      if(!b[l]) {
        a[l] = false;
      }
  }

  REP(i, m)
    if(a[i]) {
      ++sum;
    }

  cout << sum << endl;

  return 0;
}


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

int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  while(1){
    c-=b;
    if(c<=0){
      cout << "Yes" << endl; 
      break;
    }
    a-=d;
    if(a<=0){
      cout << "No" << endl; 
      break;
    }
  }
  
  return 0;

}


Measured memory_bytes: 3512
n,s,t,M,m;main(i){for(;scanf("%d",m=&n),n;printf("%d %d\n",M,m))for(M=0;n-->0;M<t&&(M=t),t<m&&(m=t))for(t=i=0;i++<5;t+=s)scanf("%d",&s);}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
//int a[102][102];
int b[102][102];
int arr[26];
int main(){
    int h,w;cin>>h>>w;
    for(int i=0;i<h;++i){
        string s;cin>>s;
        for(int j=0;j<w;++j){
            //a[i+1][j+1]=s[j];
            arr[s[j]-'a']++;      
        }
    }
    if(h<w)swap(h,w);
    int i1=1,i2=h;
    int cnt=0;
    int cnt4=0;
    int cnt2=0;
    while(i1<i2){
        int j1=1,j2=w;
        ++cnt;
        while(j1<j2){
            b[i1][j1]=b[i1][j2]=cnt;
            b[i2][j1]=b[i2][j2]=cnt;
            j1++;
            j2--;
            cnt4++;
        }
        if(j1==j2){
            b[i1][j1]=b[i1][j2]=cnt;
            cnt2++;
        }
        i1++;
        i2--;
    }
   
    if(i1==i2){
        int j1=1,j2=w;
        ++cnt;
        while(j1<j2){
            b[i1][j1]=b[i1][j2]=cnt;
            b[i2][j1]=b[i2][j2]=cnt;
            j1++;
            j2--;
            cnt2++;
        }
    }
    for(int i=0;i<26;++i){
        while(arr[i]>=4 && cnt4>0){
            arr[i]-=4;
            cnt4--;
        }
    }
    if(cnt4>0){cout<<"No\n";return 0;}
    for(int i=0;i<26;++i){
        while(arr[i]>=2 && cnt2>0){
            arr[i]-=2;
            cnt2--;
        }
    }
    if(cnt2>0){cout<<"No\n";return 0;}
    cout<<"Yes\n";
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<string>
#include<algorithm>
#include<cmath>
//#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
template <class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template <class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template <class T> inline T gcd(T a, T b) {if(a==0) return b; return gcd(b%a,a);}
template <class T> inline T lcm(T a, T b) {return a * b / gcd(a,b);}
template <class T> inline T sum(vector<T> &vec) {T res=0; for (int i = 0; i < vec.size(); i++) res += vec[i]; return res;}
template <class T> inline T mpow(T a, T b) {if(b==0)return 1; T c = mpow(a,b/2);if(b%2==1)return c*c*a; return c*c;}
const int INF = 1 << 30;
const long long INFLL = 1LL << 60;
typedef pair<int, int> P;

#define REP(i,n) for (int (i)=0;(i)<(n);(i)++)
#define FOR(i,n) for (int (i)=0;(i)<(n);(i)++)
#define REPB(i,n) for (int (i)=((n)-1);(i)>=0;(i)--)
#define FORB(i,n) for (int (i)=((n)-1);(i)>=0;(i)--)
#define SORT(A) sort((A).begin(),(A).end())

int H, W;
int d1[30][30];
int d2[30][30];
vector<string> S(30);
int dx[4] = {0,1,0,-1}, dy[4] = {1,0,-1,0};

void bfs(int x, int y, int d[30][30]) {
    queue<P> que;
    que.push(make_pair(x,y));
    while (!que.empty()) {
        P p = que.front(); que.pop();
        FOR(i,4) {
            int a = p.first+dx[i], b = p.second+dy[i];
            
            if (a >= 0 && a < H && b >= 0 && b < W &&
                d[a][b] == -1 && S[a][b] == '.') {
                    d[a][b] = d[p.first][p.second] + 1;
                    que.push(make_pair(a,b));
                }
        }
    }
}

int main() {
    /*
    cin >> H >> W;
    FOR(i,H) {cin >> S[i];} 
    FOR(i,H) {
        FOR(j,W) {d1[i][j] = d2[i][j] = -1;}
    }

    FOR(i,H) {
        FOR(j,W) {
            if (S[i][j] == '.' && d1[i][j] == -1) {
                d1[i][j] = 0;
                bfs(i,j,d1);
            }
        }
    }

    int maxi, maxj, m = -1;
    FOR(i,H) {
        FOR(j,W) {
            if (d1[i][j] > m) {
                m = d1[i][j]; 
                maxi = i, maxj = j;
            }
        }
    }
    d2[maxi][maxj] = 0;
    bfs(maxi,maxj,d2);

    int res = 0;
    FOR(i,H) {
        FOR(j,W) {
            chmax(res,d2[i][j]);
        }
    }
    cout << res << endl;*/

    cin >> H >> W;
    FOR(i,H) {cin >> S[i];} 
    FOR(i,H) {
        FOR(j,W) {d1[i][j] = d2[i][j] = -1;}
    }
    
    int res = 0;
    FOR(i,H) {
        FOR(j,W) {
            if (S[i][j] == '.') {
                d1[i][j] = 0;
                bfs(i,j,d1);
            }
            FOR(k,H) FOR(l,W) {
                chmax(res,d1[k][l]);
                d1[k][l] = -1;
            }
        }
    }

    cout << res << endl;

}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] A = new int[3];

		for(int i=0; i<3; i++) {
			A[i] = sc.nextInt();
		}Arrays.sort(A);

		System.out.println(A[0]+A[1]+10*A[2]);

	}

}


Measured memory_bytes: 22228
//code by lynmisakura.wish to be accepted!
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;

int main(void){
    int n;cin >> n;
    string s;cin >> s;
    int cnt = 0;
    for (int i = 0; i < n-2; ++i)
    {
        if(s[i] == 'A' and s[i+1] == 'B' and s[i+2] == 'C'){
            cnt++;
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

void solve() {
	int n, q;
	cin >> n >> q;
	string s;
	cin >> s;
	vector<int> l(q), r(q);
	rep(i,q) {
		cin >> l[i] >> r[i];
	}
	vector<int> v(n);
	rep(i,n-1) if (s.substr(i, 2) == "AC") v[i+1]++;
	vector<int> sum(n + 1);
	rep(i,n) sum[i+1] = sum[i] + v[i];
	rep(i,q) {
		cout << sum[r[i]] - sum[l[i]] << endl;
	}
}

int main() {
	solve();
	return 0;
}

Measured memory_bytes: 5084
#include <cstdio>

int main() {
    char s[11];
    scanf("%s", s);
    char str[] = "2019/04/30";
    for (int i = 0; i < 11; i++) {
        if (s[i] < str[i]) {
            puts("Heisei\n");
            return 0;
        }
        if (s[i] > str[i]) {
            puts("TBD\n");
            return 0;
        }
    } 
    puts("Heisei\n");    // 完全に一致したとき
    return 0;
}

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

using namespace std;

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

    int a, b;
    cin >> a >> b;
    string res1 = "";
    for (int i = 0; i < a; i ++)
        res1 += to_string(b);
    
    string res2 = "";
    for (int j = 0; j < b; j ++)
        res2 += to_string(a);

    cout << ((res1>res2) ? res2 : res1);
    
    return 0;
}

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

using namespace std;

typedef long long int ll;

const int NMax = 2e5 + 5;
const int LIM = 1e9;


int main(){

    /*#ifndef ONLINE_JUDGE
    freopen("debug.in", "r", stdin);
    #endif // ONLINE_JUDGE*/

    ios::sync_with_stdio(false);
    cin.tie(NULL);

    string s;
    cin >> s;

    int best = INFINITY;
    char now = 'W';
    int placed = 0;
    for(int i = 0; i < (int)s.size(); i++) {
        if(s[i] != now) {
            now = s[i];
            placed++;
        }
    }
    best = min(placed, best);
    now = 'B';
    placed = 0;
    for(int i = 0; i < (int)s.size(); i++) {
        if(s[i] != now) {
            now = s[i];
            placed++;
        }
    }
    best = min(placed, best);

    now = 'W';
    placed = 0;
    for(int i = (int)s.size() - 1; i >= 0; i--) {
        if(s[i] != now) {
            now = s[i];
            placed++;
        }
    }
    best = min(placed, best);
    now = 'B';
    placed = 0;
    for(int i = (int)s.size() - 1; i >= 0; i--) {
        if(s[i] != now) {
            now = s[i];
            placed++;
        }
    }
    best = min(placed, best);

    cout << best;
    return 0;

}


Measured memory_bytes: 512