akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define ALL(n) begin(n),end(n)

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

    long long power=1;
    for(int i=1; i<=n; i++){
        power=(power*(long long)i)%1000000007;
    }

    cout<<power<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <deque>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <complex>
#include <bitset>
#include <functional>

using namespace std;
using ll=long long int;

int main() {
    string s;
    cin >> s;

    if (s.length() % 2 != 0) {
        cout << "No" << endl;
        return 0;
    }

    for (int i = 0; i < s.length(); ++i) {
        if ((i % 2 == 0 && s[i] != 'h') || (i % 2 == 1 && s[i] != 'i')) {
            cout << "No" << endl;
            return 0;
        }
    }

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


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x) x
#define rep(...) MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c) c.begin(),c.end()
#define mp make_pair
#define write(x) cout<<(x)<<"\n"
using namespace std; typedef long long ll;
typedef vector<int> vi; typedef vector<ll> vll; template<class T>using vv = vector<vector<T>>;
template<class T>vv<T> vvec(size_t n, size_t m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T>bool chmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
template<class T>bool chmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 28, MOD = 1e9 + 7; constexpr ll LINF = 1ll << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); }; }aaaa;

int N, M;
vi card;

int main() {
    cin >> N >> M;
    card.resize(N + 1, 0);

    rep(i, M) {
        int l, r;
        cin >> l >> r;
        card[l - 1]++;
        card[r]--;
    }

    int ans = 0;
    int current = 0;
    rep(i, N) {
        current += card[i];
        if (current == M) ans++;
    }
    
    write(ans);
}

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

int main(){
  ll n,a,b,c,i;
  cin >> n;
  a=n;
  c=ceil(sqrt(n));
  for(i=1;i<=c;i++){
    if(n%i==0){
      a=min(a,i+n/i-2);
    }
  }
  cout << a;
}

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	odd := 0
	for i := 0; i < n; i++ {
		a := nextInt()
		odd += a % 2
	}
	if odd%2 == 0 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


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

long long f(long long x){
    if(x % 2 == 1){
        return ((x + 1) / 2) % 2;
    }
    return (x / 2) % 2 ^ x;
}

int main(){
    long long a, b;
    cin >> a >> b;
    if(a == 0)
        cout << f(b) << endl;
    else
        cout << (f(a - 1) ^ f(b)) << endl;
}

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


#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

// vector<vector<uint64_t> > v(n+1, vector<uint64_t>(n+1, 0))
// v[n][k]に組み合わせ数が入る。
void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

