akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m); (i) > (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define R cin>>
#define i64 unsigned long long
#define repr(i, n) REPR(i, n, 0)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define in(a) insert(a)
#define P(p) cout<<(p)<<endl;
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define SORT(a) sort((a).begin(), (a).end())
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long int> vll;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
void sonic(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll mod = 1e9+7;
//const ll MOD = 998244353;
const ld PI = acos(-1);
const ld EPS = 1e-11;
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
template<typename T> void co(T e){cout << e << "\n";}
template<typename T> void co(const vector<T>& v){for(const auto& e : v)
    { cout << e << " "; } cout << "\n";}
ll gcd(ll a, ll b) {
    if (a < b)swap(a, b);
    if (b == 0) return a;
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}
ll lcm(ll a, ll b) {
    ll g = gcd(a, b);
    return a * b / g;
}
bool prime(ll n) {
    for (ll i = 2; i <= sqrt(n); i++) {
        if (n%i == 0)return false;
    }
    return n != 1;
}


int pow(ll x, ll y, ll mod){
    ll ret=1;
    for(;y;y>>=1,x=1ll*x*x%mod){
        if(y&1) ret=1ll*ret*x%mod;
    }
    return ret;
}
void kill()
{
    cout << "No" << endl;
    exit(0);
}

int main() {
    sonic();
    int a, b, x;
    R a >> b >> x;
    if((a<=x)&&(x<=a+b))co("YES");
    else co("NO");
}


Measured memory_bytes: 3720
h, w, d = map(int, input().split())
graph = []
for i in range(h):
    graph.append(list(map(int, input().split())))



query = []
q = int(input())
for i in range(q):
    query.append(list(map(int, input().split())))


address = {}
dist = {}
for i in range(d+1):
    dist[i] = 0


for y in range(h):
    for x in range(w):
        address[graph[y][x]] = [y, x]


for i in range(d + 1, h * w + 1):
    dist[i] = dist[i-d] + abs(address[i][0] - address[i-d][0]) + abs(address[i][1] - address[i-d][1])


for i, j in query:
    print(dist[j] - dist[i])


Measured memory_bytes: 93656
#include<iostream>
#include<climits>
#include<utility>
#include<algorithm>
#include<cstring>

using namespace std;

long long calc_min_cost(pair<int, int>*, int);

int main() {
	int n,mini;
	cin >> n;
	pair<int, int>* mat = new pair<int, int>[n];
	for (int i = 0;i < n;i++) {
		cin >> mat[i].first >> mat[i].second;
	}
	if (n == 1) {
		cout << "0\n";
		return 0;
	}
	int** first_last = new int* [n];
	for (int i = 0;i < n;i++) {
		first_last[i] = new int[n - i];
		first_last[i][0] = 0;
	}
	for (int i = 1;i < n;i++) {
		for (int j = 0;j < n - i;j++) {
			mini = INT_MAX;
			for (int k = 0;k < i;k++) {
				mini = min(mini, first_last[j][k] + first_last[j + k + 1][i - k - 1] + mat[j].first * mat[j + k].second * mat[j + i].second);
			}
			first_last[j][i] = mini;
		}
	}
	cout << first_last[0][n - 1] << endl;
}

long long calc_min_cost(pair<int, int>* mat, int n) {
	pair<int, int> *tmp = new pair<int,int>[n];
	long long cost=-1, mini = INT_MAX;
	if (n == 2) {
		return mat[0].first * mat[0].second * mat[1].second;
	}
	for (int i = 0;i < n-1;i++) {
			cost = (long long)(mat[i].first) * mat[i].second * mat[i+1].second;
			memcpy(tmp, mat, sizeof(pair<int,int>) * n);
			tmp[i].second = tmp[i+1].second;
			for (int j = i+1;j < n-1;j++) {
				tmp[j] = tmp[j + 1];
			}
			cost += calc_min_cost(tmp, n - 1);
			mini = min(mini, cost);
	}
	free(tmp);
	return mini;
}


Measured memory_bytes: 3136
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        int[] dp = new int[30];
        dp[0] = 1;
        dp[1] = 2;
        dp[2] = 4;
        for (int i = 3; i < 30; i++) {
            dp[i] = dp[i-1] + dp[i-2] + dp[i-3];
        }

        Scanner sc = new Scanner(System.in);
        while (true)
        {
            int i = sc.nextInt();
            if (i == 0) break;

            System.out.println(dp[i-1]/3650+1);
        }
    }
}

Measured memory_bytes: 17184
#include<stdio.h>
#include<iostream>
#include<string.h>

int H,W;
char map[200][200];
void flood(int typ, int x,int y){
    if(x<0||x>W||y<0||y>H||map[y][x]!=typ)return;
    map[y][x]='X';
    flood(typ,x,y-1); flood(typ,x+1,y); flood(typ,x,y+1); flood(typ,x-1,y);
}
int main(){
    while(scanf("%d%d",&H,&W)!=EOF){if(H==0&&W==0)return 0;
        for(int i=0;i<H;i++)scanf("%s",&map[i]);
        int count=0;
        for(int i=0;i<H;i++){
            for(int j=0;j<W;j++){
                if(map[i][j]!='X'){flood(map[i][j],j,i);count++;}
            }
        }printf("%d\n",count);
    }return 0;
}

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

