akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace ConsoleApp6
{
	class Program
	{
		static void Main(string[] args)
		{			
			int n = int.Parse(Console.ReadLine());
			bool[] array1 = new bool[52];

			for(int k = 0; k < 52; k++)
			{
				array1[k] = false;
			}

			for (int i = 0; i < n; i++) 
			{
				string deck = Console.ReadLine();
				string[] card = deck.Split(' ');

				switch (card[0])
				{
					case "S":
						card[0] = "0";
						break;
					case "H":
						card[0] = "1";
						break;
					case "C":
						card[0] = "2";
						break;
					case "D":
						card[0] = "3";
						break;
				}

				int mark = int.Parse(card[0]);
				int number = int.Parse(card[1]);

				int ans = mark * 13 + number;
								
				array1[ans -1] = true;
			}

			for(int j = 0; j < 52; j++)
			{
				if(array1[j] == false)
				{
					int l = j / 13;
					int m = j % 13 + 1;

					switch (l)
					{
						case 0:
							Console.WriteLine("S {0}", m);
							break;
						case 1:
							Console.WriteLine("H {0}", m);
							break;
						case 2:
							Console.WriteLine("C {0}", m);
							break;
						case 3:
							Console.WriteLine("D {0}", m);
							break;
					}
				}
			}	
		}
	}
}



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

namespace ConsoleApp1
{
    class Program
    {
        static IEnumerable<int> GetFactors(int n)
        {
            for (int i = 1; i * i <= n; i++)
            {
                if (n % i == 0)
                {
                    yield return i;
                    if (i != n / i)
                    {
                        yield return n / i;
                    }
                }
            }
        }

        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int ans = Enumerable.Range(1, n).Count(i => i % 2 == 1 && GetFactors(i).Count() == 8);
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 13268
from collections import Counter

n=int(input())
a=list(map(int,input().split()))
ans=0
l=[]
r=[]
for i,j in enumerate(a):
    l.append(i+j)
    r.append(i-j)

#ref = dict(Counter(r))
#ans = 0
#for i in l:
#    ans += ref.get(i, 0)
#print(ans)
b=Counter(r)
for i in l:
    ans+=b.get(i,0)

print(ans)

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

#define FOR(i,l,r) for(int i = (int) (l);i < (int) (r);i++)
template<typename T> bool chmax(T& a,const T& b){ return a < b ? (a = b,true) : false; }
template<typename T> bool chmin(T& a,const T& b){ return b < a ? (a = b,true) : false; }
typedef long long ll;

int H,W,P,Q;
const int INF = 1e9;

int main()
{
	scanf("%d%d%d%d",&H,&W,&P,&Q);
	if(H % P == 0 && W % Q == 0){
		puts("No");
	}
	else{
		puts("Yes");
		FOR(i,0,H) FOR(j,0,W){
			if(i % P == P - 1 && j % Q == Q - 1){
				printf("%d",-INF);
			}
			else if(i % P == (H - 1) % P && j % Q == (W - 1) % Q){
				printf("%d",INF - 1);
			}
			else{
				printf("0");
			}
			printf("%s",j == W - 1 ? "\n" : " ");
		}
	}

	return 0;
}


Measured memory_bytes: 2944
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<stack>
#include<queue>

#define ipair pair<int,int>
#define rep(i,n) for(i=0;i<n;i++)

using namespace std;

typedef long long int lli;
typedef vector<int> vi;

int main() {
	int d;

	cin >> d;

	if (d == 25) {
		cout << "Christmas";
	}
	else if (d == 24) {
		cout << "Christmas Eve";
	}
	else if (d == 23) {
		cout << "Christmas Eve Eve";
	}
	else if (d == 22) {
		cout << "Christmas Eve Eve Eve";
	}

	return 0;
}

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

#define bottom(v) v[v.size()-1]

using namespace std;

int main() {
  int n, t;
  vector<int> v1, v2;
  cin>>n;
  
  while(n--) {
    bool isOk = true;
    for(int i = 0; i < 10; i++) {
      cin>>t;
      if(v1.empty() || bottom(v1)<t) v1.push_back(t);
      else if(v2.empty() || bottom(v2)<t) v2.push_back(t);
      else isOk = false;
    }
    cout << (isOk ? "YES" : "NO") << endl;
    v1.clear(); v2.clear();
  }
  return 0;
}

Measured memory_bytes: 1208
package main

import (
	"fmt"
)

func main() {
	var n,x int
	fmt.Scan(&n, &x)

	ls := make([]int,n)
	for i := 0; i < n; i++ {
		var l int
		fmt.Scan(&l)
		ls[i] = l
	}

	count := 1
	d := 0
	for i := 1; i < n + 1; i++ {
		d += ls[i-1]
		if d > x {
			break
		}
		count++
	}
	fmt.Println(count)
}

Measured memory_bytes: 512
#include <stdio.h>

int main(void)
{
    struct rectangle{
        int h,w;
    };

    struct rectangle rect[300];
    int n=0;
    int i,j,k;
    int flag=0;

    while(1){
        int a,b;
        scanf("%d %d",&a,&b);

        if(a==0&&b==0) break;
        
        rect[n].h=a;
        rect[n].w=b;

        n++;
    }

    for(i=0;i<n;i++){

        for(j=0;j<rect[i].h;j++){
            for(k=0;k<rect[i].w;k++){
                if(k==0){
                    switch(j%2){
                        case 0:
                            printf("#");
                            flag=1;
                            break;
                        default:
                            printf(".");
                            flag=0;
                            break;
                    }
                }
                else{
                    if(flag==0){
                        printf("#");
                        flag=1;
                    }else{
                        printf(".");
                        flag=0;
                    }
                }
            }
            printf("\n");
        }

        printf("\n");
    }

    return 0;
}

Measured memory_bytes: 576
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
    int A, B, C, X;
    cin >> A >> B >> C >> X;

