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

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(),a.end()
#define SET(a,b) memset(a,b,sizeof(a))
#define off ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
typedef pair<int,int>   II;
typedef vector< II >      VII;
typedef vector<int>     VI;
typedef vector< VI > 	VVI;
typedef long long int 	LL;
typedef vector<LL> 		VL;
#define si(n) cin>>n
#define dout(n) cout<<n<<"\n"
#define DRT() int t; si(t); while(t--)
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
//# define M_PI           3.14159265358979323846264338327950288
// DSU
void IO(){
	#ifndef ONLINE_JUDGE
    freopen("../input.txt", "r", stdin);
    freopen("../output.txt", "w", stdout);
	#endif
	srand(chrono::steady_clock::now().time_since_epoch().count());
	off;
}
LL n,m;
LL mod = 1e9+7;
int main(){
	IO();
	cin>>n>>m;
	VL arr(n);
	VL brr(m);
	rep(i,0,n){
		cin>>arr[i];
	}	
	rep(i,0,m){
		cin>>brr[i];
	}
	vector< VL > dp(n+1 , VL (m+1,0));
	rep(i,1,n+1){
		rep(j,1,m+1){
			if(arr[i-1] == brr[j-1]){
				dp[i][j] = (1 + (dp[i][j-1] + dp[i-1][j]) % mod) % mod;
			}
			else{
				dp[i][j] = ((dp[i-1][j] + dp[i][j-1]) % mod - dp[i-1][j-1] + mod) % mod;
			}
		}
	}
	cout<<(dp[n][m]+1) % mod;
	return 0;
}

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

int main(){
  int N,T;
  cin >> N >> T;
  vector<int> c(N),t(N);
  int ans = 99999;
  for(int i = 0; i < N; i++){
   cin >> c[i] >> t[i]; 
   if(t[i] <= T && c[i] < ans){
     ans = c[i];
   }

  }
  if(ans == 99999){
  cout << "TLE" << endl;
  }
  else{
  cout << ans << endl;
  } 
 
}

Measured memory_bytes: 256
#include<iostream>

int main(){
  int a, b;
  std::cin >> a >> b;
  if(b - a > 0) std::cout << "a < b" << std::endl;
  else if(b - a == 0) std::cout << "a == b" << std::endl;
  else std::cout << "a > b" << std::endl; 
}


Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
int main() {
  int64_t x,a,b,c,d;
  cin>>x;
  for(a=1;a<=200;a++) {
    for(b=0;b<=a;b++) {
      c=a*a*a*a*a;
      d=b*b*b*b*b;
      if(c-d==x) {
        cout<<a<<' '<<b<<endl;
        a=200;b=200;
      }
      else if(c+d==x) {
        cout<<a<<' '<<-b<<endl;
        a=200;b=200;
      }
    }
  }
}

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

using namespace std;
using ll = long long int;
#define INF 20000000000000000;

int main(void){
  int n; cin >> n;
  vector<int> a(n);
  vector<int> b;
  for(int i = 0;i < n;i++) cin >> a[i];
  int re_count = 1;
  
  for(int i = 0;i < n;i++){
    if(re_count % 2 == 0) b.insert(b.begin(), a[i]);
    else b.push_back(a[i]);
    
    re_count++;
  }
  
  if(re_count % 2 == 0) reverse(b.begin(), b.end());
  
  for(int i = 0;i < n;i++){
    if(i == n-1) cout << b[i];
    else cout << b[i] << " ";
  }
  cout << endl;
  
  
}

Measured memory_bytes: 3956
A, B = map(int, input().split(' '))


def main():
    x = int(A / 0.08) + 1
    y = int(B / 0.1) + 1

    p = max(x, y)
    correct = -1
    while True:
        if p < 0:
            break

        if int(p * 0.08) == A and int(p * 0.1) == B:
            correct = p

        p -= 1

    return correct


print(main())


Measured memory_bytes: 3060
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define ll long long
#define endl '\n'
using namespace std;


int main(){
	ios::sync_with_stdio(0);cin.tie(0);
	string str;
	bool arr[30]={};
	cin>>str;
	for(auto i:str)	arr[i-'a']=1;
	for(int i=0;i<26;i++){
		if(!arr[i]){
			cout<<(char)('a'+i)<<endl;
			return 0;
		}
	}
	cout<<"None\n";
	return 0;
}

Measured memory_bytes: 512
/*
  Compete against Yourself.
  Author - Aryan Choudhary (@aryanc403)
*/

#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define fo(i,n)   for(i=0;i<(n);++i)
#define repA(i,j,n)   for(i=(j);i<=(n);++i)
#define repD(i,j,n)   for(i=(j);i>=(n);--i)
#define all(x) begin(x), end(x)
#define sz(x) (lli)(x).size()
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define endl "\n"

typedef long long int lli;
typedef long double mytype;
typedef pair<lli,lli> ii;
typedef vector<ii> vii;
typedef vector<lli> vi;

clock_t time_p=clock();
void aryanc403()
{
#ifdef ARYANC403
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
#endif
}

#ifdef ARYANC403
#include "/home/aryan/codes/PastCodes/header.h"
#else
    #define dbg(args...)
#endif

const lli INF = 0xFFFFFFFFFFFFFFFL;

lli seed;
mt19937 rng(seed=chrono::steady_clock::now().time_since_epoch().count());
inline lli rnd(lli l=0,lli r=INF)
{return uniform_int_distribution<lli>(l,r)(rng);}

class CMP
{public:
bool operator()(ii a , ii b) //For min priority_queue .
{    return ! ( a.X < b.X || ( a.X==b.X && a.Y <= b.Y ));   }};

void add( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt==m.end())         m.insert({x,cnt});
    else                    jt->Y+=cnt;
}

void del( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt->Y<=cnt)            m.erase(jt);
    else                      jt->Y-=cnt;
}

bool cmp(const ii &a,const ii &b)
{
    return a.X<b.X||(a.X==b.X&&a.Y<b.Y);
}

const lli mod = 1000000007L;
// const lli maxN = 1000000007L;

    lli T,n,i,j,k,in,cnt,l,r,u,v,x,y;
    lli m;
    string s;
    vi a;
    //priority_queue < ii , vector < ii > , CMP > pq;// min priority_queue .