// フェルマーの小定理
// mod. m での a の逆元 a^{-1} を計算する
// (a/b)%m = a*movinv(b,m)%m  
int64_t modinv(int64_t a, int64_t m) {
    int64_t b = m, u = 1, v = 0;
    while (b) {
        int64_t t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

// 円周率
// M_PI

// #include <iomanip> // setprecisionを使用するのに必要
// cout << std::fixed << std::setprecision(15) << y << endl;

// 昇順
// priority_queue<int, vector<int>, greater<int> > queue;

int64_t getVal(int64_t d){
  int64_t ans = 1;
  for(int i=1;i<d;i++){
    ans *= 10;
  }
  return ans;
}



signed main() {
  int n;
  cin >> n;
  int d[n] = {};
  for(int i=0;i<n;i++){
    cin >> d[i];
  }
  int64_t ans = 0;
  for(int i=0;i<n-1;i++){
    for(int j=i+1;j<n;j++){
      ans += d[i]*d[j];
    }
  }
  cout << ans << endl;
  return 0;
  
}




Measured memory_bytes: 3664
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
using namespace std;
typedef long long ll;

int main(){
ll n;cin>>n;
if(n<2)cout<<1;
else if(n<4)cout<<2;
else if(n<8)cout<<4;
else if(n<16)cout<<8;
else if(n<32)cout<<16;
else if(n<64)cout<<32;
else cout<<64;
}

Measured memory_bytes: 256
import math
N, A, B, C = 5, 100, 90, 80
ARR = [
    98,
    40,
    30,
    21,
    80
]

# N,A,B,C = 8, 100, 90, 80
# ARR = [
#     100,
#     100,
#     90,
#     90,
#     90,
#     80,
#     80,
#     80,
# ]


# N,A,B,C,= 8, 1000, 800, 100
# ARR = [
#     300,
#     333,
#     400,
#     444,
#     500,
#     555,
#     600,
#     666,
# ]

N,A,B,C = map(int,input().split())
ARR = []
for i in range(N):
    ARR.append(int(input()))

def calculate(n, arr, a, b, c):
    result = []
    for i in range(4 ** n):
        materialA = set()
        materialB = set()
        materialC = set()
        materialNone = set()
        for j in range(n):
            s = (i >> 2 * j & 1)
            t = (i >> (2 * j + 1) & 1)
            if (s == 0) and (t == 0):
                materialA.add(j)
            if (s == 1) and (t == 0):
                materialB.add(j)
            if (s == 0) and (t == 1):
                materialC.add(j)
            if (s == 1) and (t == 1):
                materialNone.add(j)

        ok, mp = judge(n, arr, a, b, c, materialA, materialB, materialC, materialNone)
        if ok:
            result.append(mp)
    print(int(min(result)))

def judge(n, arr, a, b, c, materialA, materialB, materialC, materialNone):


    if materialNone == n:
        return False, -1

    if len(materialA) == 0:
        return False, -1

    if len(materialB) == 0:
        return False, -1

    if len(materialC) == 0:
        return False, -1

    mpA = 0
    a = a - calculateResult(arr,materialA)
    mpA += math.fabs(a)
    if len(materialA) > 1:
        mpA += 10 * (len(materialA) - 1)

    mpB = 0
    b = b - calculateResult(arr,materialB)
    mpB += math.fabs(b)
    if len(materialB) > 1:
        mpB += 10 * (len(materialB) - 1)

    mpC = 0
    c = c - calculateResult(arr,materialC)
    mpC += math.fabs(c)
    if len(materialC) > 1:
        mpC += 10 * (len(materialC) - 1)


    return True,mpA+mpB+mpC

def calculateResult(arr,material):
    result = 0
    for m in material:
        result = result + arr[m]
    return result

calculate(N, ARR, A, B, C)


Measured memory_bytes: 4624
n = int(input())

ans = 0
for i in range(1, 10**6+1):
    if n % i == n//i:
        ans += i

if n <= 10**6:
    print(ans)
    exit()
  
syou = n // 10**6

i = 10**6 + 1
while True:
    if syou != n//i or i >= n:
        break
    else:
        if n % i == n//i:
            ans += i
    i += 1

syou = n//i

for i in range(1, syou+1):
    if (n-i) % i != 0:
        continue
    else:
        okiniiri = (n-i) // i
        if n % okiniiri == i:
            ans += okiniiri 

print(ans)

Measured memory_bytes: 40172
N = int(input())
An = list(map(int,input().split(' ')))

sum_list = [ ]
nagative_count = 0
for i in range(N):
    if An[i] < 0 :
        sum_list.append(An[i]*(-1))
        nagative_count += 1
    else: 
        sum_list.append(An[i])

if nagative_count%2 == 0:
    print(sum(sum_list))
else:
    sum_list.sort()
    sum_list[0] = sum_list[0]*(-1)
    print(sum(sum_list))

Measured memory_bytes: 69468
#include <bits/stdc++.h>
using namespace std;
int n, m;
string mat[110];
bool f[110], c[110];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> m;
    for(int i = 0; i < n; i ++)
        cin >> mat[i];
    for(int i = 0; i < n; i ++)
    {
        bool flag = true;
        for(int j = 0; j < m; j ++)
            if(mat[i][j] == '#')
            {
                flag = false;
                break;
            }
        f[i] = flag;
    }
    for(int j = 0; j < m; j ++)
    {
        bool flag = true;
        for(int i = 0; i < n; i ++)
            if(mat[i][j] == '#')
            {
                flag = false;
                break;
            }
        c[j] = flag;
    }
    for(int i = 0; i < n; i ++)
    {
        if(f[i])
            continue;
        for(int j = 0; j < m; j ++)
            if(!c[j])
                cout << mat[i][j];
        cout << '\n';
    }
    return 0;
}


Measured memory_bytes: 256
import math
import copy
import sys
import bisect
input = sys.stdin.readline
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)
def lcm(a, b):
    return((a*b)//gcd(a,b))

def main():
    #x,y = map(int,input().split())	x=1,y=2
    #a = input().split()	a=['1','2','3',...,'n']
    #a = list(map(int,input().split()))	a=[1,2,3,4,5,...,n]
    #li = input().split('T')	FFFTFTTFF => li=['FFF', 'F', '', 'FF']
    #複数行の「1 2 3 4」型の入力を一配列に
    #x = sorted([list(map(int, input().split())) for _ in range(n)])
    n=int(input())
    x = sorted([list(map(int, input().split())) for _ in range(n)])
    x.sort(key=lambda y:y[1])
    time=0
    for i in range(n):
        time+=x[i][0]
        if time>x[i][1]:
            print("No")
            exit()
    print("Yes")


main()

Measured memory_bytes: 85852
a = gets

array =  a.split(" ")
b = array[0].to_i
c = array[1].to_i

if c>b
  box = b
  b=c
  c=box
end

for num in 1..c*b
  if c*num%b==0
  	puts c*num
    break
  end
end

  
  

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

int main() {
  
  long long X,K,D;
  cin >> X >> K >> D;

  if(abs(X) / D >= K) {
    cout << abs(X) - D*K << endl;
  }else {
    long long rest = abs(X)-D*abs(X/D);
    long long num = K - abs(X)/D;
    if(num % 2 != 0) {
      cout << abs(D-rest) << endl;
    }else {
      cout << rest << endl;
    }
  }


}


Measured memory_bytes: 3592
#include <cstdio>
using namespace std;

int n, a[6];

int main(){
	scanf("%d", &n);
	for(int i = 0; i < n; i++){
		double height;
		scanf("%lf", &height);
		if(height < 165.0) a[0]++;
		else if(height < 170.0) a[1]++;
		else if(height < 175.0) a[2]++;
		else if(height < 180.0) a[3]++;
		else if(height < 185.0) a[4]++;
		else a[5]++;
	}
	for(int i = 0; i < 6; i++){
		printf("%d:", i+1);
		for(int j = 0; j < a[i]; j++) printf("*");
		printf("\n");
	}
}

Measured memory_bytes: 1068
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,ans;
  int l[100010],r[100010];
  cin >> n;
  for(int i=0; i<n; i++){
    cin >> l[i];
    cin >> r[i];
   }
   for(int i=0; i<n; i++){
     ans += r[i]-l[i] + 1;
   }
   cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cmath>
using namespace std;

int main(){
  double x1, x2, y1, y2;

  cin >> x1 >> y1 >> x2 >> y2;
  
  printf("%f\n", sqrt( (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) ) );
  
  return 0;
}

Measured memory_bytes: 1228
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) (y<0||x<0||y>=h||x>=w)
#define dump(...)
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
#define INF (1001001001)
#define INFLL (1001001001001001001ll)
template<class T> ostream& operator << (ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v)) os<<*i<<(i==end(v)-1?"":"\n"); return os; }
template<class T> istream& operator >> (istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i; return is; }
template<class T> istream& operator >> (istream &is, pair<T,T> &p) {
    is>>p.first>>p.second; return is; }
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;}
//------------------------------------------------------------------------------
struct before_main_function {
    before_main_function() {
        #ifdef int
            #undef INF
            #define INF INFLL
            #define stoi stoll
        #endif
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
        #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

int N,K;
int sum[200005],a[200005],b[200005];

int size;
int bit[200005];
void add(int i,int x) {
    while(i<=size) {
        bit[i]+=x;
        i+=i&-i;
    }
}
int getsum(int i) {
    int ret=0;
    while(i>0) {
        ret+=bit[i];
        i-=i&-i;
    }
    return ret;
}

signed main() {
    cin>>N>>K;
    REP(i,N) {
        cin>>a[i];
        sum[i]+=a[i];
        if(i>0) sum[i]+=sum[i-1];
    }

    map<int,int> idx;
    REP(i,N+1) {
        b[i]=(i>0?sum[i-1]:0)-i*K;
        idx[b[i]]=0;
    }
    int cnt=0;
    FORE(x,idx) {
        x.second=cnt++;
    }

    size=N+2;
    int ans=0;
    REP(i,N+1) {
        int x=idx[b[i]];
        ans+=getsum(x+1);
        add(x+1,1);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 19072
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In,' '));
        }

