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

int main(){
  int n;
  string s;
  int ans;
  cin >> n >>s;
  for(int i=0;i<=n-1;i++){
    if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C'){
      ans++;
    }
  }


cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


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

	long long a, b, c;
	cin >> a >> b >> c;
	if ((a == b) && (a != c)) cout << "Yes\n";
	else if ((a == c) && (a != b)) cout << "Yes\n";
	else if ((b == c) && (a != b)) cout << "Yes\n";
	else cout << "No\n";

	return 0;
}


Measured memory_bytes: 888
//💭💡🎈fold
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define frd(x) freopen("x","r",stdin)
#define fwt(x) freopen("x","w",stdout)
#define fo(i,a) for(int i=1;i<=(a.n);i++)
#define fup(i,x,y) for(int i=(x);i<=(y);i++)
#define fdn(i,x,y) for(int i=(x);i>=(y);i--)
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

int main()
{
    ll n,y;
    scanf("%lld%lld",&n,&y);
    for(int i=0;i<=y/1000;i++)
    {
        for(int j=0;j<=y/5000;j++)
        {
            if(i+j>n)break;
            int k=n-i-j;
            if(1000ll*i+5000ll*j+10000ll*k==y)
                return !printf("%d %d %d\n",k,j,i);
        }
    }
    printf("-1 -1 -1\n");
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb(x) push_back(x)
#define f(i,st,n) for(i=st;i<n;i++)
#define qu queue
#define ps(x) push(x)
#define vec vector
#define ft() front()
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define mst(a,b) memset(a,b,sizeof(a))
#define mod 1000000007
#define sfl(x) scanf("%lld",&x)
#define pfl(x) printf("%lld\n",x)
#define pf(x) printf("%lld",x)
#define mpr make_pair
#define fs first
#define se second
#define inf LLONG_MAX
#define nnf INT_MIN

 
 
 
ll gcd(ll a,ll b){
    if(a==0){
        return b;
    }                     
    return gcd(b%a,a);
}
ll power(ll x,ll y){            
    ll res=1;
    while(y>0){
        if(y%2==1){
            res=((res)*(x))%mod;
        }
        x=((x)*(x))%mod;
        y=y/2;
    }
    return res;
}
    

  
int main(){

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

   ll n;
   cin>>n;
   set<string>st;
   string s;

   while(n--){

      cin>>s;
      st.insert(s);
   }
    cout<<st.size();

   
    
  
    return 0;
   
 
  
 
    
 }

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

#define ll long long int

int main() {
    ll n, l = 0, r = 0, ret = 0;
    cin >> n;
    vector<ll> a(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    int sum = 0;
    for(l = 0; l < n; l++) {
        while(r < n && ((sum ^ a[r]) == (sum + a[r]))) {
            sum += a[r];
            r++;
        }
        ret += (r - l);
        if(l == r)
            r++;
        else
            sum -= a[l];
    }
    cout << ret << endl;
}

Measured memory_bytes: 1792
#include "bits/stdc++.h"
using namespace std;
#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define PI 3.1415926535
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<Pll> vPll;
typedef vector<vector<int>> vvi;
typedef vector<vector<bool>> vvb;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<double>> vvd;
typedef vector<vector<Pi>> vvPi;
typedef priority_queue<int, vector<int>, greater<int>> pqli;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi>> pqlP;
string YN(bool y) { return (y?"YES":"NO"); }
string yn(bool y) { return (y?"Yes":"No"); }
string ON(bool y) { return (y?"OK":"NG"); }
int main(void)
{
	int n, ans=1e9;

	cin>>n;

	repr(i, 1, n){
		int a=i, b=n-i, sum=0;
		//cout<<a<<" "<<b<<" ";
		while(a>0){
			sum+=a%10;
			a/=10;
		}
		//cout<<sum<<" ";
		while(b>0){
			sum+=b%10;
			b/=10;
		}
		//cout<<sum<<endl;
		if(ans>sum) ans=sum;
	}
	cout<<ans<<endl;
}


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

#define llong long long
#define inf 999999999
#define mp make_pair
#define pb push_back
typedef pair<int, int> P;
typedef pair<P, int> PP;
typedef pair<PP, int> PPP;
typedef struct data{
	int now;
	int cost;
}data;
int nh[4] = {1, 0, -1, 0};
int nw[4] = {0, 1, 0, -1};



int main(){
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	if(a + b == c + d)cout << "Balanced" << endl;
	else if(a + b > c + d) cout << "Left" << endl;
	else cout << "Right" << endl;
	return 0;
}

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

typedef long long ll;
typedef long double ld;

#define pb push_back
#define sort(s) sort(s.begin(),s.end())
#define reverse(s) reverse(s.begin(),s.end())
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)

const ll mod = 1e9+7;

//最大公約数
ll gcd(ll a, ll b) {
    return b ? gcd(b, a%b) : a;
}

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

//素数判定
bool isPrime(ll x){
    ll i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}

//桁和
int digsum(ll n) {
    int res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

//桁数
int dignum(ll n) {
    int res = 0;
    while(n > 0) {
        res++;
        n /= 10;
    }
    return res;
}

//文字列中の特定の文字カウント
ll stringcount(string s,char c){
    return count(s.cbegin(),s.cend(),c);
}

//階乗
ll ka(ll i){
    ll res=1;
    while(i>0){
        res=res*i;
        i--;
    }
    return res;
}
 
//ncr
ll ncr(ll x,ll y){
    ll a = x;
    ll b = 1;
    if(y>(x/2)){
        y=x-y;
    }
    for(ll i=1;i<y;i++){
        a*=x-i;
        b*=i+1;
    }
    return a/b;
}

//フィボナッチ数列
ll f(ll x){
    ll dp[x+1];
    dp[1]=1;
    dp[2]=1;
    for(ll i=3;i<=x;i++){
        dp[i]=dp[i-1]+dp[i-2];
    }
    return dp[x];
}

//char->int
int ctoi(char c){
    return c-'0';
}



int main(){
    int n,m;
    cin >> n >> m;
    int a[m],b[m];
    bool check = false;
    rep(i,m) cin >> a[i] >> b[i];

    map<int,int> mf,ms;

    for(int i=0;i<m;i++){
        if(a[i]==1){
            mf[b[i]]++;
        }

        if(b[i]==n){
            ms[a[i]]++;
        }
    }

    for(auto a:mf){
        if(ms.count(a.first)){
            check = true;
        }
    }

    

    if(check){
        cout << "POSSIBLE" << endl;
    }else{
        cout << "IMPOSSIBLE" << endl;
    }
}


Measured memory_bytes: 11136
#include<bits/stdc++.h>
#define FLASH ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long int
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
using namespace std;
int main()
{
    FLASH
    int n;
    cin >> n;
    set<string> s;
    string a;
    for(int i = 0;i < n;i++)
    {

        cin >> a;
        s.insert(a);
    }
    cout << s.size();
    return 0;
}



Measured memory_bytes: 19132
#include <bits/stdc++.h>
using namespace std;
/// Typedef
typedef long long           ll;
typedef vector<int>         vi;
typedef pair<int,int>       pii;

#define pb                  push_back
#define ppb                 pop_back
#define MP                  make_pair
#define ff                  first
#define ss                  second
#define sf                  scanf
#define pf                  printf
#define SQR(x)              ((x)*(x))
#define loop(i, y)          for(int i=0; i<int(y); i++)
#define FOR(i, x, y)        for(int i=int(x); i<int(y); i++)
#define ROF(i, x, y)        for(int i=int(x); i>=int(y); i--)
#define all(c)              c.begin(), c.end()
#define sz(c)               int(c.size())
#define clr(x, y)           memset(x, y, sizeof(x))
#define si(x)               scanf("%d", &x)
#define sii(x, y)           scanf("%d %d", &x, &y)
#define siii(x, y, z)       scanf("%d %d %d", &x, &y, &z)
#define sl(x)               scanf("%lld", &x)
#define sll(x, y)           scanf("%lld %lld", &x, &y)
#define slll(x, y, z)       scanf("%lld %lld %lld", &x, &y, &z)

#ifdef VAMP
     #define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template < typename Arg1 >
    void __f(const char* name, Arg1&& arg1){
        cout << name << " = " << arg1 << std::endl;
    }
    template < typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names+1, ',');
        cout.write(names, comma - names) << " = " << arg1 <<" | ";
        __f(comma+1, args...);
    }