int main(void) {
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    // freopen("txt.in", "r", stdin);
    // freopen("txt.out", "w", stdout);
// cout<<std::fixed<<std::setprecision(35);
// cin>>T;while(T--)
{

    cin>>n;
    a.clear();a.reserve(n);

    fo(i,n)
    {
        cin>>in;
        a.pb(in);
    }

    lli ans=INF;
    repA(i,0,100)
    {
        lli cnt=0;
        for(auto x:a)
            cnt+=(x-i)*(x-i);
        ans=min(ans,cnt);
    }

    cout<<ans<<endl;

}   aryanc403();
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <functional>
#include <queue>
#include <math.h>
#include <cmath>
#include <unordered_map>

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


int main(){
    long long n;
    unordered_map<long long,int> mp;
    cin>>n;
    string ans="YES";
    long long tmp;
    rep(i,n){
        cin>>tmp;
        if(mp[tmp]>=1){
            ans="NO";
        }
        mp[tmp]++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 8520
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file  
#include <ext/pb_ds/tree_policy.hpp>  
#include <functional> // for less  
using namespace         std;
#define                 int long long
#define                 pb push_back
#define                 mp make_pair
#define st(arr,a)       memset(arr,a,sizeof arr)
#define                 nl cout<<'\n'
#define bitcount(x)     __builtin_popcountll(x)
const int MOD = 1000000007ll;
#define forn(i,a,b)     for(int i=a;i<=b;i++)
#define rfor(i,a,b)     for(int i=a;i>=b;i--)
#define all(x)          x.begin() , x.end()
#define pi pair<int,int>
#define X first
#define Y second
#define sz(A) (int)A.size()
#define N 1014159
#define  vi vector<int>
#define  v  vector
#define die exit(0)
#define alln(arr) arr+1 , arr+1+n
using namespace __gnu_pbds;  
typedef tree<int, null_type, less<int>, rb_tree_tag,  
            tree_order_statistics_node_update> oset; 

// order_of_key (k) : Number of items strictly smaller than k .
// find_by_order(k) : K-th element in a set (counting from zero).

#define in input_int()
#define ins input_string()
bool sb(int a,int i){return (a&(1LL<<i))>0;}
int p2(int a){return (1LL<<a);}
int input_int(){int a;cin>>a;return a;}
string input_string(){string s;cin>>s;return s;}
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};



int n,m,k,a,b,c,d,x,y,arr[N];
string s;
void solve()
{
    set<int>dc[N];
    cin>>s;
    //cout<<s;nl;
    n=s.size();

    forn(i,0,n-1)
    {
        dc[s[i]-'a'].insert(i);
    }

    int odds=0;
    forn(i,0,25)
    {
        if(dc[i].size()%2)odds++;
    }

    if(odds>1)
    {
        cout<<-1;
        return;
    }
    if(n%2!=odds)
    {
        cout<<-1;
        return;
    }


    oset bc;
    forn(i,0,n-1)bc.insert(i);
    int ans=0;
    while(bc.size()>1)
    {   
        int ta=MOD,val=-1;
        forn(i,0,25)
        {
            if(dc[i].size()>1)
            {
                int a=*dc[i].begin(),b=*dc[i].rbegin();
                int at=bc.order_of_key(a)+bc.size()-bc.order_of_key(b+1);
                if(ta>at)
                {
                    ta=at;
                    val=i;
                }
            }
        }
        ans+=ta;
        int a=*dc[val].begin(),b=*dc[val].rbegin();
        bc.erase(a);
        bc.erase(b);
        dc[val].erase(a);
        dc[val].erase(b);
    }

    cout<<ans;    











}


signed main() 
{

    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); 
    int t = 1;
    //cin>>t;
    forn(i,1,t)
    {
        //cout<<":Case #"<<i<<": ";
        solve();
        nl;
    }



    return 0;

}
//       clang++ c.cpp ; ./a.out < a.txt ;  

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

#define int 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; }

int n, m, q;
int a[100], b[100], c[100], d[100];

int tmp[100];
int f(){
	int ans = 0;
	for(int i = 0;i < q;i++){
		if(tmp[b[i]-1] - tmp[a[i]-1] == c[i]) ans += d[i];
	}
	return ans;
}

int dfs(int i, int cnt){
	if(cnt == n) return f();
	if(i == m){
		return 0;
	}

	int ans = dfs(i+1, cnt);
	tmp[cnt] = i+1;
	chmax(ans, dfs(i, cnt+1));
	return ans;
} 

signed main(){
	cin >> n >> m >> q;

	for(int i = 0;i < q;i++){
		cin >> a[i] >> b[i] >> c[i] >> d[i];
	}

	cout << dfs(0, 0) << endl;

	return 0;
}


Measured memory_bytes: 3600
A=[]
counter=0
sum=0
while True:
    N=int(input())
    if N==0:
        for i in range(len(A)):
            print(A[i])
        break
    else:
        for i in range(1,N):
            j=i
            while sum<N:
                sum+=j
                j+=1
            if sum==N:
                counter+=1
            sum=0
        A.append(counter)
        counter=0



Measured memory_bytes: 5604
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

#define rep(i, N) for (int i = 0; i < N; i++)
#define pb push_back

ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

bool owari = false;

bool f(vector<int> a) {
	string s, t;
	for (int x: a) {
		s.pb(".#"[x>>0 & 1]);
		t.pb(".#"[x>>1 & 1]);
	}
	cout << s << endl;
	cout << t << endl;
	string ans; cin >> ans;
	if (ans == "end") owari = true;
	return ans == "T";
}

int main() {
	int N; cin >> N;
	vector<int> a;
	bool unko = false;
	for (;;) {
		int x;
		for (x = 0; x < 4; x++) {
			if (unko) a.insert(a.begin(), x);
			else a.pb(x);
			bool ans = f(a);
			if (owari) return 0;
			if (ans) break;
			if (unko) a.erase(a.begin());
			else a.pop_back();
		}
		if (x == 4) unko = true;
	}
}


Measured memory_bytes: 596
x, y, a, b, c = map(int, input().split())
p =list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
p = sorted(p)
q = sorted(q)

p = p[(len(p)-x):]
q = q[(len(q)-y):]
r = r + p
r = r + q
r = sorted(r)
print(sum(r[(len(r)-x-y):]))


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

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;
const long long MOD = (long long)1e9 + 7;

int pop_count(long long bits){
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int calc1(int cnt, string x){
    int res = 0;
    for (int i = 0; i < x.size(); i++){
        res <<= 1;
        if(x[i] == '1'){
            res += 1;
        }
        res %= cnt;
    }
    return res;
}
int calc2(int a){
    if(a == 0){
        return 0;
    }
    int res = 0;
    res = calc2(a % pop_count(a)) + 1;
    return res;
}

int main(){
    int n;
    string x;
    cin >> n >> x;
    int cnt = 0;
    for(int i = 0; i < n; i++){
        if(x[i] == '1'){
            cnt++;
        }
    }
    int r0 = cnt != 1 ? calc1(cnt - 1, x) : 0;
    int r1 = calc1(cnt + 1, x);
    vector<int> ans(n);
    int t0 = 1, t1 = 1;
    for(int i = n - 1; i >= 0; i--){
        int a;
        if(x[i] == '0'){
            a = r1 + t1;
            a %= cnt + 1;
            ans[i] = 1 + calc2(a);
        }else if(cnt == 1){
            ans[i] = 0;
        }else{
            a = r0 - t0 + cnt - 1;
            a %= cnt - 1;
            ans[i] = 1 + calc2(a);
        }
        if(cnt != 1){
            t0 <<= 1;
            t0 %= cnt - 1;
        }
        t1 <<= 1;
        t1 %= cnt + 1;
    }
    for(int i = 0; i < n; i++){
        cout << ans[i] << endl;
    }
    return 0;
}


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

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

#define X() real()
#define Y() imag()
#define x(p) (p).X()
#define y(p) (p).Y()
#define SZ(P) (int)(P.size())
#define curr(P, i) P[(i)%SZ(P)]
#define next(P, i) P[(i+1)%SZ(P)]
#define prev(P, i) P[(i+SZ(P)-1)%SZ(P)]?´

using D = double;
using P = complex<D>;
namespace std {
  bool operator < (const P& a, const P& b) {
    return x(a) != x(b) ? x(a) < x(b) : y(a) < y(b);
  }
}
D dot(const P& a, const P& b) {
  return x(conj(a)*b);
}
D cross(const P& a, const P& b) {
  return y(conj(a)*b);
}
int ccw(P a, P b, P c) {
  b -= a;
  c -= a;
  if(cross(b, c) > 0) return +1;
  if(cross(b, c) < 0) return -1;
  if(dot(b, c) < 0) return +2;
  if(norm(b) < norm(c)) return -2;
  return 0;
}

struct L : public vector<P> {
  L() {}
  L(const P& a, const P& b) {
    push_back(a);
    push_back(b);
  }
};

const D EPS = 1e-8;



bool interSP(const L& l, const P& p) {
  return abs(l[0]-p) + abs(l[1]-p) - abs(l[0]-l[1]) < EPS;
}
bool interSS(const L& s, const L& t) {
  return ccw(s[0], s[1], t[0]) * ccw(s[0], s[1], t[1]) <= 0 &&
    ccw(t[0], t[1], s[0]) * ccw(t[0], t[1], s[1]) <= 0;
}
P proj(const L& s, const P& p) {
  P v = s[0] - s[1];
  D t = dot(p-s[0], v) / norm(v);
  return s[0] + t*v;
}
D distSP(const L& s, const P& p) {
  P r = proj(s, p);
  if(interSP(s, r)) return abs(r-p);
  return min(abs(s[0]-p), abs(s[1]-p));
}
D distSS(const L& s, const L& t) {
  if(interSS(s, t)) return 0.0;
  return min({distSP(s, t[0]), distSP(s, t[1]), distSP(t, s[0]), distSP(t, s[1])});
}
using G = vector<P>;
struct C{
  P p;
  D r;
};
bool include(const C& c, const P& p) {
  return abs(c.p - p) < c.r - EPS;
}
bool isContain(const G& g, const P& p) {
  bool in = false;
  rep(i, g.size()) {
    P a = curr(g, i) - p, b = next(g, i) - p;
    if(y(a) > y(b)) swap(a, b);
    if(y(a) <= 0 && 0 < y(b)) {
      if(cross(a, b) < 0) in = !in;
    }
    if(cross(a, b) == 0 && dot(a, b) <= 0) return true;
  }
  return in;
}

int main() {
  cout << fixed << setprecision(20);
  int n;
  while(cin >> n && n) {
    L l;
    {
      D xa, ya, xb, yb;
      cin >> xa >> ya >> xb >> yb;
      l = L{P{xa, ya}, P{xb, yb}};
    }
    const D INF = 1e18;
    vector<D> d, h;
    bool flag = true;
    rep(i, n) {
      D xa, ya, xb, yb, hh;
      cin >> xa >> ya >> xb >> yb >> hh;
      G g;
      g.push_back({xa, ya});
      g.push_back({xa, yb});
      g.push_back({xb, yb});
      g.push_back({xb, ya});
      reverse(g.begin(), g.end());
      if(isContain(g, l[0]) || isContain(g, l[1])) flag = false;
      D dist = 1e18;
      rep(i, 4) {
	dist = min(dist, distSS(l, L{curr(g, i), next(g, i)}));
	if(interSS(l, L{curr(g, i), next(g, i)})) {
	  flag = false;
	}
      }
      d.push_back(dist);
      h.push_back(hh);
    }
    if(!flag) {
      cout << 0 << endl;
      continue;
    } 
    D ans = 1e18;
    rep(i, n) {
      if(d[i] < h[i]) ans = min(ans, d[i]);
      else ans = min(ans, (d[i]*d[i]+h[i]*h[i])/(2.0*h[i]));
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 3288
#include <bits/stdc++.h>
#define int LL
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,b,a) for(int i=b;i>=a;i--)
#define For(i,a,b) for(int i=a;i<=b;i++)
#define Forenska(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define sqr(x) ((x)*(x))
#define lowbit(x) ((x)&(-x))
#define GREATER(x) x,vector<x>,greater<x>
#define randIn(L,R) (((LL)rand()*rand())%(R-L)+L)
#define __lcm(a,b) ((a)/__gcd(a,b)*(b))
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pLL;
typedef vector<int> vec;
typedef vector<LL> vecL;
typedef vector<pii> vecP;
typedef vector<pLL> vecPL;
typedef vector<string> vecS;
typedef vector<vec> mat;
typedef complex<double> point;
const long double PI=3.14159265358979323846264338327950288419716939937510582097;
const LL INFLL=0x3f3f3f3f3f3f3f3f;
const int INF=0x3f3f3f3f;
const long double EPS=1e-10;
int read()
{
    int x=0;
    char ch=' ';
    bool flag=false;
    while(ch<'0' || ch>'9')
    {
        if(ch=='-')flag=true;
        ch=getchar();
    }
    while(ch>='0' && ch<='9')
    {
        x=(x<<3)+(x<<1)+ch-'0';
        ch=getchar();
    }
    return flag?-x:x;
}
int n,m;
const int MAX_N=100005;
int A[MAX_N];
map <int,int> sum;
signed main()
{
	cin>>n>>m;
	rep(i,0,n)cin>>A[i];
	int res=0,ans=0;
	rep(i,0,n)
	{
		res+=A[i];
		res%=m;
		ans+=sum[res];
		sum[res]++;
	}
	cout<<ans+sum[0]<<endl;
	return 0;
}



Measured memory_bytes: 4992
#include<iostream>

using namespace std;

int main(void)

{
    unsigned long long int x, n = 100, interest, balance = 100, counter = 0;
    cin>>x;
    while(balance < x){
        interest = balance*0.01;
        balance += interest;
        counter++;
    }
    cout<<counter<<"\n";
    return 0;
}

Measured memory_bytes: 3196
m,k=map(int,input().split())
if k>2**m-1:
    print(-1)
elif m==1 and k==1:
    print(-1)
else:
    a,b=0,0
    i=0
    while k>0:
        if k%2:
            a+=2**i
        k//=2
        i+=1
    #print(a)
    if a==0:
        ans=[]
        for i in range(2**m):
            ans.append(i)
            ans.append(i)
    else:
        ans=[0]*2**(m+1)
        ans[2**m-1]=b
        ans[-1]=a
        ans[2**m]=a
        ans[0]=b
        s={a,b}
        idx=0
        #print(ans)
        for i in range(2**m):
            if i not in s:
                ans[idx+1]=i
                ans[-2-idx]=i
                idx+=1
    print(*ans)

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

int main() {
	int N, Y, x, y, z, pair = 0;
	cin >> N >> Y;
	for (x = 0; x <= N && 10000 * x <= Y; x++) {
	    for (y = 0; y <= N - x; y++) {
	        z = N - x - y;
	        if (10000 * x + 5000 * y + 1000 * z == Y) {
	            cout << x << " " << y << " " << z;
	            pair++;
	            break;
	        }
	    }
       	if (10000 * x + 5000 * y + 1000 * z == Y) {
          	break;
        }
	}
  	if (10000 * N == Y) cout << N << " 0 0";
	else if (pair == 0) cout << "-1 -1 -1";
	return 0;
}


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

using namespace std;

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  // freopen("input.txt", "r", stdin);
  // freopen("output.txt", "w", stdout);

  int t;
  int l;
  cin>>t>>l;
  vector <string> v;
  while(t--){
    string s;
    cin>>s;
    v.push_back(s);
  }

  sort(v.begin(), v.end());
  for(string s: v){
    cout<<s;
  }

  return 0;
}

Measured memory_bytes: 892
#include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
#include<string.h>
#include<iomanip>
using namespace std;

#define PI 3.14159265358979323846264338327950L

int main() {
	int N, A, max = 0;
	long long ans = 0;

	cin >> N;

	for (int ii = 0; ii < N; ii++) {
		cin >> A;
		if (ii == 0) {
			max = A;
			continue;
		}
		if (max > A) {
			ans += max - A;
		}
		else if (max < A) {
			max = A;
		}
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;

typedef long long ll;
#define fi first
#define se second
#define pb push_back

const int N = 20;
char s[N], t[N], u[N];

int main() {
    //ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int a, b;
    scanf("%s %s\n%d %d\n%s", s, t, &a, &b, u);
    int n = strlen(s), m = strlen(t), sz = strlen(u);
    if (sz == n && sz == m) {
        for (int i = 0; i < sz; i++) {
            if (s[i] != u[i]) {
                b--;
                goto con;
            }
        }
        a--;
    } else if (sz == n) {
        a--;
    } else {
        b--;
    }
    con:;
    printf("%d %d", a, b);
    return 0;
}


Measured memory_bytes: 3780
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

class Point{
public:
    double y, x;
    Point(double y0, double x0){
        y = y0;
        x = x0;
    }
    Point(){
        y = x = 0.0;
    }
    double cross(const Point& p) const{
        return x * p.y - y * p.x;
    }
    Point operator-(const Point& p) const{
        return Point(y - p.y, x - p.x);
    }
};

int main()
{
    for(;;){
        vector<Point> p(4);
        for(int i=0; i<4; ++i){
            char c;
            if(!(cin >> p[i].x >> c >> p[i].y))
                return 0;
            if(i < 3)
                cin >> c;
        }

        bool plus = true;
        bool minus = true;
        for(int i=0; i<4; ++i){
            Point p1 = p[(i+2)%4] - p[(i+1)%4];
            Point p2 = p[i] - p[(i+1)%4];
            if(p1.cross(p2) < 0)
                plus = false;
            else
                minus = false;
        }
        if(plus || minus)
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }
}

Measured memory_bytes: 0
#include <algorithm>
#include <functional>
#include <iostream>
#include <vector>

using namespace std;

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

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

    sort(a.begin(), a.end(), greater<long long>());

    long long a0 = 0, a1 = 0;
    for (int i = 0; i < n - 1; i++) {
        if (a[i] == a[i + 1] && a0 == 0) {
            a0 = a[i];
            i++;
        } else if (a[i] == a[i + 1]) {
            a1 = a[i];
            break;
        }
    }

    cout << (a0 * a1) << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>

using namespace std;
typedef long long ll;

struct Edge{
    ll next;
    ll id;
    Edge(ll next, ll id) : next(next), id(id) {}
};

vector<vector<Edge>> ns;
vector<bool> visited;
vector<bool> output;

bool solve(ll cur, ll parent){
    visited.at(cur) = true;
    ll count = 0;
    for(Edge e : ns.at(cur)){
        if(visited.at(e.next)){
            if(e.next != parent && !output.at(e.id)){
                cout << (cur + 1) << " " << (e.next + 1) << endl;
                output.at(e.id) = true;
                count++;
            }
        }else{
            if(!solve(e.next, cur)){
                cout << (cur + 1) << " " << (e.next + 1) << endl;
                output.at(e.id) = true;
                count++;
            }else{
                cout << (e.next + 1) << " " << (cur + 1) << endl;
                output.at(e.id) = true;
            }
        }
    }
    return (count % 2 == 1);
}

int main(){
    ll n, m;
    cin >> n >> m;

    ns.resize(n);
    for(ll i = 0; i < m; ++i){
        ll a, b;
        cin >> a >> b;
        a--; b--;
        ns.at(a).push_back(Edge(b, i));
        ns.at(b).push_back(Edge(a, i));
    }

    if(m % 2 == 1){
        cout << -1 << endl;
        return 0;
    }

    visited.resize(n, false);
    output.resize(m, false);
    solve(0, -1);
    return 0;
}


Measured memory_bytes: 19328
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		char[] s = sc.nextLine().toCharArray();
		char[] p = sc.nextLine().toCharArray();

		boolean flag = false;

		for (int i = 0; i < s.length; i++) {
			if (seretch(s, p)) {
				flag = true;
				break;
			} else {
				s = MoveCharRing(s);
			}
		}

		Print(flag);

	}

	static boolean seretch(char[] s, char[] p) {
		for (int si = 0; si + p.length <= s.length; si++) {
			int i = 0;
			if (s[si] == p[0]) {
				for (i = 1; i < p.length; i++) {
					if (s[si + i] != p[i]) {
						break;
					}
				}
				// System.out.println(i);
				if (i == p.length) {
					return true;
				}
			}
		}
		return false;

	}

	static char[] MoveCharRing(char[] c) {
		char work = c[0];
		for (int i = 1; i < c.length; i++) {
			c[i - 1] = c[i];
		}
		c[c.length - 1] = work;
		return c;
	}

	static void Print(boolean f) {
		if (f) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

}



Measured memory_bytes: 26236
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,n) for(int i=a;i<n;i++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INFL = 1e18;
const int INF = 1001001001; 
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
const int mod =1000000007;
int main(){
    int n,k;
    cin>>n>>k;
    string s;
    cin>>s;
    vi me;
    int sum =0;
    char now ='0';
    if(s[0]==now){
        me.push_back(0);
        me.push_back(0);
        }
    rep(i,n){
        if(now!=s[i]){
            me.push_back(sum);
            sum=1;
            now=s[i];
        }
        else sum++;
    }
    me.push_back(sum);
    vi ruiseki((int)me.size(),0);
    rep(i,me.size()){
        if(i==0)continue;
        ruiseki[i]=ruiseki[i-1]+me[i];
    }
    int ans =0;
    for(int  i = 0;i<ruiseki.size();i+=2){
        int right = i + k*2+1;
        if (right >= me.size()) right = (int)me.size() -1;
        ans = max(ans, ruiseki[right] - ruiseki[i]);
    }
    cout<<ans<<endl;
}


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

int N;
std::vector<int> A;

bool able(int);

int main()
{
	scanf("%d", &N);
	A.resize(N);
	for (auto& e: A) scanf("%d", &e);
	std::sort(A.begin(), A.end());

	int right{N}, left{-1};
	while (right - left > 1)
	{
		int mid{(left + right) / 2};
		if (able(mid)) right = mid;
		else left = mid;
	}
	printf("%d\n", N - right);

	return 0;
}

bool able(int begin)
{
	int64_t sum{A[begin]};
	for (int i{}; i < N; i++)
	{
		if (i == begin) continue;
		if (2 * sum < A[i]) return false;
		sum += A[i];
	}
	return true;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF = 1LL<<60;

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

ll LCM(ll a,ll b){
    return a / GCD(a,b) * b;
}

const int MOD = 1000000007;


int main() {
    int a,b; cin >> a >> b;
    int c = max(a+b,a-b);
    cout << max(c,a*b);
}


Measured memory_bytes: 256
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>

#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
#define ALL(X) X.begin(), X.end()
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef std::pair<LL,LL> PLL;//
typedef std::pair<int,int> PII;//
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)1e18+20;
const LD PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	int A;
	int MAX = 0;
	int sum = 0;
	for(int i=0;i<3;++i){
		cin >> A;
		sum += A;
		MAX = max(MAX,A);
	}
	cout << sum - MAX << endl;
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		final int D = sc.nextInt();
		final int G = sc.nextInt();
		
		int p[] = new int[D];
		int c[] = new int[D];
		for(int i = 0; i < D; i++) {
			p[i] = sc.nextInt();
			c[i] = sc.nextInt();
		}
		
		int answer = Integer.MAX_VALUE;
		boolean flag[] = new boolean[D];
		for(int i = 0; i < Math.pow(2, D); i++) {
			Arrays.fill(flag, true);
			int score = 0;
			int cnt = 0;
			for(int j = 0; j < D; j++) {
				if((1 & i >> j) == 1) {
					score += p[j] * (j + 1) * 100 + c[j];
					cnt += p[j];
					flag[j] = false;
				}
			}
			while(score < G) {
				boolean end_flag = false;
				if(score >= G) {
					break;
				}
				for(int k = D - 1; k >= 0; k--) {
					if(flag[k]) {
						int n = 0;
						while(n != p[k] && score < G) {
							score += (k + 1) * 100;
							cnt++;
							n++;
							if(n == p[k]) {
								score += c[k];
								flag[k] = false;
							}
						}
					}
					if(score >= G) break;
				}
			}
			answer = Math.min(answer, cnt);
		}
		System.out.println(answer);
	}
}


Measured memory_bytes: 23764
import java.util.Scanner;

public class Main{

	static int[][][] arrayFloor = new int[4][3][10];

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

		//??????????????????
		for(int k = 0; k < 4; k++) {
			for(int i = 0; i < 3; i++) {
				for(int j = 0; j < 10; j++) {
					arrayFloor[k][i][j] = 0;
				}
			}
		}

		for(int i = 0; i < A; i++) {

			int b = sc.nextInt();
			int f = sc.nextInt();
			int r = sc.nextInt();
			int v = sc.nextInt();

			switch(b) {
			case 1:
				calculate(b, f, r, v);
				break;

			case 2:
				calculate(b, f, r, v);
				break;

			case 3:
				calculate(b, f, r, v);
				break;

			case 4:
				calculate(b, f, r, v);
				break;
			}

		}

		for(int k = 0; k < 4; k++) {
			for(int i = 0; i < 3; i++) {
				for(int j = 0; j < 10; j++) {
					System.out.print(" "+arrayFloor[k][i][j]);
				}
				System.out.println("");
			}
			if(!(k == 3)) {
				System.out.println("####################");
			}
		}


	}
	public static void calculate(int b, int f, int r, int v) {

		if(arrayFloor[b-1][f-1][r-1] != 0) {
			arrayFloor[b-1][f-1][r-1] = arrayFloor[b-1][f-1][r-1] + v;
		}
		else {
			arrayFloor[b-1][f-1][r-1] = v;
		}
	}
}

Measured memory_bytes: 29880
import math

n, m = [int(v) for v in input().split()]

mod = 10 ** 9 + 7
if abs(n - m) >= 2:
    print(0)
elif n == m:
    ans = math.factorial(n) % mod
    ans = ans * ans * 2 % mod
    print(ans)
elif abs(n - m) == 1:
    if n < m:
        n, m = m, n
    dog = math.factorial(n) % mod
    mon = math.factorial(m) % mod
    ans = dog * mon % mod
    print(ans)

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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
from collections import deque
from fractions import gcd
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9 +7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#############
# Main Code #
#############

N = inputI()
l = inputIL()

ans = 0
for n in range(60):
  count_0 = 0
  count_1 = 0
  for i in l:
    if (pow(2,n)&i)>>n:
      count_1 += 1
    else:
      count_0 += 1
  ans = (ans + count_0*count_1*pow(2,n,MOD))%MOD
  
print(ans)

Measured memory_bytes: 119980
n = gets.chomp.split('')
min = n[0].to_i
if n[0] < n[1]
    puts (min+1).to_s * 3
elsif n[0] > n[1]
    puts min.to_s * 3
else
    if n[1] < n[2]
        puts (min+1).to_s * 3
    else
        puts min.to_s * 3
    end
end


Measured memory_bytes: 1788
s=gets.chomp.to_s
t=gets.chomp.to_s
n=s.length


def rotation(s,n)
   last = s.slice(n-1)
   sc=s.chop
   return  last+sc
end

n.times do
  if s == t
      puts "Yes"
      exit
  end
  s=rotation(s,n)
end

puts "No"

Measured memory_bytes: 1916
mx,my;//}bvTCY
//[7]ÆµÄ¢éÌÍA[0]ÍX^[gA[6]ÍS[A[1]`[5]Íp`N
pn[7];//p`N
px[7][1000],py[7][1000];//p`NÌÀW
M[5][7][1000];//Å¬Ú®
a0;
Calc(a1,a2){
	int n1,n2,m,mm;
	//printf("a0=%d Calc(%d,%d)\n",1+a0,a1,a2);
	for(n2=0;n2<pn[a2];n2++){
		mm=1e9;
		for(n1=0;n1<pn[a1];n1++){
			m=M[a0][a1][n1]+abs(px[a1][n1]-px[a2][n2])+abs(py[a1][n1]-py[a2][n2]);
			if(m<mm)
				mm=m;
		}
		M[a0][a2][n2]=mm;
		//printf("M(a0=%d,%d,%d)=%d\n",1+a0,a2,n2,mm);
	}
}
main(){
	int x,y,c,a,am;
	for(;scanf("%d%d\n",&mx,&my),mx;){
		memset(pn,0,sizeof(pn));
		for(y=0;y<my;y++){
			for(x=0;x<mx;x++){
				c=getchar();
				if(c>='1'){
					if(c<='5')
						a=c-'0';
					else if(c=='S')
						a=0;
					else if(c=='G')
						a=6;
					px[a][pn[a]]=x;
					py[a][pn[a]]=y;
					pn[a]++;
				}
			}
			getchar();
		}
		am=0;
		for(a0=0;a0<5;a0++){
			M[a0][0][0]=0;
			Calc(0,1+(a0+1)%5);
			for(a=0;a<3;a++)
				Calc(1+(a0+a+1)%5,1+(a0+a+2)%5);
			Calc(1+(a0+4)%5,6);
			if(M[a0][6][0]<M[am][6][0])
				am=a0;
		}
		printf(M[am][6][0]!=1e9?"%d %d\n":"NA\n",1+am,M[am][6][0]);
	}
	{int n;for(n=1000000;n--;)getchar();}//delay(0.52s)
	exit(0);
}

Measured memory_bytes: 596
while True:
    m,f,r=map(int,input().split())
    if m==-1 and f==-1 and r==-1:
          break
    else:
        if m==-1 or f==-1:
            print("F")
        elif m+f>=80:
            print("A")
        elif m+f>=65 and m+f<80:
            print("B")
        elif m+f>=50 and m+f<65:
            print("C")
        elif m+f>=30 and m+f<50:
            if r>=50:
                print("C")
            else:
                print("D")
        else:
            print("F")
    
    


Measured memory_bytes: 5592
from collections import deque

n,k = map(int,input().split())
D =list(map(int,input().split()))
ans = 0

for toridasukaisu in range(min(k,n)+1):#0~min(k,n)回取り出す
    for i in range(toridasukaisu+1):
        value = []#取り出したもののそれぞれの価値
        l = i#左からi回取り出し
        r = toridasukaisu - i#右から取り出す回数-i回取り出す
        for j in range(l):
            value.append(D[j])
        for j in range(r):
            value.append(D[-1-j])

        value.sort()
        suterukazu = 0
        suterukaisu = k - toridasukaisu
        for e in value:
            if suterukazu >= suterukaisu:
                break
            if e < 0:
                suterukazu += 1
            
        ans = max(sum(value[suterukazu:]),ans)
        
print(ans)               


            


    




Measured memory_bytes: 3316
#include <iostream>
#include "stdio.h"

using namespace std;

int main()
{
	int c[5];
	int i = 0;
	int j = 0;
	int temp = 0;

	for(i=0;i<5;i++)
	{
		cin >> c[i];
	}

	for(i=0;i<4;i++)
	{
		for(j=0;j<4;j++)
		{
			if(c[j]<c[j+1])
			{
				temp = c[j];
				c[j] = c[j+1];
				c[j+1] = temp;
			}
		}


	}
	for(i=0;i<5;i++)
	{
		if(i<4)
		{
			cout << c[i] << " ";
		}else{cout << c[i] << endl;}
	}

}

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

int main(){
  int N, M, cnt1, cnt2;
  cnt1=0;
  cnt2=0;
  string U[256], T[256];
  
  cin>>N;
  for(int i=0;i<N;i++) cin>>U[i];

  cin>>M;
  for(int j=0;j<M;j++) cin>>T[j];      

  for(int j=0;j<M;j++){
    for(int i=0;i<N;i++){
      if(U[i] == T[j]) cnt1++;
      else cnt2++;
    }
    if(cnt2 == N) cout<<"Unknown"<<" "<<T[j]<<endl;
    if(cnt1 % 2 == 1 && cnt2 != N) cout<<"Opened by"<<" "<<T[j]<<endl;
    if(cnt1 % 2 == 0 && cnt2 != N) cout<<"Closed by"<<" "<<T[j]<<endl;
    cnt2=0;
   
  }

  return 0;
}
	  
			 



Measured memory_bytes: 3204
import random
D = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for i in range(D)]
t = [int(input()) for i in range(D)]

