akhauriyash/Code-Regression huggingface dataset:
#include<set>
#include<map>       
#include<stack>              
#include<queue>              
#include<vector>      
#include<string>    
#include<math.h>     
#include<stdio.h>              
#include<iostream>              
#include<string.h>              
#include<stdlib.h>      
#include<algorithm>     
#include<functional>
#include<cctype>      
using namespace std;
typedef long long ll;
#define inf  1000000000         
#define mod 1000000007 
#define debug(a) cout << "*" << a << "*" << endl
ll n;
int main()
{
	while (~scanf("%lld", &n)) printf("%lld\n", n * (n - 1) / 2);
}

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

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

template<class T> bool umin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool umax(T &a, T b) { return a < b ? (a = b, true) : false; }

using namespace std;

int main(int argc, char** argv) 
{
#ifdef HOME
	if(IsDebuggerPresent())
	{
		freopen("../in.txt", "rb", stdin);
		freopen("../out.txt", "wb", stdout);
	}
#endif
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.precision(10);
	cout << fixed;
	int K;
	cin >> K;
	int rem = 7, res = 1;
	while (res < 1e7)
	{
		if (rem % K == 0)
		{
			cout << res << endl;
			return 0;
		}
		rem = (rem % K)*10 + 7;
		++res;
	}
	cout << -1 << endl;
	return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <cstring>
#include <cstdio>

using namespace std;

int main()
{
	char str[10002];
	int i = 0, j;
	int jtotal = 0;
	int itotal = 0;
	
	while(1){
	if (scanf("%s", str) == EOF) break;
	
	while (str[i+2] != '\0'){
		if (str[i] == 'J' && str[i+1] == 'O' && str[i+2] == 'I'){
			jtotal++;
		}
		if (str[i] == 'I' && str[i+1] == 'O' && str[i+2] == 'I'){
			itotal++;
		}
		i++;
	}
	
	cout << jtotal << endl;
	cout << itotal << endl;
	jtotal = 0;
	itotal = 0;
	i = 0;
	}
	return (0);
}

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

using ll = long long;

const int INF = 1001001001;
const ll INF_LL = 1001001001001001001LL;

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

  if(n%1000 == 0){
    int ans = 0;
    cout << ans << endl;
    return 0;
  }
  
  int div = n/1000+1;
  int ans = div*1000-n;
  
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 3628
#include "bits/stdc++.h"

using namespace std;

#define sp(x) cout<<setprecision(x);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define all(a) (a).begin(), (a).end()
#define inf 10000000
#define linf INT64_MAX*0.99
#define print(s) cout<<(s)<<endl
#define lint long long
#define yes "Yes"
#define no "No"

typedef pair<int, int> P;
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int r, d, x; cin>>r>>d>>x;
    REP(i,10){
        x = r*x - d;
        print(x);    
    }
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
from collections import Counter

def solve(S):
    s = Counter(S)
    if len(S) == 1:
        return "No"
    elif (s["N"]*s["S"] == 0 and s["N"]+s["S"] > 0) or \
         (s["E"]*s["W"] == 0 and s["E"]+s["W"] > 0):
        return "No"
    else:
        return "Yes"

def main():
    S = input()
    print(solve(S))

if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
s = input()

n = len(s)
res = 0
for i in range(2**(n-1)):
    idx = n-1
    ss = s
    r = i
    while r>0:
        if r & 1:
            ss = ss[:idx]+'+'+ss[idx:]
        idx -= 1
        r>>=1
    res += sum([int(c) for c in ss.split('+')])
print(res)


Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
	static long gcd(long a, long b) {
		if(a%b!=0) {
			return gcd(b,a%b);
		}else {
			return b;
		}
	}
	static long lcm(long a,long b) {
		return a*b/gcd(a,b);
	}
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong()-1;
        long b = sc.nextLong();
        long c = sc.nextLong();
        long d = sc.nextLong();
        long count = 0;
        long l=lcm(c,d);
        long bl=b/l;
        long bwaruc= b/c;
        long bwarud= b/d;
        long ansb = b-(bwaruc+bwarud)+bl;
        long al=a/l;
        long ansa = a-(a/c+a/d)+al;
        
        count=ansb-ansa;
        System.out.println(count);
    }
}


Measured memory_bytes: 21844
#include <stdio.h>
#include <math.h>
 
#define MAX	1000000000000000000
 
int main(){

  int			N, i;
  long long	int	A[100000+1], tmp, ans=1;
  
  scanf("%d\n", &N);

  for(i=0; i<N; i++){
	  scanf("%lld", &A[i]);
	  if(!A[i]){ printf("0\n"); return 0; }
  }
  
  for(i=0; i<N; i++){
	  tmp = ans * A[i];
	  if((ans > tmp) || A[i] > (MAX / ans)){ printf("-1\n"); return 0; }
	  ans = tmp;
  }

  if(ans > MAX){ printf("-1\n"); }
  else		   { printf("%lld", ans); }
 
  return 0;
}

Measured memory_bytes: 2424
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main
{
	public static void main(String[] args) {
		new Thread(null, new Runnable() {
			public void run() {
                solve();
            }
        }, "1", 1 << 26).start();
	}
	static void solve () {
		FastReader fr =new FastReader();	PrintWriter op =new PrintWriter(System.out);
 
 		int n =fr.nextInt() ,m =fr.nextInt() ,i ;	long sm =0l ;
 		for (i =0 ; i<m ; ++i)	sm += fr.nextLong() ;
 			if (sm>n)	op.println("-1") ;
 		else 	op.println(n-sm) ;
		op.flush();	op.close();
	}
	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br =new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st==null || (!st.hasMoreElements())) 
			{
				try
				{
					st =new StringTokenizer(br.readLine());
				}
				catch(IOException e)
				{
					e.printStackTrace();
				}
				
			}
			return st.nextToken();
		}

		String nextLine() {
			String str ="";

			try
			{
				str =br.readLine();
			}
			catch(IOException e)
			{
				e.printStackTrace();
			}

			return str;
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next()) ;
		}
	}
}

