akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<tuple>
#include<bitset>
#include<iomanip>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
vpint mode;
int twoflag=0;
void nextmode(int K,int pushed,bool buchikowa){
	if(mode.back().first<pushed){
		if(buchikowa==0) mode.push_back({pushed,1});
		else{
			mode.push_back({pushed,2});
			twoflag=2;
		}
		return;
	}
	else if(mode.back().first==pushed){
		mode.back().second++;
		if(mode.back().first>1&&mode.back().second>K){
			mode.pop_back();
			nextmode(K,pushed-1,0);
			mode.push_back({pushed,1});
		}
	}
	else{
		mode.pop_back();
		nextmode(K,pushed,1);
	}
}
int main(){
	int N;
	int A[200001];
	int Kmin=0,Kmax=INF;
	scan(N);
	rep(i,N){
		scan(A[i]);
	}
	while(Kmin+1<Kmax){
		int Kmid=(Kmin+Kmax)/2;
		mode.clear();
		mode.push_back({1,1});
		rep(i,N){
			if(i==0&&A[i]==1) continue;
			nextmode(Kmid,A[i],0);
			/*rep(j,mode.size()){
				printf("(%d,%d) ",mode[j].first,mode[j].second);
			}
			kaigyo;*/
		}
		if(mode.size()>=1&&mode[0].first==1&&max(mode[0].second,twoflag)>Kmid){
			//printf("Kmid:%d failed\n",Kmid);
			Kmin=Kmid;
		}
		else{
			Kmax=Kmid;
			//printf("Kmid:%d successed\n",Kmid);
		}
	}
	prin(Kmax);
	return 0;
}


Measured memory_bytes: 3448
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cctype>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <stack>
#include <queue>
 
typedef long long LL;
using namespace std;
 
int n, m;
char s[105][105];
int l[105], r[105];
 
int main()
{
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
 
	scanf("%d %d", &n, &m);
	for (int i = 1; i <= n; i++){
		scanf("%s", s[i] + 1);
	}
	for (int i = 1; i <= n; i++){
		int t = 0;
		for (int j = 1; j <= m; j++){
			if(s[i][j] == '.'){
				t++;
			}
		}
		if(t == m) l[i] = 1;
	}
	for (int i = 1; i <= m; i++){
		int t = 0;
		for (int j = 1; j <= n; j++){
			if(s[j][i] == '.'){
				t++;
			}
		}
		if(t == n) r[i] = 1;
	}
	for (int i = 1; i <= n; i++){
		int flag = 0;
		for (int j = 1; j <= m; j++){
			if(l[i] || r[j]) continue;
			flag = 1;
			printf("%c", s[i][j]);
		}
		if(flag) printf("\n");
	}
 
	return 0;
}

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

int main() {
    int n, k, q;
    cin >> n >> k >> q;
    vector<int> b(n, k-q);
    rep(i,q) {
        int a;
        cin >> a; --a;
        b[a]++;
    }
    rep(i,n) {
        if(b[i]<= 0) cout << "No" << endl;
        else cout << "Yes" << endl;
    }
    return 0;
}

Measured memory_bytes: 1024
//##MohK
// 9/2/2020 ..... 2,00
#include <bits/stdc++.h>
using namespace std ;
using ll = long long ;
using ld = long double;
int main(){
    string s,t;
    cin>>s>>t;
    int a,b;
    cin>>a>>b;
    string u;
    cin>>u;
    if(u==s){
        cout<<a-1<<" "<<b<<endl;
    }
    else if(u==t){
        cout<<a<<" "<<b-1<<endl;
    }


    return 0 ;
}



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

const int nax = 1e5 + 5;
vector<int> edges[nax];
int in_degree[nax];
bool visited[nax];
int dist[nax];


void dfs(int a){
    assert(!visited[a]);
    visited[a] = true;
    
    for(int b : edges[a]){
        dist[b] = max(dist[b], dist[a] + 1);
        --in_degree[b];
        if(in_degree[b] == 0){
            dfs(b);
        }
    }
}
int main() {
    int n, m;
    scanf("%d%d",&n,&m);
    
    while(m--){
        int a, b;
        scanf("%d%d", &a, &b);
        edges[a].push_back(b);
        ++in_degree[b];
    }
    for(int i = 1; i<=n; ++i){
        if(!visited[i] && in_degree[i]==0){
            dfs(i);
        }
    }
    int answer = 0;
    
    for(int i = 1; i<=n; i++){
        answer = max(answer, dist[i]);
    }
    
    printf("%d\n", answer);
}

Measured memory_bytes: 9728
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  
  int a;
  vector<int> A(N),B(N);
  for(int i=0;i<N;i++){
    cin >> a;
    A.at(i)=a;
    B.at(i)=a;}
  
  sort(B.begin(),B.end());
  int max1=B.at(N-1);
  int max2=B.at(N-2);
  
  for(int i=0;i<N;i++){
  if(A.at(i)==max1)cout << max2 << endl;
    else cout << max1 << endl;
  }
}


Measured memory_bytes: 3200
#include <bits/stdc++.h>
#define fastio ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define display(v) for (auto x : v) cout << x << ", "
#define print(x) cout << (#x) << " = [ ";display(x); cout << "]\n"
#define endl '\n'
#define pb push_back
typedef long long int ll;
typedef unsigned long long int ull;
using namespace std;
 