int main() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll ans = max(a * c, max(a * d, max(b * c, b * d)));
    cout << ans;
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long int LL;
//Compiler version g++ 6.3.0
int fact(LL n){
  if(n==1||n==0){
    return 1; 
  }  
  else{
    return fact(n-1)*n;}
}
int main()
{
  LL n; 
  cin>>n;
  LL c; 
  if(n<=599){
    c=8;
    cout<<c<<endl; 
  //  return;
  }
  else if(n<=799){
    c=7;
    cout<<c<<endl; 
  //  return;
  }
 else if(n<1000){
   c=6;
    cout<<c<<endl; 
 //   return;
  }
 else if(n<1200){
   c=5;
     cout<<c<<endl; 
 //    return;
  }
  else if(n<1400){
    c=4;
    cout<<c<<endl; 
 //   return;
  }
  else if(n<1600){
    c=3;
    cout<<c<<endl; 
  //  return;
  }
 else if(n<1800){
   c=2;
    cout<<c<<endl; 
 //   return; 
  }
 else if(n<2000){
   c=1;
    cout<<c<<endl; 
  }
  return 0; 
 }
       


Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <functional>
#include <iomanip>
int MOD=1e9+7;
using namespace std;
int main(){
    int n,h,w;
    cin >> n >> h >> w;
    int c=0;
    for(int i=0;i<n;i++){
        int a,b;
        cin >> a >> b;
        if(a>=h && b>=w){
            c++;
        }
    }
    cout<<c<<endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>

using namespace std;

int main(int argc, char const *argv[])
{
	int K, S;
	cin >> K >> S;

	int ans = 0;

	for (int x = 0; x < K + 1; ++x)
	{
		for (int y = 0; y < K + 1; ++y)
		{
			int z = S - x - y;
			if (0 <= z && z <= K)	
			{
				ans++;
			}
		}
	}

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

Measured memory_bytes: 256
s = int(input())
t = 10 ** 9
a = 0
b = 0
c = 0
d = 0
if s <= t:
    a = s
    d = 1
    c = 0
    b = 0
else:
    a = t
    k = s % a
    if k:
        d = s // a + 1
        c = a * d - s
        b = 1
    else:
        d = s // a
        c = 0
        b = 0
print(0, 0, a, b, c, d)


Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main(){
	int a,b,c,x,y;
	cin >> a >> b >> c >> x >> y;
	if(c*2<a+b){
		if(x<y){
			if(c*2<b){
				cout << c*2*y << "\n";
			}
			else{
				cout << c*2*x+b*(y-x) << "\n";
			}
		}
		else{
			if(c*2<a){
				cout << c*2*x << "\n";
			}
			else{
				cout << c*2*y+a*(x-y) << "\n";
			}
		}
	}
	else{
		cout << a*x+b*y;
	}
	return 0;
}


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

int main()
{
	int i;
	int x[6];
	for (i = 0; i < 5; i ++) {
		scanf("%d", &x[i]);
	}
	for (i = 0; i < 5; i ++) {
		if (x[i] == 0) {
			printf("%d\n", i + 1);
			break;
		}
	}
	return (0);
}


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

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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> tiii;

const int INF=1<<30;
const ll LINF = 1e18+5;

int A[100001];
int N;

int main() {
    cin >> N;
    rep(i, N) {
        cin >> A[i];
    }
    int Res[100001] = {};
    ll ans = 1;
    Res[0] = 3;
    rep(i, N) {
        if (Res[A[i]] == 0) {
            cout << 0 << endl;
            return 0;
        }
        ans = (ans * Res[A[i]]) % 1000000007;
        Res[A[i]]--;
        Res[A[i]+1]++;
    }
    cout << ans % 1000000007 << endl;
    return 0;
}

Measured memory_bytes: 1024
import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.util.Stack;


public class Main{
	public static class FastReader {
		BufferedReader br;
		StringTokenizer root;
		
 
		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
 
		String next() {
			while (root == null || !root.hasMoreTokens()) {
				try {
					root = new StringTokenizer(br.readLine());
				} catch (Exception r) {
					r.printStackTrace();
				}
			}
			return root.nextToken();
		}
 
		int nextInt() {
			return Integer.parseInt(next());
		}
 
		double nextDouble() {
			return Double.parseDouble(next());
		}
 
		long nextLong() {
			return Long.parseLong(next());
		}
 
		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception r) {
				r.printStackTrace();
			}
			return str;
		}
	}
	
	public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
	static int mod = (int) (1e9+7);
	static long cf = 998244353;
    static final long MAX = (long) 1e15;
    public static List<Integer>[] edges;
    public static int[][] parent;
    public static int col = 32;
    public static int[] Bit;
    public static long[] dp;
    public static long[] fac,inv;
	public static void main(String[] args) {
	
	
	FastReader sc = new FastReader();
	

	int n = sc.nextInt();
	int k = sc.nextInt();
	Long[] a = new Long[n];
	for(int i=0;i<n;++i) a[i] = sc.nextLong();
	Arrays.sort(a);
	long ans = 0;
	preprocess(n);
	for(int i=0;i<n;++i) {
		long max = (a[i]*(C(i,k-1)))%mod;
		long min = (a[i]*C(n-i-1,k-1))%mod;
		ans = (ans + max-min+mod)%mod;
	}
	out.print(ans);
	out.close();
	}

	private static long C(int n, int r) {
		if(r > n) return 0;
	
		return ((fac[n]*inv[r])%mod*inv[n-r])%mod;
	}

	private static void preprocess(int n) {
		// TODO Auto-generated method stub
		
		
		 fac = new long[n+1];
		 inv = new long[n+1];
		fac[0]=fac[1]=1;
		for(int i=2;i<fac.length;i++)
		{
			fac[i]=fac[i-1]*i;
			fac[i]%=mod;
		}
		
		inv[n]=pow(fac[n],(int) (mod-2));
		for(int i=n-1;i>=0;i--)
		{
			inv[i]=inv[i+1]*(i+1);
			inv[i]%=mod;
		}
		
	}

	private static long pow(long l, int i) {
		// TODO Auto-generated method stub
		return BigInteger.valueOf(l).modPow(BigInteger.valueOf(i), BigInteger.valueOf(mod)).longValue();
	}

	
	
}

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

