akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, int> psi;
#define rep(i, n) for(ll i = 0;i < n;i++)

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

  int A, B, C, D, E, F;
  cin >> A >> B >> C >> D >> E >> F;

  int ans_s = 0;
  int ans_w = A*100;
  rep(a, 31) rep(b, 31) rep(c, 101) rep(d, 101) {
    int w = 100*A*a+100*B*b;
    int s = C*c+D*d;
    if (w == 0 || s*100 > E*w || s+w > F) continue;
    if (s*(ans_s+ans_w) > ans_s*(s+w)) {
      ans_s = s;
      ans_w = w;
    }
  }

  printf("%d %d\n", ans_s+ans_w, ans_s);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,s=0,aa;
    cin>>n;
    int p=0;
    while(n--)
    {
        cin>>aa;
        s+=aa;
        p=max(p,aa);
    }
    int u=s-p;
    if(u>p)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
A= list(map(int,input().split()))
c = 0
for i in A:
    if i % 2 == 0:
        if i % 3 !=0 and i % 5 !=0:
            print('DENIED')
            break
    c += 1
if (N == c):
    print('APPROVED')

Measured memory_bytes: 2940
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        for (int i = 1 ; i <= 3500 ; i++) {
            for (int j = 1 ; j <= 3500 ; j++) {
                if (4 * i * j - (long) n * (i + j) > 0 && (long) n * i * j % (4 * i * j - n * (i + j)) == 0) {
                    System.out.println(i + " " + j + " " + (long) n * i * j / (4 * i * j - n * (i + j)));
                    return;
                }
            }
        }

        System.out.println("NG");



    }
}


Measured memory_bytes: 23252
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(readline())
A = [0] + list(map(int,read().split()))

for n in range(N//2,0,-1):
    A[n] = sum(A[n::n])&1

I = [i for i,x in enumerate(A) if x]

print(len(I))
if len(I) > 0:
    print(' '.join(map(str,I)))

Measured memory_bytes: 18428
#include <cstdio>
int card[201],_card[201];
int main() {
	int n,m;
	scanf("%d",&n);
	for(int i=1;i<=2*n;i++)card[i]=i;
	scanf("%d",&m);
	for(int i=0;i<m;i++) {
		int k;
		scanf("%d",&k);
		if(k==0) {
			for(int i=1;i<=2*n-1;i+=2) {
				int x=i/2+1;
				_card[i]=card[x];
				_card[i+1]=card[x+n];
			}
		}else {
			for(int i=k+1;i<=2*n;i++)
				_card[i-k]=card[i];
			for(int i=1;i<=k;i++)
				_card[i+(2*n-k)]=card[i];
		}
		for(int i=1;i<=2*n;i++)
			card[i]=_card[i];
	}
	for(int i=1;i<=2*n;i++)
		printf("%d\n",card[i]);
}

Measured memory_bytes: 1028
#include <bits/stdc++.h>
using namespace std;
 
typedef long long LL;
typedef pair<int, int> pii;
 
#define fst first
#define snd second
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define REP(i, a, b)  for(int i = (a), i##end = (b); i < i##end; ++i)
#define DREP(i, a, b) for(int i=(a-1), i##end = (b); i >=i##end; --i)
 
template <typename T> bool chkmax(T& a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> bool chkmin(T& a, T b) { return a > b ? a = b, 1 : 0; }
 
const int N = 2000;
const int oo = 0x3f3f3f3f;
 
template<typename T> T read() {
    T n(0), f(1);
    char ch = getchar();
    for(;!isdigit(ch); ch = getchar()) if(ch == '-') f = -1;
    for(; isdigit(ch); ch = getchar()) n = n * 10 + ch - 48; 
    return n * f;
}

int f[N + 5][2];
int n, a, all = 1, none = 1;

int main() {
#ifdef Wearry
    freopen("data.txt", "r", stdin);
    freopen("ans.txt", "w", stdout);
#endif 

    scanf("%d", &n);
    for(int i = 1; i <= n; ++i) {
        all *= 3;
        scanf("%d", &a);
        if(!(a & 1)) none *= 2;
    }
    printf("%d\n", all - none);
    return 0;
}


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

constexpr int inf = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3fLL;

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

    int h, w; cin >> h >> w;
    vector<string> ans;
    for (int i = 0; i < h; i++) {
        string s; cin >> s;
        cout << s << endl;
        cout << s << endl;
    }
    return 0;
}


Measured memory_bytes: 256
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
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

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

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


	int N = getint();
	int A[100001];

	int k = N;
	A[N] = -1;

	rep(i, N) {
		int a = getint();
		auto itr = lower_bound(A + k, A + N + 1, a) - 1;
		*itr = a;
		if (itr == A + k) {
			k--;
			A[k] = -1;
		}
	}

	printf("%d", N - k);

	Would you please return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <cmath>
#include <vector>
#include <queue>
#include <map>
#include <stack>
#include <set>
#include <algorithm>
#include <fstream>
#include <deque>
using namespace std;

#define mp make_pair
#define pb push_back
#define ll long long

stack<char> st;
string s;

int main(){

	cin >> s;
	int n = s.size();

	for(int i=0;i<n;i++){
		char a = s[i];
		if(a=='T'){
			if(!st.empty()){
				if(st.top()=='S'){
					st.pop();
				}else{
					st.push(a);
				}
			}else{
				st.push(a);
			}
		}else if(a=='S'){
			st.push(a);
		}
	}

	cout << st.size();

	return 0;
}

Measured memory_bytes: 644
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int []A = new int[n];
		for(int i = 0; i < n; i++){
			A[i] = sc.nextInt();
			
		}
		
		for(int i = 0; i < n; i++){
			int v = A[i];
			int j = i - 1;
			while((j >= 0) && (A[j] > v)){
				A[j+1] = A[j];
				j--;
			}
			A[j+1] = v;
			
			for(int k = 0; k < n; k++){
				if(k > 0)System.out.print(" ");
				System.out.print(A[k]);
			}
			System.out.println();
		}
	}
}

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

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