#else
    #define debug(...)
#endif
///******************************************START******************************************

/// Constants
#define MAX                 200005
#define MOD                 1000000007
#define eps                 1e-9
#define INF                 0x3f3f3f3f3f3f3f3f // 4,557,430,888,798,830,399
#define inf                 0x3f3f3f3f // 1,061,109,567
#define PI                  acos(-1.0)  // 3.1415926535897932
#define VT                  int

// a = 1
// c = 2
// g = 3
// t = 4

int n;
int invalid[5][5][5][5];
int DP[5][5][5][102];

int solve(int tinGhor, int duiGhor, int ekGhor, int pos){
    if(pos == n) return 1;
    auto &ret = DP[tinGhor][duiGhor][ekGhor][pos];
    if(~ret) return ret;
    ret = 0;
    FOR(i, 1, 5){
        if(invalid[tinGhor][duiGhor][ekGhor][i]) continue;
        ret = (ret + solve(duiGhor, ekGhor, i, pos+1)) % MOD;
    }
    return ret;
}


void check1(int a, int b, int c, int d){
    invalid[a][b][c][d] = 1;
    invalid[a][b][d][c] = 1;
    invalid[a][c][b][d] = 1;
    invalid[b][a][c][d] = 1;
}

int main(){
    #ifdef VAMP
        clock_t tStart = clock();
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    FOR(i, 0, 5){
        check1(i, 1, 2, 3);
    }
    FOR(i, 0, 5){
        check1(1, 2, 3, i);
    }
    clr(DP, -1);
    si(n);
    printf("%d\n", solve(0, 0, 0, 0));

    #ifdef VAMP
        fprintf(stderr, "\n>> Runtime: %.10fs\n", (double) (clock() - tStart) / CLOCKS_PER_SEC);
    #endif
    return 0;
}

Measured memory_bytes: 256
def input_n
  gets.to_i               # 単一整数
end

def input_s
  gets.chomp              # 文字列。chompを付けないと改行文字がついてくる
end

def input_a
  gets.split.map(&:to_i)  # スペースで区切られた複数の整数
end

def input_o(num)
  num.times.map { gets.to_i }  # 縦に並んだ複数の整数。たまにある
end

def output_f(num)
  puts sprintf("%.12f", num)
end

x, n = input_a
p = input_a

min = 1000
index = 0

(-200..200).each do |num|
  next if p.include?(num)
  if (x - num).abs < min
    min = (x - num).abs
    index = num
  end
end
puts index


Measured memory_bytes: 14372
#include<cstdio>
#include<cstring>
const int N=5e5+5;
int n,i,a[N],l,r,m,f[N];
char s[N];
bool chk(int k){
	for (f[n+1]=0,i=1;i<=n;i++) f[i]=a[i]*9;
	int sum=0;
	for (f[1]+=9*k,i=1;i<=n;i++)
		f[i+1]+=f[i]/10,f[i]%=10,sum+=f[i];
	return sum+f[n+1]<=9*k;
}
int main(){
	scanf("%s",s);n=strlen(s);
	for (i=0;i<n;i++) a[n-i]=s[i]-48;
	for (l=1,r=n;l<r;){m=l+r>>1;
		if (chk(m)) r=m; else l=m+1;
	}
	printf("%d",l);
}