    int a, b, c;
    int rest_a = X;
    int rest_b = X;
    int rest_c = X;
    int cnt = 0;

    for(a = 0; a <= A; a++)
    {
        rest_a = X - 500 * a;

        if( rest_a < 0 ) break;

        for(b = 0; b <= B; b++)
        {
            rest_b = rest_a - 100 * b;

            if( rest_b < 0 ) break;

            for(c = 0; c <= C; c++)
            {
                rest_c = rest_b - 50 * c;

                if(rest_c < 0) break;
                if(rest_c == 0) cnt++;
            }
        }
    }

    cout << cnt;
    return 0;
}

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

using namespace std;

typedef long long ll;

const ll MOD = 1e9+7;
const ll INF = 1e18+7;

signed main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for(auto& x : a)
        cin >> x;
    sort(a.begin(), a.end());
    cout << ( accumulate(a.begin(), a.end(), 0) - a.back() > a.back() ? "Yes" : "No") << endl;
}


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

using namespace std;
typedef long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typedef map <int , int> mint;
typedef map <ll , ll> mll;
typedef set <int> si;
typedef set <ll> sll;
typedef si :: iterator sitr;
typedef si :: reverse_iterator rsitr;
typedef sll :: iterator sltr;
typedef sll :: reverse_iterator rsltr;
#define mset multiset

typedef mset <int> msi;
typedef mset <ll> msll;
typedef msi :: iterator msitr;
typedef msi :: reverse_iterator msritr;
typedef msll :: iterator msltr;
typedef msll :: reverse_iterator mslritr;

#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'

char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 126)return char(x-32);
    else if( 65 <= int(x) && int(x) <= 90)return x;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 126)return x;
    else if( 65 <= int(x) && int(x) <= 90)return char(x+32);
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57)return int(x-'0');
    else if( 97 <= int(x) && int(x) <= 126)return int(x-96);
    else if( 65 <= int(x) && int(x) <= 90)return int(x-64);
}
// end of Template

char c[5][5];
int f;
int main(){

//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    for(int i=1;i<=2;i++){
        for(int j=1;j<=3;j++){
            cin>>c[i][j];
        }
    }
    if(c[1][1] == c[2][3])f++;
    if(c[1][2] == c[2][2])f++;
    if(c[1][3] == c[2][1])f++;
    if(c[2][1] == c[1][3])f++;
    if(c[2][2] == c[1][2])f++;
    if(c[2][3] == c[1][1])f++;

    if(f==6)cout<<"YES\n";
    else cout<<"NO\n";

}


Measured memory_bytes: 256
import math
a, b = map(int, input().split())

def is_prime(num):
    if num == 2:
        return True
    elif num <  3 or num % 2 == 0:
        return False
    for i in range(3, int(math.sqrt(num)) + 1, 2):
        if num % i == 0:
            return False
    return True

if b > a:
    a, b = b, a
c = []
for i in range(1, int(math.sqrt(b))+1):
    if a%i == 0 and b%i == 0:
        if is_prime(i):
            c.append(i)
    k = b//i
    if a%k == 0:
        if is_prime(k):
            c.append(k)
print(len(set(c))+1)

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, k, n) for (int i = (int)(k); i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define rREP(i, k, n) for (int i = (int)(n)-1; i >= k; i--)

#define fi first
#define se second

#define vi vector<int>
#define pb push_back
#define mp make_pair

#define pcnt __builtin_popcount

typedef long long ll;

const int inf = 100100100;
const int MOD = (int) 1e9 + 7;
const double EPS = 1e-9;

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; }
int main() {
    string s;
    cin >> s;
    ll k;
    cin >> k;
    int i;
    for(i=0;i<s.size() && k > 1;i++){
        if(s[i]!='1') break;
        else k-=1;
    }
    cout << s[i] << endl;
    return 0;
}

Measured memory_bytes: 256
x = int(input())

is_prims_dict = {n: True for n in range(2, 3200)}

for n in range(2, 3200):
  for m in range(n+1, 3200):
    if m % n == 0:
      is_prims_dict[m] = False

primes = [k for k, v in is_prims_dict.items() if v]

for ans in range(x, 2 * x):
  if all([ans == prime or ans % prime != 0 for prime in primes]):
    print(ans)
    break;


Measured memory_bytes: 3444
#include <iostream>
using namespace std;
typedef long long ll;

int main()
{
    ll n, y;
    ll m, f, s;

    cin >> n >> y;
    for (m = 0; m <= n; m++) {
        for (f = 0; f <= n; f++) {
            s = n - (m + f);
            if (s < 0) continue;

            if (y == s * 1000 + f * 5000 + m * 10000) {
                cout << m << ' ' << f << ' ' << s << endl;
                return 0;
            }
        }
    }

    cout << "-1 -1 -1" << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<sstream>
#include<vector>
#include<cmath>
using namespace std;

bool check(int n)
{
  stringstream ss;
  ss << n;
  string s = ss.str();
  string rs(s.rbegin(),s.rend());
  return s == rs;
}

int main()
{
  vector<int> vec;
  for(int i=1;i<=10000;i++)
    if(check(i))
      vec.push_back(i);
      
  int n;
  cin >> n;
  vector<int>::iterator it = lower_bound(vec.begin(),vec.end(),n);
  if(*it == n)
    cout << n << endl;
  else if(abs(*(it-1)-n) == abs((*it)-n))
    cout << *(it-1) << endl;
  else 
    (abs(*(it-1)-n) < abs((*it)-n))?cout << *(it-1) << endl:cout << (*it) << endl;
  return 0;
}

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

/* using */
using namespace std;

/* main constructor */
struct Fast
{
    Fast()
    {
        std::cin.tie(0);
        ios::sync_with_stdio(0);
        //cout << fixed << setprecision(12);
    }
} fast;

/* template */
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;
}

