akhauriyash/Code-Regression huggingface dataset:
from collections import deque

k = int(input())

cnt = 9
lnln = deque(range(1, 10))
lnln = list(map(str, lnln))


def f(n, dq):
    x = int(n[-1])
    if x == 0:
        dq.append(n + str(x))
        dq.append(n + str(x + 1))
        return 2
    elif x == 9:
        dq.append(n + str(x - 1))
        dq.append(n + str(x))
        return 2
    else:
        dq.append(n + str(x - 1))
        dq.append(n + str(x))
        dq.append(n + str(x + 1))
        return 3


for i in lnln:
    if cnt > k:
        break
    cnt += f(i, lnln)


print(lnln[k - 1])
# print(type(lnln[1]))

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

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

int main () {
    int n, k;
    cin >> n >> k;
    int ans = 0;
    rep(i, n){
        int h;
        cin >> h;
        if (h >= k) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define maxn 100005
#define pb push_back
int mod;
vector<int> e[maxn];
vector<ll> pre[maxn], suf[maxn];
ll up[maxn], down[maxn];
void dfs1(int u, int p) {
	for (int uu : e[u])
		if (uu != p) dfs1(uu, u);
	for (int i = 0; i < e[u].size(); i++) {
		int uu = e[u][i];
		pre[u][i] = i ? pre[u][i-1] : 1;
		if(uu != p)
			pre[u][i] = pre[u][i] * (1 + down[uu]) % mod;
	}
	for (int i = e[u].size() - 1; i >= 0; i--) {
		int uu = e[u][i];
		suf[u][i] = (i < e[u].size() - 1) ? suf[u][i+1] : 1;
		if(uu != p)
			suf[u][i] = suf[u][i] * (1 + down[uu]) % mod;
	}
	down[u] = suf[u][0];
}
void dfs2(int u, int p) {
	for (int i = 0; i < e[u].size(); i++) {
		int uu = e[u][i];
		if (uu == p) continue;
		ll cnt = up[u];
		if(i) cnt = cnt * pre[u][i-1] % mod;
		if(i+1 < e[u].size()) cnt = cnt * suf[u][i+1] % mod;
		up[uu] = cnt + 1; // 1是不取par
		dfs2(uu, u);
	}
}
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n; cin >> n >> mod;
    for (int i = 1; i < n; i++) {
    	int a, b; cin >> a >> b;
    	e[a].pb(b), e[b].pb(a);
    }
    e[1].pb(0), up[1] = 1;
    for (int i = 1; i <= n; i++) {
    	pre[i].resize(e[i].size());
    	suf[i].resize(e[i].size());
    }
    dfs1(1, 0), dfs2(1, 0);
    for (int i = 1; i <= n; i++)
    	cout << down[i] * up[i] % mod << "\n";
    return 0;
}

Measured memory_bytes: 24704
/****************************************************
*   Template for coding contests                    *
*   Author    :    Sanjeev Sharma                   *
*   Email     :    thedevelopersanjeev@gmail.com    *
*****************************************************/
 
#include <bits/stdc++.h>
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin >>n;
    bool flag = false;
    for(int i = 1; i < 10; i++){
        for(int j = i; j < 10; j++){
            if((i * j) == n){
                flag = true;
                break;
            }
        }
    }
    if(flag)
        cout <<"Yes";
    else 
        cout <<"No";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include <numeric>
using namespace std;
//void inputer();
char S[5];

int main() {
	for (int i = 1;i < 5;i++) {
		cin >> S[i];
	}
	if (S[1] == S[2] && S[3] == S[4] && S[1] != S[4]) {
		cout << "Yes" << endl;
	} else if (S[1] == S[3] && S[2] == S[4] && S[1] != S[4]) {
		cout << "Yes" << endl;
	} else if (S[1] == S[4] && S[3] == S[2] && S[1] != S[2]) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}



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

int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    ll sum = 0;
    rep(i,n){
        cin>>a[i];
        sum += a[i];
    }
    sort(a.begin(),a.end());
    printf("%d %d %lld\n",a[0],a[n-1],sum);
    
    return 0;
}



Measured memory_bytes: 3276
#include <iostream>
using namespace std;
typedef long long ll;
const ll N = 4010, mod = 1000000007, inv2 = mod + 1 >> 1, M = N * 50;
ll a[M], b[M], fac[N * 2], n, x, inv[N * 2], ans, num[N][N];
ll qow(ll a, ll b)
{
	ll ans = 1;
	for (; b; b >>= 1)
	{
		if (b & 1)
			ans = ans * a % mod;
		a = a * a % mod;
	}
	return ans;
}
ll f(ll i, ll j)
{
	return fac[i + j] * inv[i] % mod * inv[j] % mod;
}
ll& upd(ll &a, ll b)
{
	a = a + b < mod ? a + b : a + b - mod;
	return a;
}
int main()
{
	fac[0] = 1;
	for (ll i = 1; i < 8001; i++)
		fac[i] = fac[i - 1] * i % mod;
	inv[8000] = qow(fac[8000], mod - 2);
	for (ll i = 7999; i >= 0; i--)
		inv[i] = inv[i + 1] * (i + 1) % mod;
	scanf("%lld", &n);
	for (ll i = 1; i <= n; i++)
	{
		scanf("%lld%lld", a + i, b + i);
		num[2000 - a[i]][2000 - b[i]]++;
	}
	for (ll i = 0; i < 4001; i++)
		for (ll j = 0; j < 4001; j++)
		{
			if (i > 0)
				upd(num[i][j], num[i - 1][j]);
			if (j > 0)
				upd(num[i][j], num[i][j - 1]);
		}
	for (ll i = 1; i <= n; i++)
	{
		upd(ans, num[a[i] + 2000][b[i] + 2000]);
		upd(ans, mod - f(a[i] * 2, b[i] * 2));
	}
	cout << ans * inv2 % mod;
}