        public void Solve(ConsoleInput cin)
        {
            char[] S = cin.Read.ToCharArray(); 
            var ans = false;

            if(S[0] == S[1]){
                if(S[2] == S[3] && S[1] != S[2])  ans = true;
            }else{
                if(S[1] == S[3] && S[0] == S[2]) ans = true;
                if(S[1] == S[2] && S[0] == S[3]) ans = true;
            }

            if(ans) WriteLine("Yes");
            else WriteLine("No");
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream,char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }

        public string Read
        {
            get
            {
                if(inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for(int i = 0;i < tmp.Length;i++)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }

        
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }

}

Measured memory_bytes: 11220
import sys, re
import math
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul	# 
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd	# 最大公約数
from heapq import heappush, heappop

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

# -*- coding: utf-8 -*-
s, w = LIST()

if s <= w:
    print("unsafe")
else:
    print("safe")

Measured memory_bytes: 10620
import java.util.Scanner;
class Main {

  public static void main(String args[]) {

    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    int kekka = A;
    if (A == B) {
      kekka = C;
    } else if (A == C) {
      kekka = B;
    }
    System.out.println(kekka);

  }

}


Measured memory_bytes: 21844
#include  <stdio.h>

int main(void){

  int size=0;
  int max=0;
  int min=1000;
  int num=0;
  int sum=0;
  while(1){

    min=1000;
    max=0;
    sum=0;
    scanf("%d",&size);
    if(size==0){
      break;
    }
    for(int i=0;i<size;i++){
      scanf("%d",&num);
      sum+=num;
  //    printf("::%d\n",sum);
      if(num<min){
        min=num;
      }
      if(num>max){
        max=num;
      }
    }
//    printf("%d %d",min,max);
    sum=((sum-max)-min)/(size-2);
    printf("%d\n",sum);
}
return 0;
}



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

int main(){
    int s;
    scanf("%d",&s);
    int a[1000000] = {s};
    int i, j, x=1;
    while(x){
        a[i+1] = a[i]%2==0 ? a[i]/2: 3*a[i]+1;
        for(j=0; j<i; j++){
            if(a[i] == a[j]){
                printf("%d\n",i+1);
                x = 0;
                break;
            }
        }
        i++;
    }
    return 0;
}

Measured memory_bytes: 4096
#include<bits/stdc++.h>
using namespace std;
int main(void){
  int n; cin >> n;
  int a[2][n];
  for(int i=0;i<2;i++)for(int j=0;j<n;j++) cin >> a[i][j];
  int maxi = 0;
  for(int i=0;i<n;i++){
    int sum = 0;
    for(int j=0;j<n;j++){
      if (j<=i) sum += a[0][j];
      if (i<=j) sum += a[1][j];
    }
    maxi = max(maxi, sum);
  }
  cout << maxi << endl;
  return 0;
}
  

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
    char a[11],b[11],c[11];
    cin>>a>>b>>c;
    if(a[strlen(a)-1]==b[0]&&b[strlen(b)-1]==c[0])
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;
}


Measured memory_bytes: 256
S=input()
A=int(S[0])
B=int(S[1])
C=int(S[2])
D=int(S[3])

op = ["+","-"]

for i in op:
  for j in op:
    for k in op:
      if eval("A {} B {} C {} D".format(i, j, k)) == 7:
        print("{}{}{}{}{}{}{}=7".format(A, i, B, j, C, k, D))
        exit()

