akhauriyash/Code-Regression huggingface dataset:
function Main(input) {
  var lines = input.split('\n');
  var N = parseInt(lines[0], 10);
  var s = lines[1];
  var chars = s.split('');
  var R = chars.reduce(function(prev, cur){ return prev + (cur === 'R' ? 1 : 0); }, 0);
  var B = chars.reduce(function(prev, cur){ return prev + (cur === 'B' ? 1 : 0); }, 0);
  
	console.log(R > B ? 'Yes' : 'No');
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21064
k, n = map(int, input().split())
a_list = list(map(int, input().split()))
d_list = [a_list[0] + k - a_list[n - 1]]
for i in range(0, n - 1):
  d_list.append(a_list[i + 1] - a_list[i])
ans = sum(d_list) - max(d_list)
print(ans)

Measured memory_bytes: 26444
N = int(input())
ac = 0
wa = 0
tle = 0
re = 0
for i in range(N):
  A = input()
  if A == 'AC':
    ac += 1
  elif A == 'WA':
    wa += 1
  elif A == 'TLE':
    tle += 1
  else:
    re += 1
    
print('AC', 'x', ac)
print('WA', 'x', wa)
print('TLE', 'x', tle)
print('RE', 'x', re)

Measured memory_bytes: 9204
prime = [True] * (1000001)
prime[0] = False
prime[1] = False
for i in range(2, 1000001):
    if prime[i]:
        for j in range(i * 2, 1000001, i):
            prime[j] = False

while True:
    a, d, n = map(int, input().split())
    if a == 0:
        break
    count = 0
    i = a
    cont = True
    while cont:
        if prime[i]:
            count += 1
            if count == n:
                print(i)
                cont = False
        i += d



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

using namespace std;

const int N = 2e5+20,mod=1e9+7;

typedef long long ll;

ll f[N][3];
ll h[N],ne[N],e[N],idx; 

void add(int a,int b)
{
	e[idx]=b,ne[idx]=h[a],h[a]=idx++ ;
} 

void dfs(int u,int fa)
{
	int yz=1;
	for(int i=h[u];i!=-1;i=ne[i])
	{
		int v=e[i];
		if(v==fa) continue;
		yz=0;
		dfs(v,u);
	}
	if(yz)	f[u][1]=1,f[u][0]=1;
	else 
	{
		ll black=1,white = 1;
		for(int i=h[u];i!=-1;i=ne[i])
		{
			int v=e[i];
			if(v==fa) continue;
			else {
				black*=f[v][1];
				white*=(f[v][1]+f[v][0])%mod;
				black%=mod;
				white%=mod; 
			}
		}
		f[u][0]=black;
		f[u][1]=white;
	}
}

int main()
{
	int n;
	cin>>n;
	memset(h,-1,sizeof(h));
	int t=n-1;
	while(t--)
	{
		int a,b;
		cin>>a>>b;
		add(a,b);
		add(b,a);
	}
	dfs(1,-1);
	cout<<(f[1][0]+f[1][1])%mod<<endl;
	
}

Measured memory_bytes: 12544
from collections import Counter

mod = 1000000007

# nの素因数分解

def prime(n):
    d = Counter()
    i = 2
    while i*i <= n:
        while n%i == 0:
            n //= i
            d[i] += 1
        i += 1
    if n > 1:
        d[n] += 1
    return d

# xのn乗を計算する
def mod_pow(x, n):
    if n == 0:
        return 1
    elif n % 2 == 0:
        half_x = mod_pow(x, n // 2)
        return half_x * half_x % mod
    else:
        return x * mod_pow(x, n-1) % mod

fact = [1] * 100100
inv = [1] * 100100
for k in range(1, 100100):
    fact[k] = fact[k-1] * k % mod
    inv[k] = mod_pow(fact[k], mod-2)

def nCr(n, r):
    return fact[n] * inv[r] % mod * inv[n-r] % mod

def solve():
    N, M = map(int, input().split())
    p = prime(M)
    s = 1
    for i in p.values():
        s *= nCr(i + N - 1, N - 1)
        s %= mod
    print(s)

solve()


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

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

struct Node
{
    int node, len;
    Node() {node = len = 0;}
    Node(int node, int len) {this -> node = node, this -> len = len;}
};
typedef vector<Node> vg;

#define MAX 1
#define NON 0
#define MOD 1000000007

#define FOR(type, i, a, b) for(type i = a; i < b; i++)
#define FORR(type, i, b, a) for(type i = b; i > a; i--)
#define FORE(type, i, a, b) for(type i = a; i <= b; i++)
#define FORRE(type, i, b, a) for(type i = b; i >= a; i--)

#define testBit(n, bit) ((n >> bit) & 1)
#define flipBit(n, bit) (n ^ (1ll << bit))

main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    ll n, m; cin >> n >> m;
    ll sum = 0;
    FORE(ll, i, 1, m){
        ll num; cin >> num; sum += num;
    }
    if (sum > n) cout << -1;
    else cout << n - sum;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
int main(){
int a,s,d;
  cin >>a >>s >>d;
  for(int q=0;q<s;q++){
  cout << d <<" " ;
  }if(d>10){for(int q=a-s;q>0;q--){
  cout <<d-1<<" ";}}
  else{for(int q=a-s;q>0;q--){
  cout <<d+1<<" ";}}
  return 0;
}

Measured memory_bytes: 1280
using System;
using System.Collections.Generic;
using System.Text;
using System.Numerics;

namespace cc
{
    class Program
    {
        class Element : IComparable<Element>
        {
            public int a;
            public int b;

            public Element(int a, int b)
            {
                this.a = a;
                this.b = b;
            }

            public int CompareTo(Element e)
            {
                return b.CompareTo(e.b);
            }
        }

        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            List<Element> elist = new List<Element>();

            for (int i = 0; i < N; i++)
            {
                string[] strs = Console.ReadLine().Split(' ');

                Element e = new Element(int.Parse(strs[0]), int.Parse(strs[1]));
                elist.Add(e);
            }

            elist.Sort();

            int worktotal = 0;
            for (int i = 0; i < N; i++)
            {
                worktotal += elist[i].a;

                if(worktotal > elist[i].b)
                {
                    Console.WriteLine("No");
                    return;
                }
            }

            Console.WriteLine("Yes");
        }
    }
}


Measured memory_bytes: 27176
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
		a[i]--
	}
	c := 0
	now := 0
	for i := 0; i < n; i++ {
		if now == 1 {
			fmt.Println(c)
			return
		}
		now = a[now]
		c++
	}
	fmt.Println(-1)
}