Measured memory_bytes: 128896
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define fi first
#define se second
#define mp make_pair
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
#define dame { printf("No\n"); return 0;}
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl;
#define MOD llong(1e9+7)
#define MAX int(2 * 1e5 +5)
#define debug(x)  cout << #x << " = " << (x) << endl;
#define pi acos(-1.0)
#define int llong
#define INF llong(1e17)


signed main(){
    int n;
    cin >> n;
    int A[n+1];
    A[0]= -1;
    REP(i,n) scanf("%lld",&A[i+1]);
    int B[n+1];
    REP(i,n) scanf("%lld",&B[i]);
    B[n] = -1;

    int ika[n];
    int h[n] = {};
    FOR(i,1,n+1){
        if(A[i] != A[i-1]){
            h[i-1] = A[i];
        }
        ika[i-1] = A[i];
    }




    REPR(i,n-1){
        if(B[i] != B[i+1]){
            if(h[i] != 0 and h[i]!=B[i]){
                cout << 0 << endl;
                return 0;
            }
            h[i] = B[i];
        }
        ika[i]  = min(ika[i] , B[i]);
    }




    int res = 1;

    REP(i,n){
        if(h[i] != 0){
            if(ika[i] < h[i]){
                cout << 0 << endl;
                return 0;
            }
        }
        else{
            res *= ika[i];
            res %= MOD;

        }
    }


    cout << res << endl;

}


Measured memory_bytes: 3328
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();
		int[] p = new int[N];
		for(int i=0; i<N; i++)
			p[i] = sc.nextInt();
		Arrays.sort(p);
		int ans = 0;
		for(int i=0; i<K; i++)
			ans += p[i];
		System.out.println(ans);

		sc.close();
	}
}


Measured memory_bytes: 30168
def f():
    ax,ay,ar,bx,by,br=map(float,input().split())
    d=(ax-bx)**2+(ay-by)**2
    r1=(ar+br)*(ar+br)
    r2=(ar-br)*(ar-br)
    if d<=r1 and d>=r2:return 1;
    elif d<r2 and ar>=br:return 2
    elif d < r2 and ar <= br:return -2
    else:return 0

for _ in range(int(input())):print(f())

Measured memory_bytes: 7752
#include <iostream>
using namespace std;
int main()
{
	int a,b,c,d,t;
	cin>>a;
	cin>>b;
	cin>>c;
	cin>>d;
	if( 1<=a<=1000
	    &&1<=b<=1000
		&&1<=c<=1000
		&&1<=d<=1000)
	{
		if(a>b)
		t=b;
		else t=a;
		if(c>d)
		t=t+d;
		else t=t+c;
		cout<<t;
	}
	else return 0; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A,B,C,i;
  cin>>A>>B>>C;
  for(i=0;i<B;i++)if(A*i%B==C)break;
  if(i==B)cout<<"NO"<<endl;
  else cout<<"YES"<<endl;
}

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

int main(){
  int k, s;
  cin >> k >> s;
  int count;
  rep(i, k+1){
    rep(j, k+1){
      int x = s - i - j;
      if (0 <= x && x <= k) count++;
    }
  }
  
  cout << count << endl;
      
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <climits>
#include <queue>
using namespace std;

map<int,bool> isre;
map<int,int> dp;

int code(string s){
    int ret=0,kake=1;
    for(int i=0;i<s.size();i++){
        if(s[i]=='r') ret+=kake*1;
        else if(s[i]=='g') ret+=kake*2;
        else ret+=kake*3;
        kake*=4;
    }
    return ret;
}

int main(){
    string in;
    for(;;){
        cin>>in;
        if(in=="0") break;
        map<int,bool> isre;
        queue<string> nq;
        nq.push(in);
        int ret=-1;
        int cnt=0;
        while(!nq.empty()){
            int sz=nq.size();
            for(int i=0;i<sz;i++){
                string now=nq.front();
                nq.pop();
                int co=code(now);
                if(isre.find(co)!=isre.end() && isre[co]) continue;
                isre[co]=true;
                bool is=true;
                for(int j=0;j<now.size();j++){
                    if(now[j]!=now[0]) is=false;
                }
                if(is){
                    ret=cnt;
                    goto EXIT;
                }
                for(int j=1;j<now.size();j++){
                    string ne=now;
                    if(now[j-1]!=now[j]){
                        if(now[j-1]!='r'&&now[j]!='r'){
                            ne[j-1]=ne[j]='r';
                        }else if(now[j-1]!='g'&&now[j]!='g'){
                            ne[j-1]=ne[j]='g';
                        }else{
                            ne[j-1]=ne[j]='b';
                        }
                        nq.push(ne);
                    }
                }
            }
            cnt++;
        }
EXIT:   ;
        if(ret==-1) cout<<"NA"<<endl;
        else cout<<ret<<endl;
    }
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i,n;
    cin>>n;
    int a[n],sum=0;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
        sum+=a[i];
    }
    sort(a,a+n);
    sum-=a[n-1];
    if(a[n-1]<sum)
    cout<<"Yes";
    else
    cout<<"No";
    return 0;
}

Measured memory_bytes: 256
main :: IO ()
main = do 
    [n, a, b] <- map read . words <$> getLine :: IO [Int]
    print .sum $ filter (isWhile a b) [1..n]

isWhile :: Int -> Int -> Int -> Bool
isWhile begin end n =  
    let a = sum . map (\c -> read [c]) $ show n
    in begin <= a && a <= end

Measured memory_bytes: 1020
#include <stdio.h>
#include <stdbool.h>

bool is_lunlun(unsigned long int x) {
    bool ans = true;
    if (x / 10 > 0) {
        unsigned long int temp = x % 10;
        x = x /10;
        while (x > 0) {
            if (x % 10 != temp && x % 10 + 1 != temp && temp + 1 != x % 10) {
                ans = false;
                break;
            }
            temp = x % 10;
            x = x / 10;
        }
    }
    return ans;
}