Measured memory_bytes: 38384
int t,n,m,l,i,j,a,b,k,P[1001],T[1001],Q[2001],C[2001][2001],V[2001],d[1001][1001];
int match(s){int i=l;for(;i<l+l;i++)if(C[s][i]&&!V[i])if(V[i]=1,Q[i]<0||match(Q[i]))return Q[s]=i,Q[i]=s,1;return 0;}
main(){
  for(;scanf("%d%d%d",&n,&m,&l),l;printf("%d\n",l-t)){
	memset(C,0,sizeof(C));memset(Q,0xff,sizeof(Q));
    for(i=0;i<n;i++)for(j=0;j<n;j++)d[i][j]=i==j?0:999999;
    for(i=0;i<m;i++)scanf("%d%d%d",&a,&b,&k),d[a][b]=d[b][a]=k;
	for(i=0;i<l;i++)scanf("%d%d",P+i,T+i);
	for(k=0;k<n;k++)for(i=0;i<n;i++)for(j=0;j<n;j++)if(d[i][j]>d[i][k]+d[k][j])d[i][j]=d[i][k]+d[k][j];
	for(i=0;i<l;i++)for(j=0;j<l;j++)if(i!=j&&d[P[i]][P[j]]<999999&&T[i]+d[P[i]][P[j]]<=T[j])C[i][l+j]=C[l+j][i]=1;
    for(t=i=0;i<l;i++)memset(&V,0,sizeof(V)),t+=match(i);
  }
  return 0;
}

Measured memory_bytes: 18560
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define req(i,n) for(long long i=n-1; i>=0; i--)
#define range(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define onBoard(y,x) (y>=0 && y<h && x>=0 && x<w)
#define vint vector<int>
#define pri_que priority_queue
#define vvint vector<vector<int>>
#define vstr vector<string>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define show(x) cout<<#x<<"="<<x<<endl;
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<"Yes"<<endl
#define coutn cout<<"No"<<endl
#define coutY cout<<"YES"<<endl
#define coutN cout<<"NO"<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a/gcd(a,b)*b;}
const long long dx[8]={1,0,-1,0,1,-1,-1,1};
const long long dy[8]={0,1,0,-1,1,1,-1,-1};
const long long INF = 1e12;
const long long MOD =998244353;


int modpow(int a, int n, int mod) {
    int res=1;
    while(n>0) {
        if(n&1) res=res*a%mod;
        a=a*a%mod;
        n>>=1;
    }
    return res;
}

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

    int n; cin >> n;
    vint a(n);
    vint cnt(1e5+1,0);
    rep(i,n){
        cin >> a[i];
        cnt[a[i]]++;
    }
    int res=1;
    if(cnt[0]!=1 || a[0]!=0){
        cout<<0<<endl;
        return 0;
    }
    int max=MAX(a);

    for(int i=1; i<max; i++){
        res*=modpow(cnt[i],cnt[i+1],MOD);
        res%=MOD;
    }
    
    cout<<res<<endl;

}

Measured memory_bytes: 4760
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using Pair = pair<int32_t, int32_t>;

// std::cout << std::setprecision(20) << 1.1 << endl;

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

  int32_t N;
  cin >> N;

  constexpr int32_t kMaxNumberOfColor = 8;

  vector<int32_t> color_count(kMaxNumberOfColor, 0);
  int32_t joker = 0;
  for (int32_t i = 0; i < N; ++i) {
    int32_t a;
    cin >> a;
    if (a < 3200) {
      ++color_count[a / 400];
    } else {
      ++joker;
    }
  }
  int32_t number_of_colors = 0;
  for (const int32_t count : color_count) {
    if (count > 0) {
      number_of_colors++;
    }
  }
  cout << max(1, number_of_colors) << " " << number_of_colors + joker << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  char str[10];
  scanf("%s",str);
  if(str[0]=='S')
    cout<<"Cloudy"<<endl;
  else  if(str[0]=='C')
    cout<<"Rainy"<<endl;
  else  if(str[0]=='R')
    cout<<"Sunny"<<endl;
  
  
  
  
 return 0; 
}

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

int main()
{
	int64_t k, a, b;
	cin >> k >> a >> b;

	if (b <= a + 2)
	{
		cout << k + 1 << endl;
		return 0;
	}

	int64_t ret = 1;
	for (int64_t i = 1; i <= k; i++)
	{
		if (a <= ret && i + 1 <= k)
		{
			ret += b - a;
			i++;
		}
		else
		{
			ret++;
		}
	}
	cout << ret << endl;

	return 0;
}

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

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	double a, b, h, m;
	cin >> a >> b >> h >> m;

	double pi = acos(-1);

	double angle = ((h/12) + (m/60/12) - (m/60)) * 360;
	angle = min(angle, 360 - angle);
	double rs1 = (a*a + b*b) - (a * b * 2 * cos(angle * pi / 180));

	cout << setprecision(12) << sqrt(rs1) << endl; 
}

Measured memory_bytes: 4244
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;

public class Program
{

