akhauriyash/Code-Regression huggingface dataset:
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.NoSuchElementException;
import java.util.Queue;

public class Main implements Runnable{

	public static void main(String[] args) {
		new Thread(null,new Main(), "" ,Runtime.getRuntime().maxMemory()).start();
	}
	
	public void run() {
		FastScanner sc=new FastScanner();
		char[] o=sc.next().toCharArray();
		char[] e=sc.next().toCharArray();
		for(int i=0;i<o.length+e.length;++i) {
			System.out.print(i%2==0?o[i/2]:e[(i-1)/2]);
		}
		System.out.println();
	}
	
	void tr(Object...objects) {System.out.println(Arrays.deepToString(objects));}
}

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

Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
char a[105],b[105],c[105];
int main() 
{
	int n,sum=0,i;
	cin>>n;
scanf("%s",a);
scanf("%s",b);
scanf("%s",c);
for(i=0;i<n;i++)
{
	if(a[i]==b[i]==c[i])
	{
		sum=sum+0;
	}
	 if((a[i]==b[i]&&a[i]!=c[i])||(a[i]==c[i]&&a[i]!=b[i])||(b[i]==c[i]&&b[i]!=a[i]))
	{
		sum++;
	}
	else if(a[i]!=b[i]&&a[i]!=c[i]&&b[i]!=c[i])
	sum=sum+2;
}
cout<<sum<<endl;
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
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; }

