akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

typedef long long LL;
typedef pair<int,int> pi;
typedef vector<int> vi;
#define ST first
#define ND second
#define PB push_back
#define DET(a,b,c) (LL(b.x-a.x)*LL((c.y-a.y))-LL((c.x-a.x))*LL((b.y-a.y)))

const int MAXN = 100*1000+10;
int n,k;
int h[MAXN];
int dp[MAXN];

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin>>n>>k;
    for(int i=1; i<=n;i++) cin>>h[i];
    h[0] = -1000*1000*1000;
    for(int i=2; i<=n;i++) {
        dp[i] = 1000*1000*1000;
        for(int j=i-1; j>=max(0,i-k);j--) {
            dp[i] = min(dp[i],dp[j]+abs(h[i]-h[j]));
        }
    }
    cout<<dp[n];
}


Measured memory_bytes: 1152
#include <stdio.h>
 #include <stdbool.h> 

int main()
{ 
  int i, j, x; 
  int num;
  char ch; 
  char marks[4]={'S', 'H', 'C', 'D'};  
  int cards[4][13]={false};   

  scanf("%d ", &x);  
  for(i=0;i<x;i++)
  { 
       scanf("%c %d ", &ch, &num);    
       for(j=0;j<4;j++)
       {
            if(ch==marks[j])
            {
                 cards[j][num-1]=true;
                 break;   
            }
        }  
  } 
  
  for(i=0;i<4;i++)
  {
       for(j=0;j<13;j++)
       {
             if(!cards[i][j])
             { 
                 printf("%c %d\n", marks[i], j+1);    
             }
       } 
  }   

   return 0;
}


Measured memory_bytes: 2104
#include<stdio.h>
int main()
{
    int A, B, x, y, z;
    scanf("%d",&A);
    scanf("%d",&B);
    x=A+B;
    y=A-B;
    z=A*B;
    if (A==0 && B==0)printf("0\n");
    else if(x>=y && x>z)
    {
        printf("%d\n",x);
    }
    else if(y>x && y>z)
    {
        printf("%d\n",y);
    }
    else if(z>x && z>y) printf("%d\n",z);
    return 0;
}

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

int main(void){
int h1,h2,k1,k2,a,b,c,d;
int hs,ks;
cin >> h1 >> h2 >> k1 >> k2;
cin >> a >> b >> c >> d;
hs = h1/10*c + h1*a + h2/20*d + h2*b;
ks = k1/10*c + k1*a + k2/20*d + k2*b;
if (hs>ks) cout << "hiroshi" << endl;
else if (hs<ks) cout << "kenjiro" << endl;
else cout << "even" << endl;
return 0;
}


Measured memory_bytes: 3136
#include <stdio.h>
int main(){
    int data[10],k,i,min;
    k=i=min=0;
    for(i=0;i<3;i++){
        scanf("%d",&data[i]);
    }
    for(i=0;i<3;i++){
        for(k=0;k<3;k++){
            if(data[i]<data[k]){
                min=data[i];
                data[i]=data[k];
                data[k]=min;
            }
        }
    }
    for(i=0;i<2;i++){
        printf("%d ",data[i]);
    }
     printf("%d",data[2]);
    printf("\n");
    return 0;
}

Measured memory_bytes: 1808
def back_home():
    S=input()
    if((('S'in S) and ('N' in S)) and not (('E' in S) or  ('W' in S))):
        print('Yes')
    elif(not (('S' in S) or ('N'  in S)) and (('E' in S) and ('W' in S))):
        print("Yes")
    elif((('S'in S) and ('N' in S)) and (('E' in S) and ('W' in S))):
        print("Yes")
    else:
        print("No")
          
back_home()

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <bitset>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include<iomanip>

#define i64 int64_t
#define ff(ii,nn,mm) for(int ii=nn;ii<mm;ii++)
#define ffrvs(ii,nn,mm) for(int ii=nn;ii>=mm;ii--)
#define srt(vvv) sort(vvv.begin(),vvv.end())
#define srtrvs(vvv) reverse(vvv.begin(),vvv.end())
#define Graph vector<vector<int>>

i64 inf = 1000000007;
i64 giant = 4000000000000000037;

using namespace std;

i64 cup(i64 xxx, i64 yyy) {//切り上げ
	return (xxx + yyy - 1) / yyy;
}

//メモリ置き場
int n, a, b;

//inputします
void input() {
    cin >> n >> a >> b;
}

//ライブラリ置き場
//割り算に対するあまりの処理
i64 divmod(i64 aa26, i64 bb26, i64 pp26) {//aa:割る数 bb:pp-2 pp:余りを取る数
    if (bb26 == 0) {
        return 1;
    }
    else if (bb26 % 2 == 0) {
        i64 dd26 = divmod(aa26, bb26 / 2, pp26);
        return (dd26 * dd26) % pp26;
    }
    else {
        return (aa26 * divmod(aa26, bb26 - 1, pp26)) % pp26;
    }
}

i64 commod(i64 aa27, i64 bb27, i64 pp27) {//aaCbb mod pp
    if (aa27 < bb27)return 0;
    if (2 * bb27 > aa27)bb27 = aa27 - bb27;
    i64 ans27 = 1;
    ff(ii27, 0, bb27) {
        ans27 *= aa27 - ii27;
        ans27 %= pp27;
    }
    ff(ii27, 1, bb27 + 1) {
        ans27 *= divmod(ii27, pp27 - 2, pp27);
        ans27 %= pp27;
    }
    return ans27;
}

