akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>

using namespace std;

#define fst first
#define scd second
#define PB push_back
#define MP make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define omajinai ios::sync_with_stdio(false);cin.tie(0)
#define rep(i,x) for(int i=0;i<(int)(x);++i)
#define rep1(i,x) for(int i=1;i<=(int)(x);++i)
#define rrep(i,x) for(int i=(int)x-1;i>=0;--i)
#define rrep1(i,x) for(int i=(int)x;i>=1;--i)

using ll=long long;
using ld=long double;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int, int>;
using vpii=vector<pii>;

template<class T,class U>ostream&operator<<(ostream&os,const pair<T,U>p){os<<"("<<p.fst<<", "<<p.scd<<")";return os;}
template<class T>ostream&operator<<(ostream&os,const vector<T>v){rep(i,v.size()){if(i)os<<", ";os<<v[i];}return os;}
template<typename T>T&max(T&a,T&b){if(a>=b)return a;return b;}
template<typename T>T&min(T&a,T&b){if(a < b)return a;return b;}
template<typename T>bool chmax(T&a,T b){if(a < b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a > b){a=b;return true;}return false;}
constexpr ll TEN(ll n){return n==0?1:10ll*TEN(n-1);}

constexpr ll inf = TEN(9)+5;
constexpr ll linf = 3*TEN(18);

signed main()
{
    int N, K; cin >> N >> K;
    N -= K;
    cout << 1 + (N + K - 2) / (K - 1) << endl;
}


Measured memory_bytes: 3560
N = int(input())
#0:金額 1:種類
Money = [[] for _ in range(N)]
for i in range(N):
    Money[i] = input().split()

cnt = 0
for i in range(N):
    if Money[i][1] == "JPY":
        cnt += int(Money[i][0])
    else:
        cnt += float(Money[i][0]) * 380000.0

print(cnt)

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

#define ll long long

using namespace std;

ll n, x;
ll ans = 0;

main() {
	cin >> n >> x;
	if (x * 2 >= n) x = n - x;
	ans = n;
	n -= x;
	while (x) {
		ans += (2 * x * (n / x));
		ll temp = x;
		if (n % x == 0) ans -= x;
		x = n % x;
		n = temp;
	}
	cout << ans;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  int n;
  ll ans=0;
    cin >> n;
    ll a[200000]={0}, cnt[200000]={0};
    for(ll i=0; i<n; i++){
      cin >> a[i];
      ans += cnt[a[i]];
      cnt[a[i]]++;
    }
    for(int i=0; i<n; i++)
      cout << ans-(cnt[a[i]]-1) << endl;

}

Measured memory_bytes: 5760
S=input()
check=["dream","dreamer","erase","eraser"]
S=S[::-1]
for i in range(len(check)):
  check[i]=check[i][::-1]
nagasa=len(S)
cur=0
while cur<nagasa:
  flag=False
  for x in check:
    find_pos=S.find(x,cur)
    if cur==find_pos:
      flag=True
      cur=find_pos+len(x)
      break
  if flag==False:
    print("NO")
    exit()
print("YES")


Measured memory_bytes: 9132
#include<iostream>
#include<map>
#include<algorithm>
#include<vector>

using namespace std;
typedef pair<int, int> P;

int N, M, r, q;
map<P, vector<P>> MAP;

int main() {
	while (1) {
		cin >> N >> M;
		if (N + M == 0)break;
		cin >> r;
		for (int i = 0; i < r; i++) {
			int t, n, m, s;
			cin >> t >> n >> m >> s;
			MAP[make_pair(n, m)].push_back(make_pair(t, s));
		}

		cin >> q;

		for (int i = 0; i < q; i++) {
			bool timetable[1261] = {};
			int ts, te, m;
			cin >> ts >> te >> m;
			int ans = 0;
			int ct = 0;
			int tmp = 0;

			for (int i = 0; i < N; i++) {
				for (int k = 0; k < MAP[make_pair(i + 1, m)].size(); k += 2) {
					int start = MAP[make_pair(i + 1, m)][k].first;
					int end = MAP[make_pair(i + 1, m)][k + 1].first;
					for (int l = start; l <= end; l++) {
						timetable[l] = true;
					}
				}
			}

			for (int j = ts; j <= te; j++) {
				if (timetable[j]) {
					tmp++;
				}
				else
				{
					ans += (tmp - 1 > 0 ? tmp - 1 : 0);
					tmp = 0;
				}
			}
			ans += (tmp - 1 > 0 ? tmp - 1 : 0);
			cout << ans << endl;
		}
		MAP.clear();
	}
	return 0;
}


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

int main() {
    int n, x;
    cin >> n >> x;
    int m[n];
    int sum = 0;
    for (int i = 0; i < n; i++) {
        cin >> m[i];
        sum += m[i];
    }

    sort(m, m+n);
    cout << n + (x-sum)/m[0] << endl;
}

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

using namespace std;

int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  if (N % 2 == 1) {
    cout << "No";
    return 0;
  }

  for (int i = 0; i < N / 2; i++) {
    if (S[i] != S[N / 2 + i]) {
      cout << "No";
      return 0;
    }
  }

  cout << "Yes";

  return 0;
}


Measured memory_bytes: 256
a = [int(x) for x in input()]
n = len(a)

sum_val = 0
for i in range(1 << (n - 1)):
    tmp_val = a[0]
    for j in range(n - 1):
        if (i >> j) & 1:
            sum_val += tmp_val
            tmp_val = a[j + 1]
        else:
            tmp_val = tmp_val * 10 + a[j + 1]
    sum_val += tmp_val
print(sum_val)

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

using namespace std;

