akhauriyash/Code-Regression huggingface dataset:
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e18
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
ll mod = 1e9+7;
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b) a=b; return a<b; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a) a=b; return b<a; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill((T*)array, (T*)(array+N), val);}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

class debug
{
public:
    template<typename T> void vdeb(T vec);
    template<typename T1, typename T2> void adeb(T1 *arr, T2 n);
    template<typename T> void mdeb(T mp);
};

#endif //INCLUDE_DEBUG_HPP

template<typename T> void debug::vdeb(T vec)
{
    cout << "#vector set debug" << endl;
    for(auto vv : vec) cout << vv << " ";
    cout << endl;
}

template<typename T1, typename T2> void debug::adeb(T1 *arr, T2 n)
{
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}

template<typename T> void debug::mdeb(T mp)
{
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
debug dbg;

class AOneOutOfThree {
public:
	void solve(std::istream& in, std::ostream& out)
	{
	    int a, b, c;
	    in >> a >> b >> c;
	    if(a == b) out << c << endl;
	    else if(b == c) out << a << endl;
	    else out << b << endl;
	}
};


int main() {
	AOneOutOfThree solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

	private void solve() throws IOException {
		int a = ni();
		int b = ni();
		int d = b - a;
		int ans = d * (d + 1) / 2;
		ans -= b;
		out.println(ans);
		out.close();
	}

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

	private int[][] na(int n) throws IOException {
		int[][] a = new int[n][2];
		for (int i = 0; i < n; i++) {
			a[i][0] = ni();
			a[i][1] = i;
		}
		return a;
	}

	String ns() throws IOException {
		while (!tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine(), " ");
		}
		return tok.nextToken();
	}

	int ni() throws IOException {
		return Integer.parseInt(ns());
	}

	long nl() throws IOException {
		return Long.parseLong(ns());
	}

	double nd() throws IOException {
		return Double.parseDouble(ns());
	}

	String[] nsa(int n) throws IOException {
		String[] res = new String[n];
		for (int i = 0; i < n; i++) {
			res[i] = ns();
		}
		return res;
	}

	int[] nia(int n) throws IOException {
		int[] res = new int[n];
		for (int i = 0; i < n; i++) {
			res[i] = ni();
		}
		return res;
	}

	long[] nla(int n) throws IOException {
		long[] res = new long[n];
		for (int i = 0; i < n; i++) {
			res[i] = nl();
		}
		return res;
	}

	public static void main(String[] args) throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		tok = new StringTokenizer("");
		Main main = new Main();
		main.solve();
		out.close();
	}
}

