akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()
#define let auto const

template<typename F>
static inline constexpr decltype(auto) fix(F&& f) noexcept {
  return [f = std::forward<F>(f)](auto&&... args) {
    return f(f, std::forward<decltype(args)>(args)...);
  };
}
template<typename T>
static inline T fin() { T t; cin >> t; return std::move(t); }

int N;
int M;

struct edge{
  i64 to;
  i64 cost;
};

vector<vector<edge>> edges;

vector<i64> dist;

int main(){
  i64 P;
  cin >> N >> M >> P;

  edges.resize(N);
  dist.resize(N,1e12);
  rep(i,0,M - 1){
    i64 a,b,c;
    cin >> a >> b >> c;
    a--;
    b--;
    edges[a].push_back({b,P-c});
  }

  dist[0] = 0;

  rep(i,0,N){
    rep(v,0,N - 1){
      for(auto & e : edges[v]){
        if(dist[v] == 1e12) continue;
        dist[e.to] = min(dist[e.to] , dist[v] + e.cost);
      }
    }
  }

  vector<bool> ne(N,false);

  rep(i,0,N){
    rep(v,0,N - 1){
      for(auto & e : edges[v]){
        if(dist[v] == 1e12) continue;
        if(dist[e.to] > dist[v] + e.cost){
          dist[e.to] = dist[v] + e.cost;
          ne[e.to] = true;
        }
        ne[e.to] = ne[e.to] || ne[v];
      }
    }
  }

  if(ne[N - 1]){
    cout << -1 << endl;
  }
  else{
    cout << max(0ll, dist[N - 1] * -1) << endl;
  }

}




Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int i=0; i<(n); ++i)
#define REP(i, d, n) for(int i=(d); i<(n); ++i)
#define all(v) v.begin(), v.end()
using P = pair<int, int>;

class UnionFind {
public:
    vector<int> d;
    
    UnionFind(int n = 0) : d(n, -1) {}

    int find(int x) {
        if(d[x] < 0){
            return x;
        }
        return d[x] = find(d[x]); // メモ化再帰
    }
    
    bool unite(int x, int y) {
        x = find(x); 
        y = find(y);
        if(x == y){
            return false;
        }
        if(size(x) < size(y)){
            swap(x,y);
        } 
        d[x] += d[y];
        d[y] = x;
        return true;
    }
    
    bool same(int x, int y) { 
        return find(x) == find(y);
    }
    
    int size(int x) { 
        return -d[find(x)];
    }
};

