akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <sstream>
using namespace std;

typedef long long LL;
#define lowbit(x) ((x)&(-x))
#define INF 0x3f3f3f3f
#define memset(a,b) memset(a,b,sizeof(a))
#define	GE() printf(">----------\n")
#define	IN() freopen("in.txt","r",stdin)
#define	OUT() freopen("out.txt","w",stdout)
const int mod=1000000007;
const int inf=0x3f3f3f3f;
const double pi=acos(-1.0);
const double eps=1e-8;
const int maxn=100005;

int main()
{
    int r, g, b;
    while(~scanf("%d%d%d", &r, &g, &b)){
        int sum=r*100+g*10+b;
        printf("%s\n", sum%4?"NO":"YES");
    }
    return 0;
}



Measured memory_bytes: 256
fun main(args: Array<String>){
    val N = readLine()!!.split(" ").map{ it.toInt()}

    var a = mutableListOf<Int>()

    for(i in N.distinct()){
        if(a.contains(i)){
            continue
        }else{
            a.add(i)
        }
    }
    println(a.size)

}

Measured memory_bytes: 35992
n,m=map(x->parse(Int,x),split(readline()))
P=map(x->parse(Int,x),split(readline()))
r=[]
p=[]
for i=1:n
	push!(r,0)
	push!(p,i)
end
function f(u)
	if u==p[u]
		u
	else
		p[u]=f(p[u])
	end
end
for i=1:m
	a,b=map(x->parse(Int,x),split(readline()))
	a=f(a)
	b=f(b)
	if a!=b
		if r[a]<r[b]
			p[a]=b
		else
			p[b]=a
			if r[a]==r[b]
				r[a]+=1
			end
		end
	end
end
c=0
for i=1:n
	if f(i)==f(P[i])
		c+=1
	end
end
println(c)

Measured memory_bytes: 169892
#include <iostream>

using namespace std;
typedef long long ll;
#define REP(i,n) for (ll i = 0; i < (n); ++i)

int main(){
    ll n;
    cin >> n;
    ll ans = -1;
    for(ll i = 1; i * i <= n; ++i){
        if(n % i != 0){ continue; }
        const ll j = n / i;
        const ll step = (i - 1) + (j - 1);
        if(ans == -1 || ans > step){
            ans = step;
        }
    }
    cout << ans << endl;
    return 0;
}


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

#define int long long
#define INT int
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second