Measured memory_bytes: 34060
#include <bits/stdc++.h>
#include <cassert>
typedef long long int ll;
using namespace std;

#define DEBUG 0

#if DEBUG
  #define DLOG(...) fprintf(stderr, __VA_ARGS__)
  #define DFUNC(fname, ...) fname(__VA_ARGS__)
#else
  #define DLOG(...)
  #define DFUNC(fname, ...)
#endif

ll M, K;

int main() {
#if !DEBUG
  ios_base::sync_with_stdio(false);
#endif

  cin >> M >> K;
  
  if ((1 << M) <= K) {
    cout << -1 << endl;
    return 0;
  }

  if (M == 1) {
    if (K == 0) {
      cout << "0 0 1 1" << endl;
    }else {
      cout << -1 << endl;
    }
    return 0;
  }

  cout << K;
  for (ll i = 0; i < (1 << M); i++) {
    if (i == K)  continue;
    cout << " " << i;
  }
  cout << " " << K;
  for (ll i = (1<<M) - 1; i >= 0; i--) {
    if (i == K)  continue;
    cout << " " << i;
  }
  cout << endl;

  return 0;
}



Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
//using namespace atcoder;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define pb push_back
#define fi first
#define se second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void chOut(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using v_bool = vector<bool>;
using v_Pii = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;



signed main(){

    int a, b, c, d; cin >> a >> b >> c >> d;
    int ans = -INF;
    chmax(ans, a * c);
    chmax(ans, a * d);
    chmax(ans, b * c);
    chmax(ans, b * d);
    if((a <= 0 && 0 <= b) || (c <= 0 && 0 <= d)) chmax(ans, 0LL);
    Out(ans);

    return 0;
}


Measured memory_bytes: 3648
import math
 
A, B, C, D = map(int, input().split())
M = [[A, B], [C, D]]
T, A, HP, AP = 0, 1, 0, 1
atkTtoA = math.ceil(M[A][HP] / M[T][AP])
atkAtoT = math.ceil(M[T][HP] / M[A][AP])
#print("attack T to A = ", atkTtoA)
#print("attack A to T = ", atkAtoT)
if atkAtoT < atkTtoA:
    print("No")
else:
    print("Yes")

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