Measured memory_bytes: 21204
#include <cmath>
#include <cstdio>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
//Constant
const int A=100000;
const int D=A*2;
const int MOD=1000000007;
//Quick Read
int Read(){
	int x=0;
	bool neg=false;
	char c=getchar();
	while(isdigit(c)==false)neg^=c=='-',c=getchar();
	while(isdigit(c)==true)x=x*10+c-'0',c=getchar();
	return neg==true?-x:x;
}
inline void Read(int &x){x=Read();}
//Math
int fac[D+1],facinv[D+1];
int Power(int x,int y){
	int ans=1;
	for(int i=y;i>=1;i>>=1){
		if(i&1)ans=(long long)ans*x%MOD;
		x=(long long)x*x%MOD;
	}
	return ans;
}
inline int Inverse(int x){return Power(x,MOD-2);}
void Init(){
	fac[0]=1;
	for(int i=1;i<=D;++i)fac[i]=(long long)fac[i-1]*i%MOD;
	facinv[D]=Inverse(fac[D]);
	for(int i=D-1;i>=0;--i)facinv[i]=(long long)facinv[i+1]*(i+1)%MOD;
}
inline int Comb(int n,int m){return (long long)fac[n]*facinv[n-m]%MOD*facinv[m]%MOD;}
inline int Calculate(int r,int c){return Comb(r+c,c);}
//Main
int main(){
	// freopen("ARC058D.in","r",stdin);
	// freopen("ARC058D.out","w",stdout);
	Init();
	int r=Read(),c=Read(),a=Read(),b=Read();
	int ans=0;
	for(int i=1;i<=r-a;++i)ans=(ans+(long long)Calculate(i-1,b-1)*Calculate(r-i,c-b-1)%MOD)%MOD;
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 1792
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, K = MAP()
a = LIST()

l = []

for i in range(1, N+1):
	tmp = sum(a[:i])
	for j in range(N-i+1):
		l.append(tmp)
		tmp -= a[j]
		if j+i <= N-1:
			tmp += a[j+i]

ans = 0
for i in range(max(l).bit_length()-1, -1, -1):
	nextl = []
	for x in l:
		if (x>>i)&1:
			nextl.append(x)
	if len(nextl) >= K:
		ans += 1<<i
		l = nextl
print(ans)


Measured memory_bytes: 30036
#include<bits/stdc++.h>
using namespace std;
 
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define MP make_pair
#define pb push_back
#define ff first
#define ss second
#define sz(x) x.size()
#define all(c) c.begin(),c.end()
#define int long long
#define fr(i,j,x) for(int i=j;i<x;i++)
#define rep(i,j,x) for(int i=j;i<=x;i++)
#define mem(x,val) memset(x,val,sizeof(x))
//#define endl '\n'
#define vi vector<int>
#define ll long long
#define pii pair<int,int>
 
const int MOD=1e9+7;
const int N=5e5+10;
const int INF=1e9;


// int chk(int x){
//     vector<int>v;
//     rep(i,1,n){
//         a[i]=0;
//     }
//     int start=1,ct;
//     for(auto it=mp.rbegin();it!=mp.rend();it++){
//         v=(*it).second;
//         for(auto e:v){
//             while(start<=n && a[start]!=0){
//                 start++;
//             }
//             ct=0;
//             for(int j=start;j<=n;j+=(x+1)){
//                 while(j<=n && a[j]!=0){
//                     j++;
//                 }
//                 a[j]=e;
//                 ct++;
//                 if(ct==(*it).first){
//                     break;
//                 }
//             }
//             if(ct<(*it).first){
//                 return 0;
//             }
//         }
//     }
//     return 1;
// }

// void solve(){
//     cin>>n;
//     cnt.clear();
//     mp.clear();
//     rep(i,1,n){
//         cin>>a[i];
//         cnt[a[i]]++;
//     }   
//     for(auto &u:cnt){
//         mp[u.second].push_back(u.first);
//     }
//     lo=0;
//     hi=n-2;
//     ans=0;
//     //cout<<chk(4)<<endl;
//     while(lo<=hi){
//         mid=(lo+hi)/2;
//         if(chk(mid)){
//             lo=mid+1;
//             ans=mid;
//         }
//         else{
//             hi=mid-1;
//         }
//     }
//     cout<<ans<<endl;
// }

int cnt[10000003];

void solve(){
    int n;
    cin>>n;
    rep(i,1,n){
        for(int j=i;j<=n;j+=i){
            cnt[j]++;
        }
    }
    int ans=0;
    rep(i,1,n){
        ans+=i*cnt[i];
    }
    cout<<ans<<endl;
}
int32_t main()
{
    // #ifndef ONLINE_JUDGE
    //     freopen("inputf.in", "r", stdin);
    //     //freopen("outputf.in", "w", stdout);
    // #endif
    SPEED;
    int T=1;
    //cin>>T;
    int t1=1;
    while(true)
    {  
        //cout<<"Case #"<<t1<<": ";
        solve();
        t1++;
        if(t1>T)
            break;
    }
}   

Measured memory_bytes: 81736
#include <stdio.h>
     
    int main()
    {
      char s[200001], t[200001];
      scanf("%s%s", s, t);
      int i=0;
      int ans=0;
      while(s[i]){
        if(s[i]!=t[i]) ans++;
        i++;
      }
      printf("%d\n",ans);
      return 0;
    }

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

using namespace std;
using namespace __gnu_pbds;

#define Q int t; scanf("%d", &t); for(int q=1; q<=t; q++)
typedef long long int lli;
typedef pair<int, int> pi;
#define oset tree<int, null_type,greater<int>, rb_tree_tag,tree_order_statistics_node_update>


int main()
{
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    vector<int> v;

    if(s[0] == '0'){
        v.push_back(0);
    }
    for(int i=0; i<n; i++){
        char c = s[i];
        int cnt = 0;
        while(s[i] == c){
            cnt++;
            i++;
        }
        v.push_back(cnt);
        i--;
    }
    if(s[n-1] == '0');
    v.push_back(0);
    k = k*2+1;
    int sum = 0;
    n = v.size();
    for(int i=0; i<min(k, n); i++){
        sum += v[i];
    }
    int mx = sum;
    for(int i=k; i<n; i++){
        sum -= (v[i-k]);
        sum += (v[i]);

        if(i%2 != k%2)
            mx = max(mx, sum);
    }
    cout << mx << endl;

    return 0;
}


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

long long N, M;

int main() {
	scanf("%lld%lld", &N, &M);
	long long ans = min(N, M/2);
	N -= ans;
	M -= ans * 2;
	ans += M/4;
	
	printf("%lld\n", ans);
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    int n;
    vector<int > v;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        int t;cin>>t;
        v.push_back(t);
    }
    
    int c;
    cin>>c;
    for(int i=0;i<c;i++)
    {
        int b,m,e;
        cin>>b>>m>>e;
        auto it=v.begin();
        rotate(it+b,it+m,it+e);
    }
    
    cout<<v[0];
    for(int i=1;i<v.size();i++)
    {
        cout<<" "<<v[i];
    }
    cout<<endl;
}


Measured memory_bytes: 3136
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define pi 3.14159265359
#define all(i) i.begin(),i.end()
using namespace std;
const long long INF=1e9+7;
const string alp="abcdefghijklmnopqrstuvwxyz"; //26
const string ALP="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
//const ll MOD=998244353LL;
//const ll MOD=1777777777LL;


int main() {
  ll N,D,X;
  cin>>N>>D>>X;
  ll a[N];
  rep(i,N) cin>>a[i];
  ll ans;
  ll count=0;
  for(int i=0;i<N;i++){
    ll j=1;
    while(true){
      if(D>=1+a[i]*(j-1)&&D<1+a[i]*j){
        count+=j;
        break;
      }
      else{
        j++;
      }
    }
  }
  ans=count+X;
  cout<<ans<<endl;
}


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

map <string, int> M;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	int a = 0;
	for (int i = 0; i < n; i++) {
		string s;
		cin >> s;
		M[s]++;
		a = max(M[s], a);
	}
	for (auto P: M) {
		if (P.second == a)
			cout << P.first << '\n';
	}
}


Measured memory_bytes: 23808
#include<stdio.h>
#define MAX 2000000

int A[MAX];
int H;
void maxheapify( int i);

int main(){
    int i;
    scanf("%d",&H);

    for(i=1;i<=H;i++) scanf("%d",&A[i]);

    for(int i=H/2; i>=1; i--) maxheapify(i);

    for(i=1;i<=H;i++) printf(" %d",A[i]);
    printf("\n");
    return 0;
}

void maxheapify(int i){
    int l = 2 * i;
    int r = 2 * i  +1;
    int largest,t;

    // 左の子、自分、右の子で値が最大のノード

    if(l<=H && A[l]>A[i])largest=l;
    else largest=i;
    if(r<=H && A[r]>A[largest])  largest=r;

    if(largest != i){
        t=A[i];
        A[i]=A[largest];
        A[largest]=t;
        maxheapify(largest);
    }
}



Measured memory_bytes: 3648
#![allow(warnings)]
use std::collections::HashMap;

fn read<T: std::str::FromStr>() -> T {
  let mut s = String::new();
  std::io::stdin().read_line(&mut s).ok();
  s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
  read::<String>().split_whitespace()
    .map(|e| e.parse().ok().unwrap()).collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
  (0..n).map(|_| read_vec()).collect()
}

