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

int main(void){
    int n;
    cin >> n;
    int sum = 0;
    int x[n],y[n];
    for(int i = 0;i < n;i++)cin >> x[i];
    for(int i = 0;i < n;i++)cin >> y[i];
    for(int i = 0;i < n;i++){
        if(x[i] - y[i] > 0)sum += x[i] - y[i];
    }
    cout << sum;
}

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

int main(){
  int count = 1;
  int d = 0;
  int N;
  int limit;
  cin >> N >> limit;
  rep(i,N){
    int l;
    cin >> l;
    d += l;
    if(d<=limit) count++;
    else break;
    
  }
  cout << count << endl;
}

Measured memory_bytes: 256
line = input().split(" ")
a = max(int(line[0])-1,0)
b = max(int(line[1])-1,0)

h = 100
w = 100
m = []

for hi in range(h):
    if hi<50:
        m.append(["#" for _ in range(w)])
    else:
        m.append(["." for _ in range(w)])

for ai in range(a//50):
    for i in range(50):
        m[2*ai][2*i] = "."
for ai in range(a%50):
    m[2*(a//50)][2*ai] = "."

for bi in range(b//50):
    for i in range(50):
        m[50+2*bi+1][2*i] = "#"
for bi in range(b%50):
    m[50+2*(b//50)+1][2*bi] = "#"

print(str(h)+" "+str(w))
for hi in range(h):
    print("".join(m[hi]))


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

#define int             long long int
#define ff              first
#define ss              second
#define pb              push_back

#define vi              vector <int>
#define pii             pair <int, int>

#define loop(i,s,e)     for(int i=s;i<e;i++)
#define rloop(i,e,s)    for(int i=e;i>=s;i--)
#define mset(a,f)       memset(a,f,sizeof(a))

#define endl            "\n"
#define sz(x)           ((int) x.size())
#define all(p)          p.begin(), p.end()

#define bug(...)        __f (#__VA_ARGS__, __VA_ARGS__)
#define print(a)        for (auto x : a) cout << x << " "; cout << endl
#define Print(a,x,y)    for (int i=x; i<y; i++) cout<< a[i]<< " "; cout << endl



template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr (names + 1, ',');
	cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

const int N = 200005;


void solve()
{
	int x;
	cin >> x;
	int ans;
	if (x >= 400 and x <= 599) ans = 8;
	else if (x >= 600 and x <= 799) ans = 7;
	else if (x >= 800 and x <= 999) ans = 6;
	else if (x >= 1000 and x <= 1199) ans = 5;
	else if (x >= 1200 and x <= 1399) ans = 4;
	else if (x >= 1400 and x <= 1599) ans = 3;
	else if (x >= 1600 and x <= 1799) ans = 2;
	else if (x >= 1800 and x <= 1999) ans = 1;
	cout << ans << endl;

}

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

#ifndef ONLINE_JUDGE
	freopen("input.txt",  "r",  stdin);
	freopen("output.txt", "w", stdout);
#endif

	int t = 1;
	//cin >> t;
	while (t--) solve();

	return 0;
}

Measured memory_bytes: 3636
/* Everything happens for a reason.
Be patient, things will be at their rightful place.
It was meant to happen this way, accept it.
And now decide what you can make out of this life.
*/
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define ip pair<ll,ll>
#define vii vector<ll>
#define vpp vector<ip>
#define vdd vector<ld>
#define vb vector<bool>
#define pi  pair<ll,ip>
#define sc(x) scanf("%lli",&x)
#define c(x) cin >> x
#define fo(i,k,n) for( int i=k;i<n;i++)
#define hu 200010
#define pq priotity_queue<ll>
#define pqs priority_queue<ll,vii,greater<ll>>
#define ppq priority_queue<ip,vpp,greater<ip>>
#define INF INT_MAX
#define ff first
#define ss second
using namespace std;
const ll M = 1000000000+7;
//Grid Movement
ll dx[] = {-1, 0, 1, 0};
ll dy[] = {0, -1, 0, 1};

ld Pi= acos(-1);

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

ll mex(ll x, ll y) 
{ 
	ll res = 1;	  
	x = x % M; 
	if (x == 0) return 0; 
	while (y > 0) 
	{ 
		if (y & 1) 
		res = (res*x) % M; 
		y = y>>1; 
		x = (x*x) % M; 
	} 
	return res; 
} 

bool comp(ll comp1,ll comp2)
{
    return comp1>comp2;
}

void yes()
{
    printf("YES\n");
}

void no()
{
    printf("NO\n");
}

ll inv(ll a, ll m)
{
    ll m0 = m;
    ll y = 0, x = 1;
 
    if (m == 1)
      return 0;
 
    while (a > 1)
    {
        int q = a / m;
        int t = m;
        m = a % m, a = t;
        t = y;
        y = x - q * y;
        x = t;
    }
 
    if (x < 0)
       x += m0;
 
    return x;
}

void sieve(ll n)
{
    vii primes(n+1);
    vb is_prime(n+1);
	is_prime.resize(n+1);
	primes.resize(n+1);
 
	is_prime[0] = is_prime[1] = false;
	for(int i = 2; i<=n; i++)
	{
	    if(is_prime[i])
	    {
	    	primes.pb(i);
	        for (int j = i*i; j<=n; j+=i)
	            is_prime[j] = false;
	    }
	}
}


int main()
{
    string s,t;
    cin >>s >> t;
    ll n1 = s.size(),n2 = t.size();
    ll miny = INF;
    fo(i,0,n1-n2+1)
    {
        ll cnt = 0;
        fo(j,0,n2)
        {
            if(t[j]!=s[i+j]) cnt++;
        }
        miny = min(miny,cnt);
    }
    cout << miny << endl;
}





Measured memory_bytes: 3624
from operator import itemgetter
N,M = map(int,input().split())

AB = []
for i in range(N):
    Ai,Bi = map(int,input().split())
    AB.append([Ai,Bi])

AB.sort(key=itemgetter(1),reverse=True)
AB.sort(key=itemgetter(0))
from heapq import heappush, heappop
hq = []
i = 0
now = 1
ans = 0
while True:
    if i == N:
        if now <= M:
            if len(hq) == 0:
                break
            ans -= heappop(hq)
            now += 1
            continue
        else:
            break
    if AB[i][0] == now:
        heappush(hq,-AB[i][1])
        i += 1
        continue
    else:
        if now > M:
            break
        if len(hq) == 0:
            now += 1
            continue
        ans -= heappop(hq)
        now += 1
print(ans)


Measured memory_bytes: 75776
#include <stdlib.h>

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <vector>
using namespace std;

typedef pair<int, int> pll;
typedef long long ll;
const int maxn = 3111;
char s[maxn], t[maxn];
int dp[maxn][maxn];
int main() {
    scanf("%s%s", s + 1, t + 1);
    scanf("%s", t + 1);
    int len = strlen(s + 1), len_ = strlen(t + 1);
    for (int i = len; i >= 1; --i) {
        for (int j = len_; j >= 1; --j) {
            if (s[i] == t[j])
                dp[i][j] = dp[i + 1][j + 1] + 1;
            else
                dp[i][j] = max(dp[i + 1][j], dp[i][j + 1]);
        }
    }
    int l = 1, r = 1;
    while (l <= len && r <= len_) {
        if (s[l] == t[r]) {
            printf("%c", s[l]);
            l++, r++;
        } else if (dp[l][r] == dp[l + 1][r])
            l++;
        else
            r++;
    }
    puts("");
    return 0;
}


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

const int maxe = 2e5+5;

ll t=1, n, x, k;

void solve(){
	string s;
	cin >> s;
	ll num =0;
	for(int i=0; i<s.length(); i++){
		num += s[i]-'0';
	}
	if(num%9 == 0) cout << "Yes";
	else cout << "No";
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	while(t--){
		solve();
	}
    return 0;
}


Measured memory_bytes: 3740
import java.util.*;

class Main{
	
	public static void main(String args[]){

		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();

		ArrayList<Integer> arr = new ArrayList<>();

		for(int n=0;n<N;n++){
			arr.add(sc.nextInt());
		}
		ArrayList<Integer> sarr = new ArrayList<>(arr);

		Collections.sort(sarr);

		for(int n=0;n<N;n++){
			
			if(arr.get(n)<=sarr.get(N/2-1)){
				System.out.println(sarr.get(N/2));
			}
			else{
				System.out.println(sarr.get(N/2-1));
			}
		}
	}
}

Measured memory_bytes: 97212
N = int(input())
A = list(map(int,input().split()))
B = [0] * N
ans = 0
for i in range (N):
 if i == 0:
  B[0] = A[0]
 else:
  if B[i-1] > A[i]:
   B[i] = B[i-1]
   ans = ans + B[i-1] - A[i]
  else:
   B[i] = A[i]
   ans = ans
print (ans)


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

const ll MOD = 1000000007;
const ll MAX = 10000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


int main(){
  COMinit();
  int S;
  cin >> S;
  ll ans = 0;
  int n = (S+2) / 3;
  for ( int i=1; i<=n; i++) {
    ans += COM( S-(i*3) + (i-1), i-1);
    ans %= MOD;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3800
#include <iostream>
#include <sstream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <bitset>
#include <functional>
#include <random>
#define REP(i,a,n) for(int i=a;i<=n;++i)
#define PER(i,a,n) for(int i=n;i>=a;--i)
#define hr putchar(10)
#define pb push_back
#define lc (o<<1)
#define rc (lc|1)
#define mid ((l+r)>>1)
#define ls lc,l,mid
#define rs rc,mid+1,r
#define x first
#define y second
#define io std::ios::sync_with_stdio(false)
#define endl '\n'
#define DB(a) ({REP(__i,1,n) cout<<a[__i]<<',';hr;})
using namespace std;
typedef long long ll;
const int N = 210, P = 998244353;
int n,x[N],y[N],po[N];

int main() {
	po[0]=1;
	REP(i,1,N-1) po[i]=po[i-1]*2ll%P;
	scanf("%d",&n);
	REP(i,1,n) scanf("%d%d",x+i,y+i);
	int ans = (po[n]-1-n*(n+1)/2)%P;
	REP(i,1,n) REP(j,i+1,n) {
		int cnt = 0;
		REP(k,j+1,n) if ((x[j]-x[i])*(y[k]-y[i])==(x[k]-x[i])*(y[j]-y[i])) ++cnt;
		ans = (ans-po[cnt]+1)%P;
	}
	if (ans<0) ans+=P;
	printf("%d\n", ans);
}








Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,ans;string a;map<string,bool> vs;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;++i) {cin>>a;if(!vs[a]) vs[a]=1,++ans;}
	printf("%d\n",ans);return 0;
}

Measured memory_bytes: 19304
#include <iostream>
#include <math.h>
#include <iomanip>

 int main(){
 int R;
 std::cin>>R;

 const double pi=acos(-1.0);

 double answer=2*R*pi;

 std::cout<<std::setprecision(20)<<std::fixed<<answer<<std::endl;


 return 0;
 }

Measured memory_bytes: 3784
[N,A,B,C] = list(map(int,input().split()))
L = []
for i in range(N):
    L.append(int(input()))

import itertools
cases = list(itertools.product([0,1,2,3], repeat=N))

out = float("inf")

for case in cases:
    As =[]
    Bs =[]
    Cs =[]
    for i in range(N):
        if case[i]==1:
            As.append(i)
        if case[i]==2:
            Bs.append(i)
        if case[i]==3:
            Cs.append(i)
    LA, LB, LC = len(As),len(Bs),len(Cs)
    if LA*LB*LC==0:
        continue
    point = (LA-1)*10 + (LB-1)*10 + (LC-1)*10

    Ah = 0
    for take in As:
        Ah+=L[take]
    Bh = 0
    for take in Bs:
        Bh+=L[take]
    Ch = 0
    for take in Cs:
        Ch+=L[take]
    point += abs(A-Ah) + abs(B-Bh) + abs(C-Ch)

    if point < out:
        out = point

print(out)


Measured memory_bytes: 65444
/*
Author : N_o_o_B
Created : April 22 2020 16:04:57 
*/
#include <bits/stdc++.h>
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
*/
#define TRACE
#ifdef TRACE
#define trace(...) { cerr<<"[ "; __trace__(#__VA_ARGS__, __VA_ARGS__);}
#undef endl
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const pair<Arg1,Arg2> &x) {
    return out<<"("<<x.first<<","<<x.second<<")";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const vector<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const set<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const map<Arg1,Arg2> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
void __trace__(const string name, Arg1&& arg1){
    cerr << name << " : " << arg1 << " ] " << endl;
}
 
template <typename Arg1, typename... Args>
void __trace__(const string names, Arg1&& arg1, Args&&... args){
    const string name = names.substr(0,names.find(','));
    cerr<<name<<" : "<<arg1<<" | ";
    __trace__(names.substr(1+(int)name.size()), args...);
}
#else
    #define trace(args...)
#endif
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vll;
typedef vector<vl> vvl;
//typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> oset;
#define fori(i,n) for(int i=0;i<n;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repd(i,a,b) for(int i=a;i>=b;i--)
#define ford(i,n)  for(int i=n-1;i>=0;i--)
#define trav(x,a) for(auto& x:a)
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define sz(a) (int)a.size()
#define fi first
#define se second
clock_t time_p=clock();
void time_taken()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
//const ll mod=998244353;
const ll mod=1e9+7;
const ll INF=1e18;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    cout.precision(12);cout << fixed;

    int n,m,x;
    cin >> n >> m >> x;
    vi a(n+1);
    fori(i,m){
        int x;
        cin >> x;
        a[x]=1;
    }
    int ans1 = 0;
    fori(i,x){
        ans1 += a[i];
    }
    cout << min(ans1,m-ans1) << endl;

    time_taken();
    return 0;
}

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] a = new long[n];
        for (int i = 0 ; i < n ; i++) {
            a[i] = sc.nextLong();
        }
        int[] b = new int[60];

        for (int i = 0 ; i < 60 ; i++) {
            int c = 0;
            for (int j = 0 ; j < n ; j++) {
                if (a[j] % 2 == 1) {
                    c++;
                }
                a[j] /= 2;
            }
            b[i] = c;
        }
        long ans = 0;
        long mod = (long) (1e9 + 7);
        for (int i = 0 ; i < 60 ; i++) {
            ans += (1L << i) % mod * b[i] % mod * (n - b[i]) % mod;
            ans %= mod;
        }
        System.out.println(ans % mod);
    }

}


Measured memory_bytes: 98368
import Data.List (sort)
import Control.Monad (forM)

main = do
  _ <- read <$> getLine :: IO Int
  ss <- map sort.lines <$> getContents :: IO [String]
  sss <- forM "abcdefghijklmnopqrstuvwxyz" $ \c ->
            return $ map (takeWhile (==c).dropWhile (/=c)) ss
  let ls = map (minimum.map length) sss
      ans = concat $ zipWith (\l x-> take l$repeat x) ls "abcdefghijklmnopqrstuvwxyz"
  putStrLn ans


Measured memory_bytes: 1148
/*  -*- coding: utf-8 -*-
 *
 * a.cc: A - Transfer
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

/* typedef */

/* global variables */

/* subroutines */

/* main */

int main() {
  int a, b, c;
  scanf("%d%d%d", &a, &b, &c);

  printf("%d\n", max(c - (a - b), 0));
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<int, int>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};


int main(){
    int n, m;
    cin >> n;
    vector<string> s(n);
    rep(i, n) cin >> s[i];
    cin >> m;
    vector<string> t(m);
    rep(i, m) cin >> t[i];
    int ans = 0;

    vector<string> u = s;
    UNIQUE(u);
    rep(i, u.size()) {
        int score = 0;
        string now = u[i];
        rep(j, n) {
            if (s[j]==now) score++;
        }
        rep(j, m) {
            if (t[j]==now) score--;
        }
        ans = max(ans, score);
    }
    
    cout << ans << endl;
    return 0;
}


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

int main() {
    int n;
    string s;
    cin >> n >> s;
    if (n % 2 == 0 && s.substr(0, n / 2) == s.substr(n / 2, n / 2))
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        List<List<Integer>> ans = new ArrayList<>();
        List<Integer> lst = new ArrayList<>();
        int[] nums = new int[]{a,b,c};
        for (int n : nums) {
            lst.add(n);
        }
        rec(ans, new ArrayList<>(), lst);
        //System.out.println(ans);
        int max = 0;
        for (List<Integer> l : ans) {
            int oko = l.get(0) * 10 + l.get(1) + l.get(2);
            max = Math.max(oko, max);
        }
        System.out.println(max);
    }

    private static void rec(List<List<Integer>> ans, List<Integer> one, List<Integer> lst){
        if(lst.isEmpty()) {
            ans.add(one);
            return ;
        }

        for(int i=0;i < lst.size();i++){
            List<Integer> next = new ArrayList<>(one);
            List<Integer> temp = new ArrayList<>(lst);
            next.add(lst.get(i));
            temp.remove(i);
            rec(ans, next, temp);
        }
    }
}