//main
int main() {
	input();
    i64 ans = 4;
    deque<int> od;
    int n1 = n;
    while (n1 > 2) {
        if (n1 % 2 != 0) {
            od.push_front(1);
            n1--;
        }
        if (n1 > 2) {
            od.push_front(2);
            n1 /= 2;
        }
    }
    while (n1 != n) {
        if (od.front() == 1) {
            ans *= 2;
            ans %= inf;
            n1 += 1;
        }
        if (od.front() == 2) {
            ans *= ans;
            ans %= inf;
            n1 *= 2;
        }
        od.pop_front();
    }
    //cout << endl<<ans << endl;
    ans -= commod(n, a, inf);
    //cout << ans << endl;
    ans -= commod(n, b, inf);
    ans--;
    //cout << ans << endl;
  while(ans<0)ans+=inf;
  cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
// Tazoe

#include <iostream>
using namespace std;

int main()
{
	while(true){
		int n;
		cin >> n;

		if(n==0)
			break;

		char T[10];
		int W[10], L[10], I[10];

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

			W[i] = L[i] = 0;
			for(int j=0; j<n-1; j++){
				int r;
				cin >> r;

				if(r==0){
					W[i]++;
				}
				else if(r==1){
					L[i]++;
				}
			}

			I[i] = i;
		}

		for(int i=0; i<n-1; i++){
			for(int j=i+1; j<n; j++){
				if(W[i]<W[j]
				 ||(W[i]==W[j]&&L[i]>L[j])
				 ||(W[i]==W[j]&&L[i]==L[j]&&I[i]>I[j])){
					char c_tmp = T[i];
					T[i] = T[j];
					T[j] = c_tmp;

					int tmp = W[i];
					W[i] = W[j];
					W[j] = tmp;

					tmp = L[i];
					L[i] = L[j];
					L[j] = tmp;

					tmp = I[i];
					I[i] = I[j];
					I[j] = tmp;
				}
			}
		}

		for(int i=0; i<n; i++){
			cout << T[i] << '\n';
		}
	}

	return 0;
}

Measured memory_bytes: 0
#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 pll=pair<ll,ll>;
using tll=tuple<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 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;}
template<class T> void chmax(T &a, const T &b){if(a<b)a=b;}
template<class T> void chmin(T &a, const T &b){if(a>b)a=b;}
void YN(bool b){cout<<(b?"YES":"NO")<<endl;}
void Yn(bool b){cout<<(b?"Yes":"No")<<endl;}
void yn(bool b){cout<<(b?"yes":"no")<<endl;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,m,nm;
	cin>>n>>m;
	nm=n*m;
	vl a(n),b(m);
	vb x(nm+1,false),y(nm+1,false);
	rep(i,n)cin>>a[i],x[a[i]]=true;
	rep(j,m)cin>>b[j],y[b[j]]=true;
	ll mn=min(*min_element(all(a)),*min_element(all(b)));
	sort(all(a),greater<ll>());
	sort(all(b),greater<ll>());
//	cout<<a<<endl;
//	cout<<b<<endl;
	ll ans=1,xp=0,yp=0,bl=0;
	for(ll i=nm*1;i>0;i--){
		if(x[i]&&y[i]){
			bl+=(xp+yp);
			xp++,yp++;
		}
		else if(x[i]){
			if(xp==n||yp==0){cout<<0<<endl;return 0;}
			xp++;ans*=yp;ans%=MOD;
			bl+=(yp-1);
		}
		else if(y[i]){
			if(yp==m||xp==0){cout<<0<<endl;return 0;}
			yp++;ans*=xp;ans%=MOD;
			bl+=(xp-1);
		}
		else{
			if(bl==0){cout<<0<<endl;return 0;}
			ans*=bl;ans%=MOD;
			bl--;
		}
	}
	/*
	for(ll i=1;i<=nm;i++){
		if(a[i]==false&&b[i]==false)
	}
	*/
	cout<<ans<<endl;
}

 

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
 int t = 0;int min = 10;
 for(int i = 0;i<5;i++){
     int a;cin >> a;
     if(a % 10 != 0 and a% 10 < min){
         min = a % 10;
     }
     if(a % 10 != 0){
        a += 10 - (a % 10);
     }
     t += a;
 }
 t -= 10 - min;
 
 cout << t << endl;
}


Measured memory_bytes: 256
using System;

namespace Aizu
{
    class OnlineJudge
    {
        public static void Main()
        {
            for(var d = new int[2]; (d[0] = int.Parse(Console.ReadLine())) != (d[1] = int.Parse(Console.ReadLine())) || d[0] != 0;Console.WriteLine("{0:f6}", d[0] * Math.Sqrt(4 * d[1] * d[1] + d[0] * d[0]) + d[0] * d[0]));
        }
    }
}

Measured memory_bytes: 5644
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  int n,m;
  cin >> n >> m;
  int a[n][m];
  rep(i,n){
    rep(j,m){
      cin >> a[i][j];
      a[i][j]--;
    }
  }
  int ans[m]={};
  int step[n]={};
  set<int> se;
  rep(i,m){
    int cnt[m]={};
    rep(j,n){
      cnt[a[j][step[j]]]++;
    }
    int M=-1;
    rep(j,m)M=max(M,cnt[j]);
    rep(j,m){
      if(cnt[j]==M){
        ans[j]=M;
        se.insert(j);
        break;
      }
    }
    rep(i,n){
      while(se.find(a[i][step[i]])!=se.end())step[i]++;
    }
  }
  int an=inf;
  rep(i,m)an=min(an,ans[i]);
  cout << an << endl;
return 0;}

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <vector>
#include <cstring>
#include <algorithm>
#define int long long
using namespace std;
typedef vector <int> vi;
int read() {
	int x = 0, f = 1; char ch;
	while(! isdigit(ch = getchar())) (ch == '-') && (f = -f);
	for(x = ch ^ 48; isdigit(ch = getchar()); x = (x << 3) + (x << 1) + (ch ^ 48));
	return x * f;
}
template <class T> T Max(T a, T b) { return a > b ? a : b; }
template <class T> T Min(T a, T b) { return a < b ? a : b; }
int n, k;
vi A, a[6];
vi inv(vi x) {
	vi res(n);
	for(int i = 0; i < n; ++ i) res[x[i]] = i;
	return res;
}
vi mul(vi p, vi q) {
	vi res(n);
	for(int i = 0; i < n; ++ i) res[i] = p[q[i]];
	return res;
}
vi ksm(vi x, int y) {
	vi res(n);
	for(int i = 0; i < n; ++ i) res[i] = i;
	for( ; y; x = mul(x, x), y >>= 1) {
		if(y & 1) res = mul(res, x);
	}
	return res;
}
signed main() {
	n = read(); k = read() - 1;
	a[0].resize(n); for(int i = 0; i < n; ++ i) a[0][i] = read() - 1;
	a[1].resize(n); for(int i = 0; i < n; ++ i) a[1][i] = read() - 1;
	for(int i = 2; i < 6; ++ i) a[i] = mul(a[i - 1], inv(a[i - 2]));
	if(k < 6) {for(int i = 0; i < n; ++ i) printf("%d ", a[k][i] + 1); return 0;}
	A = ksm(mul(mul(a[1], inv(a[0])), mul(inv(a[1]), a[0])), k / 6);
	A = mul(mul(A, a[k % 6]), inv(A));
	for(int i = 0; i < n; ++ i) printf("%d ", A[i] + 1);
	return 0;
}