int main() {
  string a, b;
  cin >> a >> b;
  
  string sbuff;
  sbuff = a + b;
  int ibuff = stoi(sbuff, 0, 10);
  
  for (int i=1; i<317; i++) {
    if ((i*i)==ibuff) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
# coding: utf-8

while True:
	n = int(raw_input())
	if n == 0:
		break
	henkan = []
	for i in range(n):
		henkan.append(raw_input().split())

	m = int(raw_input())
	ans = ""
	for i in range(m):
		c = raw_input().split()
		for j in range(len(henkan)):
			if c[0] == henkan[j][0]:
				c[0] = henkan[j][1]
				break
		ans += c[0]

	print(ans)

Measured memory_bytes: 7732
#include <bits/stdc++.h>
 
#define endl '\n'
#define fi first
#define se second
#define MOD(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,n) for (int i = 0; i < n; i++)
#define forr(i,a,b) for (int i = a; i <= b; i++)
#define all(v) v.begin(), v.end()
#define pb emplace_back

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<ii> vii;

const int MX = 200005;
int n, a[2 * MX], sig[MX];
ll k, f[MX][64];

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

	cin >> n >> k;
	for (int i = 0; i < n; i++)
		cin >> a[i];

	for (int i = 2 * n - 1; i + 1; i--) {
		if (i < n) {
			f[i][0] = sig[a[i]] - i + 1;
			f[i][0] = min(f[i][0], n * k);
		}
		sig[a[i % n]] = i;
	}

	for (int j = 1; j < 64; j++)
		for (int i = 0; i < n; i++) {
			f[i][j] = f[i][j-1] + f[(i + f[i][j-1]) % n][j-1];
			f[i][j] = min(f[i][j], n * k);
		}

	ll x = 0;
	for (int j = 63; j + 1; j--)
		if (x + f[x % n][j] < n * k)
			x += f[x % n][j];

	vi st;
	bitset<MX> bs;
	for (x; x < n * k; x++) {
		if (bs[a[x % n]]) {
			while (st.back() != a[x % n]) {
				bs[st.back()] = 0;
				st.pop_back();
			}
			st.pop_back();
			bs[a[x % n]] = 0;
		} else {
			st.pb(a[x % n]);
			bs[a[x % n]] = 1;
		}
	}

	for (int i = 0; i < st.size(); i++) {
		if (i) cout << " ";
		cout << st[i];
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 104052
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long

signed main(){

  int h, w; cin >> h >> w;
  vector<string> a(h);
  for(int i = 0; i < h; i++){
    cin >> a[i];
  }

  int one = h%2 == 1 && w%2 == 1;
  int two = (h%2 == 1 ? w/2 : 0) + (w%2 == 1 ? h/2 : 0);
  int four = h/2 * (w/2);
  vector<int> cnt(26, 0);
  for(int i = 0; i < h; i++){
    for(char c : a[i]){
      cnt[c - 'a']++;
    }
  }

  for(int i = 0; i < 26; i++){
    while(four > 0 && cnt[i] >= 4){
      four--;
      cnt[i] -= 4;
    }
  }
  for(int i = 0; i < 26; i++){
    while(two > 0 && cnt[i] >= 2){
      two--;
      cnt[i] -= 2;
    }
  }
  for(int i = 0; i < 26; i++){
    if(one > 0 && cnt[i] >= 1){
      one--;
      cnt[i] -= 1;
    }
  }
  cout << (one + two + four == 0 ? "Yes" : "No") << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

int main(){
    int x;
    cin >> x;
    int max_ans = 0;
    if (x==1) cout << 1 << endl;
    else{
        for (int i=2;i<=(floor(sqrt(x))+1);i++){
            int res = 0;
            int j=0;     
            while (res<=x){
                j += 1;
                res = pow(i,j);
            }
            res = pow(i,j-1);
            if (res>=max_ans) max_ans = res;
        }
        cout << max_ans << endl;
    }
    
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<set>
#include<bitset>
#include<map>

#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)

using namespace std;

typedef long long LL;
typedef double db;

int get(){
	char ch;
	while(ch=getchar(),(ch<'0'||ch>'9')&&ch!='-');
	if (ch=='-'){
		int s=0;
		while(ch=getchar(),ch>='0'&&ch<='9')s=s*10+ch-'0';
		return -s;
	}
	int s=ch-'0';
	while(ch=getchar(),ch>='0'&&ch<='9')s=s*10+ch-'0';
	return s;
}

const int N = 1e5+5;

int n;
int a[N];
int pre[N];
int tree[N*2];

void add(int x){
	x+=n+1;
	for(;x<=n*2+2;x+=x&-x)tree[x]++;
}

int query(int x){
	int ret=0;
	x+=n+1;
	for(;x;x-=x&-x)ret+=tree[x];
	return ret;
}

bool check(int lim){
	fo(i,1,n){
		pre[i]=pre[i-1];
		if (a[i]<=lim)pre[i]++;
		else pre[i]--;
	}
	fo(i,0,n*2+2)tree[i]=0;
	add(0);
	LL tot=0;
	fo(i,1,n){
		tot+=query(pre[i]-1);
		add(pre[i]);
	}
	LL all=1ll*n*(n+1)/2;
	all=all/2+1;
	return tot>=all;
}

int main(){
	n=get();
	fo(i,1,n)a[i]=get();
	int l=1,r=1e9,ans=0;
	while(l<=r){
		int mid=(l+r)/2;
		if (check(mid))ans=mid,r=mid-1;
		else l=mid+1;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
int main(){
long long n,p=-1,q=1,r=0;
std::cin>>n;
long long x=n;
while(x){p++;q*=10;r+=x%10;x/=10;}
if(n>9&& (n+1)*10%q!=0)std::cout<<p*9+((n*10)/q)-1;
else std::cout<<r;
}

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

int main(){
  int a[2];
  cin >>a[0]>>a[1]>>a[2];
  for (int i =1;i<3;i++){
    if(a[i-1]>a[i]){
      int tmp = a[i-1];
      a[i-1] = a[i];
      a[i] = tmp;
    }
  }
  if (a[1]>a[2]){
    int tmp = a[1];
    a[1] = a[2];
    a[2] = tmp;
  }
  cout << a[0]+a[1];
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll>pi;
const int MAXN=100005;
const int MOD=1000000007;
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define DEC(i,a,b) for(int i=(a);i>=(b);i--)
#define fst first
#define snd second
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define db(x) cerr<<#x<<" = "<<x<<"\n"
#define LOW(v,x) (lower_bound(all(v),(x))-(v).begin())

int N;
int o[MAXN];
int f(int x){return o[x]==x?x:o[x]=f(o[x]);}
void merge(int x, int y){o[f(x)]=f(y);}
vector<int>adj[MAXN];
bool col[MAXN];
void dfs(int v, int p){
	//~ cout<<v<<' '<<col[v]<<"\n";
	for(auto i:adj[v])if(i!=p){
		col[i]=!col[v];
		dfs(i,v);
	}
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	cin>>N;
	FOR(i,1,N)o[i]=i;
	vector<pi>edges;
	FOR(i,1,N-1){
		int a,b,c;cin>>a>>b>>c;
		if(c%2==0){
			merge(a,b);
		}
		else edges.pb(pi(a,b));
	}
	for(auto i:edges){
		int a,b;tie(a,b)=i;
		a=f(a);b=f(b);
		if(a==b)continue;
		adj[a].pb(b);
		adj[b].pb(a);
	}
	FOR(i,1,N){
		sort(all(adj[i]));
		adj[i].resize(unique(all(adj[i]))-adj[i].begin());
	}
	dfs(f(1),-1);
	FOR(i,1,N)col[i]=col[f(i)];
	FOR(i,1,N)cout<<col[i]<<"\n";
}
/*
1 3
#.#


2 3
#.#
..#

3 3
##.
#.#
..#

3
2 5
6 1
3 7
Ans:6

4
3 7
2 9
8 16
10 8
Ans:9
*/


Measured memory_bytes: 7792
from math import gcd
from functools import reduce 
def lcm_base(x, y):
    return (x * y) // gcd(x, y)
def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)
n,m=map(int,input().split())
a=list(map(int,input().split()))
for i in range(n):
  a[i]//=2
b=lcm(*a)
if b>m:
  print(0)
  exit()
i=a[0]
j=0
cnt=0
while (i>>j)&1==0:
  j+=1
  cnt+=1
for i in a[1:]:
  j=0
  ans=0
  while (i>>j)&1==0:
    j+=1
    ans+=1
  if ans!=cnt:
    print(0)
    break
else:print((m+b)//(2*b))
    

Measured memory_bytes: 84040
c=[list(map(int,input().split())) for _ in range(3)]

ans = "Yes"

for i in range(2):
    if c[i+1][1]-c[i+1][0] != c[0][1]-c[0][0]:
        ans = "No"
    if c[i+1][2]-c[i+1][1] != c[0][2]-c[0][1]:
        ans = "No"
for j in range(2):
    if c[1][i+1]-c[0][i+1] != c[1][0]-c[0][0]:
        ans = "No"
    if c[2][i+1]-c[1][i+1] != c[2][0]-c[1][0]:
        ans = "No"

print(ans)

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

int main() {
	int n;
	cin >> n;
	map<string, int> score;
	for (int i = 0; i < n; i++) {
		string a;
		cin >> a;
		score[a]++;
	}
	int m;
	cin >> m;
	for (int i = 0; i < m; i++) {
		string t;
		cin >> t;
		score[t]--;
	}
	int ans = 0;

	for (auto p: score) {
		auto v = p.second;
		if (ans < v) ans = v;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <math.h>
#include <algorithm>
#include <set>
#include <deque>
#include <utility>
#include <map>

using namespace std;

int main(void)
{
	vector <string> s, t; //s????????????t?????°???
	multimap<int, int> mp;
	vector <pair<int, int>> pr;
	vector <int> ans;
	string temp1, temp2;
	int m, n;
	int temp;
	int i, j, k;
	int count = 0; //???????????¬??°
	int max = 0;

	while (1) {

		cin >> n;
		if (n == 0) {
			break;
		}

		for (i = 0; i < n; i++) {
			cin >> temp1 >> temp2;


			temp = stoi(temp1.substr(0, 2)) * 3600 + stoi(temp1.substr(3, 2)) * 60 + stoi(temp1.substr(6, 2));

			pr.push_back(make_pair(temp, 1));

			temp = stoi(temp2.substr(0, 2)) * 3600 + stoi(temp2.substr(3, 2)) * 60 + stoi(temp2.substr(6, 2));

			pr.push_back(make_pair(temp, 0));


		}
		sort(pr.begin(), pr.end());

		for (i = 0; i < pr.size(); i++) {
			
			if (pr[i].second == 1) {
				count++;
				if (max < count) {
					max = count;
				}

			}
			else if (pr[i].second == 0) {
				count--;
			}

	
			

		}

		pr.clear();

		ans.push_back(max);
		max = 0;

	}

	for (i = 0; i < ans.size(); i++) {
		cout << ans[i] << endl;
	}



	return (0);
}

Measured memory_bytes: 3228
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
string solve(bool a) { return ((a) ? "Yes" : "No"); }
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
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, class U>ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os << "(" << p.first << "," << p.second << ")";
	return os;
}
template <class T>ostream& operator<<(ostream& os, const vector<T>& v) {
	os << "{";
	rep(i, v.size()) {
		if (i) os << ",";
		os << v[i];
	}
	os << "}";
	return os;
}
template <class T, class U>istream& operator>>(istream& is, pair<T, U>& p) {
	is >> p.first >>p.second ;
	return is;
}
template <class T>istream& operator>>(istream& is,  vector<T>& v) {
	rep(i, v.size()) {
		is >> v[i];
	}
	return is;
}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	int n,x;
	int ans=0;
	cin >>n>>x;
	V a(n);
	cin >> a;
	sort(all(a));
	int i;
	for (i = 0; i < n and x >= a[i]; i++){
		x -= a[i];
		ans++;
	}
	if (x > 0 and i == n ) ans--;
	cout << ans << endl;
}

Measured memory_bytes: 3612
#include<stdio.h>

main(){
  char data[7][7];
  char input[402];
  int i,j,k,p,len,a,b;

  k=0;
  p=0;
  for(i=0;i<6;i++){
    for(j=0;j<5;j++){
      if(j==1 && i==5){
	data[j][i]='.';
	k++;
	continue;
      }
      if(j==2 && i==5){
	data[j][i]='?';
	k++;
	continue;
      }
      if(j==3 && i==5){
	data[j][i]='!';
	k++;
	continue;
      }
      if(j==4 && i==5){
	data[j][i]=' ';
	k++;
	continue;
      }
      data[j][i] = 'a' + k;
      k++;
    }
  }

  while(1){
    if(scanf("%c", &input[0])==EOF) break;
    if(input[0]=='\n') continue;
    for(i=1;i<400;i++){
      scanf("%c", &input[i]);
      if(input[i]=='\n'){
	len=i;
	break;
      }
    }
    p=0;
    if((len%2)!=0){
      printf("NA\n");
      continue;
    }
    for(i=0;i<len;i+=2){
      if(input[i]<'1' || input[i]>'6' || input[i+1]<'1' || input[i+1]>'5'){
	p=1;
	break;
      }
    }
    if(p==1){
      printf("NA\n");
      continue;
    }

    for(i=0;;i+=2){
      if(i==len || i+1==len) break;
      a=input[i+1]-'0';
      b=input[i]-'0';
      printf("%c", data[a-1][b-1]);
    }
    printf("\n");
  }

  return 0;
}

Measured memory_bytes: 0
#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 = 1; i <= (n); ++i)
#define ll long long
#define pp pair<int,int> 
#define v(T) vector<T>
#define all(x) (x).begin(), (x).end()
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
const int INF = 1001001001;
//int 2×10の9乗
//vector<vector<int>> a(n, vector<int>(m));
  //rep(i,n) rep(j,m) cin >> a[i][j]; 
//cout << fixed << setprecision(10);
//int gcd(int x, int y){
  //if(y==0) return x;
  //return gcd(y, x%y);
//}
//sort小さい順(昇順)
 
int main() {
  int n,k,q;
  cin >> n >> k >> q;
  v(int) a(q),x(n);
  rep(i,q){
    cin >> a[i];
    a[i]--;
    x[a[i]]++;
  }
  rep(i,n){
    if((k-q+x[i])>0) Yes;
    else No;
  }
}  

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

string s[110], t[110];
int main(){
  int N;
  cin >> N;
  for(int i = 0; i < N; i++) cin >> s[i];
  int M;
  cin >> M;
  for(int i = 0; i < M; i++) cin >> t[i];

  int ans = 0;
  for(int i = 0; i < N; i++){ //s[i]
    int score = 0;
    for(int j = 0; j < N; j++){
      if (s[j] == s[i]) score++;
    }
    for(int j = 0; j < M; j++){
      if (t[j] == s[i]) score--;
    }
    ans = max(ans, score);
  }
  cout << ans << endl;

}


Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A
"""
a,b = LI()
if a+b >= 10:
    print("error")
else:
    print(a+b)
"""
#B
s = S()
d = defaultdict(int)
for i in s:
    if d[i]:
        print("no")
        quit()
    d[i] = 1
print("yes")
#C
"""
n = I()
s = IR(n)
su = sum(s)
dp = [[0 for i in range(su+1)] for j in range(n)]
dp[0][s[0]] = 1
for i in range(n):
    dp[i][0] = 1
for i in range(1,n):
    for j in range(su+1)[::-1]:
        if s[i]+j <= su:
            dp[i][s[i]+j] = max(dp[i][s[i]+j],dp[i-1][j])
        dp[i][j] = max(dp[i][j],dp[i-1][j])
for i in range(su+1)[::-1]:
    if dp[n-1][i] == 1 and i%10 != 0:
        break
print(i)
"""

#D
"""
n,a,b = LI()
h = IR(n)
l = 0
r = math.ceil(max(h)/b)
while r-l > 1:
    m = (l+r)//2
    k = 0
    for i in range(n):
        k += max(0,math.ceil((h[i]-b*m)/(a-b)))
        if k > m:break
    if k > m:
        l = m
    else:
        r = m
print(r)
"""
#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T


Measured memory_bytes: 38512
(n,m)=gets.split.map(&:to_i)
sc=ARGF.map{|s|s.split.map(&:to_i)}

memo={}
sc.each do|(k,v)|
  if memo[k] == nil || memo[k] == v
    memo[k]=v
  else
    print -1
    exit
  end
end

if memo[1]==0 && n > 1
    print -1
    exit
end

tmp=[0]*n
tmp[0]=1 if n > 1

sc.each{|k,v|
    tmp[k-1]=v
}
print tmp.map(&:to_s).join

Measured memory_bytes: 1788
import sys
S = list(input())

if S[0] != 'A':
  print('WA')
  sys.exit(0)

lis = S[2:-1]
if 'C' not in lis:
  print('WA')
  sys.exit(0)
  
if lis.count('C') > 1:
  print('WA')
  sys.exit(0)

l = S[:]
l.remove('A')
l.remove('C')
l = str(l)

if l.islower():
  print('AC')
else:
  print('WA')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
	
using namespace std;

const int MAX_N=1e5;
int N,a[MAX_N+1],b[MAX_N+1];
vector<int> G[MAX_N+1];
bool f[MAX_N+1];
void dfs(int v){
	f[v]=true;
	REP(i,(int)G[v].size()){
		if (!f[G[v][i]]){
			dfs(G[v][i]);
		}
	}
}

int main(){
	cin>>N;
	{
		int xa,xb;
		xa=xb=0;
		REP(i,N){
			cin>>a[i];
			xa^=a[i];
		}
		REP(i,N){
			cin>>b[i];
			xb^=b[i];
		}
		a[N]=xa;
		b[N]=xb;
	}
	{
		map<int,int> ma,mb;
		REP(i,N+1){
			ma[a[i]]++;
			mb[b[i]]++;
		}
		bool flg=true;
		REP(i,N+1){
			if (ma[a[i]]!=mb[a[i]]){
				flg=false;
				break;
			}
		}
		if (!flg){
			cout<<-1<<endl;
			return 0;
		}
	}
	{
		vector<int> vec;
		REP(i,N+1){
			vec.push_back(a[i]);
		}
		sort(vec.begin(),vec.end());
		vec.erase(unique(vec.begin(),vec.end()),vec.end());
		REP(i,N+1){
			a[i]=lower_bound(vec.begin(),vec.end(),a[i])-vec.begin();
			b[i]=lower_bound(vec.begin(),vec.end(),b[i])-vec.begin();
		}
	}
	int edge=0,con=0;
	{
		REP(i,N+1){
			if (a[i]!=b[i] || i==N){
				G[a[i]].push_back(b[i]);
				edge++;
			}
		}
		REP(i,N+1){
			if (G[a[i]].size()!=0 && !f[a[i]]){
				con++;
				dfs(a[i]);
			}
		}
	}
	cout<<edge+con-2<<endl;
	return 0;
}

Measured memory_bytes: 12800
import java.io.IOException;
import java.util.Scanner;

public class Main{
	public static void main (String[] args){
		Scanner in = new Scanner(System.in);
		int a = in.nextInt();
		int b = in.nextInt();
		int c = in.nextInt();
		
		if (a < b && b < c){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
		
	}
}

Measured memory_bytes: 26240
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
//using static System.Globalization.CultureInfo;

class Program
{
    static void Main(string[] args)
    {
        var hw = Input.ar;
        var cost = Enumerable.Repeat(0, 10).Select(v => Input.ar).ToArray();
        for (var k = 0; k < 10; k++)
            for (var j = 0; j < 10; j++)
                for (var i = 0; i < 10; i++)
                    cost[j][i] = Min(cost[j][i], cost[j][k] + cost[k][i]);
        WriteLine(Enumerable.Repeat(0, hw[0]).Sum(v => Input.ar.Sum(w => w == -1 ? 0 : cost[w][1])));
    }
}

public class Input
{
    public static string read => ReadLine();
    public  static int[] ar => Array.ConvertAll(read.Split(' '), int.Parse);
    public  static int num => ToInt32(read);
    public  static long[] arL => Array.ConvertAll(read.Split(' '), long.Parse);
    public  static long numL => ToInt64(read);
    public  const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public  const int MOD = 1000000007;
}


Measured memory_bytes: 13524
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;





int main(){

	ll table[3];
	ll maximum = -HUGE_NUM,loc;

	for(int i = 0; i < 3; i++){

		scanf("%lld",&table[i]);
		if(maximum < table[i]){
			maximum = table[i];
			loc = i;
		}
	}

	ll K;
	scanf("%lld",&K);

	for(ll i = 0; i < K; i++){

		maximum *= 2;
	}

	ll ans = maximum;
	for(ll i = 0; i < 3; i++){
		if(i == loc)continue;

		ans += table[i];
	}

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

	return 0;
}


Measured memory_bytes: 3824
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
ans = 0
s = 0

for _ in range(N):
    A = list(map(int, input().split()))
    for i in range(M):
        s += A[i] * B[i]
    s += C
    if s > 0:
        ans += 1
    s = 0
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <array>
#include <vector>
#include <string>
#include <numeric>
#include <algorithm>
#include <utility>

#include <atcoder/twosat>

using namespace std;
using namespace atcoder;
#define rep(i,l,r) for(int i = l; i < r; ++i)

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

    two_sat ts(n);
    vector<pair<int, int>> xy;
    rep(i, 0, n) {
        cin >> x >> y;

        rep(j, 0, i) {
            a = xy[j].first;
            b = xy[j].second;

            if (abs(x - a) < d) ts.add_clause(i, false, j, false);
            if (abs(x - b) < d) ts.add_clause(i, false, j, true);
            if (abs(y - a) < d) ts.add_clause(i, true, j, false);
            if (abs(y - b) < d) ts.add_clause(i, true, j, true);
        }

        xy.push_back({x, y});
    }

    if (ts.satisfiable()) {
        cout << "Yes" << endl;
        auto ans = ts.answer();
        rep(i, 0, n) cout << (ans[i] ? xy[i].first : xy[i].second) << endl;
    } else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3220
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rrep(i,n) for(int i=1; i<=(int)(n); i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define fi first
#define se second
#define bigger (char)toupper
#define smaller(char)tolower
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef vector<char> vc;
typedef long long ll;
typedef unsigned long long ull;

int main() {
    ll N,K;
    cin>>N>>K;
    int ans;
    vector<pii> p;
    rep(i,N) {
        int a,b;
        cin>>a>>b;
        p.pb(make_pair(a,b));
    }
    sort(all(p));
    for(auto c : p) {
        int a=c.fi;
        int b=c.se;
        ans=a;
        K-=b;
        if(K<=0) break;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1400
N = int(input())
S = str(input())

from collections import Counter
freq = Counter(S)

div = int(1e9 + 7)
total = 1
for c in freq.keys():
  #print(c, freq[c])
  total = total * (freq[c] + 1) % div

ans = total - 1
print(ans)

Measured memory_bytes: 3444
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let v = read_vec::<usize>();
    let (x, a) = (v[0], v[1]);
    if x < a {
        println!("0");
    } else {
        println!("10");
    }
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 2104
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define M (998244353)
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;

ll dp[405][405];
ll sum[405];
vector<ll>a;

ll rec(ll l, ll r){
    if(dp[l][r]!=-1)return dp[l][r];
    if(l>r)return dp[l][r]=(ll)INF;
    if(l==r)return dp[l][r]=a[l];
    if(r==l+1)return dp[l][r] = a[l]+a[r];
    ll s = (ll)INF;
    for(ll i=l;i<r;i++){
        ll tmp = 0;
        if(i==l)tmp = rec(l,i)+rec(i+1,r)+sum[r]-sum[i];
        else{
            if(i==r-1) tmp = rec(l,i)+rec(i+1,r)+sum[r-1]-sum[l-1];
            else tmp = rec(l,i)+rec(i+1,r)+sum[r]-sum[l-1];
        }
        s = min(s,tmp);
    }
    return dp[l][r]=s;
}

int main(void){
    for(int i=0;i<405;i++){
        for(int j=0;j<405;j++){
            dp[i][j]=-1;
        }
    }
    ll n;
    cin>>n;
    a.resize(n+1,0);
    for(int i=0;i<n;i++)cin>>a[i+1];
    for(int i=0;i<n;i++)sum[i+1]=sum[i]+a[i+1];
    cout<<rec(1,n)<<endl;
    return 0;
}

Measured memory_bytes: 1536
package main

import "fmt"

func main() {
	var h [300][2]int
	var i int
	i = 0
	for true {
		fmt.Scanf("%d%d\n", &h[i][0], &h[i][1])
		if h[i][0] == 0 {
			if h[i][1] == 0 {
				break
			}
		}
		i++

	}
	for j := 0; j < i; j++ {

		for n := 0; n < h[j][0]; n++ {
			for k := 0; k < h[j][1]; k++ {
				fmt.Printf("#")
			}
			fmt.Println("")

		}
        fmt.Println("")
	}

}



Measured memory_bytes: 1160
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 より
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

// ここまで

fn run() {
    input! {
        n: usize,
        m: usize,
        e: [(usize1, usize1); m],
        s: usize1,
        t: usize1,
    }
    let mut g = vec![vec![]; 3 * n];
    for (a, b) in e {
        g[a].push(n + b);
        g[n + a].push(2 * n + b);
        g[2 * n + a].push(b);
    }
    let inf = 3 * n + 1;
    let mut dp = vec![inf; 3 * n];
    let mut q = std::collections::VecDeque::new();
    dp[s] = 0;
    q.push_back(s);
    while let Some(v) = q.pop_front() {
        let d = dp[v] + 1;
        for &u in g[v].iter() {
            if dp[u] > d {
                dp[u] = d;
                q.push_back(u);
            }
        }
    }
    if dp[t] == inf {
        println!("-1");
    } else {
        println!("{}", dp[t] / 3);
    }
}

fn main() {
    run();
}


Measured memory_bytes: 28924
# coding: utf-8


def check(S, T, c):
    ids = tuple((i for i in range(len(T)) if T[i] == c))
    if len(ids) < 2:
        return True
    cs = set((S[i] for i in ids))
    if len(cs) != 1:
        return False
    return True


def main():
    S = input().strip()
    T = input().strip()

    for ci in range(ord("a"), ord("z") + 1):
        c = chr(ci)
        if check(S, T, c) and check(T, S, c):
            continue
        return False
    return True


if __name__ == "__main__":
    print(["No", "Yes"][main()])


Measured memory_bytes: 8204
n = gets.to_i
a = gets.split.map(&:to_i)
c1, c2 = 0, 0
a.each do |x|
  if x % 4 == 0
    c1 += 1
  elsif x % 2 == 0
    c2 += 1
  end
end
puts (c1 + c2 / 2 >= n / 2 ? "Yes" : "No")

Measured memory_bytes: 8452
#include <iostream>

using namespace std;
int main() {
    int N, Q;
    char s[200001];
    char t[200001];
    char d[200001];
    cin >> N >> Q;
    for(int i=0; i<N; i++) cin >> s[i];
    for (int i=0; i<Q; i++) cin >> t[i] >> d[i];
    
    int head = 0;
    int tail = N-1;
    for (int i=Q-1; i>=0; i--) {
        if (d[i] == 'L') {
            if (s[head] == t[i]) {
                head++;
            }
            if (tail+1 < N && s[tail+1] == t[i]) {
                tail++;
            }
        }
        else {
            if (s[tail] == t[i]) {
                tail--; 
            }
            if (head-1 >= 0 && s[head-1] == t[i]) {
                head--;
            }
        }
    }
    cout << tail - head + 1 << endl;
    return 0;
}



Measured memory_bytes: 768
#define _USE_MATH_DEFINES

#include <cmath>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <limits>
#include <cstring>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <numeric>

using namespace std;

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

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

const int Maxn = 200010;

int a[Maxn], idx[Maxn];

int n;

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

    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        idx[a[i]] = i;
    }

    ll ans = 0;
    set<int> s;
    s.insert(-1), s.insert(n);
    for (int v = 1; v <= n; ++v) {
        int i = idx[v];
        auto itr = s.upper_bound(i);
        ll r = *itr, l = *(--itr);
        ans += v * (r - i) * (i - l);
        s.insert(i);
    }

    cout << ans << endl;
}

Measured memory_bytes: 11264
#include <bits/stdc++.h>
using namespace std;
#define ll long long
 
int main(int qtd, char* nome[])
{
	ios::sync_with_stdio(false);
	cin.tie(0);
 
	int n, k;
	cin >> n >> k;
	int a[n];
	for(int &x: a)
		cin >> x;
	sort(a, a+n);
	ll ans = 0;
	for(int i=0; i<n-k; i++)
		ans += a[i];
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 1024
import sys
import math
import string
import fractions
import random
from operator import itemgetter
import itertools
from collections import deque
import copy
import heapq
from bisect import bisect, bisect_left, bisect_right

MOD = 10 ** 9 + 7
INF = float('inf')
input = lambda: sys.stdin.readline().strip()

sys.setrecursionlimit(10 ** 8)

X = int(input())
for i in range(1, 10**5):
    if i*(i+1)/2 >=  X:
        print(i)
        sys.exit()

Measured memory_bytes: 6564
using System;
class Program{
	static void Main(){
		int n=int.Parse(Console.ReadLine());
		int[] s=Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
		int p=0;
		for(int i=0;i<n;i++){if(s[i]%2==0){p++;}}
		Console.WriteLine("{0}",Math.Pow(3,n)-(p>0?Math.Pow(2,p):1));
	}
}

Measured memory_bytes: 13268
while True:
    m,f,r = map(int,input().split())
    if m == -1 and f == -1 and r == -1:
        break
    if m == -1 or f == -1:
        print("F")
    elif m + f >= 80:
        print("A")
    elif m + f < 80 and m + f >= 65:
        print("B")
    elif m + f < 65 and m + f >= 50:
        print("C")
    elif m + f < 50 and m + f >= 30:
        if r >= 50:
            print("C")
        else:
            print("D")
            
    elif m + f < 30:
        print("F")


Measured memory_bytes: 5596
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>
#include <set>
#include <map>
#include <stdio.h>

#define rep(i,n) for (int i = 0; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define INF 100000000000
#define MOD 1000000007 //10^9+7
using namespace std;
using ll = long long;
using P = pair<int, int>;

// 負の数にも対応した % 演算
long long mod(long long val, long long m) {
    long long res = val % m;
    if (res < 0) res += m;
    return res;
}

int main()
{
    string s, t;
    cin >> s >> t;
    string original = s;
    char c;
    do {
        s = s.back() + s.substr(0, s.size()-1);
        if (s == t) {
            cout << "Yes" << endl;
            return 0;
        }
    } while (original != s);

    cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <vector>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>

using namespace std;


int main() {
	int D, N;
	cin >> D >> N;
	string Answer = (N != 100) ? to_string(N) : to_string(N + 1);
	for (int i = 0; i < D; i++) {
		Answer += "00";
	}
	cout << Answer << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SIZE 200005
using namespace std;
typedef long long int ll;
typedef long double ld;

struct Q
{
	ll a,b;// a/b
	Q(ll a=0,ll b=0):a(a),b(b){normalize();}
	void normalize()
	{
		if(b<0) a=-a,b=-b;
	}
	bool operator<(const Q&q) const
	{
		return a*q.b<b*q.a;
	}
};
ll A[SIZE],B[SIZE];
ll na[SIZE],nb[SIZE];
ll s1[SIZE],s2[SIZE];
ld ans[SIZE];
int st[SIZE];

ll get1(int s,int t)
{
	return s1[t]-(s==0?0:s1[s-1]);
}
ll get2(int s,int t)
{
	return s2[t]-(s==0?0:s2[s-1]);
}
Q slope(int s,int t)//s<t
{
	ll a=A[t]-A[s]+2LL*(get2(s+1,t-1)-get1(s+1,t-1)*(ll) t);
	ll b=t-s;
	return Q(a,b);
}
int main()
{
	int n;
	scanf("%d",&n);	
	for(int i=0;i<n;i++) scanf("%lld",&A[i]);
	for(int i=0;i<n;i++) scanf("%lld",&B[i]);
	ll mx=A[0];
	int pos=0;
	for(int i=0;i<n;i++)
	{
		if(mx<A[i])
		{
			mx=A[i];
			pos=i;
		}
	}
	for(int i=0;i<=n;i++) na[i]=A[(i+pos)%n];
	for(int i=0;i<=n;i++) nb[i]=B[(i+pos)%n];
	for(int i=0;i<=n;i++) A[i]=na[i],B[i]=nb[i];
	for(int i=0;i<=n;i++)
	{
		s1[i]=B[i];
		s2[i]=B[i]*(ll) i;
		if(i>0) s1[i]+=s1[i-1],s2[i]+=s2[i-1];
	}
	int sz=0;
	st[sz++]=0;
	for(int i=1;i<=n;i++)
	{
		while(sz>=2)
		{
			Q p=slope(st[sz-2],st[sz-1]);
			Q q=slope(st[sz-2],i);
			if(p<q) sz--;
			else break;
		}
		st[sz++]=i;
	}
	for(int i=0;i<=n;i++) ans[i]=A[i];
	for(int i=0;i+1<sz;i++)
	{
		int to=st[i+1];
		Q d=slope(st[i],st[i+1]);
		ld r=(ld) d.a/(ld) d.b;
		for(int j=st[i]+1;j<st[i+1];j++)
		{
			ans[j]=ans[j-1]+r;
			r+=2*B[j];
		}
	}
	ld ret=0.0;
	for(int i=0;i<n;i++) ret+=ans[i];
	printf("%.15f\n",(double) (ret/n));
}

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


#define li			long long int
#define rep(i,to)	for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)	for(li i=(li)(start);i<((li)(to));i++)
#define pb			push_back
#define sz(v)		((li)(v).size())
#define bgn(v)		((v).begin())
#define eend(v)		((v).end())
#define allof(v)	(v).begin(), (v).end()
#define dodp(v,n)		memset(v,(li)n,sizeof(v))
#define bit(n)		(1ll<<(li)(n))
#define mp(a,b)		make_pair(a,b)
#define rin	rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)		idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)		idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)	for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)		idp p2((x).F, (x).S)
#define dump(x,n)	idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)	idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)	idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)	idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)	rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)	rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

int main() {
	li n,m;
	cin>>n>>m;
	map<li,li> mm;
	rep(i,m){
		li a,b;
		cin>>a>>b;
		mm[a]++;
		mm[b]++;
	}
	foreach(it,mm){
		if(it->S%2>0){
			puts("NO");
			return 0;
		}
	}
	puts("YES");


	return 0;
}

Measured memory_bytes: 5632
#include<bits/stdc++.h>
using namespace std;
#define print(a) cout<<a<<endl;
int aaa[200] = {}, bbb[200] = {}, counta=1,countb=1, ansa, ansb = 0, xxx[1100000] = {}, yyy[1100000] = {};

int foo(int n, int x){//cout<<n<<" "<<x<<" "<<xxx[x]<<endl;;
	int mi = 1000000;
	if(xxx[n]) return xxx[n]+x;
	if(x > 5) return mi;
	for(int i = counta-1; i >= 1; i--){
		if(aaa[i] < n){
			mi = min(foo(n-aaa[i],x+1), mi);
			if(mi - n == 1)break;
		} else if(aaa[i] < n/2) break;
	}
	
	xxx[n] = mi;
	return mi;
}
int boo(int n, int x){//if(ansb){cout<<n<<" B "<<x<<" "<<yyy[n]<<endl;}
	int mi = 1000000;
	if(yyy[n]) return yyy[n]+x;
	for(int i = countb-1; i >= 1; i--){
		//if(ansb)cout<<bbb[i]<<" "<<n<<endl;
		if(bbb[i] < n){
			mi = min(boo(n-bbb[i],x+1), mi);
			if(mi - n == 1)break;
		} else if(bbb[i] < n/2) break;
	}
	//if(ansb)cout<<"aaaa "<<n<<" "<<x<<" "<<mi<<endl;
	yyy[n] = mi;
	return mi;
}

int main(){
	int i, n, abc;
	for(i = 1; abc <= 1000000; i++){
		abc = (i*(i+1)*(i+2))/6;
		xxx[abc] = 1;
		if(abc%2 == 1){
			yyy[abc] = 1;
			bbb[countb++] = abc;
		}
		aaa[counta++] = abc;
	//	cout<<counta<<" "<<i<<" "<<abc<<endl;;
	}
//	print(1);
	for(i = 1; i <= 1000000; i++){//cout<<i<<endl;
		xxx[i] = foo(i, 0);//cout<<i<<endl;
		yyy[i] = boo(i, 0);//if(i == 966077) cout<<xxx[i]<<" "<<yyy[i]<<endl;
	}	//cout<<"b"<<endl;
	/*for(int i = 1; i <= 1000000; i++){
		//cout<<i<<" "<<yyy[i]<<endl;
	//	if(yyy[i+1]-yyy[i] > 1)cout<<yyy[i+1]<<" "<<yyy[i]<<" "<<i+1<<i<<endl;
	}*/
//	print('a');//ansb = 1;
	while(1){
		cin>>n;
		if(n == 0) break;
		cout<<foo(n,0)<<" "<<boo(n,0)<<endl;
	}
	return 0;
}



Measured memory_bytes: 10904
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, n , m) for(int i = n; i <= m; i++)
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
const int mod = 1000000007; 
long long inv[200000],fact[200000],ifact[200000];
long long comb(ll n, ll k){
	if(n<k)return 0;
	else if (n<0||k<0) return 0;
	else return fact[n] * ifact[k] % mod * ifact[n-k] % mod;
}
 
 
int main(){
	ios::sync_with_stdio(false);cin.tie(0);
	inv[1] = fact[0] = fact[1] = ifact[0] = ifact[1] = 1; for (int i=2;i<200000;i++){ inv[i] = (mod - mod / i) * inv[mod % i] % mod; fact[i] = fact[i-1] * i % mod;ifact[i] = ifact[i-1] * inv[i] % mod;
	} //nCr
	
	ll N,K;
	cin>>N>>K;
	reps(i,1,K){
		cout<<(comb(K-1,i-1)*comb(N-K+1,i))%mod<<endl;
	}
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
#define rep(i, m, n) for (int i = m; i < n; ++i)
#define rem(i, m, n) for (int i = m; i >= n; --i)
typedef long long ll;
#define mod 1000000007
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() {
  char c;
  cin >> c;
  if(c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') cout << "vowel" << endl;
  else cout << "consonant" << endl;
  return 0;
}

Measured memory_bytes: 256