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

int main(){
    int N,K; cin>>N>>K;
    vector<int> ene(N);
    for (int i=0; i<N; i++){
        cin >> ene[i];
    }
    sort(ene.begin(), ene.end());
    long long ans = 0;
    for (int j=0; j<N-K; j++){
        ans += ene[j];
    }
    cout << ans << endl;
}

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

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

#define FOR(k,m,n) for(ll (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<< #str << " " str<<endl

constexpr int INF = (1 << 30);
constexpr ll INFL = (1ll << 60);
constexpr ll MOD = 1000000007;// 10^9+7

int N;
vector<ll> A, B;
vector<pair<ll, ll>> diff;

//���C���֐�
int main()
{
	cin >> N;
	A.resize(N);
	B.resize(N);
	diff.resize(N);
	REP(i, N)cin >> A[i] >> B[i];
	REP(i, N)diff[i] = make_pair(A[i] + B[i], i);
	sort(diff.begin(), diff.end());
	reverse(diff.begin(), diff.end());

	ll tak = 0, ao = 0;
	REP(i, N)
	{
		auto p = diff[i];
		if(i % 2 == 0)tak += A[p.second];
		else ao += B[p.second];
	}
	cout << tak - ao << endl;
	//cerr << tak << " " << ao << endl;

	cin >> N;
	return 0;
}


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

using namespace std;
using ll = long long int;

const ll MOD = 1e9 + 7;

ll pow_fast(ll n, ll k) {
  if (k == 0) {
    return 1LL;
  }
  if (k == 1) {
    return n;
  }

  if (k % 2 == 0) {
    ll tmp = pow_fast(n, k / 2);
    return tmp * tmp % MOD;
  } else {
    ll tmp = pow_fast(n, (k - 1) / 2);
    tmp *= tmp;
    tmp %= MOD;
    return tmp * n % MOD;
  }
}

template <typename T>
class stack {
 private:
  vector<T> _vec;

 public:
  stack(){};

  void push(T n) {
    _vec.push_back(n);
    return;
  }

  void pop() {
    if (this->empty()) {
      return;
    }
    _vec.erase(_vec.end() - 1);
    _vec.shrink_to_fit();
    return;
  }

  size_t size() { return _vec.size(); }

  T top() { return _vec[this->size() - 1]; }
  bool empty() { return _vec.empty(); }
};

int main() {
  ll W, A, B;
  cin >> W >> A >> B;

  if (A + W >= B && A <= B) {
    cout << 0 << endl;
  } else {
    cout << min(abs(B - A - W), abs(A - B - W)) << endl;
  }
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
#define LL long long
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPA(i,n) for(int i=1;i<(n);++i)
#define foreach(i, n) for(auto &i:(n))
#define PII pair<int,int>
#define PLI pair<long long, int>
#define PLL pair<long long, long long>
#define PDD pair<double, double>
#define MOD ((int)1e9 + 7)
#define INF ((int)1e9)
#define INFLL ((LL)1e18)
#define ALL(x) (x).begin(),(x).end()
#define ctoi(x) (x - 'a') 
#define CTOI(x) (x - 'A')
#define BIT(x) (1 << (x))
using namespace std;

LL modinv(LL a){
    LL b = MOD, u = 1, v = 0;
    while(b){
        LL t = a / b;
        a -= t * b;swap(a, b);
        u -= t * v;swap(u, v);
    }
    u%=MOD;
    if(u < 0) u += MOD;
    return u;

}

LL exp(LL a, LL b){
    LL sum = a;
    LL res = 1;
    while(b){
        if(b&1){
            res = (res * sum)%MOD;
        }
        sum = (sum * sum) % MOD;
        b>>=1;
    }
    return res;
}

int N, M;
vector<vector<int> > game;

int func(int place){
    if(place==N+1){
        return 1;
    }
    int won=0;
    int lose=0;
    vector<int> non;
    REPA(i, N+1){
        if(i==place)continue;
        if(game[place][i]==-1){
            ++lose;
        }else if(game[place][i]==1){
            ++won;
        }else{
            non.push_back(i);
        }
    }
    if(won>N/2||lose>N/2)return 0;
    vector<int> lw;
    REP(i, N/2-lose)lw.push_back(-1);
    REP(i, N/2-won)lw.push_back(1);
    int res = 0;
    do{
        REP(i, non.size()){
            game[place][non[i]]=lw[i];
            game[non[i]][place]=-lw[i];
        }
        res += func(place+1);
        REP(i, non.size()){
            game[place][non[i]]=0;
            game[non[i]][place]=0;
        }
    }while(next_permutation(ALL(lw)));
    return res;
}

int main(){
    while(cin>>N&&N){
        cin>>M;
        game.assign(N+1, vector<int>(N+1, 0));
        REP(i, M){
            int a, b;
            cin >> a >> b;
            game[a][b]=1;
            game[b][a]=-1;
        }
        cout << func(1) << endl;
    }
    return 0;
}



Measured memory_bytes: 3156
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <functional>
#include <stdio.h>
#include <string.h>
#include <math.h>
using namespace std;

int a[300000];
int64_t sum[100001];

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

    for (int i = 0; i < n * 3; i += 3) {
        scanf("%d%d%d", a + i, a + i + 1, a + i + 2);
    }

    priority_queue<int, vector<int>, greater<>> q0;
    int64_t s0 = 0;
    for (int i = 0; i < n; i++) {
        q0.push(a[i]);
        s0 += a[i];
    }
    sum[0] = s0;
    for (int k = n; k < n * 2; k++) {
        int c = a[k] - q0.top();
        if (c > 0) {
            s0 += c;
            q0.pop();
            q0.push(a[k]);
        }
        sum[k - n + 1] = s0;
    }

    priority_queue<int> q1;
    int64_t s1 = 0;
    for (int i = n * 2; i < n * 3; i++) {
        q1.push(a[i]);
        s1 += a[i];
    }
    int64_t r = sum[n] - s1;
    for (int k = n * 2 - 1; k >= n; k--) {
        int c = a[k] - q1.top();
        if (c < 0) {
            s1 += c;
            q1.pop();
            q1.push(a[k]);
        }
        int64_t d = sum[k - n] - s1;
        if (d > r) r = d;
    }
    cout << r << endl;
    quick_exit(0);

    return 0;
}