Measured memory_bytes: 15156
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		scan.close();
		if(a>12)System.out.println(b);
		else if(a>=6)System.out.println(b/2);
		else System.out.println("0");
	}
}

Measured memory_bytes: 21972
#include <iostream>
#include <vector>
#include <string>
#include <bits/stdc++.h>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <deque>
#include <tuple>
#include <unordered_set>
#include <array>
#include <string>

using namespace std;
#define ll long long
#define ar array

int main() {
	string s;
	cin >> s;
	if (s.back()=='s') s+="es";
	else s+="s";
	cout << s;
	return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
#define pq priority_queue
#define P pair<int,int>
#define P2 pair<int,P>
#define P3 pair<int,P2>
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
const ll LINF=1e18;
const ld PI=abs(acos(-1));
string s;
 
int main(){
	cin >> s;
	
	int pos=0;
	REP(i,0,s.size()) pos+=s[i]-'0';
	
	cout << (stoi(s)%pos?"No":"Yes") << endl;
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = ReadInt();
            var num = N;
            var sum = 0;
            while (num > 0)
            {
                sum += num % 10;
                num = num / 10;
            }

            Console.WriteLine(N % sum == 0 ? "Yes" : "No");
            Console.ReadLine();
        }

        static string Read() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Read()); }
        static long ReadLong() { return long.Parse(Read()); }
        static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }
        static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
 
#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define ll long long
#define ii pair<int,int>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<ii>
#define debug cout << "Ok" << endl;

using namespace std;

void solve(){

	return;
}


vector<int>ps(200100);
vector<int>qtd(200100,1);

int find_set(int n){
	return (ps[n]==n ? n : ps[n] = find_set(ps[n]));
}
int ma=1;

bool insert(int x, int y){
	int xr = find_set(x);
	int yr = find_set(y);
	int l;

	if(xr == yr) return false;

	if(qtd[xr] < qtd[yr]){
		l = xr;
		xr = yr;
		yr = l;
	}

	ps[yr]=xr;
	qtd[xr]+=qtd[yr];
	ma = max(ma,qtd[xr]);
	return true;
}

int32_t main(){
	long long int n,m,a,b;

	cin >> n >> m;
	for(int i=0;i<=n+3;i++){
		ps[i]=i;
	}
	while(m--){
		cin >> a >> b;
		insert(a,b);
	}


	cout << ma << endl;
	return 0;
}

Measured memory_bytes: 4664
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
S = readline().decode().rstrip()
Q = int(readline())
cnt = 0
start = ''
end = ''
for i in range(Q):
    A = list(map(str,readline().decode().split()))
    if A[0] == '1':
        cnt +=1
    else:
        if (cnt + int(A[1])) % 2:
            start += A[2]
        else:
            end += A[2]
ans = start + S + end
if cnt % 2 == 1:
    print(end[::-1] + S[::-1] + start)
else:
    print(start[::-1] + S + end)

Measured memory_bytes: 10308
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}
void readA(T)(size_t n,ref T[]t){t=new T[](n);auto r=rdsp;foreach(ref v;t)pick(r,v);}

void main()
{
  int n; readV(n);
  int[] v; readA(n, v);

  auto m = n/2, v1 = new int[](m), v2 = new int[](m);
  foreach (i; 0..m) {
    v1[i] = v[i*2];
    v2[i] = v[i*2+1];
  }

  int[int] h1, h2;
  foreach (i; 0..m) {
    ++h1[v1[i]];
    ++h2[v2[i]];
  }

  auto p1 = h1.byPair.array, p2 = h2.byPair.array;
  p1.sort!"a[1]>b[1]";
  p2.sort!"a[1]>b[1]";

  if (p1[0][0] != p2[0][0]) {
    writeln(n-p1[0][1]-p2[0][1]);
  } else {
    p1 ~= tuple(-1, 0);
    p2 ~= tuple(-1, 0);
    if (p1[1][1]+p2[0][1] > p1[0][1]+p2[1][1])
      writeln(n-p1[1][1]-p2[0][1]);
    else
      writeln(n-p1[0][1]-p2[1][1]);
  }
}


Measured memory_bytes: 12988
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define show(x) for(auto i: x){cout << i << " ";}
#define showm(m) for(auto i: m){cout << m.x << " ";}
typedef long long ll;
typedef pair<int, int> P;

// union by size + path having
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main()
{
    int n, m;
    cin >> n >> m;
    vector<P> a;
    rep(i, m){ 
        int tmpx, tmpy, tmpz; cin >> tmpx >> tmpy >> tmpz;
        tmpx--; tmpy--; 
        a.push_back(P(tmpx, tmpy));
    }
    UnionFind tree(n);

    rep(i, m){
        tree.unite(a[i].first, a[i].second);
    }

    set<int> sum;
    rep(i, n){
        sum.insert(tree.root(i));
    }
    cout << (int)sum.size() << endl;
}

Measured memory_bytes: 6004
N = int(input())

if N <= 111:
  print(111)
elif N <= 222:
  print(222)
elif N <= 333:
  print(333)
elif N <= 444:
  print(444)
elif N <= 555:
  print(555)
elif N <= 666:
  print(666)
elif N <= 777:
  print(777)
elif N <= 888:
  print(888)
elif N <= 999:
  print(999)

