akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

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

void dropBlock(vector<string>& f)
{
    int h = f.size();
    int w = f[0].size();

    for(int y=1; y<h; ++y){
        for(int i=0; i<w; ++i){
            int x;
            if(i < w / 2)
                x = i * 2 + 1;
            else
                x = (i - w / 2) * 2;
            if(f[y][x] == '.')
                continue;

            int y2 = y;
            while(y2 > 0 && f[y2-1][x] == '.' && (x == 0 || f[y2+dy[x%2][4]][x-1] == '.') && (x == w - 1 || f[y2+dy[x%2][2]][x+1] == '.')){
                swap(f[y2][x], f[y2-1][x]);
                -- y2;
            }
        }
    }
}

bool eraseBlock(vector<string>& f)
{
    int h = f.size();
    int w = f[0].size();

    bool ans = false;
    vector<vector<bool> > check(h, vector<bool>(w, false));
    for(int y=0; y<h; ++y){
        for(int x=0; x<w; ++x){
            if(check[y][x] || f[y][x] == '.')
                continue;

            vector<pair<int, int> > v;
            queue<pair<int, int> > q;
            v.push_back(make_pair(y, x));
            q.push(make_pair(y, x));
            check[y][x] = true;
            while(!q.empty()){
                int y2 = q.front().first;
                int x2 = q.front().second;
                q.pop();

                for(int i=0; i<6; ++i){
                    int y3 = y2 + dy[x2%2][i];
                    int x3 = x2 + dx[i];
                    if(0 <= y3 && y3 < h && 0 <= x3 && x3 < w && !check[y3][x3] && f[y2][x2] == f[y3][x3]){
                        v.push_back(make_pair(y3, x3));
                        q.push(make_pair(y3, x3));
                        check[y3][x3] = true;
                    }
                }
            }

            if(v.size() >= 3){
                ans = true;
                for(unsigned i=0; i<v.size(); ++i)
                    f[v[i].first][v[i].second] = '.';
            }
        }
    }

    return ans;
}

void rotateBlock(vector<string>& f, int y, int x)
{
    int h = f.size();
    int w = f[0].size();
    if(y == 0 || y == h-1 || x == 0 || x == w-1)
        return;

    for(int i=5; i>0; --i){
        int y2 = y + dy[x%2][i];
        int x2 = x + dx[i];
        int y3 = y + dy[x%2][i-1];
        int x3 = x + dx[i-1];
        swap(f[y2][x2], f[y3][x3]);
    }
}

int main()
{
    int h, w;
    cin >> h >> w;

    vector<string> f(h);
    for(int i=h-1; i>=0; --i)
        cin >> f[i];

    int q;
    cin >> q;
    for(;;){
        do{
            dropBlock(f);
        }while(eraseBlock(f));

        if(--q < 0)
            break;

        int y, x;
        cin >> x >> y;
        rotateBlock(f, y, x);
    }
    
    for(int i=h-1; i>=0; --i)
        cout << f[i] << endl;

    return 0;
}


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

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

const int N = 100010;
const double eps = 1e-6;

int x;
vector<int> num;
int a[3] = {3, 5, 7};
bool st[10];

bool check(int x)
{
    memset(st, 0, sizeof st);
    while(x)
    {
        int t = x % 10;
        st[t] = true;
        x /= 10;
    }
    return st[3] && st[5] && st[7];
}

void dfs(int x, int s, int n)
{
    if(s == n)
    {
        if(check(x)) num.push_back(x);
        return;
    }

    for(int i = 0; i < 3; i++)
        dfs(x * 10 + a[i], s + 1, n);
}

int main()
{
    for(int i = 3; i <= 9; i++)
        dfs(0, 0, i);

    int n, res = 0;
    cin >> n;
    for(int i = 0; i < num.size(); i++)
    {
        if(num[i] > n) break;
        res++;
    }

    cout << res << endl;
    return 0;
}


Measured memory_bytes: 512
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
    input!{
        n: usize,
        v: [usize1; n - 1]
    }
    let mut cs = vec![0; n];
    for &x in &v {
        cs[x] += 1;
    }
    for &c in &cs {
        println!("{}", c);
    }
}


Measured memory_bytes: 4284
import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right #func(リスト,値)
from heapq import heapify, heappop, heappush
from itertools import product, permutations, combinations, combinations_with_replacement
from functools import reduce
from math import sin, cos, tan, asin, acos, atan

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def lgcd(l):
    return reduce(gcd,l)
def llcm(l):
    return reduce(lcm,l)
def powmod(n,i,mod):
    return pow(n,mod-1+i,mod) if i<0 else pow(n,i,mod)
def div2(x):
    return x.bit_length()
def div10(x):
    return len(str(x))-(x==0)
def perm(n,mod=None):
    ans = 1
    for i in range(1,n+1):
        ans *= i
        if mod!=None:
            ans %= mod
    return ans
def intput():
    return int(input())
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))
class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x):
        self.setdefault(x,0)
        self[x] += 1
