akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main()
{
  int N, K, i=1;
  cin >> N >> K;
  
  for(int j=0; j<N; j++)
  {
    if(i<K)i*=2;
    else i+=K;
  }
  cout << i << endl;
}


Measured memory_bytes: 256
n=int(input())
s=input()
a,b=0,0 # a:'.'の個数 b:'#'の個数
x=0 # x:'.'の個数
for i in s:
    if i==".":
        x+=1
ans=x
for i in s:
    if i==".":
        a+=1
    else:
        b+=1
    ans=min(ans,b+x-a)
print(ans)

Measured memory_bytes: 3500
#a , b = gets.strip.split(' ').map(&:to_i);
x = gets.chomp;
mp = Hash.new(0);
mpC = Hash.new(0);

i = 0;
counter = 0;
x1 = x.split("");

x1.each do |indexOfChar| 
	if indexOfChar.downcase == indexOfChar 
		counter+=1;
	end
	mp[indexOfChar]+=1;
	mpC[indexOfChar] = i;
	i+=1;
end
if x[0] == 'A' && mp['C'] == 1 && mpC['C'] > 1 && mpC['C'] < x.length - 1  && counter == x.length - 2
	puts "AC";
	else
	puts "WA";
end


Measured memory_bytes: 1788
package main

import (
	"fmt"
	"strconv"
	"strings"
)

func main() {
	var a, b int
	var aString, bString string

	fmt.Scanf("%d %d", &a, &b)
	aString = strconv.Itoa(a)
	bString = strconv.Itoa(b)

	if a <= b {
		fmt.Println(strings.Repeat(aString, b))
	} else {
		fmt.Println(strings.Repeat(bString, a))
	}
}


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

template<typename T>
struct Prim{
    using P=pair<T,int>;
    int n;
    vector<vector<pair<int,T>>> G;
    vector<bool> used;
    Prim(int n):n(n),G(n),used(n,false){}
    void add_edge(int u,int v,T c){
        G[u].emplace_back(v,c);
        G[v].emplace_back(u,c);
    }
    T build(){
        T res=0;
        priority_queue<P,vector<P>,greater<P>> pq;
        pq.emplace(0,0);
        while(!pq.empty()){
            P p=pq.top(); pq.pop();
            if (used[p.second]) continue;
            used[p.second]=true;
            res+=p.first;
            for (auto e:G[p.second]){
                pq.emplace(e.second,e.first);
            }
        }
        return res;
    }
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int V,E; cin >> V >> E;
    Prim<ll> P(V);
    rep(i,E){
        int s,t; ll w; cin >> s >> t >> w;
        P.add_edge(s,t,w);
    }
    cout << P.build() << endl;
}


Measured memory_bytes: 12380
S = input()


def D2NC(D: int, N: int, link=False) -> list:
    alp = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
    res = []
    while D > 0:
        if D % N > 9:
            tmp = alp[D % N - 10]
            res.insert(0, str(tmp))
        else:
            res.insert(0, str(D % N))
        D //= N
    if not res:
        res.append('0')
    if link:
        res = ''.join(res)
    return res


n = len(S)
Sum = 0
for i in range(2**(n-1)):
    op = D2NC(i, 2, link=True).zfill(n-1)
    idx = 0
    num = []
    for i in range(len(op)):
        if op[i] == '1':
            num.append(int(S[idx:i+1]))
            idx = i+1
    num.append(int(S[idx:]))
    Sum += sum(num)

print(Sum)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a,T b){return b?gcd(b,a%b):a;}
const LL mod=1000000007;
const LL LINF=1LL<<62;
const int INF=1<<30;
int dx[]={1,0,-1,0,1,-1,1,-1};
int dy[]={0,1,0,-1,1,-1,-1,1};


int main(){
    LL x;cin >> x;
    LL now = 100;
    for (int i = 0; i <= 100000; i++) {
        if(x <= now){
            cout << i << endl;
            break;
        }
        now += now / 100;
    }
    return 0;
}



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

using namespace std;
using ll = long long;

class UF{
private:
    std::vector<long long> data; //data[i] : 頂点iの親
public:
    UF(int n){
        data.resize(n,-1);
    }
    //頂点iの親を返す
    int root(int i){
        if(data[i] < 0)return i;
        else return data[i] = root(data[i]);
    }
    //連結
    void unit(int i,int j){
        i = root(i);j = root(j);
        if(i != j){
            data[i] += data[j];
            data[j] = i;
        }
    }

    //頂点iの属する集合の頂点数
    int size(int i){
        i = root(i);
        return -data[i];
    }
};

int main()
{
    int n, m; cin >> n >> m;
    UF tree(n);
    for(int i = 0; i < m; i++) {
        int x, y, z; cin >> x >> y >> z;
        tree.unit(x - 1, y - 1);
    }
    set<int> st;
    for(int i = 0; i < n; i++)st.insert(tree.root(i));
    cout << st.size() << endl;
}

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

int main(){
	int ans = 0,n;
	cin >> n;
	int l[2 * n];
	for(int i = 0;i < 2 * n;i++) cin >> l[i];
	sort(l,l + 2 * n);
	for(int i = 2 * n - 1;i > 0;i -= 2) ans += min(l[i],l[i - 1]);
	cout << ans << endl;
}

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

using namespace std;
using namespace __gnu_pbds;
using ll = long long;

#define     _test int _TC; cin >> _TC; while(_TC--)
#define     CS(x) cout << "Case " << x << ": ";
#define     precision(n) cout << fixed << setprecision(n);
#define     Clear(a, b) memset(a, b, sizeof(a))
#define     sq(x) ((x) * 1LL * (x))
#define     eb emplace_back
#define     all(_n) _n.begin(), _n.end()
#define     rall(_n) _n.rbegin(), _n.rend()
#define     endl "\n"
#define     show(x) cout << x << endl
#define     nl cout << endl
#define     sz(x) int(x.size())
#define     gcd(a, b) __gcd(a, b)
#define     lcm(a, b) (abs((a) * (b)) / gcd(a, b))
#define     parity(a, b) ((a&1) ^ (b&1))
#define     make_unique(x) sort(all((x))); (x).erase(unique(all((x))), (x).end())
#define     IN(a) for(auto &it : a) cin >> it

template <typename T> void print (T t){ for(const auto &it : t) cout << it << ' '; nl; }
template <typename T> using OS = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; // order_of_key find_by_order

