akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define mem(a,b) memset(a,b,sizeof a);
#define rep(i,a,b) for(int i = a; i <= b; i++)
#define per(i,a,b) for(int i = a; i >= b; i--)
#define __ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
typedef long long ll;
typedef double db;
const db EPS = 1e-9;
const int N = 10;
const int inf = 1e5;
using namespace std;

void dbg() {cout << "\n";}
template<typename T, typename... A> void dbg(T a, A... x) {cout << a << ' '; dbg(x...);}
#define logs(x...) {cout << #x << " -> "; dbg(x);}

int h,w;
char s[N][N];

int solve(int row,int maxx){
	rep(j,1,w)
		if(s[row][j] == '#'){
			if(j < maxx) maxx = inf;
			else maxx = j;
		}
	return maxx;
}

int main()
{
	scanf("%d%d",&h,&w);
	rep(i,1,h) scanf("%s",s[i]+1);
	int maxx = 1;
	rep(i,1,h) maxx = solve(i,maxx);
	if(maxx == inf) printf("Impossible\n");
	else printf("Possible\n");
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main() {
	int a[4], b[4], hit, blow, i, j;
	while (scanf("%d %d %d %d", &a[0], &a[1], &a[2], &a[3]) != EOF) {
		scanf("%d %d %d %d", &b[0], &b[1], &b[2], &b[3]);
		hit = 0, blow = 0;
		for (i = 0;i < 4;i++) {
			for (j = 0;j < 4;j++) {
				if (a[i] == b[j]) {
					if (i == j) {
						hit++;
					}
					else {
						blow++;
					}
				}
			}
		}
		printf("%d %d\n", hit, blow);
	}
	return 0;
}

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

using namespace std;

#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define int long long
#define mp make_pair
#define ff first
#define ss second
#define pii pair<int,int>
#define INF LLONG_MAX
#define EPS 1e-9
#define all(v) (v).begin(),(v).end()
#define sq(x) ((x)*(x))
#define foreach(it, v) for(auto it=(v).begin(); it != (v).end(); ++it)
#define tr(...) cout<<__FUNCTION__<<' '<<__LINE__<<" = ";trace(#__VA_ARGS__, __VA_ARGS__)


#define tr(...) cout<<__FUNCTION__<<' '<<__LINE__<<" = ";trace(#__VA_ARGS__, __VA_ARGS__)

template<typename T>
void trace(const char* name, T&& arg1){cout<<name<<" : "<<arg1<<endl;}
 
template<typename T, typename... Args>
void trace(const char* names, T&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');cout.write(names, comma-names)<<" : "<<arg1<<" | ";trace(comma+1,args...);}
 
typedef long double dbl;
bool codejam = 0;

const int MOD = 1000*1000*1000 + 7;
const int NMAX = 1000*1000 + 11;

int arr[NMAX];
int n,m,p,q,k,a,b,c,ans;
string s,str;
char ch;
vector<int> v;

void solve()
{
    cin>>a>>b>>c>>n;

    if(a >= n){
        cout<<n;
    }else if(a + b >=n){
        cout<<a;
    }else{
        cout<<a - (n-a-b);
    }
}

int32_t main(){ fio;
    int t = 1;
    int cs = 1;
    // cin>>t;
    while(t--){
        if(codejam){
            cout<<"Case #"<<cs<<": ";
        }
        cs++;
        solve();
        cout<<"\n";
    }
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin>>n;
    Int ans=1;
    for(int i=1; i<=n; i++) ans*=i;
    cout<<ans<<endl;
    return 0;
}


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

#define ll long long
#define pb push_back
#define mp make_pair
#define mo 1000000007
#define MAX 1000004
#define fast_io ios::sync_with_stdio(false)

int main()
{
	fast_io;
	int n, x;
	cin >> n;
	deque<int> d;
	for(int i=1;i<=n;i++)
	{
		cin >> x;
		if(i%2 == n%2)
			d.push_front(x);
		else
			d.push_back(x);

	}
	while(!d.empty())
	{
		cout << d.front() << " ";
		d.pop_front();
	}
	return 0;
}

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

using namespace std;

int main() {
	long long n, k, ans = 0;
	cin >> n >> k;
	for (long long i = k; i <= n + 1; i++) {
		ans += (n - i + 1) * i + 1;
		ans %=1000000007;
	}
	cout << ans;
}


Measured memory_bytes: 3588
S = input()
N = len(S)
C = [0] * N
c = 0
for i in range(N):
  if S[i] == 'R':
    c = i
  else:
    C[c + (i - c) % 2] += 1
for i in range(N - 1, -1, -1):
  if S[i] == 'L':
    c = i
  else:
    C[c - (c - i) % 2] += 1
print(' '.join([str(c) for c in C]))

Measured memory_bytes: 10484
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;
const int maxn = 1e6 + 10;
long long n;
long long a[maxn];
long long cmp(long long a, long long b)
{
	return a>b;
}
int main()
{
	scanf("%lld",&n);
	long long i,j;
	for (i = 0; i < n; i++) cin>>a[i];
	sort(a,a+n,cmp);
	long long x = -1, y = -1;
	for (i = 0; i < n; i++)
		if (a[i]==a[i-1]){
			x=a[i];
			break;
		}
	for (i += 2; i < n; i++)
		if (a[i]==a[i-1]){
			y=a[i];
			break;
		}
	if (x == -1 || y == -1) printf("0\n");
	else printf("%lld\n",x*y);
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
using namespace std;
using ll = long long int;
ll mygcd(ll m, ll n){
    if(m < n){
        ll t = n; n = m; m = t;
    }
    while(n){
        ll r = m % n;
        m = n;
        n = r;
    }
    return m;
}

int main(){
    int n;
    cin >> n;
    vector<ll> t0(n);
    for(int i = 0; i < n; i++) cin >> t0[i];
    vector<ll> t;
    t.push_back(t0[0]);
    for(int i = 1; i < n; i++){
        bool isadd = true;
        for(auto p: t){
            if(p == t0[i]) isadd = false;
        }
        if(isadd) t.push_back(t0[i]);
    }

    ll ans = t[0];
    for(int i = 1; i < t.size(); i++){
        ans = ans * (t[i]/mygcd(ans, t[i]));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3620
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

X = [A,B,C,D,E]
Y = []
for x in X:
    if x%10==0:
        Y.append((0, x))
    else:
        d = 10 - x%10
        Y.append((d, x+d))

Y.sort(reverse=True)
Ans = Y[0][1]-Y[0][0]
for i in range(1,len(Y)):
    Ans += Y[i][1]

print(Ans)

Measured memory_bytes: 3064
#include <iostream>

using namespace std;

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

	int L, R;
	L = A + B;
	R = C + D;

	if (L == R)
		cout << "Balanced" << endl;
	else if (L > R)
		cout << "Left" << endl;
	else
		cout << "Right" << endl;

}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define CK(N, A, B) (A <= N && N < B)
#define REP(i, a, b) for (int i = a; i < b; i++)
#define RREP(i, a, b) for (int i = (b - 1); a <= i; i--)
#define F first
#define S second
typedef long long ll;

const int INF = 1e9;
const long long LLINF = 1e18;

int a, b, c, k;
int sum;
int main() {
    cin>>a>>b>>c>>k;
    if(a>=b && a>=c){
        REP(i, 0, k) a*=2;
    }
    else if(b>=a && b>=c){
        REP(i, 0, k) b*=2;
    }
    else {
        REP(i, 0, k) c*=2;
    }
    cout<<a+b+c<<endl;
    return 0;
}

Measured memory_bytes: 256
/*
No matter how long a night, dawn will always break.

Simular saying ... The darkest hour is just before the dawn.
 ***************************************   ************************8   **********************************
*/
#include <bits/stdc++.h>
using namespace std;

 
#define int         long long
#define double      long double
#define pb          push_back
#define pf          push_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define x           first
#define y           second
#define endl        '\n'
#define sz(x)	    (int)(x).size()
#define fo(i,l,u)   for(i=l;i<u;i++)
#define rfo(i,l,u)  for(i=l;i>=u;i--)
#define allfo(s)    for(auto it=(s).begin();it!=(s).end();it++)
#define _init(b)     memset(b,-1,sizeof(b))
#define _init0(b)     memset(b,0,sizeof(b))
#define MOD         1000000007
#define hell        998244353
#define output(x) cout << (x ? "YES" : "NO")<<endl;
 
 
 
 
 
int gcd(int a, int b) {if(a>b)swap(a,b) ;  if (a == 0)  return b; return gcd(b % a, a); }  
bool mod(double a,double b) {return a/b - floor(a/b);}
 
const int N=1e5+5;
vi graph[N];

 int r5(int n){
 	int ans=1;
 	for(int i=0;i<5;i++){
 		ans*=n;
 	}
 	return ans;
 }
 
 
signed main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
   int n,m,i,j,x,t;
   set<int> s;
   cin>>n;
   vi v;

   fo(i,0,1000){
   		v.pb(r5(i));

   }
   int a,b;
   x=n;
   vi ans;
   fo(i,0,1000){
   		fo(j,i,1000){
   			if(v[i]+v[j]==x){
   				ans.pb(i);
   				ans.pb(-j);
   			}
   			else if(v[i]-v[j]==x){
   				ans.pb(i);
   				ans.pb(j);
   			}
   			else if(v[j]-v[i]==x){
   				ans.pb(-i);
   				ans.pb(-j);
   			}
   		}
   		if(ans.size()>0)break;
   }
   cout<<ans[0]<<" "<<ans[1]<<endl;

   
    return 0;
}

Measured memory_bytes: 6016
#include <iostream>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <algorithm>
#include <functional>
#include <cstring>
#include <limits.h>
#define FOR(i,k,n)  for (int i=(k); i<(int)(n); ++i)
#define REP(i,n)    FOR(i,0,n)
#define FORIT(i,c)	for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define SZ(i) ((int)i.size())
#define pb          push_back
#define mp          make_pair
#define mt          make_tuple
#define get0(x)     (get<0>(x))
#define get1(x)     (get<1>(x))
#define get2(x)     (get<2>(x))
#define ALL(X)      (X).begin(),(X).end()
#define LLMAX       9223372036854775807LL
#define LLMIN       -9223372036854775808LL
#define IMAX        2147483647
#define IMIN        -2147483648
typedef long long LL;
using namespace std;

int N;
vector<int> A;
int B[10];
int ans=0;

int dfs(int v){
    if(v==N){
        LL p=1;
        REP(i,N)
            p*=(LL)B[i];
        if(p%2==0)
            ans++;
    }else{
        FOR(i,-1,2){
            B[v]=A[v]+i;
            dfs(v+1);
        }
    }
}

int main(void){
    cin>>N;
    REP(i,N){
        int a;
        cin>>a;
        A.pb(a);
    }
    dfs(0);
    cout<<ans<<endl;
     return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int a,b,c ;
    cin >> a;
    cin >> b;
    cin >> c;
    if(a < b && b < c){
        cout << "Yes" <<endl;
    }
        
        else{
                cout <<   "No" <<endl;
            }
}   


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

using namespace std;

typedef long long int64;
const int64 INF = 1LL << 59;

const int vy[] = {0, 1, 0, -1}, vx[] = {1, 0, -1, 0};

int main()
{
  int H, W, A, B, C, N;
  int S[100000], T[100000];
  int64 v[501][501];

  scanf("%d %d", &H, &W);
  scanf("%d %d %d", &A, &B, &C);
  scanf("%d", &N);

  queue< pair< int, int > > que;
  memset(v, -1, sizeof(v));
  for(int i = 0; i < N; i++) {
    scanf("%d %d", &S[i], &T[i]);
    v[S[i]][T[i]] = 0;
    que.emplace(S[i], T[i]);
  }

  while(!que.empty()) {
    int y, x;
    tie(y, x) = que.front();
    que.pop();
    for(int i = 0; i < 4; i++) {
      int ny = y + vy[i], nx = x + vx[i];
      if(ny < 0 || nx < 0 || ny > H || nx > W) continue;
      if(~v[ny][nx]) continue;
      que.emplace(ny, nx);
      v[ny][nx] = v[y][x] + 1;
    }
  }

  typedef tuple< int64, int, int, int > Node;
  int64 min_cost[501][501][5];
  priority_queue< Node, vector< Node >, greater< Node > > q;
  fill_n(**min_cost, 501 * 501 * 5, INF);
  q.emplace(0, S[0], T[0], 4);
  min_cost[S[0]][T[0]][4] = 0;
  while(!q.empty()) {
    int64 cost;
    int y, x, s;
    tie(cost, y, x, s) = q.top();
    q.pop();
    if(min_cost[y][x][s] < cost) {
      continue;
    }
    if(y == S[N - 1] && x == T[N - 1] && s == 4) {
      printf("%lld\n", cost);
      break;
    }
    if(s == 4) {
      for(int i = 0; i < 4; i++) {
        int ny = y + vy[i], nx = x + vx[i];
        if(ny < 0 || nx < 0 || ny > H || nx > W) continue;
        if(cost + B < min_cost[y][x][i]) {
          min_cost[y][x][i] = cost + B;
          q.emplace(min_cost[y][x][i], y, x, i);
        }
        if(cost + C < min_cost[ny][nx][4]) {
          min_cost[ny][nx][4] = cost + C;
          q.emplace(min_cost[ny][nx][4], ny, nx, 4);
        }
      }
    } else {
      if(cost + v[y][x] * C < min_cost[y][x][4]) {
        min_cost[y][x][4] = cost + v[y][x] * C;
        q.emplace(min_cost[y][x][4], y, x, 4);
      }
      int ny = y + vy[s], nx = x + vx[s];
      if(ny < 0 || nx < 0 || ny > H || nx > W) continue;
      if(cost + A < min_cost[ny][nx][s]) {
        min_cost[ny][nx][s] = cost + A;
        q.emplace(cost + A, ny, nx, s);
      }
    }
  }


}

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

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  int K;
  cin >> K;
  bool result = false;
  for (int i = 0; i <= K; i++) {
    for (int j = 0; j <= K - i; j++) {
      if (A < (B * pow(2, i)) && (B * pow(2, i)) < (C * pow(2, j))) {
        result = true;
        
      }
    }
  }
  if (result) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  return 0;
}

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

#define ll		long long
#define pb		push_back

using namespace std;

int main(){
	ll n, k;
	cin>>n;
	vector <ll> a;
	for (int i = 0; i<n; i++){
		cin>>k;
		a.pb(k);
	}
	sort(a.begin(), a.end());
	cout<< a[n-1] - a[0]; 
}

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

using namespace std;

#define long long long
#define INF 1e18
#define MOD (long) (1e9 + 7)

int main()
{
    long x;
    cin >> x;

    long y = x / 200;
    y = 10 - y;
    printf("%lld\n", y);
}


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

using namespace std;

int n;

long long x;

queue<long long> q;

int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= 9; ++i)
		q.push(i);
	for(int i = 0; i < n ; ++i)
	{
		x = q.front();
		q.pop();
		if(x % 10 != 0)
			q.push(10*x + (x%10) - 1);
		q.push(10*x + (x%10));
		if(x % 10 != 9)
			q.push(10*x + (x%10) + 1);
	}
	cout << x << endl;
	return 0;
}