Measured memory_bytes: 3060
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
  int n,m,a,b,c,d,COST[21][21];
  
  for(int i=0;i<21;i++){
    for(int j=0;j<21;j++){
      COST[i][j] = 1000000;
    }
  }

  cin >> n >> m;
  for(int i=0;;i++){
    scanf("%d,%d,%d,%d",&a,&b,&c,&d);
    if(i==m) break;
    COST[a][b] = c;
    COST[b][a] = d;
  }
  for(int i=1;i<=n;i++){
    for(int j=1;j<=n;j++){
      for(int k=1;k<=n;k++){
	if(COST[j][k]>COST[j][i]+COST[i][k]){
	  COST[j][k]=COST[j][i]+COST[i][k];
	}
      }
    }
  }
  cout << c - COST[a][b] - COST[b][a] - d << endl;
}

Measured memory_bytes: 1240
#define _USE_MATH_DEFINES

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

using namespace std;

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

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

const int Maxn = 100010;

ll a[Maxn], sum[Maxn];

int n;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    sort(a, a + n);
    for (int i = 0; i < n; ++i) {
        sum[i + 1] = sum[i] + a[i];
    }

    int ans = 1;
    for(int i = n - 2; i >= 0; --i){
        if (a[i + 1] <= 2 * sum[i + 1]) ++ans;
        else break;
    }
    cout << ans << endl;
}


Measured memory_bytes: 1792
/* include c++ libraries */
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <map>
#include <queue>
#include <set>

/* include c-lang libraries */
#include <climits>
#include <cmath>

/* include my libraries */
//#include <show_vec.hh>

using namespace std;

#define LINE DEBUG{ printf("LINE : %d\n", __LINE__); }
#define DEBUG if(false)

using ll = long long;
template<class T> using vec = vector<T>;

const int MOD = 1000000007;

template<class T> void show_vec0(std::vector<T> v){
  int s = v.size();
  for(int i = 0; i < s-1; i++){
    std::cout << v[i] << " ";
  }
  std::cout << v[s-1];
  return;
}

template<class T> void show_vec(std::vector<T> v){
  show_vec0(v);
  std::cout << std::endl;
  return;
}

int main(){

  int N;
  cin >> N;
  vec<int> A(N);
  for(int i = 0; i < N; i++){
    cin >> A[i];
  }
  sort(A.begin(), A.end());
  reverse(A.begin(), A.end());
  //show_vec(A);
  ll Ans = 0;

  for(int i = 0; i < N-1; i++){
    Ans += A[(i+1)/2];
  }
  cout << Ans << endl;
  return 0;
}


Measured memory_bytes: 4044
program main
	implicit none
    integer::i,ans
    character(16)::s,t
    t='CODEFESTIVAL2016'
    read(*,*)s
    ans=16
    do i=1,16
    	if(s(i:i)==t(i:i))then
        	ans=ans-1
        end if
    end do
    write(*,*)ans
    stop
end program main
    

Measured memory_bytes: 2716
#!/usr/bin/env python3

from pprint import pprint
from collections import deque, defaultdict
import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.buffer.readline
inf = float("inf")

N, M, Q = map(int, input().split())
l_left = []
l_right = []
for _ in range(M):
    left, right = map(int, input().split())
    l_left.append(left)
    l_right.append(right)

l_query = []
for _ in range(Q):
    p, q = map(int, input().split())
    l_query.append([p, q])

# s[left][right] := [1, left], [1, right] の領域に含まれる列車の数
# s[left][right] = s[left-1][right] + s[left][right-1] - s[left-1][right-1] + a[left][right]

s = [[0 for right in range(N + 1)] for left in range(N + 1)]

for i in range(M):
    left = l_left[i]
    right = l_right[i]
    s[left][right] += 1

for left in range(1, N + 1):
    for right in range(1, N + 1):
        s[left][right] += s[left-1][right] + s[left][right-1] - s[left-1][right-1]

for left, right in l_query:
    res = s[right][right] - s[right][left-1] - s[left-1][right] + s[left-1][left-1]
    print(res)


Measured memory_bytes: 77028
s = input()
t = input()
s = list(s)
t = list(t)
s.sort()
t.sort(reverse=True)

min_len = min(len(s),len(t))

ans = False

for i in range(min_len):
    if s[i] < t[i]:
        ans = True
        break

if s[:min_len] == t[:min_len]:
    if len(s) < len(t):
        ans = True
        
if ans:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
bool isBuilding[20][20];
int solve(int x,int y){
	if(x==0 || y==0) return 0;
	if(isBuilding[x][y]) return 0;
	if(x==1 && y==1) return 1;
	return solve(x,y-1)+solve(x-1,y);
}
int main() {
	int a,b,n,x,y;
	while(cin >> a >> b && a!=0){
		for(int i=0;i<20;i++)
			for(int j=0;j<20;j++)
				isBuilding[i][j]=false;
		cin >> n;
		for(int i=0;i<n;i++){
			cin >> x >> y;
			isBuilding[x][y]=true;
		}
		cout << solve(a,b) << endl;
	}
	// your code goes here
	return 0;
}

Measured memory_bytes: 1160
line = gets.split(' ').map(&:to_i)
A = line[0]
B = line[1]
K = line[2]

cnt = 0
ret = 0
for i in 1..100 do
    t = 101 - i
    if A % t == 0 and B % t == 0 then
        cnt += 1
        if cnt == K then
            ret = t
            break
        end
    end
end

puts ret


Measured memory_bytes: 1788
#include<iostream>
#include<vector>
using namespace std;
int main()
{
	string s;
	vector<char> t;
	int ans=0;
	cin>>s;
	for(int i=0;i<s.size();i++)
		if(t.size()&&t.back()=='S'&&s[i]=='T')ans+=2,t.pop_back();
		else t.push_back(s[i]);
	cout<<s.size()-ans<<endl;
}


Measured memory_bytes: 772
from collections import Counter
S = input()
ct = Counter(S)
if len(ct) != 26:
  for i in range(26):
    c = chr(ord('a')+i)
    if c not in ct:
      print(S+c)
      exit()