bool check(int x, int y) {
  rep(i, 30) {
    if (!(x>>i&1) && y>>i&1)
      return false;
  }
  return true;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  vector<int> a(n), b(n);
  rep(i, n) cin >> a[i] >> b[i];
  ll ans = 0;
  for (int i = 30; i >= 0; i--) {
    if (k>>i&1) {
      int x = 0;
      for (int j = 30; j >= 0; j--) {
        if (j > i)
          x |= k&1<<j;
        if (j < i)
          x |= 1<<j;
      }
      ll res = 0;
      rep(j, n) {
        if (check(x, a[j]))
          res += b[j];
      }
      chmax(ans, res);
    }
  }
  ll res = 0;
  rep(i, n) {
    if (check(k, a[i]))
      res += b[i];
  }
  chmax(ans, res);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3972
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
constexpr ll mod = 1e9 + 7;
#define endl '\n'
 
int main() {
  ios::sync_with_stdio(0); cin.tie(0);
 
  ll n;
  cin >> n;
  int d = n%10;
  if (d == 3) {
    cout << "bon" << endl;
  } else if (d <= 1 || d == 6 || d == 8) {
    cout << "pon" << endl;
  } else {
    cout << "hon" << endl;
  }

}


Measured memory_bytes: 3564
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
  int count = 0;
  vector<int> a;
  for (int i = 0; i < 3; i++){
    int k;
    cin >> k;
    a.push_back(k);
  }
  int u = a[0] % 2 + a[1] % 2 + a[2] % 2;
  int ex = -1;
  if (u == 1) {
    for (int i = 0; i < 3; i++) {
      if (a[i] % 2 == 1) ex = i;
    }
  }
  if (u == 2) {
    for (int i = 0; i < 3; i++) {
      if (a[i] % 2 == 0) ex = i;
    }
  }
  if (ex >= 0) {
    a[ex] -= 1;
    count++;
  }
  sort(a.begin(), a.end());
  count += (a[2] - a[0]) / 2 + (a[2] - a[1]) / 2;

  cout << count << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long LL;
typedef vector<ll>VI;
typedef pair<ll,ll>P;
typedef pair<double,double>P_D;
#define VV(T) vector<vector<T>>
#define PI 3.1415926535897932384626433832795
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define reprev(i, n) for (ll i = (ll)n - 1; i >= 0; i--)
#define ALL(a)  (a).begin(),(a).end()
#define c_max(a, b) (((ll)a)>((ll)b)?(a):(b))
#define c_min(a,b) (((ll)a)<((ll)b)?(a):(b))
#define chmax(x,a) x=max(x,a)
#define chmin(x,a) x=min(x,a)
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define $(x) {cout<<#x<<" = " <<(x)<<endl;}
#define fi first
#define se second
#define MAX 100100//5
#define MAX2 200100
#define MAX_6 1001001//6
#define MAX_7 10010010//7
#define SENTINEL 2000000000//9
#define NIL -1
const int MOD = 1000000007;
#define INF 1<<30
#define INFTY 1LL<<61
#define MAX_INT INT_MAX
#define Endl '\n'
inline ll GCD(ll a,ll b){return b?GCD(b,a%b):a;}
inline ll lcm(ll a,ll b){return a*b/GCD(a,b);}
using Edge=pair<int,ll>;
using Graph=vector<vector<int> >;//ll or Edge
using Edge=pair<int,ll>;
const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
// sort_reverse...greater<ll>()
// g++ -o a a.cpp -Wall -lm -std=c++17
int main(){
    int n;cin>>n;
    string s[2];
    rep(i,2)cin>>s[i];
    ll ans=1;
    bool prev_vertical=true;
    for(int i=0;i<n;i++){
        if(s[0][i]==s[1][i]){
            if(i==0){
                ans*=3;
            }
            else if(prev_vertical){
                ans*=2;
            }
            ans%=MOD;
            prev_vertical=true;
        }
        else{
            if(i==0){
                ans*=6;
            }
            else if(prev_vertical){
                ans*=2;
            }
            else{
                ans*=3;
            }
            prev_vertical=false;
            ans%=MOD;
            i++;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3608
_ = input()
seq = list(map(int,input().split()))
 
seq1 = seq[::2]
seq2 = seq[1::2]
 
if len(set(seq)) == 1:
    print(len(seq2))
    exit()
    
def count_dictonary(seq):
    ret_dict={}
    for item in seq:
        if item not in ret_dict:
            ret_dict[item] = 1
        else:
            ret_dict[item]+=1
    return ret_dict
 
def modes(counting_dict):
    #(11,2),(2,1),(3,3)
    ret={}
    for item in counting_dict.items():
        no, count = item
        if counting_dict[no] in ret:
            ret[count].append(no)
        else:
            ret[count]=[no]
            
    return ret
 
 
counting1 = count_dictonary(seq1)
counting2 = count_dictonary(seq2)
 
modes1 = sorted(modes(counting1).items(),reverse=True)
modes2 = sorted(modes(counting2).items(),reverse=True)
 
min_change=len(seq)
if modes1[0][1] != modes2[0][1] or len(modes1[0][1]) >=2 or len(modes2[0][1]) >=2:
    min_change = (len(seq1) - modes1[0][0]) + (len(seq2) - modes2[0][0])
else:
    m01=len(seq)
    m10=len(seq)
    if len(modes2) !=1:
        m01 =  (len(seq1) - modes1[0][0]) + (len(seq2) - modes2[1][0])
    if len(modes1) !=1:
        m10 =  (len(seq1) - modes1[1][0]) + (len(seq2) - modes2[0][0])
    min_change = min(m01,m10)
    
print(min_change)

Measured memory_bytes: 18652
import Data.List (elemIndex)
import Data.Maybe (fromMaybe)

main :: IO ()
main = interact solve

solve :: String -> String
solve s = case ans of True -> "Yes"; False -> "No"
  where
    ans = fromMaybe False $ do
      ci <- elemIndex 'C' s
      fi <- elemIndex 'F' $ reverse s
      let fi' = length s - fi - 1
      return $ ci < fi'

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

using namespace std;

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

  int n;
  cin >> n;
  vector<int> A(n);
  for (auto &a : A) cin >> a;

  int res = 1e9;
  for (int i = -100; i <= 100; ++i) {
    int sse = 0;
    for (auto &a : A) {
      sse += (a - i) * (a - i);
    }
    if (sse < res) res = sse;
  }
  cout << res << endl;

  return 0;
}



Measured memory_bytes: 256
package main

import "fmt"

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

	for i := 1; i <= 9; i++ {
		for j :=1; j <= 9; j++ {
			if n == i * j {
				fmt.Println("Yes")
				return
			}
		}
	}

	fmt.Println("No")
}



Measured memory_bytes: 512
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;

int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	if ((c - b) == (b - a)) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll, ll> l4;
typedef pair<double, double> dd;
#define mp make_pair
#define pb push_back
#define debug(x) cerr << #x << " = " << x << " "

const int N = 50;
const int M = 20;
vector<int> g[N];
int n, m;
ii restriction[M];

namespace Tree
{
  int p[N], h[N];
  void dfs(int cur, int par)
  {
    h[cur] = h[p[cur] = par] + 1;
    for (auto nxt : g[cur])
      if (nxt != par)
	dfs(nxt, cur);
  }
}

namespace DSU
{
  int p[N], tot = 0;
  int pa(int x)
  {
    return x == p[x]?x:p[x]=pa(p[x]);
  }
  void merge(int from, int to)
  {
    from = pa(from);
    to = pa(to);
    if (from != to)
      {
	--tot;
	p[from] = to;
      }
  }
  void init()
  {
    for (int i = 1; i <= n; ++i) p[i] = i;
    tot = n;
  }
}
using namespace Tree;
void connect(int u, int v)
{
  u = DSU::pa(u); v = DSU::pa(v);
  while (u != v)
    {
      if (h[DSU::pa(p[u])] < h[DSU::pa(p[v])]) swap(u, v);
      DSU::merge(u, p[u]);
      u = DSU::pa(u);
    }
}
int main()
{
  while (~scanf("%d", &n))
    {
      for (int i = 1; i <= n; ++i) g[i].clear();
      for (int i = 1; i <= n-1; ++i)
	{
	  int u, v; scanf("%d %d", &u, &v);
	  g[u].pb(v);
	  g[v].pb(u);
	}
      dfs(1, 0);
      scanf("%d", &m);
      for (int i = 0; i < m; ++i) scanf("%d %d", &restriction[i].first, &restriction[i].second);
      ll ans = 1ll<<(n-1);
      for (int mask = 1; mask < (1<<m); ++mask)
	{
	  DSU::init();
	  for (int i = 0; i < m; ++i) if ((mask>>i)&1) connect(restriction[i].first, restriction[i].second);
	  ll delta = 1ll<<(DSU::tot-1);
	  if (__builtin_popcount(mask)&1) ans -= delta;
	  else ans += delta;
	}
      printf("%lld\n", ans);
    }
}


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

using namespace std;

int main(){
    vector<int> a(5);

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

    int ans = 0;
    for(int i=0; i<5; ++i){
        if(a[i] == 0){
            ans = i+1;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3596
n = int(input())

count = 0
X = []
for i in range(n):
    x,l = map(int, input().split())
    X.append((x+l,x-l))
X.sort()
coord = -float('inf')

for i in X:
    if i[1] >= coord:
        count += 1
        coord = i[0]
print(count)

Measured memory_bytes: 16988
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#define debug cout<<"****************"<<endl
using namespace std;
typedef long long ll;
inline void ju() {
	freopen("***.in","r",stdin);
	freopen("***.out","w",stdout);
}
inline ll rd() {
	ll x=0,f=1; char c=getchar();
	while((c<'0'||c>'9')&&(c!='-')) c=getchar();
	if(c=='-') f=-1,c=getchar();
	while(c>='0'&&c<='9') {
		x=(x<<3)+(x<<1)+c-'0';
		c=getchar();
	}
	return x*f;
}
int main() {
	char s[10];
	scanf("%s",s+1);
	for(int i=1;s[i];++i) {
		if(s[i]=='1') s[i]='9';
		else if(s[i]=='9') s[i]='1';
	}
	printf("%s\n",s+1);
	return 0;
}


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

using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define ll long long int
#define INF 1000000007
#define llINF 1000000000000000007
#define v(i) vector<i>
#define vv(i) vector<vector<i>>
// cin.eof() 入力個数の問題
// int num = atoi(string.c_str()); 文字列の整数変換
int keta(ll n){int ans=0;while(n>0){n /= 10; ans++;}return ans;}
ll _pow(ll a,ll b){ll ans = 1;rep(i,b){ ans *= a;}return ans;}

int main() {
   string s;
   cin>>s;
   ll an=0;
   rep(i,s.size()){
       ll a = s[i] - '0';
    an+=a;
   }
   if(an%9==0){
       cout<<"Yes"<<endl;
   }else
   {
       cout<<"No"<<endl;
   }
   
    return 0;
}


Measured memory_bytes: 3744
N,P = list(map(int, input().split()))
a = list(map(int, input().split()))
num_odd = sum([i%2 == 1 for i in a])
num_even = N - num_odd

ce = 2 ** num_even
co = 2 ** (num_odd - 1)
if num_odd == 0:
    co = P^1
print(co * ce)

Measured memory_bytes: 9208
#include <bits/stdc++.h>
using namespace std;
int main() {
	double num;
	while(cin>>num,num>0){
	    string str;
		for(double i=128;i>0.03125;i/=2){
			str+=int(num/i)+'0';
			if(num/i>=1)num-=i;
			if(i==1)str+='.';
		}
		if(num/0.03125>0)cout<<"NA"<<endl;
		else cout<<str<<endl;
	}
}

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

const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;

int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  
  int n ;
  cin >> n ;
  ll a[n],b[n];
  rep(i,n){
    cin>>a[n-1-i]>>b[n-1-i];
  }
  
  ll ans=0;
  rep(i,n){
    a[i]+=ans;
    if(a[i]%b[i]!=0)ans+=b[i]-a[i]%b[i];    
  }
  cout<<ans<<endl;
}
  



Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define debug(x) cerr << #x << " " << x << '\n'
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
const int INF = 0x3f3f3f3f, N = 2e5 + 5;
const ll LINF = 1e18 + 5;
int n, q;
struct event
{
	int p, x;
	bool tag;
	bool operator < (const event &x) { return p < x.p; }
}e[N<<1];
int main()
{
 	ios::sync_with_stdio(false);
 	cin.tie(0);
 	cin >> n >> q;
 	int m = 0;
 	for(int i=1; i<=n; i++)
 	{
 		int s, t, x;
 		cin >> s >> t >> x;
 		e[++m] = {s-x, x, 0};
 		e[++m] = {t-x, x, 1};
 	}
 	sort(e+1, e+m+1);
 	multiset <int> st;
 	int cur = 1;
 	for(int i=1; i<=q; i++)
 	{
 		int d;
 		cin >> d;
 		while(cur<=m && e[cur].p<=d)
 		{
 			if(e[cur].tag) st.erase(st.find(e[cur].x));
 			else st.insert(e[cur].x);
 			cur++;
 		}
 		if(!sz(st)) cout << -1 << '\n';
 		else cout << *st.begin() << '\n';
 	}
	return 0;
}


Measured memory_bytes: 15360
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue> 
#include <tuple>
 
using namespace std;



long long gcd(long long a, long long b) {

   	if(a < b) {
       swap(a, b);
   	}

	long long r = a % b;
	while(r != 0) {
		a = b;
		b = r;
		r = a % b;
	}

	return b;
}

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

    long long N, M;

    cin >> N >> M;

    long long c = 0;

    long long a;

    cin >> a;

    a /= 2LL;

    long long k = a;

    while(true) {
        if(a % 2LL == 0) {
            a /= 2LL;
            c++;
        } else {
            break;
        }
    }

    for(int i = 1; i < N; i++) {
        cin >> a;

        a /= 2LL;
        k = k / gcd(k, a) * a;
        long long h = 0;

        while(true) {
            if(a % 2LL == 0) {
                a /= 2LL;
                h++;
            } else {
                if(h != c) {
                    cout << 0 << endl;
                    return 0;
                }
                break;
            }
        }
    }

    cerr << k << endl;

    cout << M / k - M / (k * 2LL) << endl;
    
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<ctime>
#include<queue>
using namespace std;
int n;
int q[1001];
bool havetwo=0;
int four,one;
int main()
{
cin>>n;
for(int i=1;i<=n;i++)
{
	int shuru;cin>>shuru;if(shuru%4==0)four++;
	if(shuru&1)one++;
	if(shuru%2==0&&shuru%4!=0)havetwo=1;
}
	if(havetwo==0){
		if(one<=four+1)cout<<"Yes";
		else cout<<"No";
	}
	else {
		if(one<=four)cout<<"Yes";
		else cout<<"No";
	}
	return 0;
 }


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

long long fact(long long n){
    if(n == 0 || n == 1) return 0;
    return n * (n-1) / 2;
}

int main(){
    int h,w;
    while(true){
        cin >> h >> w;
        if(h == 0 && w == 0) break;
        for(int i=0;i<h;++i){
            for(int j=0;j<w;++j){
                if(i==0 || i==h-1 || j==0 || j==w-1){
                    cout << '#';
                } else {
                    cout << '.';
                }
            }
            cout << endl;
        }
        cout << endl;
    }
    return 0;
}



Measured memory_bytes: 3088
#include <iostream>
#include <cstring>
using namespace std;
int main(void){
    int H,W;
    cin>>H>>W;
    char num[H][W];
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            cin>>num[i][j];
        }
    }
    for(int i=0;i<W+2;i++){
        cout<<'#';
    }
    cout<<endl;
    for(int i=0;i<H;i++){
        for(int j=-1;j<W+1;j++){
            if(j==-1||j==W) cout<<'#';
            else cout<<num[i][j];
        }
        cout<<endl;
    }
    for(int i=0;i<W+2;i++){
        cout<<'#';
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int H,W;
  scanf("%d %d",&H,&W);
  char a[H + 3][W + 3];
  for(int i = 1;i < H + 1;i++){
    scanf("%s",&a[i]);
    for(int j = W;j > 0;j--){
      a[i][j] = a[i][j - 1];
    }
  }
  for(int i = 0;i < H + 2;i++){
    for(int j = 0;j < W + 2;j++){
      if(i == 0 || i == H + 1 || j == 0 || j == W + 1){
        a[i][j] = '#';
      }
    }
  }
  for(int i = 0;i < H + 2;i++){
    for(int j = 0;j < W + 2;j++){
      printf("%c",a[i][j]);
    }
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n,k;
    int h[100005];
    int ans=0;
    
    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>h[i];
    }
    for(int i=0;i<n;i++){
        if(h[i]>=k)ans++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 640
total_sum=0

while 1:
    m,f,r=list(map(int, input().split()))
    total_sum=m+r+f
    mid_sum=m+f

    if total_sum==-3:
        break
    if f==-1 or m==-1:
        print("F")
    elif mid_sum>=80:
        print("A")
    elif 65 <= mid_sum < 80:
        print("B")
    elif 50 <= mid_sum <65:
        print("C")
    elif 30 <= mid_sum <50:
        if r<50:
            print("D")
        else:
            print("C")
    else:
        print("F")



Measured memory_bytes: 5596
#include <iostream>
#include <algorithm> // min()
#include <string>
#include <vector>
#include <climits> // INT_MAX
#include <cmath> // ceil()
#define rep(i, n) for (int i = 0; i < n; ++i)

using namespace std;
using ll = long long;
const int INF = INT_MAX;
using Graph = vector<vector<int>>;
using Vi = vector<int>;
using Vpii = vector<pair<int, int>>;
using Pii = pair<int, int>;


vector<bool> seen;
int ans = 0;
int land = 0;
bool is_tree = false;
Pii region;


void dfs(Graph &g, int x, int y) {
    if (x < 0 || x >= region.first) return;
    if (y < 0 || y >= region.second) return;

    if (g[y][x] == 0) return;

    if (g[y][x] == 1) {
        g[y][x] = 0;
        land--;
    }

    dfs(g, x + 1, y);
    dfs(g, x - 1, y);
    dfs(g, x, y + 1);
    dfs(g, x, y - 1);
    dfs(g, x + 1, y + 1);
    dfs(g, x + 1, y - 1);
    dfs(g, x - 1, y + 1);
    dfs(g, x - 1, y - 1);
}


int main() {
    Pii start;
    Vi answers;
    vector<Graph> graphs;
    int w, h, c;

    while (true)
    {
        Graph graph;
        land = 0;
        ans = 0;

        cin >> w >> h;
        if (w == 0 && h == 0) break;
        region = { w, h };

        rep(i, h) {
            Vi temp;
            rep(j, w) {
                cin >> c;
                temp.emplace_back(c);
                land += c;
            }
            graph.emplace_back(temp);
        }

        while (land) {
            int x;
            rep(y, h) {
                auto vec = graph[y];
                auto iter = find(vec.begin(), vec.end(), 1);
                if (iter != vec.end()) {
                    x = distance(vec.begin(), iter);
                    start = { x, y };
                    break;
                }
            }
            dfs(graph, start.first, start.second);
            ans++;
        }

        answers.emplace_back(ans);

    }

    for (auto&& a : answers) {
        cout << a << endl;
    }

}



Measured memory_bytes: 3244
#include<iostream>

using namespace std;

int main(){
  int h,w;
  char a[109][109];
  cin >> h>> w;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cin >> a[i][j];
    }
  }
  for(int i=0;i<w+2;i++){
    cout << '#';
  }
  cout << endl;
  for(int i=0;i<h;i++){
    cout << '#';
    for(int j=0;j<w;j++){
      cout << a[i][j];
    }
    cout << '#' << endl;
  }
  for(int i=0;i<w+2;i++){
    cout << '#';
  }
  cout << endl;
}

Measured memory_bytes: 256
public class Main {
    public static void main(String args[]) {
        java.util.Scanner sc = new java.util.Scanner(System.in);
        int S = sc.nextInt();
        int flag = 0;
        char[] A = new char[4];
        for (int i = 0; i < 4; i++) {
            A[i] = (char)('0' + (S % 10));
            S /= 10;
        }
        for (int i = 0; i < 2; i++) {
            flag = 0;
            for (int j = 0; j < 2; j++) {
                if (A[j+i] != A[j+1+i]) flag = 1;
            }
            if (flag == 0) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }
}

Measured memory_bytes: 22868
#include<iostream>
#include<map>
#define ll long long
using namespace std;
const int maxn=9e5+10;
ll a[maxn]; 
int main()
{
	ll n;
	ll ans=0;
	cin>>n;
	map<ll,ll>mp;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		mp[i-a[i]]++;
	}
	for(int i=1;i<=n;i++)
	{
		ans+=mp[i+a[i]];
	}
	cout<<ans<<endl;
	return 0;
 } 

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

int main(){
    int H,N,A,SUM=0;
    scanf("%d %d",&H,&N);
    for (int i=0; i<N; i++) {
        scanf("%d",&A);
        SUM+=A;
    }
    if (SUM<H) {
        printf("No\n");
    }
    else{
        printf("Yes\n");
    }
    return 0;
}

Measured memory_bytes: 128
A,B=map(int,input().split())

N=100

S=[[] for _ in range(N)]
for i in range(N):
    if i<N//2:
        S[i]=list("#"*N)
    else:
        S[i]=list("."*N)
        
    
y=0
x=0
for _ in range(A-1):
    S[y][x]="."
    x+=2
    if x>=N:
        x=0
        y+=2
        
y=N//2+1
x=0
for _ in range(B-1):
    S[y][x]="#"
    x+=2
    if x>=N:
        x=0
        y+=2
        
print(N,N)
for i in range(N):
    print(''.join(map(str, S[i])))







Measured memory_bytes: 39024
a=input().split(" ")
A=int(a[0])
B=int(a[1])
if A<B:
    A,B=B,A
while A%B!=0:
    A,B=B,A%B
if B==1:
    print(1)
else:
    count=1
    i=2
    while i**2<=B:
        if B%i==0:
            count+=1
            while B%i==0:
                B/=i
        i+=1
    if B!=1:
        count+=1
    print(count)

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

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	string S;
	cin>>S;
	int len=S.length();
	
	if(S[len-1]=='s')
	{
	    S+='e';S+='s';
	}
	else
	{
	    S+='s';
	}
	
	cout<<S<<endl;
	
	return 0;
}


Measured memory_bytes: 3660
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
//cout<<setprecision(20)
const llint mod=1000000007;
const llint big=1e17+10;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-9;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
int LBI(vector<int>&ar,int in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
int UBI(vector<int>&ar,int in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){
	map<string,int>aaa;
	int n;cin>>n;
	while(n--){string str;cin>>str;aaa[str]++;}
	int m;cin>>m;
	while(m--){string str;cin>>str;aaa[str]--;}
	int ans=0;
		for(auto it:aaa){maxeq(ans,it.sec);}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
# whileだと実行時間83msだったけどforでは？
n=int(input())
a=list(map(int, input().split()))
i=0
odd=0
even=0
eveneven=0
for i in a:
    if i%4==0:
        eveneven+=1
    elif i%2==0:
        even+=1
    else:
        odd+=1  
if even==0 and eveneven>=(odd-1):
    print("Yes")
elif even!=0 and eveneven>=odd:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 14252
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(){
    int k;
    string s;
    cin >> k;
    cin >> s;
    int len = s.length();
    if (len<=k){
        cout << s << endl;
    }else{
        string ans = "";
        for (int i=0;i<k;++i){
            ans += s[i];
        }
        ans += "...";
        cout << ans << endl;
    }
}

Measured memory_bytes: 3608
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;

int main() {
	int A, B, C;
	cin >> A >> B >> C;

	if (B + C - A > 0) {
		cout << B + C - A << endl;
	}
	else {
		cout << 0 << endl;
	}
}

Measured memory_bytes: 3628
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i <(n); i++)
#define rep2(i,l,r) for (int i=(l); i<(r); i++)
#include <bits/stdc++.h>
//~ #include <atcoder/all>
using namespace std;
using ll = long long;
//~ using P = pair<int, int>;

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
//~ int A = (1<<2) | (1<<3) | (1<<5) | (1<<7);
//~ for (int bit=A; ; bit=(bit-1)&A){
    //~ if (!bit) break;
//~ }
int next_combination(int sub){
    int x = sub & -sub, y = sub + x;
    return (((sub & ~y) / x) >> 1) | y;
}
//~ int n=5;
//~ int k=3; // nCkの組み合わせ、ただしk=0には対応してない
//~ int bit=(1<<k)-1; // 1000 -> 0111
//~ for(; bit < (1<<n); bit=nex_combination(bit){
//~ }
bool isPrime(int a){
    if(a==2) return true;
    if(a<=1 || a%2==0) return false;
  
    for(int i=3; i*i<=a; i+=2){
        if(a%i==0) return false;
    }
    return true;
}
//~ vector<int> a = {1, 14, 32, 51, 51, 51, 243, 419, 750, 910};
vector<int> a;
// index が条件を満たすかどうか
bool isOK(int index, int key) {
    if (a[index] >= key) return true;
    else return false;
}
// 汎用的な二分探索のテンプレ
int binary_search(int key) {
    int ng = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
    int ok = (int)a.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()

    /* ok と ng のどちらが大きいかわからないことを考慮 */
    while (abs(ok - ng) > 1) {
        int mid = (ok + ng) / 2;

        if (isOK(mid, key)) ok = mid;
        else ng = mid;
    }
    return ok;
}

long long modpow(long long a, long long n, long long mod){
    long long res = 1;
    while(n>0){
        if(n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

//~ int v[100100];
//~ int INF = 1 << 30;
//~ vector<vector<int>> dp(310, vector<int>(310));
//~ ll dp[110][100100];
//~ vector<int> dp(100100, 0));

//~ int seen[110];
//~ int ans[110][2];
//~ ll MOD = 1e9 + 7;

int main(){
    int A, B;
    cin >> A >> B;
    
    int ans=0;
    for (int i = 0; (1+(A-1)*i) < B; i++)
    {
        ans = i + 1;
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3576
let input = require('fs').readFileSync('/dev/stdin', 'utf8').split('\n');
let lineA = input[1].split(' ');
let lineB = input[1].split(' ');
let n = Number(input[0]);

function bubbleSort(A, N) {
    for (let i = 0; i < n; i++) {
	    for (let j = n - 1; j > i; j--) {
    		if (A[j].match(/\d/)  < A[j - 1].match(/\d/) ) {
    			let tmp = A[j];
    			A[j] = A[j - 1];
    			A[j - 1] = tmp;
    		}
    	}
    }	
}
 function selectionSort (A, N) {
    for (let i=0; i<=N-1; i++) {
            let minj = i
       for (let j=i; j<=N-1; j++) {
             if (A[j][1] - 0 < A[minj][1] - 0) {
                minj = j;
           }
       }
            if (A[i][1] - 0 !== A[minj][1] - 0) {
              tmp = A[i];
             A[i] = A[minj];
             A[minj] = tmp;
            }
       }
 }

bubbleSort(lineA, n);
console.log(lineA.join(' '));
console.log('Stable')
selectionSort (lineB, n);
console.log(lineB.join(' '));
console.log((lineA.join(' ') === lineB.join(' '))? 'Stable':'Not stable');



Measured memory_bytes: 16152
using System;
using System.Linq;

class D
{
	static void Main()
	{
		var k = int.Parse(Console.ReadLine());

		long[] Next(long[] a) => a.SelectMany(l => Enumerable.Range((int)(l % 10) - 1, 3).Where(d => d >= 0 && d <= 9).Select(d => l * 10 + d)).ToArray();

		var lun = new long[10][];
		lun[0] = Enumerable.Range(1, 9).Select(i => (long)i).ToArray();
		Console.WriteLine(Enumerable.Range(0, 10).SelectMany(i => i > 0 ? lun[i] = Next(lun[i - 1]) : lun[i]).ElementAt(k - 1));
	}
}


Measured memory_bytes: 48060
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int n;
    while(cin>>n){
        if(n==3){
            cout<<"180"<<endl;
        }
        else cout<<((2*n-4)*90)<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include <string>
#include<cstdio>
#include<math.h>
#include<stack>
#include<cstring>
#include<vector>
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define EREP(i,n) for(int i=(n-1);i>=0;--i)
#define D(n,retu) REP(i,n){cin>>retu[i];}
#define mod 1000000007
#define MIN -93193111451418101
using namespace std;
typedef long long int ll;
template<typename T>
void fill_all(T& arr, const T& v) {
	arr = v;
}
template<typename T, typename ARR>
void fill_all(ARR& arr, const T& v) {
	for (auto& i : arr) { fill_all(i, v); }
}

//------------------変数-----------------------//
ll n, cost[30], m, a[100001], k, d;
vector<vector<ll>> v(39);
bool f[200001], fl[200001];
//-------------------関数----------------------//


int main() {
	vector<ll>iiyokoiyo;
	cin >> n;
	ll step = n / 50;
	ll amari = n % 50;
	cout << 50 << endl;
	REP(i, amari) {
		ll hoge = 49 + (step + 1) * 50 - 49 * step - amari + 1;
		iiyokoiyo.push_back(hoge);
	}
	FOR(i,amari, 50) {
		ll hoge = 49 + step * 50 + -49 * step - amari;		iiyokoiyo.push_back(hoge);

	}
	REP(i, iiyokoiyo.size())
	{
		if (i) { cout << " "; }
		cout << iiyokoiyo[i];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define int ll
signed main(){
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> a(n+1);
    rep(i,n+1) cin >> a[i];
    vector<int> a_m(n+1);
    a_m[n] = 0;
    for(int i = n-1; i >= 0; i--) {
        a_m[i] = a_m[i+1]+a[i+1];
    }
    vector<int> v(n+1);
    if(a[0] >= 2) {
        cout << -1 << endl;
        return 0;
    }
    if (a[0]==1) {
        if(n != 0)  {
            cout << -1 << endl;
            return 0;
        }
    }
    if(n==0) {
        if(a[0] == 1) {
            cout << 1 << endl;
        }
        else {
            cout << -1 << endl;
        }
        return 0;
    }
    //a[0] = 0 n != 0
    int ans = 1;
    v[0] = 1;
    for(int i = 1; i <= n; i++) {
        v[i] = min(2*v[i-1]-a[i], a_m[i]);
        ///if(a[i] + v[i] < v[i-1]) {
        if(v[i] < 0) {
            cout << -1 << endl;
            return 0;
        }
        ans += v[i];
        ans += a[i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 5636
#include <stdio.h>

int main(void){
    int a,b,c;
    scanf("%d %d %d", &a, &b, &c);
    
    if((a < c && b > c) || (a > c && b < c)){
        printf("Yes");
    } else{
        printf("No");
    }
    return 0;
}



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

namespace agc017_a
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split();
            int N = int.Parse(str[0]);
            int P = int.Parse(str[1]);
            int[] A = Console.ReadLine().Split().Select(int.Parse).ToArray();
            bool OddExit = A.Any(a => a % 2 == 1);
            Console.WriteLine((OddExit) ? Math.Pow(2, N - 1) : (P == 0) ? Math.Pow(2, N) : 0);
        }
    }
}


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

using ll = long long;
#define ld long double
#define ull unsigned long long int

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  // (i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define pb push_back
#define ret return

typedef pair<int, int>    pii;
typedef vector<int>       vi;
typedef vector<vi>        vii;
typedef vector<long long> vl;

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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

    // 入力
    int n, k;
    cin >> n >> k;

    // 処理
    int ans = 1;
    rep(i, n) { (ans * 2 < ans + k) ? ans *= 2 : ans += k; }

    // 出力
    cout << ans << endl;

    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=mod*mod;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(x) (x).begin(),(x).end()
ll min(ll a,ll b){
  if(a>b){
    return b;
    }
      else{
        return a;
      }
  }
  
  ll max(ll a,ll b){
    if(a>b){
      return a;
    }
    else{
      return b;
    }
  }

ll power(ll a,ll b){
 ll ans=1;
 for(ll i=1;i<=b;i++){
ans*=a;
  }
  return ans;
}

 ll gcd(ll m,ll n){
 	if(n==0){
       return m;
     }
   return gcd(n,m%n);
 }
ll lcm(ll a,ll b){
  ll g=gcd(a,b);
  return a/gcd(a,b)*b;
		

}
int main(){
  
  ll N,K;
  cin>>N>>K;
  
  vector<ll>V(N);
  
  ll ans=0;
  
  rep(i,N){
cin>>V[i];
  }
for(ll i=min(N,K);i>=0;i--){//何個取るか
ll trash=K-i;
  
  for(ll R=0;R<=i;R++){//右から何個取るか
    priority_queue<ll,vector<ll>,greater<ll>>have;//優先付きキューの逆
    ll L=i-R;
    
    for(ll j=0;j<L;j++){
have.push(V[j]);
    }
for(ll k=0;k<R;k++){
have.push(V[N-1-k]);
}
    for(ll j=0;j<trash;j++){
      if(!have.empty()){
ll figure=have.top();
      if(figure<0){
have.pop();
      }
      }
  }

    ll sol=0;
    
    while(!have.empty()){
      sol+=have.top();
      have.pop();
    }
    
    ans=max(sol,ans);
  }
  }
  
  
  cout<<ans<<endl;
}




Measured memory_bytes: 256
n,m,x,y=map(int,input().split())
xl=list(map(int,input().split()))
yl=list(map(int,input().split()))

xl.append(x)
yl.append(y)
if max(xl) < min(yl) and x < y:
    print('No War')
else:
    print('War')

Measured memory_bytes: 3060
/// Bismillahir Rahmanir Rahim
/* Mohammad Morsalin
   Dept of ICE, NSTU
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ll long long
#define pb push_back
#define mp make_pair
#define endl "\n"
#define int long long
#define f0(n) for(int i=0;i<n;i++)
#define ms(x) memset(x,0,sizeof(x))
#define ms2d(x,m,n) memset(x, 0, sizeof(x[0][0]) * m * n)
#define uniq(vec) vec.resize(distance(vec.begin(),unique(vec.begin(),vec.end())))
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define pi pair<int,int>
#define tc(t) int t;cin>>t;while(t--)
#define bits(n) __builtin_popcount(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define ins insert
#define ALL(v) v.begin(),v.end()
#define highest(x) numeric_limits<x>::max()
#define lowest(x) numeric_limits<x>::min()
#define Inf INFINITY
#define minv(v) *min_element(v.begin(),v.end())
#define maxv(v) *max_element(v.begin(),v.end())
#define fi first
#define se second
#define PI acos(-1)
#define sz(a) (int)a.size();
#define IOS ios::sync_with_stdio(false);
using namespace std;
int gcd(int a, int b) { if (a == 0) return b; return gcd(b % a, a);}
typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
const long long MOD = 1000000007;
double sq(double x) {return x*x;}
template<typename T>inline T Bigmod(T base, T power, T MOD){
    T ret=1;
    while(power)
    {
        if(power & 1)ret=(ret*base)%MOD;
        base=(base*base)%MOD;
        power>>=1;
    }
    return ret;
}

bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}
signed main()
{
    IOS
    int l,r,d;
    cin>>l>>r>>d;
    int cnt=0;
    for(int i=l;i<=r;i++){
        if(i%d==0)cnt++;
    }
    cout << cnt <<endl;
    return 0;
}
///Alhamdulillah


Measured memory_bytes: 3600
#include <iostream>
#include <cmath>

using namespace std;

int main(){

int cnt = 0;
int n,k;
cin >> n >> k;
int a[n];

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

for(int i = 0; i < n; i++){
	if(a[i] >= k){
		cnt++;
	}
}

cout << cnt << endl;













// Задача 750А - Codeforces
/*int n;
cin >> n;
n = n - 1;

cout << "I hate ";

	while(n--){
		if(n % 2 == 0){
			cout << "that I love ";
		}else{
			cout << "that I hate ";
		}
	}

cout << "it";
*/












/*int cnt = 0;
int n,l,r;
cin >> n >> l >> r;
int a[n];

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

for(int i = l; i <= r; i++){
	cnt = cnt + a[i];
}

cout << cnt << endl;
*/



/*int c;
int n;
cin >> n;



for(int i = 0; i <= n; i++){
	if(n == pow(5,i)){
		c = c + i;
	}
}

if(c > 0){
	cout << "YES" << endl;
}else{
	cout << "NO" << endl;
}*/



// Уравнение по возрастанию
/*int a,b,c,d;
cin >> a >> b >> c >> d;

for(int x = 0; x < 1000; x++){
	if(a*x*x*x + b*x*x + c*x + d == 0){
		cout << x << " ";
	}
}
*/











// Алгоритм Евклида --------------------
/*	int n;
	cin >> n;
	int a[n];
	int b[n];

	for(int i = 0; i < n; i++){
		cin >> a[i] >> b[i];
	}

	for(int i = 2; i <= n; i++){
		if(a[i] % i == 0 && b[i] % i == 0){
			cout << i << " ";
		}
	}

*/











// Степень
/*	int n;
	int x = 1;
	cin >> n;

	for(int i = 0; i < n; i++){
		x = x * 2;
	}

	cout << x << endl;*/
















// Сумма цифр числа
/*	int n;
	int sum = 0;
	cin >> n;
	while(n != 0){
		sum = sum + n % 10;
		 n = n / 10;
	}

	cout << sum << endl;*/
















// Сумма квадратов
/*	int n;
	int sum = 0;
	cin >> n;
	for(int i = 1; i <= n; i++){
		sum = sum + i*i;
	}

	cout << sum << endl;*/



















// Количество делителей
/*int sum = 0;
int n;
cin >> n;
	for(int i = 1; i <= n; i++){
		if(n % i == 0){
			sum++;
		}
	}

	cout << sum << endl;
*/















// Минимальный делитель
/*	int n;
	cin >> n;
	for(int i = 2; i <= n; i++){
		if(n % i == 0){
			cout << i << endl;
			break;
		}
	}*/












//Факториал
	/*int sum = 1;
	int n;
	cin >> n;

	for(int i = 1; i <= n; i++){
		sum = sum * i;
	}

cout << sum;*/








// Остаток
	/*int a; int b; int c; int d;
	cin >> a >> b >> c >> d;

	for(int i = a; i <= b; i++){
		if(i % d == c){
			cout << i << " ";
		}
	}*/


    return 0;
}
















// 5 * pow(2,n)

// 5 -> 1 * 5
// 10 -> 2(1) * 5
// 20 -> 4(1) * 5
// 40 -> 8(1) * 5
// 80 -> 
// 160
// 320
// 640



 // 39(40) -> 40 / 5 = 8 while 8 > 39 c++;
 // 22(40) -> 40 / 5 = 8 while x > 22 c++;



Measured memory_bytes: 640
import java.util.*;
import java.io.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main {
  static Scanner sc = new Scanner(System.in);
  public static void main(String[] args) {
    // aoj version
    while(true) {
    int n = sc.nextInt();
    if(n==0)break;
    for(int i = 0; i < 9; i++)
      n -= sc.nextInt();
    System.out.println(n);
    }
  }
}

Measured memory_bytes: 12000
s = input(); a = []; b = [0]*27; d = []; t = ""
for i in range(len(s)): a.append(ord(s[i])); b[a[i]-97] = 1
if s == "zyxwvutsrqponmlkjihgfedcba": print(-1)
else:
    for i in range(27):
        if b[i] == 0: c = i; break
    if c != 26: a.append(c+97)
    else:
        for _ in range(24):
            if a[-2] > a[-1]: d.append(a.pop())
            else: d.append(a.pop()); d.sort(); break
        else: d.append(a.pop()); d.sort()
        for i in range(len(d)):
            if a[-1] < d[i]: a.pop(); a.append(d[i]); break
    for i in range(len(a)): t += chr(a[i])
    print(t)

Measured memory_bytes: 9068
<?php
  list($n) = explode(" ", trim(fgets(STDIN)));
  $a = array_map('intval', explode(" ", trim(fgets(STDIN))));
  $b = array_map('intval', explode(" ", trim(fgets(STDIN))));

  $asum=[0];
  $bsum=[0];
  for($i=1;$i<=$n;$i++){
    $asum[$i]=$asum[$i-1]+$a[$i-1];
    $bsum[$i]=$bsum[$i-1]+$b[$n-$i];
  }

  $ans=PHP_INT_MIN;
  for($i=1;$i<=$n;$i++){
    $ans=max($ans,$asum[$i]+$bsum[$n-$i+1]);
  }
 echo $ans;
  

Measured memory_bytes: 15896
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using E = System.Linq.Enumerable;

class Program
{
    static Node[] Path;
    static long[,] Step;
    static long[] ans;
    static void Main(string[] args)
    {
        //入力を受け取る
        var N = long.Parse(Console.ReadLine());
        
        Path = new Node[N+1];
      
        for(long i = 0; i< N ;i++){
          Path[i+1] = new Node();
        }
        
        for(long i = 1; i< N ;i++){
           var ABC = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
           var A = ABC[0];
           var B = ABC[1];
           var C = ABC[2];
           Path[A].adj.Add(B,C);
           Path[B].adj.Add(A,C);
        }
        
        ans = new long[N+1];
        for(long i = 0;i <= N ;i++){
          ans[i] = -1;
        }
        //幅優先探索でKからの最短経路を求める
        WFS(1);
        //XからKとYからKのそれぞれの最短経路を足し合わせたものを答えにする
        for(long i = 1; i <= N ;i++){
          Console.WriteLine(ans[i]);
        }
        
    }
    static void WFS(long num)
    {
        var queue = new MyQueue();
        queue.Enque(num);
        //ノード1は0(黒に塗る)
        ans[num] = 0;
        while (!(queue.isEmpty()))
        {
            var top = queue.Deque();
                foreach(KeyValuePair<long,long> item in Path[top].adj) {
                    //探索済みか
                    if (ans[item.Key] == -1)
                    {
                      //偶数距離か奇数距離かで場合分け
                      if(item.Value%2 == 0){
                        ans[item.Key] = ans[top];
                      }else{
                        if(ans[top] == 1){
                          ans[item.Key] = 0;
                        }else{
                          ans[item.Key] = 1;
                        }
                      }
                      queue.Enque(item.Key);
                    }
                }
        }
    }
}

class MyQueue
{
    public long[] datas = new long[100000];
    public long enpoint = -1;
    public long depoint = -1;
    public void Enque(long data)
    {
        this.enpoint++;
        datas[this.enpoint] = data;
    }
    public long Deque()
    {
        this.depoint++;
        return datas[this.depoint];
    }
 
    public bool isEmpty()
    {
        return (this.depoint == this.enpoint);
    }
}

class Node{
  public Dictionary<long,long> adj;
  public Node(){
    this.adj = new Dictionary<long,long>();
  }
}


Measured memory_bytes: 54044
l=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k=int(input())
print(l[k-1])

Measured memory_bytes: 38384