Measured memory_bytes: 1792
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * 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;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            long[] a = in.nextLongArray(n);

            long tmp1 = 0;
            long sum1 = 0;
            for (int i = 0; i < n; i++) {
                sum1 += a[i];
                if (i % 2 == 0) {
                    if (sum1 >= 0) {
                        tmp1 += sum1 + 1;
                        sum1 = -1;
                    }
                } else {
                    if (sum1 <= 0) {
                        tmp1 += -sum1 + 1;
                        sum1 = 1;
                    }
                }
            }

            long tmp2 = 0;
            long sum2 = 0;
            for (int i = 0; i < n; i++) {
                sum2 += a[i];
                if (i % 2 == 1) {
                    if (sum2 >= 0) {
                        tmp2 += sum2 + 1;
                        sum2 = -1;
                    }
                } else {
                    if (sum2 <= 0) {
                        tmp2 += -sum2 + 1;
                        sum2 = 1;
                    }
                }
            }

            out.println(Math.min(tmp1, tmp2));
        }

    }

    static class InputReader {
        BufferedReader in;
        StringTokenizer tok;

        public String nextString() {
            while (!tok.hasMoreTokens()) {
                try {
                    tok = new StringTokenizer(in.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return tok.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextString());
        }

        public long nextLong() {
            return Long.parseLong(nextString());
        }

        public long[] nextLongArray(int n) {
            long[] res = new long[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextLong();
            }
            return res;
        }

        public InputReader(InputStream inputStream) {
            in = new BufferedReader(new InputStreamReader(inputStream));
            tok = new StringTokenizer("");
        }

    }
}



Measured memory_bytes: 39136
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);
        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task
    {
        public void solve(int testNumber, Scanner in, PrintWriter out)
        {
            long H = in.nextLong();
            out.print(getAttacks(H));
        }

        private long getAttacks(long h)
        {
            if (h == 1) return 1;
            return 1 + (2 * getAttacks(h / 2));
        }

    }
}



