akhauriyash/Code-Regression huggingface dataset:
import sys
sys.setrecursionlimit(10**7)

N = int(input())
h = list(map(int, input().split()))

dp = [float("inf")] * N

# # 足場 i から 足場 N - 1 まで移動するときのコストの最小値
# def rec(i):
#     if dp[i] >= 0:
#         return dp[i]
    
#     res = -1
#     if i == N - 1:
#         res = 0
#     elif i == N - 2:
#         res = rec(i + 1) + abs(h[i + 1] - h[i])
#     else:
#         res =  min(rec(i + 1) + abs(h[i + 1] - h[i]), rec(i + 2) + abs(h[i + 2] - h[i]))
    
#     dp[i] = res
#     return dp[i]

# print(rec(0))

dp[N - 1] = 0
for i in reversed(range(N - 1)):
    for j in range(1, 3):
        if (i + j <= N - 1):
            dp[i] = min(dp[i], dp[i + j] + abs(h[i + j] - h[i]))

print(dp[0])

Measured memory_bytes: 20512
#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>
#undef max
#undef min

constexpr int INF = 99999999;
std::unordered_map<int, int> drawTable; // key:カードの数字 value:引く順番

int markNumber(std::vector<std::vector<int>>& mat, int minBingo) {
    std::vector<std::vector<int>> openTable;
    std::vector<int> eachMinBingoTurn;
 
    int bingoCount = 0;
    for (auto& line : mat) {
        openTable.push_back(std::vector<int>());
        for (auto& x : line) {
            auto order = drawTable.find(x);
            if (order != drawTable.end()) {
                openTable.back().push_back(order->second);
            }
            else openTable.back().push_back(INF);
        }
    }

    // 横方向のビンゴ
    for (int i = 0; i < openTable.size(); i++) {
        int minTurn = 0;
        for (int j = 0; j < openTable[i].size(); j++) {
            minTurn = std::max(minTurn, openTable[i][j]);
        }
        eachMinBingoTurn.push_back(minTurn);
    }

    if (mat.size() > 1) {
        // 縦方向のビンゴ
        for (int i = 0; i < openTable.size(); i++) {
            int minTurn = 0;
            for (int j = 0; j < openTable[i].size(); j++) {
                minTurn = std::max(minTurn, openTable[j][i]);
            }
            eachMinBingoTurn.push_back(minTurn);
        }

        // ななめ方向のビンゴ
        int minTurn = 0;
        for (int i = 0; i < openTable.size(); i++) {
            minTurn = std::max(minTurn, openTable[i][i]);
        }
        eachMinBingoTurn.push_back(minTurn);

        // ななめ方向のビンゴ
        minTurn = 0;
        for (int i = 0; i < openTable.size(); i++) {
            minTurn = std::max(minTurn, openTable[i][openTable.size() - i - 1]);
        }
        eachMinBingoTurn.push_back(minTurn);
    }

    std::sort(eachMinBingoTurn.begin(), eachMinBingoTurn.end());

    if (minBingo > eachMinBingoTurn.size()) return INF;

    return eachMinBingoTurn[minBingo-1];
}

int main() {
    int n, u, v, m;
    std::vector<std::vector<int>> usaMat, nekoMat;
    std::vector<int> drawCards;

    std::cin >> n >> u >> v >> m;

    for (int i = 0; i < n; i++) {
        usaMat.push_back(std::vector<int>());
        for (int j = 0; j < n; j++) {
            int a; std::cin >> a;
            usaMat.back().push_back(a);
        }
    }

    for (int i = 0; i < n; i++) {
        nekoMat.push_back(std::vector<int>());
        for (int j = 0; j < n; j++) {
            int a; std::cin >> a;
            nekoMat.back().push_back(a);
        }
    }

    drawTable.reserve(100000);
    for (int i = 0; i < m; i++) {
        int a; std::cin >> a;
        drawTable.insert(std::make_pair(a, i));
    }
    

    int nunUsaTurn = markNumber(usaMat, u);
    int nunNekoTurn = markNumber(nekoMat, v);

    if (nunUsaTurn < nunNekoTurn) {
        std::cout << "USAGI" << std::endl;
        return 0;
    }
    else if (nunNekoTurn < nunUsaTurn) {
        std::cout << "NEKO" << std::endl;
        return 0;
    }
    else if (nunNekoTurn == nunUsaTurn) {
        std::cout << "DRAW" << std::endl;
        return 0;
    }
    return 0;
}


Measured memory_bytes: 7316
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ll long long
#define lson l,mid,p<<1
#define rson mid+1,r,p<<1|1
#define pii pair<int,int>
using namespace std;
const int inf=1e9+10;
const int mod=1e9+7;
const int maxn=1e5+10;
ll n,a,b;

int main(){
	//ios::sync_with_stdio(false);
	//freopen("in","r",stdin);
	cin>>n>>a>>b;
	ll p=n%(a+b);

	cout<<n/(a+b)*a+min(p,a)<<endl;
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using System.Numerics;
namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var N = long.Parse(Console.ReadLine());
            long sum = 0;
            long i = 1;
            if(N%2 == 0)
            {
                while (true)
                {
                    if (N / (long)Math.Pow(5, i) > 0)
                    {
                        sum += N / (long)Math.Pow(5, i) / 2;
                    }
                    else
                    {
                        break;
                    }
                    i++;
                }
                Console.WriteLine(sum);
            }
            else
            {
                Console.WriteLine("0");
            }
            

            

        }
        
    }

}