Measured memory_bytes: 21076
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define print(A,x,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i]x;}cout<<endl;
#define pprint(A,y,m,n) rep(j,0,m){print(A[j],y,n);}
const long mod=1e9+7;
const int size=2e5;
const int inf=1e9;
int main(){
	int A,B,C,D,E,F;cin>>A>>B>>C>>D>>E>>F;
	bool valid[2][F+40];
	valid[0][0] = 1; valid[1][0] = 1;
    rep(i,1,F+1){
        valid[0][i] = 0;
        valid[1][i] = 0;
    }
	rep(i,0,F+1){
        if(valid[0][i]){
            valid[0][i+A] = 1;
            valid[0][i+B] = 1;
        }if(valid[1][i]){
            valid[1][i+C] = 1;
            valid[1][i+D] = 1;
        }
	}
	double ans = 0;
    int a=100*A,b=0;
	rep(i,0,F+1)rep(j,0,i * E + 1){
		if(100*i + j <= F)if(valid[0][i] && valid[1][j]){
			double res = 100.0 * j / (100*i + j);
            if(ans < res){
                ans = res;
                a = 100*i + j;
                b = j;
            }
		}
	}cout<<a<<" "<<b<<endl;
}

Measured memory_bytes: 256
import sys
readline=sys.stdin.readline