Measured memory_bytes: 23764
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
   
typedef pair<double,double> P;
typedef pair<P,double> P2;
   
P rot(P p, double a){
  a=a*M_PI/180.0;
  return P(p.first*cos(a)+p.second*(-sin(a)),
  p.first*sin(a)+p.second*cos(a));
}
   
double abss(P a,P b){
  return sqrt((a.first-b.first)*(a.first-b.first)+(a.second-b.second)*(a.second-b.second));
}
   
double x,y,r;int tt;
vector<P>v;
int main(){
   
  int n;
  cin>>n;
   
    double ans=1e13;
       
    v.clear();
     
    r(i,n){
      cin>>x>>y;
      v.push_back(P(x,y));
    }
   
    r(i,1){
      sort(v.begin(),v.end());
      r(j,n){
        for(int k=j+1,c=0;k<n;k++,c++){
          if(c>1000)break;
          ans=min(ans,abss(v[k],v[j]));
        }
      }
      r(j,n)v[i]=rot(v[i],0.5);
    }
   
    printf("%.11f\n",ans);
       
}


Measured memory_bytes: 4992
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
using P = pair<int, int>;


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

    int start = a / k;

    string res = "NG";

    for (int i = a; i <= b; ++i) {
        if (i % k == 0) {
            res = "OK";
            break;
        }
    }
    cout << res;
}

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