/* define */
#define REP(i, x, n) for (int i = x; i < (int)(n); ++i)
#define RREP(i, x, n) for (int i = x - 1; i >= (int)(n); --i)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) REP(i, 1, n + 1)
#define rrep(i, n) RREP(i, n, 0)
#define each(i, n) for (auto &i : n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define eunique(x) (x).erase(unique(all(x)), (x).end())
#define int long long

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

/* const */
const int inf = 1e9 + 7;

/* main */
signed main(void)
{
    int a, b, c;
    cin >> a >> b >> c;
    rep(i, 100)
    {
        if ((a * i) % b == c)
        {
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<vector>
#include<iostream>
#include<map>
#include<algorithm>
#include<cmath>
#include<queue>
#include<set>
#include<deque>
#define ll long long
using namespace std;
#define BUF_SIZE 1048576
char _buf[BUF_SIZE],*_is=_buf,*_it=_buf;
inline char rdc(){
	if (_is==_it) _it=(_is=_buf)+fread(_buf,1,BUF_SIZE,stdin);
	return *_is++;
}
inline void rdi(int &x){
	int f=0;
	register char ch=rdc();
	while ((ch<'0' or ch>'9') and (ch^'-')) ch=rdc();
	if (ch=='-') f=1,ch=rdc();
	while (ch>='0' and ch<='9') x=(x<<3)+(x<<1)+(ch^'0'),ch=rdc();
	if(f) x=-x;
}
inline void rdi(ll &x){
	ll f=0;
	register char ch=rdc();
	while ((ch<'0' or ch>'9') and (ch^'-')) ch=rdc();
	if (ch=='-') f=1,ch=rdc();
	while (ch>='0' and ch<='9') x=(x<<3)+(x<<1)+(ch^'0'),ch=rdc();
	if(f) x=-x;
}
inline void write(int x){
    if(x<0) putchar('-'),x=-x;
    if(x>9) write(x/10);
    putchar(x%10+'0');
}
inline void _write(int x){
	write(x);
	putchar(' ');
}
inline void print(int x){
	write(x);
	putchar('\n');
}
inline void write(ll x){
    if(x<0) putchar('-'),x=-x;
    if(x>9) write(x/10);
    putchar(x%10+'0');
}
inline void _write(ll x){
	write(x);
	putchar(' ');
}
inline void print(ll x){
	write(x);
	putchar('\n');
}
ll hi[200005],dp[200005],C;
int n,que[200005],h,t;
inline long double go(int x,int y){	return 1.0l*((hi[y]*hi[y]+dp[y])-(hi[x]*hi[x]+dp[x]))/(hi[y]-hi[x]);}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	rdi(n),rdi(C);
	int i;
	for(i=1;i<=n;++i) rdi(hi[i]);
	que[t++]=1;
	for(i=2;i<=n;++i){
		while(h<t-1 and go(que[h],que[h+1])<2*hi[i]) ++h;
		dp[i]=dp[que[h]]+pow(hi[i]-hi[que[h]],2)+C;
		while(h<t-1 and go(que[t-2],que[t-1])>go(que[t-1],i)) --t;
		que[t++]=i;
	}
	print(dp[n]);
	return 0;
}

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


int main() {
    int N;
    int bricks[200000];
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> bricks[i];
    }
    bool exists = false;
    int index = 1;
    int ans = 0;
    for (int i = 0; i < N; i++) {
        if (index == bricks[i]) {
            index++;
            exists = true;
        } else {
            ans++;
        }
    }
    if (exists) {
        cout << ans << endl;
    } else {
        cout << -1 << endl;
    }
}




Measured memory_bytes: 1024
import sys
import array

if __name__ == "__main__":
    N = int(sys.stdin.readline().strip())
    A = array.array('i', [int(a) for a in sys.stdin.readline().strip().split(" ")])

    count_pair = 0
    L = {}
    R = {}

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

        if l in L:
            L[l].append(i+1)
        else:
            L[l] = [i+1]

        if r in R:
            R[r].append(i+1)
        else:
            R[r] = [i+1]

    print(sum([len(L[m]) * len(R[m]) for m in list(set(L.keys()) & set(R.keys()))]))
    

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

    const ll MAX = 1000000;
    const ll MOD = 1000000007;

    ll fac[MAX];

    // テーブルを作る前処理
    /*
    void COMinit() {
        fac[0] = fac[1] = 1;
        for (int i = 2; i < MAX; i++){
            fac[i] = fac[i - 1] * i % MOD;
        }
    }
    */

    ll pow_kai(ll a,ll n){//aのn乗を計算します。
    ll x = 1;
    while(n > 0){//全てのbitが捨てられるまで。
        if(n&1){//1番右のbitが1のとき。
        x = x*a%MOD;
        }
        a = a*a%MOD;
        n >>= 1;//bit全体を右に1つシフトして一番右を捨てる。
    }
    return x;
    }

    // 二項係数計算
    ll COM(int n, int k){
        if (n < k) return 0;
        if (n < 0 || k < 0) return 0;
        ll tmp=1;
        for(ll i=n;i>=n-k+1;i--) tmp = (tmp*i)%MOD;

        return (tmp * pow_kai(fac[k],MOD-2)) % MOD;
    }



    int main()
    {
        ll N,M;
        cin >>N >> M;
    
        ll A,tot=0;
        rep(i,M){
            cin >> A;
                tot += A;
        }

        cout << max(-1LL,N-tot) << endl;

    
        return 0;

    }

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define Mp make_pair
#define pb push_back

using ll = long long;
using db = double;
using pii = pair<int, int>;
using vi = vector<int>;

signed main() {
	int n;
	cin>>n;
	cout << (1000-n%1000) % 1000<<endl;
	fprintf(stderr, "time=%.4f\n", (db)clock()/CLOCKS_PER_SEC);
	return 0;
	/* 取模直接除，爆零两行泪
	 * 不开ll见祖宗
	 */
}

Measured memory_bytes: 3728
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

int main() {
    int i,j,n,p,q,a,b,r,d,x,temp;
    int flag=0;
    string s;
    cin>>r>>d>>x;
    int t=x;
    for(i=0; i<10; ++i){
      t=r*t-d;
      if(i!=10){
      cout<<t<<endl;}
      else{cout<<t;}
    }

    return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        String s = stdIn.next();
        char[] c = s.toCharArray();
        Arrays.sort(c);
        System.out.println(c[0] == c[1] && c[2] == c[3] && c[0] != c[2] ? "Yes" : "No");
    }
}

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