X,N=map(int,readline().split())
P=set(list(map(int,readline().split())))

x = X
while x in P:
  x -= 1

minX = x

x = X
while x in P:
  x += 1
maxX = x

if abs(minX - X) <= abs(maxX - X):
  print(minX)
else:
  print(maxX)


Measured memory_bytes: 9196
MOD = 1000000007


def main():
    H, W, K = map(int, input().split())
    dp = [[0 for _ in range(W)] for _ in range(H + 1)]
    dp[0][0] = 1
    for i in range(H):
        for j in range(W):
            for k in range(1 << (W - 1)):
                ok = True
                for l in range(W - 2):
                    # 橋が隣同士で重なっていないかの確認
                    if (k >> l) & 1 and (k >> (l + 1)) & 1:
                        ok = False

                if (ok):
                    if 1 <= j and (k >> (j - 1)) & 1:
                        dp[i + 1][j - 1] = (dp[i + 1][j - 1] + dp[i][j]) % MOD
                    elif j <= W - 2 and (k >> j) & 1:
                        dp[i + 1][j + 1] = (dp[i + 1][j + 1] + dp[i][j]) % MOD
                    else:
                        dp[i + 1][j] = (dp[i + 1][j] + dp[i][j]) % MOD

    print(dp[H][K - 1])

