akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int long long
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)

using namespace std;

int n , q , a , b ; 
int prefix[200001];
string s; 
bool bani = false;

int32_t main(){IOS;
     
     cin >> n >> q >> s ;
     if(s[0] == 'A') bani = true;
     for(int i = 1 ; i <  n; i++){
             if(bani and s[i] == 'C'){
                     prefix[i] = prefix[i-1]+1;
                     bani = false;
             }else if(s[i] == 'A'){
                     bani = true;
                     prefix[i] = prefix[i-1];
             }else{
                     bani = false;
                     prefix[i] = prefix[i-1];
             }
     } 
     
     while(q--){
		 cin >> a >> b ;
		 cout << prefix[b-1] - prefix[a-1] << endl ;
     }
     
     return 0;
}


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

using namespace std;

const int MAXN = 3e5;
vector <int> g[MAXN];
vector <int> ng[MAXN];
int in[MAXN];
int n;
int dist[MAXN];
int ans[MAXN];

bool used[MAXN];

void dfs(int v, int ok, int p) {
	used[v] = true;
	ans[p + ok]++;
	for (auto u : ng[v]) {
		if (!used[u]) dfs(u, (ok + 1) & 1, p);
	}
}

void solve(int v) {
	ans[v + 1]++;
	ans[v]++;
	used[v + 1] = true;
	used[v] = true;
	for (auto u : ng[v]) {
		if (u != v + 1) {
			dfs(u, 1, v);
		}
	}
	for (auto u : ng[v + 1]) {
		if (u != v) {
			dfs(u, 0, v);
		}
	}
}


int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string s;
	cin >> s;
	n = s.size();
	for (int i = 0; i < n; i++) {
		if (s[i] == 'R') {
			g[i].push_back(i + 1);
			ng[i + 1].push_back(i);
			in[i + 1]++;
		} else {
			g[i].push_back(i - 1);
			ng[i - 1].push_back(i);
			in[i - 1]++;
		}
	}
	for (int i = 0; i < n - 1; i++) {
		if (s[i] == 'R' && s[i + 1] == 'L') {
			// cout << i << endl;
			solve(i);
		}
	}
	for (int i = 0; i < n; i++) {
		cout << ans[i] << " ";
	}
	return 0;
}



Measured memory_bytes: 27472
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#include <functional>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
using namespace std;
using ll = long long;
constexpr int inf = 1000000000;
constexpr ll INF = 1000000000000000000;

int main() {
    int N;
    cin >> N;
    deque<int> dq;
    rep(i, N) {
        int a;
        cin >> a;
        if (i & 1) dq.push_front(a);
        else dq.push_back(a);
    }
    if (N & 1) {
        rep(i, N) {
            cout << dq.back() << " \n"[i == N - 1];
            dq.pop_back();
        }
    } else {
        rep(i, N) {
            cout << dq.front() << " \n"[i == N - 1];
            dq.pop_front();
        }
    }
    return 0;
}


Measured memory_bytes: 4408
#include<iostream>
#include<cstdio>
using namespace std;
int n,s;
int mn=1e9;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		int x;
		scanf("%d",&x);
		s+=x;
		if(x%10!=0)mn=min(mn,x);
	}
	if(s%10==0)
	{
		if(mn==1e9)s=0;else s=s-mn;
	}
	printf("%d",s);
	return 0;
}

Measured memory_bytes: 256
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
from collections import Counter
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