inline int read() {
    char c; int x; for (c = getchar(); !isdigit(c); c = getchar());
    for (x = 0; isdigit(c); c = getchar()) { x = x * 10 + c - '0'; } return x;
}

const int N = 1e4 + 5;

int n, _m, m, a[N], cnt[N], sum[N];
long long ans;

int main() {
    n = read(); _m = 1e3 + 1; m = 2e3 + 5;
    for (int i = 0; i < n; i++) { a[i] = read(); cnt[a[i]]++; }
    for (int i = 1; i < m; i++) { sum[i] = sum[i - 1] + cnt[i]; }
    for (int i = 1; i < _m; i++) {
        for (int j = i + 1; j < _m; j++) {
            ans += 1ll * (sum[i + j - 1] - sum[j]) * cnt[i] * cnt[j];
        }
    }
    for (int i = 1; i < _m; i++) {
        ans += 1ll * (sum[i + i - 1] - sum[i]) * cnt[i] * (cnt[i] - 1) / 2;
    }
    for (int i = 1; i < _m; i++) {
        ans += 1ll * sum[i - 1] * cnt[i] * (cnt[i] - 1) / 2;
    }
    for (int i = 1; i < _m; i++) {
        ans += 1ll * cnt[i] * (cnt[i] - 1) * (cnt[i] - 2) / 6;
    }
    std::cout << ans;
    return 0;
}

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

#define endl '\n'

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

    int n, k;
    cin >> n >> k;
    int res = 0;
    for(int i = 0; i < n; i++) {
        int v;
        cin >> v;
        res += min(abs(k - v), v) * 2;
    }
    cout << res;

    return 0;
}

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

struct Point { double x, y;};

void koch (int n, Point a, Point b ) {
        if ( n == 0 ) return;
        Point s, t, u;
        double th = M_PI * 60.0 / 180.0; //ラジアンへ
        s.x = ( 2.0 * a.x + 1.0 * b.x ) / 3.0;
        s.y = ( 2.0 * a.y + 1.0 * b.y ) / 3.0;
        t.x = ( 1.0 * a.x + 2.0 * b.x ) / 3.0;
        t.y = ( 1.0 * a.y + 2.0 * b.y ) / 3.0;
        u.x = ( t.x - s.x ) * cos(th) - ( t.y - s.y ) * sin(th) + s.x;
        u.y = ( t.x - s.x ) * sin(th) + ( t.y - s.y ) * cos(th) + s.y;

        koch ( n-1 , a, s );
        printf ( "%.8f %.8f\n", s.x, s.y );
        koch ( n-1 , s ,u );
        printf ( "%.8f %.8f\n", u.x, u.y );
        koch ( n-1 , u ,t );
        printf ( "%.8f %.8f\n", t.x, t.y );
        koch ( n-1 , t ,b );
}

int main() {
        Point a, b;
        int n;
        scanf("%d", &n );
        a.x = 0;
        a.y = 0;
        b.x = 100;
        b.y = 0;
        printf( "%.8f %.8f\n", a.x, a.y ) ;
        koch(n,a,b);
        printf("%.8f %.8f\n", b.x, b.y);

        return 0;

}



Measured memory_bytes: 2716
#include <iostream>

using namespace std;

string f(string s1, string s2, string s3) {
    string result = "";
    result += s1[0] ^ 32;
    result += s2[0] ^ 32;
    result += s3[0] ^ 32;

    return result;
}