prev = chr(ord('a')-1)
arr = []
for i in range(26)[::-1]:
  if prev > S[i]:
    print(S[:i] + min(filter(lambda x: x > S[i],arr)))
    break
  arr.append(S[i])
  prev = S[i]
else:
  print(-1)

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

char s[10010];
char p[10010];

char k[10][10];

void init()
{
	k[1][0] = 5;
	k[1][1] = '\'';
	k[1][2] = ',';
	k[1][3] = '.';
	k[1][4] = '!';
	k[1][5] = '?';

	int i;
	for( i = 2; i<=6 ;i++ )
	{
		k[i][0] = 6;
		k[i][1] = 'a' + 3*(i-2);
		k[i][2] = 'b' + 3*(i-2);
		k[i][3] = 'c' + 3*(i-2);
		k[i][4] = 'A' + 3*(i-2);
		k[i][5] = 'B' + 3*(i-2);
		k[i][6] = 'C' + 3*(i-2);
	}

		k[7][0] = 8;

		k[7][1] = 'p';
		k[7][2] = 'q';
		k[7][3] = 'r';
		k[7][4] = 's';

		k[7][5] = 'P';
		k[7][6] = 'Q';
		k[7][7] = 'R';
		k[7][8] = 'S';


		k[8][0] = 6;
		k[8][1] = 't';
		k[8][2] = 'u';
		k[8][3] = 'v';

		k[8][4] = 'T';
		k[8][5] = 'U';
		k[8][6] = 'V';


		k[9][0] = 8;

		k[9][1] = 'w';
		k[9][2] = 'x';
		k[9][3] = 'y';
		k[9][4] = 'z';

		k[9][5] = 'W';
		k[9][6] = 'X';
		k[9][7] = 'Y';
		k[9][8] = 'Z';

}

int main()
{
	init();
	while( cin>>s )
	{
		char c = 0;
		int n = 0;
		int sp = 0;
		c = s[0];
		n = 1;
		int i;
		for( i = 1; s[i]!='\0' ; i++ )
		{
			if( s[i]=='0')
			{
				if( n==0 )
				{
					p[sp] = ' ';
					sp++;
				}
				else
				{
						int pos = k[c-'0'][0];
						n = n % pos;
						if( n == 0 )
						{
							n = pos;
						}
						p[sp] = k[c-'0'][n ];	
						sp++;
						n = 0;
				}
				c = '0';
			}
			else
			{

				if( c==s[i] )
				{
					n++;
				}
				else
				{
					if( n==0 )
					{
						c = s[i];
						n++;
						continue;
					}
					
					int pos = k[c-'0'][0];
						n = n % pos;
						if(n == 0 )
						{
							n = pos;
						}

					p[sp] = k[c-'0'][n ];	
					sp++;
					c = s[i];
					n = 1;
				}
			}
		}
		if( c!='0' )
		{	p[sp]= c ;
		
		int pos = k[c-'0'][0];
						n = n % pos;
						if(n == 0 )
						{
							n = pos;
						}

					p[sp] = k[c-'0'][n ];	
					sp++;
					c = s[i];
					n = 1;
					;}
		p[sp]= '\0' ;
		puts(p);
	}
	return 0;
}

Measured memory_bytes: 0
#include"stdio.h"
#include"stdlib.h"
#include"string.h"

struct Vector
{
  struct Vector *flont;
  int x;
  struct Vector *next;
};
struct Vector *head;
struct Vector *back;
int insertFlag;
void setVector()
{
  head=(struct Vector*)malloc(sizeof(struct Vector));
  head->next = NULL;
  head->flont=NULL;
  back=head;
}
void push_back(int key)
{
  struct Vector *new;
  new = (struct Vector*)malloc(sizeof(struct Vector));
  if(head->next!=NULL)
    {
      new->next=head->next;
      new->next->flont=new;
      head->next=new;
      new->flont=head;
      new->x=key;
    }
  else
    {
      back=new;
      new->next=NULL;
      head->next=new;
      new->flont=head;
      new->x=key;
    }
}
void Delete(int key)
{
  struct Vector *buf;
  struct Vector *p;
  for(p=head->next;p!=NULL;p=p->next)
    {
      if(p->x==key)
        {
          buf=p;
          if(p->next!=NULL)
            {
              buf=p;
              p->flont->next=p->next;
              p->next->flont=p->flont;
              free(buf);
              break;
            }
          else
            {
              buf=p;
              p->flont->next=NULL;
              back=p->flont;
              free(buf);
              break;
            }
        }
    }
}
void Delete_flont()
{
  struct Vector *buf;
  if(head->next!=NULL)
    {
      buf=head->next;
      if(buf->next==NULL)
        {
          head->next=NULL;
          back=head;
        }
      else
        {
          head->next=buf->next;
          buf->next->flont=head;
        }
      free(buf);
    }
}
void Delete_back()
{
  struct Vector *buf;
  if(head->next!=NULL)
    {
      buf=back;
      back=back->flont;
      back->next=NULL;
      free(buf);
    }
}
int main()
{
  setVector();
  int i;
  struct Vector* p;
  int n;
  int key;
  char cmd[12];
  char insert[]={"insert"};
  char delete[]={"delete"};
  char deleteFirst[]={"deleteFirst"};
  char deleteLast[]={"deleteLast"};
  scanf("%d",&n);
  for(i=0;i<n;i++)
    {
      scanf("%s",cmd);
      if(!strcmp(cmd,insert))
        {
          scanf("%d",&key);
          push_back(key);
        }
      else if(!strcmp(cmd,delete))
        {
          scanf("%d",&key);
          Delete(key);
        }
      else if(!strcmp(cmd,deleteFirst))
        {
          Delete_flont();
        }
      else if(!strcmp(cmd,deleteLast))
        {
          Delete_back();
        }
    }
  if(head->next!=NULL)
    {
      printf("%d",head->next->x);
      for(p=head->next->next;p!=NULL;p=p->next)
        {
          printf(" %d",p->x);
        }
    }
  printf("\n");
  return 0;
}


Measured memory_bytes: 32932
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << 
 << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;

