akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,n,s) for(int i = s; i < (n); ++i)
#define rsrep(i,n,s) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;

const int MAX = 1000005;
ll fac[MAX], finv[MAX], inv[MAX];

void comb_init() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll comb(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    int x, y;
    cin >> x >> y;
    if (x > y) swap(x, y);

    if ((x+y)%3 != 0 || x*2 < y) {
        puts("0");
        return 0;
    }
    int n = (x+y)/3;
    int k = x - n;

    comb_init();
    ll ans = comb(n, k);

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

Measured memory_bytes: 23680
def resolve():
    from collections import deque
    n = int(input())
    d = deque()
    A = list(map(int, input().split()))

    reverse = False
    for i in range(n):
        if not reverse:
            d.append(A[i])
            reverse = not reverse
        else:
            d.appendleft(A[i])
            reverse = not reverse

    if not reverse:
        for i in d:
            print(i, end=' ')
    else:
        for i in reversed(d):
            print(i, end=' ')


resolve()

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

void insertionSort(int *A, int N){ // N??????????´??????????0-?????????????????????A
	for (int i = 0; i<N; i++){
		int v = A[i];
		int j = i - 1;
		
		while (j >= 0 && A[j] > v){
			A[j + 1] = A[j];
			j--;
			A[j + 1] = v;
		}

		for (int i = 0; i < N; i++){
			cout << A[i];
			if (i == N - 1) cout << "\n";
			else cout << " ";
		}
	}
}

int main(void){
	int N, *A;
	
	cin >> N;

	A = new int[N];

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

	insertionSort(A, N);

	return 0;
}

Measured memory_bytes: 1188
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    N = I()
    A = sorted(LI())
    n = A[-1]
    ix = bisect.bisect_left(A, n / 2)
    '''
    [1, 3, 8, 10, 12] -> bisect_left(A, 12 / 2) = 2
    [1, 2, 3, 8, 10, 12] -> bisect_left(A, 12/2) = 3
    '''
    m, l, r = inf, inf, inf
    # 最大値の半分との距離が最小のものを選ぶ
    if ix < N:
        m = A[ix]
    if 0 < ix <= N:
        l = A[ix - 1]
    if ix + 1 < N:
        r = A[ix + 1]

    m1 = abs(n / 2 - m)
    l1 = abs(n / 2 - l)
    r1 = abs(n / 2 - r)

    min_val = min(m1, l1, r1)
    if min_val == m1:
        n_ = m
    if min_val == l1:
        n_ = l
    if min_val == r1:
        n_ = r

    print(n, n_)
main()



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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = long long;
using pll = pair<ll,ll>;
constexpr ll INF = (1LL<<60);
constexpr ll MOD = (1e9+7);
//constexpr ll MOD = (998244353);
template<class T> bool chmax(T &ok,const T &b){if(ok<b){ok=b;return 1;}return 0;}
template<class T> bool chmin(T &ok,const T &b){if(ok>b){ok=b;return 1;}return 0;}
#if loc||debg||local||debug
void dump(){cerr<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T>vector<T> vec(size_t ok){return vector<T>(ok);}
template<class T, class... Ts>auto vec(size_t ok, Ts... ts){return vector<decltype(vec<T>(ts...))>(ok, vec<T>(ts...));}
template<class T>vector<T> _vec(size_t ok,T v){return vector<T>(ok,v);}
template<class T, class... Ts>auto _vec(size_t ok, Ts... ts){return vector<decltype(_vec<T>(ts...))>(ok, _vec<T>(ts...));}

int main(){

  auto a = vec<int>(3,3);
  cin>>a;
  int n;
  cin>>n;
  vector<int> b(n);
  cin>>b;

  auto ok = vec<int>(3,3);
  for(auto bi:b){
    rep(i,3)rep(j,3){
      if(a[i][j]==bi)ok[i][j]=1;
    }
  }

  bool ans = false;
  if(
    (ok[0][0]&&ok[0][1]&&ok[0][2]) ||
    (ok[1][0]&&ok[1][1]&&ok[1][2]) ||
    (ok[2][0]&&ok[2][1]&&ok[2][2]) ||
    (ok[0][0]&&ok[1][0]&&ok[2][0]) ||
    (ok[0][1]&&ok[1][1]&&ok[2][1]) ||
    (ok[0][2]&&ok[1][2]&&ok[2][2]) ||
    (ok[0][0]&&ok[1][1]&&ok[2][2]) ||
    (ok[0][2]&&ok[1][1]&&ok[2][0])
  )ans = true;

  cout<<(ans?"Yes":"No")<<endl;


}

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

int f[190];
int dp1[1000100];
int dp2[1000100];


void solve(){

    int n=182;
    vector<int> v;

    while(true){
        int x;
        cin >> x;
        if(x==0) break;
        v.emplace_back(x);
    }


    rep(i,190){
        f[i]=i*(i+1)*(i+2)/6;
    }

    rep(i,1000100){
        dp1[i]=i;
        dp2[i]=i;
    }


    for(int k=1; k<=1000100; k++){
        rep(i,n){
            if(k>=f[i]) dp1[k]=min(dp1[k-f[i]]+1, dp1[k]);
            if(f[i]%2==1){
                if(k>=f[i]) dp2[k]=min(dp2[k-f[i]]+1, dp2[k]);
            }
        }
        /*
        rep(i,100){
            if(k>=fodd[i]) dp2[k]=min(dp2[k-fodd[i]]+1, dp2[k]);
        }
        */
    }


    rep(i,v.size()){
        cout << dp1[v[i]] << " " << dp2[v[i]] << endl;
    }


}

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



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

#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif

vector<int> RG[3000],can_use(3000,0);

struct edge{ int to,cost; };
int bellmanford(vector<edge> G[],int n,int s){
  const int INF = 1 << 30;
  vector<int> dist(n,INF); //sからの最短距離
  dist[s] = 0;
  for(int i = 0; i < n; i++){
    for(int u = 0; u < n; u++){
      if(!can_use[u]) continue;
      for(auto e : G[u]){
        if(dist[u] != INF && dist[e.to] > dist[u] + e.cost){
          dist[e.to] = dist[u] + e.cost;
          //n回目にも更新があるなら負の閉路が存在
          if(i == n-1) return -1;
        }
      }
    }
  }
  return max(0LL,-dist[n-1]);
}

signed main(){

  int n,m,p; cin >> n >> m >> p;
  vector< edge > G[n];
  for(int i = 0; i < m; i++){
    int a,b,c; cin >> a >> b >> c;
    a--,b--;
    G[a].push_back({b,-(c-p)});
    RG[b].push_back(a);
  }

  function< void(int,int) > dfs =
  [&](int u,int pre){
    if(can_use[u]) return;
    can_use[u] = 1;
    for(int v : RG[u]){
      if(v == pre) continue;
      dfs(v,u);
    }
  };
  dfs(n-1,-9);

  cout << bellmanford(G,n,0) << endl;

  return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
#define MAXN 2020
#define MOD 1000000007
#define INF 1000000009
#define FOR(x,n) for(int x=0; x<n; x++)
#define FOR1e(x,n) for(int x=1; x<=n; x++)
typedef pair<int, int> ii;
typedef long long ll;

int main() {
	char w[5];
	int ans = 0;
	scanf("%s", w);
	FOR(x, 3) if (w[x] == '1') ans++;
	printf("%d\n", ans); 
	return 0;
}

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

#define ll long long
#define REP(i,n) for(int i = 0; i < n; i++)
#define PI 3.141592653589
#define MOD 1000000007

using namespace std;

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

void solve_161D(){
    ll k;
    cin >> k;

    queue<ll> q;
    ll i = 1, ans;
    ll ctr = 0;
    REP(i,9) q.push(i+1);

    REP(i,k){
        ans = q.front();
        q.pop();

        if(ans % 10 != 0) q.push(10 * ans + (ans % 10) - 1);
        q.push(10 * ans + (ans % 10));
        if(ans % 10 != 9) q.push(10 * ans + (ans % 10) + 1);
    }

    cout << ans << endl;
}

int main(void){
    solve_161D();
    
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define orep(i, n) for (int i = 1; i < (int)(n); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

vector<pair<int, int>> a;
int n;

double calc(int depth, double dis, vi visit, int current) {
  if (depth == 0) return dis;
  rep(i, n) {
    if (visit[i] == 0) {
      dis += sqrt(pow(a[current].first - a[i].first, 2) +
                  pow(a[current].second - a[i].second, 2));
      visit[i] = 1;
      calc(depth - 1, dis, visit, i);
    }
  }
  return dis;
}

int main() {
  cin >> n;
  int x, y;
  rep(i, n) {
    cin >> x >> y;
    a.push_back(make_pair(x, y));
  }

  double ans = 0;
  rep(i, n) {
    vi visit(n, 0);
    visit[i] = 1;
    ans += calc(n, 0, visit, i);
  }

  printf("%f\n", ans / n);

  return 0;
}

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

#define NREP() for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define MSG(x) cout << x << endl;
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
using ll = long long;
const static ll MOD = 1e9 + 7;

int main(int argc, char *argv[]) {
   ll n, m;
   cin >> n >> m;
   Yn(n == m)
}


Measured memory_bytes: 256
n,m=map(int,input().split())
a=[1]*(n+1)
b=[0]*(n+1)
b[1]=1
for _ in range(m):
  x,y=map(int,input().split())
  a[x]-=1
  a[y]+=1
  if b[x]:b[y]=1
  if a[x]==0:b[x]=0
ans=0
for i,j in zip(a,b):
  ans+=(i!=0)*j
print(ans)

Measured memory_bytes: 71848
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
s = input()
t = input()
val = max(i for i in range(n+1) if i==0 or s[-(i):]==t[:i])
ans = 2*n - val
print(ans)

Measured memory_bytes: 61896
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
    long k;
    string a;

    cin >> k >> a;
    if (a.size() <= k)
    {
        cout << a << endl;
        return 0;
    }
    else
    {
        for (int i = 0; i < k; i++)
        {
            cout << a[i];
        }
        cout << "..." << endl;
    }

    return 0;
}


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

using namespace std;
using ll = long long;
using ii = pair<int, int>;

const int MAX { 200010 };
const ll MOD { 1000000007 }, oo { 1LL << 62 };

ll solve(int N, vector<ll>& xs)
{
    sort(xs.begin(), xs.end());
    ll ans = 0;

    for (int i = N - 1; i >= 0; --i)
        for (int j = i - 1; j >= 0; --j)
        {
            auto diff = xs[i] - xs[j];
            int pos = upper_bound(xs.begin(), xs.end(), diff) - xs.begin();

            ans += max(j - pos, 0);      
        }

    return ans;
}

int main()
{
    ios::sync_with_stdio(false);

    int N;
    cin >> N;

    vector<ll> xs(N);

    for (int i = 0; i < N; ++i)
        cin >> xs[i];

    auto ans = solve(N, xs);

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 3672
n=int(input())
a=list(map(int, input().split()))
a.sort()
flag=0
if a[0]==0:
    ans=0
else:
    ans=a[0]
    for x in range(1,n):
        ans=ans*a[x]
        if ans>10**18:
            ans=-1
            break
print(ans)

Measured memory_bytes: 21644
#include <bits/stdc++.h>
using namespace std;
#define lim 1e9
#define on 100005
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define FOR for(int i=1;i<=n;i++)
typedef long long int lo; 
typedef pair<int,int> PII;
int n,m,cev,a[100005],mp1[on],mp2[100005],cevv=lim,cevc,flag;
char c;
string s;
stack<int> st;
vector< pair<int,int> > v;
vector< pair<int,int> > bir;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
		cevc=max(cev,a[i]);
		if(i%2==0)
			mp1[a[i]]++;
		if(i%2==1)
			mp2[a[i]]++;
	}
	for(int i=1;i<=n;i++){
		if(i%2==0)
			v.pb(mp(mp1[a[i]],a[i]));
		if(i%2==1)
			bir.pb(mp(mp2[a[i]],a[i]));
	}
	sort(bir.begin(),bir.end());
	sort(v.begin(),v.end());
	reverse(bir.begin(),bir.end());
	reverse(v.begin(),v.end());
	//~ for(int i=0;i<(int)v.size();i++){
		//~ printf("%d %d\n",v[i].fi,v[i].se);
	//~ }
	for(int i=0;i<(int)bir.size();i++){
		cev=(n/2-bir[i].fi);
		for(int j=0;j<(int)v.size();j++){
			if(v[j].se!=bir[i].se){
				cev+=(n/2-v[j].fi);
				flag=1;
				break;
			}
		}
		if(flag==0)
			cev+=(n/2);
		cevv=min(cev,cevv);
		cev=0;
		flag=0;
	}
	printf("%d",cevv);
	return 0;
}




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

int main() {
  int n,d;
  cin >> n >> d;
  
  int ans =0;
  
  for (int i=0; i<n;){
    i = i+d+1;
    ans++;
    i += d;
  }
  
  cout << ans << endl;
}


Measured memory_bytes: 256
s = input()


#b = s[int((len(s)+3)/2)-1:]

ans = 'Yes'

for i in range(int(len(s)/2)):
	if s[i] != s[-(i+1)]:
		ans = 'No'
		break


if ans == 'Yes':
	a = s[:int((len(s)-1)/2)]
	n = len(a)
	for i in range(int(n/2)):
		if a[i] != a[-(i+1)]:
			ans = 'No'
			break

print(ans)


Measured memory_bytes: 3060
import java.util.*;
public class Main {
	public static void main (String[] args) {
		Scanner sc =new Scanner (System.in);
		int x=sc.nextInt();
		int y=x/500;
		x=x%500;
		int z=x/5;
		System.out.println(1000*y+5*z);
	}
}


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

int main(){
    int K, S;
    cin >> K >> S;

    int count = 0;
    for (int X=0; X <= K; X++){
        for(int Y = 0; Y <= K; Y++){
            int Z = S - (X + Y);
            if(Z >= 0 && Z <= K) count++;
        }
    }
    cout << count << endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <string.h>
#include <cstring>
#include <math.h>
#include <cmath>
#include <iomanip>
#include <set>
#include <vector>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <cassert>

using namespace std;
using ll = long long;

#define nl "\n"
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define trav(x) for(auto& i: x)

string s, t;
bool ans = false;

string rotate(string s) {
	char c = s[s.size() - 1];
	string x = s;
	for(int i = 1; i < s.size(); i++) {
		s[i] = x[i - 1];
	}
	s[0] = c;
	return s;
}

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

	cin >> s >> t;
	for(int i = 0; i < (int)s.size() + 100; i++) {
		if(s == t) {
			ans = true;
			break;
		} else {
			s = rotate(s);
		}
	}
	if(ans) {
		cout << "Yes" << nl;
	} else {
		cout << "No" << nl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF mugen
#define dump(x) cerr<<#x<<"="<<x<<endl
#define all(a) (a).begin(),(a).end()
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<vii> viii;
typedef pair<int,int> P;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
using ll = long long;
const ll mod = LLONG_MAX;
int a,b;
int main(){
  cin>>a>>b;
  if(a<=b){
    cout<<a<<endl;
  }else{
    cout<<a-1<<endl;
  }


}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<vector>
#define V vector
#define VI vector<int>
#define VVI vector<vector<int>>
#define rep(i,N) for(int i=0;i<N;i++)

using namespace std;

int main(void){
    int W;
    cin>>W;
    cout<<W*32<<endl;
}




Measured memory_bytes: 3116
#include <iostream>
 
using namespace std;
 
int main()
{
    
        string s;
    cin>>s;
    if(s[0]=='R'&&s[1]=='R'&&s[2]=='R') cout<<3;
 
    else if(s[0]=='R'&&s[2]=='R')cout<<1<<endl;
    else if(s[0]=='R'&&s[1]=='R')cout<<2<<endl;
    else if(s[1]=='R'&&s[2]=='R')cout<<2<<endl;
else if(s[0]!='R'&&s[1]!='R'&&s[2]=='R') cout<<1;
else if(s[0]=='R'&&s[1]!='R'&&s[2]!='R') cout<<1;
else if(s[0]!='R'&&s[1]=='R'&&s[2]!='R') cout<<1;
    else if(s[0]!='R'&&s[2]!='R') cout<<0;
    else if(s[0]!='R'&&s[1]!='R') cout<<0;
    else if(s[0]!='R'&&s[1]!='R'&&s[2]!='R') cout<<0;
 
 
 
 
    return 0;
}

Measured memory_bytes: 3604
use std::io;

fn main() {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let n = match buf.trim().parse::<i32>() {
		Ok(m) => m,
		_ => panic!(""),
	};
	
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let iter = buf.split_whitespace();
	let mut a = Vec::new();
	for j in iter {
		let i = match j.parse::<i32>() {
			Ok(m) => m,
			_ => panic!(""),
		};
		a.push(i);
	}
	
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let iter = buf.split_whitespace();
	let mut b = Vec::new();
	for j in iter {
		let i = match j.parse::<i32>() {
			Ok(m) => m,
			_ => panic!(""),
		};
		b.push(i);
	}
	
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let iter = buf.split_whitespace();
	let mut c = Vec::new();
	for j in iter {
		let i = match j.parse::<i32>() {
			Ok(m) => m,
			_ => panic!(""),
		};
		c.push(i);
	}
	let mut ret = 0;
	for i in 0..n {
		let num = a[i as usize];
		ret = ret + b[(num - 1) as usize];
		if i+1 < n && a[(i+1) as usize] == num + 1 {
			ret = ret + c[(num - 1) as usize];
		}
	}
	println!("{}", ret);
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define simplify ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
#define endl "\n"
using namespace std;



int32_t main() {

    simplify
    int n;
    cin>>n;
    int temp;
    int ans=0;

    for(int i=1;i<=n;i++){
        cin>>temp;
        if(i%2 && temp%2)ans++;
    }
    cout<<ans;



    return 0;
}



Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
int cnt[26];
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	string s;
	cin >> s;
	for(char c : s)
		cnt[c - 'a']++;
	for(int i=1;i<n;i++) {
		cin >> s;
		int tem[26] = {};
		for(char c : s)
			tem[c - 'a']++;
		for(int i=0;i<26;i++)
			cnt[i] = min(cnt[i],tem[i]);
	}
	for(int i=0;i<26;i++)
		for(int t=0;t<cnt[i];t++)
			cout << (char)('a' + i);
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Numerics;

namespace abc162
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
            if (File.Exists("input.txt"))
            {
                Console.SetIn(new StreamReader("input.txt"));
            }
			solve_abc162B();
			Console.Out.Flush();

        }

        public static void solve_abc162D()
        {
            int n = Convert.ToInt32(Console.ReadLine());
            string s = Console.ReadLine();
        }

        public static void solve_abc162C()
        {
            int n = Convert.ToInt32(Console.ReadLine());
            int sum = 0;
            for (int i = 1; i <= n; i++)
            {
                for (int j = 1; j <= n; j++)
                {
                    for (int k = 1; k <= n; k++)
                    {
                        sum += gcd(i, gcd(j, k));
                    }
                }
            }

            Console.WriteLine(sum);
        }
        public static int gcd(int a, int b)
        {
            if (b == 0)
            {
                return a;
            }
            else
            {
                return gcd(b, a % b);
            }
        }

        public static void solve_abc162B()
        {
            int n = Convert.ToInt32(Console.ReadLine());
            long sum = 0;
            for (int i = 1; i <= n; i++)
            {
                if (i % 3 != 0 && i % 5 != 0)
                {
                    sum += i;
                }
            }
            Console.WriteLine(sum);
        }

        public static void solve_abc162A()
        {
            string s = Console.ReadLine();
            Console.WriteLine(s.Contains("7") ? "Yes" : "No");
        }
    }
}


Measured memory_bytes: 28504
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define str to_string
#define endl "\n"
#define PI 3.141592653589
using namespace std;
using lint = long long;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

//AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC
int main(){
    lint a,b,c;cin>>a>>b>>c;
    c=min(c,a+b+1);
    lint ans=b+c;
    cout<<ans<<endl;
}


Measured memory_bytes: 3552
/*
Mangal bhavan amangal haari
Drabahu su Dasharath achar Bihari
Raam Siya Raam Siya Raam jai jai Raam
Raam Siya Raam Siya Raam jai jai Raam
Ho hoi hai wohi jo Raam rachi raakha
Ko kari tarak badhave saakha
Raam Siya Raam Siya Raam jai jai Raam
Ho dheeraj dharam mitra aru naari
Aapad kaal parakhiye chaari
Ho jehike jehi par satya sanehu
So tehi milay na kachhu sandehu
Ho jaaki rahi bhawana jaisi
Prabhu murati dekhi tin taisi
Ho Raghukul reet sada chali aayi
Praan jaaye par vachan na jaayi
Raam Siya Raam Siya Raam jai jai Raam, Raam
Raam Siya Raam Siya Raam jai jai Raam
Ho hari anant hari katha ananta
Kahahi sunahi bahuvidhi sab santa
Raam Siya Raam Siya Raam jai jai Raam, Raam
Raam Siya Raam Siya Raam jai jai Raam
Raam Siya Raam Siya Raam jai jai Raam
*/


#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
//auto->.
//map<int,int>::iterator i
vector<int> sieve(int n) 
{ 

    vector<bool> prime(n+1,true); 
       
    prime[0] = false; 
    prime[1] = false; 
    int m = sqrt(n); 
   vector<int> ans;

    for (int p=2; p<=m; p++) 
    { 
    
        if (prime[p]) 
        { 
         
            for (int i=p*2; i<=n; i += p) 
            prime[i] = false; 
        } 
    }  
    //vector<int> ans; 
    for (int i=0;i<n;i++) 
        if (prime[i]) 
            ans.push_back(i); 
    return ans; 
}

int gcd(int a,int b)
{
	if(b==0) return a;
	return gcd(b,a%b);
}
int mod = 1e9 + 7;
int power(int a , ll b)
{
	int res = 1;
	while(b)
	{
		if(b & 1)
			res = 1LL * res * a ;//% mod;
		a = 1LL * a * a ;//% mod;
		b >>= 1;
	}
	return res;
}
bool sortbysec(const pair<int,int> &a, 
              const pair<int,int> &b) 
{ 
    return (a.second < b.second); 
}
ll min(int a,ll b)
{
	if(a>b)
	return b;
	return a;
}
ll max(int a,ll b)
{
	if(a>b)
	return a;
	return b;
}
ll myXOR(ll x, ll y) 
{ 
   return (x | y) & (~x | ~y); 
}
int conti(int x)
{
	if(x<1)
	return 0;
	if(x%4==0)
	return x;
	if(x%4==1)
	return 1;
	if(x%4==2)
	return x+1;
	if(x%4==3)
	return 0;
}
 
bool ispfsq(long double x) 
{   
  // Find floating point value of  
  // square root of x. 
  long double sr = sqrt(x); 
  
  // If square root is        an integer 
  return ((sr - floor(sr)) == 0); 
}
#define PI 3.141592653589793


vector<int > adj[200005];
bool visited[2005][2005];
int ch[100005],dep[100005];
void solve()
{
int n;
cin>>n;
int ac=0,wa=0,tle=0,re=0;
for(int i=0;i<n;i++)
{
	string a;
	cin>>a;
	if(a=="AC")
	ac++;
	if(a=="WA")
	wa++;
	if(a=="TLE")
	tle++;
	if(a=="RE")
	re++;
}
cout<<"AC x "<<ac<<"\n";
cout<<"WA x "<<wa<<"\n";
cout<<"TLE x "<<tle<<"\n";
cout<<"RE x "<<re<<"\n";

}

int main()
{
	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
int mul=0;
if(mul==1)
{
 int t;
    cin>>t;
   while(t--)
    {
		solve();
	cout<<"\n";
    }
    
}
else
{
//	fun();
	solve();
}
}

Measured memory_bytes: 8368
// A.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>

using namespace std;

int main(int argc, char *argv[]) {
	int a[4];
	cin >> a[0] >> a[1];
	a[2] = a[0] - 1, a[3] = a[1] - 1;
	sort(a, a + 4);
	int ans = a[2] + a[3];
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
import copy
import collections

N = int(input())
A = list(map(int, input().split()))

gain = sum([max(a, 0) for a in A])

# Flow network
S, T = 0, N + 1
c = [{} for i in range(N + 2)]
for i in range(N):
    ix = i + 1
    if A[i] <= 0:
        c[S][ix] = -A[i]
    else:
        c[ix][T] = A[i]

    for j in range(2 * ix, N + 1, ix):
        c[ix][j] = 10e15

# Residual network
r = copy.deepcopy(c)

# Edmonds-Karp algorithm
max_flow = 0
while True:
    # Find path to T
    q, s, p = collections.deque(), {S}, None
    q.append((S,))
    findPath = False
    while not len(q) == 0 and not findPath:
        cand_path = q.popleft()
        for to, path in r[cand_path[-1]].items():
            if path == 0:
                continue
            elif to == T:
                p = cand_path + (to,)
                findPath = True
            elif not to in s:
                q.append(cand_path + (to,))
                s.add(to)

    if not findPath:
        break

    # Minimum flow
    min_flow = min([r[p[i]][p[i + 1]] for i in range(len(p) - 1)])
    max_flow += min_flow
    for i in range(len(p) - 1):
        r[p[i]][p[i + 1]] -= min_flow
        if p[i] in r[p[i + 1]]:
            r[p[i + 1]][p[i]] += min_flow
        else:
            r[p[i + 1]][p[i]] = min_flow

print(gain - max_flow)


Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
 
typedef long long int ll;
#define rep(i, n) for(int i=0;i<(n);i++)
#define all(v) v.begin(), v.end()
#define MOD 1e7
const long long INF = 1LL<<60;

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

    int t, x, n, y;
    cin>>n>>x>>t;
    if(n%x != 0)  
        y = (n/x)+1;
    else 
        y = (n/x);
    cout<<(y*t);
    return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long N;
    cin>>N;
    map<int,int>mp;
    long long i=2;
  
    if(N==1){
      cout<<0<<endl;
      return 0;
    }
    int ans=0;
    while(N!=1){
        if(N%i==0){
            N=N/i;
            mp[i]++;
            continue;
        }
        i++;
        if(i>1000000){
            ans++;
            break;
        }
    }

    for(auto e:mp){
        if(e.second<3){
            ans++;
        }
        else if (e.second<6){
            ans=ans+2;
        }
        else if(e.second<10){
            ans=ans+3;
        }
        else if(e.second<15){
            ans=ans+4;
        }
        else if(e.second<21){
            ans=ans+5;
        }        
        else if(e.second<28){
            ans=ans+6;
        }     
        else if(e.second<36){
            ans=ans+7;
        }     
        else if(e.second<45){
            ans=ans+8;
        }
    }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3620
#include <stdio.h>
#include <string.h>

int main(){
  char s[4];  scanf("%s", s);
  if(s[strlen(s)-1] == '3'){
    printf("bon\n");
  }else if(s[strlen(s)-1]=='0' || s[strlen(s)-1]=='1' || s[strlen(s)-1]=='6' || s[strlen(s)-1]=='8'){
    printf("pon\n");
  }else{
    printf("hon\n");
  }
  return 0;
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    int count=0,i,n;
    cin>>s;
       for(i=0;i<s.length();i=i+2)
    {
        if(!(s[i]=='h' && s[i+1]=='i'))
        {
            count++;
            break;
        }
    }
    if(count==0)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<numeric>
#include<set>
#include<map>
#include<list>
#include<valarray>
#define ll long long 
#define d double
using namespace std;

ll fre[26];
int main()
{
	ll w;
	cin >> w;
	string x,z="";
	cin >> x;
	for (int i = 0; i < x.length(); i++)
	{
		if (i < w)
		{
			z += x[i];
		}
	}
	if(x.length()==z.length())
	cout << z << endl;
	else
	{
		z += "...";
		cout << z << endl;
	}

}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5+10;
typedef long long ll;
ll n, a[maxn];
ll f(ll x){
	ll sum = 0;
	for(int i=1;i<=n;i++)
		sum += abs(a[i]-(x+i));
	return sum;
}
int main() {
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	ll l = -1e9, r = 1e9, ans = -1;
	while(l < r-1){
		ll mid = (l+r)>>1;
		ll mmid = (r+mid)>>1;
		if(f(mid) < f(mmid)) r = mmid;
		else l = mid;
	}
	ans = f(l) > f(r)? r:l;
	cout<<f(ans)<<endl;
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#define INF 2000000000
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
#define ll long long
#define PL pair<long long, long long>
#define P pair<int,int>
#define mk make_pair
#define en endl;
#define WHITE 0
#define BLACK 2
#define GRAY 1
#define RE return 0;

#define MAX_R 15
#define MAX_C 10005

#define MAX 55556

bool is_prime[MAX];
int prime[MAX];

int main(){
  int n;
  cin>>n;
  int p=0;
  for(int i=0; i<MAX; i++){
    is_prime[i]=true;
  }
  
  is_prime[0]=is_prime[1]=false;
  for(int i=2; i<=MAX; i++){
    if(is_prime[i]){
      for(int j=2*i; j<=MAX; j+=i) is_prime[j]=false;
      int pri=i;
      bool ok=true;
      for(int j=0; j<5556; j++){
        pri-=10;
        if(pri==7) {
          ok=false;
          break;
        }
      }
      if(ok) continue;
      prime[p++]=i;
      if(p==n) break;
    }
  }
  
  int sum=0;
  for(int i=0; i<n; i++){
    cout<<prime[i]<<' ';
  }
  cout<<en
  
  RE
}

Measured memory_bytes: 256
N,K=map(int,input().split())
h=[int(input()) for i in range(N)]
h.sort()
mindif=h[K-1]-h[0]
for i in range(N-K+1):
    dif=h[i+K-1]-h[i]
    if mindif>dif:
        mindif=dif
print(mindif)

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

int main(void)
{
    long long N;
    cin >> N;
    vector<char> c(N);
    long long countR = 0;
    for (int i = 0; i < N; i++)
    {
        cin >> c[i];

        if(c[i] == 'R') countR++;
    }

    if(countR == 0 || countR == N)
    {
        cout << 0 << endl;
        return 0;
    }
    
    long long leftR = 0;
    for (int i = 0; i < countR; i++)
    {
        if(c[i] == 'R') leftR++;
    }
    
    cout << countR - leftR << endl;
}

Measured memory_bytes: 3624
// Problem : D - Redistribution
// Contest : AtCoder - AtCoder Beginner Contest 178
// URL : https://atcoder.jp/contests/abc178/tasks/abc178_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
ordered_set;	

#define FOR(i,a,b) for(int i = (a); i <= (b); ++i)
#define FORD(i,a,b) for(int i = (a); i >= (b); --i)
#define RI(i,n) FOR(i,1,(n))
#define REP(i,n) FOR(i,0,(n)-1)
#define mini(a,b) a=min(a,b)
#define maxi(a,b) a=max(a,b)
#define pb push_back
#define st first
#define nd second
#define sz(w) (int) w.size()
typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<pii, int> para;
const ll inf = 1e18 + 7;
const ll maxN = 2e3 + 5;
const ll MOD = 1e9 + 7;

ll dp[maxN], s;

ll solve(ll sum) {
	// cout << sum << endl;
	if (sum == 0) return 1;
	if (sum < 3) return 0;
	if (dp[sum] != -1) return dp[sum];
	ll ans = 0;
	FOR(i, 3, sum) {
		// cout << "call " << sum << " " << i << endl;
		ans += solve(sum - i);
		// cout << "after call " << sum << " " << i << " " << ans << endl;
		ans %= MOD;
	}
	dp[sum] = ans;
	// cout << sum << " " << ans << endl;
	return ans;
}
// sprawdz MODULO!
int main() {
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cin >> s;
	REP(i, s + 2) dp[i] = -1;
	cout << solve(s);
	return 0;
}
 


Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define boost ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define M 1000000007
#define eb emplace_back

using namespace std;
const int N = 1e6;

int32_t main(){
  boost;
  int t = 1; //cin >> t;
  while(t--)
  {
    char c; cin >> c;
    cout << char(c + 1)<<endl;
  }
  return 0;
}
 

Measured memory_bytes: 256
import math

A, B, H, M = map(int, input().split())

radH = 360 * H / 12 + 30 * M / 60
radM = 360 * M / 60 

if radH > radM:
  rad = radH - radM
else:
  rad = radM - radH


cosC =  math.cos(math.radians(rad))

S = A*A + B*B - 2*A*B*cosC

print(math.sqrt(S))

Measured memory_bytes: 9308
#include <bits/stdc++.h> 
using namespace std;
#define rep(i, N) for(int i=0; i<N; i++)
typedef long long ll;
int main() {
    int a, b, c; cin >> a >> b >> c;
    if(a<b) swap(a,b);
    if(a<c) swap(a,c);
    if(b<c) swap(b,c);

    if(3*a%2==(a+b+c)%2){
        cout << (2*a - b - c)/2 << endl;
    }
    else{
        cout << (2*a + 3 - b - c)/2 << endl; 
    }

   return 0;
}

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

using namespace std;

typedef long long int lli;

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

#ifdef LOCAL
	#define eprintf(...) printf(__VA_ARGS__)
#else 
	#define eprintf(...) 1
#endif

#define ROUNDUP(a, b) 		( ((a) + ((b) - 1) ) / b)
#define SET_ZERO(a)	 		( memset((a), 0, sizeof(a)))
#define SET_NUM_ARRAY(a,b)	( memset((a), b, sizeof(a)))

const int nmax = 3*1000*100;

int main() {
	int N;
	char str[nmax + 1];
	scanf("%d", &N);
	scanf("%s", str);

	int esum[nmax], wsum[nmax];
	SET_ZERO(esum);SET_ZERO(wsum);
	if (str[0] == 'W') esum[0] = 1;
	if (str[N-1] == 'E') wsum[N-1] = 1;
	for (int i = 1; i < N; i++) {
		esum[i] = esum[i-1] + (str[i]=='W'?1:0);
		eprintf("esum[%d]=%d\n", i, esum[i]);
	}
	for (int i = N - 2; i >= 0; i--) {
		wsum[i] = wsum[i+1] + (str[i]=='E'?1:0);
		eprintf("wsum[%d]=%d\n", i, wsum[i]);
	}

	int min = wsum[1];
	for (int i = 1; i < N-1; i++) {
		eprintf("min=%d\n", min);
		int tmp = esum[i-1] + wsum[i+1];
		if ( min > tmp ) min = tmp;
	}
	eprintf("min=%d\n", min);
	if ( min > esum[N-2] ) min = esum[N-2];
	eprintf("min=%d\n", min);

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

		


Measured memory_bytes: 2944
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		InputReader r = new InputReader(System.in);
		int n = r.nextInt();
		int k = r.nextInt();
		boolean[] can = new boolean[10];
		for (int i = 0; i < k; i++) {
			can[r.nextInt()] = true;
		}
		for (int res = n;; res++) {
			int x = res;
			boolean win = true;
			while (x > 0) {
				int dig = x % 10;
				x /= 10;
				if (can[dig]) {
					win = false;
				}
			}
			if (win) {
				System.out.println(res);
				return;
			}
		}
	}

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

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

		public InputReader(FileReader stream) {
			reader = new BufferedReader(stream);
			tokenizer = null;
		}

		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return 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());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}
	}
}


Measured memory_bytes: 8020
k = int(input())
aa = input().split()
aaa = aa[0]
bbb = aa[1]
a = int(aaa)
b = int(bbb)
l = 0
for i in range(a,b+1):
    if i % k == 0:
        print("OK")
        l = 1
        break
    else:
        continue
if l == 1:
    pass
else:
    print("NG")

Measured memory_bytes: 9192
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <string>
#include <stdlib.h>

using namespace std;

int main()
{
	string s;
	int i=0, price=700;

	cin>>s;

	while(s[i]!='\0')
	{
		if (s[i]=='o')
		{
			price+=100;
		}
		i++;
	}

	cout<<price<<endl;

	return 0;
}


Measured memory_bytes: 256
"use strict";

function main(input) {
  let pass_friend_num = parseInt(input.split("\n")[0].split(" ")[0]);
  const pass_height = parseInt(input.split("\n")[0].split(" ")[1]);

  const friend_height_data = input.split("\n")[1].split(" ");

  for (let i = 0; i < friend_height_data.length; i++) {
    if (pass_height > parseInt(friend_height_data[i])) {
      pass_friend_num--;
    }
  }

  console.log(pass_friend_num);
}

main(require("fs").readFileSync("/dev/stdin", "UTF-8"));


Measured memory_bytes: 16588
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));
var mod = 1e9+7;