int main() {

    string s1, s2, s3;
    cin >> s1 >> s2 >> s3;

    string result = f(s1, s2, s3);
    cout << result << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
typedef long long int ll;
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define EREP(i,n) for (int i=1;i<=(n);i++)
#define ALL(a) (a).begin(),(a).end()
//#define EVEL 1

#ifdef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const int MOD =1e9+7;
    ll ans=1e10,A[300010],siz=0,N;
    bool F;
    string S;
int main(){
    cin>>N>>S;
    REP(i,N){
        if(S[i]=='W')A[i]++;
    }
    REP(i,N){
        A[i+1]+=A[i];
    }
    DEB(A[0])END
    REP(i,N){
        DEB(A[N-1]-A[i-1])DEB((A[N-1]-A[i]))END
        if(i!=0)ans=min({ans,A[i-1]+(N-i-1)-(A[N-1]-A[i])});
        else ans=min(ans,N-(A[N-1]));
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3076
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define bit(k) (1LL<<(k))
typedef long long ll;

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; }

const int INF = 1e9;
const ll INFLL = 1e18;
const ll MOD = 1e9+7;
const double PI = acos(-1.0);

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

/*------------------------------------/
for library*/

/*------------------------------------*/

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int N,M;
    cin>>N>>M;
    ll teisyutu_kaisuu = bit(M);
    cout<<(1900 * M + 100 * (N - M)) * teisyutu_kaisuu<<endl;
}

Measured memory_bytes: 256
/* cerberus97 - Hanit Banga */

#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)

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

const int N = 1e5 + 10;

int main() {
	fast_cin();
	string s; cin >> s;
	int c = 0;
	for (auto &i : s) {
		c += (i == 'o');
	}
	if (c + 15 - s.length() >= 8) {
		cout << "YES\n";
	} else {
		cout << "NO\n";
	}
}

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

ll divisor(ll a) {
  ll ans = 1;
  for (int i = 2; i <= sqrt(a); i++) {
    int cnt = 0;
    while (a % i == 0) {
      cnt++;
      a /= i;
    }
    ans *= (cnt + 1);
    if (a == 1) break;
  }
  if (a != 1) ans *= 2;
  return ans;
}

int main() {
  ll n;
  cin >> n;
  ll num = divisor(n - 1) - 1;
  ll a = floor(sqrt(n));
  for (ll i = 2; i <= a; i++) {
    if (n % i != 0) continue;
    ll tmp = n;
    while (tmp % i == 0) {
      tmp /= i;
    }
    tmp--;
    if (tmp % i == 0) num++;
  }
  cout << num + 1 << endl;
}

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

int main() {
	int A, B, C, X;
	cin >> A >> B >> C;
	cin >> X;
	int cnt = 0;
	for (int a = 0; a <= A; a++) {
		for (int b =  0; b <= B; b++) {
			for (int c = 0; c <= C; c++) {
				int x = 500*a+100*b+50*c;
				if (X == x) {
					cnt++;
				}
			}
		}
	}
	cout << cnt << endl;
}


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

namespace B
{
    internal static class Program
    {
        private static void Main(string[] args)
        {
            var n = Cint();
            var sum = 0L;

            for (var i = 1; i <= n; ++i)
            {
                if (i % 3 != 0 && i % 5 != 0)
                {
                    sum += i;
                }
            }
            
            Cout(sum);
        }

        #region Input and Output

        private static readonly List<string> Buffer = new List<string>();

        private static string Cin()
        {
            ReadBuffer();

            var str = Buffer.First();
            Buffer.RemoveAt(0);

            return str;
        }

        private static IEnumerable<string> CinA() => Console.ReadLine()?.Split();
        private static int Cint() => int.Parse(Cin());
        private static int[] CintA() => CinA().Select(int.Parse).ToArray();
        private static void Cout(object obj) => Console.WriteLine(obj);

        private static void ReadBuffer()
        {
            if (Buffer.Any()) return;

            var line = Console.ReadLine();
            if (line != null && line.Contains(' '))
            {
                Buffer.AddRange(line.Split());
            }
            else
            {
                Buffer.Add(line);
            }
        }

        #endregion

        #region Loops

        private static void Loop(int count, Action<int> action) => Loop(0, count, action);

        private static void Loop(int init, int count, Action<int> action, int step = 1)
        {
            for (var i = init; i < count + init; i += step)
            {
                action(i);
            }
        }

        #endregion
    }
}


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

#include <atcoder/all>

// #LIB#

using namespace std;
using namespace atcoder;
using ll = long long;
#define double long double
#define rep(i, n) for (long long i = 0; i < (n); ++i)
#define repr(i, a, b) for (auto i = (a); i < (b); ++i)
#define itr(x, c) for (auto&& x : (c))
#define updatemax(t, v) ((t) = std::max((t), (v)))
#define updatemin(t, v) ((t) = std::min((t), (v)))
#ifdef ONLINE_JUDGE
#define endl _endl
const char _endl = (cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout.precision(16), '\n');
#endif

int main() {
  ll t;
  cin >> t;
  vector<ll> n(t - 1 - 0 + 1), m(t - 1 - 0 + 1), a(t - 1 - 0 + 1), b(t - 1 - 0 + 1);
  rep(i, t - 1 - 0 + 1) cin >> n[i] >> m[i] >> a[i] >> b[i];
  rep(i, t) cout << floor_sum(n[i], m[i], a[i], b[i]) << endl;
}


Measured memory_bytes: 5224
#include <bits/stdc++.h>
using namespace std;
#define rep(i,c) for(int i=0;i<c;++i)
int main(){
 int a,b;
 cin >> a>> b;
 if(b%a==0){
   cout << a+b << endl;
 }else{
   cout << b-a << endl;
 }
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
 
int main(){
	int w,h,x,y;
	scanf("%d %d %d %d",&w,&h,&x,&y);
	double s;
	s =(double)w*h/2;
	
	if(x==(double)w/2&&y==(double)h/2)
		printf("%lf 1\n",s);
	else
		printf("%lf 0\n",s);
	return 0;
}

Measured memory_bytes: 128
import sys,heapq
from collections import deque,defaultdict
printn = lambda x: sys.stdout.write(x)
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
DBG = True  and False
def ddprint(x):
  if DBG:
    print(x)

n,k = inm()
v = inl()

#vsuml = [0] * n
#for i in range(n):
#    vsuml[i] = vsuml[i-1]+v[i]

#vsumr = [0] * n
#vsumr[n-1] = v[n-1]
#for i in range(n-2,-1,-1):
#    vsumr[i] = vsumr[i+1]+v[i]

maxsum = 0
maxi = min(n,k)
for i in range(1,maxi+1):
    for il in range(i+1):
        ir = i-il  # il from left, ir from right
        x = []
        for j in range(il):
            x.append(v[j])
        for j in range(ir):
            x.append(v[n-1-j])
        x.sort()
        rmmax = min(k-i,i-1)
        for j in range(rmmax):
            if x[j]>0:
                rmmax = j  # first j are negative
                break
        #sum = (vsuml[il] if il>0 else 0) + (vsumr[n-ir+1] if ir>0 else 0)
        sum0 = sum(x[rmmax:])
        ddprint("il {} ir {} rm {} sum {}".format(il,ir,rmmax,sum0))
        if sum0 > maxsum:
            maxsum = sum0
        if i==n:
            break

print(maxsum)


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

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  if(a>b&&a>c)
    cout << b*c/2 << endl;
  if(b>a&&b>c)
    cout << a*c/2 << endl;
  if(c>b&&c>a)
    cout << a*b/2 << endl;
}



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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define P pair<int,int>
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}

