akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();

		char[][] s = new char[h][];

		for (int i = 0; i < h; i++) {
			String line = sc.next();
			s[i] = new char[w];
			for (int j = 0; j < w; j++) {

				s[i][j] = line.charAt(j);
			}
		}

		int[][] r = new int[h][];

		for (int i = 0; i < h; i++) {
			r[i] = new int[w];
			for (int j = 0; j < w; j++) {
				if (s[i][j] != '#') {
					int ww = 0;
					for (int ii = i - 1; ii <= i + 1; ii++) {
						for (int jj = j - 1; jj <= j + 1; jj++) {
							if (ii >= 0 && ii < h && jj >= 0 && jj < w) {
								if (s[ii][jj] == '#') {
									ww++;
								}
							}
						}
					}
					r[i][j] = ww;
				}
			}
		}

		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				if (s[i][j] != '#') {
					s[i][j] = (char) ('0' + r[i][j]);
				}
				System.out.print(s[i][j]);
			}
			System.out.println();
		}

	}

}


Measured memory_bytes: 22356
#include <assert.h>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <algorithm>
#include <numeric>
#include <functional>
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <bitset>
typedef long long ll;
typedef unsigned long long ull;

#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define DEBUG(vec) for (auto v : vec) { cout << v << " "; } cout << endl;

using namespace std;

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

  int R, G;
  cin >> R >> G;

  cout << 2 * G - R << endl;

  return 0;
}


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

char s[200002];
int n, k;

int main(){
	scanf("%d%d%s", &n, &k, s);
	if (n == 1){
		if (k & 1) { if (s[0] == 'A')s[0] = 'B'; else s[0] = 'A'; }
		printf("%s\n", s);
		return 0;
	}
	s[n] = 'B';
	int i = 0;
	bool c = false;
	while (k && i <= n){
		if (!c && s[i] - (i & 1) == 'A'){
			c = true;
			--k;
			continue;
		}
		c = false;
		--k;
		++i;
	}
	f(j, 0, n){
		int z = j + i;
		if (z > n){
			if (n - j & 1)s[j] = 'A';
			else s[j] = 'B';
			continue;
		}
		if (i & 1) { if (s[z] == 'A')s[j] = 'B'; else s[j] = 'A'; }
		else s[j] = s[z];
	}
	if (c)s[0] = 'B';
	if (k & 1 && s[0] == 'A')s[0] = 'B';
	s[n] = 0;
	printf("%s\n", s);
}


Measured memory_bytes: 640
m,n = map(int,input().split())

L = [[i+1,0,0,0] for i in range(n)]

for i in range(n):
    L[i][1],L[i][2] = map(int,input().split())

L.sort(key = lambda x:(x[1],x[2]))

cnt = 1
for i in range(n):
    if i != 0 and L[i][1] != L[i-1][1]:
        cnt = 1
    L[i][3] = str(1000000+L[i][1])[1:7] + str(1000000+cnt)[1:7]
    cnt += 1

L.sort(key = lambda x:x[0])

for i in range(n):
    print(L[i][3])

Measured memory_bytes: 32424
#include "iostream"
#include "cstdio"
#include "cstring"

using namespace std;

int main()
{
    char a[20];
    char b[20];

    scanf("%s %s",a, b);
    b[strlen(b)-1] = '\0';
    if(strcmp(a, b)==0)
        printf("Yes\n");
    else
        printf("No\n");

    return 0;
}

Measured memory_bytes: 3688
N=int(input())
A=sorted(map(int,input().split()))
mod=10**9+7
cnt = [0]*N
for a in A:
    if (1+a+N)%2:
        print(0)
        break
    cnt[a]+=1
    if cnt[a]>2:
        print(0)
        break
else:
    if cnt[0]>1:
        print(0)
    elif cnt[1:].count(1)>1:
        print(0)
    else:
        ans = 1
        for _ in range(N//2): ans=(ans*2)%mod
        print(ans)

Measured memory_bytes: 13880
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}

	return i
}
func main() {
	sc.Split(bufio.ScanWords)
	a := nextInt()
	b := nextInt()
	h := nextInt()
	m := nextInt()

	var hf = float64(h)
	var mf = float64(m)
	var difd float64

	_ = a
	_ = b
	//	difr = float64(m)
	//fmt.Println("h base=", hf, " = ", float64(hf*360.0/12.0))
	//fmt.Println("h =", hf, " = ", float64(hf*360.0/12.0)+float64(mf*0.5))
	//fmt.Println("m=", mf, " = ", float64(mf*360.0/60.0))

	difd = float64(hf*360.0/12.0) + float64(mf*0.5) - float64(mf*360.0/60.0)
	//fmt.Println("dig=%.2f", difd, " rad=%.2f", difd*math.Pi/180.0)

	// 余弦定理
	//fmt.Printf("%.2f", math.Cos(difd*math.Pi/180.0))

	var c float64
	//	c = math.Sqrt(float64(a*a+b*b) - 2.0*float64(a*b)*math.Cos(difd*180/math.Pi))
	c = math.Sqrt(float64(a*a+b*b) - 2.0*float64(a*b)*math.Cos(difd*math.Pi/180.0))

	fmt.Printf("%.11f", c)
}


Measured memory_bytes: 1756
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);
//cin.tie(0);
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> plpl;
typedef tuple<ll,ll,ll> tl;
//ll mod=1000000007;
ll mod;
ll mod2=998244353;
ll inf=1000000000000000000;
double pi=2*acos(0);
#define rep(i,m,n) for(int i=m;i<n;i++)
#define rrep(i,n,m) for(int i=n;i>=m;i--)
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
int main(){
    ll n;cin>>n;
    ll a[n];
    rep(i,0,n)cin>>a[i];
    ll u=10000000000;
    ll d=0;
    while(u-d>1){
        ll mid=(u+d)/2;
        ll now=mid;
        rep(i,0,n)now=2*a[i]-now;
        if(mid<=now)d=mid;
        else u=mid;
    }
    vector<ll> ans;
    ans.push_back(d);
    ll now=d;
    rep(i,0,n-1){
        ans.push_back(2*a[i]-now);
        now=2*a[i]-now;
    }
    rep(i,0,n-1)cout<<ans[i]<<" ";
    cout<<ans[n-1]<<endl;
}