fn main() {
//  let (s, t) = {
//    let mut tmp: Vec<String> = read_vec();
//    (&tmp[0], "hoge")
//  };
  let tmp: Vec<String> = read_vec();
  let (a, b) = {
    let tmp: Vec<i8> = read_vec();
    (tmp[0], tmp[1])
  };
  let u: String = read();

  let s = &tmp[0];
  let t = &tmp[1];

  let mut hash = HashMap::new();
  hash.insert(s, a);
  hash.insert(t, b);

  let num: i8 = hash.get(&u).unwrap() - 1;
  hash.insert(&u, num);

  println!("{:?} {:?}", hash.get(&s).unwrap(), hash.get(&t).unwrap());
}

Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <tuple>
#include <cstdio>
#include <cmath>
using namespace std;
using ll = long long;
const int INF = 999999999;

int main() {
    int A, B; cin >> A >> B;
    if (A >= 13) {
        cout << B << endl;
    } else if (A >= 6) {
        cout << B / 2 << endl;
    } else {
        cout << 0 << endl;
    }
}

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

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

    int a[110];
    for(int i = 0; i < n; i++)
        cin >> a[i];

    int alice = 0;
    int bob = 0;
    
    sort(a, a+n, greater<int>());

    for(int i = 0; i < n; i++){
        if(i % 2 == 0){
            alice += a[i];
        }
        else{
            bob += a[i];
        }
    }

    cout << alice - bob << endl;
    return 0;
}

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

bool cmp(long long a, long long b)
{
    return (b<a);
}
long long int num = 1e9 + 7;
long long mod(long long a)
{
    return (a%num+num)%num;
}
long long modi(long long a, long long b)
{
    return mod(mod(a)* mod(b));
}

int main() 
{
    int n,k;
    cin>>n>>k;
    long long in;
    vector<long long> pos;
    vector<long long> neg;
    for(int i=0; i<n; i++)
    {
        cin>>in;
        if(in>0) pos.push_back(in);
        else neg.push_back(in);
    }
    long long answer=1;
    if(pos.size()==0)
    {
        sort(neg.begin(),neg.end());
        if(k%2==1)
        {
            reverse(neg.begin(),neg.end());
        }
        for(int i=0; i<k; i++)
        {
            answer=modi(answer,neg[i]);
        }
        cout<<answer<<endl;
        return 0;
    }
    else 
    {
        if(k%2==1)
        {
            sort(pos.begin(), pos.end());
            answer=modi(answer,pos.back());
            k--;
            pos.pop_back();
        }
        vector<long long> poo;
        sort(pos.begin(),pos.end(),cmp);
        sort(neg.begin(), neg.end());
        for(int i=0; i<(int)pos.size()-1; i+=2)
        {
            poo.push_back(pos[i]*pos[i+1]);
        }
        for(int i=0; i<(int)neg.size()-1; i+=2)
        {
            poo.push_back(neg[i]*neg[i+1]);
        }
        if((int)pos.size()%2==1 and (int)neg.size()%2==1)
        {
            poo.push_back(pos.back()*neg.back());
        }
        sort(poo.begin(),poo.end(),cmp);
        for(int i=0; i<k/2;i++)
        {
            answer=modi(answer,(long long)poo[i]);
        }
        cout<<answer<<endl;
    }
    return 0;
}

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

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using lint=int64_t;
using namespace std;

int main()
{
	int N,A,B,C,D;
	string S;

	cin >> N >> A >> B >> C >> D;
	A--;
	B--;
	C--;
	D--;
	cin >> S;
	
	int ok=true;
	for(int i=B;i<D-1;i++)
	{
		if(S[i]=='#' && S[i+1]=='#')
		{
			ok=false;
			break;
		}
	}
	for(int i=A;i<C-1;i++)
	{
		if(S[i]=='#' && S[i+1]=='#')
		{
			ok=false;
			break;
		}
	}
	if(D<C && B<C)
	{
		bool flag=false;
		for(int i=B-1;i<=D-1;i++)
		{
			if(S[i]=='.' && S[i+1]=='.' && S[i+2]=='.')
			{
				flag=true;
				break;
			}
		}
		if(!flag)ok=false;
	}
	
	if(ok)cout << "Yes";
	else cout << "No";
	cout << endl;
	return 0;
}



Measured memory_bytes: 640
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
int main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	long double n,m,sum;
	cin>>n>>m>>sum;
	if(n+m+2.0*sqrt(n*m)<sum)cout<<"Yes";
	else cout<<"No";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <string>

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

using namespace std;

int main(){

  int H,W;
  int i,j,k;

  for(i=0;i<300;i++){
    cin >>H >>W;
    if(H==0 && W==0) break;

    for(j=1;j<=H;j++){
      for(k=1;k<=W;k++){
	if(j==1 || k==1 || j==H || k==W){
	  cout <<"#";
	}
	  else cout <<".";
      }
      cout <<endl;
    }
    cout <<endl;
  }
  return 0;
}

Measured memory_bytes: 1152
/**
 * The man who codes no bugs
 * McCheng is the man studying Maths in CUHK with IQ200
 * @author McCheng
 */

#include <bits/stdc++.h>
#define int long long
using namespace std;
#undef int
class DReplacing {
public:
    static constexpr int kStressCount = 0;
    static void generateTest(ostream& test) {}
	void solve(istream& cin, ostream& cout) {
int n;
cin>>n;
        vector<int> cnt(1e5 + 1,0);
        long long ans=0;
        for (int i = 0; i < n; i++) {
            int tmp;
            cin>>tmp;
            cnt[tmp]++;
            ans+=tmp;
        }
        int q;
        cin>>q;
        for (int i = 0; i < q; i++) {
            int b,c;
            cin>>b>>c;
            cnt[c]+=cnt[b];
            ans-=1LL*b*cnt[b];
            ans+=1LL*c*cnt[b];
            cnt[b]=0;
            cout<<ans<<"\n";
        }

	}
};

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    istream &in(cin);
    ostream &out(cout);
    out << fixed;
    out.precision(20);
    DReplacing solver;
    solver.solve(in, out);
}


