akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;
import java.util.ArrayList;

public class Main{
    public static void main(String[] args) {
        Main main = new Main();
        main.ex1();
    }

    private void ex1() {
        Scanner scanner = new Scanner(System.in);
        int num = scanner.nextInt();

        String[] marks = {"S", "H", "C", "D"};

        ArrayList<Card> cards = new ArrayList<Card>();
        for(int i=0; i<marks.length; i++) {
            for(int rank=1; rank<=13; rank++) {
                Card card = new Card(marks[i], rank);
                cards.add(card);
            }
        }

        for(int i=0; i<num; i++) {
            String mark = scanner.next();
            int rank = scanner.nextInt();
            Card deleteCard = new Card(mark, rank);

            for(int j=0; j<cards.size(); j++) {
                if (deleteCard.toString().equals(cards.get(j).toString())) {
                    cards.remove(j);
                    break;
                }
            }
        }
        
        for(int i=0; i<cards.size(); i++) {
            System.out.println(cards.get(i).toString());
        }
    }

    class Card {
        private String mark = null;
        private int rank = 0;
        public Card(String mark, int rank) {
            this.mark = mark; this.rank = rank;
        }
        public String getMark() { return this.mark; }
        public int getRank() { return this.rank; }
        public String toString() {
            return this.mark + " " + this.rank;
        }
    }

}


Measured memory_bytes: 26292
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin >> s;
    long long n;
    cin >> n;
    for(int i = 0;i < s.length();i++)
    {
        n--;
        if(n == 0)
        {
            cout << s[i];
            return 0;
        }
        if(s[i] != '1')
        {
            cout << s[i];
            return 0;
        }
    }
    cout << 1;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
#define era(t) t.erase(unique(be(t)),t.end())
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
typedef long long ll;
using namespace std;
const ll mod=1000000007,mod9=1000000009;
template <class T>inline T lcm(T a,T b){return (a*b/__gcd(a,b));}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a[5],n;
    for(int i=0;i<5;i++){cin>>a[i];
        if(i==0){n=a[i]%10;
            n=10-n;
            n%=10;
        }
        else{
            n=max(n,(10-(a[i]%10))%10);
        }
    }
    n=-n;
    for(int i=0;i<5;i++){
        n+=a[i]+(10-(a[i]%10))%10;
    }
    cout << n<<endl;
    
    return 0;
}



Measured memory_bytes: 256
#ifdef _MSC_VER
#include "stdc++.h"
#endif
#ifdef __GNUC__
#include<bits/stdc++.h>
#endif
using namespace std;

using ll = long long;

//vector
using vi = vector<int>;
using vii = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;

//constant
const double EPS = 1e-10;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, s, e) for (ll i = s; i < e; i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(), (x).rend()

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;

// vector
//template<typename T> vector<vector<T>> vv(ll H, ll W, T v) { return vector<vector<T>> vec(H, vector<T>(W, v)); }

// view vector
template<typename T> void view(T e) { cout << e << endl; }
template<typename T> void view(const vector<T>& v) { for (const auto& e : v) { cout << e << " "; } cout << endl; }
template<typename T> void view(const vector<vector<T> >& vv) { for (const auto& v : vv) { view(v); } }

// DP
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }




// ***************************************

int N, K, C;

vll calc(string S){
    int last = -C - 1;

    vll ret(N + 1, 0);
    ll cur = 0;
    REP(i, N){
        if (S[i] == 'o' && i - last > C) {
            last = i;
            cur++;
        }
        ret[i + 1] = cur;
    }

    return ret;
}

int main(){

    cin >> N >> K >> C;
    string S;
    cin >> S;
    
    const auto left = calc(S);
    string T = S;
    reverse(ALL(T));
    const auto right = calc(T);

    bool flag = false;
    REP(i, N){
        if (S[i] == 'x') continue;
        if (left[i] + right[N - i - 1] < K) {
            cout << i + 1 << endl;
            flag = true;
        }
    }

    if(!flag) cout << endl;

    return 0;
}


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

vector<int> mysort(vector<int> s) {
    for (int i = 0; i < s.size(); i++) {
        for (int j = i+1; j < s.size(); j++) {
            if (s.at(i) < s.at(j)) {
                int tmp = s.at(i);
                s.at(i) = s.at(j);
                s.at(j) = tmp;
            }
        }
    }
    return s;
}