main()


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


signed  main(){

	int t;
	t=1;
	//cin >> t;
	while(t--){
	 
	 int a,v,b,w,t;
	 cin>>a>>v>>b>>w>>t;
	 
	
	
	 if(a<b)
	 {
	     a=a+v*t;
	     b=b+w*t;
	     
	     if(b<=a)
	     {
	         cout<<"YES"<<endl;
	         
	     }
	     else
	     {
	         cout<<"NO"<<endl;
	     }
	 }
else
{
    a=a-v*t;
    b=b-w*t;
    
    if(b>=a)
    {
        cout<<"YES"<<endl;
    }
    else
    {
        cout<<"NO"<<endl;
    }
    
    
}
	 
	 
	    
	}
	return 0;
}






Measured memory_bytes: 3624
#include<stdio.h>
#include<math.h>

int main(void){

while(1){
int n;
scanf("%d",&n);
if(n==-1)break;
double th=0.0;
for(int i=1;i<=n-1;i++)th+=asin(1/sqrt(i+1));
double x=sqrt(n)*cos(th);
double y=sqrt(n)*sin(th);
printf("%lf\n%lf\n",x,y);

}

return 0;
}


Measured memory_bytes: 2028
A, B, C, X, Y = map(int, input().split())

total = 0
share = min(X, Y)
X -= share
Y -= share
if A+B <= 2*C:
    total += share * (A+B)
else:
    total += share * 2 * C

if X > 0:
    if A < 2 * C:
        total += A * X
    else:
        total += 2 * C * X

if Y > 0:
    if B < 2 * C:
        total += B * Y
    else:
        total += 2 * C * Y

print(total)


Measured memory_bytes: 3060
/* template.cpp {{{ */
#include <bits/stdc++.h>
using namespace std;
#define get_macro(a, b, c, d, name, ...) name
#define rep(...) get_macro(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep(...) get_macro(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
#define rep1(n) rep2(i_, n)
#define rep2(i, n) rep3(i, 0, n)
#define rep3(i, a, b) rep4(i, a, b, 1)
#define rep4(i, a, b, s) for (ll i = (a); i < (ll)(b); i += (ll)(s))
#define rrep1(n) rrep2(i_, n)
#define rrep2(i, n) rrep3(i, 0, n)
#define rrep3(i, a, b) rrep4(i, a, b, 1)
#define rrep4(i, a, b, s) for (ll i = (ll)(b) - 1; i >= (ll)(a); i -= (ll)(s))
#define each(x, c) for (auto &&x : c)
#define fs first
#define sc second
#define all(c) begin(c), end(c)
using ui = unsigned;
using ll = long long;
using ul = unsigned long long;
using ld = long double;
const int inf = 1e9 + 10;
const ll inf_ll = 1e18 + 10;
const ll mod = 1e9 + 7;
const ll mod9 = 1e9 + 9;
const int dx[]{-1, 0, 1, 0, -1, 1, 1, -1};
const int dy[]{0, -1, 0, 1, -1, -1, 1, 1};
template<class T, class U> void chmin(T &x, const U &y){ x = min<T>(x, y); }
template<class T, class U> void chmax(T &x, const U &y){ x = max<T>(x, y); }
struct prepare_ { prepare_(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(12); } } prepare__;
/* }}} */

int n;
int a[1000];

int main(){
  cin >> n;
  rep(i, n) cin >> a[i];
  int res = -1;
  rep(i, n) rep(j, i){
    string s = to_string(a[i] * a[j]);
    bool f = true;
    rep(k, s.size() - 1) f &= s[k] + 1 == s[k + 1];
    if (f) chmax(res, a[i] * a[j]);
  }
  cout << res << endl;
}

Measured memory_bytes: 3272
#include <stdio.h>
int main(){
int a, b, c, h, w;

	while(1){
	scanf("%d %d", &h, &w);
		if(h >= 300 && w >= 300) break;
		if(h == 0 && w == 0) break;
		if(h >= 3 || w <= 100){ 
		for(a = 0; a < h ; a++){
			for(b = 0 ; b < w ; b++){
					if(a == 0 || a == h - 1 || b == 0 || b == w - 1){
						printf("#");
					}else{
						printf(".");
					}
				}
			printf("\n");
			}
			printf("\n");
	}
	}
	
	return 0;

}

