akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define ll long long
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vl vector<ll>
#define vul vector<ull>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vi2d vector<vi >
#define vl2d vector<vl >
#define vpll vector<pll >

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rz resize
#define fr(i,n) for(i=0;i<(n);i++)
#define frr(i,n) for(i=(n-1);i>=0;i--)
#define fre(i,n) for(i=0;i<=(n);i++)
#define frre(i,n) for (i=(n);i>=0;i--)
#define frab(i,a,b) for(i=(a);i<(b);i++)
#define freab(i,a,b) for(i=(a);i<=(b);i++)
#define frrab(i,a,b) for(i=(b-1);i>=a;i--)
#define frreab(i,a,b) for(i=(b);i>=a;i--)

#define sz(a) int((a).size())
#define mset(a,b) (memset(a,b,sizeof(a)))
#define max3(a,b,c) (max((a),max((b),(c))))
#define min3(a,b,c) (min((c),min((a),(b))))
#define sumv(v) accumulate(all(v),ll(0))
#define productv(v) accumulate(all(v), ll(1), multiplies< ll >())
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
vector <ll> sprime;
vector<char> prime (1000000, true);
void sieve(ll n)
{
  //O(nloglogn) time
  sprime.pb(0);
  prime[0] = prime[1] = false;
  ll cnt = 0;
  for (ll i = 2; i <= n; ++i)
  {
    if (prime[i])
    {
      cnt++;
      sprime.pb(i);
      for (ll j = 2 * i; j <= n; j += i)
        prime[j] = false;
    }
  }
}
ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }
ll fastpowMOD(ll a, ll p, ll MOD) { if (p == 0) return 1; ll z = fastpowMOD(a, p / 2, MOD); z = (z * z) % MOD; if (p % 2) z = (z * a) % MOD; return z; }
ll fastpow(ll a, ll p) { if (p == 0) return 1; ll z = fastpow(a, p / 2); z = (z * z); if (p % 2) z = (z * a); return z; }

#define mod 1000000007
#define inf LLONG_MAX
#define minf LLONG_MIN
#define pi 3.14
#define ex 2.71

//*********************************************///
const int N = 1e5 + 5;
int i,j;
ll w[N];
ll v[N];


ll dp[3005][3005];
int n,wt;

void solve()
{
  string s,t;
  cin>>s>>t;
  freab(i,1,sz(s))
    freab(j,1,sz(t))
    {
      if(s[i-1]==t[j-1])
        dp[i][j]=dp[i-1][j-1]+1;
      else
        dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
    }
  string ans;
  int n=sz(s),m=sz(t);
  while(n!=0 && m!=0)
  {
    // if(dp[n][m]==dp[n-1][m-1]+1)
    // {
    //   ans+=s[n-1];
    //   n--;
    //   m--;
    // }
    if(s[n-1]==t[m-1])
    {
      ans+=s[n-1];
      n--;
      m--;
    }
    else if(dp[n][m]==dp[n-1][m])
      n--;
    else
      m--;
  }
  reverse(ans.begin(),ans.end());
  cout<<ans<<endl;

}

int main()
{
  fast;
  int z;
  //cin>>z;
  z=1;
  while(z--)
  {
    solve();
  }
  return 0;
}


Measured memory_bytes: 72960
input = gets.chomp.split
n = input[0].to_i
m = input[1].to_i

l_max = -1
r_min = -1

for i in 1..m do
    input = gets.chomp.split
    l = input[0].to_i
    r = input[1].to_i
    if (l_max < 0 or l_max < l)
        l_max = l
    end
    if (r_min < 0 or r_min > r)
        r_min = r
    end
end

num = r_min - l_max +1

if num < 0
    puts "0"
else 
    puts num
end

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

int main(){

  string str[256], man;
  int n, m, judge;

  cin >> n;

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

  cin >> m;

  for(int i = 0; i < m; i++){
    cin >> man;
    for(int j = 0; j < n; j++){
      if(str[j] == man){
	if(judge == 0){
	  cout << "Opened by " << man << endl;
	  judge = 1;
	  break;
	}else {
	  cout << "Closed by " << man << endl;
	  judge = 0;
	  break;
	}
      }else if(j == n - 1) cout << "Unknown " << man << endl;
    }
  }

  return 0;
}

Measured memory_bytes: 1216
N,L = map(int, input().split())
A = []
mn = 10**9
for i in range(N):
    A.append(L+i)
sum_A = sum(A)

for i in range(N):
    aji = sum(A[:i]) + sum(A[i+1:])
    tmp = abs(sum_A - aji)
    if tmp < mn:
        mn = tmp
        ans = aji