	public void Proc()
	{
        int itemCount = int.Parse(Reader.ReadLine());
        long[] sticklist = Reader.ReadLine().Split(' ').Select(a => long.Parse(a)).ToArray();

        long max1 = 0;
        long max2 = 0;
        Dictionary<long, int> stickDic = new Dictionary<long, int>();

        sticklist.ToList().ForEach(a=>{
            if(stickDic.ContainsKey(a)) {
                stickDic[a]++;
                if(stickDic[a]>=4) {
                    if(a>max1) {
                        max1 = a;
                        max2 = a;
                    } else if(a>max2) {
                        max2 = a;
                    }
                } else {
					if (a > max1)
					{
                        max2 = max1;
						max1 = a;
					}
                    else if (a > max2 && a!=max1)
					{
						max2 = a;
					}
				}
            } else {
                stickDic[a] = 1;
            }
        });
        long ans = max1 * max2;
        Console.WriteLine(ans);
    }

    public class Reader
	{
		private static StringReader sr;
		public static bool IsDebug = false;
		public static string ReadLine()
		{
			if (IsDebug)
			{
				if (sr == null)
				{
					sr = new StringReader(InputText.Trim());
				}
				return sr.ReadLine();
			}
			else
			{
				return Console.ReadLine();
			}
		}
		private static string InputText = @"



10
3 3 3 3 4 4 4 5 5 5


";
	}

	public static void Main(string[] args)
	{
#if DEBUG
		Reader.IsDebug = true;
#endif
		Program prg = new Program();
		prg.Proc();
	}
}


Measured memory_bytes: 30304
#include <iostream>
#include <map>

using namespace std;

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

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

    map<int, int> m;
    for(int i=0; i<N; i++){
        if(m.count(A[i]) == 0){
            m.insert(make_pair(A[i], 0));
            continue;
        }else{
            cout << "NO";
            return 0;
        }
    }

    cout << "YES";

    return 0;
}

Measured memory_bytes: 10368
//#include <bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<numeric>
#include<cstdio>
#include<cmath>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<ctype.h>
#include <fstream>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
using namespace std;
typedef long long ll;//int64
typedef unsigned long long ull;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a*b/gcd(a,b);}
int dy[4]={0,1,0,-1};
//----------program from here----------

int main(){
  int t[3];
  for(int i=0;i<3;++i) cin >> t[i];
  sort(t, t+3);
  cout << t[1]-t[0] + t[2]-t[1] << endl;

  return 0;
}

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

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

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

using namespace std;


int main()
{
    int n;
    cin >> n;
    vector<int> a(n), b(n), c(n - 1);
    for(int i = 0;i < n;i++) cin >> a[i];
    for(int i = 0;i < n;i++) cin >> b[i];
    for(int i = 0;i < n - 1;i++) cin >> c[i];

    int ans = 0;
    for(int i = 0;i < n;i++){
        ans += b[a[i] - 1];
        if(i != n - 1 && a[i] == a[i + 1] - 1){
            ans += c[a[i] - 1];
        }
    }

    cout << ans;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

template <ll M = MOD> struct modint {
    ll val;
    modint(const ll x = 0) : val(x) {
        val = x;
        while(val < 0) val += M;
        while(val > M) val -= M;
    }

    modint operator+(const modint a) const { return modint(*this) += a; }
    modint operator-(const modint a) const { return modint(*this) -= a; }
    modint operator*(const modint a) const { return modint(*this) *= a; }
    modint operator/(const modint a) const { return modint(*this) /= a; }
    modint operator-() const { return modint(M-val); }
    modint inv() const {
        ll u = 1, v = 0, s = 0, t = 1, m = M, x = val;
        while (x) {ll q = m/x; swap(s -= q*u, u); swap(t -= q*v, v); swap(m -= q*x, x); }
        if(s < 0) s += M;
        return modint(s);
    }
    modint pow(ll n) const {
        ll u = 1, xx = val;
        while (n > 0){ if (n&1) u = u * xx % M; xx = xx * xx % M; n >>= 1; }
        return modint(u);
    }
    modint& operator+=(const modint a){ val += a.val; if(val >= M) val -= M; return *this; }
    modint& operator-=(const modint a){ val -= a.val; if(val < 0) val += M; return *this; }
    modint& operator*=(const modint a){ val = val * a.val % M; return *this; }
    modint& operator/=(const modint a){ val = val * a.inv().val % M; return *this;}

    modint& operator=(const int& x){
        val = x;
        while(val < 0) val += M;
        while(val > M) val -= M;
        return *this;
    }
};

using mint = modint<MOD>;

template <class T, class U>
vector<T> make_v(U size, const T& init){ return vector<T>(static_cast<size_t>(size), init); }

template<class... Ts, class U>
auto make_v(U size, Ts... rest) { return vector<decltype(make_v(rest...))>(static_cast<size_t>(size), make_v(rest...)); }

template<class T> void chmin(T &a, const T &b){ a = (a < b ? a : b); }
template<class T> void chmax(T &a, const T &b){ a = (a > b ? a : b); }

int main() {
    int n, k;
    cin >> n >> k;
    auto dp = make_v(n+1, n+1, k+1, mint(0));
    dp[0][0][0] = 1;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j <= i; ++j) {
            for (int l = 0; l+2*j <= k; ++l) {
                dp[i+1][j][l+2*j] += dp[i][j][l]*mint(2*j+1);
                if(j) dp[i+1][j-1][l+2*j] += dp[i][j][l]*mint(j)*mint(j);
                if(j < n) dp[i+1][j+1][l+2*j] += dp[i][j][l];
            }
        }
    }
    cout << dp[n][0][k].val << "\n";
    return 0;
}