console.log(main());
function main(){
  var n = o.a();
  var dp = Array(n+1).fill(0).map(a=>Array(4).fill(0).map(a=>Array(4).fill(0).map(a=>Array(4).fill(0))));
  for(var i = 1; i < 4; i++){
    for(var j = 0; j < 4; j++){
      for(var k = 0; k < 4; k++){
        for(var l = 0; l < 4; l++){
          if(j === 0 && k === 1 & l === 2)continue;
          if(j === 0 && k === 2 & l === 1)continue;
          if(j === 1 && k === 0 & l === 2)continue;
          dp[i][j][k][l] = 1;
        }
      }
    }
  }
  for(var i = 4; i <= n; i++){
    for(var j = 0; j < 4; j++){
      for(var k = 0; k < 4; k++){
        for(var l = 0; l < 4; l++){
          for(var m = 0; m < 4; m++){
            if(k === 0 && l === 1 & m === 2)continue;
            if(k === 0 && l === 2 & m === 1)continue;
            if(k === 1 && l === 0 & m === 2)continue;
            if(j === 0 && l === 1 & m === 2)continue;
            if(j === 0 && k === 1 & m === 2)continue;
            dp[i][k][l][m] += dp[i-1][j][k][l];
            dp[i][k][l][m] %= mod;
          }
        }
      }
    }
  }
  var ans = 0;
  for(i = 0; i < 4; i++)for(j = 0; j < 4; j++)for(k = 0; k < 4; k++){
    ans += dp[n][i][j][k];
  }
  return ans % mod;
}