Measured memory_bytes: 3720
#include <cstdio>

const int P=998244353;
inline int mul(const int &a,const int &b){return 1ll*a*b%P;}
inline int add(int a,const int &b){a+=b;return(a>=P)?a-P:a;}
inline int sub(int a,const int &b){a-=b;return (a<0)?a+P:a;}
int qsm(int a,int b){
	int ans=1;
	while(b){
		if(b&1)ans=mul(ans,a);
		a=mul(a,a);
		b>>=1;
	}
	return ans;
}
int n,a[1048576],lim,S,b[1048576];
void FWT(int *a){
	for(int i=1;i<lim;i<<=1)
		for(int j=0;j<lim;j+=(i<<1))
			for(int k=0;k<i;k++){
				const int Ny=a[i+j+k];
				a[i+j+k]=sub(a[j+k],Ny);
				a[j+k]=add(a[j+k],Ny);
			}
}
int main(){
	scanf("%d",&n);
	lim=1<<n;
	for(int i=0;i<lim;i++)scanf("%d",a+i),S=add(S,a[i]);
	S=qsm(S,P-2);
	for(int i=0;i<lim;i++)a[i]=mul(sub(0,a[i]),S);
	a[0]=add(a[0],1);
	FWT(a);
	for(int i=0;i<lim;i++)a[i]=qsm(a[i],P-2);
	a[0]=0;
	FWT(a);
	for(int i=0;i<lim;i++)a[i]=sub(0,a[i]);
	for(int i=0;i<lim;i++)printf("%d\n",sub(a[i],a[0]));
}

Measured memory_bytes: 4736
#include<stdio.h>

int main(){

char S[100000];
char ans;
int ch;
int alpha[26];
for (int i = 0; i < 26; i++){alpha[i]= -1;}

scanf("%s",S);

for (int i = 0; i < 100000; i++)
{ 
 if (S[i] == '\0')
  {
    break;
  }else
  {
    int t = (int)S[i] - 'a';
    alpha[t] = (int)S[i] - 'a';
  } 
}

for (int i = 0; i < 26; i++)
{
  if (alpha[i] == -1)
  {
    printf("%c",'a'+i);
    break;
  }else if (i==25 && alpha[25]!= -1)
  {
    puts("None");
  }
}

return 0;

}

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

vector<ll> a(1, 0);
vector<ll> b(1, 0);
vector<ll> cum(1, 0);

int main()
{
    int n, m, k;
    cin >> n >> m >> k;
    for (int i = 0; i < n; i++)
    {
        int A;
        cin >> A;
        a.push_back(a[i] + A);
    }
    for (int i = 0; i < m; i++)
    {
        int B;
        cin >> B;
        b.push_back(b[i] + B);
    }

    int ans = 0;
    int j = m;

    for (int i = 0; i < n + 1; i++)
    {
        if (a[i] > k) break;

        while (b[j] > k - a[i] && j > 0)
        {
            j--;
        }

        ans = max(ans, i + j);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 7952
import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        PriorityQueue<Integer> q = new PriorityQueue<>();
        for (int i = 0; i < n; i++) {
            q.add(sc.nextInt());
        }

        int count = 0;
        for (int i = 0; i < k; i++) {
            count += q.poll();
        }
        System.out.println(count);
    }
}


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

typedef long long ll;

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

const ll INF=1LL<<60;

int N;
ll a[100010][3];
ll dp[100010][3];

int main(){
	int n; cin>>n;
	for(int i=0;i<n;i++){
		for(int j=0;j<3;j++){
			cin>>a[i][j];
		}
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<3;j++){
			for(int k=0;k<3;k++){
				if(j==k)continue;
				chmax(dp[i+1][k],dp[i][j]+a[i][k]);
			}
		}
	}
	ll ans=0;
	for(int i=0;i<3;i++){
		chmax(ans,dp[n][i]);
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 4992
<?php
// Your code here!

fscanf(STDIN, "%d %d %d %d", $a, $b, $c, $k);
// var_dump($k);
// $sum = 0;
$xa = min($a, $k);
$k -= $xa;
$xb = min($b, $k);
$k -= $xb;
$xc = $k;

echo $xa - $xc;



?>

Measured memory_bytes: 16148
#include <algorithm>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <string>
#include <vector>

#define rep(i, x, n) for(int i = x; i < n; i++)
using namespace std;
const long long INF = 1LL << 60;
bool compare_by_b(pair<int, long long> a, pair<int, long long> b) {
    if(a.second != b.second) {
        return a.second < b.second;
    } else {
        return a.first < b.first;
    }
}

int main() {
    long long N, M;
    string s;
    cin >> N >> M >> s;
    reverse(s.begin(), s.end());
    vector<int> ma(N + 1);
    ma[0] = 0;
    rep(i, 1, N + 1) {
        if(s[i] == '0') {
            ma[i] = i;
        } else {
            ma[i] = ma[i - 1];
        }
    }
    vector<int> res;
    int t = 0;
    while(true) {
        if(t + M >= N) {
            res.push_back(N - t);
            break;
        }
        if(ma[t+M]==t){
            cout<<-1<<endl;
            return 0;
        }
        res.push_back(ma[t + M] - t);
        t = ma[t + M];
    }
    reverse(res.begin(), res.end());
    rep(i, 0, res.size()) {
        if(i != res.size() - 1) {
            cout << res[i] << " ";
        } else {
            cout << res[i] << endl;
        }
    }
}

Measured memory_bytes: 1528
// at_dp_d.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
#define FOR(i,a) for(int i=0;i<a;i++)
typedef long long ll;
const int MAXN = 1e5+5;
int main()
{
	//dp[i][a] -> the minimum sum required to make a using first i elements 
	//dp[i][a]=min(dp[i-1][a],dp[i-1][a-value[i]]+weight[i]);
	int dp[MAXN]; int value[MAXN]; int weight[MAXN]; 
	int n, maxw; cin >> n >> maxw;
	memset(dp, 0x3f3f3f3f, sizeof(dp));
	dp[0] = 0;
	for(int i=1;i<=n;i++){
		cin >> weight[i] >> value[i];
		for (int a = MAXN; a >= value[i]; a--) {
				dp[a] = min(dp[a], dp[a - value[i]] + weight[i]);
		}
	}
	for (int i = MAXN - 1; i >= 0; i--) {
		if (dp[i] <= maxw) {
			cout << i << "\n"; return 0;
		}
	}
	cout << "0\n";
}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started: 
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file


Measured memory_bytes: 640
import java.util.*

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)
    val N = scanner.nextLong()
    val Y = scanner.nextLong()
    for (a in (0..N)) {
        for (b in (0..N)) {
            val c = N - a - b
            if (a * 10000 + b * 5000 + c * 1000 == Y && c >= 0) {
                println("$a $b $c")
                return
            }
        }
    }
    print("-1 -1 -1")
}