template<class T> inline T sqr(T x) {return x*x;}

int main() {
    int n,c,k;
    cin >> n >> c >> k;
    VI t(n);
    REP(i,0,n) cin >> t[i];
    sort(all(t));
    int num = 1, cnt = 0;
    for (int i = 0; i < n;) {
        //cout << i << endl;
        REP(j,i+1,n) {
            //cout << j << endl;
            if (num == c) {
                num = 1;
                ++cnt;
                i = j;
                break;
            }
            if (t[j] <= t[i] + k) ++num;
            else {
                num = 1;
                ++cnt;
                i = j;
                break;
            }
        }
        if (num > 1 || i == n - 1) {
            num = 0;
            ++cnt;
            break;
        }
    }
    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main()
{
	char  a[4];
	cin>>a[0]>>a[1]>>a[2];
	if(a[0]==a[1]&&a[0]==a[2]&&a[1]==a[2])cout<<"No";
	else cout<<"Yes";
	
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int a,b,c;
	char s[11];
	scanf("%s",&s[0]);
	a=1000*(s[0]-48)+100*(s[1]-48)+10*(s[2]-48)+s[3]-48;
	b=10*(s[5]-48)+s[6]-48;
	c=10*(s[8]-48)+s[9]-48;
	if(a<2020&&b<5&&c<31){
		printf("Heisei");
	}else{
		printf("TBD");
	}
}

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

int main(){
int N;
   cin>>N;
  vector<double>x(N);
  string u;
  double sum=0;
  for(int i=0; i<N; i++){
   cin>>x[i]>>u;
    if(u=="JPY"){sum+=x[i];}
    else{sum+=x[i]*380000.0;}
  }
  
  cout<<sum;
}


Measured memory_bytes: 256
n = int( input() )
h = [ int( hi ) for hi in input().split() ]
#print( h )

cost = [ 0 ] * n
cost[ 1 ] = max( h[ 1 ]-h[ 0 ], h[ 0 ]-h[ 1 ] )
for i in range( 2, n ):
#    print( i )
    cost1 = cost[ i-1 ] + max( h[ i ]-h[ i-1 ], h[ i-1 ]-h[ i ] )
    cost2 = cost[ i-2 ] + max( h[ i ]-h[ i-2 ], h[ i-2 ]-h[ i ] )
    cost[ i ] = min( cost1, cost2 )

print( cost[ n-1 ] )


Measured memory_bytes: 13928
#include <iostream>
using namespace std;
int main(void){
    int i, j;
    for(i=1; i<10; i++){
        for(j=1; j<10; j++){
            cout << i << "x" << j << "=" << i*j << endl;
        }
    }
    return 0;
}

/*２重ループの問題です*/


Measured memory_bytes: 3076
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
#define int long long
#define endl "\n"
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
typedef long long ll;
typedef pair<int, int> P;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a/gcd(a,b)*b;};
int mod(int a,int b){return (a+b-1)/b;};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;};
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;};

int b[55];