class comb():
    def __init__(self, n, mod=None):
        self.l = [1]
        self.n = n
        self.mod = mod
    def get(self,k):
        l,n,mod = self.l, self.n, self.mod
        k = n-k if k>n//2 else k
        while len(l)<=k:
            i = len(l)
            l.append(l[i-1]*(n+1-i)//i if mod==None else (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod)
        return l[k]

S = input()
ans = 0
c = S[0]
for i in range(1,len(S)):
    if c!=S[i]:
        ans += 1
        c = S[i]
print(ans)

Measured memory_bytes: 74164
import sys

S = sys.stdin.readline().strip()

N = len(S)

pl = 0
pr = N

res = 0

while pl < pr:
    cnt = 0

    while pl < N and S[pl] == 'x':
        cnt += 1
        pl += 1

    while 0 < pr and S[pr - 1] == 'x':
        cnt -= 1
        pr -= 1

    res += abs(cnt)

    if 0 < pr and pl < N and S[pl] != S[pr - 1]:
        print(-1)
        sys.exit()

    pl += 1
    pr -= 1

print(res)


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

using namespace std;

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

// chmax, chmin
template<class T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}

template<class T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}

void solve(long long N, std::vector<long long> x, std::vector<long long> y) {
    int A[] = {0, 1, 2, 3, 4, 5, 6, 7};

    double ans = 0;
    int cnt = 0;
    do {

        for (int i = 1; i < N ; i++) {
            ans += sqrt((x[A[i]] - x[A[i - 1]]) * (x[A[i]] - x[A[i - 1]]) + (y[A[i]] - y[A[i - 1]]) * (y[A[i]] - y[A[i - 1]]));
        }
        cnt++;

    } while (next_permutation(A, A + N));

    ans /= cnt;
    printf("%.10lf\n", ans);
}

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


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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define rrep(i,n) RFOR(i,n,0)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

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

	int H,W,h,w;
	cin >> H >> W >> h >> w;

	if(H%h == 0 && W%w == 0) {
		cout << "No" << endl;
		return 0;
	}
	
	cout << "Yes" << endl;
	rep(i,H){
		rep(j,W){
			int l;
			if((i%h == h-1) && (j%w == w-1)) l = -1000 * h*w + 1000 - 1;
			else l = 1000;

			cout << l << (j == W-1 ? "\r\n" : " ");
		}
	}
}

Measured memory_bytes: 1664
K, N = map(int, input().split())
house = list(map(int,input().split()))
min = house[N - 1] - house[0]
 
for i in range(N - 1):
  if K - (house[i + 1] - house[i]) < min:
    min = K - (house[i + 1] - house[i])
 
print(min)

Measured memory_bytes: 26596
fun main(args: Array<String>) {
    val  inLyric = readLine()?.split(" ").orEmpty()
    val amountN = inLyric[0].toInt()
    val lengthL = inLyric[1].toInt()
    var inList = mutableListOf<String>()
    var i = 0

    while(i < amountN){
        inList.add(readLine().orEmpty())
        i++
    }

    inList.sort()
    inList.forEach{
        print(it)
    }

}

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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif

int main()
{

    double a,b,x;
    cin >> a >> b >> x;

    double ans, tmp;

    double s, t;
    double pi = 3.14159265358979323846264338327950288;

    if(a*a*b/2.0  < x){
        s = b / a;
        t = x / (a * a * a);
        double v = 2.0 * (s - t);
        ans = atan(v);
    }else{
        s = a*b * b / 2.0;
        s /= x;
        ans = atan(s);
    }

    ans = (ans * 360.0) / 2.0;
    ans /= pi;

    ans -= 0.0000001;

    cout << fixed;
    cout << setprecision(8) << ans << "\n";

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int>card(n);
  for(int i=0;i<n;i++) {
    cin >> card.at(i);}
  sort(card.begin(),card.end());
  reverse(card.begin(),card.end());
  int Alice=0;
  int Bob=0;
  char x='a';
  for(int i=0;i<n;i++) {
    if(x=='a') {
      Alice+=card.at(i);
      x='b';}
    else {
      Bob+=card.at(i);
      x='a';}}
    int y=Alice-Bob;
    cout << y << endl;
    return 0;
  
}

      
      
  


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,K,S;
  cin>>N>>K;
  S=1;
  for(int i=0;i<N;i++){
    if(S>=K){
      S+=K;
    }
    else{
      S*=2;
    }
  }
  cout<<S<<endl;
}






Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef double ld;

void bfs(int x,vector<int> *adj,vector<int> &distance){
distance[x] = 0;
queue<int> q;
vector<int> visited(distance.size(),0); 
q.push(x);
visited[x] = 1;
while(!q.empty()){
	int a = q.front();
    q.pop();
    for(auto u:adj[a]){
    if(!visited[u]){
      visited[u] = 1;
      q.push(u);
      distance[u] = a;
    }
    }
}
}
int main() {
	// your code goes here
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.precision(10);
  int n,m;
  cin >> n >> m;
  vector<int> adj[n+1];
  for(int i =0;i<m;i++){
  int u,v;
    cin >> u >> v;
    adj[u].pb(v);
    adj[v].pb(u);
  }
  vector<int> distance(n+1,-1);
  bfs(1,adj,distance);
  vector<int> output;
  for(int i = 2;i<=n;i++){
  	if(distance[i]!=-1)output.pb(distance[i]);
  }
  if(output.size()==0)std::cout << "No" << std::endl;
  else{
      std::cout << "Yes" << std::endl;
      for(int i = 0;i<output.size();i++){
          std::cout << output[i] << std::endl;
      }
  }
  return 0;
}