using namespace std;

int n;
vector <int> pos, neg;
int zero;

long long calcZero() {
	return 1LL * zero * (n - zero) + 1LL * zero * (zero - 1LL) / 2LL;
}

long long calcPos(long long v) {
	//# of products <= v
	
	int p = (int)pos.size() - 1;
	long long tot = 0;
	
	for (int i = 0; i < pos.size(); i++) {
		while (p > i && 1LL * pos[i] * pos[p] > v) {
			p--;
		}
		if (p > i) {
			tot += p - i;
		}
	}
	
	p = (int)neg.size() - 1;
	
	for (int i = 0; i < neg.size(); i++) {
		while (p > i && 1LL * neg[i] * neg[p] > v) {
			p--;
		}
		if (p > i) {
			tot += p - i;
		}
	}
	
	tot += 1LL * (int)pos.size() * (int)neg.size();
	return tot;
}

long long calcNeg(long long v) {
	//# of products >= v
	
	int p = (int)neg.size() - 1;
	long long tot = 0;
	
	for (int i = 0; i < pos.size(); i++) {
		while (p >= 0 && 1LL * pos[i] * neg[p] >= v) {
			p--;
		}
		tot += (int)neg.size() - p - 1;
	}
	
	return tot;
}

int main() {
	long long k;
	scanf("%d%lld", &n, &k);
	
	for (int i = 0; i < n; i++) {
		int x;
		scanf("%d", &x);
		
		if (x > 0) pos.push_back(x);
		else if (x == 0) zero++;
		else neg.push_back(-x);
	}
	
	sort(pos.begin(), pos.end());
	sort(neg.begin(), neg.end());
	
	long long lb = -1e18;
	long long ub = 1e18;
	
	while (ub - lb > 1) {
		long long mid = (lb + ub) / 2;
		
		long long tot = 0;
		
		if (mid < 0) tot = calcNeg(-mid);
		else {
			tot = calcPos(mid) + calcZero();
		}
		
		if (tot < k) lb = mid;
		else ub = mid;
	}
	
	printf("%lld\n", ub);
}


Measured memory_bytes: 1400
#include <stdio.h>
#include <sysexits.h>
#include <math.h>
int main(void){
  int b,i,S;
  int a[4];
  if(scanf("%d",&S)!=1){
exit(1);
}
  b=0;
  for(i=0;i<4;i++){
    a[i]=S%10;
    S=S/10;
  }
  for(i=0;i<3;i++){
    if(a[i]==a[i+1]){
      b=1;
      break;
    }
  }
  if(b==1){
  printf("Bad");
  }
  else{
    printf("Good");
  }
  return 0;
}

Measured memory_bytes: 128
N = int(input())
A = [list(map(int, input().split())) for _ in range(N)]
time, x, y = 0, 0, 0
for i in range(N):
    timei, xi, yi = A[i][0], A[i][1], A[i][2]
    time = timei - time
    x = xi - x
    y = yi - y
    move = x + y
    if time >= move:
        if(move*time)%2==1 or (move*time)%4==0:
            ans = "Yes"
        else:
            ans = "No"
            break
    else:
        ans = "No"
        break
    time, x, y = timei, xi, yi
print(ans)

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

constexpr int atcoder_mod = 1e9+7;

using namespace std;
using ll = long long;

template<typename T=int>
T in(){T x; cin >> x; return (x);}

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

	int N=in(),Q=in();
	string S=in<string>();
	vector<int> sum(N,0);
	for(int i=1;i<N;i++){
		sum[i] = sum[i-1];
		if(S[i-1]=='A' && S[i]=='C'){
			sum[i]++;
		}
	}
	REP(i,Q){
		int l=in()-1,r=in()-1;
		cout << sum[r]-sum[l] << endl; 
	}
	return 0;
}


Measured memory_bytes: 1488
//参考：https://qiita.com/DaikiSuyama/items/9dba963ba74396b9b7fd
//インクルード(アルファベット順)
#include <algorithm>     //sort,二分探索,など
#include <bitset>        //固定長bit集合
#include <cmath>         //pow,logなど
#include <complex>       //複素数
#include <deque>         //両端アクセスのキュー
#include <functional>    //sortのgreater
#include <iomanip>       //setprecision(浮動小数点の出力の誤差)
#include <iostream>      //入出力
#include <iterator>      //集合演算(積集合,和集合,差集合など)
#include <map>           //map(辞書)
#include <numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include <queue>         //キュー
#include <set>           //集合
#include <stack>         //スタック
#include <string>        //文字列
#include <unordered_map> //イテレータあるけど順序保持しないmap
#include <unordered_set> //イテレータあるけど順序保持しないset
#include <utility>       //pair
#include <vector>        //可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      //sizeをsize_tからllに直しておく
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define FIR first    //pairの一つ目の要素
#define SEC second   //pairの二つ目の要素