A = [0]*26

ret = 0
for i in range(D):
    ret += s[i][t[i]-1]
    # print(ret)
    A[t[i]-1] = i+1
    for j in range(26):
        ret -= c[j] * (i+1 - A[j])
    print(ret)


Measured memory_bytes: 9808
#JMD
#Nagendra Jha-4096

 
import sys
import math

#import fractions
#import numpy
 
###File Operations###
fileoperation=0
if(fileoperation):
    orig_stdout = sys.stdout
    orig_stdin = sys.stdin
    inputfile = open('W:/Competitive Programming/input.txt', 'r')
    outputfile = open('W:/Competitive Programming/output.txt', 'w')
    sys.stdin = inputfile
    sys.stdout = outputfile

###Defines...###
mod=1000000007
 
###FUF's...###
def nospace(l):
    ans=''.join(str(i) for i in l)
    return ans
 
 
 
##### Main ####
t=1
for tt in range(t):
    #n=int(input())
    #n,k,s= map(int, sys.stdin.readline().split(' '))
    a=list(map(int,sys.stdin.readline().split(' ')))
    a.sort()
    if(a[0]==1 and a[1]==4 and a[2]==7 and a[3]==9):
    	print("YES")
    else:
    	print("NO")
    
    
#####File Operations#####
if(fileoperation):
    sys.stdout = orig_stdout
    sys.stdin = orig_stdin
    inputfile.close()
    outputfile.close()

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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t,n,a,b;
	t = 1;
	while(t--) {
	 cin >> n >> a >> b;
	 if(a <= n && b <= n)
	  cout << "delicious" << endl;
	 else if(abs(a - b) <= n)
	  cout << "safe" << endl;
	 else
	  cout << "dangerous" << endl;
	}
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
template<class T> inline bool chmax(T& a, T b){ if(a<b){ a=b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b){ if(a>b){ a=b; return 1; } return 0; }


signed main()
{
    int N,W; cin>>N>>W;
    vector<int> w(N),v(N);
    for(int i=0;i<N;i++){
        cin>>w[i]>>v[i];
    }
    
    vector<vector<int> > dp(N+1,vector<int>(W+1));
    for(int i=0;i<=W;i++) dp[0][i]=0;

    for(int i=0;i<N;i++){
        for(int j=0;j<=W;j++){
            chmax(dp[i+1][j],dp[i][j]);
            if(j+w[i]<=W){
                chmax(dp[i+1][j+w[i]],dp[i][j]+v[i]);
            }
        }
    }
    cout<<dp[N][W]<<endl;
}


Measured memory_bytes: 80256
import qualified Data.ByteString.Char8 as BC
import Data.Maybe (fromJust)
import Data.List

main = BC.getContents >>= print . solve . map (fst . fromJust . BC.readInt) . BC.words

solve (n:as) = solve2 0 $ reverse $ drop n $ sort as

solve2 cnt [] = cnt
solve2 cnt (_:a:as) = solve2 (cnt + a) as

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b, c, d, e, k;
    cin >> a >> b >> c >> d >> e >> k;
    
    if (e - a > k)
        cout << ":(\n";
    else
        cout << "Yay!\n";
    
    return 0;
}


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