using namespace std;

int main(){
	int a,b;
	cin >> a >> b;
	int ans = b;
	if(a >= 13) ans = b;
	else if(a >= 6) ans = b/2;
	else ans = 0;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}

int func(int a){
  int count = 0;
  while(a != 0 && a%2 == 0){
    a /= 2;
    count++;  
  }
  return count;
}

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

  int ans = 0;

  rep(i,n){
    ans += func(a[i]);
  }
  
  cout << ans;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef std::vector<vector<int> > vvi;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<pi> vpi;
#define debugone(x) cerr << #x << " " << x << "\n"; cerr.flush();
#define debugtwo(x) cerr << #x << "-------------" << "\n";for(auto &it: x) cerr << it << " ";cerr << "\n"; cerr.flush();
#define debugthree(x, i, j) cerr << #x << "------------" << "\n";cerr << "from " << i << " to " << j << "\n";for(ll k=i; k<=j; k++) cerr << x[k] << " ";cerr << "\n"; cerr.flush();
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;
 
const ll mod = 1e9 + 7;
const ll inf = 1e11 + 5;
const int MaxN = 2e5 + 5;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	
	int n;
	cin >> n;
	vi cnt(26);
	for(int i = 0; i < n; i++){
		char ch;
		cin >> ch;
		cnt[ch - 'a']++;
	}
	ll ans = 1;
	for(int i = 0; i < 26; i++){
		ans = ans * (cnt[i] + 1);
		ans = ans % mod;
	}
	ans--;
	cout << (ans + mod) % mod << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <random>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <sstream>
#include <bitset>
#include <cassert>
#include <fstream>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
	#define DBG(X) cout << #X << "=" << (X) << endl;
#else
	#define DBG(X)
	#define endl '\n'
#endif
 
using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld  = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF  = (ll)(2e18);

const ll mod = 1e9 + 7;
const int NIL = -1;
static mt19937 _g(time(nullptr));

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for(auto el: v) cout << el << " "; return os; }

void solve()
{
	int k, x;
	cin >> k >> x;

	for(int i = max(-1000000, x - k + 1); i <= min(1000000, x + k - 1); ++i)
		cout << i << " ";

	cout << endl;
}

int main()
{
	fast_io();
	solve();

	return 0;
}


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

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int N;
ll A[100005];

bool check(ll n)
{
    REP(i, N)
    {
        ll p = n / A[i];
        n = A[i] * p;
    }
    return n == 2;
}