// DEBUG TEMPLATE by livw
void __print(int x) {cout << x;}
void __print(long long x) {cout << x;}
void __print(double x) {cout << x;}
void __print(long double x) {cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
#ifdef INCLUDEWHENOFFLINE
#define debug(x...) cout << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif




int main()
{
    fastio;
    
    int n;
    cin >> n;
    int cnt = 0;
    for (int i = 0; i < n; i++)
    {
        int temp;
        cin >> temp;
        if (temp == cnt + 1) cnt++;
    }
    if (cnt == 0) cout << -1;
    else cout << n - cnt;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
    public static bool f = false, t = true;
    static void Main(string[] args)
    {
        int sum = 0;
        int[] a = Read.ints();
        for (int i = 1; i <= a[0]; i++)
        {
            string str = "" + i + "";
            int ans = 0;
            for (int i1 = 0; i1 < str.Length; i1++)
            {
                ans += int.Parse(str.Substring(i1, 1));
            }
            if (a[1] <= ans && a[2] >= ans) { sum+=i; }
        }
        Console.WriteLine(sum);
    }
    public static long gcd(long a, long b)
    {
        while (true)
        {
            if (a == 0) { return b; }
            if (b == 0) { return a; }
            if (a > b) { a -= b; }
            else { b -= a; }
        }
    }
    public static long lcm(long a, long b) { return a / gcd(a, b) * b; }
    public static bool IsPrime(int num)
    {
        if (num < 2) return false;
        else if (num == 2) return true;
        else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

        double sqrtNum = Math.Sqrt(num);
        for (int i = 3; i <= sqrtNum; i += 2)
        {
            if (num % i == 0)
            {
                // 素数ではない
                return false;
            }
        }

        // 素数である
        return true;
    }
}
public static class Read
{
    public static void outl(string n = "") { Console.WriteLine(n); return; }
    public static long Long() { return long.Parse(Console.ReadLine()); }
    public static long[] longs() { return Console.ReadLine().Split().Select(long.Parse).ToArray(); }
    public static int Int() { return int.Parse(Console.ReadLine()); }
    public static int[] ints() { return Console.ReadLine().Split().Select(int.Parse).ToArray(); }
    public static string Str() { return Console.ReadLine(); }
    public static string[] Strs() { return Console.ReadLine().Split(); }
}

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

int main() {
  int N,Y;
  cin >> N >> Y;
  bool loop=true;
  for(int i=0;i<N+1 && loop;i++){
    for(int j=0;i<N+1 && loop;j++){
      if(i+j>N)break;
      else{
        if(10000*i+5000*j+1000*(N-i-j)==Y){
          cout << i << " " << j << " " << N-i-j;
          loop=false;
          break;
        }
      }
    }
  }
  if(loop)cout << -1 << " " << -1 << " " << -1;
}

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

int main(void) {
	std::string S;
	std::cin >> S;
	bool n = false, w = false, s = false, e = false;
	for(int i = 0; i < S.length(); ++i) {
		switch(S[i]) {
			case 'N':
				n = true;
				break;
			case 'W':
				w = true;
				break;
			case 'S':
				s = true;
				break;
			case 'E':
				e = true;
				break;
		}
	}
	if((n == s) && (e == w)) {
		std::cout << "Yes\n";
	} else {
		std::cout << "No\n";
	}
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
template <class T> void corner(bool flg, T hoge) {
    if(flg) {
        cout << hoge << endl;
        exit(0);
    }
}
#define all(v) v.begin(), v.end()
#define inputv(v, n)                                                           \
    vl v;                                                                      \
    rep(i, n) {                                                                \
        ll x;                                                                  \
        cin >> x;                                                              \
        v.push_back(x);                                                        \
    }
const ll INF = 999999999999999;
const ll MOD = 1000000007;
const ll MAX_N = 500010;
ll a, b, c, d, e, f, p, t, x, y, z, q, m, n, r, h, k, w, l, ans;
ll key[MAX_N],value[MAX_N],dp[MAX_N];
int main() {
    ans=INF;
    cin>>n>>m;
    rep(i,m){
        cin>>value[i]>>x;
        rep(j,x){
            cin>>a;
            a--;
            key[i]+=1<<a;
        }
    }

    fill(dp,dp+(1<<n),INF);
    rep(i,1<<n){
        if(i==0)dp[i]=0;
        a=0;
        b=0;
        rep(j,m){
            a=(1<<n)-1-key[j];
            dp[i]=min(dp[a&i]+value[j],dp[i]);
        }
    }
    ans=dp[(1<<n)-1];

    corner(ans==INF,-1);
    cout<<ans<<endl;
}

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

#define int long long
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
template<class T,class U>void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>void chmax(T &t,U f){if(t<f)t=f;}

struct BinaryIndexedTree{
	int n;
	vector<int>dat;
	BinaryIndexedTree(int n=0):n(n){
		dat.resize(n+1);
	}
	void add(int k,int x){
		for(k++;k<=n;k+=k&-k)dat[k]+=x;
	}
	int sum(int k){
		int ret=0;
		for(k++;k;k-=k&-k)ret+=dat[k];
		return ret;
	}
};

signed main(){
	int n,q;cin>>n>>q;
	BinaryIndexedTree bit(n);
	while(q--){
		int t,x,y;
		cin>>t>>x>>y;
		if(t==0){
			x--;
			bit.add(x,y);
		}
		else{
			x--;y--;x--;
			cout<<bit.sum(y)-bit.sum(x)<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3616
/*
--------------              |   /
      |                     |  /
      |                     | /
      |             *       |/          |    |         ------            *
      |                     |           |    |        /      \
      |             |       |\          |    |       |       |\          |
   \  |             |       | \         |    |       |       | \         |
    \ |             |       |  \        |    |        \     /   \        |
     V              |       |   \        \__/|         -----     \       |
*/
#include <bits/stdc++.h>
using namespace std;

#define EmiliaMyWife ios::sync_with_stdio(0); cin.tie(NULL);
#define mem(i,j) memset(i,j,sizeof (i));
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(), (a).end()
#define lowbit(x) ((x)&(-(x)))
#define siz(v) (long long)(v).size()
typedef int64_t ll;
typedef uint64_t ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
const double EPS  = 1e-8;
const int INF     = 0x3F3F3F3F;
const ll LINF     = 4611686018427387903;
const int MOD     = 1e9+7;
const int MAXN    = 2e5+9;
/*-----------------------------------------------------------------------------------------------------*/

signed main() {
	EmiliaMyWife

	string s;
	int p, n;
	cin >> n >> p >> s;
	if(p==2 || p==5) {
		ll ans = 0;
		for(int i = 0; i < n; i++) {
			if((s[i]-'0')%p==0) ans+=i+1;
		}
		cout << ans;
		return 0;
	}
	vector<int> mod(n), cnt(p);
	int a= 0, cur=1;
	ll ans = 0;
	cnt[0]=1;
	for(int i = n-1; ~i; i--) {
		a=(a+(s[i]-'0')*cur)%p;
		ans+=cnt[a];
		cnt[a]++;
		//cout <<ans << '\n';
		cur=cur*10%p;
	}
	cout << ans;


	return 0;
}


Measured memory_bytes: 1300
#include <algorithm>
#include <complex>
#include <cstdlib>
#include <ctime>
#include <time.h>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <numeric>
#include <limits>
#include <type_traits>

using namespace std;
#define SAY_YES cout << "YES" << endl;
#define SAY_Yes cout << "Yes" << endl;
#define SAY_NO cout << "NO" << endl;
#define SAY_No cout << "No" << endl;
#define IFYES(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "YES" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "NO" << endl;  \
    }
#define IFYes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "Yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "No" << endl;  \
    }
#define IFyes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "no" << endl;  \
    }
#define DEBUG_OUTPUT_ARRAY(XXX, ONE)                            \
    for (int i = 0; i < (ONE); i++)                             \
    {                                                           \
        cout << "DEBUG: i = " << i << " -> " << XXX[i] << endl; \
    }
#define DEBUG_OUTPUT_ARRAY2(XXX, ONE, TWO)                             \
    for (int i = 0; i < (ONE); i++)                                    \
    {                                                                  \
        cout << "<<< i = " << i << " >>>" << endl;                     \
        for (int j = 0; j < (TWO); j++)                                \
        {                                                              \
            cout << "DEBUG: j = " << j << " -> " << XXX[i][j] << endl; \
        }                                                              \
    }
#define DEBUG_OUTPUT_ARRAY2_BOX(XXX, ONE, TWO) \
    for (int i = 0; i < (ONE); i++)            \
    {                                          \
        cout << i << "  ";                     \
        for (int j = 0; j < (TWO); j++)        \
        {                                      \
            cout << XXX[i][j] << " ";          \
        }                                      \
        cout << endl;                          \
    }

typedef pair<long long int, long long int> pll;


const long long int mod = 1000000007;
const long long int INF = 1e18;
const long double PI=3.14159265358979323; 

long long int N,T,c[2000],t[2000],res=INF;





int main()
{
    cout << fixed << setprecision(18);
    cin>>N>>T;
    for(long long int i = 0; i < N; i++){
        cin>>c[i]>>t[i];
        if(t[i]<=T){
            res=min(res,c[i]);
        }
    }
    if(res==INF){cout<<"TLE"<<endl;}
    else{cout<<res<<endl;}

}


Measured memory_bytes: 256
#include<bits/stdc++.h>                                                   //---------------------------------------------------------------
                                                                    
# define ll long long   
# define ld long double                                               
# define mod 1000000007                                                   
# define MAX 100005
# define pi 3.141592653589793238                                                                                  //shortcut keys
                                                                                
# define pb push_back                                                                     
# define mp make_pair                                                     
                                                                  
# define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);        //---------------------------------------------------------------                                       
using namespace std;
int main()
{
   string s;
   cin>>s;
   if(s[2]==s[3]&&s[4]==s[5])
   cout<<"Yes";
   else
   cout<<"No";
    return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (h, w, a, b) = readLine()!!.split(' ').map(String::toLong)
    if ((w == 1L && a != 0L) || (h == 1L && b != 0L)) {
        println("No")
        return
    }
    for (r in 1..h) {
        var line = ""
        for (c in 1..w) {
            line += if (r <= b && c <= a) 1
            else if (r <= b) 0
            else if (c <= a) 0
            else 1
        }
        println(line)
    }
}


Measured memory_bytes: 118408
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
int n;
#define Maxn 505
ll val1[Maxn][Maxn];//below
ll val2[Maxn][Maxn];//up
ll f[Maxn][Maxn];
ll sum[Maxn];
inline int calc(int x){return x*(x+1)/2;}
inline void rd(int &x){
	x=0;char ch=getchar();
	while(ch<'0'||ch>'9')ch=getchar();
	while(ch>='0'&&ch<='9'){
		x=x*10+ch-'0';
		ch=getchar();
	}
}
int main(){
	ll All=0;
	rd(n);
	int x;
	for(register int i=1;i<=n;++i)
	    for(register int j=1;j<=n;++j)
	       if(j!=i){
	       	    rd(x);
	       	    All+=x;
	       	    if(j<i)val1[j][i-1]=x;
	       	    else val2[i][j-1]=x;
		   }
	n--;
	for(register int i=1;i<=n;++i)
	    for(register int j=2;j<=i;++j){
	    	val1[j][i]+=val1[j-1][i];
	    	val2[j][i]+=val2[j-1][i];
		}
	ll Ans=0;
	ll Ha=0;
	for(register int i=1;i<=n;++i){
		Ha+=val1[i][i];
	    f[i][0]=Ha+val2[i][i];
		for(register int j=0;j<i;++j){
			ll tmp=0;
		    for(register int k=i+1;k<=n;++k){
		    	f[k][i]=max(f[k][i],f[i][j]+tmp+val1[k][k]-val1[i][k]+val2[k][k]);
                tmp+=val1[k][k]-val1[j][k]+val2[i][k];
			}
		}
	}
	for(register int i=1;i<=n;++i)sum[i]=val1[i][i]+sum[i-1];
	for(register int i=1;i<=n;++i)
	    for(register int j=i+1;j<=n;++j){
	    	val1[i][j]+=val1[i][j-1];
	    	val2[i][j]+=val2[i][j-1];
		}
	for(register int i=1;i<=n;++i)
	    for(register int j=0;j<i;++j)
	    	Ans=max(Ans,f[i][j]-val1[j][n]+val1[j][i]+val2[i][n]-val2[i][i]+sum[n]-sum[i]);
    printf("%lld\n",All-Ans);
	return 0;	    
}

Measured memory_bytes: 6144
import qualified Data.Vector.Unboxed as U
import qualified Data.ByteString.Char8 as C
import Data.Maybe 
  ( fromJust )

main = do
  _  <- getLine
  as <- map (fst . fromJust . C.readInt) . C.words <$> C.getLine 
  print $ uncurry (-) $ maxMin $ U.fromList as

maxMin = (,) <$> U.maximum <*> U.minimum


Measured memory_bytes: 508
/*
    フィボナッチ数列
    https://onlinejudge.u-aizu.ac.jp/courses/lesson/1/ALDS1/10/ALDS1_10_A
*/
#include <bits/stdc++.h>
#define ll long long int
using namespace std;

ll fibonacci(ll n) {
    if (n == 0 || n == 1)
        return 1;

    ll n1 = 1, n2 = 1, n3 = 0;
    n3 = n1 + n2;
    for (ll i = 0; i < n - 2; i++) {
        n1 = n2;
        n2 = n3;
        n3 = n1 + n2;
    }
    return n3;
}

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

    ll n;
    cin >> n;

    cout << fibonacci(n) << endl;
}


Measured memory_bytes: 3180
import java.util.Scanner;
public class Main{
	int kazu;
	
	public void solve(){
		Scanner sc = new Scanner(System.in);
		kazu = sc.nextInt();
		System.out.println(kazu*kazu*kazu);
	}
	public static void main(String[] args){
		Main obj = new Main();
		obj.solve();
	}
}

Measured memory_bytes: 17156
#include <stdio.h>

int main(){
int n,m,ans=0,total=0,a[1010];
  scanf("%d %d",&n,&m);
  for(int i=0;i<=n;i++){
  	scanf("%d",&a[i]);
    total+=a[i];
  }
  for(int j=0;j<=n;j++){
   if((a[j]*4*m)>=total){
    	ans++;
  }}
  if(ans>=m){
  printf("Yes");
  }else{
  printf("No");
  }

}

Measured memory_bytes: 128
//#pragma GCC optimize("O3")
//#pragma comment(linker, "/STACK:1024000000,1024000000")
#include<bits/stdc++.h>
using namespace std;
function<void(void)> ____ = [](){ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);};
int x, y;
int main(){
    cin >> x >> y;
    if(x*2>y or x*4<y or(y&1)==1) cout << "No" << endl;
    else cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3592
#include<stdio.h>

int main()
{
  int n;
  int fir = 0, sec = 0;
  int cnt = 0;
  int a[200000];
  
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  
  for (int i = 0; i < n; i++)
  {
    if (i == 0)
    {
      fir = a[i];
      continue;
    }
    if (a[i] > fir)
    {
      sec = fir; fir = a[i];
      continue;
    }
    if (fir >= a[i] && a[i] > sec)
    {
      sec = a[i];
      continue;
    }
  }
  
  for (int i = 0; i < n; i++) if (a[i] == fir) cnt++;
  if (cnt >= 2)
  {
    for (int i = 0; i < n; i++) printf("%d\n", fir);
    return 0;
  }
  else
  {
    for (int i = 0; i < n; i++)
    {
      if (a[i] == fir) printf("%d\n", sec);
      else printf("%d\n", fir);
    }
    return 0;
  }
}

Measured memory_bytes: 2304
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <cmath>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
typedef long long ll;
using namespace std;
int main(){
    int a,b,x;
    cin>>a>>b>>x;
    if(a>x) cout<<"NO"<<endl;
    else if(a+b<x) cout<<"NO"<<endl;
    else cout<<"YES"<<endl;
    
    return 0;
}

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

using namespace std;

string s,ss;

int main()
{
    cin>>s;
    ss=s;
    sort(s.begin(),s.end());
    if(s[0]==s[1]&&s[1]==s[2])
    {
        cout<<s<<endl;
        return 0;
    }
    else
    {
        if(s[2]==ss[0])
        {
            ss[0]=s[2];
            ss[1]=s[2];
            ss[2]=s[2];
            cout<<ss<<endl;
            return 0;
        }
        else
        {
            if(s[2]==ss[1])
            {

               char temp=ss[0];
                ss[0]=temp+1;
                ss[1]=temp+1;
                ss[2]=temp+1;
                cout<<ss<<endl;
                return 0;
            }
            else
            {
                if(s[2]==ss[2])
                {
                    if(ss[0]>ss[1])
                    {
                       char temp=ss[0];
                        ss[0]=temp;
                        ss[1]=temp;
                        ss[2]=temp;
                        cout<<ss<<endl;
                        return 0;

                    }
                    else
                    {
                        char temp=ss[0];
                        ss[0]=temp+1;
                        ss[1]=temp+1;
                        ss[2]=temp+1;
                        cout<<ss<<endl;
                        return 0;
                    }
                }
            }
        }
    }




    return 0;
}


Measured memory_bytes: 256
H, W = map(int, input().split())
S = ["." + input() + "." for _ in range(H)]
S = ["." * (W + 2)] + S + ["." * (W + 2)]
ans = [["0" for _ in range(W)] for _ in range(H)]
for i in range(1, H + 1):
    for j in range(1, W + 1):
        if S[i][j] == "#":
            ans[i - 1][j - 1] = "#"
        else:
            ans[i - 1][j - 1] = str((S[i - 1][j - 1], S[i - 1][j], S[i - 1][j + 1], S[i][j - 1], S[i][j], S[i][j + 1], S[i + 1][j - 1], S[i + 1][j], S[i + 1][j + 1],).count("#"))
for i in ans:
    print("".join(i))


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

typedef int_fast64_t ll;
typedef long double ld;
typedef int_fast32_t intt;
typedef int_fast32_t tmp_m;
#define deb(x) cout << #x << ' ' << x << endl
#define rep(i, cmp1, cmp2) for (tmp_m i = cmp1; i < cmp2; ++i)
#define repp(i, cmp1, cmp2) for (tmp_m i = cmp1; i >= cmp2; --i)
#define pb push_back
#define st stack
#define pa pair
#define vc vector
#define qu queue
#define pq priority_queue
#define fr first
#define sc second
#define mp map
const ld pi = acos(-1.0);
const intt mod = 1e9 + 7;

struct pr {
  intt x;
  intt y;
  intt dst;
  pr() {}
  pr(intt x, intt y, intt dst) : x(x), y(y), dst(dst) {}
  inline bool operator<(const pr& cmp2) const {
    if (dst != cmp2.dst) return dst < cmp2.dst;
    if (x != cmp2.x) return x < cmp2.x;
    return y < cmp2.y;
  }
  inline bool operator==(const pr& cmp2) const {
    return (cmp2.dst == dst) && (cmp2.x == x) && (cmp2.y == y);
  }
  inline bool operator>(const pr& cmp2) const {
    if (dst != cmp2.dst) return dst > cmp2.dst;
    if (x != cmp2.x) return x > cmp2.x;
    return y > cmp2.y;
  }
};

struct point {
  intt x;
  intt y;
  point() {}
  point(intt x, intt y) : x(x), y(y) {}
  inline bool operator<(const point& cmp2) const {
    if (cmp2.x != x) return cmp2.x < x;
    return cmp2.y < y;
  }
  inline bool operator==(const point& cmp2) const {
    return (cmp2.x == x) && (cmp2.y == y);
  }
  inline bool operator>(const point& cmp2) const {
    if (cmp2.x != x) return cmp2.x > x;
    return cmp2.y > y;
  }
};

class prHash {
 public:
  size_t operator()(const pr& cmp1) const {
    return (hash<intt>()(cmp1.x)) ^ (hash<intt>()(cmp1.y)) ^
           (hash<intt>()(cmp1.dst));
  }
};

class pointHash {
 public:
  size_t operator()(const point& cmp1) const {
    return (hash<intt>()(cmp1.x)) ^ (hash<intt>()(cmp1.y));
  }
};

inline bool spoint(const point& cmp1, const point& cmp2) {
  // swap(cmp1, cmp2);
  if (cmp1.x != cmp2.x) return cmp1.x < cmp2.x;
  return cmp1.y < cmp2.y;
}

inline bool spr(const pr& cmp1, const pr& cmp2) {
  // swap(cmp1, cmp2);
  if (cmp1.dst != cmp2.dst) return cmp1.dst < cmp2.dst;
  if (cmp1.x != cmp2.x) return cmp1.x < cmp2.x;
  return cmp1.y < cmp2.y;
}

void solve() {
  intt s, w;
  cin >> s >> w;
  if(s > w){
    puts("safe");
  } else puts("unsafe");
}

void init() {
  // remove if interactive
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  srand(time(0));
  // memset(dp, -1, sizeof dp);
}

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


Measured memory_bytes: 3644
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <vector>
#include <map>
#include <queue>
#define inf 0x3f3f3f3f
#define ms(a,b) memset(a, b, sizeof a)
using namespace std;
const int maxn = 2e5 + 1e3;
int used[maxn];
int main(void){
    int n, m;
    while(scanf("%d%d", &n, &m) == 2) {
            ms(used, 0);
        for(int i = 1; i <= m; ++i) {
            int a, b;
            scanf("%d%d", &a, &b);
            if(a == 1 || a == n) used[b]++;
            else if(b == 1 || b == n) used[a]++;
        }
        bool flag = 0;
        for(int i = 2; i < n; i++) {
            if(used[i] >= 2) {
                flag = 1;
                break;
            }
        }
        if(flag) cout <<"POSSIBLE"<<endl;
        else cout << "IMPOSSIBLE" << endl;
    }
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main(void){
	int k,x;
	cin >> k;
	cin >> x;
	
	cout << x-k+1;
	for(int i = x-k+2; i < x+k; ++i){
		cout << ' ' << i;
	}
	cout << endl;
	
	return 0;
}

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

map<string, int>memo;

int main() {
    int n;cin>>n;
    rep(i,n){
        string s;cin>>s;
        memo[s]+=1;
    }
    int m;cin>>m;
    rep(i,m){
        string t;cin>>t;
        memo[t]-=1;
    }
    int maxv = 0;
    for(const auto& x:memo){
        int v = x.second;
        if(v > maxv)maxv=v;
    }
    cout<<maxv<<endl;
	return 0;
}

Measured memory_bytes: 3608
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <ratio>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <climits>
#define ll long long
#define ld long double
#define mp make_pair
#define pb push_back
#define in insert
#define vll vector<ll>
#define endl "\n"
#define pll pair<ll,ll>
#define f first
#define s second
#define FOR(i,a,b) for(int i=(a),_b=(b); i<=_b; i++)
#define int ll
#define sz(x) (ll)x.size()
#define all(x) (x.begin(),x.end())
using namespace std;

 
const ll INF = 1e12;
const ll N =(50+5); // TODO : change value as per problem
const ll MOD = 1e9+7;
int a[N];
int dp[N][N][3000];
void solve(){
	int n,A;
	cin >> n >> A;
	for(int i =1;i<=n;i++){
		cin >> a[i];
	}
	sort(a+1,a+n+1);
	dp[0][0][0] = 1;
	for(int i =1;i<=n;i++){
		for(int j =0;j<=i;j++){
			for(int s = 0;s<3000;s++){
				if(s >= a[i] && j){
					dp[i][j][s] += dp[i-1][j-1][s-a[i]];
					dp[i][j][s] += dp[i-1][j][s];
				}
				else{
					dp[i][j][s] += dp[i-1][j][s];
				}
			}
		}
	}
	int ans= 0;
	for(int i = 1;i<=n;i++){
		int s = A*i;
		// for(int j = 1;j<=n;j++){
			ans += dp[n][i][s];
		
	}
	cout << ans << endl;

}
signed main(){
 
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
     // freopen(".in","r",stdin);freopen(".out","w",stdout);
    
     ll tt=1;   
     // cin >> tt;
    while(tt--){    
        solve();
    }    
}

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



int main(){
    int a,b,h;
    cin >>a >> b >> h;
    cout << (a+b)*h/2 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int A[100004];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&A[i]);
	for(int i=1;i<=n;i++){
		if(i+1<=n&&i-1>=1&&A[i]>A[i+1]&&A[i-1]==A[i]){
			puts("No");
			return 0;
		}
		else if(i-1>=1&&A[i]<A[i-1]){
			puts("No");
			return 0;
		}
		else if(A[i-1]<A[i])A[i]--;
	}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>
#include <string>
#include <ctype.h>
#include <cmath>
using namespace std;
int main() {
    int N,K; cin >> N >> K;
    double ans = 0;
    for (int i=1;i<=N;i++){
        if (i>=K) {
            ans++;
            continue;
        }
        double tmp = pow(0.5,ceil(log2(K*1.0/i)));
        ans += tmp;
    }
    printf("%.12f\n",ans/N);
    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 FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD (1000000007)
#define INF (1e9)
#define INFL (1e12)
 
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template<class T>using arr=vector<vector<T>>;
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} cout << a[a.size()-1] << endl;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
 
int main()
{
    int x, y; cin >> x >> y;

    int t;
    bool f = false;
    rep(c, x+1){
        t = x-c;
        if(c*2 + t*4 == y){
            f = true;
            break;
        }
    }

    if(f) pr("Yes\n");
    else pr("No\n");
    return 0;}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main()
{
 int n,k;
  cin>>n>>k;
  int a[n];
  int c=0;
  for(int i=0;i<n;i++)
  {
  cin>>a[i];
    if(a[i]>=k)
    {c++;}
  }cout<<c;
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

	public static String Y = "Yes";
	public static String N = "No";
	public static long MOD = (long) (Math.pow(10, 9) + 7);
	public static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int n = ni();
		String s = n();
		String t = n();

		int ordinary = n;
		boolean flg = false;

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

			if (s.substring(i, n).equals(t.substring(0, n - i))) {
				ordinary += i;
				flg = true;
				break;
			}
		}

		if (flg) {
			out(ordinary);
		} else {
			out(2 * ordinary);
		}

	}

	/*
	 * 以下メソッド集
	 */
	static int ni() {
		return sc.nextInt();
	}

	static long nl() {
		return sc.nextLong();
	}

	static double nd() {
		return sc.nextDouble();
	}

	static String n() {
		return sc.next();
	}

	static char[] nc() {
		return sc.next().toCharArray();
	}

	static int kaijo(int n) {
		if (n == 0 || n == 1) {
			return 1;
		} else {
			return n * kaijo(n - 1);
		}
	}

	static int fib(int n) {
		return (n == 1 || n == 0) ? n : fib(n - 2) + fib(n - 1);
	}

	static long lcm(long m, long n) {

		return m * n / gcd(m, n);
	}

	static int lcm(int m, int n) {

		return m * n / gcd(m, n);
	}

	static long gcd(long a, long b) {
		return (b == 0) ? a : gcd(b, a % b);
	}

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

	static void out(String info) {
		System.out.println(info);
	}

	static void out(int info) {
		System.out.println(info);
	}

	static void out(double info) {
		System.out.println(info);
	}

	static void out(long info) {
		System.out.println(info);
	}

	static void out(char info) {
		System.out.println(info);
	}

	static void out(Object obj) {
		System.out.println(obj.toString());
	}

	static void outn(String info) {
		System.out.print(info);
	}

	static void outn(int info) {
		System.out.print(info);
	}

	static void outn(double info) {
		System.out.print(info);
	}

	static void outn(long info) {
		System.out.print(info);
	}

	static void outn(char info) {
		System.out.print(info);
	}

	static double max(double d, double e) {
		return Math.max(d, e);
	}

	static long max(long a, long b) {
		return Math.max(a, b);
	}

	static double min(double d, double e) {
		return Math.min(d, e);
	}

	static long min(long a, long b) {
		return Math.min(a, b);
	}
}