int main(void) {
  string s, t;
  cin >> s >> t;

  for(int i = 0; i < s.length(); i++) {
    s.push_back(s[0]);
    s.erase(s.begin());
    if(s == t) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 256
n = gets.chomp.to_i
TH = Math::PI * 60.0 / 180.0

class Point
  attr_accessor :x, :y

  def initialize(x = 0.0, y = 0.0)
    @x = x.to_f
    @y = y.to_f
  end

  def one_third(p1, p2)
    self.x = (2.0 * p1.x + 1.0 * p2.x) / 3.0
    self.y = (2.0 * p1.y + 1.0 * p2.y) / 3.0
    return self
  end

  def two_third(p1, p2)
    self.x = (1.0 * p1.x + 2.0 * p2.x) / 3.0
    self.y = (1.0 * p1.y + 2.0 * p2.y) / 3.0
    return self
  end

  def apex(p1, p2)
    self.x = (p2.x - p1.x) * Math.cos(TH) - (p2.y - p1.y) * Math.sin(TH) + p1.x
    self.y = (p2.x - p1.x) * Math.sin(TH) + (p2.y - p1.y) * Math.cos(TH) + p1.y
    return self
  end

  def inspect
    puts "#{x} #{y}"
  end
end

def koch(time, p1, p2)
  if time == 0
    return
  end

  n = time - 1

  s = Point.new.one_third(p1, p2)
  t = Point.new.two_third(p1, p2)
  u = Point.new.apex(s, t)

  koch(n, p1, s)
  s.inspect
  koch(n, s, u)
  u.inspect
  koch(n, u, t)
  t.inspect
  koch(n, t, p2)
end

a = Point.new(0, 0)
b = Point.new(100, 0)

a.inspect
koch(n, a, b)
b.inspect

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

int main(){
    int n;
    string s;
    cin>>n>>s;
    int ans=0;
    for(int i=0;i<n-1;i++){
        string x=s.substr(0,i+1);
        string y=s.substr(i+1);
        int cnt=0;
        for(char c='a';c<='z';c++){
            for(int j=0;j<x.length();j++){
                if(x[j]==c){
                    for(int k=0;k<y.length();k++){
                        if(y[k]==c){
                            cnt++;
                            break;
                        }
                    }
                    break;
                }
            }
        }
        ans=max(ans,cnt);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define boost ios_base::sync_with_stdio(false);	cin.tie(0);	cout.tie(0)
#define vi vector<int>
#define P push_back
#define F first
#define S second
#define debug(x) cout<<x<<" "
#define pi vector<pair<int,int> >
#define FOR(i,x,n) for(int i=x;i<n;i++)
using namespace std;
int main(){
    boost;
    string s;
  	cin>>s;
  	for(int i=1;i<4;i++){
      if(s[i]==s[i-1]){cout<<"Bad";return 0;}
    }
  	cout<<"Good";

    return 0;
}


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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define ll long long
#define P pair<ll,ll>
const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1);

int main(void)
{
    ll n; cin>>n;
    vector<ll> s(1e6,0);
    rep(i,n){
        ll a,b; cin>>a>>b;
        s[--a]++;
        s[b]--;
    }
    ll ans=0;
    for(ll i=1;i<=n;++i){
        s[i]+=s[i-1];
        if(i<=s[i]) ans=i;
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 10736
#include <bits/stdc++.h>
#define DAU  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define PLEC exit(0);
using namespace std;
vector<int> v;
int x, y, res(2019);
int main() {
    DAU
    cin >> x >> y;
    for (int i = x; i <= min(x + 2020, y); ++i)
        v.emplace_back(i % 2019);
    sort(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()), v.end());
    for (size_t i = 0; i < v.size(); ++i)
        for (size_t j = i + 1; j < v.size(); ++j)
            res = min(res, (v[i] * v[j]) % 2019);
    cout << res;
    PLEC
}


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

#define all(v) v.begin(), v.end()
typedef long long ll;

int main() {
    int n, k; cin >> n >> k;
    ll ans = k;
    for(int i = 1; i < n; i++){
        ans *= (k - 1);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <list>
#include <deque>
#include <set>
#include <map>
#include <queue>
#include <bitset>

using namespace std;

int mod = 998244353;
long long mod_adjust(long long a) {//	余りをとる(0～mod-1に調整する)
	if (a > mod) {
		return a % mod;
	}
	if (a < 0) {
		a *= -1;
		a %= mod;
		return mod - a;
	}
	return a;
}
int mod_add(int a, int b) {//	足し算
	long long k = mod_adjust((long long)a); k += mod_adjust((long long)b);
	k = mod_adjust(k);
	return (int)k;
}
int mod_sub(int a, int b) {//	引き算
	return mod_add(a, -b);
}
int mod_multi(int a, int b) {//	掛け算
	long long k = mod_adjust((long long)a);
	k *= mod_adjust((long long)b);
	k = mod_adjust(k);
	return (int)k;
}
int mod_inv(int a) {//	逆元
	long long k = (int)mod_adjust((long long)a);
	if (k == 0) { return 0; }
	if (k == 1) { return 1; }
	long long p = mod, q = k, m = 0, n = 1, r, c;

	while (q > 1) {
		r = p % q;
		c = p / q;
		c = mod_adjust(m - n * c);
		p = q, m = n, q = r, n = c;
	}
	return (int)mod_adjust(n);
}
int mod_div(int a, int b) {//	割り算
	return mod_multi(a, mod_inv(b));
}
int mod_pow(int x, int n) {//	累乗(logNオーダーなので速い)
	x = (int)mod_adjust((long long)x);
	n = n % (mod - 1);
	if (n < 0) {
		return mod_pow(mod_div(1, x), -n);
	}
	if (n == 0) {
		return 1;
	}
	if (n == 1) {
		return (int)mod_adjust((long long)x);
	}
	if (n % 2 == 0) {
		int k = mod_pow(x, n / 2);
		return mod_multi(k, k);
	}
	else {
		int k = mod_pow(x, n / 2);
		return mod_multi(mod_multi(k, k), x);
	}
}

const int V = 1000000;
int main() {
	int* c = new int[V + 1];
	for (int i = 0; i <= V; i++) { c[i] = 0; }

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

	int* w = new int[V+1];
	w[0] = 0;
	for (int i = 1; i <= V; i++) {
		w[i] = mod_inv(i);
	}

	for (int i = 1; i <= V; i++) {
		for (int j = i * 2; j <= V; j += i) {
			w[j] = mod_sub(w[j], w[i]);
		}
	}

	int ans = 0;
	for (int i = 1; i <= V; i++) {
		int sum = 0;
		int sum2 = 0;
		for (int j = i; j <= V; j += i) {
			sum = mod_add(sum, mod_multi(j, c[j]));
			sum2 = mod_add(sum2, mod_multi(mod_multi(j, j), c[j]));
		}
		ans = mod_add(ans, mod_multi(w[i], mod_sub(mod_multi(sum, sum), sum2)));
	}
	ans = mod_div(ans, 2);
	
	cout << ans << endl;

	return 0;
}

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

int main(){
    int n; cin >> n;
    set<string> goods;
    
    for(int idx=0;idx<n;idx++){
        string s; cin >> s;
        if(!goods.count(s)) goods.insert(s);
    }
    cout << goods.size() << endl;
    
    
}

Measured memory_bytes: 19124
#!/usr/bin/env python
# coding: utf-8

def ri():
    return int(input())

def rl():
    return list(input().split())

def rli():
    return list(map(int, input().split()))

def main():
    inf = 1e9
    x = ri()
    n = 0
    nums = dict()
    bef = 0
    while True:
        p = n**5
        if p - bef > 2*inf:
            break
        nums[p] = n
        nums[-p] = -n
        bef = p
        n += 1
    for i in range(n+1):
        p = i**5
        if x+p in nums:
            print(nums[x+p],i)
            return
        if x-p in nums:
            print(nums[x-p],-i)
            return


if __name__ == '__main__':
    main()


Measured memory_bytes: 9152
//author:luckYrat(twitter:@luckYrat_)
//#include <bits/stdc++.h>

//def
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

//array
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <utility>
#include <climits>



using namespace std;

using ll = long long;
using P = pair<ll,ll>;

#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)


#define MAX 1000000000
const int mod = 1000000007;
#define EPS (1e-10)

#define pb push_back
#define fir first
#define scn second
#define ednl endl

#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")


P ar4[4] = {{0,1},{0,-1},{1,0},{-1,0}};
P ar8[8] = {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる
vector.unique()は隣接した同じ要素を削除するので先にソートをする

計算量は変わらないが楽できるシリーズ
C++11以降でmin({a,b,c...})で複数個のmic,maxを処理できる
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる

*/
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}



int main(){
  int h,n;cin>>h>>n;
  for(int i = 0; max(h,n) > i; i++){
    cout << min(h,n);
  }
  cout << endl;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

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

	step := 1
	maxCount := 0
	for i := 0; i < n; i += step {
		count := 0
		for j := i; j < n-1; j++ {
			if list[j] >= list[j+1] {
				count++
			} else {
				break
			}
		}
		if count != 0 {
			step = count
		} else {
			step = 1
		}
		if maxCount < count {
			maxCount = count
		}
	}
	fmt.Println(maxCount)

}


Measured memory_bytes: 5504
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>//sort,reverse
#include<utility>//pair
#include<queue>//queue,priority_queue
#include<deque>//double_ended queue
#include<map>//map
using namespace std;
typedef long long LL; 
typedef pair<LL,LL> P;//Pでpair<-,->を表す。
const LL MAX=2000010;
const LL MOD=1000000007;
typedef map<LL,LL>::iterator Itr;

int main()
{ 
    LL x;
    cin>>x;
    for(LL i=0;i<=120;i++){
        LL k=i*i*i*i*i;
        for(LL j=1;j<=120;j++){
                LL l=j*j*j*j*j;
                if(l-k==x){
                    cout<<j<<' '<<i<<endl;
                    return 0;
                }
                if(l+k==x){
                    cout<<j<<' '<<-i<<endl;
                    return 0;
                }
        }
    }

    cout<<-1<<endl;
    return 0;
}

Measured memory_bytes: 3636
program bbb
implicit none

integer :: s, i, j
integer,dimension(1000000) :: a

read*, s

a=0
a(1)=s

do i=2,1000000
if(mod(a(i-1),2)==0) then
a(i)=a(i-1)/2
else
a(i)=3*a(i-1)+1
end if
 do j=1,i-1
 if(a(i)==a(j)) then
 write(*,'(i0)') i
 return
 end if
 end do
end do

end program

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

int main()
{
	int n;
	cin >> n;
	int a[n];

	REP(i, n)
	{
		cin >> a[i];
	}
	int on = 0;
	int count = 0;
	while (a[on] != 1 && count < n)
	{
		on = a[on] - 1;
		count++;
		if (on == 1)
		{
			cout << count << '\n';
			return (0);
		}
	}
	cout << -1 << '\n';
	return (0);
}


Measured memory_bytes: 4004
import java.util.*;
import java.lang.*;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s[] = new String[n];
        for (int i = 0; i < n; i++) {
            s[i] = sc.next();
        }
        if (Arrays.asList(s).contains("Y")) {
            System.out.println("Four");
        } else {
            System.out.println("Three");
        }
    }
}


Measured memory_bytes: 23764
from heapq import heappush, heappop
N, M = map(int, input().split())
Cs = []
for _ in range(N):
    a, b = map(int, input().split())
    Cs.append((M-a, b))
Cs.sort()
Ds = []
r = 0
for i in range(M):
    j = M - i -1
    while True:
        if not len(Cs):
            break
        if Cs[-1][0] < j:
            break
        heappush(Ds, -Cs.pop()[1])
    if len(Ds):
        s = -heappop(Ds)
        r += s
print(r)


Measured memory_bytes: 69848
#include <iostream>
#include <vector>
#include <math.h>
#include <string.h>
#include <stdio.h>
#include <algorithm>

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> l(n);
    for(int i = 0; i<n; i++){
        cin>>l[i];
    }
    sort(l.begin(), l.end());
    
    int cnt = 0;

    for(int i = 0;i<n;i++){
        for(int j = 0;j<i;j++){
            for(int k = 0; k<j;k++){
                if(l[i] != l[j] and l[j] != l[k] and l[k] + l[j] > l[i]){
                    cnt++;
                }
            }
        }
    }
    cout<<cnt<<endl;
    return 0;
}  


Measured memory_bytes: 3632
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

typedef struct point2d{
  int64 x,y;
} point;

typedef struct line2d{
  point s,t;
} line;

void swap(int64 *a,int64 *b){
  int64 tmp=*a;
  *a=*b;
  *b=tmp;
}

int func(const line *a,const point *b){
  int64 p=a->s.x;
  int64 q=a->s.y;
  int64 r=a->t.x;
  int64 s=a->t.y;
  int64 t=(s-q)*(b->x-p)-(r-p)*(b->y-q);
  return t==0?0:(t>0?1:-1);
}

int isIntersect(const line *a,const line *b){
  int p=func(a,&(b->s));
  int q=func(a,&(b->t));
  int r=func(b,&(a->s));
  int s=func(b,&(a->t));
  if(p==0 && q==0 && r==0 && s==0){//同一直線上に2つの線分有り
    if(a->s.x!=a->t.x){
      int64 p=a->s.x;
      int64 q=a->t.x;
      int64 r=b->s.x;
      int64 s=b->t.x;
      if(p>q) swap(&p,&q);
      if(r>s) swap(&r,&s);
      return !(p>s || r>q);
    } else {
      int64 p=a->s.y;
      int64 q=a->t.y;
      int64 r=b->s.y;
      int64 s=b->t.y;
      if(p>q) swap(&p,&q);
      if(r>s) swap(&r,&s);
      return !(p>s || r>q);
    }
  }
  return p*q<=0 && r*s<=0;
}

void scanfLine(line *a){
  scanf("%lld%lld%lld%lld",&(a->s.x),&(a->s.y),&(a->t.x),&(a->t.y));
  return;
}

void run(void){
  int q;
  scanf("%d",&q);
  while(q--){
    line a,b;
    scanfLine(&a);
    scanfLine(&b);
    int ans=isIntersect(&a,&b);
    printf("%d\n",ans);
  }
  return;
}

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



Measured memory_bytes: 2100
import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		
		Scanner s = new Scanner(System.in);
		String k = s.next();
		int max = 0;
		for(int i=0;i<k.length();i++) {
			int ctr = 0;
			while(i<k.length() && k.charAt(i)=='R') {
				i++;
				ctr++;
			}
			max = Math.max(max,ctr);
			
		}
		System.out.println(max);
		
		
	}
}


Measured memory_bytes: 35600
#include <bits/stdc++.h>  
using namespace std;
using ll = long long int;
using pii = pair<int, int>;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0; i<(int)(n); i++)
using graph = vector<vector<char>>;