Measured memory_bytes: 13140
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        FastScanner sc = new FastScanner();
        int N = sc.nextInt();
        int max = 1;
        HashMap<Integer, Integer> map = new HashMap<>();
        map.put(sc.nextInt(), 1);
        for (int i=1; i<N; i++) {
            int P = sc.nextInt();
            if (map.containsKey(P-1)) {
                int val  = map.get(P-1)+1;
                map.put(P, val);
                map.remove(P-1);
                if (val > max) {
                    max = val;
                }
            } else {
                map.put(P, 1);
            }
        }
        out.println(N-max);
        out.flush();
    }
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}

Measured memory_bytes: 48408
N, A, B = map(int, input().split())
ans = []
 
if A+B-1<=N<=A*B:
    S = N-A
    cur = N
    ans = []
    for i in range(A+1):
        num = min(B-1, S)+1
        S -= num-1
        for j in range(num):
            ans.append(cur-num+1+j)
        cur -= num
    ans = ans[::-1][1:]
    print(*ans)
else:
    print(-1)

from bisect import bisect


def LIS(L):
    INF, N = 10**12, len(L)
    seq = [INF] * N
    for i in L:
        seq[bisect(seq, i)] = i
    return N - seq.count(INF)

Measured memory_bytes: 25636
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <algorithm>
#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{
      if (d.same(u,v)){
        cout << 1 << "\n";
      }else{
        cout << 0 << "\n";
      }
    }
  }
  return 0;
}


Measured memory_bytes: 3956
#include <bits/stdc++.h>
#define DEBUG if(0)
#define lli long long int
#define ldouble long double
using namespace std;

const int maxN = 101;
char s[maxN];

int main()
{
  while (scanf("%s", s) != EOF)
  {
    getchar();
    int n = strlen(s), ans = 0;
    for (int i = 0, j = n - 1; i < j; i ++, j --)
      if (s[i] != s[j])
        ans ++;
    printf("%d\n", ans);
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

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

const int MOD = 1e9 + 7;

int add(int a, int b) {
	return (a + b) % MOD;
}

int mul(int a, int b) {
	return (a * b) % MOD;
}

int modpow(int base, int exp, int modulus) {
  base %= modulus;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = (result * base) % modulus;
    base = (base * base) % modulus;
    exp >>= 1;
  }
  return result;
}

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);

    int N, M;
    cin >> N >> M;

    rep(i, M){
      int tmp;
      cin >> tmp;
      N -= tmp;
    }

    if(N < 0){
      N = -1;
    }

    cout << N << endl;

    return 0;
}


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

int main() {
  int h,w;
  int inf = 1e5+1;
  cin >> h >> w;
  
  vector<string>data(h);
  vector<vector<int>>dp(h,vector<int>(w));
  rep(i,0,h) cin >> data[i];
  if(data[0][0] != '#') dp[0][0] = 0;
  else dp[0][0] = 1;
  
  rep(i,0,h){
    rep(j,0,w){
      if(i == 0 && j == 0) continue;
      int l,u;
      if(j == 0) l = inf;
      else{
        l = dp[i][j-1];
        if(data[i][j] != data[i][j-1]) l++;
      }
      if(i == 0) u = inf;
      else{
        u = dp[i-1][j];
        if(data[i][j] != data[i-1][j]) u++;
      }
      dp[i][j] = min(l,u);
    }
  }
  if(data[h-1][w-1] == '#') dp[h-1][w-1]++;
  cout << dp[h-1][w-1]/2 << endl;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using i64 = long long;

std::vector<long long> fact, inv;

constexpr auto pow(long long x, long long n, const long long mod) {
    long long ret = 1;
    while(n > 0) {
        if ((n & 1) == 1) ret = (ret * x) % mod;
        x = (x * x) % mod;
        n >>= 1;
    }
    return ret;
}

constexpr auto inverse(const long long x, const long long p) {
    return pow(x, p - 2, p);
}

void init_factorial(const int n, const long long mod) {
    fact.resize(n + 1);
    inv.resize(n + 1);
    fact[0] = 1;
    for (long long i = 1; i <= n; i++) fact[i] = fact[i - 1] * i % mod;
    inv[n] = inverse(fact[n], mod);
    for (long long i = n; i > 0; i--) inv[i - 1] = inv[i] * i % mod;
}

int main() {
    constexpr i64 mod = 1000000007;
    i64 n, k;
    std::cin >> n >> k;
    init_factorial(2 * n, mod);

    if (k >= n - 1) {
        std::cout << fact[2 * n - 1] * inv[n] % mod * inv[n - 1] % mod << std::endl;
        return 0;
    }

    i64 ret = 0;
    for (int i = n - k; i <= n; i++) {
        ret = (ret + fact[n - 1] * inv [i - 1] % mod * inv[n - i] % mod * fact[n] % mod * inv[i] % mod * inv[n - i] % mod) % mod;
    }

    std::cout << ret << std::endl;

    return 0;
}


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

typedef long long ll;
using namespace std;
const int modn=1e9+7;
const int maxn=2e5+10;
ll inv[maxn];
ll pow(ll a, ll n, ll p)
{
    ll ans = 1;
    while(n)
    {
        if(n & 1) ans = ans * a % p;
        a = a * a % p;
        n >>= 1;
    }
    return ans;
}
int main()
{
    int n,k;
    scanf("%d%d",&n,&k);
    k=min(k,n-1);
    inv[1]=inv[0]=1;
	for(int i=2;i<=2e5;i++)inv[i]=(modn-modn/i)*inv[modn%i]%modn;
	ll sum=0;
	ll now1=1,now2=1;
	for(int i=0;i<k;i++){
        now1=now1*(n-i)%modn*inv[i+1]%modn;
        now2=now2*(n-1-i)%modn*inv[i+1]%modn;
        sum=(sum+now1*now2%modn)%modn;
	}
	sum=(sum+1)%modn;
	printf("%lld\n",sum);
    return 0;
}


Measured memory_bytes: 1792
N,X = list(map(int,input().split(" ")))
listA = [0]
count = 0
F = 0
R = list(map(int,input().split()))
for i in range(N):
    F += R[count] 
    if X < F:
        break
    else:
        listA.append(F)
        count += 1
print(len(listA))
    

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int k;
    string s,s1="...";
    cin>>k>>s;
    if(k>=s.length()){
        cout<<s;
    }
    else{
            s=s.substr(0,k);
            s+=s1;
        cout<<s;
    }
}



Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define int         long long
#define endl        "\n"
#define P           pair<int, int>
#define dint        long double

