akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,m,ans=0;
	cin>>n>>m;
	vl a(n),b(n);
	rep(i,n)cin>>a[i]>>b[i];
	vvl vm(100002);
	rep(i,n){
		vm[a[i]-1].push_back(b[i]);
	}
	priority_queue<ll> q;
	rep(i,m){
		for(auto x:vm[i]){
			q.push(x);
		}
		if(q.empty())continue;
		ans+=q.top();q.pop();
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 7296
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <map>

using namespace std;

typedef  long long ll;

int cnt_bit(int n) {
  int cnt = 0;
  while(n) {
    cnt += n % 2;
    n /= 2;
  }
  return cnt;
}

int main(){
  int h, w, k;
  int s[10][1000];
  cin >> h >> w >> k;

  for (int i = 0; i < h; i++) {
    string ss;
    cin >> ss;
    for(int j = 0; j < w; j++) {
      s[i][j] = ss[j] - '0';
    }
  }

  int ans = h+w;
  for (int p = 0; p < (1<<(h-1)); p++) {
    int num[10][1000];
    bool invalid = false;
    for(int j = 0; j < w; j++) {
      int cnt = 0;
      int group = 0;
      for(int i = 0; i < h; i++) {
        cnt += s[i][j];
        if (cnt > k) {
          invalid = true;
          break;
        }
        if ((p & (1<<i)) != 0) {
          num[group++][j] = cnt;
          cnt = 0;
        }
      }
      if (cnt > k) {
        invalid = true;
      }
      if (invalid) {
        break;
      }
      num[group][j] = cnt;
    }
    if (invalid) {
      continue;
    }

    int G = cnt_bit(p) + 1;
    int sum[10] = {0};
    int cnt = 0;
    for (int j = 0; j < w; j++) {
      bool cut = false;
      for (int g = 0; g < G; g++) {
        if (sum[g] + num[g][j] > k) {
          cut = true;
          break;
        }
      }
      if (cut) {
        cnt++;
        for (int g = 0; g < G; g++) {
          sum[g] = 0;
        }
      }
      for (int g = 0; g < G; g++) {
        sum[g] += num[g][j];
      }
    }
    ans = min(ans, cnt + cnt_bit(p));
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  if((A+B) > (C+D)){
    cout << "Left";
  } else if((A+B) < (C+D)){
    cout << "Right";
  } else {
    cout << "Balanced";
  }
}

Measured memory_bytes: 256
k,t = map(int, input().split())
al = list(map(int, input().split()))

al.sort(reverse=True)

x,y = 0,0
for a in al:
    if x<y:
        x += a
    else:
        y += a

res = (max(x,y)-min(x,y)) - 1
print(max(res,0))

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<numeric>
#include<algorithm>
#include<complex>
#include<queue>
#include<stdlib.h>
#include<map>
#include<cmath>
#define ll long long

using namespace std;

int main(){
    int N;
    cin >> N;
    vector<string> S(N);
    for(int i=0;i<N;i++){
        cin >> S[i];
    }
    for(int i=0;i<N-1;i++){
        for(int j=i+1;j<N;j++){
            if(S[i]==S[j]){
                cout << "No" << endl;
                return 0;
            }
        }
    }
    for(int i=0;i<N-1;i++){
        if(S[i][S[i].size()-1]!=S[i+1][0]){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


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



int main() {
    int n;
    cin >> n;
    vector<int> l(n);

    for(int i=0; i<n; i++){
        cin >> l.at(i);
    }

    sort(l.begin(),l.end());
    int sum=0;
    for(int i=0; i<n-1; i++){
        sum += l.at(i);
    }
    if(l.at(n-1) < sum) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
# A = [ int(input()) for _ in range(N) ]
##############################

from fractions import gcd

A, B = map(int, input().split())

# 最大公約数
g = gcd(A, B)

if g == 1:
    print(1)
    exit()

def prime_factorize(n):
    a = set()
    while n % 2 == 0:
        a.add(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.add(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.add(n)
    return a

print(len(prime_factorize(g)) +1)

Measured memory_bytes: 5048
//#pragma GCC optimize ("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")

#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/rope>
#define pb push_back
#define F first
#define S second
#define ins insert
#define mp make_pair
#define fo(i, n1, n, x) for(int i = n1; i <= n; i += x)
#define foo(i, n, n1, x) for(int i = n; i >= n1; i -= x)
#define bit __builtin_popcount
#define md (l + ((r - l) / 2))
#define all(x) x.begin(),x.end()
#define eb emplace_back
#define ub upper_bound
#define lb lower_bound
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)

using namespace std;
//using namespace __gnu_pbds;
//using namespace __gnu_cxx;


using ll = long long;

//#define int ll

using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;



const int N = 2e5 + 11, mod = 1e9 + 7, mod2 = 998244353;
const int MAX = 1e5 + 11;
const int INF1 = 2e9 + 11;
const ll INF2 = 6e18 + 11;
const double INF3 = 1e8 + 11;
const int base = 500;
const int P = 31;
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};
const double EPS = 1e-4;
const double PI = acos(-1.0);


//template<typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
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; }


mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int a, b, c[N], k;
main() {
  file("threesum");
  ios;
  cin >> k >> a >> b;
  int x = (a + k - 1) / k * k;
  if (x <= b) cout << "OK";
  else cout << "NG";
  return 0;
}
/**

*/


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

using namespace std;


int main(){
	double x,y,s;
	int n,k;
	
	
	x=y=s=0;
	while((scanf("%d,%d",&n,&k)),n!=0){
		x=x+n*cos(M_PI*s/180);
		y=y+n*sin(M_PI*s/180);
		s=s+k;
	}
	printf("%d\n%d\n",int(y),int(x));
}

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

int main()
{
  string S;
  cin >> S;
  size_t N = S.size();
  
  // 一致度
  int count1 = 0;
  int count2 = 0;
  for(int i=0; i<N; i++){
    // 010101010101...
  	// 偶数番目（０番目，２番目，４番目・・・）：0
  	// 奇数番目（１番目，３番目，５番目・・・）：1
	if(i % 2 == 0 && S[i] % 2 == 0){count1 += 1;}
    else if(i % 2 == 1 && S[i] % 2 == 1){count1 += 1;}
    
    // 101010101010...
  	// 偶数番目（０番目，２番目，４番目・・・）：1
  	// 奇数番目（１番目，３番目，５番目・・・）：0
    if(i % 2 == 0 && S[i] % 2 == 1){count2 += 1;}
    else if(i % 2 == 1 && S[i] % 2 == 0){count2 += 1;}
  }
  
  // ひっくり返すと効率の良い方を求める
  int ans = N; // 初期値
  if(count1 > count2){ans = N - count1;}
  else if(count2 >= count1){ans = N - count2;}
  
  cout << ans;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define fi first
#define se second
#define forn(i,n) for(int i=0; i< (int)n; ++i)
#define for1(i,n) for(int i=1; i<= (int)n; ++i)
#define fore(i,l,r) for(int i=(int)l; i<= (int)r; ++i)
#define ford(i,n) for(int i=(int)(n) - 1; i>= 0; --i)
#define fored(i,r,l) for(int i=(int)r; i>= (int)l; --i)
#define pb push_back
#define el '\n'
#define d(x) cout<< #x<< " " << x<<el
#define INF (1LL<<62)

using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef pair<long long,long long> pll;
typedef tuple<long double,int,int> tdii;
const double PI = atan(1)*4;
const int MAXN = 1e5 + 10;
const double EPS = 1e-9;
int dp[MAXN];
vector<int> g[MAXN];
int n, m, u, v, ans;
bool seen[MAXN];

int dfs (int v){
    int &r = dp[v];
    if(r != -1){
        return r;
    }
    r = 0;
    for(int u: g[v]){
        if(dp[u]!= -1){
            r = max(r, dp[u]+1);
        }
        else {
            r = max(r, dfs(u)+1);
        }
    }
    return r;
}

int main (){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    cin>>n>>m;
    memset(dp, -1, sizeof dp);
    forn(i,m){
        cin>>u>>v;
        g[u-1].pb(v-1);
    }
    forn(i,n){
        if(dp[i]==-1){
            dfs(i);
        }
    }
    forn(i,n){
        ans = max(ans, dp[i]);
    }
    cout<<ans<<el;

}


Measured memory_bytes: 7552
package main

import "fmt"

func main() {
	var N, M, X, A int

	fmt.Scan(&N)
	fmt.Scan(&M)
	fmt.Scan(&X)

	leftCost := 0
	rightCost := 0
	for i := 0; i < M; i++ {
		fmt.Scan(&A)
		if A <= X {
			leftCost++
		} else {
			rightCost++
		}
	}
	
	res := leftCost
	if res > rightCost {
		res = rightCost
	}

	fmt.Println(res)
}


Measured memory_bytes: 512
/* ****TCIITB**** */

#include<bits/stdc++.h>
#define io          ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); 
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
using namespace std;

#define N  100005

int main()
{
	
	io
	
	ll m,n;
	cin>>n>>m;
	ll arr[n][m],arr1[n][m];
	rep(i,0,n)
	{
		rep(j,0,m)
		{
			char x;
			cin>>x;
			if(x=='.')
				{
					arr[i][j]=0;
					arr1[i][j]=1;
				}
			else
				{
					arr[i][j]=1;
					arr1[i][j]=0;			
				}
		}
	}
	ll dp[n][m],dp1[n][m];
	dp[0][0]=arr[0][0];
	dp1[0][0]=arr1[0][0];
	rep(i,1,n)
	{
		if(arr[i][0]==1 && arr[i-1][0]==1)
		{
			dp[i][0]=dp[i-1][0];	
		}
		else
		{
			dp[i][0]=dp[i-1][0]+arr[i][0];
		}
		
		dp1[i][0]=dp1[i-1][0]+arr1[i][0];
	}
	rep(i,1,m)
	{
		if(arr[0][i] && arr[0][i-1])
			dp[0][i]=dp[0][i-1];
		else
			dp[0][i]=dp[0][i-1]+arr[0][i];
		dp1[0][i]=dp1[0][i-1]+arr1[0][i];
	}
	rep(i,1,n)
	{
		rep(j,1,m)
		{
			ll zz=1e18;
			
			
				if(arr[i][j]&&arr[i-1][j])
				{
					zz=min(zz,dp[i-1][j]);
				}
				else
				{
					zz=min(zz,dp[i-1][j]+arr[i][j]);
				}
				if(arr[i][j]&&arr[i][j-1])
				{
					zz=min(zz,dp[i][j-1]);
				}
				else
				{
					zz=min(zz,dp[i][j-1]+arr[i][j]);
				}
			dp[i][j]=zz;			
		}
	}
	cout<<dp[n-1][m-1];
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
int main()
{
  int n;
  cin>>n;

  vector<int>v;
  for(int i=1;i<=n;i++)
    v.pb(i);

  vector<int>p,q;

  for(int i=0;i<n;i++)
  {
      int r;
      cin>>r;
      p.pb(r);
  }
  for(int i=0;i<n;i++)
  {
      int r;
      cin>>r;
      q.pb(r);
  }
  if(p==q)
    cout<<"0\n";
  else
  {  int c=0;
     int a,b,d=2;
     do
     {  c++;
        if(p==v)
        {
            a=c;
            d--;
        }
        if(q==v)
        {
            b=c;
            d--;
        }
        if(d==0)
            break;

     }while(next_permutation(v.begin(),v.end()));
     cout<<abs(a-b)<<"\n";
  }

return 0;
}


Measured memory_bytes: 3624
package main

import (
	"bufio"
	"fmt"
	"index/suffixarray"
	"os"
)

func main() {
	r := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()

	var s string
	var q int

	fmt.Fscan(r, &s)
	fmt.Fscan(r, &q)

	index := suffixarray.New([]byte(s))

	for i := 0; i < q; i++ {
		var p string
		fmt.Fscan(r, &p)

		res := index.Lookup([]byte(p), 1)
		if len(res) > 0 {
			fmt.Fprintln(w, 1)
		} else {
			fmt.Fprintln(w, 0)
		}
	}
}



Measured memory_bytes: 40420
#line 2 "header.hpp"

//%snippet.set('header')%
//%snippet.fold()%
#ifndef HEADER_H
#define HEADER_H

// template version 2.0
using namespace std;
#include <bits/stdc++.h>

// varibable settings
const long long INF = 1e18;
template <class T> constexpr T inf = numeric_limits<T>::max() / 2.1;

#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define _rrep(i, n) rrepi(i, 0, n)
#define rrepi(i, a, b) for (ll i = (ll)((b)-1); i >= (ll)(a); --i)
#define r_rep(...) _overload3(__VA_ARGS__, rrepi, _rrep, )(__VA_ARGS__)
#define each(i, a) for (auto &&i : a)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(...) make_tuple(__VA_ARGS__)
#define ub upper_bound
#define lb lower_bound
#define lpos(A, x) (lower_bound(all(A), x) - A.begin())
#define upos(A, x) (upper_bound(all(A), x) - A.begin())
template <class T, class U> inline void chmax(T &a, const U &b) { if ((a) < (b)) (a) = (b); }
template <class T, class U> inline void chmin(T &a, const U &b) { if ((a) > (b)) (a) = (b); }
template <typename X, typename T> auto make_table(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto make_table(X x, Y y, Z z, Zs... zs) { auto cont = make_table(y, z, zs...); return vector<decltype(cont)>(x, cont); }

#define cdiv(a, b) (((a) + (b)-1) / (b))
#define is_in(x, a, b) ((a) <= (x) && (x) < (b))
#define uni(x) sort(all(x)); x.erase(unique(all(x)), x.end())
#define slice(l, r) substr(l, r - l)

typedef long long ll;
typedef long double ld;
using vl = vector<ll>;
using vvl = vector<vl>;
using pll = pair<ll, ll>;

template <typename T>
using PQ = priority_queue<T, vector<T>, greater<T>>;
void check_input() { assert(cin.eof() == 0); int tmp; cin >> tmp; assert(cin.eof() == 1); }

#if defined(PCM) || defined(LOCAL)
#else
#define dump(...) ;
#define dump_1d(...) ;
#define dump_2d(...) ;
#define cerrendl ;
#endif

#endif /* HEADER_H */
//%snippet.end()%
#line 2 "solve.cpp"
template<class T=ll> using vec = vector<T>;
struct Fast { Fast() { std::cin.tie(0); ios::sync_with_stdio(false); } } fast;


int solve() {
    ll a,b,c,d;cin>>a>>b>>c>>d;
    ll res = -INF;
    chmax(res, a * c);
    chmax(res, a * d);
    chmax(res, b * d);
    chmax(res, b * c);
    cout << res << endl;

    return 0; 
}


int main(){/*{{{*/
    solve();
    check_input();
    return 0;
}/*}}}*/


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

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

  double ans = 0;
  for (int i = 0; i < N; i++) {
    double x;
    string u;
    cin >> x >> u;
    if (u == "BTC") x *= 380000.0;
    ans += x;
  }

  printf("%lf\n", ans);
}

Measured memory_bytes: 256
#!/usr/bin/python3

import sys
# input = sys.stdin.readline
sys.setrecursionlimit(100000)
MOD = 10 ** 9 + 7

N, K, Q = [int(x) for x in input().split()]

T = [K-Q] * N
for _ in range(Q):
    a = int(input())
    a -= 1
    T[a] += 1

for t in T:
    if t > 0:
        print('Yes')
    else:
        print('No')


Measured memory_bytes: 6552
#include<queue>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string.h>
#define maxn 1000
#define INF (1<<30)
#define mem(a, b) memset(a, b, sizeof(a))
const int N = 362881;
typedef long long ll;
using namespace std;
int ch, cv;
int fac[10];
struct node {
    int x, w;
    node(int _x, int _w) {
        x = _x, w = _w;
    }
    bool operator < (const node & T) const {
        return w > T.w;
    }
};

void Atoint(int* a, int &x) {
    int i, j, y;
    x = 0;
    for (i = 0; i < 9; i++) {
        y = a[i];
        for (j = 0; j < i; j++)
            if (a[j] < a[i]) y--;
        x += fac[8 - i] * y;
    }
}

void inttoA(int x, int* a) {
    int has[10] = {0};
    int i, j, y;
    for (i = 0; i < 9; i++) {
        y = x / fac[8 - i];
        for (j = 0; j < 9; j++) if (!has[j]) {
            if (y == 0) break;
            y--;
        }
        a[i] = j, has[j] = 1, x %= fac[8 - i];
    }
}

int st, ed;
priority_queue<node> q;
int d[N], vis[N], a[10], b[10];

void update(int x, int w) {
    if (!vis[x] && d[x] > w) {
        d[x] = w, q.push(node(x, w));
    }
}
void work() {
    Atoint(a, st), Atoint(b, ed);
    while(!q.empty()) q.pop();
    memset(d, 0x7F, sizeof(d));
    memset(vis, 0, sizeof(vis));
    d[st] = 0;
    q.push(node(st, 0));
    int x, w, i, y;
    while(!q.empty()) {
        x = q.top().x, w = q.top().w, q.pop();
        if (vis[x]) continue;
        vis[x] = 1;
        if (x == ed) {
            printf("%d\n", w);
            break;
        }
        inttoA(x, a);
        for (i = 0; i < 9; i++) if (!a[i]) break;
        swap(a[i], a[(i + 1) % 9]);
        Atoint(a, y);
        update(y, w + ch);
        swap(a[i], a[(i + 1) % 9]);
        swap(a[i], a[(i + 8) % 9]);
        Atoint(a, y);
        update(y, w + ch);
        swap(a[i], a[(i + 8) % 9]);
        swap(a[i], a[(i + 3) % 9]);
        Atoint(a, y);
        update(y, w + cv);
        swap(a[i], a[(i + 3) % 9]);
        swap(a[i], a[(i + 6) % 9]);
        Atoint(a, y);
        update(y, w + cv);
    }
}
int main () {
    fac[0] = 1;
    for (int i = 1; i < 10; i++) fac[i] = fac[i - 1] * i;
    while(scanf("%d%d", &ch, &cv), ch || cv) {
        for (int i = 0; i < 9; i++) scanf("%d", a + i);
        for (int i = 0; i < 9; i++) scanf("%d", b + i);
        work();
    }
    return 0;
}

Measured memory_bytes: 5968
#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() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  int n; cin >> n;
  int m = 0, sum = 0;
  rep(i, n) {
    int x; cin >> x;
    m = max(m, x);
    sum += x;
  } cout << sum - (m/2) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define f(i,a,n) for(int i=a;i<n;i++)
#define ve vector
#define ss second 
#define ff first
#define pf pop_front
#define pob pop_back
#define psf push_front
#define res(x) cout<<x<<'\n'
#define read(t) ll t;cin>>t

int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	cout.tie(NULL);
    int a;
    string s1,s2;
    cin>>a;
    cin>>s1>>s2;
    string s3="";
    for(int i=0;i<a;i++){
        s3=s3+s1.at(i);
        s3=s3+s2.at(i);
    }

    cout<<s3<<endl;
    
    


   

}

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << setprecision(20) << fixed;
  string s;
  cin >> s;
  int mid = s.size()/2;
  int i = 1;
  int zure = mid;
  while(mid - i >= 0 || mid + i < s.size()){  
    if(mid - i >= 0){  
      if(s[mid] != s[mid-i]){  
        zure = mid-i; 
        break;
      }
    }
    if(mid + i < s.size()){  
      if(s[mid] != s[mid+i]){  
        zure = mid+i; 
        break;
      }
    }
    i++;
  }
  //cout << i <<endl;
  //cout << zure <<endl;
  if(zure == mid) cout << s.size() <<endl;
  else cout << max((int)s.size()-zure-1, zure) <<endl;
}


Measured memory_bytes: 3736
#include <iostream>
using namespace std;
int main(){
int n,m;
cin>>n>>m;
int a[n][m];
int b[m];
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
 cin>>a[i][j];
}
}
for(int i=0;i<m;i++){
 cin>>b[i];
}
for(int i=0;i<n;i++){
 a[i][0]*=b[0];
}
for(int i=1;i<m;i++){
 for(int j=0;j<n;j++){
   a[j][i]=(a[j][i]*b[i])+a[j][i-1];
   }
 }
 for(int i=0;i<n;i++){
cout<<a[i][m-1]<<endl;
}
return 0;
}

 
 

Measured memory_bytes: 1200
#include <bits/stdc++.h>
#define repr(i,from,to) for(int (i)=(from);(i)<(to);(i)++)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
#define vprint(x) for(auto a:(x)) cout << x << endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) { a = b; return true;}
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) { a = b; return true;}
    return false;
}
int main(void) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin>>n;
    vector<int> a(n-1),b(n-1);
    vector<vector<int>> nbs(n, vector<int>());
    map<pair<int,int>, int> edge_idx;
    rep(i,n-1)cin>>a[i]>>b[i];
    rep(i,n-1) {
        a[i]--;b[i]--;
        nbs[a[i]].push_back(b[i]);
        nbs[b[i]].push_back(a[i]);
        edge_idx[pair<int,int>(a[i], b[i])] = i;
    }
    DEBUG {
        printf("test");
    }
    function<pair<int,int>(int, int)> key = [&] (int a, int b) {
        return pair<int, int> (min(a,b), max(a,b));
    };
    vector<int> color(n-1,0);
    queue<pair<int, int>> que;
    rep(i,n) {
        if (nbs[i].size() == 1) {
            que.emplace(nbs[i][0], i);
            color[edge_idx[key(i, nbs[i][0])]] = 1;
            break;
        }
    }
    DEBUG {
        printf("test");
    }
    while(!que.empty()) {
        int par = que.front().second;
        int now = que.front().first;
        int col_p = color[edge_idx[key(par, now)]];
        que.pop();
        int col_now = 1;
        for (auto x: nbs[now]) {
            if (col_now == col_p) col_now++;
            if (x != par) {
                color[edge_idx[key(x, now)]] = col_now;
                que.emplace(x, now);
                col_now++;
            }
        }
    }
    int res = 0;
    rep(i,n-1) {
        chmax(res, color[i]);
    }
    cout << res << endl;
    rep(i,n-1) {
        cout << color[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 13568
#include <bits/stdc++.h>
using namespace std;
using Int = long long int;
template<typename T> void swap(T *t1, T *t2){ T* tmp=t1; t1=t2; t2=tmp;}
Int tmpi = 0;
double tmpd = 0.0;


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

    vector<Int> v;
    vector<Int> v2;
    for(Int i=0; i<5; i++){
        cin >> tmpi;
        v.push_back(tmpi);
    }

    Int min = 1000;
    Int minind = 1000;
    for(Int i=0; i<v.size(); i++){
        tmpi = v[i]/10;
        Int tmpi2 = v[i] - tmpi*10;
        if(tmpi2 == 0){
            v2.push_back(v[i]);
            continue;
        }
        if(tmpi2 < min){
            min = tmpi2;
            minind = i;
        }
        v2.push_back(tmpi*10+10);
    }

    v2[minind] = v[minind];

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

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
    char buf, ch='a', str[1200]={'\0'};
    int i, num;

    i=0;
    while ((buf=getchar()) != EOF) {
        str[i] = buf;
        i++;
    }
    for (i=0; i<sizeof(str); i++) {
        if (str[i]>=65 && str[i]<=90) str[i]+=32;
    }
    while(ch!=123) {
        num=0;
        for (i=0;i<sizeof(str);i++) {
            if(str[i]==ch) num++;
        }
        printf("%c : %d\n", ch, num);
        ch++;
    }
    return 0;
}



Measured memory_bytes: 2044
#include <stdio.h>
#define MAX 100000
int main(void){
    int n,i,A[MAX + 1];
    scanf("%d",&n);
    for(i=1;i<=n;i++) scanf("%d",&A[i]);
    
    for(i=1;i<=n;i++){
        printf("node %d: key = %d, ",i,A[i]);
        if((i/2) >= 1) printf("parent key = %d, ",A[i/2]);
        if((2*i) <= n) printf("left key = %d, ",A[2*i]);
        if((2*i+1) <= n) printf("right key = %d, ",A[2*i+1]);
        printf("\n");
    }
    return 0;
}



Measured memory_bytes: 2048
n,a,b=map(int,input().split())

count=0
for i in range(1,n+1):
  j=i
  t=0
  while(i//10>=0and i>0):
    t+=i%10
    i=i//10
  if(t>=a and t<=b):
    count+=j
    
print(count)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define ll long long int 
#define ld double
#define mp make_pair
#define pb push_back
#define mod 1000000007
#define ff first
#define ss second
#define pll pair <ll,ll>
#define nl "\n"
 
int main()
{
	ios_base::sync_with_stdio(false);
	ll n,m,k,i,maxrow=0,maxcol=0;
	cin>>n>>m>>k;
	vector <pll> v;
	ll row[n+2]={0}, col[m+2]={0};
	set <pll> s;
	for(i=0;i<k;i++)
	{
		ll x,y;
		cin>>x>>y;
		row[--x]++;
		col[--y]++;
		s.insert({x,y});
	} 
	set <ll> idrow, idcol;
	for(i=0;i<n;i++)
	{
		maxrow = max(maxrow, row[i]);
	}
	for(i=0;i<m;i++)
	{
		maxcol = max(maxcol, col[i]);
	}
	for(i=0;i<n;i++)
	{
		if(row[i]==maxrow)
			idrow.insert(i);
	}
	for(i=0;i<m;i++)
	{
		if(col[i]==maxcol)
			idcol.insert(i);
	}
	// ll count = 0;
	// for(i=0;i<k;i++)
	// {
	// 	if(idrow.find(v[i].ff)!=idrow.end() && idcol.find(v[i].ss)!=idcol.end())
	// 	{
	// 		count++;
	// 	}
	// }
	ll f=0;
	for(auto it:idrow)
	{
		for(auto it2:idcol)
		{
			if(s.find({it,it2})==s.end())
			{
				f=1;
				break;
			}
		}
		if(f==1)
			break;
	}
	if(f==0)
		cout<<maxrow+maxcol-1<<nl;
	else
		cout<<maxrow+maxcol<<nl;
	return 0;
}

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

int main(){
  long long int n;
  cin >> n;
  vector<tuple<long long int, long long int>> vec;
  rep(i,n,0){
    long long int a, b;
    cin >> a >> b;
    vec.push_back(tie(b,a));
  }
  sort(vec.begin(), vec.end());
  
  long long int sum = 0;
  rep(i, n, 0){
    long long int p, q;
    tie(p, q) = vec[i];
    sum += q;
    if(sum > p){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 6512
//https://atcoder.jp/contests/agc031/tasks/agc031_a
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
const int mod = 1e9 + 7;
int alphabet[30];
long long ans = 1;

int main(int argc, char const *argv[]) {
  int N;
  string S;
  cin >> N >> S;
  for (int i=0; i<S.size(); i++){
    alphabet[S[i] - 'a' + 1]++;
  }
  for (int i=0; i<30; i++){
    ans = ans * (alphabet[i]+1);
    ans = ans%mod;
  }
  cout<<ans-1<<endl;
  return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define f first 
#define sf second.first 
#define ss second.second 
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P > iP;

int main(){
  int t,p,r,b;
  while(cin>>b>>t>>p>>r&&t){
    iP a[51];
    int k[11][51]={};
    a[0]=iP(-1,P(-1,-1));
    for(int i=1;i<=t;i++)a[i]=iP(0,P(0,i));
    for(int i=0;i<r;i++){
      int ti,pi,m,s;
      cin>>m>>ti>>pi>>s;
      if(!s)a[ti].f++,a[ti].sf-=m+k[pi][ti]*20;
      else k[pi][ti]++;
    }
    sort(a+1,a+t+1);
    for(int i=t;i>0;i--){
      cout<<a[i].ss;
      if(i!=1)
	if(a[i-1].f==a[i].f&&a[i-1].sf==a[i].sf)cout<<"=";
	else cout<<",";
    }
    cout<<endl;
  }
  return 0;
}

Measured memory_bytes: 1168
n, m = map(int, input().split())
peak = list(map(int, input().split()))
lst = [list(map(int, input().split())) for i in range(m)]

hlst = [[] for i in range(n)]
for i in range(m):
  hlst[lst[i][1]-1].append(peak[lst[i][0]-1])
  hlst[lst[i][0]-1].append(peak[lst[i][1]-1])

ans = 0

for i in range(n):
  judge = True
  for j in range(len(hlst[i])):
    if hlst[i][j] >= peak[i]:
      judge = False
      break
  if judge:
    ans += 1
                 
print(ans)

Measured memory_bytes: 41404
import java.util.*;
import java.awt.Point;
public class Main{
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int dx[] = {0, 1, 0, -1};
        int dy[] = {1, 0, -1, 0};

        int h = sc.nextInt();
        int w = sc.nextInt();
        char map[][] = new char[h][w];
        int a[][] = new int[h][w];
        int INF = Integer.MAX_VALUE;
        for(int[] n: a){
            Arrays.fill(n,INF);
        }
        Queue<Point> queue = new ArrayDeque<>();
        for(int i=0; i<h; i++){
            map[i] = sc.next().toCharArray();
            for(int j=0; j<w; j++){
                if(map[i][j]=='#'){
                    queue.add(new Point(i,j));
                    a[i][j] = 0;
                }
            } 
        }
        int memo = 0;
        while(!queue.isEmpty()){
            Point p = queue.poll();
            for(int k=0; k<4; k++){
                int X = p.x + dx[k];
                int Y = p.y + dy[k];
                if(X>=0 && X<h && Y>=0 && Y<w && a[X][Y]==INF){
                    a[X][Y] = a[p.x][p.y] + 1;
                    queue.add(new Point(X,Y));
                    memo = a[X][Y];
                }
            }
        }
        System.out.println(memo);
    }
}

Measured memory_bytes: 66900
#include<bits/stdc++.h>
using namespace std;
using ull=unsigned long long;
#define mod 1000000007
#define mod2 998244353 
#define PI 3.14159265
#define ll long long
#define ld long double
#define pi pair<ll,ll>
#define pb push_back
#define vi vector<ll>
#define sz size()
#define setbits(x)  __builtin_popcount(x)
#define fi first
#define se second
#define lz length()
#define all(x) (x).begin(),(x).end()
#define scf(x) scanf("%lld",&x)
#define rep(i,n) for(ll i=0;i<n;i++)
const int INF = (int)1e9;
const ll IINF=1LL<<62;
const int maxn=10000005;

//int divr[maxn];
/**/
/*void divisor()
{for(int i=2;i<sqrt(maxn);i++)
     {
          if(!divr[i])
          {
               for(int j=i*i;j<maxn;j+=i)if(!divr[j])divr[j]=i;     
          }
     }
     for(int i=1;i<maxn;i++)if(!divr[i])divr[i]=i;
}*/
 
/*const int N=1000005;
ll n;
struct line {
    long long m, c;
    long long eval(long long x) { return m * x + c; }
    long double intersectX(line l) { return (long double) (c - l.c) / (l.m - m); }
};
vector<pair<pi,ll>> rect;
deque<line> dq;
*/
/*int find(int a){
     if(a==par[a])return a;
     return par[a]=find(par[a]);
}
void unite(int a,int b){
     a=find(a),b=find(b);
     if(a==b)return ;
     par[b]=a;
}
ll modexpo(ll a,ll b)
{
     int ans=1LL;
     while(b>0)
     {
          if(b&1)ans=(ans*a)%mod;
          a=(a*a)%mod;
          b>>=1;
     }
     return ans;
}
*/















int main(){
     int n,m;
     cin>>n>>m;
     string s;
     cin>>s;
     vector<int> vec;
     int ct=0;
     for(int i=0;i<s.length();i++){
          if(s[i]=='1'){ct++;
          if(ct>=m){
               cout<<-1;return 0;
          }}
          else{
               ct=0;
          }
     }
     int idx=s.length()-1;
     while(idx>0){
          for(int i=max(0,idx-m);i<idx;i++){
               if(s[i]=='1')continue;
               vec.pb(idx-i);
               idx=i;break;
          }
     }
     reverse(vec.begin(),vec.end());
     for(auto it:vec)cout<<it<<" ";
}



















































Measured memory_bytes: 4004
#include <iostream>
using namespace std;
int main()
{
  int A, B;
  cin >> A >> B;
  string ans = "Impossible";
  if (A % 3 == 0 || B % 3 == 0 || (A + B) % 3 == 0)
    ans = "Possible";
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int p[100005];
bool visited[100005];
int u_find(int a){
	if(!p[a]) return a;
	return p[a] = u_find(p[a]);
}
void merge(int a,int b){
	a = u_find(a);
	b = u_find(b);
	if(a==b) return;
	p[a] = b;
}
int main(){
	int n,m;
	cin>>n>>m;
	while(m--){
		int a,b,z;
		cin>>a>>b>>z;
		merge(a,b);
	}
	int ret = 0;
	for(int i=1; i<=n; i++){
		int r = u_find(i);
		if(visited[r]) continue;
		visited[r] = true;
		ret++;
	}
	cout<<ret;
}

Measured memory_bytes: 4908
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()


int main()
{
    ll N;  cin>>N;
    VL L(N);
    rep(i,0,N)cin>>L[i];
    
    sort(ALL(L));
    ll sum=0;
    rep(i,0,L.size()-1)sum+=L[i];
    
    if(L[L.size()-1]>=sum)cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

void operation(int member[4][3][10],int b, int f,int r,int v){
	member[b - 1][f - 1][r - 1] = member[b - 1][f - 1][r - 1] + v;
}

int main(void){
	int n,b[300],f[300],r[300],v[300];
	int member[4][3][10] = { 0 };
	scanf("%d", &n);
	int i;
	for (i = 0; i < n; i++){
		scanf("%d %d %d %d", &b[i], &f[i], &r[i], &v[i]);
	}

	for (i = 0; i < n; i++){
		operation(member,b[i],f[i],r[i],v[i]);
	}

	int i_count, i_point;
	for (i = 0; i < 4; i++){
		for (i_count = 0; i_count < 3; i_count++){
			for (i_point = 0; i_point < 10; i_point++){
				printf(" %d", member[i][i_count][i_point]);
			}
			putchar('\n');
		}
		if (i<3)
		printf("####################\n");
	}


	return 0;
}


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

int N;
vector<int> a;
int counter[100010];

int main() {
    cin >> N;
    a.resize(N); 
    for (int i = 0; i < N; i++) scanf("%d", &a[i]);
    for (int i = 0; i < N; i++) counter[a[i]]++;
    int maxi = 0;
    for (int i = 0; i < 100000; i++) {
        int sum = counter[i] + counter[i+1] + counter[i+2];
        maxi = max(maxi,sum);
    }
    cout << maxi << endl;
    return 0;
}

Measured memory_bytes: 1024
import sys
import numpy as np
input = sys.stdin.readline

N = int(input())
A = []
B = []
for _ in range(N):
    a,b = list(map(int,input().split()))
    A.append(a)
    B.append(b)
cnt = 0
for i in range(N-1,-1,-1):
    if (A[i]+cnt)%B[i] == 0:
        continue
    else:
        cnt += B[i] - (A[i]+cnt)%B[i]
print(cnt)


Measured memory_bytes: 34696
bool DBG = true;
#include<bits/stdc++.h>
//#include <boost/multiprecision/cpp_dec_float.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using ll = long long;
using ld = long double;
//using i128 = __int128_t;
//using bint = boost::multiprecision::cpp_int
//using d1024 = boost::multiprecision::number<mp::cpp_dec_float<1024>>;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define IFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define RPT(i,a,b) for(int i=(a);i<((a)+(b));++i)
#define IRPT(i,a,b) for(int i=((a)+(b)-1);i>=(a);--i)
#define ALL(x) x.begin(),x.end()
#define fs first
#define sd second
#define couts(x) cout << (x) << (" ")
#define coutn(x) cout << (x) << ("\n")
#define endl "\n"
#define pb(x) push_back(x)
#define eb(x) emplace_back(x)
#define dcouts(x) if(DBG) couts(x)
#define dcoutn(x) if(DBG) coutn(x);
template<typename T> std::istream &operator>>(std::istream &is, std::vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T1, typename T2> std::istream &operator>>(std::istream &is, std::pair<T1,T2> &p){is >> p.first >> p.second; return is; }
template<typename T> std::ostream &operator<<(std::ostream &os, const std::vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> std::ostream &operator<<(std::ostream &os, const std::deque<T> &vec){ os << "deque["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> std::ostream &operator<<(std::ostream &os, const std::set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> std::ostream &operator<<(std::ostream &os, const std::unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> std::ostream &operator<<(std::ostream &os, const std::multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> std::ostream &operator<<(std::ostream &os, const std::unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> std::ostream &operator<<(std::ostream &os, const std::pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> std::ostream &operator<<(std::ostream &os, const std::map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> std::ostream &operator<<(std::ostream &os, const std::unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }

template<class T> using V = vector<T>;
template<class T> using V2 = V<V<T>>;
template<class T> using V3 = V<V2<T>>;

constexpr int INF = 1<<29;


void solve(){
  int n; cin >> n;
  V<int> a(n), b(n+2, -INF), c(n+2, -INF);
  cin >> a;
  FOR(i,0,n) b[i+1] = max(b[i], a[i]);
  IFOR(i,0,n) c[i] = max(a[i], c[i+1]);
  FOR(i,0,n) coutn( max(b[i],c[i+1]) );
}

int main(void){
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
  return 0;
}

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

#define NUM 100000
#define INF 1000000010
int L[NUM + 1];
int length = 0;

void init(){
    for(int i = 0; i <= NUM; i++){
        L[i] = INF;
    }
}

int main(void){
    init();

    int n;
    scanf("%d", &n);

    for(int i = 0; i < n; i++){
        int a;
        scanf("%d", &a);

        auto iter = lower_bound(L + 1, L + 1 + length, a);
        if(*iter == INF){
            length++;
        }
        *iter = a; 
    }
    
    printf("%d\n", length);
}



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

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))

#define INF 2e9
#define INF_LL 1LL<<60
#define ll long long
#define MOD 1e9+7
#define MAX_V 305

typedef pair<int, int> P;

int main() {
    ll h, n, gokei = 0;
    cin >> h>> n;
    REP(i, n) {
        ll waza;
        cin >> waza;
        gokei += waza;
    }

    if(h<=gokei) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int n,k,i=1;
    double s;
	scanf("%d%d",&n,&k);
	s=k;
    while(n/k!=0)
	{
		i++;
		n/=k;
	}
	printf("%d",i);
		
	
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
using namespace std;

#define ll long long
 
ll f(ll n) 
{
  return n * (n - 1) / 2;
}
 
int main() 
{
  ll N;
  cin >> N;
  vector<ll> a(N);
  map<ll, ll> mp;
  for (ll i = 0; i < N; i++) 
  {
    cin >> a[i];
    mp[a.at(i)]++;
  }
  ll ans = 0;
  for (auto const& b : mp) ans += f(b.second);
  for (auto a : a) cout << ans - f(mp[a]) + f(mp[a] - 1) << "\n";
}

Measured memory_bytes: 12676
// clang-format off
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using G = vector<vector<ll>>;
#define G(i, j) i, vector<ll>(j)
#define Gv(i, j, k) i, vector<ll>(j, k)
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(ll i=1, i##_len=(n); i<=i##_len; ++i)
#define rrep(i,n) for(ll i=n-1; i>=0; --i)
#define rrep1(i,n) for(ll i=n; i>0; --i)
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort(all(x))
#define SORT_DESC(x) sort((x).rbegin(),(x).rend())
#define pb push_back
#define mp make_pair
#define coutl cout<<fixed<<setprecision(10)
#define ANS(ans) cout<<ans<<endl
#define END(ans) ANS(ans); return
const ll LINF = (1LL << 62) - 1;
const int INF = (1 << 30) - 1;
template<class T>inline bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if (b<a){a=b;return 1;}return 0;}
// clang-format on

void solve(long long N, long long K, std::vector<long long> A) {
  rep(k, min(K, 41LL)) {
    vector<ll> B(N);
    rep(i, N) {
      ll l = max(0LL, i - A[i]), r = min(N - 1, i + A[i]);
      B[l]++;
      if (r + 1 < N)
        B[r + 1]--;
    }
    rep(i, N - 1) {
      B[i + 1] += B[i];
    }
    A = B;
  }

  rep(i, N) {
    cout << A[i];
    if (i != N - 1)
      cout << " ";
  }
  cout << endl;
}

// clang-format off
int main() {
  long long N;
  scanf("%lld",&N);
  long long K;
  scanf("%lld",&K);
  std::vector<long long> A(N);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&A[i]);
  }
  solve(N, K, std::move(A));
  return 0;
}


Measured memory_bytes: 6420
# 少ないやつを変えたほうが少なくてすむので嬉しい
n, k = map(int, input().split())
arr = list(map(int, input().split()))
hash = dict()
for ai in arr:
    if ai in hash:
        hash[ai] += 1
    else:
        hash[ai] = 1
hash = list(sorted(hash.items(), key=lambda x: x[1]))
ans = 0
for i in range(len(hash) - k):
    ans += hash[i][1]
print(ans)


Measured memory_bytes: 99912
package main

import (
	"fmt"
)

func main() {
	var N, K int
	fmt.Scan(&N, &K)
	p := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scan(&p[i])
	}
	// fmt.Println("N", N, "K", K, "p", p)
	e := make([]float64, N)
	for i := 0; i < N; i++ {
		e[i] = float64((1+p[i])*p[i]/2) / float64(p[i])
	}
	sum, ans := 0.0, 0.0
	for i := 0; i < N; i++ {
		sum += e[i]
		if i >= K {
			sum -= e[i-K]
		}
		ans = max(ans, sum)
	}
	fmt.Println(ans)
}
func max(a, b float64) float64 {
	if a > b {
		return a
	}
	return b
}


Measured memory_bytes: 6656
open Str

let read_list f =
  split (regexp " +") (read_line ()) |> List.map f

let print_array a = Array.to_list a |> List.map string_of_int |> String.concat " " |> print_endline

let bubble_sort a n =
  let rec oloop i c fin =
    if fin then c
    else let rec iloop j c' fin' =
           if j = i then (c', fin')
           else if a.(j) < a.(j-1) then begin
               let v = a.(j) in
               a.(j) <- a.(j-1);
               a.(j-1) <- v;
               iloop (j-1) (c'+1) false
             end
           else iloop (j-1) c' fin' in
         let (c'', fin'') = iloop (n-1) c true in
         oloop (i+1) c'' fin''
  in
  oloop 0 0 false
                        
let () =
  let n = read_int () in
  let ar = Array.of_list (read_list int_of_string) in
  let c = bubble_sort ar n in
  print_array ar; string_of_int c |> print_endline

Measured memory_bytes: 2232
#include <bits/stdc++.h>
 
using namespace std;
int p[100005],pre[100005];
int main()
{
    string s;
    cin>>s;pre[0]=s[0]-'0';int cnt=0;
    for(int i=0;i<s.length();i++)
    {
    	if(s[i]=='0') cnt++;
	}int len=s.length();
	cout<<2*min(cnt,len-cnt);
}

Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<stack>
#include<queue>
#include<string>
#include<set>
#include<map>
#include<cmath>
#include<cstring>
using namespace std;
#define rep(i,n) for(int i=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int i=(m);(i)<(n);(i)++)
typedef long long ll;

int main(){
    int N;
    cin >> N;
    int res = 1<<28;
    rep(i,N){
        int a;
        cin >> a;
        int tmp = 0;
        while(a%2==0){
            a/=2;
            tmp++;
        }
        res = min(res,tmp);
    }
    cout << res << endl;
    return 0;
}

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

template<typename T>
bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	int H=in(),N=in();
	vector<pair<int,int>> A(N);
	REP(i,N){
		A[i].first=in(),A[i].second=in();
	}
	vector<vector<int>> dp(N+1,vector<int>(H+1,atcoder_mod));
	dp[0][0] = 0;
	REP(i,N){
		REP(j,H+1){
			chmin(dp[i+1][j],dp[i][j]);
			if(j+A[i].first<=H) chmin(dp[i+1][j+A[i].first],dp[i+1][j]+A[i].second);
			else chmin(dp[i+1][H],dp[i+1][j]+A[i].second);
		}
	}

	out(dp[N][H]);
	return 0;
}


Measured memory_bytes: 39424
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using vi = vector<i64>;
using vvi = vector<vi>;

vi des, asc;
using ii = pair<i64, int>;
vector<vector<ii>> adj;

i64 ans = 0;

void dfs1(int v, int p) {
    i64 m = 0;
    for (ii s: adj[v]) {
        if (s.second != p) {
            dfs1(s.second, v);
            m = max(m, des[s.second] + s.first);
        }
    }
    des[v] = m;
}

void dfs2(int v, int p) {
    vector<ii> ds = {ii(0, 0)};
    for (ii s: adj[v]) {
        if (s.second == p) {
            ds.push_back(ii(asc[p] + s.first, s.second));
        } else {
            ds.push_back(ii(des[s.second] + s.first, s.second));
        }
    }
    sort(ds.begin(), ds.end(), greater<>());
    ans = max(ans, ds[0].first + ds[1].first);
    for (ii s: adj[v]) {
        if (s.second != p) {
            asc[s.second] = ds[ds[0].second == s.second].first;
            dfs2(s.second, v);
        }
    }
}

int main() {
    int n;
    cin >> n;
    des = vi(n);
    asc = vi(n);
    adj = vector<vector<ii>>(n);
    for (int i = 0; i < n - 1; i++) {
        int s, t, w;
        cin >> s >> t >> w;
        adj[s].push_back(ii(w, t));
        adj[t].push_back(ii(w, s));
    }
    dfs1(0, -1);
    dfs2(0, -1);

    cout << ans << endl;
}


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

using namespace std;

main(){
	int a;
	cin >> a;
	int b=0;
	long long c=a;
	int d=a;
	long long s=1;
	while(a > b+1){
		b=b+1;
		s=c*s;
		c=c-1;
	}
	printf("%lld\n",s);
}


Measured memory_bytes: 3080
#include<cstdio>
using namespace std;
int main(){
    int n,m;
    scanf("%d %d",&n,&m);
    int A[n][m],b[m];
    
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            scanf(" %d",&A[i][j]);
        }
    }
    
    for(int i=0;i<m;i++){
        scanf(" %d",&b[i]);
    }
    int ans[n];

    for(int i=0;i<n;i++){
        ans[i]=0;
        for(int j=0;j<m;j++){
            int tmp;
            tmp=A[i][j]*b[j];
            ans[i]+=tmp;
        }
        printf("%d\n",ans[i]);
    }

}


Measured memory_bytes: 2752
#include<iostream>
using namespace std;
typedef long long LL;

int main() {
    int N, M;
    int proba = 1;
    cin >> N >> M;

    for (int i = 0; i < M; i++) proba *= 2;

    cout << (1900 * M + 100 * (N - M)) * proba << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
	ll n,a,b;
	cin>>n;
	vector<pair<ll,ll>> v;
	for(ll i=0;i<n;i++)
	{
	    cin>>a>>b;
	    v.push_back({b,a});
	}
	sort(v.begin(),v.end());
	ll s=0,f=1;
	for(ll i=0;i<n;i++)
	{
	    if(s+v[i].second>v[i].first)
	    {
	        f=0;
	        break;
	    }
	    s+=v[i].second;
	}
	if(f==0)
	cout<<"No"<<endl;
	else
	cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 5744