Measured memory_bytes: 11060
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const ll dx[4] = { 0, -1, 1, 0 };
const ll dy[4] = { -1, 0, 0, 1 };
const int INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
////////////////////////////////////////
int main() {
	ll N, M; cin >> N >> M;
	vector<vector<pair<ll, ll>>>rel(N + 1);
	for (int i = 0; i < M; ++i) {
		ll L, R, D;
		cin >> L >> R >> D;
		rel[L].push_back({ R,D });
		rel[R].push_back({ L,-D });
	}

	vector<ll> place(N + 1, INF);
	queue<ll>q;
	for (int i = 1; i <= N; ++i) {
		if (!rel[i].empty()&&place[i]==INF) {
			place[i] = 0;
			q.push(i);
			while (!q.empty()) {
				ll from = q.front();
				for (auto r : rel[from]) {
					ll to = r.first;
					ll dis = r.second;
					if (place[to] < INF) {
						if (place[to] != place[from] + dis) {
							cout << "No" << endl;
							return 0;
						}
					}
					else {
						place[to] = place[from] + dis;
						q.push(to);
					}
				}
				q.pop();
			}
		}
	}
	cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 14080
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 int a , s1, s2, s3 ;
 cin >> a ;
 s1 = a / 100 ;
 s2 = a / 10 % 10;
 s3 = a - 100 * s1 - 10 * s2;
 cout << s1 + s2 + s3 << endl;
}

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

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = 1LL << 60;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

#define int long long

inline void my_io() {

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

	cout << fixed << setprecision(16);

	//cout << setprecision(10) << scientific << ans << endl;
}

signed main() {
	ll h, w;

	cin >> h >> w;

	vector<vector<ll>> v(h, vector<ll>(w));

	ll sum = 0;

	REP(i, h) {
		REP(j, w) {
			cin >> v[i][j];
			sum += v[i][j];
		}
	}

	vector<tuple<ll, ll, ll, ll>> ans;
	tuple<ll, ll, ll> prev = make_tuple(0, 0, 0);
	ll val, x, y;

	REP(i, h) {
		if (i % 2 == 0) {
			REP(j, w) {
				tie(val, x, y) = prev;

				if (val % 2 == 1) {
					ans.push_back(make_tuple(x + 1, y + 1, i + 1, j + 1));
					v[i][j]++;
					prev = make_tuple(v[i][j], i, j);
				}
				else {
					prev = make_tuple(v[i][j], i, j);
				}
			}
		}
		else {
			RREP(j, w) {
				tie(val, x, y) = prev;

				if (val % 2 == 1) {
					ans.push_back(make_tuple(x + 1, y + 1, i + 1, j + 1));
					v[i][j]++;
					prev = make_tuple(v[i][j], i, j);
				}
				else {
					prev = make_tuple(v[i][j], i, j);
				}
			}
		}
	}

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

	ll xx, yy;

	REP(i, ans.size()) {
		tie(x, y, xx, yy) = ans[i];
		cout << x << " " << y << " " << xx << " " << yy << endl;
	}
}

Measured memory_bytes: 8432
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
struct X{int P,K,D;vector<int>C;}A[100005];
int N;
 
int main()
{
	scanf("%d",&N);
	for(int i=0;i<N;i++)A[i].P=-1;
	for(int i=0;i<N;i++)
	{
		int n;
		scanf("%d",&n);
		scanf("%d",&A[n].K);
		for(int j=0;j<A[n].K;j++)
		{
			int t;
			scanf("%d",&t);
			A[t].P=n;
			A[n].C.push_back(t);
		}
	}
	for(int i=0;i<21;i++)
	{
		for(int j=0;j<N;j++)
			if(A[j].P!=-1)
				A[j].D=A[A[j].P].D+1;
	}
	for(int i=0;i<N;i++)
	{
		printf("node %d: parent = %d, depth = %d, %s, [",i,A[i].P,A[i].D,A[i].P==-1?"root":A[i].K==0?"leaf":"internal node");
		for(int j=0;j<A[i].K;j++)
			printf("%d%s",A[i].C[j],j==A[i].K-1?"":", ");
		puts("]");
	}
	return 0;
}

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