int main(){
  string  s;cin>>s;
  bool b=false;
  rep(i,8){
    string t=s.substr(0,i);
    string u=s.substr(s.size()+i-7,7-i);
    if(t+u=="keyence"){b=true;break;}
  }
  if(b)cout<<"YES";
  else{cout<<"NO";}
}





Measured memory_bytes: 256
#include <stdio.h>
int main(void){
	int i=0;
int tmp=0;
	scanf("%d",&i);
	tmp=i%10;
if(tmp==2||tmp==4||tmp==5||tmp==7||tmp==9){
puts("hon");
}else if(tmp==0||tmp==1||tmp==6||tmp==8){
puts("pon");
}else{
puts("bon");
}

}

Measured memory_bytes: 2048
#include<cstdio>
#define maxn 10005
int ans,n,x;
int main(){
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&x);
		while((x&1)==0)ans++,x>>=1;
	}
	printf("%d",ans);
	return 0;
}

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

A = list(map(int, input().split()))
B = list(map(int, input().split()))
A2 = A.copy()

for i in range(n):
    if A[i] > B[i]:
        A[i] = A[i] - B[i]
    else:
        A[i + 1] = max(0, A[i + 1] - (B[i] - A[i]))
        A[i] = 0
        

    #print(A)

ans = 0
for i in range(n + 1):
    ans = ans + (A2[i] - A[i])
    #print(ans)
    