print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
const ll INF = 1e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)

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

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cout << a[i] << " "; cout << "\n"; }
template<class T> void verr(const vector<T>& v){ for(auto& a : v) cout << a << " "; cout << "\n"; }
ll dbgt = 1; void err() { cout << "passed " << dbgt++ << "\n"; }
template<class H, class... T> void err(H&& h,T&&... t){ cout<< h << (sizeof...(t)?" ":"\n"); if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
//--------------------------------------------------------------------------------//

int main() {
    init();
    ll N,X,D;
    cin >> N >> X >> D;
    // kx mod D の数え上げの左端,右端を保持
    map<ll, vc<pair<ll,ll>>> mp;
    if(D==0){
        if(X==0){
            cout << 1 << endl;
            return 0;
        }
        else{
            cout << N + 1 << endl;
            return 0;
        }
    }
    else if(D<0){
        X = -X;
        D = -D;
    }

    ll ans = 0;
    rep(k,N+1){
        ll kx = k * X, mx = (D + k * X % D) % D;
        ll lv = kx + D * k * (k - 1) / 2, rv = kx + D * k * (2 * N - k - 1) / 2;
        mp[mx].eb(lv, rv);
    }
    for(auto p:mp){
        vc<pair<ll, ll>> R = p.second;
        ll r = -INF;
        sort(all(R));

        rep(i,R.size()){
            ll l = max(r, R[i].first);
            ans += max(0ll, R[i].second - l + D) / D;
            chmax(r, R[i].second + D);
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 22144
#include <bits/stdc++.h>
const int INF = 1e9;
using LL = long long;
const LL LINF = 1e18;
const double EPS = 1e-10;
using namespace std;

#define SCIN(n) string(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

#define ALL(obj) (obj).begin(),(obj).end()

#define rt return
#define ENDL cout<<endl
#define s second
#define f first

typedef string::const_iterator State;
class PalseError {};
class Edge{
public:
    LL from,to,value;
    Edge(LL a,LL b,LL c){
        from = a;
        to = b;
        value = c;
    }
    Edge(LL a,LL b){
        from = a;
        to = b;
    }
};
LL gcd(LL a, LL b) {
    if(b == 0) return a;
    return gcd(b, a % b);
}
LL lcm(LL a, LL b) {
    return a / gcd(a, b) * b ;
}
int main(){
    int N;cin >> N;
    LL ans = 1;
    for(int a = 0;a < N;a++){
        LL b;cin >> b;
        ans = lcm(ans, b);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
using namespace std;
const int N=1000000+5;
typedef long long ll;
struct node{
    int u,v,nxt;
}edge[N*2];
int head[N],mcnt;
int du[N];
void add_edge(int u,int v){
    mcnt++;
    edge[mcnt].u=u;
    edge[mcnt].v=v;
    edge[mcnt].nxt=head[u];
    head[u]=mcnt;
    du[u]++;
}
ll I,P,Q;
bool tag[N];
bool vis[N];
bool flag;
void dfs(int u){
    vis[u]=1;
    for(int i=head[u];i;i=edge[i].nxt){
        int v=edge[i].v;
        if(!vis[v]){
            tag[v]=tag[u]^1;
            dfs(v);
        }
        else
            if(tag[u]==tag[v])
                flag=false;
    }
}
int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i=1;i<=m;i++){
        int u,v;
        scanf("%d%d",&u,&v);
        add_edge(u,v);
        add_edge(v,u);
    }
    for(int i=1;i<=n;i++){
        if(vis[i])
            continue;
        if(du[i]==0){
            I++;
            continue;
        }
        flag=true;
        dfs(i);
        if(flag)
            Q++;
        else
            P++;
    }
    ll ans=1ll*2*I*n-1ll*I*I+1ll*P*P+2ll*P*Q+2ll*Q*Q;//
    printf("%lld\n",ans);
}


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

#define rep(i,s,n) for(ll i = (s); i < (n); i++)
#define rep0(i,n) rep(i,0,n)
#define rep1(i,n) rep(i,1,n+1)
#define repR(i,s,n) for(ll i = (n-1); i >= (s); i--)
#define repR0(i,n) repR(i,0,n)
#define repR1(i,n) repR(i,1,n+1)

#define BR "\n"
#define SP " "
#define SHOW(x) for(int i = 0; i < x.size(); i++) { cout << x[i] << SP; } cout << BR;
#define SHOW2(x) for(int j = 0; j < x.size(); j++) { SHOW(x[j]); } cout << BR;
#define fcout cout << fixed << setprecision(18)

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

int a[100];
int cells[100][100]; // r * c

int main() {
  int A, B;
  cin >> A >> B;
  cout << max(0, A - 2 * B) << BR;
  return 0;
}

Measured memory_bytes: 256
#[cfg(test)]
#[macro_use]
extern crate contest;

use std::cmp;
use std::collections::VecDeque;
use std::fmt::Debug;
use std::io::{self, Bytes, Read, Stdin, StdinLock};
use std::str::{self, FromStr};

fn main() {
    let stdin = io::stdin();
    let mut sc = StdinScanner::new(&stdin);
    println!("{}", solve(sc.next()));
}


fn solve(s: String) -> u32 {
    let mut result = 1000;
    let q = {
        let mut q = VecDeque::new();
        for c in s.as_bytes() {
            q.push_back(c);
        }
        q
    };
    for target in 'a' as u8..'z' as u8 + 1 {
        if s.as_bytes().iter().find(|&&c| c == target).is_none() {
            continue;
        }
        let mut n = 0;
        let mut q = q.clone();
        while !q.is_empty() {
            if *q[0] == target {
                q.pop_front();
            } else {
                let l = q.len();
                for i in 0..l - 1 {
                    if *q[i + 1] == target {
                        q[i] = &target;
                    }
                }
                n += 1;
                q.pop_back();
            }
        }
        result = cmp::min(result, n);
    }
    result
}


#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test() {
        assert_eq_in_time!(1000, "", "");
    }
}


struct StdinScanner<'a> {
    buf: Vec<u8>,
    bytes: Bytes<StdinLock<'a>>,
}


#[allow(dead_code)]
impl<'a> StdinScanner<'a> {
    fn new(stdin: &'a Stdin) -> Self {
        StdinScanner {
            buf: Vec::with_capacity(256),
            bytes: stdin.lock().bytes(),
        }
    }

    fn next<T: FromStr>(&mut self) -> T
        where <T as FromStr>::Err: Debug
    {
        self.buf.clear();
        let mut c = self.bytes.next().unwrap().unwrap();
        while c == ' ' as u8 || c == '\n' as u8 {
            c = self.bytes.next().unwrap().unwrap();
        }
        while !(c == ' ' as u8 || c == '\n' as u8) {
            self.buf.push(c);
            c = self.bytes.next().unwrap().unwrap();
        }
        str::from_utf8(&self.buf).unwrap().parse().unwrap()
    }

    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T>
        where <T as FromStr>::Err: Debug
    {
        (0..n).map(|_| self.next()).collect()
    }

    fn pairs<A: FromStr, B: FromStr>(&mut self, n: usize) -> Vec<(A, B)>
        where <A as FromStr>::Err: Debug,
              <B as FromStr>::Err: Debug
    {
        (0..n).map(|_| (self.next(), self.next())).collect()
    }

    fn trios<A: FromStr, B: FromStr, C: FromStr>(&mut self, n: usize) -> Vec<(A, B, C)>
        where <A as FromStr>::Err: Debug,
              <B as FromStr>::Err: Debug,
              <C as FromStr>::Err: Debug
    {
        (0..n)
            .map(|_| (self.next(), self.next(), self.next()))
            .collect()
    }

    fn mat<T: FromStr>(&mut self, m: usize, n: usize) -> Vec<Vec<T>>
        where <T as FromStr>::Err: Debug
    {
        (0..n).map(|_| self.vec(m)).collect()
    }
}


trait PrintYn {
    fn print_yn(self, yes: &str, no: &str);
}

impl PrintYn for bool {
    fn print_yn(self, yes: &str, no: &str) {
        println!("{}", if self { yes } else { no });
    }
}


Measured memory_bytes: 4352
#pragma GCC optimize("Ofast")

//インクルード
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
using Graph = vector<vector<int>>; // グラフ型
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 1000000007 //10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MAXR 100000 //10^5:最大のrange(素数列挙などで使用)

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

int main() {
  // 高速化
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);


    ll n, k;
    cin >> n >> k;
    ll ans = 0;

    FOR(i, k, n){
         ans +=  (((n+1)*n)/2) - (((n+1-i)*(n+1-i-1))/2) - (i*(i-1))/2 + 1;
         ans %= MOD;
    }
    ans++; //(全部選ぶとき)

    cout << ans  << "\n"; 

    return 0;

}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<(n);++i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(int)(n)-1;i>=0;--i)
#define RFOR(i, a, b) for(int i=(int)(b)-1;i>=(a);--i)
#define ALL(a) a.begin(),a.end()
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;
const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;
template <typename T1, typename T2>
bool chmax(T1 &a, const T2 &b) {
    if (a < b) { a = b; return true; }
    return false;
}
template <typename T1, typename T2>
bool chmin(T1 &a, const T2 &b) {
    if (a > b) { a = b; return true; }
    return false;
}
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "[";
    REP(i, SZ(v)) {
        if (i) os << ", ";
        os << v[i];
    }
    return os << "]";
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const map<T1, T2> &mp) {
    os << "{";
    int a = 0;
    for (auto &tp : mp) {
        if (a) os << ", "; a = 1;
        os << tp;
    }
    return os << "}";
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
    os << p.first << ":" << p.second;
    return os;
}


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    for (;;) {
        int W, H; cin >> W >> H;
        if (W == 0) break;
        vector<string> a(H);
        REP(i, H) cin >> a[i];

        const int di[] = {0, 1, 0, -1};
        const int dj[] = {1, 0, -1, 0};

        function<void(int,int,vvi&,char)> dfs = [&](int i, int j, vvi& used, char invalid) {
            if (used[i][j]) return;
            used[i][j] = 1;
            REP(k, 4) {
                int ni = i + di[k], nj = j + dj[k];
                if (ni < 0 or nj < 0 or H <= ni or W <= nj or
                    a[ni][nj] == invalid) {
                    continue;
                }
                dfs(ni, nj, used, invalid);
            }
        };

        vvi black(H, vi(W));
        REP(i, H) {
            REP(j, W) {
                if (a[i][j] == 'B') dfs(i, j, black, 'W');
            }
        }
        vvi white(H, vi(W));
        REP(i, H) {
            REP(j, W) {
                if (a[i][j] == 'W') dfs(i, j, white, 'B');
            }
        }

        int b = 0, w = 0;
        REP(i, H) {
            REP(j, W) {
                if (a[i][j] != '.') continue;
                if (black[i][j] and !white[i][j]) ++b;
                if (!black[i][j] and white[i][j]) ++w;
            }
        }
        cout << b << " " << w << endl;
   }

    return 0;
}