Measured memory_bytes: 4608
#include "bits/stdc++.h"
using namespace std;

struct Node{int key; Node *right,*left,*parent;};
Node *root,*NIL;

Node * treeMinimum(Node *x){
	while(x->left!=NIL)x=x->left;
	return x;
}

Node * find(Node *u,int k){
	while(u!=NIL&&k!=u->key){
		if(k<u->key)u=u->left;
		else u=u->right;
	}
	return u;
}
Node * treeSuccessor(Node *x){
	if(x->right!=NIL)return treeMinimum(x->right);
	Node *y=x->parent;
	while(y!=NIL&&x==y->right){
		x=y;
		y=y->parent;
	}
	return y;
}

void treeDelete(Node *z){
	Node *y;//????????????????±?
	Node *x;//?????????
	//??????????????????????±??????????
	if(z->left==NIL|| z->right==NIL)y=z;
	else y=treeSuccessor(z);
	//y?????????????±???????
	if(y->left!=NIL){
		x=y->left;
	}else{
		x=y->right;
	}
	if(x!=NIL){
		x->parent=y->parent;
	}
	if(y->parent ==NIL){
		root=x;
	}else{
		if(y==y->parent->left){
			y->parent->left=x;
		}else{
			y->parent->right=x;
		}
	}
	if(y!=z){
		z->key=y->key;
	}
	free(y);
}


void insert(int k){
	Node *y=NIL;//x??????
	Node *x=root;//T??????
	Node *z;
	z=(Node *)malloc(sizeof(Node));
	z->key=k;
	z->left=NIL;
	z->right=NIL;
	while(x!=NIL){
		y=x;//???????¨????
		if(z->key<x->key){
			x=x->left;
		}else{
			x=x->right;
		}
	}
	z->parent=y;
	if(y==NIL){//T???????????´???
		root=z;
	}else{
		if(z->key<y->key){
			y->left=z;//z???y?????????????????????
		}else{
			y->right=z;//z???y?????????????????????
		}
	}
}

void inorder(Node *u){
	if(u==NIL)return;
	inorder(u->left);
	printf(" %d",u->key);
	inorder(u->right);
}
void preorder(Node *u){
	if(u==NIL)return;
	printf(" %d",u->key);
	preorder(u->left);
	preorder(u->right);
}

int main(){
	int n,x;
	string com;
	scanf("%d",&n);
	for (int i = 0; i < n; ++i) {
		cin>>com;
		if(com=="insert"){
			scanf("%d",&x);
			insert(x);
		}else if(com=="print"){
			inorder(root);
			printf("\n");
			preorder(root);
			printf("\n");
		}else if(com=="find"){
			scanf("%d",&x);
			Node *t=find(root,x);
			if(t!=NIL)printf("yes\n");
			else printf("no\n");
		}else if(com=="delete"){
			scanf("%d",&x);
			treeDelete(find(root,x));
		}
	}
	return 0;
}

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

typedef long long ll;


int main() {
    string N;
    cin >> N;
    bool flag = false;
    for (int i=0;i<N.size();i++){
        if (N[i] == '7') flag =true;
    }
    if (flag) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 3624
#include<stdio.h>

int A[1000000], n;


int binarySearch(int key){
	int left = 0;
	int right = n;
	int mid;
	while(left < right){
		mid = (left + right) / 2;
		if(key == A[mid])return 1;
		if(key > A[mid])left = mid + 1;
		else if(key < A[mid])right = mid;
	}
return 0;
}

int main(){
	int i, q, k, sum = 0;
	
	scanf("%d",&n);
	for(i = 0; i < n; i++){
		scanf("%d", &A[i]);
	}
	
	scanf("%d",&q);
	for(i = 0; i < q; i++){
		scanf("%d", &k);
		if(binarySearch( k ))sum++;
	}
	printf("%d\n", sum);
	
	return 0;
}


Measured memory_bytes: 2252
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

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

typedef int long long ll;
using namespace std;
typedef pair<int, int> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;
static const int MAX = 100;
static const int INF = (1 << 23);

int main() {
    int k,t;
    cin>>k>>t;

    vector<int> q;
    rep(i,t){
        int a;
        cin>>a;
        q.push_back(a);
    }
    auto maxe = max_element(q.begin(),q.end());
    cout<<max(*maxe-1-(k-*maxe),0)<<endl;

    return 0;
}


Measured memory_bytes: 256
'''
問題：
    高橋くんは、自動販売機でジュースを買ったときの音が好きです。
    その音は 1回 A円で聞くことができます。

    高橋くんは B円持っていますが、
    お気に入りの音を C回聞くと満足するため、
    B円で最大 C回まで聞けるだけ聞きます。
    高橋くんはお気に入りの音を何回聞くことになるでしょうか。
'''

'''
制約：
    入力は全て整数である。
    1 ≤ A, B, C ≤ 100
'''

# 標準入力から A, B, C の値を取得する
a, b, c = map(int, input().split())

# お気に入りの音を聞ける回数を計算して出力する
result = 0
if a * c < b:
    result = c
else:
    result = int(b / a)

print(result)


Measured memory_bytes: 9176
#include<cstdio>
#include<cstring>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
using namespace std;

int n;
int numw, nume;
string str;

int main()
{
    cin >> n;
    cin >> str;
    for (int i = 0; i < n; ++i)
        if (str[i] == 'W')
            ++numw;

    int maxs, ans = 0;
    for (int i = 0; i < n; ++i)
    {
        if (str[i] == 'W')
            numw--;
        maxs = numw + nume;
        ans = max(ans, maxs);
        if (str[i] == 'E')
            nume++;
    }
    cout << n - ans - 1 << endl;

	return 0;
}


Measured memory_bytes: 900
/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2020-02-22 22:10:17
**/

#include <iostream>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
#include <bitset>
#include <cassert>
#include <cctype>
#include <iomanip>
#include <random>
#include <utility>
#include <chrono>

using namespace std;

using int64 = long long;

template<class T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) { os << '{'; size_t n = vec.size(); for (size_t i = 0; i < n; ++i) { os << vec[i]; if (i != n - 1) os << ','; } os << '}'; return os; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) { return os << '{' << p.first << " " << p.second << '}'; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) { os << '{'; for (auto it = mp.begin(); it != mp.end(); ++it) { os << '{' << it->first << ':' << it->second << '}'; if (it != --mp.end()) os << ','; } os << '}'; return os; }
template<class T> std::ostream& operator<<(std::ostream& os, const std::set<T>& st) { os << '{'; for (auto it = st.begin(); it != st.end(); ++it) { os << *it; if (it != --st.end()) os << ','; } os << '}'; return os; }
template<class T> std::istream& operator>>(std::istream& is, std::vector<T>& vec) { size_t n = vec.size(); for (size_t i = 0; i < n; ++i) is >> vec[i]; return is; }