signed main()
{
    int k, a, b;
    cin >> k >> a >> b;

    for (int i = 1; i <= 1000; i++)
    {
        if (a <= k * i && b >= k * i)
        {
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;

    return 0;
}


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

#pragma warning(disable : 4996)

typedef long long ll;
#define all(x) (x).begin(), (x).end()  // sortなどの引数を省略
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define max3(x, y, z) max(x, max(y, z))
#define min3(x, y, z) min(x, min(y, z))

#ifdef _MSC_FULL_VER  //デバッグ出力
#define dout cout
#define debug() if (true)
#define check(x) std::cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) std::cout << "☆" << x << endl
#else
#define dout \
  if (false) cout
#define debug() if (false)
#define check(x) \
  if (false) cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) \
  if (false) cout << "☆" << x << endl
#endif

using namespace std;
//#define int long long;

double dist(double x1, double y1, double x2, double y2) {
  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
ll idist(ll x1, ll y1, ll x2, ll y2) {
  return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
}

signed main() {
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  double ans = 0.5 * a * b;
  if (c * 2 == a and d * 2 == b) {
    cout << ans << " " << 1;
  } else {
    cout << ans << " " << 0;
  }
}


Measured memory_bytes: 3756
#include <bits/stdc++.h>
using namespace std;
vector <string> v;
vector<int> x;
string s;
string ans = "Yes";
int main(){
  string s,t;

  cin >> s>>t;

  sort(s.begin(),s.end());
  sort(t.rbegin(),t.rend());
  if(t <= s)ans = "No";



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


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

int main(){
	double r,l,menseki;
	double PI= 3.141592653589;
	cin >> r;
	menseki = (double)r * r * PI;
	l = (double)2 * PI * r;
	cout << fixed << setprecision(6);
	cout << menseki << " "<< l <<endl; 



}

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

int main() {
    int N; cin >> N;
    string s; cin >> s;
    int cnt = 0;
    rep(i, N){
        if(s[i] == '#'){
            cnt++;
        }
    }

    int ans = cnt;
    vector<int> blk(N);
    vector<int> wht(N);
    for (int i = 1; i < N; i++){
        if(s[i-1] == '#'){
            wht[i] = wht[i-1]+1;
        } else {
            wht[i] = wht[i-1];
        }
    }

    if(s[N-1] == '.')blk[N-1] = 1;
    for (int i = N-2; i >= 0; i--){
        if(s[i] == '.'){
            blk[i] = blk[i+1] + 1;
        } else {
            blk[i] = blk[i+1];
        }
    }

    rep(i, N){
        int x = wht[i] + blk[i];
        ans = min(ans, x);
    }

    cout << ans << endl;

    return 0;
}

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

#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))

#define MOD 1000000007 

//昇順
int asc(const void* a, const void* b){
    return *(int*)a-*(int*)b;
}

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

    //A[0]~A[N-1]に格納する
    int* A;
    NEW(A,N);
    for(int i=0;i<N;i++){
        scanf("%d",&A[i]);
    }
    qsort(A,N,sizeof(int),asc);

    long ans=1;
    if(N%2==0){
        for(int i=0;i<(N/2);i++){
            if(A[2*i]==2*i+1 && A[2*i+1]==2*i+1) ans=(ans*2)%MOD;
            else{
                ans=0;
                break;
            }
        }
    }
    else{
        if(A[0]==0){
            for(int i=1;i<=(N/2);i++){
                if(A[2*i-1]==2*i && A[2*i]==2*i) ans=(ans*2)%MOD;
                else{
                    ans=0;
                    break;
                }
            }
        }
        else ans=0;
    }
    printf("%ld\n",ans);

    return 0;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reprev(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;

int main()
{
    int N, R, r;
    cin >> N >> R;

    if (N >= 10)
        r = R;
    else
    {
        r = R + 100 * (10 - N);
    }

    cout << r << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <utility>
#include <set>
using namespace std;

typedef pair<int, int> P;

inline P plus_p(P a, P b)
{
    return P(a.first + b.first, a.second + b.second);
}

inline P minus_p(P a, P b)
{
    return P(a.first - b.first, a.second - b.second);
}

int main()
{
    int m;

    while (scanf("%d", &m), m){
        P e;
        P d[256];

        scanf("%d %d", &e.first, &e.second);
        for (int i = 1; i < m; i++){
            P tmp;

            scanf("%d %d", &tmp.first, &tmp.second);
            d[i] = minus_p(tmp, e);
        }

        int n;
        scanf("%d", &n);
        P star[1024];
        set<P> sky;
        for (int i = 0; i < n; i++){
            scanf("%d %d", &star[i].first, &star[i].second);
            sky.insert(star[i]);
        }

        for (int i = 0; i < n; i++){
            bool flag = true;

            for (int j = 1; j < m && flag; j++){
                flag = (sky.find(plus_p(star[i], d[j])) != sky.end());
            }
            if (flag){
                P move = minus_p(star[i], e);
                printf("%d %d\n", move.first, move.second);
                break;
            }
        }
    }

    return 0;
}

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

const long long MOD = 998244353;
struct mint {
  long long x;
  mint(long long x = 0) noexcept : x((x + MOD) % MOD) {}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x -= a.x) < 0) 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(long long t) const {
    if (t == 0) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(MOD - 2); }
  mint& operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const { return mint(*this) /= a; }
};

mint dp[3005][3005][2];
int main() {
  int A, B, C, D; cin >> A >> B >> C >> D;
  int Y = C - A, X = D - B;

  dp[0][0][1] = 1;
  rep(y, Y + 1) rep(x, X + 1) {
    if (y > 0) dp[y][x][0] = dp[y - 1][x][0] * (B + x) + dp[y - 1][x][1] * (B + x);
    if (x > 0) dp[y][x][1] = dp[y][x - 1][1] * (A + y) + dp[y][x - 1][0];
  }
  cout << (dp[Y][X][0] + dp[Y][X][1]).x << endl;
}

Measured memory_bytes: 144624
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <iomanip>
#include <cmath>
using namespace std;

void solve(){
  int n; cin >> n;
  vector<int> a(n + 1), s(n + 1), ans;
  for(int i = 1; i <= n; i++){
    cin >> a[i];
  }
  for(int i = n; i >= 1; i--){
    int x = i * 2, sum = 0;
    while(x <= n){
      sum += s[x];
      x += i;
    }
    if(sum % 2 == 0){
      if(a[i] == 0) s[i] = 0;
      else{
        ans.push_back(i);
        s[i] = 1;
      }
    }
    else{
      if(a[i] == 0){
        ans.push_back(i);
        s[i] = 1;
      }
      else s[i] = 0;
    }
  }
  cout << ans.size() << endl;
  for(int i = 0; i < ans.size(); i++){
    cout << ans[i] << " ";
  }
  cout << endl;

  return;
}

int main(){
  solve();
  return 0;
}


Measured memory_bytes: 3064
//Volume0-0092
import java.util.Scanner;

public class Main {

	//declare
	private static int      n;
	private static int [][] dp;
	private static char[][] board;

	public static void main(String[] args) {

        //input
        Scanner sc = new Scanner(System.in);
        while((n = Integer.parseInt(sc.nextLine())) != 0){
        	board = new char[n][n];
        	dp    = new int [n][n];
        	for(int i=0;i<n;i++){
        		board[i] = sc.nextLine().toCharArray();
        	}

        	//calculate
        	int max = 0;
        	for(int i=0;i<n;i++){
        		for(int j=0;j<n;j++){
        			if(board[i][j] == '*'){dp[i][j] = 0; continue;}
        			if(i == 0 || j == 0)  {dp[i][j] = 1; continue;}
        			dp[i][j] = Math.min(dp[i-1][j-1],Math.min(dp[i-1][j], dp[i][j-1]))+1;
        			max      = Math.max(dp[i][j],max);
        		}
        	}

        	//output
        	System.out.println(max);
        }
	}
}

Measured memory_bytes: 61720
function Main(input) {
  input = input.trim().split(" ");
  var N = parseInt(input[0], 10);
  var K = parseInt(input[1], 10);

  var sum = K;

  for (var i = 1; i < N; i++) {
    sum *= K - 1;
  }

  console.log(sum);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#define SIZE 300005
#define MOD 1000000007LL
#define EPS 1e-10
#define INF 2147483647
#define LLINF 9223372036854775807LL
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define DOWN(i,b,a) for(int i=b;i>=a;i--)
#define SET(a,c) memset(a,c,sizeof a)
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique((o).begin(),(o).end()), (o).end())
#define SQ(x) ((x)*(x))
using namespace std;
typedef int_fast64_t ll;
typedef pair<ll,ll> Pll;
typedef pair<int, int> Pii;
typedef pair<double, double> Pdd;
typedef complex<double> dcomplex;
template<typename T> inline void priv(vector<T>a){REP(i,a.size()){cerr<<a[i]<<((i==a.size()-1)?"\n":" ");}}
inline void fastio(){cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15);}
ll gcd(ll a,ll b){ll c=max(a,b);ll d=min(a,b);return c==0||d==0?c:gcd(c%d,d);}
ll lcm(ll a,ll b){return a==0||b==0?0:a*b/gcd(a,b);}

template<int N, typename T, T M>
struct ModFact {
    T inv[N+1];
    T fact[N+1];
    T ifact[N+1];
    constexpr ModFact() : fact(), ifact() {
        fact[0] = 1;
        for (int i = 0; i < N; i++)
            fact[i+1] = (fact[i]*(i+1))%M;
        ifact[N] = power(fact[N], M-2);
        for (int i = N-1; i >= 0; i--)
            ifact[i] = (ifact[i+1]*(i+1))%M;
        inv[0] = 0;
        for (int i = 0; i < N; i++)
            inv[i+1] = (fact[i]*ifact[i+1])%M;
    }
    constexpr T power(T a, T b) {
        T r = 1;
        while (b>0) {
            if((b&1)!=0) r = (r*a)%M;
            a = (a*a)%M;
            b >>= 1;
        }
        return r;
    }
    constexpr T comb(T n, T r) {
        return (((fact[n]*ifact[r])%M)*ifact[n-r])%M;
    }
};

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}

inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

ModFact<100000, ll, MOD> fact;

ll N;

int main() {
    ll N, ans = 0, prev, now;
    N = getint();
    prev = getint();
    ll a = 0;
    REP(i, N-1) {
        now = getint();
        // cin >> now;
        a = (a + fact.inv[i+1]) % MOD;
        ans = (ans + a * (now - prev)) % MOD;
        prev = now;
    }
    printf("%lld\n", (ans * fact.fact[N-1])%MOD);
	return 0;
}


Measured memory_bytes: 2688
#include "bits/stdc++.h"
using namespace std;
     
#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl
     
typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll, ll>
const int inf = 1000000001;
const ll INF = 1e16;
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<<fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };


int main () {
  ll n, h, i, j;
  cin >> n >> h;
  vector<pll> ba(n);
  ll maxa = -1;
  ll maxi = -1;
  for (i = 0; i < n; i++) {
    cin >> ba[i].second >> ba[i].first;
  }
  sort(ba.begin(), ba.end());
  for (i = 0; i < n; i++) {
    if (maxa < ba[i].second) {
      maxa = ba[i].second;
      maxi = i;
    }
  }
  int cnt = 0;
  for (i = n - 1; i >= 0; i--) {
    if (ba[i].first <= maxa) {
      break;
    }
    h -= ba[i].first;
    cnt++;
    if (h <= 0) {
      cout << cnt << endl;
      return 0;
    }
  }
  int cnt2 = h / maxa;
  cnt += cnt2;
  h -= cnt2 * maxa;
  while (h > 0) {
    h -= maxa;
    cnt++;
  }
  cout << cnt << endl;
  
  
}


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

int main() {
	int N,K;
	cin >>N>>K;

	vector<long long> H(N);
	for(int i=0;i<N;i++){
		cin >> H[i];
	}
	sort(H.begin(),H.end());
	long long p=0;
	for(int i=0; i<N-K;i++){
		p+=H.at(i);
	}
	cout <<p;
	

}

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

int main() 
{

  long A,B,K;
  cin>>A>>B>>K;
  
  if(K<=A){
    A-=K;
  }
  else if(K<=A+B){
    B=B-(K-A);
    A=0;
  }else{
    A=0;
    B=0;
  }
    
  
  cout<<A<<" "<<B<<endl;
  
    return 0;
}

Measured memory_bytes: 256
n = int(input())
S = []
a = 0
t = 0
w = 0
r = 0
for _ in range(n):
    S.append(input())
for i in range(n):
  if S[i]=="AC":
    a += 1
  elif S[i]=="TLE":
    t += 1
  elif S[i]=="WA":
    w += 1
  else:
    r += 1
a = str(a)
w = str(w)
t = str(t)
r = str(r)
print("AC x "+a)
print("WA x "+w)
print("TLE x "+t)
print("RE x "+r)

Measured memory_bytes: 16132
N, M = list(map(int, input().split()))

min_num = 1
max_num = N
for i in range(M):
    min_input, max_input = list(map(int, input().split()))
    if min_input > min_num:
        min_num = min_input
    
    if max_input < max_num:
        max_num = max_input

output = max_num- min_num + 1

if output <= 0:
	print(0)
else :
  	print(output)


Measured memory_bytes: 3060
N = int(input())
a = list(map(int, input().split()))

msum = abs(a[0])
for i in range(1, N):
    msum += abs(a[i - 1] - a[i])
msum += abs(a[-1])

ans = msum - abs(0 - a[0]) - abs(a[0] - a[1]) + abs(0 - a[1])
print(ans)
for i in range(1, N - 1):
    ans = msum - abs(a[i - 1] - a[i]) - abs(a[i] - a[i + 1]) + abs(a[i - 1] - a[i + 1])
    print(ans)

ans = msum - abs(a[N - 2] - a[N - 1]) - abs(a[N - 1]) + abs(a[N - 2] - 0)
print(ans)

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

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using   P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

// 汎用マクロ
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(i,q) for (auto &i : q)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define SZ(x) ((int)(x).size())
template <class T>inline bool chmin(T &a, const T b) {if (a > b) { a = b; return true;} return false;}
template <class T>inline bool chmax(T &a, const T b) {if (a < b) { a = b; return true;} return false;}
template <class T>inline void line_out(const vector<T> vec) {int n = SZ(vec); rep(i, n) { cout << vec[i]; if(i < n-1) cout << " ";}cout << endl;}
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 60;
const int mod = 1000000007;
//const int mod = 998244353;
struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};


int main()
{
  int n; cin >> n;
  map<int, int> mp;
  for(int x = 2; x <= n; ++x) {
    int num = x;
    for(int i = 2; i*i <= num; ++i) {
      while(num%i==0) {
        num/=i;
        ++mp[i];
      }
    }
    if(num!=1) ++mp[num];
  }
  mint ans = 1;
  for(auto x : mp) ans *= x.second+1;
  cout << ans.x << endl;
}