int main() {
    int n;
    int score_a = 0;
    int score_b = 0;
    vector<int> cards;
    cin >> n;
    cards = vector<int>(n);

    for (int i = 0; i < n; i++) {
        cin >> cards.at(i);
    }
    cards = mysort(cards);

    for (int i = 0; i < n; i++) {
        if (i%2 == 0) score_a += cards.at(i);
        else score_b += cards.at(i);
    }
    cout << (score_a - score_b) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
using P = pair<int,int>;
const int mod = 1000000007;
ll comb[1000000];
ll comb2[1000000];
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main()
{
    ll n,k;
    cin >> n >> k;
    comb[0] = 1;
    comb2[0] = 1;
    ll ans = 0;
    k = min(k,n-1);
    rep(i,n){
        if( i == 0)continue;
        
        ll waru = modpow(i,mod-2,mod);
        comb[i] = comb[i-1]*((n-i+1)*waru%mod)%mod;
        comb2[i] = comb2[i-1]*((n-i)*waru%mod)%mod;
   
        
    }
    rep(i,k+1){
        ans += comb[i]*comb2[i]%mod;
        ans %= mod;
    }
  
       
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5888
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
ll d[100005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin >> N;
  ll a, b;
  ll ret = 0;
  for (int i=0; i<N; i++) {
    cin >> a >> b;
    ret -= b;
    d[i] = a + b;
  }
  sort(d, d+N, greater<ll>());
  for (int i=0; i<N; i+=2) {
    ret += d[i];
  }
  cout << ret << '\n';
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <map>
using namespace std;
int main()
{
    int N;
    map<string, int> si;
    string res;
    string ans[] = {"AC", "WA", "TLE", "RE"};
    cin >> N;
    for (int i = 0; i < N; i ++){
        cin >> res;
        si[res] ++;
    }
    for (int i = 0; i < 4; i ++){
        cout << ans[i] << " x " << si[ans[i]] << endl;
    }
    system("pause");
    return 0;
}

Measured memory_bytes: 3660
n, m = map(int, raw_input().split())
ans = 0
p = 1.0 / (2**m)
for k in range(1, 1000):
    t = ((1.0 - p)**(k-1)) * p * k * (1900*m + 100*(n-m))
    ans += t
print int(ans + 0.1)

Measured memory_bytes: 2820
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws IOException {
        OutputStream outputStream = System.out;
        PrintWriter out = new PrintWriter(outputStream);
        FastReader in = new FastReader();
        test a=new test();
        a.solve(in,out);
        out.close();
    }
}
class test{
    public void solve(FastReader in, PrintWriter out){
       long x=in.nextLong();
       outer:for(int i=1;i<1000;i++){
           for(int j=-1000;j<1000;j++){
               long a=(long)Math.pow(i,5);
               long b=(long)Math.pow(j,5);
               if((a-b)==x){
                   out.println(i+" "+j);
                   break outer;
               }
           }
       }
    }
}

class FastReader{
    BufferedReader br;
    StringTokenizer st;

    public FastReader(){
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next(){
        while(st==null || !st.hasMoreElements()){
            try{
                st=new StringTokenizer(br.readLine());
            }
            catch(IOException e){
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

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

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

    double nextDouble(){
        return Double.parseDouble(next());
    }
    String nextLine(){
        String str="";
        try{
            str=br.readLine();
        }
        catch(IOException e){
            e.printStackTrace();
        }
        return str;
    }
}



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

using namespace std;

typedef long long ll;
typedef long double ld;

const int N=100+5;
const int K=(int)1e5+5;

int dp[K];
int v[N];
int n,k;

void calc(int x)
{
    if(dp[x]!=-1) return;
    for(int i=1;i<=n;i++)
    {
        int y=x-v[i];
        if(y>=0)
        {
            calc(y);
            if(dp[y]==2)
            {
                dp[x]=1;
                return;
            }
        }
    }
    dp[x]=2;
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    for(int i=0;i<K;i++) dp[i]=-1;
    cin>>n>>k;
    for(int i=1;i<=n;i++)
    {
        cin>>v[i];
        dp[v[i]]=1;
    }
    calc(k);
    if(dp[k]==1)
    {
        cout<<"First\n";
    }
    else
    {
        cout<<"Second\n";
    }
    return 0;
}



Measured memory_bytes: 5376
#include <bits/stdc++.h>
#define whlie while
#define pb push_back
#define eb emplace
#define fi first
#define se second
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repr(i,N) for(int i = (N) - 1; i >= 0; i--)
#define rep1(i,N) for(int i = 1; i <= (N) ; i++)
#define repr1(i,N) for(int i = (N) ; i > 0 ; i--)
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
using namespace std; void solve();
using ll = long long; using vl = vector<ll>;
using vi = vector<int>; using vvi = vector< vector<int> >;
constexpr int inf = 1001001001;
constexpr ll infLL = (1LL << 61) - 1;
struct IoSetupNya {IoSetupNya() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(10);} } iosetupnya;
template<typename T, typename U> inline bool amin(T &x, U y) { return (y < x) ? (x = y, true) : false; }
template<typename T, typename U> inline bool amax(T &x, U y) { return (x < y) ? (x = y, true) : false; }
template<typename T, typename U> ostream& operator <<(ostream& os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<typename T, typename U> istream& operator >>(istream& is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator <<(ostream& os, const vector<T> &v) { int s = (int)v.size(); rep(i,s) os << (i ? " " : "") << v[i]; return os; }
template<typename T> istream& operator >>(istream& is, vector<T> &v) { for(auto &x : v) is >> x; return is; }
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}
#ifdef NyaanDebug
  #include "NyaanDebug.h"
  #define trc(...) do { cerr << #__VA_ARGS__ << " = "; dbg_out(__VA_ARGS__);} while(0)
  #define trca(v,N) do { cerr << #v << " = "; array_out(v , N);cout << endl;} while(0)
#else
  #define trc(...)
  #define trca(...)
  int main(){solve();}
#endif
using P = pair<int,int>; using vp = vector<P>;
constexpr int MOD = /** 1000000007; //*/ 998244353;
////////////////

void solve(){
  inl(N);
  vl v(N); in(v);
  ll ans = 0;
  ans -= N * (N + 1) / 2;
  each(x , v) ans += x;
  out(ans);
}


Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <cmath>
#include <map>
 
using namespace std;
int A, B, C, D;

int main()
{
  int i;
  int a, sum=0;

  cin >> A >> B >> C >> D;

  while (A>0 && C>0) {
    C -= B;
    if (C<=0) break;
    A -= D;
  }
  if (A<=0)
    printf("No\n");
  else
    printf("Yes\n");

  return 0;
}


Measured memory_bytes: 3624
m, d =map(int, input().split())
day=0
for i in range(1,m+1):
    for j in range(20,d+1):
        d1=j%10
        d10=(j-d1)/10
        if d1>=2 and d10>=2:
            if i==d1*d10:
                day+=1
                #print(i,j)
print(day)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll p=1e9+7;
ll n,m,k,i,j,ans,f[100010],a[100010];
ll ksm(ll x,ll y){
	ll xlh=1;
	while(y){
		if(y&1)xlh=xlh*x%p;
		x=x*x%p;
		y/=2;
	}
	return xlh;
}
int main(){
	scanf("%lld%lld",&n,&k);
	for(i=1;i*i<=n;i++)if(n%i==0){
		a[++m]=i;
		if(n/i!=i)a[++m]=n/i;
	}
	sort(a+1,a+m+1);
	for(i=1;i<=m;i++){
		f[i]=ksm(k,(a[i]+1)/2);
		for(j=1;j<i;j++)if(a[i]%a[j]==0)f[i]=(f[i]-f[j]+p)%p;
		if(a[i]%2)ans=(ans+f[i]*a[i])%p;
		 else ans=(ans+a[i]*ksm(2,p-2)%p*f[i])%p;
	}
	printf("%lld",ans);
}

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

const int MAXN = 1 << 22;
const int mod = 1e9 + 7;

long long exp_mod (long long a, long long b) {
    long long ret = 1;
    while (b) {
        if (b & 1) ret = ret * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return ret;
}

long long dp[MAXN][2], cnt[MAXN];
long long sum, cnt0;

int main (void) {
    int n;
    scanf("%d", &n);

    for (int i = 0; i < MAXN; i++) {
    	dp[i][0] = 1;
    }
    for (int i = 1, val; i <= n; i++) {
        scanf("%d", &val);
        sum ^= val;
        if (sum) {
            dp[sum][0] = (dp[sum][0] + dp[sum][1] * (cnt0 - cnt[sum])) % mod;
            dp[sum][1] = (dp[sum][1] + dp[sum][0]) % mod;
            cnt[sum] = cnt0;
        } else cnt0++;
    }
    if (sum) {
        printf("%lld\n", dp[sum][0]);
    } else {
    	long long ret = exp_mod(2, cnt0 - 1);
    	for (int i = 1; i < MAXN; i++) {
    		ret = (ret + dp[i][1]) % mod;
    	}
    	printf("%lld\n", ret);
    }
}

Measured memory_bytes: 76032
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;

namespace AtCoder_1
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = CinDAr();
            Cout($"{n[0] * n[1] / 2} {Convert.ToInt32(2* + n[2] == n[0] && 2* n[3] == n[1])}");
        }


        static string Cin() { return Console.ReadLine(); }
        static string[] CinAr() { return Console.ReadLine().Split(' '); }
        static int CinT() { return S2i(Cin()); }
        static int[] CinTAr() { return CinAr().Select((x, i) => { return S2i(x); }).ToArray(); }
        static long CinL() { return S2L(Cin()); }
        static long[] CinLAr() { return CinAr().Select((x, i) => { return S2L(x); }).ToArray(); }
        static double CinD() { return S2D(Cin()); }
        static double[] CinDAr() { return CinAr().Select((x, i) => { return S2D(x); }).ToArray(); }
        static int S2i(string s) { return int.Parse(s); }
        static long S2L(string s) { return long.Parse(s); }
        static double S2D(string s) { return double.Parse(s); }
        static void Cout(object s) { Console.WriteLine(s); }
        static void DbShowE<Type>(IEnumerable<Type> types)
        {
            foreach(var i in types)
            {
                Console.Write(i + " ");
            }
            Console.WriteLine();
        }
    }
}


Measured memory_bytes: 13268
#include<bits/stdc++.h>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using namespace std;

// n must be a number which ia a pow of 2

int n = 262144;
ll dp[262144*2-1];

// initialize
void init(){
    // make all value of dp[i] 0
    for (int i = 0; i < 2*n-1; i++){
        dp[i] = 0;
    }
}

// change the value of index i to x
void update(int i, ll x){
    // number of leaf
    i += n-1;
    dp[i] = x;
    // updating with going up to the root node
    while(i > 0) {
        i = (i-1) / 2;
        dp[i] = max(dp[2*i+1], dp[2*i+2]);
    }
}

// return the maximum value in [a,b)
// l, r is a span correspoing to node k
// use | query(a, b, 0, 0, n)
ll query(int a, int b, int k, int l, int r){
    if (r <= a || b <= l) return 0; // disjoint
    if (a <= l && r <= b) return dp[k]; // contain completely
    else {
        ll vl = query(a, b, k*2+1, l, (l+r)/2);
        ll vr = query(a, b, k*2+2, (l+r)/2, r);
        return max(vl, vr);
    }
}

int main (){
    int N;
    int h[200005], a[200005];
    ll ans;
    ll tmp;
    ans = 0;
    cin >> N;
    rep(i, N){
        cin >> h[i];
    }

    rep(i, N){
        cin >> a[i];
    }

    init();

    rep(i,  N){
        tmp = a[i] + query(0, h[i], 0, 0, n);
        update(h[i], tmp);
        ans = max(tmp, ans);

    }

    cout << ans << endl;
}

Measured memory_bytes: 5888
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
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 (a>b) { a=b; return 1; } return 0; }

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

    int N; cin >> N;
    vel A(N), B(N), C(N-1);
    rep(i,N) cin >> A[i];
    rep(i,N) cin >> B[i];
    rep(i,N-1) cin >> C[i];
    ll sum = 0LL;
    rep(i,N) sum += B[A[i]-1];
    rep(i,N-1) if(A[i+1] == A[i] + 1) sum += C[A[i]-1];
    cout << sum << endl;
    return 0;

}



Measured memory_bytes: 256
N = int(input())
a = [int(_) for _ in input().split()]
List = [0]*(10**5+1)
ans = 0

for i in a:
    if i > 10**5:
        ans += 1
    else:
        List[i] += 1

for i in range(1, 10**5+1):
    if List[i] >= i:
        ans += List[i] - i
    else:
        ans += List[i]

print(ans)

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

int main() {
  int n, a, b, c, d;
  cin >> n;

  a = n / 1000;
  b = n / 100 % 10;
  c = n / 10 % 10;
  d = n % 10;
    
  if ((a == b and b == c) or (b == c and c == d)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

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

#define watch(x) cerr << (#x) << ": " << (x) << endl

vector<int> ans;

void dfs(int cur, int val, vector<vector<pair<int, int>>>& graph) {
    ans[cur] = val;

    for(auto child : graph[cur]) {
        if(ans[child.first] == -1) {
            if(child.second%2) {
                dfs(child.first, (val+1)%2, graph);
            } else {
                dfs(child.first, val, graph);
            }
        }
    }
}

int32_t main() {

    int n; cin >> n;

    vector<vector<pair<int, int>>> graph(n+1, vector<pair<int, int>>());

    for(int i = 0; i < n-1; ++i) {
        int u, v, w; cin >> u >> v >> w;
        graph[u].push_back({v, w});
        graph[v].push_back({u, w});
    }

    ans.resize(n+1, -1);

    dfs(1, 0, graph);

    for(int i = 1; i <= n; ++i) {
        int a = ans[i];
        cout << a << endl;
    }
    
    return 0;
}


Measured memory_bytes: 8192
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int N=sc.nextInt(), K=sc.nextInt(), d, e, t=0;
    int A[]= new int[N];
    for(int i=0; i<K; i++){
      d=sc.nextInt();
      for(int j=0; j<d; j++){
        e=sc.nextInt();
        A[e-1]++;
      }
    }
    for(int k=0; k<N; k++){
      if(A[k]==0) t++;
    }
    System.out.println(t);
  }
}

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

using namespace std;

int main() {
    int a, b, c;
    int k;
    cin >> a >> b >> c >> k;
    int bcount = 0;
    int ccount = 0;
    while(a >= b) {
      b *= 2;
      bcount++;
    }
    while(b >= c) {
      c *= 2;
      ccount++;
    }
    int count = bcount + ccount;
    if (count > k) {
      cout << "No" << endl;
    }
    else {
      cout << "Yes" << endl;
    }
    return 0;
}

Measured memory_bytes: 3592
#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 = (1e+9)+7;

ll modpow(ll a,ll n){
    //aのn乗を求める.
    if(n == 1)return a % MOD;
    if(n % 2 == 1)return a * modpow(a,n-1) %MOD;
    ll t = modpow(a,n/2) % MOD;
    return t*t % MOD;
}

ll get_comb(ll n,ll r){
    ll X = 1;
    for(int i=0;i<r;i++){
        X = X* ( (n-i)%MOD ) % MOD;
    }
    ll Y =1;
    for(int i = r;i>0;i--){
        Y = Y * i % MOD; 
    }
    return X * modpow(Y,MOD-2) % MOD;
}

int main(){
    ll ans = 0;
    ll n,a,b;cin>>n>>a>>b;
    ans += modpow(2,n) -1;
    ans -= get_comb(n,a)%MOD;
    ans -= get_comb(n,b)%MOD;
    if(ans%MOD <0){
        ans %= MOD;
        ans+=MOD;
    }
    cout<<ans%MOD<<endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp107 {
    class Program {
        static ulong mod = 1000000007;

        static void Main(string[] args) {
            var st = Console.ReadLine().Split().Select(ulong.Parse).ToArray();

            ulong N = st[0];
            ulong M = st[1];

            if (Math.Abs((int)N - (int)M) >= 2) {
                Console.WriteLine(0);
                return;
            }

            FactorialMod(N);
            FactorialMod(M);

            if ((N + M) % 2 == 0) {
                Console.WriteLine(2 * FactorialMod(N) % mod * FactorialMod(M) % mod);
            } else {
                Console.WriteLine(FactorialMod(N) % mod * FactorialMod(M) % mod);
            }

        }

        static ulong FactorialMod(ulong a) {
            if (a <= 1) {
                return 1;
            }

            return a * FactorialMod(a - 1) % mod;
        }
    }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;
int check(int n){
  int ret = 0;
  while(n){
    ++ret;
    n /= 10;
  }
  return ret;
}
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  ll n,ans = 0;
  cin >> n;
  for(int i = 1; i <= n; ++i){
    if(check(i)&1) ++ans;
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int MOD = 1000000007;
//const int MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const double pi = acos(-1.0);
const double EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

struct Graph{
    vector<vector<int>> es;
    const int n;

    Graph(int n) : n(n){
        es.resize(n);
    }

    void add_edge(int from, int to, bool directed = false){
        es[from].pb(to);
        if(!directed) es[to].pb(from);
    }
};

struct Strongly_Connected_Components{
    vector<vector<int>> es, rs;
    vector<int> vs, comp;
    vector<bool> used;
    const int n;

    Strongly_Connected_Components(int n) : n(n){
        es.resize(n), rs.resize(n);
        vs.resize(n), comp.resize(n), used.resize(n);
    }

    void add_edge(int from, int to, bool directed = true){
        es[from].pb(to), rs[to].pb(from);
        if(!directed) es[to].pb(from), rs[from].pb(to);
    }

    void dfs(int now){
        used[now] = true;
        for(auto &e: es[now]) if(!used[e]) dfs(e);
        vs.pb(now);
    }

    void rdfs(int now, int cnt){
        used[now] = true, comp[now] = cnt;
        for(auto &e: rs[now]) if(!used[e]) rdfs(e, cnt);
    }

    Graph decompose(){
        fill(all(used), false);
        rep(i, n) if(!used[i]) dfs(i);
        fill(all(used), false), reverse(all(vs));
        int cnt = 0;
        for(auto &e: vs) if(!used[e]) rdfs(e, cnt++);
        Graph G(cnt);
        rep(i, n){
            for(auto &e: es[i]){
                int u = comp[i], v = comp[e];
                if(u != v) G.add_edge(u, v, true);
            }
        }
        return G;
    }

    int operator [] (int k) const {return comp[k];}
};

int main(){
    int N, D;
    cin >> N >> D;
    int x[N], y[N];
    rep(i, N) cin >> x[i] >> y[i];
    Strongly_Connected_Components G(2*N);
    rep(i, N){
        rep(j, i){
            if(abs(x[i]-x[j]) < D) G.add_edge(i, N+j), G.add_edge(j, N+i);
            if(abs(x[i]-y[j]) < D) G.add_edge(i, j), G.add_edge(N+j, N+i);
            if(abs(y[i]-x[j]) < D) G.add_edge(N+i, N+j), G.add_edge(j, i);
            if(abs(y[i]-y[j]) < D) G.add_edge(N+i, j), G.add_edge(N+j, i);
        }
    }
    G.decompose();
    int ans[N];
    rep(i, N){
        if(G[i] == G[N+i]) {cout << "No" << endl; return 0;}
        if(G[i] > G[N+i]) ans[i] = x[i];
        if(G[i] < G[N+i]) ans[i] = y[i];
    }
    cout << "Yes" << endl;
    rep(i, N) cout << ans[i] << endl;
}

Measured memory_bytes: 3920
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<queue>
#include<climits>
#include<set>
#include<map>
#define ll long long
using namespace std;

int main() {
	ll n;
	cin >> n;
	cout << n*(n + 1)/2 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define long long long
using namespace std;
string a,b,c;
long num;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin>>a>>b;
    c=a+b;
    for(auto x:c)
    {
        num=num*10+x-'0';
    }
    long x=sqrt(num);
    if(x*x==num)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
N, X = map(int, input().split())
S = [int(i) for i in input().split()]

mod = 10 ** 9 + 7

S.sort(reverse=True)

dp = [0] * (X + 1)
dp[X] = 1

for i in range(N) :
  ndp = [0] * (X + 1)
  for j in range(X + 1) :
    ndp[j%S[i]] += dp[j]
    ndp[j%S[i]] %= mod
    if i != N - 1 :
      ndp[j] += dp[j] * (N - 1 - i)
      ndp[j] %= mod
  dp = ndp

ret = 0
for i in range(X + 1) :
  ret += i * dp[i] % mod
  ret %= mod

print(ret)

Measured memory_bytes: 84988
let f s =
 let rec fiter ss =
  if String.length ss=0
   then false
   else
    (if ss.[0]=='9'
     then true
     else fiter (String.sub s 1 (String.length ss-1))) in fiter s;;
let () = Scanf.scanf "%s"
f
|> (fun a -> if a then "Yes" else "No")
|> Printf.printf "%s\n"

Measured memory_bytes: 384
cities_count, roads_count = [int(x) for x in input().split(' ')]

cities_roads_count = [0] * cities_count

for i in range(roads_count):
    a, b = [int(x) for x in input().split(' ')]

    cities_roads_count[a - 1] += 1
    cities_roads_count[b - 1] += 1

for c_r in cities_roads_count:
    print(c_r)

Measured memory_bytes: 3060
#include<iostream>
#include<iomanip>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<set>
using namespace std;
int t,x,y,n;
int bj=1;
int main() {
	cin>>n;
	while(n--){
		cin>>t>>x>>y;
		if(x+y>t)bj=0;
		if(((x+y)&1)!=(t&1))bj=0;
	}
	if(bj)puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args){
		  Scanner sc = new Scanner(System.in);
		  int a = sc.nextInt();
		  int b = sc.nextInt();
		  int c = sc.nextInt();
		  int d = sc.nextInt();
		  sc.close();
		  
		  boolean flag = false;
	      
		  if(Math.abs(a - c) <= d) {
			  flag = true;
		  }else {
			  if(Math.abs(a - b) <= d && Math.abs(b - c) <= d) {
				  flag = true;
			  }
		  }
		  
		  if(flag) {
			  System.out.println("Yes");
		  }else {
			  System.out.println("No");
		  }
	      System.exit(0);
	    }
}

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

#define mp make_pair
typedef long long ll;
typedef pair<int,int>pii;
vector<pii>edge;

int main()
{
	int n,k;
	scanf("%d%d",&n,&k);
	if(k>((n-1)*(n-2))/2){
		printf("-1\n");
		return 0;
	}
	int cnt = ((n-1)*(n-2))/2;
	for(int i=2;i<=n;i++){
		edge.push_back(mp(1,i));
	}
	for(int i=2;i<=n&&cnt>k;i++){
		for(int j=i+1;j<=n&&cnt>k;j++){
			edge.push_back(mp(i,j));
			cnt--;
		}
	}
	printf("%d\n",(int)edge.size());
	for(auto it:edge)
	{
		printf("%d %d\n",it.first,it.second);
	}
}


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

int main(){
	int d;
	cin >> d;
	if(d == 25)
		cout << "Christmas";
	if(d == 24)
		cout << "Christmas Eve";
	if(d == 23)
		cout << "Christmas Eve Eve";
	if(d == 22)
		cout << "Christmas Eve Eve Eve";
	cout << endl;
}

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

long long pp[101][101] ;

int main(){

    int n, x ;
    cin >> n >> x ;
    int ans = 1 ;
    int wow = 0 ;
    for(int i = 0; i < n;i++){

        int tmp ;
        cin >> tmp ;
        wow += tmp ;
        if(wow <= x)
            ans++ ;

    }
    cout << ans ;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(A: "List[List[int]]", N: int, b: "List[int]"):
    for i in range(N):
        searchAndPut(A,b[i])

    # Horisonal
    if A[0][0] == A[0][1] == A[0][2] == -1:
            print(YES)
    elif A[1][0] == A[1][1] == A[1][2] == -1:
            print(YES)
    elif A[2][0] == A[2][1] == A[2][2] == -1:
            print(YES)
    # Vertical
    elif A[0][0] == A[1][0] == A[2][0] == -1:
            print(YES)
    elif A[0][1] == A[1][1] == A[2][1] == -1:
            print(YES)
    elif A[0][2] == A[1][2] == A[2][2] == -1:
            print(YES)
    # Cross
    elif A[0][0] == A[1][1] == A[2][2] == -1:
            print(YES)
    elif A[0][2] == A[1][1] == A[2][0] == -1:
            print(YES)
    else:
        print(NO)

def searchAndPut(A: "List[List[int]]",b):
    for i in range(3):
        list = A[i]
        if (b in list):
            list[list.index(b)] = -1
            break

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = [[int(next(tokens)) for _ in range(3)] for _ in range(3)]  # type: "List[List[int]]"
    N = int(next(tokens))  # type: int
    b = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(A, N, b)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll a = 0;
  string s;
  in(s);
  ll n;
  while(s.size() > 4){
    n = s.size();
    if(s[n - 1] == 'm' && s[n - 2] == 'a' && s[n - 3] == 'e' && s[n - 4] == 'r' && s[n - 5] == 'd'){
      rep(i, 5)
        s.pop_back();
    }
    else if(s[n - 1] == 'e' && s[n - 2] == 's' && s[n - 3] == 'a' && s[n - 4] == 'r' && s[n - 5] == 'e'){
      rep(i, 5)
        s.pop_back();
    }
    else if(n >= 7 && s[n - 1] == 'r' && s[n - 2] == 'e' && s[n - 3] == 'm' && s[n - 4] == 'a' && s[n - 5] == 'e' && s[n - 6] == 'r' && s[n - 7] == 'd'){
      rep(i, 7)
        s.pop_back();
    }
    else if(n >= 6 && s[n - 1] == 'r' && s[n - 2] == 'e' && s[n - 3] == 's' && s[n - 4] == 'a' && s[n - 5] == 'r' && s[n - 6] == 'e'){
      rep(i, 6)
        s.pop_back();
    }
    else break;
    if(s.size() == 0)
      a = 1;
  }
  if(a == 1)
    out("YES");
  else
    out("NO");
  memi;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(ll i = s;i<n;i++)
#define repe(i,s,n)for(ll i = s;i<=n;i++)

int main() {
	ll A, B, C, K; cin >> A >> B >> C >> K;

	ll D = A + B + C;
	ll maxV = max(A, max(B, C));

	D -= maxV;
	rep(i, 0, K) {
		maxV *= 2;
	}
	cout << maxV + D << endl;
	return 0;
}

Measured memory_bytes: 256
n,m = map(int,input().split())
a = []; b= [];
for i in range(n): a.append(list(map(int,input().split())))
for i in range(m): b.append(int(input()))
for i in range(n):
    c = 0
    for j in range(m):
        c += a[i][j]*b[j]
    print(c)



Measured memory_bytes: 6016
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    d = {"Sunny":1 , "Cloudy":2, "Rainy":0}
    a = ["Sunny", "Cloudy", "Rainy"]
    print(a[d[input()]])
    return

#B
def B():
    s = S()
    for i, si in enumerate(s):
        if i % 2:
            if si == "R":
                print("No")
                return
        else:
            if si == "L":
                print("No")
                return
    print("Yes")
    return

#C
def C():
    n, k, q = LI()
    d = [0] * n
    for _ in range(q):
        a = II() - 1
        d[a] += 1
    for a in d:
        if k - (q - a) > 0:
            print("Yes")
        else:
            print("No")
    return

#D
def D():
    n, = LI()
    a = LI()
    q = []
    for ai in a:
        heappush(q, ai)
    for _ in range(m):
        heappush(q, heappop(q) / 2)
    ans = 0
    while q:
        ans += int(heappop(q))
    print(ans)
    return

#E
def E():
    return

#F
def F():
    return

#Solve
if __name__ == '__main__':
    C()


Measured memory_bytes: 47580
def main():
    H, W = map(int, input().split())
    N = int(input())
    A = list(map(int, input().split()))
    ans = [[0] * W for _ in range(H)]
    i = 0
    j = 0
    d = 1
    for n in range(N):
        for _ in range(A[n]):
            ans[i][j] = str(n + 1)
            if (0 > d and j == 0) or (d > 0 and j == W - 1):
                i += 1
                d *= -1
                continue
            j += d
    for r in ans:
        print(' '.join(r))


main()


Measured memory_bytes: 3700
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	bool isok = true;
	for(int i=0;i<s.size();i++)
	{
		if(i%2==0)
		{
			if((s[i]!='R'&&s[i]!='U'&&s[i]!='D'))
			isok = false;
		}
		if(i%2 == 1)
		{
			if(s[i] !='L'&&s[i]!='U'&&s[i]!='D')
			isok = false;
		}
	 } 
	 if(isok)cout<<"Yes\n";
	 else cout<<"No\n";
	 return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <tuple>
#include <stack>

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define print(s) cout << s << endl
typedef long long ll;
using namespace std;

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main() {
	int n; cin >> n;
	cout << "ABC" << n << endl;
}

Measured memory_bytes: 256
#include<iostream>
    #include<cmath>
    #include<algorithm>
     
    using namespace std;
     
    char c[567890];
    int a[567890], dp[567890];
    int n;
     
    int main() 
    {
    	scanf("%d%s", &n, c+1);
    	
    	for (int i=1;i<=n;++i) 
    	{
    		if (c[i]=='0') a[i]=i;
    		else a[i]=a[i-1];
    	}
    	
    	for (int i=1;i<=n;++i) 
    	{
    		dp[i] = dp[i-1];
    		if (c[i]=='1') 
    		{
    			if (c[i-1]=='0'&&c[i-2]=='1') 
    			{
    				dp[i]=max(dp[i],dp[a[i-2]]+(i-2)-a[i-2]);
    				dp[i]=max(dp[i],dp[a[i-2]+1]+(i-2)-(a[i-2]+1));
    			}
    			else if (a[i]>1&&c[a[i]-1]=='1') dp[i]=max(dp[i],dp[a[i]-2]+i-a[i]);
    		}
    	}
    	
    	cout<<dp[n];
    	
    	return 0;
    }

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

int main(){
	
	int N,M,P;
	cin>>N>>M>>P;
	
	vector<vector<pair<long long,long long>>> E(N,vector<pair<long long,long long>> (0));
	vector<vector<int>> E2(N,vector<int>(0));
	for(int i=0;i<M;i++){
		long long a,b,c;
		cin>>a>>b>>c;
		a--;b--;
		c=P-c;
		E[a].push_back(make_pair(b,c));
		E2[b].push_back(a);
	}
	
	vector<long long> dis(N,Inf);
	dis[0] = 0;
	
	for(int i=0;i<N;i++){
		for(int j=0;j<N;j++){
			if(dis[j]==Inf)continue;
			for(int k=0;k<E[j].size();k++){
				int to = E[j][k].first;
				long long cost = E[j][k].second;
				if(dis[to] > dis[j] + cost){
					dis[to] = dis[j] + cost;
				}
			}
		}
	}
	
	vector<long long> dis2(N,Inf);
	dis2[N-1]=0;
	for(int i=0;i<N;i++){
		for(int j=0;j<N;j++){
			if(dis2[j]==Inf)continue;
			for(int k=0;k<E2[j].size();k++){
				int to = E2[j][k];
				long long cost = 1;
				if(dis2[to] > dis2[j] + cost){
					dis2[to] = dis2[j] + cost;
				}
			}
		}
	}
	/*
	for(int i=0;i<N;i++){
		cout<<dis[i]<<endl;
	}*/
	
	for(int i=0;i<N;i++){
		for(int j=0;j<E[i].size();j++){
			int to = E[i][j].first;
			long long cost = E[i][j].second;
			if(dis[i]+cost<dis[to]){
				if(dis2[to]!=Inf&&dis[to]!=Inf){
					cout<<-1<<endl;
					return 0;
				}
			}
		}
	}
	
	
	
	cout<<max(-dis[N-1],(long long)0)<<endl;
	
		
	
	return 0;
}


Measured memory_bytes: 640
#include<stdio.h>
#include<stdbool.h>
#include<string.h>

void rotation(char S[], char T[], int len){
  char keep = S[0];

  for(int i = 0 ; i < len - 1 ; i++){
    S[i] = S[i + 1];
  }

  S[len - 1] = keep;

}


int main(void){

  char S[101];
  char T[101];
  bool check = false;
  scanf("%s", S);
  scanf("%s", T);
  
  int len = strlen(S);
  

  for(int i = 0 ; i < len ; i++){
    int count = 0;
    
    for(int j = 0 ; j < len ; j++){
      if(S[j] == T[j]) count++;
    }
  
    if(count == len) check = true;
    rotation(S , T , len);
  }
  

  if(check){
    puts("Yes");
  }else{
    puts("No");
  }
    
  return 0;
}

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a*b/gcd(a, b);
}

int main()
{
    cout << fixed << setprecision(15);
    ll A, B, X;
    cin >> A >> B >> X;

    if(A<= X && X <= A+B){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
    return 0;
}

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

const int MAXN = 1e3 + 5;
const int MAXK = 1e4 + 5;
ll dp[MAXK];
ll a[MAXN];
ll b[MAXN];
int n,m;

ll solve(int h)
{
    if(h >= m)
        return 0;
   
   ll &ret = dp[h];
   if(ret != -1)
       return ret;
       
       
   ret = 1e17;
  for(int i = 0 ; i < n ; i++)
      ret = min(ret , solve(h + a[i]) + b[i]);
      
return ret;
       
       
}

int main() {
  
  cin >> m >> n;
  for(int i = 0 ; i < n ; i++)
  {
      cin >> a[i] >> b[i];
  }
  memset(dp,-1,sizeof(dp));
  cout << solve(0);
  
}

Measured memory_bytes: 768
// AOJ 2759 Match Peas War
// 2019.3.11 bal4u

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define MIN(a,b) ((a)<=(b)?(a):(b))
int memo[6][6][6][6];

int check(int l1, int r1, int l2, int r2)
{
	int ans = 0;

	if (l1 >= 5 && r1 >= 5) return 0;
	if (memo[l1][r1][l2][r2] >= 0) return memo[l1][r1][l2][r2];
	if      (l1 < 5 && l2 < 5 && !check(MIN(5, l1 + l2), r2, l1, r1)) ans = 1;
	else if (r1 < 5 && l2 < 5 && !check(MIN(5, r1 + l2), r2, l1, r1)) ans = 1;
	else if (l1 < 5 && r2 < 5 && !check(l2, MIN(5, r2 + l1), l1, r1)) ans = 1;
	else if (r1 < 5 && r2 < 5 && !check(l2, MIN(5, r2 + r1), l1, r1)) ans = 1;
	return memo[l1][r1][l2][r2] = ans;
}

int main()
{
	int l1, l2, r1, r2;

	memset(memo, 0xff, sizeof(memo));
	scanf("%d%d%d%d", &l1, &r1, &l2, &r2);
	puts(check(l1, r1, l2, r2)? "ISONO": "NAKAJIMA");
	return 0;
}


Measured memory_bytes: 2112
var s:String;i:Longint;a:array[97..122]of boolean;
begin
	readln(s);
	for i:=1 to length(s) do begin
		a[ord(s[i])]:=true;
	end;
	for i:=97 to 122 do begin
		if not a[i] then begin
			writeln(chr(i));
			exit;
		end;
	end;
	writeln('None');
end.


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

int main(void)
{
    int LR = 0;
    int N;
    cin >> N;
    string str;
    cin >> str;
    deque<int> I;
    deque<char> A;
    for( int i = 0; i < str.length(); i++){
        if(str[i] == '(' ) I.push_back(0);
        else I.push_back(1); 
    }
    for( int i = 0; i < I.size(); i++){
        //cout << I[i];
    }
    for( int i = 0; i < I.size(); i++){
        if( I[i] == 0 ){
            LR++;
            A.push_back('(');
        }
        else {
            LR--;
            A.push_back(')');
        }
        if( LR ==  -1 ){
            LR++;
            A.push_front('(');
        }
    }
    for( int i = 0; i < LR; i++){
        A.push_back(')');
    }
    for( int i = 0; i < A.size(); i++){
        cout << A[i];
    }

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<complex>
#include<set>
#include<map>
#include<algorithm>

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)

const int H = 66;
const int W = 11;
const int INF = 1000000000;
int w,h;
string masu[H];
int board[H][W];
int n;

typedef pair<int,int> pii;

pii foot[H*W];
vector<pii> pos[H*W];
vector<int> edge[H*W];

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

void makepos(){
	rep(i,H)rep(j,W)board[i][j]=0;
	rep(i,H*W){
		pos[i].clear();
		edge[i].clear();
	}
	n = 1;
	
	rep(i,h){
		rep(j,w){
			if(masu[i][j]!='.'){
				char c = masu[i][j];
				queue<pii> que;
				que.push(pii(i,j));
				
				while(!que.empty()){
					pii u = que.front();
					que.pop();
					
					if(u.first<0 || u.second<0 || u.first>=h || u.second>=w)continue;
					if(masu[u.first][u.second]!=c)continue;
					masu[u.first][u.second]='.';
					board[u.first][u.second]=n;
					pos[n].push_back(u);
					
					rep(p,4)que.push(pii(u.first+dy[p], u.second+dx[p]));
				}
				n++;
			}
		}
	}
	
	/*
	rep(i,n){
		rep(j,pos[i].size()){
			printf("(%d,%d)",pos[i][j].first, pos[i][j].second);
		}puts("");
	}*/
	
	/*
	rep(i,h){
		rep(j,w)printf("%d ",board[i][j]);puts("");
	}
	*/
}

void make_edge_foot(){
	rep(i,H*W)foot[i] = pii(INF,-INF);
	foot[0] = pii(-INF, INF);
	
	rep(i,h){
		rep(j,w){
			if(board[i][j]!=0){
				bool s = false;
				if(i==h-1){
					edge[0].push_back(board[i][j]);
					s=true;
				}else{
					if(board[i+1][j]!=0 && board[i+1][j]!=board[i][j]){
						edge[board[i+1][j]].push_back(board[i][j]);
						s=true;
					}
				}
				if(s){
					pii temp = foot[board[i][j]];
					foot[board[i][j]] = pii(min(temp.first, j), max(temp.second,j));
				}
			}
		}
	}
	rep(i,n){
		sort(edge[i].begin(),edge[i].end());
		edge[i].erase(unique(edge[i].begin(),edge[i].end()), edge[i].end());
	}
	/*
	rep(i,n){
		printf("foot %d  %d %d\n",i,foot[i].first, foot[i].second);
	}
	rep(i,n){
		printf("edge ");
		rep(j,edge[i].size())printf("%d ",edge[i][j]);puts("");
	}
	*/
}

bool saiki(int val, vector<int>& befsum){
	
	bool ret = true;
	
	vector<int> sum(befsum.size());
	rep(i,edge[val].size()){
		ret &= saiki(edge[val][i], sum);
	}
	
	rep(i,pos[val].size())sum[pos[val][i].second]++;
	rep(i,sum.size())befsum[i]+=sum[i];
	
	double h = 0;
	int count = 0;
	rep(i,sum.size()){
		h += i*sum[i];
		count += sum[i];
	}
	
	h/=count;
	h+=0.5;
	
	
	ret &= ((foot[val].first < h) && (h < foot[val].second+1));
	/*
	printf("val=%d\n",val);
	rep(i,sum.size())printf("%d ",sum[i]);puts("");
	printf("foot %d %d  %lf\n",foot[val].first, foot[val].second, h);
	printf("%d\n\n",ret);
	*/
	return ret;
}

string solve(){
	rep(i,h)cin>>masu[i];
	
	makepos();
	
	make_edge_foot();
	
	vector<int> v(w);
	bool ans = saiki(0, v);
	if(ans)return "STABLE";
	return "UNSTABLE";
}

int main(){
	while(1){
		cin>>w>>h;
		if(w==0 && h==0)break;
		cout<<solve()<<endl;
		//break;
	}
}

Measured memory_bytes: 1292
#include <algorithm>
#include <iostream>
#include <string>

using namespace std;

int main()
{

	int N;
	cin >> N;

	string S,S1,S2;
	cin >> S;

	char c;
	
	int max_count = 0;
	
	for (int k = 1; k < N-1; k++) {
		int count=0;
		S1= S.substr(0, k);
		S2= S.substr(k);

		for (int i = 0; i < 26; i++) {
			char c = 'a' + i;

			if (S1.find(c) != -1 && S2.find(c) != -1) {
				count++;
			}
		}
		if (count > max_count) {
			max_count = count;
		}
	}
	
	cout << max_count << endl;

	return 0;
}

Measured memory_bytes: 384
s = input()

if len(s) % 2 == 1:
    print('No')
    exit()

i = 0
while True:
    if i > len(s) - 2:
        break
    target = s[i:i+2]
    if target != "hi":
        print("No")
        exit()
    i += 2
print("Yes")






Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<long long,long long>
#define ii pair<int,int>
#define mod 1000000007
#define endl '\n'
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);

ll power(ll a,ll b){
	ll ans=1;
	while(b>0){
		if(b%2!=0){
			ans=(ans*a)%mod;
		}
		a=((a%mod)*(a%mod))%mod;
		b>>=1;
	}
	return ans;
}

void sieve(int n){
	bool prime[n+1];
	memset(prime,true,sizeof(prime));
	for(int p=2;p*p<=n;p++){
		if(prime[p]){
			for(int i=p*p;i<=n;i+=p)
				prime[i]=false;
		}
	}
	for(int p=2;p<=n;p++){
		if(prime[p])
			cout<<p<<" ";
	}
}

int main() {
	IOS;
	int t=1;
	//cin>>t;
	while(t--){
		int n;
		double z;
		cin>>n;
		double ans=0;
		double a[n];
		for(int i=0;i<n;i++){
			cin>>a[i];
		}
		sort(a,a+n);
		ans=(a[0]+a[1])/2;
		for(int i=2;i<n;i++){
			ans=(ans+a[i])/2;
		}
		cout<<ans;
	}
	return 0;
}

Measured memory_bytes: 256