akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
 
using namespace std;
#define ll long long
const ll INF=1e15;
#define int long long
#define pb push_back
#define mp make_pair
#define endl "\n"
#define fastio cin.tie(NULL); cout.tie(NULL); ios_base::sync_with_stdio(false)
const double pi = acos(-1.0);
int gcd (int a, int b) {
    while (b) {
        a %= b;
        swap(a, b);
    }
    return a;
}
int lcm (int a, int b) {
    return a / gcd(a, b) * b;
}

long long binpows(long long a, long long b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)  //impar
            res = res * a;
        a = a * a;
        b >>= 1;  // /2
    }
    return res;
}
const int mod=1e9+7;
int binpow(int a, int b, int m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
//CHECAR SE PRECISA DE LONG LONG
//LEMBRAR DE DAR FLUSH

void solve(){
	int n,k;
	cin>>n>>k;
	vector<int> v(n);
	for(int i=0; i<n; i++){
		cin>>v[i];
	}
	int dp[123456];
	int pre[123456];
	for(int i=0; i<=k; i++){
		dp[i]=0;
		pre[i]=1;
	}
	dp[0]=1;
	for(int i=0; i<n; i++){
		for(int j=k; j>=1; j--){
			int aux=pre[j-1]-(j-v[i]-1<0?0:pre[(j-v[i]-1)]);
			if(aux<0)
				aux+=mod;
			dp[j]+=aux;
			dp[j]%=mod;
		}
		for(int j=0; j<=k; j++){
			pre[j]=dp[j];
			if(j!=0)
				pre[j]+=pre[j-1];
		}
	}
	cout<<dp[k]<<endl;
}
//revise as variaveis e a ordem nas funções
signed main(){fastio;
    int t=1;
    //cin>>t;
    while(t--){
        solve();
    }
}

Measured memory_bytes: 5204
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vl>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;

ll func(ll n){
  ll sqn = (ll)sqrt(n - 2) + 1;
  ll ret = 0;

  rep2(x, 1, sqn){
    rep2(y, x, sqn){
      rep2(z, y, sqn){
	if(x*x + y*y + z*z + x*y + y*z + z*x > n)
	  break;
	
	if(x*x + y*y + z*z + x*y + y*z + z*x == n){
	  if((x == y) && (y == z)){
	    ret++;
	  } else if(((x == y) && (y != z)) || ((x != y) && (y == z))){
	    ret += 3;
	  } else{
	    ret += 6;
	  }
	}
      }
    }
  }

  return ret;  
}

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

  rep2(n, 1, N+1) ans[n - 1] = func(n);
  rep(i, N) cout << ans[i] << "\n";
  
  return 0;
}


Measured memory_bytes: 3632
#include <algorithm>
#include <iostream>
#include <map>
#include <string>
#include <queue>
#include <utility>
#include <vector>

using namespace std;

typedef pair<int, int> P;

int x;
priority_queue<int, vector<int>, greater<int> > q;
long long ans;

int main(void) {
  cin >> x;
  
  for (int i = 1; i * i <= x; i++) {
    if (x % i == 0) {
      q.push(i);
      q.push(x/i);
    }
  }
  
  while (true) {
    int k = q.top();
    q.pop();
    long long b = -k;
    while (true) {
      long long a = b + k;
      long long tmp = a*a*a*a*a - b*b*b*b*b;
      if (tmp == x) {
        cout << a << " " << b << endl;
        return 0;
      }
      if (tmp > x and b >= 0) break;
      b++;
    }
  }
}


Measured memory_bytes: 3640
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#include<cmath>


#define REP(i,n) for (int i = 0; (i) < (n); ++ (i))
#define FOR(i,n) for (int i = 1; (i) <= (n); ++ (i))
#define dump(x)  cout << #x << " = " << (x) << endl;
#define lint long long

const int INF = 1e9;
const int MOD = 1e9+7;
const lint LINF = 1e18;



using namespace std;

int gcd(int a,int b){
  if(a>b) swap(a,b);
  if(a==0) return b;
  return gcd(b%a,a);
}

int n,t;
int ans;
int a,b,c;

int main(){
  cin >> a >> b >> c;
  int d = gcd(a,b);
  if(c%d==0) cout << "YES" << endl;
  else cout <<"NO" << endl;
  return 0;
}


Measured memory_bytes: 256
#import sys
MOD = 10 ** 9 + 7
INFI = 10**10
#input = sys.stdin.readline
import math

import itertools
import heapq
#import bisect

import copy
from functools import lru_cache

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def kingaku(a,b,n):
    keta=len(str(n))
    return a*n+b*keta

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

#    h,w,a,b = map(int, input().split())
#    c = [[0 for j in range(n)] for i in range(n)]

def ret(a):
    c=[None]*(len(a)-1)
    if len(a)==1:
        return a[0]
    elif len(a)==0:
        return 0
    for i in range(1,len(a)):
        c[i-1]=abs(a[i]-a[i-1])
    return ret(c)


def main():
    n,m=map(int,input().split())
    a=list(map(int,input().split()))
    a=sorted(a,reverse=True)
    total=sum(a)
    boarder=total/(4*m)
    if a[m-1]>=boarder:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":

    main()

Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
int N;
int p[55555];
vector<int>z;
int main(){
    cin>>N;
    for(int i=2;i<55555;i++){
        if(!p[i]){
            if(i%10==1)z.push_back(i);
            for(int j=2;i*j<55555;j++)
                p[i*j]++;
        }
    }
    cout<<2;
    for(int i=0;i<N-1;i++)cout<<' '<<z[i];
    return 0;
}


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

#define pb push_back

#define ll long long

#define ft first

#define sd second

using namespace std;

const int N = 5050 ;

bool used[N];

ll z , r , w ;

int main(){

    ll n , m ;
    cin >> n >> m ;
    ll a[m];
    for(int i = 0 ; i < m ; i ++ ){
        cin >>a[i];
    }
    for(int i = 0 ; i < m ; i ++ ){
        z+=a[i];
    }
    if(z>=n){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }

}