typedef long long ll;

using namespace std;

const int INF = 1e9,MOD = 1e9 + 7;
const ll LINF = 1e18;

//while(x!=0){
            //sum+=x%10;
           // x/=10;
        //}
        //各桁の和

//pair<int,int> p[100000];
//cin >> tmp;
//p[i]=make_pair(tmp,i);
//cout << p[i].second+1 << endl;//ペアの右側つまりiを出力

//s.find(w[i])==string::npos
//findの使い方

long long int n=1,cnt=0,ans=0,a,b,c,d,w,cmp,data,m,h,x,y,xcmp=0,ycmp=0,qq,xcmpp=0,ycmpp=0;

string s;

vector<int> z;

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

       cin >> w >> h >> n;
        a=0;
        b=w;
        c=0;
        d=h;
       rep(i,n){
           cin >> x >> y >> qq;
         if(qq==1){
             a = max(a,x);
         }
         else if(qq==2){
             b = min(b,x);
         }
         else if(qq==3){
             c = max(c,y);
         }
         else if(qq==4){
             d = min(d,y);
         }
       }
       if((b-a)<=0 || (d-c)<=0){
           cout << 0 << endl;
           return 0;
       }
       cout << (b-a)*(d-c) << endl;
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
const ll mod=1000000007;
const ll INF=1e15;
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back

int main(){
    ll N,M; cin>>N>>M;
    vector<bool> used(N+1,false);
    vec d(N+1,0);
    rep(i,M){
        ll p; cin>>p;
        string S; cin>>S;
        if(S=="AC") used.at(p)=true;
        else{
            if(!used.at(p)) d.at(p)++;
        }
    }

    ll AC=0,WA=0;
    rep(i,N+1) if(used.at(i)) AC++;
    rep(i,N+1) if(used.at(i)) WA+=d.at(i);
    cout<<AC<<' '<<WA<<endl;

}

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

using namespace std;