const    double Pi = acos(-1.0);
const    int Mod = 1e9 + 7;
const    int Inf = 1 << 30; // INT_MAX = (1LL << 31) -1 // Inf -> 1e9
const    int Maxx = 1e6 + 10;

/************************************[Code Starts Here]************************************/


void _case()
{
    int n, x, y; cin >> n >> x >> y;
    ll cnt = 0;
    vector<int> k(n+1);
    
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            int p = min({abs(i-j), abs(i-x)+1+abs(y-j), abs(i-y)+1+abs(x-j)});
            k[p]++;
        }
    }
    for (int i = 1; i < n; i++) show(k[i]/2);
}

int32_t main()
{
    ios::sync_with_stdio(false), cin.tie(nullptr);
    _case();
    return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std ;
#define rep( i, s, t ) for( register int i = s; i <= t; ++ i )
#define re register
#define int long long
int gi() {
	char cc = getchar() ; int cn = 0, flus = 1 ;
	while( cc < '0' || cc > '9' ) {  if( cc == '-' ) flus = - flus ; cc = getchar() ; }
	while( cc >= '0' && cc <= '9' )  cn = cn * 10 + cc - '0', cc = getchar() ;
	return cn * flus ;
}
const int N = 4e5 + 5 ; 
const int P = 1e9 + 7 ; 
int n, Ans, w[N], a[N], Go[N], fac[N], inv[N], deg[N], vis[N], cir[N], L[N] ;
int fpow( int x, int k ) {
	int ans = 1, base = x % P ; 
	while( k ) {
		if( k & 1 ) ans = ans * base % P ; 
		base = base * base % P, k >>= 1 ; 
	} return ans ; 
}  
int C( int x, int y ) {
	if( y > x ) return 0 ;
	return fac[x] * inv[y] % P * inv[x - y] % P ; 
}
int top, st[N], R[N] ; 
int solve( int x ) {
	int u = x, l = 0, r = 0, ans = 1 ; top = 0 ;
	while( !l || u != x ) ++ l, u = Go[u] ; 
	r = l, l = 0 ; 
	while( !l || u != x ) {
		if( L[u] ) st[++ top] = L[u], R[top] = r - l ; 
		++ l, u = Go[u] ; 
	}
	if( top == 1 ) {
		if( st[top] > l ) return 0 ;
		if( st[top] == l ) return 1 ; 
		return 2 ; 
	}
	reverse( st + 1, st + top + 1 ), reverse( R + 1, R + top + 1 ) ;
	for( re int i = 2; i <= top; ++ i ) {
		int ug = R[i - 1] + st[i - 1] ; 
		int uk = ( ug <= R[i] ) + ( ug < R[i] ) ;
		ans = ans * uk % P ; 
	}
	if( st[top] >= l ) return 0 ;
	int ug = R[top] + st[top] ;
	if( ug <= l ) return 2 * ans % P ; 
	if( ug > l ) ug -= l ;
	int uk = ( ug <= R[1] ) + ( ug < R[1] ) ;
	ans = ans * uk % P ; 
	return ans % P ; 
}
signed main()
{
	n = gi() ; rep( i, 1, n ) a[i] = gi(), Go[i] = a[i], ++ deg[a[i]] ; 
	inv[0] = fac[0] = 1 ; 
	for( re int i = 1; i <= 2 * n + 5; ++ i ) fac[i] = fac[i - 1] * i % P, inv[i] = fpow( fac[i], P - 2 ) ;
	rep( i, 1, n ) {
		if( vis[i] ) continue ; 
		int x = i ; while( !vis[x] ) vis[x] = i, x = Go[x] ; 
		if( vis[x] != i ) continue ;
		while( !cir[x] ) cir[x] = 1, x = Go[x] ; 
	}
	rep( i, 1, n ) if( ( cir[i] && deg[i] > 2 ) || ( !cir[i] && deg[i] > 1 ) ) { puts("0") ; exit(0) ; }
	rep( i, 1, n ) {
		if( deg[i] ) continue ; 
		int x = i, l = 0 ; while( !cir[x] ) ++ l, x = Go[x] ;
		L[x] = l ; 
	}
	Ans = 1 ;
	memset( vis, 0, sizeof(vis) ) ;
	rep( i, 1, n ) {
		if( !cir[i] ) continue ; 
		if( vis[i] ) continue ; 
		int l = 0, x = i, flag = 0 ; 
		while( !vis[x] ) ++ l, vis[x] = 1, x = Go[x], flag |= ( L[x] != 0 ) ; 
		if( !flag ) ++ w[l] ;
		else Ans = ( Ans * solve(i) ) % P ; 
	}
	for( re int i = 1; i <= n; ++ i ) {
		int ans = 0 ; if( !w[i] ) continue ; 
		for( re int j = 0; j <= w[i] / 2; ++ j ) {
			int num = C( w[i], 2 * j ) ;
			if( ( i & 1 ) && ( i != 1 ) ) num = ( num * fpow( 2, w[i] - 2 * j ) ) % P ; 
			num = ( num * fpow( i, j ) ) % P ; 
			num = ( num * fac[2 * j] ) % P ;
			num = ( num * fpow( fpow( 2, j ) % P, P - 2 ) ) % P ;
			num = ( num * inv[j] ) % P ;
			ans = ( ans + num ) % P ;
		}
		Ans = Ans * ans % P ;
	}
	printf("%lld\n", Ans ) ;
	return 0 ;
}

Measured memory_bytes: 26880
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int x,y,z,n;
	scanf("%d%d%d",&x,&y,&z);
	n = (x - z)/(y + z);
	printf("%d\n",n);
}

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

using namespace std;

const int maxn = 410;
const long long inf = 2e18+10;

typedef long long ll;

ll num[maxn], soma[maxn];
ll dp[maxn][maxn];

ll solve(int l, int r)
{
	if (l == r || l > r) return 0;
	if (dp[l][r] != -1) return dp[l][r];

	ll ans = inf;
	for (int i = l; i < r; i++)
		ans = min(ans, solve(l, i)+solve(i+1, r));

	return dp[l][r] = soma[r]-soma[l-1]+ans;
}

int main(void)
{
	int n;
	cin >> n;

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

	memset(dp, -1, sizeof dp);

	cout << solve(1, n) << "\n";
}

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

#define ll long long
#define ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
const ll mod=1000000007;

using namespace std;