#define all(_) begin(_), end(_)
#define rall(_) rbegin(_), rend(_)

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...) 1728
#endif

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}

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

  int n, r; cin >> n >> r;
  if (n >= 10) {
    cout << r << endl;
  } else {
    cout << r + 100 * (10 - n) << endl;
  }

  return 0;
}

Measured memory_bytes: 256
n,m=map(int,input().split())
nl=[list(map(int,input().split())) for _ in range(n)]
ml=[list(map(int,input().split())) for _ in range(m)]

for i in range(n):
    min_d = 10 ** 9
    near = -1
    for j in range (m):
        if abs(nl[i][0]-ml[j][0])+abs(nl[i][1]-ml[j][1])<min_d:
            near=j+1
            min_d=abs(nl[i][0]-ml[j][0])+abs(nl[i][1]-ml[j][1])
    print(near)

Measured memory_bytes: 3064
import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args){
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String str = "";
        try {
            str = reader.readLine();
            //System.out.println(str);
            reader.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
      
      String[] inputStrArray = str.split(" ");
      int[] inputIntArray = new int[3];
      int amount = 0;
      for(int i=0; i<3; i++){
        inputIntArray[i] = Integer.parseInt(inputStrArray[i]);
        amount += inputIntArray[i];
      }
      
      if(amount <= 21){
        System.out.println("win");
      }
      else{
        System.out.println("bust"); 
      }
      
      
	}
}

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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debug3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define debugB(x, y) cerr<<#x<<": "<<bitset<y>(x) << endl;
#define line() cerr << "---------------" << endl;

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

template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

// ------------------------------------------------------------------------------------------