print(ans)


Measured memory_bytes: 18476
def calc(expression):
    stack = []
    for i in expression:
        if i == '+':
            b, a = stack.pop(), stack.pop()
            stack.append(a + b)
            
        elif i == '-':
            b, a = stack.pop(), stack.pop()
            stack.append(a - b)
            
        elif i == '*':
            b, a = stack.pop(), stack.pop()
            stack.append(a * b)
            
        elif i == '/':
            b, a = stack.pop(), stack.pop()
            stack.append(a // b)
            
        else:
            stack.append(int(i))
    
    return stack[0]
n = input().split() 
print(calc(n))


Measured memory_bytes: 5596
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define MOD 1000000007
bool comp( pair<string,pair<int,int> > a,pair<string,pair<int,int> > b)
{
    if(a.first>b.first)
    {
        return false;
    }
    else if(b.first>a.first)
    return true;
    else if(a.second.first>b.second.first)
    return true;
    else return false;
}
int main()
{
    int N;
    cin>>N;
    vector<pair<string,pair<int,int> > >V;
    for(int i=0;i<N;i++)
    {
        string s;
        int P;
        cin>>s>>P;
        V.push_back(make_pair(s,make_pair(P,i)));
    }
    
    sort(V.begin(),V.end(),comp);
    int a[N];
    for(int i=0;i<N;i++)
    {
        cout<<V[i].second.second+1<<endl;
    }
    
    
    
    return 0;

    
}

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

using namespace std;

using ll = long long;
using ld = long double;

const double PI = 3.1415926535897932384626433832795;
const ll MOD = 1000000007;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : abs(x); }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : abs(x); }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

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

	int n;
	cin >> n;

	int ans = n * n * n;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int lld;

const lld mod = 1e9+7;
const lld INF = 1e9;
//const lld MAXN = 1e9;

int main()
{
	int a,b,h;
	cin >> a >> b >> h;

	cout << (a+b) * h / 2 << endl;

	return 0;
}

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

int main() {
  int N;
  cin>>N;
  vector<int> d(N);
  for(int i=0;i<N;i++){
    cin>>d.at(i);
  }
  
  int tower=0;
  int min=0;
  for(int i=0; i<N;i++){
    int count=0;
    int minnow=0;
    for(int j=0;j<N;j++){
      if(d.at(j)>min){
        if(count==0){minnow=d.at(j);}
        else{if(d.at(j)<minnow){minnow=d.at(j);}}
        count++;
      }
    }
    if(minnow!=0){tower++;min=minnow;}
  }
  cout<<tower<<endl;
}

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