Measured memory_bytes: 3500
import * as fs from 'fs';

//in
// 3 5
//out
// 0
const main = (inp: string) => {
    const [x, a]: number[] = inp.split(' ').map(Number);

    if (x < a) {
        console.log(0);
    } else {
        console.log(10);
    }
};

main(fs.readFileSync('/dev/stdin', 'utf8').trim());

Measured memory_bytes: 7372
#include <stdio.h>
#include <math.h>
 
using namespace std;
 
int main(){
    int n;
    double students[1000] = {0},sum,m,div;
 
    while(true){
        scanf("%d",&n);
        if(n == 0) break;
        div = sum = 0;
        for(int i = 0; i < n; i++){
            scanf("%lf",&students[i]);
            sum += students[i];
        }
        m = sum/n;
        for(int i = 0; i < n;i++){
            div += (students[i] - m)*(students[i] - m);
            students[i] = 0;
        }
        printf("%.8lf\n",sqrt(div/n));
    }
}


Measured memory_bytes: 2684
#include <iostream>
#include <algorithm>

using namespace std;

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

void input(bool grid[][9])
{
	rep(i,9){
		string s;
		cin>>s;
		if(i%2==0)
			rep(j,4)
				grid[i][j*2+1]=s[j]-'0';
		else
			rep(j,5)
				grid[i][j*2]=s[j]-'0';
	}
}