using namespace std;

int n;
int m[523];

int main()
{
	cin >> n;
	n *= 2;
	for (int i = 0; i < n; i++) cin >> m[i];
	sort(m, m + n);
	reverse(m, m + n);
	int ans = 0;
	for (int i = 1; i < n; i+=2)
		ans += m[i];
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 256
package main

import (
        "fmt"
        "math"
)

func solution(x int) int {
        if x == 1 {
                return 1
        }
        b := int(math.Floor(math.Sqrt(float64(x))))
        out := -1 << 31
        for i := b; i > 1; i-- {
                for j := 2; int(math.Pow(float64(i), float64(j))) <= x; j++ {
                        out = max(out, int(math.Pow(float64(i), float64(j))))
                }
        }
        return out
}

func max(x, y int) int {
        if x > y {
                return x
        }
        return y
}

func main() {
        var x int
        fmt.Scan(&x)
        fmt.Println(solution(x))
}

Measured memory_bytes: 512
MAX_TIME = 10

N = int(input())

F = [int(input().replace(" ", ""), 2) for i in range(N)]

P = [[int(j) for j in input().split()] for i in range(N)]


def main():
    # 1 から 2 ** MAX_TIME - 1
    # 営業時間帯 最低でも ひとつの時間帯
    # 選択する時間帯を2進法で表現したもの

    # F[店のインデックス]
    # 他の店
    # 選択する時間帯を2進法で表現したもの

    # P[店のインデックス][合致した時間帯の数]
    # 利益
    print(max(sum(
        [p[bin(f & i).count("1")] for f, p in zip(F, P)])
        for i in range(1, 2 ** MAX_TIME)))

    return


main()


Measured memory_bytes: 3064
import java.util.*;

public class Main {
	static final long MODULO = 1_000_000_000 + 7;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		int C = sc.nextInt() - 1;
		int T = sc.nextInt();
		int[] a = new int[K];
		int[] b = new int[K];
		int[] t = new int[K];
		for (int i = 0; i < K; ++i) {
			a[i] = sc.nextInt();
			b[i] = sc.nextInt();
			t[i] = sc.nextInt();
		}
		long[][][] A = new long[6][N][N];
		for (int i = 0; i < K; ++i) {
			for (int j = 0; j < b[i]; ++j) {
				A[t[i]][j][(a[i] - 1) + j] += 1;
			}
			for (int j = 0; j < a[i] - 1; ++j) {
				A[t[i]][b[i] + j][j] += 1;
			}
			for (int j = a[i] + b[i] - 1; j < N; ++j) {
				A[t[i]][j][j] += 1;
			}
		}
		long[][] dp = new long[6][N];
		dp[0][C] = 1;
		for (int i = 1; i <= 5; ++i) {
			for (int j = 0; j < i; ++j) {
				dp[i] = addVec(dp[i], mulVec(A[i - j], dp[j]));
			}
		}
		long[] v = new long[N * 5];
		for (int i = 0; i < 5; ++i) {
			for (int j = 0; j < N; ++j) {
				v[j + i * N] = dp[i][j];
			}
		}
		long[][] mx = new long[5 * N][5 * N];
		for (int i = N; i < 5 * N; ++i) {
			mx[i - N][i] = 1;
		}
		for (int i = 1; i <= 5; ++i) {
			for (int j = 0; j < N; ++j) {
				for (int k = 0; k < N; ++k) {
					mx[4 * N + j][N * (5 - i) + k] = A[i][j][k];
				}
			}
		}

		v = mulVec(pow(mx, T), v);
		System.out.println(v[0]);
	}

	static long[][] mul(long[][] a, long[][] b) {
		int n = a.length;
		long[][] ret = new long[n][n];
		for (int i = 0; i < n; ++i) {
			for (int j = 0; j < n; ++j) {
				for (int k = 0; k < n; ++k) {
					ret[i][j] += a[i][k] * b[k][j] % MODULO;
					ret[i][j] %= MODULO;
				}
			}
		}
		return ret;
	}

	static long[] mulVec(long[][] a, long[] v) {
		int n = v.length;
		long[] ret = new long[n];
		for (int i = 0; i < n; ++i) {
			for (int j = 0; j < n; ++j) {
				ret[i] += a[i][j] * v[j] % MODULO;
				ret[i] %= MODULO;
			}
		}
		return ret;
	}

	static long[] addVec(long[] a, long[] b) {
		int n = a.length;
		long[] ret = new long[n];
		for (int i = 0; i < n; ++i) {
			ret[i] = (a[i] + b[i]);
			if (ret[i] >= MODULO)
				ret[i] -= MODULO;
		}
		return ret;
	}

	static long[][] pow(long[][] a, long n) {
		int len = a.length;
		long[][] ret = new long[len][len];
		for (int i = 0; i < len; ++i)
			ret[i][i] = 1;
		for (; n > 0; n >>= 1, a = mul(a, a)) {
			if (n % 2 == 1) {
				ret = mul(ret, a);
			}
		}
		return ret;
	}

}

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