typedef long long ll;
typedef pair<int, int> P;

#define MAX 100005
#define INF 1001001001

int main(int, char**)
{
  multiset<int> a;
  int q;
  cin >> q;
  vector<int> ans;
  rep(i,q) {
    int command; cin >> command;
    if (command == 0) {
      int x; cin >> x;
      a.insert(x);
      ans.push_back(a.size());
    } else if (command == 1) {
      int x; cin >> x;
      ans.push_back(a.count(x));
    } else if (command == 2) {
      int x; cin >> x;
      a.erase(x);
    } else if (command == 3) {
      int l, r; cin >> l >> r;      
      auto itrl = a.lower_bound(l);
      auto itrr = a.upper_bound(r);
      for (auto itr = itrl; itr != itrr; itr++)
      ans.push_back(*itr);
    }
  }

  for (auto a : ans) cout << a << endl;

  return 0;
}



Measured memory_bytes: 16144
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {
  
  int A,B,C;
  cin>>A>>B>>C;
  
  bool ans=false;
  
  if(A+B>=C){
    ans=true;
  }
  
  if(ans){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 3596
#include <iostream>
#include <queue>
#include <vector>
#include <cstring>
using namespace std;

class Edge{
public:
  int to, cost;

  Edge(){}
  Edge(int to, int cost):
    to(to), cost(cost){}
};

class State{
public:
  int id, rem, cost;

  State(){}
  State(int id, int rem, int cost):
    id(id), rem(rem), cost(cost){}

  bool operator<(const State &st)const{
    return cost > st.cost;
  }
};

int n, m, l, k, a, h;
vector<Edge> t[102];
bool closed[102][102];
bool f[102];

void solve(){
  priority_queue<State> open;
  memset(closed, 0, sizeof(closed));
  open.push(State(a, m, 0));

  while(!open.empty()){
    State st = open.top();
    open.pop();

    if(closed[st.id][st.rem]) continue;
    closed[st.id][st.rem] = true;

    if(st.id == h){
      cout << st.cost << endl;
      return ;
    }

    //テ・ツ崢榲・ツセツゥ
    if(f[st.id] && st.rem + 1 <= m){
      open.push(State(st.id, st.rem + 1, st.cost + 1));
    }

    //テァツァツサテ・ツ仰?
    for(int i = 0; i < t[st.id].size(); i++){
      Edge e = t[st.id][i];
      if(st.rem - e.cost < 0) continue;
      open.push(State(e.to, st.rem - e.cost, st.cost + e.cost));
    }
  }
  cout << "Help!" << endl;
}

int main(){
  while(cin >> n >> m >> l >> k >> a >> h, n){
    memset(f, 0, sizeof(f));
    for(int i = 0; i < n; i++){
      t[i].clear();
    }

    for(int i = 0; i < l; i++){
      int id;
      cin >> id;
      f[id] = true;
    }

    for(int i = 0; i < k; i++){
      int from, to, cost;
      cin >> from >> to >> cost;
      t[from].push_back(Edge(to, cost));
      t[to].push_back(Edge(from, cost));
    }

    solve();
  }
}

Measured memory_bytes: 2240
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var S = Console.ReadLine();

            if (N % 2 == 1)
            {
                Console.WriteLine("No");
            }
            else
            {
                var a = S.Substring(0, N / 2);
                var b = S.Substring(N / 2, N / 2);

                if (a == b)
                {
                    Console.WriteLine("Yes");
                }
                else
                {
                    Console.WriteLine("No");
                }
            }
        }
    }
}


Measured memory_bytes: 13140
#include <iostream>
#include <string>
#define rep(i,n) for(long long i=0;i<n;i++)

using namespace std;
using ll = long long;