Measured memory_bytes: 52096
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>

using namespace std;

#define REP(i,n) for(int i=0;i<int(n);i++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
typedef long long ll;
typedef pair<int,int> P;

string toString(ll number){
	stringstream ss;
	ss << number;
	return ss.str();
}

int main(void){
	          ll i;

	          ll N;
	          cin >> N;
	          ll p;
	          for(i=1;i*i<=N;i++){
	        	  if(N%i!=0) continue;
	        		  p=i;
	        	  }


	          string x=toString(p);
	          string y=toString(N/p);

	          cout <<max(x.size(),y.size()) << endl;



	          return 0;
}


Measured memory_bytes: 256
/******************************************************************************
 
рассвет. 
 
*******************************************************************************/
#include <bits/stdc++.h>
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define rapgame ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define eb emplace_back
#define vi vector <int>
#define vlli vector <lli>
#define vulli vector <ulli>
#define vchar vector <char>
#define vstr vector <string>
#define vb vector <bool>
#define fst first
#define sec second
#define srt(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define vpii vector <pair <int,int> >
#define pii pair <int,int> 
#define vplli vector <pair <lli,lli> >
#define vpulli vector <pair <ulli,ulli> >
#define vvi vector <vector <int> >
#define vvlli vector <vector <lli> >
#define vvpii vector <vector <pair <int,int>> >
#define fr(i,n) for (int i = 0; i < (n); ++i)
#define frbig(i,n) for (lli i = 0; i < (n); ++i)
#define fra(i,a,n) for (lli i = a; i < (n); ++i)
#define run(c,s) for(auto c:s) 
#define read(n) int n; cin >> n;
#define readchar(n) char n; cin >> n;
#define readstr(n) string n; cin >> n;
#define readarr(a,n) fr(i,n) cin >> a[i];
#define read2(x,y) int x,y; cin >> x >> y;
#define read2ll(x,y) long long int x,y; cin >> x >> y;
#define readll(n) lli n; cin >> n;
#define watch(x) cout << (#x) << " is " << (x) << endl
#define print_array(x) fr(i,x.size()) cout << x[i] << " ";
using namespace std;
 
const lli MOD=1e9+7;
const lli MAXN=1e6+1;
const ld PI=acos(-1);
 