Measured memory_bytes: 3584
n = int(input())
x = [int(x) for x in list(input())]

x_cnt = 0
for i, y in enumerate(x):
    if y == 1:
        x_cnt += 1

aa = x_cnt + 1
bb = x_cnt - 1

a = [1 % aa]
if bb > 0:
    b = [1 % bb]
else:
    bb = 1
    b = [0]

for _ in range(n-1):
    a.append(a[-1]*2 % aa)
    b.append(b[-1]*2 % bb)

a = a[::-1]
b = b[::-1]

x_ps = 0
x_ng = 0
for i, val in enumerate(x):
    if val == 1:
        x_ps += a[i]
        x_ng += b[i]

for i in range(n):
    ans = 0
    if x[i] == 0:
        cnt = x_cnt + 1
        val = (x_ps + a[i]) % cnt
    else:
        cnt = x_cnt - 1
        if cnt == 0:
            print(ans)
            continue
        val = (x_ng - b[i]) % cnt
    ans += 1

    tmp = val
    cnt = 0
    while tmp > 0:
        if tmp & 1:
            cnt += 1
            tmp = (tmp-1) // 2
        else:
            tmp = tmp // 2

    if cnt == 0:
        print(ans)
        continue

    while val > 0:
        ans += 1
        val = val % cnt
        tmp = val % cnt
        cnt = 0
        while tmp > 0:
            if tmp & 1:
                cnt += 1
                tmp = (tmp-1) // 2
            else:
                tmp = tmp // 2
    print(ans)


Measured memory_bytes: 116048
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;

class Program
{
    internal static void Main(string[] args) {
        var inp = ReadLine().Split(' ').Select(s => int.Parse(s)).ToList();

        if ((inp[0] * inp[1]) % 2 == 0) {
            WriteLine("Even");
        } else {
            WriteLine("Odd");
        }
    }
}


Measured memory_bytes: 11220
import math

N = int(input())

# 証明できないけど、真ん中の方の数字の方が数を足すと小さい値になると思う。
for n in reversed(range(1, int(math.sqrt(N)) + 1)):
  if N % n == 0:
    a = int(n + N/n)
    break


print(a - 2)


Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <string>
#include <ctype.h>
#include <algorithm>
using namespace std;

const int maxN = 100000;
long long dp[maxN + 1];

int main()
{
	int N, K;
	cin >> N>> K;
	vector<int> h(N);

	for (int i = 0; i < N; i++) {
		cin >> h[i];
	}

	dp[1] = abs(h[0] - h[1]);
	for (int i = 2; i < N; i++) {
		int m = dp[i - 1] + abs(h[i - 1] - h[i]);
		for(int k = 2; k <= K;k++){
			if (i - k < 0) break;
			int tmp = dp[i - k] + abs(h[i - k] - h[i]);
			if (tmp < m) m = tmp;
		}
		dp[i] = m;//lmin(dp[i - 1] + abs(h[i - 1] - h[i]), dp[i - 2] + abs(h[i - 2] - h[i]));
	}
	cout << dp[N - 1] << endl;

	return 0;
}



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

using namespace std;
#define endl "\n"

const int MOD = 1000000007;
int main()
{
	int a, b, m = 0;
	cin >> a >> b;
	for(int i = a; i >0; i-=b){
		m++;
	}
	
	cout << m << endl;
	
	return 0;
}


Measured memory_bytes: 3648
# coding: utf-8
import sys
#from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
from heapq import heappop, heappush
from collections import defaultdict
sys.setrecursionlimit(10**7)
#import math
#from itertools import product, accumulate, combinations, product
#import bisect
#import numpy as np
#from copy import deepcopy
#from collections import deque
#from decimal import Decimal
#from numba import jit

INF = 1 << 50
EPS = 1e-8
mod = 10 ** 9 + 7

def run():
    S = input()
    K = int(input())
    dic = set()
    pos = defaultdict(lambda : [])
    for i, s in enumerate(S):
        heappush(pos[s], S[i:])
    base = 'abcdefghijklmnopqrstuvwxyz'

    for l in base:
        while pos[l]:
            sub = heappop(pos[l])
            for i in range(1, len(sub)+1):
                dic.add(sub[:i])

            if len(dic) >= K:
                dic = sorted(list(dic))
                print(dic[K - 1])
                return



if __name__ == "__main__":
    run()


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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
#define debug(x) cerr << #x << ": " << x << endl
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2018/02/14  Problem: 060_arc_a / Link: https://arc060.contest.atcoder.jp/tasks/arc060_a?lang=en  ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */

LL N, A;

LL ans = 0LL;

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

	cin >> N >> A;
	VI a(N);
	FOR(i, 0, N) {
		cin >> a[i];
	}
	vector<VVL> dp(N + 1, VVL(N + 1, VL(2501, 0)));
	dp[0][0][0] = 1;
	FOR(i, 0, N) {
		FOR(k, 0, N) {
			FOR(val, 0, 2501) {
				if(val+a[i]<=2500)dp[i + 1][k + 1][val + a[i]] += dp[i][k][val];
				dp[i + 1][k][val] += dp[i][k][val];
			}
		}
	}
	FOR(i, 1, N+1) {
		ans += dp[N][i][i*A];
	}

	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 52224
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;

int main()
{
    int n,m,x;
    int num[200];
    memset(num,0,sizeof(num));
    scanf("%d%d%d",&n,&m,&x);
    for(int i=0; i<m; i++)
    {
        int x;
        scanf("%d",&x);
        num[x]=1;
    }
    int ans1=0,ans2=0;
    for(int i=x-1; i>=0; i--)
    {
        if(num[i]==1){
            ans1++;
        }
    }
    for(int i=x+1;i<=n;i++){
        if(num[i]==1){
            ans2++;
        }
    }
    int ans=min(ans1,ans2);
    printf("%d",ans);
}