int main() {
   int a, b;
   int c, d;
   cin >> a >> b >> c >> d;
   cout << min(a, b) + min(c, d) << endl;

   return 0;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
const double PI = 3.14159265358979323846;

int main() {
  int r, g, b;
  cin >> r >> g >> b;
  int ans = r * 100 + g*10 + b;
  if(ans % 4 == 0) cout << "YES" << endl;
  else cout << "NO" << endl;
}

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

int main(){
    int N;
    cin>>N;
    vector<int> odd(100002,0),eve(100002,0);
    rep(i,N){
        int tmp;
        cin>>tmp;
        if(i%2==0){
            odd[tmp]++;
        }else{
            eve[tmp]++;
        }
    }
    int odd1=0,odd2,oddnum,eve1=0,eve2,evenum;
    for(int i=0;i<100002;i++){
        if(odd1<odd[i]){
            odd2 = odd1;
            odd1 = odd[i];
            oddnum = i;
        }else if(odd2 < odd[i]){
            odd2 = odd[i];
        }
    }

    for(int i=0;i<100002;i++){
        if(eve1<eve[i]){
            eve2 = eve1;
            eve1 = eve[i];
            evenum = i;
        }else if(eve2 < eve[i]){
            eve2 = eve[i];
        }
    }

    int res;
    if(oddnum==evenum){
        res = min(N-odd1-eve2,N-eve1-odd2);
    }else{
        res = N-odd1-eve1;    
    }
    cout<<res;
}

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

int main(){
    int a[3][3];
    for(int i=0; i<3; i++){
        for(int j=0; j<3; j++){
            cin >> a[i][j];
        }
    }

    int n;
    cin >> n;
    int b[n];
    for(int i=0; i<n; i++){
        cin >> b[i];
    }

    int c[3][3];
    for(int i=0; i<3; i++){
        for(int j=0; j<3; j++){
            c[i][j] = 0;
        }
    }

    for(int k=0; k<n; k++){
        for(int i=0; i<3; i++){
            for(int j=0; j<3; j++){
                if(a[i][j] == b[k]){
                    c[i][j] = 1;
                }
            }
        }
    }

    for(int i=0; i<3; i++){
        if(c[i][0]&&c[i][1]&&c[i][2]){
            cout << "Yes" << flush;
            return 0;
        }
        if(c[0][i]&&c[1][i]&&c[2][i]){
            cout << "Yes" << flush;
            return 0;
        }
    }
    if(c[0][0]&&c[1][1]&&c[2][2]){
        cout << "Yes" << flush;
        return 0;
    }
    if(c[0][2]&&c[1][1]&&c[2][0]){
        cout << "Yes" << flush;
        return 0;
    }

    cout << "No" << flush;
}

Measured memory_bytes: 256
#include <stdio.h>
//Input
 int main(void){
 int a, b, c;

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

 int ispoor = 0;
 if (a == b && b != c) ispoor = 1;
 if (b == c && c != a) ispoor = 1;
 if (c == a && a != b) ispoor = 1;

 if (ispoor) {
 puts("Yes");
 } else {
 puts("No");
 }

 return 0;
}

Measured memory_bytes: 128
n = int(input())
s_li = [input() for i in range(n)]
m = int(input())
t_li = [input() for i in range(m)]
tmp_map = {}
for s in s_li:
    if s not in tmp_map:
        tmp_map[s] = 1
    else:
        tmp_map[s] +=1
for m in t_li:
    if m not in tmp_map:
        tmp_map[m] = -1
    else:
        tmp_map[m] -=1
print(max(tmp_map.values()) if max(tmp_map.values())>0 else 0)

Measured memory_bytes: 3064
let f i k = 
  let res = ref 0 in
  while i * (1 lsl !res) < k do
    res := !res + 1
  done;
  !res
;;

let g n = 0.5 ** n;;

let () = Scanf.scanf "%d %d" (fun n k -> (
  let p = ref 0. in (
    for i = 1 to n do
      p := !p +. ((f i k) |> float_of_int |> g)
    done;
    p := !p /. (float_of_int n);
    print_float !p
  )
))

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
    /*#ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif*/
        /* 
        Ofcourse it's Hard.
        It's supposed to be Hard.
        If it's easy everyone would do it.
        HARD IS WHAT MAKES IT GREAT

        YESTERDAY U SAID TOMORROW

        SLOWLY BECOMING THE PERSON I 
        SHOULD HAVE BEEN A LONG TIME AGO

        SAME TASK CAN'T BE FOUND DIFFICULT TWICE

        BTBHWSITW

        SPRH TU KAB P

        CP IS ALL ABOUT THINKING 
        YOU HAVE MUCH MORE POTENTIAL THAN U THINK

        AJIT SHIDDAT 10

        UR DAILY ROUTINE 


        */

fast();
//ll t;cin>>t;while(t--)
{
  ll a,b,c,d,i=1;
  cin>>a>>b>>c>>d;
  while(a>0&&c>0)
  {
      if(i&1)
      {
        c-=b;
        //cout<<"c = "<<c<<endl;
        i++;
      }
      else
      {
        a-=d;
       // cout<<"a = "<<a<<endl;
        i++;
      }
  }
  if(a>0)
    Yes
  else
    No
    
}
return 0;
}

Measured memory_bytes: 3688
#include <iostream>
#include <cstdio>
#include <math.h>

using namespace std;

typedef long long int ll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
const int MOD = 1000000007;
const int INF = INT_MAX;



int main(int argc, char const *argv[])
{
    int a, b;
    cin >> a >> b;

    if(a*b %2 == 0){
        cout << "Even" << endl;
    }
    else {
        cout << "Odd" << endl;
    }



    return 0;
}




//              g++ -std=c++1z  

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define dbg(x) cout<<"( "<<#x<<" -> "<<x<<" )"<<endl;
using namespace std;
ll Power(ll a,int b)
{
    ll res=1LL;
    while (b>0LL)
    {
        if (b%2LL==1LL)
        res=res*a;
        a=a*a;
        b=b/2LL;
    }
    return res;
}
int main()
{
    ll n;
    scanf("%lld",&n);
    if (n<=0LL || n%2LL==1LL)
    {
        printf("0\n");
        return 0;
    }
    ll sum1=0;
    for (ll i=25;i>0;i--)
    {
        ll p=2LL*Power(5,i);
        sum1=sum1+(n/p);
    }
    printf("%lld\n",sum1);
    return 0;
}


Measured memory_bytes: 3668
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <queue>
#include <tuple>
#include <cstring>
#include <cctype>
#include <ctype.h>

#define INF 200000000
#define MOD 1000000007

using namespace std;

int main()
{
    long long int n, a[5];
    cin >> n;
    long long int tmp_min = 1000000000000001;
    for (long long int i = 0; i < 5; i++)
    {
        cin >> a[i];
        tmp_min = min(tmp_min, a[i]);
    }
    if (n % tmp_min == 0)
    {
        cout << n / tmp_min + 4 << endl;
        return 0;
    }
    else
    {
        cout << n / tmp_min + 5 << endl;
        return 0;
    }
    return 0;
}


Measured memory_bytes: 256
import math
def kosu(n):
    l =[]
    sosu = [True] * (n+1)
    sosu[0] = False
    sosu[1] = False
    for i in range(2, math.floor(math.sqrt(n)) + 1):
        if not sosu[i]:
            continue
        for j in range(i*2,n+1,i):
            sosu[j] = False
    for i in range(len(sosu)):
        if sosu[i]:
            l.append(i)
    return(l)
        
while True:
    n = int(input())
    if n == 0:
        break
    ans = len(kosu(2*n)) - len(kosu(n))
    print(ans)
    


Measured memory_bytes: 9616
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<int, int>;
#define INF 1001001001
#define PI 3.14159265359
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define repX(i, n , x) for (int i = (int)(x); i < (int)(n); ++i)
#define repB(i, n) for (int i = n; i >= 1; --i)
#define repBX(i, n , x) for (int i = (int)(n); i >= int(X); --i)
#define dup(x,y) (((x)+(y)-1)/(y))