Measured memory_bytes: 31520
# 初期入力
import sys
input = sys.stdin.readline
N = int(input())
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))

count =[0]*N
if N ==1:
    count[0] =A1[0] +A2[0]
else:
    for i in range(N-1):
        count[i] =sum(A1[:i+1]) +sum(A2[i:])
print(max(count))

Measured memory_bytes: 3064
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#define fo(a,b,c) for (a=b; a<=c; a++)
#define fd(a,b,c) for (a=b; a>=c; a--)
#define max(a,b) (a>b?a:b)
using namespace std;

int a[80001][2];
int ls[201];
int d[201];
int f[201];
int n,i,j,k,l,len,h,t,ans,s;
char ch;

void New(int x,int y)
{
	++len;
	a[len][0]=y;
	a[len][1]=ls[x];
	ls[x]=len;
}

int main()
{
//	freopen("b.in","r",stdin);
	
	scanf("%d",&n);
	fo(i,1,n)
	{
		fo(j,1,n)
		{
			ch=getchar();
			while (ch!='0' && ch!='1')
			ch=getchar();
			
			if (ch=='1')
			New(i,j);
		}
	}
	
	ans=-1;
	fo(l,1,n)
	{
		s=1;
		
		memset(f,0,sizeof(f));
		h=0;
		t=1;
		d[1]=l;
		f[l]=1;
		
		while (h<t)
		{
			for (i=ls[d[++h]]; i; i=a[i][1])
			if (!f[a[i][0]])
			{
				f[a[i][0]]=f[d[h]]+1;
				s=max(s,f[a[i][0]]);
				
				d[++t]=a[i][0];
			}
			else
			if (f[a[i][0]]+1!=f[d[h]] && f[a[i][0]]-1!=f[d[h]])
			{
				s=-1;
				break;
			}
			
			if (s==-1)
			break;
		}
		
		ans=max(ans,s);
	}
	
	printf("%d\n",ans);
}

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

#define rep(i, n) for(int i=0; i < n; i++)
#define REP(i, n, m) for(int i=n; i < m; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define ALL(v) v.begin(), v.end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)

using namespace std;
using ll=long long;

ll mod=1000000007;

const ll INF = 1LL << 60;

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}

vector<int> ans(100005);

int main() {
  string s;cin >> s;
  vector<int> cnt;
  int c=1;
  int n=s.size();
  rep(i,n-1){
    if(s[i]==s[i+1]){c++;}
    else {cnt.pb(c);c=1;}
    if(i==n-2)cnt.pb(c);
  }

  int r=1;
  int k=0;
  for(auto x:cnt){
    k+=x;
    if(r){
      ans[k-1]+=(x+1)/2;
      ans[k]+=x/2;
    }
    if(!r){
      ans[k-x]+=(x+1)/2;
      ans[k-x-1]+=x/2;
    }
    r=1-r;
  }
  rep(i,n)cout << ans[i] << (i<n-1?' ':'\n');


}




Measured memory_bytes: 1528
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <set>
#include <stack>
using ll = long long;
using uint = unsigned int;
using graph = std::vector<std::vector<ll>>;
using wGraph = std::vector<std::vector<std::pair<ll,ll>>>;
#define rep(i,n) for (int i=0; i < int(n); i++)