using namespace std;

int main()
{
    vector<long long> sum;
    int n;
    cin >> n;
    long long l;
    cin >> l;
    sum.push_back(l);
    for(int i = 1; i < n; i++){
        long long in;
        cin >> in;
        sum.push_back(sum[i -1] + in);
    }
    long long ans = 0;
    sort(sum.begin(), sum.end());
    for(int i = 0; i < n; i++){
    //    cout << sum[i] << endl;
}
    for(long long i = 0; i < n; ){
        long long k = 0;
        while(i + k < n){
            if(sum[i] != sum[i + k]){
                break;
            }
            k++;
        }
        ans += ((k) * (k - 1)) / 2;
        if(sum[i] == 0){
            ans += k;
        }
        i = i + k;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 2420
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


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


	int N;
	cin >> N;
	int A[20], C[20];

	int kotae = 0;
	rep(i, N) cin >> A[i];
	rep(i, N) {
		int b;
		cin >> b;
		kotae += b;
	}
	rep(i, N - 1) cin >> C[i];

	rep(i, N - 1) {
		if (A[i] + 1 == A[i + 1]) kotae += C[A[i] - 1];
	}

	co(kotae);

	Would you please return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main()
{
    int n,k;
    cin >> n >> k;
    
    vector<int> snake(n);
    for(int i=0; i<n; i++) {
        cin >> snake[i];
    }
    
    sort(snake.rbegin(), snake.rend());
    
    int sum =0 ;
    for(int i=0; i<k; i++) {sum += snake[i];}
    cout << sum << endl;
    
    return 0;
}

Measured memory_bytes: 256
//package atcoder.beginnercontest.r179;

import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    try (Scanner sc = new Scanner(System.in)) {
      String s = sc.next();
      if (s.endsWith("s"))
        s += "e";
      System.out.println(s + "s");
    }
  }
}


Measured memory_bytes: 38580
#!/usr/bin/env ruby

n = gets.chomp.to_i

dict = {}
n.times do
  action, str = gets.chomp.split
  str = str.tr('ACTG', '1234').to_i
  case action
  when 'insert'
    dict[str] = 1
  when 'find'
    puts dict[str] ? 'yes' : 'no'
  end
end

Measured memory_bytes: 26136
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int k = sc.nextInt();
    int x = sc.nextInt();
    if (k * 500 >= x) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
}


Measured memory_bytes: 21716