int main() {
    int X;
    cin >> X;
    int gohyaku = X/500;
    X %= 500;
    int ans = gohyaku*1000 + X - X%5;
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 3600
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<time.h>
#include<math.h>
int A[30],n;
int solve(int M,int sum,int degree)
{
	if(M==sum)
		return 1;
	if(degree>n)
		return 0;
	if(solve(M,sum,degree+1))
		return 1;
	return solve(M,sum+A[degree],degree+1);
}
int main()
{
	int q,m[210],i;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
		scanf("%d",&A[i]);
	scanf("%d",&q);
	for(i=1;i<=q;i++)
		scanf("%d",&m[i]);
	for(i=1;i<=q;i++)
	{
		if(solve(m[i],0,1))
			printf("yes\n");
		else
			printf("no\n");
	}
	return 0;
}


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

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int N, mark;
	vector<int> stages[105], order;
	cin >> N;
	stages[0].resize(N,0);
	for (int i = 0; i < N; ++i){
		cin >> stages[0][i];
	}
	for (int i = 1; i <= N; ++i){
		mark = -1;
		for (int j = stages[i-1].size(); j > 0; --j){
			if (stages[i-1][j-1] == j){
				mark = j;
				break;
			}
		}
		if (mark == -1){
			cout << -1 << '\n';
			return 0;
		}
		order.push_back(mark);
		for (int j = 0; j < stages[i-1].size(); ++j){
			if (j == mark-1) continue;
			stages[i].push_back(stages[i-1][j]);
		}
	}
	reverse(order.begin(),order.end());
	for (int i = 0; i < order.size(); ++i){
		cout << order[i] << '\n';
	}
	cout << flush;
	//for (int i = 0; i < 1e9; ++i){for (int j = 0; j < 1e9; ++j){}}
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <numeric>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
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; }
inline bool Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+" ";
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e17;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
const ll MAX = 200005;
void dp(vector<ll> &a, vector<bool> &b){
    if (a.size() == 0) return;
    rep(i,(int)a.size()){
        vector<bool> copy(16001,0);
        rep(j,(int)b.size()){
            if (b[j]){
                if (j-a[i] >= 0) copy[j-a[i]] = 1;
                if (j+a[i] <= 16000) copy[j+a[i]] = 1;
            }
        }
        rep(j,16001) b[j] = copy[j];
    }
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    s += 'T';
    ll x,y,stock = 0;
    cin >> x >> y;
    ll flag = 1;
    bool f = 1;
    vector<ll> u,l;
    rep(i,(int)s.length()){
        if (s[i] == 'F') {
            if (f) x -= 1;
            else stock++;
        }
        else{
            if (f){
                f = 0;
                continue;
            }
            if (flag) u.push_back(stock);
            else l.push_back(stock);
            flag = 1-flag;
            stock = 0;
        }
    }
    //array_output(all(u));
    //array_output(all(l));
    vector<bool> canl(16001,0),canu(16001,0);
    canl[8000] = 1;
    canu[8000] = 1;
    dp(l,canl);
    dp(u,canu);
    if (x < -8000) PRINT("No");
    else if ((canl[8000+x] && canu[8000+y])) PRINT("Yes");
    else PRINT("No");
}


Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rRep(i,a,b) for(int i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ll INF=1000000011;
constexpr ll MOD2=998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS=10e-8;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
    for(auto i=begin(v); i != end(v); ++i){
        if(i !=begin(v)) os << ' ';
        os << *i;
    }
    return os;
}

ll N,D[50];
ll chek[50];

int main(){
    cin >> N;
    rep(i,N){
        cin >> D[i];
    }
    sort(D,D+N);
    chek[0]=1;chek[24]=1;
    rep(i,N){
        if(i%2==0){
            if(chek[D[i]]==0){
                chek[D[i]]=1;
            }
            else if(chek[24-D[i]]==0){
                chek[24-D[i]]=1;
            }
            else{
                cout << 0 << endl;
                return 0;
            }
        }
        else{
            if(chek[24-D[i]]==0){
                chek[24-D[i]]=1;
            }
            else if(chek[D[i]]==0){
                chek[D[i]]=1;
            }
            else{
                cout << 0 << endl;
                return 0;
            }
        }
    }
    ll T=0,mi=INF;
    Rep(i,1,25){
        if(chek[i]==1){
            mi=min(mi,T+1);
            T=0;
        }
        else{
            T++;
        }
    }
    cout << mi << endl;
}

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

if A+B < 2*C:
    print(A*X + B*Y)
else:
    if X > Y:
        if A > 2*C:
            print(2*C*X)
        else:
            print(2*C*Y + A*(X-Y))
    elif X < Y:
        if B > 2*C:
            print(2*C*Y)
        else:
            print(2*C*X + B*(Y-X))
    else:
        print(2*C*X)

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

using namespace std;

#define int long long

#define PB	push_back
#define ALL(x)	(x).begin(), (x).end()
#define ALLR(x)	(x).rbegin(), (x).rend()
#define MP	make_pair

#define debug(args...) { string _s = #args; replace(ALL(_s), ',', ' '); stringstream ss(_s); cerr << endl;_debug(ss, args); }
#define _rg auto it = next(v.begin()); it != v.end(); it++
#define _input ostream& operator <<(ostream& out

template<typename T, typename U>
_input, const pair<T, U>& p) {
	out << "(" << p.first << ", " << p.second << ")";
	return out;
}

#define cont(c) template<typename T> _input, const c<T>& v) { \
					if (v.empty()) return out; \
					out << "[" << *v.begin(); \
					for (_rg) out << ", " << *it; \
					out << "]"; return out; \
				}
				