Measured memory_bytes: 256
def main():
    n = int(input())
    array = [int(i) for i in input().split(' ')]

    count = 0
    for i in range(n):
        for j in range(n-1, i, -1):
            if array[j] < array[j-1]:
                count += 1
                array[j], array[j-1] = array[j-1], array[j]
    print(' '.join(map(str, array)))
    print(count)

if __name__ == '__main__':
    main()



Measured memory_bytes: 5600
N,Y = map(int,input().split())

Yu = N
Hi = 0
No = 0

flag = False
bul = False

while True:

    if Yu * 10000 + Hi * 5000 + No * 1000 == Y:
        print (Yu,Hi,No)
        bul = True
        break

    Yu -= 1
    Hi = N - Yu
    No = 0
    

    while True:

        if Yu * 10000 + Hi * 5000 + No * 1000 == Y:
            print (Yu,Hi,No)
            bul = True
            flag = True
            break

        if Yu == 0 and Hi == 0 and No == N:
            flag = True
            break

        elif Hi == 0:
            break

        Hi -= 1
        No += 1


    if flag:
        break

if not bul:

    print (-1,-1,-1)

        


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

using namespace std;

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

    vector<long> a(n);
    for(auto &x: a) cin >> x;

    long sum = 0;
    for(auto &x: a) sum += x;

    long res = 1;
    for(long qq=1; qq*qq<sum; qq++) {
        if(sum % qq != 0) continue;

        for(long q : {qq, sum/qq}) {
            vector<long> b(n);
            copy(a.begin(), a.end(), b.begin());

            for(auto &x: b) x %= q;
            sort(b.begin(), b.end());

            long s = 0;
            for(auto &x: b) s += q - x;

            long t = 0, r = 1e9;
            for(int i=0; i<n; i++) {
                r = min(max(t, s), r);
                t += b[i];
                s -= q - b[i];
            }
            r = min(max(t, s), r);

            if(r <= k)
                res = max(res, q);

        }
    }

    cout << res << endl;
}


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  int asw = 0;
  for (int i = 1; i <= n; ++i) {
    int j = i, d = 0;
    while (j) {
      ++d;
      j /= 10;
    }
    asw += d % 2;
  }
  cout << asw << endl;
  return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int x = Integer.parseInt(in.readLine());
    System.out.println(x<1200?"ABC":"ARC");
  }
}

Measured memory_bytes: 32584
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 998244353;
const ll INF = 1LL << 60;

vector<int> Z_algo(const string &s) {
	int n = s.size();
	vector<int> z(n);
	int L = 0, R = 0;
	for (int i = 1; i < n; i++) {
		if (i > R) {
			L = R = i;
			while (R < n && s[R - L] == s[R]) R++;
			z[i] = R - L; R--;
		}
		else {
			int k = i - L;
			if (z[k] < R - i + 1) z[i] = z[k];
			else {
				L = i;
				while (R < n && s[R - L] == s[R]) R++;
				z[i] = R - L; R--;
			}
		}
	}
	return z;
}