Measured memory_bytes: 1024
N = int(input())
S = input()

add_left = 0
add_right = 0
for c in S:
    if c == '(':
        add_right += 1
    elif add_right == 0:
        add_left += 1
    else:
        add_right -= 1
ans = '(' * add_left + S + ')' * add_right
print(ans)


Measured memory_bytes: 2940
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.BufferedReader;;

public class Main {
	public static void main(String srgs[]) {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		try {
			String s = reader.readLine();
			String t = reader.readLine();

			int count = 0;

			for (int i = 0; i < 3; i++) {
				if (s.charAt(i) == t.charAt(i)) {
					count += 1;
				}
			}

			System.out.println(count);

		} catch (IOException e) {
			e.printStackTrace();
		}

	}

}


Measured memory_bytes: 21204
package main

import (
	"fmt"
)

const LARGE = 100000 * 10000 * 2

var h [100000]int
var c [100000]int

func abs(x int) int {
	if x >= 0 {
		return x
	} else {
		return -x
	}
}

func max(a, b int) int {
	if a >= b {
		return a
	} else {
		return b
	}
}

func main() {
	var n int
	fmt.Scan(&n)

	ca, cb, cc := 0, 0, 0
	var a, b, c int
	for i := 0; i < n; i++ {
		fmt.Scan(&a, &b, &c)
		ca, cb, cc = a+max(cb, cc), b+max(ca, cc), c+max(ca, cb)
		// fmt.Printf("%d %d %d\n", ca, cb, cc)
	}

	fmt.Printf("%d\n", max(ca, max(cb, cc)))
}


Measured memory_bytes: 5504
//#include "stdafx.h"
#include<bits/stdc++.h> 
#include<iostream>
#include<queue>
#include<string>
#include<algorithm>
using namespace std;
int a,b;
int main()
{
	cin>>a>>b;
	if(a>b&&b!=1)
		cout<<"Alice\n";
	else if(a>b&&b==1)
		cout<<"Bob\n";
	else if(b>a&&a!=1)
		cout<<"Bob\n";
	else if(b>a&&a==1)
		cout<<"Alice\n";
	else
		cout<<"Draw\n";
	
    return 0;
 
}



Measured memory_bytes: 3560
#include<cstdio>
#include<iostream>
using namespace std;
int main(void){
	int n,x,xx,y,z,i,j,ff,cnt;
	cin>>n;
	int flg[n+1];
	for(i=1;i<=n;i++) flg[i]=0;
	cin>>x;
	for(i=0;i<x;i++){
		cin>>xx;
		flg[xx]=-1;
	}
	cin>>y;
	int yy[y];
	for(i=0;i<y;i++) cin>>yy[i];
	cin>>z;
	int zz[z];
	for(i=0;i<z;i++){
		cin>>zz[i];
		if(flg[zz[i]]!=-1)flg[zz[i]]=1;
	}
	for(i=0;i<y;i++){
		for(j=0;j<z;j++){
			if(yy[i]==zz[j]) flg[yy[i]]=1;
		}
	}
	cnt=0;
	for(i=0;i<=n;i++){
		if(flg[i]==1) cnt++;
	}
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 3124
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <unordered_map>
#include <algorithm>
using namespace std;




int main () {
	int n;
	cin >> n;
	if (n == 3) {
		cout << 2 << endl;
		cout << "1 3" << endl << "2 3" << endl;
		return 0;
	}
	if (n == 4) {
		cout << 4 << endl;
		cout << "1 2" << endl << "1 3" << endl;
		cout << "4 2" << endl << "4 3" << endl;
		return 0;
	}
	cout << n / 2 * 4 << endl;
	for (int i = 1; i < n / 2; i++) {
		int j = n / 2 * 2 + 1 - i;
		cout << i << " " << i + 1 << endl;
		cout << i << " " << j - 1 << endl;
		cout << j << " " << i + 1 << endl;
		cout << j << " " << j - 1 << endl;
	}
	if (n % 2 == 0) {
		cout << 1 << " " << n / 2 << endl;
		cout << 1 << " " << n / 2 + 1 << endl;
		cout << n << " " << n / 2 << endl;
		cout << n << " " << n / 2 + 1 << endl;
	}
	else {
		cout << n << " " << 1 << endl;
		cout << n << " " << n - 1 << endl;
		cout << n << " " << n / 2 << endl;
		cout << n << " " << n / 2 + 1 << endl;
	}
}

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

using namespace std;

int main(void){
    int n, k, q;
    cin >> n >> k >> q;
    vector<int> a;
    a.resize(q);
    for (int i = 0; i < q; i++) {
        cin >> a[i];
    }
    vector<int> point;
    point.resize(n);
    for (int i = 0; i < n; i++) {
        point[i] = k - q;
    }
    for (int i = 0; i < q; i++) {
        point[a[i] - 1] += 1;
    }
    for (int i = 0; i < n; i++) {
        if (point[i] <= 0) {
            cout << "No" << endl;
        } else {
            cout << "Yes" << endl;
        }
    }
}


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

using namespace std;

typedef long long ll;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    vector <int> a(n);
    vector <int> vis(1e6 + 7, 0);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        vis[a[i]]++;
    }
    const int N = 1e6 + 7;
    vector <int> good(N, true);
    for (int i = 1; i < N; i++) {
        if (vis[i] > 1) good[i] = false;
        for (int j = i + i; j < N; j += i) {
            if (vis[i]) good[j] = false;
        }
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
        ans += good[a[i]];
    }
    cout << ans << '\n';
    return 0;
}

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