Measured memory_bytes: 5504
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
using namespace std;

#define rep(i, s) for (int i = 0; i < s; ++i)
#define all(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define VEC(a, n) vector<int>a(n)
#define PQ(a) priority_queue<int>a
#define PQmin(a) priority_queue< int, :vector<int>, greater<int> >a
#define PAIR pair<int, int>
/*
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long  ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    int n;
    cin>>n;
    vector<pair<int,int> >a(n);
    for(int i=0;i<n;i++){
        cin>>a.at(i).first>>a.at(i).second;
    }
    int ans=n;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            int cnt=0;
            if(i==j){
                continue;
            }
            //n*(n-1)点の組み合わせについてベクトルを定める。
            int dx=a.at(i).first-a.at(j).first;
            int dy=a.at(i).second-a.at(j).second;

            //それぞれのdx.dyについて、その方向のベクトルが存在するかを確認する。
            for(int k=0;k<n;k++){
                for(int l=0;l<n;l++){
                    if((a.at(k).first-a.at(l).first)==dx){
                        if((a.at(k).second-a.at(l).second)==dy){
                            cnt++;
                            // break;
                        }
                    }
                }
            }
            ans=min(ans,n-cnt);
        }
    }
    cout<<ans<<endl;



    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define fastio                        \
    std::ios::sync_with_stdio(false); \
    std::cin.tie(NULL);
#define pb push_back
#define mp make_pair

typedef long long ll;

using namespace std;

int main()
{
    fastio;
    string n;
    cin>>n;
    int sn=0;
    for(int i=0;i<n.size();i++){
        sn+=n[i]-'0';
    }
    if(stoi(n)%sn==0) cout<<"Yes"<<'\n';
    else cout<<"No"<<'\n';
    
    return 0;
}

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

int main(){
  int N, K;
  cin >> N >> K;

  vector<int64_t> H(N);
  rep(i, N){
    cin >> H.at(i);
  }

  int64_t sum = 0;
  if(N > K){
    sort(H.begin(), H.end());
    rep(i, N-K){
      sum += H.at(i);
    }
  }

  cout << sum << endl;

}


Measured memory_bytes: 1792
#include<stdio.h>

int main()
{
	int x,i,h=0;

	scanf("%d",&x);
	while(x>=500){
		x-=500;
		h+=1000;
	}
	while(x>=5){
		x-=5;
		h+=5;
	}
	printf("%d",h);
	return 0;
}

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

#define MAX(X,Y) ((X)>(Y)?(X):(Y))

int main(void){
  long long n, maxa, maxb, ans;
  
  cin >> n;
  maxa = 0;
  for (int i=0; i<n; i++){
    long long a,b; cin >> a >> b;
    maxa = MAX(maxa, a);
    if (a==maxa) maxb = b;
  }
  cout << (maxb+maxa) << endl;
  return 0;
}

Measured memory_bytes: 3648
#include <stdio.h>
int main(void)
{
    int a,b;
    scanf("%d%d", &a,&b);
    if(a==b) printf("Draw");
    else if(a==1) printf("Alice");
    else if(b==1) printf("Bob");
    else if(a>b) printf("Alice");
    else if(b>a) printf("Bob");
    return 0;
}

Measured memory_bytes: 128
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

vector<long long> burger, patty;

long long dfs(int i, long long& x)
{
    if(x == 0)
        return 0;

    if(i == 0){
        -- x;
        return 1;
    }
    else if(burger[i] <= x){
        x -= burger[i];
        return patty[i];
    }

    -- x;
    long long ans = dfs(i-1, x);
    if(x > 0){
        -- x;
        ans += dfs(i-1, x) + 1;
        if(x > 0)
            -- x;
    }
    return ans;
}

long long solve(int n, long long x)
{
    burger.assign(n+1, 1);
    patty.assign(n+1, 1);
    for(int i=1; i<=n; ++i){
        burger[i] = burger[i-1] * 2 + 3;
        patty[i] = patty[i-1] * 2 + 1;
    }
    return dfs(n, x);
}

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

    cout << solve(n, x) << endl;

    return 0;
}


Measured memory_bytes: 256
# coding: utf-8
S=list(input())
K=int(input())
N=len(S)

L=[]

for i in range(N):
    L.append((26-(ord(S[i])-ord("a")))%26)

for i in range(N):
    if K>=L[i]:
        S[i]="a"
        K-=L[i]

if K>0:
    S[-1]=chr(ord("a")+((ord(S[-1])+K-ord("a"))%26))

print("".join(S))

Measured memory_bytes: 5048
#include<stdio.h>
#include<string.h>

int main(void){

    char O[51],E[51];
    int i;

    scanf("%s",O);
    scanf("%s",E);

    for(i = 0;i < strlen(E);i++){
        printf("%c",O[i]);
        printf("%c",E[i]);
    }

    if(strlen(O) > strlen(E)){
        printf("%c",O[strlen(O)-1]);
    }

    return 0;
}


Measured memory_bytes: 128
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define ub upper_bound
#define lb lower_bound
#define bit __builtin_popcount
#define memset(x) memset(x,0,sizeof(x))

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<vector<int>> matrix;

inline void boost(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

const ll maxn=2e5+123;
const ll inf=1e9+123;
const ll linf=1e18+123;
const ll mod=1e9+7;
const double eps=1e-9;
const double pi=acos(-1);
int dx[8]={0,1,-1,0,1,-1,1,-1};
int dy[8]={1,0,0,-1,1,1,-1,-1};
int mx,V;
vector<int>g[maxn];
queue<int>q;
void dfs(int v,int p){
    q.push(v);
    if(q.size()>mx){
        V=v;
        mx=max(mx,(int)q.size());
    }
    for(auto to:g[v]){
        if(to==p){
            continue;
        }
        dfs(to,v);
    }
    q.pop();
}
int main(){
    boost();
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int n;
    cin>>n;
    for(int i=1;i<=n-1;i++){
        int u,v;
        cin>>u>>v;
        g[u].pb(v);
        g[v].pb(u);
    }
    dfs(1,-1);
    dfs(V,-1);
    mx--;
    if(mx%3==1){
        cout<<"Second";
        return 0;
    }
    cout<<"First";
	exit(0);
}


Measured memory_bytes: 21376
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::str::FromStr;
use std::io::*;
use std::collections::*;
use std::cmp::*;

struct Scanner<I: Iterator<Item = char>> {
    iter: std::iter::Peekable<I>,
}

macro_rules! exit {
    () => {{
        exit!(0)
    }};
    ($code:expr) => {{
        if cfg!(local) {
            writeln!(std::io::stderr(), "===== Terminated =====")
                .expect("failed printing to stderr");
        }
        std::process::exit($code);
    }}
}

impl<I: Iterator<Item = char>> Scanner<I> {
    pub fn new(iter: I) -> Scanner<I> {
        Scanner {
            iter: iter.peekable(),
        }
    }

    pub fn safe_get_token(&mut self) -> Option<String> {
        let token = self.iter
            .by_ref()
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            Some(token)
        }
    }

    pub fn token(&mut self) -> String {
        self.safe_get_token().unwrap_or_else(|| exit!())
    }

    pub fn get<T: FromStr>(&mut self) -> T {
        self.token().parse::<T>().unwrap_or_else(|_| exit!())
    }

    pub fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.get()).collect()
    }

    pub fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }

    pub fn char(&mut self) -> char {
        self.iter.next().unwrap_or_else(|| exit!())
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.get::<String>().chars().collect()
    }

    pub fn line(&mut self) -> String {
        if self.peek().is_some() {
            self.iter
                .by_ref()
                .take_while(|&c| !(c == '\n' || c == '\r'))
                .collect::<String>()
        } else {
            exit!();
        }
    }

    pub fn peek(&mut self) -> Option<&char> {
        self.iter.peek()
    }
}

trait Joinable {
    fn join(self, sep: &str) -> String;
}

impl<U: ToString, T: Iterator<Item = U>> Joinable for T {
    fn join(self, sep: &str) -> String {
        self.map(|x| x.to_string()).collect::<Vec<_>>().join(sep)
    }
}
fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin.bytes().map(|c| c.unwrap() as char));
    let N: usize = sc.get();
    let mut a = Vec::new();
    for i in 0..N {
        let A: usize = sc.get();
        a.push((i, A));
    }
    a.sort_by_key(|k| k.1);
    for (i, _) in a {
        println!("{}", i+1);
    }
}


Measured memory_bytes: 6908
while True:
    (m, f, r) = [int(i) for i in input().split()]
    if m == f == r == -1:
        break
 
    total = m + f
    if m == -1 or f == -1 or total < 30:
        print('F')
    elif total < 50 and r < 50:
        print('D')
    elif total < 65:
        print('C')
    elif total < 80:
        print('B')
    else:
        print('A')

Measured memory_bytes: 6724
#include<iostream>                
#include<algorithm>
using namespace std;
int main()
{
int n,d,x;
int cnt=0;
cin>>n>>d>>x;
int a[101];
for(int i=0;i<n;i++)
cin>>a[i];
for(int i=0;i<n;i++)
{cnt+=1;
 cnt+=(d-1)/a[i];}
cout<<cnt+x;
system("pause");
return 0;
}   

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

int main() {
    int x[5];
    for(int i = 0; i < 5; ++i) {
        cin >> x[i];
    }
    for(int i = 0; i < 5; ++i) {
        if(x[i] == 0) {
            cout << i + 1 << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 3596
import java.util.*;
/*
Main class for AOJ where there is no input.
*/
public class Main{
   public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int n = Integer.parseInt(sc.nextLine());
      String str;
      String[] arr;
      int[][] pc = new int[4][13];
    