int main()
{
    cin >> N;
    REP(i, N)
    {
        cin >> A[i];
    }
    //! とりあえず満たすものを1つ求める
    ll t = 2;
    REP(i, N)
    {
        //! t<=k<2*tを満たす最小のA[N-1-i]の倍数
        ll a = A[N - 1 - i];
        ll p = t / a;
        if (a * p >= t)
            t = a * p;
        else
            t = a * (p + 1);
    }
    if (!check(t))
    {
        cout << -1 << endl;
        return 0;
    }

    //! 最小値と最大値を二分探索で見つける
    ll min = t;
    {
        ll ng = 0;
        while (abs(min - ng) > 1)
        {
            ll mid = (min + ng) / 2;
            if (check(mid))
            {
                min = mid;
            }
            else
            {
                ng = mid;
            }
        }
    }
    ll max = t;
    {
        ll ng = (ll)1e17;
        while (abs(max - ng) > 1)
        {
            ll mid = (max + ng) / 2;
            if (check(mid))
            {
                max = mid;
            }
            else
            {
                ng = mid;
            }
        }
    }
    cout << min << " " << max << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
string s,t;
int dp[3001][3001];
int solve(int l, int r){
	if(l<0||r<0) return 0;
	int& ret=dp[l+1][r+1];
	if(s[l]==t[r])
		return ret=1+solve(l-1,r-1);
	if(ret!=-1) return ret;
	int tmp=solve(l-1,r);
	ret=solve(l,r-1);
	if(ret<tmp)
		ret=tmp;
	return ret;
}
int main(){
	cin>>s>>t;
	for(int i=0;i<=s.length();i++)
		for(int j=0;j<=t.length();j++)
			dp[i][j]=-1;
	int sl=s.length();
	int tl=t.length();
	solve(sl-1,tl-1);
	vector<char> ans;
	while(sl>0&&tl>0){
		if(s[sl-1]==t[tl-1]){ 
			ans.push_back(s[sl-1]);
			sl--;
			tl--;
			continue;
		}
		if(dp[sl-1][tl]>dp[sl][tl-1])
			sl--;
		else
			tl--;
	}
	reverse(ans.begin(),ans.end());
	for(char a:ans)
		cout<<a;
	return 0;
}


Measured memory_bytes: 35840
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int i,j,k,h,r,mat[200][2][2],stk,ans;
int n,m;

int main(){
	while(scanf("%d",&n)*n){
		for(i=0;i<n;i++)scanf("%d %d",&mat[i][0][0],&mat[i][0][1]);
		mat[n][0][0]=9999;mat[n][0][1]=9999;
		scanf("%d",&m);
		for(i=0;i<m;i++)scanf("%d %d",&mat[i][1][0],&mat[i][1][1]);
		mat[m][1][0]=9999;mat[m][1][1]=9999;

		ans=n;h=0;r=0;
		for(i=0,j=0;j<m;j++){
			while(mat[j][1][0]>=mat[i][0][0] || mat[j][1][1]>=mat[i][0][1]){
				h=mat[i][0][0];r=mat[i][0][1];
				i++;
			}
			if(mat[j][1][0]>h && mat[j][1][1]>r){
				ans++;
				h=mat[j][1][0];r=mat[j][1][1];
			}
		}

		stk=m;h=0;r=0;
		for(i=0,j=0;i<n;i++){
			while(mat[i][0][0]>=mat[j][1][0] || mat[i][0][1]>=mat[j][1][1]){
				h=mat[j][1][0];r=mat[j][1][1];
				j++;
			}
			if(mat[i][0][0]>h && mat[i][0][1]>r){
				stk++;
				h=mat[i][0][0];r=mat[i][0][1];
			}
		}

		printf("%d\n",stk>ans?stk:ans);
	}
	return 0;
}

Measured memory_bytes: 600
import java.util.*;
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 res = a+b+c;
        if(res >= 22){
          System.out.println("bust");
        }
        else{
          System.out.println("win");
        }
	}
}

Measured memory_bytes: 23764
#include<bits/stdc++.h>
#define lint long long
#define st first
#define nd second
#define INF 0x3f3f3f3f

using namespace std;


int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	int n,x,t;
	cin>>n>>x>>t;
	int aux = 0;
	int ti=0;
	while(aux < n){
		ti += t;
		aux += x;
	}
	cout<<ti<<"\n";

	return 0;	
}


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

int main () {
  string N;
  cin >> N;
  string check = N.substr(N.size() - 1, 1);
  if(check == "3") cout << "bon" << endl;
  else if (check == "0" || check == "1" || check == "6" || check == "8") cout << "pon" << endl;
  else cout << "hon" << endl;
}

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

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


Measured memory_bytes: 9108
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
  ll n;
  cin>>n;
  ll a[n];
  ll i;
  for(i=0;i<n;i++)
    cin>>a[i];
  ll sol[n];
  sol[0]=0;
  sol[1]=abs(a[1]-a[0]);
  for(i=2;i<n;i++)
    sol[i]=min((sol[i-1]+abs(a[i]-a[i-1])),(sol[i-2]+abs(a[i]-a[i-2])));
    
  cout<<sol[n-1];
}

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

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &a) {
    bool first = true;
    os << "{";
    for (auto v : a) {
        if (!first) os << ", ";
        else first = 0;
        os << v;
    }
    os << "}";
    return os;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    vector<vector<int>> g(n);
    vector<pair<int, int>> edges(m);
    for (int i = 0; i < m; ++i) {
        int u, v;
        cin >> u >> v;
        --u, --v;
        edges[i] = make_pair(u, v);
        g[u].push_back(i);
    }
    vector<vector<bool>> res1(n, vector<bool>(n));
    {
        function<void(int, int)> dfs = [&](int u, int s) {
            res1[s][u] = 1;
            for (auto e : g[u]) {
                int v = edges[e].second;
                if (!res1[s][v]) dfs(v, s);
            }
        };
        for (int i = 0; i < n; ++i)
            dfs(i, i);
    }
    vector<bool> res2(m);
    {
        function<void(int, int, vector<int>&)> dfs = [&](int u, int id, vector<int> &mark) {
            mark[u] = id;
            for (auto e : g[u]) {
                int v = edges[e].second;
                if (mark[v] == -1) dfs(v, id, mark);
            }
        };
        for (int u = 0; u < n; ++u) {
            // cerr << "At: " << u << '\n';
            vector<int> mark1 = vector<int>(n, -1);
            mark1[u] = 0;
            for (int i = 0; i < (int) g[u].size(); ++i) {
                int v = edges[g[u][i]].second;
                if (mark1[v] == -1) dfs(v, i, mark1);
            }
            vector<int> mark2 = vector<int>(n, -1);
            mark2[u] = 0;
            for (int i = (int) g[u].size() - 1; i >= 0; --i) {
                int v = edges[g[u][i]].second;
                if (mark2[v] == -1) dfs(v, i, mark2);
            }
            // cerr << "mark1: " << mark1 << "\nmark2: " << mark2 << '\n';
            for (auto e : g[u]) {
                // cerr << e << ": " << edges[e].first << " " << edges[e].second << '\n';
                int v = edges[e].second;
                if (mark1[v] == mark2[v]) {
                    res2[e] = 0;
                } else {
                    res2[e] = 1;
                }
                // cerr << "res2[" << e << "] = " << res2[e] << '\n';
            }
        }
    }
    for (int i = 0; i < m; ++i) {
        int u = edges[i].first, v = edges[i].second;
        // cerr << res1[v][u] << " " << res2[i] << '\n';
        bool wit1 = res1[v][u] && !res2[i];
        bool wit2 = !res1[v][u] && res2[i];
        // cerr << wit1 << " " << wit2 << '\n';
        if (wit1 != wit2) cout << "diff\n";
        else cout << "same\n";
    }
    return 0;
}