Measured memory_bytes: 3320
#include<stdio.h>
#include<math.h>
int main()
{
	double x,h;
	double b;
	while(1){
		scanf("%lf%lf",&x,&h);
		if(x==0&&h==0){
			break;
		}

		b=sqrt(h*h+(x/2)*(x/2))*x/2;
		printf("%5lf\n",x*x+(b*4));
	}
	return 0;
}

Measured memory_bytes: 648
import java.util.*;

class Main {
    public static void main(String[] args) throws Exception{
        Scanner input = new Scanner(System.in);
        int x = input.nextInt();
        int y = input.nextInt();
        int z = input.nextInt();
        int[] ar = {x,y,z};
        Arrays.sort(ar);
        System.out.println(ar[0]+" "+ar[1]+" "+ar[2]);
    }
}

Measured memory_bytes: 26192
#include<bits/stdc++.h>
using namespace std;
 
#define EPS (1e-10)
#define equals(a,b) ( fabs(a-b) < EPS )
#define PI 3.141592653589793238

// COUNTER CLOCKWISE
static const int CCW_COUNTER_CLOCKWISE = 1;
static const int CCW_CLOCKWISE = -1;
static const int CCW_ONLINE_BACK = 2;
static const int CCW_ONLINE_FRONT = -2;
static const int CCW_ON_SEGMENT = 0;

//Intersect Circle and Circle
static const int ICC_SEPARATE = 4;
static const int ICC_CIRCUMSCRIBE = 3;
static const int ICC_INTERSECT = 2;
static const int ICC_INSCRIBE = 1;
static const int ICC_CONTAIN = 0;

struct point{
	double x,y;
	//construct
	point() {} 
	point(double x,double y):x(x),y(y){}
	//演算子
	point operator + (point p) { return point(x+p.x,y+p.y); }
	point operator - (point p) { return point(x-p.x,y-p.y); }
	point operator * (double k) { return point(x*k,y*k); }
	point operator / (double k) { return point(x/k,y/k); }
	point operator / (point p) { return point( (x*p.x + y*p.y)/p.norm()  , (-x*p.y + y*p.x)/p.norm() ) ; }
	bool operator < (point p) { return x!=p.x ? x<p.x : y<p.y; }
	bool operator == (point p) { return equals(x,p.x) && equals(y,p.y) ; }
	//function
	double arg() { return atan2(y,x) ; }
	double norm(){return x*x+y*y; }
	double abs() { return sqrt(norm() ) ;}
	double dot(point p) { return p.x*x + p.y*y; }
	double cross(point p) { return x*p.y - y*p.x; }

	//input output
	void input(){cin>>x>>y;}
	void print(){cout<<x<<' '<<y<<endl;};

};

bool sort_x(point a,point b){
	return a.x!=b.x?a.x<b.x:a.y<b.y ;
}
bool sort_y(point a,point b){
	return a.y!=b.y?a.y<b.y:a.x<b.x ;
}

typedef vector<point> polygon;

struct segment{
	point s,t;
	segment() {}
	segment(point s,point t) : s(s),t(t){}
	void input(){s.input(),t.input(); }
};
typedef segment line;

struct circle{
	point c;
	double r;
	circle() {}
	circle(point c,double r) : c(c),r(r){}

};

double norm(point a){	return a.norm(); }
double abs(point a){ return a.abs(); }
double dot(point a,point b) { return a.x*b.x + a.y*b.y ; }
double cross(point a,point b) { return a.x * b.y - a.y * b.x ; }

point orth(point p){ return point(-p.y,p.x); }

//isOrthgonal 垂直
bool isOrthogonal(point a,point b) { return equals(dot(a,b), 0.0 ) ; }
bool isOrthogonal(point a,point b,point c,point d) { return isOrthogonal(a-b,c-d) ; }
bool isOrthogonal(line l1,line l2 ){ return isOrthogonal(l1.t-l1.s,l2.t-l2.s); }
//isParallel 平行
bool isParallel(point a,point b) { return equals(cross(a,b), 0.0) ; }
bool isParallel(point a,point b,point c,point d) { return isParallel(a-b,c-d); }
bool isParallel(line l1,line l2) { return isParallel(l1.t-l1.s,l2.t-l2.s) ; }

point project(line l,point p){
	point base = l.t-l.s;
	double r = dot(p-l.s,base) / norm(base) ;
	return l.s + base*r;
}
point reflect(line l,point p){
	return p + (project(l,p) - p) *2.0;
}




int main(){
    	line l;
	l.input();
	int q;
	cin>>q;
	for(int i=0;i<q;i++){
		point a;
		a.input();
		point b = project(l,a);
		printf("%0.10lf %0.10lf\n",b.x,b.y);
	}
	return 0;
}



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

const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    int x;
    cin >> x;
    if (x == 0) cout << 1 << endl;
    else cout << 0 << endl;
    return 0;
}


Measured memory_bytes: 3580
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <cstdio>
using namespace std;
#define F first
#define S second
typedef long long ll;
typedef pair<ll,ll> P;
int n,m,k;
int p[100005],c[100005];
int find(int x){
    if(p[x]==x)return x;
    else return p[x]=find(p[x]);
}
int main(void){
    cin>>n>>m>>k;
    for(int i=1;i<=n;i++)p[i]=i;
    for(int i=1;i<=k;i++){
        int x,a,b;
        cin>>x>>a>>b;
        if(x==1){
            a=find(a);
            b=find(b);
            if(c[a]==0&&c[b]==0)p[a]=b;
            else if(c[a]!=0&&c[b]==0)p[b]=a;
            else if(c[a]==0&&c[b]!=0)p[a]=b;
            else if(c[a]==c[b])p[a]=b;
            else{
                cout<<i<<endl;
                return 0;
            }
        }else{
            a=find(a);
            if(c[a]==0)c[a]=b;
            else if(c[a]!=b){
                cout<<i<<endl;
                return 0;
            }
        }
    }
    cout<<0<<endl;
    return 0;
}