signed main()
{
    //入力の高速化用のコード
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    REP(i, N)
    {
        cin >> A[i];
    }

    sort(ALL(A));

    ll sum = 0;
    REP(i, K)
    {
        sum += A[i];
    }

    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 3660
N,M = map(int,input().split())
graph = [0]*(N+1)
for i in range(N+1):
    graph[i]=list()
for i in range(M):#生成
    a,b = map(int,input().split())
    graph[a].append(b)
    graph[b].append(a)
graph[0].append(1)
# for i in range(N+1):#整列
#     graph[i].sort()
# print(graph)
ans = [-1]*(N+1)
ans[1] = 0
dis_stack = list()
dis_stack.extend(graph[0])
bef_stack = [1]
# k = 0
# print(graph)


while dis_stack:
    now_watch=dis_stack.pop(0)
    next_watch = graph[now_watch]
    for spot in next_watch:
        if(ans[spot] != -1):
            continue            
        # print(dis_stack)
        # print(bef_stack)
        dis_stack.append(spot)
        ans[spot] = now_watch
            # print(ans)
 
ans.pop(0)
print("Yes")
for i in range(1,len(ans)):
    print(ans[i])

    # k +=1
# 探索スタート地点を「探索候補スタック」に積む
# while スタックが空っぽになるまで
#     スタックから次の探索地点を1つ取り出す（pop）
#     「探索済みリスト」に取り出した地点を格納（ここが現在地点）
# 　　現在地点から、次に行こうと思えば行けるポイントを全部探し出す
#     for 地点 in 次に行こうと思えば行けるポイント
#         if その地点は既に「探索済みリスト」にある？
#             探索済みなので「探索候補スタック」には入れない（continue）
#         if その地点は既に「探索候補スタック」にある？（閉路があるなら可能性あり、木なら可能性なし）
#             探索予定なので「探索候補スタック」には入れない（continue）
#         未探索かつ候補にも入っていない地点なので「探索候補スタック」に追加する（append）
# print 探索済み地点

Measured memory_bytes: 33772
import java.util.* ;
import java.util.Map.Entry;
public class Main {
	public static void main(String[] args) {
		Scanner S = new Scanner( System.in ) ;
		char ch = S.nextLine().charAt(0)  ;
		if( Character.isUpperCase(ch) ) System.out.println( 'A' ) ;
		else System.out.println( 'a' ) ;
	}
}

Measured memory_bytes: 35808
from operator import mul
from functools import reduce

def nCr(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

N, K = map(int, input().split())
MOD = 10 ** 9 + 7

for i in range(1, K + 1):
    if i > N - K + 1:
        ans = 0
    else:
#        ans = nCr(K - 1, i - 1) * nCr(N - K + 1, i) % MOD
        ans = nCr(K - 1, i - 1) * nCr(N - K + 1, i) % MOD
    print(ans)

Measured memory_bytes: 3944
n=int(input())
L=list(map(int,input().split()))

import collections

d=collections.Counter(L)
S=d[0]+d[1]
for i in range(1, 10**5+1):
	s=d[i-1]+d[i]+d[i+1]
	S=max(S,s)
print(S)

Measured memory_bytes: 20848
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
 
using namespace __gnu_pbds;
using namespace std;

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define ull unsigned long long
#define ld long double

#define mod 1000000007
#define EULER 2.7182818284
#define INF 1000000000

#define pb push_back
#define ins insert
#define IT iterator
#define PQ priority_queue
#define    nl           "\n"
#define fi first
#define se second
#define maxe max_element
#define mine min_element
#define er erase
#define lb lower_bound
#define ub upper_bound

#define vi vector<int>
#define vll vector<ll>
#define vb vector<bool>
#define pi pair<int,int>
#define pll pair<ll,ll>
#define all(v) v.begin(),v.end()

#define mem(v,i) memset(v,i,sizeof(v)) // v is array. To set all elements to 0 or -1 only. mem(arr,0);


#define repab(i,a,b) for(int i=(a);i<=(b);i++)
#define reprab(i,a,b) for(int i=(a);i>=(b);i--)
#define repll(i,a,b) for(ll 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 bs bitset
#define bpc(a) __builtin_popcount(a)
#define tc int t;cin>>t;while(t--)
template<typename T> void TIME(T start, T end)
{
#ifndef ONLINE_JUDGE
    double time_taken =  chrono::duration_cast<chrono::nanoseconds>(end - start).count();
    time_taken *= 1e-9;
    cout << "\nExecuted in: " << fixed
         << time_taken << setprecision(9);
    cout << " sec";
#endif
}

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

ll max(ll a,ll b)
{
    if(a>b)return a;return b;
}
ll min(ll a,ll b)
{
    if(a<b)return a;return b;
}

ll mypow(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
ll gcd(ll a,ll b)
{
    if(b==0)
    return a;
    return gcd(b,a%b);
}
#define MAX 1000
//..............................!!!!!!Get ready to fight!!!!!!............................
void printString(ll n) 
{ 
    char str[MAX]; // To store result (Excel column name) 
    ll i = 0; // To store current index in str which is result 
  
    while (n > 0) { 
        // Find remainder 
        int rem = n % 26; 
  
        // If remainder is 0, then a 'Z' must be there in output 
        if (rem == 0) { 
            str[i++] = 'z'; 
            n = (n / 26) - 1; 
        } 
        else // If remainder is non-zero 
        { 
            str[i++] = (rem - 1) + 'a'; 
            n = n / 26; 
        } 
    } 
    str[i] = '\0'; 
  
    // Reverse the string and print result 
    reverse(str, str + strlen(str)); 
    cout << str << endl; 
  
    return; 
} 

int main()
{   
     auto start = chrono::high_resolution_clock::now();
    fast
    ll n;
    cin>>n;
    printString(n);
    auto end = chrono::high_resolution_clock::now();
    TIME(start, end);
    return 0;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define rep(i,n) for(ll i=0;i<(n);i++)
int main(){
  ll n,k;cin>>n>>k;
  vector<ll> v(n);
  rep(i,n) cin>>v[i];
  ll dp[n];
  rep(i,n) dp[i]=1e10;
  dp[0]=0;
  rep(i,n-1){
    rep(j,k){
      if(i>=j) dp[i+1]=min(dp[i+1],dp[i-j]+abs(v[i+1]-v[i-j]));
    }
  }
  cout<<dp[n-1]<<endl;
}

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

# refered to
# rank : http://at274.hatenablog.com/entry/2018/02/02/173000
# size : abc120 kaisetsu
class UnionFind:
    def __init__(self, n):
        # par = Parent Number or NoV
        self.par = [-1] * (n+1)
        # rank = Tree Height
        self.rank = [0] * (n+1)
    
    # 自分が所属する集合の数を返す
    def size(self, x):
        return -1*self.par[self.find(x)]
    
    def size_list(self):
        return [x*(-1) for x in self.par[1:] if x < 0]

    # 根なら番号を返す
    def find(self, x):
        
        if(self.par[x] < 1):
            return x
        self.par[x] = self.find(self.par[x])
        return self.par[x]

    # 親が同じか判定
    def same_check(self, x, y):
        return self.find(x) == self.find(y)

    def union(self, x, y):
        # 根を探す
        x = self.find(x)
        y = self.find(y)

        # もう繋がれている
        if(x == y):
            return False

        # つなぎ替える
        if(self.size(x) < self.size(y)):
            x,y = y,x
        
        # xのサイズを更新
        self.par[x] += self.par[y]
        # yのサイズ(おやばんごう)をxに
        self.par[y] = x

        return True 

def solve(N: int, M: int, p: "List[int]", x: "List[int]", y: "List[int]"):
    uf = UnionFind(N)

    for i in range(M):
        uf.union(x[i], y[i])

    ans = 0
    for i in range(1, N+1):
        if(uf.same_check(i, p[i-1])):
            ans += 1

    print(ans)

    return


# Generated by 1.1.3 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    p = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    x = [int()] * (M)  # type: "List[int]" 
    y = [int()] * (M)  # type: "List[int]" 
    for i in range(M):
        x[i] = int(next(tokens))
        y[i] = int(next(tokens))
    solve(N, M, p, x, y)

if __name__ == '__main__':
    main()


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

#define F first
#define S second
#define pb push_back
#define SZ(x) (int)(x.size())

typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;

const ll maxn=1e5+10, mod=1e9+7, inf=1e18;

ll dp[maxn],h[maxn];

int main(){

	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);

	ll n; cin>>n;
	for(int i=1;i<=n;i++) cin>>h[i];

	dp[1]=0;
	dp[2]=abs(h[2]-h[1]);
	for(int i=3;i<=n;i++) dp[i]=min(dp[i-2]+abs(h[i-2]-h[i]),dp[i-1]+abs(h[i-1]-h[i]));
	cout<<dp[n]<<endl;


	return 0;

}




















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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin >> N;
    vector<int> A(N);
    int GCD = A[0];
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
        GCD = __gcd(A[i], GCD);
    }
    if (GCD != 1) {
        cout << "not coprime\n";
        return 0;
    }
    vector<bool> used(1E6, false);
    for (int i = 0; i < N; ++i) {
        int cur = A[i];
        for (int j = 2; j * j <= cur; ++j) {
            if (cur % j == 0) {
                if (used[j]) {
                    cout << "setwise coprime\n";
                    return 0;
                }
                used[j] = true;
                while (cur % j == 0) {
                    cur /= j;
                }
            }
        }
        if (cur != 1) {
            if (used[cur]) {
                cout << "setwise coprime\n";
                return 0;
            }
            used[cur] = true;
        }
    }
    cout << "pairwise coprime\n";
    return 0;
}

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

int main() {
  int X;
  cin >> X ;
  int X2 = X;
  int total=0;
  int A = 100000000;
  
  for (int i = 0; i < 9; i++) {
    if(X/A == 0){ A /= 10; continue; } 
    else { total += X/A;
          X -= (X/A)*A;
          A /= 10;}}
  if(X2%total == 0){
    cout << "Yes" << endl;} else{
    cout << "No" << endl;}
  

}


Measured memory_bytes: 256
n, x, m = map(int, input().split())
l = [x]
a = x
loopsum = 0
loopnum = 0


for i in range(n - 1):
    a = a**2%m
    if a not in l:
        l.append(a)
    else:
        pos = l.index(a)
        loopnum = len(l[pos:])
        loopsum = sum(l[pos:])
        break

if loopnum > 0:
    rest = (n - len(l))%loopnum
    times = (n - len(l))//loopnum
    ans = sum(l) + loopsum*times
    for i in range(rest):
        ans += l[pos + i]
else:
    ans = sum(l)

print(ans)

Measured memory_bytes: 69196
def main():
  t = input().split(" ")
  N, M = int(t[0]), int(t[1])
  x = set([0])
  n = [1]*N
  for i in range(M):
    t = input().split(" ")
    fr, to = int(t[0])-1, int(t[1])-1
    if fr in x:
      x.add(to)
    n[fr] -= 1
    n[to] += 1
    if (fr in x) and n[fr] == 0:
        x.remove(fr)
  print(len(x))

main()


Measured memory_bytes: 12652
import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush,heapify
import math
from copy import deepcopy
import queue
#import sympy as syp(素因数分解とか)
Mod = 1000000007
  
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[y] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)