Measured memory_bytes: 6640
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
    int A, B, C; cin >> A >> B >> C;

    cout << (A+B+C >= 22 ? "bust" : "win") << endl;
	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343



Measured memory_bytes: 256
import numpy as np

N = int(input())
D = list(map(int, input().split()))
M = int(input())
T = list(map(int, input().split()))
res = True
dic = {}
for i in range(N):
  if D[i] in dic:
    dic[D[i]] += 1
  else:
    dic[D[i]] = 1
for j in range(M):
  if (dic.get(T[j], 0) == 0):
    res = False
    break
  else:
    dic[T[j]] -= 1
if(res):
  print("YES")
else:
  print("NO")

Measured memory_bytes: 50588
#include <stdio.h>
#include <math.h>

int main(void){
	int N,M,X;
	int A[100];
	int i,j;
	
	scanf("%d",&N);
	scanf("%d",&M);
	scanf("%d",&X);
	for(i=1;i<=M;i++){
		scanf("%d",&A[i]);
	}
	
	int left=0,right=0;
	
	i=1;
	if(A[1]<=X){
		while(A[i]<=X){
			i++;
		}
		left=i-1;
	}else{
		left=0;
	}
	j=0;
	i=M;
	if(A[M]>X){
		while(A[i]>=X){
			i--;
			j++;
		}
		right=j;
	}else{
		right=0;
	}
	
	if(left>=right){
		printf("%d",right);
	}else{
		printf("%d",left);
	}
	return 0;}

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

int main() {
	int n, kotae = 0, tdn = 0; string yj;
	cin >> n; cin >> yj;
	for(int i = 0; i < n; i++) {
		tdn = 0;
		string s; cin >> s;
		for(int j = 0; j < s.size(); j++) {
			for(int k = 1; k < s.size(); k++) {
				for(int l = 0; l < yj.size() && j + k * l < s.size(); l++) {
					if(s[j + k * l] != yj[l])
						break;
					if(l == yj.size() - 1) {
						kotae++;
						tdn = 1;
						break;
					}
				}
				if(tdn)
					break;
			}
			if(tdn)
				break;
		}
	}
	cout << kotae << endl;
	return 0;
}

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define PI 3.14159265358979
#define MOD 1000000007 // = 10^9 + 7

using namespace std;
using ll = long long;


void solve()
{
	int k, x;
	cin >> k >> x;

	cout << (k * 500 < x ? "No" : "Yes");
}

int main()
{
	fastio;
	solve();

	return 0;
}

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

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

	int d,a;

	vector<int> A(N);

	for (int i = 0; i < K; i++) {
		cin >> d;
		for (int j = 0; j < d; j++) {
			cin >> a;
			A.at(a - 1)++;
		}
	}
	int count = 0;
	for (auto x : A) {
		if (x == 0) count++;
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 3192
n=int(input())

A=[[[0 for k in range(11)] for j in range(4)] for i in range(5)]

for i in range(n):
	a,b,c,d = map(int,input().split())
	A[a][b][c] += d

for a in range(1,5):
	for b in range(1,4):
		for c in range(1,11):
			print(f" {A[a][b][c]}", end="")
		print()
	if a != 4: print("#"*20)


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

const int MOD = 1000000007;
const int INF = 1e9;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n, i##_len=(n); i>=0; i--)
#define FOR(i,a,b) for(int i=(a), i##_len=(b); i<i##_len; ++i)

//最大公約数 
 ll gcd(ll a,ll b){
 if(b == 0) return a;
 return gcd(b,a%b);
 }

//最小公倍数
 ll lcm(ll a,ll b){
 ll g = gcd(a,b);
 return a / g * b; // Be careful not to overflow  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
} 







int main(){
int N, K;
cin >> N >> K;
string S;
cin >> S;
int score = 0;
REP(i, N - 1){
  if(S.at(i) == S.at(i + 1)) score++;
}

int ans = min(score + K * 2, N - 1);
print(ans);

}

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

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vint;
typedef vector<double> vd;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<int> > vvint;
typedef vector<pair<int, int> > vpii;
typedef vector<pair<ll, ll> > vpll;
typedef priority_queue<int, vector<int>, greater<int> > spqint; //小さい順に取り出し
typedef priority_queue<ll, vector<ll>, greater<ll> > spqll;     //小さい順に取り出し
typedef priority_queue<int, vector<int>, less<int> > bpqint;    //大きい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll> > bpqll;        //大きい順に取り出し

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (int)a; i < (int)b; i++)
#define IREP(i, v) for (auto i = (v).begin(); i != (v).end(); i++)
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define PF push_front
#define TS to_string
#define BS binary_search
#define LB lower_bound
#define UB upper_bound
#define NP next_permutation
#define DI(v,i) distance((v).begin(),(auto(i)))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)