    /*
    pc[suit][number][bool]
    bool:
      0 = doesn't exist
      1 = exists
    suit:
      0 = Spade
      1 = Heart
      2 = Club
      3 = Diamond
    */
    
      for(int i = 0; i < n; i++){
         str = sc.nextLine();
         arr = str.split(" ");
         if(arr[0].equals("S")){
            pc[0][Integer.parseInt(arr[1])-1] = 1;
         }else if(arr[0].equals("H")){
            pc[1][Integer.parseInt(arr[1])-1] = 1;
         }else if(arr[0].equals("C")){
            pc[2][Integer.parseInt(arr[1])-1] = 1;
         }else if(arr[0].equals("D")){
            pc[3][Integer.parseInt(arr[1])-1] = 1;
         }
      }
      
      String[] symbol = {"S", "H", "C", "D"};
    
      for(int suit = 0; suit < 4; suit ++ ){
         for(int number = 0; number < 13; number ++){
            if(pc[suit][number] == 0){
               System.out.print(symbol[suit] + " " + (number + 1) + "\n");
            }
         }
      }
      
    
    
   }//main
}//class

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

inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	for (; ch < '0' || ch > '9'; ch = getchar()) if (ch == '-') f = -1;
	for (; ch >= '0' && ch <= '9'; ch = getchar()) x = (x << 1) + (x << 3) + ch - '0';
	return x * f;
}