def main():  #startline-------------------------------------------
     a, b = map(int, input().split())
     print(a*b)
if __name__ == "__main__":
    main() #endline===============================================

Measured memory_bytes: 9840
N = int(input())
A = list(int(x) for x in input().split())

while 1 < len(A):
	low = min(A)
	A.remove(low)

	A = map(lambda x: x%low, A)
	A = list(filter(lambda x: x>0, A))

	A.append(low)

print(A[0])

Measured memory_bytes: 15020
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define EPS (1e-10)
#define equals(a, b) (fabs((a)-(b)) < EPS)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;

struct mint {
  ll x;
  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;
  }
   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;}
};
typedef vector<mint> vm;
typedef vector<vm> vvm;

class Combi {
private:
  v(ll) fac, inv, finv;
  void init(int N) {
    fac[0] = fac[1] = 1; inv[1] = 1; finv[0] = finv[1] = 1;
    for (int i = 2; i < N; i++) {
      fac[i] = fac[i - 1] * i % MOD;
      inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
      finv[i] = finv[i - 1] * inv[i] % MOD;
    }
  }
public:
  Combi(int N) : fac(N + 1), inv(N + 1), finv(N + 1) { init(N + 1); }
  ll Cmod(int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
  }
  ll Pmod(int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * finv[n - k] % MOD;
  }
};
  