int main(){
    bool dp[100100];
    int n,k,a[100100];
	cin>>n>>k;
	for (int i=0;i<n;i++)cin>>a[i];
	for (int i=0;i<k;i++){
        if (dp[i])continue;
        for (int j=0;j<n;j++){
            if (i+a[j]>k)continue;
            dp[i+a[j]]=true;
        }
	}
	if (dp[k])return cout<<"First",0;
	cout<<"Second";
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define pb push_back
#define rep(i,s,t) for(int i=s;i<=(t);++i)
#define lop(i,s,t) for(int i=s;i<(t);++i)
#define Pr(f,...) //printf(f,##__VA_ARGS__),fflush(stdout)
using namespace std; 
typedef long long ll;
const int N=1005;
int n;
ll a[N];
vector<int> op;
void del(int x){
	//printf("Del %d\n",x);
	op.pb(x);
	if(x==1||x==n){
		for(int i=1,t=0;i<=n;++i){
			if(i!=x)a[++t]=a[i];
		}
		--n;
	}else{
		a[x-1]+=a[x+1];
		for(int i=x;i+2<=n;++i)a[i]=a[i+2];
		n-=2;
	}
	rep(i,1,n)Pr("%lld ",a[i]);Pr("\n");
}
void mt(){
	ll odd=0,even=0;
	for(int i=1;i<=n;i+=2){
		odd+=a[i]>0?a[i]:0;
		if(i+1<=n)even+=a[i+1]>0?a[i+1]:0;
	}
	if(even>odd){
		del(1);
	}
}
int main(){
	scanf("%d",&n);
	rep(i,1,n)scanf("%lld",a+i);
	bool spec=true;
	rep(i,1,n)spec&=a[i]<=0;
	if(spec){
		int mx=1;
		rep(i,2,n)if(a[i]>a[mx])mx=i;
		int t1=mx-1,t2=n-mx;
		while(t1--)del(1);
		while(t2--)del(n);
	}else{
		while(true){
			bool suc=false;
			mt();
			for(int i=1;i<=n;i+=2){
				if(a[i]<0){
					del(i);
					suc=true;
					break;
				}
			}
			if(!suc)break;
		}
		mt();
		while(n>1){
			del(2);
		}
	}
	printf("%lld\n", a[1]);
	printf("%d\n", (int)op.size());
	for(auto t : op) printf("%d\n", t);
	return 0;
}


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

using namespace std;

const int MOD = 1000000007;

int main(){
    const int maxSize = 200001;
	vector<long long> inv(maxSize);
	vector<long long> fact(maxSize);
	vector<long long> factInv(maxSize);
	for(int i=0;i<2;i++) inv[i] = fact[i] = factInv[i] = 1;
	for(int i=2;i<maxSize;i++){
		inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;
		fact[i] = fact[i-1] * i % MOD;
		factInv[i] = factInv[i-1] * inv[i] % MOD;
	}
	auto comb = [&](int n, int r){
		if(n < r || r < 0) return 0LL;
		return fact[n] * factInv[n-r] % MOD * factInv[r] % MOD;
	};
    int n, k;
    while(cin >> n >> k){
        long long res = 1;
        for(int i=1;i<=min(k, n-1);i++){
            res += comb(n, i) * comb(n-1, n-i-1);
            res %= MOD;
        }
        cout << res << endl;
    }
}

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

int main(){
    int n;
    cin>>n;
    if(n==1){
        cout<<"Hello World"<<endl;
    }
    else{
        int a,b;
        cin>>a>>b;
        cout<<a+b<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
<?php

$N = trim(fgets(STDIN));

$result = 0;
for($i = 1; $i <= $N; $i++)
{
    if($i % 2 === 0)
    {
        continue;
    }
    if(is_count_eigth($i))
    {
        $result++;
    }
}


function is_count_eigth($num)
{
   $cnt = 0;
   for($i = 1; $i <= $num; $i++)
   {
       if($num % $i === 0)
       {
           $cnt++;
       }
   }
    if($cnt === 8)
    {
        return true;
    }
    return false; 
}

echo $result;
echo "\n";


Measured memory_bytes: 4728
line = input().split(" ")
n = int(line[0])
k = int(line[1])
h = []
sa = 9999999999999999999999


for i in range(n):
    h.append(int(input()))

h = sorted(h)

for i in range(n-k+1):
    if (h[k+i-1] - h[i]) < sa:
        sa = h[k+i-1] - h[i]

print(sa)

Measured memory_bytes: 8280
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int a,b;
    double a2,b2;
    
    int d,r;//?????????????????´??°???
    double f;//???????°???°?????°
    
    scanf("%d %d",&a,&b);//?????°?????\???
    
    d = a/b;//???
    r = a%b;//??????
    
    a2 = a;//?????°????????´
    b2 = b;//???"
    f = a2/b2;//???????°???°?????°
    
    
    printf("%d %d %lf",d,r,f);
    
    return 0;
}

Measured memory_bytes: 1768
#include <iostream>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <tuple>
#include <queue>
#include <set>
#include <cmath>
#include <array>
#include <list>
#include <set>
const int MOD=1000000007;
using namespace std;
typedef long long ll;
typedef tuple<ll,int,int> tup;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> p;
typedef vector<p> vp;
const int INF=1e9;
int n;
vector<pair<int,int> > vindex1(100005);
vector<pair<int,int> > vindex2(100005);
int main(int argc,char const* argv[])
{
  cin >> n;
  for(int i=0;i<=100000;i++)
    {
      vindex1[i]=make_pair(0,i);
      vindex2[i]=make_pair(0,i);
    }
  for(int i=1;i<=n;i++)
    {
      int v;
      cin >> v;
      if(i%2!=0)
	{
	  vindex1[v].second=v;
	  vindex1[v].first++;
	}
	else 
	{
	  vindex2[v].second=v;
	  vindex2[v].first++;
	}
    }
  sort(vindex1.begin(),vindex1.end(),greater<pair<int,int>>());
  sort(vindex2.begin(),vindex2.end(),greater<pair<int,int>>());
  if(vindex1[0].second!=vindex2[0].second)
    {
      cout << n/2-vindex1[0].first+n/2-vindex2[0].first << endl;
    }
  else
    {
      int ans=min(n/2-vindex1[1].first+n/2-vindex2[0].first,
		  n/2-vindex1[0].first+n/2-vindex2[1].first);
      cout << ans << endl;
    }
  return 0;
  
}


Measured memory_bytes: 1792
a,b = map(int,input().split())
t = {1:13, 2:1, 3:2, 4:3, 5:4, 6:5,7:6,8:7,9:8,10:9,11:10,12:11, 13:12}
if a == b:
  print('Draw')
elif t[a] > t[b]:
  print('Alice')
else:
  print('Bob')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long int
#define rep(i, n) for(int i = 0; i < n; i++)
#define repp(i, n) for(int i = 1; i <= n; i++)
#define sort(v) sort((v).begin(), (v).end())
#define pb push_back
#define mp make_pair
#define riverse(v) reverse((v).begin(), (v).end())
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using vll = vector<ll>;
const int MOD = 1e9+7;
vi alphabet = {'a','b','c','d','e','f','g','h','i','j','k','l','m',
               'n','o','p','q','r','s','t','u','v','w','x','y','z'};
 
 
int main() {
	int N;
  	cin >> N;
  	vi p(N);
  	vector<bool> q(N,false);
  	rep(i,N){
    	cin >> p[i];
      	if(p[i] != i+1) q[i] = true;
    }
  	int count=0;
  	rep(i,N){
    	if(q[i] == false&& i != N-1){
        	i++;
          	count++;
        }
      	else if(q[i] == false && i==N-1){
			
          	count++;
        }
    }
	cout << count << endl;
}

Measured memory_bytes: 640
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
from typing import Iterable
import sys
def main(N, M, AB):
    uf = UnionFindTree(N)
    for a, b in AB:
        uf.union(a - 1, b - 1)
    ans = 0
    for i in range(N):
        ans = max(ans, uf.size(i))
    print(ans)

class UnionFindTree:
    def __init__(self, n: int) -> None:
        self.parent = [-1] * n

    def find(self, x: int) -> int:
        p = self.parent
        while p[x] >= 0: x, p[x] = p[x], p[p[x]]
        return x

    def union(self, x: int, y: int) -> bool:
        x, y, p = self.find(x), self.find(y), self.parent
        if x == y: return False
        if p[x] > p[y]: x, y = y, x
        p[x], p[y] = p[x] + p[y], x
        return True

    def same(self, x: int, y: int) -> bool:
        return self.find(x) == self.find(y)

    def size(self, x: int) -> int:
        return -self.parent[self.find(x)]

    def same_all(self, indices: Iterable[int]) -> bool:
        f, v = self.find, self.find(indices[0])
        return all(f(i) == v for i in indices)

if __name__ == '__main__':
    input = sys.stdin.readline
    N, M = map(int, input().split())
    AB = [tuple(map(int, input().split())) for _ in range(M)]
    main(N, M, AB)


Measured memory_bytes: 101448
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)

ll mod = 1e09;

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

  ll n, a;
  cin >> n >> a;
  int rec = 0;
  REP(i, a + 1){
    if(n % 500 == i) rec = 1;
  }
  if(rec) cout << "Yes";
  else cout << "No";
  return 0;
}