Measured memory_bytes: 572
#include<bits/stdc++.h>
#include<cmath>
#include<cstring>
#include<climits>
#define int long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define asc(a,n) sort(a,a+n);
#define dsc(a,n) sort(a,a+n,comp);
#define fo(i,x,y) for(int i=x;i<y;i++)
#define inarr(x) int n; cin>>n; int x[n]; fo(i,0,n){cin>>x[i];}
#define test int t; cin>>t; while(t--)
using namespace std;

int basic(){freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);return 0;}
bool comp(int a,int b){return a>b;}



int32_t main()
{ //basic(); 
  fast; 
  int k; cin>>k; int sum=100; int i=0;
  for( i=0; sum<k;i++)
  {
  	sum=sum+(sum/100);
  	//cout<<sum<<" "<<i<<endl;
  } cout<<i;
  	
   
return 0;
}







Measured memory_bytes: 3648
S = input()
N = len(S)

tmp1, tmp2 = [], []
flag = 0
for i in range(int((N-1)/2)):
  tmp1.append(S[i])
for i in range(int((N+3)/2)-1,N):
  tmp2.append(S[i])
#print(tmp1, tmp2)
if tmp1 == tmp2:
  flag = 1
  
if flag == 1:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3188
#include "bits/stdc++.h"
using namespace std;
typedef long long int lint;
typedef pair<lint, lint> plint;
typedef pair<double long, double long> pld;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(lint i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(lint i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first - r.first, l.second - r.second); }
const lint MOD = 1e9 + 7, INF = 1e18;

lint N, arr[100000], sums[100000];
int main() {
	cin.tie(0); ios_base::sync_with_stdio(false);
	cin >> N;
	REP(i, N) {
		cin >> arr[i];
	}
	bool flag;
	lint sum = 0;
	lint ans = 0;

	sums[0] = arr[0];
	REP(i, N - 1) {
		sums[i + 1] = arr[i + 1] + sums[i];
	}


	flag = false;
	REP(i, N) {
		sums[i] += sum;
		if (flag ^ ((i % 2) == 1)) {
			if (sums[i] >= 0) {
				sum -= (sums[i] + 1);
				ans += abs(sums[i] + 1);
				sums[i] -= (sums[i] + 1);
			}
		}
		else {
			if (sums[i] <= 0) {
				sum -= (sums[i] - 1);
				ans += abs(sums[i] - 1);
				sums[i] -= (sums[i] - 1);
			}
		}
	}


	lint tmp = ans;
	sum = 0; ans = 0;
	sums[0] = arr[0];
	REP(i, N - 1) {
		sums[i + 1] = arr[i + 1] + sums[i];
	}
	flag = true;
	REP(i, N) {
		sums[i] += sum;
		if (flag ^ ((i % 2) == 1)) {
			if (sums[i] >= 0) {
				sum -= (sums[i] + 1);
				ans += abs(sums[i] + 1);
				sums[i] -= (sums[i] + 1);
			}
		}
		else {
			if (sums[i] <= 0) {
				sum -= (sums[i] - 1);
				ans += abs(sums[i] - 1);
				sums[i] -= (sums[i] - 1);
			}
		}
	}


	cout << min(tmp, ans) << endl;
}


Measured memory_bytes: 1792
#include <cstdio>
#include <algorithm>
int N;
char a[101], b[101];
int main()
{
	scanf("%d%s%s", &N, a, b);
	for (int i = N; i <= N + N; i++)
		if (std::equal(a + i - N, a + N, b, b + N + N - i))
		{
			printf("%d\n", i);
			return 0;
		}
}


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

#define rep(i, u) for (int i = 0; i < u; i++)

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

int main() {
  int m, f, r;
  rep(i, 50) {
    cin >> m >> f >> r;
    if (m == -1 && f == -1 && r == -1) break;
    if (m == -1 || f == -1) cout << 'F' << endl;
    else if (m + f >= 80) cout << 'A' << endl;
    else if (m + f >= 65) cout << 'B' << endl;
    else if (m + f >= 50 || (m + f >= 30 && r >= 50)) cout << 'C' << endl;
    else if (m + f >= 30) cout << 'D' << endl;
    else cout << 'F' << endl;
  }
  return 0;
}



Measured memory_bytes: 3076
n,a,b = map(int,input().split())
lst = list(map(int,input().split()))
ans = 0
for i in range(1,n):
    if (lst[i] - lst[i-1]) * a >= b:
        ans += b
    else:
        ans += (lst[i] - lst[i-1]) * a
print(ans)

Measured memory_bytes: 62704
"""
                            pppppppppppppppppppp
                         ppppp  ppppppppppppppppppp
                      ppppppp    ppppppppppppppppppppp
                      pppppppp  pppppppppppppppppppppp
                      pppppppppppppppppppppppppppppppp
                              pppppppppppppppppppppppp
       ppppppppppppppppppppppppppppppppppppppppppppppp  pppppppppppppppppppp
      pppppppppppppppppppppppppppppppppppppppppppppppp  ppppppppppppppppppppp
     ppppppppppppppppppppppppppppppppppppppppppppppppp  pppppppppppppppppppppp
    ppppppppppppppppppppppppppppppppppppppppppppppp    pppppppppppppppppppppppp
   pppppppppppppppppppppppppppppppppppppppppppppp     pppppppppppppppppppppppppp
  ppppppppppppppppppppppppppppppppppppppppppppp      pppppppppppppppppppppppppppp
  pppppppppppppppppppppppppppppppp               pppppppppppppppppppppppppppppppp
  pppppppppppppppppppppppppppp     pppppppppppppppppppppppppppppppppppppppppppppp
  ppppppppppppppppppppppppppp    pppppppppppppppppppppppppppppppppppppppppppppppp
    pppppppppppppppppppppppp  pppppppppppppppppppppppppppppppppppppppppppppppppp
     ppppppppppppppppppppppp  ppppppppppppppppppppppppppppppppppppppppppppppppp
      pppppppppppppppppppppp  ppppppppppppppppppppppppppppppppppppppppppppppp
       ppppppppppppppppppppp  ppppppppppppppppppppppppppppppppppppppppppppp
                              pppppppppppppppppppppppp
                              pppppppppppppppppppppppppppppppp
                              pppppppppppppppppppppp  pppppppp
                              ppppppppppppppppppppp    ppppppp
                                 ppppppppppppppppppp  ppppp
                                    pppppppppppppppppppp
"""