const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
const double PI = M_PI;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }     //最小公倍数

void yes()
{
    cout << "Yes" << endl;
}
void no()
{
    cout << "No" << endl;
}
//-----------------------------------------

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

    double a, b, h, m ;
    cin >> a >> b >> h >> m ;
    int k = 60*h + m ;
    double rad = abs(2*PI*(double)(k%60)/60 - 2*PI*(double)(k%720)/720) ;

    cout << SP(10) << sqrt(a*a+b*b-2*a*b*cos(rad)) <<endl ;
    

    

    return 0;
}



Measured memory_bytes: 4236
//小数点以下　cout << fixed << setprecision(10) << num << endl;
//桁数はlog10(mid)でやれ　log(mid)/log(10)はWA
//long*long<0で判定するな
//開区間と閉区間
//アルファベットが何番目かは x=s[i]-'a'
//bfsはmain()内で　rep(i,h)rep(j,w)rep(i,4)でバグ
//切り上げ：(a+(b-1))/b
//32bit以上は 1ull<<j
// map 初期値0 for(auto itr=mp.begin();itr!=mp.end();++itr) itr->fi itr->se で全探索
// for(auto u:mp) u.fi u.se も可能
//n個のgcd,lcmは一つずつみて更新していく
//大きな数を扱うときは素因数分解した形で持っておく
// (l/a[i]) = l*powmod(a[i],MOD-2)%MOD;
//auto itr=lower_bound(ALL(a),key) a[itr-a.begin()]
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <stdio.h>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional> //operator[]
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;