signed main() {

    int n, m;
    cin >> n >> m;
    UnionFind uf(n);
    vector<vector<int>> graph(n);
    rep(i, m){
        int a, b;
        cin >> a >> b;
        --a; --b;
        uf.unite(a, b);
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
    
    queue<int> q;
    vector<int> dis(n, -1), ans(n);
    q.push(0);
    dis[0] = 0;
    while(!q.empty()){
        int v = q.front();
        q.pop();
        rep(i, (long long)graph[v].size()){
            int u = graph[v][i];
            if(dis[u] == -1){
                dis[u] = dis[v] + 1;
                ans[u] = v;
                q.push(u);
            }
        }
    }

    bool ok = true;
    rep(i, n){
        if(!uf.same(0, i)){
            ok = false;
        }
    }

    if(ok){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
        return 0;
    }

    REP(i, 1, n){
        cout << ans[i] + 1 << endl;
    }

    return 0;
}


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

using namespace std;

const int mod = 998244353;
const int up = 2e5 + 5;
int tree[up << 2], lazy[up << 2];
int pref[up];

int range(int l, int r) {
    return (pref[l] - pref[r + 1] + mod) % mod;
}
void build(int node, int l, int r) {
    if(l == r) {
        tree[node] = range(l, r);
    }else {
        int mid = (l + r)  >> 1;
        build(2 * node, l, mid);
        build(2 * node + 1, mid + 1, r);
        tree[node] = (tree[2 * node] + tree[2 * node + 1]) % mod;
    }
}

void relax(int node, int l, int r) {
    if(l != r) {
        lazy[2 * node] = lazy[node];
        lazy[2 * node + 1] = lazy[node];
    }
    tree[node] = (1ll * lazy[node] * range(l, r)) % mod;
    lazy[node] = 0;
}

void update(int node, int l, int r, int ql, int qr, int val) {
    if(lazy[node]) {
        relax(node, l, r);
    }
    if(ql > r || l > qr) {
        return;
    }
    if(ql <= l && r <= qr) {
        lazy[node] = val;
        relax(node, l, r);
        return;
    }
    int mid = (l + r) >> 1;
    update(2 * node, l, mid, ql, qr, val);
    update(2 * node + 1, mid + 1, r, ql, qr, val);
    tree[node] = (tree[2 * node] + tree[2 * node + 1]) % mod;
}
int main()
{
    ios_base::sync_with_stdio(false);
    int n, q;
    cin >> n >> q;

    pref[n] = 1;
    for(int i = n - 1; i >= 1; --i) {
        pref[i] = (10ll * pref[i + 1]) % mod;
    }
    for(int i = n - 1; i >= 1; --i) {
        pref[i] += pref[i + 1];
        pref[i] %= mod;
    }
    build(1, 1, n);
    int l, r, d;
    for(int i = 0; i < q; ++i) {
        cin >> l >> r >> d;
        update(1, 1, n, l, r, d);
        cout << tree[1] << '\n';
    }
    return 0;
}

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

MOD=10**9+7

S=read().rstrip().decode("utf-8")
#print("S:",S)

R=[0]*13
R_buffer=[0]*13

if S[0]=="?":
  for i in range(0,10):
    R[i]=1
else:
  R[int(S[0])]=1
#print("R:",R)

for i in range(1,len(S)):
  
  if S[i]=="?":
    for j in range(13):
      for k in range(10):
        R_buffer[(j*10+k)%13]+=R[j]
  else:
    for j in range(13):
      R_buffer[(j*10+int(S[i]))%13]+=R[j]
  
  for j in range(13):
    R[j]=R_buffer[j]%MOD
    R_buffer[j]=0
  #print("R:",R)
  
print(R[5])

Measured memory_bytes: 42988
#include <iostream>
#include <vector>
#include <math.h>
#include <cmath>
#include <algorithm>
#include <string>
#include <cstring>

using namespace std;

using ull = unsigned long long;
using vi = vector<int>;
using vs = vector<string>;
using vull = vector<ull>;

#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define rFOR(i,a,b) for(int i=(b);i>=(a);i--)
#define SORT(a) sort((a).begin,(a).end);
#define rSORT(a) sort((a).rbegin,(a).rend);
#define yn(a) cout <<((a)?"Yes":"No")<<endl;

int isP(int n) {
    if(n<=1) return 0;
    FOR(i,2,(int)sqrt(n)) {
        if(n%i==0) return 0;
    }
    return 1;
}

int main() {

    int H,W,yc=0;
    cin >>H>>W;
    vs a(H);
    FOR(i,0,H-1) {
        cin >>a[i];
    }

    FOR(i,0,W+1) {
        cout <<"#";
    }
    cout <<endl;
    FOR(i,0,H-1) {
        cout <<"#"<<a[i]<<"#"<<endl;
    }
    FOR(i,0,W+1) {
        cout <<"#";
    }
    cout <<endl;
    
    return 0;
}

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

public class Main {
    private static String repeat(String s, int n) {
        return new String(new char[n]).replace("\0", s);
    }
    public static void main(String[] args) {
        // @DONE

        Scanner in = new Scanner(System.in);

        String s = in.nextLine();
        StringTokenizer st = new StringTokenizer(s);
        int x1 = Integer.parseInt(st.nextToken());
        int y1 = Integer.parseInt(st.nextToken());
        int x2 = Integer.parseInt(st.nextToken());
        int y2 = Integer.parseInt(st.nextToken());

        // First move up
        StringBuilder ret = new StringBuilder();

        ret.append(repeat("U", Math.max(0, y2 - y1)));
        ret.append(repeat("R", Math.max(0, x2 - x1)));
        ret.append(repeat("D", Math.max(0, y2 - y1)));
        ret.append(repeat("L", Math.max(0, x2 - x1)));

        ret.append("L");
        ret.append(repeat("U", Math.max(0, y2 - y1 + 1)));
        ret.append(repeat("R", Math.max(0, x2 - x1 + 1)));
        ret.append("DR");
        ret.append(repeat("D", Math.max(0, y2 - y1 + 1)));
        ret.append(repeat("L", Math.max(0, x2 - x1 + 1)));
        ret.append("U");

        System.out.println(ret.toString());
    }
}


Measured memory_bytes: 25556
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
    ll N;
    cin >> N;
    ll a[N];
    ll i;
    for(i=0;i<N;i++){
      cin >> a[i];
    }
    sort(a,a+N);
    ll ans=0;
    ll tmp=0;
    for(i=0;i<N;i++){
      if (tmp!=a[i])ans++;
      tmp = a[i];
    }
    cout << ans <<endl;
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var (
	scanner = bufio.NewScanner(os.Stdin)
	w       = bufio.NewWriter(os.Stdout)
)

func readInt() (read int) {
	scanner.Scan()
	read, err := strconv.Atoi(scanner.Text())
	if err != nil {
		panic(err)
	}
	return
}

func main() {
	scanner.Split(bufio.ScanWords)
	defer w.Flush()

	n := readInt()
	m := readInt()
	tw := make([]int, n)
	for i := 0; i < n; i++ {
		tw[i] = readInt()
	}

	good := make([]bool, n)
	for i := 0; i < n; i++ {
		good[i] = true
	}

	for i := 0; i < m; i++ {
		a := readInt() - 1
		b := readInt() - 1
		if tw[a] > tw[b] {
			good[b] = false
		} else if tw[a] == tw[b] {
			good[a] = false
			good[b] = false
		} else {
			good[a] = false
		}
	}

	cnt := 0
	for i := 0; i < n; i++ {
		if good[i] {
			cnt++
		}
	}

	fmt.Println(cnt)
}

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

typedef long long ll;

int main() {

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

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

    int arr[3] = {0};
    int k = 0;
    cin >> arr[0] >> arr[1] >> arr[2];
    cin >> k;
    int ans = 0;
    int count = 0;

    while(arr[1] <= arr[0]) {
        arr[1] = arr[1] * 2;
        count++;
    }
    
    while(arr[2] <= arr[1]) {
        arr[2] = arr[2] * 2;
        count++;
    }

    if(count > k) ans = 0;
    else ans = 1;



    if(ans) cout << "Yes\n";
    else cout << "No\n";

    return 0;
}

Measured memory_bytes: 3580
#include <cstdio>
#include <algorithm>

int n, dp[4001];

int main(){
    for(int a = 0; a <= 1000; a++){
        for(int b = 0; b <= 1000; b++){
            dp[a + b]++;
        }
    }

    while(scanf("%d", &n) != EOF){
        int ans = 0;

        for(int i = 0; i <= 2000; i++){
            if(n - i < 0 || n - i > 2000) continue;
            ans += dp[i] * dp[n - i];
        }

        printf("%d\n", ans);
    }

    return 0;
}

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

int main() {
    int K, A, B;
    std::cin >> K >> A >> B;

    for (int i = A; i <= B; ++i) {
        if (i % K == 0) {
            std::cout << "OK" << std::endl;
            return 0;
        }
    }

    std::cout << "NG" << std::endl;

    return 0;
}


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

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;
const int INF = 2147483647;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//myfuncs
//素数判定
template<class T> inline T isPrime(T x) {
    bool ret = true;
    if (x < 2) {
        ret = false;
    }
    for (LL i = 2; i <= sqrt(x); i++) {
        if (x%i == 0) {
            ret = false;
        }
    }
    return ret;
}

//Union FInd
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

//main code

int main(int argc, char const* argv[])
{
    int n;
    cin >> n;
    int nt,nx,ny;
    nt = 0,nx = 0,ny = 0;
    for (int i = 0; i < n; i++) {
        int t,x,y,dx,dy;
        cin >> t >> x >> y;
        dx = x - nx,dy = y - ny;
        if ((t-(dx + dy + nt)) % 2 == 1) {
            cout << "No" << endl;
            return 0;
        }
        else if (t - (dx + dy + nt) < 0) {
            cout << "No" << endl;
            return 0;
        }
        else {
            nt = t,nx = x,ny = y;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define REP(i, a, n) for (int i = (a); i < (int)(n); ++i)
#define REPC(i, a, n) for (int i = (a); i <= (int)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init) \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T>
using VEC = std::vector<T>;
template <class T>
using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail>
void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec) os << v << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}

int main() {
  int n, m;
  cin >> n >> m;
  VEC<LL> sum(n);
  VEC<LL> x(n), y(n), z(n);
  REP(i, 0, n) { cin >> x[i] >> y[i] >> z[i]; }
  int lim = 0b1000;
  LL ans=0;
  REP(i, 0, lim) {
    VEC<LL>sum(n,0);
    REP(j, 0, n) {
      VEC<LL> p = {x[j], y[j], z[j]};
      REP(k, 0, p.size()) {
        if ((i & (1 << k)) == 0) {
          sum[j] += p[k];
        } else
          sum[j] -= p[k];
      }
    }
    sort(ALL(sum));
    reverse(ALL(sum));
    LL cand=0;
    REP(i,0,m){
      cand+=sum[i];
    }
    ans=max(ans,cand);
   // cerr<<ans<<endl;
  }
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python

N,K=map(int,raw_input().split())
arr=[[0,0]]*N
for i in range(N):
    arr[i]=map(int,raw_input().split())
#print "Not sorted arr",
#print arr
arr=sorted(arr)
#print "sorted",
#print arr
sum=0
for i in range(N):
#    print "i: "+str(i)
    sum=sum+arr[i][1]
#    print "sum = "+str(sum)
    if sum>=K:
#        print "sum: "+str(sum)
        print arr[i][0]
        break

Measured memory_bytes: 21876
fun main(args: Array<String>) {
    val arrTmp = readLine()!!.split(" ").map(String::toInt)
    val arr = arrTmp.sorted()
    var res = 0
    for (i in 0..(arr.size-2)) {
        res += arr[i + 1] - arr[i]
    }
    println(res)
}

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

//--------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX/3

//--------------------------------------------
const double EPS = 1e-14;
const double PI  = acos(-1.0);

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

int main(){
  int a, b, c, d;

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

  if (a <= c) printf("%d\n",max(0, min(d - c, b - c)));
  else printf("%d\n",max(0, min(d - a, b - a)));
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long int
#define ll long long int 
#define vi vector<int> 
#define vl vector<ll> 
#define vvi vector<vector<int>>
#define vvl vector<vector<ll>>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vpii vector<pii>
#define vpll vector<pair<ll,ll>>
#define umap unordered_map
#define uset unordered_set
#define all(c) c.begin(), c.end()
#define maxarr(A) *max_element(A, A+n) 
#define maxvec(v) *max_element(all(v)) 
#define minarr(A) *min_element(A, A+n);
#define minvec(v) *min_element(all(v));
#define lb(v,elem) lower_bound(all(v),elem)
#define ub(v,elem) upper_bound(all(v),elem)
#define pb push_back 
#define ff first 
#define ss second
#define sz(z) (int)z.size()
#define rep(i,a,b) for(int i=a; i<b; ++i)
#define rev(i,a,b) for(int i=a; i>=b; i--)
#define debug(v) for(ll i=0; i<v.size(); i++) cout<<v[i]<<" "; cout<<endl;
#define debugn(v,n) for(ll i=0; i<n; i++) cout<<v[i]<<" "; cout<<endl;
#define deb(sum) cout<<"sum = "<<sum<<endl;
#define mod 1000000007
#define INF (ll)1e18
#define endl "\n"
#define pi 3.142857142857143

  
ll binpow(ll a, ll b) {
	if (b == 0)
		return 1;
	ll res = binpow(a, b / 2);
	if (b % 2)
		return res * res * a;
	else
		return res * res;
}

ll modexpo(ll x, ll y, ll p){  
	ll res = 1;  
	x = x % p; 
	if (x == 0) return 0;
	while (y > 0){   
		if (y & 1)  
			res = (res*x) % p;  
		y = y>>1;
		x = (x*x) % p;  
	}  
	return res;  
}

vector<int> getPrimes(int M){
	
	vi p(M,1);
	vector<int>prime;
	for(int i=2; i*i <= M; ++i){
		if(p[i]){
			for(int j = i*i; j<=M; j+=i) 
				p[j] = 0;
		}
	}
	rep(i,2,M) if(p[i]) prime.push_back(i);
	return prime;
}  


int main() { 
  ios_base::sync_with_stdio(false); 
  cin.tie(NULL); 
  cout.tie(NULL); 
  //freopen("1.in","r",stdin);
  
  int t=1;
  //cin>>t;
  while(t--){
  	 int x,y;
  	 cin>>x>>y;
  	 if(y%2) cout<<"No"<<endl;
  	 else{
  	 	if(y>=x*2 && y<=4*x) cout<<"Yes"<<endl;
  	 	else cout<<"No"<<endl;
  	 }
  } 
  return 0;
} 


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

using namespace std;
#define BUF (100005)

#define ll long long 

int k;

vector<int> v[BUF];
vector<int> v_[BUF];
int d[BUF];

int main(void){
	cin >> k;
	for(int i=1;i<k;i++){
		v[i].push_back((i+1)%k);
		v_[i].push_back((10*i)%k);
	}


	deque<int> q;
	q.push_front(1);
	d[1] = 1;	

	while(1){
		int p=q.front();
		q.pop_front();
		if(p==0) break;
		for(auto x: v_[p]){
			if(d[x]==0 || d[x]>d[p]){
				q.push_front(x);
				d[x]=d[p];
			}
		}

		for(auto x: v[p]){
			if(d[x]==0 || d[x]>d[p]+1){
				q.push_back(x);
				d[x]=d[p]+1;
			}
		}
	}

	cout << d[0] << endl;

	return 0;
}


Measured memory_bytes: 11776
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef map<int, int> mi;
typedef set<int> si;
#define VV(T) vector<vector< T > >
#define dump(x)  cout << #x << " = " << (x) << endl
#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 rep(i, n) REP(i, 0, n)                              // 0, 1, ..., n-1
#define REP(i, x, n) for(int i = x; i < n; i++)             // x, x + 1, ..., n-1
#define FOREACH(x,a) for(auto& (x) : (a) )
#define SORT(x) sort(x.begin(), x.end())

#define ALL(v) (v).begin() , (v).end()
#define RALL(v) (v).rbegin(), (v).rend()

#define pb push_back
#define pu push
#define mp make_pair
#define fi first
#define sc second

#define COUT(x) cout << (x) << endl
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECCOUT(x) for(auto&youso_: (x) )cout<<youso_<<" ";cout<<endl

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


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

    int A, B, C; cin >> A >> B >> C;
    if(A == B && B == C && C == A) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>

int max(int a, int b){
  if(a > b) return a;
  else return b;
}

int min(int a, int b){
  if(a < b) return a;
  else return b;
}

typedef long long ll;

ll check_digit(ll a){

  int digit = 1;
  while( (a / 10) > 0 ){
    ++digit;
    a /= 10;
  }

  return digit;

}

int main(){

  ll n;
  scanf("%lld",&n);

  ll ans =100000000000000000;
  for(ll a = 1; a*a <= n; ++a){
    if(n % a != 0) continue;
    ll b = n/a;
    int tmp = max(check_digit(a),check_digit(b));
    ans = min(ans,tmp);
  }

  printf("%d",ans);

  return 0;

}


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

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if (a * c <= b)
    {
        cout << c << endl;
    }
    else
    {
        cout << b / a << endl;
    }
    return 0;
}


Measured memory_bytes: 256
/* Alohomora */
#include<bits/stdc++.h>
#define ll         long long
#define fl(i,n)    for(i=0;i<n;i++)
#define fld(i,a,b) for(i=a;i>b;i--)
#define fli(i,a,n) for(i=a;i<n;i++)
#define inp(i,a,n) for(i=0;i<n;i++) {cin>>a[i];}
#define op(i,a,n)  for(i=0;i<n;i++) {cout<<a[i]<<" ";}
#define pb         push_back
#define mp         make_pair
#define mod1        987654319 
#define speedup    ios_base::sync_with_stdio(false),cin.tie(0)
using namespace std;
ll fact(ll n){ if(n==0){return 1;}return (n*fact(n-1))%mod1;}
ll power(ll x, ll y,ll mod){ll out = 1;while (y > 0){if (y & 1) out=(out*x)%mod;y = y>>1;x = (x*x)%mod;}return out%mod;}
ll inverse(ll a){return power(a,mod1-2,mod1);}
ll gcd(ll a,ll b){if(b==0){return a;}gcd(b,a%b);}
ll a[2000000];
void sieve(){ll i,j;fli(i,2,1000001){if(a[i]==0){for(j=i*i;j<1000001;j+=i){a[j]=1;}}}}
map<ll,vector<ll> >m1;
vector<ll>v1;
bool compar(const pair<ll,ll> &a, const pair<ll,ll> &b) 
{ 
    return (a.second < b.second);
} 
ll level[1000000];
vector<ll>root;
void comp()
{
	ll i,j,l,r,n;
	vector<ll>v1;
	cin>>n;
	fl(i,n)
	{
		cin>>j;
		v1.pb(j);
	}
	ll sum=0,temp;
	fl(i,n)
	{
		if(i%2)
		sum-=v1[i];
		else
		sum+=v1[i];
	}
	vector<ll>v2;
	v2.pb(sum);
	sum/=2;
	fl(i,n-1)
	{
		temp=v1[i]-sum;
		v2.pb(2*temp);
		sum=temp;
	}
	fl(i,n)
	{
		cout<<v2[i]<<" ";
	}
	cout<<"\n";
} 
int main()
{
	speedup;
	ll i=0,t;
	ll n;
	//cin>>t;
	t=1;
	while(t--)
	{
	 comp();
	}
}

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

typedef long long ll;
const ll MOD = 998244353;
const int MAXN = 5010;

ll Pow(ll a, ll b)
{
	ll ans = 1;
	for(; b; b >>= 1)
	{
		if(b & 1) ans = ans * a % MOD;
		a = a * a % MOD;
	}
	return ans;
}

int n, k; ll pow2[MAXN];
ll fac[MAXN], inv[MAXN];

inline ll C(int n, int m)
{
	if(n < 0 || m > n || m < 0) return 0;
	return fac[n] * inv[m] % MOD * inv[n - m] % MOD;
}

ll calc(int a, int b, int c)
{
	ll res = 0;
	for(int i = 0; i <= min(a, c); ++i)
	{
		ll sum = C(a, i) * pow2[i] % MOD * C(c + b - 1, i + b - 1) % MOD;
		res = (res + sum) % MOD;
	}
	return res;
}

int main()
{
	fac[0] = 1;
	for(int i = 1; i < MAXN; ++i) fac[i] = fac[i - 1] * i % MOD;
	inv[MAXN - 1] = Pow(fac[MAXN - 1], MOD - 2);
	for(int i = MAXN - 2; ~i; --i) inv[i] = inv[i + 1] * (i + 1) % MOD;
	pow2[0] = 1;
	for(int i = 1; i < MAXN; ++i) pow2[i] = pow2[i - 1] * 2ll % MOD;
	scanf("%d %d", &k, &n);
	for(int i = 2; i <= 2 * k; ++i)
	{
		int cnt = 0;
		for(int j = 1; j <= k; ++j) cnt += (i - j >= 1 && i - j <= k);
		ll ans = calc(cnt >> 1, k - cnt, n);
		if(!(i & 1)) ans = (ans + calc(cnt >> 1, k - cnt, n - 1)) % MOD;
		printf("%lld\n", ans);
	}
	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

struct FastIO{
  FastIO(){
    cin.tie(0);
    ios::sync_with_stdio(0);
  }
}fastio_beet;

//INSERT ABOVE HERE
const int MAX = 200;
using UC = unsigned char;
int a[MAX][MAX];
int s[MAX][MAX];

int query(UC u,UC d,UC l,UC r){
  assert(u<=d&&l<=r);
  return (s[u][l]+s[d][r])-(s[u][r]+s[d][l]);
}


UC lg[MAX]={};
int calc(UC u,UC d,UC l,UC r){
  return (d*(d-1)/2+u)*(185*186/2)+(r*(r-1)/2+l);
}

UC dp[296012025]={};
UC dfs(UC u,UC d,UC l,UC r){
  if(query(u,d,l,r)==0) return 0;
  if(query(u,d,l,r)==(int)(d-u)*(r-l)) return 0;
  if((int)(d-u)*(r-l)==2) return 1;

  if((d-u)==3&&(r-l)==1)
    return 2-(a[u][l]==a[u+1][l]||a[u+1][l]==a[u+2][l]); 
  if((d-u)==1&&(r-l)==3)
    return 2-(a[u][l]==a[u][l+1]||a[u][l+1]==a[u][l+2]);
  
  if((d-u)==2&&(r-l)==2)
    return min(max(dfs(u,d,l,l+1),dfs(u,d,l+1,r)),
               max(dfs(u,u+1,l,r),dfs(u+1,d,l,r)))+1;
  
  int st=calc(u,d,l,r);
  if(dp[st]) return dp[st];  
  UC &res=dp[st];
  res=lg[d-u]+lg[r-l]; 
  
  {
    int L=u,R=d;
    while(L+1<R){
      int M=(L+R)>>1;
      UC y=M;
      UC a=dfs(u,y,l,r);
      UC b=dfs(y,d,l,r);
      if(min(a,b)+1>=res) break;
      chmin(res,max(a,b)+1);
      if(a>=b) R=M;
      else L=M;
    }
  }
  {
    int L=l,R=r;
    while(L+1<R){
      int M=(L+R)>>1;
      UC x=M;
      UC a=dfs(u,d,l,x);
      UC b=dfs(u,d,x,r);
      if(min(a,b)+1>=res) break;
      chmin(res,max(a,b)+1);
      if(a>=b) R=M;
      else L=M;
    }
  }
  return res;
}

signed main(){    
  int h,w;
  cin>>h>>w;
  vector<string> st(h);
  for(int i=0;i<h;i++) cin>>st[i];

  for(int i=2;i<MAX;i++) while((1<<lg[i])<i) lg[i]++;
  
  memset(a,0,sizeof(a));
  memset(s,0,sizeof(s));
  for(int i=0;i<h;i++)
    for(int j=0;j<w;j++)
      a[i][j]=st[i][j]=='.';
    
  for(int i=0;i+1<MAX;i++)
    for(int j=0;j+1<MAX;j++)
      s[i+1][j+1]=s[i+1][j]+a[i][j];
  
  for(int i=0;i+1<MAX;i++)
    for(int j=0;j<MAX;j++)
      s[i+1][j]+=s[i][j];
  
  cout<<(int)dfs(0,h,0,w)<<endl;
  return 0;
}


Measured memory_bytes: 289664
import java.util.*;
import java.util.stream.IntStream;

public class Main {
    static int length = 2 * (int)1e9 + 1;
    public static void main(String args[]) {
        Scanner scan = new Scanner(System.in);
        int N =scan.nextInt();
        int M =scan.nextInt();

        List<Queue<Integer>> A = new ArrayList<>(N);
        for (int i : IntStream.range(0, N).toArray()){
            Queue<Integer> tmp = new ArrayDeque<>(M);
            for (int j :IntStream.range(0, M).toArray()){
                tmp.add(scan.nextInt() - 1);
            }
            A.add(tmp);
        }
        int[] players = new int[M];
        int[] playerLikes = new int[N];
        for (int j :IntStream.range(0, N).toArray()){
            int like = A.get(j).poll();
            players[like]++;
            playerLikes[j] = like;
        }
        int popular = maxIndex(players);
        int score = max(players);
        for (int i :IntStream.range(1, M).toArray()){
            popular = maxIndex(players);
            players[popular] = -1;
            for (int j :IntStream.range(0, N).toArray()){
                if(playerLikes[j] == popular) {
                    int like = A.get(j).poll();
                    playerLikes[j] = like;
                    while (players[playerLikes[j]] == -1) {
                        like = A.get(j).poll();
                        playerLikes[j] = like;
                    }
                    players[like]++;
                }
            }
            score = Math.min(score, max(players));
        }
        System.out.println(score);
    }

    static int max(int[] a) {
        int max = 0;
        for (int tmp : a) {
            max = Math.max(max, tmp);
        }
        return max;
    }

    static int maxIndex(int[] a) {
        int max = 0;
        int index = 0;
        for (int i = 0; i < a.length; i++) {
            if (a[i] > max) {
                max = a[i];
                index = i;
            }
        }
        return index;
    }

}


Measured memory_bytes: 51044
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
 
using namespace std;
 
#define rint register int
#define gc() getchar()
inline int read(int r=0,int s=0,int c=gc()){for(;c<48||c>57;s=c,c=gc());for(;c>=48&&c<=57;(r*=10)+=c-48,c=gc());return s^'-'?r:-r;}
int a[105], b[105], c[105], d[105], g[105][105], n, Ans; int book[105], T, match[105];
bool DFS(int p)
{for(rint v = 1; v <= n; v++) if(book[v]<T && g[p][v] && (book[v]=T, !match[v] || DFS(match[v]))){match[v] = p; return true;} return false;}
void Hungary(){for(rint i = 1; i <= n; ++T, Ans += DFS(i), i++);}
int main()
{
	n = read(); for(rint i = 1; i <= n; a[i] = read(), b[i] = read(), i++); for(rint i = 1; i <= n; c[i] = read(), d[i] = read(), i++);
	for(rint i = 1, j; i <= n; i++) for(j = 1; j <= n; j++) if(a[i]<c[j]&&b[i]<d[j]) g[i][j] = true; Hungary(); printf("%d\n",Ans); return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <string>
#include <algorithm>
using namespace std;
typedef long long ll;
const int N=100000+5;
struct P
{
    ll m;
    ll h;
}a[N];
ll a1[N],a2[N];
bool cmp(const P &p1,const P &p2)
{
    return p1.m<p2.m;
}
int main()
{
    int n;
    ll x;
    scanf("%d%lld",&n,&x);
    for(int i=1;i<=n;i++)
    {
        scanf("%lld%lld",&a[i].m,&a[i].h);
    }
    sort(a+1,a+n+1,cmp);
    ll _max=0,sum;
    sum=0;
    a1[0]=0;
    a2[n+1]=0;
    for(int i=1;i<=n;i++)
    {
        sum+=a[i].h;
        a1[i]=max(a1[i-1],sum-a[i].m);
    }
    sum=0;
    for(int i=n;i>=1;i--)
    {
        sum+=a[i].h;
        a2[i]=max(a2[i+1],sum-(x-a[i].m));
    }
    sum=0;
    for(int i=1;i<=n;i++)
    {
        sum+=a[i].h;
        _max=max(sum+a2[i+1]-2*a[i].m,_max);
    }
    sum=0;
    for(int i=n;i>=1;i--)
    {
        sum+=a[i].h;
        _max=max(sum+a1[i-1]-2*(x-a[i].m),_max);
    }
    printf("%lld\n",max(_max,max(a1[n],a2[1])));

    return 0;
}


Measured memory_bytes: 3328
#include "bits/stdc++.h"

using namespace std;
const int MAX = 700000;
const int MOD = 1000000007;

long long  fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y) {
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
/*逆元計算*/
long long int  modinv(long long a, long long m) {
	long long int b = m, u = 1, v = 0;
	while (b) {
		long long int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
// index が条件を満たすかどうか
vector<long long int >meguru;
bool isOK(int index, int key) {
	if (meguru[index] >= key) return true;
	else return false;
}
// 汎用的な二分探索のテンプレ
int binary_search(int key) {
	int left = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	int right = (int)meguru.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
	/* どんな二分探索でもここの書き方を変えずにできる！ */
	while (right - left > 1) {
		int mid = left + (right - left) / 2;

		if (isOK(mid, key)) right = mid;
		else left = mid;
	}
	/* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
	return right;
}
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

int main() {
	int n;
	cin >> n;
	vector<long long int> v;
	long long int sum = 0;
	long long int ans = 0;
	for (int i = 0; i < n; i++) {
		long long int a;
		cin >> a;
		sum = sum + a;
		v.push_back(a);
	}
	for (int i = 0; i < n; i++) {
		sum = sum - v[i];
		long long int temp = sum % MOD;
		long long int b    = (temp * v[i]) % MOD;
		ans = ans + b;
		ans = ans % MOD;
	}
	cout << ans;
}

Measured memory_bytes: 5372
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main(){
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)cin>>a[i];
    int f=0,k=0,count=0;
    while(n--){
        if(a[k]==2){
            f=1;
            count++;
            break;
        }else{
            k=a[k]-1;
            count++;
        }
    }
    if(f==1)cout<<count;
    else cout<<-1;
}


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

int main (){
	int x,y;
	while(1){
		cin>>x>>y;
		if(x<y){
			cout<<x<<" "<<y<<endl;
		}
		else if(y<x){
			cout<<y<<" "<<x<<endl;
		}
		else if(x=y){
			cout<<x<<" "<<y<<endl;
		}
		else if(x==0&&y==0){
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 3080
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

const double EPS = 1e-10;
const double PI  = acos(-1.0);

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

int main() {
  int n;

  while(1) {
    cin >> n;
    if(!n) break;

    REP(i, n) {
      int pm, pe, pj;
      cin >> pm >> pe >> pj;
      if(pm == 100 || pe == 100 || pj == 100) cout << 'A' << endl;
      else if((pm+pe)/2 >=90) cout << 'A' << endl;
      else if((pm+pe+pj)/3 >= 80) cout << 'A' << endl;
      else if((pm+pe+pj)/3 >= 70) cout << 'B' << endl;
      else if(((pm+pe+pj)/3 >= 50) && (pm >= 80 || pe >= 80)) cout << 'B' << endl;
      else cout << 'C' << endl; 
    }
  }
}

Measured memory_bytes: 1152
import math

n = int(input())
for i in range(n):
  a,b = list(map(int,input().split()))
  c = a * b
  r = int(math.sqrt(c))
  if a == b:
    print((r - 1) * 2)
  elif r ** 2 == c:
    print((r - 1) * 2 - 1)
  elif r * (r + 1) < c:
    print((r * 2 - 1))
  else:
    print((r - 1) * 2)

Measured memory_bytes: 3064
n, y = gets.strip.split.map(&:to_i)
_i, _j, _k = -1, -1, -1

(0..n).each do |i|
    (0..n-i).each do |j|
       if i * 10000 + j * 5000 + (n - i - j) * 1000 == y
           _i, _j, _k = i, j, n - i - j
       end
    end
end

puts "#{_i} #{_j} #{_k}"

Measured memory_bytes: 1916
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
typedef long long ll;
using namespace std;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
#define repi(i, n, init) for (ll i = init; i < (n); i++)

int main()
{
    string s;
    cin >> s;
    int ans = 0;
    repi(i, s.size() / 2, 0)
    {
        if (s[i] != s[s.size() - 1 - i])
        {
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
import numpy as np
from math import ceil as C, floor as F, sqrt
from collections import defaultdict as D, Counter as CNT
from functools import reduce as R
 
ALP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
alp = 'abcdefghijklmnopqrstuvwxyz'
def _X(): return sys.stdin.readline().rstrip().split(' ')
def _S(ss): return tuple(ss) if len(ss) > 1 else ss[0]
def S(): return _S(_X())
def Ss(): return list(S())
def _I(ss): return tuple([int(s) for s in ss]) if isinstance(ss, tuple) else int(ss)
def I(): return _I(S())
def _Is(ss): return list(ss) if isinstance(ss, tuple) else [ss]
def Is(): return _Is(I())

n, k = I()
ans = [0] * n
for _ in range(k):
  x = I()
  ys = Is()
  for y in ys:
    ans[y-1] += 1

print(len([a for a in ans if a == 0]))

Measured memory_bytes: 27076
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <iomanip>
#include <locale>

using namespace std;

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

	// 極大から2以上小さいのが現れたらNo
	int highest = 0;
	for (int i = 0; i < n; i++) {
		if (highest - 1 > height[i]) {
			cout << "No" << endl;
			return 0;
		}
		else if (highest <= height[i]) {
			highest = height[i];
		}
	}

	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 640
//0065

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

int main(void)
{
	map<int, int> m1, m2;
	string str;
	stringstream ss;
	int index, day;
	char dummy;
	while(getline(cin, str), str.size() > 1)
	{
		ss.str(str);
		ss >> index >> dummy >> day;
		m1[index]++;
		ss.clear();
	}
	while(getline(cin, str), cin)
	{
		ss.str(str);
		ss >> index >> dummy >> day;
		m2[index]++;
		ss.clear();
	}

	for(map<int,int>::iterator ite = m1.begin();
		ite != m1.end();
		++ite)
	{
		if(m2[ite->first])
			cout << ite->first << ' ' << ite->second + m2[ite->first] << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define REP(i, a, b) for(int i(a); i <= (b); ++i)

#define gc getchar()
struct Reader {
	template <class T> inline operator T() {
		T w; char c, p = 0;
		for(; !isdigit(c = gc); c == '-' && (p = 1));
		for(w = c & 15; isdigit(c = gc); w = w * 10 + (c & 15));
		return p ? -w : w;
	}
}rd;

template <class T> inline bool smin(T&x, const T&y) { return y < x ? x = y, 1 : 0; }
template <class T> inline bool smax(T&x, const T&y) { return x < y ? x = y, 1 : 0; }

typedef long long ll;

int n, k, a[105];
std::map<int, bool> f;
int main() {
	n = rd, k = rd;
	REP(i, 1, n) a[i] = rd;
	REP(i, 0, a[1] - 1) f[i] = 0;
	for (auto u : f) REP(i, 1, n) if(u.first + a[i] <= k)
		f[u.first + a[i]] |= !u.second;
//	for (auto u : f) printf("%d %s\n", u.first, u.second ? "Y" : "N");
	puts(f[k] ? "First" : "Second");
	return 0;
}



Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vp;
typedef pair<int,int> pii;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9+7;
const int MAX = 10000000;
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
//cout << 'H' << endl;
//next_permutation(ALL(p));
//typedef priority_queue<int> pque;//これは大きい順
//typedef priority_queue<int, vector<int>, greater<int>> pque;//これは小さい順
//factorizeは、素因数分解用の関数

int main(){
	int m1,d1,m2,d2;
  cin >> m1 >> d1 >> m2 >> d2;
  if(m1 == m2 - 1 || (m1 == 12 && m2 == 1)){
    cout << 1 << endl;
  }else{
    cout << 0 << endl;
  }

  return 0;
}


Measured memory_bytes: 256
n=int(input())
d=[[0] *2 for i in range(n)]
cnt=0
c=0

for i in range(n):
  a,b=map(int,input().split())
  if a==b:
    cnt+=1
  else:
    cnt=0
  if cnt==3:
    c=1
if c==1:
  print("Yes")
else:
  print("No")


Measured memory_bytes: 62500
#include <iostream>
using namespace std;
int main(){
    int n;
    int64_t k;
    cin >> n >> k;
    int a[n], aa[n];
    for(int i=0;i<n;i++){
        cin >> a[i];
        aa[i] = 0;
    }
    int present = 1;
    aa[present] = 0;
    for(int i=1;i<=k;i++){
        present = a[present-1];
        if((aa[present-1]>0)||(present==1)){
            k = (k-aa[present-1])%(i-aa[present-1]);
            for(int j=0;j<k;j++){
                present = a[present-1];
            }
            cout << present;
            break;
        }else if(i==k){
            cout << present;
        }else{
            aa[present-1] = i;
        }
    }
    

    return 0;
}

Measured memory_bytes: 5200
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <cmath>

using namespace std;
using ll = long long;
using ull = unsigned long long;

constexpr ll LLINF {1001002003004005006};//ll = 9*LLINF
constexpr int INTINF {1000000000};//int = 2*INTINF

#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 srep(i,s,t) for(int i = s; i < t;  ++i)

template<typename T>
void maxs(T& x, T&& y) {
  x=std::max(x,y);
}
template<typename T>
void maxs(T& x, T& y) {
  x=std::max(x,y);
}

template<typename T>
void mins(T& x, T&& y) {
  x=std::min(x,y);
}
template<typename T>
void mins(T& x, T& y) {
  x=std::min(x,y);
}

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

  std::string S, T;
  cin >> S >> T;
  int ans {};
  rep(i, S.size()) {
    if (S[i] != T[i]) ++ans;
  }
  cout << ans << '\n';
}


Measured memory_bytes: 3820
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial
from bisect import bisect_left #bisect_left(list, value)
#from fractions import gcd
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
def pri(x): print('\n'.join(map(str, x)))

X = int(input())

sen = X // 500
go = (X%500)//5

print(sen*1000 + go * 5)



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

using namespace std;

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

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int f(ll n){
  int ret = 0;
  while(n){
    ret += n%10;
    n/=10;
  }
  return ret;
}

// memo[p][x] := p に足しまくって x にできるか
int memo[100001][52];

bool calc(int n,int p,int x){
  if(x<0)return false;
  if(p==0)return true;
  if(x==0)return false;
  if(memo[p][x] != -1)return memo[p][x];
  memo[p][x] = false;
  
  if(f(p)<=x){
    return memo[p][x] = true;
  }
  REP(i,10){
    int j = p + i*n;
    if(calc(n,j/10,x-(j%10))){
      return memo[p][x] = true;
    }
  }
  return memo[p][x] = false;
}

int solve(int n){
  REP(i,100001)REP(x,52)memo[i][x] = -1;
  REP(x,46){
    FOR(i,1,10){
      int j = i*n;
      if(calc(n,j/10,x-(j%10))){
        return x;
      }
    }
  }
}

int main(){
  int n;
  cin>>n;
  printf("%d\n",solve(n));
  // int maxi = 0;
  // int m=4009;pii po = solve(m);printf("%d -> %d(%lld)\n",m,po.second,(ll)m*po.second);return 0;
  // FOR(n,2,100001){
  //   pii a = solve(n);
  //   if(a.second > maxi){
  //     maxi = a.second;
  //     printf("%d -> %d(%lld)\n",n,maxi,(ll)n*maxi);
  //   }
  // }
  return 0;
}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N, x;
  cin >> N >> x;
  vector<ll> a(N);
  REP(i, N) cin >> a[i];
  ll ans = 0;
  //まず左端
  // while(a[0] + a[1] > x) {
  //   if(a[1] > 0) {
  //     a[1]--;
  //     ans++;
  //   } else {
  //     a[0]--;
  //     ans++;
  //   }
  // }

  if(a[0] + a[1] > x) {
    ll d = a[0] + a[1] - x;
    ans += d;
    if(a[1] >= d) {
      a[1] -= d;
    } else {
      a[0] = a[0] - (d - a[1]);
      a[1] = 0;
    }
  }
  //つぎに右端
  // while(a[N - 1] + a[N - 2] > x) {
  //   if(a[N - 2] > 0) {
  //     a[N - 2]--;
  //     ans++;
  //   } else {
  //     a[N - 1]--;
  //     ans++;
  //   }
  // }

  if(a[N - 1] + a[N - 2] > x) {
    ll d = a[N - 1] + a[N - 2] - x;
    ans += d;
    if(a[N - 2] >= d) {
      a[N - 2] -= d;
    } else {
      a[N - 1] = a[N - 1] - (d - a[N - 2]);
      a[N - 2] = 0;
    }
  }

  // for(ll i = 0; i < N - 1; i++) {
  //   while(a[i] + a[i + 1] > x) {
  //     if(a[i + 1] > 0) {
  //       a[i + 1]--;
  //       ans++;
  //     } else {
  //       a[i]--;
  //       ans++;
  //     }
  //   }
  // }

  for(ll i = 0; i < N - 1; i++) {
    if(a[i] + a[i + 1] > x) {
      ll d = a[i] + a[i + 1] - x;
      ans += d;
      if(a[i + 1] >= d) {
        a[i + 1] -= d;
      } else {
        a[i] = a[i] - (d - a[i + 1]);
        a[i + 1] = 0;
      }
    }
  }

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


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <cstring>
#include <vector>
#include <map>
#include <cmath>
#include <climits>

//find out the use of the below
#include <list>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <memory.h>
#include <cassert>

using namespace std;
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> set_t;
#define mp(a,b) make_pair((a),(b))
#define pii pair<int,int>
#define pll pair<LL,LL>
#define pdd pair<double,double>
#define pb push_back
#define x first
#define y second
#define sqr(x) ((x)*(x))
#define EPS 1e-100
#define MEM(x) memset(x,0,sizeof(x))
#define MEMS(x) memset(x,-1,sizeof(x))
#define pi acos(-1)

int main(){
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt","w", stdout);
    int n;
    cin >>n; 
    vector<int> ar(n);
    long long a1 = 0;
    int pr = 1;
    for (int i = 0; i < n; ++i){
        scanf("%d", &ar[i]);
        a1 += pr*ar[i];
        pr = pr*(-1);
    }
    long long prev = a1;
    cout << a1 << ' ';
    for (int i = 1; i < n; ++i){
        printf("%lld ", 2*ar[i-1]-prev);
        prev = 2*ar[i-1]-prev;
    }

    return 0;
}
/* BEFORE submitting, check for:
 *  1. Integer overflow
 *  2. Float/Double precision errors
 *  3. Array index out of bounds
 *  4. Edge cases.(n=1, n=max, etc.)
 *  5. Time complexity. No TLEs
 */



Measured memory_bytes: 1664
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(v) v.begin(),v.end()
using namespace std;

int main(){
	long long d[4],n;
	double size[4];
	rep(i,4){
		cin>>d[i];
		size[i]=0.25*pow(2,i);
	}
	cin>>n;
	vector<pair<int,int> > vec;
	rep(i,4){
		vec.pb(pair<int,int>(d[i]*pow(2,3-i),i));
	}
	sort(all(vec));
	long long ans=0,num;
	rep(i,4){
		num=n/size[vec[i].second];
		ans+=d[vec[i].second]*num;
		n-=num*size[vec[i].second];
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256