int main(void)
{
    ll n,t=0;
    int k,i=1;
    cin>>n>>k;
    while(i<=n)
    {
        i*=k;
        t++;
    }
    cout<<t<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <valarray>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <iomanip>
#include <map>
#include <set>
#include <list>
#include <limits>
#include <numeric>
#include <utility>
#include <deque>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#include <array>
#include <bitset>
#include <complex>
#include <tuple>
#include <random>

using namespace std;
using ll = long long;
const int INF = 1e9;
const ll MOD = 1e9 + 7;

int main()
{
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<int> r, g, b;
  for (int i = 0; i < n; ++i)
  {
    if (s[i] == 'R')
      r.push_back(i);
    else if (s[i] == 'G')
      g.push_back(i);
    else
      b.push_back(i);
  }
  sort(r.begin(), r.end());
  sort(g.begin(), g.end());
  sort(b.begin(), b.end());
  ll sum = r.size() * g.size() * b.size();
  for (int i = 0; i < r.size(); ++i)
  {
    for (int j = 0; j < g.size(); ++j)
    {
      if ((r[i] + g[j]) % 2 != 0 || b.size() == 0)
        continue;
      int ng = -1, ok = b.size();
      while (abs(ok - ng) > 1)
      {
        int mid = (ng + ok) / 2;
        if (b[mid] >= (r[i] + g[j]) / 2)
          ok = mid;
        else
          ng = mid;
      }
      if (b[ok] == (r[i] + g[j]) / 2)
        sum--;
    }
  }
  for (int j = 0; j < g.size(); ++j)
  {
    for (int k = 0; k < b.size(); ++k)
    {
      if ((b[k] + g[j]) % 2 != 0 || r.size() == 0)
        continue;
      int ng = -1, ok = r.size();
      while (abs(ok - ng) > 1)
      {
        int mid = (ng + ok) / 2;
        if (r[mid] >= (b[k] + g[j]) / 2)
          ok = mid;
        else
          ng = mid;
      }
      if (r[ok] == (b[k] + g[j]) / 2)
        sum--;
    }
  }
  for (int i = 0; i < r.size(); ++i)
  {
    for (int k = 0; k < b.size(); ++k)
    {
      if ((r[i] + b[k]) % 2 != 0 || g.size() == 0)
        continue;
      int ng = -1, ok = g.size();
      while (abs(ok - ng) > 1)
      {
        int mid = (ng + ok) / 2;
        if (g[mid] >= (r[i] + b[k]) / 2)
          ok = mid;
        else
          ng = mid;
      }
      if (g[ok] == (r[i] + b[k]) / 2)
        sum--;
    }
  }
  if (sum < 0)
    sum = 0;
  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 3200
#AGC026 A
'''
問題
この世界にはスライムの色が10000色ある
左からiつめのスライムの色はai
スライムがN体1列に並んでいる。Nは2以上100以下
隣り合う色のスライムが同じにならないようにスライムの色を変えたい。最小で何個のスライムの色を変える必要がある？

考察
同じスライムの色が2つ連続する→1回
同じスライムの色が3つ連続する→1回
同じスライムの色が4つ連続する→2回
そのため同じ色のスライムnつ連続に対してn//2回必要
これを列全体について数える
'''

N = int(input())
A = list(map(int,input().split(' ')))
ans = 0
chain = 1

for i in range(N):
	if i==0:
		continue
	elif A[i]==A[i-1]:
		chain += 1
	elif A[i]!=A[i-1]:
		ans += (chain//2)
		chain = 1
	if i==N-1:
		ans += (chain//2)
		chain = 1		
		
print(ans)

Measured memory_bytes: 3064
w,h,x,y=map(int,input().split())

x1=x*h
x2=(w-x)*h
y1=y*w
y2=(h-y)*w
f=0
if x==0 or y==0 or x==w or y==h:
    a=1/2*w*h
    f=1
else:    
    #a=max(0,min(x1,x2),min(y1,y2))
    a=1/2*w*h
    
if min(x1,x2)==min(y1,y2) and f==0:
    b=1
    
else:
    b=0
    
print(a,b)

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

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

lint lcm(lint x, lint y) { return x/gcd(x,y)*y; }

lint C(lint n, lint k) {
  if(n == k) { return 1; }
  else if(n < k) { return 0; }
  else if(k == 0) { return 1; }
  else if(k == 1) { return n; }
  else return C(n-1,k-1) + C(n-1,k);
}

lint P(lint n, lint k) {
  if(k == 1) { return n; }
  return (n*(P(n-1,k-1)%1000000007)%1000000007);
}


int main() {
  lint n; cin >> n;
  vector<lint> t(n+1,0),x(n+1,0),y(n+1,0); for(lint i=1;i<=n;i++) { cin >> t[i] >> x[i] >> y[i]; }

  for(lint i=1;i<=n;i++) {
    lint diff = abs(x[i]-x[i-1]) + abs(y[i]-y[i-1]);
    if(diff>t[i]-t[i-1]) {
      printf("No\n");
      return 0;
    } else {
      if(diff%2 != (t[i]-t[i-1])%2) {
        printf("No\n");
        return 0;
      }
    }
  }

  printf("Yes\n");
  return 0;
}


Measured memory_bytes: 5548
#include<bits/stdc++.h>
#define ll          long long int
#define lld          long double
#define pb          push_back
#define pii         pair<ll,ll>
#define mi          map<ll,ll>
#define vec         vector<ll>
#define all(a)     (a).begin(),(a).end()
#define F           first
#define S           second
#define mod         1000000007
#define rep(i,a,b)	for(ll  i=a;i<b;i++)
#define repi(i,a,b)	for(ll  i=a;i<=b;i++)
#define per(i,a,b)  for(ll i=a;i>=b;i--)
#define mp          make_pair
#define mit         map<ll,ll>::iterator
#define sit         set<ll>::iterator
#define pit         pair<ll,ll>::iterator
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;
ll xo(ll x, ll y) 
{ 
   return (x | y) & (~x | ~y); 
}  
ll bin_Expo(ll x,ll n)
{
		if(x==0)
		return 0;
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return bin_Expo(x*x,n/2);
    else                             //n is odd
        return x*bin_Expo(x*x,(n-1)/2);
}
ll mod_Expo(ll x,ll n,ll M)
{
		if(x==0)
		return 0;
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return mod_Expo((x*x)%M,n/2,M);
    else                             //n is odd
        return (x*mod_Expo((x*x)%M,(n-1)/2,M))%M;
 
}
ll NcR(int n, int r) 
{ 
    ll p = 1, k = 1; 
    if (n - r < r) 
        r = n - r; 
  
    if (r != 0) { 
        while (r) { 
            p *= n; 
            k *= r; 
            ll m=__gcd(p, k); 
            p /= m; 
            k /= m; 
            n--; 
            r--; 
        } 
    } 
    else
        p = 1; 
    return p;
}
bool prime_check(ll x)
{
    bool prime = (x >= 2);
    for (ll i = 2; i * i <= x; i++) 
    {
        if (x % i == 0) 
        {
            prime = false;
            break;
        }
    }
    return prime;
}
ll logg(ll base,ll x)
{
    return (ll)(log(x)/log(base));
}
ll po(ll n)
{
	ll k=0;
	while(n%2==0)
	{
		k++;
		n=n/2;
	}
	return k;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
//	cin>>TESTS;
    while(TESTS--)
    {
    	ll i,j,l,m,k,n,w;
    	cin>>n>>w;
    	ll dp[100005];
		pii a[n]; 
    	rep(i,0,n)
    	cin>>a[i].F>>a[i].S;
    	k=0;
		rep(i,0,100005)
		{
			dp[i]=mod;
		}
		dp[0]=0;
		rep(i,0,n)
		{
			per(j,100004,0)
			{
				dp[j]=min(dp[j], (j>=a[i].S) ? dp[j-a[i].S]+a[i].F : mod);
			}
		}
		repi(i,0,100004)
		{
			if(w>=dp[i])
			k=i;
		}
		cout<<k;
    } 
	return 0;
}

Measured memory_bytes: 1152
#include <queue>
#include <iostream>
using namespace std;
int n, m, c, x, l[15], d[14348915], power[16];
int main() {
	power[0] = 1;
	for (int i = 1; i < 16; i++) power[i] = power[i - 1] * 3;
	while (cin >> n >> m, n) {
		for (int i = 0; i < 3; i++) {
			cin >> c;
			for (int j = 0; j < c; j++) cin >> x, l[--x] = i;
		}
		int s = 0, f = 0;
		for (int i = 0; i < n; i++) s += power[i] * l[i];
		fill(d, d + power[n], -1); d[s] = 0;
		queue<int> que; que.push(s);
		while (!que.empty()) {
			int v = que.front(); que.pop();
			if (v == 0 || v == power[n] - 1) {
				cout << d[v] << endl; f = 1; break;
			}
			if (d[v] == m) continue;
			int maxr[3] = { -1, -1, -1 };
			for (int i = 0; i < n; i++) maxr[(v / power[i]) % 3] = i;
			for (int i = 0; i < 3; i++) {
				if (maxr[i] == -1) continue;
				int k = maxr[i];
				int e = (v / power[k]) % 3;
				for (int j = 0; j < 3; j++) {
					if (k < maxr[j]) continue;
					int nxt = -1;
					if (e - j == -1) nxt = v + power[k];
					if (e - j == 1) nxt = v - power[k];
					if (nxt != -1 && d[nxt] == -1) {
						d[nxt] = d[v] + 1;
						que.push(nxt);
					}
				}
			}
		}
		if (!f) cout << -1 << endl;
	}
}

Measured memory_bytes: 59208
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
template<class T> inline bool chmin(T& a, T b){if(a>b){a=b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a=b;return true;}return false;}
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll digsz(ll x){if(x==0) return 1;else{ll ans=0;while(x){x/=10;ans++;}return ans;}}
ll digsum(ll x){ll sum=0;while(x){sum+=x%10;x/=10;}return sum;}
vector<ll> pw2(62,1);vector<ll> pw10(19,1);

vector<ll> vectorprime(ll x){
    vector<bool> is_prime(x+1);
    vector<ll> prime;
    rep(i,x+1) is_prime[i]=true;
    is_prime[0]=is_prime[1]=false;
    for(ll i=2;i<=x;i++){
        if(is_prime[i]){
            prime.pb(i);
        }
        for(int j=i*2;j<=x;j+=i) is_prime[j]=false;
    }
    return prime;
}
map<ll,ll> prime_factor(ll x){
    map<ll,ll> m;
    ll sq=(ll)sqrt(x) + 1;
    vector<ll> v_prime=vectorprime(sq);
    
    ll tmp=x;
    rep(i,sz(v_prime)){
        ll count=0;
        while(tmp % v_prime[i] == 0){
            tmp /= v_prime[i];
            count++;
        }
        if(count != 0) m[v_prime[i]]=count;
        if(tmp==1) break;
    }
    
    if(tmp != 1) m[tmp]=1;
    return m;
}

int main(){
    {rep1(i,61) pw2[i]=2*pw2[i-1];}
    {rep1(i,18) pw10[i]=10*pw10[i-1];}
    
    ll N; cin>>N;
    
    ll now=1;
    while((1+now)*now<N*2){
        now++;
    }
    ll tmp=(now+1)*now/2;
    //tmp-N;
    rep1(i,now){
        if(i==tmp-N) continue;
        else cout<<i<<endl;
    }
    
}



Measured memory_bytes: 3616
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const ll MOD = 1000000007;
const double EPS = 1e-9;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;



int main(void) {
    
    int n,l;
    cin>>n>>l;
    vs v(n);
    rep(i,n)cin>>v[i];
    Sort(v);
    rep(i,n)cout<<v[i];
    cout<<endl;
}


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

int parent[100001];
int rnk[100001];

void init(int n) {
  for (int i=0; i<n; i++) {
    parent[i] = i;
    rnk[i] = 1;
  }
}

int find(int i) {
  if (parent[i] == i) {
    return i;
  }
  return parent[i] = find(parent[i]);
}

void unite(int i, int j) {
  i = find(i);
  j = find(j);
  if (i == j) {
    return;
  }
  if (rnk[i] < rnk[j]) {
    parent[i] = j;
  } else {
    parent[j] = i;
    if (rnk[i] == rnk[j]) {
      ++rnk[i];
    }
  }
}

int main() {
  int n;
  cin>>n;
  pair<int, int> xs[n];
  pair<int, int> ys[n];
  for (int i=0; i<n; i++) {
    int x, y;
    cin>>x>>y;
    xs[i] = make_pair(x, i);
    ys[i] = make_pair(y, i);
  }
  sort(xs, xs + n);
  sort(ys, ys + n);

  tuple<long, int, int> edges[2*n-2];
  for (int i=0; i<n-1; i++) {
    edges[2*i] = make_tuple(abs(xs[i].first - xs[i+1].first), xs[i].second, xs[i+1].second);
    edges[2*i+1] = make_tuple(abs(ys[i].first - ys[i+1].first), ys[i].second, ys[i+1].second);
  }
  sort(edges, edges + 2*n);

  init(n);

  int cnt_e = 0;
  int idx_e = 0;
  long long ans = 0;
  while (cnt_e < n -1) {
    int t1 = get<1>(edges[idx_e]);
    int t2 = get<2>(edges[idx_e]);
    if (find(t1) == find(t2)) {
      ++idx_e;
      continue;
    }
    unite(t1, t2);
    ans += get<0>(edges[idx_e]);
    ++idx_e;
    ++cnt_e;
  }

  cout<<ans<<endl;
}

Measured memory_bytes: 5760
w,a,b = map(int,input().split())

if a < b:
  if b-(a+w) >0:
    print(b-(a+w))
  else:
    print(0)
    
elif a==b:
  print(0)
  
elif a>b:
  if a-(b+w) >0:
    print(a-(b+w))
  else:
    print(0)
  


Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Linq;
public class Program
{
    public static void Main()
    {
        int[] n = Console.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();
        int N = n[0];
        int M = n[1];

        int[,] st = new int[N, 2];
        for (int i = 0; i < N; i++)
        {
            n = Console.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();
            st[i, 0] = n[0];
            st[i, 1] = n[1];
        }

        int[,] points = new int[M, 2];
        for (int i = 0; i < M; i++)
        {
            n = Console.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();
            points[i, 0] = n[0];
            points[i, 1] = n[1];
        }

        int add = 0;
        int min = 2147483647;
        int box = 0;
        for (int i = 0; i < N; i++)
        {
            min = 2147483647;
            add = 0;
            for (int j = 0; j < M; j++)
            {
                box = Math.Abs(st[i, 0] - points[j, 0]) + Math.Abs(st[i, 1] - points[j, 1]);
                if (min > box) { min = box; add = j + 1; }
            }
            Console.WriteLine(add);
        }
    }
}

Measured memory_bytes: 13396
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long int
// #define ll long long int
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#define eb emplace_back
#define pii pair<int, int>
#define endl '\n'
#define all(x) x.begin(),x.end()
#define f(i,j,l) for(i=j;i<l;i++)
#define smax(a,b) a=max(a,b)
// #if !defined(ONLINE_JUDGE)
// #include "debugging.h"
// #endif
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// find_by_order(k)  returns iterator to kth element starting from 0;
// order_of_key(k) returns count of elements strictly smaller than k;
// erase,insert same as normal set

// int const mod = 7340033;
// int const mod = 998244353;
int const mod = 1e9+9;
int power(int a,int b,int m){
    int res = 1;
    while(b){
        if(b&1){
            // res = res*a;
            res = (res*a)%m;
        }
        a=(a*a)%m;
        // a%=m;
        b=b/2;
    }
    return res;
}
// ll mul(ll num1,ll num2,ll m){
//     ll x = (num1*num2)%m;
//     return x;
// }

// ll add(ll num1,ll num2,ll m){
//     ll x = ((num1%m)+(num2%m))%m;
//     return x;
// }

// ll sub(ll num1,ll num2,ll m){
//     ll x = (((num1%m)-(num2%m))%m + m)%m;
//     return x;
// }


int inverse(int x , int m){
    return power(x,m-2,m);
}

int const N = 1e5+5;
int const inf = 2e18;

void solve(){  
    int i,j;
    int n;
    cin>>n;
    string s;
    cin>>s;
    int cnt = 0;
    for(i=0;i<n;i++){
        cnt = cnt + s[i] - '0';
    }

    int sm1=0;
    int sm2=0;

    int m1 = cnt-1;
    int m2 = cnt+1;

    if(m1 > 0){
        for(i=0;i<n;i++){
            sm1 = sm1*2 + s[i]-'0';
            sm1 %= m1;
        }
    }
    for(i=0;i<n;i++){
        sm2 = sm2*2 + s[i]-'0';
        sm2 %= m2;
    }

    int ans1 = 1;
    int ans2 = 1;

    for(i=0;i<n;i++){
        if(s[i] == '0'){
            int sm = sm2 + power(2LL , (n-i-1) , m2);
            sm %= m2;

            int ans = 1;
            while(sm != 0){
                int c = __builtin_popcount(sm);
                sm = sm%c;
                ans++;
            }
            cout<<ans<<endl;
        }
        else{
            if(cnt == 1) cout<<0<<endl;
            else{
                int sm = sm1 - power(2LL , (n-i-1) , m1);
                sm %= m1;
                sm = (sm + m1)%m1;

                int ans = 1;
                while(sm){
                    int c = __builtin_popcount(sm);
                    sm = sm%c;
                    ans++;
                }
                cout<<ans<<endl;
            }
        }
    }
}           

int32_t main(){
    IOS;
    int t;
    t = 1;
    // precompute();
    // cin>>t;
    for(int tt=1;tt<=t;tt++){
        solve();
    }
    return 0;
}


/*

*/

Measured memory_bytes: 3780
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
const int mod = 1e9+7;



int main(void){
    ull N,M;
    cin>>N>>M;
    if (max(N,M)-min(N,M)>1) {
        cout<<0<<endl;
        return 0;
    }
    vector<ull> factorial(1e5+10);
    factorial[0] = 1;
    for (int i=1;i<=1e5+1;i++) {
        ull temp = i * factorial[i-1] % mod;
        factorial[i] = temp;
    }

    ull big = factorial[max(N,M)];
    ull small = factorial[min(N,M)];

    if (N==M) {
        cout<<2*big*big%mod<<endl;
    }
    else {
        cout<<big*small%mod<<endl;
    }
    return 0;
}

Measured memory_bytes: 1024
h,n = map(int,input().split())
a = []
b = []
for _ in range(n):
  tmp = list(map(int,input().split()))
  a.append(tmp[0])
  b.append(tmp[1])

dp = [[10**9 for _ in range(h+1)] for _ in range(n+1)]

for i in range(n):
  for j in range(h+1):
    if j <= a[i]:
      dp[i+1][j] = min(dp[i][j],b[i])
    else:
      dp[i+1][j] = min(dp[i][j],dp[i+1][j-a[i]]+b[i])

print(dp[n][h])

Measured memory_bytes: 125276
#include <bits/stdc++.h>
using namespace std;
const int lim = 7368791;

int main(){
while(1){//start

	bool a[lim + 1];
	memset(a, 0, sizeof(a));

	int m, n;
	cin >> m >> n;
	int idx = m;
	if(m == 0 and n == 0) break;

	//敗因；全部なめた
	int cnt = 0;
	for(int i = m; cnt < n; i++){
		if(a[i] == 0){
			cnt++;
			for(int j = i; j <= lim; j += i){
				a[j] = 1;
			}
		}
	}


	for(int i = m; i <= lim; i++){
		if(a[i] == 0){
			cout << i << endl;
			break;
		}
	}

}//end

	return 0;
}



Measured memory_bytes: 10272
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template<class T> inline bool chmax(T& a, T b) {if (a<b) {a=b; return true;} return false;}
template<class T> inline bool chmin(T& a, T b) {if (a>b) {a=b; return true;} return false;}

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, k; cin >> n >> k;
    vll a(n); REP(i, n) cin >> a[i];
    vvll dp(n+1, vll(k+1, 0));
    vll cum(k+2, 0);
    dp[0][0] = 1;
    rep(i, 1, n+1) {
        cum[0] = 0;
        rep(j, 1, k+2) cum[j] = (cum[j-1] + dp[i-1][j-1])%MOD;
        rep(j, 0, k+1) dp[i][j] = ((cum[j+1] - cum[max(0LL, j-a[i-1])])+MOD)%MOD;
    }
    cout << dp[n][k] << '\n';
    return 0;
}


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

using namespace std;
typedef long long ll;

struct edge {
  ll to, cost;
  edge() {}
  edge(ll t, ll c): to(t), cost(c) {}
};

const ll INF = 1e12;
ll n, m, R;
ll d[201][201];
ll cost[201][201];

void warshallFloyd(ll n) {
  for (ll k = 0; k < n; k++) {
    for (ll i = 0; i < n; i++) {
      for (ll j = 0; j < n; j++) {
        d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
      }
    }
  }
}

ll solve(ll t, ll sum, vector<bool> used) {
  used[t] = true;
  ll res = INF;
  bool flag = true;
  for (ll i = 0; i < R; i++) {
    if (used[i] || cost[t][i] == INF) continue;
    res = min(res, solve(i, sum + cost[t][i], used));
    flag = false;
  }
  if (flag) return sum;
  return res;
}

int main(void) {
  cin >> n >> m >> R;

  vector<ll> r(R);
  map<ll, ll> mp;
  for (ll i = 0; i < R; i++) {
    cin >> r[i];
    r[i]--;
    mp[r[i]] = i;
  }

  for (ll i = 0; i < n; i++) {
    for (ll j = 0; j < n; j++) {
      d[i][j] = INF;
    }
    d[i][i] = 0;
  }

  vector<ll> a(m), b(m), c(m);
  for (ll i = 0; i < m; i++) {
    cin >> a[i] >> b[i] >> c[i];
    a[i]--, b[i]--;
    d[a[i]][b[i]] = d[b[i]][a[i]] = c[i];
  }

  warshallFloyd(n);

  for (ll i = 0; i < R; i++) {
    for (ll j = 0; j < R; j++) {
      cost[i][j] = cost[j][i] = d[r[i]][r[j]];
    }
  }

  vector<bool> used(R, false);
  ll ans = INF;
  for (int i = 0; i < R; i++) {
    ans = min(ans, solve(i, 0, used));
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

int inc(int a,int o,int C,int d){
	while(d>=(a+1)){
		C = C+1;
		a = a+o;
	}
	return C;
}

int main(){
	int N,d,x,a,o,C,i;
	scanf("%d",&N);
	scanf("%d %d",&d,&x); 
	C = N;
	for(i= 0; i<N ;i++){
		scanf("%d",&a);
		C = inc(a,a,C,d);
	}
	C=C+x;
	printf("%d",C);
}

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

const int MAX = 1010;
int dp[MAX][MAX];

int main()
{
  int n; cin >> n;
  while(n--) {
    string s1, s2; cin >> s1 >> s2;
    memset(dp, 0, sizeof(dp));
    for (int i = 0; i < s1.size(); i++)
      for (int j = 0; j < s2.size(); j++)
        if (s1[i] == s2[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]);
    cout << dp[s1.size()][s2.size()] << endl;
  }
  return EXIT_SUCCESS;
}




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

constexpr int inf = 1e9;

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

    int ans = inf;
    int da[4] = {0, 1, 1, 0};
    int db[4] = {0, 1, 0, 1};
    int dc[4] = {0, 0, 1, 1};
    for(int i = 0; i < 4; ++i) {
        const int aa = a + da[i], bb = b + db[i], cc = c + dc[i];
        int ma = max({aa, bb, cc});
        if((ma - aa) % 2 == 0 && (ma - bb) % 2 == 0 && (ma - cc) % 2 == 0) {
            ans = min(ans, (i != 0) + (3 * ma - aa - bb - cc) / 2);
        }
    }
    cout << ans << endl;
}


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

public class Main {
    public static void main(String[] args) {
        try {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            String str = br.readLine();
            int strLength = str.length();
            int count = 0;
            for (int i = 0; i < str.length(); i++) {
                char ch = str.charAt(i);
                if (ch == 'S') {
                    count++;
                } else {
                    if (count > 0) {
                        count--;
                        strLength -= 2;
                    }
                }
            }
            System.out.println(strLength);
        } catch (IOException e) {
            e.printStackTrace();
           }
    }
}


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

typedef struct {
  int a, b;
} task;

bool b_cmp(const task& left, const task& right) {
  return left.b == right.b ? left.a < right.a : left.b < right.b;
}

int main() {
  int n;
  bool flg = true;
  cin >> n;
  vector<task> t(n);
  for (int i = 0; i < n; i++) {
    cin >> t[i].a >> t[i].b;
  }
  sort(t.begin(), t.end(), b_cmp);
  int sum_time = 0;
  for (int i = 0; i < n; i++) {
    sum_time += t[i].a;
    if (sum_time > t[i].b) {
      flg = false;
      break;
    }
  }
  if (flg) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 4740
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n, ans = 0, maxx = 0;
    int a[20];
    cin>>n;
    for (int i = 1; i <= n; i++) cin>>a[i];
    for (int i = 1; i <= n; i++)
    {
        ans += a[i];
        maxx = max(a[i], maxx);
    }
    printf("%d", ans - maxx + maxx/2);
    return 0;
}


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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair
#define F first
#define S second

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

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


#define MAX_N 100
u64 N;
u64 T[MAX_N];

u64 gcd(u64 a, u64 b) {
    if (a < b) swap(a, b);

    u64 t;
    while(b > 0) {
        t = a % b;
        a = b;
        b = t;
    }

    return a;
}

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

void solve() {
    u64 res = T[0];
    for (u64 i = 1; i < N; i++) {
        res = lcm(res, T[i]);
    }
    cout << res << endl;
}

int main() {
    cin >> N;
    REP(i, N) cin >> T[i];

    solve();

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a; i< (int)(b); ++i)
#define ALL(x) (x).begin(),(x).end()
#define rALL(x) (x).rbegin(),(x).rend()
typedef long double ld;
using ll=long long;
using namespace std;
const int mod=1e9+7;
const ll inf = 1LL << 60;
const ld pi = (acos(-1));
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 main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);

  
  string s;  cin >> s;
  int idx=0,ans=0;
  rep(i,0,s.size()){
    if(s[i]!='A' and s[i]!='G' and s[i]!='C' and s[i]!='T'){
      ans=max(ans,i-idx);
      idx=i+1;
    }
    else if(i==s.size()-1) ans = max(ans,i+1-idx);
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 3656
#include <iostream>

using namespace std;

int main()
{
    int x, a, b;
    cin >> x >> a >> b;
    if (b - a <= 0) {
        cout << "delicious" << endl;
    } else {
        if (b - a <= x) {
            cout << "safe" << endl;
        } else {
            cout << "dangerous" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
/*
██████╗  ███████╗  
██╔══██╗ ██╔════╝ 
██████╔╝ ███████╗ 
██╔══██╗ ╚════██║  
██║  ██║ ███████║      
╚═╝  ╚═╝ ╚══════╝                                                                                                             
*/

#include<bits/stdc++.h>
using namespace std;
 
#define ll long long int
#define rep(i,n) for(int i=0;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define haha(j,a,n) for(int j=a;j<n;j++)
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define endl "\n"
#define bc(v) v.begin(),v.end()
#define vl vector<ll>
#define vi vector<int>
#define why 1000000007
#define NUM 100005
#define F first
#define S second
#define bhar(a) rep(i,a.size()) cin>>a[i];
#define show(a) rep(i,a.size()) cout<<a[i]<<" ";
#define sott(a) sort(bc(a))
#define mp(a,b) make_pair(a,b)
#define pb push_back
#define mapp map<ll,ll>
#define dkac cout<<fixed<<setprecision(15);
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define yeah(n) while(n--)
ll gcd(int a, int b){if(b==0) return a; else return gcd(b,a%b);}
ll bitfun(ll x){
    return (x&(-x));
}
void solve(){
    int n,k; cin>>n>>k;
    int a[n];
    for(int i=0;i<n;i++) cin>>a[i];
    int dp[NUM];
    memset(dp,0,sizeof(dp));
    for(int i=0;i<=k;i++)
        for(int j:a)
            if(i-j>=0 && dp[i-j]!=1)
                dp[i]=1;
    if(dp[k]) cout<<"First";
    else cout<<"Second";

}
int main(){
    ios
    int t=1; 
    //cin>>t;
    yeah(t){
        solve();
    }
}

Measured memory_bytes: 768
function mark(a_rev, b)
  local marked = {false, false, false,
                  false, false, false,
                  false, false, false}
  for i = 1, #b do
    local bi = b[i]
    if a_rev[bi] then
      marked[a_rev[bi]] = true
    end
  end
  return marked
end

function bingo(marked)
  local bingos = {
    {1, 4, 7}, {2, 5, 8}, {3, 6, 9},
    {1, 2, 3}, {4, 5, 6}, {7, 8, 9},
    {1, 5, 9}, {3, 5, 7}
  }

  for i = 1, 8 do
    local c = bingos[i]
    if marked[c[1]] and marked[c[2]] and marked[c[3]] then
      return true
    end
  end

  return false
end

local a_rev = {}
for i = 1, 9 do
  a = io.read("*n")
  a_rev[a] = i
end

local n = io.read("*n")

local b = {}
for i = 1, n do
  b[i] = io.read("*n")
end

local marked = mark(a_rev, b)
if bingo(marked) then
  print("Yes")
else
  print("No")
end


Measured memory_bytes: 256
n = int(input())
shogens = []

for i in range(n):
    a = int(input())
    shogens.append([])
    for j in range(a):
        x, y = map(int, input().split())
        x -= 1
        shogens[-1].append((x,y))

def is_honest(i, j):
    return (i >> j) % 2 == 1

def honest_cnt(i):
    ans = 0
    for j in range(n):
        ans += is_honest(i, j)
    return ans

ans = 0

for i in range(1 << n):
    ok = True
    for j in range(n):
        if not is_honest(i,j):continue
        for (x, y) in shogens[j]:
            if y == 0 and is_honest(i, x):ok = False
            if y == 1 and not is_honest(i, x):ok = False
    if ok:
        ans = max(ans, honest_cnt(i))

print(ans)
        

Measured memory_bytes: 3188
N=int(input())
T=list(map(int,input().split()))
A=list(map(int,input().split()))
cand=[-1]*N
cand2=[-1]*N
flag=1
ans=1
p=10**9+7
for i in range(N):
    if i==0:
        cand[i]=T[i]
    else:
        if T[i]!=T[i-1]:
            cand[i]=T[i]
for i in range(N-1,-1,-1):
    if i==N-1:
        cand2[i]=A[i]
    else:
        if A[i]!=A[i+1]:
            cand2[i]=A[i]
#print(cand)
#print(cand2)

ans=1
for i in range(N):
    if (cand[i]==-1)and(cand2[i]==-1):
        ans=(ans*min(T[i],A[i]))%p
    elif (cand[i]==-1):
        if T[i]<cand2[i]:
            ans=0
    elif (cand2[i]==-1):
        if A[i]<cand[i]:
            ans=0
    else:
        if cand[i]!=cand2[i]:
            ans=0
print(ans)


#print(flag,cand)
"""
lmax=[0]*N
rmax=[0]*N
for i in range(N):
    if i==0:
        lmax[i]=cand[i]
        rmax[N-1-i]=cand[N-1-i]
    else:
        if cand[i]==-1:
            lmax[i]=lmax[i-1]
        else:
            lmax[i]=cand[i]

        if cand[N-i-1]==-1:
            rmax[N-i-1]=rmax[N-i]
        else:
            rmax[N-i-1]=cand[N-i-1]
#print(lmax,rmax)
for i in range(N):
    if cand[i]==-1:
        ans=(ans*min(A[i],T[i]))%p
if flag==0:
    print("0")
else:
    print(ans%p)
"""

Measured memory_bytes: 83172
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);

    String s = sc.next();
    s += sc.next();
    s += sc.next();
    s += sc.next();

    if (s.contains("1") && s.contains("9") && s.contains("4") && s.contains("7")) {
      System.out.println("YES");
    } else {
      System.out.println("NO");
    }

  }
}

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

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

	int a = n, b = 0;
	while (a > 0) {
		b += a % 10;
		a /= 10;
	}

	if (n % b == 0) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
    int S, h, m, s, a, b;
    
    scanf("%d", &S);
    
    a = S%3600;
    b = a%60;
    s = b;
    m = (a-b)/60;
    h = (S-a)/3600;
    
    printf("%d:%d:%d\n", h, m, s);
    
    return 0;
}


Measured memory_bytes: 2136
#include<stdio.h>
int main(void){

int a,b,c,i,s=0;
scanf("%d %d %d", &a,&b,&c);
	for(i=a;i<=b;i++){
		if(c%i==0){
		s++;
		}
	}
printf("%d\n",s);
return 0;
}



Measured memory_bytes: 2148
#include <iostream>
#include <vector>
#include <deque>
#include <math.h>
#include <set>
#include <iomanip>
#include <time.h>
#include <list>
#include <stdio.h>
#include <queue>
#include <map>
#include <algorithm>
#include <assert.h>
#include <memory.h>

#define mk make_pair
#define sc second
#define fr first
#define pb emplace_back
#define all(s) s.begin(), s.end()
#define sz(s) ( (int)s.size() )

using namespace std;

const int N = 5e3 + 5, M = 205, inf = -1e9 - 7;

int n, m, ar[N][M], cur[M], numlog[N], table[23][N][202];

long long  pref[N], ans;

inline int max(int a, int b)
{
    return a > b ? a : b;
}
inline int min(int a, int b)
{
    return a > b ? b : a;
}


void build(int pos)
{
      for(int i = 0; i <= numlog[n]; i ++)
      {
            for(int j = 1; j <= n; j ++)
            {
                  if(i == 0)
                  {
                        table[i][j][pos] = ar[j][pos];
                        continue;
                  }
                  int d = min(j + (1 << (i - 1)), n);
                  table[i][j][pos] = max(table[i - 1][j][pos], table[i - 1][d][pos]);
            }
      }
}

int get(int l, int r, int pos)
{
      int curlog = numlog[r - l + 1];
      return max(table[curlog][l][pos], table[curlog][r - (1 << curlog) + 1][pos]);
}

void Compute(int l, int r, int opl, int opr)
{
      if(l > r) return ;
      int md = (l + r) >> 1, opt = l;
      long long c = 0;
      for(int i = opl; i <= min(opr, md); i ++)
      {
            long long res = 0;

            for(int j = 1; j <= m; j ++)
                  res += get(i, md, j);

            res -= pref[md] - pref[i];

            if(res > c)
            {
                  c = res;
                  opt = i;
            }
      }
      ans = max(ans, c);
      Compute(l, md - 1, opl, opt);
      Compute(md + 1, r, opt, opr);
}

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

  for(int i = 2; i <= n; i ++)
        numlog[i] = numlog[i / 2] + 1;

    for (int i = 2; i <= n; i++)
        scanf("%lld", &pref[i]), pref[i] += pref[i - 1];

    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= m; j++)
            scanf("%d", &ar[i][j]);

      for(int i = 1; i <= m; i ++)
            build(i);

    Compute( 1, n, 1, n );

    cout << ans << endl;
}


Measured memory_bytes: 58240
A, B = map( int, input().split() )
S = input()

def isPostalCode( A, B, S ):
    for i in range(A):
        if S[i] == '-': return False
    if S[A] != '-': return False
    for i in range(A+1,A+B):
        if S[i] == '-': return False
    return True

if isPostalCode( A, B, S ): print( 'Yes' )
else: print( 'No' )

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

void solve(std::string S){
    bool ans = true;
    int count = 0;
    while (true) {
        S.erase(S.end() - 1);
        count++;
        if (S.size() % 2) continue ;
        int mid = S.size() / 2;
        if (S.substr(0, mid) == S.substr(mid))
            break ;
    }
    cout << S.size() << '\n';
}

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


Measured memory_bytes: 256
s=input()
import re
ans=re.findall("[ATGC]+",s)#findall、なかったら[]が帰ってくる。matchのようにNoneが帰ってくるわけではない。
if ans==[]:
    print(0)
else:
    print(len(max(ans,key=len)))#このときfindallで返される行列は先頭から見つかったもの順に並べられることに注意すること。

Measured memory_bytes: 3188
A, B, C, D = map(int, input().split())

dividedbyC = B // C - (A-1) // C
dividedbyD = B // D - (A-1) // D


def gcd(a, b):
    """
    自然数a, b の最大公約数を求める
    """
    if b == 0:
        return a
    else:
        return gcd(b, a % b)


mcl = C * D // gcd(C, D)
dividedbyCandD = B // mcl - (A-1) // mcl
ans = B - A + 1 - (dividedbyC + dividedbyD - dividedbyCandD)
print(ans)

Measured memory_bytes: 3064