Measured memory_bytes: 7984
import java.util.Scanner;

// m_solutions2020_a
public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int K = sc.nextInt();

		boolean result = recursion(A, B, C, K);

		if (result) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		sc.close();
	}

	private static boolean recursion(int red, int green, int blue, int K) {

		if (K == -1) {
			return false;
		}

		if (red < green && green < blue) {
			return true;
		}

		boolean bl1 = recursion(red * 2, green, blue, K - 1);
		boolean bl2 = recursion(red, green * 2, blue, K - 1);
		boolean bl3 = recursion(red, green, blue * 2, K - 1);

		return bl1 || bl2 || bl3;
	}
}


Measured memory_bytes: 35532
q, h, s, d = map(int, input().split())
n = int(input())
ans = []
ans.append((n//0.25)*q)
ans.append((n//0.5)*h)
ans.append((n//1)*s)
if n % 2 != 0:
    ans.append((n//2)*d+min(q*4, h*2, s))
else:
    ans.append((n//2)*d)
print(int(min(ans)))

Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;string s;int i=0;int main(){getline(cin,s); while(i<s.length()){if(s[i]!='0'&&s[i]!='1') {if(i>0) s.erase(i-1,2),i--;else s.erase(i,1);}else i++;}cout<<s<<endl;return 0;}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#ifdef _DEBUG
  #include "_DEBUG.hpp"
#endif
#define int long long
const int INF = 1LL << 60;

signed main(){

  char c; cin >> c;

  if(c > 'Z'){
    cout << 'a' << endl;
  }else{
    cout << 'A' << endl;
  }

  return 0;
}

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

 int main()
     {
  long long a,b,c;
  cin>>a>>b>>c;
   if(a==b&&a==c&&c==b)
    cout<<1;
   else if(a==b&&a!=c&&c!=b)
      cout<<2;
   else if(a!=b&&b==c&&c!=a)
    cout<<2;
   else if(a!=b&&a==c&&c!=b)
    cout<<2;
   else if(a!=b&&b!=a&&a!=c)
    cout<<3;
   return 0;
     }


Measured memory_bytes: 3620
#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<cstring>
using namespace std;
int a,b,c,d,e;
int ta,tb,tc,td,te;
int maxx = 10;
int ans;
int main()
{
  cin>>a>>b>>c>>d>>e;
  ta = a/10 + (a%10 != 0?1:0);
  tb = b/10 + (b%10 != 0?1:0);
  tc = c/10 + (c%10 != 0?1:0);
  td = d/10 + (d%10 != 0?1:0);
  te = e/10 + (e%10 != 0?1:0);
  maxx = max((10-a%10)%10,(10-b%10)%10);
  maxx = max(maxx,(10-c%10)%10);
  maxx = max(maxx,(10-d%10)%10);
  maxx = max(maxx,(10-e%10)%10);
  ans = ta*10+tb*10+tc*10+td*10+te*10-maxx;
  cout<<ans<<endl;
  return 0;
}


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

signed main(){
  int N;
  cin >> N;
  int a = 1, b = 1;
  for ( int i = 0; i < N; i++ ) {
    int c, d;
    cin >> c >> d;
    if ( c >= a && d >= b ) {
      a = c;
      b = d;      
    }
    int ca = 1, db = 1;    
    if ( c <= a ) ca = (a-1)/c+1;
    if ( d <= b ) db = (b-1)/d+1;
    int e = max(ca, db);
    a = c*e;    
    b = d*e;
    // cout << a << " " << b << endl;
  }

  cout << a+b << endl;  
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
  long long n,a[100001],i,b[100001];
  scanf("%lld",&n);
  for(i=1;i<=n;i++){
    scanf("%lld",&a[i]);
    b[a[i]]=i;
  }
  for(i=1;i<=n;i++){
    printf("%lld ",b[i]);
  }
  return 0;
}


Measured memory_bytes: 2304
#include <stdio.h>
#define N 1000000
int a[N+1][3];
int dp[N+1][3];

int min(int a, int b){
  if(b>a)return a;
  else return b;
}
int max(int a, int b){
  if(a>b)return a;
  else return b;
}
int abs(int a){
  if(a<0)return -1*a;
  else return a;
}
int main(){
   int i,j,n;
   scanf("%d", &n);
   for(i=0;i<n;i++)scanf("%d %d %d", &a[i][0], &a[i][1], &a[i][2]);
   //dp[i][j]:i日目にa[i][j](0≦j≦2)で遊んだ時の幸福度の最大値
   dp[0][0]=a[0][0],dp[0][1]=a[0][1], dp[0][2]=a[0][2];
   for(i=1;i<n;i++){
     for(j=0;j<3;j++){
       if(j==0)dp[i][j]=max(dp[i-1][1]+a[i][j], dp[i-1][2]+a[i][j]);
       else if(j==1)dp[i][j]=max(dp[i-1][0]+a[i][j], dp[i-1][2]+a[i][j]);
       else dp[i][j]=max(dp[i-1][0]+a[i][j], dp[i-1][1]+a[i][j]);
     }
   }

   printf("%d\n", max(max(dp[n-1][0], dp[n-1][1]), dp[n-1][2]));

   return 0;
 }


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
#define REPi(i, a, b) for(int i=int(a); i<int(b); i++)
#define MEMS(a,b) memset(a,b,sizeof(a))
#define mp make_pair
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; }
const ll MOD = 1e9+7;

vector<ll> G[100100];
ll H[100100];
ll N, M;
bool isvisit[100100];
ll X[100100];


int main(){
    cin >> N >> M;
    REP(i,N){
        ll h;
        cin >> h;
        H[i] = h;
        X[i] = -1;
    }
    REP(i,M){
        ll a, b;
        cin >> a >> b;
        a--, b--;
        chmax(X[a], H[b]);
        chmax(X[b], H[a]);
    }

    ll ans = 0;
    REP(i,N){
        if(H[i] > X[i])
            ans ++;
    }

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


Measured memory_bytes: 7516
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
ld PI = 4*atan(1);
typedef pair<ll,ll> pl;
vector<pl> wa;
int main() {
	ios::sync_with_stdio(0);cin.tie(0);
	cout.precision(20);
	ll xa,ya,xb,yb;
	cin >> xa >> ya >> xb >> yb;
	ll n;
	cin >> n;
	for(int i=0;i<n;i++) {
		ll a,b;
		cin >> a >> b;
		wa.push_back({a,b});
	}
	if(xa > xb) {
		xa *= -1;xb *= -1;
		for(int i=0;i<n;i++) {
			wa[i].first *= -1;
		}
	}
	if(ya > yb) {
		ya *= -1;yb *= -1;
		for(int i=0;i<n;i++) {
			wa[i].second *= -1;
		}
	}
	sort(wa.begin(),wa.end());
	vector<ll> lis;
	for(int i=0;i<n;i++) {
		if(wa[i].first >= xa && wa[i].first <= xb) {
			if(wa[i].second >= ya && wa[i].second <= yb) {
				ll va = wa[i].second;
				ll id = lower_bound(lis.begin(),lis.end(),va)-lis.begin();
				if(id == lis.size()) {
					lis.push_back(va);
				} else {
					lis[id] = va;
				}
			}
		}
	}
	ld res = 100*(abs(ya-yb)+abs(xa-xb));
	res += lis.size()*(PI*5.-20.);
	ll bop = min(abs(ya-yb),abs(xa-xb))+1;
	if(lis.size() == bop) {
		res += PI*5.;
	}
	cout << res << '\n';
}


Measured memory_bytes: 9988