int main() {
	int N;
	cin >> N;
	string S;
	cin >> S;
	int ans = 0;
	for (int i = 0; i < N; i++) {
		string T = S.substr(i);	
		vector<int> z = Z_algo(T);
		for (int i = 1; i < T.size(); i++) {
			ans = max(ans, min(z[i], i));
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 384
N, K = map(int, input().split())
hs = []
for _ in range(N):
  hs.append(int(input()))
hs.sort()
  
start, end = 0, K-1
ans = float('inf')
while end < N:
  ans = min(ans, hs[end]-hs[start])
  start += 1
  end += 1
  
print(ans)

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

#define X first
#define Y second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define rep(i, a, b) for (long i = (a); i <= (b); ++i)
#define per(i, a, b) for (long i = (a); i >= (b); --i)

using namespace std;

using I = int;
using L = long;
using F = float;
using S = string;
using SS = stringstream;
using C = char;
using LL = long long;
using VI = vector<int>;
using VL = vector<long>;
using VF = vector<float>;
using VS = vector<string>;
using VVI = vector<vector<int>>;
using VVL = vector<vector<long>>;
using PLL = pair<long, long>;
using PLF = pair<long, float>;
using PLS = pair<long, string>;
using PSL = pair<string, long>;
using PSF = pair<string, float>;
using PSS = pair<string, string>;
using MLL = map<long, long>;
using MLF = map<long, float>;
using MLS = map<long, string>;
using MSL = map<string, long>;
using MSF = map<string, float>;
using MSS = map<string, string>;

const long kMax2 = 109;
const long kMax3 = 1009;
const long kMax4 = 10009;
const long kMax5 = 100009;
const long kMax6 = 1000009;
const long kInfI = 0x3F3F3F3F;
const float kInfF = 1e15;

template <class T>
void Printnector(const vector<T> & v) {
  for (const auto & e: v) {
    cout << e << endl;
  }
}

template <class T>
void Printnector(const vector<T> & v, unsigned n) {
  rep(i, 0, n - 1) {
    cout << v[i] << endl;
  }
}


int main(int argc, char const *argv[]) {
  I N;
  L sum_a = 0, sum_b = 0;
  cin >> N;
  VI a(N, 0), b(N, 0);
  rep(i, 0, N - 1) {
    cin >> a[i];
  }
  rep(i, 0, N - 1) {
    cin >> b[i];
  }
  rep(i, 0, N - 1) {
    auto dif = b[i] - a[i];
    if (dif <= 0) sum_a -= dif;
    else sum_b += dif / 2 * 2;
  }
  if (sum_a * 2 > sum_b) cout << "No" << endl;
  else cout << "Yes" << endl;

  return 0;
}


Measured memory_bytes: 384
N = gets.to_i
V = gets.chomp.split(" ").map(&:to_i)

V.sort!.reverse!
wk = 0
k = 1
V.each{|v|
  k *= 2
  wk += Rational(v, k)
}
wk += Rational(V[-1], k)

puts wk.to_f


Measured memory_bytes: 3836
#include<bits/stdc++.h>
using namespace std;
int main(){
	int H1,H2,M1,M2,K;
	cin>>H1>>M1>>H2>>M2>>K;
	int total;
	total=(H2*60+M2)-(H1*60+M1);
	cout<<total-K<<endl;
}

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

namespace CSharp
{
    class Program
    {
        public static void Main()
        {
            var N = int.Parse(Console.ReadLine());
            var dic = new Dictionary<string, int>();

            var result = 0L;
            for (int i = 0; i < N; i++)
            {
                var s = Console.ReadLine();

                var array = s.ToCharArray();
                Array.Sort(array);
                s = new string(array);

                if (dic.ContainsKey(s))
                {
                    dic[s]++;
                }
                else
                {
                    dic[s] = 0;
                }

                result += dic[s];
            }

            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 29144
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <algorithm>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

// to container
template <class C>
void input(C &c)
{
    for_each(c.begin(), c.end(), [](auto &i) { cin >> i; });
}

// to number, string
template <class T>
T input()
{
    T data;
    cin >> data;
    return data;
}

int main()
{
    const ll mod = 1000000007;
    ll N = input<ll>(), M = input<ll>();

    if (abs(N - M) >= 2)
    {
        cout << 0 << endl;
        return 0;
    }

    ll fact_n = 1;
    for (ll i = 1; i <= N; i++)
    {
        fact_n = (fact_n % mod) * (i % mod) % mod;
    }

    ll fact_m = 1;
    for (ll i = 1; i <= M; i++)
    {
        fact_m = (fact_m % mod) * (i % mod) % mod;
    }

    ll f = (fact_n % mod) * (fact_m % mod) % mod;
    if (abs(N - M) == 1)
    {
        cout << f << endl;
    }
    else
    {
        cout << (2 * f) % mod << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
template<typename T>
using pque = priority_queue<T, vector<T>, greater<T>>;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

char s[212345];
ll a[2222] = {1};

int main(){
	scanf("%s", s);
	int n = strlen(s);
	reverse(s, s+n);
	{
		int b = 0;
		int p = 1;
		REP(i, n){
			b = (b + p * (s[i] - '0')) % 2019;
			p = p * 10 % 2019;
			a[b]++;
			DEBUG("%d\n", b);
		}
	}
	ll ans = 0;
	REP(i, 2019){
		ans += a[i] * (a[i]-1) / 2;
	}
	printf("%lld\n", ans);
}


Measured memory_bytes: 4036
#include<bits/stdc++.h>
typedef long long int ll;
#define mod 1000000007
#define ln "\n"
#define pb push_back
#define pf push_front
#define mp make_pair
#define pll pair<ll,ll>
#define f first
#define s second
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
char b[7][7];
char a[7][7];
int n,m,k;
void copy_matrix(){
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++)
            b[i][j]=a[i][j];
    }
    return;
}
void color(int i,int j){
    for(int x=0;x<n;x++){
        if(i&(1<<x)){
            for(int y=0;y<m;y++)
                b[x][y]='$';
        }
    }
    for(int x=0;x<m;x++){
        if(j&(1<<x)){
            for(int y=0;y<n;y++)
                b[y][x]='$';
        }
    }
    return;
}
bool check(){
    int total=0;
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            if(b[i][j]=='#')
                total++;
        }
    }
    if(total==k)
        return true;
    else
        return false;
}
void solve(){
    cin>>n>>m>>k;
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++)
            cin>>a[i][j];
    }
    int total=0;
    for(int i=0;i<(1<<n);i++){
        for(int j=0;j<(1<<m);j++){
            copy_matrix();
            color(i,j);
            if(check())
                total++;
        }
    }
    cout<<total;
}
int main(){
    fio;
    solve();
    return 0;
}


Measured memory_bytes: 3656
function Main(input) {
    var N = parseInt(input[0], 10);
    var X = parseInt(input[1], 10);
    var L = input.slice(2).map(w => parseInt(w, 10));

    var result = 1;
    var sum = 0;

    for (var i = 0; i < L.length; i++) {
        sum += L[i];
        if (sum <= X) {
            result++;
        } else {
            i += L.length;
        }
    }

    console.log(result);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim().split(/\n|\s/));

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


string S, T;


void input() {
    cin >> S >> T;
}


bool judge(map<char, char> &w, set<char> &s, char c, char x) {
    if (s.count(x)) return true;
    s.insert(x);
    if (w[x] == c) return false;
    if (!w.count(w[x])) return true;
    return judge(w, s, c, w[x]);
}


int main() {
    input();
    int n = S.size();
    map<char, char> w;
    rep(i, n) {
        if (w.count(S[i]) && w[S[i]] != T[i]) {
            cout << "No" << endl;
            return 0;
        }
        w[S[i]] = T[i];
    }
    vector<pair<char, char>> l;
    for (auto p : w) l.push_back(p);
    n = l.size();
    rep(i, n) {
        rep(j, n) {
            if (l[j].first == l[i].second) l[j].first = l[i].first;
        }
        l[i].first = l[i].second;
    }
    for (auto p : l) {
        if (p.first != p.second) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}


Measured memory_bytes: 776
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int n1=n,cnt=0;
	if(n<3){
		cout<<"0"<<endl;
		return 0;
	}
	do{
		n1-=3;
		cnt++;
	}while(n1>=3);
	cout<<cnt<<endl;
    return 0;
}      

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

using i64 = int64_t;

constexpr i64 MOD = 1e9 + 7;

i64 dp[2][10]={0};

int main(){
    int h, w, k;
    cin >> h >> w >> k;
    if(w == 1){
        cout << 1 << endl;
        return 0;
    }
    dp[0][0] = 1;
    for(int i=0;i<h;++i){
        for(int j=0;j<10;++j)dp[1][j] = 0;
        for(int j=0;j<(1<<(w-1));++j){
            bool flag = false;
            for(int l=0;l<w-2;++l){
                if(((j>>l)&1)&((j>>(l+1))&1)){
                    flag = true;
                    break;
                }
            }
            if(flag)continue;

            for(int l=0;l<w-1;++l){
                if((j>>l)&1){
                    dp[1][l] += dp[0][l+1];
                    dp[1][l] %= MOD;
                    dp[1][l+1] += dp[0][l];
                    dp[1][l+1] %= MOD;
                }
            }
            for(int l=0;l<w-1;++l){
                if(l == 0 && ((j>>l)&1) == 0){
                    dp[1][l] += dp[0][l];
                    dp[1][l] %= MOD;
                }
                if(l < w-2 && ((j>>l)&1) == 0 && ((j>>(l+1))&1) == 0
                    || l == w-2 && ((j>>l)&1) == 0){
                    dp[1][l+1] += dp[0][l+1];
                    dp[1][l+1] %= MOD;
                }
            }
        }
        for(int j=0;j<10;++j)dp[0][j] = dp[1][j];
    }

    cout << dp[0][k-1] << endl;

    return 0;
}


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

const char wall = '#';
vector<vector<char>> fields;
vector<vector<bool>> used;
vector<vector<ll>> dist;
const int dx[4] = {0, -1, 0, 1};
const int dy[4] = {1, 0, -1, 0};

ll N;
vector<ll> A;
// vectorのリサイズ
// A.resize(N);

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

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

  ll n;
  cin >> n;
  vector<string> s(n);
  map<string, int> m;
  set<string> se;
  vector<P> vp;
  vector<string> ans;
  rep(i, n) {
    std::cin >> s[i];
    m[s[i]]++;
    se.insert(s[i]);
  }
  //cout << "---" << endl;
  for(string hoge: se) {
    vp.push_back(make_pair(m[hoge], hoge));
  }
  sort(vp.begin(), vp.end(), greater<P>());
  ans.push_back(vp[0].second);
  for(int i = 1; i < vp.size(); i++) {
    if (vp[i].first == vp[0].first) ans.push_back(vp[i].second);
    else break;
  }
  sort(ans.begin(), ans.end());
  for(string an: ans) {
    cout << an << endl;
  }
  return 0;
}


Measured memory_bytes: 41580
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <math.h>
#include <stack>
#include <climits>
#include <bitset>
#include <utility>


using namespace std;
typedef long long ll;

//最小公倍数
ll gcd(ll x, ll y) {
  ll tmp = 0;
  if (x < y){
    tmp=x;
    x=y;
    y=tmp;
  }
  while (y > 0) {
    ll r = x % y;
    x = y;
    y = r;
  }
  return x;
}

//最大公倍数
ll lcm(ll x,ll y){
  return x/gcd(x,y)*y;
}

//階乗
ll kaijo(ll k){
    ll sum = 1;
    for (ll i = 1; i <= k; ++i)
    {
        sum *= i;
        sum%=1000000000+7;
    }
    return sum;
}

//for(int i = ; i < ; i++){}

ll lmax(ll s,ll t){
  if(s>t){
    return s;
  }
  else{
    return t;
  }
}

ll lmin(ll s,ll t){
  if(s<t){
    return s;
  }
  else{
    return t;
  }
}
// ここから開始

int main(){
  int n,k;
  cin>>n>>k;
  int cnt = 0;
  for(int i = 0; i < n; i++){
    int a;
    cin>>a;
    if(a>=k)cnt++;
  }
  cout<<cnt<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include<stdlib.h>
int cmpare(const void *a,const void *b)
{
	int c = *(long*)a -*(long*)b;
	if(c<0)
	return -1;
	else if(c>0)
	return 1;
	else 
	return 0;
}
int main(void) {
	// your code goes here
	int n,k,i,sum = 0;
	scanf("%d",&n);
	long int *arr = (long int*)malloc(sizeof(long int )*n);
	for(i = 0;i<n;i++)
	{
		scanf("%ld",&arr[i]);
	}
	qsort(arr,n,sizeof(arr),cmpare);
//	for(i = 0;i<n;i++)
//	printf("%ld ",arr[i]);
	int count = 1;
	for(i = 0;i<n-1;i++)
	{
		if(arr[i+1]==arr[i])
		{	count++;}
			
		else{
			if(count%2!=0&& count!=1)
				{sum++; continue;}
			if(count>1)
			{count = 1;	continue;}
			count = 1;
		//	if((arr[i+2]!=arr[i+1]&& i+2<n)||i+2>=n)
			{sum++; //printf("at %d",i);
			}
		
		}
	//	printf("%d ..",sum);
	}
		if(count%2!=0&& count!=1)
				sum++;
	
	if(arr[n-1]!=arr[n-2])
	
		sum++;
	printf("%d",sum);
	return 0;
}


Measured memory_bytes: 1788
#include<queue>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
using namespace std;
int gcd(int a,int b,int &x,int &y)
{
    if(b==0)
    {
        x=1;
        y=0;
        return a;
    }
    else
    {
        int r=gcd(b,a%b,y,x);
        y-=x*(a/b);
        return r;
    }
}
int main()
{
    int a,b,c,x,y;
    while(cin>>a>>b>>c)
    {
        if(a==0&&b==0&&c==0)
            break;
        int d=gcd(a,b,x,y);
        int r=b/d;
        int r1=a/d;
        int x1=((c/d*x)%r+r)%r;
        int y1=(c-a*x1)/b;
        if(y1<0)
            y1=-y1;
        int y2=((c/d*y)%r1+r1)%r1;
        int x2=(c-b*y2)/a;
        if(x2<0)
            x2=-x2;
        if(x1+y1>x2+y2)
        {
            x1=x2;
            y1=y2;
        }
        cout<<x1<<" "<<y1<<endl;
    }
}


Measured memory_bytes: 2988
#define  _CRT_SECURE_NO_WARNINGS
#pragma comment (linker, "/STACK:526000000")

#include "bits/stdc++.h"

using namespace std;
typedef string::const_iterator State;
#define eps 1e-11L
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL

#define MOD 998244353LL
#define seg_size 262144 * 4LL
#define pb push_back
#define mp make_pair
typedef long long ll;
#define REP(a,b) for(long long (a) = 0;(a) < (b);++(a))
#define ALL(x) (x).begin(),(x).end()

void init() {
	iostream::sync_with_stdio(false);
	cout << fixed << setprecision(20);
}

#define int ll
vector<int> vertexs[100001];
int dp[2][100001];
void solve(){
	int n, m, s, t;
	cin >> n >> m >> s >> t;
	REP(i, m) {
		int a, b;
		cin >> a >> b;
		vertexs[a].push_back(b);
		vertexs[b].push_back(a);
	}
	REP(i, n) {
		dp[0][i+1] = 1e9;
		dp[1][i + 1] = 1e9;
	}
	dp[0][s] = 0;
	queue<pair<int, int>> next;
	next.push(mp(0, s));
	while (next.empty() == false) {
		pair<int, int> now = next.front();
		next.pop();
		for (auto x : vertexs[now.second]) {
			if (dp[(now.first + 1) % 2][x] > now.first + 1) {
				dp[(now.first + 1) % 2][x] = now.first + 1;
				next.push(mp((now.first + 1), x));
			}
		}
	}
	int ans = 1e9;
	if (dp[0][t] == 2) {
		cout << 2 << endl;
		return;
	}
	if (dp[1][t] == 1e9) {
		cout << -1 << endl;
		return;
	}
	for (int i = max(3LL, dp[1][t]);;i += 2) {
		int ok = 1;
		for (int q = 2; q * q <= i; ++q) {
			if (i % q == 0) ok = 0;
		}
		if (ok == 1) {
			cout << i << endl;
			return;
		}
	}
}

#undef int
int main() {
	init();
	solve();
}


Measured memory_bytes: 10708
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include <set>

#define DIV 1000000007
using namespace std;
using ll = long long;

typedef struct {
    int id;
    int x;
    int y;
}posi_t;
vector<posi_t> posi;

typedef struct {
    vector<pair<int, int>> edge;
}node_t;
vector<node_t> node;

bool cmpx(const posi_t& left, const posi_t& right) {
    return left.x < right.x;
}
bool cmpy(const posi_t& left, const posi_t& right) {
    return left.y < right.y;
}

priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq;
void prim(ll& ans, vector<bool>& visit) {
    //int cnt = 1;
    while (!pq.empty()) {
        pair<int, int> x = pq.top();
        pq.pop();
        if (visit[x.second]) continue;
        ans += (ll)x.first;
        visit[x.second] = true;
        //cnt++;

        //cout << x.second << "ans=" << ans << endl;
        for (auto ed : node[x.second].edge) {
            if (visit[ed.second]) continue;
            pq.push(ed);
        }        
    }
}

int main() {
    int N;
    cin >> N;

    posi = vector<posi_t>(N);
    for (int i = 0; i < N; i++) {
        posi[i].id = i;
        cin >> posi[i].x >> posi[i].y;
    }

    node = vector<node_t>(N);
    sort(posi.begin(), posi.end(), cmpx);
    for (int i = 0; i < N - 1; i++) {
        int cost = posi[i + 1].x - posi[i].x;
        node[posi[i].id].edge.push_back(make_pair(cost, posi[i + 1].id));
        node[posi[i + 1].id].edge.push_back(make_pair(cost, posi[i].id));
    }

    sort(posi.begin(), posi.end(), cmpy);
    for (int i = 0; i < N - 1; i++) {
        int cost = posi[i + 1].y - posi[i].y;
        node[posi[i].id].edge.push_back(make_pair(cost, posi[i + 1].id));
        node[posi[i + 1].id].edge.push_back(make_pair(cost, posi[i].id));
    }

    vector<posi_t>().swap(posi);
    ll ans = 0;
    vector<bool> visit(N);
    visit[0] = true;
    for (auto ed : node[0].edge) {
        pq.push(ed);
    }
    prim(ans, visit);

    cout << ans << endl;

}


Measured memory_bytes: 9964
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
typedef pair< int , pair< int, int > > piii;
int n, m;
int root[1000];
vector< piii > pq;
vector< int > vc;

int find_root(int n){
   if(n!=root[n]) return root[n]=find_root(root[n]);
   return n;
}

int kruskal(bool f, int dodge){
    int cnt=1;
    for(int i=1;i<=n;i++){
        root[i]=i;
    }

    int sum=0;
    for(int i=0;i<m;i++){
        if(i==dodge) continue;
        if(cnt==n) break;
        piii e = pq[i];
    	int px = find_root(e.ss.ff);
    	int py = find_root(e.ss.ss);
    	if(px!=py){
            root[px]=py;
            cnt++;
	        sum+=e.ff;
            if(f) vc.push_back(i);
    	}
    }

    if(cnt!=n) return -1;
    else return sum;
}


int main(){
	scanf("%d%d", &n, &m);
	for(int i=1;i<=m;i++){
		int u,v,c;
		scanf("%d%d%d", &u, &v, &c);
		pq.push_back({c,{u,v}});
	}
	sort(pq.begin(), pq.end());

	int cost = kruskal(1,-1),  ans=0, cnt=0;
	//cout<<cost<<" "<<vc.size()<<endl;
	for(int i=0;i<vc.size();i++){
		int tmp = kruskal(0,vc[i]);
		//cout<<i<<" "<<tmp<<endl;
		if(tmp!=cost){
			cnt++;
			ans+=pq[vc[i]].ff;
		}
	}

	printf("%d %d\n", cnt, ans);
	return 0;
}





Measured memory_bytes: 3808