enum dir{
	UP,RIGHT,DOWN,LEFT
};
const int di[]={-1,0,1,0};
const int dj[]={0,1,0,-1};
const char output[]="URDL";

bool in_range(int i,int j)
{
	return 0<=i && i<9 && 0<=j && j<9;
}

int main()
{
	bool grid[9][9]={{0}};
	input(grid);
	
	int i=0,j=0;
	dir prev=RIGHT;
	for(;;){
		dir next[4]={LEFT,UP,RIGHT,DOWN};
		rotate(next,next+prev,next+4);
		
		int k;
		for(k=0;k<3;k++){
			if(in_range(i+di[next[k]],j+dj[next[k]]) && grid[i+di[next[k]]][j+dj[next[k]]])
				break;
		}
		
		cout<<output[next[k]];
		
		i+=di[next[k]]*2;
		j+=dj[next[k]]*2;
		prev=next[k];
		
		if(i==0 && j==0)
			break;
	}
	cout<<endl;
	
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define INF 1000000000
#define LINF 1000000000000000000
#define MOD 1000000007
#define mod 1000007
#define INF63 1061109567
#define INF127 9187201950435737471
#define F first
#define S second
#define ll long long
#define M 66000
#define N 20
using namespace std;
ll n,a[N][N],sc[M],dp[M];
ll dfs(ll s)
{
	if(s<=0)
	{
		return 0;
	}
	if(dp[s]!=-1)
	{
		return dp[s];
	}
	ll i;
	for(i=s;i!=0;i=(i-1)&s)
	{
		dp[s]=max(dp[s],dfs(s-i)+sc[i]);
	}
	return dp[s];
}
int main(){
	ll i,j,k;
	cin>>n;
	for(i=0;i<n;i++)
	{
		for(j=0;j<n;j++)
		{
			cin>>a[i][j];
		}
	}
	memset(dp,-1,sizeof(dp));
	for(i=0;i<(1<<n);i++)
	{
		vector<ll> v;
		sc[i]=0;
		for(j=0;j<n;j++)
		{
			if((i&(1<<j))!=0)
			{
				v.push_back(j);
			}
		}
		for(j=0;j<v.size();j++)
		{
			for(k=j+1;k<v.size();k++)
			{
				sc[i]+=a[v[j]][v[k]];
			}
		}
	}
	cout<<dfs((1<<n)-1)<<endl;
	return 0;
}

Measured memory_bytes: 1280
#include <iostream>

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

    int counter = 0;
    for (int ii = 0; ii <= a; ++ii)
    {
        int xcura = x;
        xcura -= ii * 500;
        for (int jj = 0; jj <= b; ++jj)
        {
            int xcurb = xcura;
            xcurb -= jj * 100;
            for (int kk = 0; kk <= c; ++kk)
            {
                int xcurc = xcurb;
                xcurc -= kk * 50;
                if (xcurc == 0)
                {
                    ++counter;
                }
            }
        }
    }

    std::cout << counter;
}


Measured memory_bytes: 256
import java.util.*;


public class Main {

	public static void main(String[] args) {
		Scanner scanner =new Scanner(System.in);
		String line1 = scanner.nextLine();
		scanner.close();
		String[] linestr =line1.split(" ",0);
		long cards = Long.parseLong(linestr[3]);
		long ans = 0;
		long[] cardsArr = new long[3];
		long[] ansArr = new long[3];
		
		for (int i = 0; i < 3; i++) {
			cardsArr[i] += Long.parseLong(linestr[i]);
		}

		for (int i = 0; i < 3; i++) {
			if (cards - cardsArr[i] >= 0) {
				cards = cards - cardsArr[i];
				ansArr[i] = cardsArr[i];
			} else {
				ansArr[i] = cards;
				break;
			}
		}
		ans = ansArr[0] * 1 + ansArr[1] * 0 + ansArr[2] * -1;
		System.out.println(ans);

	}
}


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

using ll = long long;