class XY {
	int h;
	int c;

	XY(int h, int c) {
		this.h = h;
		this.c = c;
	}
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define modulo 2019
#define mod(mod_x) ((((long long)mod_x)+modulo)%modulo)
#define Inf 1000000000



int main(){
	int L,R;
	cin>>L>>R;
	R = min(L+2019,R);
	
	int mini = 2018;
	
	for(int i=L;i<=R;i++){
		for(int j=i+1;j<=R;j++){
			mini = min(mini,(int)mod(i*j));
		}
	}
	
	cout<<mini<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  vector<char> s(19);
  for (char &x:s){
    cin>>x;
  }
  s.at(5)=' ';
  s.at(13)=' ';
  for (char &x:s){
    cout <<x;
  }
  cout<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<queue>
#include<cassert>
#include<tuple>
#include<set>
#include<map>
#include<list>
#include<bitset>

#define PB push_back
#define ALL(a)  (a).begin(),(a).end()
#define DWN(a)  (a).begin(),(a).end(), greater<int>()
#define rep(i, m) for (int i = 0; i < m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)

#define mod 1000000007

using namespace std;

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

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
const int INF = (int)1e9;

int main() { 
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<ll> a(n);
	rep(i, n) cin >> a[i];
	sort(a.begin(), a.end());
	int ans, b = a[n - 1];
	for (int i = 0; i < n - 1; i++) {
		if (b > abs(a[n - 1] / 2.0 - a[i])) {
			b = abs(a[n - 1] / 2.0 - a[i]);
			ans = i;
		}
	}
	cout << a[n - 1] << " " << a[ans] << "\n";
	return 0;
}

Measured memory_bytes: 1024
#
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

#
#op = sum(B) - sum(A)
#if op<0:
#    print('No')

#
a = 0
b = 0
e = 0
for i in range(N):
    if A[i]==B[i]:
        e += 1
    elif A[i]>B[i]:
        b += A[i] - B[i]
    else:
        a += (B[i] - A[i])//2

#
if b<=a:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 4596
#include "bits/stdc++.h"
using namespace std;
#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define PI 3.1415926535
typedef long long ll;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<Pll> vPll;
typedef vector<vector<int>> vvi;
typedef vector<vector<bool>> vvb;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<double>> vvd;
typedef vector<vector<Pi>> vvPi;
typedef priority_queue<int, vector<int>, greater<int>> pqli;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi>> pqlP;
string YN(bool y) { return (y?"YES":"NO"); }
string yn(bool y) { return (y?"Yes":"No"); }
string ON(bool y) { return (y?"OK":"NG"); }
int main(void)
{
	int a, b, c;

	cin>>a>>b>>c;

	cout<<yn(a+b>=c)<<endl;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = 0
for i in range(n):
    if i > 0 and a[i] == a[i-1]+1:
        ans += c[a[i-1]-1]
ans += sum(b)
print(ans)

Measured memory_bytes: 3064
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            String s = in.next();
            int[] cnt = new int[26];
            for (int i = 0; i < n; ++i) ++cnt[s.charAt(i) - 'a'];
            long res = 1;
            long MODULO = (long) (1e9 + 7);
            for (int x : cnt) {
                res = res * (x + 1) % MODULO;
            }
            res = (res + MODULO - 1) % MODULO;
            out.println(res);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



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

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

  // 予報と結果を比較
  int k = 0;
  for (int i = 0; i < 3; i++) {
    if (S.at(i) == T.at(i)) {
      k=k+1;
    }
  }
  
  cout << k << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {

    public static void main(String[] args) {
    	try (Scanner sc = new Scanner(System.in)){
			int n = sc.nextInt();
			String a = "";
			for (int i=1; i<n+1; i++) a += i;  //1からnまで入る文字列を作成
			permutation(a,"");
    	}
  }

    static void permutation( String input, String ans){
    	//1まで削ったらその回を終了して、答えを出力する
    	if (input.length() <= 1) {
    		System.out.println(ans + input);  //最後の数字はここでくっつく
    	} else {
    		for (int i=0; i<input.length(); i++) {  //inputの1、2、3…char目を分離して、残りの方に挿入する
    			permutation(input.substring(0, i) + input.substring(i + 1), ans + input.charAt(i) + " ");  //空白を入れる
    		}
    	}
    }
}



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

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

    if (n == 100) {
        n++;
    }

    int a = (d == 0 ? 1 : (d == 1 ? 100 : 10000));

    cout << (n * a) << endl;

    return 0;
}


Measured memory_bytes: 256
#a,b = map(int,input().split())
#A = list(map(int,input().split()))
# S = str(input())
# if('L' in S[0::2] or 'R' in S[1::2]):
#     print('No')
# else:
#     print('Yes')
N,K = map(int,input().split())
h = list(map(int,input().split()))
ans = 0
for i in range(N):
    if(h[i] >= K):
        ans += 1
print(ans)

Measured memory_bytes: 11916
N, K = list(map(int, input().split()))
A = sorted(list(map(int, input().split())))
F = sorted(list(map(int, input().split())))[::-1]
B = sum(A)
## 修行前の最短: M
M = max([a*f for a, f in zip(A, F)])

def is_possible(x):
    return B - sum([min(a, x//f) for a, f in zip(A, F)]) <= K

## 2分探索
left = -1
right = M
while left + 1 < right:
    mid = (left + right)//2
    if is_possible(mid):
        right = mid
    else:
        left = mid

print(right)

Measured memory_bytes: 136952
#include<bits/stdc++.h>
using namespace std;
#define rkc ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
#define fl(i,a,b) for(ll i=a;i<b;i++)
#define rfl(i,a,b) for(ll i=a;i>b;i--)
#define pb push_back
#define mp make_pair
#define test ll t;cin>>t;while(t--)
#define lld long double
#define vpp vector<pair<ll,ll>>
#define ff first
#define ss second
const ll M = 1e9 + 7;
const double pi  =3.141592653589793238463;
ll modularExponentiation(ll x,ll n,ll M)
{
    ll result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x)%M;
        x=(x*x)%M;
        n=n/2;
    }
    return result;
}
int main()
{
    rkc;
    int a;
    string s;
    cin>>a>>s;
    if(a<3200)cout<<"red";
    else cout<<s;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std; 
int n,k,ans,dp[2001][2001],a[4000001],b[4000001],mod=1e9+7;
inline int read()
{
    int sum=0,x=1;
    char ch=getchar();
    while (!isdigit(ch))
	{
        if (ch=='-')
		  x=-1;
        ch=getchar();
    }
    while (isdigit(ch))
	{
        sum=(sum<<1)+(sum<<3)+(ch^'0');
        ch=getchar();
    }
    return sum*x;
}
inline void write(int x)
{
    if (x<0)
	{
        putchar('-');
        x=-x;
    }  
    if (x>9)
      write(x/10);
    putchar(x%10+'0');
}
inline int sr(int x,int y)
{
    if (y>x)
	  return 0;
    return a[x]*b[y]%mod*b[x-y]%mod;
}
inline int power(int x,int y)
{
    int s=1;
    for (;y;y>>=1,x=x*x%mod)
      if (y&1)
		s=s*x%mod;
    return s;
}
signed main()
{
    n=read();k=read();
    if (k<2)
    {
        write(1);
        return 0;
    }
    a[0]=b[0]=1;
    for (register int i=1;i<=n*k;++i)
    {
    	a[i]=a[i-1]*i%mod;
		b[i]=power(a[i],mod-2);
	}
    dp[0][0]=1;
    for (register int i=1;i<=n;++i)
      for (register int j=i;j>=0;--j)
        dp[i][j]=(dp[i][j]+dp[i-1][j-1]*sr(k*i-j-1,k-2)+dp[i][j+1])%mod;
    write(dp[n][0]*a[n]%mod);
    return 0;
}

Measured memory_bytes: 88724
#include <bits/stdc++.h>
#include <iostream>
#include <math.h>
using namespace std;
 
int main() {
int a;
  cin >> a ;
  if(a %10 == 3){
  cout << "bon" << endl;
  }
  else if(a % 10 == 0||a % 10 ==1||a % 10 ==6||a % 10 ==8){
  cout << "pon" << endl;
  }
  else{
    cout << "hon" << endl;
  }
}


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

ll solve() {
    ll N, a;
    cin >> N;
    ll ans = 0;
    for ( int i = 0; i < N; i++ ) {
        cin >> a;
        ans += a-1;
    }
    return ans;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
/**
*    created: 05.05.2020 07:20:00
**/

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
const int inf = 1000000000;

int main() {
    int n,a,b;
    string s;
    cin>>n>>a>>b>>s;
   // cout << s[0] << endl;
    int w=0,f=1;
    rep(i,n){
//        int j=i+1;//順位

       // cout << s[i] << endl;
        if(s[i]=='a'){
            if(w<a+b){
                w++;
                cout << "Yes" << endl;
            }else{
                cout << "No" << endl;
            }
          continue;
        }

        if(s[i]=='b'){
            if(w<a+b&&f<=b){
                f++;
                w++;
                cout << "Yes" << endl;
           }else{
               cout << "No" << endl;
               
           }
          continue;
        }

        if(s[i]=='c'){
          
            cout << "No" << endl;
          continue;
        }
        
        cout << s[i] << endl;
    }
}

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

int main(){
    int n;
    cin>>n;
    vector<int> a(n), cnt(1000001);
    for(int i=0;i<n;i++){
        cin>>a[i];
        ++cnt[a[i]];
    }
    for(int i=1000000;i>=1;i--){
        for(int j=2*i;j<=1000000;j+=i){
            cnt[j]+=cnt[i];
        }
    }
    int ans=0;
    for(int i=0;i<n;i++){
        if(cnt[a[i]]==1)++ans;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 8012
#include<cstdio>
#define int long long
int id[100001],x,m;
long long n;
signed main()
{
	scanf("%lld%lld%lld",&n,&x,&m);
	x%=m;
	long long i,lp=0;
	long long ans=0,smlp=0;
	for(i=x;!id[i];i=i*i%m)
		if(!id[i])
			id[i]=++lp;
	lp-=(id[i]-1);
	for(int j=x;j!=i;j=j*j%m)
		if(j!=i)
			ans+=j;
	smlp=i%m;
	int j;
	for(j=i*i%m;j!=i;j=j*j%m)
		if(j!=i)
			smlp+=j;
	ans+=(n-id[i]+1)/lp*smlp;
	int k=j;
	for(int dd=1;dd<=(n-id[i]+1)%lp;++dd,k=k*k%m)
		ans+=k;
	printf("%lld",ans);
}

Measured memory_bytes: 2456
import sys
def input():
    return sys.stdin.readline()[:-1]

L, R = map(int, input().split())

res = 2020
if R-L >= 2019:
    print(0)
else:
    for i in range(L, R):
        if res==0: break
        for j in range(i+1, R+1):
            if res==0: break
            
            new_res = (i*j)%2019
            if new_res < res:
                res = new_res
    print(res)

Measured memory_bytes: 39408
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <limits>
#include <climits>
#include <utility>
#include <algorithm>
#include <numeric>

using namespace std;

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

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

    S[3] = '8';

    cout << S << endl;

    return 0;
}


Measured memory_bytes: 256