int main() {
  int N;
  cin >> N;
  mint ans = 0;
  Combi comb(N);
  srep(k,2,N+1) {
    mint r = mint(2).pow(k)-2;
    r *= mint(8).pow(N-k);
    r *= comb.Cmod(N,k);
    ans += r;
  }
  cout << ans.x << endl;
  return 0;
}

Measured memory_bytes: 26592
#include <iostream>
#include <algorithm>
#include<vector>
#include <queue>
#include "math.h"
#include <string>
using namespace std;
int main()
{
	int n,a;
	int f = 0;
	int d = 0;

	cin >> n ;
	

	for (int i = 1; i <= n; i++) {
		cin >> a;
		if (a % 4 == 0)f++;
		else if (a % 2 == 0)d++;
	}
	if(d==0&&2*f+1>=n)cout << "Yes" << endl;
	else if(d==0)cout << "No" << endl;
	else if(2*f+d>=n)cout << "Yes" << endl;
	else cout << "No" << endl;

}

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

using namespace std;

int main () {
  string a, b;
  cin >> a >> b;
  int n = a.size();
  int m = b.size();
  vector <vector <int>> dp(n + 1, vector <int> (m + 1, 0));
  vector <vector <pair <int, int>>> path(n + 1, vector <pair <int, int>> (m + 1, {0, 0}));
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (dp[i - 1][j] < dp[i][j - 1]) path[i][j] = {0, -1};
      else path[i][j] = {-1, 0};
      dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
      if (a[i - 1] == b[j - 1] and dp[i][j] < 1 + dp[i - 1][j - 1]) {
        dp[i][j] = 1 + dp[i - 1][j - 1];
        path[i][j] = {-1, -1};
      }
    }
  }
  string ans = "";
  int l = n, r = m;
  while (true) {
    pair <int, int> pp = path[l][r];
    if (pp.first == -1 and pp.second == -1) {
      ans += a[l - 1];
      l--;
      r--;
    }
    else if (pp.first == -1) l--;
    else if (pp.second == -1) r--;
    else break;
  }
  reverse(begin(ans), end(ans));
  cout << ans << endl;
  return (0);
}


Measured memory_bytes: 105984
// C - GeT AC

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

int cnt_ac[100001];

int main() {
	int N, Q;
	string S;
	cin >> N >> Q >> S;

	for (int i=1; i<N; i++) {
		if (S[i-1] == 'A' && S[i] == 'C') cnt_ac[i] = cnt_ac[i-1] + 1;
		else cnt_ac[i] = cnt_ac[i-1];
	}

	vector<int> ans;
	for (int i=0; i<Q; i++) {
		int l, r;
		cin >> l >> r;
		l--;
		r--;
		ans.push_back(cnt_ac[r] - cnt_ac[max(0, l)]);
	}

	for (int a : ans) {
		cout << a << endl;
	}

	return 0;
}

Measured memory_bytes: 4404
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <climits>
#include <string>
#include <set>
#include <cmath>
#include <map>
#include <unordered_map>
#include <numeric>
#include <random>
#include <memory>
#include <chrono>
#include <iterator>
#include <functional>
#ifdef LOCAL
#include "debug.h"
#else
#define debug(x...)
#endif
//#pragma GCC optimize("Ofast")

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
#define mp make_pair
#define pb push_back
#define sz(x) int((x).size())

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int N = 2e5 + 7;
const int inf = INT_MAX / 2;
const ll INF = LLONG_MAX / 3;
const int MOD = 998244353;
const ld eps = 1e-6;
const string cars[] = {"🚗", "🚕", "🚙"};


signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    cout << fixed << setprecision(3);
    cin.tie();
    cout.tie();

    ll a, b;
    cin >> a >> b;

    if (b == 1) {
        cout << 0;
    }
    else if (a >= b) {
        cout << 1;
    }
    else {
        b -= a;
        cout << int(ceil((ld)b / (a - 1))) + 1;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  cout << (N+1)/2 << "\n";
  return 0;
}