Measured memory_bytes: 256
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.System.exit;
import static java.util.Arrays.fill;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

	static void solve() throws Exception {
		int n = scanInt(), m = scanInt(), t = scanInt();
		int x[] = new int[m], y[] = new int[m];
		for (int i = 0; i < m; i++) {
			x[i] = scanInt() - 1;
			y[i] = scanInt() - 1;
		}
		char ans[] = new char[m];
		fill(ans, '^');
		switch (t) {
		case 1:
		{
			int nn = (n + 63) >> 6;
			long sets[][] = new long[n][nn];
			for (int i = 0; i < n; i++) {
				sets[i][i >> 6] |= 1L << i;
			}
			for (int i = 0; i < m; i++) {
				long s1[] = sets[x[i]], s2[] = sets[y[i]];
				for (int j = 0; j < nn; j++) {
					s1[j] = s2[j] = s1[j] | s2[j];
				}
			}
			int o = -1;
			i: for (int i = 0; i < n; i++) {
				long s[] = sets[i];
				for (int j = 0; j < nn - 1; j++) {
					if (s[j] != -1) {
						continue i;
					}
				}
				if (s[nn - 1] != -1L >>> -n) {
					continue;
				}
				o = i;
				break;
			}
			if (o < 0) {
				out.print(-1);
				return;
			}
			boolean cur[] = new boolean[n];
			cur[o] = true;
			for (int i = m - 1; i >= 0; i--) {
				if (cur[x[i]] && !cur[y[i]]) {
					cur[y[i]] = true;
				} else if (cur[y[i]] && !cur[x[i]]) {
					cur[x[i]] = true;
					ans[i] = 'v';
				}
			}
		}
		break;
		case 2:
		{
			if (n == 2) {
				out.print(-1);
				return;
			}
			int next[] = new int[n], xNext[] = new int[m], yNext[] = new int[m];
			fill(next, -1);
			for (int i = m - 1; i >= 0; i--) {
				xNext[i] = next[x[i]];
				yNext[i] = next[y[i]];
				next[x[i]] = next[y[i]] = i;
			}
			int a = 0, b;
			for (b = 1; next[b] >= 0 && next[b] == next[a]; b++) { }
			int aNext = next[a], bNext = next[b];
			while (aNext >= 0 && bNext >= 0) {
				if (aNext < bNext) {
					if (xNext[aNext] == bNext) {
						ans[aNext] = 'v';
						aNext = yNext[aNext];
					} else {
						aNext = xNext[aNext];
					}
				} else {
					if (xNext[bNext] == aNext) {
						ans[bNext] = 'v';
						bNext = yNext[bNext];
					} else {
						bNext = xNext[bNext];
					}
				}
			}
		}
		break;
		default:
			throw new AssertionError();
		}
		out.print(ans);
	}

	static int scanInt() throws IOException {
		return parseInt(scanString());
	}

	static long scanLong() throws IOException {
		return parseLong(scanString());
	}

	static String scanString() throws IOException {
		while (tok == null || !tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}

	static BufferedReader in;
	static PrintWriter out;
	static StringTokenizer tok;

	public static void main(String[] args) {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			solve();
			in.close();
			out.close();
		} catch (Throwable e) {
			e.printStackTrace();
			exit(1);
		}
	}
}

Measured memory_bytes: 507644
// AOJ ITP1_2_C
#include<cstdio>
#include<algorithm>
#define rep(i,a) for( int i = 0; i != (a); ++i )

int main()
{
	int a[3];
	rep( i, 3 )
		scanf( "%d", a+i );

	std::sort( a, a+3 );

	rep( i, 3 )
		printf( "%d%c", a[i], i == 2 ? '\n' : ' ' );

	return 0;
}