int main(){
    ll H, N;
    scanf("%lld %lld%*c", &H, &N);
    std::vector<ll> A(N);
    ll all_damage = 0;
    for(int i = 0; i < N; i++){
        ll temp;
        std::cin >> temp;
        all_damage += temp;
    }

    if(all_damage >= H) std::cout << "Yes" << std::endl;
    else std::cout << "No" << std::endl;

    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main(){
    int k,n;
    scanf("%d%d",&k,&n);
    int a[n];
    for (int i = 0; i < n; i++){
        scanf("%d",&a[i]);
    }
    int ans = k-(a[0]+k-a[n-1]);
    for (int i = 1; i < n; i++){
        ans = min(ans,k-a[i]+a[i-1]);
    }
    printf("%d",ans);
}


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

int main(){
  int N;cin>>N;
  vector<int> A(N);
  for(int i=0;i<N;i++) cin>>A.at(i);
  int button=1;
  int count=0;
  bool can=false;
  set<int> S;
  S.insert(1);
  while(true){
    button=A.at(button-1);
    count++;
    if(button==2){
      can=true;
      break;
    }
    else if(S.count(button)) break;
    else S.insert(button);
  }
  cout<<(can?count:-1)<<endl;
}

Measured memory_bytes: 8156
#include <stdio.h>
#include <math.h>

int main(void) {
  long  n, d;
  scanf("%ld %ld", &n, &d);
  int ret = 0;
  for(int i = 0;i < n;i++) {
    long x, y;
    scanf("%ld %ld", &x, &y);
    if(d >= sqrt(x * x + y * y)) {
      ret++;
    }
  }
  printf("%d\n", ret);
  return 0;
}


Measured memory_bytes: 2152
# -*- coding: utf-8 -*-
"""
B - Small and Large Integers
https://beta.atcoder.jp/contests/abc093/tasks/abc093_b

"""
import sys
from sys import stdin
input = stdin.readline


def main(args):
    A, B, K = map(int, input().split())
    ans = set()

    for x in range(A, A+K):
        if x <= B:
            ans.add(x)
    for x in range(B-K+1, B+1):
        if x >= A:
            ans.add(x)

    res = list(ans)
    res.sort()
    print(*res, sep='\n')


if __name__ == '__main__':
    main(sys.argv[1:])
    


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

typedef long long ll;

vector<pair<int, int> > A;
vector<int> R;

int main() {
    ios_base::sync_with_stdio(false);
    int n;
    cin >> n;
    for(int i = 0; i < n; i++) {
        int v;
        cin >> v;
        A.push_back({v, i});
    }
    sort(A.begin(), A.end());
    int off = n / 2;
    R = vector<int> (n);
    for(int i = 0; i < n; i++) {
        R[A[i].second] = A[i + off].first;
        off--;
        if(off == 0) off--;
    }
    for(int i : R) cout << i << endl;
}


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

#define rep(X,N) for(ll X = 0LL; X < (N); X++)
#define ALL(V) (V).begin(),(V).end()

using namespace std;
typedef long long ll;

const double PI = 3.1415926535897932384626;
const ll MODN = 1000000007;
const ll MODN2 = 998244353;
const double EPS = 1e-10;

int main(){

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

    int size = s.size();
    int ans = 0;

    rep(i, size){
        if(s[i] != t[i]) ans++;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3916
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <cmath>

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

using namespace std;

int main()
{
	int n, k;
	cin >> n >> k;
	int i;
	vector<int> p(n);
	for (i = 0; i < n; i++)
	{
		cin >> p[i];
	}
	sort(p.begin(), p.end());
	int sum = 0;
	for (i = 0; i < k; i++) sum += p[i];
	cout << sum;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi; 
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
const int mod = 1e9+7;
const int maxn = 2e5+10;
const int inf = 0x3f3f3f3f;
int cnt[maxn];
int main()
{
	ios::sync_with_stdio(false);cin.tie(0);
	int n;
	cin>>n;
	rep(i,1,n-1) {
		int x;
		cin>>x;
		cnt[x]++;
	}
	rep(i,1,n) cout<<cnt[i]<<'\n';
	return 0;
}


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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    string N;
    cin >> N;
    int c = N[N.size() - 1] - '0';
    if(c == 3) cout << "bon";
    else if(c == 0 || c == 1 || c == 6 || c == 8) cout << "pon";
    else cout << "hon";
    cout << endl;

    return 0;
}



Measured memory_bytes: 3652
import java.util.Arrays;
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-1];
		int[] count = new int[N];
		Arrays.fill(count, 0);
		for(int i = 0;i < N-1;i++){
			A[i] = sc.nextInt();
		}
		sc.close();
		count[0]++;
		for(int i = 1;i < N-1;i++){
			if(A[i-1]==A[i]){
				count[A[i-1]-1]++;
			}else{
				count[A[i]-1]++;
			}
		}
		for(int num : count){
			System.out.println(num);
		}
	}

}

Measured memory_bytes: 62928
#include <bits/stdc++.h>
#define mod 1000000007

using namespace std;
struct nodS
{
    long long dpb, dpw;
    vector<int> v;
};
int n,i,x,y;
nodS nod[100005];
void dfs(int p, int par)
{
    nod[p].dpw=nod[p].dpb=1;

    for(int it : nod[p].v)
    {
        if(it==par)
            continue;

        dfs(it, p);

        nod[p].dpw*=(nod[it].dpb + nod[it].dpw)%mod;
        nod[p].dpw%=mod;

        nod[p].dpb*=nod[it].dpw%mod;
        nod[p].dpb%=mod;
    }
}
int main()
{
    cin>>n;
    for(i=1;i<n;i++)
    {
        cin>>x>>y;
        nod[x].v.push_back(y);
        nod[y].v.push_back(x);
    }

    dfs(1, 0);

    cout<<(nod[1].dpw+nod[1].dpb)%mod;
    return 0;
}


