akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
struct pos {
  int row;
  int column;
};
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define Sort(a) sort(a.begin(), a.end())
const int INF = 1 << 30;
const ll MOD = 1000000007;
int N, M;
vector<vector<bool>> keep;
vector<int> pattern;

bool isValid(void) {
  rep(i, N - 1) {
    if (!keep[pattern[i]][pattern[i + 1]]) return false;
  }
  return true;
}
int main(void) {
  cin >> N >> M;
  keep.resize(N);
  rep(i, N) {
    keep[i].resize(N);
    pattern.push_back(i);
  }
  rep(i, M) {
    int a, b;
    cin >> a >> b;
    keep[a - 1][b - 1] = true;
    keep[b - 1][a - 1] = true;
  }

  int count = 0;
  Sort(pattern);

  do {
    if (pattern[0] != 0) break;
    if (isValid()) count++;
  } while (next_permutation(pattern.begin(), pattern.end()));
  cout << count << endl;
  return 0;
}

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

using namespace std;

#define LL long long
#define DD double
#define Pb push_back
#define Bp pop_back
#define Pf push_front
#define Fp pop_front
#define Ub upper_bound
#define Lb lower_bound
#define In insert
#define All(x) x.begin(), x.end()
#define mem(a, b) memset(a, b, sizeof(a))
#define fast ios_base::sync_with_stdio(0);cin.tie(0)
#define X first
#define Y second
#define mx1 10
#define mx2 110
#define mx3 1010
#define mx4 10010
#define mx5 100010
#define mx6 1000010

typedef vector<LL> Vl;
typedef vector<DD> Vd;
typedef vector<bool> Vb;
typedef vector<Vl> VVl;
typedef pair<LL, LL> Pll;
typedef pair<DD, DD> Pdd;
typedef vector<Pll> Vpl;
typedef vector<Pdd> Vpd;
typedef queue<LL> Ql;
typedef stack<LL> Sl;
typedef deque<LL> Dl;

LL _set(LL N, LL pos) {return N = N | (1 << pos);}
LL _reset(LL N, LL pos) {return N = N & ~(1 << pos);}
bool _check(LL N, LL pos) {return (bool)(N & (1 << pos));}
bool _upper(char a) {return a >= 'A' && a <= 'Z';}
bool _lower(char a) {return a >= 'a' && a <= 'z';}
bool _digit(char a) {return a >= '0' && a <= '9';}

LL dx[] = {1, -1, 0, 0, -1, -1, 1, 1};
LL dy[] = {0, 0, 1, -1, -1, 1, -1, 1};

///**************************DONE****************************///

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

    int L = s.size();
    if(s[0] != 'A')
        return cout << "WA\n", 0;

    int cnt = 0;
    for(int i = 1; i < L; i++){
        if(_upper(s[i])){
            if(s[i] != 'C')
                return cout << "WA\n", 0;
            else if(i < 2 || i == L - 1)
                return cout << "WA\n", 0;
            else
                cnt++;
        }
    }

    if(cnt != 1)
        cout << "WA\n";
    else
        cout << "AC\n";
    return 0;
}


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

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define rep(i, n) repd(i, 0, n)

using namespace std;

using ll = long long;
using ul = unsigned long long;
ll mod = 1000000007;