int main() {
  string N;
  cin >> N;
  int n = N.at(N.size() - 1) - 48;

  if (n == 3) {
    cout << "bon" << endl;
  } else if (n == 0 || n == 1 || n == 6 || n == 8) {
    cout << "pon" << endl;
  } else {
    cout << "hon" << endl;
  }
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define print(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl; 
typedef long long ll;
int main()
{
    string S;
    cin >> S;    
    
    int N = S.size();
    rep(i, N){
        if (S[i] != S[N - 1 - i]){
            cout << "No";
            return 0;
        }
    }
    rep(i, N/2 - 1){
        if (S[i] != S[N/2 - 1 - i]){
            cout << "No";
            return 0;
        }
    }

    rep(i, N/2 - 1){
        if (S[N/2 + 1 + i] != S[N - 1 - i]){
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
    return 0;
}


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

int main() {
  int n, k, ans=INF;
  cin >> n >> k;
  int h[n];
  rep(i, n) cin >> h[i];
  sort(h, h+n);
  rep(i, n-k+1) ans=min(ans, h[i+k-1]-h[i]);
  cout << ans << endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
#include<stack>
#include<numeric>
#include<set>
#include<iomanip>
#include<map>
#include<type_traits>
#include<tuple>
#include<deque>
#include<cassert>
#include<bitset>

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define rep(i,N) for(int (i)=0;(i)<(N);(i)++)
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
const double PI = 3.1415926535897932384626433832795;
const int mod = 1000000007;
const int INF = 1001001001;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

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

  combination comb(n);
  int red = n - k;
  for (int i = 1; i <= k; ++i) {
    mint ans = comb(red + 1, i) * comb(k - 1, i - 1);
    cout << ans << endl;
  }

}

Measured memory_bytes: 3616
let () =
  let i = read_line () in
  let w,h,x,y,r =
    Scanf.sscanf i "%d %d %d %d %d" (fun w h x y r ->  w,h,x,y,r) in
  print_endline (if x+r > w || x-r < 0 || y+r > h || y-r < 0 then "No"
                 else "Yes")

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

using namespace std;

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

  int ans;
  if (B <= C or D <= A) ans = 0;
  else if (A <= C and B <= D) ans = B - C;
  else if (C <= A and D <= B) ans = D - A;
  else if (A <= C and D <= B) ans = D - C;
  else ans = B - A;

  cout << ans;
}

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

class Dice {
	private int _t, _s, _e, _w, _n, _b;
	int getTop() {
		return _t;
	}
	void setTop(int t) {
		_t = t;
	}
	int getSouth() {
		return _s;
	}
	void setSouth(int s) {
		_s = s;
	}
	int getEast() {
		return _e;
	}
	void setEast(int e) {
		_e = e;
	}
	int getWest() {
		return _w;
	}
	void setWest(int w) {
		_w = w;
	}
	int getNorth() {
		return _n;
	}
	void setNorth(int n) {
		_n = n;
	}
	int getBottom() {
		return _b;
	}
	void setBottom(int b) {
		_b = b;
	}
	void rollX(boolean d) {
		if (d) {
			int temp = _t;
			_t = _n;
			_n = _b;
			_b = _s;
			_s = temp;
		} else {
			int temp = _t;
			_t = _s;
			_s = _b;
			_b = _n;
			_n = temp;
		}
	}
	void rollY(boolean d) {
		if (d) {
			int temp = _s;
			_s = _w;
			_w = _n;
			_n = _e;
			_e = temp;
		} else {
			int temp = _s;
			_s = _e;
			_e = _n;
			_n = _w;
			_w = temp;
		}
	}
	void rollZ(boolean d) {
		if (d) {
			int temp = _e;
			_e = _b;
			_b = _w;
			_w = _t;
			_t = temp;
		} else {
			int temp = _e;
			_e = _t;
			_t = _w;
			_w = _b;
			_b = temp;
		}
	}
	void anchor_t_s(int t, int s) {
		if (t == _e) {
			rollZ(true);
		} else if (t == _w) {
			rollZ(false);
		} else {
			while (t != _t) {
				rollX(true);
			}
		}
		while (s != _s) {
			rollY(true);
		}
	}
}

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Dice[] d = {new Dice(), new Dice()};
		int[][] nums = {new int[6], new int[6]};
		for (int i = 0; i < 2; ++i) {
			for (int j = 0; j < 6; ++j) {
				nums[i][j] = sc.nextInt();
			}
			sc.nextLine();
			d[i].setTop(nums[i][0]);
			d[i].setSouth(nums[i][1]);
			d[i].setEast(nums[i][2]);
			d[i].setWest(nums[i][3]);
			d[i].setNorth(nums[i][4]);
			d[i].setBottom(nums[i][5]);
		}
		Arrays.sort(nums[0]);
		Arrays.sort(nums[1]);
		for (int i = 0; i < 6; ++i) {
			if (nums[0][i] != nums[1][i]) {
				System.out.println("No");
				sc.close();
				return;
			}
		}
		for (int i = 0; i < 2; ++i) {
			d[i].anchor_t_s(nums[i][0], nums[i][1]);
		}
		System.out.println(d[0].getTop() == d[1].getTop() && d[0].getSouth() == d[1].getSouth() && d[0].getEast() == d[1].getEast() && d[0].getWest() == d[1].getWest() && d[0].getNorth() == d[1].getNorth() && d[0].getBottom() == d[1].getBottom() ? "Yes" : "No");
		sc.close();
	}
}


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

#define each(i, c) for (auto& i : c)
#define mkp(a, b) make_pair(a, b)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> Pll;
const ll MOD = 1e9+7;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << ": " << p.second << ")"; return os; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ", "; os << ")"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; each (i, m) os << i << ", "; os << "}"; return os; }

int main() {
  ll n;
  cin >> n;

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

  map<ll, ll> m;
  for (ll i = 0; i < n-1; ++i) {
    if (m.count(a[i])) m[a[i]]++;
    else m[a[i]] = 1;
  }

  for (ll i = 1; i <= n; ++i) {
    if (m.count(i)) cout << m[i] << endl;
    else cout << 0 << endl;
  }

  return 0;
}

Measured memory_bytes: 17188
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// Data :
type Data struct {
	a, b int
}

// Datas :
type Datas []Data

func (p Datas) Len() int {
	return len(p)
}

func (p Datas) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p Datas) Less(i, j int) bool {
	return p[i].a < p[j].a
}

func main() {
	sc.Split(bufio.ScanWords)

	N, K := getInt(), getInt()
	n := make(Datas, N)
	for i := 0; i < N; i++ {
		n[i] = Data{getInt(), getInt()}
	}

	sort.Sort(n)

	ans := 0
	cnt := 0
	for _, v := range n {
		if cnt+v.b >= K {
			ans = v.a
			break
		}
		cnt += v.b
	}

	out(ans)
}