const int mod = 998244353;
 
inline int add(int a, int b) { int res = a + b; if(res >= mod) res -= mod;  return res; }
inline int sub(int a, int b) { int res = a - b; if(res < 0) res += mod; return res;}
inline int mul(int a, int b) { return (a * b)%mod; }
 
int modpow(int a, int b) {
    if(a == 0 || a == 1 || b == 1) return a;
    int ans = 1;
    while(b) {
        if(b%2) ans = mul(ans, a);    
        b /= 2; a = mul(a, a);
    }   return ans;
}

struct qu {
    int a, b, c, d;
};

void solve() {
    /*int n, m, q; cin >> n >> m >> q;
    qu v[q];
    for(int i=0; i<q; i++) {
        cin >> v[i].a >> v[i].b >> v[i].c >> v[i].d;
    }*/
    int cur = 100;
    int x; cin >> x;
    int yr = 0;
    while(cur < x) {
        int inc = cur / 100;
        cur += inc;
        yr++;
    }   cout << yr << endl;
}

signed main() {

    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cout << fixed << setprecision(12);

    int T = 1;
    //cin >> T;
    for(int i=1; i<=T; i++) {
        solve();
    }
    return 0;

}



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

int main()
{
    //入力
    int N, M;
    cin >> N >> M;

    char A[50][50] = { { 0 } }, B[50][50] = { { 0 } };
    for( int i = 0; i < N; ++i ){
        string s;
        cin >> s;
        for( int j = 0; j < N; ++j ){
            A[i][j] = s.c_str()[j];
        }
    }
    for( int i = 0; i < M; ++i ){
        string s;
        cin >> s;
        for( int j = 0; j < M; ++j ){
            B[i][j] = s.c_str()[j];
        }
    }


    //パターンマッチング
    for( int i = 0; i < N*N; ++i ){
        bool flag = true;
        for( int j = 0; j < M && flag; ++j ){
            for( int k = 0; k < M && flag; ++k ){
                if( A[j+i/N][k+i%N] != B[j][k] ) flag = false;
            }
        }
        if( flag == true ){
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;


    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef int64_t ll;
struct Solution {
    void solve(std::istream& in, std::ostream& out) {
        string s;
        in >> s;
        ll len = s.length() - 2;
        out << s[0] << len << s[s.length() - 1] << endl;
    }
};
void solve(std::istream& in, std::ostream& out) {
    out << std::setprecision(12);
    Solution solution;
    solution.solve(in, out);
}
#include <fstream>
#include <iostream>
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    istream& in = cin;
    ostream& out = cout;
    solve(in, out);
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {


		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		String[] s = sc.next().split("");
		if(s.length != a+ b +1) {
			System.out.println("No");
			return;
		}
		for(int i = 0;i < a + b + 1;i++) {
			if(i == a) {
				if(!s[i].equals("-")) {
					System.out.println("No");
					return;

			}}else {
				try {
					Integer.parseInt(s[i]);
				}catch(Exception e) {
					System.out.println("No");
					return;
				}
			}
		}
		System.out.println("Yes");
	}

}

Measured memory_bytes: 23636
let input = require("fs").readFileSync("/dev/stdin", "utf8")

function main() {
    const [N,M,X] = load(3)
    const [C,...A] = load(N,1+M)
    
    const candies = new Set()
    const max = Math.pow(2,N)//Math.pow(2,12)
    for(let i = 0; i < max; i++) {

        let sum = 0
        for(let j = 0; j < N; j++) {
            if(i & (1 << j)) {
                sum += A[0][j]
            }
        }

        if(sum >= X) candies.add(i)
    }

    for(let x = 1; x < M; x++) {
        for(const bits of candies) {

            let sum = 0
            for(let y = 0; y < N; y++) {
                if(bits & (1 << y)) {
                    sum += A[x][y]
                }
            }

            if(sum < X) candies.delete(bits)
        }
    }

    if(!candies.size) return -1

    let result = null
    for(const bits of candies) {

        let cost = 0
        for(let i = 0; i < N; i++) {
            if(bits & (1 << i)) {
                cost += C[i]
            }
        }

        if(result === null || cost < result) result = cost
    }

    return result
}

let inputs = input.split(/[\s\n]/)
console.log(main())

// 入力値を読み込む
function load(rows = 1, cols = 1, type = Number) {
    const length = rows * cols
    let result = inputs.splice(0, length)

    if(type !== String) result = result.map(type)
    if(cols > 1) {
        const arrays = new Array(cols)
        for(let col = 0; col < cols; col++) {
            arrays[col] = new Array()
            for(let row = 0; row < rows; row++) {
                arrays[col].push(result[row * cols + col])
            }
        }
        result = arrays
    }

    return result
}


Measured memory_bytes: 33464
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
#define rep(i, a, b) for (int i = a; i < b; ++i)

int main(){
    long long int x,y;
    cin>>x>>y;
    
    long long int  cnt=1;
    for(int i=0;x<=y;){
        x*=2;
        if(x<=y) cnt+=1;
    }
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
    #include <cstdio>
    #include <algorithm>
    #include <vector>
    #include <string>
    #include <string.h>
     
    typedef long long ll;
    using namespace std;
    const ll INF = 1000000000000000000ll;
    const ll MOD = 1000000007ll;
     
    const double EPS = 1e-8;
     
    int main()
    {
		ll W,H,N,X,Y,x[2]={},y[2]={},a;

		cin >> W >> H >> N;

		x[0]=0;x[1]=W;y[0]=0;y[1]=H;
		for(int i=0;i<N;i++){
			cin >> X >> Y >> a;
			if(a==1){
				x[0]=max(x[0],X);
			}else if(a==2){
				x[1]=min(x[1],X);
			}else if(a==3){
				y[0]=max(y[0],Y);				
			}else if(a==4){
				y[1]=min(y[1],Y);
			}
		}

		if((x[1]<=x[0]) || (y[1]<=y[0])){
			cout << 0 << endl;
		}else{
			cout << (x[1]-x[0])*(y[1]-y[0])<<endl;
		}

		return 0;
    }

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define PI acos(-1)
#define mp make_pair
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define F first
#define sd(x) scanf("%d",&x)
#define sd2(x,y) scanf("%d%d",&x,&y)
#define sdl(x) scanf("%lld",&x)
#define sd2l(x,y) scanf("%lld%lld",&x,&y)
#define maxn 100010
#define S second
#define ll long long int
#define inf 1000000014
#define infl (ll)(1e18+20000)
#define mod 1000000007
#define clrs(x) memset(x,0,sizeof x)
#define sz(x) (int) x.size()
#define pi pair< int,int >
#define pii pair<pi,int>
#define pu push
#define ld long double
#define trace1(x)  cerr << #x << ": " << x << endl
#define trace2(x, y)  cerr << #x << ": " << x << " | " << #y << ": " << y << endl
using namespace std;
vector< int > v[1010];
int cnt[1010];
int main(int argc, char const *argv[])
{
   // freopen("input.txt","r",stdin);
   // freopen("output.txt","w",stdout);
    int n;
    sd(n);
    for(int i=2;i<=1000;i++)
    {
        if(sz(v[i])==0)
        {
            for(int j=i;j<=1000;j+=i)
                v[j].pb(i);
        }
    }
    ll ans = 1;
    for(int i=2;i<=n;i++)
    {
        int cpy = i;
        for(int j=0;j<sz(v[i]);j++)
        {
            int ctr = 0;
            while(cpy%v[i][j]==0)
            {
                cpy/=v[i][j];
                ctr++;
            }
            cnt[v[i][j]]+=ctr;
        }
    }
    for(int i=2;i<=n;i++)
    {
        ans = (ans*(cnt[i]+1))%mod;
    }
    cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <vector>
#include <cassert>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
#include <tuple>
#include <regex>
#include <map>
#include <cstdint>

using namespace std;
using ull = unsigned long long;
using ll = long long;

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

#define EPS (1e-7)
#define ALL(x) begin(x), end(x)

int main() {
	ll N, k;
	cin >> N >> k;

	ll sum = 0;
	for (ll j = 1; j <= N; j++) {
		if (j <= k) continue;
		sum += (N / j) * (j - k);
		if (N % j - (k - 1) > 0) {
			sum += N % j - (k - 1);
		}
	}
	if (k == 0) {
		sum = N * N;
	}

	cout << sum << endl;

	return 0;
}

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

int main(){
    string s;
    cin >> s;
    int n = s.size();
    ll ans = 0;
    for(int i = 0; i < (1 << n-1); ++i){
        ll a = 0;
        for(int j = 0; j < n; ++j){
            a = a * 10 + s[j] - '0';
            // cout << a << endl;
            if(i>>j & 1){
                ans += a;
                // cout << ans << endl;
                a = 0;
            }
        }
        ans += a;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
N = int(input())
S = [input() for i in range(N)]
from collections import Counter
ctr = Counter([s[0] for s in S])

ans = 0
import itertools
for ptn in itertools.combinations('MARCH',3):
    a,b,c = ptn
    ans += ctr[a] * ctr[b] * ctr[c]
print(ans)

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

const ll INF = 1001001001;

int main(){
  int n; cin>>n;
  string s; cin>>s;
  int ans =0;
  for(int i=0;i<n-2;i++){
    if(s.at(i) == 'A'&& s.at(i+1) == 'B' && s.at(i+2)=='C') ans++;
  }
  cout<<ans<<endl;
  
}




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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define abs(a) max((a),-(a))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repe(i,n) rep(i,(n)+1)
#define per(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define pere(i,n) rep(i,(n)+1)
#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define RET return 0
#define MOD 1000000007
#define INF 1000000000000000000

typedef long long LL;
typedef long double LD;

int main(){
  int n,a,b,c;
  cin >> n >> a >> b >> c;
  cout << n-a-b+c << endl;
  return 0;
}



Measured memory_bytes: 3088
n, m, q = map(int,input().split())
a, b, c, d = [0] * q,[0] * q, [0] * q, [0] * q

for i in range(q):
    a[i], b[i], c[i], d[i] = map(int,input().split())
    a[i] -= 1
    b[i] -= 1

def score(z):
    tmp = 0
    for ai, bi, ci, di in zip(a, b, c, d):
        if z[bi] - z[ai] == ci:
            tmp += di
    return tmp

def dfs(a):
    if len(a) == n:
        return score(a)
    ans = 0
    prev_last = a[-1] if len(a) > 0 else 0
    for v in range(prev_last,m):
        a.append(v)
        ans = max(ans,dfs(a))
        a.pop()
    return ans

print(dfs([]))

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

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define pb push_back
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define print(obj) cout << obj << endl
#define scan(obj) cin >> obj

typedef long long ll;

using namespace std;

int main(void){
    int s;
    cin >> s;
    bool a[100000] = {false};
    a[s] = true;
    int i = 2;
    while(true){
        if(s % 2 == 0){
            s /= 2;
        } else{
            s = s * 3 + 1;
        }
        if(a[s]){
            print(i);
            return 0;
        }
        a[s] = true;
        i++;
    }
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
const int MAX_NUM = 2000000;
int gcd(int a, int b){
    if(b == 0){
        return a;
    }else{
        return gcd(b, a%b);
    }
}
int main(){
    // 求最大公约数
    int a, b;
    cin >> a >> b;
    if(a < b) swap(a, b);
    cout << gcd(a,b) << endl;
    return 0;
}



Measured memory_bytes: 3088
def resolve():
    s = input()

    for i in range(len(s)):
        # 奇数文字目
        if i % 2 == 0:
            if s[i] == 'L':
                print('No')
                return
        else:
            if s[i] == 'R':
                print('No')
                return

    print('Yes')




resolve()

Measured memory_bytes: 38384
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using static System.Console;
using static System.Math;


namespace AtCodeeeer
{
    class AtCOOOOOOOOOOOder
    {
        static void Main(string[] args)
        {
            WriteLine(180 * (int.Parse(ReadLine())-2));
        }
    }
}


Measured memory_bytes: 11092
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
	vector<int> a(10),b(10);
	for(int i=0;i<10;i++)	cin >> a[i];
	for(int i=0;i<10;i++)	cin >> b[i];
	sort(a.begin(),a.end());
	sort(b.begin(),b.end());
	cout << a[9]+a[8]+a[7] << ' ' << b[9]+b[8]+b[7] << endl;
	return 0;
}


Measured memory_bytes: 3124
N = int(input())
s = list(input() for _ in range(N))
d = {}
ans = 0
for i in range(N):
    temp = str(sorted(s[i]))
    if temp in d.keys():
        ans += d[temp]
        d[temp] += 1
    else:
        d[temp] = 1
print(ans)

Measured memory_bytes: 29216
#include "bits/stdc++.h"
using namespace std;

// Inserted snippets: io, root
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
template<typename H> bool chmin(H& v1, const H v2) { if (v1 > v2) { v1 = v2; return true; } return false; }
template<typename H> bool chmax(H& v1, const H v2) { if (v1 < v2) { v1 = v2; return true; } return false; }
template<typename H> void read(H& head) { cin >> head; }
template<typename H, typename ...T> void read(H& head, T& ...tail) { cin >> head; read(tail...); }
template<typename H> void write(H head) { cout << head << '\n'; }
template<typename H, typename ...T> void write(H head, T ...tail) { cout << head << " "; write(tail...); }
template<typename ...T> void die(T ...tok) { write(tok...); exit(0); }
// End snippets

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);

  int n; read(n);
  vector<ll> v(n);
  rep(i, 0, n) read(v[i]);
  ll d = 0;
  rep(i, 0, n) d += (i % 2 == 0 ? v[i] : -v[i]);
  vector<ll> ans(n);
  ans[0] = d;
  rep(i, 1, n)
    ans[i] = 2 * v[i - 1] - ans[i - 1];
  rep(i, 0, n)
    cout << ans[i] << " ";
  cout << endl;
}


Measured memory_bytes: 4748
#include <bits/stdc++.h>
#include <math.h>
#include <regex>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const ll mod = 1000000007;
const int INF = 1001001001;

int main(){
    ll n , m ; cin >> n >> m;
    vector<ll> a(n);

    ll sum = 0;
    rep(i,n){
        cin >> a.at(i);
        sum += a.at(i);
    }
    ll cnt = 0;
    rep(i,n){
        if(a.at(i) * 4 * m >= sum) cnt++;
    }
    if(cnt>=m){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

}

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

#define int long long
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define pb push_back
#define fi first
#define se second
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

struct edge{
    int to,cost;
    edge(int to,int cost):to(to),cost(cost){}
};

int N,M;
vector<edge>G[100];
int T[100][100];
const int L=12;

int ma=0;
bool used[100];
int deg[100];

int calc(vint &v){
    if(v.size()<=1)return 0;
    int sum=0;
    for(auto a:v){
        int t=1001001001;
        for(auto b:v)if(a!=b)chmin(t,T[a][b]);
        sum+=t;
    }
    return sum;
}

void dfs(){
    memset(deg,0,sizeof(deg));
    rep(i,N){
        if(used[i])continue;
        for(auto e:G[i])if(!used[e.to])deg[i]++;
        if(deg[i]>L)continue;
        vector<int>lis;
        for(auto e:G[i])if(!used[e.to])lis.pb(e.to);
        rep(j,1<<lis.size()){
            vector<int>v={i};
            rep(k,lis.size()){
                if(j>>k&1)v.pb(lis[k]);
            }
            chmax(ma,calc(v));
        }
        used[i]=true;
        dfs();
        return;
    }

    vector<int>v;
    rep(i,N)if(!used[i])v.pb(i);
    rep(i,1<<v.size()){
        vector<int>u;
        rep(j,v.size())if(i>>j&1)u.pb(v[j]);
        chmax(ma,calc(u));
    }
}

signed main(){
    cin>>N>>M;
    rep(i,M){
        int a,b,c;
        cin>>a>>b>>c;
        a--;b--;
        G[a].pb(edge(b,c));
        G[b].pb(edge(a,c));
        T[a][b]=T[b][a]=c;
    }

    dfs();
    cout<<ma<<endl;
    return 0;
}

Measured memory_bytes: 3256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner std = new Scanner(System.in);
		int n = Integer.parseInt(std.next());
		int array[];
		array = new int[n];
		for (int i=0; i<=n-1; i++){
			array[i] = Integer.parseInt(std.next());
		}
		String ret = "";
		for (int j=n-1; j>=1; j--){
			ret += array[j] + " ";
		}
		ret += array[0];
		System.out.println(ret);
	}
}

Measured memory_bytes: 26248
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long int
int K;
int A[100010];

int check(int num) {
    rep(i, K) num -= (num % A[i]) % A[i];
    return num;
}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> K;
    rep(i, K) cin >> A[i];

    int smallans, largeans;
    int small = 2, large = 1000000000000000000;
    int middle = (small + large) / 2;
    int prev_s = small+1, prev_l = large-1;

    while(small != prev_s || large != prev_l) {
        int num = check(middle);
        prev_s = small; prev_l = large;
        if (num > 2) large = middle-1;
        if (num <= 2) small = middle;
        middle = (small + large + 1) / 2;
        //dump(large); dump(middle); dump(small); 
        //cout << endl;
    }
    if (check(middle) == 2) largeans = middle;
    else {
        cout << -1 << endl;
        return 0;
    }

    small = 2, large = 1000000000000000000;
    middle = (small + large) / 2;
    prev_s = small+1, prev_l = large-1;

    while(small != prev_s || large != prev_l) {
        int num = check(middle);
        prev_s = small; prev_l = large;
        if (num >= 2) large = middle;
        if (num < 2) small = middle+1;
        middle = (small + large) / 2;
        //dump(large); dump(middle); dump(small); 
        //cout << endl;
    }
    if (check(middle) == 2) smallans = middle;
    else {
        cout << -1 << endl;
        return 0;
    }
    cout << smallans << " " << largeans << endl;
    return 0;
}


Measured memory_bytes: 1024
import java.util.*;

public class Main {
public static void main(String[] args) {
		
		Scanner keyboard = new Scanner(System.in); 
		
		String S = keyboard.next();	
		String T = keyboard.next();	
		
		int Slong = S.length();
		
		int count = 0;
		for (int i=0; i<Slong; i++) {
			if(S.charAt(i) == T.charAt(i)) {
				
			}else {
				count++;
			}
		}
					
							
		System.out.println(count);
		keyboard.close();	
	}
}






Measured memory_bytes: 41168
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <cmath>
#include <iomanip>
#include <sstream>
#define PI acos(-1.0)
using namespace std;
const long long INF=1e10+7;
typedef unsigned long long ULL;
typedef long long LL;
const int maxn=100005;
int fa[maxn];
int getfa(int u) {
    if(fa[u]!=u) fa[u]=getfa(fa[u]);
    return fa[u];
}
void Union(int x,int y) {
    int fx=getfa(x),fy=getfa(y);
    if(fx!=fy)
        fa[fx]=fy;
}
int in[maxn];
int main() {
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++) {
        scanf("%d",in+i);
    }
    for(int i=1;i<=n;i++)
        fa[i]=i;
    while(m--) {
        int a,b;
        scanf("%d%d",&a,&b);
        Union(a,b);
    }
    int ans=0;
    for(int i=1;i<=n;i++) {
        if(getfa(i)==getfa(in[i])){
            ans++;
        }
    }
    printf("%d\n",ans);
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;

//typedef pair<int,int> P;

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

	long long ans = 0;
	for(int i=0;i<=K;i++){
		for(int j=0;j<=K;j++){
			if(S-i-j>=0 && S-i-j<=K) ans++;
		}
	}

	printf("%lld\n",ans);

	return 0;
}


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

template <typename T, typename Op = plus<T>>
class segtree {
private:
    size_t N;
    vector<T> data;
    T idelem;
    const Op &op;

public:
    segtree(size_t n, T idelem, const Op &op = Op())
    : idelem(idelem), op(op) {
        for(N = 1; N < n; N <<= 1);
        data = vector<T>(2 * N, idelem);
    }

    segtree(const vector<T> &init, T idelem, Op &op = Op())
    : idelem(idelem), op(op) {
        for(N = 1; N < init.size(); N <<= 1);
        data = vector<T>(2 * N);
        for(int i = 0; i < N; ++i) data[i + N] = init[i];
        for(int i = N - 1; i >= 0; --i) data[i] = op(data[2 * i], data[2 * i + 1]);
    }

    void update(size_t pos, T val) {
        data[pos + N] = val;
        for(pos = (pos + N) / 2; pos > 0; pos >>= 1) {
            data[pos] = op(data[2 * pos], data[2 * pos + 1]);
        }
    }

    T query(size_t left, size_t right) {
        left += N;
        right += N;

        T vl = idelem, vr = idelem;
        while(left < right) {
            if(left & 1) vl = op(vl, data[left++]);
            if(right & 1) vr = op(data[right - 1], vr);
            left >>= 1;
            right >>= 1;
        }
        return op(vl, vr);
    }

    T operator[](size_t k) {
        return data[k + N];
    }
};

#include <iostream>
using namespace std;

int main() {
    int n, q; cin >> n >> q;
    auto op = [](const int &a, const int &b){ return min(a, b); };
    segtree<int, decltype(op)> st(n, (1LL << 31) - 1, op);

    while(q--) {
        int c, x, y; cin >> c >> x >> y;
        if(c == 0) {
            st.update(x, y);
        } else {
            cout << st.query(x, y + 1) << endl;
        }
    }
}


Measured memory_bytes: 3880
A = list(input())
B = list(input())
C = list(input())
turn = "a"
while True:
    if turn == "a":
        try:
            turn = A[0]
            A.pop(0)
        except IndexError:
            break

    if turn == "b":
        try:
            turn = B[0]
            B.pop(0)
        except IndexError:
            break

    if turn == "c":
        try:
            turn = C[0]
            C.pop(0)
        except IndexError:
            break
print(turn.upper())

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

struct edge {
    int to;
    int cost;
};
using P = pair<int, int>;
vector<vector<edge>> G;
vector<int> d;
void dijkstra(int s) {
    priority_queue<P, vector<P>, greater<P>> que;
    fill(d.begin(), d.end(), INF);
    d[s] = 0;
    que.push(P(0, s));
    while (!que.empty()) {
        P p = que.top();
        que.pop();
        int v = p.second;
        if (d[v] < p.first)
            continue;
        rep(i, G[v].size()) {
            edge e = G[v][i];
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}

int main() {
    int N, X, Y;
    cin >> N >> X >> Y;

    G.resize(N);
    d.resize(N);

    G[X - 1].push_back({Y - 1, 1});
    rep(i, N - 1) {
        G[i].push_back({i + 1, 1});
        G[i + 1].push_back({i, 1});
    }

    vector<int> ans(N);
    for (int i = 0; i < N; i++) {
        dijkstra(i);
        for (int j = i; j < N; j++) {
            ans[d[j]]++;
        }
    }

    rep(i, N - 1) cout << ans[i + 1] << "\n";

    return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
int main (void){
   int n;
    int c=0;
    int p[100];
    scanf("%d",&n);
    for(int i=1;i<n+1;i++){
            scanf("%d",&p[i]);
    }
    for(int i=1;i<n+1;i++){
        if((p[i-1]<p[i]&&p[i]<p[i+1])&&i!=1&&i!=n||(p[i+1]<p[i]&&p[i]<p[i-1])&&i!=1&&i!=n){
            c=c+1;
}
}
printf("%d",c);
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <iomanip>

int main() {
	std::string s; std::cin >> s;
	int counta = 0;
	for (int i = 0; i < s.size(); ++i) {
		++counta;
		if (s[i] == s[i + 1]) {
			++counta;
			i += 2;
			if (i >= s.size())
				--counta;
		}
	}
	int countb = 0;
	if (s[0] == s[1]) {
		countb = 1;
		for (int i = 2; i < s.size(); ++i) {
			++countb;
			if (s[i] == s[i + 1]) {
				++countb;
				i += 2;
				if (i >= s.size())
					--countb;
			}
		}
	}
	std::cout << std::max(counta, countb) << std::endl;

	return 0;
}


Measured memory_bytes: 3740
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int H, W;
  cin >> H >> W;
  vector<vector<char>> s(H+2, vector<char>(W+2));
 //  vector<vector<int>> c(H+2, vector<int>(W+2));
  for (int i=0;i<H+2;i++){
    for (int j=1;j<W+2;j++){
      s.at(i).at(j)='.';
    }
  }
  
  for (int i=1;i<H+1;i++){
    for (int j=1;j<W+1;j++){
      cin >> s.at(i).at(j);
    }
  }
  
  for (int i=1;i<H+1;i++){
    for (int j=1;j<W+1;j++){
      int bomb=0;
      if (s.at(i).at(j)!='#'){
      	for (int k=-1;k<2;k++){
          for (int l=-1;l<2;l++){
            if (k!=0 || l!=0){
              if (s.at(i+k).at(j+l)=='#') bomb++;
            }
          }
        }
        s.at(i).at(j)=(char)('0'+bomb); 	
      }
  
    }
  }
  
  for (int i=1;i<H+1;i++){
    for (int j=1;j<W+1;j++){
     cout << s.at(i).at(j);
    }
    cout << endl;
  }
  
}

Measured memory_bytes: 256
fun main(args: Array<String>) {

    // B - Two Anagrams
    // 文字列のソート、辞書順比較
    // memo 昇順ソート、降順ソートし大小比較する
    // kotlinのコレクションのソートについて知っている必要がありそう
    val first = readLine()!!.toCharArray()
    val second = readLine()!!.toCharArray()

    first.sort()
    second.sortDescending()

    // collectionを文字列にする joinToString
    val firstStr = first.joinToString(separator = "")
    val secondStr = second.joinToString(separator = "")

    // compareToをいい加減覚えよう!!
    if (firstStr < secondStr)
        println("Yes")
    else
        println("No")
}


Measured memory_bytes: 34156
sx,sy,tx,ty = map(int,input().split())
w = ""
for i in range(tx-sx):
    w += "R"
for j in range(ty-sy+1):
    w += "U"
for i in range(tx-sx+1):
    w += "L"
for j in range(ty-sy+1):
    w += "D"
w += "R"
w += "D"
for i in range(tx-sx+1):
    w += "R"
for j in range(ty-sy+1):
    w += "U"
for i in range(tx-sx+1):
    w += "L"
for j in range(ty-sy):
    w += "D"
print(w)
    

Measured memory_bytes: 43484
import java.io.*;
class Main
{
    public static void main(String[] args9)
    { 
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); 
	String line=null;
	try {
	    line = br.readLine();
	} catch (IOException e) {
	    System.out.println("Input strange");
	}
	    
	String[] f= line.split(" ",0);
	int m = Integer.parseInt(f[0]);
	int n = Integer.parseInt(f[1]);
	System.out.printf("%d %d\n", m*n , 2*(m+n));
    }

}

Measured memory_bytes: 24608
#include <algorithm>
#include <iostream>
#include <queue>
#include <string>
#include <vector>

using namespace std;

using ll = long long;

int N;
ll maxA = 0;
ll minB = 0;

int main() {
    cin >> N;
    for (int n = 0; n < N; n++) {
        ll A, B;
        cin >> A >> B;
        maxA = max(A, maxA);
        if (maxA == A) { minB = B; }
    }

    cout << minB + maxA << endl;

    cin >> N;

    return 0;
}

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

int main()
{
    vector<int> x(5);
    rep(i,5) cin >> x[i];
    int ans = 0;
    rep(i,5){
        if(x[i] == 0){
            ans = i+1;
            break;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  string s;
  cin>>s;
  sort(s.begin(),s.end());
  Int ans=(s[0]==s[1])&&(s[1]!=s[2])&&(s[2]==s[3]);
  cout<<(ans?"Yes":"No")<<endl;
  return 0;
}


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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<=(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define rev(v) reverse(all(v))

typedef long long ll;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<string> vs;

typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;

const double pi = acos(-1.0);
const int mod=1000000007;
const int mod2=998244353;

ll powmod(ll a,ll b){ll c=1; while(b>0){ if(b&1){ c=a*c%mod; } a=a*a%mod; b>>=1; } return c;}
ll gcd(ll x, ll y) {return __gcd(x,y);}
ll lcm(ll x, ll y) {return x/__gcd(x,y)*y;}

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


   
}

 
    

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

#define infi            5e9
#define infl            5e18
#define MX              100005
#define pi              2*acos(0.0)
#define ll              long long int
#define rr              read()
#define ff              first
#define ss              second
#define pb              push_back
#define pii             pair<int,int>
#define pll             pair<ll,ll>
#define ms(a,b)         memset(a, b, sizeof(a))
#define loop(i,n)       for(register int i=0;i<n;i++)
#define pool(i,n)       for(register int i=n-1;i>=0;i--)
#define loop1(i,n)      for(register int i=1;i<=n;i++)
#define pool1(i,n)      for(register int i=n;i>0;i--)

using namespace std;

inline ll read(){char c=getchar();ll num,sign=1;for(;c<'0'||c>'9';c=getchar())if(c=='-')sign=-1;for(num=0;c>='0'&&c<='9';){c-='0';num=num*10+c;c=getchar();}return num*sign;}
inline ll pw(ll b, ll p){ll ans=1;while(p>0){if(p&1)ans*=b;p>>=1;b*=b;}return ans;}
inline bool isPrime(ll n){if(n==1)return false;if(n==2)return true;if(!(n%2))return false;for(ll i=3;i<=sqrt(n);i+=2)if(!(n%i))return false;return true;}
inline ll gcd(ll a, ll b){if(a==0)return b;return gcd(b%a,a);}

// //*************************************  Bitmask Opereations  **********************************//
// int Set(int N,int pos){return N=N | (1<<pos);}
// int reset(int N,int pos){return N= N & ~(1<<pos);}
// bool check(int N,int pos){return (bool)(N & (1<<pos));}
// //********************************************************************************************//


int main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    //#ifdef rid.dle//freopen("in.txt", "r", stdin);//#endif
    //freopen("in.txt", "r", stdin);

    ll n=rr;
    ll x,y,t=1,a=1;

    loop(i, n){
        x=rr,y=rr;
        ll r = max((t+x-1)/x, (a+y-1)/y);
        t=x*r;
        a=y*r;
    }
    cout << t+a << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
typedef vector<double> VD;

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

struct union_find{
    VI par;

    void init(int n){
        par.resize(n);
        REP(i,n) par[i] = i;
    }

    int find(int x){
        if (par[x] == x) return x;
        else return par[x] = find(par[x]);
    }

    bool same(int x, int y){
        return find(x) == find(y);
    }

    void merge(int x, int y){
        x = find(x);
        y = find(y);
        if (x == y) return;
        par[x] = y;
    }
};

int main() {
    int n, m;
    cin >> n >> m;
    VI a(n);
    REP(i,n) a[i] = in() - 1;

    VI pos(n);
    REP(i,n) pos[a[i]] = i;

    union_find uf;
    uf.init(n);

    REP(i,m){
        int x = in() - 1, y = in() - 1;
        uf.merge(x, y);
    }

    int ans = 0;
    REP(i,n){
        if (uf.same(i, pos[i])) ans++;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1408
#include <stdio.h>
int main(void)
{
    int W, H, x, y, r;
    scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
    if (x - r >= 0 && x + r <= W && y - r >= 0 && y + r <= H)
        printf("Yes\n");
    else
        printf("No\n");
    return 0;
}


Measured memory_bytes: 2104
from collections import deque

s = input()

if len(s) == 1:
  print(s)
  exit()

lst = deque([[" "], ["+"]])
rlt = 0

while lst:
  sm = lst.pop()
  if len(sm) == len(s) - 1:
    now = int(s[0])
    for i in range(len(s) - 1):
      if sm[i] == '+':
        rlt += now
        now = int(s[i+1])
      else:
        now = now*10 + int(s[i+1])
    rlt += now
  else:
    als = sm+[" "]
    lst.append(als)
    als = sm+["+"]
    lst.append(als)
    
print(rlt)

Measured memory_bytes: 71200