int main() {
    int n;
    cin >> n;
    int nn = n;
    int sum = 0;
    while (n > 0) {
        sum += n % 10;
        n /= 10;
    }

    if (nn % sum == 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}



Measured memory_bytes: 256
N,A,B = map(int,input().split())
def f(n):
  n = list(str(n))
  n  = [int(e) for e in n]
  return sum(n)
l = []
for i in range(1,N+1):
  if A <= f(i) <= B:
    l.append(i)
print(sum(l))


Measured memory_bytes: 3296
fn read_ls<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn main(){
    for i in 1 ..{
        let l:Vec<i32> = read_ls();
        let (x, y) = (l[0], l[1]);
        if x == 0 && y == 0{ break }
        if x < y { println!("{} {}", x, y) }
        else { println!("{} {}", y, x) }
    }
}



Measured memory_bytes: 5028
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>
#include <sstream>

using namespace std;

int main() {
	int i, j, k;
	int n;

	cin >> n;

	while (true)
	{


		string s = to_string(n);

		if (s[0] == s[1] && s[1] == s[2]) {
			cout << s << endl;
			break;
		}
		else {
			n++;
		}


	}






	getchar();
	getchar();
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,...) for(int i = (a)*(strlen(#__VA_ARGS__)!=0);i<(int)(strlen(#__VA_ARGS__)?__VA_ARGS__:(a));++i)
#define per(i,a,...) for(int i = (strlen(#__VA_ARGS__)?__VA_ARGS__:(a))-1;i>=(int)(strlen(#__VA_ARGS__)?(a):0);--i)
#define foreach(i, n) for(auto &i:(n))
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
#define lambda(RES_TYPE, ...) (function<RES_TYPE(__VA_ARGS__)>)[&](__VA_ARGS__) -> RES_TYPE
#define method(FUNC_NAME, RES_TYPE, ...) function<RES_TYPE(__VA_ARGS__)> FUNC_NAME = lambda(RES_TYPE, __VA_ARGS__)
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
//const ll MOD = (ll)1e9+7;
const ll MOD = 998244353;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}
#ifdef DEBUG
#define debug(x) cout<<"LINE "<<__LINE__<<": "<<#x<<" = "<<x<<endl;
#else
#define debug(x) (void)0
#endif

namespace templates{
  ll modpow(ll x, ll b){
    ll res = 1;
    while(b){
      if(b&1)res = res * x % MOD;
      x = x * x % MOD;
      b>>=1;
    }
    return res;
  }

  ll modinv(ll x){
    return modpow(x, MOD-2);
  }

  bool was_output = false;
  template<class t>
  void output(t a){
    if(was_output)cout << " ";
    cout << a;
    was_output = true;
  }
  void outendl(){
    was_output = false;
    cout << endl;
  }
  ll in(){
    ll res;
    scanf("%lld", &res);
    return res;
  }

  template<class t>
  istream& operator>>(istream&is, vector<t>&x){
    for(auto &i:x)is >> i;
    return is;
  }

  template<class t, class u>
  istream& operator>>(istream&is, pair<t, u>&x){
    is >> x.first >> x.second;
    return is;
  }

  template<class t>
  void in(t&x){
    cin >> x;
  }

  template<class t>
  t in(){
    t res; cin >> res; return res;
  }

  template<class t>
  void out(t x){
    cout << x;
  }

  template<class t>
  vector<t> sorted(vector<t> line,function<bool(t,t)> comp=[](t a,t b){return a<b;}){
    sort(line.begin(),line.end(),comp);
    return line;
  }

  template<class t>
  vector<t> reversed(vector<t> line){
    reverse(line.begin(),line.end());
    return line;
  }
}

using namespace templates;

int main(){
    int n = in();
    ll money = 1000;
    vector<ll> line(n);
    foreach(i,line)i=in();
    rep(i,1,n){
        if(line[i-1]<line[i]){
            money += money/line[i-1]*(line[i]-line[i-1]);
        }
    }
    cout << money << endl;
  return 0;
}


Measured memory_bytes: 3696
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class Main implements Runnable {

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

    public static void main(String[] args) {
        new Thread(null, new Main(), "", 256 * 1024 * 1024).start();
    }

    public void run() {
        int n = sc.nextInt(), m = sc.nextInt();
        int p[] = new int[n + 1];
        for (int i = 1; i <= n; i++) {
            p[i] = sc.nextInt();
        }
        Map<Integer, List<Integer>> neighbors = new HashMap<>();
        for (int i = 0; i < m; i++) {
            int a = sc.nextInt(), b = sc.nextInt();
            if (!neighbors.containsKey(a)) {
                neighbors.put(a, new ArrayList<>());
            }
            if (!neighbors.containsKey(b)) {
                neighbors.put(b, new ArrayList<>());
            }
            neighbors.get(a).add(b);
            neighbors.get(b).add(a);
        }

        DFS dfs = new DFS(neighbors);
        int[] links = new int[n + 1];
        int linkId = 1;
        for (int i = 1; i <= n; i++) {
            if (links[i] == 0) {
                dfs.fillId(links, linkId, i);
                linkId++;
            }
        }
        int count = 0;
        for (int i = 1; i <= n; i++) {
            if (links[p[i]] == links[i]) {
                count++;
            }
        }
        System.out.println(count);
    }
}

class DFS {

    private Map<Integer, List<Integer>> neighbors;

    DFS(Map<Integer, List<Integer>> neighbors) {
        this.neighbors = neighbors;
    }

    void fillId(int[] links, int linkId, int root) {
        Deque<Integer> stack = new ArrayDeque<>();
        stack.push(root);
        links[root] = linkId;
        while (!stack.isEmpty()) {
            int u = stack.pop();
            if (neighbors.containsKey(u)) {
                for (int i = 0; i < neighbors.get(u).size(); i++) {
                    int v = neighbors.get(u).get(i);
                    if (links[v] == 0) {
                        links[v] = linkId;
                        stack.push(v);
                    }
                }
            }
        }
    }
}


Measured memory_bytes: 114604
#include "bits/stdc++.h"
#include <set>

using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define int long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
#define INF 10e10
template <typename T>

void print(T x)
{
	std::cout << x << " ";
}

template <typename T>

void println(T x)
{
	std::cout << x << "\n";
}

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
    vector <int> siz; // 素集合のサイズを表す配列(1 で初期化)

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for (int i = 0; i < N; i++) par[i] = i;
    }

    void init(int N) {
        par.resize(N);
        siz.assign(N, 1);  // resize だとなぜか初期化されなかった
        for (int i = 0; i < N; ++i) par[i] = i; // 初期では親は自分自身
    }


    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        if (siz[rx] < siz[ry]) swap(rx, ry);
        siz[rx] += siz[ry];
        par[ry] = rx; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }

    int size(int x) { return siz[root(x)]; }
};

signed main(void) {
	int n,m;
	cin >> n >> m;
	UnionFind tree(n+1);
	tree.init(n + 1);

	rep(i, m) {
		int a,b;
		cin >> a>>b;
		tree.unite(a,b);
	}
	int ret=0;
	rep(i,n){
		ret=max(ret,tree.size(i+1));
	}
	print(ret);
}

Measured memory_bytes: 6420
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;

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

    string A;
    if(S.compare("Sunny") == 0){
        A = "Cloudy";
    }else if(S.compare("Cloudy") == 0){
        A = "Rainy";
    }else if(S.compare("Rainy") == 0){
        A = "Sunny";
    }
    cout << A << endl;
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/python3

import math
import os
import sys


DEBUG = 'DEBUG' in os.environ


def inp():
    return sys.stdin.readline().rstrip()


def dprint(*value, sep=' ', end='\n'):
    if DEBUG:
        print(*value, sep=sep, end=end)


def main():
    N, K = [int(e) for e in inp().split()]
    H = [int(e) for e in inp().split()]
    print(len([h for h in H if h >= K]))


if __name__ == '__main__':
    main()


Measured memory_bytes: 51440
def main
  command = gets.chomp
  yaml = parse_yaml
  puts print(yaml, command)
end

def print obj, command
  params = command.split('.')
  params.shift
  next_obj = obj

  params.each do |param|
    unless next_obj.instance_of?(Hash)
      return 'no such property'
    end

    next_obj = next_obj[param]
    if next_obj.nil?
      return 'no such property'
    end
  end

  unless next_obj.instance_of?(String)
    return 'object'
  end

  "string \"#{next_obj}\""
end

def parse_yaml
  next_line,yaml = make_obj
  yaml
end

def make_obj
  obj = Hash.new
  line = gets.chomp
  next_line = ''
  level = obj_level(line)
  loop do
    key,value = parse_line(line)

    if value.nil?
      next_line,value = make_obj
    else
      next_line = gets
    end
    obj[key] = value

    break if next_line.nil? or obj_level(next_line) < level
    line = next_line.chomp
  end
  [next_line, obj]
end

def parse_line str
  key,value = str.split(':')
  key.strip!
  value.sub!(/^ /, '') unless value.nil?
  [key, value]
end

def obj_level str
  str.index(/[a-z0-9]/)
end