Measured memory_bytes: 3872
n = int(input())
a_list = list(map(int, input().split()))
a_list.sort()
max_num = max(a_list)
a_list.pop()
n_half = max_num / 2
a_list_dif = [abs(i - n_half) for i in a_list]
min_idx = 0
min_val = 10 ** 10
for idx, v in enumerate(a_list_dif):
    if v < min_val:
        min_idx = idx
        min_val = v
print(max_num, a_list[min_idx])


Measured memory_bytes: 14052
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>
#include <sstream>
#include <stack>
#include <time.h>
#include <vector>
#include <complex>
#include <map>
#include <set>
#include <iomanip>
#include <math.h>
#include <stdlib.h>
#include <list>
#include <utility>
#include <memory>
#include <cstring>
#include <fstream>
#include <numeric>
#include <assert.h>
#include <bits/stdc++.h>
using namespace std;
string s,t;
set <int> g[200];
set <int> p[200];
int main(){
	cin>>s>>t;
	for (int i=0;i<s.size();i++){
		g[s[i]].insert(t[i]);
		p[t[i]].insert(s[i]);
	} 
	for (int i='a';i<='z';i++){
		if (g[i].size()>1){
			cout<<"No";
			return 0;
		}
		if (p[i].size()>1){
			cout<<"No";
			return 0;
		}
	}
	cout<<"Yes";
	return 0;
}

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

public class Main {
    public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt(); //整数の数
    int[] x = new int[n];
    for (int i=0; i<n; i++) { //整数を読み込む
        x[i] = sc.nextInt();
    }
    int count = selectSort(x);
    out(x,count);
    }
    /**
     * 選択ソート
     */
    public static int selectSort(int[] x) {
        int count = 0;
        for(int i=0; i<x.length; i++) {
            int minj = i; //最小値の位置
            for(int j=i; j<x.length; j++) {
                //最小値の位置を見つける
                if(x[j]<x[minj]) minj = j;
            }
            //未ソートの先頭が最小値でない場合、最小値を先頭と入れ替える
            if(i != minj) {
                int a = x[i];
                x[i] = x[minj];
                x[minj] = a;
                count++;
            }
        }
        return count;
    }
    /**
     * 出力
     */
    public static void out(int[] x, int count) {
        for (int i=0; i<x.length-1; i++) {
            System.out.print(x[i]+" ");
        }
        System.out.print(x[x.length-1]);
        System.out.println();
        System.out.println(count);
    }
}



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

int main() {
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);

  int btn = 1, ans = 0;

  for (int i = 0; i < N; i++) {
    btn = A.at(btn - 1), ans++;
    if (btn == 2) {
      cout << ans << "\n";
      return 0;
    }
  }

  cout << -1 << "\n";
}

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

#define INF 1 << 29
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)

using namespace std;

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

void gen_sosuu(int sosuu[]){
  REP(i,100010){
    sosuu[i] = true;
  }
  sosuu[0] = false;
  sosuu[1] = false;
  sosuu[2] = true;
  FOR(i,2,sqrt(100000)+1){
    if(sosuu[i] == false) continue;
    for(int j = 2; i*j<=100000;j++){
      //printf("%d %d %d\n",i*j,i,j);
      sosuu[i*j] =false;
    }
  }
}
string a,b,c;

int main(){
  cin >> a >> b >> c;
  int k = 'A' - 'a';
  printf("%c%c%c\n",a[0]+k,b[0]+k,c[0]+k);
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000


//void CoutingSort(int [], int n);

int main(){
     int *A, *B;
    int  n,i, j;
    int C[VMAX+1];
    scanf("%d", &n);

    A = malloc(sizeof(int)*n+1);
    B = malloc(sizeof(int)*n+1);



    for ( i = 0; i <= VMAX; i++ ) C[i] = 0;

    for(i=0; i<n; i++){
        scanf("%d", &A[i+1]);
         C[A[i+1]]++;
    }

    for(i=1;i<=VMAX; i++){
        C[i] = C[i] + C[i-1];
    }

    for(j=n; j>0; j--){
        B[C[A[j]]] = A[j];
        C[A[j]]--;
    }



  //  CoutingSort(A, n);

    for( i=1; i<=n; i++){
        if(i>1) printf(" ");
        printf("%d",B[i]);
    }
    printf("\n");

    return 0;
}



Measured memory_bytes: 17412
import math
n = int(input())

ans = 0

for i in range(1, n+1):
    if i % 2 == 0:
        continue
    num = 0
    for j in range(1, math.floor(i / 3) + 1):
        if i % j == 0:
            num += 1
    else:
        if num == 7:
            ans += 1

print(ans)


Measured memory_bytes: 3064
N=int(input())
r=[0]*N
from itertools import product
for x,y,z in product(range(1,100),repeat=3):
    p=x*x+y*y+z*z+x*y+y*z+z*x
    if 0<p<=N:
        r[p-1]+=1
print(*r,sep='\n')

Measured memory_bytes: 9424
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define substr(s,f,t) (s.substr(f-1,t-f+1))
#define ALL(a) (a).begin(),(a).end()
#define Yes(hoge) cout<<((hoge)?"Yes":"No")<<endl;
#define YES(hoge) cout<<((hoge)?"YES":"NO")<<endl;
using namespace std;
struct Grid{ll x,y,t;};
struct Edge{ll to,cost;};
struct Graph{vector<vector<Edge>>E;int V;
  const ll Inf = llINF;const int MAX_V=201010;vector<ll>d;
  Graph(int n):E(n){d.resize(MAX_V);E.resize(n);V=n;}
  void init(){for(int i=0;i<MAX_V;i++)d[i]=Inf;}
  void add_edge(ll from,ll to,ll cost){E[from].pb({to,cost});}
};
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;cin>>n;
  ll ans=0;
  ll mae=0;
  for(int i=0;i<n;i++){
    ll num;cin>>num;
    ans+=(num+mae)/2;
    if(num>0&&(num+mae)%2)mae=1;
    else mae=0;
    
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
  val input1 = readLine()!!.toInt()
  val num = readLine()!!.split(" ").map(String::toInt)
  val map = HashMap<Int, Int?>()
  for (i in 0 until input1 - 1) {
    var workVal = map[num[i]]
    if (workVal == null) {
      map[num[i]] = 1
    } else {
      map[num[i]] = workVal + 1
    }
  }

  for (i in 1..input1) {
    val resVal = map[i]
    if (resVal == null) {
      println(0)
    } else {
      println(resVal)
    }
  }

}


Measured memory_bytes: 79328
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <unordered_set>
#include <unordered_map>

using namespace std;

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

const ll mod = 1000000007;

struct unionfind {
  vector<int> group;

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

  int root(int x) {
    if (group[x] == x) return x;
    return group[x] = root(group[x]);
  }

  void unite(int x, int y) {
    int rx = root(x);
    int ry = root(y);
    if (rx == ry) return;
    group[rx] = ry;
  }

  bool same(int x, int y) {
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
};

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

  int n, m, k;
  cin >> n >> m >> k;
  vector<vector<int> > follow(n);
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    follow[a-1].push_back(b-1);
    follow[b-1].push_back(a-1);
  }
  vector<vector<int> > block(n);
  for (int i = 0; i < k; i++) {
    int a, b;
    cin >> a >> b;
    block[a-1].push_back(b-1);
    block[b-1].push_back(a-1);
  }

  unionfind uf(n);
  vector<bool> visited(n);
  for (int i = 0; i < n; i++) {
    if (!visited[i]) {
      queue<int> que;
      que.push(i);
      while (!que.empty()) {
        auto now = que.front();
        que.pop();
        if (visited[now]) continue;
        visited[now] = true;
        uf.unite(i, now);
        for (auto &x: follow[now]) {
          if (!visited[x]) que.push(x);
        }
      }
    }
  }

  unordered_map<int, int> groupCount;
  for (int i = 0; i < n; i++) groupCount[uf.root(i)]++;

  vector<int> ans(n);
  for (int i = 0; i < n; i++) {
    ans[i] = groupCount[uf.root(i)] - 1;
    unordered_set<int> excluded;
    for (auto &x: follow[i]) excluded.insert(x);
    for (auto &x: block[i]) {
      if (uf.root(x) == uf.root(i)) excluded.insert(x);
    }
    ans[i] -= excluded.size();
  }

  for (auto &x: ans) cout << x << " ";
  cout << endl;

  return 0;
}


