akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define Hello ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define endl '\n'
void trace(int n, int arr[]){for(int i = 0; i < n; i++){cout << i << " " << arr[i] << endl;} cout << endl << endl;}
int main()
{
    Hello
    int arr[5];
    for (int i = 0; i < 5; ++i) {
        cin >> arr[i];
        if(!arr[i])
            cout << i + 1;
    }
    return 0;
}

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

using ll = long long;

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}

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

int main() {
    int n;
    ll m;
    cin >> n >> m;
    vector<ll> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a.at(i);
    }

    vector<ll> b(n);
    for (int i = 0; i < n; i++) {
        b.at(i) = a.at(i) / 2;
    }

    ll L = 1;
    for (int i = 0; i < n; i++) {
        L = lcm(L, b.at(i));
    }

    int cnt = 0;
    while (b.at(0) % 2 == 0) {
        b.at(0) /= 2;
        cnt++;
    } 
    for (int i = 1; i < n; i++) {
        int c = 0;
        while (b.at(i) % 2 == 0) {
            b.at(i) /= 2;
            c++;
        }

        if (cnt != c) {
            cout << 0 << endl;
            return 0;
        }
    }

    cout << m / L - m / L / 2 << endl;
}

Measured memory_bytes: 1792
#include <stdio.h>
int main(void){
    long long n;
    scanf("%lld", &n);
    long long sum = 100;
    for(int i = 1; ; i++){
        sum = sum*1.01;
        if(n <= sum){
            printf("%d", i);
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 1732
from collections import deque

H,W = map(int, input().split())
C = list(map(int, input().split()))
D = list(map(int, input().split()))
D_y = D[0] -1   #0スタート
D_x = D[1] -1   #0スタート
MAP = [list(input()) for i in range(H)]
visited = [[-1] * W for i in range(H)]
visited[C[0]-1][C[1]-1] =0 #初期位置
moves = [(0,1), (0,-1), (1,0), (-1,0)]

main_q = deque()
magic_q = deque()

main_q.append([C[0]-1, C[1]-1])

#BFS
while main_q:
    y, x = main_q.popleft()
    magic_q.append([y,x])
    for move in moves:
        dy, dx = move
        moved_y = y + dy
        moved_x = x + dx

        if moved_y < 0 or moved_x < 0 or moved_y > H - 1 or moved_x > W -1:
            continue
        if MAP[moved_y][moved_x] == '#':
            continue
        if MAP[moved_y][moved_x] == '.' and visited[moved_y][moved_x] == -1:
            visited[moved_y][moved_x] = visited[y][x]
            main_q.append([moved_y,moved_x])

    #マジックBFS
    if not main_q:
        while magic_q:
            y, x = magic_q.popleft()
            for dy in range(-2,3):
                for dx in range(-2,3):
                    moved_y = y + dy
                    moved_x = x + dx

                    if moved_y < 0 or moved_x < 0 or moved_y > H - 1 or moved_x > W -1:
                        continue
                    if MAP[moved_y][moved_x] == '#':
                        continue
                    if MAP[moved_y][moved_x] == '.' and visited[moved_y][moved_x] == -1:
                        visited[moved_y][moved_x] = visited[y][x] + 1
                        main_q.append([moved_y,moved_x])

anser = visited[D_y][D_x]
print(anser)

Measured memory_bytes: 136524
using System;
    using System.Collections.Generic;
    using System.Linq;
     
    class ShiftOnly
    {
        static void Main(string[] args)
        {
            int m = 0; // 2で割った回数
            int n = int.Parse(Console.ReadLine()); // 扱うデータの個数
            var blackBoardNum = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
     
            while(blackBoardNum.All(x => (x % 2) == 0))
            {
                blackBoardNum = blackBoardNum.Select(x => x / 2).ToArray();
                m++;
            }
     
            Console.WriteLine($"{m}");
     
            return;
        }
    }

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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

const string YES = "Yes";
const string NO = "No";
const ll mod = 1e9+7;


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

    string s;cin>>s;
    ll n = s.size();
    vll man(n,0);
    ll count = 0;
    for(ll i=0;i<=n;i++){

        count++;

        if (i==n-1) {
            man[i-count] += count / 2;
            man[i-count+1] += count/2 + count%2;
            break;
        }

        else if (s[i]=='R' && s[i+1]=='L'){
            man[i+1] += count / 2;
            man[i] += count / 2 + count % 2; 
            count=0;
        }

        else if (s[i]=='L' && s[i+1]=='R'){
            man[i-count] += count / 2;
            man[i-count+1] += count/2 + count%2;
            count=0;
        }
    }
    REP(i,n) cout<<man[i]<<" ";
    return 0;
    
}



Measured memory_bytes: 1488
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>

using namespace std;

int main(){
	
	int n, m;
	cin  >> n >> m;
	
	int sum=0;
	
	for (int i=1; i<n; i++){
		sum+=n-i;
	}
	
	for (int i=1; i<m; i++){
		sum+=m-i;
	}
	
	cout << sum << endl;
	
	return 0;
	
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<functional>
#include<vector>
#include<map>

using namespace std;
#define endl '\n'
#define pb push_back
#define fst first
#define scd second
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD (1e9 + 7)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define REP(i,n) for(int i = 0;i < (n);i++)
#define FOR(i,a,b) for(int i = (a);i <= (b);i++)
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) > "Yes" : "No" ) << endl


typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vector<int>> vii;

template <class T = int> T in() { T x; cin >> x; return (x); }
template <class T = int> void out(T x) { cout << (x) << endl; }

int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }

void solve() {

	int n, k;
	cin >> n >> k;

	out(n % k ? 1 : 0);

	return;
}

int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);

	solve();

	return 0;

}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << endl;
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    ll N, K;
    cin >> N >> K;

    vll A(N);
    REP(i, N) cin >> A[i];

    if (accumulate(ALL(A), 0LL) <= K) {
        print(0);
        return 0;
    }

    vll F(N);
    REP(i, N) cin >> F[i];

    sort(ALL(A));
    sort(ALL(F), greater<>());

    ll l = 0, r = INF;
    while(r - l > 1) {
        ll m = (l + r) / 2;

        ll k = 0;
        REP(i, N) {
            if (A[i] * F[i] > m) {
                ll tmp = A[i] - m / F[i] - 2;
                while (A[i] * F[i] - tmp * F[i] > m) tmp++;
                k += tmp;
            }
        }

        if (k > K) l = m;
        else r = m;
    }

    print(r);
}


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