Measured memory_bytes: 1040
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);
        String[] arr = br.readLine().split(" ");
        int N = Integer.parseInt(arr[0]);
        int X = Integer.parseInt(arr[1]);
        String[] arr2 = br.readLine().split(" ");

        int D = 0;
        int ans = 1;
        for (int i = 0; i < N; i++) {
            D += Integer.parseInt(arr2[i]);
            if (D > X) {
                break;
            }
            ans++;
        }
        out.println(ans);
        out.close();
    }
}


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

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

using namespace std;

using pii = pair<int, int>;

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

    int N;
    cin >> N;
    auto encode = [&](int i, int j) { return (2 * N - i - 1) * i / 2 + j - i - 1; };
    vector<vector<int>> g(N * (N - 1) / 2);
    vector<int> indegree(g.size());
    REP(i, N) {
        int u, v;
        REP(j, N - 1) {
            int A;
            cin >> A;
            --A;
            v = encode(min(i, A), max(i, A));
            if (j) {
                g[u].push_back(v);
                ++indegree[v];
            }
            u = v;
        }
    }

    queue<pii> q;
    REP(i, N) FOR(j, i + 1, N) {
        int v = encode(i, j);
        if (indegree[v] == 0) {
            q.emplace(v, 1);
        }
    }

    int result = 0;
    REP(_, N * (N - 1) / 2) {
        if (q.empty()) {
            result = -1;
            break;
        }
        int u, depth;
        tie(u, depth) = q.front();
        q.pop();
        result = max(result, depth);
        for (int v: g[u]) {
            --indegree[v];
            if (indegree[v] == 0) {
                q.emplace(v, depth + 1);
            }
        }
    }

    cout << result << endl;

    return 0;
}

Measured memory_bytes: 29568
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <iomanip>

using namespace std;

#define FAST       			ios_base :: sync_with_stdio(false); cin.tie(NULL); 
#define endl "\n"

typedef long long int  ll;
typedef unsigned long long int ull;


int main()
{
	FAST;
	long long int a,b,x;
	cin >> a >> b >> x;
    
    ll ans = (b/x);
    if(a)   ans -= (a-1)/x;
    else
        ans++;
    
    cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <vector>
#include <tuple>
#include <cstdint>

using namespace std;

// Type aliases
using i8  =  int8_t; using  u8 =  uint8_t;
using i16 = int16_t; using u16 = uint16_t;
using i32 = int32_t; using u32 = uint32_t;
using i64 = int64_t; using u64 = uint64_t;

template <class T> using V = vector<T>;

// Loops
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, n, m) for (int i = n; i < m; ++i)
#define FORR(i, n, m) for (int i = m - 1; i >= n; --i)

// Input
template <class T>
T read() {
    T t;
    cin >> t;
    return t;
}

template <class T>
vector<T> read(const int length) {
    vector<T> ts(length);
    for (auto& t: ts) {
        cin >> t;
    }
    return ts;
}

// Output
namespace debug {
    template <class F, class S>
    ostream &operator<<(ostream& stream, const pair<F, S> &pair) {
        stream << "{" << pair.first << ", " << pair.second << "}";
        return stream;
    }
    template <class Arg, class ...Args>
    void output(ostream& stream, tuple<Arg, Args...> tuple) {
        stream << get<1>(tuple) << ", ";
        // TODO
    }
    template <class Arg>
    void output(ostream& stream, tuple<Arg> tuple) {
        stream << get<1>(tuple);
    }
    template <class ...Args>
    ostream &operator<<(ostream& stream, const tuple<Args...> &tuple) {
        stream << "{";
        output(stream, tuple);
        stream << "}";
        return stream;
    }

    template <class T, class Alloc>
    ostream &operator<<(ostream& stream, const vector<T, Alloc> &vector) {
        stream << "[";

        for (auto i = 0; i < vector.size(); i++) {
            stream << vector[i];

            if (i != vector.size() - 1) {
                stream << "," << ((i % 10 == 9) ? "\n " : "\t");
            }
        }

        stream << "]";
        return stream;
    }
}

// Body
void body() {
    auto A = read<i16>();
    auto B = read<i16>();
    auto C = read<i16>();

    if (C >= A && C <= B) {
        std::cout << "Yes" << std::endl;
    } else {
        std::cout << "No" << std::endl;
    }
}