Measured memory_bytes: 3840
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define F .first
#define S .second 
#define endl "\n"
using ll=long long;
using ld=long double;
using namespace std;
const ll mod=1e9+7;
//ll a[110000];
main(){
  ll n,k;
  cin>>n>>k;
  ll r,s,p;
  cin>>r>>s>>p;
  string t;
  cin>>t;
  ll ans=0;
  rep(i,0,k){
    ll tmp=0,cntr=0,cnts=0,cntp=0;
    ll lcr=1,lcs=1,lcp=1;
      if(t[i]=='r')cntr++;
      if(t[i]=='s')cnts++;
      if(t[i]=='p')cntp++;
    for(ll j=i+k;j<n;j+=k){
      if(t[j]==t[j-k]&&t[j]=='r'){lcr++;cntr++;}
      if(t[j]==t[j-k]&&t[j]=='s'){lcs++;cnts++;}
      if(t[j]==t[j-k]&&t[j]=='p'){lcp++;cntp++;}
      if(t[j]=='r'&&t[j-k]!='r'){tmp+=(lcr/2)*p;lcr=1;cntr++;}
      if(t[j]=='s'&&t[j-k]!='s'){tmp+=(lcs/2)*r;lcs=1;cnts++;}
      if(t[j]=='p'&&t[j-k]!='p'){tmp+=(lcp/2)*s;lcp=1;cntp++;}
    }
    tmp+=(lcr/2)*p;
    tmp+=(lcs/2)*r;
    tmp+=(lcp/2)*s;
    ll tt=cntr*p+cnts*r+cntp*s;
    ans+=tt-tmp;
   // cout<<ans<<endl;
  }
  cout<<ans;
}


Measured memory_bytes: 512
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

INF = 1 << 19

"""
・dp[bit][s]
ビットに1が立っているカードはソートされて左から並んでいる。
そのとき最後の値をsにするのに必要な最小操作回数


"""
# 1 <= A,B <= 50, bitの立ち方が 0...0 ~ 1...1 の2**N
dp = [[INF for _ in range(50 + 1)] for _ in range((1 << N))]
# 0枚選んでいて右端が0は何もしてないのでコスト0
dp[0][0] = 0

for bit in range(1 << N):
    # 現在見ているbit列にいくつ1が立っているか＝カードを何枚既に選んで並べているか
    num_used = bin(bit).count("1")
    
    # bitで１が立っていない＝まだ使われていないカードがどこにあるか
    idx = num_used
    remaining = []
    for i in range(N):
        if not (bit & (1 << i)):
            # 一つ目が初期位置、二つ目は、bitで１が立っているやつらを左に寄せた時にどの位置にいるか
            remaining.append((i, idx))
            idx += 1

    for s in range(51):
        # bitの集合かつ、その右端にsの状態が作れないならスキップ
        if dp[bit][s] >= INF:
            continue

        for ini, curr in remaining:
            """
            ini  : initial position
            curr : current position
            現時点でnum_used-1のインデックスまでカードがソートされて並んでいる
            最初iniの位置にあったカードを最後尾に並べることを考える
            """
            num = A[ini] if abs(ini - num_used) % 2 == 0 else B[ini]

            """
            numが並んでるカードの最後尾より大きければ最後尾につける
            """
            if num >= s:
                # 元の集合と、iniの位置だけ１が立ってるものの論理和で、追加した状態を表す
                # その場合の最小コストは、既に求まっているもの or 新たにnum_usedの位置にiniのカードをあてたとき　の小さいほう
                dp[bit | (1 << ini)][num] = min(dp[bit | (1 << ini)][num], dp[bit][s] + abs(num_used - curr))



# 全てのbitに1が立っている（全て並べ切った）時の最小コストが答え
ans = min(dp[-1][s] for s in range(51))

print(ans if ans < INF else -1)


Measured memory_bytes: 181128
x, y = map(int, input().split())

MAX = 10**6+1
MOD = 10**9+7
fac = [1]
for i in range(1, MAX):
    fac.append(fac[i-1] * i % MOD)

if (x % 3 == 0 and y % 3 == 0) or (min(x % 3, y % 3) == 1 and max(x % 3, y % 3) == 2):
    xx, yy = max(x, y), min(x, y)
    a = b = 0
    while not xx == yy:
        xx -= 2
        yy -= 1
        a += 1
        if xx < 0 or yy < 0:
            res = 0
            break
    else:
        a += xx // 3
        b += yy // 3
        res = fac[a+b] * pow(fac[a]*fac[b], MOD-2, MOD) % MOD
    print(res)
else:
    print(0)


Measured memory_bytes: 42712
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <math.h>
#define MOD 1000000007
typedef long long ll;
using namespace std;