int main()
{
	int n = read();
	int x = read();
	int d = read();
	if (d == 0 && x == 0) return puts("1"), 0;
	if (d == 0) return printf("%d\n", n + 1), 0;
	if (x == 0) return printf("%lld\n", 1LL * n * (n - 1) / 2 + 1), 0;
	
	if (x < 0) x = -x, d = -d;
	int gcd = __gcd(x, abs(d));
	x /= gcd; d /= gcd;
	
	long long ans = 1LL * n * n * (n + 1) / 2 
		- 1LL * n * (n + 1) * (2 * n + 1) / 6 + n + 1;
	for (int i = 0; i <= n; ++i)
		ans -= max(0LL, 
			min(1LL * (n + n - i - 1) * i / 2, 
				1LL * (n + n - i - d - 1) * (i + d) / 2 + x) - 
			max(1LL * i * (i - 1) / 2,
				1LL * (i + d) * (i + d - 1) / 2 + x) + 1);
	printf("%lld\n", ans);
	
	return 0;
}


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

using namespace std;

int main()
{
    int a = 0, b = 0, c = 0, d = 0;
    while (cin >> a >> b >> c >> d) {
        if (c > a) {
            if (b < c) cout << 0 << endl;
            else cout << (min(b, d) - max(a, c)) << endl;
        }
        else {
            if (d < a) cout << 0 << endl;
            else cout << (min(b, d) - max(a, c)) << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

class Main {
    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();

        int[][][] build = new int[4][3][10];
        do{
            int b = scanner.nextInt();
            int f = scanner.nextInt();
            int r = scanner.nextInt();
            int v = scanner.nextInt();
            build[b-1][f-1][r-1] += v;
        }while(1 < n--);
        
        int i =0;
        for(int[][] b : build){
            for(int[] f : b){
                for(int r : f){
                    System.out.print(" " + r);
                }
                System.out.println("");
            }
            i++;
            if(i < 4){
               System.out.println("####################"); 
            }
        }
    }
}


Measured memory_bytes: 29012
#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include <map>
#include <fstream>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <assert.h>
#include <complex>
using namespace std;
#define LONG_INF 10000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353LL
#define seg_size 65536*4
#define REP(i,n) for(long long i = 0;i < n;++i)
int done[10][10] = {};
int cnt[10] = {};
int n;
int solve(int now) {
	if (now == n + 1) return 1;
	vector<int> sizing;
	for (int i = now + 1; i <= n; ++i) {
		if (done[now][i] == 0) {
			sizing.push_back(i);
		}
	}
	long long ans = 0;
	for (int i = 0; i < (1 << sizing.size()); ++i) {
		int now_doing = i;
		for (int q = 0;q < sizing.size(); ++q) {
			if (now_doing % 2 == 1) {
				//kati
				cnt[now]++;
			}
			else {
				//make
				cnt[sizing[q]]++;
			}
			now_doing /= 2;
		}
		if (cnt[now] == n / 2) {
			ans += solve(now + 1);
		}
		now_doing = i;
		for (int q = 0; q < sizing.size(); ++q) {
			if (now_doing % 2 == 1) {
				//kati
				cnt[now]--;
			}
			else {
				//make
				cnt[sizing[q]]--;
			}
			now_doing /= 2;
		}
	}
	return ans;
}
int main() {
	while (true) {
		cin >> n;
		if (n == 0) return 0;
		int m;
		cin >> m;
		REP(i, 10) {
			REP(q, 10) {
				done[i][q] = 0;
			}
			cnt[i] = 0;
		}
		REP(i, m) {
			int a, b;
			cin >> a >> b;
			done[a][b] = 1;
			done[b][a] = 1;
			cnt[a]++;
		}
		cout << solve(1) << endl;
	}
}


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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int MOD = 1000000009;
const long long INF = 1LL << 60;

int main() {
    int N;
    cin >> N;
    vector<int> h(N);
    for (int i = 0; i < N; ++i) cin >> h[i];
    vector<ll> dp(N+1, INF);
    dp[0] = 0;
    for (int i = 0; i < N; ++i) {
        dp[i+1] = min(dp[i+1], abs(h[i+1] - h[i]) + dp[i]);
        if (N-1 > i) dp[i+2] = min(dp[i+2], abs(h[i+2] - h[i]) + dp[i]);
    }
    cout << dp[N-1] << endl;
    return 0;
}

Measured memory_bytes: 4560
#include <bits/stdc++.h>
#define int long long
#define pii pair<int,int>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(),(c).end()
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MINF(a) memset(a,0x3f,sizeof(a))
#define POW(n) (1LL<<(n))
#define IN(i,a,b) (a <= i && i <= b)
using namespace std;
template <typename T> inline bool CHMIN(T& a,T b) { if(a>b) { a=b; return 1; } return 0; }
template <typename T> inline bool CHMAX(T& a,T b) { if(a<b) { a=b; return 1; } return 0; }
template <typename T> inline void SORT(T& a) { sort(ALL(a)); }
template <typename T> inline void REV(T& a) { reverse(ALL(a)); }
template <typename T> inline void UNI(T& a) { sort(ALL(a)); a.erase(unique(ALL(a)),a.end()); }
template <typename T> inline T LB(vector<T>& v, T a) { return *lower_bound(ALL(v),a); }
template <typename T> inline int LBP(vector<T>& v, T a) { return lower_bound(ALL(v),a) - v.begin(); }
template <typename T> inline T UB(vector<T>& v, T a) { return *upper_bound(ALL(v),a); }
template <typename T> inline int UBP(vector<T>& v, T a) { return upper_bound(ALL(v),a) - v.begin(); }
template <typename T1, typename T2> ostream& operator<< (ostream& os, const pair<T1,T2>& p) { os << p.first << " " << p.second; return os; }
template <typename T1, typename T2> istream& operator>> (istream& is, pair<T1,T2>& p) { is >> p.first >> p.second; return is; }
template <typename T> ostream& operator<< (ostream& os, const vector<T>& v) { REP(i,v.size()) { if (i) os << " "; os << v[i]; } return os; }
template <typename T> istream& operator>> (istream& is, vector<T>& v) { for(T& in : v) is >> in; return is; }
template <typename T = int> vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...)); }
template <typename T, typename V> typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) { t = v; }
template <typename T, typename V> typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) { for(auto &e : t) fill_v(e,v); }
const int MOD = 1000000007;
const int INF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-10;

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

  int N;
  cin >> N;
  int sum = 0;
  int M = N;
  while (M) {
    sum += M % 10;
    M /= 10;
  }
  cout << (N % sum == 0 ? "Yes" : "No") << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,n) for(int i = (a); i < (n); ++i)