#include <algorithm>
#include <cstdio>
using namespace std;

int main() {
  int h, w;

  while(cin >> h >> w) {
    if(h == 0 && w == 0) break;

    for(int i=0; i<h; i++) {
      for(int j=0; j<w; j++) {
        if((i==0 || i==h-1) || (j==0 || j==w-1)) printf("#");
        else printf(".");
      }
      printf("\n");
    }
    printf("\n");
  }
}

Measured memory_bytes: 1112
import java.util.*;

public class Main {

    private static final int[] NS = new int[]{2, 5, 5, 4, 5, 6, 3, 7, 6};

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] A = new int[M];
        for (int m = 0; m < M; m += 1) {
            A[m] = sc.nextInt();
        }

        int[] dp = new int[N + 1];
        dp[0] = 0;
        for (int n = 1; n <= N; n += 1) {
            int next = -1;
            for (int a : A) {
                int prevDP = n - NS[a - 1];
                if (prevDP < 0) {
                    continue;
                }
                int curNext = dp[prevDP] + 1;
                if (next < curNext) {
                    next = curNext;
                }
            }
            dp[n] = next;
        }

        while (N > 0) {
            int curA = 0;
            for (int a : A) {
                int nextDP = N - NS[a - 1];
                if (curA < a && nextDP >= 0) {
                    if (dp[nextDP] == (dp[N] - 1)) {
                        curA = a;
                    }
                }
            }
            N -= NS[curA - 1];
            System.out.print(curA);
        }

    }

}


Measured memory_bytes: 22612
import math
N = int(input())

candidates = [i for i in range(2, 55556)]
primes = []

while len(candidates) > 0:
    if candidates[0] > math.sqrt(55555):
        primes.extend(candidates)
        break
    t = candidates.pop(0)
    tmp = []
    for c in candidates:
        if c % t != 0:
            tmp.append(c)
    candidates = tmp
    primes.append(t)

ans = []
for p in primes:
    if p % 5 == 1:
        ans.append(p)
    if len(ans) == N:
        break

print(*ans)


Measured memory_bytes: 5528
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n");
var m=Arr.shift()-0;
var n=Arr.shift()-0;
var M=[];
var check=[];
for(var i=0;i<m;i++)M[i]=[];
for(var i=0;i<m;i++)check[i]=false;
var obj={};
for(var i=0;i<n;i++){
   var str=Arr.shift();
   obj[str]=true;
   var v=str.split(" ").map(Number);
   M[v[0]-1].push(v[1]-1);
}
var L=[];
for(var i=0;i<m;i++){
   visit(i);
}
function visit(x){
   if(check[x]==true)return;
   else check[x]=true;
   M[x].forEach(function(v){
      visit(v);
   });
   L.push(x);
}
L.reverse();
L=L.map(function(v){return v+1;});
var flag=true;
for(var i=0;i<L.length-1;i++){
   if(obj.hasOwnProperty(L[i]+" "+L[i+1])==false){flag=false;break;}
}
L.forEach(function(v){
   console.log(v);
});
console.log(flag?"0":"1");

Measured memory_bytes: 52112
n=int(input())
h=list(map(int,input().split()))
temp=0
if n==1:
  print("Yes")
else:
  for i in range(0,n):
    if h[i]<temp:
      print("No")
      break
    temp=max(temp,h[i]-1)
  else:
    print("Yes")

Measured memory_bytes: 14396
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
const ll mod=1e9+7;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll a,b;
    cin>>a>>b;
    if((a+b)%2==0){
        cout<<(a+b)/2<<endl;
    }
    else if(a==b){
        cout<<0<<endl;
    }
    else{
        cout<<"IMPOSSIBLE"<<endl;
    }
    return 0;
    }


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
inline int read()
{
	int n=0;bool b=0;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')b=1;c=getchar();}
	while(c>='0'&&c<='9')n=(n<<3)+(n<<1)+(c^48),c=getchar();
	return b?-n:n;
}

int cnt[400100];
int n,ans;