signed main() {
  int a,b;cin>>a>>b;
  if((a*b)%2) cout << "Yes" << endl;
  else cout << "No"<<endl;
  
}


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

void Main() {
  string s;
  cin >> s;

  bool kaibun = true;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] != s[s.length() - 1 - i]) {
      kaibun = false;
      break;
    }
  }

  for (int i = 0; i < (s.length() - 1) / 2; i++) {
    if (s[i] != s[(s.length() - 1) / 2 - 1 - i]) {
      kaibun = false;
      break;
    }
  }

  for (int i = (s.length() + 3) / 2 - 1; i < s.length(); i++) {
    if (s[i] != s[s.length() - 1 - i]) {
      kaibun = false;
      break;
    }
  }

  if (kaibun) cout << "Yes" << endl;
  else cout << "No" << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;
using ll = long long;

ll gcd(ll m, ll n)
{
	ll temp;
	while (m % n != 0)
	{
		temp = n;
		n = m % n;
		m = temp;
	}
	return n;
}

ll lcm(ll m, ll n){
    return m*n/gcd(m, n);
}

int main(){
    ll a, b, c, d;
    cin >> a >> b >> c >> d;

    ll totalb = b - (b/c + b/d - b/lcm(c,d));
    ll totala = (a-1) - ((a-1)/c + (a-1)/d - (a-1)/lcm(c,d));

    cout << totalb - totala << endl;
}

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

using namespace std;

const int N = 305;

int n, m, mod;
int c[N][N];
int f[N][N];
int g[N][N];
int h[N][N];

void add(int &x, int y) { x += x + y >= mod ? y - mod : y; }

int main() {
	cin >> n >> m >> mod;
	for (int i = 0; i < N; ++i) c[i][0] = 1;
	for (int i = 1; i < N; ++i) {
		for (int j = 1; j <= i; ++j) {
			c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % mod;
		}
	}
	for (int i = 1; i <= m + 1; ++i) h[0][i] = 1;
	for (int i = 1; i <= n; ++i) {
		for (int j = m; j >= 1; --j) {
			f[i][j] = h[i - 1][j + 1];
			g[i][j] = (g[i][j + 1] + f[i][j]) % mod;
		}
		for (int j = 1; j <= m; ++j) {
			for (int k = 1; k <= i; ++k) {
				add(h[i][j], 1LL * h[i - k][j] * g[k][j] % mod * c[i - 1][k - 1] % mod);
			}
		}
	}
	cout << h[n][1];
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)n;i++)
int main() {
  int n,m,c,t,cnt=0; cin>>n>>m>>c;
  int b[m];
  rep(i,m) cin>>b[i];
  rep(i,n){
    int s=0;
    rep(j,m) cin>>t,s+=t*b[j];
    if(s+c>0) cnt++;
  }
  cout<<cnt;
}


Measured memory_bytes: 3648
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <utility>
#include <set>
#include <vector>
#include <functional>
#include <map>
#include <queue>
using namespace std;
int a[100005];
int main()
{
  int N,x,maxx=0;
  cin>>N;
  for (int i=0;i<N;i++)
  {
    cin>>x;
    a[x]++;
  }
  for (int i=0;i<100000;i++)
  {
    maxx=max(maxx,a[i]+a[i+1]+a[i+2]);
  }
  cout<<maxx<<endl;
  //system("pause");
  return 0;
}

Measured memory_bytes: 640
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

var sc *bufio.Scanner

const bufferSize = 1024

func nextString() string {
	if !sc.Scan() {
		panic(nil)
	}
	return sc.Text()
}