#define ALL(a) (a).begin(), (a).end()
#define debug_v(v,N) for(int i=0;i<N;i++) { cout << v[i] << " "; } cout << endl;
#define debug_vv(v,H,W) for(int i=0;i<H;i++) { for(int j=0;j<W;j++) { cout << v[i][j] << " "; } cout << endl; }

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pii;

void Main()
{
	int N, Q; cin >> N >> Q;
	vvi edges(N);
	rep(i, N - 1) {
		int a, b; cin >> a >> b;
		--a, --b;
		edges[a].push_back(b);
		edges[b].push_back(a);
	}
	vector<int> pq(N, 0);
	rep(i, Q) {
		int p, q; cin >> p >> q;
		pq[--p] += q;
	}
	vi cnt(N, 0);
	queue<int> q;
	q.push(0);
	vector<bool> use(N, false);
	while (!q.empty()) {
		int node = q.front(); q.pop();
		cnt[node] += pq[node];
		for (int next : edges[node]) {
			if (use[next]) continue;
			q.push(next);
			cnt[next] += cnt[node];
		}
		use[node] = true;
	}
	rep(i, N) {
		cout << cnt[i];
		if (i != N - 1) cout << " ";
	}
	cout << endl;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
}


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

using namespace std;

using ll = long long;