Measured memory_bytes: 16656
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define double long double
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mod 1000000007
#define endl "\n"
 
 
int pow1(int n, int p)
{
	if(p==0)	return 1;
	int x=pow1(n, p/2);
	x=(x*x)%mod;
	if(p%2==0)
		return x;
	else
		return (x*n)%mod;
}
 
int32_t main()
{
	fast;

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

	int a=max(h, w);

	int b=(n+a-1)/a;
	cout<<b<<endl;

	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
using namespace std;
int main()
{
	char s[26];
	int n,flg,i,j;
	scanf("%s",s);
	n=strlen(s);
	flg=0;
	for(i=0;i<n-1;i++){
		for(j=i+1;j<n;j++){
			if(s[i]==s[j]){
				flg=1;
				break;
			}
		}
		if(flg==1)	break;
	}
	if(flg==0)	printf("yes\n");
	else	printf("no\n");
	return 0;
}

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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main(){
	ll n;
	cin >> n;
	ll a[n], sum=0;
	for(int i=0; i<n; i++){
		cin >> a[i];
		sum+=a[i];
	}
	
	if(sum%(n*(n+1)/2)!=0){
		cout << "NO" << endl;
		return 0;
	}

	ll k=sum/(n*(n+1)/2), d[n];
	for(int i=0; i<n-1; i++) d[i]=a[i]-a[i+1];
	d[n-1]=a[n-1]-a[0];

	ll cnt=0;
	for(int i=0; i<n; i++){
		if((d[i]+k)%n!=0 || d[i]+k<0){
			cout << "NO" << endl;
			return 0;
		}else cnt+=(d[i]+k)/n;
	}
	if(cnt==k) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;
int n,m;
bool vi[100];
vector<vector<int>> g;
int ans = 0;

bool check() {
    bool ret = true;
    REP(i,n) if (!vi[i]) ret = false;
    return ret;
}

void dfs(int x) {
    if (vi[x]) return;
    vi[x] = true;
    if (check()) ++ans;

    for (auto&& e: g[x]) {
        dfs(e);
    }
    vi[x] = false;
    return;
}

int main(int argc, char const *argv[]) {
    cin >> n >> m;
    g.resize(n);
    REP(i,m) {
        int a,b;
        cin >> a >> b; --a,--b;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    REP(i,100) vi[i] = false;
    dfs(0);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<queue>
#include<algorithm>
#include<vector>
#include<unordered_map>
#define p pair<int,int>
#define P pair<p,int>
using namespace std;

p x[1000000];
int g[1000][1000];
int main() {
    unordered_map<int, bool>oq;
	queue<P>Q;
	int a, b;
	cin >> a >> b;
	char d[1000];
	for (int c = 0; c < a; c++) {
		scanf("%s", d);
		for (int e = 0; e < b; e++) {
			if (d[e] == '.')g[c][e] = 0;
			else g[c][e] = d[e] - '0';
		}
	}
	int k = 0;
	for (int f = 1; f < a-1; f++) {
		for (int h = 1; h < b-1; h++) {
			if (g[f][h]) {
				int sum = 0;
				for (int i = -1; i < 2; i++) {
					for (int j = -1; j < 2; j++) {
						if (g[f + i][h + j])sum++;
					}
				}
				if (9 - sum >= g[f][h]&&!oq[f*10000+h]) {
					Q.push(P(p(f, h), 1));
					oq[f*10000+h] = true;
					x[k] = p(f, h);
					k++;
				}
			}
		}
	}
	for (int t = 0; t < k; t++)g[x[t].first][x[t].second] = 0;
	int MAX = 0;
	int w = 0, now = 0;
	while (Q.size()) {
		P s = Q.front();
		Q.pop();
		if (s.second != now) {
			for (int t = 0; t < w; t++) { g[x[t].first][x[t].second] = 0; }
			w = 0;
			now = s.second;
		}
		MAX = max(MAX, s.second);
		for (int i = -1; i < 2; i++) {
			for (int j = -1; j < 2; j++) {
				if (s.first.first + i>=1&& s.first.first + i<a-1&&s.first.second + j>=1&& s.first.second + j<b-1&&g[s.first.first + i][s.first.second + j]) {
					int sum = 0;
					for (int n = -1; n < 2; n++) {
						for (int m = -1; m < 2; m++) {
							if (g[s.first.first + i+n][s.first.second+j+m])sum++;
						}
					}
					if (9 - sum >= g[s.first.first + i][s.first.second + j]&&!oq[(s.first.first + i)*10000+ s.first.second + j]) {
						Q.push(P(p(s.first.first + i, s.first.second + j), s.second + 1)); 
						oq[(s.first.first + i) * 10000 + s.first.second + j] = true;
						x[w] = p(s.first.first + i, s.first.second + j);
						w++;
					}
				}
			}
		}
	}
	cout << MAX << endl;
}

Measured memory_bytes: 46252
n = int(input()) 
p = list(int(_) for _ in input().split()) 

num = 0
for i in range(0,n-2):
    if p[i] < p[i+1] < p[i+2] or p[i] > p[i+1] > p[i+2]:
        num += 1
print(num)

Measured memory_bytes: 3060
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <utility>
#include <vector>
#include <map>
#include <unordered_map>
#include <cstdlib>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
using ll = long long;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

template <class T> void swap(T& a, T& b) { T t = std::move(a); a = std::move(b); b = std::move(t); }

int main(void)
{
    ll N, M, i, a[200001], b[200001], j, k, judge=0;

    cin >> N >> M;

    vector<ll> v1(N), v2(N);

    for(i=1; i<=M; i++){
        cin >> a[i] >> b[i];

        if(a[i] == 1){
            v1.at(b[i]) = 1;
        }

        if(b[i] == N){
            v2.at(a[i]) = 1;
        }
    }

    for(i=2; i<=N-1; i++){
        if(v1.at(i)==1 && v2.at(i)==1){
            judge = 1;
            break;
        }
    }

    if(judge==1) cout << "POSSIBLE" << endl;
    else cout << "IMPOSSIBLE" << endl;

    return 0;
}

Measured memory_bytes: 6528
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#define ll long long
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define vi vector<int>
#define vvi vector<vector<int>>
using namespace std;

class UnionFind {
private:
    vector<vector<int>> Graph;// {ID,Number,ParentID,Height}
public:
    void push(int x) {
        int i = Graph.size();
        Graph.push_back({ i,x,i,1 });
    }
    void unite(int x, int y) {
        int hx = Graph[root(x)][3];
        int hy = Graph[root(y)][3];
        if (hx < hy) {
            Graph[root(x)][2] = root(y);
            flatten(x, root(y));
        }
        else if(hx == hy){
            Graph[root(y)][2] = root(x);
            Graph[root(x)][3]++;
            flatten(y, root(x));
        }
        else {
            Graph[root(y)][2] = root(x);
            flatten(y, root(x));
        }
    }
    bool same(int x, int y) {
        return root(x) == root(y);
    }

    void flatten(int x, int rootid) {
        int parentid = Graph[x][0];
        while (Graph[parentid][0] != Graph[parentid][2]) {
            Graph[parentid][2] = rootid;
            int next = Graph[parentid][2];
            parentid = next;
        }
    }
    int root(int x) {
        int parentid = Graph[x][0];
        while (Graph[parentid][0] != Graph[parentid][2]) {
            int next = Graph[parentid][2];
            parentid = next;
        }
       
        return parentid;
    }
};
int main() {
    int n, q; cin >> n >> q;
    UnionFind uf;
    for (int i = 0; i < n; i++) {
        uf.push(i);
    }
    for (int i = 0; i < q; i++) {
        int com, x, y; cin >> com >> x >> y;
        if (com == 0) {
            uf.unite(x, y);
        }
        if (com == 1) {
            cout << uf.same(x, y) << endl;
        }
    }
}


Measured memory_bytes: 3432
#include<iostream>
#include<vector>
#include<bitset>
#include<string>
#include<cmath>
#include<algorithm>
#include<stack>
#include<list>
#include<queue>
#include<map>
using namespace std;
#define rep(i,x) for(int i=0;i<x;i++)
#define re(i,x,y) for(int i=x;i<y;i++)
int INF=1e9;
const long long mod=1e9+7;
typedef long long ll;

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


Measured memory_bytes: 4424
#include<bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    typedef long double db;
    typedef pair<int,int> pii;
    typedef vector<int> vi;
    #define de(x) cout << #x << "=" << x << endl
    #define rep(i,a,b) for(int i=a;i<(b);++i)
    #define all(x) (x).begin(),(x).end()
    #define sz(x) (int)(x).size()
    #define mp make_pair
    #define pb push_back
    #define fi first
    #define se second
    #define lb(x) (x&-(x))
    const int N = 101010;
    char s1[200],s2[200];
    int s1len,s2len;
    int judge()
    {

        int minlen=min(s1len,s2len);
        for(int i=0;i<minlen;i++)
        {
            if(s1[i]<s2[i])
            {
                return 1;
            }
            else if(s1[i]==s2[i])
            continue;
            else return 0;  
        }
        if(s1len<s2len)
        return 1;
        else return 0;
    }

    bool cmp1(char a,char b)
    {
        return a<b;
    }

    bool cmp2(char a,char b)
    {
        return a>b;
    }
    int main(){
        scanf("%s",s1);
        scanf("%s",s2); 
        s1len=strlen(s1);
        s2len=strlen(s2);   
        sort(s1,s1+s1len,cmp1);
        sort(s2,s2+s2len,cmp2);
    //  printf("%s\n",s1);
    //  printf("%s\n",s2);
        if(judge()) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;

        return 0;
    }

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

int main()
{
	int a,b,c;
	cin >> a >> b >> c;
	int M = max(a,max(b,c));
	int sum = (M-a)+(M-b)+(M-c);
	if (sum % 2 == 1) sum += 3;
	cout << sum/2 << endl;
	return 0;
}

Measured memory_bytes: 3540
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

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; }
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 5e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//
ll S[505][505];

int main() {
    init();
    ll N, M, Q;
    cin >> N >> M >> Q;
    rep(i,M){
        ll l, r;
        cin >> l >> r;
        S[l - 1][r - 1]++;
    }

    rep(i, N) rep(j, N) S[i][j + 1] += S[i][j];

    repr(i, N - 1) rep(j, N) S[i][j] += S[i + 1][j];

    rep(q,Q){
        ll a, b;
        cin >> a >> b;
        cout << S[a - 1][b - 1] << '\n';
    }
}

Measured memory_bytes: 2944
A,B,C,D,E,F=map(int,input().split())
max_=0
ans=[100*A,0]
for i in range(F//(100*A)+1):
    for j in range((F-100*A*i)//(100*B)+1):
        for k in range((F-100*A*i-100*B*j)//C+1):
            a=E/(100+E)
            bunshi=100*A*i+100*B*j+C*k
            l=min((F-bunshi)//D,(a*bunshi-C*k)//((1-a)*D))
            if bunshi+D*l==0 or l<0:
                pass
            elif bunshi+D*l <= F and (C*k+D*l)*(100+E)<=E*(bunshi+D*l):
                if max_*(bunshi+D*l)<(C*k+D*l):
                    max_ = (C*k+D*l)/(bunshi+D*l)
                    ans = [bunshi+D*l,C*k+D*l]
            if bunshi+D*(l+1)==0 or l<0:
                pass
            elif bunshi+D*(l+1) <= F and (C*k+D*(l+1))*(100+E)<=E*(bunshi+D*(l+1)):
                if max_*(bunshi+D*(l+1))<(C*k+D*(l+1)):
                    max_ = (C*k+D*(l+1))/(bunshi+D*(l+1))
                    ans = [bunshi+D*(l+1),C*k+D*(l+1)]   
print(int(ans[0]),int(ans[1]))

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(a) sort(a.begin(), a.end())
const int INF = 1<<30;
const ll MOD = 1000000007;

int main(void) {

    string s; int k; cin >> k >> s;
    if (s.size() <= k) cout << s << endl;
    else {
        string subs = s.substr(0, k);
        cout << subs << "..." << endl;
    }


    return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <stack>

using namespace std;

struct set { int i, sum, depth; };

int n, s, cnt;
int a[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};

void dfs(int i, int sum, int depth) {
    stack<set> S;
    S.push(set{i, sum, depth});

    while (!S.empty()) {
        set u = S.top();
        if (u.depth == n && u.sum == s) { cnt++; }

        if (u.i == 10 && u.depth == 0 && u.sum == 0) { break; }

        if (u.i < 10 && u.depth < n) {
            S.push(set{u.i + 1, u.sum, u.depth});
            S.push(set{u.i + 1, u.sum + a[u.i], u.depth + 1});
        }
        else if (u.i == 10) {
            int tmp = u.depth;
            while (S.top().depth == tmp) { S.pop(); }
        }
        else { S.pop(); }
    }
}

int main() {
    while (cin >> n >> s) {
        if (!n && !s) { break; }
        cnt = 0;
        dfs(0, 0, 0);
        cout << cnt << endl;
    }
    return 0;
}

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

    static class Knapsack01 {

        int capacity;
        int n;
        int[] cost;
        int[] value;
        int[][] dp;

        public Knapsack01(int n, int capacity, int[] cost, int[] value) {
            this.n = n;
            this.capacity = capacity;
            this.cost = cost;
            this.value = value;
        }

        int solve() {
            dp = new int[n + 1][];
            for (int i = 0; i < n + 1; i++) {
                dp[i] = new int[capacity + 1];
                for (int j = 0; j < capacity + 1; j++) {
                    dp[i][j] = -1;
                }
            }
            return computeMemoization(0, capacity);
        }

        int computeMemoization(int itemIdx, int weight) {
            if (dp[itemIdx][weight] != -1) {
                return dp[itemIdx][weight];
            }
            int res;
            if (itemIdx == n) {
                res = 0;
            } else if (weight < cost[itemIdx]) {
                res = computeMemoization(itemIdx + 1, weight);
            } else {
                res = Math.max(computeMemoization(itemIdx + 1, weight),
                        computeMemoization(itemIdx + 1, weight - cost[itemIdx]) + value[itemIdx]);
            }
            dp[itemIdx][weight] = res;
            return res;
        }
    }

    static Scanner in = new Scanner(System.in);

    static Knapsack01 readCase() {
        while (in.hasNext()) {
            int n = in.nextInt();
            int capacity = in.nextInt();
            int[] cost = new int[n];
            int[] value = new int[n];
            for (int i = 0; i < n; i++) {
                value[i] = in.nextInt();
                cost[i] = in.nextInt();
            }
            Knapsack01 knapsack01 = new Knapsack01(n, capacity, cost, value);
            return knapsack01;
        }
        return null;
    }

    public static void main(String[] args) {
        Knapsack01 knapsack01 = null;
        while ((knapsack01 = readCase()) != null) {
            System.out.println(knapsack01.solve());
        }
    }

}

Measured memory_bytes: 31888
import java.util.Scanner;
import java.lang.Long;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        int n = S.length()-1;
        long ans = 0;
        for (int mask = 0; mask < 1<<n; mask++) {
            int pre = 0;
            for (int i = 0; i < n; i++) {
                if ( (mask >> i & 1) == 1) {
                    ans += Long.parseLong(S.substring(pre,i+1));
                    pre = i+1;
                }
            }
            ans += Long.parseLong(S.substring(pre,n+1));
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 10196
#include <iostream>
#include<string>
using namespace std;
int main(void){
    int a,b,cnt=0,flag=0;
    string s;
    cin >>a>>b>>s;
    for(int i=0;i<s.size();i++){
        if(s[i] == '-' && i == a) flag=1;
        else if(s[i]=='-') cnt++;
    }
    if(flag && cnt == 0) cout<<"Yes";
    else cout<<"No";
    
    
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace  std;
const int NIL = -1;

void fnMaxHeapifyUp(vector<int>& rvnPrtyHeap, int nx)
{
  int nParnt = nx / 2;
  int nLrge = nx;

  if (nParnt > 0  &&
      rvnPrtyHeap[nParnt] < rvnPrtyHeap[nLrge])
  {
    swap(rvnPrtyHeap[nParnt], rvnPrtyHeap[nLrge]);
    fnMaxHeapifyUp(rvnPrtyHeap, nParnt);
  }
}

void fnMaxHeapifyDown(vector<int>& rvnPrtyHeap, int nx)
{
  int nLeft = nx * 2;
  int nRigt = nLeft + 1;
  int nLrge = nx;

  if (nLeft < rvnPrtyHeap.size()  &&
      rvnPrtyHeap[nLrge] < rvnPrtyHeap[nLeft])  
    nLrge = nLeft;
  if (nRigt < rvnPrtyHeap.size()  &&
      rvnPrtyHeap[nLrge] < rvnPrtyHeap[nRigt])
    nLrge = nRigt;

  swap(rvnPrtyHeap[nx], rvnPrtyHeap[nLrge]);
  if (nx != nLrge)
    fnMaxHeapifyDown(rvnPrtyHeap, nLrge);
}

void fnPriorityQueue(vector<int>& rvnPrtyHeap)
{
  rvnPrtyHeap.push_back(NIL);
  string sCmd;
  while (cin >> sCmd && sCmd != "end")
  {
    if (sCmd[0] == 'i')
    {
      int nNo;
      cin >> nNo;
      rvnPrtyHeap.push_back(nNo);
      int nx = rvnPrtyHeap.size() - 1;
      fnMaxHeapifyUp(rvnPrtyHeap, nx);
    }
    else if (sCmd[0] == 'e')
    {
      if (rvnPrtyHeap[1] != NIL)
        cout << rvnPrtyHeap[1] << endl;

      rvnPrtyHeap[1] = NIL;
      fnMaxHeapifyDown(rvnPrtyHeap, 1);
    }
    else;
  }
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<int> vnPrtyHeap; 

  fnPriorityQueue(vnPrtyHeap);
  return 0;
}

Measured memory_bytes: 11248
n = int(input())
x = list(map(int, input()))

one_cnt = x.count(1)
mods = [one_cnt - 1, one_cnt + 1]
sms = [0, 0]

for i in range(2):
    if mods[i] == 0:
        continue

    for j, e in enumerate(x):
        sms[i] += pow(2, n - j - 1, mods[i]) * e
        sms[i] %= mods[i]

for i, e in enumerate(x):
    idx = 1 - e
    mod = mods[idx]
    sm = sms[idx]

    if mod == 0:
        print(0)
        continue

    sm_changed = sm + pow(2, n - i - 1, mod) * (-1) ** e
    sm_changed %= mod
    ans = 1
    while sm_changed:
        tmp = sm_changed
        cnt = 0
        while tmp:
            cnt += tmp & 1
            tmp >>= 1

        sm_changed %= cnt
        ans += 1

    print(ans)


Measured memory_bytes: 10896
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  
  int A=0;
  int B=0;
  
  vector<int> vec(N);
  
  for(int i=0;i<N;i++){
    cin >> vec[i];
  }
  
  sort(vec.begin(),vec.end());
  reverse(vec.begin(),vec.end());//大きい順に並べ替え
  
  for(int i=0;i<N;i++){
    if(i%2==0){
      A +=vec.at(i);
    }else{
      B +=vec.at(i);
    }
  }
  
  cout << A-B <<endl;
  
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <algorithm>
#include <cmath>
#include <iterator>
#include <numeric>
#include <iomanip>
#define FI first
#define SE second
#define EB emplace_back
#define REP(i, n) for (ll i = 0; i < n; i++)
#define INF 1100000000
#define LLINF 1100000000000000000LL
#define Decimal fixed << setprecision(20)
#define ALL(c) c.begin(),c.end()
#define SHOWVEC(v, sz) for(int i = 0; i < sz; i++) cerr << v[i] << ' '; cerr << endl;
#define SHOWX(x) cerr << #x << ": " << x << endl;
#define SHOWP(p) cerr << "[" << p.first << ',' << p.second << "]";

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

int main()
{
  int N, K; cin >> N >> K;
  vector<int> h(N);
  REP(i, N) cin >> h[i];
  int ans = 0;
  REP(i, N) {
    if (h[i] >= K) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
n,k = map(int,input().split())
a = []
for i in range(n):
    a.append(list(map(int,input().split())))
a.sort(key = lambda x:x[0])
i = 0
while(1):
    k -= a[i][1]
    if k < 1:
        print(a[i][0])
        exit()
    i += 1

Measured memory_bytes: 29508
#include <stdio.h>
#define getchar() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1<<22, stdin), p1 == p2) ? EOF : *p1++)
char buf[(1 << 22)], *p1 = buf, *p2 = buf;
inline int read() {
    char c = getchar(); int x = 0, f = 1;
    while(c < '0' || c > '9') {if(c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
    return x * f;
}
int ab[100001];
int main(int argc, char *argv[])
{
	int n = read(),m = read();
	for (int i = 0; i < m; i++) {
		int a = read(),b = read();
		if (ab[b] < a) {ab[b] = a;}
	}
	int ans = 0;
	int k = 1;
	for (int i = 1; i <= n; i++) {
		if (k <= ab[i]) {
			k = i;
			++ans;
		}
	}
	printf("%d\n", ans);
	return 0;
}

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

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

int main(){
	int A, B, C, D;
	cin >> A >> B >> C >> D;
	while (true) {
		C -= B;
		if (C <= 0) {
			cout << "Yes" << endl;
			break;
		}
		A -= D;
		if (A <= 0) {
			cout << "No" << endl;
			break;
		}
	}
}

Measured memory_bytes: 3596
N = input()[::-1]
L = len(N)
dp = [[0]*2 for _ in range(L+1)]
dp[0][1] = 10**18

for i in range(L):
    n = int(N[i])
    dp[i+1][0] = min(dp[i][0]+n, dp[i][1]+n+1)
    dp[i+1][1] = min(dp[i][0]+10-n, dp[i][1]+10-n-1)

print(min(dp[L][0], dp[L][1]+1))

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

const int N=1e5+5;
int n,head[N],cnt,du[N],rec[N],ans;
struct edge
{
	int nxt,to;
}e[N<<1];

inline void add(int u,int v)
{
	e[++cnt]=(edge){head[u],v};
	head[u]=cnt;
}

void dfs(int u,int fa,int col)
{
	int num=1;
	for(int i=head[u];i;i=e[i].nxt)
	{
		int v=e[i].to;
		if(v==fa) continue;
		if(num==col) num++;
		rec[i]=num;
		dfs(v,u,num);
		num++;
	}
}

int main()
{
	cin>>n;
	for(int i=1,a,b;i<n;i++)
	{
		scanf("%d%d",&a,&b);
		add(a,b);
		add(b,a);
		du[a]++;du[b]++;
		if(du[a]>ans) ans=du[a];
		if(du[b]>ans) ans=du[b];
	}
	dfs(1,0,0);
	cout<<ans<<'\n';
	for(int i=1;i<=cnt;i+=2)
	{
		cout<<rec[i]<<'\n';
	}
}

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

const double PI = 3.14159265358979323846;
//using namespace boost::multiprecision;
using namespace std;
typedef long long ll;
//typedef unsigned long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<int, int> P;
//typedef pair<ll, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
//const ll INF = LONG_LONG_MAX / 100;
//const ll INF = (1ll << 31) - 1;
const ll INF = 1e15;
//const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
//typedef pair<int, int> P;
//typedef pair<double, double> P;
#define ret() return 0;

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const int mod = 1000000007;
//const ll mod = 1e10;
typedef priority_queue<long long, vector<long long>, greater<long long> > PQ_ASK;


int main() {
    string s;
    cin >> s;

    stack<char> st;

    for (char c : s) {
        if (c == 'S') st.push(c);
        else if (c == 'T') {
            if (!st.empty() && st.top() == 'S') {
                st.pop();
            } else {
                st.push(c);
            }
        }
    }

    cout << st.size() << endl;

}


Measured memory_bytes: 644
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <string>
#include <vector>

using namespace std;

struct Memo {
	long long fact = 0;
	long long fact_inv = 0;
	long long inv = 0;
};
class Combination {
private:
	int m_module = 1000000007;
	vector<struct Memo> memo;
public:
	int calculate(int, int);
	Combination(int, int);
};
int Combination::calculate(int n, int k) {
	return (memo[n].fact * (memo[k].fact_inv * memo[n - k].fact_inv) % m_module) % m_module;
}
Combination::Combination(int memo_max, int module = 1000000007) {
	m_module = module;
	memo.push_back({ 1,1,0 });
	memo.push_back({ 1,1,1 });
	for (int loop = 2; loop <= memo_max; loop++) {
		struct Memo temp;
		temp.fact = (memo[loop - 1].fact * loop) % m_module;
		temp.inv = m_module - (memo[m_module % loop].inv * int(m_module / loop)) % m_module;
		temp.fact_inv = (memo[loop - 1].fact_inv * temp.inv) % m_module;
		memo.push_back(temp);
	}
}

void A_Strings(void) {

	string S, T;
	cin >> S >> T;
	cout << T << S << flush;
	return;
}

int main(void) {

	A_Strings();
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
    int n;
    cin >> n;
    int x[n];
    vector<int> v;
    for (int i=0; i<n; i++) {
        cin >> x[i];
        v.push_back(x[i]);
    }
    sort(v.begin(), v.end());
    int medL = v[n/2-1], medR = v[n/2];
    for (int i=0; i<n; i++) {
        if (x[i] <= medL) {
            cout << medR << endl;
        } else {
            cout << medL << endl;
        }
    }
}

Measured memory_bytes: 4852
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef deque<ll> V;
V dfs(ll n){
  if(n==1)return V();
  V res=dfs(n/2),t;
  res.push_back(res.size()+1);
  if(n%2)res.push_front(res.size()+1);
  return res;
}

int main(){
  ll n;
  cin>>n;
  V res=dfs(n+1);
  cout<<res.size()*2<<endl;
  for(int i=1;i<=res.size();i++){
    cout<<i;
    if(i!=res.size())cout<<" ";
  }
  while(!res.empty())
    cout<<" "<<res.front(),res.pop_front();
  
  cout<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
int main()
{
	std::string number;
	while (std::getline(std::cin,number)){
		int count = 0, c = 0;
		int a = number[0] - '0';
		if (a == 0)break;
		for (int dd = 0; dd < number.size();dd++){
			char b = number[dd];
			c = b - '0';
			count = count + c;
		}
		std::cout << count << std::endl;
		number.clear();
	}
}

Measured memory_bytes: 3084
def dist(x, y, i, j):
    dx = x[i] - x[j]
    dy = y[i] - y[j]
    return (dx * dx + dy * dy) ** 0.5

n = int(input())
x = [0] * n
y = [0] * n

for i in range(n):
    x[i], y[i] = map(int, input().split())

ans = 0
for i in range(n):
    for j in range(i + 1, n):
       ans += dist(x, y, i, j) * 2 / n

print(ans)


Measured memory_bytes: 9448
import java.util.*;

public class Main{

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[][] g = new int[n][];
        for (int i = 0; i < n; i++) {
            int v = sc.nextInt()-1;
            int k = sc.nextInt();
            g[v] = new int[k];
            for (int j = 0; j < k; j++) {
                int u = sc.nextInt()-1;
                g[v][j] = u;
            }
        }
        int[][] a = new int[n][2];
        int t = 0;
        for (int i = 0; i < n; i++) {
            t = dfs(i, t+1, a, g);
        }
        for (int i = 0; i < n; i++) {
            int v = i+1;
            System.out.println(v + " " + a[i][0] + " " + a[i][1]);
        }
        sc.close();

    }

    private static int dfs(int v, int t, int[][] a, int[][] g) {
        if(0 < a[v][0])return t-1;
        a[v][0] = t;
        for(int nex : g[v]){
            t = dfs(nex, t+1, a, g);
        }
        a[v][1] = ++t;
        return t;
    }

}



Measured memory_bytes: 28268