int main(){
    rapgame
    int n;
    cin >> n;
    ld k=n,seks=(n%2>0),ans=(n/2+seks)/k;
    cout << fixed << setprecision(20) << ans;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
vector<int>v[200001],vv;
pair<int,int>p[200001];
int n,x,y,ans[200001];
void dfs1(int x,int pre,pair<int,int>ma)//走的房间个数跟它父亲结点前缀的最大值有关，找出每个结点的最大前缀
{
    if(x>ma.second) ma.second=x;
    if(ma.second>ma.first) swap(ma.first,ma.second);
    p[x]=ma;
    for(int i=0;i<v[x].size();i++)
        if(v[x][i]!=pre) dfs1(v[x][i],x,ma);
}
void dfs2(int x,int pre)
{
    vv.push_back(x);
    if(x==1) ans[1]++;
    else
    {
        int l=0,r=vv.size()-1,m;
        while(r-l>1)
        {
            m=l+r>>1;
            int t=vv[m];
            if(p[t].first!=t&&p[t].first==p[x].first||p[t]==p[x]) r=m;
            //父亲结点前缀值满足单调性，前缀最大值相同的结点要走的路径只要入口转移，因此二分计算入口结点是哪个，只在入口结点加入要经过点的信息
            else l=m;
        }
        ans[vv[r]]++;
    }
    for(int i=0;i<v[x].size();i++)
        if(v[x][i]!=pre) dfs2(v[x][i],x);
    vv.pop_back();
}
void dfs3(int x,int pre)
{
    ans[x]+=ans[pre];//把入口结点的值转移过来
    for(int i=0;i<v[x].size();i++)
        if(v[x][i]!=pre) dfs3(v[x][i],x);
}
int main()
{
    scanf("%d",&n);
    for(int i=1;i<n;i++) scanf("%d%d",&x,&y),v[x].push_back(y),v[y].push_back(x);
    dfs1(1,0,make_pair(0,0));
    dfs2(1,0);
    ans[1]=0;
    dfs3(1,0);
    for(int i=2;i<=n;i++) printf(i==n?"%d\n":"%d ",ans[i]);
}


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

using namespace std;
using ll =long long;
using db = double;

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

#define che(a,string) cout<<"//"<<string <<"=="<<(a)<<"//" <<endl;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define leftunique(v) SORT(v);(v).erase(unique((v).begin(),(v).end()),(v).end())
//leftuniqueは配列から同じ要素のものを取り除く 例 4 6 2 1 3 4 1 2 なら 1 2 3 4 6 になる
bool IsInt(double a){int b = a/1;if(a==b){return true;}else {return false;}}
bool coY() {cout <<"Yes"<<endl;}
bool coN(){cout <<"No"<<endl;}
const int mod = 1e9 + 7;
const ll INF = 1LL << 60;

//ここから書き始める
	ll dp[110][100100];//dp[i]は、価値がiを超える最小の重さの最小値
int main()
{
	cout << setprecision(10);
	int n;
	ll w ;
	cin >> n >> w;
	ll weight[n],value[n];
	rep(i,n){
		cin >> weight[i] >> value[i] ;
	}
	for(int i = 0; i < 110; i++) for(int j = 0 ; j < 100100 ; j++) dp[i][j] = INF;
	dp[0][0] = 0;
	rep(i,n){
		for(int sum_v = 0 ; sum_v < 100100 ; sum_v ++){
			if(sum_v - value[i] >= 0 ){
				chmin(dp[i+1][sum_v],dp[i][sum_v-value[i]]+weight[i]);
			}
			chmin(dp[i+1][sum_v],dp[i][sum_v]);
		}
	}
	ll ans = 0;
	rep(sum_v,100100){
		if(dp[n][sum_v] <= w) ans = sum_v;
	}
	cout << ans << endl;
}


Measured memory_bytes: 86272
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>

#define LP(i,n) for(int i=0;i<n;i++)
#define Mset(x,v) memset(x,v,sizeof(x))
#define INF INT_MAX

using namespace std;
using LL=long long;

int main(){
    int a,b,s=0,r=0;
    cin>>a>>b;
    for(int i=1;i<=999;i++){
        if(a<s){
            if(s-a==s+i-b){
                r=s-a;
            }
        }
        s+=i;
    }
    cout<<r<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
using ll = long long;

ll N, K;
int main(){
    cin >> N >> K;
    ll sum = 0;
    for(ll i = K + 1; i <= N; ++i){
        sum += N / i * (i - K) + max(0LL, N - ((N / i) * i + K - 1));
    }
    cout << sum - ((K == 0) ? N : 0LL) << endl;
    return 0;
}


Measured memory_bytes: 256
import sys
from collections import Counter
from collections import deque
import heapq
import math
import fractions
import bisect
import itertools
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

s=input()
n=len(s)
que=deque()
que.append([0,s[0]])
ans=0
while len(que):
    q=que.popleft()

    if q[0]==n-1:
        ans+=sum(list(map(int, q[1].split("+"))))
    else:
        que.append([q[0]+1,q[1]+s[q[0]+1]])
        que.append([q[0]+1,q[1]+"+"+s[q[0]+1]])
print(ans)


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

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

	int res = 0;
	char ch;
	string s;
	int n;

	cin >> n;
	cin >> s;

	res = 1;
	ch = s[0];
	for(int i=0;i<s.length();i++)
	{
		if(ch!=s[i])
		{
			ch = s[i];
			res++;
		}
	}

	cout << res << '\n';

	return 0;
}

Measured memory_bytes: 512
// Author: HarshKumar

#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
const ll N = 1e6 + 6, M = 1e9 + 7;
int main()
{
    ios::sync_with_stdio(false), cin.tie(nullptr);
    ll a, b, c, d, f = 0;
    cin >> a >> b >> c >> d;
    while (a > 0 && c > 0)
    {
        if (f)
            a -= d;
        else
            c -= b;
        f ^= 1;
    }
    cout << (a > 0 ? "Yes" : "No");
}

Measured memory_bytes: 3640
s = input()
if s[0] == 'R':
    if s[1] == 'R':
        if s[2] == 'R':
            print(3)
        else:
            print(2)
    else:
        print(1)
elif s[1] == 'R':
    if s[2] == 'R':
        print(2)
    else:
        print(1)
elif s[2] == 'R':
    print(1)
else:
    print(0)

Measured memory_bytes: 9112
#include <iostream>
#include <cassert>
#include <vector>
#include <cmath>
#include <ctime>        // time
#include <cstdlib>      // srand,rand
#include <fstream>
#include <string>
#include <sstream>      //文字ストリーム
#include <iterator>
#include <map>
#include <algorithm>
#include <memory>
#include <iomanip>
#include <limits>
#include <typeinfo>

#include <stdio.h>
#include <string.h>


using namespace std;

int main(int argc, char* argv[])
{
	int hairetu[] = {
		0,
		1,
		3,
		1,
		2,
		1,
		2,
		1,
		1,
		2,
		1,
		2,
		1,
	};

	int x,y;

	cin >> x >> y;

	if(hairetu[x]==hairetu[y]){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskK solver = new TaskK();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskK {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int k = in.nextInt();
            int[] ar = new int[n];
            for (int i = 0; i < n; i++)
                ar[i] = in.nextInt();
            boolean[] dp = new boolean[k + 1];
            for (int stones = 1; stones <= k; stones++)
                for (int x : ar)
                    if (stones - x >= 0 && dp[stones - x] == false)
                        dp[stones] = true;
            if (dp[k])
                out.println("First");
            else
                out.println("Second");
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

    }
}



Measured memory_bytes: 22612
#include <bits/stdc++.h>
using namespace std;
string s;
int a[26];
int main(){
	cin>>s;
	for(int i=0;i<s.size();i++){
		a[s[i]-'A']++;
	}
	int cnt=0;
	for(int i=0;i<26;i++){
		if(a[i]==2){
			cnt++;
		}
	}
	if(cnt==2){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	return 0;
}


Measured memory_bytes: 256
//
/*==========================================================*/
/*    Template ver 2017-0720    |    Created by JollyBee    */
/* DOMINUS pascit me, et nihil mihi deerit (Psalmorum 23:1) */
/*==========================================================*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
const double EPS=(double)1e-9;
const double PI=(double)acos(-1.0);
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define FOR(i,n) for(int i=0;i<n;i++)
#define REPP(i,l,r,c) for(int i=l;i<=r;i+=c)
#define REP(i,l,r) REPP(i,l,r,1)
#define FORD(i,n) for(int i=n-1;i>=0;i--)
#define REVV(i,l,r,c) for(int i=l;i>=r;i-=c)
#define REV(i,l,r) REVV(i,l,r,1)
//random
int irand(int lo, int hi){
    return (((double)rand())/(RAND_MAX+1.0)) * (hi-lo+1) + lo;
}
//ll to string
string toString(ll x) {
    stringstream ss;
    ss << x;
    return ss.str();
}
//string to ll
ll toNumber(string S) {
    ll ret;
    sscanf(S.c_str(),"%lld",&ret);
    return ret;
}
// std::fill(start, end, value);
// for(auto it: DS){}

const int INF=(int)2e9;
const ll MOD=(ll)1e9+7;
/*==========================================================*/
/*                     END OF TEMPLATE                      */
/* DOMINUS pascit me, et nihil mihi deerit (Psalmorum 23:1) */
/*==========================================================*/

ll fast(ll a, ll p){
    if(p == 0) return (ll)1;
    ll res = fast(a, p>>1);
    res = (res * res) % MOD;
    if(p&1) res = (res * a) % MOD;
    return res;
}

const int N = (int)1e5;

pll fact[2*N+5];

int start(){
    fact[0] = mp((ll)1, (ll)1);
    REP(i,1,2*N){
        fact[i].fi = (fact[i-1].fi * (ll)i) % MOD;
        fact[i].se = fast(fact[i].fi, MOD-2);
    }
    return 0;
}

ll nCk(int n, int k){
    ll num = fact[n].fi;
    ll denum = (fact[n-k].se * fact[k].se) % MOD;
    return (num * denum) % MOD;
}

int main(){
    start();
    int h,w,a,b; scanf("%d %d %d %d", &h, &w, &a, &b);
    //
    ll res = 0;
    REP(i,b+1,w){
        ll reta = nCk(h-a-1 + i-1, i-1);
        ll retb = nCk(a-1 + w-i, a-1);
        res += (reta * retb) % MOD;
    }
    printf("%lld\n", res % MOD);
    return 0;
}


Measured memory_bytes: 3328
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>

using namespace std;
string s;
int main()
{
    cin >>s;
    long long ans=0;
    int n=s.size(),b=0;
    char la='#';
    for (int i=0;i<n;i++)
    {
        if (s[i]=='B') b++;
        if (s[i]=='W') ans+=b;
        la=s[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#!/usr/bin/env python3
import sys
import math
INF = float("inf")


def solve(H: int):
    M = int(math.log2(H))
    print(pow(2, M+1)-1)
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    solve(H)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3188
N,Y = input().split()
n = int(N)
y = int(Y)

a = y//10000 
ans = ""

for i in range(a,-1,-1):
    r = y - 10000*i
    if ans:
        break
    for j in range(r//5000,-1,-1):
        s = (r - 5000*j)//1000
        if  i + j + s == n:
            ans = str(i)+" "+str(j)+" "+str(s)
            break
if ans:
    print(ans)
else:
    print("-1 -1 -1")

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

using namespace std;

vector< vector<int> > xy;
int dp[100000];
int n,m;

int dfs(int k){
  if(xy[k].size() == 0){
    dp[k] = 1;
    return 0;
  }
  int t = 0;
  for(auto v : xy[k]){
    if(dp[v] == -1) dfs(v);
    t = max(t, dp[v]);
  }
  dp[k] = t+1;
  return 0;
}


int main(){
  cin >> n >> m;
  xy = vector< vector<int> >(n);
  for(int i = 0; i < n; i++){
    dp[i] = -1;
  }
  for(int i = 0; i < m; i++){
    int a,b;
    cin >> a >> b;
    xy[a-1].push_back(b-1);
  }
  int ans = 0;
  for(int i = 0; i < n; i++){
    if(dp[i] == -1)dfs(i);
    ans = max(ans, dp[i]);
  }
  cout << ans - 1 << endl;
}


Measured memory_bytes: 8192
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef vector<int> vec1;
typedef vector<string> vec2;
typedef vector<double> vec3;

int main() {
  
  int n;
  cin >> n;
  vec1 a(n);
  for(int i = 0; i < n; i++) cin >> a.at(i);
  int ans = 0;
  int c = 0;
  for(int i = 0; i < 101; i++) {
    for(int j = 0; j < n; j++) {
      if(a.at(j) % 2 == 1) {
        c++;
        break;
      } else {
        a.at(j) = a.at(j) / 2;
      }
    }
    if(c == 1) break;
    ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
vector < bool > dig(11,true);

bool eh(long long u){
	bool ans=true;
	while(u>0){
		if(!dig[u%10]) ans=false;
		u/=10;
	}
	return ans;
}
int main(){
	ios::sync_with_stdio(false);
  	cin.tie(0);
  	long long n, k;
  	cin >> n >> k;
  	long long pot=1;
  	for(int i=1; i<=k; i++){
  		int a;
  		cin >> a;
  		dig[a]=false;
	}
	int w=0;
	for(; !dig[w]; w++);
	if(eh(n)) cout << n << endl;
	else{
		long long u=n;
		while(!eh(u/10)) u=u/10;
		while(!eh(u)) u++;
		while(u<n) u=10*u+w;
		cout << u << endl;
	}
}

Measured memory_bytes: 256