Measured memory_bytes: 3592
#include<bits/stdc++.h>
typedef long long int ll;
typedef long long unsigned int llu;
#define pb push_back
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define F first
#define S second
#define ALL(a) (a).begin(),(a).end()
#define YUGEN ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define lp(i,start,end) for(int i=start;i<end;i++)
#define MAX 105
#define test() ll t; cin>>t; while(t--)
using namespace std;
ll gcd(ll a,ll b) {if (a==0) return b;return gcd(b%a,a);}
int main()
 {
    YUGEN;
       int n;
       cin>>n;
       ll a[n];
       for(int i=0;i<n;i++)
        cin>>a[i];
        int ans=0;
       for(int i=0;i<n;i++)
       {
           int u=a[i];
       for(int j=i+1;j<n;j++)
       {
           int v=a[j];
           for(int k=j+1;k<n;k++)
           {
               int w=a[k];
               if(u!=v and v!=w and w!=u and u+v>w and v+w>u and u+w>v)
                ans++;
           }
       }
       }
       cout<<ans;

	return 0;

 }



Measured memory_bytes: 3652
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define drep(i,a,b) for(ll i=(a);i>=(b);--i)
#define SIZE(a) int((a).size())
#define out(a) cout<<(a)<<endl;
const int INF=INT_MAX;
const int MAX = 510000;
const ll MOD = 1000000007;
ll fac[MAX], finv[MAX], inv[MAX];

int main(){
  ll n,k;cin>>n>>k;
  ll tmp=0;
  vvll s(n,vll(2));
  rep(i,0,n){
    cin>>s[i][0]>>s[i][1];
  }
  sort(s.begin(),s.end());
  ll i=0;
  while(tmp<k){
    if(k-tmp>s[i][1]){
      tmp+=s[i][1];
      i++;
    }
    else{
      tmp+=s[i][1];
      cout<<s[i][0]<<endl;
    }
  }
}


Measured memory_bytes: 8820
use proconio::{input, fastout};
use proconio::marker::{Chars};
use proconio::marker::Usize1;
use std::cmp::*;