import sys
from functools import lru_cache, cmp_to_key
from collections import defaultdict as dd, deque, Counter as C
from bisect import bisect_left as bl, bisect_right as br, bisect
from heapq import heapify, heappop, heappush
from math import ceil, log, floor, sqrt
mod = pow(10, 9) + 7
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(var, end="\n"): sys.stdout.write(str(var)+end)
def outa(*var, end="\n"): sys.stdout.write(' '.join(map(str, var)) + end)
def L(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]


n = int(data())
points = []
for i in range(n):
    points.append(L())
arr = []
for x, y in points:
    arr.append(x + y)
arr.sort()
answer = arr[-1] - arr[0]
arr = []
for x, y in points:
    arr.append(x - y)
arr.sort()
answer = max(answer, arr[-1] - arr[0])
out(answer)


Measured memory_bytes: 116356
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define size_of_array(array) (sizeof(array)/sizeof(array[0]))
#define max 100005
using ll =long long;
using namespace std;
using Graph=vector<vector<int>>;

int main(){
    int n,m;
    cin>>n>>m;
    int a[100]={};
    double sum=0;
    rep(i,n){
        cin>>a[i];
        sum+=(double)a[i];
    }
    double border=sum/(4*m);
    sort(a,a+n,greater<int>());
    int cnt=0;
    rep(i,m){
        if((double)a[i]>=border){
            cnt++;
        }
    }
    if(cnt==m){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <bitset>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <utility>
#include <set>
#include <map>
#include <tuple> 
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <list>
using namespace  std;
using ll = long long;
using P = pair<ll, ll>;
#define REP(i, n) for(long long (i)=0, i_bound = (long long)(n); (i)<i_bound; ++i)
#define FOR(i, a, b) for(long long (i)=(a); (i)<(b); ++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
const long long MOD = static_cast<long long>(1e9) + 7LL;
const long long INF = 1234567891234567890LL;
signed main(){
    ll N, C; 
    cin>>N>>C;
    vector<vector<ll>> D(C, vector<ll>(C));
    vector<vector<ll>> G(N, vector<ll>(N));
    REP(i, C)REP(j,C) cin >> D[i][j];
    REP(i, N)REP(j,N) cin >> G[i][j];
    vector<vector<ll>> A(3, vector<ll>(C, 0));
    vector<vector<ll>> B(3, vector<ll>(C, 0));
    for(int i=0; i<N; i++){
        for(int j=0; j<N; j++){
            A[(i+j)%3][G[i][j]-1]++;
        }
    }
    
    for(int k=0; k<3; k++){
        for(int j=0; j<C; j++){
            for(int i=0; i<C; i++){
                B[k][j] += D[i][j] * A[k][i];
            }
        }
    }    
    ll res = INF;
    for(int i=0; i<C; i++){
        for(int j=0; j<C; j++){
            if(i==j) continue;
            for(int k=0; k<C; k++){
                if(i==k or j==k) continue;
                res = min(res, B[0][i]+ B[1][j]+ B[2][k]);
            }
        }
    } 
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 2304
#include "bits/stdc++.h"
#define MAXN 100009
#define INF 1000000007
#define mp(x,y) make_pair(x,y)
#define all(v) v.begin(),v.end()
#define pb(x) push_back(x)
#define wr cout<<"----------------"<<endl;
#define ppb() pop_back()
#define tr(ii,c) for(__typeof((c).begin()) ii=(c).begin();ii!=(c).end();ii++)
#define ff first
#define ss second
#define my_little_dodge 46
#define debug(x)  cerr<< #x <<" = "<< x<<endl;
using namespace std;

typedef long long ll;
typedef pair<int,int> PII;
template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
int main(){
    //~ freopen("file.in", "r", stdin);
    int a,b;
    scanf("%d%d",&a,&b);
    for(int i=0;i<=min(a,b);i++)
		if((a-i)%500==0){
			puts("Yes");
			return 0;
		}
	puts("No");	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define PB push_back
#define MP make_pair
#define LL long long 
const int INF = 1145141919;

int dp[4002][4002];

int main(){
	string s1, s2;
	while (cin >> s1){
		cin >> s2;
		int ans = 0;
		memset (dp, 0, sizeof(dp));
		REP (i, s1.size()){
			REP (j, s2.size()){
				if (s1[i] == s2[j]){
					dp[i+1][j+1] = dp[i][j] + 1;
					ans = max (ans, dp[i+1][j+1]);
				}
			}
		}
		cout << ans << endl;
	}	
}

Measured memory_bytes: 63776
#include <iostream>
#include <algorithm>
#include <cmath>
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

int n, a, b, c;
int l[8];
int p4[9];

int main() {
	int i, j;
	
	p4[0] = 1;
	rep(i, 8) p4[i + 1] = p4[i] * 4;
	
	cin >> n >> a >> b >> c;
	rep(i, n) cin >> l[i];
	
	int ans = 1e+9;
	rep(i, p4[n]) {
		int x = 0, y = 0, z = 0;
		int usedCnt = 0;
		rep(j, n) {
			int type = (i / p4[j]) % 4;
			if (type == 0) x += l[j];
			if (type == 1) y += l[j];
			if (type == 2) z += l[j];
			if (type < 3) usedCnt++;
		}
		if (x == 0 || y == 0 || z == 0) continue;
		int cst = (usedCnt - 3) * 10 + abs(x - a) + abs(y - b) + abs(z - c);
		ans = min(ans, cst);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, a, b, c, d, e int
	fmt.Scan(&n, &a, &b, &c, &d, &e)

	x := []int{a, b, c, d, e}
	sort.Ints(x)
	min := x[0]

	if n%min == 0 {
		fmt.Println(n/min + 4)
	} else {
		fmt.Println(n/min + 4 + 1)
	}
}


Measured memory_bytes: 512
//HOW YOU DOI'N........................JT
//Could this code be more bad..........CB
//I know...............................MG
//Hii..................................RG
//Noooooooo............................RG
//I wish I could but I don't want to...PB

//That's what she said.................MS


#include <bits/stdc++.h>

#define fast                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0);

#define ll long long
#define ld long double
#define pb push_back
#define mkpr make_pair
#define fi(i,a,b) for (ll i=a;i<b;i++)
#define vll vector<ll>
#define vch vector<char>
#define vst vector<string>
#define vpll vector<pll>
#define vvl vector<vector<ll>>
#define srt(v) sort(v.begin(),v.end())
#define rsrt(v) sort(v.rbegin(), v.rend())
#define mxe(v) *max_element(v.begin(),v.end())
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ff first
#define ss second
#define mll map<ll, ll>
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a)*1ll * (b)) / gcd(a, b)
#define nl "\n"
#define sp " "
#define sz(x)  (int)x.size()

using namespace std;

double PI = (acos(-1));
ll md = 1000000007; // 998244353;

ll pw(ll a, ll b){ll c=1,m=a;while (b){if (b&1)c=(c*m);m=(m*m);b/=2;}return c;}
ll pwmd(ll a, ll b){ll c = 1, m = a;while (b){if (b & 1)c = ((c * m)) % md;m = (m * m) % md;b /= 2;}return c;}
ll modinv(ll n){return pwmd(n, md - 2);}
ll min(ll a,ll b){if(a>=b)return b;return a;}
ll nc2(ll n){return (1ll * n * (n - 1)) / 2;}
ll nsum(ll n){return (1ll * n * (n + 1)) / 2;}
bool prime(ll a){for(int i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}

#define MAX_SIZE 100005
void Sieve(vector<int> &primes){bool IsPrime[MAX_SIZE];memset(IsPrime, true, sizeof(IsPrime));
for (int p = 2; p * p < MAX_SIZE; p++){if (IsPrime[p] == true){
			for (int i = p * p; i < MAX_SIZE; i += p)IsPrime[i] = false;}}
	for (int p = 2; p < MAX_SIZE; p++)if (IsPrime[p])primes.push_back(p);}


vector<char> sml={'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'};
vector<char> cap={'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'};


// Lets start ...

    

int main(){
    //vector<int> primes;
    //Sieve(primes);
    
    fast
    ll tests=1,cnt=0;
    //cin>>tests;
    while(tests--){
        string s;
        cin>>s;
        ll n=sz(s);
        ll cnt=0;
        fi(i,0,n)cnt+=s[i]-'0';
        if(cnt%9==0)cout<<"Yes";
        else cout<<"No";
        
        
    }

    return 0;
    }

// Done:)




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

int main(){
	int n,k;
	cin>>n>>k;
	vector<int>arr;
	while(n--){
		int a;
		cin>>a;
		arr.push_back(1);
	}
	int ret = 0;
	while(arr.size()){
		ret++;
		for(int i=0; i<k && arr.size(); i++) arr.pop_back();
		if(arr.size()) arr.push_back(1);
	}
	cout<<ret;
}

Measured memory_bytes: 3512
#include <iostream>
using namespace std;
int main() {
  int n,k,v;
  cin >> n >> k;
  v = 1;
  while (n>0) {
    v *= 2;
    n -= 1;
    if (v+k < v*2) {
      v += k*n;
      break;
    }
  }
  cout << v << endl;
}

Measured memory_bytes: 256
#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 = 1e9 + 7;

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

  ll n, a, b;
  cin >> n >> a >> b;
  ll p[n];
  ll s = 0, t = 0, u = 0;
  REP(i, n){
    cin >> p[i];
    if(p[i] <= a) s++;
    else if(p[i] <= b) t++;
    else u++;
  }

  ll ans = min(s, min(t, u));
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import std.stdio, std.string, std.range, std.conv, std.array, std.algorithm, std.math, std.typecons, std.functional;

void main() {
    auto tmp = readln.split.to!(long[]);
    const N = tmp[0], M = tmp[1];
    auto nodeList = N.iota.map!(i => new Node(i)).array;
    auto bridgeList = M.iota.map!(_ => readln.split.to!(long[])).array;

    long[] result = [N*(N-1)/2];
    foreach_reverse(i; 0..M) {
        auto bridge = bridgeList[i];
        auto nodeA = nodeList[bridge[0]-1];
        auto nodeB = nodeList[bridge[1]-1];

        if (nodeA.find() == nodeB.find()) {
            result ~= result.back;
            continue;
        }

        const sizeA = nodeA.getSize;
        const sizeB = nodeB.getSize;

        result ~= result.back - sizeA * sizeB;

        unite(nodeA, nodeB);
    }
    result.popBack;
    result.retro.each!writeln;
}

class Node {
    long value;
    long size;
    Node parent;

    this(long value) { this.value = value; this.size = 1; }

    Node root() {
        if (parent is null) return this;
        auto result = parent.root;
        this.parent = result;
        return result;
    }

    long find() {
        return root.value;
    }

    long getSize() {
        return root.size;
    }
}

void unite(Node u, Node v) {
    auto up = u.root;
    auto vp = v.root;

    vp.parent = up;
    up.size += vp.size;
}


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

typedef long long llt;

const int MaxN = 400 + 5, MaxM = 400 + 5;
const int MaxV = 160000 + 5;

int N, M;
char str[MaxN][MaxM];
int par[MaxV]; bool vis[MaxV];
int dx[4] = {0, 1, -1, 0}, dy[4] = {1, 0, 0, -1};
map <int, bool> mp[MaxV];
llt Ans[MaxV], Cnt[MaxV];

void init() {
  scanf("%d %d", &N, &M);
  for (int i = 1; i <= N; ++i) scanf("%s", str[i] + 1);
}

inline int get_cor(int i, int j) {
  return (i - 1) * M + j;
}

int Find(int x) {
  return x == par[x] ? x : par[x] = Find(par[x]);
}

inline void Merge(int x, int y) {
  int p = Find(x), q = Find(y);
  par[p] = q;
}

void solve() {
  for (int i = 1; i <= N * M; ++i) par[i] = i;

  for (int i = 1; i <= N; ++i) for (int j = 1; j <= M; ++j) {
    if (str[i][j] == '#') {
      for (int k = 0; k < 4; ++k) {
        int x = i + dx[k], y = j + dy[k];
        if (x < 1 || x > N || y < 1 || y > M) continue;
        if (str[x][y] == '#') continue;

        for (int k2 = 0; k2 < 4; ++k2) {
          if (k + k2 == 3) continue;
          int u = x + dx[k2], v = y + dy[k2];
          if (u < 1 || u > N || v < 1 || v > M) continue;
          if (str[u][v] == '.') continue;

          Merge(get_cor(i, j), get_cor(u, v));
        }
      }
    }
  }

  for (int i = 1; i <= N; ++i) for (int j = 1; j <= M; ++j) {
    if (str[i][j] == '.') {
      for (int k = 0; k < 4; ++k) {
        int x = i + dx[k], y = j + dy[k];
        if (x < 1 || x > N || y < 1 || y > M) continue;
        if (str[x][y] == '.') continue;

        int p = Find(get_cor(x, y));
        if (mp[p][get_cor(i, j)] == true) continue;
        mp[p][get_cor(i, j)] = true;
        Ans[p]++;
      }
    } else {
      int p = Find(get_cor(i, j));
      Cnt[p]++;
    }
  }

  llt ans = 0;
  for (int i = 1; i <= N * M; ++i) {
    int p = Find(i);
    if (vis[p] == true) continue;
    vis[p] = true;
    ans += Ans[p] * Cnt[p];
  }
  cout << ans << endl;
}

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

Measured memory_bytes: 14976
#include<bits/stdc++.h>
using namespace std;
const int maxn=100100,mod=998244353;
inline void Add(int &a,int b){a=a+b>=mod?a+b-mod:a+b;}
inline int ksm(int a,int b)
{
	int res=1;
	for(;b;b>>=1,a=1ll*a*a%mod) if(b&1) res=1ll*res*a%mod;
	return res;
}
int N;
struct Graph
{
	vector<int> V[maxn];int M,sg[maxn],sum[512];
	inline void read()
	{
		scanf("%d",&M);
		for(int i=1,A,B;i<=M;i++)
		{
			scanf("%d%d",&A,&B);
			if(A>B) swap(A,B);
			V[A].push_back(B);
		}
	}
	inline void Getsg()
	{
		for(int i=N;i;i--)
		{
			set<int> S;
			for(int j=0;j<(int)V[i].size();j++) S.insert(sg[V[i][j]]);
			while(S.count(sg[i])) sg[i]++;
			Add(sum[sg[i]],ksm(10,i*18));
		}
	}
}G[3];
int main()
{
	scanf("%d",&N);
	G[0].read();G[1].read();G[2].read();
	G[0].Getsg();G[1].Getsg();G[2].Getsg();
	int ans=0;
	for(int A=0;A<512;A++) for(int B=0;B<512;B++)
		Add(ans,1ll*G[0].sum[A]*G[1].sum[B]%mod*G[2].sum[A^B]%mod);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 17224
def add word
	@dic[hashF word] << word
end

def hashF word
    temp = word.dup
	temp.gsub!("A", "1")
	temp.gsub!("C", "2")
	temp.gsub!("G", "3")
    temp.gsub!("T", "4")
	return temp.to_i % @dic.length
end

def find word
    @dic[hashF word].include? word
end

n = gets.to_i
@dic = Array.new(n){[]}
n.times{
	command, word = gets.chomp.split
	case command
	when "insert"
		add word
	else
		puts (find word) ? "yes" : "no"
	end
}

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

using namespace std;

using i64 = int64_t;

const i64 MOD = 1e9+7;

const i64 INF = 1e18+7;


signed main(){
    string s;
    cin >> s;
    map<int,int> m;
    for(auto& x : s)
        ++m[x];
    for(auto& p : m){
        if(p.second & 1){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import sys
import os
import math


N = int(input())

for i in range(N):
    ax, ay, ar, bx, by, br = map(float, input().split())

    between_center = math.sqrt( (ax-bx)**2 + (ay-by)**2 )

    # ????????£????????????
    if between_center > ar + br:
        print(0)

    # ????????????????????¨
    else:
        # B in A
        if ar > between_center + br:
            print(2)

        # A in B
        elif br > between_center + ar:
            print(-2)

        else:
            print(1)

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

int main(){
  long long N;
  cin >> N;
  vector<long long> A(N);
  for(int i=0;i<N;i++)  cin >> A.at(i);

  map<long long,long long> mp;
  for(int i=0;i<N;i++){
    mp[A.at(i)]++;
  }

  long long sum=0;
  for(int i=1;i<=N;i++){
    if(mp.count(i)){
      long long tmp=mp.at(i);
      sum+=(tmp*(tmp-1))/2;
    }
  }
  for(int i=0;i<N;i++){
    long long tmp=mp.at(A.at(i));
    cout << sum-((tmp*(tmp-1))/2)+((tmp-1)*(tmp-2))/2 << endl;
  }

  return 0;
}


Measured memory_bytes: 11008
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rrep(i, n) for(int i = n-1; i >= 0; --i)
#define fi first
#define se second
using namespace std;
using lint = long long;
using uint = unsigned int;
using ulint = unsigned long long;
using ldouble = long double;
using pii = pair<int, int>;
using pli = pair<lint, lint>;
using pdd = pair<double, double>;
using pld = pair<ldouble, ldouble>;
using v1i = vector<int>;
using v1li = vector<lint>;
using v2i = vector<vector<int>>;
using v2li = vector<vector<lint>>;
using v3i = vector<vector<vector<int>>>;
using v3li = vector<vector<vector<lint>>>;
using v1b = vector<bool>;
using v2b = vector<vector<bool>>;
using v3b = vector<vector<vector<bool>>>;
using v1c = vector<char>;
using v2c = vector<vector<char>>;
using v3c = vector<vector<vector<char>>>;
constexpr lint mod1 = 1e9+7;
constexpr lint mod2 = 998244353;

int main(){
  int n, x, t; cin >> n >> x >> t;
  cout << ((n-1)/x + 1) * t << endl;
  return 0;
}

Measured memory_bytes: 3588