if __FILE__ == $0
  main
end

Measured memory_bytes: 6240
#include <iostream>
#include <cstring>

using namespace std;

int main() {
  string a,b,c;

  cin >> a >> b >> c;

  if(a[a.size()-1] == b[0] && b[b.size()-1] == c[0])cout << "YES"<<endl;
  else cout <<"NO"<<endl;
}


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

int main()
{
	int r, c;
	cin >> r >> c;
	int table[100][100];
	int allsum = 0;
	for (int i = 0; i < r; i++)
	{
		for (int j = 0; j < c; j++)
		{
			cin >> table[i][j];
		}
	}
	for (int i = 0; i < r; i++)
	{
		int sum = 0;
		for (int j = 0; j < c; j++)
		{
			cout << table[i][j] << " ";
			sum += table[i][j];
			allsum += table[i][j];
		}
		cout << sum << endl;
	}
	for (int i = 0; i < c; i++)
	{
		int sum = 0;
		for (int j = 0; j < r; j++)
		{
			sum += table[j][i];
		}
		cout << sum << " ";
	}
	cout << allsum << endl;
}


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

ll n,k,a[N_MAX];	
int l;
vector<ll> ks,best; // ks : Kを2進数表記, best : 最適解

int len(ll K) {
	// Kを２進数表記したときの桁数
	int cnt = 1;
	while(K>=2) {
		K /= 2;
		cnt++;
	}
	return cnt;
}

ll f(ll x) {
	// f(x)を計算する O(n)
	ll ans = 0;
	rep(i, n) {
		ans += x ^ a[i];
	}
	return ans;
}

ll make(int i) {
	// l-1 ~ i+1 bitはks
	// iは0
	// i ~ 0 bitはbest
	ll ans = 0;
	for (ll j = 0; j < i; j++) {
		if (best[j]) {
			ans |= (1ll << j);
		}
	}
	for (ll j = i+1; j < 60; j++) {
		if (ks[j]) {
			ans |= (1ll << j);
		} 
	}
	return ans;
}

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

	l = len(k);
	rep(i,n) {
		cin >> a[i];
	}


	rep(i,60) {	// iは桁数を表す
		int cnt0 = 0, cnt1 = 0;
		rep(j,n) { // jはa配列のどれを巡っているかを表す
			if (a[j] & (1ll << i)) {
				cnt1++;
			} else {
				cnt0++;
			}
		}
		if (cnt1 >= cnt0) {
			best.push_back(0);
		} else {
			best.push_back(1);
		}
	}

	rep(i,60) {
		ks.push_back(k&(1ll<<i));
	}

	// rep(i, (int)ks.size()) {
	// 	cout << ks[i];
	// }
	// cout << endl;

	// K以下で最適解探す
	ll ma = f(k);
	rep(i,l) {
		if (ks[i]) {
			ma = max(ma, f(make(i)));
		}
	}

	cout << ma << endl;
}



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

using ll = long long;
using ull = unsigned long long;

#define MOD 1000000007

int main(void) {
    ll H, W;
    ll maxi = 0;
    vector<string> map;
    vector<vector<ll>> left, right, top, down;
    cin >> H >> W;
    map.resize(H);
    left.resize(H);
    right.resize(H);
    top.resize(H);
    down.resize(H);
    for(ll i = 0;i < H;i++) {
        left[i].resize(W);
        right[i].resize(W);
        top[i].resize(W);
        down[i].resize(W);
        cin >> map[i];
    }
    for(ll i = 0;i < H;i++) {
        ll count = 0;
        for(ll j = 0;j < W;j++) {
            if(map[i][j] == '#') {
                count = 0;
            } else {
                count++;
            }
            left[i][j] = count;
        }
    }
    for(ll i = 0;i < H;i++) {
        ll count = 0;
        for(ll j = W - 1;j >= 0;j--) {
            if(map[i][j] == '#') {
                count = 0;
            } else {
                count++;
            }
            right[i][j] = count;
        }
    }
    for(ll j = 0;j < W;j++) {
        ll count = 0;
        for(ll i = 0;i < H;i++) {
            if(map[i][j] == '#') {
                count = 0;
            } else {
                count++;
            }
            top[i][j] = count;
        }
    }
    for(ll j = W - 1;j >= 0;j--) {
        ll count = 0;
        for(ll i = H - 1;i >= 0;i--) {
            if(map[i][j] == '#') {
                count = 0;
            } else {
                count++;
            }
            down[i][j] = count;
        }
    }
    for(ll i = 0;i < H;i++) {
        for(ll j = W - 1;j >= 0;j--) {
            if(map[i][j] != '#') {
                ll count = left[i][j] + right[i][j] + top[i][j] + down[i][j] - 3;
                maxi = max(maxi, count);
            }
        }
    }
    cout << maxi << endl;
    return 0;
}


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

int main()
{
    ll n;
    cin >> n;
    vector<ll> a(n + 1);
    rep(i, 1, n + 1) cin >> a.at(i);

    vector<ll> ans;
    vector<ll> cnt(n + 1, 0);

    for (ll i = n; i > 0; --i)
    {
        if (cnt.at(i) % 2 != a.at(i) % 2)
        {
            ans.push_back(i);
            vector<ll> v;
            for (ll j = 1; j * j <= i; ++j)
            {
                if (i % j == 0)
                {
                    v.push_back(j);
                    if (j != i / j)
                    {
                        v.push_back(i / j);
                    }
                }
            }
            rep(k, 0, v.size())
            {
                ++cnt.at(v.at(k));
            }
        }
    }

    cout << ans.size() << endl;
    rep(i, 0, ans.size())
    {
        cout << ans.at(i);
        if (i != ans.size() - 1)
        {
            cout << " ";
        }
    }
    return 0;
}

Measured memory_bytes: 4980