Measured memory_bytes: 3060
N = int(input())
if N==1:
    print(1)
    exit()
segs = [[0,0]]*N

X = [0]*N
L = [0]*N
for i in range(N):
    X[i],L[i] = map(int,input().split())

for i in range(N):
    segs[i] = [X[i]-L[i],X[i]+L[i]]
segs.sort(reverse=True, key=lambda x:x[0])

ans=0
seg = segs.pop()
#while len(segs)!=0:
    

while len(segs)!=0:
    seg2 = segs.pop()
    if len(segs)==0:
        ans += 1
    if seg[1]>seg2[0]:
        if seg[1]<=seg2[1]:
            continue
        else:
            seg=seg2
    else:
        ans+=1
        seg=seg2
        

print(ans)

Measured memory_bytes: 60248
#include <stdio.h>
  
int main(void){
 
    char str[1000] ,str1[1000],input[1000];
 
    scanf("%s",str);
    scanf("%s",str1);  
  
        strcpy(input,str);
        strcat(input,str);
 
        if(strstr(input,str1) != NULL){
            printf("Yes\n");
              
        }
        else{
            printf("No\n");
        }
      
  
    return 0;
}

Measured memory_bytes: 544
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
#include<cstdio>
#include<cstdlib>
using namespace std;
 
#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592
 
const double EPS = 1e-10;
 
using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;

int main(){
    int x; cin >> x;
    for(ll i = -1000; i <= 1000; i++){
        for(ll j = -1000; j <= 1000; j++){
            ll a = i*i*i*i*i;
            ll b = j*j*j*j*j;
            if(a-b == x){
                cout << i << " " << j << endl;
                return 0;
            }
        }
    }
    
}


Measured memory_bytes: 3592
from collections import deque

def dfs(sx, sy):
  stack = deque()
  stack.append([sx, sy])
  visited[sy][sx] = 1
  while stack:
    x, y = stack.popleft()
    if x == w - 1 and y == h - 1:
      break
    for dx, dy in [(1, 0), (-1, 0), (0, 1), (0, -1)]:
      if 0 <= x + dx < w and 0 <= y + dy < h:
        if S[y + dy][x + dx] != "#" and visited[y + dy][x + dx] == -1:
          visited[y + dy][x + dx] = visited[y][x] + 1
          stack.append([x + dx, y + dy])

h, w = map(int, input().split())
S = [input() for _ in range(h)]

visited = [[-1] * w for _ in range(h)]

dfs(0, 0)

whites = sum([s.count(".") for s in S])

if visited[h - 1][w - 1] != -1:
  ans = whites - visited[h - 1][w - 1]
else:
  ans = -1
  