Measured memory_bytes: 17540
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  int N;
  cin >> N;
  vector<pair<int, int> > P;
  rep(i, N) {
    int p;
    cin >> p;
    P.push_back(make_pair(p, i+1));
  }
  sort(P.begin(), P.end(), greater<pair<int, int> >());
  set<int> S;
  S.insert(0);
  S.insert(N+1);
  ll ans = 0;
  rep(i, N) {
    ll p = P[i].first;
    int idx = P[i].second;
    int r1 = *S.lower_bound(idx+1);
    int r2 = r1 == N+1 ? N+1 : *S.lower_bound(r1+1);
    int l1 = *(--S.upper_bound(idx-1));
    int l2 = l1 == 0 ? 0 : *(--S.upper_bound(l1-1));
    ans += p * ((r2 - r1) * (idx - l1) + (r1 - idx) * (l1 - l2));
    S.insert(idx);
  }
  cout << ans << endl;
  return 0;
}


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

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = (int)(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = (int)(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())

const int IINF = (1 << 30) - 1;
const long long LLINF = 1LL << 61;
const long long MOD = 1000000007LL;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

template<typename T>
bool chmin(T &_a, T _b){
    if(_a > _b){
        _a = _b;
        return true;
    }else{
        return false;
    }
}

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

    int n, m;
    vector<int> st(2);
    cin >> n >> m >> st[0] >> st[1];
    rep(i, 2){
        --st[i];
    }

    vector< vector<int> > g(n);
    rep(i, m){
        int u, v;
        cin >> u >> v;
        --u;
        --v;
        g[u].emplace_back(v);
        g[v].emplace_back(u);
    }

    vector< vector<int> > cost(2, vector<int>(n, IINF));
    rep(i, 2){
        queue< P > que;
        que.push({st[i], 0});
        while(!que.empty()){
            P now = que.front();
            que.pop();
            if(!chmin(cost[i][now.first], now.second)){
                continue;
            }
            for(auto e : g[now.first]){
                if(cost[i][e] > now.second + 1){
                    que.push({e, now.second + 1});
                }
            }
        }
    }

    int d = cost[0][st[1]];

    vector< vector<lint> > cnt(2, vector<lint>(d + 1, 0LL));
    rep(i, 2){
        rep(j, n){
            if(cost[i][j] <= d){
                ++cnt[i][cost[i][j]];
            }
        }
    }

    lint ans = 0;
    rep(i, d - 1){
        ans += cnt[0][i] * cnt[1][d - i - 2];
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 10860
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
//ll mod = 998244353;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    int n;
    ll k;
    cin >> n >> k;
    vector<ll> a(n);
    ll max_num = 0;
    rep(i, n) {
        cin >> a[i];
        max_num = max(max_num, a[i]);
    }
    if (k == 0) {
        cout << max_num << endl;
        return 0;
    }
    ll l = 0;
    ll r = 1e9;

    while(r-l>1LL) {
        ll m = (l + r) / 2LL;
        ll cnt = 0;
        rep(i, n) {
            cnt += (a[i] + m - 1LL) / m - 1LL; 
        }
        //cout << l << " " << r << " " << cnt << endl;
        if (cnt > k) {
            l = m;
        }
        else {
            r = m;
        }
    }
    cout << r << endl;
    return 0;
}


Measured memory_bytes: 4756
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

using ll = long long;
using ull = uint64_t;
using P = pair<int, int>;
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

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

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

    ll L, A, B;
    int M;
    cin >> L >> A >> B >> M;

    ll x = 0;
    // (桁数, [l, r)) のタプル
    vector<tuple<int, ll, ll>> table;
    while(x < L){
        ll lb = x, ub = L;
        int d = 0;
        ll X = A + B * x;
        while(X > 0){
            ++d;
            X /= 10;
        }
        while(ub - lb > 1){
            ll mid = (lb + ub) / 2;
            X = A + B * mid;
            int k = 0;
            while(X > 0){
                ++k;
                X /= 10;
            }
            if(k > d)   ub = mid;
            else    lb = mid;
        }
        table.emplace_back(d, x, ub);
        x = ub;
    }

    using Vec = vector<ll>;
    using Matrix = vector<Vec>;
    auto Mul = [&](const Matrix& X, const Matrix& Y) -> Matrix {
        Matrix res(X.size(), Vec(X[0].size(), 0));
        for(int i = 0; i < (int)X.size(); ++i){
            for(int k = 0; k < (int)X[0].size(); ++k){
                for(int j = 0; j < (int)Y.size(); ++j){
                    res[i][j] = (res[i][j] + X[i][k] * Y[k][j] % M) % M;
                }
            }
        }
        return res;
    };
    auto Pow = [&](Matrix X, ll n) -> Matrix {
        Matrix res(X.size(), Vec(X[0].size(), 0));
        for(int i = 0; i < (int)X.size(); ++i)  res[i][i] = 1;
        while(n){
            if(n & 1)   res = Mul(res, X);
            X = Mul(X, X);
            n >>= 1;
        }
        return res;
    };

    vector<ll> pow10(19);
    pow10[0] = 1;
    for(int i = 0; i + 1 <= 18; ++i)    pow10[i + 1] = pow10[i] * 10;

    ll ans = 0;
    A %= M, B %= M;
    for(auto tup : table){
        int d;
        ll l, r;
        tie(d, l, r) = tup;
        Matrix W(3, Vec(3, 0));
        W[0][0] = pow10[d] % M;
        W[0][1] = W[1][1] = W[2][2] = 1;
        W[1][2] = B;
        W = Pow(W, r - l);
        ll X = W[0][0] * ans % M;
        X = (X + W[0][1] * A) % M;
        X = (X + W[0][2]) % M;
        ll Y = W[1][0] * ans % M;
        Y = (Y + W[1][1] * A) % M;
        Y = (Y + W[1][2]) % M;
        ans = X, A = Y;
    }

    cout << ans << endl;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define N 3055
#define ll long long
int n,k;
ll dp[N][N], ar[N];

ll solve(int i, int j) {
    if(i>j)
        return 0;

    ll &ret = dp[i][j];
    if(~ret)
        return ret;

    ll c1 = ar[i] - solve(i+1,j);
    ll c2 = ar[j] - solve(i,j-1);
    return ret = max(c1,c2);
}

int main() {

    memset(dp, -1,sizeof dp);
    scanf("%d",&n);
    for(int i=1; i<=n; ++i) {
        scanf("%lld",&ar[i]);
    }
    cout << solve(1,n);

    return 0;
}


Measured memory_bytes: 73344
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int W,a,b;

int main()
{
	cin>>W>>a>>b;
	if((b>=a&&b<=a+W)||(a>=b&&a<=b+W))
		puts("0");
	else
		printf("%d\n",min(abs(b-(a+W)),abs(a-(b+W))));
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
typedef long long ll;
const int MOD = 1000000007;
#define PI 3.14159265358979
using namespace std;

int main() {
	int r;
	cin >> r;
	cout << 2 * r * PI << endl;
	return 0;
}


Measured memory_bytes: 3784
import java.io.*;
import java.util.*;

public class Main {

    public static void main(final String[] args) throws Exception {
        final Scanner sc = new Scanner(System.in);
        long N;
        N = sc.nextLong();
        long[] A = new long[(int)(N)];
        for(int i = 0 ; i < N ; i++){
                A[i] = sc.nextLong();
        }

        final Solver solver = new Solver();
        solver.solve(N, A);
    }
}

class Solver {
    public void solve(long N, long[] A) {
        long largest = 0;
        int largestIndex = 0;
        long secondLargest = 0;

        for (int i = 0; i < N; i++) {
            long v = A[i];

            if (largest < v) {
                largest = v;
                largestIndex = i;
                continue;
            }

            if (secondLargest < v) {
                secondLargest = v;
            }
        }

        for (int i = 0; i < N; i++) {
            if (i == largestIndex) {
                System.out.println(secondLargest);
            }
            else {
                System.out.println(largest);
            }
        }
    }
}



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

int main() {
	string N;
	cin >> N;
	if (N.at(0) == '9' || N.at(1) == '9') {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>
#include <string>
using namespace std;

int main()
{
    
    
    string s;
    
    cin >> s;
    
    if(s.size() == 2)cout << s << endl;
    else cout <<s[2]<<s[1]<<s[0]<<endl;
    
    
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <cctype>
#include <limits.h>
#include <math.h>
#include <complex>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define BINARY(x) static_cast<bitset<16> >(x)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)
#define if_range(x, y, w, h) if (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))

const int INF = 1e9;
const double EPS = 1e-8;
const double PI = 3.14159;
int dx[4]={0, 1, 0, -1}, dy[4]={-1, 0, 1, 0};
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

/* struct P {
	int x, y, n;
	P(int n, int x, int y):n(n), x(x), y(y){}
	P(){}
}; */

/** Problem2014 : Surrounding Area **/
int main()
{
	int W, H;
	while (cin>>W>>H, W) {
		char field[W][H];
		rep(i, H) {
			rep(j, W) {
				cin>>field[j][i];
			}
		}
		
		string C = "BW";
		int ans[2]={0};
		// color
		rep(c, 2) {
			rep(y, H) {
				rep(x, W) {
					if (field[x][y] != '.') continue;
					
					int tmp[2]={0};
					queue<P> Q;
					bool vis[W][H];
					memset(vis, 0, sizeof(vis));
					
					vis[x][y] = true;
					Q.push(P(x, y));
					
					while (Q.size()) {
						P p = Q.front(); Q.pop();
						if (field[p.first][p.second] != '.') {
							if (field[p.first][p.second] == 'B') tmp[0]++;
							else								 tmp[1]++;
							continue;
						}
						
						rep(d, 4) {
							int nx = p.first+dx[d], ny = p.second+dy[d];
							if_range(nx, ny, W, H) {
								if (!vis[nx][ny]) {
									Q.push(P(nx, ny));
									vis[nx][ny] = true;
								}
							}
						}
					}
					
					if (tmp[c]>0 && tmp[1-c]==0) ans[c]++;
				}
			}
		}
		
		cout << ans[0] << " " << ans[1] << endl;
	}
}

Measured memory_bytes: 1232
#include <bits/stdc++.h>
 
using namespace std;
#define ll long long
const ll INF=1e15;
#define int long long
#define pb push_back
#define mp make_pair
#define endl "\n"
#define fastio cin.tie(NULL); cout.tie(NULL); ios_base::sync_with_stdio(false)
const double pi = acos(-1.0);
int gcd (int a, int b) {
    while (b) {
        a %= b;
        swap(a, b);
    }
    return a;
}
int lcm (int a, int b) {
    return a / gcd(a, b) * b;
}

long long binpows(long long a, long long b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)  //impar
            res = res * a;
        a = a * a;
        b >>= 1;  // /2
    }
    return res;
}
const int mod=1e9+7;
int binpow(int a, int b, int m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
//CHECAR SE PRECISA DE LONG LONG
bool dp[123456];
void solve(){
	int n,k;
	cin>>k>>n;
	vector<int> v(k);
	for(auto &i: v)
		cin>>i;
	sort(v.begin(),v.end());

	for(int i=1; i<=n; i++){
		for(int j=0; j<v.size(); j++){
			if(v[j]>i)
				break;
			if(dp[i-v[j]]==0){
				dp[i]=1;
				break;
			}
		}
	}
	if(dp[n]==1){
		cout<<"First"<<endl;
	}else{
		cout<<"Second"<<endl;
	}
}
//revise as variaveis e a ordem nas funções
signed main(){
    int t=1;
    //cin>>t;
    while(t--){
        solve();
    }
}

Measured memory_bytes: 3648
n, k = map(int, input().split())

lis = []
max_num = 0
for i in range(n):
    array = list(map(int, input().split()))
    if array[0] > max_num:
        max_num = array[0]
    lis.append(array)

num_list = [0] * max_num

for i, j in lis:
    num_list[i-1] += j

count = 0
for i in range(len(num_list)):
    count += num_list[i]
    if count >= k:
        print(i+1)
        exit()

Measured memory_bytes: 30164
// -*- coding:utf-8-unix -*-

use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
        m: usize,
        ab: [(usize, usize); m],
    }
    let mut tomodachi = EquivalenceRelation::new(n);
    let mut group_size = vec![1; n];
    let mut group_size_max = 1;
    for &(ai, bi) in &ab {
        if tomodachi.are_equivalent(ai - 1, bi - 1) {
            continue;
        }
        let groupsizea = group_size[tomodachi.find(ai - 1)];
        let groupsizeb = group_size[tomodachi.find(bi - 1)];
        tomodachi.make_equivalent(ai - 1, bi - 1);
        let newval = groupsizea + groupsizeb;
        group_size[tomodachi.find(ai - 1)] = newval;
        group_size_max = group_size_max.max(newval);
    }
    println!("{}", group_size_max);
}

use std::cell::Cell;

#[derive(Debug, Clone)]
struct EquivalenceRelation {
    parent: Vec<Cell<usize>>,
    rank: Vec<Cell<usize>>,
}

impl EquivalenceRelation {
    fn new(n: usize) -> Self {
        let mut parent = Vec::with_capacity(n);
        for i in 0..n {
            parent.push(Cell::new(i));
        }
        let rank = vec![Cell::new(0); n];
        return Self { parent, rank };
    }

    fn make_equivalent(&mut self, a: usize, b: usize) {
        let volume = self.parent.len();
        if a >= volume || b >= volume {
            panic!(
                "Tried to make {} and {} equivalent but there are only {} elements",
                a, b, volume
            );
        }
        let aa = self.find(a);
        let bb = self.find(b);
        if aa == bb {
            return;
        }
        let aarank = self.rank[aa].get();
        let bbrank = self.rank[bb].get();
        if aarank > bbrank {
            self.parent[bb].set(aa);
        // self.rank[aa] = aarank.max(bbrank + 1);
        } else {
            self.parent[aa].set(bb);
            self.rank[bb].set(bbrank.max(aarank + 1));
        }
    }

    fn find(&self, a: usize) -> usize {
        let volume = self.parent.len();
        if a >= volume {
            panic!("Tried to find {} but there are only {} elements", a, volume);
        }
        let b = self.parent[a].get();
        if b == a {
            return a;
        } else {
            let c = self.find(b);
            self.parent[a].set(c);
            return c;
        }
    }

    fn are_equivalent(&self, a: usize, b: usize) -> bool {
        return self.find(a) == self.find(b);
    }
}


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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex<double> point;
#define F first
#define S second



int main()
{
    #ifdef DGC
        freopen("a.txt", "r", stdin);
        //freopen("b.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(0), cin.tie(0);

    int n;
    cin >> n;
    vector<vector<pair<int, int>>> adj(n);
    for (int i = 1, u, v, w; i < n; ++i)
    {
        cin >> u >> v >> w;
        --u, --v;
        adj[u].push_back({ v, w });
        adj[v].push_back({ u, w });
    }

    vector<int> a(n, -1);
    function<void(int, int, int)> dfs = [&](int u, int p, int w)
    {
        a[u] = (p==-1) ? 0 : ((w&1) ? !a[p] : a[p]);
        for (auto v : adj[u])
            if (v.F != p)
                dfs(v.F, u, v.S);
    };

    dfs(0, -1, 0);

    for (auto &i : a)
        cout << i << "\n";

    return 0;
}


Measured memory_bytes: 8960
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
/* clang-format off */
#define MOD 1000000007
#define INF 1000000000
#define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(a) (a).begin(), (a).end()
#define __DEBUG__
#ifdef __DEBUG__
#define CH_P(a) cout <<"check_point("<<#a<<")" << "\n";
#define DEBUG(x) cout<<#x<<":"<<x<<"\n"
#define DEBUGS(v) cout << #v << ":";for(auto x:v){cout<<x<<" ";}cout<<"\n"
#endif
#ifndef __DEBUG__
#define CH_P(a) 
#define DEBUG(x) 
#define DEBUGS(v) 
#endif
/* clang-format on */

int main() {
  ll n;
  cin >> n;
  vector<ll> b(n), ans(n);
  REP(i, n) { cin >> b[i]; }
  REP(i, n) {
    bool f = false;
    for (ll j = b.size() - 1; j >= 0; j--) {
      if (b[j] == j + 1) {
        ans[i] = b[j];
        b.erase(b.begin() + j);
        f = true;
        // DEBUGS(b);
        break;
      }
    }
    if (!f) {
      cout << "-1\n";
      return 0;
    }
  }
  reverse(ALL(ans));
  REP(i, n) { cout << ans[i] << "\n"; }
  return 0;
}


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


public class Main {

    public static void main(String[] args) throws IOException {
        Scanner s = new Scanner(System.in);
        int a = s.nextInt();
        char c = s.next().charAt(0);
        int  b = s.nextInt();
        if(c=='+') System.out.println(a+b);
        else System.out.println(a-b);
    }

}




class Scanner
{
    StringTokenizer st;
    BufferedReader br;

    public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

    public String next() throws IOException
    {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }

    public int nextInt() throws IOException {return Integer.parseInt(next());}

    public long nextLong() throws IOException {return Long.parseLong(next());}

    public String nextLine() throws IOException {return br.readLine();}

    public double nextDouble() throws IOException
    {
        String x = next();
        StringBuilder sb = new StringBuilder("0");
        double res = 0, f = 1;
        boolean dec = false, neg = false;
        int start = 0;
        if(x.charAt(0) == '-')
        {
            neg = true;
            start++;
        }
        for(int i = start; i < x.length(); i++)
            if(x.charAt(i) == '.')
            {
                res = Long.parseLong(sb.toString());
                sb = new StringBuilder("0");
                dec = true;
            }
            else
            {
                sb.append(x.charAt(i));
                if(dec)
                    f *= 10;
            }
        res += Long.parseLong(sb.toString()) / f;
        return res * (neg?-1:1);
    }

    public boolean ready() throws IOException {return br.ready();}


}

Measured memory_bytes: 25108
#include <bits/stdc++.h>
#define f(i, a, b) for(int i=a; i<b; i++)
using namespace std;

int main()
{
	int n;
	cin>>n;
	int h[n], dp[n];
	f(i, 0, n) cin>>h[i];
	dp[0] = 0; dp[1] = abs(h[1] - h[0]);
	f(i, 2, n) dp[i] = min(dp[i-1] + abs(h[i] - h[i-1]), dp[i-2] + abs(h[i] - h[i-2]));
	cout<<dp[n-1];
}

Measured memory_bytes: 1024