int main(){
    int N,K;
    cin >> N >> K;
    char S[N];
    
    for (int i = 0; i < N; i++){
        cin >> S[i];
    }
    
    S[K-1] = S[K-1] +  0x20;
    for (int i = 0; i < N; i++){
        cout <<  S[i];
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#include <functional>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
using namespace std;
using ll = long long;
constexpr int inf = 1000000000;
constexpr ll INF = 1000000000000000000;

constexpr int MAXB = 100010;

int main() {
    int N;
    cin >> N;
    vector<int> S;
    int sum = 0;
    rep(i, N) {
        int s;
        cin >> s;
        if (s % 10) S.push_back(s);
        sum += s;
    }
    sort(ALL(S));
    if (sum % 10) {
        cout << sum << "\n";
    } else {
        if (SZ(S)) cout << sum - S[0] << "\n";
        else cout << 0 << "\n";
    }
    return 0;
    return 0;
}


Measured memory_bytes: 3608
#include<iostream>
#include<complex>
using namespace std;
typedef complex<double> xy;

int main() {
	xy a, b, c, p;
	while (cin 
		>> a.real() >> a.imag()
		>> b.real() >> b.imag()
		>> c.real() >> c.imag()
		>> p.real() >> p.imag()) 
	{
		double d, e, f;
		d = (conj(a - p)*(b - p)).imag();
		e = (conj(b - p)*(c - p)).imag();
		f = (conj(c - p)*(a - p)).imag();
		if ((d < 0 && e < 0 && f < 0) || (d > 0 && e > 0 && f > 0))	cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

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

int main(){

  int N=0;
  cin>>N;

  if(N%2!=0){cout<<"No";return 0;}
  
  string s;
  cin>>s;
  
  rep(i,N/2){
  
    //cout<<i<<" "<<(i-1+N/2)<<endl;
    if(s[i]!=s[i+(N)/2]){cout<<"No";return 0;}
  
  }
  
  cout<<"Yes"<<endl;

  
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <limits>
#include <sstream>
#include <fstream>
#include <climits>
#include <map>
#include <numeric>
#include <functional>
#include <utility>

using namespace std;

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

int main(void) {
  int n = 5;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  int idx = -1;
  int mn = INT_MAX;
  int sum = 0;
  rep(i, n) {
    int q = a[i] % 10;
    if (q != 0) {
      if (q <= mn) {
        mn = q;
        idx = i;
      }
      sum += a[i] + 10 - q;
    }
    else {
      sum += a[i];
    }
  }
  cout << (idx == -1 ? sum : sum - 10 + mn) << endl;

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main() {
    int N;
    scanf("%d",&N);
    int array[N];
    int count = 0;

    int stop=0;

    for(int i=0;i <= N-1;i++){
        scanf("%d",&array[i]);
    }
 
 
    
    while(stop == 0){
        int start=-1;
        int end=-1;
        int min=101;

        for (int i=0;i<=N-1;i++){
            if (array[i]!=0&&start==-1){
                start=i;
                min=array[i];
                continue;
            }
            if(start!=-1){
                if(array[i]!=0){
                    if(min>=array[i]){
                    min=array[i];
                }
                }else{
                    end =i-1;
                    break;
                }
            }
      }
        if (start==-1){
            break;
        }
        if (end == -1){
            end = N-1;
        }
        for (int i=start;i<=end;i++){
            array[i]=array[i]-min;
        }
        count = count+min;
    }
    printf("%d", count);

  
    
    return 0;
}



Measured memory_bytes: 128
#include<stdio.h>
#include<string.h>
int main()
{
  char str[100];
  char *flag;
  scanf("%s", str);

  flag = strchr(str, (int)'7');

  if(flag != NULL)
  {
    printf("Yes\n");
  }

  else
  {
    printf("No\n");
  }

  return 0;
}


Measured memory_bytes: 1656
N, M = map(int, input().split())

L = list()
R = list()
for i in range(M):
    l, r = map(int, input().split())
    L.append(l)
    R.append(r)

maxL = max(L)
minR = min(R)

num = 0 
for j in range(maxL,minR+1):
    num +=1

print(num)

Measured memory_bytes: 16728
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define EPS (1e-7)
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
const double PI = acos(-1);
const ll MOD = 1000000007;
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;
}
///////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int A,B,C; cin >> A >> B >> C;
    if (A % 2 == 1 || B % 2 == 1 || C % 2 == 1) cout << 0 << endl;
    else {
        if (A == B && B == C) cout << -1 << endl;
        else {
            int cnt = 0;
            while (A % 2 == 0 && B % 2 == 0 && C % 2 == 0) {
                cnt++;
                int p = B/2 + C/2;
                int q = C/2 + A/2;
                int r = A/2 + B/2;
                A = p;
                B = q;
                C = r;
            }

            cout << cnt << endl;
        }
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;int main(){int N,A[60000];cin>>N;for(int i=0;i<N;i++)A[i]=0;for(int x=1;x<101;x++)for(int y=1;y<101;y++)for(int z=1;z<101;z++)A[x*x+y*y+z*z+x*y+y*z+z*x-1]++;for(int i=0;i<N;i++)cout<<A[i]<<endl;}


Measured memory_bytes: 3788
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<bits/stdc++.h>
using namespace std;
int main() 
{
string s;
for(int i=0;i<4;i++)
{
cin>>s[i];
}

 if(s[0] == s[1] && s[1] != s[2] && s[2] == s[3])
printf("Yes\n");
else if(s[0] == s[2] && s[2] != s[1] && s[1] == s[3])
printf("Yes\n");
else if(s[0] == s[3] && s[3] != s[1] && s[1] == s[2])
printf("Yes\n");
else
 printf("No\n");

return 0;
}

Measured memory_bytes: 3640
#include <stdio.h>
int main(void){
	double n,k,i,score=0,cp=0,tp=0;

	scanf("%lf%lf",&n,&k);

	for(i=1;i<=n;i++){
		score = i;
		cp= 1 / n;
		while(score < k){
			score = score * 2;
			cp = cp / 2;
		}
		tp = tp + cp;
	}
	
	printf("%.15f\n",tp);
	return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;


int main() {
    int n,a;
    cin >> n;
    vector<int>m,mm;
    map<int, int>mp;
    rep(i, n) {
        cin >> a;
        mp[a]++;
        m.push_back(a);
    }
    mm = m;
    sort(all(m));
    int z = m[n - 1], y = m[n - 2];
    for (auto s : mm) {
        if (s == z) {
            if (mp[z] = 1)cout << y << endl;
            else cout << z << endl;
        }
        else {
            cout << z << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 8692
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
using namespace std;

int main(){
  int N;
  cin >> N;
  vector<int> stu(N);
  for(int i = 0;i < N;i++){
    cin >> stu.at(i);
  }
  vector<int> ans(N);
  for(int i = 0;i < N;i++){
    ans.at(stu.at(i) - 1) = i + 1;
  }
  for(int i = 0;i < N;i++){
    cout << ans.at(i) << " ";
  }
  cout << endl;
  
  return 0;
}


Measured memory_bytes: 4044
using System;
using System.Collections.Generic;
using System.Linq;
using Console = System.Console;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var r = Console.ReadLine();
            var len = r.Length - 2;
            Console.WriteLine(r.First().ToString() + len.ToString() + r.Last().ToString());
        }        
        
    }
}

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

const int maxn=200010;
int a[maxn],b[maxn];

bool cmp(int a,int b){
	return a>b;
}

int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		b[i]=a[i];
	}
	sort(b+1,b+n+1,cmp);
	int maxa=b[1];
	int i=1;
	while(i<=n&&b[i]==b[1]) i++;
	if(i>n||i>2){
		for(int i=1;i<=n;i++) cout<<maxa<<endl;
	}
	else{
		int maxb=b[i];
		for(int i=1;i<=n;i++){
			if(a[i]==maxa) cout<<maxb<<endl;
			else cout<<maxa<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3200
#include <iostream>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#define ll long long
#define mod 1000000007
using namespace std;

ll n, arr[10004];
bool vis[1000005];
map<ll, ll>mp;
set<ll>st;

void pre()
{
    for (int i = 2; i < 1000005; i++)
    {
        if (!vis[i])
        {
            st.insert(i);
            for (int j = i + i; j <= n; j++)
                vis[j] = 1;
        }
    }
}

bool prime(ll x)
{
    if (st.find(x) != st.end())return 1;
    return 0;
}

ll fp(ll base, ll power)
{
    if (power == 0) return 1;
    ll ans = fp(base, power / 2);
    ans = (ans * ans) % mod;
    if (power % 2 != 0)
        ans = (ans * (base % mod)) % mod;
    return ans;
}

void get_max(ll key, ll val)
{
    map<ll, ll>::iterator it = mp.find(key);
    if (it == mp.end())
        mp.insert({ key,val });
    else
        it->second = max(it->second, val);
}

void get_factors(ll x)
{
    ll xx = x;
    for (int i = 2; i <= sqrt(x); i++)
    {
        if (xx % i == 0)
        {
            ll power = 0;
            while (xx % i == 0)
            {
                power++;
                xx /= i;
            }
            get_max(i, power);
        }
    }
    if (prime(xx))
        get_max(xx, 1);
}

int main()
{
    pre();
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> arr[i];
        get_factors(arr[i]);
    }
    ll lcm = 1, ans = 0;
    for (auto i : mp)
        lcm = ((lcm % mod) * fp(i.first, i.second)) % mod;
    for (int i = 0; i < n; i++)
        ans = (ans + ((lcm * fp(arr[i], mod - 2)) % mod)) % mod;
    cout << ans % mod << '\n';
    return 0;
}


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

int main(){
  char s;
  int ch = 0;
  //vector<char> C(26);
  cin >> s;
  for(char moji='a'; moji<='z'; ++moji){
    if(ch==1) {cout << moji << endl; break;}
    else if(s == moji) ch = 1;
  }
}

Measured memory_bytes: 256
N = int(input())
# dp[i] = 合計i円引き出すために必要な引出し回数
dp = [10**9 for _ in range(10 ** 5 + 1)]
dp[0] = 0

# 引き出せる金額のリスト
num = [1]
for i in range(1, 7):
    num.append(6**i)
for i in range(1, 6):
    num.append(9**i)

for i in range(10**5 + 1):
    for n in num:
        # 遷移元が存在する and 遷移先が存在する場合
        if dp[i] != -1 and i + n <= 10**5:
            dp[i + n] = min(dp[i + n], dp[i] + 1)

print(dp[N])


Measured memory_bytes: 79168
#include <iostream>
#include <stdio.h>
using namespace std;

int main(){
	/*input*/
	int a, b;	cin >> a >> b;
	/*calculation*/
	int r[2];
	int l[2];
	int ans = 0;
	for(int i = a; i <= b; i++){
		r[0] = i%10;
		r[1] = ((i - r[0])%100)/10;
		l[0] = i/10000;
		l[1] = (i - l[0]*10000)/1000;
		if(r[0] == l[0] && r[1] == l[1])ans++;
	}
	/*output*/
	cout << ans << endl;
}


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

int main(){
    int N,M,K[30],A[30][30],i,j,k,Q,count;
    cin >> N >> M;
    for(i=0;i<N;i++){
        cin >> K[i];
        for(j=0;j<K[i];j++){
            cin >> A[i][j];
        }
    }
    count = 0;
    for(i=0;i<K[0];i++){
        Q=0;
        for(j=1;j<N;j++){
            for(k=0;k<K[j];k++){
                if(A[0][i]==A[j][k])
                    Q++;
            }
        }
        if(Q==N-1){
            count++;
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 256
a,b,c = map(int, input().split())

flg = 0

if a != b:
    flg = 1

if a != c:
    flg = 1

if b != c:
    flg = 1

if a != b and a !=c and b != c:
    flg = 0

if flg == 1:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
//============================================================================
// Name        : JOI.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <vector>
using namespace std;
typedef long long ll;
string S1,S2,S3;
int main() {
	cin>>S1>>S2>>S3;

	string A,B,C;
	A=toupper(S1[0]);
	B=toupper(S2[0]);
	C=toupper(S3[0]);

	cout<<A<<B<<C<<endl;
	return 0;
}


Measured memory_bytes: 768
#include<bits/stdc++.h>
#include<string.h>
#define ll long long
#define pf printf
#define sf scanf
#define ff first
#define ss second
#define clr clear()
#define sz size()
#define pb push_back
#define mk make_pair
#define pi acos(-1)
#define inf 20000000000000000
#define mod 1000000007
#define ull unsigned long long int
#define f(i,k,n) for(i=k;i<n;i++)
#define fr(i,n,k) for(i=n;i>=k;i--)
#define ent(a) scanf("%lld",&a)
#define ent2(a,b) scanf("%lld%lld",&a,&b)
#define ent3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define mem(a) memset(a,0,sizeof(a))
#define vec(v,s) vector<ll>v[s]
#define arr(a,s) ll a[s];
/*#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
//knight and king//
int dr[]= {2,2,-2,-2,1,-1,1,-1};
int dc[]= {1,-1,1,-1,2,2,-2,-2};
int dr1[]= {0,0,1,1,1,-1,-1,-1};
int dc1[]= {1,-1,1,0,-1,0,1,-1};
int dr2[]= {0,0,1,-1};
int dc2[]= {1,-1,0,0};
////////////////////////////
using namespace std;
#define ma 200000

int main()
{
   ll i,j,x,y;
   cin>>x>>y;
   bool f=0;
   for(i=0;i<=x;i++)
   {
       ll p=i*2;
       ll q=(x-i)*4;
       if(p+q==y)f=1;
   }
   if(f)cout<<"Yes"<<endl;
   else cout<<"No"<<endl;
}




Measured memory_bytes: 3560
import java.util.Scanner;

public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        int D = sc.nextInt();
        int L = A + B;
        int R = C + D;

        if(L > R){
            System.out.println("Left");
        }else if(L == R){
            System.out.println("Balanced");
        }else{
            System.out.println("Right");
        }

    }
}

Measured memory_bytes: 23636
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

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

//const ll INF = 1e18L + 5;
//const int INF = 1e9 + 5;
//const double pi = 3.14159265358979323846;

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

	int n;
	cin >> n;
	unordered_map<int, int> mp;

	vector<int> h(n);
	ll ans = 0;
	rep(i, n) cin >> h[i];
	rep(j, n) {
		if (j - h[j] >= 0)
			mp[j - h[j]]++;
	}
	rep(i, n) {
		ans += mp[i + h[i]];
	}
	cout << ans << endl;
}


Measured memory_bytes: 12988
#include <iostream>
#include <string>
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <algorithm>
#include <ctime>
#include <vector>
#include <set>
#include <queue>
using namespace std;
#define PI 3.14159265358979323846264338327950L

int main()
{
    int N, M;
    cin >> N >> M;
    int A[M], B[M];
    vector<int> adj[N];
    for (int i = 0; i < M; i++)
    {
        cin >> A[i] >> B[i];
        A[i]--;
        B[i]--;
        adj[A[i]].push_back(B[i]);
        adj[B[i]].push_back(A[i]);
    }
    deque<int> q;
    //queue<int> que;
    q.push_back(0);
    int ans[N]{};
    bool vis[N]{};
    vis[0] = true;
    while (!q.empty())
    {
        int v = q.front();
        q.pop_front();
        for (int i : adj[v])
        {
            if (vis[i])
                continue;
            ans[i] = v;
            q.push_back(i);
            vis[i] = true;
        }
    }
    cout << "Yes\n";
    for (int i = 1; i < N; i++)
    {
        cout << ans[i] + 1 << "\n";
    }
    return 0;
}

Measured memory_bytes: 12056
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int inf = 1001001001;

int main(){
  ll x;
  cin >> x;
  
  ll i = 0;
  ll mo = 100;
  while (mo < x){
    mo += mo/100;
    i++;
  }
  cout << i << endl;
}

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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
void dbg(){ cerr << "\n"; }  template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
typedef uint64_t ul;
struct chtime{  
	chrono::system_clock::time_point ctm;
	chtime() { rstt();}
	void rstt() { ctm=chrono::system_clock::now();}
	uint64_t gtm(){
		auto ptm = chrono::system_clock::now() - ctm;
		return chrono::duration_cast<chrono::milliseconds>(ptm).count();
	}
	void disp(){ cerr << gtm() <<"\n";}
};
const vector<VI> cnsw ={
	{1,4},   {0,2,5},  {1,3,6}, {2,7},
	{0,5,8}, {1,4,6,9},{2,5,7,10},{3,6,11},
	{4,9,12},{5,8,10,13}, {6,9,11,14}, {7,10,15},
	{8,13},  {9,12,14}, {10,13,15}, {11,14}
};

VI bb(16);
int lv;
int mhcl(const VI& v){
	int rt=0;
	rep(i,16) if(v[i]!=0){
		int cr=v[i]-1;
		rt += abs((i>>2) - (cr>>2)) + abs((i&3) - (cr&3));
	}
	return rt;
}

bool fck(int dpt, int pr, int zr){

	int mh = mhcl(bb);
	if(mh ==0 ) return true;
	if(mh + dpt > lv) return false;
	for(int z: cnsw[zr]){
		if(z == pr) continue;
		swap(bb[z], bb[zr]);
		if(fck(dpt+1, zr, z)) return true;
		swap(bb[z], bb[zr]);
	}
	return false;
}

int main()
{

	rep(i, 16) cin >>bb[i];
	int zr;
	rep(i,16) if(bb[i]==0) zr=i;
	//chtime tm;
	for(lv=0; lv<50  ;lv++){
		if(fck(0, 999, zr)){
			cout << lv <<"\n"; break;
			//dbg(lv, tm.gtm());
		}
	}
	//tm.disp();
	return 0;
}




Measured memory_bytes: 3172
#include<bits/stdc++.h>
const unsigned int M = 1000000007; 
#define all(v) (v).begin(), (v).end()
#define rall(v) v.rbegin(),v.rend()
#define  pb push_back
#define mpp make_pair
#define int  long long
#define N 998244353
#define endl "\n"
#define fr(i,n) for(int i=0;i<n;i++)
int power(int x,int y){int res=1;while(y>0){if(y&1)res=x*res; y=y>>1;x=x*x;}return res;}
int power(int x,int y,int mod){int res=1;while(y>0){if(y&1)res=x*res%mod; y=y>>1;x=x*x%mod;}return res;}

using namespace std;

void nik()
{
	ios_base::sync_with_stdio(false); cin.tie(NULL);

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

	int dp[105][100005];


#define F first
#define S second

 signed main()
{
//nik();

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

while(t--)
{	
	
	int n,w;
	cin>>n>>w;
	int a[105]={0};
	int b[105]={0};
	for(int i=1;i<=n;i++)
	{
		
		cin>>a[i]>>b[i];
	}

	for(int i=1;i<=n;i++)
	{
		int wht=a[i];
		int val=b[i];
		dp[i][wht]=max(dp[i][wht],val);
		for(int j=1;j<=w;j++)
		{
			dp[i][j]=max(dp[i][j],dp[i-1][j]);
			if(j-wht>0)
			{
				dp[i][j]=max(dp[i][j],val+dp[i-1][j-wht]);
				dp[i][j]=max(dp[i][j],dp[i][j-1]);

			}
		}
	}
	// fr(i,n+1)
	// {
	// 	fr(j,w+1)cout<<dp[i][j]<<" ";
	// 	cout<<endl;;
	// }
	cout<<dp[n][w];
}
 return 0;
}



Measured memory_bytes: 79360
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i=a; i<n; i++)
#define RREP(i, a, n) for(ll i=n-1; i>=a; i--)
typedef long long ll;
const ll mod =1e9+7;
const ll inf =1e18;
using namespace std;

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

    if(a>b) swap(a, b);
    if(a==1 && b==2) cout<<3<<endl;
    else if(a==2 && b==3) cout<<1<<endl;
    else cout<<2<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] d = new int[n];
		for(int i = 0 ; i < n ; i++) {
			d[i] = sc.nextInt();
		}
		Arrays.sort(d);
		if(d.length % 2 == 1) {
			System.out.println(0);
		}
		int hanbun = d.length / 2;
		System.out.println(d[hanbun] - d[hanbun - 1]);
	}
}



Measured memory_bytes: 60652
#include <bits/stdc++.h>
typedef long long ll;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REP2(i, a, b) for(int i = a;i <= b;i++)
#define REPR(i, a, b) for(int i = a; i >= b; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define PI 3.14159265358979323846
#define vi vector<int>
#define vll vector<ll>
#define vi2 vector<vector<int>>
#define eb emplace_back
#define fi first
#define se second
#define ALL(v) v.begin(), v.end()
#define sz(x) int(x.size())
using namespace std;
using P = pair<ll,ll>;
const int dx[]{0, 1, 0, -1, -1, -1, 1, 1}, dy[]{1, 0, -1, 0, -1, 1, -1, 1};
#define INT(name) int name;cin >> name;
#define VEC(type,name,n) vector<type> name(n);REP(i,n) cin >> name[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;
}
class UnionFind {
public:
    vector < ll > par; // 各元の親を表す配列
    vector < ll > siz; // 素集合のサイズを表す配列(1 で初期化)

    // Constructor
    UnionFind(ll sz_): par(sz_), siz(sz_, 1) {
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1);
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }

    // Member Function
    // Find
    ll root(ll x) { // 根の検索
        while (par[x] != x) {
            x = par[x] = par[par[x]]; // x の親の親を x の親とする
        }
        return x;
    }

    // Union(Unite, Merge)
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        // merge technique（データ構造をマージするテク．小を大にくっつける）
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) { // 連結判定
        return root(x) == root(y);
    }

    ll size(ll x) { // 素集合のサイズ
        return siz[root(x)];
    }
};
int main()
{
  ll N,M;
  cin >> N >> M;
  vector<P> A(M);
  REP(i,M){
    cin >> A[i].first >> A[i].second;
    A[i].fi--;
    A[i].se--;
  }
  
  UnionFind UF(N);
  ll MAX = 1;
  REP(i,M){
    UF.merge(A[i].fi,A[i].se);
  }
  REP(i,M){
    MAX=max(MAX,UF.size(A[i].fi));
  }

  cout << MAX << endl;
}

Measured memory_bytes: 9580
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
constexpr long double EPS = 1e-15;
const long double PI = acos(-1);
constexpr int inf = 2e9;
constexpr ll INF = 2e18;
constexpr ll MOD = 1e9+7;
constexpr ll MOD1 = 998244353;
typedef pair<ll,ll> P;
//#define all(v) (v).begin(), (v).end()
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
//#define mp make_pair

vector<int> G[200010];
ll d[200010];
ll ans[200010];
ll used[200010];

void dfs(int v, ll cost) {
    used[v] = 1;
    cost += d[v];
    ans[v] = cost;
    REP(i,G[v].size()) {
        int to = G[v][i];
        if (used[to]) continue;
        dfs(to, cost);
    }
}

void solve() {
    int n,q;
    cin >> n >> q;
    REP(i,n-1) {
        int f,t;
        cin >> f >> t;
        f--;
        t--;
        G[f].pb(t);
        G[t].pb(f);
    }
    REP(i,q) {
        int node, value;
        cin >> node >> value;
        node--;
        d[node] += value;
    }
    dfs(0,0);
    REP(i,n) {
        cout << ans[i] << " \n"[i == n - 1];
    }
}

int main(int argc, char *argv[]){
    // /* Regular */
    // int case_num = 1;
    // if (argc > 1 && stoi(argv[1])) cin >> case_num;
    // REP(case_no, case_num) {
    //   cerr << endl << "case " << case_no + 1 << endl;
    //   solve();
    // }
    /* AOJ */
    solve();
    return 0;
}

Measured memory_bytes: 27392
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    }

    static class B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            long h = Long.parseLong(in.next());
            long w = Long.parseLong(in.next());

            if (h == 1 || w == 1) {
                out.println(1);
                return;
            }
            if (h % 2 == 0 && w % 2 == 0) {
                out.println((h * w) / 2);
                return;
            }

            long w2 = (w + 1) / 2;

            long ans = 0;
            for (int i = 0; i < h; i++) {
                if (w % 2 == 0 || i % 2 == 0) {
                    ans += w2;
                } else {
                    ans += w2 - 1;
                }
            }
            out.println(ans);
        }

    }
}



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

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

  int n, h, w;
  cin >> n >> h >> w;

  int vr = n - h + 1;
  int hr = n - w + 1;

  int ans = vr * hr;

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
/**
	������������ Author : Avi J Patel ������������
	������������ University : DA-IICT ������������
**/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair 
#define mt make_tuple
#define N 100000
#define ff first
#define ss second
#define si size()
#define MOD 1000000007
#define large 10000000000000001

#define For(i,m,n) for(long long i=m;i<n;i++)
#define st(x) sort(x.begin(),x.end())
#define re(x,i) reverse(x.begin()+i,x.end())
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));

bool sortbysec(const pair<int,int> &a, 
              const pair<int,int> &b) 
{ 
    return (a.second < b.second); 
} 
/*void calc()
{
	for(int i=0;i<2005;i++)
	{
		a[i][0]=1;
		a[i][i]=1;
		for(int j=1;j<i;j++)
		{
			a[i][j]=(a[i-1][j-1]+a[i-1][j])%MOD;	
		}
	}
}*/
int main()
{
	int n;
	cin>>n;
	vector<int> a(n);
	int max1=0,max2=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		if(a[i]>max1)
		{
			max2=max1;
			max1=a[i];
		}
		else if(a[i]>max2)
		{
			max2=a[i];
		}
	}
	for(int i=0;i<n;i++)
	{
		if(a[i]==max1)
		cout<<max2<<endl;
		else
		cout<<max1<<endl;
	}
	return 0;
}









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


void solve(long long N, std::vector<std::vector<long long>> A){
    vector<vector<long long> > C(2);
    vector<long long> temp_c(N+1, 0);
    for(int i = 0; i < N; ++i){
        temp_c[i+1] = temp_c[i] + A[0][i];
    }
    //for(auto i : temp_c) cout << i << endl;
    C[0] = temp_c;
    temp_c.clear();
    temp_c.resize(N+1);
    for(int i = N; i > 0; --i){
        temp_c[i-1] = temp_c[i] + A[1][i-1];
    }
    //for(auto i : temp_c) cout << i << endl;
    C[1] = temp_c;
    long long ans = 0;
    for(int i = 1; i < N+1; ++i) ans = max(ans, C[0][i] + C[1][i-1]);
    cout << ans << endl;
    return;
}

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


Measured memory_bytes: 3668
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
 
int main() {
    int n,k;
    cin >> n >> k;
    vector<ll> h(n);
    rep(i,n) cin >> h.at(i);
    sort(h.begin(),h.end());
    reverse(h.begin(),h.end());
    ll ans=0;
    for(int i=k;i<n;i++){
        ans+=h.at(i);
    }
    cout << ans << endl;

}

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

using namespace std;

const int INF = 1001001001;

struct Edge {
	int to, cost;
	Edge(){}
	Edge(int to, int cost) : to(to), cost(cost){}
};

struct State {
	Edge e;
	int ltime;
	State(Edge e, int ltime) : e(e), ltime(ltime){}
	bool operator > (const State &rhs) const {
		return (e.cost > rhs.e.cost);
	}
};

int main()
{
	int N, M, L, K, A, H;

	while (scanf("%d %d %d %d %d %d", &N, &M, &L, &K, &A, &H) && N){
		vector<Edge> G[128];
		bool able[128] = {0};
		int dp[128][128];

		for (int i = 0; i < N; i++){
			fill(dp[i], dp[i] + 128, INF);
		}

		for (int i = 0; i < L; i++){
			int x;
			scanf("%d", &x);
			able[x] = true;
		}
		able[A] = able[H] = 0;

		for (int i = 0; i < K; i++){
			int a, b, c;
			scanf("%d %d %d", &a, &b, &c);
			G[a].push_back(Edge(b, c));
			G[b].push_back(Edge(a, c));
		}

		priority_queue< State, vector<State>, greater<State> > pq;
		pq.push(State(Edge(A, 0), M));

		while (!pq.empty()){
			State tmp = pq.top(); pq.pop();
			if (dp[tmp.e.to][tmp.ltime] <= tmp.e.cost) continue;
			dp[tmp.e.to][tmp.ltime] = tmp.e.cost;

			if (tmp.e.to == H) break;

			for (int i = 0; i < G[tmp.e.to].size(); i++){
				Edge nxt = G[tmp.e.to][i];
				if (nxt.cost > tmp.ltime) continue;
				for (int j = 0; j + tmp.ltime - nxt.cost <= M; j++){
					if (j != 0 && !able[nxt.to]) break;
					else if (dp[nxt.to][j + tmp.ltime - nxt.cost] >= tmp.e.cost + j + nxt.cost){
						pq.push(State(Edge(nxt.to, tmp.e.cost + j + nxt.cost), j + tmp.ltime - nxt.cost));
					}
				}
			}
		}

		int ans = *min_element(dp[H], dp[H] + M + 1);
		if (ans != INF) printf("%d\n", ans);
		else printf("Help!\n");
	}

	return (0);
}

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

bool ok(bitset<15> is_honest_bit, vector<vector<int>>& shougen) {
        for (int i = 0; i < shougen.size(); i++) {
            if (!is_honest_bit[i]) {
                continue;
            }
            for (int j = 0; j < shougen.size(); j++) {
                if (shougen[i][j] == -1) {
                    continue;
                }
                if (is_honest_bit[j] != shougen[i][j]) {
                    return false;
                }
            }
        }
        return true;
}

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

    vector<vector<int>> shougen(N, vector<int>(N, -1));

    for(int i = 0; i < N; i++) {
        int A;
        cin >> A;
        for (int j = 0; j < A; j++) {
            int x;
            cin >> x;
            cin >> shougen[i][x - 1];
        }
    }

    int ans = 0;
    for (int is_honest = 0; is_honest < (1L << N); is_honest++) {
        bitset<15> is_honest_bit(is_honest);
        if (ok(is_honest_bit, shougen)) {
            int cnt = is_honest_bit.count();
            if (ans < cnt) {
                ans = cnt;
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
 
public class A {
    public static void Main(){
        string[] line = Console.ReadLine().Split(' ');
        string S = line[0];
        string T = line[1];
        
        line = Console.ReadLine().Split(' ');
        int A = int.Parse(line[0]);
        int B = int.Parse(line[1]);
        
        string U = Console.ReadLine();
        if (U == S)
        {
            A--;
        }
        else if (U == T)
        {
            B--;
        }
        Console.WriteLine(A+" "+B);
    }
}

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

int main(){
	int a[5];
	cin>>a[0];
	cin>>a[1];
	cin>>a[2];
	sort(a,a+3);
	if(a[1]-a[0]==a[2]-a[1]){
		cout<<"YES";
	}
	else cout<<"NO";
	cout<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
const long long inf=0x3f3f3f3f;
long long bs[maxn];
long long d,dx1[maxn],dx2[maxn];
long long a[maxn],an,ans;
void dfs(long long x,long long v,long long c)
{
	if(x==an)
	{
		ans+=(v==d)*c;
		return ;
	}
	if(abs(v-d)>a[x]*20)
		return ;
	for(long long i=0;i<20;i++)
	{
		long long cnt;
		if(x==0)
			cnt=dx1[i];
		else
			cnt=dx2[i];
		if(a[x]==0)
			cnt=i<10;
		if(cnt==0)
			continue;
		dfs(x+1,v+(i-10)*a[x],c*cnt);
	}
}
void solve(long long n)
{
	an=0;
	for(long long i=0;i<n;i++)
	{
		if(i>n-i-1)
			break;
		a[an++]=bs[n-i-1]-bs[i];
	}
	dfs(0,0,1);
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //freopen(".in","r",stdin);
    //freopen(".out","w",stdout);
    for(long long i=0;i<=9;i++)
    	for(long long j=0;j<=9;j++)
    		dx2[i-j+10]++;
    for(long long i=0;i<=9;i++)
    	for(long long j=1;j<=9;j++)
    		dx1[i-j+10]++;
    bs[0]=1;
    for(long long i=1;i<19;i++)
    	bs[i]=bs[i-1]*10;
    cin>>d;
    for(long long i=1;i<=19;i++)
    	solve(i);
    cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3648
#include<iostream>
#include<iomanip>
#include<queue>
#include<string>
#include<stack>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<cassert>
#include<algorithm>
#include<utility>
#include<map>
#include<set>
#include<vector>
#include<functional>

using namespace std;

#ifdef DEBUG
#define dbg
#define dprintf      printf
#define dout(x)      printf(#x" = %d\n",(x))
#define dary(x,n)    {int i;for(i=0;i<(n);i++)printf(#x"[%d] = %d\n",i,*((x)+i));}
#define dloop(i,s,g) for((i)=(s);(i)<(g);(i)++)
#define drep(i,n)    for((i)=0;(i)<(n);(i)++)
#else
#define dbg          (1)?0:
#define dprintf      (1)?0:printf
#define dout(x)
#define dary(x,n)
#define dloop(i,s,g) if(0)
#define drep(i,n)    if(0)
#define dary(x,n)
#endif

#define INF  (0x7fffffff)
#define LINF (0x7fffffffffffffff)

#define F    first
#define S    second
#define pb   push_back
#define mp   make_pair

#define loop(i,s,g) for((i)=(s);(i)<(g);(i)++)
#define rep(i,n)    for((i)=0;(i)<(n);(i)++)
#define all(x)      (x.begin(),x.end())

//#define int long long;
typedef  long long           ll;
typedef  unsigned            ui;
typedef  unsigned long long  ull;
typedef  pair<int,int>       i_i;
typedef  pair<ll,int>        ll_i;
typedef  pair<ll,ll>         ll_ll;
typedef  pair<double,int>    d_i;
typedef  pair<double,double> d_d;

signed main(void)
{
  int n;
  char s[112345];
  int a[1000]={};
  int max=0;
  int i,j;
  cin>>n;
  cin>>s;
  int len=strlen(s);
  loop(i,1,len+1)
    {
      if(s[i-1]=='I')
	a[i]=a[i-1]+1;
      else if(s[i-1]=='D')
	a[i]=a[i-1]-1;
      if(max<a[i])
	max=a[i];
    }
  cout<<max<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stack>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <functional>
#include <string>
#include <cstdlib>
#include <numeric>
#include <cstdbool>
#include <map> 
#include<set>
#include<queue>

typedef long long ll;


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

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; }

const long long INF = 1000000000000000;
const ll inf = -1e18;
typedef pair<ll, ll> P;
ll ma = 1000000000 + 7;
ll mx = 1000003;
ll h, w, n,m,k; string s,t;
char maze[60][60];
int dis[101][101]; int graph[52][52]; bool vis[52];
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };
ll gcd(ll x, ll y) {
	if (x % y == 0) return y;
	return gcd(y, x % y);

}
ll lcm(ll a,ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
void comb(vector<vector <ll> >& v) {
	for (ll i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (ll k = 1; k < v.size(); k++) {
		for (int j = 1; j < k; j++) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j])%ma;
		}
	}
}

ll GetDigit(ll num) {
	return log10(num) + 1;
}

int main() {
	ll a, b;
	cin >> a >> b;
	ll cnt = 0;
	ll sum = 0;
	rep(i, 1000) {
		if (b <= (a * cnt) - cnt+1) {
			cout << cnt << endl;
			return 0;
		}
		else {
			cnt++;
		}
	}
}

Measured memory_bytes: 256