int lb(int x) {
    if (x == 0) return 0;
    else return x-1;
}

int ub(int x) {
    if (x == 0 || x == 9) return 9;
    else return x+1;
}

unsigned long int answer(int i[]) {
    unsigned long int ans = 0;
    int j;
    for (j=0; j<10; j++) {
        ans = ans * 10 + (unsigned long int)i[j];
    }
    return ans;
}

bool judge(int i[]) {
    int j;
    for (j=0; i[j] == 0; j++) ;
    bool ans = true;
    int temp = i[j];
    for (j++; j < 10; j++) {
        if (temp-i[j] > 1 || temp-i[j] < -1) {
            ans = false;
            break;
        }
        temp = i[j];
    }
    return ans;
}

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

    int count = -1;
    int i[10] = {0};
    unsigned long int ans;

    for (i[0] = 0; i[0] <= 9; i[0]++) {
        for (i[1] = lb(i[0]); i[1] <= ub(i[0]); i[1]++) {
            for (i[2] = lb(i[1]); i[2] <= ub(i[1]); i[2]++) {
                for (i[3] = lb(i[2]); i[3] <= ub(i[2]); i[3]++) {
                    for (i[4] = lb(i[3]); i[4] <= ub(i[3]); i[4]++) {
                        for (i[5] = lb(i[4]); i[5] <= ub(i[4]); i[5]++) {
                            for (i[6] = lb(i[5]); i[6] <= ub(i[5]); i[6]++) {
                                for (i[7] = lb(i[6]); i[7] <= ub(i[6]); i[7]++) {
                                    for (i[8] = lb(i[7]); i[8] <= ub(i[7]); i[8]++) {
                                        for (i[9] = lb(i[8]); i[9] <= ub(i[8]); i[9]++) {
                                            if (judge(i)) count += 1;
                                            if (count == k) {
                                                ans = answer(i);
                                                printf("%ld\n", ans);
                                                return 0;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }

    printf("Not founf\n");
    return 0;
}

Measured memory_bytes: 128
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <ios>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <forward_list>
#include <random>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <unordered_map>
#include <unordered_set>
#endif

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm( a, b ) (a)/__gcd((a),(b))*(b)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 100005;

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

vector< int > Div( int n ) {
    vector< int > ret;
    for( int i = 1; i * i <= n; ++i ) {
        if( n % i == 0 ) {
            ret.pb( i );

            if( i * i != n ) ret.pb( n / i );
        }
    }
    sort( all( ret ) );
    return ret;
}

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

    string s, t;
    cin >> s >> t;
    int cnt = 0;
    if( s[0] == t[0] ) ++cnt;
    if( s[1] == t[1] ) ++cnt;
    if( s[2] == t[2] ) ++cnt;
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<cassert>
#include<cassert>
#include<unordered_map>
#include<unordered_set>
#include<functional>
#include<queue>
#include<stack>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<sstream>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<numeric>
#include<random>
#include<chrono>
#include<bitset>
using namespace std;

#define all(x) (x).begin(), (x).end()
#define pb push_back
#define xx first
#define yy second
#define sz(x) (int)(x).size()
#define gc getchar
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mp make_pair

#ifndef ONLINE_JUDGE
#  define LOG(x) (cerr << #x << " = " << (x) << endl)
#else
#  define LOG(x) ((void)0)
#endif

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

const double PI=acos(-1);
const ll INF = 1LL<<62;
const ll MINF = -(1LL<<62);

template<typename T> T getint() {
	T val=0;
	char c;
	
	bool neg=false;
	while((c=gc()) && !(c>='0' && c<='9')) {
		neg|=c=='-';
	}

	do {
		val=(val*10)+c-'0';
	} while((c=gc()) && (c>='0' && c<='9'));

	return val*(neg?-1:1);
}

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); uniform_int_distribution<int>(0, n-1)(rng)


int ans(int x) {
	if(x==0) return 0;
	return ans(x%__builtin_popcount(x))+1;
}

int fastpow(int a, int b, int mod) {
	if(b==0) return 1;
	int fele=fastpow(a,b/2, mod);
	int ans=ll(fele)*ll(fele)%mod;
	if(b&1) ans=ll(ans)*ll(a)%mod;
	return ans;
}

int main() {
	IO;
	int n;
	cin>>n;
	string t;
	cin>>t;
	int cnt=0;
	for(char c:t) {
		cnt+=c=='1';
	}
	
	int kisebb=0, nagyobb=0;
	if(cnt>1) {
		for(int i=0;i<sz(t);i++) {
			kisebb*=2;
			kisebb+=t[i]-'0';
			kisebb%=cnt-1;
		}
	}
	
	for(int i=0;i<sz(t);i++) {
		//~ val*=2;
		//~ val+=t[i]-'0';
		
		nagyobb*=2;
		nagyobb+=t[i]-'0';
		nagyobb%=cnt+1;
	}
	
	//~ LOG(kisebb);
	//~ LOG(nagyobb);
	//~ LOG(val);
	for(int i=0;i<sz(t);++i) {
		//~ LOG(ans(val^(1<<(sz(t)-i-1))));
		if(t[i]=='0') {
			int akt=(fastpow(2, sz(t)-i-1, cnt+1)+nagyobb)%(cnt+1);
			cout<<ans(akt)+1<<"\n";
		}else {
			if(cnt>1) {
				int akt=(kisebb-fastpow(2, sz(t)-i-1, cnt-1))%(cnt-1);
				if(akt<0) akt+=cnt-1;
				cout<<ans(akt)+1<<"\n";
			}else {
				cout<<"0\n";
			}
		}
	}
	
	return 0;
}


Measured memory_bytes: 3776
#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;
string s;
int main(){
    cin>>s;
    if ("SUN"==s) cout<<7;
    else if (s=="SAT") cout<<1;
    else if (s=="FRI") cout<<2;
    else if (s=="THU") cout<<3;
    else if (s=="WED") cout<<4;
    else if (s=="TUE") cout<<5;
    else if (s=="MON") cout<<6;

}


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

using namespace std;

#define ll long long
#define mod 1e9 + 7
#define mx 1000000000
#define endl '\n'

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,m;
    cin>>n>>m;
    vector<string> s(n);
    for(int i = 0;i<n;i++){
        cin>>s[i];
    }
    int ans = 0;
    int arr[n][m],brr[n][m];
    for(int i = 0;i<n;i++){
        for(int j = 0;j<m;j++){
            if(s[i][j] == '.')arr[i][j] = 1,brr[i][j] = 1;
            else arr[i][j] = 0,brr[i][j] = 0;
        }
    }
    for(int i = 0;i<n;i++){
        for(int j = 1;j<m;j++){
            if(s[i][j] != '#'){
                arr[i][j] += arr[i][j-1];
            }
        }
    }
    for(int i = 0;i<m;i++){
        for(int j = 1;j<n;j++){
            if(s[j][i] != '#'){
                brr[j][i] += brr[j-1][i];
            }
        }
    }
    for(int i = 0;i<n;i++){
        for(int j = m-2;j>=0;j--){
            if(s[i][j+1] != '#' && s[i][j] != '#'){
                arr[i][j] = arr[i][j+1];
            }
        }
    }

    for(int i = 0;i<m;i++){
        for(int j = n-2;j>=0;j--){
            if(s[j+1][i] != '#' && s[j][i] != '#'){
                brr[j][i] = brr[j+1][i];
            }
        }
    }

    for(int i = 0;i<n;i++){
        for(int j = 0;j<m;j++){
            ans = max(ans,arr[i][j] + brr[i][j]);
        }
    }

    cout<<ans-1;
    return 0;
}



Measured memory_bytes: 35840
#include <bits/stdc++.h>
 
#define ff first
#define ss second
#define mp make_pair
 
using namespace std;
 
typedef long long ll;
 
int main() {
	int n;
 
	scanf("%d", &n);
 
	int ans = 1e9;
 
	for(int i = 1; i <= n; i++) {
		if(i*108 >= n*100 && i*108 < n*100 + 100) {
			printf("%d\n", i);
			return 0;
		}
	}
 
	printf(":(\n");
 
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define F first
#define S second

using namespace std;
typedef pair<int,int> P;
typedef vector<int> ivec;

const int MOD=1000000007;
int INF=100100100100100;

signed main(){
  int n,k;cin>>n>>k;
  if((n+1)/2>=k)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  return 0;
}


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

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

}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;

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

    if(abs(a-c) <= d) {
        ans = "Yes";
    }
    else {
        if(abs(a-b) <= d && abs(b-c) <= d) {
            ans = "Yes";
        }
        else {
            ans = "No";
        }
    }

    cout << ans;
    
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef pair<int, int> P;

const long long int MOD = 998244353;
long long int n, nodes[200000];

int main(){
  cin >> n;
  long long int d, maxd = 0;
  bool flag = true;
  rep(i, n) nodes[i] = 0;
  rep(i, n){
    cin >> d;
    if(d == 0 && i == 0){
      nodes[0]++;
      continue;
    }else if(d == 0){
      flag = false;
      break;
    }
    nodes[d]++;
    maxd = max(d, maxd);
  }
  //rep(i, maxd + 1) cerr << nodes[i] << " "; cerr << endl;
  
  long long int sum = 1;
  for(int i = 1; i <= maxd; i++){
    long long int num = nodes[i];
    rep(j, num){
      sum *= nodes[i - 1];
      sum %= MOD;
    }
  }
  cout << (flag ? sum : 0) << endl;
  return 0;
}


Measured memory_bytes: 1024
import sys

group = [None, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1]

x, y = map(int, sys.stdin.readline().split())

def main():
    ans = 'Yes' if group[x] == group[y] else 'No'
    print(ans)

if __name__ ==  '__main__':
    main()

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

int main() {
	int A[4];
	int B[4];
	cin >> A[0] >> A[1] >> A[2] >> A[3];
	cin >> B[0] >> B[1] >>B[2] >> B[3];
	int a = A[0] + A[1] + A[2] + A[3];
	int b = B[0] + B[1] + B[2] + B[3];
	if (a>=b){
		cout << a << endl;
	}
	else
	{
		cout << b << endl;
	}
	char c;
	cin >> c;
}

Measured memory_bytes: 3036
def count_(X,Y):
    dic={}
    for a in X:
        if a in Y:
            dic[a]=1
    return len(dic)

N=input()
S=input()
max_=0
for i in range(1,len(S)):
    X=S[:i]
    Y=S[i:]
    tmp = count_(X,Y)
    if tmp>max_:
        max_=tmp
print(max_)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
using namespace std; using ll = long long; using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
//**デバッグ準備**//
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop//
//gcdlcm, isPrime, eratos, Npow, divisor, modinv, bitSearch, bitList, dfs, bfs//
//dijkstra, UnionFind, COM, digitDP//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z;
ll MOD = 1000000007; ll INF = 1LL << 60; ll ans = 0; ll z = 0;
vl flag, color; vll path;
//***********//
int main() {
	cin >> N;
	vpll P(N);
	for (i = 0; i < N; i++) {
		cin >> P[i].first >> P[i].second;
		P[i].second++;
	}
	ll L = -INF;
	ll left = 0;
	ll R = INF;
	ll right = 0;
	for (i = 0; i < N; i++) {
		if (L < P[i].first) {
			L = P[i].first;
			left = i;
		}
		if (P[i].second < R) {
			R = P[i].second;
			right = i;
		}
	}
	ll M = 0;
	for (i = 0; i < N; i++) {
		M = max(M, P[i].second - P[i].first);
	}
	ans = max(z, R - L) + M;
	if (left != right) {
		vpll Q;
		for (i = 0; i < N; i++) {
			Q.push_back(make_pair(max(z, P[i].second - L), max(z, R - P[i].first)));
		}
		sort(Q.begin(), Q.end(), pairCompare);
		reverse(Q.begin(), Q.end());
		ll K = Q.size();
		vl A(K + 1);
		vl B(K + 1);
		A[K] = max(z, P[left].second - L);
		B[0] = max(z, R - P[right].first);
		for (i = 0; i < K; i++) {
			B[i + 1] = min(B[i], max(z, R - Q[i].first));
		}
		for (i = K - 1; i >= 0; i--) {
			A[i] = min(A[i + 1], max(z, Q[i].second - L));
		}
		for (i = 0; i < K; i++) {
			//debug(Q[i].first, Q[i].second);
		}
		R = INF;
		for (i = 0; i < K; i++) {
			//debug(i, A[i], B[i]);
			if (i)  ans = max(ans, R + Q[i].first);
			R = min(R, Q[i].second);
		}
	}
	cout << ans;
}


Measured memory_bytes: 4976
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin() , v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)

string w;
int i;
char a[102];
int c[31] = {0};

int main(){
    cin >> w;
    rep(i, w.length()){
        c[w[i] - 'a']++;
    }
    bool flg = true;
    rep(i, 31){
        if(c[i] % 2 != 0) flg = false;
    }
    if(flg) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

int main() {
	int n,k;
	cin>>n>>k;
	int a[n],dp[n]={};
	for(int i=0;i<n;i++) cin>>a[i];
	dp[n-2]=abs(a[n-1]-a[n-2]);
	for(int i=n-3;i>=0;i--){
		dp[i]=dp[i+1]+abs(a[i+1]-a[i]);
		for(int j=2;j<=k;j++)
			if(i+j+1>n) break;
			else dp[i]=min(dp[i+j]+abs(a[i+j]-a[i]),dp[i]);
	}
	cout<<dp[0];
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    string s;
    cin>>s;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]=='7')
        {
            cout<<"Yes";
            return 0;
        }
    }
    cout<<"No";
    return 0;
}

Measured memory_bytes: 3608
s = input()
t = input()
slen = len(s)
tlen = len(t)

dp = [[0]*(tlen+1) for _ in range(slen+1)]

for i in range(slen):
    for j in range(tlen):
        if s[i] == t[j]:
            dp[i+1][j+1] = dp[i][j]+1
        else:
            dp[i+1][j+1] = max(dp[i+1][j],dp[i][j+1])

length = dp[slen][tlen]

ans = ''
i,j = slen,tlen
while length>0:
    if s[i-1] == t[j-1]:
        ans += s[i-1]
        i -= 1
        j -= 1
        length -= 1
    elif dp[i][j] == dp[i][j-1]:
        j -= 1
    else:
        i -= 1
print(ans[::-1])

Measured memory_bytes: 144304
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>

using namespace std;

typedef long long ll;
const int MAXN = 3010;

int n;
double p[MAXN], f[MAXN][MAXN<<1];

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%lf",&p[i]);
	f[0][0] = 1;
	for(int i=1;i<=n;i++){
		for(int j=0;j<=i;j++){
			if(j == 0) f[i][j] = f[i-1][j] * (1 - p[i]);
			else f[i][j] = f[i-1][j-1] * p[i] + f[i-1][j] * (1 - p[i]);
		}
	}
	double ans = 0.0;
	for(int i=n/2+1;i<=n;i++)
		ans += f[n][i];
	printf("%.10lf\n",ans);
	return 0;
}

Measured memory_bytes: 139648
#include<stdio.h>
#include<string>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<string.h>
#include<map>
#include<queue>

using namespace std;

typedef pair<int,int> pii;

#define rep(i,j) for(int i=0;i<(j);i++)
#define reps(i,j,k) for(int i=j;i<=k;i++)
#define in(i,j,k) ((i)>=(j)&&(i)<=(k))


int main(){
	int n[5];
	rep(i,5)scanf("%d",n+i);
	sort(n,n+5);
	rep(i,5)printf("%d%c",n[4-i],i<4?' ':'\n');
	return 0;
}

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

string a, b, c;

int main() {
  cin >> a >> b >> c;
  if (a[a.size()-1] == b[0] && b[b.size()-1] == c[0]) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}


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

int main() {
  int n, c = 0;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    if (to_string(i).length() % 2 == 1) ++c;
  }
  cout << c << endl;
  return 0;
}

Measured memory_bytes: 256
/*atcoder beginner contest D - Recording*/
#include<bits/stdc++.h>
#define T 100000
using namespace std;
int main()
{	
	int n,c;
	cin>>n>>c;
	int ct[c+1][T+1];
	for(int i=0;i<=c;i++)
		for(int j=0;j<=T;j++)
			ct[i][j]=0;
	
	for(int i=0;i<n;i++){
		int s,t,c;
		cin>>s>>t>>c;
		for(int ss=s-1;ss<t;ss++)
			ct[c][ss]=1;
	}
	int res=0;
	for(int i=0;i<=T;i++)
	{
		int cres=0;
		for(int j=0;j<=c;j++)
			cres+=ct[j][i];
		res=max(cres,res);
	}

	cout<<res<<endl;

	return 0;
}

Measured memory_bytes: 12416
n = int(input())
a = list(map(int, input().split()))
b = max(a)
che = [1 for i in range(b)]
for i in a:
    if che[i-1] == 1:
        c = b // i
        for j in range(2,c+1):
            che[i*j-1] = 0
        che[i-1] = 2
    elif che[i-1] == 2:
        che[i-1] = 0
ans = 0
for i in a:
    if che[i-1] == 2:
        ans += 1
print(ans)


Measured memory_bytes: 32248
#include <bits/stdc++.h>
#define REP(i, n) for (long long i = 0; i < (long long)n; i++)
//#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using Vl = vector<ll>;
using vi = vector<int>;
using Graph = vector<vi>;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  // std::cout << std::fixed << std::setprecision(15); //"for float-base
  // problem"
  int N;
  cin >> N;

  Vl A(N), B(N);
  REP(i, N) cin >> A.at(i) >> B.at(i);
  sort(A.begin(), A.end());
  sort(B.begin(), B.end());
  int m, M;
  if (N % 2 == 1) {
    m = A.at(N / 2);
    M = B.at(N / 2);
  } else {
    m = (A.at(N / 2 - 1) + A.at(N / 2));
    M = (B.at(N / 2 - 1) + B.at(N / 2));
  }
  cout << M - m + 1 << endl;
}

Measured memory_bytes: 6372
#include <bits/stdc++.h>
#define int long long

using namespace std;

int32_t main () {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int n, x, ant, ans = 0;
  cin >> n >> ant;
  for (int i = 1; i < n; ++i) {
    cin >> x;
    if (x < ant) {
      ans += ant - x;
      x = ant;
    }
    ant = x;
  }
  cout << ans;
}


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

using namespace std;

using ll = int64_t;

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

    ll a, b, c, k, d;
    cin >> a >> b >> c >> k;
    if (k % 2 == 0) {
        cout << a - b;
    } else {
        cout << b - a;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair

using namespace std;

const int INF = 2000000000;
const double pi = 3.1415926;
const int base = 1000000007;

string s, t;
int a, b;

int main()
{
    //ifstream cin ("input.txt");
    //ofstream cout ("output.txt");
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> s >> t;
    cin >> a >> b;
    string u;
    cin >> u;
    if (u == s) a--;
    else if (u == t) b--;
    cout << a << ' ' << b;
    return 0;
}


Measured memory_bytes: 256
// Problem : C - Sugar Water
// Contest : AtCoder - AtCoder Beginner Contest 074
// URL : https://atcoder.jp/contests/abc074/tasks/arc083_a
// Memory Limit : 256 MB
// Time Limit : 3000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define eb emplace_back
#define pb push_back
#define size(s) (int)s.size()
#define int long long
#define vi vector<int>
#define vs vector<string>
#define vv vector<vector<int>>
#define pii pair<int,int>
#define m_p(x,y) make_pair(x,y)
#define vp vector<pair<int,int>>
#define setbits(x) __builtin_popcountll(x)
#define f first
#define se second
#define inc(v,n,x) v.assign(n,x)
#define incd(v,n) v.resize(n)
#define iniz(n) memset(n,0,sizeof(n))
#define inin(n) memset(n,-1,sizeof(n))
#define inimi(n) memset(n,0xc0,sizeof(n))
#define inima(n) memset(n,0x3f,sizeof(n))
#define all(v) (v).begin(),(v).end()

using namespace std;

template<typename T1,typename T2>istream &operator>>(istream &is, vector<pair<T1,T2>> &v) { for (pair<T1,T2> &t : v) is >> t.f>>t.se; return is; }
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }

const int N=200001;
double pi=acos(-1.0);
int md=1e9+7;
const int INF=1e15;
int dx1[]={0,0,-1,1};
int dy1[]={1,-1,0,0};

template<class T>
T abst(T a)
{return a<0?-a:a;}

template<class T>
T max2(T a,T b){return a>b?a:b;}
template<class T>
T min2(T a,T b){return a<b?a:b;}

void solve()
{
	long double a,b,c,d,e,f;
	cin>>a>>b>>c>>d>>e>>f;
	pii ans;
	ans.f=0,ans.se=0;
	long double den=-1;
	for(int i=0;i<=100;i++)
	{
		for(int j=0;j<=100;j++)
		{
			long double sugar=i*c+j*d;
			if(sugar>f)continue;
			for(int i1=0;i1<=100;i1++)
			{
				for(int i2=0;i2<=100;i2++)
				{
					if(i1==0 and i2==0)continue;
					long double water=i1*100.0*a+i2*100.0*b;
					if(water>f)continue;
					if(water*e>=100.0*sugar and water+sugar<=f)
					{
						long double density=(sugar*100.0/(water+sugar));
						if(density>den)
						ans.f=water,ans.se=sugar,den=density;
					}
				}
			}
		}
	} 
	cout<<fixed<<setprecision(0)<<ans.f+ans.se<<" "<<ans.se;
}

int32_t main(){
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
int t=1;
//cin>>t;
for(int i=1;i<=t;i++)
{
    solve();
}
return 0;
}


Measured memory_bytes: 3720
#include <iostream>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <algorithm>
#include <queue>

#define ll long long
#define ull unsigned long long
#define mod 1000000007

using namespace std;

struct moji{
    char c;
    vector<int> x;
};

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

    string s, t;
    cin >> s >> t;

    const char* schar = s.c_str();
    const char* tchar = t.c_str();

    vector<moji> mojis;
    for(int i = 0; i < s.length(); i++){
        bool flag = true;
        for(int j = 0; j < mojis.size(); j++){
            if(schar[i] == mojis[j].c){
                mojis[j].x.push_back(i);
                flag = false;
                break;
            }
        }
        if(flag){
            moji newMoji;
            newMoji.c = schar[i];
            newMoji.x.push_back(i);
            mojis.push_back(newMoji);
        }
    }

    ll count = 0;
    ll currentX = -1;
    for(int i = 0; i < t.length(); i++){
        bool flag = true;
        for(int j = 0; j < mojis.size(); j++){
            if(tchar[i] == mojis[j].c){
                flag = false;
                if(mojis[j].x[mojis[j].x.size()-1] <= currentX){
                    count += (mojis[j].x[0] - currentX) + s.length();
                    currentX = mojis[j].x[0];
                }else{
                    int left = 0;
                    int right = mojis[j].x.size();
                    int mid;
                    while(left<right){
                        mid = (left+right) >> 1;
                        if(currentX >= mojis[j].x[mid]){
                            if(right == left + 1){
                                break;
                            }
                            left = mid;
                        }else{
                            right = mid;
                        }
                    }
                    count += (mojis[j].x[right] - currentX);
                    currentX = mojis[j].x[right];
                }
            }
        }
        if(flag){
            cout << -1 << endl;
            return 0;
        }
    }

    cout << count << endl;
}