signed main(){
    int n,m; cin >> n >> m;
    int ans[n];
    rep(i,n) ans[i]=-1;
    rep(i,m){
        int s,c; cin >> s >> c;
        if(s==1&&c==0&&n!=1){
            cout << -1 << endl;
            return 0;
        }
        s--;
        if(ans[s]==c||ans[s]==-1){
            ans[s]=c;
        }else{
            cout << -1 << endl;
            return 0;
        }
    }
    rep(i,n){
        if(i==0&&n!=1){
            if(ans[i]==0||ans[i]==-1) cout << 1;
            else cout << ans[i];
        }else{
            if(ans[i]==-1) cout << 0;
            else cout << ans[i];
        }
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define MOD (int) (1e9+7)
#define INF (int) 2e9
#define LLINF (ll) 2e18

// 逆元のmod MOD
ll rev_mod(ll num){
	ll pow_num = MOD - 2;
	ll mod_num = MOD;
	ll pow_cur = num;
	ll ret = 1;
	while(pow_num > 0){
		if(pow_num % 2 == 1){
			ret *= pow_cur;
			ret %= mod_num;
		}
		pow_cur *= pow_cur;
		pow_cur %= mod_num;
		pow_num /= 2;
	}
	return ret;
}

int main(){
    int n, k;
    cin >> n >> k;
	int h[n];
	rep(i, n){
		cin >> h[i];
	}
	sort(h, h+n);

	ll sum = 0;
	rep(i, n-k){
		sum += h[i];
	}
    cout << sum << endl;
    // printf("%d\n", N);
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
// I - Coins

using namespace std;

double dp[3003][3003];

int main() {
    int N,i,j;
    double p,ans;

    scanf("%d",&N);

    dp[0][0] = 1;
    for (i = 1;i <= N;i++) {
        scanf("%lf",&p);
        dp[i][0] = dp[i - 1][0] * (1 - p);
        for (j = 1;j <= i;j++)
            dp[i][j] = dp[i - 1][j - 1] * p + dp[i - 1][j] * (1 - p);
    }

    ans = 0;
    for (i = (N >> 1) + 1;i <= N;i++)
        ans += dp[N][i];

    printf("%.10f\n",ans);

    return 0;
}


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

const double epsilon = 1e-9;
const long double pi = 3.1415926535;
double a, b, x;

bool spilled(double theta) {
	double h1 = a * sin(theta), h2 = b * sin(pi / 2 - theta);
	if (h1 > h2) {
		return (x > (a * b * b * tan(pi / 2 - theta) / 2));
	}
	else {
		return (x > ((a * a * b) - (a * a * a * tan(theta)) / 2));
	}
}

void bs() {
	long double l = 0, r = pi / 2, mid;
	while (abs(l - r) > epsilon) {
		mid = (l + r) / 2;
		if (spilled(mid))
			r = mid;
		else
			l = mid;
	}
	cout << setprecision(9) << l * 180 / pi << "\n";
}

int main() {
	cin >> a >> b >> x;
	bs();
	// spilled(45.0);
}


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

int main(){
  int n,i,j;
  cin >> n;
  vector<ll> a(n),p(31);
  for(i=0;i<n;i++){
    cin >> a.at(i);
  }
  
  sort(a.begin(),a.end());
  if(n%3!=0){
    if(a.at(n-1)!=0){
      cout << "No" << endl;
    }else{
      cout << "Yes" << endl;
    }
    return 0;
  }
  
  for(i=0;i<n-1;i++){
    if(i!=n/3-1&&i!=n*2/3-1&&a.at(i)!=a.at(i+1)){
      cout << "No" << endl;
      return 0;
    }
  }
  
  int x,y,z,Z;
  x=a.at(0);
  y=a.at(n/3);
  z=a.at(n*2/3);
  Z=0;
  
  p.at(0)=1;
  for(j=1;j<31;j++){
    p.at(j)=p.at(j-1)*2;
  }
  
  vector<int> bitx(31,0),bity(31,0);
  for(j=0;j<31;j++){
    bitx.at(j)=x%2;
    x /= 2;
    bity.at(j)=y%2;
    y /= 2;
    Z += p.at(j)*((bitx.at(j)+bity.at(j))%2);
  }
  
  if(Z==z){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3964
#include <bits/stdc++.h>
using namespace std;
//*******************
// Mahmoud Magdy    *
//*******************
#define ll long long
#define endl "\n"

void fast()
{
    ios_base :: sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
}
inline int D()
{
    int m ;
    cin>>m;
    return m ;
}
inline ll lD()
{
    ll m ;
    cin>>m;
    return m ;
}
inline double dD()
{
    double m ;
    cin>>m;
    return m ;
}
int main()
{
string s;
cin>>s;
for(int i=0;i<s.length();++i){
    if((i+1)%2)
        cout<<s[i];
}
}


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

typedef long long lint;
typedef long double louble;

#define so(a) ((int)((a).size()))

template<typename T1,typename T2> inline T1 max(T1 a,T2 b){return a<b?b:a;}
template<typename T1,typename T2> inline T1 min(T1 a,T2 b){return a<b?a:b;}
template<typename T1,typename T2> inline T1 gmax(T1 &a,T2 b){return a=a<b?b:a;}
template<typename T1,typename T2> inline T1 gmin(T1 &a,T2 b){return a=a<b?a:b;}

const char lf = '\n';

namespace ae86
{
	const int bufl = 1 << 15;

	char buf[bufl],*s=buf,*t=buf;

	inline int fetch()
	{
		if(s==t){t=(s=buf)+fread(buf,1,bufl,stdin);if(s==t)return EOF;}
		return *s++;
	}

	inline int ty()
	{
		int a=0;int b=1,c=fetch();
		while(!isdigit(c))b^=c=='-',c=fetch();
		while(isdigit(c))a=a*10+c-48,c=fetch();
		return b?a:-a;
	}

	inline int tc()
	{
		int c=fetch();
		while(c<=32 && c!=EOF)c=fetch();
		return c;
	}
}
using ae86::ty;
using ae86::tc;

const int _ = 100007;
const lint linf = 0x3f3f3f3f3f3f3f3f;

int n,dir[_]={0};lint val[_]={0};
lint f[3];

int main()
{
	ios::sync_with_stdio(0),cout.tie(nullptr);

	n=ty(),dir[1]=1,val[1]=ty();
	for(int i=2;i<=n;i++)dir[i]=tc()=='+',val[i]=ty();
	n+=2;
	
	memset(f,-64,sizeof(f));
	f[0]=0;
	for(int i=1;i<=n;i++)
	{
		lint xval=val[i]*(dir[i]?1:-1);
		f[0]+=xval,f[1]-=xval,f[2]+=xval;
		if(!dir[i])gmax(f[2],f[1]),gmax(f[1],f[0]);
		gmax(f[1],f[2]),gmax(f[0],f[1]);
	}

	cout<<max({f[0],f[1],f[2]})<<lf;
	
	return 0;
}


Measured memory_bytes: 1408
x=input().split()
y=list(map(int,x))
z=list(map(int,y))
a=y[0]
b=y[1]
c=y[2]
if a==1 and b==1 and c==0:
    print("Open")
elif a==0 and b==0 and c==1:
    print("Open")
else:
    print("Close")



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

using namespace std;

typedef vector<string> VS;
typedef vector<VS> VVS;

void remove_leading_zeros ( string& str )
{
	while ( str[0] == '0' ) { str = str.substr( 1 ); }
}

bool str_comp( const string& a, const string& b )
{
	if ( a.size() != b.size() ) {;
		return a.size() < b.size();
	}
	return a < b;
}

int main ( void )
{
	int w, h;
	while ( cin >> w >> h, w | h ) {
		VS mat( h );
		for ( int i = 0; i < h; ++i ) {
			cin >> mat[i];
		}

		VVS d( h, VS( w, "" ) );

		string ans = "";
		if ( isdigit( mat[0][0] ) ) {
			d[0][0] = string( 1, mat[0][0] );
		}
		for ( int y = 0; y < h; ++y ) {
			for ( int x = 0; x < w; ++x ) {
				if ( !isdigit( mat[y][x] ) ) {
					continue;
				}
				if ( y ) {
					d[y][x] = max( d[y][x], d[y - 1][x] + mat[y][x], str_comp );
					remove_leading_zeros( d[y][x] );
				}
				if ( x ) {
					d[y][x] = max( d[y][x], d[y][x - 1] + mat[y][x], str_comp );
					remove_leading_zeros( d[y][x] );
				}
				//cout << x << ", " << y << " = " << d[y][x] << endl;
				ans = max( ans, d[y][x], str_comp );
			}
		}

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

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

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
#define INF 1LL<<60

void dfs(int cur, int prev, vector< vector<int> >& edges, vector<int>& score, vector<bool>& visited) {
    score[cur] += score[prev];
    visited[cur] = true;
    for(int next: edges[cur]) {
        if(cur != next && !visited[next])
            dfs(next, cur, edges, score, visited);
    }
}

int main() {
    int N, Q;
    cin >> N >> Q;
    vector< vector<int> > edges(N+1, vector<int>());
    vector<int> score(N+1);
    vector<bool> visited(N+1);
    REP(i, N-1) {
        int a, b;
        cin >> a >> b;
        edges[a].push_back(b);
        edges[b].push_back(a);
    }

    vector<int> p(Q), x(Q);
    REP(i, Q) {
        cin >> p[i] >> x[i];
        score[p[i]] += x[i];
    }

    dfs(1, 0, edges, score, visited);
    FOR(i, 1, N) cout << score[i] << " ";
    cout << endl;

    return 0;
}

Measured memory_bytes: 31360