print(ans)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main()
{
	int a,b,t[1000]={};
	for(int i=1;i<=999;i++)t[i]+=i+t[i-1];
	cin>>a>>b;
	cout<<t[b-a]-b<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>


int main()
{
	int a, b, d, r;
	double f;
	std::cin >> a >> b;

	d = a / b;
	r = a%b;
	f = 1.0*a / b;
	
	
	std::cout << d << " " << r << " " ;
	printf("%.5f\n", f);

    return 0;
}

Measured memory_bytes: 3236
object Main extends App {
    val in = io.Source.stdin.getLines.map(_.split(" ").map(_.toInt)).toSeq.tail
    var a = 0
    in.foreach(r => {a += r.sum; println(r.mkString(" ") + " " + r.sum)})
    println(in.transpose.map(_.sum).mkString(" ") + " " + a)
}

Measured memory_bytes: 53876
#include<iostream>
#include<cstdio>
#include<map>
#include<string>
using namespace std ;
int main(){
 for(;;){
  int n,s,a=1,b=2,c=3,d=4,e=5,f=6,x;
  string m; 
    s=1;
    cin>>n;
    if(n==0)break;
    for(int i=0;i<n;i++){
    cin>>m;
    if(m=="North"){
      x=e;
      e=a;
      a=b;
      b=f;
      f=x; 
      s=s+a;
    }
    if(m=="East"){
      x=c;
      c=a;
      a=d;
      d=f;
      f=x;
      s=s+a;
    }
    if(m=="West"){
      x=d;
      d=a;
      a=c;
      c=f;
      f=x;
      s=s+a;
    }
    if(m=="South"){
      x=b;
      b=a;
      a=e;
      e=f;
      f=x; 
      s=s+a;
    }
    if(m=="Right"){
      x=b;
      b=c;
      c=e;
      e=d;
      d=x; 
      s=s+a;
    }
    if(m=="Left"){
      x=b;
      b=d;
      d=e;
      e=c;
      c=x;
      s=s+a;
    }
   }
    cout<<s<<endl;
  }
  return 0;
  }

Measured memory_bytes: 3084
#include<iostream>

using namespace std;

int a[100001];

int main(){
	int n,k,q,b;

	cin >> n >> k >> q;
	
	for(int i=1;i<=q;i++){
		cin >> b;
		a[b]++;
	}
	
	for(int i=1;i<=n;i++){
	if(k-q+a[i]>0) cout << "Yes" << endl;
	else cout << "No" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1024
import java.util.*;

public class Main{
      public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            int a = sc.nextInt();
            int b = sc.nextInt();
            int ans = 0;
            if(a >= 2){
              ans += a - 1;
            }
            if(b >= a){
              ans++;
            }
            System.out.println(ans);
          }
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
int n,s=0;
int a[202];
bool c()
{
	bool f=true;
	for(int i=0;i<n;i++)
		if(a[i]%2!=0){
			f=false;
			break;
		}
	return f;
}
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)cin>>a[i];
	while(c()){
		for(int i=0;i<n;i++)a[i]/=2;
		s++;
	}
	cout<<s;
	return 0;
}

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

int main(){
    int n;
    cin>>n;
    vector<int> a(n+1);
    rep(i,n+1) cin>>a[i];
    vector<int> b(n);
    rep(i,n) cin>>b[i];
    ll ans=0;
    rep(i,n){
        if(b[i]>a[i]){
            ans+=a[i];
            b[i]-=a[i];
            if(a[i+1]>=b[i]){
                a[i+1]-=b[i];
                ans+=b[i];
            }
            else{
                ans+=a[i+1];
                a[i+1]=0;
            }
        }
        else ans+=b[i];
    }
    cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 4056
#include<stdio.h>
#include<ctype.h>
int main(void){
    int i,ascii = 0x61;
    char x;
    int counter[25] = {0};
    while(scanf("%c",&x) != EOF)
    {
        for(i = 0;i < 26;i++)
        {
            if(isupper(x))  x = tolower(x);
            if((int)x == i+ascii)    counter[i]++;
        }
    }
    for(i = 0;i < 26;i++)
    {
        printf("%c : %d\n",i+ascii,counter[i]);
    }
}


Measured memory_bytes: 1992
#include <iostream>
#include <cstdio>
#include <string.h>
using namespace std;

#define is_uruu leapyear
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(a);i>(b);--i)
	
int list[2000003], head=1000001, tail=1000001;


void insert(int x){
	head--;
	list[head] = x;
}


void deleteU(int x){
	FOR(i, head, tail){
		if(list[i] == x) {
			list[i]=-1;
			break;
		}
	}
}


void deleteFirst(){
	head++;
	while(list[head-1] == -1)head++;
}


void deleteLast(){
	tail--;
	while(list[tail] == -1)tail--;
}

	
int main() {
	int n, tmp;
	char c[12];
	scanf("%d", &n);
	FOR(i, 0, n){
			scanf("%s", c);
		
		
		if(!strcmp(c, "insert")){
			scanf("%d", &tmp);
			insert(tmp);
		} 
		else if(!strcmp(c, "delete")){
			scanf("%d", &tmp);
			deleteU(tmp);
		}
		else if(!strcmp(c, "deleteFirst")){
			deleteFirst();
		}
		else if(!strcmp(c, "deleteLast")){
			deleteLast();
		}
	}
		
	int j=head;
	for(; j<tail; j++){
		if(list[j] != -1){
			printf("%d", list[j]);
			j++;
			break;
		}
	}
	FOR(k, j, tail){
		if(list[k] != -1)printf(" %d", list[k]);
	}
	printf("\n");
		
    return 0;
}


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


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.StringTokenizer;
 
public class Main {
	public static void main(String[] args) throws IOException {
		MScanner sc = new MScanner(System.in);
		PrintWriter pw=new PrintWriter(System.out);
		int n=sc.nextInt();
		int[]in=new int[n];for(int i=0;i<n;i++)in[i]=sc.nextInt();
		for(int i=1;i<n;i++) {
			if(in[i]<in[i-1]) {
				pw.println("No");pw.flush();return;
			}
			if(in[i]-in[i-1]>=1) {
				in[i]--;
			}
		}
		pw.println("Yes");
		pw.close();
		pw.flush();
 
	}
    static class MScanner {
		StringTokenizer st;
		BufferedReader br;
 
		public MScanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}
 
		public MScanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}
 
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
 
		public String nextLine() throws IOException {
			return br.readLine();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
 
		public char nextChar() throws IOException {
			return next().charAt(0);
		}
 
		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public boolean ready() throws IOException {
			return br.ready();
		}
 
		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
}

Measured memory_bytes: 38932
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B;
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL<<60;
typedef pair<ll, ll> P;

vec san(32, 1);

int bit3_t(ll a, int t){
    return (a % san[t + 1]) / san[t];
}

bool between(ll x, ll y1, ll y2){
    if(y1 > y2) swap(y1, y2);
    ++y1; --y2;
    if(y1 > y2) return false;
    while(x > 0){
        if(x%3 == 1){
            if(y2 - y1 > 3) return true;
            for(ll y = y1; y <= y2; ++y) if(y%3 == 1) return true;
        }
        x /= 3;
        y1 /= 3;
        y2 /= 3;
    }
    return false;
}

ll f(ll a, ll b, ll c, ll d){
    ll res = 0;
    Rrep(i, 31){
        /*if(bit3_t(b, i) == 1 && bit3_t(d, i) == 1){
            swap(a, b);
            swap(c, d);
        }*/
        if(bit3_t(a, i) == 1 && bit3_t(c, i) == 1 && a / san[i] == c / san[i]){
            if(abs((d / san[i]) - (b / san[i])) >= 2){
            //if(between(a / san[i], b / san[i], d / san[i])){
                ll diff1 = a % san[i], diff2 = c % san[i];
                res = max(res, min({diff1 + 1, san[i] - diff1,
                                    diff2 + 1, san[i] - diff2}) * 2);
            }
        }
    }
    return res;
}


int main() {
    cin>>Q;
    reps(i, 1, 32) san[i] = san[i-1] * 3;
    rep(i,Q){
        vec v(4);
        rep(j,4){
            cin>>v[j];
            --v[j];
        }
        ll res = abs(v[0] - v[2]) + abs(v[1] - v[3]);
        //cout<<res<<endl;
        cout<<res + max(f(v[0], v[1], v[2], v[3]), f(v[1], v[0], v[3], v[2]))<<endl;
    }
}

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

using namespace std;

#define int			long long
#define double 		long double
#define pb			push_back
#define in 			insert
#define mp			make_pair
#define f			first
#define s			second
#define x			first
#define y			second
#define all(el)		el.begin(), el.end()
#define allr(el)	el.rbegin(), el.rend()
#define sz(el)		(int)el.size()
 
template <typename T1, typename T2> inline bool chkmin(T1 &x, const T2 &y) {if (x > y) {x = y; return 1ll;} else {return 0ll;}}
template <typename T1, typename T2> inline bool chkmax(T1 &x, const T2 &y) {if (x < y) {x = y; return 1ll;} else {return 0ll;}}

signed main() {
	
	#ifdef BarkovBG
		freopen("input.txt", "r", stdin);
	#endif

	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

	int l;
	cin >> l;
	double ans = (double)l / 3;
	cout << fixed << setprecision(20) << ans * ans * ans;

	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
#include <cmath>
#include <set>
#include <deque> 
#include <string>


using namespace std;

int n;

int x;


int main()
{
	scanf("%d", &n);
	
	int target = n * 100;
	int x = n * 100 / 108;
	int gen = x * 108;
	
	while (gen < target)
	{
		x++;
		gen = x * 108;
	}
	
	if ((gen / 100) == (target / 100))
		printf("%d\n", x);
	else
		printf(":(\n");
		
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define fr(i,n) for(int i=0;i<(n);++i)
#define foor(i,a,b) for(int i=(a);i<=(b);++i)
#define rf(i,n) for(int i=(n);i--;)
#define roof(i,b,a) for(int i=(b);i>=(a);--i)
#define all(x) x.begin(),x.end()
#define Sort(x) sort(all(x))
#define Reverse(x) reverse(all(x))
#define PQ priority_queue
#define print(x) cout<<(x)<<endl
using namespace std;            typedef vector<int>  vi;
typedef long long ll;           typedef vector< ll>  vl;
typedef unsigned long long ull; typedef vector<ull>  vu;
typedef double dbl;             typedef vector<dbl>  vd;
typedef pair<int,int>pii;       typedef vector<pii>vpii; typedef map<int,int>mii;
typedef pair< ll, ll>pll;       typedef vector<pll>vpll; typedef map< ll, ll>mll;
typedef pair<dbl,dbl>pdd;       typedef vector<pdd>vpdd; typedef map<dbl,dbl>mdd;
typedef pair< ll,int>pli;       typedef vector<pli>vpli; typedef map< ll,int>mli;
typedef pair<dbl,int>pdi;       typedef vector<pdi>vpdi; typedef map<dbl,int>mdi;
template<typename T>vector<T>&operator<<(vector<T>&v,const T t){v.push_back(t);return v;}
template<typename T>multiset<T>&operator<<(multiset<T>&m,const T t){m.insert(t);return m;}
template<typename T>set<T>&operator<<(set<T>&s,const T t){s.insert(t);return s;}
template<typename T,typename U>PQ<T,vector<T>,U>&operator<<(PQ<T,vector<T>,U>&q,const T t){q.push(t);return q;}
template<typename T,typename U>istream&operator>>(istream&s,pair<T,U>&p){return s>>p.first>>p.second;}
template<typename T>istream&operator>>(istream&s,vector<T>&v){fr(i,v.size()){s>>v[i];}return s;}
template<typename T,typename U>ostream&operator<<(ostream&s,const pair<T,U>p){return s<<p.first<<" "<<p.second;}
template<typename T>ostream&operator<<(ostream&s,const vector<T>v){for(auto a:v){s<<a<<endl;}return s;}
const int MD=1e9+7;
vpli dijkstra(const int N,const vpli E[],const int s,const ll inf){vpli d;fr(i,N)d<<pli{inf,i};d[s].first=0;PQ<pli,vpli,greater<pli>>pq;pq<<(d[s]=pli{0,s});while(pq.size()){pli a=pq.top();pq.pop();int v=a.second;if(d[v].first>=a.first){for(pli e:E[v]){if(d[v].first+e.first<d[e.second].first){d[e.second]=pli{d[v].first+e.first,v};pq<<pli{d[v].first+e.first,e.second};}}}}return d;}
ll gcd(const ll a,const ll b){return a?gcd(b%a,a):b;}
ll pow(const ll a,const ll n,const int m){ll t;return n?(n&1?a>=0?a%m:~-m+~a%m:1)*(t=pow(a,n>>1,m),t*t%m)%m:1;}
ll C2(const int n){return(ll)n*~-n/2;}
 
main(){cin.tie(0);ios::sync_with_stdio(false);
	using P=pair<ll,double>;
	set<P>s;
	ll k=0,p=1;
	for(ll j=0;j<=15;++j){
		for(ll i=1;i<=1000;++i){
			ll t=i*p+k;
			ll a=0;
			for(ll u=t;u;u/=10){
				a+=u%10;
			}
			s<<P{t,(double)t/a};
		}
		k=k*10+9;
		p*=10;
	}
	vector<P>v;
	for(P a:s){
		v<<a;
	}
	Reverse(v);
	vl z;
	double m=1e18;
	for(P a:v){
		if(a.second<=m){
			z<<a.first;
			m=a.second;
		}
	}
	Reverse(z);
	int K;
	cin>>K;
	fr(i,K){
		print(z[i]);
	}
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b, c, d;
  int left, right;
  cin >> a >> b >> c >> d;
  
  left = a + b;
  right = c + d;
  
  if (left > right) {
    cout << "Left" << endl;
  } else if (left < right) {
    cout << "Right" << endl;
  } else {
    cout << "Balanced" << endl;
  }
}


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

using namespace std;

main() {

    long long N, A, B;
    cin >> N >> A >> B;

    if ((B-A)%2 == 0) {
        cout << (B-A)/2 << "\n";
    }
    else {
        long long left = A + (B-A-1)/2;
        long long right = N-B+1 + (B-A-1)/2;
        cout << min(left,right) << "\n";
    }

    return 0;
}

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

using namespace std;

int main(){
	int N; cin >> N;
	int A[N];
	for(int i = 0; i < N; ++i) cin >> A[i];
	for(int i = 0; i < N; ++i){
		int x = A[i];
		int cnt = 0;
		while(1){
			if(x%2 == 0){
				x /= 2;
				cnt++;
			}else{
				A[i] = cnt;
				break;
			}
		}
	}
	cout << *min_element(A, A + N) << endl;
}


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

int main() {
    int n, k, q; cin >> n >> k >> q;
    vector<int> a(n, k-q);
    for (int i=0; i<q; ++i) {
        int tar; cin >> tar;
        ++a[tar-1];
    }
    for (int i=0; i<n; ++i) {
        string ans = (a[i]>0) ? "Yes" : "No";
        cout << ans << endl;
    }
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()
#define all(v) (v).begin(), (v).end()


using namespace std;

typedef long long ll;

static const long long MOD = 1000000007;

ll k;
vector<ll> v;
map<ll, bool> m;

int main(void) {
    cin >> k;
  
    for(ll i=1; i<=9; i++) {
        v.pb(i);
        m[i] = true;
    }

    int i = 0;
    for(int c=0; c<=k+5;c++) {
        ll t = v[i];
        string s = to_string(t);
       
        ll d = s[(int)s.size()-1]-'0';
        for (ll j=d-1; j<=d+1; j++) {
            if (j>=0 && j<=9) {
                string tmp = s;
                tmp += ('0' + j);
                v.pb(stoll(tmp));
            }
        }
        i++;
    }


    sort(all(v));
    ll ans = v[k-1];

    cout << ans << endl;

	return 0;
}


Measured memory_bytes: 6256
l = []

n = int(input())
for i in range(n):
    x = input().split()
    if len(x)==2:
        if int(x[0])==0:
            l.append(int(x[1]))
        elif int(x[0])==1:
            print(l[int(x[1])])
    else:
        l.pop()
        


Measured memory_bytes: 13372
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,a,b;
    b=0;
    cin>>n>>a;
    b=n%500;
    if(b<=a){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}


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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

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

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

ll dp[310][310] = {0};

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

  int N, K;
  cin >> N >> K;
  vector<ll> H(N+1);
  H[0] = 0;
  for(int i = 1; i < N+1; i++){
    cin >> H[i];
  }

  for(int i = 0; i < N+1; i++){
    for(int j = 0; j < N+1; j++){
      dp[i][j] = INF;
    }
  }

  dp[0][0] = 0;
  for(int i = 1; i < N+1; i++){
    for(int j = 1; j < N+1; j++){
      for(int k = 0; k < i; k++){
        chmin(dp[i][j], dp[k][j-1] + max(0LL, H[i] - H[k]));
      }
    }
  }

  ll ans = INF;
  for(int i = 0; i <= N; i++){
    chmin(ans, dp[i][N-K]);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a;
cin>>a;
if(a<105)
{
	cout<<"0";
	return 0;
}
int count2=1;


for(int i=107;i<=a;i=i+2)
{
    int count=0;
	for(int j=2;j<i;j++)
	{
		if(i%j==0)
			count++;
	}
	if(count==6)
		count2++;

}
cout<<count2<<"\n";
return 0;
}

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

using namespace std;
using namespace atcoder;

typedef pair<int, int> ii;

int main(){
  ios::sync_with_stdio(0), cin.tie(0);
  int n;  cin >> n;
  int x[n], y[n];
  for (int i = 0; i < n; ++i){
    cin >> x[i] >> y[i];
  }
  int idx[n];
  iota(idx, idx+n, 0);
  sort(idx, idx+n, [&] (int i, int j) { return x[i]<x[j]; } );
  dsu d(n);
  set<ii> st;
  st.insert({y[idx[0]], idx[0]});
  for (int i = 1; i < n; ++i){
    auto it = st.begin();
    if(it->first < y[idx[i]]){
      d.merge(it->second, idx[i]);
      auto it2 = st.lower_bound({y[idx[i]], n+1});
      it2--;
      if(it2 != it) d.merge(it2->second, idx[i]);
    }
    st.insert({y[idx[i]], idx[i]});
  }
  st.clear();
  st.insert({y[idx[n-1]], idx[n-1]});
  for (int i = n-2; i >= 0; --i){
    auto it = st.rbegin();
    if(it->first > y[idx[i]]){
      d.merge(it->second, idx[i]);
    }
    st.insert({y[idx[i]], idx[i]});
  }
  for (int i = 0; i < n; ++i){
    cout << d.size(i) << "\n";
  }
  return 0;
}

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

using namespace std;

bool check(vector<int>& v)
{
    int res = v[0];
    res += v[1] * 10 + v[2];
    res += v[3] * 100 + v[4] * 10 + v[5];
    return (res == v[6] * 100 + v[7] * 10 + v[8]);
}

int main()
{
    vector<int> p, v(9);
    for (int i = 0; i < 9; i++) {
        p.push_back(i + 1);
    }
    for (int i = 0; i < 9; i++) {
        cin >> v[i];
    }
    int res = 0;
    do {
        vector<int> nv(9);
        bool ok = 1;
        for (int i = 0; i < 9; i++) {
            nv[i] = p[i];
            if (v[i] == -1) continue;
            if (v[i] != p[i]) {
                ok = 0;
                break;
            }
        }
        if (ok && check(nv)) res++;
    } while (next_permutation(p.begin(), p.end()));
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3152
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
using ll=long long int;
int main()
{
    int n;
    cin>>n;
    int x;
    int s1=0;
    ll s2=0;
    REP(i,n){
        cin>>x;
        s1+=x;
        s2+=x*x;
    }
    int m=min({s2-2*s1*(s1/n)+n*(s1/n)*(s1/n),
               s2-2*s1*(s1/n+1)+n*(s1/n+1)*(s1/n+1),
               s2-2*s1*(s1/n-1)+n*(s1/n-1)*(s1/n-1),});
    cout<<m<<endl;
}

Measured memory_bytes: 256
SUNUKE,KASHI  =list(map(int, input().split()))
havings = [1 for _ in range(SUNUKE)]

for k in range(KASHI):
    num_sunuke=int(input())
    having_sunuke = list(map(int, input().split()))
    for i in having_sunuke:
        havings[i-1] = 0


print(sum(havings))


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


#define ONSPEED ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define f(i,x,n) for(i=x;i<n;i++)
#define rf(i,x,n) for(i=n;i>x;i--)
#define ll long long
#define GCD(a,b) __gcd(a,b)
#define ff first
#define ss second
#define adios return 0;

/*
tacet aquilae
*/

int main()
{
    ONSPEED;
    ll t,n,k,a,b,c,d,s=0,i,j,flag;
    string x,y;
    cin>>x;
    f(i,0,x.size())
    {
    	if(x[i]=='R')
    	{
    		s++;
    	}
    }
    if(s==2){
    	if(x[0]!=x[1] and x[1]!=x[2]) s=1;
    }
    cout<<s<<endl;





    adios;
}
	


Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <iomanip>
#include <functional>
#include <bitset>
#include <limits>
#include <cstdio>
#include <cmath>
#include <cassert>
#include <random>

#ifdef DEBUG
#include "library/Utility/debug.cpp"
#else
#define debug(...)
#endif

#define rep(i,n) for(int i=0;i<(n);++i)
#define EL '\n'
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
using lnt = long long;
struct FIO{FIO(){std::cin.tie(0);std::cout.tie(0);std::ios_base::sync_with_stdio(0);std::cout<<std::fixed<<std::setprecision(15);}}fIO;
/*-*/

int main() {
	std::string s,t;
	std::cin >> s >> t;
	int n=s.size();
	int count=0;
	rep(i,n) if(s[i]!=t[i]) count++;
	print(count);
}


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

const int maxn=1e6+7;

int a[maxn];

ll pre[maxn],lpre[maxn];

int main(){
    int n;scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%d",&a[i]);
    for(int i=1;i<=n+1;i++) pre[i]=abs(a[i]-a[i-1])+pre[i-1];
    for(int i=n;i>=0;i--) lpre[i]=lpre[i+1]+abs(a[i]-a[i+1]);
    for(int i=1;i<=n;i++){
        printf("%lld\n",pre[i-1]+lpre[i+1]+abs(a[i-1]-a[i+1]));
    }
    /*for(int i=1;i<=n;i++)  {
        if(i==1) printf("%lld\n",pre[n+1]);
        else if(i==n) printf("%lld\n",pre[n-1]+abs(a[n-1]));
        else printf("%lld\n",pre[n+1]-abs(a[i]-a[i-1])-abs(a[i]-a[i+1])+abs(a[i-1]-a[i+1]));
    }*/
    return 0;
}


Measured memory_bytes: 8192
#include <iostream>

int main()
{
  using namespace std;
  int n, k, cnt = 0;

  cin >> n >> k;

  for (int i = 0; i < n; i++) {
    int h;
    cin >> h;
    if (k <= h) cnt++;
  }

  cout << cnt << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using ull = unsigned long long;
using vll = vector<long long>;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define VREP(s, ite) for (auto ite = s.begin(); ite != s.end(); ++ite)
#define FI first
#define SE second
#define ALL(v) v.begin(),v.end()
//#define endl "\n"
#define ciosup  \
    cin.tie(0); \
    ios::sync_with_stdio(false);
#define eb emplace_back
#define vint vector<int>
constexpr ll INF = 1e15 + 7LL;
constexpr ll MOD = 998244353;

template <typename T>
istream &operator>>(istream &is, vector<T> &v)
{
    for (int i = 0; i < v.size(); ++i)
    {
        is >> v[i];
    }
    return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    for (int i = 0; i < v.size() - 1; ++i)
    {
        os << v[i] << " ";
    }
    if (v.size() > 0)
    {
        os << v[v.size() - 1] << endl;
    }
    return os;
}

struct edge{
    ll to, cost;
};

int n, m;
ll d[2 * 100'000 + 10];
vector<vector<edge>> G(2 * 100'000 + 10);

void dijkstra(int s)
{
    priority_queue<pll, vector<pll>, greater<pll>> que;
    fill(d, d + 2 * n + 10, INF);
    d[s] = 0;
    que.push(pll(0, s));
    while (!que.empty())
    {
        pint p = que.top();
        que.pop();
        int v = p.SE;
        if (d[v] < p.FI)
            continue;
        REP(i, G[v].size())
        {
            edge e = G[v][i];
            if (d[e.to] > d[v] + e.cost)
            {
                d[e.to] = d[v] + e.cost;
                que.push(pll(d[e.to], e.to));
            }
        }
    }
}

int main()
{
    cin >> n >> m;
    vll l(m), r(m), c(m);
    REP(i,m){
        cin >> l[i] >> r[i] >> c[i];
    }
    FOR(i,1,n){
        edge e;
        e.to = i;
        e.cost = 0;
        G[i + 1].emplace_back(e);
    }
    REP(i,m){
        edge e;
        e.to = r[i];
        e.cost = c[i];
        G[l[i]].emplace_back(e);
    }
    dijkstra(1);
    if (d[n] == INF){
        d[n] = -1;
    }
    cout << d[n] << endl;
}

Measured memory_bytes: 15480
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
bool dp[2016][10010],d2[2016][10010];
string s[2016],t[2016];
int len[2016];
vector<int> za;
vector<int> zalgo(string s){
	int i=1,j=0,n=s.size();
	vector<int> a(n,0);
	a[0]=n;
	while(i<n){
		while(i+j<n && s[j]==s[i+j]) j++;
		a[i]=j;
		if(j==0){i++;continue;}
		int k=1;
		while(i+k<n && k+a[k]<j){a[i+k]=a[k];++k;}
		i+=k;j-=k;
	}
	return a;
}

//T[0~be]とT[0~j]+Sを比較
int cal(int i,int be,int j){
	if(be<=j) return 0;
	int ma=za[j+len[i]];ma=min(ma,min(be-j,len[i]));
	if(ma==min(be-j,len[i])) return 0;
	else if(s[i][ma]<t[i][j+ma]) return 1;return -1;
}

//T[0~be]+SとT[0~j]+Sを比較
int cal2(int i,int be,int j){
	if(be>j) return -cal2(i,j,be);
	if(be==j) return 0;
	int ma=za[len[i]+be];
	if(ma<j-be){
		if(t[i][ma+be]<s[i][ma]) return 1;return -1;
	}
	ma=za[j-be];
	//if(i==2 && be==3 && j==4) cout<<ma<<endl;cout<<s[ma]<<' '<<
	if(ma>=len[i]-j+be) return 0;
	else if(s[i][ma]<s[i][ma+j-be]) return 1;return -1;
}
int main()
{
	int n,k;
	cin>>n>>k;
	memset(dp,false,sizeof(dp));dp[n][k]=true;
	rep(i,n){
		cin>>s[i];len[i]=s[i].size();
	}
	for(int i=n;i>0;i--) rep(j,k+1){
		if(!dp[i][j]) continue;
		if(j>=len[i-1]) dp[i-1][j-len[i-1]]=true;
		dp[i-1][j]=true;
	}
	/*rep(i,n) rep(j,k+1){
		if(dp[i][j]) cout<<i<<' '<<j<<endl;
	}*/
	rep(i,n) t[i]="";
	memset(d2,false,sizeof(d2));d2[0][0]=true;
	rep(i,n){
		//cout<<t[i]<<endl;rep(j,t[i].size()+1){if(d2[i][j]) cout<<j<<' ';}cout<<endl;
		za=zalgo(s[i]+t[i]);
		int be=-1;
		rep(j,t[i].size()+1){
			if(j+len[i]>k || !dp[i+1][j+len[i]] || !d2[i][j]) continue;
			if(be<0){
				int x=cal(i,t[i].size(),j);
				if(x>0 || (x==0 && j+len[i]>t[i].size())) be=j;
			}
			else{
				int x=cal2(i,be,j);
				if(x>=0) be=j;
			}
		}
		rep(j,t[i].size()+1){
			if(!d2[i][j]) continue;
			if(dp[i+1][j]){
				if(be<0) d2[i+1][j]=true;
				else{
					if(cal(i,j,be)<=0) d2[i+1][j]=true;
					//if(cal(i,j,be)<0) while(1){}
				}
			}
			if(j+len[i]>k || !dp[i+1][j+len[i]]) continue;
			if(be<0){
				if(cal(i,t[i].size(),j)>=0) d2[i+1][j+len[i]]=true;
				//if(cal(i,t[i].size(),j)>0) while(1){}
			}
			else{
				if(cal2(i,be,j)>=0) d2[i+1][j+len[i]]=true;
				//if(cal2(i,be,j)>0) while(1){}
			}
		}
		if(be<0) t[i+1]=t[i];
		else t[i+1]=t[i].substr(0,be)+s[i];
	}
	cout<<t[n]<<endl;
}


Measured memory_bytes: 60416
#include <iostream>
using namespace std;
typedef long long ll;
ll N,A,K;

ll rec(ll x,ll k){
    if(x<k) return 0;
    if(x%k==0) return x/k;
    ll t = x/k+1;
    ll l = 1,r = A;
    while(l+1<r){
        ll m = (l+r)/2;
        if(x-m*t>0 && (x-m*t)/k==x/k) l = m;
        else r = m;
    }
    return rec(x-l*t,k);
}

int main(){
    cin >> N;
    ll g = 0;
    for(int i=0;i<N;i++){
        cin >> A >> K;
        g ^= rec(A,K);       
    }
    cout << (g? "Takahashi":"Aoki") << endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>

using namespace std;

int main()
{
	string s1, s2, s3;
	cin >> s1 >> s2 >> s3;
	
	cout << char(s1[0] - ' ') << char(s2[0] - ' ') << char(s3[0] - ' ') << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
constexpr ll mod=1e9+7;

int main()
{
  ll n,a,b;
  cin>>n>>a>>b;
  if(abs(a-b)%2==0)
  {
    cout<<abs(a-b)/2<<endl;
  }
  else
  {
    if(abs(a-1)<abs(b-n))
    {
      cout<<abs(a-1)+1+
      abs(b-a-1)/2<<endl;
    }
    else
    {
      cout<<abs(b-n)+1+
      abs(b-a-1)/2<<endl;
    }
  }
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
#define int long long int
#define ld long double
#define all(x) (x).begin(), (x).end()
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define fi first
#define se second
#define mp make_pair
#define pb push_back
typedef pair<int,int> pii;
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define ub upper_bound
#define lb lower_bound
#define present(c,x) (c.find(x) != c.end())
#define removeDuplicates(a) a.resize(unique(all(a))-a.begin())
#define endl '\n'	
#define fill(s,x,n) vector
 x(n); rep(i,0,n) cin>>x[i];
#define INF 1000000007 
#define MOD 998244353
#define INF64 1e18

void solve(){
	int n,k;
	cin>>n>>k;
	fill(int,a,n);

	vector<int> dp(k+1,false);
	dp[0]=false;

	rep(i,1,k+1){
		for(auto it:a){
			if(it>i)
				break;
			dp[i]|=!(dp[i-it]);
		}
	}

	if(dp[k])
		cout<<"First";
	else
		cout<<"Second";
}	
 
int32_t main(){
	
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
 
	int T;
	// cin>>T;
	T=1;
	while(T--){
		solve();
	}
}

Measured memory_bytes: 3968
import fractions

A,B,C,D = map(int,input().split())
LCM = (C*D)//fractions.gcd(C,D)
ans = B-A-(B//C-(A-1)//C)-(B//D-(A-1)//D)+(B//LCM-(A-1)//LCM)+1
print(ans)

Measured memory_bytes: 5560
package main

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

var scanner = bufio.NewScanner(os.Stdin)

func scanInt() int {
	scanner.Scan()
	a, err := strconv.Atoi(scanner.Text())
	if err != nil {
		fmt.Println(err)
	}
	return a
}

func main() {
	scanner.Split(bufio.ScanWords)

	n := scanInt()
	k := scanInt()

	if n < k {
		fmt.Println(0)
		return
	}

	h := make([]int, n)
	for i := 0; i < n; i++ {
		h[i] = scanInt()
	}

	sort.Ints(h)

	s := 0
	for i := 0; i < n-k; i++ {
		s += h[i]
	}

	fmt.Println(s)
}


Measured memory_bytes: 5120
#include<iostream>
#include<string.h>

using namespace std;

int main(){
  char tap[100];
  cin>>tap;
  int flag = 1, len = strlen(tap);
  for(int i=1; i<=len;i++){
    if((tap[i-1] == 'R' && i%2 == 0)||(tap[i-1] == 'L' && i%2 == 1)){
      flag = 0;
      break;
    }
  }
  if(flag)
    cout<<"Yes"<<endl;
  else
    cout<<"No";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for( i=a;i<b;i++)
#define rep(i,n) for(ll i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
const ll MOD=1e9+7;



int main() {
    ios_base::sync_with_stdio(false);

    ll n,m;
    cin >> n >> m;
    ll ans=0;
    if (abs(n-m)<=1) {
        ans=1;
        rep(i,n) ans=(ans*(i+1))%MOD;
        rep(i,m) ans=(ans*(i+1))%MOD; 
    }
    if (n==m) ans=(2*ans)%MOD;
    cout << ans << endl;
    
    return 0;
}

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

from pprint import pprint
from collections import deque, defaultdict
import itertools
import math
import sys

sys.setrecursionlimit(10 ** 6)
INF = float('inf')


nums = list(map(int, (list(input()))))
# print(nums)

if sum(nums) % 9 == 0:
    print('Yes')
else:
    print('No')


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

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

    int count = 0;
    while (true) {
        N /= K;
        if (N < 1) {
            break;
        }
        count++;
    }

    cout << count + 1 << endl;
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define mod 1000000007
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string str,s,t;
    cin>>s>>t;
    int m,n;
    m = s.length();
    n = t.length();
    vector<vector<int> > dp;
    dp.resize(m+1,vector<int>(n+1,0));
    for(int i=0;i<m;i++)
    {
        for(int j=0;j<n;j++)
        {
            if(s[i] == t[j])
                dp[i+1][j+1] = dp[i][j]+1;
            else
                dp[i+1][j+1] = max(dp[i][j+1],dp[i+1][j]);
        }
    }
    int i=m,j=n;
    str = "";
    while(i>0 && j>0)
    {
        if(dp[i-1][j] == dp[i][j])
        {
            i--;
        }
        else if(dp[i][j-1] == dp[i][j])
        {
            j--;
        }
        else
        {
            str = s[i-1]+str;
            i--;
            j--;
        }
    }
    if(str.length())
        cout<<str;
    else
        cout<<' ';
    
}

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

int main() {
	int n, i, s;
	cin >> n;
	vector<int> nums(2 * n, 0);
	for (i = 0; i < 2 * n; i++) {
		cin >> nums[i];
	}
	sort(nums.begin(), nums.end());
	s = 0;
	for (i = 0; i < 2 * n; i = i + 2) {
		s += nums[i];
	}
	cout << s << endl;
	return 0;
}

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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair
#define F first
#define S second

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

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


#define INF 1000


int main() {
    i64 N; cin >> N;
    vector<i64> H(N);
    REP(i, N) cin >> H[i];

    i64 cnt = 0;
    REP(k, N) {
        i64 minv = INF;
        auto decl = [&](i64 l, i64 r, i64 v) {
            if (l == r) return (i64)0;
            for (i64 i = l; i < r; i++) H[i] -= v;
            return v;
        };
        i64 l = 0;
        REP(r, N + 1) {
            if (r == N || H[r] == 0) {
                cnt += decl(l, r, minv);
                l = r + 1;
                minv = INF;
            } else {
                chmin(minv, H[r]);
            }
        }
    }

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rrep(i,a,b) for(int i=(int)(a);i>=(int)(b);--i)
#define fore(i,a) for(auto &i:a)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define isin(i,a,b) ((a) <= (i) && (i) < (b))
#define uni(a) (a).erase(unique(all(a)),(a).end())
#define fi first
#define se second
#define pb push_back
#define sz(a) (int)(a).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll  = long long;
using unit= unsigned;
using ull = unsigned long long;
using P   = pair<int,int>;
using vi  = vector<int>;
using vl  = vector<ll>;
using vvi = vector<vi>;
using vp  = vector<P>;
void _main(); int main(){ cin.tie(0); ios::sync_with_stdio(false); _main(); }
template<class T>void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T>void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T>void POSS(T condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class T>void Poss(T condition){ if(condition) cout << "Possible" << endl; else cout << "Impossible" << endl; }
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; }
template<class T>T gcd(T a, T b){ if (b==0){ return a; }else{ return gcd(b, a%b); }}
template<class T>T lcm(T a, T b){ return a / gcd(a, b) * b; }
constexpr double eps = 1e-10;
constexpr int inf = INT_MAX / 2;
constexpr ll infl = 1LL << 60;

void _main() {
  int N;
  cin >> N;
  vi W(N);
  rep(i, 0, N) cin >> W[i];

  int s1=0, s2=0;
  s1 = W[0];
  rep(i, 1, N) s2 += W[i];

  int ans = abs(s1-s2);
  rep(i, 1, N-1) {
    s1 += W[i];
    s2 -= W[i];
    chmin(ans, abs(s1-s2));
  }
  cout << ans << endl;
}

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

#define INIT_CAP 10
#define INF 1000000000

typedef struct {
	int *elem, cap, size;
} VecInt;

VecInt adj[100000];
int d[100000];
int cnt[100000];
int queue[100000];
int front, rear;

void init(int n) {
	while (n--)
		adj[n] = (VecInt){malloc(sizeof(int) * INIT_CAP), INIT_CAP, 0};
}

void add(int from, int to) {
	if (adj[from].size == adj[from].cap) {
		adj[from].cap <<= 1;
		adj[from].elem = realloc(adj[from].elem, sizeof(int) * adj[from].cap);
	}
	adj[from].elem[adj[from].size++] = to;
}

int main(void) {
	int i;
	int n, m;

	scanf("%d %d", &n, &m);

	init(n);
	for (i = 0; i < m; i++) {
		int a, b;

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

		add(a, b);
		add(b, a);
	}
	for (i = 0; i < n; i++)
		d[i] = INF;

	d[0] = 0;
	queue[rear++] = 0;
	while (front != rear) {
		const int from = queue[front++];
		cnt[d[from]]++;
		for (i = 0; i < adj[from].size; i++) {
			const int to = adj[from].elem[i];
			if (d[to] == INF) {
				d[to] = d[from] + 1;
				queue[rear++] = to;
			} else if (d[to] == d[from]) {
				printf("%lld\n", (long long)n * (n - 1) / 2 - m);
				return 0;
			}
		}
	}

	int sum[2] = {0};
	for (i = 0; i < 100000; i++)
		sum[i & 1] += cnt[i];

	printf("%lld\n", sum[0] * sum[1] - m);

	return 0;
}


Measured memory_bytes: 7168