using namespace std;
ll MOD7 = 1000000007;
ll MOD9 = 1000000009;
vector<ll> InputVec(ll N){
    vector<ll> A(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    return A;
}
void OutputVec(vector<ll> A){
    for (int i = 0; i < A.size(); ++i) {
        cout << A[i] << ",";
    }
    cout << endl;
}
vector<vector<ll>> InputVec2d(ll H,ll W){
    vector<vector<ll>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<ll>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        for (int xi = 0; xi < W; ++xi) {
            cin >> A[yi][xi];
        }
    }
    return A;
}
vector<vector<char>> InputVec2dStr(ll H,ll W){
    vector<vector<char>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<char>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        string S;
        cin >> S;
        for (int xi = 0; xi < W; ++xi) {
            A[yi][xi] = S[xi];
        }
    }
    return A;
}
void OutputVec2d(vector<vector<ll>> A){
    for (int yi = 0; yi < A.size(); ++yi) {
        for (int xi = 0; xi < A[yi].size(); ++xi) {
            cout << A[yi][xi] << ",";
        }
        cout << endl;
    }
}
graph InputGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    return G;
}
graph InputDGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
    }
    return G;
}
void OutputGraph(graph G){
    for (int i = 0; i < G.size(); ++i) {
        cout << i << ":";
        for (int j = 0; j < G[i].size(); ++j) {
            cout << G[i][j]<< ",";
        }
        cout << endl;
    }
}
void OutputAnswerBool(bool b,bool isUpperCase = false){
    if(b){
        if(isUpperCase){
            cout << "YES" << endl;
        }else{
            cout << "Yes" << endl;
        }
    }else{
        if(isUpperCase){
            cout << "NO" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}

int main() {
    ll N,A,B;
    cin >> N >> A >> B;
    if(B < A || (N == 1&& A!= B)){
        cout << 0 << endl;
        return 0;
    }
    ll m = A * (N-1) + B;
    ll M = A + B * (N-1);
    cout << M - m + 1 << endl;
}


Measured memory_bytes: 256
//#include "stdafx.h"
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;

int main()
{
	int n,a,b;

	cin >> n >> a >> b; //スペースで区切られたものを別々に入力
	int i;
	int sum=0;
	for (i = 0;i <= n;i++) {

		if (i / 10000) { //10000 (10^4)
			if ((((i % 10) + (i / 10 % 10) + (i / 100 % 10) + (i / 1000 % 10) + (i / 10000 % 10)) >= a) && (((i % 10) + (i / 10 % 10) + (i / 100 % 10) + (i / 1000 % 10) + (i / 10000 % 10)) <= b)) {
				sum += i;
			}
		}
		else if (i / 1000) { //1000-9999
			if ((((i % 10) + (i / 10 % 10) + (i / 100 % 10) + (i / 1000 % 10)) >= a) && (((i % 10) + (i / 10 % 10) + (i / 100 % 10) + (i / 1000 % 10)) <= b)) {
				sum += i;
			}
		}
		else if (i / 100) { //100-999
			if ((((i % 10) + (i / 10 % 10) + (i / 100 % 10)) >= a) && (((i % 10) + (i / 10 % 10) + (i / 100 % 10)) <= b)) {
				sum += i;
			}
		}
		else if (i/10) { // 10-99
			if ((((i % 10) + (i / 10 % 10)) >= a) && (((i % 10) + (i / 10 % 10)) <= b)) {
				sum += i;
			}
		}
		else { //0-9
			if ((((i % 10)) >= a) && (((i % 10) ) <= b)) {
				sum += i;
			}
		}
	}
	cout << sum << endl;

	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define V vector<int>
using namespace std;
using ll = long long;

int main(){
    int wa[101000];
    bool ac[101000];
    int ACnum=0,WAnum=0;

    int n, m;
    cin >> n >> m;

    Rep(i, 1, n){
        wa[i] = 0;
        ac[i] = false;
    }
    rep(i, 0, m){
        int p;
        string s;
        cin >> p >> s;
        if(ac[p]) continue;
        if(s=="WA") wa[p]++;
        else if(s=="AC"){
           ACnum++;
           WAnum+=wa[p];
           ac[p]=true;
        }
    }
    cout<<ACnum<<" "<<WAnum<<"\n";
}

Measured memory_bytes: 768
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
using namespace std;
long long gcd(long long a, long long b) { return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b) { return a/gcd(a,b)*b;}

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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (a == b) {
    if (a != c || b != c) cout << "Yes" << endl;
    else  cout << "No" << endl;
  } else if (a == c) {
    if (a != b || c != b) cout << "Yes" << endl;
    else  cout << "No" << endl;
  } else if (b == c) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}

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

using namespace std;

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

Measured memory_bytes: 256
/*
         ██╗ ██████╗ ██╗███╗   ██╗    ██╗   ██╗███████╗
         ██║██╔═══██╗██║████╗  ██║    ██║   ██║██╔════╝
         ██║██║   ██║██║██╔██╗ ██║    ██║   ██║███████╗
    ██   ██║██║   ██║██║██║╚██╗██║    ██║   ██║╚════██║
    ╚█████╔╝╚██████╔╝██║██║ ╚████║    ╚██████╔╝███████║
     ╚════╝  ╚═════╝ ╚═╝╚═╝  ╚═══╝     ╚═════╝ ╚══════╝
*/
//password:+BdCHpO8dQvpo5fnV3/u
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
const int maxn = 5e5 + 5;
const int inf = 0x3f3f3f3f;


int main() {
    int n,m;
    cin>>n>>m;
    vector<int>h(n+1);
    for(int i=1;i<=n;i++) cin>>h[i];
    vector<int>good(n+1,1);
    map<pair<int,int>,int>qaq;
    for(int i=1;i<=m;i++)
    {
        int x,y;
        cin>>x>>y;
        qaq[make_pair(x,y)]++;
        qaq[make_pair(y,x)]++;
    }
    for(auto it:qaq) {
            if(h[it.first.first]>h[it.first.second]) good[it.first.second]=0;
            else if(h[it.first.first]<h[it.first.second]) good[it.first.first]=0;
            else good[it.first.first]=0,good[it.first.second]=0;
    }
    int ans=0;
    for(int i=1;i<=n;i++){
        if(good[i]) ans++;
    }
    cout<<ans;
    return 0;
}

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

int dp[100010], n, k, h[100010];

int main()
{
	scanf("%d%d", &n, &k);
	for (int i = 1; i <= n; i++)
		scanf("%d", &h[i]);
	memset(dp, 0x7f, sizeof(dp));
	dp[1] = 0, dp[2] = abs(h[2] - h[1]);
	for (int i = 3; i <= n; i++)
		for (int j = max(1, i-k); j <= i-1; j++)
			dp[i] = min(dp[i], dp[j] + abs(h[i] - h[j]));
	printf("%d\n", dp[n]);
	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<set>
#include<algorithm>
#include<utility>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const int INF = 1001001001;

ll pow_mod(ll x, ll y) {
	ll res = 1;
	for (ll i = 0; i < y; i++) res = res * x % mod;
	return res;
}

ll gcd(ll x, ll y) {
	if (y == 0) {
		return x;
	}
	return gcd(y, x % y);
}

bool kaibun(string s) {
	string a = s;
	reverse(a.begin(), a.end());
	if (a == s) return true;
	else return false;
}

int main() {
	string s;
	cin >> s;
	int n = s.size();
	string a, b;
	a = s.substr(0, (n - 1) / 2);
	b = s.substr((n + 3) / 2 - 1, (n - 1) / 2);
	if (kaibun(s) && kaibun(a) && kaibun(b)) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<pair<ll,ll>> vp;
#define rep(i,n) for(ll i = 0; i < ll(n); i++)
#define reep(i,n) for(ll i = n; i >-1; i--)
#define deb(variable) cout<<#variable<<"="<<variable<<endl
#define MMOD(i) ((i%MOD)+MOD)%MOD;
#define vec(i,j) vector<vector<ll>>(i,vector<ll>(j,0))
const ll INF=99999999999999999;
const ll MOD=128;
const ll MAX_N=100010;
ll a,b,c,d,e,x,y,z,k,m,n,l,q,ans=0;
double aa,bb;
vl v1,v2,v3;
vp vp1,vp2;
string s[100000];
ll solve(void){
    a=0;
}
int main(){
    c=1;
    d=0;
    e=0;
    cin>>n;
    rep(i,n){
        cin>>s[i];
    }
 
    rep(i,n){
    	a=0;
    	b=0;
        rep(j,s[i].length()-1){
            if(s[i][j]=='A'&&s[i][j+1]=='B')ans++;
        }
        if(s[i][s[i].length()-1]=='A')a=1;
        if(s[i][0]=='B')b=1;
        if(a+b==1)c=0;
        d+=a;
        e+=b;
    }
    cout<<ans+fminl(d,e)-fminl(d,c)<<endl;
}

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

#define ll long long
#define ull unsigned long long
#define LL long long
#define sl(n) scanf("%lld", &n)
#define sf(n) scanf("%lf", &n)
#define si(n) scanf("%d", &n)
#define sch(n) scanf(" %c", &n)
#define ss(n) scanf("%s", n)
#define pii pair <int, int>
#define pll pair <ll, ll>
#define plp pair <int, pll >
#define pb push_back
#define fr first
#define sc second
#define all(a)  a.begin(),a.end()
#define Unique(a)  sort(all(a)),a.erase(unique(all(a)),a.end())

#define inf (1LL<<50)
#define eps 1e-9

ll Set(ll n, ll pos)
{
    return n|(1LL<<pos);
}

bool Check(ll n, ll pos)
{
    return (bool) (n&(1LL<<pos));
}

ll a[410];
ll dp[410][410];
ll csum[410];

ll solve(ll b, ll e)
{
    if (b > e)
        return 0;
    if (b == e)
        return 0;
    ll &ret = dp[b][e];
    if (ret != -1)
        return ret;

    ret = inf;

    for (ll i = b; i < e; i++)
    {
         ret = min(ret, solve(b, i) + solve(i+1, e) + csum[e]-csum[i] + csum[i]-csum[b-1]);
    //     cout << i << " i " << csum[e]-csum[i] << " " << csum[i]-csum[b-1] << endl;
    //     cout << b << " " << e << " " << ret << endl;
    }

    return ret;
}

int main ()
{
    //  freopen("input.txt", "r", stdin);
    //  freopen("output.txt", "w", stdout);
    //  ios_base::sync_with_stdio(0); // no printf/scanf must be present
    ll cs, ts, i, j, k, x, y, z, q, m, n, cap;

    while(sl(n) != EOF)
    {
        for (i = 1; i <= n; i++)
        {
            sl(a[i]);
            csum[i] = csum[i-1]+a[i];
        }

        memset(dp, -1, sizeof(dp));

        printf("%lld\n", solve(1, n));
    }
    return 0;
}


Measured memory_bytes: 1536
while(True):
    (a,op,b) = [s for s in input().split()]
    a = int(a)
    b = int(b)
    if op == "+":
        print(a+b)
    elif op == "-":
        print(a-b)
    elif op == "/":
        print(a//b)
    elif op == "*":
        print(a*b)
    else:
        break

Measured memory_bytes: 7676
n = int(input())
array = [int(x) for x in input().split()]
flag = True
for i in range(n):
    if i == 0:
        continue
    else:
        if array[i] < array[i-1]:
            flag = False
        else:
            if array[i-1] != array[i]:
                array[i] -= 1
print("Yes" if flag else "No")


Measured memory_bytes: 14396
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <numeric>
#include <functional>
#include <set>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cctype>
#include <climits>
#include <fstream>
#include <bitset>
#include <time.h>
#include <assert.h>

#define LL long long
#define VI vector<int>
#define VL vector<long long>
#define FOR(i,a,b) for(int i= (a); i<((int)b); ++i)
#define RFOR(i,a) for(int i=(a); i >= 0; --i)
#define FOE(i,a) for(auto i : a)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v,x) (std::find(v.begin(), v.end(), x) != v.end())
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define EPS 1e-14
#define INF INT_MAX/2

using namespace std;


bool is_necessary(int idx, const vector<LL> &a_list, LL K) {
	vector<LL> dp(K + 1, 0);
	dp[0] = 1;
	FOR(i, 0, a_list.size()) {
		if (i == idx) { continue; }
		LL a = a_list[i];
		for (int j = dp.size() - 1; j >= 0; --j) {
			if (dp[j] == 1 && j + a < dp.size()) {
				dp[j + a] = 1;
			}
		}
	}
	
	FOR(i, 0, dp.size()) {
		if (i < K && dp[i] == 1) {
			if (a_list[idx] + i >= K) {
				return true;
			}
		}
	}

	return false;
}

int main(int argc, char *argv[]) {
	int N, K;
	cin >> N >> K;
	vector<LL> a_list(N);
	FOR(i, 0, N) {
		cin >> a_list[i];
	}
	sort(ALL(a_list));
	
	int low = -1, high = N, ans = 0;
	while (high - low > 1) {
		int middle = (low + high) / 2;
		if (is_necessary(middle, a_list, K)) {
			ans = N - middle;
			high = middle;
		}
		else {
			low = middle;
		}
	}
	cout << N - ans << endl;

	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <cstring>
#include <cstdio>
#include <string>
#include <map>
using namespace std;

struct page{
    int sum;
    int x1[110],y1[110],x2[110],y2[110];
    int num[110];
    string name[110];
    string my_name;
}a[110];

char s0[110];
string s;

map<string,int> g;

int n,m;
int x0,y0;
int c[1100000];
int top,now;




int main()
{
   // freopen("in.txt","r",stdin);
    while (cin>>n)
    {
        if (n==0) return 0;
        cin>>x0>>y0;
        g.clear();
        for (int k=1;k<=n;k++)
        {
            scanf("%s",s0);
            s=s0;
            g[s0]=k;
            a[k].my_name=s0;
            scanf("%d",&a[k].sum);
            for (int i=1;i<=a[k].sum;i++)
            {
                scanf("%d%d%d%d %s",
                      &a[k].x1[i],&a[k].y1[i],&a[k].x2[i],&a[k].y2[i],
                      s0);
                a[k].name[i]=s0;
            }
        }
        for (int k=1;k<=n;k++)
            for (int i=1;i<=a[k].sum;i++)
                a[k].num[i]=g[a[k].name[i]];
        top=1;
        now=1;
        c[1]=1;
        cin>>m;
        for (int tt=1;tt<=m;tt++)
        {
            scanf("%s",s0);
            if (strcmp(s0,"show")==0)
            {
                for (int i=0;i<a[c[now]].my_name.length();i++)
                    printf("%c",a[c[now]].my_name[i]);
                puts("");
            }
            if (strcmp(s0,"click")==0)
            {
                int xx,yy;
                scanf("%d%d",&xx,&yy);
                int id=c[now];
                int nx_num=0;
                for (int k=1;k<=a[id].sum;k++)
                {
                    if (xx>=a[id].x1[k]&&xx<=a[id].x2[k]
                      &&yy>=a[id].y1[k]&&yy<=a[id].y2[k])
                    nx_num=k;
                    if (nx_num) break;
                }
                if (nx_num!=0)
                {
                    c[++now]=a[id].num[nx_num];
                    top=now;
                }
            }
            if (strcmp(s0,"back")==0)
            {
                if (now>1)
                    now--;
            }
            if (strcmp(s0,"forward")==0)
            {
                if (now<top)
                    now++;
            }
        }

    }
    return 0;
}

Measured memory_bytes: 1612
# coding: utf-8
S = input()
ans = "Yes"
if ("N" in S) and ("S" not in S):
    ans = "No"
elif ("S" in S) and ("N" not in S):
    ans = "No"
elif ("E" in S) and ("W" not in S):
    ans = "No"
elif ("W" in S) and ("E" not in S):
    ans = "No"
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
#include<complex>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 4000001;
const long double eps = 1E-14;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

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

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};

class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% MOD + MOD) % MOD) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint& a) {
		if ((x += a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator-=(const mint& a) {
		if ((x += MOD - a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator*=(const  mint& a) {
		(x *= a.x) %= MOD;
		return *this;
	}
	mint operator+(const mint& a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint& a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint& a) const {
		mint res(*this);
		return res *= a;
	}

	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime MOD
	mint inv() const {
		return pow(MOD - 2);
	}
	mint& operator/=(const mint& a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint& a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream& os, const mint& m) {
		os << m.x;
		return os;
	}
};

mint pw(mint a, ll b) {
	if (b == 0) { return 1; }
	mint ret = pw(a, b >> 1);
	ret *= ret;
	if (b & 1) { ret *= a; }
	return ret;
}

typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;

typedef vector<mint> vmint;
typedef vector<vector<mint>> vvmint;
typedef vector<vector<vector<mint>>> vvvmint;

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

int main() {
	ll a, b, c;
	cin >> a >> b >> c;
	if (c - a - b > 0 && (c - a - b) * (c - a - b) > 4 * a * b) { cout << "Yes" << endl; }
	else { cout << "No" << endl; }

}


Measured memory_bytes: 3620
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

int H, N;
int A[101010];

int main()
{
    cin >> H >> N;
    ll sum = 0;
    rep(i, 0, N)
    {
        cin >> A[i];
        sum += A[i];
    }
    if (H <= sum)
    {
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
}


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

#define     F       first
#define     S       second
typedef pair<int, int>  pi;
typedef long long       ll;

map<int, bool> in;

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

    int n, x;
    cin >> x >> n;
    for (int i=1; i<=n; ++i) {
        int a;
        cin >> a;
        in[a]=1;
    }

    int ans=0;
    for (int i=x; i<=101+x; ++i) {
        if (!in[i]) {
            ans=i;
            break;
        }
    }

    for (int i=x-1; i>=x-101; --i) {
        if (!in[i]) {
            if (x-i<=ans-x) {
                ans=i;
                break;
            }
            else {
                break;
            }
        }
    }

    cout << ans;

    return 0;
}


Measured memory_bytes: 3668
#include <stdio.h>

int main()
{
  int a[4];
  int i = 0;
  while (i < 4)
  {
    scanf("%d\n",&a[i]);
    //if (i % 2 == 0 && i != 0)
    i++;
  }
  a[2] = a[0] % 500;
  if (a[2] > a[1] || (a[0] < 500) && (a[1] < 500))
    printf("No");
  else
    printf("Yes");
}

Measured memory_bytes: 384
import queue

N, M = map(int, input().split())

graph = [[] for i in range(N)]

for i in range(M):
    A, B = map(int, input().split())
    A -= 1
    B -= 1
    graph[A].append(B)
    graph[B].append(A)

dist = [-1 for i in range(N)]
que = queue.Queue()

dist[0] = 0
que.put(0)


while not que.empty():
    v = que.get()
    for nv in graph[v]:
        if dist[nv] != -1:
            continue

        dist[nv] = v
        que.put(nv)


print("Yes")
for i in range(1, N):
    print(dist[i] + 1)


Measured memory_bytes: 34656
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int Taro = 0;
      int Hanako = 0;
      for (int i =0; i<n; i++) {
        String a = sc.next();
        String b = sc.next();
        if (a.equals(b)) {
          Taro += 1;
          Hanako += 1;
        } else if (a.compareTo(b)>0) {
          Taro += 3;
        } else {
          Hanako += 3;
        }
      }
        System.out.println(Taro + " " + Hanako);
    }
}


Measured memory_bytes: 30048