N = int(input())
i = 1
divs = []
while i ** 2 <= N:
    if N % i == 0:
        divs.append((i, N // i))
    i += 1

ans = 0
for p in divs:
    r = p[0]
    m = p[1] - 1
    if m == 0:
        continue
    if N % m == r:
        ans += m
print(ans)

Measured memory_bytes: 9568
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<queue>
#include<stack>
#include<map>
#include<math.h>
#include<string>
#include <cctype>
#include <cstdlib>
#include<bitset>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = s; i < (int)(n); i++)
#define out(x) cout << x << endl
#define INF 1ll<<60;
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; }

using namespace std;
using ll = long long;
typedef pair<int, int> P;

int main(){
    int n; cin >> n;
    ll b[n];
    rep(i, n){cin >> b[i];}

    int cnt=0;
    bool flag=true;
    while(flag){
        rep(i, n){
            if(b[i]%2!=0){
                flag=false;
            }
        }
        if(flag){
            rep(i, n){
                b[i]/=2;
            }
            cnt++;
        }
    }
    out(cnt);
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(a) a.begin(), a.end()
#define mod 1000000007
#define MOD 998244353
#define INF 40000000000000000
int dx8[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
int dy8[8] = {1, 1, 1, 0, -1, -1, -1, 0};
int dx4[4] = {-1, 0, 1, 0};
int dy4[4] = {0, -1, 0, 1};
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 gcd(int a, int b) {
    if(b == 0) return a;
    return gcd(b, a % b);
}
pair<int, int> solve(pair<int, int> p) {
    int a = p.first, b = p.second;
    if(b > 0) {
        return make_pair(b, -a);
    }
    return make_pair(-b, a);
}
int mod_pow(int x, int n, int mm) {
    int res = 1;
    while(n > 0) {
        if(n & 1) res = res * x % mm;
        x = x * x % mm;
        n >>= 1;
    }
    return res;
}
signed main() {
    int N;
    cin >> N;
    map<pair<int, int>, int> M;
    int count = 0;  //(a,b)=(0,0)の個数
    rep(i, N) {
        int a, b;
        cin >> a >> b;
        if(a == 0 && b == 0) {
            count++;
            continue;
        }
        int g = abs(gcd(a, b));
        a /= g;
        b /= g;
        if(a == 0) b = abs(b);
        if(a < 0) {
            a = -a;
            b = -b;
        }
        M[make_pair(a, b)]++;
    }
    int ans = 1;
    for(auto x : M) {
        pair<int, int> p = x.first;
        int n = x.second;
        if(n == 0) continue;
        int m = M[solve(p)];
        //cout << p.first << ':' << p.second << ' ' << n << ' ' << m << endl;
        int s = mod_pow(2, n, mod);
        if(m > 0) {
            s += mod_pow(2, m, mod);
            s -= 1;
        }
        ans = (ans * s) % mod;
        M[p] = 0;
        M[solve(p)] = 0;
    }
    cout << (ans + count + mod - 1) % mod << endl;
}


Measured memory_bytes: 28580
#include <bits/stdc++.h>
#include <iomanip>
#include <algorithm>
#define ll long long
#include <unordered_map>
using namespace std;
 
int main() {
  ll N, i = 2, j = 0, befN, cnt = 0;
  bool nexti = 0, kusodekasosu = 0;
  cin >> N;
  befN = N;
  vector<ll> A(1, 0);
  while(1) {
    if(N % i == 0) {
      if(nexti == 1) {
        A.push_back(1);
        j++;
        N /= i;
        nexti = 0;
      }
      else {
        A.at(j)++;
        N /= i;
      }
    }
    else {
      i++;
      nexti = 1;
    }
    if(i >= sqrt(befN)) {
      if(N == 1) break;
      else {
        kusodekasosu = 1;
        break;
      }
    }
  }
  if(befN == 1) cout << 0 << endl;
  else if((A.size() == 1) && (A.at(0) == 0)) cout << 1 << endl;
  else {
    for(ll i = 0; i < A.size(); i++) {
      j = 1;
      while(1) {
        if(A.at(i) - j < 0) break;
        else {
          cnt++;
          A.at(i) -= j;
          j++;
        }
      }
    }
    if(kusodekasosu == 1) cout << cnt + 1 << endl;
    else cout << cnt << endl;
  }
}


Measured memory_bytes: 3676
#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define x first
#define y second
using namespace std;
using ll = long long;
using ld = long double;
#define int ll

const int N = 2e6;
int n, k;
ld a[N];

signed main() {
#ifdef LC
    assert(freopen("input.txt", "r", stdin));
#endif
    ios::sync_with_stdio(0), cin.tie(0);
	
	cin >> n >> k;
	for (int x, i = 1; i <= n; ++i) {
		cin >> x;
		a[i] = ld(x + 1) / 2;
	}
	for (int i = 1; i <= n; ++i) {
		a[i] += a[i - 1];
	}
	ld s = 0;
	for (int i = 1; i + k - 1 <= n; ++i) {
		s = max(s, a[i + k - 1] - a[i - 1]);
	}
	cout << fixed << setprecision(20) << s << endl;
	return 0;
}


Measured memory_bytes: 4352
#include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
using namespace std;
long long has[205][205], lop[205], wok[205], Lop[205], Wok[205];
long long P[205], Q[205];
long long N[205];
long long ans;
long long ex_gcd(long long a,long long b,long long &x,long long &y)
{
    if(b==0)
    {
        x=1;y=0;
        return a;
    }
    long long r=ex_gcd(b,a%b,x,y);
    long long t=x;
    x=y;
    y=t-a/b*y;
    return r;
};
long long a[205], m[205], n;
long long CRT(long long a[], long long m[], long long n) {
    if (n == 1) {
        if (m[0] > a[0]) return a[0];
        else return -1;
    }
    long long x, y, d;
    for (int i = 1; i < n; i++) {
        if (m[i] <= a[i]) return -1;
        d = ex_gcd(m[0], m[i], x, y);
        if ((a[i] - a[0]) % d != 0) return -1;
        long long t = m[i] / d;
        x = ((a[i] - a[0]) / d * x % t + t) % t;
        a[0] = x * m[0] + a[0];
        m[0] = m[0] * m[i] / d;
        a[0] = (a[0] % m[0] + m[0]) % m[0];
    }
    return a[0];
}

long long gcd(long long a,long long b)
{
    if(b==0)
        return a;
    return
        gcd(b,a%b);
}
void check(long long i){
    long long temp = Q[i], last = i;
    has[i][i] = 0;
    while(has[i][temp] == -1)
        has[i][temp] = has[i][last] + 1, last = temp, temp = Q[temp];
    lop[i] = has[i][last] + 1 - has[i][temp];
    return ;
}
int main() {
    long long N;
    memset(has, -1, sizeof has);
    cin >> N;
    for(long long i = 1; i <= N; i++)
        cin >> P[i], ans = (P[i] == i ? ans : 1);
    for(long long i = 1; i <= N; i++)
        cin >> Q[i];
    for(long long i = 1; i <= N; i++)
        check(i);
    for(long long i = 1; i <= N; i++) {
        if(has[P[i]][i] == -1) {
            cout << "-1" << endl;
            return 0;
        }
        wok[i] = has[P[i]][i];
    }
    for(long long i = 1; i < N; i++)
        for(long long j = i + 1; j <= N; j++)
            if(lop[j] > lop[i])
                swap(lop[i], lop[j]), swap(wok[i], wok[j]);
    for(long long i = 1; i <= N; i++) {
        if(lop[i] == lop[i - 1] && wok[i] != wok[i - 1]) {
            cout << "-1" << endl;
            return 0;
        }
        long long temp = 0;
        if(lop[i] == 1){
            if(temp == 0)
                temp = 1;
            temp = temp / gcd(temp, wok[i]) * wok[i];
        }
        else if(lop[i] != lop[i - 1])
            Lop[++Lop[0]] = lop[i], Wok[Lop[0]] = (wok[i] + temp) % lop[i];
    }
    //for(long long i = 1; i <= N; i++)
    /*    cout << Wok[i] << " ";
    cout << endl;
    for(long long i = 1; i <= N; i++)
        cout << Lop[i] << " ";
    cout << endl;*/
    cout << CRT(Wok + 1, Lop + 1, Lop[0]) << endl;
    return 0;
}



Measured memory_bytes: 3452
N = int(input())
h = list(map(int, input().split()))
dp = [0 for _ in range(N)]
dp[0] = 0
dp[1] = abs(h[1]-h[0])
for n in range(2, N):
    dp[n] = min(abs(h[n]-h[n-2])+dp[n-2], abs(h[n]-h[n-1])+dp[n-1])
print(dp[-1])

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

int main(){
  int a,b,c; cin >> a >> b >> c;
  if (a == b && b == c && c == a){
    cout << 1;
  }
  else if (a != b && b != c && c != a){
    cout << 3;
  }
  else{
    cout << 2;
  }
}

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

/* 大文字を小文字に変換 */
char tolower(char c) {return (c + 0x20);}
/* 小文字を大文字に変換 */
char toupr(char c) {return (c - 0x20);}

// if('A'<=s[i] && s[i]<='Z') s[i] += 'a'-'A';

/*
string s = "abcdefg"
s.substr(4) "efg"
s.substr(0,3) "abc"
s.substr(2,4) "cdef"
*/

int main()
{
    int n; cin >> n;
    vector<tuple<int, int, char, ll, string> > Item;
    rep(i,n){
        int v, w; char t; string s;
        ll d;
        cin >> v >> w >> t >> d >> s;
        Item.push_back(make_tuple(v, w, t, d, s));
    }
    sort(Item.begin(), Item.end());
    rep(i,n){
        int v, w; char t; string s;
        ll d;
        tie(v, w, t, d, s) = Item[i];
        printf("%d %d %c %ld ", v, w, t, d);
        cout << s << endl;
    }
}


Measured memory_bytes: 12332
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>

using namespace std;

int main(){
  int n; cin >> n;
  for(int i = 0; i <= n; i++){
    if((int)floor((double)i * 1.08) == n){
      cout << i << endl;
      return 0;
    }
  }
  cout << ":(" << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	char a,b,c;
	int d=0;
	scanf("%c%c%c",&a,&b,&c);
	if (a=='1')
	d++;
	if (b=='1')
	d++;
	if (c=='1')
	d++;
	printf("%d\n",d);
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int mem=sc.nextInt();
		int[][] ten=new int[mem][3];
		boolean deki=true;
		for(int i=0; i<mem; i++) {
			for(int j=0; j<3; j++) {
				ten[i][j]=sc.nextInt();
			}
		}
		int[] point=new int[mem];
		for(int i=0; i<mem; i++) {
			point[i]=0;
		}
		for(int i=0; i<3; i++) {
			deki=true;
			for(int j=0; j<mem; j++) {
				deki=true;
				for(int k=0; k<mem; k++) {
					if(k==j) {
						//
					}
					else {
						if(ten[j][i]==ten[k][i]) {
							deki=false;
							break;
						}
					}
				}
				if(deki==true) {
					point[j]+=ten[j][i];
				}
			}
		}
		for(int i=0; i<mem; i++) {
			System.out.println(point[i]);
		}
	}
}



Measured memory_bytes: 28600
using System;
using System.Collections.Generic;
using static System.Console;
using System.Linq;

class Program
{
    static void Main(string[] args) {
        var list = new List<string>(Console.ReadLine().Split('/')).Select(ele => Int32.Parse(ele)).ToList();
        var str = "TBD";
        if (list[0] <= 2019 && list[1] <= 4 && list[2] <= 30)
            str = "Heisei";

        WriteLine(str);

        Console.ReadLine();
    }
}


Measured memory_bytes: 11220
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Main {

    private static Scanner sc;

    public static void main(String[] args) {
        Main instance = new Main();
        sc = instance.new Scanner();
        instance.solve();
    }

    private class Scanner {
        String[] s;
        int i;
        BufferedReader br;
        String regex = " ";

        public Scanner() {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        @Override
        protected void finalize() throws Throwable {
            try {
                super.finalize();
            } finally {
                destruction();
            }
        }

        private void destruction() throws IOException {
            if (br != null)
                br.close();
        }

        public String next() throws IOException {
            if (i < s.length)
                return s[i++];
            String st = br.readLine();
            while (st == "")
                st = br.readLine();
            s = st.split(regex, 0);
            i = 0;
            return s[i++];
        }

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

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

        public Double nextDouble() throws NumberFormatException, IOException {
            return Double.parseDouble(next());
        }
    }

    private void solve() {
        try {
            String s;
            s = sc.next(); 
            String str=s.replaceAll("\\?", "D");
            System.out.println(str);
           
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Measured memory_bytes: 50120
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(input())
def inpl(): return list(map(int, input().split()))
def inpl_s(): return list(input().split())

D,N = inpl()
if N == 100:
	print((N+1)*100**D)
else:
	print(N*100**D)


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

const string Direction = {"ENWS"};
const int Next[4][2] = {{0, 1}, {-1, 0}, {0, -1}, {1, 0}};
enum {Y, X};

int main() {
    int w, h;
    while(cin >> w >> h, w | h) {
        int time;
        vector<string> field(h);
        for(int i = 0; i < h; ++i) cin >> field[i];

        for(time = 0; time <= 180; ++time) {
//             cout << time << endl;
//             for(auto& s: field)cout<<s<<endl;
            bool ok = true;
            for(const auto& line: field) for(const auto& c: line)
                if(Direction.find(c) != string::npos) ok = false;
            if(ok) break;
            // turn
            for(int i = 0; i < h; ++i) for(int j = 0; j < w; ++j) {
                int index = Direction.find(field[i][j]);
                if(index == string::npos) continue;
                for(int k = 0; k < 4; ++k) {
                    int d = (index + 3 + k) % 4;
                    int y = i + Next[d][Y];
                    int x = j + Next[d][X];
                    if(field[y][x] != '.' && field[y][x] != 'X') continue;
                    field[i][j] = Direction[d];
                    break;
                }
            }
            // move
            vector<vector<int>> used(h, vector<int>(w, 0));
            for(int i = 0; i < h; ++i) for(int j = 0; j < w; ++j) {
                if(field[i][j] != '.' && field[i][j] != 'X') continue;
                if(used[i][j]) continue;
                for(int d = 0; d < 4; ++d) {
                    int y = i + Next[d][Y];
                    int x = j + Next[d][X];
                    if(y < 0 || h <= y) continue;
                    if(x < 0 || w <= x) continue;
                    if(field[y][x] != Direction[(d + 2) % 4]) continue;
                    if(used[y][x]) continue;
                    used[i][j] = 1;
                    used[y][x] = 1;
                    if(field[i][j] == '.') field[i][j] = field[y][x];
                    field[y][x] = '.';
                    break;
                }
            }
        }

        if(time > 180) cout << "NA" << endl;
        else cout << time << endl;
    }
}

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

class Main
{
	static Scanner sc;
	
	public static void main( String[] args ) throws IOException
	{
	sc = new Scanner( new BufferedReader( new InputStreamReader( System.in ) ) );
		int a = sc.nextInt();
		int h = a / 3600, m = (a - h * 3600) / 60, s = a - h * 3600 - m * 60;
		System.out.printf("%s\n", "" + h + ":" + m + ":" +s);
	}
}


Measured memory_bytes: 26200
from collections import*
z,v,a=input,range,print
h,w,k=map(int,z().split());r,s,t,u=map(lambda x:int(x)-1,z().split());b=[z()for _ in v(h)];l=[[-1]*w for _ in v(h)];l[r][s]=0;d=deque([(r,s)])
while d:
  x,y=d.popleft();j=l[x][y]
  if(x==t)&(y==u):exit(a(j))
  for e,f in[[1,0],[-1,0],[0,-1],[0,1]]:
    for i in v(1,k+1):
      p,q=x+e*i,y+f*i
      if not((0<=p<h)&(0<=q<w))or b[p][q]=="@" or 0<=l[p][q]<=j:break
      if l[p][q]<0:d+=[(p,q)];l[p][q]=j+1
a(-1)

Measured memory_bytes: 36464
#include <bits/stdc++.h>
using namespace std;
signed main(){
  int a,b,c;
  cin>>a>>b;
  if(a<=5)
    cout<<"0"<<endl;
  else if(a>=13)
    cout<<b<<endl;
  else
    cout<<b/2<<endl;
  return(0);
}


Measured memory_bytes: 256
//Resting_Prince
#include<bits/stdc++.h>
#define mod 1000000007
#define inf 1e18
#define PI 3.141592653589
#define fi first
#define se second 
#define sv(v) sort(all(v));reverse(all(v))
#define all(v) v.begin(),v.end()
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define repr(i,a,b) for(ll i=a;i>=b;i--)
#define pb push_back
#define mk make_pair
#define en '\n'
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef long double ld;

int main()
{
    ll n,a[200005],k=0;
    cin>>n;
    rep(i,0,n-1)
    {
        cin>>a[i];
    }a[0]--;
    rep(i,1,n-1)
    {
        if(a[i]>a[i-1])a[i]--;
    }k=0;
    rep(i,1,n-1)
    {
        if(a[i]<a[i-1])k++;
    }
    if(k>0)cout<<"No";
    else cout<<"Yes";
    return 0;
}


Measured memory_bytes: 1024
#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;
}

// index が条件を満たすかどうか

int main() {
	long long int x, y;
	cin >> x >> y;
	long long int ans = 0;
	while (x <= y) {
		ans++;
		x = x * 2;
	}
	cout << ans;
}

Measured memory_bytes: 384
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author cherrypi59
 */

#pragma GCC optimize ("O2")
#pragma GCC optimize ("tree-vectorize")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define FFOR(i, a, b) FOR(i, a, b+1)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) FOR(i, 1, n+1)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define LEN(x) (int)(x).size()
#define DUMP(x) cerr<<__LINE__<<' '<<#x<<"="<<(x)<<endl;
#define popcnt(x) __builtin_popcount(x)
#define popcntll(x) __builtin_popcountll(x)
#define pb push_back
#define eb emplace_back
#define mp make_pair

using namespace std;
using lint = long long;
using pii =  pair<int, int>;
using pll =  pair<lint, lint>;
template <typename T> using vc = vector<T>;
template <typename T> using vvc = vector<vector<T>>;
template <typename T> inline bool chmax(T &a, T b){if(a<b){a = b; return true;} return false;}
template <typename T> inline bool chmin(T &a, T b){if(a>b){a = b; return true;} return false;}

constexpr lint ten(int n) {return n==0 ? 1 : ten(n-1)*10;}

class DRoadToMillionaire {
public:
    void solve(std::istream& in, std::ostream& out){
        ios_base::sync_with_stdio(false);
        in.tie(nullptr), out.tie(nullptr);
        int N;
        in>>N;
        vc<int> A(N);
        REP(i, N) in>>A[i];
        vc<lint> f(N);
        f[0] = 1000;
        lint ans = 1000;
        FOR(i, 1, N){
            REP(j, i){
                lint k = f[j] / A[j];
                chmax(f[i], max(f[j], f[j]+(A[i]-A[j])*k));
            }
            chmax(ans, f[i]);
        }
        out<<ans<<'\n';
    }
};


int main() {
	DRoadToMillionaire solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3548
#include<stdio.h>
int main(void)
{
  char S[2];
  scanf("%s",S);
  char T[2];
  scanf("%s",T);
  if(S[0]==T[0]&&S[1]==T[1]&&S[2]==T[2])printf("3\n");
  else if(S[0]==T[0]&&S[1]==T[1])printf("2\n");
  else if(S[2]==T[2]&&S[0]==T[0])printf("2\n");
  else if(S[2]==T[2]&&S[1]==T[1])printf("2\n");
  else if(S[0]==T[0]) printf("1\n");
  else if(S[1]==T[1]) printf("1\n");
  else if(S[2]==T[2]) printf("1\n");
  else printf("0\n");
  return 0;
}
    
    
    
        

Measured memory_bytes: 128
import sys
input=sys.stdin.readline
import copy
def knapsack(N,W,weight,value):
  dp=[[999999999999 for i in range(W+1)] for j in range(N+1)]
  for i in range(W+1): dp[0][i]=0
 
  for i in range(N):
    for w in range(W+1):
      if weight[i]<=w:
        if dp[i][w-weight[i]]+value[i]>dp[i][w]:
          dp[i+1][w]=dp[i][w-weight[i]]+value[i]
        else:
          dp[i+1][w]=dp[i][w]
      else:
        dp[i+1][w]=dp[i][w]
  return dp
 
n,t=map(int,input().split())
l=[list(map(int,input().split())) for i in range(n)]
l.sort()
a=[];b=[]
for i in range(n):
  a.append(l[i][0])
  b.append(l[i][1])
dp=knapsack(n,t-1,a,b)
ans=[]
for i in range(n):
  if i!=n:
    ans.append(dp[i][t-1]+b[i])
  else:
    ans.append(dp[n][t])
print(max(ans))

Measured memory_bytes: 121052
#include<stdio.h>

int main(void){
    int n;
    int h[100];
    int cnt = 1;
    int i, j;
    int flg;

    scanf("%d", &n);
    for(i = 0; i < n; i++){
        scanf("%d", &h[i]);
    }

    for(i = 1; i < n; i++){
        flg = 0;
        for(j = 0; j < i; j++){
            if(h[j] > h[i]){
                flg = 1;
            }
        }
        if(flg == 0){
            cnt++;
        }
    }

    printf("%d", cnt);

    return 0;

}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;




signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int N,M;

    cin>>N>>M;
    int a[N];
    a[0]=1;
    a[1]=1;
    rep(i,N+1){
        a[i]=1;
    }
    rep(i,M){
        int x;
        cin>>x;
        x;
        a[x]=0;
    }
    for(int i=2;i<=N;i++){
        a[i]=a[i]*(a[i-1]+a[i-2])%MOD;
    }
    cout << a[N] << endl;



}


Measured memory_bytes: 1024
import Control.Monad   (replicateM)
import Data.List       (sort)
import Data.List.Split (splitOn)
main = do
    w <- readLn
    n <- readLn
    bs <- replicateM n getLine
    let lines = [1..w]
        bars  = map (makePair.map read.splitOn ",") bs :: [(Int,Int)]
    mapM_ print $ map snd.sort.map (pursueBars bars) $ lines

makePair [a,b] = (a,b)

pursueBars bars i = (finali, i)
    where
        finali = pursue bars i

pursue []     i = i
pursue (b:bs) i = pursue bs (swap b i)

swap (left,right) i
    | left  == i = right
    | right == i = left
    | otherwise  = i

Measured memory_bytes: 4124
class BinaryTree:
    def __init__(self, left, right, parent):
        self.left = left
        self.right = right
        self.parent = parent
        self.key = None
        self.root = False
        

def insert(T, z):
    global root
    
    y = -1
    try:
        x = root
    except:
        x = -1
        root = z
        T[z].root = True
    
    while x != -1:
        y = x
        if T[z].key < T[x].key:
            x = T[x].left
        else:
            x = T[x].right
    T[z].parent = y
    
    if y == -1:
        pass
    
    elif T[z].key < T[y].key:
        T[y].left = z
        
    else:
        T[y].right = z

def find(T, z, s):
    if s == -1:
        return False
        
    elif T[s].key == z:
        return True
        
    elif T[s].key < z:
        return find(T, z, T[s].right)
        
    else:
        return find(T, z, T[s].left)
    
def preParse(u):
    if u == -1:
        return 0
    print(" " + str(T[u].key), end="")
    preParse(T[u].left)
    preParse(T[u].right)

def inParse(u):
    if u == -1:
        return 0
    inParse(T[u].left)
    print(" " + str(T[u].key), end="")
    inParse(T[u].right)

m = int(input().rstrip())

z = 0
T = []
for _ in range(m):
    T.append(BinaryTree(-1, -1, -1))

for _ in range(m):
    command = input().rstrip()
    if command =="print":
        inParse(root)
        print()
        preParse(root)
        print()
    else:
        command, key = command.split(" ")
        key = int(key)
    
    
    if command == "insert":
        T[z].key = key
        insert(T, z)
        z += 1
        
    elif command == "find":
        if find(T, key, root):
            print("yes")
        else:
            print("no")


Measured memory_bytes: 118436
#include <bits/stdc++.h>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
//#define INF 2e9
#define ALL(v) v.begin(), v.end()

using namespace std;
typedef long long ll;

int main(){
    int d,t,s;
    cin >> d >> t >> s;
    if(s*t >= d) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3584
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;
//inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

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

// 0 1
// 0 0 1 2

LL f(LL n) {
    //dump(n);
    if (n < 0) return 0;
    LL ans = 0;
    REP(i,0,40) {
        LL sum = 0;
        LL div = 1LL << (i+1);
        sum += (n - n % div) / 2;
        sum += max(0LL, n % div - div / 2 + 1);
        //dump(sum);
        if (sum % 2) ans += 1LL << i;
    }
    return ans;
}

void solve() {
    LL a,b;
    cin >> a >> b;
    cout << (f(b) ^ f(a-1)) << endl;;
}

int main() {
    solve();
    
    return 0;
}

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

using namespace std;

int main(){
    int N;
    cin >> N;
    vector<vector<int>>  A(N,vector<int>(3));
    for (int i = 0; i < N ; ++i) {
        for (int j = 0; j <3 ; ++j) {
            cin >> A[i][j];
        }
    }


    vector<vector<long long>> dp(N+1,vector<long long>(3,0));
    long long temp = 0;

    for (int j = 1; j < N+1 ; ++j) {
        for (int i = 0; i <3 ; ++i) {
            for (int k = 0; k <3 ; ++k) {
                if(i != k) temp = max(dp[j-1][k] + A[j-1][i],temp);
            }
            dp[j][i] = temp;
            temp = 0;
        }
    }

    long long res = 0;
    for (int l = 0; l < 3; ++l) {
        res = max(res,dp[N][l]);
    }

    cout << res;




}


Measured memory_bytes: 11136
import sys
input = sys.stdin.readline
ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18
MOD=10**9+7

N,A,B,C,D=rl()
S=input()
M=[0]*(N+1)
for i in range(N):
    M[i] = 0 if S[i]=='.' else 1

ans = 1

flag_2 = 0
cnt = 0
for i in range(A-1,D):
    if M[i] == 1:
        cnt += 1
    else:
        cnt = 0
    if cnt >= 2:
        flag_2 = 1
        break
if flag_2==1:
    ans = 0

flag_3 = 0
cnt = 0
if C > D:
    for i in range(B-2,D+1):
        if M[i] == 0:
            cnt += 1
        else:
            cnt = 0
        if cnt>=3:
            flag_3 = 1
            break
    if flag_3 == 0:
        ans = 0

yn(ans)

Measured memory_bytes: 4980
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>

using namespace std;

using ll = long long;

#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define ALL(v) (v).begin(),(v).end()

typedef pair<ll, int> P;

const int MOD = (int) 1e9 + 7;

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

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

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

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

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n, m;
	cin >> n >> m;
	ll x[n], y[n], z[n];
	REP(i, n) cin >> x[i] >> y[i] >> z[i];
	
	ll maxsum = 0;
	REP(i, 1 << 3) {
		vector<ll> v(n);
		REP(j, n) {
			ll sum = 0;
			if (i >> 0 & 1) sum += x[j];
			else sum -= x[j];
			if (i >> 1 & 1) sum += y[j];
			else sum -= y[j];
			if (i >> 2 & 1) sum += z[j];
			else sum -= z[j];
			v[j] = sum;
		}
		sort(v.begin(), v.end());
		reverse(v.begin(), v.end());
		ll total = 0;
		REP(i, m) total += v[i];
		maxsum = max(maxsum, total);
	}
	
	cout << maxsum << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define ll long long
using namespace std;
const int maxn = 1e5+10;

int main(){
	int k;
	scanf("%d", &k);
	ll n = 7;
	int ans = 1;
	if(k%2==0 || k%5==0){
		printf("-1");
		return 0;
	}
	while(1){
		if(n % k==0){
			printf("%d", ans);
			break;
		}
		ans ++;
		n = n*10+7;
		n%=k;
	}

	return 0;
}


Measured memory_bytes: 3780
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#include <functional>
#include <vector>
#include <numeric>
#include <deque>
#include <utility>
#include <bitset>
#include <limits.h>
#include <iostream>
#include <unordered_set>
#include <unordered_map>

using namespace std;
typedef long long ll;
typedef unsigned long long llu;
typedef double lf;
typedef unsigned int uint;
typedef long double llf;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

ll x, y;
int main() {
	scanf("%lld%lld", &x, &y);
	vector<ll> cands;
	cands.push_back( y-x);
	cands.push_back( y+x+1);
	cands.push_back(-y-x+1);
	cands.push_back(-y+x+2);
	sort(cands.begin(), cands.end());
	for(auto x : cands)
		if(x > 0) return 0 & printf("%lld\n", x);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007
#define print(A,n) for(ll i=0;i<n;++i)cout<<A[i]<<' ';cout<<endl;
#define take(A,n) for(ll i=0;i<n;++i)cin>>A[i];
ll mulmod(ll a,ll b,ll c) 
{ 
    if (b==0) 
        return 0; 
    ll s = mulmod(a, b/2, c); 
    if (b%2==1) 
        return (a%c+2*(s%c)) % c; 
 
    else
        return (2*(s%c)) % c; 
} 

  
void fastio(){ios_base::sync_with_stdio(false);cin.tie(NULL);}
int main()
{ll int t;
t=1;
//cin>>t;

while(t--)
{ll int h,i,n;
cin>>n>>h;
;;ll int sum = 0,a[n];
for(i=0;i<n;i++)
{cin>>a[i];
}
sort(a,a+n);
for(i=0;i<n-h;i++)
sum+=a[i];
cout<<sum<<endl;


    
}
 
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <stdio.h>
#include <stdlib.h>

using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	if ((a*b) % 2 == 0) {
		cout << "No";
	}
	else {
		cout << "Yes";
	}
	return 0;
}

Measured memory_bytes: 256
while True:
    args = input().split()
    if args[0] == '0' and args[1] == '0':
        break

    H = int(args[0])
    W = int(args[1])

    pr = ''
    while H > 0:
        while W > 0:
            pr += '#'
            W-=1
        print(pr)
        pr = ''
        W = int(args[1])
        H-=1

    print('')



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

using namespace std;
typedef long long ll;

int main(){
    int N,K;
    cin >> N >> K;
    vector<int> list(N);
    int max = 0;
    rep (i,N){
        cin >> list[i];
        if (list[i] > max){
            max = list[i];
        }
    }
    int left = 0; int right = max;
    while ((right - left) > 1){
        int mid = (right + left)/2;
        int count = 0;
        rep (i,N){
                count += (list[i] - 1)/mid;
        }
        if (count <= K){
            right = mid;
        }
        else {
            left = mid;
        }
    }
    cout << right << endl;
    return 0;
}

Measured memory_bytes: 3948
from time import time
from random import randrange

n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
start = time()

for i in range(n):
    if A[i] != B[i]:
        continue
    while time() - start < 1.8:
        j = randrange(n)
        if A[i] != B[j] and A[j] != B[i]:
            B[i], B[j] = B[j], B[i]
            break
    else:
        print("No")
        exit(0)

print("Yes")
print(*B)

Measured memory_bytes: 124764
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
typedef long long i64;
int main(){
    int N,A,B;
    cin >> N >> A >> B;
    cout << min(N*A,B) << endl;
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <numeric>
typedef long long Int;
#define rep(i,a,b) for(Int i=a;i<b;++i)
#define rrep(i,a,b) for(Int i=a;i>=b;--i)
using namespace std;

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

  	Int A, B; cin >> A >> B;
    cout << max(A+B, max(A-B, A*B)) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
using namespace std;
typedef long long ll;

int main(){
  int a;
  string s;
  
  cin >> a >> s;
  
  if (a >= 3200) cout << s;
  else cout << "red";
  
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
	int k, x;
	cin >> k >> x;

	for (int i = max(x - k + 1, -1000000); i <= min(x + k - 1 , 1000000); i++){
		cout << i << " ";
	}

	return 0;
}

Measured memory_bytes: 256
s=list(input())
k=int(input())
for i in range(len(s)):
    if i==len(s)-1:
        s[-1]=chr((ord(s[i])-97+k)%26+97)
        break
    if s[i]=='a':
        continue
    if 123-ord(s[i])<=k:
        k-=123-ord(s[i])
        s[i]='a'
print(*s,sep='')

Measured memory_bytes: 11560
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <cmath>
 
using namespace std;
 
#define MAX 15
#define INF 1e9
 
int N;
int path[1<<MAX][MAX];
double dp[1<<MAX][MAX];
double _time,d[MAX],B[MAX];
int n[MAX];
vector<int> ans;
 
double V(double w){
  return 2000. / (70. + w);
}
 
double dist(int a,int b){
  return abs(d[a]-d[b]);
}
 
double solve(int S,int prev,double b){
  if(N == __builtin_popcount(S)) return dp[S][prev] = 0.0;
  if(dp[S][prev] >= 0) return dp[S][prev];
 
  double res = INF;
  for(int i = 0 ; i < N ; i++){
    if(S >> i & 1) continue;
    double next = solve(S|(1<<i),i,b+B[i]) + dist(prev,i)/V(b);
    if(next < res){
      res = next;
      path[S][prev] = i;
    }
  }
  return dp[S][prev] = res;
}
 
int main(){
  cin >> N;
  for(int i = 0 ; i < N ; i++){
    cin >> n[i] >> d[i] >> B[i];
    B[i] *= 20;
  }
  _time = INF;
  for(int i = 0 ; i < 1<<N ; i++){
    for(int j = 0 ; j < N ; j++){
      dp[i][j] = -1;
    }
  }
  for(int i = 0 ; i < N ; i++){
    double now = solve(1<<i,i,B[i]);
    if(now < _time){
      _time = now;
      path[0][0] = i;
    }
  }
  int S = 0, p = 0;
  while(true){
    if(N == __builtin_popcount(S)) break;
    ans.push_back(n[path[S][p]]);
    int T = S;
    S |= 1<<path[S][p];
    p = path[T][p];
  }
  for(int i = 0 ; i < N ; i++){
    if(i == N-1){
      cout << ans[i] << endl;
    }else{
      cout << ans[i] << " ";
    }
  }
 
  return 0;
}

Measured memory_bytes: 7016
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin>>s;
	int l=s.size();
	for(int i=0;i<l;i++){
		if(s[i]=='7'){
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	return 0;
}

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

int main (){
    long long N = 0;
    cin >> N;
    long long D = 0;
    cin >> D;
    long long a, b;
    long long ans = 0;
    for (size_t i = 0; i < N; i++)
    {
        cin >> a >> b;
        if (a*a+b*b<=D*D)
        {
            ans++;
        }
        
    }
    cout << ans << endl;

    
}

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

int main(){
	int n , k;
	scanf("%d%d" , &n , &k);
	int se[n+10];
	bool game[k+100] = {0};
	for(int i=0 ; i<n ; i++){
		scanf("%d"  ,se + i);
		game[se[i]] = 1;
	}
	for(int i=1 ; i<=k ; i++){
		if(game[i]) continue;
		game[i] = 1;
		for(int j=0 ; j<n ; j++){
			if(i-se[j] < 0) continue;
			game[i] &= game[i - se[j]];
		}
		game[i] = !game[i];
	}
	printf("%s" , (game[k] ? "First":"Second"));
}



Measured memory_bytes: 384
import java.io.*;
import java.util.*;
public class Main{
	static int n,k;
	static int[] height=new int[100001];
	public static int solve(){
		int[] dp=new int[n];
		dp[0]=0;
		for(int i=1;i<n;i++){
			dp[i]=Integer.MAX_VALUE;
			for(int j=i-1;j>=Math.max(0,i-k);j--){
				dp[i]=Math.min(dp[i],dp[j]+Math.abs(height[i]-height[j]));
			}
			
		}
		return dp[n-1];
	}
	public static void main(String[] args) throws IOException{
    	 BufferedReader br = new BufferedReader( 
                              new InputStreamReader(System.in)); 
        String[] str=br.readLine().split(" ");
		n=Integer.parseInt(str[0]); 
		k=Integer.parseInt(str[1]); 		
		str=br.readLine().split(" ");
		for(int i=0;i<n;i++){			
		   height[i]=Integer.parseInt(str[i]);		 
		}
		System.out.println(solve());
	
    }
}

Measured memory_bytes: 35288
#include <bits/stdc++.h>
#define debug(x) cerr << "\n" \
                      << #x << " = " << x << ".\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define print(xx) cout << (xx) << endl
using namespace std;
#define int long long
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vint;
const int INF = ((1LL << 30) + (1LL << 29));
const ll MOD = 1000000007;

/* 

*/
//================== INPUT ========================
int N;
//=================================================
void input()
{
    cin>>N;

}

bool check(int n){
    int p = n%10;
    while (n){
        if (n %10 != p) {
            return false;
        }
        n /= 10;
    }
    return true;
}

//=================================================
void solve()
{
    for (int i=N; i<=999; ++i){
        if (check(i)) {
            cout<<i<<endl;
            break;
        }
    }
}

//=================================================
signed main()
{
    input();
    solve();
    return 0;
}

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

using namespace std;

int main(){

    int a = -13;
    int b = 3;

    cin >> a >> b;
    // cout << a-b <<endl;
    // cout << a+b <<endl;
    // cout << a*b <<endl;

    vector <int> tmp;
    tmp.push_back(a+b);
    tmp.push_back(a-b);
    tmp.push_back(a*b);
    int max = * max_element(tmp.begin(), tmp.end());
    cout << max <<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int mod = 1e9+7;
const int  N=200005;
map<string,int>mp;
int main()
{
    string s,t,u;
    int x,y;
    cin >> s >> t;
    cin >> x >> y;
    mp[s]=x;
    mp[t]=y;
    cin >> u;
    mp[u]--;
    cout<<mp[s]<<" "<<mp[t];
    return 0;
}

Measured memory_bytes: 256
import math

counter = 0

def new_way(n, a, b, mod, nCa, nCb):
    g1 = [1, 1] # 元テーブル
    g2 = [1, 1] #逆元テーブル
    inverse = [0, 1] #逆元テーブル計算用テーブル

    for i in range( 2, n + 1 ):
        g1.append( ( g1[-1] * i ) % mod )
        inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
        g2.append( (g2[-1] * inverse[-1]) % mod )
    
    nCa = new_cmb(n, a, mod, g1, g2)
    print("a")
    nCb = new_cmb(n, b, mod, g1, g2)
    print("b")

def new_cmb(n, r, mod, g1, g2):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    ans = g1[n] * g2[r] % mod
    ans = ans * g2[n-r] % mod
    return ans


def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    bunshi = 1
    bunbo = 1
    for i in range(r):
        bunshi = bunshi * (n-i) % mod

        bunbo = bunbo * (i+1) % mod
    
    bunbo_inv = my_pow(bunbo, mod-2, mod)

    return bunshi * bunbo_inv % mod

def my_pow(x, n, mod):
    global counter
    
    if n == 0:
        return 1

    K = 1
    while n > 1:
        if n % 2 != 0:
            K = K * x % mod
        x = x * x % mod
        n //= 2

    return K * x % mod

n, a, b = map(int,input().split())


mod = 10**9+7 #出力の制限

sum_nCr = my_pow(2, n, mod)

nCa = cmb(n, a, mod)
nCb = cmb(n, b, mod)
# nCa = 0
# nCb = 0
# new_way(n, a, b, mod, nCa, nCb)

ans = sum_nCr - (1 + nCa + nCb)
ans %= mod
print(ans)


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
const ll MOD = 998244353;
const ll INF = 4611686018427387903;
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

int main(){
	int a, b; cin >> a >> b;
	cout << a*b << endl;
	return 0;
}


Measured memory_bytes: 3636
#include<stdio.h>
int main()
{
	int n,x;
	while(~scanf("%d%d",&n,&x))
	{
		int a[200]={0};
		int total=0,t=0;
		for(int i=1;i<=n;i++)
		{
			scanf("%d",&a[i]);
		}
		for(int i=1;i<=n+1;i++)
		{
			t=t+a[i-1];
			if(t<=x)
			total++;
		}
		printf("%d\n",total);
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const int INF = 1000000000;
const long INF64 = 1000000000000000ll;
const int MOD = 1000000007;
int main(){
	int a,b,c;
	std::cin >> a>>b>>c;
	std::cout << max(c-(a-b),0) << std::endl;
}

Measured memory_bytes: 256