#define cont2(c) template<typename T, typename U> _input, const c<T, U>& v) { \
					if (v.empty()) return out; \
					out << "[" << *v.begin(); \
					for (_rg) out << ", " << *it; \
					out << "]"; return out; \
				}

cont(vector) cont(set) cont(multiset) cont(queue) cont2(map)

template<typename T, size_t n, typename= enable_if_t<!is_same<T, char>::value>>
_input, const T(&v)[n]) {
	if (n == 0) return out;
	out << "[" << v[0];
	for (int i = 1; i < (int)n; i++) out << ", " << v[i];
	out  << "]"; return out;
}

template<typename T, typename... Ts>
void _debug(stringstream& ss, const T &arg) {
	string name; ss >> name;
	cerr << name << " = " << arg << endl;
}

template<typename T, typename... Ts>
void _debug(stringstream& ss, const T& arg, const Ts&... args) {
	string name; ss >> name; 
	cerr << name << " = " << arg << ", ";
	if (is_class<T>::value || is_array<T>::value) cerr << endl;
	_debug(ss, args...);
}

#define FAST_IO ios::sync_with_stdio(false); cin.tie(0)

typedef pair<int, int> ii;
typedef pair<pair<int, int>, int> iii;
typedef vector<int> vi;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef unsigned long long ull;

const int INF = LONG_LONG_MAX/2;
const int NINF = LONG_LONG_MIN/2;
const double PI = 3.141592653589793238;

int32_t main() {
	FAST_IO;

	int a, v, b, w, t;
	cin >> a >> v >> b >> w >> t;
	
	int d1 = v*t;
	int d2 = w*t;
	
	if (abs(a-b)+d2 > d1) {
		cout << "NO" << endl;
	} else {
		cout << "YES" << endl;
	}
}
// g++ -Wall -Wextra -Wshadow -fsanitize=undefined -std=c++17


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

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

const int INF = 1e9;

inline void chmin(int &x, int y)
{
	if (x > y) x = y;
}

int N;
int dp[1010];
int p[1010];
vi g[1010];
int x[1010];
int dp2[2][5010];

int main() {
	cin >> N;
	rep(i, N) dp[i] = INF;

	rep(i, N-1) {
		cin >> p[i+1];
		--p[i+1];
		g[p[i+1]].pb(i + 1);
	}

	rep(i, N) cin >> x[i];

	for (int i = N-1; i >= 0; --i) {
		if (g[i].size() == 0) {
			dp[i] = 0;
		} else {
			rep(j, 5010) dp2[0][j] = dp2[1][j] = INF;

			int c = 0, f = 1;

			int to0 = g[i][0];
			dp2[c][x[to0]] = dp[to0];

			if (dp[to0] < 5010) {
				chmin(dp2[c][dp[to0]], x[to0]);
			}

			for (int j = 1; j < g[i].size(); ++j) {
				int to = g[i][j];
				rep(k, 5010) dp2[f][k] = INF;

				//use
				rep(k, 5010) if (dp2[c][k] != INF) {
						//same
					int u = k + x[to], v = dp2[c][k] + dp[to];
					if (u > v) swap(u, v);
					if (u < 5010) {
						chmin(dp2[f][u], v);
					}

					u = k + dp[to], v = dp2[c][k] + x[to];

					if (u > v) swap(u, v);
						//reverse
					if (u < 5010) {
						chmin(dp2[f][u], v);
					}
				}
				
				swap(c, f);
			}

			rep(k, 5010) {
				if (k <= x[i]) {
					chmin(dp[i], dp2[c][k]);
				}

				if (dp2[c][k] <= x[i]) {
					chmin(dp[i], k);
				}
			}
		}
		//cout << i << "= " << dp[i] << endl;
	}

	puts(dp[0] != INF ? "POSSIBLE" : "IMPOSSIBLE");
	
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <string.h>
#include <vector>
//s#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX 10000

using namespace std;

#define ll long long
#define pb push_back
//#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a; i<n; i++)
#define r0 return 0
#define INF (int)1e15
#define MOD 1000000007
//#define N 12
#define sz 1000*1000

 int main(){

  ll x;
  cin>>x;
  ll ans=1;

  while(true){

   ll num = ans*(ans+1)/2;
   if(num >= x) break;
      ans++;
  }

  cout<<ans<<endl;

 return 0;
 }


Measured memory_bytes: 3604
/*
  Vivek Rathi
  CSE 2nd Year
  MNNIT
*/
#include<bits/stdc++.h>
using namespace std;
#define M 1000000007
#define ll long long int
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define debug1(x) cout<<#x<<" "<<x<<endl;
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;
#define present(c,x) ((c).find(x) != (c).end())
#define null NULL
#define mp make_pair
#define fi first
#define se second
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);
#define inf 1e18
#define flush fflush(stdout);
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<ll, null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
ll modpower(ll a,ll b,ll c)
{
	ll res=1;
	while(b)
	{
		if(b&1LL)
			res=(res*a)%c;
		a=(a*a)%c;
		b>>=1;
	}
	return res;
}
//-------------------------------Template--Above------------------------------------------------
ll n,m;
ll dp[2001][2001];
ll a[2001],b[2001];
ll solve(ll i,ll j)
{
	if(i==n||j==m)
		return 0;
	if(dp[i][j]!=-1)
		return dp[i][j];
	ll ans=0;
	if(a[i]==b[j])
	{
		ans=1;
	}
	ans=(ans+(solve(i,j+1)+solve(i+1,j)-(a[i]==b[j]?0:solve(i+1,j+1))+M)%M)%M;
	//debug3(ans,solve(i,j+1),solve(i+1,j));
	
	return dp[i][j]=ans;
}
int main()
{
	boost
	memset(dp,-1,sizeof(dp));
	cin>>n>>m;
	for(ll i=0;i<n;i++)
	{ 
		cin>>a[i];
	}
	for(ll i=0;i<m;i++)
	{
		cin>>b[i];
	}
	cout<<(solve(0,0)+1)%M<<endl;
	return 0;
}