macro_rules! debug {
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

#[fastout]
fn main() {
    input!{
        a: i64,
        b: i64,
        c: i64,
        d: i64,
    }

    println!("{}", max(b*c,max(a*d,max(a*c, b*d))));

}


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

#define rep(i, m, n) for(int(i) = (int)(m); i < (int)(n); ++i)
#define rep2(i, m, n) for(int(i) = (int)(n)-1; i >= (int)(m); --i)
#define REP(i, n) rep(i, 0, n)
#define REP2(i, n) rep2(i, 0, n)
#define all(hoge) (hoge).begin(), (hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
template <class T>
using vec = vector<T>;
template <class T>
using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
using tp = tuple<ll, ll, ll>;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
//constexpr long long MOD = (ll)1e9 + 7;
constexpr long long MOD = 998244353LL;
using ld = long double;
static const ld pi = 3.141592653589793L;
typedef vector<ll> Array;
typedef vector<Array> Matrix;

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

//グラフ関連
struct Edge {
    ll to, cap, rev;
    Edge(ll _to, ll _cap, ll _rev) {
        to = _to;
        cap = _cap;
        rev = _rev;
    }
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph &G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
    G[from].push_back(Edge(to, cap, (ll)G[to].size()));
    if(revFlag)
        G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

void solve() {
    ll d, t, s;
    cin >> d >> t >> s;
    if(d <= t * s) {
        cout << "Yes" << en;
    } else {
        cout << "No" << en;
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    /*
    ll t;
    cin >> t;
    while(t--)*/
    solve();

    return 0;
}


Measured memory_bytes: 3616
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    class QuestionB
    {
        public static void Main(string[] args)
        {
            var inputIntArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i));
            int n = inputIntArray.ElementAt(0);
            int k = inputIntArray.ElementAt(1);
            var hArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i));

            int result = 0;
            foreach(int h in hArray)
            {
                if(h >= k)
                {
                    result++;
                }
            }
            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 15840
#include <iostream>
#include <cmath>
using namespace std;
int main(){
    int a, b, flag=-1;
    cin >> a >> b;
    for(double i=0;i<1300;i++){
        if(a==floor(i*0.08)&&b==floor(i*0.1)) {
            flag = i;
            break;
        }
    }
    if(flag==-1) cout << flag << endl;
    else cout << flag << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <functional>
#include <unordered_set>
#include <vector>
#include <cmath>
using namespace std;


int main(void) {
    long long N;

    cin >> N;

    for(long long i=1; i<=N; ++i)
    {
        long long sum = 0;
        for(long long x=1; x<=i-4-x*x; ++x)
        {
            for(long long y=1; y<=i-4-y*y;++y)
            {
                double d_z_1 = (-(x+y) +  sqrt((x+y)*(x+y) - 4*(i-x*x-y*y-x*y))) / 2;
                double d_z_2 = (-(x+y) +  sqrt((x+y)*(x+y) + 4*(i-x*x-y*y-x*y))) / 2;
                long long z = 0;
                if(d_z_1 < 1 || d_z_1 > i-4 || d_z_1 - (long long)d_z_1 != 0.0)
                {
                    if(d_z_2 < 1 || d_z_2 > i-4 || d_z_2 - (long long)d_z_2 != 0.0)
                    {
                        continue;
                    }
                    else
                    {
                        z = (long long)d_z_2;
                    }
                    
                }
                else
                {
                    z = (long long)d_z_1;
                }
                if(x*x+y*y+z*z+x*y+y*z+z*x == i)
                {
                    sum++;
                }
            }
        }
        cout << sum << endl;
    }
}

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

#if DEBUG
template <typename T>
void debug(const T& value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(const T& value, const Ts&... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                        \
  do {                                  \
    cerr << #__VA_ARGS__ << ": ";       \
    debug(__VA_ARGS__);                 \
    cerr << " (L" << __LINE__ << ")\n"; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define rd(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << '\n';
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define wt(...) write_to_cout(__VA_ARGS__);

#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using ll = long long;

template <typename T>
using V = std::vector<T>;
template <typename T>
using VV = V<V<T>>;

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  rd(int, n);
  map<pair<ll, ll>, ll> m;
  rep(i, n) {
    rd(string, s);
    string l = s;
    ll two = 0, five = 0;
    rep(j, s.size()) if (s[j] == '.') {
      string r = s.substr(j + 1);
      l = s.substr(0, j) += r;
      two -= r.size();
      five -= r.size();
    }
    {
      ll x = atoll(l.c_str());
      while (x % 2 == 0) {
        ++two;
        x /= 2;
      }
      while (x % 5 == 0) {
        ++five;
        x /= 5;
      }
    }
    ++m[{two, five}];
  }
  ll ans = 0;
  for (auto [a, b] : m) {
    for (auto [c, d] : m) {
      auto [e, f] = a;
      auto [g, h] = c;
      if (e + g >= 0 && f + h >= 0) {
        if (a == c) {
          ans += b * (b - 1) / 2;
        } else {
          ans += b * d;
        }
      }
      if (a == c) break;
    }
  }
  wt(ans);
}


Measured memory_bytes: 3628
import java.io.IOException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws IOException {
		Scanner cin = new Scanner(System.in);
		String line;
		for (; cin.hasNext();) {
			line = cin.nextLine();
			String[] s = line.split(" ");
			int N = Integer.valueOf(s[0]); // キャンディー

			int result = (N * (N + 1))/2;

			System.out.println(result);

		}
	}
}


Measured memory_bytes: 9812
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    ll N, M, V, P;
    cin >> N >> M >> V >> P;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];
    sort(All(A));
    reverse(All(A));
    ll res = P;
    ll pool = A[P - 1];
    ll len = 1;
    ll ok = N - P - 1;
    for(int i = P; i < N; i++) {
        if(V <= P + ok) {
            if(A[P - 1] <= A[i] + M)
                res++;
            else {
                break;
            }
        } else {
            if(A[P - 1] <= A[i] + M &&
               (A[i] + M) * len - pool >= M * (V - (P + ok))) {
                res++;
            } else {
                break;
            }
        }
        pool += A[i];
        len++;
        ok--;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 4044
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;
typedef long long ll;

const ll INF = 10000000000000LL;

ll calc(ll a, ll b, ll c)
{
	//cout<<a<<" "<<b<<" "<<c<<endl;
	ll maxnum = max(max(a,b),c);
	ll minnum = min(min(a,b),c);
	return maxnum - minnum;
}

int main()
{
	ll h,w;
	scanf("%lld%lld",&h,&w);
	ll ans = min(h,w);
	
	ans = min(ans, calc(w*(h/3LL), w*(h/3LL), w*(h-(h/3LL)*2LL)));
	ans = min(ans, calc(h*(w/3LL), h*(w/3LL), h*(w-(w/3LL)*2LL)));
	for (ll x=1;x<h;x++) ans = min(ans, calc(x*w,(h-x)*(w/2LL), (h-x)*(w-w/2LL)));
	for (ll x=1;x<w;x++) ans = min(ans, calc(h*x,(w-x)*(h/2LL), (w-x)*(h-h/2LL)));
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
long long int k;
scanf("%lld",&k);
printf("50\n");
long long int a[50],i,n,m;
for(i=0;i<50;i++){
a[i]=i;
}

n=k/50;
m=k%50;
for(i=0;i<m;i++){
a[i]=i+50-m+1+n;
}
for(i=m;i<50;i++){
a[i]=a[i]-m+n;
}
for(i=0;i<50;i++){
printf("%lld ",a[i]);
}
return 0;
}

Measured memory_bytes: 128
#include <iostream>

using namespace std;
using ll = long long;

ll hoge1(ll n) {
  static ll data[100] = {};
  if (data[n] != 0)
    return data[n];
  return data[n] = n == 0 ? 1 : 3 + 2 * hoge1(n-1);
}

ll hoge2(ll n, ll x) {
  if (n == 0)
    return 1;
  else if (x == 1)
    return 0;
  else if (x <= hoge1(n-1) + 1)
    return hoge2(n-1, x-1);
  else if (x == hoge1(n-1) + 2)
    return hoge2(n-1, hoge1(n-1)) + 1;
  else if (x <= 2 + 2 * hoge1(n-1))
    return hoge2(n-1, hoge1(n-1)) + hoge2(n-1, x - hoge1(n-1) - 2) + 1;
  else
    return hoge2(n-1, hoge1(n-1)) * 2 + 1;
}


int main() {
  ll n, x;
  cin >> n >> x;
  cout << hoge2(n, x) << endl;
}


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

int main() {
  int N;
  cin >> N;
  if (N == 100000)
    cout << 90909 << endl;
  else if (N >= 10000)
    cout << 9 + 900 + (N - 9999) << endl;
  else if (N >= 1000)
    cout << 909 << endl;
  else if (N >= 100)
    cout << 9 + (N - 99) << endl;
  else if (N > 8)
    cout << 9 << endl;
  else
    cout << N << endl; 
}


Measured memory_bytes: 256