Measured memory_bytes: 1228
import collections

N = int(input())
v = list(map(int, input().split()))
ov = collections.Counter(v)
if ov.most_common()[0][1] == len(v):
  v[0] = (v[0] + 1) % 10
  v[1] = (v[1] + 1) % 10

odd = [v[2*i+1] for i in range(int(N/2))]
even = [v[2*i] for i in range(int(N/2))]
oo = collections.Counter(odd)
oe = collections.Counter(even)
max_odd = oo.most_common()[0][0]
max_even = oe.most_common()[0][0]

if oo.most_common()[0][0] == oe.most_common()[0][0]:
  if oo.most_common()[1][1] > oe.most_common()[1][1]:
    max_odd =  oo.most_common()[1][0]
  else:
    max_even = oe.most_common()[1][0]

print(len(odd)+len(even)-odd.count(max_odd)-even.count(max_even))

Measured memory_bytes: 26716
#include <bits/stdc++.h>
using namespace std;
#define Maxn 207
#define Maxm 80007
int n;
int last[Maxm],pre[Maxm],other[Maxm],cnt=0;
int col[Maxn];
char s[Maxn][Maxn];
bool flag=true;
bool vis[Maxn];
int que[Maxn];
void insert(int u,int v)
{
    other[++cnt]=v,pre[cnt]=last[u],last[u]=cnt;
}
void pre_dfs(int u)
{
    for (int q=last[u];q;q=pre[q])
    {
        int v=other[q];
        if (col[v]==-1)
        {
            col[v]=col[u]^1;
            pre_dfs(v);
        } else if (col[u]==col[v]) flag=false;
    }
}
int main()
{
    scanf("%d",&n);
    for (int i=1;i<=n;i++)
    {
        scanf("%s",s[i]+1);
        for (int j=1;j<=n;j++)
            if (s[i][j]=='1') insert(i,j);
    }
    memset(col,-1,sizeof(col));
    col[1]=0;
    pre_dfs(1);
    if (!flag)
    {
        printf("%d\n",-1);
        return 0;
    }
    int ans=2;
    for (int i=1;i<=n;i++)
    {
        memset(vis,false,sizeof(vis));
        memset(col,0,sizeof(col));
        int tmp=1;
        int lx=0,rx=0;
        que[++rx]=i;
        vis[i]=true;
        col[i]=1;
        while (lx<rx)
        {
            int u=que[++lx];
            for (int q=last[u];q;q=pre[q])
            {
                int v=other[q];
                if (!vis[v])
                {
                    vis[v]=true;
                    col[v]=col[u]+1;
                    tmp=max(tmp,col[v]);
                    que[++rx]=v;
                }
            }
        }
        ans=max(ans,tmp);
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 3964
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const int inf = 1e9;
const ll INF = 1e18;
const double pi = 3.14159265358979323846;
#define rep(i,n) for(ll i=0;i<n;i++)

int main(){
	string s;cin>>s;
	string t={};
	rep(i,s.size()){
		if(s[i]=='0'){
			t+='0';
		}
		else if(s[i]=='1'){
			t+='1';
		}
		else{
			if(t!="") t.erase(t.size()-1);
		}
	}
	cout<<t;

	cout<<"\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin>>N;
  vector<int>vec(N);
  vector<int>ans(N);
  for(int i=0;i<N;i++){
    cin >> vec[i];
    ans[vec[i]-1]=i+1;
  }
  for(int i=0;i<N;i++){
    if(i == N-1){
      cout << ans[i] << endl;
    }
    else{
      cout<<ans[i]<<" ";
    }
  }
}


Measured memory_bytes: 4056
#include <bits/stdc++.h>
#define rep(i,x) for(long long i = 0; i < x; i++)
#define mod 1000000007
typedef long long ll;
using namespace std;

const ll INF = 1LL<<60;

int N;
ll dp[(1<<21)+1];
int a[21][21];

int main(){
  cin>>N;
  rep(i,N)rep(j,N) cin>>a[i][j];

  dp[0] = 1;

  for(ll bit=0; bit<(1<<N); bit++){
    int pos = __builtin_popcount(bit)-1;

    rep(i,N){
      if((bit & 1<<i) && a[pos][i]){
        dp[bit] += dp[bit ^ (1<<i)];
        dp[bit] %= mod;
      }
    }
  }
  cout<<dp[(1<<N)-1];
  return 0;
}


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

void solve() 
{
    int n;
    cin>>n;
    ll a[n];REP(i,n)cin>>a[i];
    sort(a,a+n);
    if(a[0]==0)cout<<0<<endl;
    else{
        ll sum=1;
        REP(i,n){
            if(sum*a[i]>(ll)1e18||sum*a[i]<max(sum,a[i])){
                cout<<-1<<endl;return;
            }
            sum*=a[i];
        }
        cout<<sum<<endl;
    }
}

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

Measured memory_bytes: 4404
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t,i,c[10000000],x;
    cin>>t;
   for(i=1;i<=t-1;i++)
    {
      cin>>x;
      c[x]++;
        }
        for(int i=1;i<=t;i++)
        cout<<c[i]<<endl;

}





Measured memory_bytes: 4308
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define int long long
typedef long long ll;
using namespace std;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

vector<int> init(int size){
  vector<int> par(size,-1);
  return par;
}

int root(int x, vector<int>& par){
  if(par[x] < 0){
    return x;
  }else{
    return par[x] = root(par[x],par);
  }
}

bool same(int x, int y, vector<int>& par){
  return root(x, par) == root(y, par);
}

void unite(int x, int y, vector<int>& par){
  x = root(x, par), y = root(y, par);
  if(same(x,y, par))return;
  par[x] += par[y];
  par[y] = x;
}

int size(int x, vector<int>& par){
  return -par[root(x, par)];
}

int pow(int x, int n){
  if(n == 0)return 1;
  if(n % 2 == 0)return pow(x * x % MOD, n/2);
  else return x * pow(x, n-1) % MOD;
}




signed main(){
  int n,m;cin>>n>>m;
  vector<int> par = init(n);
  int ans = 0;
  rep(i,m){
    int x,y,z;cin>>x>>y>>z;x--;y--;
    unite(x,y,par);
  }
  vector<bool> ka(n, false);
  rep(i,n){
    if(!ka[root(i, par)]){
      ka[root(i, par)] = true;ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
int dq[51];
int n,k,ans=0;

int solve(int a,int b,int c){
    int sum=0;
    priority_queue<int, vector<int>, greater<int> > pq;
    for(int i=0;i<a;i++){
        pq.push(dq[i]);
    }
    for(int i=0;i<b;i++){
        pq.push(dq[n-1-i]);
    }
    for(int i=0;i<c;i++){
        if(!pq.empty() && pq.top()<0) pq.pop();
    }
    int size=pq.size();
    for(int i=0;i<size;i++){
        sum+=pq.top();
        pq.pop();
    }
    ans=max(sum,ans);
}

int main(){
    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>dq[i];
    }
    for(int i=0;i<=min(n,k);i++){
        for(int j=0;j<=min(k-i,n-i);j++){
            for(int p=0;p<=k-i-j;p++){
                solve(i,j,p);
            }
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
//header{{{
#include<bits/stdc++.h>
  
using namespace std;
 
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define setout(n,x) setw(n) << setfill(x)
#define Fixed fixed << setprecision(10)
#define int long long
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod = 1e9+7; 

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
  
int gcd(int a,int b){ return b ? gcd(b,a % b) : a;}
int lcm(int a,int b){ return a / gcd(a,b) * b;}
//}}}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	double sum = 0;
	vector<int> x(n),y(n),v(n);
	rep(i,n){
		cin >> x[i] >> y[i];
		v[i] = i;
	}
	int cnt = 0;
	do{
		int tmp = v[0];
		reps(i,n-1){
			sum += sqrt(abs(x[tmp] - x[v[i]]) * abs(x[tmp] - x[v[i]]) + abs(y[tmp] - y[v[i]]) * abs(y[tmp] - y[v[i]]));
			tmp = v[i];
		}
		++cnt;
	}while(next_permutation(all(v)));
	
	cout << Fixed << sum / cnt << '\n';

	return 0;
}



Measured memory_bytes: 256
main =
  let 
    input = do
      line <- getLine
      let 
        [m,f,h] = (map read $ words line :: [Int])
        in calc m f h
    calc m f h
      | m+f+h == -3  = do
        putStr ""
      | m == -1 || f == -1  = do 
        putStrLn "F" 
        input
      | m+f >= 80  = do
        putStrLn "A"
        input
      | m+f >= 65  = do
        putStrLn "B"
        input
      | m+f >= 50 || ( m+f >= 30 && h >= 50 ) = do
        putStrLn "C"
        input
      | m+f >= 30  = do
        putStrLn "D"
        input
      | otherwise  = do
        putStrLn "F"
        input
    in
      input



Measured memory_bytes: 4064
#include <iostream>
#include <string>
using namespace std;
int main(){
	string s;
	cin >> s;
	
	int len = s.length();
	int sum = 0;
	for(int i = 0;i<len;i++){
		char ch = s[i];
		int digit = (int)ch - '0';
		
		sum += digit;
	}
	
	if(sum %9 ==0)
		cout << "Yes";
	else
		cout << "No";
}


Measured memory_bytes: 3292
import collections

N = int(input())
A = list(map(int, input().split()))

B = collections.Counter(A)

p = []
for k, v in B.items():
    if v >= 2:
        p.append(k)
    if v >= 4:
        p.append(k)

if len(p) < 2:
    print(0)
else:
    p.sort()
    print(p[-1]*p[-2])

Measured memory_bytes: 18600
#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>
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 = 998244353;
const ll MAX = 1000001;

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;
};


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



int main() {
	
	ll N;
	cin >> N;

	vector<ll> A(N + 1), B(N + 1), sa(N + 1);

	repn(i, N) cin >> A[i];
	repn(i, N) cin >> B[i];
	repn(i, N) sa[i] = B[i] - A[i];

	sort(++sa.begin(), sa.end(),greater<ll>());

	ll ans = 0;
	ll sum = 0;

	for(ll i=1; sa[i]>0&&i<=N; i++) {
		ans++;
		sum += sa[i];
		//cout << sum << endl;
	}

	for (ll i = N; sum > 0 && i >= 1; i--) {
		sum += sa[i];
		ans++;
	}

	if (sum > 0) { ans = -1; }

	cout << ans;

	system("PAUSE");
}


Measured memory_bytes: 2808
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define END getchar();getchar();return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define inf 1000000007

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

	END;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();

        ArrayList<Shop<Long, Long>> list = new ArrayList<>();

        for (int i = 0; i < n; i++) {
            long a = sc.nextLong();
            long b = sc.nextLong();

            list.add(new Shop<Long, Long>(a, b));
        }

        sc.close();

        list.sort(Comparator.comparing(Shop::getA));

        long ans = 0;

        for (Shop shop : list) {
            if (m <= shop.b) {
                ans += shop.a * m;
                break;
            }
            ans += shop.a * shop.b;
            m -= shop.b;
        }

        System.out.println(ans);
    }

    public static class Shop<a, b> {
        public long a;
        public long b;

        public Shop(long a, long b) {
            this.a = a;
            this.b = b;
        }

        public long getA() {
            return this.a;
        }

        public long getB() {
            return this.b;
        }

    }
}

Measured memory_bytes: 95276