Measured memory_bytes: 31872
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll MOD = 1e9+7;

#define vec vector<int>
#define vecll vector<ll>
#define vpair vector<pair<int, int>>
#define vpairll vector<pair<ll, ll>>

#define rep(i,n)         for(int i=(int)0; i<(int)n; i++)
#define REP(i,m,n)       for(int i=(int)m; i<(int)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define prt(var)         cout << var << "\n"
#define prtd(n, var)     cout << fixed << setprecision(n) << var << "\n"
#define prt2(v1, v2)     cout << v1 << " " << v2 << "\n"
#define prt3(v1, v2, v3) cout << v1 << " " << v2 << " " << v3 << "\n"
#define prtall(var)      rep(i,var.size()){cout << var[i] << " ";} cout << "\n"

//----------------------------------------------------------------

int main(void) {
  ll h, n;
  cin >> h >> n;

  vecll a(n), b(n);
  rep(i,n){
    cin >> a[i] >> b[i];
  }
  vecll dp(30000, 1e18);
  dp[0]=0;
  ll ans=1e18;
  rep(i,30000){
    rep(j,n){
      if(i-a[j]>=0){
        dp[i]=min(dp[i], dp[i-a[j]]+b[j]);
        if(i>=h){
          ans = min(ans,dp[i]);
        }
      }
    }
  }
/*
  prt("-----DP-----");
  rep(i,30000){
    prt2(i, dp[i]);
  }
  prt("===ANS===");
*/
  prt(ans);

}


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

int main(){
  int N;
  cin >> N;
  vector<string> S(N);
  for (int i=0; i<N; i++) cin >> S[i];
  long long ans=0;
  for (int i=0; i<N; i++){
    bool flag = true;
    for (int j=0; j<N; j++){
      for (int k=0; k<N; k++){
        if (S[(j+i)%N][k] != S [(k+i)%N][j]){
          flag = false;
          break;
        }
      }
    if (!flag) break;
    if (j==N-1) ans += N;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 384
# input
N, K = map(int, input().split())

# initialization
p_list = [0]*N

# count
for i in range(K):
    d = int(input())
    a_nums = list(map(int, input().split()))
    for j in range(d):
        p_list[a_nums[j]-1] += 1

# check
ans = 0
for i in range(N):
    if p_list[i]==0:
        ans += 1

# output
print(ans)


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

using namespace std;

int main () {
  
  int a, b;
  cin >> a >> b;
  
  if ( a > b) {
	  cout << max(a,b) + max(a-1,b);
  } else {
      cout << max(a,b) + max(a, b-1);
  }
   
  return 0;
  
}

Measured memory_bytes: 256
from collections import Counter
N = int(input())
D=list(map(int,input().split()))
M = int(input())
T=list(map(int,input().split()))

C=Counter(D)

for t in T:
    if C[t]<=0:
        print("NO")
        exit()
    else:
        C[t]-=1
print("YES")


Measured memory_bytes: 139704
#! /usr/bin/env perl
use Data::Dumper;


sub min{
    my @data = @_;
    my $tmp = abs($data[0]);
    for my $i(1 .. $#data){
        if($tmp > abs($data[$i])){
            $tmp = abs($data[$i]); 
        }
    }
    return $tmp;
}


sub sum{
    my @data = @_;
    my $sum =0;
    for my $j(0 .. $#data){
        $sum += $data[$j];
    }
    return $sum;
}


sub check{
    my @aji_data = @_;
    $sum = sum(@aji_data);
    $min = min(@aji_data);

    if($sum < 0){
        return $sum + $min;
    }else{
        return $sum - $min;
    }

}


my $in = <STDIN>;
chomp $in;
my ($n,$l) = split / /,$in;

my $aji = [];

for my $i(0 .. $n -1){
    $aji->[$i] = $l+$i
}

print check(@$aji);


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

int main() {

	int n;

	int i = 1;
	int x;

	cin >> n;

	while (i <= n) {
		x = i;
		if (x % 3 == 0)
			cout << " " << i;
		else
			while (x > 0) {
				if (x % 10 == 3) {
					cout << " " << i;
					break;
				}
				x /= 10;
			}

		i++;
	}

	cout << endl;

	return 0;
}


Measured memory_bytes: 3104
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

import static java.lang.Integer.parseInt;

/**
 * Decimal Sequences - Time Limit Exceeded
 */
public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		String[] words;

		int n = parseInt(br.readLine());
		char[] seq = new char[n];

		int _i = 0;
		while ((line = br.readLine()) != null && !line.isEmpty()) {
			for (int i = 0; i < line.length(); i += 2, _i++) {
				seq[_i] = line.charAt(i);
			}
		}

		//solve
		boolean[] nums = new boolean[1_000_000];
		outer:
		for (int i = 0; i < n; i++) {
			for (int j = i; j < n; j++) {
				int len = j - i + 1;
				if ((seq[i] == '0' && len > 1) || len > 6) continue outer;
				nums[parseInt(String.valueOf(seq, i, len))] = true;
			}
		}

		for (int i = 0; i < nums.length; i++) {
			if (!nums[i]) {
				System.out.println(i);
				break;
			}
		}

	} //end main
}

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

int main(void){
    ll a;
    cin >> a;
    double b;
    cin >> b;
    int B = b * 100 + ESP;
    ll ans = a * B / 100;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3664