int main(){
  int n;
  cin>>n;
  int m=101;
  int sum=0;
  int s[n];
  for(int i=0;i<n;i++){
    cin>>s[i];
    if(s[i]%10!=0){
      m=min(m,s[i]);
    }
    sum+=s[i];
  }
  if(m==101) m=sum;
  if(sum%10==0){
    cout<<sum-m<<endl;
  }else{
    cout<<sum<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)
#define rep_r(i,s,n)for(ll i=n-1;i>=s;i--)
#define repe_r(i,s,n)for(ll i=s;i<=n;i++)
static const ll MOD = 1e9 + 7;
static const ll MAX_L = (ll)1 << 62;

ll s[26] = {};
ll t[26] = {};
int main() {
	string S, T; cin >> S >> T;
	rep(i, 0, S.size()) s[S[i] - 'a']++;
	rep(i, 0, T.size()) t[T[i] - 'a']++;

	sort(s, s + 26);
	sort(t, t + 26);
	rep(i, 0, 26) {
		if (s[i] != t[i]) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 776
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0; i<(n); i++)
#define REP2(i,x,n) for(ll i=x; i<(n); i++)
#define REP3(i,x,n) for(ll i=x; i>(n); i--)
#define ALL(n) begin(n),end(n)
#define MAX 500000
#define SENTINEL 2000000000
#define NIL -1
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();

struct Node{ll parent ,left,right;};
struct Node T[MAX];
ll N;
void PreorderWalk(ll u){
    if(u ==NIL)return;
    cout << " "<< u; 
    PreorderWalk(T[u].left);
    PreorderWalk(T[u].right);
}

void InorderWalk(ll u){
    if(u ==NIL)return; 
    InorderWalk(T[u].left);
    cout << " "<< u;
    InorderWalk(T[u].right);
}

void PostorderWalk(ll u){
    if(u ==NIL)return; 
    PostorderWalk(T[u].left);
    PostorderWalk(T[u].right);
    cout << " "<< u;
}
int main(){
    ll i,v,left,right,root;
    cin >> N;
    REP(i,N)T[i].parent =NIL;
    REP(i,N){
        cin >> v >> left >> right;
        T[v].left=left;
        T[v].right=right;
        if(left!=NIL)T[left].parent = v;
        if(right!=NIL)T[right].parent = v;
    }
    REP(i,N){
        if(T[i].parent==NIL)root =i;
    }
    cout << "Preorder" << endl;
    PreorderWalk(root);
    cout << endl;
    cout << "Inorder" << endl;
    InorderWalk(root);
    cout << endl;
    cout << "Postorder" << endl;
    PostorderWalk(root);
    cout << endl;
    return 0;
}


Measured memory_bytes: 3216
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1000000007;
const ld PI = acos(-1);  
const ld EPS = 0.0000000001;
#define REP(i, n) for(ll i=0; i<(ll)(n); i++)
#define REPD(i, n) for(ll i=n-1; 0<=i; i--)
#define FOR(i, a, b) for(ll i=a; i<(ll)(b); i++)
#define FORD(i, a, b) for(ll i=a; (ll)(b)<=i; i--)
#define ALL(x) x.begin(), x.end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))


int main(){
    string s;   cin >> s;
    string t="";
    REP(i, s.size()-1){
        if(s.substr(i, 2)=="BC"){
            t += "D"; i+= 1;
        }else t += s[i];
    }
    ll ans=0, cnt=0;
    //cout << t << endl;
    REP(i, t.size()){
        if(t[i]=='A') cnt += 1;
        else if(t[i]=='D') ans += cnt;
        else cnt = 0;
    }
    cout << ans << endl;
}

Measured memory_bytes: 776
import sys
def power_func(a,n,p):
    bi = str(format(n,"b"))#2進表現に
    res = 1
    for i in range(len(bi)):
        res = (res*res) %p
        if bi[i] == "1":
            res = (res*a) %p
    return res

N = int(input())

a1 = power_func(10,N,10**9+7)
a2 = power_func(9,N,10**9+7)
a3 = power_func(8,N,10**9+7)
if a1 - 2 * a2 + a3 >= 0:
    print(a1 - 2 * a2 + a3)
    sys.exit()
ans = a1 - 2*a2 + a3
while ans < 0:
    ans += 10**9 + 7
print(ans)

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

int main()
{
  int n,q;
  cin>>n>>q ;
  dsu D(n);
  for(int i=0 ; i<q ; ++i)
  {
    int t,u,v ;
    cin>>t>>u>>v ;
    if(t==0)
      D.merge(u,v);
    else
      cout<<D.same(u,v)<<"\n";
  }
  
  return 0;
}


Measured memory_bytes: 4104
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
int main(void){
    int n;
    int a[100000];
    cin>>n;
    for(int i=0;i<n;i++)cin>>a[i];
    sort(a,a+n);
    int co=0,ans=0;
    for(int i=0;i<n;i++){
        if(a[i]==a[i+1])co++;
        else{
            co++;
            if(co>=a[i])ans+=co-a[i];
            else ans+=co;
            co=0;
        }
    }
    cout<<ans<<endl;
    return 0;

}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,a) for(int i=0;i<(a);i++)
#define MOD 1000000007

int main(){
  while(1){
    int h,w;
    cin>>w>>h;
    if(h==0&&w==0) break;
    char a[h][w];
    queue<pair<int,int>> q;
    bool used[h][w];
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
        cin>>a[i][j];
        used[i][j]=0;
        if(a[i][j]=='@') q.push(make_pair(i,j));
      }
    }
    int ans=0;
    while(!q.empty()){
      pair<int,int> p=q.front();
      q.pop();
      int x=p.first, y=p.second;
      if(used[x][y]) continue;
      used[x][y]=1;
      ans++;
      if(x>0){
        if(!used[x-1][y]&&a[x-1][y]=='.'){
          q.push(make_pair(x-1,y));
        }
      }
      if(x<h-1){
        if(!used[x+1][y]&&a[x+1][y]=='.'){
          q.push(make_pair(x+1,y));
        }
      }
      if(y>0){
        if(!used[x][y-1]&&a[x][y-1]=='.'){
          q.push(make_pair(x,y-1));
        }
      }
      if(y<w-1){
        if(!used[x][y+1]&&a[x][y+1]=='.'){
          q.push(make_pair(x,y+1));
        }
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}



Measured memory_bytes: 3112
S = list(input())
Q = int(input())
query = [list(input().split()) for _ in range(Q)]
mae = []
ato = []
is_reverse = False
for q in query:
    if q[0] == "1":
        is_reverse = not is_reverse
    else:
        if is_reverse:
            if q[1] == "2":
                mae.append(q[2])
            else:
                ato.append(q[2])
        else:
            if q[1] == "1":
                mae.append(q[2])
            else:
                ato.append(q[2])
mae.reverse()
mae.extend(S)
mae.extend(ato)
if is_reverse:
    mae.reverse()
    print("".join(mae))
else:
    print("".join(mae))


Measured memory_bytes: 118264
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;
#define rep(i, a, b) for(long long i = a; i < (b); ++i)
typedef long long ll;
ll gcd(ll a, ll b)
{
   if (b == 0)
   {
       return a;
   }
    return gcd(b, a%b);
}

vector<pair<ll, int>> factorize(ll n){
    vector<pair<ll, int>> res;
    for(ll i = 2; i*i<=n; i++){
        if(n%i)continue;
        res.emplace_back(i, 0);
        while (n%i == 0) {
            n /= i;
            res.back().second++;
        }
    }
    if(n!=1) res.emplace_back(n, 1);
    return res;
}

int main() {
    ll a,b;
    cin >> a >> b;
    ll gcdn = gcd(a, b);
    
    auto f = factorize(gcdn);
    ll ans = f.size() + 1;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
 int main(){
 int a,b,c;
 cin>>a>>b>>c;
 int tmp;
 tmp=a;
   a=b;
   b=tmp;
   tmp=a;
   a=c;
   c=tmp;
cout<<a<<" "<<b<<" "<<c<<" "<<endl;
 }

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

int main() {
	int W,H,x,y,r;;
	cin>>W>>H>>x>>y>>r;
	if (x-r<0 || x+r>W || y-r<0 || y+r>H){
		cout<<"No"<<endl;
	}
	else {
		cout<<"Yes"<<endl;
	}
	return 0;
}


Measured memory_bytes: 3096
#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}

fn main() {
    let v = read_vec::<u32>();
    let n = v[0];
    let k = v[1];
    let hs = read_vec::<u32>();

    let ans = hs.into_iter().filter(|&h| h >= k).count();
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define popcnt(a) __builtin_popcount(a)
#define FastIO() ios::sync_with_stdio(false), cin.tie(0);
#define IO() freopen("palindrome.in","rw",stdin)
#define error(args...)                       \
{                                            \
    cerr<<"LINE "<<__LINE__;                 \
    string _s = #args;                       \
    replace(_s.begin(), _s.end(), ',', ' '); \
    stringstream _ss(_s);                    \
    istream_iterator<string> _it(_ss);       \
    err(_it, args);                          \
    cerr<<endl;                              \
}
void err(istream_iterator<string> it)
{
} 
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
  cerr<<' '<< *it << " = " << a ;
  err(++it, args...);
} 
typedef long long LL;
const LL MOD = 1e9 + 7;
const int N = 1e6+9, M = (1<<31), OO = 0x3f3f3f3f;
int arr[108];
int main()
{
  int a,b;
  scanf("%d%d",&a,&b);
  int res=ceil((b-1)*1.0/(a-1));
  printf("%d\n",res);
  
  #ifdef _LOCAL_DEFINE
  cerr << (double)clock() * 1.0 / CLOCKS_PER_SEC << endl;
  #endif
  return 0; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define N 200005
#define mid (l+r>>1)
int n,a[N],ds[N],dp[N];vector<int> e[N];int cntS,rt[N];struct Seg {int v,ch[2];}sg[N*20];
void upd(int p,int l,int r,int &nwP,int x,int v)
{
	sg[nwP=++cntS]=sg[p];sg[nwP].v=max(sg[nwP].v,v);if(l==r) return;
	if(x<=mid) upd(sg[p].ch[0],l,mid,sg[nwP].ch[0],x,v);
	else upd(sg[p].ch[1],mid+1,r,sg[nwP].ch[1],x,v);
}
int qMx(int p,int l,int r,int qL,int qR)
{
	if(!p || qL>qR) return 0;if(l>=qL && r<=qR) return sg[p].v;int res=0;
	if(qL<=mid) res=qMx(sg[p].ch[0],l,mid,qL,qR);
	if(qR>mid) res=max(res,qMx(sg[p].ch[1],mid+1,r,qL,qR));return res;
}
void dfs(int u,int f)
{
	dp[u]=qMx(rt[f],1,ds[0],1,a[u]-1)+1;upd(rt[f],1,ds[0],rt[u],a[u],dp[u]);
	dp[u]=max(dp[u],dp[f]);
	for(int i=0,v;i<e[u].size();++i) {v=e[u][i];if(v!=f) dfs(v,u);}
}
int main()
{
	scanf("%d",&n);for(int i=1;i<=n;++i) scanf("%d",&a[i]),ds[++ds[0]]=a[i];
	sort(ds+1,ds+ds[0]+1);ds[0]=unique(ds+1,ds+ds[0]+1)-ds-1;
	for(int i=1;i<=n;++i) a[i]=lower_bound(ds+1,ds+ds[0]+1,a[i])-ds;
	for(int i=1,u,v;i<n;++i) scanf("%d %d",&u,&v),e[u].push_back(v),e[v].push_back(u);
	dfs(1,0);for(int i=1;i<=n;++i) printf("%d\n",dp[i]);return 0;
}

Measured memory_bytes: 69116
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define eb emplace_back
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 2e5 + 233;
vector<int> g[maxn];
int d[maxn],vis[maxn];
int ord[maxn];
int ans[maxn],u[maxn],v[maxn];
queue<int> q;
map<pii,int> rev;
void shit(){
	puts("-1");
	exit(0);
}
bool cmp(int i,int j){
	return d[i]<d[j];
}
void cdd(int x,int y,int v){
	if(x>y)swap(x,y);
	int k = rev[mp(x,y)];
	ans[k] = v;
}
int main()
{
	int n,m;cin>>n>>m;
	for(int i=1;i<=n;i++)scanf("%d",&d[i]),ord[i] = i;
	sort(ord+1,ord+1+n,cmp);
//	if(d[ord[2]]!=d[ord[1]])shit();
	int mini = d[ord[1]];
	memset(vis,-1,sizeof(vis));
	for(int i=1;i<=m;i++){
		scanf("%d%d",&u[i],&v[i]);
		if(u[i]>v[i])swap(u[i],v[i]);
		rev[mp(u[i],v[i])] = i;
		g[u[i]].pb(v[i]);
		g[v[i]].pb(u[i]);
		ans[i] = 1e9;
	}
	for(int i=1;i<=n;i++){
		int x = ord[i];
		if(vis[x]!=-1)continue;
		for(int y:g[x]){
			if(vis[y]!=-1){
				vis[x] = vis[y]^1;
				cdd(x,y,d[x]);
				break;
			}
			if(d[y]==d[x]){
				vis[x] = 0;
				vis[y] = 1;
				cdd(x,y,d[x]);
				break;
			}
		}
	}
	for(int i=1;i<=n;i++)if(vis[i]==-1)shit();
	for(int i=1;i<=n;i++){
		if(vis[i])putchar('B');
		else putchar('W');
	}
	puts("");
	for(int i=1;i<=m;i++)printf("%d\n",ans[i]);
	return 0;
}


Measured memory_bytes: 28032
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;

int main(){
    int n, k;
    cin >> n >> k;
    vector<int> l(n);
    for(int i=0; i<n; i++){
       cin >> l[i];
    }
    sort(l.rbegin(), l.rend());
    int ans = 0;
    for(int i=0; i<k; i++){
        ans += l[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
	string s;
	cin>>s;
	int flag=1;
	for(int i=0;i<s.length()&&flag;i++)
	{
		if((i%2==0)&&(s[i]=='R'||s[i]=='U'||s[i]=='D'))//odd position
			flag=1;
		else if((i%2==1)&&(s[i]=='L'||s[i]=='U'||s[i]=='D'))
			flag=1;
		else
			flag=0;
	}
	flag?cout<<"Yes\n":cout<<"No\n";
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
using namespace std;
#define ll long long int
#define ld long double
#define vi vector<int>
#define vl vector<ll>
#define pi pair<int, int>
#define pl pair<ll, ll>
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define nl '\n'
#define mp make_pair
#define debug1(x) cout <<#x<<" "<<x<<'\n';
#define debug2(x,y) cout <<#x<<" "<<x <<" "<<#y<<" "<<y <<'\n';
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<'\n';
#define fi first
#define se second
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define inf 1e18
const int mod = (int)1e9 + 7;
pair<ll, ll>s4[4] = {{ -1, 0}, {1, 0}, {0, -1}, {0, 1}};
pair<ll, ll>s8[8] = {{ -1, -1}, { -1, 0}, { -1, 1}, {0, -1}, {0, 1}, {1, 1}, {1, 0}, {1, -1}};

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

void solve() {
    ld a, b;
    cin >> a >> b;
    ll ans = a * b;
    cout << ans;
}

signed main() {
    judge();
    boost;
    solve();
}


Measured memory_bytes: 3760
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define repr(e,x) for(auto& e:x)
using namespace std;
typedef long long ll;

ll N,K;
ll cnt[100001];

int main(){
    cin>>N>>K;
    rep(i,N){
        ll a,b;
        cin>>a>>b;
        cnt[a]+=b;
    }

    ll ans;
    ll sum=0;
    repn(i,100000){
        sum+=cnt[i];
        if(K<=sum){
            ans=i;
            break;
        }
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 1024
n,k,q = map(int,input().split())
a = [input() for i in range(q)]
K = [k]*n
limit = 0

for i in range(q):
  tmp = a[i]
  K[int(tmp)-1] = K[int(tmp)-1]+1
  limit += 1
  
for k in range(len(K)):
  if K[k] > limit:
    print("Yes")
  else:
    print("No")

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

int main()
{
    string S;
    int N, flag = 0, count = 0;
    cin >> S;
    N = S.length();

    for (int i = 0; i < N; i++)
    {
        if (S[i] != S[N - i - 1])
        {
            flag = 1;
        }
        
    }

    for (int i = 0; i < (N-1)/2; i++)
    {
        if (S[i] != S[(N-1)/2 - i - 1])
        {
            flag = 1;
        }
        
    }
    
    for (int i = (N+3)/2 - 1; i < N ; i++)
    {
        if (S[i] != S[N - count - 1])
        {
            flag = 1;
        }

        ++count;
        
    }
    
    if (flag != 0)
    {
        cout << "No" << endl;
    }else
    {
        cout << "Yes" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#ifdef _DEBUG
#define DBG(n) n
#else
#define DBG(n)
#endif
#define INF         1e9
#define INFLL       1e18
#define EPS         1e-9
#define REP(i,n)    for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)   for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)   for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)  for(ll i=(n);i>0;--i)
#define REPC(i,obj) for(auto i:obj)
#define ALL(obj)    (obj).begin(),(obj).end()
#define SETP(n)     cout << fixed << setprecision(n)
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

signed main()
{
	ll s;
	double w, h;
	while (scanf("%lld,%lf,%lf", &s, &w, &h) != EOF) {
		if (w >= 25 * h * h)cout << s << endl;
	}
}


Measured memory_bytes: 3152