func nextInt() int {
	if !sc.Scan() {
		panic(nil)
	}
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

var production bool

func debugf(format string, v ...interface{}) {
	if !production {
		fmt.Printf(format, v...)
	}
}

func min(a, b int) int {
	if a > b {
		return b
	}
	return a
}

func solve(s []int) int {
	dp0 := make([]int, len(s))
	dp1 := make([]int, len(s))
	for i := range s {
		dp0[i] = s[i]
		dp1[i] = 10 - s[i]
		if i > 0 {
			dp0[i] += min(dp0[i-1], dp1[i-1])
			dp1[i] += min(dp0[i-1]+1, dp1[i-1]-1)
		} else {
			dp1[i]++
		}
	}
	return min(dp0[len(s)-1], dp1[len(s)-1])
}

func answer(reader io.Reader, writer io.Writer) {
	sc = bufio.NewScanner(reader)
	buf := make([]byte, bufferSize)
	sc.Buffer(buf, 1e+7)
	sc.Split(bufio.ScanWords)
	n := nextString()
	//debugf("%v\n", n)
	//s := make([]int, len(n)+1)
	s := make([]int, len(n))
	for i := 0; i < len(n); i++ {
		d := int(n[i] - '0')
		s[i] = d
	}
	ans := solve(s)
	//debugf("%v\n", s)
	_, _ = fmt.Fprintf(writer, "%d", ans)
}

func main() {
	production = true
	answer(os.Stdin, os.Stdout)
}


Measured memory_bytes: 27904
#include <iostream>
#include <vector>
#include <string>
#include <memory.h>
using namespace std;
typedef long long ll;

int main(){
    string s;
    int K;
    cin >> s >> K;
    int N = s.size();
    int dp[N + 1][2][K + 5];
    memset(dp, 0, sizeof(dp));
    dp[0][0][0] = 1;

    for (int i = 0; i < N;i++){
        for (int j = 0; j < 2;j++){
            for (int k = 0; k < K + 1;k++){
                int t = j ? 9 : s[i] - '0';
                for (int l = 0; l < t + 1;l++){
                    dp[i + 1][j || l < t][k + (l != 0)] += dp[i][j][k];
                }
            }
        }
    }
    cout << dp[N][0][K] + dp[N][1][K] << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[100001];
long long read()
{
	long long  x=0;
	int flag=1;
	char ch=getchar();
	while((ch<'0')||(ch>'9'))
	{
		if(ch=='-')
			flag=-1;
		ch=getchar();
	}
	while((ch>='0')&&(ch<='9'))
	{
		x=x*10+ch-'0';
		ch=getchar();
	}
	return x*flag;
}
int main()
{
	long long n;
	n=read();
	long long maxn=0;
	long long num=0;
	for(int i=1;i<=n;i++)
	{
		long long x=read();
		if(x>n)
		{
			num=num+1;
		}
		else 
		{
			a[x]=a[x]+1;
			if(maxn<x)
			{
				maxn=x;
			}
		}
	}	
	for(int i=1;i<=maxn;i++)
	{
		if(a[i]==0||a[i]==i)
			continue;
		else
		{
			if(a[i]<i)
			{
				num=num+a[i];
			}
			else if(a[i]>i)
			{
				num=num+a[i]-i;
			}
		}
	}
	printf("%lld",num);
	cout<<endl;
	return 0;
}

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

#pragma GCC optimize("O2,no-stack-protector,unroll-loops,fast-math")

#define F first
#define S second
#define pb push_back
#define SZ(x) (ll)(x.size())
#define all(x) x.begin(),x.end()
#define MP make_pair

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

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll maxn=3e3+10, maxm=1e6+10, lg=21, mod=1e9+7, inf=1e18;

int n;
char s[100100];
int ap[100100],bp[100100];
int ca,cb;
string f[3030];
bool book[6060];
int nxt[6060];

int main(){
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	
	scanf("%d",&n);
	scanf("%s",s+1);
	n=strlen(s+1);
	for(int i=1;i<=n;++i)
		if(s[i]=='a')ap[++ca]=i;
		else bp[++cb]=i;
	n/=2;
	for(int i=1;i<=n;++i)nxt[min(ap[i],bp[i])]=i;
	for(int i=n*2;i;--i)if(!nxt[i])nxt[i]=nxt[i+1];
	for(int i=n;i;--i)
	{
		memset(book,0,sizeof(book));
		book[ap[i]]=book[bp[i]]=1;
		if(bp[i]<ap[i])
		{
			int mxa=ap[i];
			for(int j=i+1;j<=n;++j)
				if(bp[j]<ap[j]&&bp[j]<mxa)
				{
					book[ap[j]]=book[bp[j]]=1;
					mxa=max(mxa,ap[j]);
				}
			for(int j=1;j<=n*2;++j)
				if(book[j])f[i]+=s[j];
			f[i]+=f[nxt[mxa+1]];
		}
		else f[i]="ab"+f[nxt[bp[i]+1]];
		f[i]=max(f[i],f[i+1]);
	}
	cout<<f[1]<<endl;	
	
	return 0;
}



 


Measured memory_bytes: 16136
#include <iostream>

using namespace std;

int main(void) {

	int N;

	int H[25];

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

	int ans = 0;

	for (int i = 1; i <= N; i++) {
		int sign = 1;
		for (int j = 1; j <= i - 1; j++) {
			if (H[j] > H[i]) { sign = 0; }
		}
		if (sign == 1) { ans++; }
	}

	cout << ans << endl;

	//system("pause");
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
char c[5];
int main(){
  int n,m,a;
  char b;

  scanf("%d%d",&n,&m);
  if(n==1 && m==0 ){
    printf("0\n");
    return 0;
  }
  for (int i = 0; i < m; i++)
  {
    scanf("%d %c", &a,&b);
    if(n != 1 && a == 1 && b=='0' )
    {
      printf("-1\n");
      return 0;
    }
    if(c[a-1] == 0 )
      c[a-1]=b;
    else if( c[a-1] != b )
    {
      printf("-1\n");
      return 0;
    }
  }
  for (int i = 0; i < n; i++)
    if (i==0 && c[0]== 0)
      c[0]='1';
    else if (c[i]==0)
      c[i]='0';

  printf("%s\n", c);
  return 0;
}


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

int main() {
    int N, K; cin >> N >> K;
    cout << (N + K - 3) / (K - 1) << endl;
    return 0;
}

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

ret = []

for i in range(10000) :
    if i * (i + 1) // 2 >= N :
        break
        
for j in range(i, 0, -1) :
    if j <= N :
        ret.append(j)
        N -= j
        
for r in ret[::-1] :
    print(r)

Measured memory_bytes: 42864
#include <iostream>

using namespace std;

bool f(int a, int b, int c) {
    if (c >= a && c <= b) {
        return true;
    }
    return false;
}

int main() {

    int a, b, c;
    cin >> a >> b >> c;

    if (f(a, b, c)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
<?php
fscanf(STDIN, "%d %d %d %d %d", $N, $A, $B, $C, $D);
fscanf(STDIN, "%s", $S);
$ans = 'Yes';

$AC = substr($S, $A - 1, $C - $A + 1);
if (preg_match('/##/', $AC)) {
    $ans = 'No';
}
$BD = substr($S, $B - 1, $D - $B + 1);
if (preg_match('/##/', $BD)) {
    $ans = 'No';
}

if ($D < $C) {
    $BBDD = substr($S, $B - 2, $D - $B + 3);
    if (! preg_match('/\.\.\./', $BBDD)) {
        $ans = 'No';
    }
}
echo $ans;


Measured memory_bytes: 5112
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <unordered_map>

using namespace std;

typedef long long ll;

int main(void) {
  int N; cin >> N;
  ll m = 0, a = 0, r = 0, c = 0, h = 0;
  ll D[5];
  int P[10] = {0, 0, 0, 0, 0, 0, 1, 1, 1, 2};
  int Q[10] = {1, 1, 1, 2, 2, 3, 2, 2, 3, 3};
  int R[10] = {2, 3, 4, 3, 4, 4, 3, 4, 4, 4};

  for (int i = 0; i < N; i++) {
    string S; cin >> S;
    if (S[0] == 'M') m++;
    if (S[0] == 'A') a++;
    if (S[0] == 'R') r++;
    if (S[0] == 'C') c++;
    if (S[0] == 'H') h++;
  }
  D[0] = m;
  D[1] = a;
  D[2] = r;
  D[3] = c;
  D[4] = h;

  ll res = 0;
  for (int d = 0; d < 10; d++) {
    res += D[P[d]] * D[Q[d]] * D[R[d]];
  }
  cout << res << endl;
}


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

using namespace std;


int main() {
    int n,a;
    cin>>n>>a;
    long long sum[n+1][n*50+1]={0};
    int num[n];
    int s[n+1]={0};
    for (int i = 0; i < n; ++i) {
        cin>>num[i];
        s[i+1]=s[i]+num[i];
    }
    for (int j = 0; j < n; ++j) {
        int t=num[j];
        for (int i = j+1; i >0 ; --i) {
            for (int k = 0; k <= s[j+1]; ++k) {
                if(sum[i][k]!=0)sum[i+1][k+t]+=sum[i][k];
            }
        }
        sum[1][t]++;
    }
    long long re=0;
    for (int l = 1; l <= n; ++l) {
        re+=sum[l][l*a];
    }
    cout<<re<<endl;
    return 0;
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll> 
#define P pair<ll,ll>
#define rep(i,n) for(ll (i)=0; i<(n); ++(i))
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll a=0,b=0;
  bool is_2017=true;
  lvector v(100000+1,0),s(100000+1,0);
  for(ll i=3;i<=99999;i+=2) {
    is_2017=true;
    a=i,b=(i+1)/2;
    for (ll j = 2; j*j <= a; j++) {
      if(a%j==0) {is_2017=false;break;}
    }
    if(is_2017) {
      for (ll j = 2; j*j <= b; j++) {
        if(b%j==0) {is_2017=false;break;}
      }
    }
    if(is_2017) v[i]+=1;
  }
  s[0]=v[0];
  for(ll i=1;i<s.size();++i) s[i]=s[i-1]+v[i];
  ll q,l,r;cin>>q;
  lvector ans(q,0);
  rep(i,q) {
    cin>>l>>r;
    ans[i]=s[r]-s[l]+v[l];
  }
  rep(i,q) print(ans[i]);
  return 0;
}

Measured memory_bytes: 2944
use std::io;

fn main() {
	let mut buf : String = String::new();
	io::stdin().read_line(&mut buf).unwrap();
	let xs : Vec<i64> = buf.trim().split_whitespace()
		.map(|x| x.parse::<i64>().unwrap()).collect();
	println!("{}", if xs[0] * xs[1] > xs[2] { xs[2] } else { xs[0] * xs[1] });
}


Measured memory_bytes: 4352
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string.h>
#include <math.h>
#include <stdio.h>
#include <deque>
#include <bits/stdc++.h>
//#include "D:\C++\test_lib_projects\testlib.h"
using namespace std;
#define ll long long
#define pii pair<int,int>

bool debug=true;
//FROM ***

ll n,a,b,k;
ll c[300005]; //C(n,x)

const ll mod=998244353l;


ll mpow(ll a,ll b,ll mod){
 if(b==0) return 1;
 ll ans=mpow(a,b/2,mod);
 if(b%2==1){
  return ans*ans%mod*a%mod;
 }else{
  return ans*ans%mod;
 }
}

ll inv(ll a,ll mod){
 return mpow(a,mod-2,mod);
}

int main(int argc,char* argv[]){
 //scanf("%d%d%d%d",&n,&a,&b,&k);
 cin>>n>>a>>b>>k;
 c[0]=1;
 for(ll i=1,j=n; i<=n; i++,j--)  {
  ll ooo=j*inv(i,mod)%mod;
  c[i]=c[i-1]*ooo%mod; 
 }
         
 
 
 
// for(int i=0;i<=n;i++){
//  cout<<c[i]<<" ";
// }
// for(int i=0;i<=n;i++){
//  cout<<"C"<<i<<"="<<c[i]<<endl;
// }
 
 ll ans=0;
 for(int i=0;i<=n;i++){
  ll acost=a*i;
  if(acost>k) break;
  //cout<<i<<" acost="<<acost<<"left="<<k-acost<<" mod b="<<(k-acost)%b<<endl;
  if((k-acost)%b==0){
   ll bTime=(k-acost)/b;
   if(bTime>n) continue;
   //cout<<"OK:"<<i<<" "<<bTime<<" --> "<<c[i]*c[bTime]<<endl;
   ans+=c[i]*c[bTime];
   ans%=mod;
  }
 }
 
 cout<<ans;
 return 0;
}

Measured memory_bytes: 2560
#include <stdio.h>

int time[24 * 60];

int main(void)
{
	int N, M;
	int h, m;
	int i, flag;
	
	scanf("%d", &N);
	for (i = 0; i < N; i++){
		scanf("%d%d", &h, &m);
		time[h * 60 + m] = 1;
	}
	scanf("%d", &M);
	for (i = 0; i < M; i++){
		scanf("%d%d", &h, &m);
		time[h * 60 + m] = 1;
	}

	flag = 0;
	for (i = 0; i < 24 * 60; i++){
		if (time[i] != 0){
			if (flag != 0){
				printf(" ");
			}
			flag = 1;
			printf("%d:%02d", i / 60, i % 60);
		}
	}
	printf("\n");
	return (0);
}

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

int h, w, n, cnt = 0, now = 1, nd = 0;
int col[10005] = {0};
int ans[105][105] = {0};
int x[4] = {0, 1, 0, -1};
int y[4] = {1, 0, -1, 0};

int main() {
  int i, j;
  cin >> h >> w >> n;
  for(i = 0; i < n; ++i) {
    cin >> col[i];
    if(i != 0) col[i] += col[i - 1];
    // cout << "co" << col[i];
  }
  i = 0;
  j = 0;
  for(cnt = 0; cnt < h * w; ++cnt) {
    // cout << "ijcol" << i << " " << j << " " << cnt << " " << col[now - 1]
    //<< endl;
    if(cnt >= col[now - 1]) ++now;
    ans[i][j] = now;
    // cout << "next " << i + x[nd] << " " << y[nd] + j << endl;
    if(i + x[nd] < 0 || i + x[nd] > h - 1 || j + y[nd] < 0 ||
       j + y[nd] > w - 1 || ans[i + x[nd]][j + y[nd]] != 0) {
      ++nd;
      nd %= 4;
    }
    i += x[nd];
    j += y[nd];
  }
  for(i = 0; i < h; ++i) {
    for(j = 0; j < w; ++j) {
      cout << ans[i][j];
      if(j != w - 1) cout << " ";
    }
    cout << endl;
  }

  return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<numeric>
#include<algorithm>
#include<complex>
#include<queue>
#include<stdlib.h>
#include<map>
#include<cmath>
#include<stdio.h>
#include<stdlib.h>
#include<set>

#define ll long long int
#define MOD 1000000007
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define mp make_pair

using namespace std;

int main(){
    ll N;
    cin >> N;
    vector<pair<ll,ll>> vec;
    ll x,y;
    for(ll i=0;i<N;i++){
        cin >> x >> y;
        vec.pb(mp(x,y));
    }
    ll cnt;
    ll p,q;
    vector<ll> ans;
    for(int i=0;i<vec.size();i++){
        for(int h=0;h<vec.size();h++){
            cnt=0;
            if(i==h){
                continue;
            }
            p=vec[i].first-vec[h].first;
            q=vec[i].second-vec[h].second;
            for(int j=0;j<vec.size();j++){
                for(int k=0;k<vec.size();k++){
                    if(j==k){
                        continue;
                    }
                    if((vec[j].first-vec[k].first==p)&&(vec[j].second-vec[k].second==q)){
                        cnt++;
                    }
                }
            }
            ans.pb(cnt);
        }
    }
    sort(ans.rbegin(),ans.rend());
    if(N!=1){
        cout << N-ans[0] << endl;
    }
    else{
        cout << 1 << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,flag=0;
  cin>>n;
  while(n!=0)
  {
    if(n%10 == 7)
    {
      flag=1;
      break;
    }
    else
      n=n/10;
  }
  if(flag==1)
    cout<<"Yes";
  else
    cout<<"No";
  return 0;
}
  


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

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

  int a, b, c, d;
  cin >> a >> b >> c >> d;

  cout << min(a, b) + min(c, d) << '\n';

  return (0);
}


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

const int MOD = 1000000007;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

// 最小公倍数
unsigned lcm(unsigned a, unsigned b){
    return a / gcd(a, b) * b; 
}

int main(){
int N, X;
cin >> N >> X;
int mi = MOD;
REP(i, N){
  int m;
  cin >> m;
  mi = min(mi, m);
  X -= m;
}

int ans = N + (X / mi);
print(ans);

}

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

using namespace std;

using int64 = long long;

template<class T> inline bool UpdateMin(T& a, T b) {
  if (a > b) { a = b; return 1; } return 0;
}
template<class T> inline bool UpdateMax(T& a, T b) {
  if (a < b) { a = b; return 1; } return 0;
}

constexpr int DEBUG = 1;

bool Solve() {
  int n;
  cin >> n;
  
  vector<int64> xs(n);
  int64 x_sum = 0;
  int64 u = 0;
  for (int i = 0; i < n; i++) {
    cin >> xs[i];
    x_sum += xs[i];
    u += i + 1;
  }

  if (x_sum % u != 0) {
    return false;
  }
  
  int64 m = x_sum / u;

  vector<int64> counts(n);
  for (int i = 0; i < n; i++) {
    int64 d = m + xs[(i + n - 1) % n] - xs[i];
    // cout << "i: " << i << " d: " << d << endl;
    if (d < 0 || d % n != 0) return false;
    counts[i] = d / n;
  }

  int64 count_sum = 0;
  for (int64 count : counts) count_sum += count;

  return count_sum == m;
}

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

  if (Solve()) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef long long ll;
typedef long double ld;
typedef pair<ll, int> ii;
const int mod = (int) 1e9 + 7;
const ll inf = 1LL << 60;
const int maxn = (int) 1e5 + 5;
const ld eps = 1e-9;

int n, m, d[maxn];

int main() {
    //freopen("test.txt", "r", stdin);
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n >> m;
    while (m --) {
        int a, b; cin >> a >> b;
        d[a] ++;
        d[b] ++;
    }
    rep(i, 1, n + 1) if(d[i] & 1) return cout << "NO\n", 0;
    cout << "YES\n";
}






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

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

bool is_prime(int x)
{
    if (x <= 1)
    {
        return false;
    }
    int i = 2;
    while (i * i <= x)
    {
        if (x % i == 0)
        {
            return false;
        }
        i++;
    }
    return true;
}

int main()
{
    int cnt = 0;
    int n;
    cin >> n;
    rep(i, n)
    {
        int x;
        cin >> x;
        if (is_prime(x))
        {
            cnt++;
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 3024
# coding: utf-8
# 75
k=0

while True:
    x,y = map(int,input().split())
    if x==0 and y==0:
        break
    if y>x:
        x,y=y,x
    while y>0:
        r = x
        x = y
        y = r%y
        k += 1
  
    print(x,k)
    k=0


Measured memory_bytes: 5612
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline().strip()
INF = 10 ** 18
MOD = 10 ** 9 + 7

def main(): 
    N, W = LI()
    wv = []
    for _ in range(N):
        wv.append(LI())


    # 横軸 v, 縦軸 n
    dp_table = [[None for _ in range(10**5+1)] for _ in range(N)]
    
    # init
    w0, v0 = wv[0]
    dp_table[0][0] = 0
    dp_table[0][v0] = w0

    # dp
    for i, item in enumerate(wv):
        if i== 0: continue
        w,v = item
        for val, weight in enumerate(dp_table[i-1]):
            if weight is not None:
                # i番目の荷物を入れないとき
                dp_table[i][val] = min(dp_table[i][val], weight) if dp_table[i][val] is not None else weight
                # i番目の荷物を入れるとき
                dp_table[i][val+v] = weight + w

    v  = 10**5
    for w in reversed(dp_table[N-1]):
        if w and w <= W:
            print(v)
            break
        v -= 1


main()

Measured memory_bytes: 171528
#include <cstdio>
#include <bitset>

const int N = 2010;

std::bitset<N * N> bt;

int a[N];

int main() {
    int n, tot = 0;
    scanf("%d", &n);
    for(int i = 1; i <= n; i++) {
        scanf("%d", &a[i]);
    }
    for(int i = 1; i <= n; i++) {
        bt |= (bt << a[i]);
        bt[a[i]] = 1;
        tot += a[i];
    }
    tot = (tot + 1) >> 1;
    while(bt[tot] == 0) {
        tot++;
    }
    printf("%d", tot);
    return 0;
}


Measured memory_bytes: 1792
def main():
  c = {
      'S': [0]*13,
      'H': [0]*13,
      'C': [0]*13,
      'D': [0]*13
  }
  N = int(input())
  for i in range(N):
      s, num = input().split()
      c[s][int(num)-1] = 1
  for i in["S", "H", "C", "D"]:
      for j in range(13):
          if c[i][j] == 0:
              print(i, j+1)

if __name__ == '__main__':
  main()



Measured memory_bytes: 5596
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <tuple>
#include <bitset>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>


int main() {
	int x, y; std::cin >> x >> y;
	std::cout << x + y / 2 << std::endl;
}

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

const int NMAX = 100010;

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

    int A[NMAX], B[NMAX], C[NMAX];
    for (int i = 1; i <= N; ++i) cin >> A[i] >> B[i] >> C[i];

    long long dp[NMAX][3] = {0};
    for (int i = 1; i <= N; ++i) {
        dp[i][0] = max(dp[i][0], dp[i - 1][1] + A[i]);
        dp[i][0] = max(dp[i][0], dp[i - 1][2] + A[i]);

        dp[i][1] = max(dp[i][1], dp[i - 1][0] + B[i]);
        dp[i][1] = max(dp[i][1], dp[i - 1][2] + B[i]);

        dp[i][2] = max(dp[i][2], dp[i - 1][0] + C[i]);
        dp[i][2] = max(dp[i][2], dp[i - 1][1] + C[i]);
    }

    long long ans = 0;
    for (int i = 0; i < 3; ++i) {
        ans = max(ans, dp[N][i]);
    }

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

Measured memory_bytes: 3712
'use strict';
process.stdin.on('data', function(chunk) {
  var inputs = chunk.toString().trim();
  var expressions = inputs.split('\n');
   for(var i = 0; i < expressions.length;i++) {
   	if (expressions[i] ==='0 ? 0') {
   		break;
   	}
   	var expression = (expressions[i].split(' '));
   	var left = Number(expression[0]);
   	var right = Number(expression[2]);
   	var op = expression[1];
   	if (op === '+') {
   		console.log(left + right);
  }else if (op === '-') {
  	console.log(left - right);
} else if (op === '*') {
	console.log(left * right);
} else if (op === '/') {

       console.log(Math.floor(left/right));

   	}
   }


});
process.stdin.resume();
process.stdin.setEncoding('utf8');

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

int main(){
  string s;
  bool flag=false;
  while(cin>> s){
    int ban[8][5]={0}; //0が空白,1がアスタリスク,2が=
    for(int i=0;i<8;i++){
      if(i==0 || i==4 || i==5 || i==6 || i==7){
	for(int j=0;j<5;j++){
	  ban[i][j]=1;
	}
      }
      else if(i==2){
	for(int j=0;j<5;j++){
	  ban[i][j]=2;
	}
      }
    }

    for(int i=0;i<s.size();i++){
      int x=i+(5-s.size());
      if(s[i]=='1'){
	ban[3][x]=1; ban[4][x]=0;
      }
      else if(s[i]=='2'){
	ban[3][x]=1; ban[5][x]=0;
      }
      else if(s[i]=='3'){
	ban[3][x]=1; ban[6][x]=0;
      }
      else if(s[i]=='4'){
	ban[3][x]=1; ban[7][x]=0;
      }
      else if(s[i]=='5'){
	ban[1][x]=1; ban[0][x]=0;
      }
      else if(s[i]=='6'){
	ban[1][x]=1; ban[0][x]=0;
	ban[3][x]=1; ban[4][x]=0;
      }
      else if(s[i]=='7'){
	ban[1][x]=1; ban[0][x]=0;
	ban[3][x]=1; ban[5][x]=0;
      }
      else if(s[i]=='8'){
	ban[1][x]=1; ban[0][x]=0;
	ban[3][x]=1; ban[6][x]=0;
      }
      else if(s[i]=='9'){
	ban[1][x]=1; ban[0][x]=0;
	ban[3][x]=1; ban[7][x]=0;
      }
    }
    if(flag)
      cout<< endl;
    for(int i=0;i<8;i++){
      for(int j=0;j<5;j++){
	//cout<< ban[i][j];
	if(ban[i][j]==0) cout<< " ";
	else if(ban[i][j]==1) cout<< '*';
	else if(ban[i][j]==2) cout<< '=';
      }
      cout<< endl;
    }
    flag=true;
  }
}

Measured memory_bytes: 1176
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
string s;
int main(){
    ios::sync_with_stdio(false);
    cin>>s;
    int n = s.length();
    s="*"+s;
    bool f1=1,f2=1;
    for(int i=1;i<=n&&f1&&f2;i++){
        if(i&1){
            if(s[i]!='R'&&s[i]!='U'&&s[i]!='D'){
                f1=0;
            }
        }else{
            if(s[i]!='L'&&s[i]!='U'&&s[i]!='D'){
                f2=0;
            }
        }
    }
    if(f1&&f2)cout<<"Yes";
    else cout<<"No";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int,int>;
#define rep(i,n) for(int i=0; i<n; i++)
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてから使う
#define INF 2147483647
#define LLINF 9223372036854775807LL

int main() {
  int n; cin >> n;
  vector<int>L(n+1);
  rep(i,n) cin >> L[i];
  L[n] = INF;
  sort(L.begin(), L.end());
  int ans = 0;
  for (int i=0; i<=n-3; i++){
    for (int j=i+1; j<=n-2; j++){
      int border = L[i]+L[j];
      auto itr = lower_bound(L.begin(), L.end(), border);
      if (itr != L.end()){
        int index = itr - L.begin();
        ans += index-1-j;
      }
    }
  }
  cout << ans << endl;
}



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

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

  string s;
  int p = 0, num = 0;
  vector<pair<pair<string, int>, int>> rest(N);

  for (int i = 0; i < N; i++) {
    cin >> s >> p;
    rest[i] = make_pair(make_pair(s, -p), i + 1);
  }

  sort(rest.begin(), rest.end());

  for (int i = 0; i < N; i++) {
    cout << rest[i].second << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef double dd;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef pair<ll , ll> lli;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;
typedef vector<lli> vlli;
 
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define in insert
#define f0(b) for(int i=0;i<(b);i++)
#define f00(b) for(int j=0;j<(b);j++)
#define f1(b) for(int i=1;i<=(b);i++)
#define f11(b) for(int j=1;j<=(b);j++)
#define f2(a,b) for(int i=(a);i<=(b);i++)
#define f22(a,b) for(int j=(a);j<=(b);j++)
#define sf(a) scanf("%lld",&a)
#define sff(a,b) scanf("%lld %lld", &a , &b)
#define pf(a) printf("%lld\n",a)
#define pff(a,b) printf("%lld %lld\n", a , b)
#define PI 3.14159265359
#define bug printf("**!\n")
#define mem(a , b) memset(a, b ,sizeof(a))
#define front_zero(n) __builtin_clzll(n)
#define back_zero(n) __builtin_ctzll(n)
#define total_one(n) __builtin_popcountll(n)

const ll mod = (ll)998244353;
const ll maxn = (ll)2e5+5;
const int nnn = 1048590;
const int inf = numeric_limits<int>::max()-1;
//const ll INF = numeric_limits<ll>::max()-1;
const ll INF = 1e18;

ll dx[]={0,1,0,-1};
ll dy[]={1,0,-1,0};
ll dxx[]={0,1,0,-1,1,1,-1,-1};
ll dyy[]={1,0,-1,0,1,-1,1,-1};


void solve(){
	
	ll n,k,a,sum = 0, big = 0;
	vector < ll > v;
	cin >> k >> n;
    f0(n) cin >> a , v.pb(a);
    sum = ( (k-a) + (v[0]));
    big = sum;
    for(ll i = 1; i <= n-1;i++){
    	big = max(big , v[i]-v[i-1]);
	}
	cout << k-big;
	return;
}


int main() {
   
    ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
    ll T;
    T=1;
   // cin >> T;
    //scanf("%lld",&T);
    ll CT = 0;
    //work();
    while(T--){
    	//cout << "Case " << ++CT <<": " ;
    	//printf("Case %lld: ",++CT);
		solve();
	}
    
    return 0;
}


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

using namespace std;

typedef long long int ll;

const int D = (int) 1e2 + 10;
const int N = (int) 1e4 + 10;
const int mod = (int) 1e9 + 7;

int n, d;
string s;
int memo[2][D][N];

int dp(int at, int md, bool bounded) {
    if(at == n) return md == 0;
    int &ans = memo[bounded][md][at];
    if(ans != -1) return ans;
    ans = 0;
    int mx = bounded ? s[at]-'0' : 9;
    for(int i = 0; i <= mx; ++i) {
        ans += dp(at + 1, (md + i) % d, bounded && i == mx);
        ans %= mod;
    }
    return ans;
}

void solve() {
    cin >> s >> d;
    n = s.length();
    memset(memo, -1, sizeof(memo));
    int ans = dp(0, 0, true) - 1;
    if(ans < 0) ans += mod;
    cout << ans << endl;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(20);
    cout << fixed;
    solve();
    return 0;
}

Measured memory_bytes: 9600
#include<bits/stdc++.h>
using namespace std;
int main() {
	int n,m;
	cin>>n>>m;
	int ans = 0 ;
	for(int i=1;i<=n;++i) {
		int x;
		cin>>x;
		if(x>=m)ans++;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#define rep(i, n) for (int i = 0; i < (n); i++)
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int MOD = 1000000007;
// MAX int 2,147,483,647
// MAX O(n) 10^18

int main() {
    int N;
    cin >> N;
    vector<int> W(N);
    rep(i, N) cin >> W.at(i);

    int minDiff = MOD;
    rep(t, N) { // T
        int S1 = 0, S2 = 0;
        rep(i, N) {  // i loop
            if(i <= t) {
                S1 += W.at(i);
            } else {
                S2 += W.at(i);
            }
        }
        minDiff = min(minDiff, abs(S2 - S1));
    }

    cout << minDiff << endl;

    return 0;
}


Measured memory_bytes: 3624
#include <algorithm>
#include <bitset>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/irange.hpp>
#include <cmath>
#include <map>
#include <numeric>
#include <iostream>
#include <string>
#include <vector>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define decn int n = 0; cin >> n
#define sort(v) sort(v.begin(), v.end())
#define in(type, n) type n = 0; cin >> n

using namespace std;
namespace mp = boost::multiprecision;
typedef long long ll;
const ll M = 1000000007;

int main(){
	int n, r;
	cin >> n >> r;

	if (n > 10) {
		cout << r;
		return 0;
	}

	cout << 100 * (10-n) + r;

	return 0;
}


Measured memory_bytes: 888
#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() {
  int64_t x, y;
  cin >> x >> y;
  int64_t count = 10000000000;
  int64_t count1 = (x <= y) ? y-x : -1;
  int64_t count2 = (-x <= y) ? y+x+1 : -1;
  int64_t count3 = (x <= -y) ? -y-x+1 : -1;
  int64_t count4 = (-x <= -y) ? -y+x+2 : -1;
  count = 0 < count1 ? count1 : count;
  count = 0 < count2 ? min(count, count2) : count;
  count = 0 < count3 ? min(count, count3) : count;
  count = 0 < count4 ? min(count, count4) : count;
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ll              long long
#define pb              push_back
#define ppb             pop_back
#define endl            '\n'
#define mii             map<ll,ll>
#define pii             pair<ll,ll>
#define vi              vector<ll>
#define vs              vector<string>
#define all(a)          (a).begin(),(a).end()
#define F               first
#define S               second
#define sz(x)           ((ll)x.size())
#define hell            (1000000007)
#define inf             ((ll)5e18 + 5)
#define PI              ((double)3.14159265358979323844)
#define DECIMAL(n)      cout << fixed << setprecision(n);
#define rep(i,a,b)      for (ll i=a;i<b;i++)
#define repr(i,a,b)     for (ll i=a-1;i>=b;i--)
#define bitcount(a)     (ll)__builtin_popcount(a)
#define lbnd            lower_bound
#define ubnd            upper_bound
#define mp              make_pair
#define ios             ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ordered_set     tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define trace(...)      __f(#__VA_ARGS__, __VA_ARGS__)

template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}

using namespace std;
using namespace __gnu_pbds;

/*----------------------Graph Moves----------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*------------------------------------------------*/

//primes for hashing 937,991,1013,1409,1741

void solve() {
    string s;
    cin>>s;
    ll temp=0;
    rep(i, 0, sz(s)) {
        temp+=(s[i]-'0');
    }
    if (temp%9==0) {
        cout<<"Yes"<<endl;
        return;
    }
    cout<<"No"<<endl;
}

signed main() {
    ios
    ll test=1;
    //cin>>test;
    while (test--) solve();
    return 0;
}

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

#define ll long long 

void update(ll seg[], int lo, int hi, int index, ll change, int x){
	if(index == lo && index == hi){
		seg[x] = change;
		}
	else{
		int mid = (lo + hi)>>1;
		if(mid >= index)
			update(seg, lo, mid, index, change, 2*x);
		else
			update(seg, mid +1, hi, index, change, 2*x + 1);
			
		seg[x] = max(seg[2*x], seg[2*x + 1]);
		}
	}
	
ll query(ll seg[], int lo, int hi, int r, int x){
	if(hi <= r)
		return seg[x];
	else{
		int mid = (lo + hi)>>1;
		if(mid >= r)
			return query(seg, lo, mid, r, 2*x );
		else{
			ll left = query(seg, lo, mid, r, 2*x);
			ll right = query(seg, mid + 1, hi, r, 2*x + 1);
			return max(left, right);
			}
		}
	
	}
	
int main(){
	int n;
	cin>>n;
	int height[n+1];
	
	for(int i= 1; i<=n; i++){
		cin>>height[i];
		
		}
	ll seg[6*n] = {};
	for(int i = 1; i<=n; i++){
		int beauty;
		cin>>beauty;
		ll maxa = query(seg, 0, n, height[i]-1, 1);
		//~if()
		update(seg, 0, n, height[i], maxa + beauty, 1);
		}
	cout << query(seg, 0, n, n, 1);
	
	return 0;
	}


Measured memory_bytes: 10368
#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>
#include <stack>
using namespace std;

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

typedef pair<int, int> P;

int main() {
    stack<int> st;
    stack<P> st2;
    string s;
    cin >> s;
    REP(i,s.size()) {
        if (s[i] == '\\') {
            st.push(i);
        }else if (s[i] == '/' && st.size() > 0) {
            int j = st.top(); st.pop();
            int area = i - j;
            while(st2.size() > 0 && st2.top().first > j) {
                area += st2.top().second; st2.pop();
            }
            st2.push(make_pair(j, area));
        }
    }
    
    vector<int> v;
    int sum = 0;
    int size = st2.size();
    REP(i,size) {
        int area = st2.top().second;
        sum += area;
        v.push_back(area);
        st2.pop();
    }
    cout << sum << endl << size;
    for(int i = size-1; i >= 0; i--) {
        cout << " " << v[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 1320
#include <iostream>

int main(){

  int i, num, count, index_last, temp;
  int ary[110];

  std::cin >> num;

  for (i = 0; i <= num - 1; i++) {
    std::cin >> ary[i];
  }

  count = 0;
  index_last = num - 2;

  while (index_last >= 0) {

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

      if (ary[i] > ary[i+1]){
        temp     = ary[i];
        ary[i]   = ary[i+1];
        ary[i+1] = temp;
        count++;
      }
    }
    index_last--;

  }

  for (i = 0; i <= num - 2; i++) std::cout << ary[i] << " ";
  std::cout << ary[num - 1] << std::endl;
  std::cout << count << std::endl;

  return 0;
}



Measured memory_bytes: 3108
n = int(input())
arr = [ int(i) for i in input().split(" ") ]

flag = "APPROVED"

for ele in arr:
  if ele % 2 == 0:
    if ele % 3 == 0 or ele % 5 == 0:
      pass
    else:
      flag = "DENIED"
      break

print(flag)

Measured memory_bytes: 2940
#include <stdio.h>
#include <stdlib.h>

int main()
{
	int i, j, n, k, *before_row, *after_row, tmp, result;
	char *s;

	scanf("%d%d", &n, &k);

	if ((s = (char *)malloc(sizeof(char) * (n + 1))) == NULL)
		return 1;
	if ((before_row = (int *)malloc(sizeof(int) * n)) == NULL)
		return 1;
	if ((after_row = (int *)malloc(sizeof(int) * n)) == NULL)
		return 1;

	scanf("%s", s);

	for (i = 0; i < n; i++) {
		before_row[i] = 0;
		after_row[i] = 0;
	}

	for (i = 0, j = 0, tmp = 0; s[i] != '\0';) {
		while (s[i] == '0')
			i++;

		if (s[i] == '\0')
			break;

		do {
			tmp++;
			i++;
		} while ((s[i - 1] != '1' || s[i] != '0') && s[i] != '\0');

		before_row[j] = tmp;
		j++;
		tmp = 0;

		if (s[i] == '\0')
			break;
	}

	for (i = 0, j = 0, tmp = 0; s[i] != '\0';) {
		do {
			tmp++;
			i++;
		} while ((s[i - 1] != '1' || s[i] != '0') && s[i] != '\0');

		after_row[j] = tmp;
		j++;
		tmp = 0;

		if (s[i] == '\0')
			break;
	}

    if (n <= k)
		printf("%d\n", n);
	else {
		for (i = -1, result = 0; i < n - k - 1; i++) {
			if (i != -1)
				tmp = before_row[i];
			else
				tmp = 0;
			for (j = 0; j < k; j++)
				tmp += after_row[i + j + 1];

			if (tmp > result)
				result = tmp;
		}

		printf("%d\n", result);
	}

	free(s);
	free(before_row);
	free(after_row);

	return 0;
}


Measured memory_bytes: 1024
import java.io.PrintWriter
val pw = PrintWriter(System.out)
fun main(args: Array<String>) {
    func()
    pw.flush()
}
fun println(value: Any) { pw.println(value) }

fun func() {
    val (X, A) = listOfInt()

    var ans = if (X < A) 0 else 10
    println("${ans}")
}

fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { Integer.parseInt(it) }


Measured memory_bytes: 38084