main()
{
	n=read();
	for(int i=1;i<=n;++i)
	{
		int a=read();
		if(i>=a&&i-a<=400001)ans+=cnt[i-a];
		++cnt[min(400010ll,i+a)];
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 6680
import sys

sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, K = map(int, input().split())
T = set()

for _ in range(K):
    d = int(input())
    A = set(map(int, input().split()))
    T |= A

print(N - len(T))


Measured memory_bytes: 9176
#include <stdio.h>
#include<string.h>
int main(void){
	int a,b;
	int x;
	while(1){
		//printf("a=");
		scanf("%d",&a);
		if(a>=1 && a<=499498){
			break;
		}
	}
	while(1){
		//printf("b=");
		scanf("%d",&b);
		if(b>a && b<499500){
			break;
		}
	}
	x = (b-a)*(b-a+1)/2 - b;
	printf("%d",x);
	return 0;
}

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

int main (void){
    int a, b ,c;
    cin >> a >> b >> c;
    if (a + b + c < 22){
        cout << "win" << endl;
    } else {
        cout << "bust" << endl;
    }
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define f first
#define s second
#define pb push_back
#define mk make_pair
#define MOD 1000000007
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
#define boost ios::sync_with_stdio(false); cin.tie(0)
using namespace std;
const int MAX = 1e5 + 5;
int dp[MAX][13];
int main()
{
	boost;
	string s;
	int n, i, j, k;
	cin >> s;
	n = s.length();
	if(s[0] == '?'){
		foe(i, 0, 9)
		dp[1][i] = 1;
	}
	else
	dp[1][s[0] - '0'] = 1;
	
	fo(i, 1, n){
		if(s[i] == '?'){
			fo(j, 0, 13){
				foe(k, 0, 9)
				dp[i + 1][(j * 10 + k) % 13] = (dp[i + 1][(j * 10 + k) % 13] + dp[i][j]) % MOD;
			}
		}
		else{
			int x = s[i] - '0';
			fo(j, 0, 13)
			dp[i + 1][(j * 10 + x) % 13] = (dp[i + 1][(j * 10 + x) % 13] + dp[i][j]) % MOD;
		}
	}
	cout << dp[n][5];
}

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << setprecision(20) << fixed;
  int X;
  cin >> X;
  if(X == 3 || X == 5 || X == 7){
    cout << "YES" <<endl;
  } else{
    cout << "NO" <<endl;
  }
}


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

int main(){
  int n,m,x,a[100];
  cin>>n>>m>>x;
  for(int i=1;i<=m;i++){
    cin>>a[i];
  }
  int left=0;
  for(int i=1;i<=m;i++){
    if(a[i]>=1&&a[i]<=x){
      left++;
    }
  }
  int right=0;
  for(int i=1;i<=m;i++){
    if(a[i]>=x&&a[i]<=n+1){
      right++;
    }
  }
  cout<<min(right,left)<<endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int cnt = 0, max = 0, N;  cin >> N;
    for(int i=0; i<N; ++i){
        int a;  cin >> a;
        if(a >= max){
            cnt++;
            max = a;
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define e1 first
#define e2 second
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define boost ios_base::sync_with_stdio(false)
#define eb emplace_back
#define OUT(x) {cout << x; exit(0); }
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define scanf(...) scanf(__VA_ARGS__)?:0
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair <int, int> PII;
typedef pair <int, int> PLL;
typedef pair <PLL, int> PLLI;
typedef pair <PLL, PLL> PP;
typedef pair <PII, int> PPI;
typedef pair <ll, int> PLI;
typedef pair <ld, ld> PLD;
typedef pair <PLD, ld> PLDD;
typedef pair <PLL, ll> PLLL;
typedef unsigned int ui;
const int inf = 1e9+9;
const int mod = 1e9+7;
const ll MOD = 1e9+696969;
const long long INF = (ll)1e18+3;
int n, m, k, a, b, c, DL = 0, CC = 0, T;
#define maxn 1000100
int t[maxn];
ll wyn = 0;
PII stos[maxn];
ll FIRST[maxn], LAST[maxn];

int main() {
	boost;
	cin >> n;
	FOR(i, 1, n) cin >> t[i];
	stos[0] = {0, 0};
	
	FOR(i, 1, n) {
		while (stos[DL].e1 > t[i]) DL--;
		FIRST[i] = stos[DL].e2;
		stos[++DL] = mp(t[i], i);
	}
	
	DL = 0;
	stos[0] = {0, n+1};
	for (int i=n; i>0; --i) {
		while (stos[DL].e1 > t[i]) DL--;
		LAST[i] = stos[DL].e2;
		stos[++DL] = mp(t[i], i);
	}

	ll wyn = 0;
	FOR(i, 1, n) {
		wyn += (ll)t[i] * (LAST[i] - i) * (i - FIRST[i]);
	}
	cout << wyn;
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
#ifdef __DEBUG__
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const deque<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const set<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int H,W;
vector<string> S;
void input(){
    fast_io();
    cin >> H >> W;
    for (int i = 0; i < H; i++)
    {
        string s; cin >> s;
        S.push_back(s);
    }
}

int solve(){
    vector<vector<int>> ans(H,vector<int>(W,0));
    for (int i = 0; i < H; i++)
    {
        for (int j = 0; j < W; j++)
        {
            if(S[i][j]=='#'){
                ans[i][j] = 10;
                for (int k = 0; k < 8; k++)
                {
                    int x = i+dx[k];
                    int y = j+dy[k];
                    if(x<0 || x>=H) continue;
                    if(y<0 || y>=W) continue;
                    if(S[x][y]=='#') ans[x][y] = 10;
                    else ans[x][y]++;
                }
            }
        }
    }
    for (int i = 0; i < H; i++)
    {
        for (int j = 0; j < W; j++)
        {
            if(ans[i][j]!=10) cout << ans[i][j];
            else cout << "#";
        }
        cout << endl;
        
    }
    
    
    return 0;
}   

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

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

const int N = 1e5 + 5;
int h,w,n,sr,sc;
string s,t;


int main(){
#ifdef LOCAL
    freopen("./input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    cin>>h>>w>>n>>sr>>sc;
    cin>>s>>t;
    
    //up
    int up_to = sr;
    int down_to = sr;
    for (int i = 0; i < n; i++){
        if(s[i] == 'U'){
            up_to --;
            if(up_to ==0){
                cout<<"NO"<<endl;
                return 0;
            }
        }
        if(s[i] == 'D'){
            down_to ++;
            if(down_to == h+1){
                cout<<"NO"<<endl;
                return 0;
            }
        }
        
        if(t[i] == 'D'&& up_to<h){
            up_to ++;
        }
        
        if(t[i]=='U'&& down_to >1){
            down_to --;
        }
    }
    
    int left_to = sc, right_to = sc;
    
    for (int i = 0; i < n; i++){
        if(s[i] == 'L'){
            left_to --;
            if(left_to == 0){
                cout<<"NO"<<endl;
                return 0;
            }
        }
        
        if(s[i] == 'R'){
            right_to ++;
            if(right_to == w+1){
                cout<<"NO"<<endl;
                return 0;
            }
        }
        
        if(t[i] == 'R'&& left_to<w ){
            left_to++;
        }
        
        if(t[i] == 'L'&&right_to > 1){
            right_to --;
        }
        
    }
    
    
    
    cout<<"YES"<<endl;
    
    
    
    return 0;
}



Measured memory_bytes: 920
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#include <cmath>
#include <queue>
#include <set>
#include <map>
using namespace std;

#define rep(i,n) for(int i=0; i<n; i++)
typedef long long ll;
typedef pair<int,int> pii;

int main() {
	int n;
	double w,m;
	char c;
	while(cin >> n >> c >> w >> c >> m) {
		if(w/m/m >= 25.0) {
			cout << n << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1232
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>

using namespace std;

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define PI 3.141592653589793238
#define INF 1050000000

using vi = vector<int>;


int main() {


	int a, b;

	cin >> a >> b;

	cout << (((a*b)%2 ==0)?"Even":"Odd") << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    char a;
    cin >> a;
    if (a == 'a' || a == 'e' || a == 'i' || a == 'u' || a == 'o')
    {
        cout << "vowel" << endl;
    }
    else
    {
        cout << "consonant" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
long long gcd(long long m,long long n) {
    if(m*n==0)
        return (m==0?n:m);
    if(m>n)
        return gcd(m%n,n);
    else if(m<n)
        return gcd(n%m,m);
}
int main()
{
	long long m,n;
	long long a,b;
	scanf("%lld%lld",&m,&n);
	b=m*n;
	a=b/(gcd(m,n));
	printf("%lld",a);
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int N;
long long res = 0;
vector<long long> A, B;

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> N;
    for (int i = 0; i < N + 1; ++i) {
        long long x; cin >> x;
        A.push_back(x);
    }
    for (int i = 0; i < N; ++i) {
        long long x; cin >> x;
        res += min(x, A[i]);
        x -= min(x, A[i]);
        res += min(x, A[i + 1]);
        A[i + 1] -= min(x, A[i + 1]); 
    }
    cout << res;
    return 0;
}

Measured memory_bytes: 1400
x = int(input())
import numpy as np

def seachPrimeNum(N):
    m = int(np.sqrt(N))
    seachList = [i for i in range(2,N+1)]
    primeNum = []
    while seachList[0] <= m:
        primeNum.append(seachList[0])
        tmp = seachList[0]
        seachList = [i for i in seachList if i % tmp != 0]
    primeNum.extend(seachList)
    return primeNum

s = set(seachPrimeNum(2*x))
for i in range(x):
  if x+i in s:
    u = x+i
    break
print(u)

Measured memory_bytes: 21456
# -*- coding: utf-8 -*-
# 行
H=int(input())
# 列
W=int(input())

N=int(input())
num = 0
if H >= W:
    for i in range(W):
        if (i+1)*H >= N:
            num = i+1
            break
else:
    for j in range(H):
        if (j+1)*W >= N:
            num = j+1
            break
print(num)

Measured memory_bytes: 3060
# input
menu = []
5.times do |i|
  menu.push(gets.chomp.to_i)
end
  
# main
ans = []
menu.permutation.to_a.each do |v|
  tmp = 0
  5.times do |i|
    tmp += v[i]
    if tmp % 10 != 0 and i != 4 then
      tmp += 10 - tmp % 10
    end
  end
  ans.push(tmp)
end
  
# output
puts ans.min


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

#define fastIO ios::sync_with_stdio(false);cout.tie(0);cin.tie(0);
#define endl '\n'
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#define inf INT_MAX
#define minf INT_MIN

typedef long long int lli;

using namespace std;

ofstream outfile;
ifstream infile;

int main()
{
	infile.open("input.txt");
	outfile.open("output.txt");

	string s;
	cin >> s;
	if(s.substr(0, 4) == "YAKI")
		cout << "Yes\n";
	else
		cout << "No\n";
}

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

typedef long long ll;
typedef long double ld; 
typedef double db; 
typedef string str; 

typedef pair<int, int> pi;
typedef pair<ll,ll> pl; 
typedef pair<ld,ld> pd; 

typedef vector<int> vi; 
typedef vector<ll> vl;
typedef vector<ld> vd; 
typedef vector<str> vs; 
typedef vector<pi> vpi;
typedef vector<pl> vpl; 

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound 
#define ub upper_bound 

const int MOD = 998244353;
const ll INF = 1e18;
const int MX = 5000;

int N, X, Y;
vi tree[MX];
map<pi, int> dists;
int p;
bitset<MX> vis;
int lengths[MX] = {0};


void dfs(int v, int d) {
    vis[v] = 1;
    if (p < v) {
        if (!dists.count(mp(p, v))) dists[mp(p, v)] = d;
        else dists[mp(p, v)] = min(dists[mp(p, v)], d);
    } else {
        if (!dists.count(mp(v, p))) dists[mp(v, p)] = d;
        else dists[mp(v, p)] = min(dists[mp(v, p)], d);
    }

    
    trav(u, tree[v]) {
        if (!vis[u]) dfs(u, d + 1);
    }
}

void bfs() {
    vis.reset();
    queue<int> q;
    q.push(p);
    vis[p] = 1;
    vector<int> d(MX);
    while (!q.empty()) {
        int v = q.front();
        q.pop();
        for(int u : tree[v]) {
            if (!vis[u]) {
                vis[u] = true;
                q.push(u);
                d[u] = d[v] + 1;
                if (u > p) {
                    lengths[d[u] - d[p]]++;
                }
            }
        }
    }
}

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
    cin >> N >> X >> Y;
    tree[X].pb(Y);
    tree[Y].pb(X);
    FOR(i, 1, N + 1) {
        if (i < N) {
            tree[i].pb(i + 1);
            tree[i + 1].pb(i);
        }
    }
    
    FOR(i, 1, N + 1) {
        vis.reset();
        p = i;
        bfs();
    }
    
    FOR(i, 1, N) {
        cout << lengths[i] << "\n";
    }
    return 0;
    // You should actually read the stuff at the bottom
}

/* Stuff to Look For
 * -----------------
 * Int overflow, array bounds
 * Initializing all variables, avoid weird behavior
 * Edge cases(n = 0, n = 1)
 * Just return 0 after result
 */


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

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int h, n, total=0;
    cin>>h>>n;

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

        total+=a;
    }
    if (total<h)
        cout<<"No";
    else
        cout<<"Yes";



}


Measured memory_bytes: 256
#define y1 askjdkasldjlkasd
#include <bits/stdc++.h>
#undef y1

using namespace std;

#define pb push_back
#define mp make_pair
#define fi(a, b) for(int i=a; i<=b; i++)
#define fj(a, b) for(int j=a; j<=b; j++)
#define fo(a, b) for(int o=a; o<=b; o++)
#define fdi(a, b) for(int i=a; i>=b; i--)
#define fdj(a, b) for(int j=a; j>=b; j--)
#define fdo(a, b) for(int o=a; o>=b; o--)
#define sz(x) (int)x.size()

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<ll> vll;

#ifdef LOCAL
#define err(...) fprintf(stderr, __VA_ARGS__)
#else
#define err(...) while (0)
#endif

double START_TIME;

void exit() {
#ifdef LOCAL	
	cerr << "TIME: " << setprecision(5) << fixed << (clock() - START_TIME) / CLOCKS_PER_SEC << endl;
#endif	
	exit(0);
}

template<typename A, typename B>
ostream& operator<<(ostream& os, pair<A, B> p) {
	os << "(" << p.first << ", " << p.second << ")";
	return os;
}

template<typename T>
ostream& operator<<(ostream& os, vector<T> v) {
	fi(0, sz(v) - 1) {
		os << v[i] << " ";
	}
	return os;
}

template<typename T>
ostream& operator<<(ostream& os, set<T> t) {
	for (auto z : t) {
		os << z << " ";
	}
	return os;
}

template<typename T1, typename T2>
ostream& operator<<(ostream& os, map<T1, T2> t) {
	cerr << endl;
	for (auto z : t) {
		os << "\t" << z.first << " -> " << z.second << endl;
	}
	return os;
}

#ifdef LOCAL
#define dbg(x) {cerr << __LINE__ << "\t" << #x << ": " << x << endl;}
#define dbg0(x, n) {cerr << __LINE__ << "\t" << #x << ": "; for (int ABC = 0; ABC < n; ABC++) cerr << x[ABC] << ' '; cerr << endl;}
#else
#define dbg(x) while(0){}
#define dbg0(x, n) while(0){}
#endif

#ifdef LOCAL
#define ass(x) if (!(x)) { cerr << __LINE__ << "\tassertion failed: " << #x << endl, abort(); }
#else
#define ass(x) assert(x)
#endif

///////////////////////////////////////////////////

const int MAX = 141;

int n;
int a[MAX];

void solve () {
	vi ans;
	vi v;
	v.insert(v.begin(), a, a + n);
	fi(0, n - 1) v[i]--;
	while (sz(v)) {
		int x = -1;
		fdi(sz(v) - 1, 0) {
			if (v[i] == i) {
				x = i;
				break;
			}
		}
		if (x == -1) {
			printf("-1\n");
			return;
		}
		ans.insert(ans.begin(), x);
		v.erase(v.begin() + x);
	}	
	for (int x : ans) printf("%d\n", x + 1);
}

int main() {
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	START_TIME = (double)clock();
#endif
	
	scanf("%d", &n);
	fi(0, n - 1) scanf("%d", &a[i]);
	solve();

	exit();
	return 0;
}





Measured memory_bytes: 256
import math
N = int(input())
a_a = 0
b_b = 0
def F_ab(a, b):
    a_len = len(str(a))
    b_len = len(str(b))
    
    if(a_len >= b_len):
        return a_len
    else:
        return b_len
    
n = math.floor(N ** (1/2))

min_f = 99999999999999
for a in range(1, n + 1):
    if(N % a == 0):
        b = math.floor(N/a)
        f = F_ab(a, b)
        if(min_f > f):
            min_f = f
            a_a = a
            b_b = b
        
print(min_f)

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

int main()
{
        char A[11],B[11],C[11];
        scanf("%s%s%s",A,B,C);
        int i=strlen(A)-1;
        int j=strlen(B)-1;
        if(A[i]==B[0]&&B[j]==C[0])
        printf("YES\n");
        else
        printf("NO\n");
        return 0;
}


Measured memory_bytes: 128
//#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast,no-stack-protector") 
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
 
#include <bits/stdc++.h>
 
//#define int long long
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = l; i <= r; i++)
#define repb(i, r, l) for (int i = r; i >= l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp(a, b) make_pair(a, b)
#define ret(a) {cout << a; exit(0);}
 
using namespace std;                                                                                  

mt19937 mrand(random_device{}()); 
const ll mod = 1e9 + 7;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
 
typedef pair < int , int > pii ;                                            
typedef pair < long long  , long long > pll ;
const int N = 5e5 + 123;

int n, m, k;
int a[N];
string s;
int cnt[300],cnt2[300];
main(){
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin >> n;
	for(int i = 'a';  i <= 'z'; i++)
		cnt[i] = 1e9;

	rep(i , 1,  n){
		cin >> s;
		for(int i = 'a';  i <= 'z'; i++)
			cnt2[i] = 0;	
		rep(i, 0 , sz(s) - 1)
			cnt2[s[i]]++;
		for(int i = 'a';  i <= 'z'; i++)
			cnt[i] = min(cnt[i], cnt2[i]);
	}	
	for(int i = 'a' ; i <= 'z' ; i++){
		while(cnt[i]--)
			cout << char(i);
	}
}
 


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Deque;
import java.util.LinkedList;
import java.util.StringTokenizer;
import java.util.regex.Pattern;


public class Main {

	boolean isNumber(String s){
		return Pattern.matches("\\A-?[0-9]+.?[0-9]*\\z",s);
	}
	
	double solve(String str){
		Deque<Double> stack=new LinkedList<Double>();
		StringTokenizer st=new StringTokenizer(str);
		
		while(st.hasMoreTokens()){
			String token=st.nextToken();
			if(isNumber(token)){
				stack.push(Double.parseDouble(token));
			}
			else{
				double a=stack.pop();
				double b=stack.pop();
				double c=0;
				switch(token.charAt(0)){
				case '+':
					c=b+a;
					break;
				case '-':
					c=b-a;
					break;
				case '*':
					c=b*a;
					break;
				case '/':
					c=b/a;
					break;
				}
				stack.push(c);
			}
		}
		return stack.pop();
	}
	
	void io(){
		BufferedReader input=new BufferedReader(new InputStreamReader(System.in));
		String str;
		try {
			while((str=input.readLine())!=null){
				System.out.println(solve(str));
			}
			
		} catch (IOException e) {
		}
	}
	
	public static void main(String[] args){
		new Main().io();
	}
}

Measured memory_bytes: 17148