bool solve() {
    int n;
    cin >> n;
    int lt = 0, lx = 0, ly = 0;
    for (int i = 0; i < n; ++i) {
        int t, x, y;
        scanf("%d %d %d", &t, &x, &y);
        if (((abs(x - lx) + abs(y - ly)) & 1) != ((t - lt) & 1) ||
            abs(x - lx) + abs(y - ly) > t - lt) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    
    return 0;
}

int main() {
#ifdef LOCALHOST
    freopen("input", "r", stdin);
#endif
    while (solve());
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int N, K;
    cin >> N >> K;
    vector<long long> A(N+1);
    for (int i = 1; i <= N; i++) {
        cin >> A[i];
    }
    
    for (int i = 1; i <= N; i++) {
        A[i] += A[i-1];
    }
    
    vector<long long> cans;
    for (int i = 0; i < N; i++) {
        for (int j = i+1; j <= N; j++) {
            cans.push_back(A[j] - A[i]);
        }
    }

    for (int i = 0; i <= 60; i++) {
        long long bit = (1LL << (60 - i));
        vector<long long> next_cans;
        for (auto &j : cans) {
            if (bit & j) {
                next_cans.push_back(j);
            }
        }
        if (K <= next_cans.size()) {
            cans = next_cans;
        }
    }
    
    long long ans = cans[0];
    for (int i = 1; i < cans.size(); i++) {
        ans &= cans[i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 6388
#include<bits/stdc++.h>
using namespace std;
#define int long long 

main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    
    int n,x;
    cin>>n>>x;
    int v[n],w[n];
    for(int i=0;i<n;i++){
        cin>>w[i]>>v[i];
    }

    int dp[n+1][x+1];
    for(int i=0;i<=n;i++){
        dp[i][0]=0;
    }
    for(int i=1;i<=x;i++){
        dp[0][i]=0;
    }

    for(int i=1;i<=n;i++){
        for(int j=1;j<=x;j++){
            if(j>=w[i-1]){
                dp[i][j]=max(v[i-1]+dp[i-1][j-w[i-1]],dp[i-1][j]);
            }
            else{
                dp[i][j]=dp[i-1][j];
            }
        }
    }

    cout<<dp[n][x];

    return 0;
}

Measured memory_bytes: 79232
using System;
using System.Linq;

namespace ABC084_D
{
    class Program
    {
        static void Main(string[] args)
        {
            var Q = int.Parse(Console.ReadLine());
            int n = 100000;
            bool[] p = new bool[n + 1];
            p[1] = true;
            for (int i = 2; i <= (int)Math.Sqrt(n); i++)
            {
                if (p[i]) continue;
                for (int j = 2; j * i <= n; j++)
                    p[i * j] = true;
            }

            int[] l = new int[n + 1];
            for (int i = 1; i <= n; i++)
                l[i] = l[i - 1] + (!p[i] && !p[(i + 1) / 2] ? 1 : 0);

            for (int i = 0; i < Q; i++)
            {
                var lr = Console.ReadLine().Split().Select(int.Parse).ToArray();
                Console.WriteLine(l[lr[1]] - l[lr[0]-1]);
            }
        }
    }
}


Measured memory_bytes: 15940
import math
import random
from operator import itemgetter
import re
import sys
from itertools import accumulate
from collections import defaultdict
from collections import deque
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
input = sys.stdin.readline
N = int(input())
A =[int(i) for i in input().split()]
num_count = [0] * N
ans = 1
md = 1000000007
for i in range(N):
    num_count[A[i]] += 1
    if num_count[A[i]] > 3 :
        ans = 0
        break
    else:
        if A[i] != 0:
            if num_count[A[i]-1] == 0:
                ans = 0
                break
            else:
                ans *=  num_count[A[i]-1]-num_count[A[i]]+1
                ans = ans%md
        else:
            continue
if num_count[0] == 2:
    ans *= 6
    ans = ans%md
elif num_count[0] == 3:
    ans *= 6
    ans = ans%md
else:
    ans *= 3
    ans =ans%md
print(ans)

Measured memory_bytes: 79152
#include <iostream>
#include <math.h>
#include <set>
#include<vector>
#include<string>
#include <algorithm>
#include<queue>
#define rep(i,j,k) for(int i = (int)j;i <= (int)k;i ++)
#define per(i,j,k) for(int i = (int)j;i >= (int)k;i --)
#define F(i,k) for(int i=(int)0;i<(int)k;i++)
#define pii pair<int,int>
typedef long long ll;
const int maxn = 3e5 + 5;
using namespace std;
ll m,k;
int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	int a, b;
	cin >> a >> b;
	cout << max(max(a + b, a - b), a*b);
	//	cin >> n;
}

/*

*/

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

def main():
    n, nc = map(int, input().split())
    d = [list(map(int, input().split())) for i in range(nc)]
    c = [list(map(int, input().split())) for i in range(n)]

    cnt = [[0 for _ in range(nc)] for eta in range(3)]
    for i in range(n):
        for j in range(n):
            eta = (i + j) % 3
            cnt[eta][c[i][j] - 1] += 1

    iwamin = 10 ** 9
    for c1 in range(nc):
        for c2 in range(nc):
            for c3 in range(nc):
                if len(set([c1, c2, c3])) < 3:
                    continue
                iwa = 0
                for c4 in range(nc):
                    iwa += cnt[0][c4] * d[c4][c1]
                    iwa += cnt[1][c4] * d[c4][c2]
                    iwa += cnt[2][c4] * d[c4][c3]
                iwamin = min(iwamin, iwa)
    print(iwamin)

if __name__ == "__main__":
    main()


Measured memory_bytes: 5620
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s, t;
  cin >> s >> t;
  
  if(t.size()==s.size()+1){
  
    int sum = 0;
  for(int i=0;i<s.size();i++){
    if(s.at(i)==t.at(i)){
   sum++;
    }
  }
  
    if(sum==s.size()){
      cout << "Yes" << endl;
    }
    else{
    cout << "No" << endl;
    }
  }
  else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3632
# 帰宅経路数と時間を取得
N, T = map(int, input().split())
# 時間制限
ans = 1001
# N個の帰宅経路と時間を取得し、比較する
for i in range(N):
    cost, time = map(int, input().split())
    if time <= T:
        ans = min(ans, cost)
# 出力する
if ans == 1001:
    ans = "TLE"
print(ans)

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

int main(){
    ll n;
    cin>>n;
    string s;
    cin>>s;
    ll r=0,g=0,b=0;
    for (int i = 0; i < n; ++i) {
        if(s[i]=='R')r++;
        if(s[i]=='G')g++;
        if(s[i]=='B')b++;
    }
    ll ans=0;
    ans+=r*g*b;
    for (int j = 0; j < n; ++j) {
        for (int i = 0; i <n ; ++i) {
            int now1=i;
            int now2=now1+j;
            int now3=now2+j;
            if(now3>=n)continue;
            if(s[now1]!=s[now2] && s[now2]!=s[now3] && s[now3]!=s[now1])ans--;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3632
// Created by sz
#include <bits/stdc++.h>
using namespace std;

const int MAXN = 3005;
int dp[MAXN][MAXN];


int main(){
#ifdef LOCAL
    freopen("./input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    string a,b, c;
    cin>>a>>b;
int lena = a.length(), lenb = b.length();
for(int i = lena-1; i>=0; i--){
    for(int j = lenb-1; j  >= 0 ; j--){
        if(a[i]==b[j]){
            dp[i][j] = max(dp[i][j], dp[i+1][j+1]+1);
        }else{
            dp[i][j] = max(dp[i][j+1], dp[i+1][j]);
        }
    }
}

int i = 0, j = 0;
while (i < lena && j < lenb)
{
    if (a[i]==b[j])
    {
        c = c +a[i];
        i++; j++;
    }
    else if (dp[i+1][j] == dp[i][j]) i++;
    else j++;
}
cout<<c<<endl;
    return 0;
}





Measured memory_bytes: 35456
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main() {
  int N, L;
  string S[100];
  cin >> N >> L;
  for (int i = 0; i < N; i++) cin >> S[i];
  sort(S, S + N);
  for (int i = 0; i < N; i++) cout << S[i];
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

// inf
constexpr ll infl = 10000000000000000LL;
constexpr int inf = 1000000000;

void dfs(int s, const pair<int, int>& e, const vector<vector<int>>& graph, vector<bool>& visited) {
    if (visited[s]) return;
    
    visited[s] = true;
    for (int to : graph[s]) {
        if ((s == e.first && to == e.second) || (s == e.second && to == e.first)) continue;
        dfs(to, e, graph, visited);
    }
}

int main() {
    int N, M;
    cin >> N >> M;

    vector<vector<int>> graph(N, vector<int>());
    vector<pair<int, int>> edges(M);
    for (int i = 0; i < M; ++i) {
        int a, b;
        cin >> a >> b;
        --a;
        --b;
        graph[a].push_back(b);
        graph[b].push_back(a);
        edges[i] = {a, b};
    }

    int ans = 0;
    for (auto &e : edges) {
        vector<bool> visited(N);
        dfs(0, e, graph, visited);

        bool flag = false;
        for (auto v : visited) {
            if (!v) flag = true;
        }
        ans += flag;
    }
    cout << ans << endl;

    return 0;
}

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

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

int main() {

    int a, b; cin >> a >> b;
    --a; --b;

    int c[3] = {};

    c[a]++;
    c[b]++;

    for (int i = 0; i < 3; ++i) {
        if (c[i] == 0) {
            cout << i+1 << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fileio freopen("in.in", "r", stdin),freopen("out.out", "w", stdout);
#define ll long long int
#define FF first
#define SS second
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<long long int,long long int>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d\n",x)
#define plld(x) printf("%lld\n",x)
#define pss printf
#define MOD 998244353
#define INF 1e18
#define eps 0.00001
#define endl '\n'
#define debug(n1) cout<<n1<<endl

int n,k;
ll dp[2005][2005];
ll pre[2005];
ll dp1[2005][2005];

int rec(int i,int j)
{
	return dp[i][j];
}

int rec1(int i,int j)
{
	if(j==0)
		return 1;
	if(i==0)
		return (j==0);
	if(dp1[i][j]!=-1)
		return dp1[i][j];
	int an=(rec1(i-1,j)+rec1(i,j-1))%MOD;
	return dp1[i][j]=an;
}

int main()
{
	SPEED;		
	cin>>k>>n;
	dp[0][0]=1;
	pre[0]=1;
	for(int j=1;j<=n;j++)
		pre[j]=(pre[j-1]+dp[0][j])%MOD;
	for(int i=1;i<=k;i++)
	{
		dp[i][0]=1;
		for(int j=1;j<=n;j++)
			dp[i][j]=(dp[i-1][j]+2*pre[j-1])%MOD;
		pre[0]=dp[i][0];
		for(int j=1;j<=n;j++)
			pre[j]=(pre[j-1]+dp[i][j])%MOD;
	}
	memset(dp1,-1,sizeof dp1);
	for(int i=2;i<=2*k;i++)
	{
		ll ans=0;
		int moves=0;
		if(i%2)
		{
			if(i<=k)
				moves=i/2;
			else
				moves=i/2-(i-k)+1;
			for(int j=0;j<=n;j++)
			{
				ll x=rec(moves,j);
				ll y=rec1(k-2*moves,n-j);
				ans=(ans+x*y)%MOD;
			}
		}
		else
		{
			if(i<=k)
				moves=(i-1)/2;
			else
				moves=(i-1)/2 - (i-k-1);
			for(int j=0;j<=n;j++)
			{
				ll x=rec(moves,j);
				ll y=rec1(k-2*moves-1,n-j);
				ans=(ans+x*y)%MOD;
				y=0;
				if(n-j-1>=0)
					y=rec1(k-2*moves-1,n-j-1);
				ans=(ans+x*y)%MOD;
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 63232
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define inf 1000000000000000
#define mod 1000000007
typedef pair<int, int> P;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}

signed main() {
	int h, w, d;
	cin >> h >> w >> d;
	P a[90005];
	rep(i, h) {
		rep(j, w) {
			int x;
			cin >> x;
			a[x] = P(i, j);
		}
	}
	int ans[90005];
	for (int i = 1; i <= d; i++) {
		ans[i] = 0;
		for (int j = i + d; j <= h * w; j += d) {
			ans[j] = ans[j - d] + abs(a[j].first - a[j - d].first) + abs(a[j].second - a[j - d].second);
		}
	}
	int q;
	cin >> q;
	rep(i, q) {
		int l, r;
		cin >> l >> r;
		cout << ans[r] - ans[l] << endl;
	}

	return 0;
}


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

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

#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;

const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;


int main(){
   char s;
   cin >> s;
   if(s - 'A'<=26)cout << 'A' << endl;
   else cout << 'a' << endl;
}

Measured memory_bytes: 3596
#include "bits/stdc++.h"
using namespace std;
#define pb          push_back
#define mp          make_pair
#define ll          long long
#define pii         pair<ll, ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll, ll>
#define mii         map<pii, ll>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define debug(x) cout << '>' << #x << ':' << x << endl;
#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 bg(i)       i.begin()
#define fset(it,s)   for(auto it = s.begin(); it != s.end(); it++)
 
#define track(x)                 cerr<<#x<<": "<<x<<endl
#define track2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define track3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define track4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
 
#define ed(i)       i.end()
#define mem(a)	    memset(a, 0, sizeof(a))

#define MOD         1000000007
ll mult(ll a,ll b, ll p=MOD){return ((a%p)*(b%p))%p;}
ll add(ll a, ll b, ll p=MOD){return (a + b + p)%p;}
ll fpow(ll n, ll k, ll p = MOD) {ll r = 1; for (; k; k >>= 1LL) {if (k & 1LL) r = mult(r,n,p); n = mult(n,n,p);} return r;}
ll inv(ll a, ll p = MOD) {return fpow(a, p - 2, p);}
void self_max(int &a, int &b) {a = max(a, b); }
void self_min(int &a, int &b) {a = min(a, b); }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
const int INF = 1e9 + 5;
#define N	    	400001
int dp[N];
void solve(){
    int n, k;
    cin>>n>>k;
    int a[n];
    rep(i, 0, n)
        cin>>a[i];
    rep(i, 1, k+1) {
        rep(j, 0, n) {
            if(i - a[j] >= 0 && dp[i-a[j]] == 0) {
                dp[i] = 1;
            }
        }
    }
    if(dp[k])
        cout<<"First"<<endl;
    else
        cout<<"Second"<<endl;
}
int main() {
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);
	cin.tie(0);
	cout.tie(0);
	int t = 1;
//	cin>>t;
	while(t--){
		solve();
	}
}




Measured memory_bytes: 640
main(float v){for(;scanf("%f",&v)+1;)puts(v>91.00?"heavy":v>81?"light heavy":v>75?"middle":v>69?"light middle":v>64?"welter":v>60?"light welter":v>57?"light":v>54?"feather":v>51?"bantam":v>48?"fly":"light fly");}

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

using namespace std;
int N;
long long int A[100005];

int main(void) {


	cin >> N;

	for (int i = 1; i <= N; i++) {
		cin >> A[i];
	}

	for (int i = 1; i <= N; i++) {
		if (A[i] == 0) { cout << 0 << endl; return 0; }
	}

	long double tmp = 1.0;

	for (int i = 1; i <= N; i++) {
		tmp *= A[i];
	}

	if (tmp > 1.0e18) { cout << -1 << endl; return 0; }
	else {
		long long int ans = 1;
		for (int i = 1; i <= N; i++) {
			ans *= A[i];
		}

		if (ans <= 1000000000000000000) { cout << ans << endl; }
		else { cout << -1 << endl; }

	}

	return 0;
}

Measured memory_bytes: 3972
#include<bits/stdc++.h>
#define db double
#define ui unsigned int
#define ll long long
#define ull unsiged ll
#define rep(i,l,r) for(int i=l;i<=r;i++)
#define per(i,r,l)for(int i=r;i>=l;i--)
#define pb push_back
#define pp pop_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mod 1e9+7
#define vii vector<int>
#define vll vector<ll>
#define vpp vector<pii>
#define inf  INT_MAX
#define lnf LLONG_MAX
#define mii map<int,int>
#define mll map<ll,ll>
#define mil map<int,ll>
#define umii unordered_map<int,int>
#define umll unordered_map<ll,ll>
#define si(n) scanf("%d",&n)
#define sl(n) scanf("%lld",&n)```
using namespace std;
const int MX = 2e5 + 7;
ll modulo(ll num, ll MOD = mod) { return ((num%MOD) + MOD) % MOD; }
ll power(ll b, ll e, ll MOD = mod) { ll ans = 1; while (e) { if (e&1) ans = (ans*b) % MOD; b = (b*b) % MOD; e /= 2; } return ans; }
ll inv(ll num, ll MOD = mod) { return power(modulo(num), MOD - 2, MOD); }
ll gcd(ll a, ll b) { return ((b == 0) ? a : gcd(b, a%b)); }
int main()
{
	ios::sync_with_stdio(0);cin.tie(0);
	int t,n,m;
	cin>>n;
	rep(i,1,9)rep(j,1,9)if(i*j==n){cout<<"Yes"<<endl;return 0;}
   cout<<"No"<<endl;
}


Measured memory_bytes: 256
import java.util.*;

class Main {
  public static void main (String[] args) {
    Scanner scanner = new Scanner(System.in);
    String out = "";
    while (scanner.hasNext()) {
      int beginY = scanner.nextInt();
      int endY = scanner.nextInt();
      if (beginY == 0 && endY == 0) {
        break;
      }
      boolean flag = false;
      for (int y = beginY;  y <= endY; y++) {
        if (y % 4 != 0) {
          continue;
        }
        if (y % 100 == 0 && y % 400 != 0) {
          continue;
        }
        out += y + "\n";
        flag = true;
      }
      if (!flag) {
        out += "NA\n";
      }
      out += "\n";
    }
    System.out.print(out.substring(0, out.length() - 1));
  }
}

Measured memory_bytes: 53980
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;

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

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

int main() {
  int n, m;
  cin >> n >> m;
  cout << (n-1)*(m-1) << endl;
}

Measured memory_bytes: 256
def solve(string):
    n, *a = map(int, string.split())
    a = sorted(a)
    ans = 1
    for _a in a:
        ans *= _a
        if ans > 10**18:
            return "-1"
        if ans == 0:
            return "0"
    return str(ans)


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))


Measured memory_bytes: 23412
#include <bits/stdc++.h>
#define rep(i,N) for (int i = 0; i < (N); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main(void){
  int N;
  cin >> N;

  int x, y;
  x = 800 * N;
  y = 200 * (N / 15);
  cout << x - y << endl;
}


Measured memory_bytes: 3560
import sys
input = sys.stdin.readline

def main():
    s = list( input() )
    t = list( input() )
    s.pop(-1)
    t.pop(-1)
    len_s = len( s )
    len_t = len( t )
    max = 0
    for i in range( len_s - len_t + 1 ):
        same = 0

        for j in range(len_t ):
            if s[ i + j ] == t[ j ]:
                same += 1

        if same > max:
            max = same
    
    print( len_t - max )

main()

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

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

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

const int MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;
int INF = INT_MAX / 2;

int main() {
	int N, M; cin >> N >> M;
	vector<vector<int> > G(N);
	while (M--) {
		int u, v; scanf("%d%d", &u, &v);
		u--; v--;
		G[u].pb(v); G[v].pb(u);
	}
	int Q; cin >> Q;
	vector<int> u0(Q), d(Q), c(Q);
	rep(k, Q) {
		scanf("%d%d%d", &u0[k], &d[k], &c[k]);
		u0[k]--;
	}
	vector<int> a(N, -1);
	rep(t, 11) {
		vector<int> _a = a;
		rep(u, N) for (int v: G[u]) _a[v] = max(_a[v], a[u]);
		a = _a;
		rep(k, Q) if (d[k] + t == 10) a[u0[k]] = max(a[u0[k]], k);
	}
	rep(u, N) printf("%d\n", a[u] == -1 ? 0 : c[a[u]]);
}


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

int main() {
  
  int A, B, C, D, L, R;
  cin >> A >> B >> C >> D;
  
  L = A + B;
  R = C + D;
  
  if (L > R) {
    cout << "Left" << endl;
  }
  
  else if (L < R) {
    cout << "Right" << endl;
  }
  
  else {
    cout << "Balanced" << endl;
  }
}


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

#define llint long long int

using namespace std;

int main() {
    int N;

    cin >> N;

    vector<int> L(N);

    for (int i = 0; i < N; i++) {
        cin >> L[i];
    }
    int count = 0;

    for (int i = 0; i < N - 2; i++) {
        for (int j = i + 1; j < N - 1; j++) {
            for (int k = j + 1; k < N; k++) {
                if (L[i] + L[j] > L[k] && L[j] + L[k] > L[i] && L[k] + L[i] > L[j]) {
                    if (L[i] != L[j] && L[j] != L[k] && L[k] != L[i]) {
                        count++;
                    }
                }
            }
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 3636