int main() {
source:
    string s;
    cin >> s;
    if (s[2] == s[3] && s[4] == s[5]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm>
#include <cstdlib>
#include <cmath>
using namespace std;

int main()
{
    int x, a, b;
    cin >> x >> a >> b;

    if (fabs(x - a) < fabs(x - b)){
        cout << 'A' << endl;
    }else{
        cout << 'B' << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
  using namespace std;
  #define       M                        1000000007
  #define       ll                       long long
  #define       FIO                      ios_base::sync_with_stdio(false);cin.tie(NULL)
  #define       ifor(st,lim)             for(int i=st;i<lim;i++)
  #define       jfor(stt,llim)           for(int j=stt;j<llim;j++)
  #define       eifor(st,lim)            for(int i=st;i<=lim;i++)
  #define       ejfor(stt,llim)          for(int j=stt;j<=llim;j++)
  #define       blank                    cout<<'\n' 


void solve()
{ 
   string s; cin>>s;
   
   if(s[0] == s[1] && s[1] == s[2] && s[0] == 'R') cout<<"3";
   else if(s[0] == s[1] && s[0] == 'R') cout<<"2";
   else if(s[1] == s[2] && s[1] == 'R') cout<<"2";
   else if(s[0] == 'R' || s[1] == 'R' || s[2] == 'R') cout<<"1";
   else cout<<"0";   
}
 
  int main()
  {
  #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
  #endif
  int t=1;
  while(t--){
      solve();
     } 
  }

Measured memory_bytes: 3600
h, n = map(int, input().split())
a = []
b = []
for i in range(n):
    a_, b_ = map(int, input().split())
    a.append(a_)
    b.append(b_)

f_inf = float("inf")
dp = [f_inf] * (h + max(a))
dp[0] = 0
for i in range(n):
    for j in range(h):
        if dp[j] != f_inf:
            if dp[j + a[i]] > dp[j] + b[i]:
                dp[j + a[i]] = dp[j] + b[i]

print(min(dp[h:]))


Measured memory_bytes: 43100
#include<stdio.h>
int main(){
    int m,f,r,sum=0;
    for(;scanf("%d%d%d",&m,&f,&r);){
        if(m==-1 && f==-1 && r==-1)
            break;
        else if(m<=50 && f<=50 && r<=100){
            sum=m+f;
            if(m==-1 || f==-1 || m+f<30)
                printf("F\n");
            else if(sum>=80)
                printf("A\n");
            else if(sum>=65 && sum<80)
                printf("B\n");
            else if(sum>=50 && sum<65)
                printf("C\n");
            else if(sum>=30 && sum<50 && r>=50)
                printf("C\n");
            else if(sum>=30 && sum<50)
                printf("D\n");
            }
        }
    return 0;
}


Measured memory_bytes: 2040
#include<vector>
#include<iostream>
#include<cmath>
using namespace std;
//宿場町はn個　m日間
int n, m, pos = 0, a;
long long ans = 0;
long long t[100000];
int main()
{
	cin >> n >> m;
	t[0] = 0;
	//累積和
	for (int i = 1; i < n; i++)
	{
		cin >> t[i];
		t[i] += t[i - 1];
	}
	pos = 0;
	for (int i = 0; i < m;i++)
	{
		cin >> a;
		ans += abs(t[pos] - t[pos + a]);
		ans %= 100000;
		pos += a;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3872
#include <bits/stdc++.h>
using namespace std;
int b, g;
int t[100000], v[100000];
long long k(int W, int n)
{
	long long K[n+1][W+1];
   for (int i = 0; i <= n; i++) 
   { 
       for (int w = 0; w <= W; w++) 
       { 
           if (i==0 || w==0) 
               K[i][w] = 0; 
           else if (t[i-1] <= w) 
                 K[i][w] = max(v[i-1] + K[i-1][w-t[i-1]],  K[i-1][w]); 
           else
                 K[i][w] = K[i-1][w]; 
       } 
   } 
   return K[n][W];
}
int main()
{
    cin >> b >> g;
    for(int i = 0; i < b; i++)
    {
    	cin >> t[i] >> v[i];
	}
	cout << k(g, b) << endl;
}



Measured memory_bytes: 79104
n = int(input())
a = list(map(int, input().split()))

d = 1000
s = 0

for i in range(n-1):
    if a[i] < a[i+1]:
        s += d//a[i]
        d %= a[i]
    elif a[i] > a[i+1]:
        d += s*a[i]
        s = 0
d += s*a[n-1]
print(d)


Measured memory_bytes: 9188
fun main(args: Array<String>) {
    val n = readInputLine().toInt()
    val s = readInputLine().toCharArray()
    
    var ans = Int.MAX_VALUE
    
    var l = 0
    var r = 0
    
    // まず、最初に1人目以外でEの数をカウントし、暫定の答えとする
    for (i in 1 until n) {
        if (s[i] == 'E') {
            r++
        }
    }
    ans = r
    
    // 1つずつずらしていき、左側で向きを変える人数と右側で向きを変える人数を増減させていく
    for (i in 1 until n) {
        if (s[i - 1] == 'W') {
            l++
        }
        if (s[i] == 'E') {
            r--
        }
        
        if (l + r < ans) {
            ans = l + r
        }
    }
    
    println(ans)
}

fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 36508
#include <iostream>
#include <algorithm>
#include <string> 
#include <vector>
#include <iomanip>
#include <math.h>
#include <map>
using namespace std;

int main()
{
	string S;
	cin >> S;
	int size = S.size();
	int C = 150;
	int F = -1;
	for (int i = 0; i < size; i++) {
		if (S[i] == 'C') {
			C = i;
			break;
		}
	}
	for (int i = size - 1; i > -1; i--) {
		if (S[i] == 'F') {
			F = i;
			break;
		}
	}
	if (C < F) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REPR(i,n) for (int i=(int)(n)-1;i>=0;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define valid(y,x,h,w) (0<=y&&y<h&&0<=x&&x<w)
#define tpl(...) make_tuple(__VA_ARGS__)
const int INF = 0x3f3f3f3f;
const double EPS = 1e-8;
const double PI = acos(-1);
const int dy[] = {-1,0,1,0};
const int dx[] = {0,1,0,-1};
typedef long long ll;
typedef pair<int,int> pii;
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; }
template<typename Ch,typename Tr,typename C,typename=decltype(begin(C()))>basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>&os,
const C& c){os<<'[';for(auto i=begin(c);i!=end(c);++i)os<<(i==begin(c)?"":" ")<<*i;return os<<']';}
template<class S,class T>ostream&operator<<(ostream &o,const pair<S,T>&t){return o<<'('<<t.first<<','<<t.second<<')';}
template<int N,class Tp>void output(ostream&,const Tp&){}
template<int N,class Tp,class,class ...Ts>void output(ostream &o,const Tp&t){if(N)o<<',';o<<get<N>(t);output<N+1,Tp,Ts...>(o,t);}
template<class ...Ts>ostream&operator<<(ostream&o,const tuple<Ts...>&t){o<<'(';output<0,tuple<Ts...>,Ts...>(o,t);return o<<')';}
template<class T>void output(T t,char z=10){if(t<0)t=-t,putchar(45);int c[20];
int k=0;while(t)c[k++]=t%10,t/=10;for(k||(c[k++]=0);k;)putchar(c[--k]^48);putchar(z);}
template<class T>void outputs(T t){output(t);}
template<class S,class ...T>void outputs(S a,T...t){output(a,32);outputs(t...);}
template<class T>void output(T *a,int n){REP(i,n)cout<<a[i]<<(i!=n-1?',':'\n');}
template<class T>void output(T *a,int n,int m){REP(i,n)output(a[i],m);}
template<class T>bool input(T &t){int n=1,c;for(t=0;!isdigit(c=getchar())&&~c&&c-45;);
if(!~c)return 0;for(c-45&&(n=0,t=c^48);isdigit(c=getchar());)t=10*t+c-48;t=n?-t:t;return 1;}
template<class S,class ...T>bool input(S&a,T&...t){input(a);return input(t...);}
template<class T>bool inputs(T *a, int n) { REP(i,n) if(!input(a[i])) return 0; return 1;}

int main() {
  int a,p;
  while(input(a,p)) {
    cout << (a * 3 + p) / 2 << endl;
  }
}


Measured memory_bytes: 256
#include <string>
#include <sstream>
#include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>
#include <functional>
#include <map>
#include <climits>
#include <queue>

using namespace std;

#define ll long long

class Main {
public:
	bool contains(vector<string> image, vector<string> templ) {
		int n = image.size();
		int m = templ.size();

		for (int i = 0;i <= n - m;i++) {
			for (int j = 0;j <= n - m;j++) {
				bool ok = true;

				for (int x = 0;x <= m - 1;x++) {
					for (int y = 0;y <= m - 1;y++) {
						if (image[i + x][j + y] != templ[x][y]) {
							ok = false;
						}
					}
				}

				if (ok) {
					return true;
				}
			}
		}

		return false;
	}
};


int main()
{
	Main main;
	int n,m;
	vector<string> image, templ;

	cin >> n >> m;
	for (int i = 0;i < n;i++) {
		string inp;
		cin >> inp;
		image.push_back(inp);
	}

	for (int i = 0;i < m;i++) {
		string inp;
		cin >> inp;
		templ.push_back(inp);
	}

	cout << (main.contains(image, templ) ? "Yes" : "No") << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main() {
    int n;
    ll md=0;
    cin >> n;
    vector<ll> hai_a(n);
    for(int i=0;i<n;i++){
        cin >> hai_a.at(i);
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<i;j++){
            if(abs(hai_a.at(i)-hai_a.at(j))>=md){
                md = abs(hai_a.at(i)-hai_a.at(j));
            }
        }
    }
    cout << md <<endl;
}


Measured memory_bytes: 256
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

#include <boost/rational.hpp>
*/
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using ll = long long;
using ld = long double;
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rep3(i, n) for (ll i = 1; i < (ll)(n+1); i++)
#define rep4(i, s, n) for (ll i = (s); i < (ll)(n+1); i++)
#define repr(i,n) for (ll i = (n-1); i>=0;i--)
#define repr3(i,n) for(ll i = (n);i>0;i--)
#define repr4(i,s,n) for(ll i = (n);i>=(s);i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;
using Graphw = vector<vector<pair<ll,ll>>>;
#define INF1  INT_MAX;
#define INF2  LLONG_MAX;
#define PI  3.14159265358979323846;
#define MOD 1000000007;
/*
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部長が32の浮動小数点数型
using Real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部長が1024の浮動小数点数型
using Real1024 = mp::number<mp::cpp_dec_float<1024>>;
// 有理数型
using Rat = boost::rational<Bint>;
*/


int main(){
int N;
cin>>N;
ll A[N+1];
rep3(i,N){
    cin>>A[i];
}
ll ans=0;
rep(j,60){
    ll x=0,ansj;
rep3(i,N){
    if((A[i]>>j)&1)x++;
}
    ansj=x*(N-x);

rep(k,j){
    ansj=ansj*2%MOD;

    }
    ans+=ansj;
    ans%=MOD;


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

Measured memory_bytes: 5884
#include <bits/stdc++.h>
#define foi(i,k,n) for(int i = (int)k; i < (int)n; ++i)

using namespace std;
using ll = unsigned long long;
using ii = pair<int,int>;

constexpr int MAXN = 5 + 200000;

namespace stree {
#define m ((s+e)/2)
int t[4*MAXN], lazy[4*MAXN];
int query(int s, int e, int p, int l, int r) {
  if (l > r) return 0; // Elemento neutro.
  if (s == l && e == r) return t[p];
  return max(query(s, m, 2*p, l, min(m,r)),
             query(1+m, e, 1+2*p, max(1+m,l), r));
}
void update(int s, int e, int p, int l, int r, int add) {
  if (l > r) return;
  if (s == l && e == r) {
    t[p] = add;
  } else {
    update(s, m, 2*p, l, min(m,r), add);
    update(1+m, e, 1+2*p, max(1+m,l), r, add);
    t[p] = max(t[2*p], t[1+2*p]);
  }
}}

namespace comp {
int v[MAXN];
// Comprime todos los numeros comenzando desde BEG en O(nlgn).
void compress(int arr[], int n, int BEG = 1) {
  copy(arr, arr + n, v); sort(v, v + n);
  int sz = unique(v, v + n) - v;
  foi (i,0,n) {
    arr[i] = BEG + lower_bound(v, v + sz, arr[i]) - v;
  }}}

int a[MAXN], res[MAXN], n;
vector<int> t[MAXN];

void solve(int u, int p, int rup) {
  int rbef = stree::query(1,n,1,a[u-1],a[u-1]);
  int resu = 1 + stree::query(1,n,1,1,a[u-1]-1);
  bool change = false;
  if (resu > rbef) {
    change = true;
    stree::update(1,n,1,a[u-1],a[u-1],resu);
  }

  rup = max(rup, resu);
  res[u] = rup;

  for (int v : t[u]) {
    if (v == p) continue;
    solve(v,u,rup);
  }

  if (change) stree::update(1,n,1,a[u-1], a[u-1], rbef);
}

int main() {
  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  cin >> n;
  foi (i,0,n) cin >> a[i];
  foi (i,1,n) {
    int u,v; cin >> u >> v;
    t[u].push_back(v);
    t[v].push_back(u);
  }
  comp::compress(a, n);
  solve(1,-1,1);
  for (int i = 1; i <= n; ++i) cout << res[i] << '\n';
  return 0;
}


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

typedef long long int lli;

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


    lli a, b;
    char ch;

    cin >> a >> ch >> b;
    if(ch == '+')
    {
        cout << a + b;
    }
    else
    {
        cout << a- b;
    }
}


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

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef long double ld;

const int INF = 1e9;
const ld EPS = 1e-8;

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

  string ret;

  if(S.length() < 26) {
    ret = S;
    vector<bool> cnt(26, false);
    for(char c: S) cnt[c - 'a'] = true;
    REP(i,26) {
      if(cnt[i]) continue;
      ret += 'a' + i;
      break;
    }
  }else{
    ret = "-1";
    vector<bool> cnt(26, false);
    for(int i = 25; i >= 0; --i) {
      for(int j = S[i] - 'a' + 1; j < 26; ++j) {
        if(cnt[j]) {
          ret = S.substr(0, i);
          ret += 'a' + j;
          break;
        }
      }
      if(ret != "-1") break;
      cnt[S[i] - 'a'] = true;
    }
  }

  cout << ret << endl;
  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = 0; i < (n); i++)
 
int main(){
    int N,X,Y;
    cin >> N >> X >> Y;
    int R[N+1] = {};
    for(int i=1;i<=N;i++){
        for(int j=i+1;j<=N;j++){
            int k = min(j-i,abs(X-i) + abs(Y-j) + 1);
            R[k]++;
        }
    }
    for(int i=1;i<=N-1;i++){
        cout << R[i] << endl;
    }
 
    return 0;
}

Measured memory_bytes: 256
N = int(input())
H = [int(h) for h in input().split()]

minus_point = 0
for n in range(N-1):
  h1 = H[n]
  h2 = H[n+1]
  if h1 < h2:
    minus_point = 0
    continue
  elif h1 == h2:
    continue
  elif h1 - h2 == 1:
    if minus_point == 0:
      minus_point += 1
    else:
      print("No")
      break
  else: #h1-h2 > 1:
    print("No")
    break
else:
  print("Yes")

Measured memory_bytes: 14252
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define all(a) a.begin(), a.end()
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; }
using namespace std;

#define int long long
// AtCoder Grand Contest 037
signed main(){
    
    int n; cin >> n;
    vector<int> a(n), b(n);
    rep(i, n)cin >> a[i];
    rep(i, n)cin >> b[i];

    typedef pair<int, int> pa;
    priority_queue<pa> que;

    auto judge = [&](int i){
        return b[i] > b[(i + 1) % n] and b[i] > b[(i + n - 1) % n] and b[i] > a[i];
    };

    auto doit = [&](int i){
        que.push(pa(b[i], i));
    };
  
    rep(i, n){
        if(judge(i))doit(i);
    }

    int ans = 0;
    while(que.size()){
        pa p = que.top(); que.pop();
        int i = p.second;
        int sum = b[(i + 1) % n] + b[(i + n - 1) % n];
        if(b[i] - sum < a[i]){
            cout << -1 << endl;
            return 0;
        }
        if(b[i] - sum <= max(b[(i + 1) % n], b[(i + n - 1) % n])){
            ans++;
            b[i] -= sum;
        } else {
            int mx = max<int>({b[(i + 1) % n], b[(i + n - 1) % n], a[i]});
            int step = (b[i] - mx) / sum;
            b[i] -= step * sum;
            ans += step;
        }
        if(judge(i))doit(i);
        if(judge((i + 1) % n))doit((i + 1) % n);
        if(judge((i + n - 1) % n))doit((i + n - 1) % n);
    }

    rep(i, n)if(b[i] > a[i]){
        cout << -1 << endl;
        return 0;
    }

    cout << ans << endl;
    return 0;

}

Measured memory_bytes: 6136
#include<stdio.h>
using namespace std;
#define NEL -1

struct bi{
    int p,l,r;
};

bi a[30];
int n,d[30],h[30];

void de(int u,int p){
    if(u==NEL) return ;
    d[u]=p;
    if(a[u].l!=NEL) de(a[u].l,p+1);
    if(a[u].r!=NEL) de(a[u].r,p+1);
}

int hi(int u){
    int h1=0;
    int h2=0;
    if(a[u].l!=NEL) h1=hi(a[u].l)+1;
    if(a[u].r!=NEL) h2=hi(a[u].r)+1;
    return h[u]=(h1>h2?h1:h2);
}

int s(int u){
    int c=a[u].p;
    if(c!=-1)
        if(a[c].l==u) return a[c].r;
        if(a[c].r==u) return a[c].l;
}

void print(){
    for(int i=0;i<n;i++){
        int x=0;
        printf("node %d: ",i);
        printf("parent = %d, ",a[i].p);
        if(a[i].p!=NEL)
            printf("sibling = %d, ",s(i));
        else
            printf("sibling = %d, ",-1);
        if(a[i].l!=NEL) x++;
        if(a[i].r!=NEL) x++;
        printf("degree = %d, ",x);
        printf("depth = %d, ",d[i]);
        printf("height = %d, ",h[i]);
        if(a[i].p!=NEL)
            if(x) printf("internal node\n");
            else printf("leaf\n");
        else printf("root\n");
    }
}

int main(){
    int id,r1,l1,r;
    scanf("%d",&n);
    for(int i=0;i<n;i++) { a[i].p=NEL; a[i].l=NEL; a[i].r=NEL; }
    for(int i=0;i<n;i++){
        scanf("%d%d%d",&id,&l1,&r1);
        a[id].l=l1;
        a[id].r=r1;
        if(l1!=NEL) a[l1].p=id;
        if(r1!=NEL) a[r1].p=id;
    }
    for(int i=0;i<n;i++) if(a[i].p==NEL) { r=i; break; }
    de(r,0);
    hi(r);
    print();
    return 0;
}

Measured memory_bytes: 2648
import sys

a = []
for i in range(10):
    a.append(int(input()))
#num = [1819, 2003, 876, 2840, 1723, 1673, 3776, 2848, 1592, 922]
a.sort(reverse = True)
print(a[0])
print(a[1])
print(a[2])

Measured memory_bytes: 7648
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<stdio.h>
#include<deque>
#include<map>
#include<queue>

typedef long long ll;

#define debug(x) cout << #x << "=" << x << endl;
#define debug_arr(a, n) for(int i = 0; i < n; i++)cout << a[i] << " "
#define inf 100000000000
#define loop(i,n) for(int i = 0; i < n; i++)
#define graph vector<vector<ll>>
#define P pair<ll,ll>

using namespace std;

struct Edge{
    int to,id;
};

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

    vector<vector<Edge>> edgeVector(n);
    vector<int> ans(n-1);
    loop(i,n-1){
        int a,b;
        cin >>a >>b;
        a--;
        b--;
        edgeVector[a].push_back(Edge{b,i});
        edgeVector[b].push_back(Edge{a,i});
    }

    vector<int> used(n,0);
    queue<int> q;
    q.push(0);
    used[0] = 1;

    while(!q.empty()){
        int current = q.front();
        q.pop();
        int c = -1;
        loop(i, edgeVector[current].size()){
            int to = edgeVector[current][i].to;
            int id = edgeVector[current][i].id;
            
            if(used[to]) c = ans[id];
        }

        int k = 1;
        loop(i, edgeVector[current].size()){
            int to = edgeVector[current][i].to;
            int id = edgeVector[current][i].id;

            if(used[to]) continue;
            if(k == c) k++;
            ans[id] = k;
            k++;
            q.push(to);
            used[to] = 1;
        }
    }

    int maxValue = 0;
    loop(i,n-1){
        maxValue = max(ans[i],maxValue);
    }
    cout << maxValue << endl;

    loop(i, n-1){
        cout << ans[i] << endl;
    }

    return 0;

}

Measured memory_bytes: 7296
import collections

N = int(input())
a = [int(i) for i in input().split()]

# a = [1, 1, 1, 2, 2, 3]

c = collections.Counter(a)

ans = 0
for key in list(c.keys()):
    if c[key] > key:
        ans += c[key] - key
    elif key > c[key]:
        ans += c[key]

print(ans)

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

int main(){
  int n, s, t, a;
  cin >> n;
  int b[n];
  for(int i = 0; i < n; i++){
    cin >> b[i];
  }
  s = 1;
  t = 0;
  for(int i = 0; i < n; i++){
    if(b[i] == s)
      s++;
    else
      t++;
  }
  if(t == n)
    cout << "-1" << endl;
  else
    cout << t << endl;
}

Measured memory_bytes: 1024
import sys
from collections import *
import heapq
import math
# from math import gcd
import bisect
import copy
from itertools import permutations,accumulate,combinations,product
# def input():
#     return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n,k=map(int,input().split())
a=list(map(int,input().split()))
rlst=ruiseki(a)
# print(rlst)
lst=[]
for i in range(n+1):
    for j in range(i+1,n+1):
        # print(i,j)
        lst.append(rlst[j]-rlst[i])
# print(lst)
tmp=math.log(rlst[-1],2)
now=int(tmp)

while now>=0:
    anslst=[]
    for i in range(len(lst)):
        if 1&(lst[i]>>now)==1:
            anslst.append(lst[i])
    if len(anslst)>=k:
        lst=anslst
    now-=1
# print(lst)
ans=lst[0]
for i in range(k):
    ans=ans&lst[i]
print(ans)

Measured memory_bytes: 66044
#include<iostream>

using namespace std;
#define rep(i, a) for(int i=0; i<(a); i++)
string A, B;
int M;
int memo[502][2][4][10][500];
//pos, less, hoge, pre, modM
string S;
const int up=2, down=3;
const int mod=1e4;



int rec(int i, int j, int k, int l, int m){

    if(memo[i][j][k][l][m]!=-1) return memo[i][j][k][l][m];

    if(i==S.size()){
        return memo[i][j][k][l][m]=((k!=0)&&(m==0));

    }
    int ret=0;
    int ue=(j? 9: S[i]-'0');
    rep(d, ue+1){
        int diff=d-l;
        int nj=(j||d<ue);
        int nk;
        int nm=(10*m+d)%M;
        if(k==0){
            nk=(d!=0);
        }else if(k==1){
            if(diff==0) continue;
            nk=(diff>0? up: down);
        }else if(k==up&&diff<0){
            nk=down;
        }else if(k==down&&diff>0){
            nk=up;
        }else{
            continue;
        }
        (ret+=rec(i+1, nj, nk, d, nm))%=mod;
    }

    return memo[i][j][k][l][m]=ret;
}


int calc(string N){

    fill((int*)memo, (int*)memo+502*2*4*10*500, -1);
    S=N;
    return rec(0, 0, 0, 0, 0);
}

void minus1(){

    int len=A.size();
    for(int i=0; i<len; i++){
        char ch=A[len-1-i];
        if(ch=='0'){
            A[len-1-i]='9';
        }else{
            A[len-1-i]=ch-1;
            break;
        }
    }
    if(A[0]=='0'&&A.size()>1) A=A.substr(1);
}

int main(){

    cin>> A>> B>> M;

    minus1();
    cout<< (calc(B)-calc(A)+mod)%mod<< endl;

    return 0;
}

Measured memory_bytes: 81624
import fractions
N = int(input())
a = list(map(int, input().split()))

ans = a[0]
for i in range(1, N):
    ans = ans * a[i] // fractions.gcd(ans, a[i])

kai = 0
for i in range(N):
  kai += ans // a[i]

print(kai % (pow(10,9) + 7))

Measured memory_bytes: 6200
data class P(val x: Int, val y: Int, val h: Int)

fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val arr = Array(n) {
        readLine()!!.split(" ").map { it.toInt() }.let { P(it[0], it[1], it[2]) }
    }
    for (cx in 0..100) {
        for (cy in 0..100) {
            val info = arr.firstOrNull { it.h > 0 }
            if (info == null) {
                if (!arr.any { it.x == cx && it.y == cy }) {
                    println("$cx $cy 1")
                    break
                }
            } else {
                val H = info.h + Math.abs(info.x - cx) + Math.abs(info.y - cy)
                if (arr.all { it.h == Math.max(0, H - Math.abs(it.x - cx) - Math.abs(it.y - cy)) }) {
                    println("$cx $cy $H")
                    return
                }
            }
        }
    }
}

Measured memory_bytes: 37872
//Copyright(c)2018 Mstdream
#include<bits/stdc++.h>
#define LL long long
using namespace std;
const int N=505;
int n,is[N*N],pr[N*N],cnt;
LL a[N][N];
map<int,int>x,y;
int main(){
	//freopen("xxx.in","r",stdin);
	//freopen("xxx.out","w",stdout);
	for(int i=2;i<=100000;i++){
		if(!is[i]){
			pr[++cnt]=i;
			for(int j=i+i;j<=100000;j+=i)is[j]=1;
		}
	}
	cin>>n;
	cnt=0;
	for(int i=0;i<=n+n+2;i+=2)x[i]=pr[++cnt];
	int sta=-n-1,end=n+1;
	if(end&1)sta--,end++;
	for(int i=sta;i<=end;i+=2)y[i]=pr[++cnt];
	for(int i=0;i<=n+1;i++){
		for(int j=0;j<=n+1;j++){
			if((i+j)%2==0)a[i][j]=x[i+j]*y[i-j];
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			if((i+j)%2==1){
				a[i][j]=a[i-1][j];
				a[i][j]=a[i][j] / __gcd(a[i][j], a[i + 1][j]) * a[i + 1][j];
				a[i][j]=a[i][j] / __gcd(a[i][j], a[i][j - 1]) * a[i][j - 1];
				a[i][j]=a[i][j] / __gcd(a[i][j], a[i][j + 1]) * a[i][j + 1];
				a[i][j] ++;
			}
			printf("%lld%c",a[i][j]," \n"[j==n]);
		}
	}
}


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

int  main()
{
	int n, k; cin >> n >> k;
	if (n % k)
		cout << 1 << endl;
	else if (n % k == 0)
		cout << 0 << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

ll gcd(ll a, ll b) {
	if (b == 0) { return a; }
	if (a < b) { return gcd(b, a); }
	return gcd(b, a%b);
}

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

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};


///////////////////////////



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

	cout << (N + 1) / 2;
	

	system("PAUSE");
}






Measured memory_bytes: 504
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<map>
#include<set>

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
 
#define PRINT(str) printf(#str "\n")
#define yOUT PRINT(Yes)
#define nOUT PRINT(No)
#define YOUT PRINT(YES)
#define NOUT PRINT(NO)
 
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()


using namespace std;
 
int main(void)
{   
    int n, m, ans;
    map<string, int> mp;
    cin >> n;
    vector<string> s(n);
    REP(i, n){
        cin >> s[i];
        mp[s[i]]++;
    }
    cin >> m;
    vector<string> t(m);
    REP(i, m){
        cin >> t[i];
        mp[t[i]]--;
    }

    for(auto itr = mp.begin(); itr != mp.end();itr++){
        if(itr == mp.begin()){
            ans = itr->second;
        }
        else{
            ans = max(ans, itr->second);
        }
    }

    if(ans < 0) ans = 0;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cctype>
#include <algorithm>
#define repu(i,x,y) for (int i=x; i<=y; ++i)
using namespace std;

int n,tot,ans[100100],bit[100100];
struct data
{
    int l,r,id;
    bool operator<(const data &t) const
    {
        return l>t.l || l==t.l && id<t.id;
    }
} a[15000100];

int getint()
{
    char ch;
    while (!isdigit(ch=getchar()));
    int x=ch-'0';
    for (; isdigit(ch=getchar()); x=x*10+ch-'0');
    return x;
}

void add(int x)
{
    for (; x<=n; ++bit[x],x+=x&-x);
}

int query(int x)
{
    int ret=0;
    for (; x; ret+=bit[x],x-=x&-x);
    return ret;
}

int main()
{
    scanf("%d%d",&tot,&n);
    repu(i,1,tot)
        a[i].l=getint(),a[i].r=getint();
    repu(i,1,n)
        ans[i]=tot;
    repu(i,2,n)
        for (int j=0; j<n; j+=i)
            a[++tot]=(data){j+1,min(j+i-1,n),i};
    sort(a+1,a+1+tot);
    repu(i,1,tot)
        if (a[i].id)
            ans[a[i].id]-=query(a[i].r);
        else
            add(a[i].r);
    repu(i,1,n)
        printf("%d\n",ans[i]);
    return 0;
}

Measured memory_bytes: 21760
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <sstream>
#include <cmath>
#include <queue>

using namespace std;

#define INF (1 << 28)
#define MAX_E 1000
#define MAX_V 100

int cost[MAX_V][MAX_V];
bool used[MAX_V];
int d[MAX_V];

// O(V^2)??§?????????????????£??¨??????

void shortest_path(int s, int V){
	for(int i = 0; i < V; i++){
		d[i] = INF;
		used[i] = false;
	}
	d[s] = 0;
	while(true){
		
		int add_v = -1;
		
		for(int u = 0; u < V; u++){
			if(!used[u] && (add_v == -1 || d[u] < d[add_v])){
				add_v = u;
			}
		} // ??´??°????????????????±????
		
		if(add_v == -1){
			break;
		} // ??´??°???????????????????????´????????????
		used[add_v] = true;
		
		for(int u = 0; u < V; u++){
			d[u] = min(d[u], d[add_v] + cost[add_v][u]);
		} // ???????????????????????????????°???????????????´??°
	}
}

int main(){
	
	int V = 10; // V???????????°
	
	int n;
	
	bool town_use[10];
	
	while(true){
		
		cin >> n;
		
		if(n == 0){
			break;
		}
		
		for(int i = 0; i < 100; i++){
			for(int j = 0; j < 100; j++){
				cost[i][j] = INF;
			}
		}
		
		for(int i = 0; i < 10; i++){
			town_use[i] = false;
		}
		
		for(int i = 0; i < n; i++){
			int hoge1, hoge2, hoge3;
			cin >> hoge1 >> hoge2 >> hoge3;
			cost[hoge1][hoge2] = hoge3;
			cost[hoge2][hoge1] = hoge3;
			town_use[hoge1] = true;
			town_use[hoge2] = true;
		}
		
		int min = INF;
		int ans = 0;
		
		for(int i = 0; i < 10; i++){
			int sum = 0;
			if(town_use[i]){
				shortest_path(i, V);
				for(int j = 0; j < 10; j++){
					if(d[j] != INF){
						sum += d[j];
					}
				}
				if(sum < min){
					min = sum;
					ans = i;
				}
			}
		}
		
		cout << ans << " " << min << endl;
		
	}
	
	return 0;
}

Measured memory_bytes: 3088
n,m = map(int,input().split())

acs = [0 for i in range(n)]
was = [0 for i in range(n)]
ps = []
ss = []


for i in range(m):
    pa,sa = input().split()
    pa = int(pa)
    if sa == "AC":
        acs[pa-1] = 1
    if sa == "WA" and acs[pa-1] == 0:
        was[pa-1] += 1

wa_cnt = 0
for i in range(n):
    if acs[i] == 1:
        wa_cnt += was[i]


print(sum(acs), wa_cnt)

Measured memory_bytes: 47280
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <string>

using namespace std;

#define LL long long

const int dx[4] = {1, -1, 0, 0};
const int dy[4] = {0, 0, 1, -1};

LL mod(LL x, LL md) {
	return ((x % md) + md) % md;
}

class Mint {
public:
	static LL md;
	LL x;
	Mint(LL _x) {
		x = mod(_x, md);
	}
	Mint(const Mint &y) {
		x = mod(y.x, md);
	}
};

void MintMyExgcd(LL a, LL b, LL &x, LL &y) {
	// solve equation ax + by = 1 (mod m)
	LL md = Mint::md;
	if (b == 0) {
		y = 0;
		x = 1;
		return ;
	}
	MintMyExgcd(b, a % b, x, y);
	LL t = y;
	y = mod(x - (a / b) * y, md);
	x = t;
}

LL MintNY(LL x) {
	if (x == 0) {
		return 1;
	}
	LL md = Mint::md;
	LL a, b;
	MintMyExgcd(x, md, a, b);
	while (a < 0) {
		a += md;
	}
	return a;
}

/* LL gcd(LL a, LL b) {
	if (b == 0) {
		return a;
	}
	return gcd(b, a % b);
} */

Mint operator+(Mint a, Mint b) {
	return Mint(mod(a.x + b.x, Mint::md));
}
Mint operator-(Mint a, Mint b) {
	return Mint(mod(a.x - b.x, Mint::md));
}
Mint operator*(Mint a, Mint b) {
	return Mint(mod(a.x * b.x, Mint::md));
}
Mint operator/(Mint a, Mint b) {
	Mint c = Mint(MintNY(b.x));
	return Mint(mod(a.x * c.x, Mint::md));
}

Mint operator-(Mint a) {
	return Mint(-a.x);
}
bool operator==(Mint a, Mint b) {
	return a.x == b.x;
}
bool operator!=(Mint a, Mint b) {
	return a.x != b.x;
}
bool operator>(Mint a, Mint b) {
	return a.x > b.x;
}
bool operator<(Mint a, Mint b) {
	return a.x < b.x;
}
bool operator>=(Mint a, Mint b) {
	return a.x >= b.x;
}
bool operator<=(Mint a, Mint b) {
	return a.x <= b.x;
}

void operator+=(Mint &a, Mint b) {
	a = a + b;
}
void operator-=(Mint &a, Mint b) {
	a = a - b;
}
void operator*=(Mint &a, Mint b) {
	a = a * b;
}
void operator/=(Mint &a, Mint b) {
	a = a / b;
}

ostream& operator<<(ostream &out, Mint a) {
	out << a.x;
	return out;
}

istream& operator>>(istream &in, Mint &a) {
	in >> a.x;
	return in;
}

Mint factorial(LL n) {
	if (n == 0) {
		return Mint(1);
	}
	Mint res = 1;
	for (LL i = 1; i <= n; ++i) {
		res *= i;
	}
	return res;
}
Mint multiRange(LL s, LL t) {
	Mint res = 1;
	for (LL i = s; i <= t; ++i) {
		res *= i;
	}
	return res;
}

Mint getC(LL n, LL k) {
	if (n - k < k) {
		return getC(n, n - k);
	}
	return multiRange(n - k + 1, n) / factorial(k);
}

Mint getA(LL n, LL k) {
	return multiRange(n - k + 1, n);
}

Mint countNonNegativeDivision(LL n, LL k) {
	return getC(n + k - 1, k - 1);
}
Mint countPositiveDivision(LL n, LL k) {
	if (n < k) {
		return 0;
	}
	if (k <= 0) {
		return 0;
	}
	return getC(n - 1, k - 1);
}
Mint quickMod(Mint a, LL b) {
	Mint res = 1;
	while (b > 0) {
		if (b % 2) {
			res *= a;
		}
		a *= a;
		b /= 2;
	}
	return res;
}

LL Mint::md = 1000000007;
int s, w;
int main() {
	cin >> s >> w;
	if (w >= s) {
		cout << "unsafe" << endl;
	}
	else {
		cout << "safe" << endl;
	}
	return 0;
}

Measured memory_bytes: 3640
S = input()
ans = 0
S = S.replace("><", ">,<").split(",")
for s in S:
  a = s.count(">")
  b = s.count("<")
  ans += a * (a - 1) // 2 + b * (b - 1) // 2 + max(a, b)
print(ans)


Measured memory_bytes: 79732
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < n; ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
#define FORV(i, v) for (auto i = v.begin(); i != v.end(); i++)
using namespace std;

using ll = int64_t;

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; }
const int INF = 1001001001;
const long long INFL = (1LL<<60);
const double eps = (1e-9);


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

  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];

  int ans = INF;

  for (int i = MIN(a); i <= MAX(a); i++) {
    int tmp = 0;
    for (int x : a) {
      tmp += (x - i) * (x - i);
    }
    chmin(ans, tmp);
  }

  cout << ans << endl;

  return 0;
}


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

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "Yes" : "No") << endl;
typedef long long ll;

