akhauriyash/Code-Regression huggingface dataset:
#include <iostream>

using namespace std;

int main(){
    int N,M;
    cin>>N>>M;
    int R[55]= {0};
    int a,b;
    for(int i=0;i<M;i++){
        cin>>a;
        cin>>b;
        R[a] += 1;
        R[b] += 1;
    }
    for(int i=1;i<=N;i++){
        cout<<R[i]<<endl;
    }
}

Measured memory_bytes: 3584
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int X = sc.nextInt();
    int Y = sc.nextInt();
    int distanse = Y-X;//ショートしなかった場合の距離
    int mindist[][]=new int[N+1][N+1];
    int ans[] = new int[N];
    for(int i=1;i<=N;i++){
      for(int j=i+1;j<=N;j++){
        if(i<=X&&j>=Y){//完全にまたいでいるとき
          mindist[i][j]=j-i-distanse+1;
          ans[mindist[i][j]]++;
        }else if(i>=X&&j<=Y){//両方ショートカットの中に入っているとき
          mindist[i][j]=Math.min(j-i,i-X+1+(Y-j));//中からたどるか外からたどるか早いほう
                    ans[mindist[i][j]]++;
        }else if(i>=X&&j>=Y&&i<=Y){//iがショートカットの中に入っているとき
          mindist[i][j]=Math.min(i-X+1+(j-Y),j-i);//中からたどるか外から...
                    ans[mindist[i][j]]++;
        }else if(j<=X||i>=Y){//ショートカット関係ないとき
          mindist[i][j]=j-i;
                    ans[mindist[i][j]]++;
        }else if(i<X&&j>=X&&j<=Y){//jがショートカットの中に入っているとき
          mindist[i][j]=Math.min(X-i+1+Y-j,j-i);//同上
                    ans[mindist[i][j]]++;
        }else{
        }
      }
    }
//    for(int i=0;i<N;i++){
//      for(int j=0;j<N;j++){
//        System.out.print(mindist[i][j]);
//        System.out.print(" ");
//      }
//      System.out.println("");
//    }
    
    for(int k=1;k<=N-1;k++){
     System.out.println(ans[k]);
    }
  }
  

  
}

Measured memory_bytes: 51668
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
int main() {
    string s;
    cin >> s;
    int n = sz(s);
    int ans = 0;
    int now = 0;
    rep(i, n) {
        if (s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T') {
            now++;
        } else {
            chmax(ans, now);
            now = 0;
        }
    }
    chmax(ans, now);
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<string>
#include<utility>
#include<algorithm>
#include<cstdio>
#include<iomanip>
using namespace std;
#define ll int64_t
#define REP(i, n) for (ll i=0; i<n; i++)

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

    string S;
    cin >> S;
    ll count = 0, ans = 0;
    REP (i, S.size()) {
        if (S[i] == 'W') {
            ans += i - count;
            count++;
        }
    }

    cout << ans << "\n";
}

Measured memory_bytes: 720
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,n) for(int i=1;i<(int)(n);i++)

typedef long long ll;
using namespace std;
int main()
{
  ll a,b,c;
  cin>>a>>b>>c;
  cout<<min(min(a+b,a+c),b+c)<<endl;

  return 0;
}


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



int ASCttenannoryaku(const void *a,const void *b) {
	return *(int *)a - *(int *)b;
}
int main(void)
{
	long n, k, ans = 1, keep = 0;
	scanf("%ld""%ld",&n,&k);
	keep = k;
	while (pow(keep,ans) <= n) {
		//printf("%d ",k);
		ans++;
	}
	printf("%d",ans);
	return 0;
}