signed main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    
    int n, i, j = 0;
    int ans;
    string s;
    cin >> n >> s;
    REP(i, 1, n) {
        if(s[i-1] == s[i]) b[j]++;
        else j++;
    }
    ans = (b[0] ? 6 : 3);
    for(i = 0; i < j; i++) {
        ans = (ans * (b[i] ? b[i+1] ? 3 : 1 : 2)) % MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
int main() {
	double a; cin>>a;
	 cout<<fixed<<setprecision(10);
	 cout<<pi*a*a<<" "<<2*pi*a<<endl;
	// your code goes here
	return 0;
}

Measured memory_bytes: 3256
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

int main(void){
	for(int m, nmin, nmax; cin >> m >> nmin >> nmax, m;){
		vi p(m);
		for(auto & e : p) cin >> e;

		sort(_all(p), greater<int>());

		int res = 0, resn;
		rep(n, nmin, nmax + 1){
			int gap = p[n - 1] - p[n];
			if(res <= gap){
				res = gap;
				resn = n;
			}
		}

		cout << resn << endl;
	}

	return 0;
}

Measured memory_bytes: 3032
for i in range(100000):
    s = input().rstrip().split(" ")
    a = int(s[0])
    b = s[1]
    c = int(s[2])
    if b =="?":
        break
    if b == "+":
        print(a+c)
    if b == "-":
        print(a-c)
    if b == "*":
        print(a*c)
    if b == "/":
        print(int(a/c))


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

using namespace std;

class DisjoinSet{
    public:
    vector<int> rank,p;

    DisjoinSet(){
    
    }
    DisjoinSet(int size){
        rank.resize(size,0);
        p.resize(size,0);
        for(int i=0;i<size;i++) makeSet(i);
    }
    void makeSet(int x){
        p[x] = x;
        rank[x]  = 0;
    }
    bool same(int x,int y){
        return findSet(x) == findSet(y);
    }
    void unite(int x,int y){
        link(findSet(x),findSet(y));
    }

    void link(int x,int y){
        if(rank[x] > rank[y]){
            p[y] = x;
        }else{
            p[x] = y;
            if(rank[x]==rank[y]){
                rank[y]++;
            }
        }
    }
    int findSet(int x){
        if(x != p[x]){
            p[x] = findSet(p[x]);
        }
        return p[x];
    }
};

int main(){
    int n,a,b,q;
    cin >> n >> q;
    DisjoinSet ds = DisjoinSet(n);
    int t;
    for(int i=0;i<q;i++){
        cin >> t >> a >> b;
        if(t==0) ds.unite(a,b);
        else if(t==1){
            if(ds.same(a,b)) cout << 1 << endl;
            else cout << 0 << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3168
#include <iostream>

using namespace std;
int main() {
    char S[5];
    cin >> S;
    for (int i=0; i<3; i++) {
        if (S[i] == S[i+1]) {
            cout << "Bad" << endl;
            return 0;
        }
    }
    cout << "Good" << endl;
    return 0;
}



Measured memory_bytes: 764
use std::collections::hash_map::HashMap;

fn main() {
    let s = {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        s.trim_right().to_owned()
    };
    let n = {
        let mut ws = s.split_whitespace();
        let l: i64 = ws.next().unwrap().parse().unwrap();
        l
    };

    let s = {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        s.trim_right().to_owned()
    };
    let a_vec = {
        let mut ws = s.split_whitespace();
        let mut a_vec = vec![];
        for _ in 0..n {
            let a: i64 = ws.next().unwrap().parse().unwrap();
            a_vec.push(a);
        }
        a_vec
    };

    let mut a_work = a_vec.to_vec();
    a_work.sort();
    let mut amount = vec![];
    let mut before = None;
    let mut size: i64 = 0;
    for a in a_work {
        before = match before {
            None => {
                size += 1;
                Some(a)
            }
            Some(b) => {
                if a == b {
                    size += 1;
                } else {
                    amount.push((b, size));
                    size = 1;
                }
                Some(a)
            }
        }
    }
    if let Some(b) = before {
        amount.push((b, size));
    }

    let mut pattern_list = HashMap::new();
    let mut pattern_list2 = HashMap::new();
    for &(key, value) in amount.iter() {
        pattern_list.insert(key, combination2(value as i64));
        pattern_list2.insert(key, combination2(value as i64 - 1));
    }
    let sum: i64 = pattern_list.values().sum();

    let mut memo = HashMap::new();
    for a in a_vec {
        let mut patterns = 0;
        if memo.contains_key(&a) {
            patterns = *memo.get(&a).unwrap();
        } else {
            patterns = sum - *pattern_list.get(&a).unwrap() + *pattern_list2.get(&a).unwrap();
            memo.insert(a, patterns);
        }
        println!("{}", patterns);
    }
}

fn combination2(n: i64) -> i64 {
    n * (n - 1) / 2
}

// 2*1/2 -> 1*0/2
// 3*2/2 -> 2*1/2


Measured memory_bytes: 34496
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,N) for(int i = 0;i < (int)(N);i++)
int main(){
  int n,k;
  cin>>n>>k;
  vector<int>h(n);
  rep(i,n) cin>>h[i];
  int count=0;
  rep(i,n){
    if(h[i]>=k){
      count++;
    }
   }
   cout<<count<<endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (ll)(n); i++)

int main() {
  ll n; cin >> n;
  vector <char> res;
  while (n != 0) {
    ll tmp = n%26;
    if (tmp) tmp--;
    else tmp = 25;
    char c = 'a' + tmp;
    res.push_back(c);
    if (n%26) n /= 26;
    else n = n/26 - 1;
  }
  reverse(res.begin(), res.end());
  rep(i, res.size()) cout << res.at(i);
  cout << endl;
}

Measured memory_bytes: 3624
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        try(Scanner sc = new Scanner(System.in)){
            String line = sc.nextLine();
            String answer = "";
            int length = line.length();
            for(int i = 0;i < length;i++){
                char ch = line.charAt(i);
                if(Character.isLowerCase(ch)){
                    ch = Character.toUpperCase(ch);
                }else{
                    ch = Character.toLowerCase(ch);
                }
                answer+=ch;
            }
            System.out.println(answer);
        }
    }
}


Measured memory_bytes: 31672
nums = list(map(int, input().split(" ")))
a = nums[0]
b = nums[1]

c1 = int( a / b )
c2 = int( a % b )
c3 = float( a / b )
print(str(c1) + " " + str(c2) +  " " + str("{0:.5f}".format(c3)))


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

signed main(){

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

  map<int, int> mp;
  for(int i = 0; i < n; i++){
    mp[-a[i] - i]++;
  }

  int ans = 0;
  for(int i = 0; i < n; i++){
    ans += mp[a[i] - i];
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 27312
#!/usr/bin/env python3
import sys


def solve(N: int, M: int):
    if N == 1 and M == 1:
        print(1)
        return 

    if N == 1 or M ==1:
        print(max(N,M)-2)
        return
    
    print((N-2)*(M-2))
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    solve(N, M)

if __name__ == '__main__':
    main()


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

int main() {
  int a, b;
  cin >> a >> b; 
  if (a * b % 2 == 1) {
    cout << "Odd" << endl;
  }
  if (a * b % 2 != 1) {
    cout << "Even" << endl;
  }
}

Measured memory_bytes: 3568
n = gets.chomp.to_i
t,a = gets.chomp.split.map(&:to_i)
h = gets.chomp.split.map(&:to_i)
ans = 0
sa = 1e18
for i in 0...n
  x = t - 0.006 * h[i]
  ssa = x-a
  ssa = -ssa if ssa < 0
  if ssa < sa
    ans = i
    sa = ssa
  end
end
puts (ans+1)

Measured memory_bytes: 1788
#include<iostream>
#include<cmath>
#include<algorithm>
#include <cassert>
#include<string>
#include<vector>
#include<map>
#include <utility>
#include <math.h>
using namespace std;
int a = 0, b = 0,c = 0, e[100010] = {}, f[100010];
double syo = 0, su = 0;
long long   mur=0, kmr=0, yju=0, counto[5003],counto1[5003];
char fir='z',sec='z',mado[5010];
string rik,tok[25003];
bool mazi[110], gi[110],zi,manji;
pair<int, int>n[110];
vector<int> aa[50] = {}, cc;
vector<string> bb;
map<int, int>pos;
int gcd(int a,int b) {
	int d;
	if (a > b) {
		int t = b;
		b = a;
		a = t;
	}
	while ((d = b % a) != 0) {
		b = a;
		a = d;
	}
	return a;
}
int main() 
{
	cin >> mur>>kmr;
	if (mur  <= kmr/2) {
		kmr -= mur * 2;
		yju += mur;
		mur = 0;
	}
	else {
		
		cout << kmr / 2 << endl;
		return 0;
	}
	//cout << yju << endl;
	yju += kmr / 4;
	cout << yju  << endl;
	return 0;
}

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

int need_num[9] = {2,5,5,4,5,6,3,7,6};
vector<int> av_nums;
string dp[10001];

int main(){
	int n,m;
	cin >> n >> m;
	int a;
	for(int i=0;i<m;++i){
		cin >> a;
		av_nums.push_back(a);
	}
	sort(av_nums.begin(),av_nums.end(), greater<int>());
	
	for(int i=0;i<10001;++i)dp[i] ="";
	for(int i=0;i<n+1;++i){
		for(int j=0;j<av_nums.size();++j){
			int un = av_nums[j];
			int nn = need_num[un-1];
			
			if(i-nn >= 0){
				if(i-nn==0 || dp[i-nn].size()>0){
					char a = ('0'+un);
					string tmp = dp[i-nn] ;
					tmp.push_back(a);
					if(dp[i].size() < tmp.size())
						dp[i] = tmp;
				}
			}
		}
	}
/*	for(int i=0;i<21;++i){
		cout <<dp[i] <<endl;
	}*/
	
	string res = dp[n];
	reverse(res.begin(),res.end());
	cout << res << endl;
	
	return 0;
}



Measured memory_bytes: 43648
"use strict";

function main(input) {
  input = input.trim().split("");
  const n = parseInt(input.pop());
  if (n == 2 || n == 4 || n == 5 || n == 7 || n == 9) {
    console.log("hon");
    return;
  }
  if (n == 0 || n == 1 || n == 6 || n == 8) {
    console.log("pon");
    return;
  }
  if (n == 3) {
    console.log("bon");
    return;
  }
}

main(require("fs").readFileSync("/dev/stdin", "utf-8"));


Measured memory_bytes: 29624
/**
 *　　　　　　  　　┏┓　　 　┏┓
 * 　　　　　  　　┏┛┗━━━━━━━┛┗━━━┓
 * 　　　　　  　　┃　　　　　　　┃ 　
 * 　　　　　  　　┃　　　━　　 　┃
 * 　　　　　  　　┃　＞　　　＜　┃
 * 　　　　　  　　┃　　　　　　　┃
 * 　　　　　  　　┃...　⌒　... 　┃
 * 　　　　　　  　┃              ┃
 * 　　　　　　  　┗━┓          ┏━┛
 * 　　　　　　　　　┃          ┃　Code is far away from bug with the animal protecting　　　　　　　　　　
 * 　　　　　　　　　┃          ┃   神兽保佑,代码无bug
 * 　　　　　　　　　┃          ┃　　　　　　　　　　　
 * 　　　　　　　　　┃          ┃  　　　　　　
 * 　　　　　　　　　┃          ┃
 * 　　　　　　　　　┃          ┃　　　　　　　　　　　
 * 　　　　　　　　　┃          ┗━━━┓
 * 　　　　　　　　　┃              ┣┓
 * 　　　　　　　　　┃              ┏┛
 * 　　　　　　　　　┗┓┓┏━━━━━━━━┳┓┏┛
 * 　　　　　　　　　　┃┫┫       ┃┫┫
 * 　　　　　　　　　　┗┻┛       ┗┻┛
 */ 
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<map>
#include<vector>
#include<bits/stdc++.h>
#define mem(a,b) memset(a,b,sizeof(a))
#define ll long long
#define inf 1000000000
#define maxn 1005
#define maxm 100005
#define eps 1e-10
#define for0(i,maxn) for(int i=1;i<=(maxn);++i)
#define for1(i,maxn) for(int i=1;i<=(maxn);++i)
#define for2(i,x,y) for(int i=(x);i<=(y);++i)
#define for3(i,x,y) for(int i=(x);i>=(y);--i)
#define mod 1000000007
using namespace std;
inline int read()
{
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9') {if(ch=='-') f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9') {x=10*x+ch-'0';ch=getchar();}
    return x*f;
}
int main()
{
    int n=read();
    int ans=0;
    for(int i=1;i<=n;++i) ans+=read();
    ans-=n;
    cout<<ans<<endl;
}

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

int main()
{
    int n, m;
    cin >> n >> m;

    vector<pair<int, int>> s(n);
    rep (i, n)
        cin >> s[i].first >> s[i].second;

    ll ans = 0;
    int index = 0, cnt = 0;
    sort(s.begin(), s.end());
    rep (i, m)
    {
        ++cnt;
        if (cnt > s[index].second)
        {
            index++;
            cnt = 1;
        }
        ans += s[index].first;
    }

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

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define P pair<int,int>
#define PI 3.141592653589793
const int INF = 1001001001;

int main() {
	int a, b;
	cin >> a >> b;
	cout << a * b << endl;
}




Measured memory_bytes: 3632
n = int(input())
h = list(map(int, input().split()))

max_step = 0
current_step = 0
for i in range(n - 1):
    if h[i] >= h[i + 1]:
        current_step += 1
        if current_step > max_step:
            max_step = current_step
    else:
        current_step = 0
print(max_step)


Measured memory_bytes: 14252
#include<bits/stdc++.h>
#define lld long long int
#define vec vector<lld>
#define pll pair<lld,lld>
#define pb push_back
#define ss second
#define ff first
#define mp make_pair
#define mod 1000000007
#define answer(x) cout<<endl<<"answer : "<<x<<endl<<endl;
#define op(x) cout<<x<<endl;
#define maxn 500005
#define messi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int main() {messi lld t=1;//cin>>t;
    while(t--)
    {
        lld n=0,m=0,k=0,i=0,j=0,p=0,q=0,x=0,y=0,z=0,ans=0,cnt=0,l=0,r=1,mid=0,lo=0,hi=0;string s;bool flag=false;
        cin>>n; lld a[n]; for(i=0;i<n;i++) cin>>a[i];
        lld dp[n];
        dp[n-1]=0;
        for(i=n-2;i>=0;i--)
            dp[i]=dp[i+1]+a[i+1];
        for(i=0;i<n;i++)
            cnt=(cnt%mod +(a[i]%mod * (dp[i]%mod)))%mod;
        cout<<cnt<<endl;
    }
	return 0;
}
/*  CODED BY:-
 ________________________________________
|            __        __                |
|  /\   /\  |__)  /\  |  \ |__| \ /  /\  |
| /~~\ /~~\ |  \ /~~\ |__/ |  |  |  /~~\ |
|________________________________________|

*/


Measured memory_bytes: 6780