const int INF = 1e9 + 1;
const int MAX_N = 1e3 + 1;

int N;
string s;

int cnt[MAX_N][26];

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

  cin >> N;
  cin >> s;

  REP(i, N) {
    if (i > 0) {
      REP(j, 26) {
	cnt[i][j] += cnt[i - 1][j];
      }
    }
    cnt[i][s[i] - 97]++;
  }

  int ans = 0;
  
  REP(i, N) {
    int tmp = 0;
    REP(j, 26) {
      if (cnt[i][j] > 0 && cnt[N - 1][j] - cnt[i][j] > 0) {
	tmp++;
      }
    }
    ans = max(ans, tmp);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <iomanip>

using namespace std;
int main(void){
  int a,b,x;
  cin >> a >> b >> x;
  double arctan;
  if(2*x >= a*a*b){
    double denom = 2*((double)a*a*b - (double)x);
    double numer = pow(a,3.0);
    arctan = M_PI/2 - atan(numer/denom);
  }else{
    double denom = (double)a*b*b;
    double numer = 2.0*x;
    arctan = M_PI/2 - atan(numer/denom);
  }
  cout << std::setprecision(13) << arctan/(2.0*M_PI)*360 << endl;
  return 0;
} 


Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main(){
    int n,l;
    cin  >> n >> l;
    int ans = 0;
    int nnum = 101;
    bool flag = true;
    for(int i = 0; i < n; i++){
        ans += l+i;
        if(abs(l+i) < nnum){
            nnum = abs(l+i);
            if(l+i<0) flag = false; 
            else flag = true;
        }
    }
    if(flag)cout << ans-nnum << endl;
    else cout << ans+nnum << endl;
    return 0;
}

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

int main() {
    int N, K;
    cin >> N >> K;
    vector<long long int> H(N);
    for(int i = 0; i < N; i++) {
        cin >> H[i];
    }
    sort(H.rbegin(), H.rend());
    long long int ans = 0;
    for(int i = K; i < N; i++) {
        ans += H[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
#define _CRT_SECURE_NO_WARNINGS
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define rep(i,n) for(int i=0;i<(lint)(n);i++)
#define REP(i,n) for(int i=1;i<=(lint)(n);i++)
#define all(V) V.begin(),V.end()
#define stackReplaceBegin(size)\
	void* p=malloc(size);\
	esp_new=(lint)p+size-1;\
	void * stack_extend_memory_ = malloc(size);\
	void * stack_extend_origin_memory_;\
	char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);\
	*stack_extend_dummy_memory_ = 0;\
	asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
typedef long long lint;
typedef unsigned long long ulint;
typedef std::pair<int, int> P;
constexpr int INF = INT_MAX/2;
constexpr lint LINF = LLONG_MAX/2;
constexpr double eps = DBL_EPSILON;
constexpr double PI = 3.141592653589793238462643383279;
lint esp_new;
template<class T>
class prique :public std::priority_queue<T, std::vector<T>, std::greater<T>> {};
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
	if (lhs < rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
	if (lhs > rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
inline lint gcd(lint a, lint b) {
	while (b) {
		lint c = a;
		a = b; b = c % b;
	}
	return a;
}
inline lint lcm(lint a, lint b) {
	return a / gcd(a, b) * b;
}
bool isprime(lint n) {
	if (n == 1)return false;
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}
	return true;
}
template<typename T>
T mypow(T a, unsigned int b) {
	T res(1),now(a);
	while(b){
		if(b&1)res*=now;
		b>>=1;
		now*=now;
	}
	return res;
}
template<typename T>
void printArray(std::vector<T>& vec) {
	rep(i, (int)vec.size() - 1)std::cout << vec[i] << " ";
	if(!vec.empty())std::cout << vec.back() << std::endl;
}
template<typename T>
void printArray(T l, T r) {
	T rprev = r;
	rprev--;
	for (T i = l; i != rprev; i++) {
		std::cout << *i << " ";
	}
	std::cout << *rprev << std::endl;
}
int main(){
	lint n,m;
	std::cin>>n>>m;
	if(n==1||m==1)std::cout<<1<<std::endl;
	else std::cout<<(n*m+1)/2<<std::endl;
	return 0;
}


Measured memory_bytes: 3528
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
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; }
int main(){
    ll k,n; cin>>k>>n;
    vector<ll> a(n);
    rep(i,n) cin>>a[i];
    ll res=0;
    rep(i,n-1) chmax(res, a[i+1]-a[i]);
    chmax(res, a[0]+k-a[n-1]);
    cout<<k-res<<endl;
    return 0;
}

Measured memory_bytes: 1792
#include<stdio.h>
#include<algorithm>
#include<stdio.h>
using namespace std;
int main()
{
    int n;
    char str[105],str2[105];
    scanf("%d",&n);
    scanf("%s",str);
    scanf("%s",str2);
    int j=0,k=0;
    for(int i=0;i<2*n;i++)
    {
        if(i%2==0)
        {
            printf("%c",str[j++]);
        }
        else
        {
            printf("%c",str2[k++]);
        }
    }
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define Rep(i, n) for (int i = 0; i < (int)(n); i++)
#define BitRep(i, n) for (int i = 0; i < (int)(1 << n); i++)
#define All(vec) vec.begin(), vec.end()
#define Sum(vec) accumulate(vec.begin(), vec.end(), 0)
#define Sort(vec) sort(vec.begin(), vec.end())
#define Reverse(vec) reverse(vec.begin(), vec.end())
#define Next_permutation(vec) next_permutation(vec.begin(), vec.end())
#define PI acos(-1)

int main() {
    int N, M;
    cin >> N >> M;
    priority_queue<int> A;
    Rep(i, N) {
        int a;
        cin >> a;
        A.push(a);
    }
    Rep(i, M) {
        int a = A.top();
        A.pop();
        A.push(a / 2);
    }
    ll ans = 0;
    Rep(i, N) {
        ans += A.top();
        A.pop();
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3928
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define nfs ios_base::sync_with_stdio(false);cin.tie(NULL)
#define F(i,a,b) for(i=a;i<b;i++)
#define RF(i,a,b) for(i=a;i>=b;i--)
#define m_p make_pair
#define p_b push_back
#define MOD 1000000007
int main()
{
	nfs;
	int t;
	t=1;
//	cin >> t;

	while(t--)
	{
		ll n,k;
		cin >> n >> k;
		ll ans = (n-k+1) ;
		cout << ans << endl;
		
	}
	return 0;

}



Measured memory_bytes: 256
//in the name of god
//if you read this code please search about imam hussain
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

#define pb push_back
#define endl "\n";
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define read freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);

const int maxn=1e5+5;
const int mod=1e9+7;
const int inf=1e9;
const int del=728729;
	long int bmm(int x, int y)
	{
	 if(y==0)
	  return x;
	 return bmm(y,x%y);
	}
int main(){
	migmig;
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	ll len1=b;
	ll oc=len1/c;
	ll od=len1/d;
	ll lc=(c*d)/bmm(c,d);
	ll om=len1/lc;
	ll ans1=len1-oc-od+om;
	ll len2=a-1;
	ll tc=len2/c;
	ll td=len2/d;
	ll tm=len2/lc;
	ll ans2=len2-tc-td+tm;
	cout<<ans1-ans2;
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const char *str = "FESTIVAL";
char S[5478943];
int main(){
	scanf("%s",S);
	int len=strlen(S);
	for(int i=0;i<len-strlen(str);i++){
		putchar(S[i]);
	}
	return 0;
}

Measured memory_bytes: 256
// AtCoder Regular Contest 061
// C - たくさんの数式 / Many Formulas

#include <cstdio>
#define MAX_S 10
using namespace std;

typedef long long int ll;


ll S;
int nums[MAX_S];
int length;
ll ans;

int main() {

  ll d;

  scanf("%lld", &S);

  d = 1;
  for (int i = 0; S / d > 0; d *= 10, i++) {
    nums[i] = (S / d) % 10;
    length = i + 1;
  }

  ans = 0;
  for (int b = 0; b < (1 << length); b += 2) { // 0 ビット目は常に 0
    for (int i = 0; i < length; i++) {
      d = (b & (1 << i)) ? (d * 10) : 1;
      ans += nums[i] * d;
    }
  }

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

}




Measured memory_bytes: 128