// main function (DO NOT EDIT)
int main () {
    ios_base::sync_with_stdio(false);
    body();
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
https://abc088.contest.atcoder.jp/tasks/abc088_a

"""
import sys
from sys import stdin
input = stdin.readline


def solve(N, A):
    N %= 500
    if 0 <= N <= A:
        return 'Yes'
    else:
        return 'No'


def main(args):
    N = int(input())
    A = int(input())
    ans = solve(N, A)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])
    


Measured memory_bytes: 3060
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		
		long N=sc.nextLong();
		
		long k=1;
		for(long i=1; i*i<=N; i++) {
			k=i;
		}
		k++;
		
		int a=0,b=0;
		long xa=0,xb=0;
		for(long j=k; k>=1; k--) {
			if(N%k==0) {
				xa=k;
				xb=N/k;
				while(xa>0) {
					a++;
					xa/=10;
				}
				
				while(xb>0) {
					b++;
					xb/=10;
				}
				System.out.println(Math.max(a, b));
				return;
			}
		}
	}
}

Measured memory_bytes: 23764
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define mkp make_pair
#define pr(num) cout << num << "\n"
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define INF 1000000000000000000
#define MOD 1000000007LL
#define MAX 200010
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;

int main() {
    ll N;
    cin >> N;
    ll a[MAX];
    ll i;
    Map mp;
    for(i=0; i<N; i++) {
        cin >> a[i];
        mp[a[i]]++;
    }
    sort(a, a+N);
    
    ll ans=0;
    for(i=N-1; i>=0; i--) {
        if(mp[a[i]]==0) continue;
        mp[a[i]]--;
        ll t=1;
        while(t<=a[i]) t<<=1;
        
        t=t-a[i];
        if(binary_search(a, a+i, t) && mp[t]>0) {
            mp[t]--;
            ans++;
        }
    }
    
    pr(ans);
    
}


Measured memory_bytes: 14336
using System;
using System.Collections.Generic;
using System.Linq;

namespace E
{
    class Program
    {
        static List<int> min_factor = new List<int>();
        static void Main(string[] args)
        {
            var n = Int32.Parse(Console.ReadLine());
            var a = Console.ReadLine().Split(" ").Select(s => Int32.Parse(s)).ToList();

            min_factor = new List<int>();
            for(var i=0;i<=1000000;i++){
                min_factor.Add(i); 
            }
            for(int i=2; i*i<=1000000; i++){
                if(min_factor[i] < i) continue;
                for(int j=i*i; j<=1000000; j+=i){
                    if(min_factor[j] == j) min_factor[j] = i;
                }
            }
            var p = new List<List<int>>();
            var values = new Dictionary<int, int>();
            foreach (var val in a)
            {
                p.Add(new List<int>());
                var facts = PrimeFactors(val);
                foreach (var hoge in facts.Distinct())
                {
                    if(!values.ContainsKey(hoge)) values[hoge] = 0;
                    values[hoge]++;
                    p.Last().Add(hoge);
                }
            }



            bool flag1 = true;
            var f2 = true;
            foreach(var v in values){
                if(v.Key == 1) continue;
                if(v.Value > 1) {
                    flag1 = false;
                }
                if(v.Value >= n) {
                    f2 = false; 
                }
            }
            if(flag1) {
                Console.WriteLine("pairwise coprime");
                return;
            }
            else if(f2) {
                Console.WriteLine("setwise coprime");
                return;
            }
            Console.WriteLine("not coprime");
        }
        public static IEnumerable<int> PrimeFactors(int n)
        {
            int tmp = n;

            while (tmp > 1)
            {
                yield return min_factor[tmp];
                tmp = tmp / min_factor[tmp];
            }
            yield return 1;
        }
    }
}

Measured memory_bytes: 180288
#include<stdio.h>
int main(void)
{
	char a,s,d;
	int f,g,h,i,j;
	f=1;
	g=0;
	h=0;
	while(scanf("%c,%c",&a,&s)!=EOF){
		if(a=='A'&&s=='B'||a=='B'&&s=='A'){
			i=f;
			f=g;
			g=i;
		}
		if(a=='A'&&s=='C'||a=='C'&&s=='A'){
			i=f;
			f=h;
			h=i;
		}
		if(a=='B'&&s=='C'||a=='C'&&s=='B'){
			i=g;
			g=h;
			h=i;
		}
		//printf("A=%d B=%d C=%d\n",f,g,h);
	}
	if(f==1){
		printf("A\n");
	}
	if(g==1){
		printf("B\n");
	}
	if(h==1){
		printf("C\n");
	}
	return 0;
}

Measured memory_bytes: 952
#include<stdio.h>
#include<string.h>
int main(){
  int i,n,j=0;
 char str[100];
  scanf("%s",str);
  
  
  n=strlen(str);
  
  for(i=0;i<n;i++){
    if(str[i]==str[n-i-1]){
      continue;
    }else{
      printf("No");
      return 0;
    }
  }
  for(i=0;i<((n-1)/2);i++){
    if(str[i]==str[((n-1)/2)-1-i]){
      continue;
    }else{
      printf("No");
      return 0;
    }
  }

  for(i=(n+3)/2-1;i<n-1;i++){
    if(str[i]==str[n-j-1]){
      j++;
      continue;
    }else{
      printf("No");
      return 0;
    }
  }
  printf("Yes");
}

Measured memory_bytes: 128
// G++ MACRO.CPP -STD=C++17
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
 
#define dump(x)  cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
#define possible(n) cout << ((n) ? "possible" : "impossible"  ) << endl
 
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
 
#define FOREACH(x,a) for(auto& (x) : (a) )
 
#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j])
 
#define SCOUT(x) cout<<(x)<<" "
#define ENDL cout<<endl
 
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i]
#define VECCOUT(x) if(1){for(auto tt=x.begin();tt!=x.end();tt++){if(tt!=x.begin())cout<<" ";cout<<(*tt);}cout<<endl;}
 
#define ALL(obj) (obj).begin(),(obj).end()
 
#define EXIST(n,x) (find(ALL(n),x)!=n.end())
#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end())
#define EN(x) if(1){cout<<#x<<endl;return 0;}
#define COUT(x) cout<<(x)<<endl
void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)
 
template <class T = ll>
T IN(){T x;cin>>x;return (x);}
 
template <class Head>
void VT(Head head){}
template <class Head,class Seco,class... Tail>
void VT(Head&& head,Seco&& seco,Tail&&... tail){
    seco.resize(head);
    VT(head,move(tail)...);
}
void VT2(){}
template <class Head,class... Tail>
void VT2(Head&& head,Tail&&... tail){
  VECCIN(head);
  VT2(move(tail)...);
}
 
template <class Head>
void VT3(Head&& head){}
template <class Head,class Seco,class... Tail>
void VT3(Head&& head,Seco&& seco,Tail&&... tail){
  seco[head]=IN();
  VT3(head,move(tail)...);
}
 
#define VC1(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);VT2(__VA_ARGS__); //aaabbbccc
#define VC2(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);REP(i,n)VT3(i,__VA_ARGS__); //abcabcabc
 
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision; // cpp_int
 
#define P pair<ll,ll>
#define V vector<ll>
#define M map<ll,ll>
#define S set<ll>
 
#define pb(a) push_back(a)
#define mp make_pair


int main(){
  
  CIN(n);VC1(n,a);
  M m;REP(i,n)m[a[i]]++;
  if(m[0])EN(0);
  FOREACH(xx,m)if(xx.second>2)EN(0);
  sort(ALL(a));
  bitset<25> bs;
  bs[0]=true;
  bs[24]=true;
  REP(i,n)
    bs[(i&1?a[i]:24-a[i])]=true;
  /*
  REP(i,25)
    SCOUT(bs[i]);ENDL;
  */
  int count=1;
  int ans=INF;
  FOR(i,1,25){
    if(!bs[i])count++;
    else{ans=min(ans,count);count=1;}
  }
  COUT(ans);

  return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int ans = -1;
        for(int i = 1;i <= 1000;i++){
            if((i*8)/100==a && (i*10)/100==b){
                ans = i;
                break;
            }

        }
        
        System.out.println(ans);
    }
}

Measured memory_bytes: 23892
// hello {{{
#include <bits/stdc++.h>
#include <unistd.h>
#define SZ(x) ((int)(x).size())
#define ALL(c) begin(c),end(c)
#define REP(i,n) for ( int i=0; i<(int)(n); i++ )
#define REP1(i,a,b) for ( int i=(int)(a); i<=(int)(b); i++ )
#define FOR(it,c) for ( auto it=(c).begin(); it!=(c).end(); it++ )
#define MP make_pair
#define PB push_back
using namespace std;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef long long LL;

void RI() {}

template<typename... T>
void RI( int& head, T&... tail ) {
    scanf("%d",&head);
    RI(tail...);
}

template<typename T>
void _dump( const char* s, T&& head ) { cerr<<s<<"="<<head<<endl; }

template<typename T, typename... Args>
void _dump( const char* s, T&& head, Args&&... tail ) {
    int c=0;
    while ( *s!=',' || c!=0 ) {
        if ( *s=='(' || *s=='[' || *s=='{' ) c++;
        if ( *s==')' || *s==']' || *s=='}' ) c--;
        cerr<<*s++;
    }
    cerr<<"="<<head<<", ";
    _dump(s+1,tail...);
}

#define dump(...) _dump(#__VA_ARGS__, __VA_ARGS__);

template<typename Iter>
ostream& _out( ostream &s, Iter b, Iter e ) {
    s<<"[";
    for ( auto it=b; it!=e; it++ ) s<<(it==b?"":" ")<<*it;
    s<<"]";
    return s;
}

template<typename A, typename B>
ostream& operator <<( ostream &s, const pair<A,B> &p ) { return s<<"("<<p.first<<","<<p.second<<")"; }
template<typename T>
ostream& operator <<( ostream &s, const vector<T> &c ) { return _out(s,ALL(c)); }
template<typename T>
ostream& operator <<( ostream &s, const set<T> &c ) { return _out(s,ALL(c)); }
template<typename A, typename B>
ostream& operator <<( ostream &s, const map<A,B> &c ) { return _out(s,ALL(c)); }
// }}}

int N;
LL K;
vector<LL> A, F, AF;

void input() {
    RI(N); scanf("%lld", &K);
    REP(i, N) {
        int a; RI(a);
        A.PB(a);
    }
    REP(i, N) {
        int a; RI(a);
        F.PB(a);
    }
}

bool C(LL k) {
    LL s = 0;
    REP(i, N) {
        if(AF[i] > k) {
            s += (A[i] - k/F[i]);
        }
        if(s > K) return true;
    }
    return false;
}

void solve() {
    sort(ALL(A));
    sort(ALL(F), greater<int>());

    #ifdef DEBUG
    REP(i, N)
        cout << F[i] << ' ';
    cout << endl;
    #endif

    REP(i, N) {
        AF.PB(A[i] * F[i]);
    }

    LL lb = 0, ub = 1e18;
    REP(i, 100) {
        LL mid = (lb + ub) / 2;
        if(C(mid)) {
            lb = mid;
        } else {
            ub = mid;
        }
    }
    printf("%lld\n", ub);
}

int main( int argc, char *argv[] ) {
    input();
    solve();
    return 0;
}


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

int main()
{
    int i;
    int a[4];
    for(i=0;i<4;i++)
        scanf("%1d",&a[i]);
    if(a[0]+a[1]+a[2]+a[3]==7)
    {printf("%d+%d+%d+%d=7",a[0],a[1],a[2],a[3]);
    return 0;
    }
    if(a[0]+a[1]+a[2]-a[3]==7)
    {printf("%d+%d+%d-%d=7",a[0],a[1],a[2],a[3]);
    return 0;
    }
    if(a[0]+a[1]-a[2]+a[3]==7)
    {printf("%d+%d-%d+%d=7",a[0],a[1],a[2],a[3]);
    return 0;
    }
    if(a[0]+a[1]-a[2]-a[3]==7)
    {printf("%d+%d-%d-%d=7",a[0],a[1],a[2],a[3]);
    return 0;
    }
    if(a[0]-a[1]+a[2]+a[3]==7)
    {printf("%d-%d+%d+%d=7",a[0],a[1],a[2],a[3]);
    return 0;
    }
    if(a[0]-a[1]+a[2]-a[3]==7)
    {printf("%d-%d+%d-%d=7",a[0],a[1],a[2],a[3]);
    return 0;
    }
    if(a[0]-a[1]-a[2]+a[3]==7)
    {printf("%d-%d-%d+%d=7",a[0],a[1],a[2],a[3]);
    return 0;
    }
    if(a[0]-a[1]-a[2]-a[3]==7)
    {printf("%d-%d-%d-%d=7",a[0],a[1],a[2],a[3]);
    return 0;
    }
    return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

ll n,m,ans;
int main(){
	scanf("%lld%lld",&n,&m);
	if((n^m)&1)puts("IMPOSSIBLE");
	else printf("%lld",(n+m)/2);
}

Measured memory_bytes: 128
import java.util.*;
import java.io.*;
import java.math.*;


import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;


public class Main{ 


    static long mod=1000000007;
     static int dx[]={1,-1,0,0};
       static int dy[]={0,0,1,-1};
    // static int dx[]={1,-1,0,0,1,1,-1,-1};
    // static int dy[]={0,0,1,-1,1,-1,1,-1};
    // PriorityQueue<Integer> que = new PriorityQueue<Integer>(); 
    //HashMap<Integer,Integer> map = new HashMap<Integer,Integer>();

public  static void main(String[] args)   throws Exception, IOException{

    
    Reader sc = new Reader(System.in);
    PrintWriter out=new PrintWriter(System.out);

    //  int n=sc.nextInt();  
    int n=sc.nextInt();
    int a=sc.nextInt();
    int b=sc.nextInt();
    int s[] = new int[n];
    long sum = 0,ans=0;
    for( int i=0; i<n; i++ ) s[i] =  sc.nextInt();

    sort(s);
    int up=1<<30,dw=0,mid=0;
    long bs=0,as=0;
    for( int i=0; i<55; i++ ){
        mid=(up+dw)/2;
        bs= (long)mid*b;
        boolean f=false;
        long tmp=0, q=0;
        // db(mid,bs);
        for( int t=n-1; -1<t; t-- ){
            tmp=s[t]-bs;
            if(0>=tmp){f=true;break;}
            q += tmp / (a-b);
            if(tmp % (a-b) > 0)q++;
            if(q>mid)break;
        }
        if(q<=mid)f=true;
        if(f){
            ans=mid;
            up=mid;
        }
        else {
            dw=mid;
        }
    }
    

    out.println(ans);
    out.flush();
}

static void db(Object... os){

    System.err.println(Arrays.deepToString(os));

}

static boolean validpos(int x,int y,int r, int c){
    
    return x<r && 0<=x && y<c && 0<=y;
    
}
 
static boolean bit(long x,int k){
    // weather k-th bit (from right) be one or zero
    return  ( 0 < ( (x>>k) & 1 )  )  ? true:false;
}

}


class XY {
    int x,y,d;
    XY(int x, int y, int d) {
        this.x=x;
        this.y=y;
        this.d=d;
    } 
}

class P implements Comparable<P>{
    int x,y;
    P(int x, int y) {
        this.x=x;
        this.y=y;
    } 
      
    public int compareTo(P p){
        return x - p.x;
    } 
}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}



Measured memory_bytes: 35280
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <queue>

using namespace std;

#define lli long long int
#define REP(i,n) for(int i=0;i<n;i++)
#define REP2(i,n) for(int i=1;i<=n;i++)
#define DEBUG 0

typedef struct UnionFind{
	vector<lli> par; //par[i]:iの親番号 par[3] = 2 : 3の親が2
	vector<lli> size;//size[i]:iの大きさ 自分のみのときは1,根っこにsizeを持たせる*/

	UnionFind(int N){/*最初はすべてが根であると初期化*/
		REP(i,N){
			par.push_back(i);
			size.push_back(1);
		}
	}

	lli root(lli x){/*データxが属する木の根を再起で得る root(x) = {xの木の根}}*/
		if(par[x] == x)return x;
		return par[x] = root(par[x]);
	}

	void unite(lli x,lli y){/*xとyの併合*/
		lli rx = root(x);
		lli ry = root(y);
		if(rx == ry)return;
		par[rx] = ry; /*xとyの根が同じじゃない: xの根をrxをyの根ryに変更する */
		lli resize = size[rx] + size[ry];
		size[rx] = resize;
		size[ry] = resize;
	}

	bool same(lli x,lli y){
		lli rx = root(x);
		lli ry = root(y);
		return rx == ry;
	}

	lli getSize(lli x){
		lli rx = root(x);
		return size[rx];
	}
};

int main(){

	lli n,m;
	cin>>n>>m;
	vector<lli> a(m),b(m);
	UnionFind uf(n);

	REP(i,m){
		lli ta,tb;
		cin>>ta>>tb;
		ta--;
		tb--;
		a[i] = ta;
		b[i] = tb;
	}

	vector<lli> ans(m,0);
	ans[m-1] = n*(n-1)/2;

	for(lli i=m-1;i>0;i--){
		if(uf.same(a[i],b[i])){
			ans[i-1] = ans[i];
		}
		else{
			ans[i-1] = ans[i] - uf.getSize(a[i]) * uf.getSize(b[i]);
			uf.unite(a[i],b[i]);
		}
	}
	REP(i,m){
		cout<<ans[i]<<endl;
	}

	return 0;
}

Measured memory_bytes: 5484
#include "bits/stdc++.h"
using namespace std;
int main(void){
  string ans;
  int Al,Bl,Cl;
  char A[10],B[10],C[10];
  cin >> A >> B >> C;
  Al = strlen(A);
  Bl = strlen(B);
  Cl = strlen(C);
  if (A[Al-1]==B[0] && B[Bl-1]==C[0])
    ans = "YES";
  else
    ans = "NO";
  cout << ans << endl;
}


Measured memory_bytes: 256
#pragma GCC optimize (3)
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define PII pair<ll,ll>
#define ll long long
#define ull unsigned long long
#define INFI 2147483647
#define INFL 9223372036854775807
#define INFU 18446744073709551615
using namespace std;
const double PI=acos(-1.0);
const double eps=1e-6;
char s[110];
ll k;
int main()
{
	//ios_base::sync_with_stdio(false);
    //cin.tie(0);
    //cout.tie(0);
    while(scanf("%s",s+1) && cin>>k){
        ll len=strlen(s+1),Front=1,Back=1,j,hit=1;
        ll ans=0;
        bool flag=0;
        bool pure=1;
        for(int i=2;i<=len;i++) if(s[i]!=s[i-1]) pure=0;
        if(len==1) cout<<k/2LL<<endl;
        else if(pure==1) cout<<k*len/2LL<<endl;
        else{
            for(ll i=2;i<=len;i++){
                if(flag==0 && s[i]==s[i-1]){
                    flag=1;
                    hit=2;
                    if(i==len){
                        //printf("hit=%lld\n",hit);
                        ans+=(hit/2LL);
                    }
                }
                else if(flag==0 && s[i]!=s[i-1]);
                else if(flag==1 && s[i]==s[i-1]){
                    hit++;
                    if(i==len){
                        //printf("hit=%lld\n",hit);
                        ans+=(hit/2LL);
                    }
                }
                else if(flag==1 && s[i]!=s[i-1]){
                    flag=0;
                    //printf("hit=%d\n",hit);
                    ans+=(hit/2LL);
                    hit=1LL;
                }
                else;
            }
            ans*=k;
            //cout<<ans<<endl;
            if(s[1]==s[len]){
                for(j=2;s[j]==s[j-1];j++);
                Front=j-1;
                for(j=len-1;s[j]==s[j+1];j--);
                Back=len-j;
                //printf("Front=%d\n",Front);
                //printf("Back=%d\n",Back);
                ans-=((Front/2LL)*(k-1));
                ans-=((Back/2LL)*(k-1));
                ans+=((Front+Back)/2LL*(k-1));
            }
            cout<<ans<<endl;
        }
    }
	return 0;
}


Measured memory_bytes: 256
import re

def calc(people):
    Ws = 0
    Es = people[1:].count("E")
    ans = Ws + Es

    for i in range(1, len(people)):
        if people[i] == "E":
            Es -= 1
        
        if people[i - 1] == "W":
            Ws += 1

        ans = min(ans, Ws + Es)
    
    return ans


if __name__ == "__main__":
    _ = input()
    people = input()

    print(calc(people))


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

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

ll mod(ll a){
  return (a % 1000000007);
}

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


int main(){
  ll a,b; cin >> a >> b;
  
  cout << lcm(a,b) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;   
using ll = long long;
//const ll INF = 1e9 + 5;

void max_self(ll& a, ll b) {
	a = max(a, b);
}

int main() 
{ 
	ll n, w; cin >> n >> w;
	vector<ll > dp(w + 1);
	for(ll item = 0; item < n; item++) {
		ll weight, value;
		cin >> weight >> value;
		for(ll weight_already = w - weight; weight_already >= 0; weight_already--) {
			max_self(dp[weight_already + weight], dp[weight_already] + value);
		}
	}
	ll answer = 0;
	for(ll i=0; i <= w; i++) {
		max_self(answer, dp[i]);
	}
	cout << answer;
    return 0; 
} 

Measured memory_bytes: 1024