Measured memory_bytes: 128
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
if N%min(A, B, C, D, E) == 0:
    print(N//min(A, B, C, D, E)+4)
else:
    print(N//min(A, B, C, D, E)+5)

Measured memory_bytes: 38256
import numpy as np

n = int(input())

a = list(map(int, input().split()))

x = {}
y = {}

ans = 0

for i in range(n):
  x.setdefault((i+a[i]), []).append(i) 
  y.setdefault((i-a[i]), []).append(i)

z = list(set(x.keys()) & set(y.keys()))

# print(x)
# print(y)
# print(z)

for i in z:
  if x[i][len(x[i])-1] < y[i][0]:
    n = len(y[i]) * len(x[i])
    ans += n
    # print(x[i])
    # print(y[i])
    # print(n)
    # print(ans)

  else:
    for j in range(len(x[i])):
      # print(x[i])
      # print(x[i][j])
      # print(y[i])
      ans += sum(1 for k in y[i] if x[i][j] < k)

print(ans)

Measured memory_bytes: 131660
#include <stdio.h>

int main(void)
{
    int h,w,i,a;
    char x='#';
    
   while(1){
    scanf("%d%d",&h,&w);
    if(h+w==0)break;
        for(i=0;i<h;i++){
            for(a=0;a<w;a++){
                printf("%c",x);
            }
        printf("\n");
        }
    printf("\n");
   }
    return 0;
}


Measured memory_bytes: 2112
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define check(v) rep(i,v.size()) cout << v[i] << " ";\
cout << endl
#define INF 1e8
typedef long long ll;
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお

int main() {
    int n; cin >> n;
    bool big = false, small = false;
    vector<int> v(n);
    rep(i,n){
        cin >> v[i];
    }
    int ans = 0;
    for(int i = 1; i < n; i++){
        if(v[i]>v[i-1]) big = true;
        else if(v[i]<v[i-1]) small = true;
        if(big == true && small == true){
            ans += 1;
            big = false;
            small = false;
        }
    }
    cout << ans+1 << endl;

    return 0;
}

Measured memory_bytes: 640
import bisect
N, M, K = map(int, input().split())
A = [0]+[int(i) for i in input().split()]
B = [int(i) for i in input().split()]

for i in range(1, N+1):
    A[i] = A[i-1]+A[i]

for i in range(1, M):
    B[i] = B[i-1]+B[i]


ans = 0
for i in range(N+1):
    if A[i] <= K:
        ans = max(ans, i+bisect.bisect_right(B, K-A[i]))
print(ans)


Measured memory_bytes: 120336
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
#define REP(i,a,b) for(i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
#define ll long long
#define ull unsigned ll
typedef long double ld;
#define ALL(a) (a).begin(),(a).end()
#define ifnot(a) if(not a)
#define dump(x)  cerr << #x << " = " << (x) << endl
using namespace std;

void reader(int &a) { scanf("%d", &a); }
void reader(double &a) { scanf("%lf", &a); }
void reader(char a[]) { scanf("%s", a); }
void reader(char &a) { scanf(" %c", &a); }
void reader(ll &a) { scanf("%lld", &a); }
void reader(ull &a) { scanf("%llu", &a); }
// void reader(string& a){cin >> a;};
template<class T, class U> void reader(T& t, U& u) { reader(t); reader(u); }
template<class T, class U, class V> void reader(T& t, U& u, V& v) { reader(t); reader(u); reader(v); }

void writer(const int a, char c) { printf("%d", a); putchar(c); }
void writer(const ll a, char c) { printf("%lld", a); putchar(c); }
void writer(const ull a, char c) { printf("%llu", a); putchar(c); }
void writer(const double a, char c) { printf("%.20lf", a); putchar(c); }
void writer(const char a[]) { printf("%s", a); };
void writer(const char a[], char c) { printf("%s", a); putchar(c); };
void writer(const char a, char c) { putchar(a); putchar(c); };
template<class T> void writerLn(T t) { writer(t, '\n'); }
template<class T, class U> void writerLn(T t, U u) { writer(t, ' '); writer(u, '\n'); }
template<class T, class U, class V> void writerLn(T t, U u, V v) { writer(t, ' '); writer(u, ' '); writer(v, '\n'); }
template<class T> void writerArr(T x[], int n) { int i; if (!n) { putchar('\n'); return; }rep(i, n - 1) writer(x[i], ' '); writer(x[n - 1], '\n'); }
template<class T> void writerVec(vector<T> x) { int n = x.size(); int i; if (!n) { putchar('\n'); return; }rep(i, n - 1) writer(x[i], ' '); writer(x[n - 1], '\n'); }

vector<string> split(const string &str, char sep) { vector<string> v; stringstream ss(str); string buffer; while (getline(ss, buffer, sep)) { v.push_back(buffer); }return v; }
// #define int ll
bool test = 1;
int dx[] = { 0,1,0,-1 };
int dy[] = { 1,0,-1,0 };
#define MAX 300000
//.....................
ull mod = (int)1e9 + 7;

struct Rectangle {
	int h, w;
	bool operator < (const Rectangle& r) const {
		if (h*h + w*w < r.h*r.h + r.w*r.w) return true;
		if (h*h + w*w == r.h*r.h + r.w*r.w) {
			if (h < r.h) return true;
		}
		return false;
	}
};
signed main(void)
{
	int i, j, k;
	while (1) {
		Rectangle a;
		cin >> a.h >> a.w;
		if (a.h == 0) return 0;
		Rectangle res = { 350,350 };
		Rectangle now;
		REP(now.h, 1, 350) {
			REP(now.w, now.h + 1, 350) {
				if (a < now && now < res) {
					res = now;
				}
			}
		}
		writerLn(res.h, res.w);
	}
	return 0;
}

Measured memory_bytes: 1148
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
typedef long long ll;
typedef vector<vector<ll>> vvl;
typedef vector<ll> vl;
typedef vector<vector<char>> vvc;
typedef vector<char> vc;
typedef pair<ll,ll> pll;
ll max(ll x,ll y){
if(x>y)return x;
else return y;
}
ll min(ll x,ll y){
  return x+y-max(x,y);
}


int main() {
  int n;cin >> n;
  double ans=0;
  rep(i,n){
    double t;string s;
    cin >> t >> s;
    if(s=="JPY")ans+=t;
    else ans=ans+(380000.0*t);
  }
  cout << fixed << setprecision(10);
  cout << ans << endl;
}

Measured memory_bytes: 256
# 毎回ソートしても別にいいんじゃないの -> ダメでした
# 毎回最大のものがほしいならheapq使うか
import heapq

n, m = map(int, input().split())
# heapは最小のものを取り出すので予め-1をかけて大小を見かけ上逆転しておく
arr = list(map(lambda x: int(x) * -1, input().split()))
heapq.heapify(arr)
for _ in range(m):
    a = heapq.heappop(arr)
    # 負数にしたときの誤差がめんどくさい
    a *= -1
    a //= 2
    heapq.heappush(arr, a * -1)
print(sum(arr) * -1)


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

int solve(int n, int k, vector<vector<int>> a) {
  vector<bool> res(n, true);
  for(auto aa: a) {
    for(auto aaa: aa) {
      res[aaa -1] = false;
    }
  }
  int count = 0;
  for(auto r: res) {
    if(r)
      count++;
  }

  return count;
}

int main() {
  int n, k;
  cin >> n >> k;
  vector<vector<int>> a(k);
  for(int i=0;i<k;i++) {
    int d;
    cin >> d;
    a[i] = vector<int>(d);
    for(int j=0;j<d;j++) {
      cin >> a[i][j];
    }
  }
  cout << solve(n, k, a);
}

Measured memory_bytes: 3552
#include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<functional>
#include<queue>
#include<stack>
#include<set>
using namespace std;
#define SZ(n)  (int)n.size()
#define dump(x) cerr<<#x<<" = "<<(x)<<endl;
#define debug(x)cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define MP make_pair
#define PB push_back
const int INF=1<<28;
	int n,m,k;
	int p[300000];
	void dfs(int now,int sum){
		if(now==n)p[sum]++;
		if(now==n)return ;
		for(int i=1;i<=m;i++)dfs(now+1,sum+i);
	}
	
	int main(){
	while(cin>>n>>m>>k,n+m+k){
	dfs(0,0);
	double ans=0.0;
	int kaku=pow(m,n);
	for(int i=1;i<=m*n;i++){
		double a=(double)p[i]/double(kaku);
		double b=max(double(i-k),1.0);
		ans+= a*b;
	}
	printf("%.10lf\n",ans);
	fill(p,p+300000,0);
	}
	return 0;
} 

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

int main(){
    int n, a;
    cin >> n >> a;
    if(n % 500 == 0){
        cout << "Yes" << endl;
        return 0;
    }

    while(true){
        if(a == 0){
            break;
        }
        n--;
        if(n % 500 == 0){
            cout << "Yes" << endl;
            return 0;
        }
        a--;
    }

    cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main()
{
  string str;
  string strAZ = "";
  bool appearedA = false;
  
  cin >> str;

  for (int i = 0; i != str.size(); i++) {
    if (!appearedA) {
      if (str[i] == 'A') {
        appearedA = true;
      }
    } else {
      if (str[i] == 'Z') {
        appearedA = false;
        strAZ += "AZ";
      }
    }
  }
  strAZ.size() ? cout << strAZ << endl : cout << -1 << endl;
}
        



Measured memory_bytes: 3208
import itertools

def main():
  X = int(input())
  S = int(X/100)
  
  costs = [100, 101, 102, 103, 104, 105]
  
  for v in itertools.combinations_with_replacement(costs, S):
    if sum(v) == X:
      return 1
  
  return 0

print(main())

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

int main ()
{
    string s;
    cin >> s;
    int k;
    cin >> k;
    vector<string> v;
    for (int i=0;s.size()>i;i++)
    {
        for (int j=1;i+j-1<s.size();++j)
        {
            if (j > k+2) break;
            v.push_back(s.substr(i,j));
        }
    }
    set<string> st;
    while (k--)
    {
        string mn = " ";
        mn[0] = char('z'+1);
        for (string i:v)
        {
            if (st.find(i) != st.end()) ;
            else mn = min(mn,i);
        }
        if (!k) cout << mn << endl;
        st.insert(mn);
    }
}


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

int memo[100000];

int main(){
  int s;
  cin >> s;
  
  for(int i=1;s>0;i++){
    memo[s]++;
    if(memo[s] >= 2){
      cout << i;
      return 0;
    }
    if(s%2==0){
      s/=2;
    }
    else{
      s = 3*s +1;
    }
  }
  return 0;
}

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


int main(){
    int n;
    cin >> n;
    double ans = (n&1 ? (double)(n+1.0)/(2.0*n) : 0.5);
    printf("%.8f\n", ans);
}


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

// #define fi first
// #define se second
#define rep(i, n) for (ll i=0;i<(n); i++)
#define ALL(v) (v).begin(), (v).end()
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pi;

const ll M=1000000007ll;
const ll MOD=1000000007ll;
const ll MAX=100000001ll;
//const ll M = 1000000000+7;

const int mod = 1000000007;
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*(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;
  }
};

mint f(ll n){
  if(n==0) return 1;
  mint ans = f(n/2);
  ans *= ans;
  if(n%2==1) ans*= 2;
  return ans;
}

mint choose(ll n, ll k){
  mint x=1, y=1;
  rep(i,k){
    x *= (n-i);
    y *= (i+1);
  }
  return x / y;
}

struct BIT {
  private:
   vector<ll> bit;
   ll N;
 
  public:
   BIT(ll size) {
     N = size;
     bit.resize(N + 1);
   }
 
   // 一点更新です
   void add(ll a, ll w) {
     for (ll x = a; x <= N; x += x & -x) bit[x] += w;
   }
 
   // 1~Nまでの和を求める。
   int sum(ll a) {
     ll ret = 0;
     for (ll x = a; x > 0; x -= x & -x) ret += bit[x];
     return ret;
   }
 };
 
ll fff(ll n, vector<ll>& v, ll i, ll j, ll rl){
  ll can = 0;
  ll can_i = 0;

  cout << v[0]<<endl;
  
  // right
  if(rl == 0){
    rep(k, n){
      if(v[k]*(j-k)>can){
	can = v[k]*(j-k);
	can_i = k;
      }
      //cout << can<<endl;
    }
    v[can_i] = 0;
    return can;
  }
  // left
  else{
    rep(k, n){
      if(v[k]*(k-i)>can){
	can = v[k]*(k-i);
	can_i = k;
      }
      //cout << can<<endl;

    }
    v[can_i] = 0;
    return can;
  }
  
}

ll ff(ll x){
  return x * (x+1) / 2;
}

int main(){
  ll n, k,x,y;
  cin>>n>>k;

  map<ll, ll> m;
  priority_queue< ll, vector<ll>, greater<ll> > q;
  ll cnt=0,tmp=0;
  rep(i, n){
    cin>>tmp;
    m[tmp]++;
  }
  for(auto w:m){
    cnt++;
    q.push(w.second);
  }
  ll ans=0;
  if(cnt<k){
    cout<<0<<endl;
    return 0;
  }
  rep(i, cnt-k){
    ans+=q.top();
    q.pop();
  }
  
  cout<<ans<<endl;
}


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

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

  int ans = 0;
  rep(i, N) {
    if (S.at(i) == 'A' && i+1 <= N-1) {
      if (S.at(i+1) == 'B' && i+2 <= N-1) {
        if (S.at(i+2) == 'C') {
          ans++;
        }
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
//K-OS WITH THE OCDE

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

#include <iostream>
#include <numeric>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <deque>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <climits>

using namespace std;

typedef long long int ll;
typedef long double db;


#define TEST ll t; cin>>t; while(t--)
#define vell vector<ll>
#define pl pair<ll,ll>
#define all(v) v.begin(),v.end()
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define dbg(x)  cerr << #x << ": "<< x <<endl
#define dbg2(x,y) cerr<< #x <<": "<< x <<" || "<< #y << ": " << y << endl

#define endl "\n"
#define MAX 1e18
#define MIN INT_MIN
#define mod 1000000007



void solve()
{
    string a, b;
    cin >> a >> b;
    ll n = a.size() , m  = b.size() , f = MAX;

    for (ll i = 0 ; i < n - m + 1 ; ++i) {
        ll co = 0;
        string c = a.substr(i, m);

        for (ll j = 0 ; j < m ; ++j)
            if (c[j] != b[j])
                co++;

        f = min(f, co);
    }

    cout << f;
}

int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(0); cin.tie(0);
    //TEST
    solve();
}



Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL<<60;
#define REP(i,n) for(int i=0; i<(n);++i)
#define FOR(i,k,n) for(int i=(k);i<(n);++i)
 
int main(){
    ll a,b,c;cin>>a>>b>>c;
    if(a%2==0||b%2==0||c%2==0)cout<<0<<endl;
    else{
        cout<<min(a*b,min(b*c,c*a))<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
n, m = gets.split().map(&:to_i)
ps = []
seen = Array.new(n+1, false)
wa = Array.new(n+1, 0)

m.times do
  ps << gets.chomp.split()
end

ps.each do |p, s|
  if s == "AC"
    seen[p.to_i] = true
    next
  end
  next if seen[p.to_i]
  wa[p.to_i] += 1
end

acSum = 0
waSum = 0

(n+1).times do |i|
  if seen[i]
    acSum += 1
    waSum += wa[i]
  end
end

puts "#{acSum} #{waSum}"


Measured memory_bytes: 22140
#include <bits/stdc++.h>
#include <iostream>
#include <utility>
#include <algorithm>
#include <numeric>
#define load ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
#define ll long long
#define ull unsigned long long
#define fori(i,n) for (int i=0; i<int(n);i++)
#define srt(v) sort(v.begin(), v.end())
#define MOD 1000000007
const int INF = 1e9;
const double PI = 3.14159265358979323846;

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

void solve(){

}

int main(){
	load;
    ll a;
    cin>>a;
    ll res = 0;
    for(ll i=2; i*i <= a;i++){
		ll cnt = 0, curPow = 1;
		while(a % i == 0){
			a /= i;
			cnt++;
			
			if (cnt == curPow){
				res ++;
				curPow ++;
				cnt = 0;
			}
		}
	}
	if (a > 1) res ++;
	cout << res << "\n";
}



Measured memory_bytes: 3604
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
''' 
------------------------
author : iiou16
------------------------
'''

def main():
    S = "0b" + input()
    
    # 01010...のビット列とのXORをとってビットの数を数える
    # 0と1で少ないほうが最小値
    """
    # 桁揃えをしないと一桁減る場合がある
    0000
    0b0000 0b0101
    0b101
    1
    """
    base = "0b"
    for i in range(len(S)-2):
        if i % 2 == 0:
            base += "1"
        else:
            base += "0"
    # print(S, base)
    res = int(S, 0) ^ int(base, 0)

    b_format = "{:0" + str(len(S)-2) + "b}"
    bit = b_format.format(res)
    # print(bit)
    bit = list(map(int, list(bit)))
    count = sum(bit)
    
    if count >= len(bit) / 2:
        print(len(bit) - count)
    else:
        print(count)


if __name__ == '__main__':
    main()

Measured memory_bytes: 5236
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i=0;i < (int)(n);i++)

int cnt[100];
ll val[10];
int main(){
    int n;
    map<char,int> m;
    cin >> n;
    rep(i,n){
        string s;
        cin >> s;
        if (s[0] == 'M' || s[0] == 'A' ||s[0] == 'R' || s[0] == 'C' || s[0] == 'H') m[s[0]]++;
    }
    int id=0;
    for (auto w:m){
        val[id] = (ll)w.second;
        id++;
    }
    ll ans=0;
    for (int i=0;i < 5;i++){
        for (int j = i+1;j < 5;j++){
            for (int k = j+1;k < 5;k++){
                ans+=val[i]*val[j]*val[k];
            }
        }
    }
    // rep(i,5) cout << val[i];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=998244353;

ll N;
string S;

ll dp[200020][2];

void add(ll &a,ll b){
  a=(a+b)%MOD;
}

ll mod_pow(ll x,ll n){
  x%=MOD;
  ll res=1;
  while(n>0){
    if(n&1) res=res*x%MOD;
    x=x*x%MOD;
    n/=2;
  }
  return res;
}

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

  dp[0][0]=1;
  for(int i=0;i<N;i++){
    if(S[i]=='0'){
      add(dp[i+1][0],dp[i][0]);
      add(dp[i+1][1],dp[i][1]*2%MOD);
    }else{
      add(dp[i+1][0],dp[i][0]);
      add(dp[i+1][1],dp[i][1]*2%MOD);
      add(dp[i+1][1],dp[i][0]);
    }
  }

  vector<pair<int,ll>> v;

  for(int i=1;i<=N;i++){
    if(N%i>0) continue;
    int x=N/i;
    if(x%2==0) continue;

    string s="";
    for(int j=0;j<i;j++) s+=S[j];
    string t="";
    for(int j=0;j<i;j++){
      if(s[j]=='0') t+="1";
      else t+="0";
    }
    string r="";
    for(int j=1;j<=x;j++){
      if(j%2) r+=s;
      else r+=t;
    }

    if(S>=r) v.push_back(mkp(i,dp[i][1]+1));
    else v.push_back(mkp(i,dp[i][1]));
  }

  ll ans=0;
  for(int i=0;i<v.size();i++){
      int now=v[i].first;
      add(ans,v[i].second*2*now%MOD);
      for(int j=i+1;j<v.size();j++){
          if(v[j].first%now==0) add(v[j].second,MOD-v[i].second);
      }
  }

  cout<<ans<<endl;

  return 0;
}


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

#define range 524289
#define mod 1000000007
#define eps 1e-9
#define PI 3.14159265358979323846
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define ALL(V) V.begin(), V.end()
#define _ <<" "<<

using namespace std;

typedef  long long int ll;
typedef vector <ll> vi;
typedef vector<vi> vvi;
typedef pair <ll, ll> ii;
typedef pair<int, pair<int,int> > iii;
typedef vector<ii> vii;
typedef vector<iii> viii;

string s;
int n;
int k;
vi a;
vector<vvi> dp;

ll solve(int i, int sum, int flag){
    if(i==n){
        return (sum==k);
    }
    if(dp[i][sum][flag]!=-1) return dp[i][sum][flag];
    int lim = 9;
    if(!flag){
        lim = a[i];
    }
    ll ans =0;
    for (int j = 0; j<=lim; ++j)
    {
        /* code */
        int sum1 = sum+j;
        int flag1 = flag;
        while(sum1>k){
            sum1 -= k;
        }
        if(flag==0&&j<lim) flag1 = 1;
        ans = (ans + solve(i+1, sum1, flag1))%mod;
    }
    // cout<<i<<" "<<sum<<" "<<flag<<" "<<ans<<endl;
    return dp[i][sum][flag] = ans;
}


int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
	int t = 1;
	// cin>>t;
	while(t--){
        cin>>s;
        n = s.size();
        a = vi(n);
        for (int i = 0; i < n; ++i)
        {
            /* code */
            a[i] = s[i]-'0';

        }
        cin>>k;
        dp = vector<vvi>(n, vvi(k+1, vi(2, -1)));

        cout<<solve(0, 0, 0)<<endl;

	}

    return 0;
}


Measured memory_bytes: 56832
#include <iostream>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#include <iterator>
#include <math.h>
#include <cstdlib>
#include <cmath>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define dump(x)  cerr << #x << " = " << (x) << endl;
using namespace std;
int main(){
  int N,X;
  cin >> N >> X;
  int m[N];
  int sum = 0;
  FOR(i,0,N){
    int x;
    cin >> x;
    m[i] = x;
    sum += x;
  }
  int nokori = X - sum;
  vector<int> vecm(m,m+N);
  sort(vecm.begin(),vecm.end());
  int ans = N;
  //for(auto x : vecm ) std::cout << x << " ";
  while(nokori >= 0){
    nokori -= vecm.at(0);
    ans++;
  }
  cout << ans -1 << endl;
  return 0;
}

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

def factorization(n):
    arr = {}
    temp = n
    i = 2
    if temp % i == 0:
        cnt = 0
        while temp % i == 0:
            cnt += 1
            temp //= i
        arr[i] = cnt

    return arr

ans = 0
for a in A:
    arr = factorization(a)
    if 2 in arr:
        ans += arr[2]
print(ans)

Measured memory_bytes: 42220
from collections import deque

INF = 1001001001
di = (-1, 0, 1, 0)
dj = (0, -1, 0, 1)

h, w = map(int, input().split())
s = [input() for _ in range(h)]
ans = 0

for si in range(h):
  for sj in range(w):
    if s[si][sj] == '#':
      continue
    dist = [[INF] * w for _ in range(h)]
    dist[si][sj] = 0
    q = deque([(si, sj)])
    while q:
      i, j = q.popleft()
      for dir in range(4):
        ni = i + di[dir]
        nj = j + dj[dir]
        if (ni<0 or ni>=h or nj<0 or nj>=w):
          continue
        if s[ni][nj] == '#':
          continue
        if dist[ni][nj] != INF:
          continue
        q.append((ni, nj))
        dist[ni][nj] = dist[i][j]+1
    for i in range(h):
      for j in range(w):
        if dist[i][j] == INF:
          continue
        ans = max(ans, dist[i][j])
print(ans)

Measured memory_bytes: 3316
N,M = list(map(int,input().split()))
A = list(map(int,input().split()))
A.sort(reverse=True)

discount_list = []
for a in A:
    while a > 0:
        discount = a//2
        discount_list.append(a-discount)
        a = discount
        
discount_list.sort(reverse=True)
# print(discount_list)

print(sum(A)-sum(discount_list[:M]))

Measured memory_bytes: 216340
#include<stdio.h>
#include<math.h>

int main(){
	int x, count=0;
	int N,m;
	scanf("%d",&N);
	for(m=0;m<N;m++){
		scanf("%d",&x);
		if(x==2||x==3){
			count++;
			continue;
		}
		else if(x%2==0){
			continue;
		}
		int i;
		int y=1;
		for(i=2;i*i<=x;i+=1){
			if(x%i==0){
				y=0;
				break;
			}
		}
		if(y==1){
			count++;
		}
	}
	printf("%d\n",count);
	return 0;
}

Measured memory_bytes: 596
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#include<boost/multiprecision/cpp_int.hpp>
#define endl "\n"
#define sz(x) ((ll)(x).size())
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define prt(x) cout << (x)
#define prtl(x) cout << (x) << endl
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define rrep(i,a,b) for(ll i=a; i>b; i--)
#define mp(a, b) make_pair(a, b)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define debug(v) cout << #v<< ": " << v <<endl;
using namespace std;
using namespace boost::multiprecision;
using vi = vector<int>;
using vll = vector<long long int>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vc = vector<char>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long int>>;
using vvc = vector<vector<char>>;
using ll = long long int;
using P = pair<long long int, long long int>;
using Map = map<long long int, long long int>;
using bint = cpp_int;
ll INF = 1LL<<60;

const ll M = 1000000007;
 
vector<ll> fac(3000000); //n!(mod M)
vector<ll> ifac(3000000); //k!^{M-2} (mod M)
//a,bの範囲的にこれだけ配列を用意していけば十分

ll mpow(ll x, ll n){ //x^n(mod M) ←普通にpow(x,n)では溢れてしまうため，随時mod計算
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % M;
        x = x*x % M;
        n = n >> 1;
    }
    return ans;
}

ll comb(ll a, ll b){ //aCbをmod計算
    if(a == 0 && b == 0)return 1;
    if(a < b || a < 0 || b < 0)return 0;
    ll tmp = ifac[a-b]* ifac[b] % M;
    return tmp * fac[a] % M;
}

ll hcomb(int P_,int Q_) { return (P_==0&&Q_==0)?1:comb(P_+Q_-1,Q_);}

int main(){
    fac[0] = 1;
    ifac[0] = 1;
    for(ll i = 0; i<3000000; i++){
        fac[i+1] = fac[i]*(i+1) % M; // n!(mod M)
        ifac[i+1] = ifac[i]*mpow(i+1, M-2) % M; // k!^{M-2} (mod M) ←累乗にmpowを採用
    }
    ll n, m, k; cin >> n >> m >> k;
    bint sum = 0;
    rep(i, 1, n){
        bint h = 1;
        h *= (ll)pow(m,2);
        h *= (n-i);
        h *= i;
        sum += h;
    }
    rep(i, 1, m){
        bint h = 1;
        h *= (ll)pow(n,2);
        h *= (m-i);
        h *= i;
        sum += h;
    }
    sum *= comb(n*m-2, k-2);
    sum %= M;
    prt(sum);
}


Measured memory_bytes: 50096
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define pb push_back
#define fi first
#define se second
const int maxn=1e3+10;
const int mod=1e9+7;
const int inf=0x3f3f3f3f;
int pow2[20],dp[1<<14];
bool vis[1<<14];
pair<int,int> book[maxn];
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n,m;
	cin>>n>>m;
	pow2[0]=1;
	for(int i=1;i<=13;i++) pow2[i]=pow2[i-1]*2;
	vis[0]=true;
	for(int i=0;i<m;i++)
	{
		int a,b,now=0;
		cin>>a>>b;
		book[i].fi=a;
		while(b--)
		{
			int x;
			cin>>x;
			now+=pow2[x-1];
		}
		book[i].se=now;
	}
	int up=1<<n;
	for(int i=0;i<m;i++)
	{
		for(int j=0;j<up;j++)
		{
			if(!vis[j]) continue;
			if(vis[j|book[i].se])
				dp[j|book[i].se]=min(dp[j|book[i].se],dp[j]+book[i].fi);
			else 
				dp[j|book[i].se]=dp[j]+book[i].fi;
			vis[j|book[i].se]=true;
		}
	}
	if(vis[up-1]) cout<<dp[up-1]<<'\n';
	else cout<<-1<<'\n';
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>  // g++ -std=c++14 -o a a.cpp

using namespace std;

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

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

__attribute__((constructor)) void initial() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int N;
map<int, map<string, int>> memo;
char C[4] = {'A', 'C', 'T', 'G' };

bool ok(string last4) {
    rep(i, 4) {
        string s = last4;
        // DEBUG(s);
        if (i >= 1) { // 交換なし、0,1,2の位置での交換
            s[i - 1] = last4[i];
            s[i] = last4[i - 1];
        }
        if (s.find("AGC") != string::npos) {
            return false;
        }
    }
    return true;
}

int dfs(int cur, string last3) {
    if (memo.count(cur) > 0 && memo.at(cur).count(last3) > 0) return memo.at(cur).at(last3);
    if (cur == N) return 1;
    int ret = 0;
    rep(i, 4) {
        // DEBUG(last3 + C[i]);
        // DEBUG(ok(last3 + C[i]));
        if (ok(last3 + C[i])){

            ret = (ret + dfs(cur + 1, last3.substr(1, 2) + C[i])) % MOD;
        }
    }
    if (memo.count(cur) == 0) {
        map<string, int> m;
        memo.insert(make_pair(cur, m));
    }
    memo.at(cur).insert(make_pair(last3, ret));
    return ret;
}

int main() {
    cin >> N;
    int result = dfs(0, "TTT");
    cout << result << endl;
}

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

namespace ConsoleApplication1
{
  class Program
  {
    static void Main(string[] args)
    {
      string line = Console.ReadLine();
      string[] split = line.Split(' ');
      int n = Int32.Parse(split[0]);
      int k = Int32.Parse(split[1]);

      int[] ai = new int[200000];
      line = Console.ReadLine();
      split = line.Split(' ');
      for (int i = 0; i < n; ++i) {
        ai[i] = Int32.Parse(split[i]);
      }

      int ak = 1;
      for (int i = 0; i < k; ++i) {
        ak *= ai[i];
      }

      for (int testnum = k; testnum < n; testnum++)
      {
        if (ai[testnum - k] < ai[testnum]) Console.WriteLine("Yes");
        else Console.WriteLine("No");

      }

      int a = 0;
    }
  }
	class list{
		public int juni;
		public int old;
		public list(int juni, int old){
			this.juni = juni;
			this.old = old;
		}
	}
}


Measured memory_bytes: 45884
#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <map>
#include <iomanip>
#include <climits>
#include <cmath>
#define ll long long int
#define MOD 1000000007
#define IOS ios::sync_with_stdio(false)  ;cin.tie()  ; cout.tie()

using namespace std;



int main()
{
    IOS;
    int x , a  ,b  ;
    cin>>x>>a>>b ;
    if(abs(x-a) < abs(x-b))
        cout<<"A\n" ;
    else
        cout<<"B\n"  ;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;cin>>N;
    int zelo=0;
    int B=0;
    for(int i=0;i<N;i++){
        int a;cin>>a;
        if(a%4==0)B++;
        if(a%4==1||a%4==3)zelo++;
    }
    if((zelo-1<B)||((zelo+B==N)&&(zelo-1==B)))cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
// header {{{
#include <bits/stdc++.h>
using namespace std;
#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y
#define ASSERT(expr...) assert((expr))
using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using f80 = __float80;
// }}}
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
// util {{{
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}

template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}
// }}}

// init {{{
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;
// }}}

//--------------------------------------------------------------------

signed main() {
    int n;
    cin>>n;
    vector<int> a(n);
    int mx = 0;
    int mxnum = 0;
    
    REP(i,n){
        cin>>a[i];
        if(a[i] > mx){
            mx = a[i];
            mxnum = 1;
        } else if(a[i] == mx){
            mxnum++;
        }
    }

    int sec_max = 0;
    if(mxnum > 1){ sec_max = mx; }
    else {
        REP(i,n){
            if(a[i] == mx){ continue; }
            sec_max = max(sec_max, a[i]);
        }
    }

    REP(i,n){
        if(a[i] == mx){
            cout<<sec_max<<endl;
        } else {
            cout<<mx<<endl;
        }
    }

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

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


int main() {
	cout << setprecision(10);
	cerr << setprecision(10);
	int N, K;
	cin >> N >> K;
	vector<long double>A(N);
	long double max_len = 0;
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
		max_len = (max_len > A[i] ? max_len : A[i]);
	}

	long double eps = 0.00001;
	long double l = eps;
	long double r = max_len;
	while (r - l > eps) {
		long double x = (l + r) / 2;
		long long count = 0;
		for (int i = 0; i < N; ++i) {
			count += floor((A[i] / x));
		}
		if (count > K) {
			l = x;
		}
		else {
			r = x;
		}
	}
	cout << ceil(r-eps) << endl;
	return 0;
}


Measured memory_bytes: 6348
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def main():

    N = in_n()
    ans = []

    l = 1
    t = 0
    while True:
        if N <= t + 26 ** l:
            break
        t += 26 ** l
        l += 1

    ans = []

    N = N - t - 1
    for i in range(l):
        ans.append(chr(ord('a') + N % 26))
        N -= N % 26
        N = N // 26

    print(''.join(ans[::-1]))


if __name__ == '__main__':
    main()


Measured memory_bytes: 9260
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
int dp[105000];

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    int H[105000];
    cin >> N;
    for(int i = 1; i <= N; i++) cin >> H[i];
    dp[N] = 0;
    int ans = 0;
    for(int i = N - 1; i >= 1; i--) {
        if(H[i] >= H[i+1]) dp[i] = dp[i+1] + 1;
        else dp[i] = 0;
        chmax(ans, dp[i]);
    }
    cout << ans << endl;
    return 0;
}


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

int main()
{
    ll n,r,c=0;
    cin>>n>>r;
    vector<ll>v(n);
    for(ll i=0;i<n;i++)
    {
       cin>>v[i];
       if(v[i]>=r)
         c++;
    }
    cout<<c;
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ios_base::sync_with_stdio(0); 
    cin.tie(0);   
	ll n,a[200009],m,k,ans=0,fl=0,mod=1000000007,b[200009];
	string s;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		b[i]=a[i];
	}
	for(int i=1;i<n;i++)
	{
		b[i]=b[i]+b[i-1];
		// cout<<b[i]<<" ";
	}
	for(int i=0;i<n-1;i++)
	{
		ll temp=(b[n-1]-b[i])%mod;
		ll te=(a[i]%mod*temp%mod)%mod;
		// cout<<(100000000000000%mod*1000000000)%mod<<endl;
		ans=(ans+te)%mod;
		// cout<<ans<<" "<<te<<" "<<temp<<endl;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 6716
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
//#include<unordered_map>//イテレータあるけど順序保持しないmap
//#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
#include<valarray>//なんとなく追加
//メモ：表示桁数を大きくする　　cout << fixed << setprecision(20) << cm << endl;
using namespace std;
typedef long long ll;

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


signed main() {
int A,B,C,K;
string ans;
cin >>A>>B>>C>>K;
while(K!=0){
    if(A>=B){
        B=B*2;
        K--;
        continue;
    }
    if(B>=C){
        C=C*2;
        K--;
        continue;
    }
    K--;
    
}
if(A<B && B<C){
    ans="Yes";
}
else{
    ans="No";
}

answer(ans);
return 0;
}


Measured memory_bytes: 3588
import java.util.Scanner;

public class Main {

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

    public static void main(String[] args) {
	String s1 = scan.next();
	String s2 = scan.next();

	String ans = "EQUAL";
	if(s1.length() > s2.length()) ans = "GREATER";
	else if(s1.length() < s2.length()) ans = "LESS";
	else {
	    for (int i = 0; i < s1.length(); i++) {
		if(s1.charAt(i) > s2.charAt(i)) {
		    ans = "GREATER";
		    break;
		} else if(s1.charAt(i) < s2.charAt(i)) {
		    ans = "LESS";
		    break;
		}
	    }
	}

	System.out.println(ans);
	scan.close();
    }
}


Measured memory_bytes: 21972
#include <iostream>
#include <cstdio>
#include <cstring>
#include <queue>
#include <map>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;

int k, s, ans;
int main() {
	cin >> k >> s;
	for (int i = 0; i <= k; i++) {
		for (int j = 0; j <= k; j++) {
			int t = s - i - j;
			if (t >= 0 && i + j + t <= s && t <= k) ans++;
		}
	}
	cout << ans << endl;
	
	return 0;
}

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

using namespace std;

int check(string s){

	int n=0;

	n+= ((int) s[0]- 48)*10;
	n+= (int) s[1] - 48;

	if(n>12 or n==0) return 0;
	return 1;
}



int main(){

	string s,s2,s1;
	int t,t1;
	cin >> s;


	s1.push_back(s[0]);
	s1.push_back(s[1]);
	s2.push_back(s[2]);
	s2.push_back(s[3]);

	t=check(s1);
	t1=check(s2);

	if(t and t1) cout << "AMBIGUOUS" << endl;
	else if(t and !t1) cout << "MMYY" << endl;
	else if(!t and t1) cout << "YYMM" << endl;
	else cout << "NA" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
const double EPS = 1e-9;
const double PI  = acos(-1.0);

const int hours=22-6+1;
int dp[1<<hours];

int dfs(int mask,vvi &guys,vi &score){
	if(dp[mask]!=-1){
		return dp[mask];
	}
	int ret=0;
	REP(i,guys.size()){
		bool ng=false;
		REP(j,hours){
			if(guys[i][j]&&((1<<j)&mask)){
				ng=true;
				break;
			}
		}
		if(!ng){
			int newmask=mask;
			REP(j,hours){
				if(guys[i][j]){
					newmask|=(1<<j);
				}
			}
			ret=max(ret,dfs(newmask,guys,score)+score[i]);
		}
	}
	return dp[mask]=ret;
}

int main(){
	int n;
	while(cin>>n,n){
		REP(i,1<<hours){
			dp[i]=-1;
		}
		vvi guys(n,vi(hours));
		vi score(n);
		REP(i,n){
			int m,l;
			cin>>m>>score[i];
			REP(j,m){
				int s,e;
				cin>>s>>e;
				FOR(k,s,e){
					guys[i][k-6]=1;
				}
			}
		}
		cout<<dfs(0,guys,score)<<endl;
	}

}

Measured memory_bytes: 1736
#include<iostream>

char *c;
int n,pm,pe,pj;

char solve(int m, int e, int j){
	char ans='C';
	if(m==100 || e==100 || j==100 || m+e>=180 || m+e+j>=240)
		ans = 'A';
	else if(m+e+j>=210 || (m+e+j>=150 && (m>=80 || e>=80)))
		ans = 'B';
	return ans;
}

int main(){
	while(true){
		std::cin >> n;
		if(!n)
			return 0;
		c = new char[n];
		for(int i=0; i<n; i++){
			std::cin >> pm >> pe >> pj;
			c[i] = solve(pm, pe, pj);
		}
		for(int i=0; i<n; i++)
			std::cout << c[i] << std::endl;
		delete[] c;
	}
	return 0;
}

Measured memory_bytes: 0