akhauriyash/Code-Regression huggingface dataset:
function Main(input) {
  input = input.split("\n");
  var N = input[0];
var LineB = input[1].split(" ").map(Number);
  LineB.push(Infinity)
var Sum = 0;
for(var i=0; i<N-1 ; i++){
  if(LineB[i]<LineB[i+1]){
    Sum += LineB[i];
  }else{
    Sum += LineB[i+1];
  }
}
Sum += LineB[0];  
  console.log(Sum);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include<stdio.h>

int main(){
    int A[4][4] = {0};
    int flag[4][4] = {0};
    int i,j,k;

    for( i = 1; i <= 3; i++ ){
        scanf("%d %d %d", &A[i][1], &A[i][2], &A[i][3]);
    }

    int N,b;
    scanf("%d", &N);

    for( k = 1; k <= N; k++ ){
        scanf("%d", &b);
        for( i = 1; i <= 3; i++ ){
            for( j = 1; j <= 3; j++ ){
                if( b == A[i][j] ) flag[i][j] = 1;
            }
        }
    }

    int ans = 0;

    for( i = 1; i <= 3; i++ ){
        if( flag[i][1] == 1 && flag[i][2] == 1 && flag[i][3] == 1 ) ans = 1; 
        if( flag[1][i] == 1 && flag[2][i] == 1 && flag[3][i] == 1 ) ans = 1; 
        if( flag[1][1] == 1 && flag[2][2] == 1 && flag[3][3] == 1 ) ans = 1; 
        if( flag[1][3] == 1 && flag[2][2] == 1 && flag[3][1] == 1 ) ans = 1; 
    }

    if( ans == 0 ) printf("No\n");
    if( ans == 1 ) printf("Yes\n");
    



    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <map>
#include <set>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstring>
#include <math.h>
#include <list>

using namespace std;

#define Rep(i,a,b) for(int i = a; i < b; i++)
#define rep(i,b) Rep(i,0,b)
#define rrep(i,a) for(int i = a; i >= 0; i--)
#define allof(a) (a).begin(), (a).end()

typedef long long ll;
const int inf = 1e9 + 7;
const ll infll = 1ll << 60ll;
const ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

/*
// 最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

// 最小公倍数
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}*/

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	/*
	ll n, W;
	cin >> n >> W;
	vector<ll> w(n), v(n);
	rep(i, n) cin >> w[i] >> v[i];

	// w1 <= wi <= w1 + 3
	// wは4パターンしか値を持たない

	// dp[i][j] := i番目までの商品を見て重さがjであるときの価値
	// 
	*/
	ll n, T;
	cin >> n >> T;
	vector<ll> t(n);
	rep(i, n)cin >> t[i];

	int ans = T;
	int time = T;
	Rep(i, 1, n) {
		time = max(time - (t[i] - t[i - 1]), 0LL);
		if (time == 0) {
			ans += T;
			time = T;
		}
		else {
			ans += T - time;
			time = T;
		}
	}

	cout << ans << endl;

	return 0;
}


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

using namespace std;

#define SZ(x) (int)(x.size())

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

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

  string s; cin >> s;
  int cnt = 0;
  cnt += s[0] == '1';
  cnt += s[1] == '1';
  cnt += s[2] == '1';
  cout << cnt << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	private static Scanner sc=new Scanner(System.in);
	private static double x1=sc.nextDouble();
	private static double y1=sc.nextDouble();
	private static double x2=sc.nextDouble();
	private static double y2=sc.nextDouble();
	private static double ans;
	public static void main (String[] args){
		ans=Math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
		System.out.println(ans);
	}
}

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

	int main() {
		int n,k;
		cin>>n>>k;
		int a[n];
		for(int i=0;i<n;i++){
			cin>>a[i];
		}

	int dp[n];
		for(int i=0;i<n;i++){
			dp[i]=9999999999;
		}
		dp[0]=0;
		for(int i=1;i<n;i++){
			for(int j=k;j>=1;j--){
				if((i-j)>=0)
					dp[i]=min(dp[i], dp[i-j]+abs(a[i]-a[i-j]));
				}
		}
		cout<<dp[n-1]<<endl;
		return 0;
	}


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

bool f[100000];
int add[100005];
signed main(){
 int q , l , r;
  for(int i=3;i<1000;i+=2){
    for(int j=i*i;j<100000;j+=i){
      f[j]=1;
    }
  }
  
  for(int i=4;i<=100000;i+=2){
    f[i]=1;
  }
  
  for(int i=3;i<=100000;i+=2){
    add[i]=add[i-1];
    if(f[i] == false && f[(i+1)/2] == false){
      add[i]+=1;
    }
    add[i+1]=add[i];
  }
  
  cin>>q;
      
  for(int i=0;i<q;i++){
    cin>>l>>r;
    cout<<add[r]-add[l-1]<<endl;
  }
  return(0);
}

Measured memory_bytes: 1152
N, A, B = map(int, input().split())
S = input()

passed = 0
oversea = 0
for s in S:
    if s == "a" and passed < A + B:
        passed += 1
        print("Yes")
        continue

    if s == "b" and passed < A + B and oversea < B:
        passed += 1
        oversea += 1
        print("Yes")
        continue

    print("No")


Measured memory_bytes: 4016
using System;

namespace ALDS1_2_A
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var a = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            int cnt = 0;
            for (int i = 0; i < n - 1; i++)
            {
                int min = i;
                for (int j = i + 1; j < n; j++) if (a[min] > a[j]) min = j;
                if (i != min)
                {
                    a[i] ^= a[min];
                    a[min] ^= a[i];
                    a[i] ^= a[min];
                    cnt++;
                }
            }
            Console.Write(a[0]);
            for (int i = 1; i < n; i++) Console.Write(" " + a[i]);
            Console.WriteLine();
            Console.WriteLine(cnt);
        }
    }
}

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

int main() {
    int N, P;
    while (cin >> N >> P, N || P) {
        vector<int> v(N);
        int ans = -1;
        int now = 0;
        while (1) {
            if (P == 0) {
                P += v[now];
                v[now] = 0;
            } else {
                P--;
                v[now]++;
            }

            if (P == 0) {
                int count = 0;
                for (auto i : v) if (i > 0) count++;
                if (count == 1) {
                    cout << now << endl;
                    break;
                }
            }

            now = (now + 1) % N;
        }
    }

    return 0;
}



Measured memory_bytes: 2984
public partial class IntroductionToProgramming{
	public static void Main(){
		string[] str = System.Console.ReadLine().Split(' ');
		decimal a = decimal.Parse(str[0]);
		decimal b = decimal.Parse(str[1]);
		while(!(a == 0M && b == 0M))
		{
			System.Console.WriteLine((a < b ? a.ToString() : b.ToString()) + " " + (a < b ? b.ToString() : a.ToString()));
			string[] str2 = System.Console.ReadLine().Split(' ');
			a = decimal.Parse(str2[0]);
			b = decimal.Parse(str2[1]);
		}
	}
}

Measured memory_bytes: 6112
var input = require('fs').readFileSync('/dev/stdin', 'utf8').trim();
//var input = 14;
var n = parseInt(input);
var on = n;

var primes = [];
while (n % 2 == 0) {
    primes.push(2);
    n = n / 2;
}
for (var i = 3; i < n / 2; i += 2) {
    while (n % i == 0) {
        primes.push(i);
        n /= i;
    }
}
if (n > 1) primes.push(n);

console.log(on + ': ' + primes.join(' '));


Measured memory_bytes: 16312
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <limits>
#include <ios>
#include <iomanip>
#include <stdio.h>
#include <iomanip>
#include <queue>
using namespace std;

#define rep(i,N) for(int (i)=0; (i)<(N); (i)++)
#define revrep(i,N) for(int (i)=(N)-1; (i)>=0; (i)--)
#define dump(vec) for(int i = 0; i < (vec).size(); i++){cout << vec.at(i) << ",";}cout << endl

typedef long long ll;

int main(void)
{
    int N;
    string S;
    cin >> N >> S;
    if (N%2 == 1){
        cout << "No" << endl;
        return 0;
    }

    string s1 = S.substr(0, N/2);
    string s2 = S.substr(N/2);

    if (s1 == s2) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <math.h>
#include <time.h>
using namespace std;
const long long mod = 1000000007;
#define dump(x)                             \
    if (dbg) {                              \
        cout << #x << " = " << (x) << endl; \
    }
bool dbg = false;
long long gcd(long long a, long long b){
   if (a % b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a % b));
   }
}
long long lcm(long long a, long long b){
   return (a / gcd(a, b))* b;
}
//---------------------------------------------------------------------------------------------------
/*ここからいじる*/
//---------------------------------------------------------------------------------------------------

void solve(){
}
int main(){
    int n, m;
    cin >> n >> m;
    vector<int>data(m);
    for(int i = 0; i < n; i++){
        int k;
        cin >> k;
        vector<int>tmp(k);
        for(int j = 0; j < k; j++){
            cin >> tmp.at(j);
            tmp.at(j)--;
            data.at(tmp.at(j))++;
        }
    }
    int ans = 0;
    for(int i = 0; i < m; i++){
        if(data.at(i) == n){
            ans++;
        }
    }
    cout << ans << endl;
    solve();
    return 0;
}



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

#define N 1000000

using namespace std;

int main(){

  int n, root;
  int p[N][2] = {0};

  for(int i=2; i<N; i++){
    p[i][0] = 1;
  }

  for(int i=2; i<N; i++){
    root = (int)sqrt(i) + 1;
    for(int j=2; j<root; j++){
      if(p[j][0] == 1){
        if(i % j == 0){
          p[i][0] = 0;
          break;
        }
      }
    }
  }

  for(int i=2; i<N; i++){
    p[i][1] = p[i-1][1] + p[i][0];
  }

//  for(int i=0; i<30; i++){
//    cout << i << " " << p[i][0] << endl;
//  }

  while(cin >> n){
    cout << p[n][1] << endl;
  }

  return 0;
}

Measured memory_bytes: 8980
#include <iostream>
#include <bits/stdc++.h>
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef unsigned long long int ulli;
using namespace std;

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

/* MAIN CODE */
int main() {
	// your code goes here
	fastIO
	int n;
	cin >> n;
	if(n%1000==0)
	    cout << 0;
	else
	    cout << 1000 - n%1000;
	return 0;
}


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

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

	for (long long i = 0; i <= b; i++) {
		if (a <= i && i < k + a) {
			cout << i << endl;
		}
		else if (a <= i && b - k < i && i <= b) {
			cout << i << endl;
		}
	}

	return 0;
}

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

char p[1000001];

int main(void){
	int a,d,n;

	memset(p,1,sizeof(p));
	p[0] = p[1] = 0;
	for(int i=2;i<=1000000;i++){
		if(p[i]){
			for(int j=i*2;j<=1000000;j+=i){
				p[j] = 0;
			}
		}
	}

	while(cin>>a>>d>>n && (a||d||n)){
		while(1){
			if(p[a]){
				n--;
				if(n == 0) break;
			}
			a += d;
		}

		cout<<a<<endl;
	}

	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
typedef long long ll;
typedef pair<int,int> P;
const int INF=-2000000000;
int main() {
  int n,x;
  cin >> n >> x;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  ll sum=0;
  for(int i=0; i<n-1; i++){
    if(a[i]+a[i+1]>x){
      if(a[i]>x){
        sum+=a[i+1];
        sum+=a[i]-x;
        a[i+1]=0;
      }
      else{
        sum+=a[i+1]-(x-a[i]);
        a[i+1]=x-a[i];
      }
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
bool vis[5009];
vector<pair<ll,ll> >vec;
ll pp[5009];
ll val[5009];
int main()
{
    ll a,b,c,d,e,i,j,k,l,n,m,x,y,t,p;
    scanf("%lld%lld",&n,&k);
    for(i=1;i<=n;i++)
    {
        scanf("%lld",&pp[i]);
    }
    for(i=1;i<=n;i++)
    {
        scanf("%lld",&val[i]);
    }
    ll ans=-(5e18);
    for(i=1;i<=n;i++)
    {
        for(j=0;j<=n;j++)
        {
            vis[j]=false;
        }
        vec.clear();
        a=i;
        m=0;
        y=0;
        while(1)
        {
            m++;
            if(m>k)
            {
                m--;
                break;
            }
            a=pp[a];

            if(vis[a]==true)
            {
                m--;
                break;
            }
            else
            {
                vis[a]=true;
                y+=val[a];
                ans=max(ans,y);
                vec.push_back({a,val[a]});
            }
        }
        if(m==k)
        {
            continue;
        }

        d=(k-m);
        c=0;
        x=0;
        l=vec.size();
        e=m;
        ll ff=y;
        ll pp=0;
        for(j=0;j<l;j++)
        {
            if(vec[j].first==a)
            {
                pp=j;
                for(ll ii=j;ii<l;ii++)
                {
                    if(e<k)
                    {
                        ff+=vec[ii].second;
                        e++;
                        ans=max(ans,ff);
                    }
                    c++;
                    x+=vec[ii].second;
                }
                break;
            }
        }

        ll aa=(d/c);
        y+=(aa*x);
        ans=max(ans,y);
        aa=d%c;
        l=min(l,pp+aa);
        ll xx=0;
        for(j=pp;j<l;j++)
        {
            y+=vec[j].second;
            xx+=vec[j].second;
            ans=max(ans,y);
        }
        if((d/c)>0)
        {
            y-=x;
            y-=xx;
            ans=max(ans,x);
            l=vec.size();
            for(j=pp;j<l;j++)
            {
                y+=vec[j].second;
                ans=max(ans,y);
            }
        }
    }

    cout<<ans<<endl;
}


Measured memory_bytes: 3972
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
	
	static class Reader {
		BufferedReader br;
		StringTokenizer st;
 
		public Reader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
 
		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}
 
		int nextInt() {
			return Integer.parseInt(next());
		}
 
		long nextLong() {
			return Long.parseLong(next());
		}
 
		double nextDouble() {
			return Double.parseDouble(next());
		}
 
		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}
	
	public static void main(String[] args) {
		Reader r = new Reader();
		
		int n = r.nextInt();
		int[][] dp = new int[n][3];
		
		for (int i = 0; i < 3; i++) {
			dp[0][i] = r.nextInt();
		}
		
		for (int i = 1; i < n; i++) {
			for (int j = 0; j < 3; j++) {
				dp[i][j] = r.nextInt();
			}
			
			dp[i][0] += Integer.max(dp[i - 1][1], dp[i - 1][2]);
			dp[i][1] += Integer.max(dp[i - 1][0], dp[i - 1][2]);
			dp[i][2] += Integer.max(dp[i - 1][1], dp[i - 1][0]);
		}
		
		System.out.println(Integer.max(Integer.max(dp[n - 1][1], dp[n - 1][2]), dp[n - 1][0]));
	}
}


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

#define _DEBUG
#define ll long long
#define ld long double
#define ar array
#define vt vector
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define sz(x) (int)(x).size()

#define F_OR(i, a, b, s) for (int i = (a); (s) > 0 ? i < (b) : i > (b); i += (s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define FOR(...)       \
    F_ORC(__VA_ARGS__) \
    (__VA_ARGS__)
#define EACH(x, a) for (auto &x : a)

template <class A>
void read(vt<A> &v);
template <class A, size_t S>
void read(ar<A, S> &a);
template <class T>
void read(T &x)
{
    cin >> x;
}
void read(double &d)
{
    string t;
    read(t);
    d = stod(t);
}
void read(long double &d)
{
    string t;
    read(t);
    d = stold(t);
}
template <class H, class... T>
void read(H &h, T &... t)
{
    read(h);
    read(t...);
}
template <class A>
void read(vt<A> &x)
{
    EACH(a, x)
    read(a);
}
template <class A, size_t S>
void read(array<A, S> &x)
{
    EACH(a, x)
    read(a);
}

string to_string(char c)
{
    return string(1, c);
}
string to_string(bool b)
{
    return b ? "true" : "false";
}
string to_string(const char *s)
{
    return string(s);
}
string to_string(string s)
{
    return s;
}
string to_string(vt<bool> v)
{
    string res;
    FOR(sz(v))
    res += char('0' + v[i]);
    return res;
}

template <size_t S>
string to_string(bitset<S> b)
{
    string res;
    FOR(S)
    res += char('0' + b[i]);
    return res;
}
template <class T>
string to_string(T v)
{
    bool f = 1;
    string res;
    EACH(x, v)
    {
        if (!f)
            res += ' ';
        f = 0;
        res += to_string(x);
    }
    return res;
}

template <class A>
void write(A x)
{
    cout << to_string(x);
}
template <class H, class... T>
void write(const H &h, const T &... t)
{
    write(h);
    write(t...);
}
void print()
{
    write("\n");
}
template <class H, class... T>
void print(const H &h, const T &... t)
{
    write(h);
    if (sizeof...(t))
        write(' ');
    print(t...);
}

void DBG()
{
    cerr << "]" << endl;
}
template <class H, class... T>
void DBG(H h, T... t)
{
    cerr << to_string(h);
    if (sizeof...(t))
        cerr << ", ";
    DBG(t...);
}
#ifdef _DEBUG
#define dbg(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
#else
#define dbg(...) 0
#endif

void solve()
{
    string str;
    read(str);
    int r = 0;
    for (int i = 0; i < 3;i++)
    {
        if(str[i]=='R')
        {
            while (str[i]=='R')
            {
                r++;
                i++;
            }
            break;
        }
    }
        cout << r << "\n";
}

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

    int t = 1;
    //read(t);
    FOR(t)
    {
        solve();
    }
}

Measured memory_bytes: 3640
#include <stdio.h>

main(){
    int A,B;

    scanf("%d %d",&A,&B);

    int max=A+B;
    if(max<A-B)
        max=A-B;
    if(max<A*B)
        max=A*B;

    printf("%d\n",max);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;
#define rep(i,a,b) for(ll i=a ; i<b ; i++)
#define qrep(que, ite) for(auto ite=begin(que) ; ite!=end(que) ; ite++)
const int max_n = 1e5;
const ll mod = 1e9+7;
const ll INF = 1LL<<60;
const int inf = 1e5;
//typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
ll mo = 998244353;
struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x) {
        return -par[root(x)];
    }
};
int main(){
  int d[50][50];
  rep(i,0,50)rep(j,0,50){
    d[i][j] = 0;
  }
  int n;  cin>>n;
  rep(i,0,n){
    string s; cin>>s;
    rep(j,0,s.size()){
      d[i][s[j]-'a']++;
    }
  }

  int ma=0;
  int a[50]={0};
  string s="";
  rep(i,0,26){
    int k=inf;
    rep(j,0,n){
      chmin(k, d[j][i]);
    }
    a[i] = k;
  }
  for(char st='a' ; st<='z' ; st++){
    for(int i=0 ; i<a[st-'a'] ; i++){
      s += st;
    }
  }
  cout << s << endl;
  return 0;
}


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

using namespace std;

const int MAXN = 110;
const int MAXK = 100010;

int n, k, a[MAXN];
bool sg[MAXK];

int main()
{
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	sg[0] = 0;
	for(int i=1;i<=k;i++){
		for(int j=1;j<=n;j++){
			if(i >= a[j]) sg[i] |= !sg[i-a[j]];
		}
	}
	if(sg[k]) puts("First");
	else puts("Second");
	return 0;
}

Measured memory_bytes: 384
program takahashikun_the_strider
  implicit none
  integer :: x, s = 360, i
  read(*,*) x
  do i = 2, 360
    do while (mod(x, i) == 0 .and. mod(s, i) == 0)
      x = x / i
      s = s / i
    end do
  end do
  write(*,'(i0)') s
end program takahashikun_the_strider

Measured memory_bytes: 2852
import sys
from collections import deque, defaultdict
import copy
import bisect
sys.setrecursionlimit(10 ** 9)
import math
import heapq
from itertools import product, permutations,combinations
import fractions

import sys
def input():
	return sys.stdin.readline().strip()

N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))

mod = 10**9 + 7

F = [1]
for i in range(N*M):
	F.append((F[-1]*(i + 1))%mod)



def pow(x, y, mod=1000000007):
	pow_list = [x]
	i = 1
	while 2**i <= y:
		a = pow_list[-1]**2
		if mod != 0:
			a = a % mod
		pow_list.append(a)
		i += 1
	ans = 1
	for bit in range(len(pow_list)):
		if (2**bit) & y != 0:
			ans *= pow_list[bit]
			if mod != 0:
				ans = ans % mod
	return ans

def fact(n, mod=1000000007):

	return F[n]

def mod_rev(x, mod):
	"""
	関数powが必要
	"""
	return pow(x, mod - 2, mod)


def comb(a, b, mod=1000000007):
	"""
	関数mod_rev, fact, powが必要
	"""
	if a < b or b < 0:
		return 0
	a_fact = fact(a, mod)
	a_b_fact = fact(a - b, mod)
	if mod != 0:
		return (a_fact * mod_rev(a_b_fact, mod))%mod
	else:
		return a_fact//a_b_fact



A.sort()
B.sort()

i = 0
j = 0
max_list = deque([])
ans = 1
mod = 10**9 + 7

if A[-1] != B[-1]:
	print(0)
	exit()

while True:
	if i > 0 and j > 0:
		if A[-i] == A[-i+1] or B[-j] == B[-j+1]:
			print(0)
			exit()
	if j != M and (i == N or A[-(i + 1)] < B[-(j + 1)]):
		ans *= i
		ans %= mod
		max_list.appendleft((B[-(j + 1)], i - 1))
		j += 1
	elif i != N and (j == M or A[-(i + 1)] > B[-(j + 1)]):
		ans *= j
		ans %= mod
		max_list.appendleft((A[-(i + 1)], j - 1))
		i += 1
	elif A[-(i + 1)] == B[-(j + 1)]:
		if i + j != 0:
			max_list.appendleft((A[-(i + 1)], i + j))
		i += 1
		j += 1
	if i == N and j == M:
		break

num = 0
#print(max_list,ans)
for i in range(len(max_list)):
	ans *= comb(max_list[i][0] - i - 1 - num, max_list[i][1])
	ans %= mod
	num += max_list[i][1]

print(ans)

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


int main() {

    int a, b;
    cin >> a >> b;
    cout << (b % a == 0 ? a+b : b-a) << endl;
    return 0;
}

Measured memory_bytes: 256
from collections import Counter

S = input()
s_o = S[::2]
s_e = S[1::2]

cnt_o = Counter(s_o).most_common(1)
cnt_e = Counter(s_e).most_common(1)

if len(S) == 1:
    print(0)
else:
    if cnt_o[0][1] >= cnt_e[0][1] and cnt_o[0][0] == '0':
        print(s_o.count('1')+s_e.count('0'))
    elif cnt_o[0][1] >= cnt_e[0][1] and cnt_o[0][0] == '1':
        print(s_o.count('0')+s_e.count('1'))
    elif cnt_o[0][1] < cnt_e[0][1] and cnt_e[0][0] == '0':
        print(s_o.count('0')+s_e.count('1'))
    else:
        print(s_o.count('1')+s_e.count('0'))

Measured memory_bytes: 3444
import java.util.Arrays;
import java.util.Scanner;
import java.util.ArrayList;

class Main{
	void solve(){
		Scanner sc = new Scanner(System.in);
		
		int sum = 0;
		while(sc.hasNext()){
			String str = sc.next();
			ArrayList<String> list = new ArrayList<String>();
			
			for(int i=0; i<str.length(); ++i){
				String s = "";
				while(true){
					char c = str.charAt(i);
					if('0' <= c && c <= '9'){
						s += new String(new char[]{c});
					}else{
						break;
					}
					
					if(str.length() <= ++i){
						break;
					}
				}
				if(!s.equals("")){
					--i;
					list.add(s);
				}
			}
			
			for(int i=0; i<list.size(); ++i){
				sum += Integer.parseInt(list.get(i));
			}
		}
		
		System.out.println(sum);
	}
	
	public static void main(String[] args){
		new Main().solve();
	}
	
	void debug(Object... os){
		System.err.println(Arrays.deepToString(os));
	}
}

Measured memory_bytes: 12000
#include <stdio.h>

int main(int argc, char *argv[])
{
	int num, cnt = 0, n = 0;
	// char c, dummy;

	scanf("%d", &n);
	// scanf("%c", &dummy);

	int A[10][3], B[10][3], C[10][3], D[10][3];
	for (int i = 0; i < 10; i++)
	{
		for (int j = 0; j < 3; j++)
		{
			A[i][j] = 0;
			B[i][j] = 0;
			C[i][j] = 0;
			D[i][j] = 0;
		}
	}
	cnt = 0;
	int b, f, r, v;
	while (cnt < n)
	{
		scanf("%d %d %d %d", &b, &f, &r, &v);
		// printf("%d %d %d %d\n", b, f, r, v);
		r --;
		f --;
		if (b == 1)
		{
			A[r][f] += v;
		}
		if (b == 2)
		{
			B[r][f] += v;
		}
		if (b == 3)
		{
			C[r][f] += v;
		}
		if (b == 4)
		{
			D[r][f] += v;
		}
		cnt++;
	}

	for (int i = 0; i < 3; i++)
	{
		for (int j = 0; j < 10; j++)
		{
			printf(" %d", A[j][i]);
		}
		printf("\n");
	}

	printf("####################\n");
	for (int i = 0; i < 3; i++)
	{
		for (int j = 0; j < 10; j++)
		{
			printf(" %d", B[j][i]);
		}
		printf("\n");
	}
	printf("####################\n");
	for (int i = 0; i < 3; i++)
	{
		for (int j = 0; j < 10; j++)
		{
			printf(" %d", C[j][i]);
		}
		printf("\n");
	}
	printf("####################\n");
	for (int i = 0; i < 3; i++)
	{
		for (int j = 0; j < 10; j++)
		{
			printf(" %d", D[j][i]);
		}
		printf("\n");
	}
	return 0;
}



Measured memory_bytes: 2100
#include<bits/stdc++.h>
using namespace std;
const int MAX_NUM = 20000+7;
char s[MAX_NUM];
int ss[MAX_NUM];
struct hole{
	int left;
	int size;
};
stack<int> mystack;
stack<struct hole> mystack2;
int main(){
	scanf("%s", s);
	int i;
	int ans = 0;
	int sum = 0;
	for(i = 0; i < strlen(s); i++){
		if(s[i]=='\\'){
			mystack.push(i);
		}else if(s[i]=='/'){
			if(!mystack.empty()){
				int k;
				k = mystack.top();
				mystack.pop();
				sum += (i-k); 
				int t = (i-k);
				while(1){
					if(mystack2.empty()) break;
					struct hole h = mystack2.top();
					if(h.left>k){
						t += h.size;
						mystack2.pop();
					}else{
						break;
					}
				}
				struct hole x;
				x.left = k;
				x.size = t;
				mystack2.push(x);
				
				
			}
		}
		
	}
	

	cout << sum << endl;
	cout << mystack2.size();
	int c = mystack2.size();
	i  = c-1;
	while(!mystack2.empty()){
		ss[i] =  mystack2.top().size;
		mystack2.pop();
		i--;
	}
	for(i = 0; i<c;i++){
		cout << " ";
		cout << ss[i];
	}
	cout << endl;
	return 0;
}


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

typedef long long ll;
const ll MOD = 998244353;
const ll MAX_N = ll(3e5) + 5;

ll factrial[MAX_N], inverse[MAX_N];

ll power(ll x, ll n, ll m = MOD) {
    ll ans = 1;
    while (n > 0) {
        if ((n & 1) == 1) {
            ans = ans * x % m;
        }
        x = x * x % m;
        n >>= 1;
    }
    return ans;
}

void init(ll n) {
    factrial[0] = 1;
    inverse[0] = 1;
    for (ll i = 1; i <= n; i++) {
        factrial[i] = (factrial[i - 1] * i) % MOD;
        inverse[i] = power(factrial[i], MOD - 2) % MOD;
    }
}

ll nCr(ll n, ll k) {
    return factrial[n] * inverse[k] % MOD * inverse[n - k] % MOD;
}

int main() {
    ll N, A, B, K, ans=0;
    cin >> N >> A >> B >> K;
    init(N+1);
    for(int r=0;r<=N;r++){
        ll rest = K - r*A;
        if(rest < 0 || rest > N*B || rest%B != 0)continue;
        ll b = rest/B;
        ans += nCr(N,r)*nCr(N,b) % MOD;
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4992
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;
// (]  >=
int BinarySearch(const vector<int64_t>& sorted, int64_t value) {
    int64_t l = -1;
    int64_t r = sorted.size();
    while (r - l > 1) {
        int64_t mid = (r + l)/ 2;
        if (sorted[mid] >= value) {
            r = mid;
        } else {
            l = mid;
        }
    }
    return r;
}

int main()
{   int64_t big = 1000000007;
    int64_t n, A, B;
    cin >> n >> A >> B;
    vector<int64_t> sorted(n);
    for (auto & x: sorted) {
        cin >> x;
    }
    vector<pair<int64_t, int64_t>> one_color(n);
    one_color[0] = {A + B, A + B};
    for (int i = 1; i < n; ++i) {
        one_color[i].first = sorted[i] - sorted[i - 1];
        if (one_color[i].first >= A) {
            one_color[i].first += one_color[i - 1].first;
        }
        one_color[i].second = sorted[i] - sorted[i - 1];
        if (one_color[i].second >= B) {
            one_color[i].second += one_color[i - 1].second;
        }
    }
    vector<pair<int64_t, int64_t>> ans(n);
    ans[0] = {1, 1};
    for (int i = 1; i < n; ++i) {
        if (sorted[i] - sorted[i - 1] >= A) {
            ans[i].first = (ans[i - 1].first + ans[i - 1].second) % big;
        } else if (one_color[i - 1].second + sorted[i] - sorted[i - 1] >= A) {
            int ind = BinarySearch(sorted, sorted[i] - A);
            if (sorted[ind] == sorted[i] - A) {
                ++ind;
            }
            ans[i].first = ans[ind].second;
        } else {
            ans[i].first = 0;
        }
        if (sorted[i] - sorted[i - 1] >= B) {
            ans[i].second = (ans[i - 1].first + ans[i - 1].second) % big;
        } else if (one_color[i - 1].first + sorted[i] - sorted[i - 1] >= B) {
            int ind = BinarySearch(sorted, sorted[i] - B);
            if (sorted[ind] == sorted[i] - B) {
                ++ind;
            }
            ans[i].second = ans[ind].first;
        } else {
            ans[i].second = 0;
        }
    }
    cout << (ans.back().first + ans.back().second) % big;
    return 0;
}


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

using namespace std;

int main() {
	string s , t;
	ios::sync_with_stdio(0);
	cin >> s >> t;
	int ans = 0 ;
	for(int i = 0 ; i + t.length() - 1 < s.length() ; i++ ) {
		int cnt = 0;
		for(int j = 0 ; j < t.length() ; j++) {
			if(s[i + j] == t[j]) {
				cnt++;
			}
		}
		ans = max(ans , cnt);
	}
	cout << t.length() - ans << "\n";
	return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define pii pair<int, int>
#define ull unsigned ll
#define f first
#define s second
#define FOR(i,a,b) for (int i=(a); i<(b); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for (int i=(n-1); i>=0; i--)
#define ALL(x) x.begin(),x.end()
#define SZ(x) (int)x.size()
#define SQ(x) (x)*(x)
#define MN(a,b) a = min(a,(__typeof__(a))(b))
#define MX(a,b) a = max(a,(__typeof__(a))(b))
#define pb push_back
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#ifdef BALBIT
#define IOS()
#define bug(...) fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);_do(__VA_ARGS__);
template<typename T> void _do(T &&x){cerr<<x<<endl;}
template<typename T, typename ...S> void _do(T &&x, S &&...y){cerr<<x<<", ";_do(y...);}
#else
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define bug(...)
#endif

#define int ll

const int iinf = 1<<29;
const ll inf = 1ll<<60;
const ll mod = 1e9+7;


void GG(){cout<<"-1\n"; exit(0);}

ll mpow(ll a, ll n, ll mo = mod){ // a^n % mod
    ll re=1;
    while (n>0){
        if (n&1) re = re*a %mo;
        a = a*a %mo;
        n>>=1;
    }
    return re;
}

ll inv (ll b, ll mo = mod){
    if (b==1) return b;
    return (mo-mo/b) * inv(mo%b) % mo;
}

const int maxn = 1e5+5;


main(){
    IOS();
    int x, y; cin>>x>>y;
    int re = 0;
    if (x==1 && y==1) {
        re += 400000;
    }
    if (x<=3) {
        re += (4-x)* 100000;
    }
    if (y<=3) {
        re += (4-y)* 100000;
    }
    cout<<re<<endl;
} 


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using datas=pair<ll,ll>;
using ddatas=pair<double,double>;
using tdata=pair<ll,datas>;
using vec=vector<ll>;
using mat=vector<vec>;
using pvec=vector<datas>;
using pmat=vector<pvec>;
#define For(i,a,b) for(i=a;i<(ll)b;i++)
#define bFor(i,a,b) for(i=a;i>=(ll)b;i--)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define brep(i,N) bFor(i,N-1,0)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define endl "\n"
#define pb push_back
#define output(v) do{bool f=0;for(auto outi:v){cout<<(f?" ":"")<<outi;f=1;}cout<<endl;}while(0)
const ll mod=1000000007;
const ll inf=1LL<<60;
const double PI = acos(-1);
const double eps = 1e-9;
template<class T> inline bool chmax(T& a,T b){bool x=a<b;if(x)a=b;return x;} 
template<class T> inline bool chmin(T& a,T b){bool x=a>b;if(x)a=b;return x;} 

void startupcpp(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(15);
}

double distance(ddatas& x,ddatas& y){
  double a=x.first-y.first,b=x.second-y.second;
  return sqrt(a*a+b*b);
}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

vec modncrlistp,modncrlistm;

ll modncr(ll n,ll r){
  ll i,size=modncrlistp.size();
  if(size<=n){
    modncrlistp.resize(n+1);
    modncrlistm.resize(n+1);
    if(!size){
      modncrlistp[0]=modncrlistm[0]=1;
      size++;
    }
    For(i,size,n+1){
      modncrlistp[i]=modncrlistp[i-1]*i%mod;
      modncrlistm[i]=modinv(modncrlistp[i]);
    }
  }
  return modncrlistp[n]*modncrlistm[r]%mod*modncrlistm[n-r]%mod;
}

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

ll gcd(ll a,ll b){if(!b)return a;return (a%b==0)?b:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}
void judgement(int a){
  if(a){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  if(a){
    cout<<"YES"<<endl;
  }else{
    cout<<"NO"<<endl;
  }
}

int main(){
  ll i,j,N,cnt=0,ans=0;
  cin>>N;
  rep(i,N){
    cin>>j;
    if(j==cnt+1){
      cnt++;
    }else{
      ans++;
    }
  }
  if(cnt){
    cout<<ans<<endl;
  }else{
    cout<<-1<<endl;
  }
  return 0;
}

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

int main() {
    int n;
    ll k;
    cin>>n>>k;
    map<int,ll> mp;
    rep(i,n) {
        int temp1,temp2;
        cin>>temp1>>temp2;
        mp[temp1]+=temp2;
    }
    ll cnt=0;
    for (auto v : mp) {
        cnt+=v.second;
        if (k<=cnt) {
            cout<<v.first<<endl;
            return 0;
        }
    }
}


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

int main() {
  int A, B, C, X;
  cin >> A >> B >> C >> X;
  int res = 0;
  for (int a = 0; a <= A; ++a) {
    for (int b = 0; b <= B; ++b) {
      for (int c = 0; c <= C; ++c) {
        int total = 500*a + 100*b + 50*c; // 合計金額
        if (total == X) ++res; // 合計金額が X に一致したら答えをインクリメント
      }
    }
  }
  cout << res << endl;
}

Measured memory_bytes: 3640
#include <cstdio>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

using vs=vector<string>;

int main() {
    int N, L;
    scanf("%d %d", &N, &L);

    vs S(N);
    for (int i=0; i<N; ++i) {
        char buf[128];
        scanf("%s", buf);
        S[i] = buf;
    }

    sort(S.begin(), S.end());
    for (int i=0; i<N; ++i)
        printf("%s", S[i].c_str());

    printf("\n");

    return 0;
}


Measured memory_bytes: 256
const input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);let input_i=-1;const tn=():number=>{input_i++;return Number(input[input_i])};const tnn=(n:number):number[]=>{const a=[];for(let i=0;i<n;i++){a.push(tn())}return a};const ts=():string=>{input_i++;return String(input[input_i])};const tss=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(ts())}return a};const to=(...arg)=>{console.log(...arg)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const floor=(a)=>{return Math.floor(a)};const ceil=(a)=>{return Math.ceil(a)};const asc=(ar:number[])=>{const t=[...ar];return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{const t=[...ar];return t.sort((a,b)=>{return b-a})};const sw=(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length-1;i+=2){if(eval(a+op+arr[i])){return arr[i+1]}}return arr[arr.length-1]};const near=(n:number,arr:number[]):number=>{let ne=arr[0],ni=0;for(let i=1;i<arr.length;i++){if(Math.abs(n-ne)>Math.abs(n-arr[i])){ne=arr[i];ni=i}}return ni};const deduplicate=(a:any[]):any[]=>{return Array.from(new Set(a))};const gcd=(x,y)=>{while(y){[x,y]=[y,x%y]}return x};const sum=(arr)=>{return arr.reduce((a,b)=>a+b);};
const main=()=>{
  let [n,m]=tnn(2),heights=tnn(n),ans=Infinity
  heights.sort((a,b)=>a-b)
  for(let i=0;i<n-m+1;i++){
    ans=min(heights[i+m-1]-heights[i],ans)
  }
  to(ans)
}
main()


Measured memory_bytes: 29884
#include <iostream>
using namespace std;
int main(void){
    int a,b;
    cin >> a;
    cin >> b;
    if(a<b){
        cout << "a < b" << endl;
    }else if(a>b){
        cout << "a > b" << endl;
    }else{
        cout << "a == b" << endl;
    }
}



Measured memory_bytes: 3076
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using pll = pair<ll, ll>;
#define overload4(_1,_2,_3,_4,name,...) name
#define rep1(n) for(ll i=0;i<n;++i)
#define rep2(i,n) for(ll i=0;i<n;++i)
#define rep3(i,a,b) for(ll i=a;i<b;++i)
#define rep4(i,a,b,c) for(ll i=a;i<b;i+=c)
#define rep(...) overload4(__VA_ARGS__,rep4,rep3,rep2,rep1)(__VA_ARGS__)
#define all(i) begin(i), end(i)

const int INF = 0x3fffffff;
const ll MINF = 0x7fffffffffff;
const ld DINF = numeric_limits<ld>::infinity();
const int MOD = 1000000007;
const int MODD = 998244353;
const ld EPS = 1e-9;
const ld PI = 3.1415926535897932;

template<class T> bool chmin(T &a, const T &b){ if(a > b){ a = b; return 1; } else return 0; }
template<class T> bool chmax(T &a, const T &b){ if(a < b){ a = b; return 1; } else return 0; }
template<class T> auto min(const T& a){ return *min_element(all(a)); }
template<class T> auto max(const T& a){ return *max_element(all(a)); }

ll gcd(ll a, ll b){ while(b){ ll c = b; b = a % b; a = c; } return a; }
ll lcm(ll a, ll b){ if(!a || !b) return 0; return a * b / gcd(a, b); }
ll pow_mod(ll n,ll k,ll m){ll r = 1;for(; k > 0;k >>= 1) {if (k & 1) r = (r * n) % m; n = (n * n) % m;}return r;}

//ここから。
int main(){
    int n;
    cin >> n;
    vector<int> dp(n + 10,INF);
    dp[0] = 0;
    rep(i,n+1){
        chmin(dp[i+1],dp[i]+1);
        int num = 6;
        while(i+num < n+1){
            chmin(dp[i+num],dp[i] + 1);
            num *= 6;
        }
        num = 9;
        while(i+num < n+2){
            chmin(dp[i+num],dp[i]+1);
            num *= 9;
        }
    }
    cout << dp[n] << endl;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int N,i,flag;
  flag=0;
  cin >> N;
  vector<int> A(N);
  
  for(i=0;i<N;i++)
  {
    cin >> A.at(i);
  }
  sort(A.begin(),A.end());
  for(i=0;i<N-1;i++)
  {
    if(A.at(i)==A.at(i+1))
    {
      flag=1;
      break;
    }
  }
  if(flag==1)
  {
     cout << "NO" << endl;
  }
  else
  {
    cout << "YES" << endl;
  }
}

Measured memory_bytes: 1024
package main

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

var mod int = 1e9 + 7
var maxMove int = 1e6
var fac = make([]int, maxMove)

func powMod(x, n int) int {
	if n == 0 {
		return 1
	}
	if n%2 == 0 {
		t := powMod(x, n>>1)
		return t * t % mod
	}
	return x * powMod(x, n-1) % mod
}

func main() {
	x, y := readInt(), readInt()

	if (x+y)%3 != 0 || y > 2*x || 2*y < x {
		fmt.Println(0)
		return
	}

	fac[0] = 1
	for i := 1; i < maxMove; i++ {
		fac[i] = fac[i-1] * i % mod
	}

	totalMove := (x + y) / 3
	diff := abs(x - y)
	move := (totalMove - diff) / 2

	fmt.Println(fac[totalMove] * powMod(fac[move]*fac[totalMove-move]%mod, mod-2) % mod)
}

// sort ------------------------------------------------------------

type xxx struct {
	x int
}

type sortArray []xxx

func (s sortArray) Len() int           { return len(s) }
func (s sortArray) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s sortArray) Less(i, j int) bool { return s[i].x < s[j].x }

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

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	readString, readBytes = newReadString(os.Stdin)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

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

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

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func sum(a []int) int {
	var ret int
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumFloat64(a []float64) float64 {
	var ret float64
	for i := range a {
		ret += a[i]
	}
	return ret
}

func gcd(m, n int) int {
	for m%n != 0 {
		m, n = n, m%n
	}
	return n
}

func lcm(m, n int) int {
	return m / gcd(m, n) * n
}


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

int main(int argc, char *argv[]) {
	int num_of_eat = 0;
	int paid = 0;
	int received = 0;

	std::cin >> num_of_eat;
	paid = 800 * num_of_eat;
	received = (num_of_eat / 15) * 200;

	std::cout << (paid - received) << std::endl;
	return 0;
}


Measured memory_bytes: 256
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
long long getDigit(long long n);      // 数字の桁数を取得する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      ((a)/GCD((a),(b))*(b))
#define kiriage(a,b)  ((a)+(b)-1)/(b)

const int INF = 1e9;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;

// code
// ------------------------------------------------
int main()
{

  ll n;
  cin >> n;

  map<ll,ll> m;

  ll mo = 1000000007;

  ll ans = 1;

  // N!の素因数を列挙する
  // ちょっと大きい数になるので、N!を計算する過程でそれぞれの項を素因数分解していく
  rep(i,n)
  {
    ll buf = i + 1;

    for(ll j = 2;j <= buf; j++)
    {
      if(buf % j == 0)
      {
        while(buf % j == 0)
        {
          m[j]++;
          buf /= j;
        }
      }
    }
  }

  for(auto itr = m.begin(); itr!=m.end(); ++itr)
  {
    ans = (ans * (itr->second + 1) % mo) % mo;
  }

  cout << ans << endl;

  return 0;

  return 0;
}
// funcの実体
// ------------------------------------------------
ll getDigit(ll n)
{
  int i = 1;
  while(1)
  {
    n = n / 10;
    if(n == 0)
      break;
    i++;
  }
  return i;
}
ll CalcSumOfDigit(ll n)
{
  ll s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


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

using namespace std;

typedef long long ll;
#define fi first
#define se second
#define pb push_back

const int N = 202;
int a[N];

int main() {
    //ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n, l;
    scanf("%d %d", &n, &l);
    int sum = 0;
    for (int i = 1; i <= n; i++) {
		sum += l + i - 1;
	}
	int res, mn = 1e9, tot = sum;
	for (int i = 1; i <= n; i++) {
		tot -= l + i - 1;
		if (abs(tot - sum) < mn) {
			mn = abs(tot - sum);
			res = tot;
		}
		tot += l + i - 1;
	}
	printf("%d", res);
    return 0;
}


Measured memory_bytes: 3764
#include<iostream>
#include<cstdio>
#include<cstdlib>
#define N 4010
#define mod 1000000007
#define ll long long
using namespace std;
int sum[N],f[N];
int main()
{
	int n,m,k;
	scanf("%d%d%d",&n,&m,&k);
	k--;
	ll ans=0;
	for(int i=0;i<=m;i++) sum[i]=1;
	for(int i=1;i<=(n+m)/k;i++)
	{
		for(int j=1;j<=m;j++)
		{
			if(j>k) f[j]=(sum[j-1]-sum[j-k-1]+mod)%mod;
			else f[j]=sum[j-1];
			if(j%k==m%k && i*k<=n+j-1 && (n+j-1)%k==0)
			ans=(ans+f[j])%mod; 
		}
		for(int j=1;j<=m;j++)
		{
			f[j]=(f[j-1]+f[j])%mod;
			sum[j]=(sum[j]+f[j])%mod;
		}
	}
	printf("%lld\n",ans);
	return 0;
}


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

using namespace std;

int n;
int a[2005];
bitset<4000005> bs;

int main(void)
{
	cin >> n;
	for(int i = 1; i <= n; i++) cin >> a[i];
	
	int sum = 0, mid;
	for(int i = 1; i <= n; i++) sum += a[i];
	mid = (sum+1)/2;
	
	bs[0] = true;
	for(int i = 1; i <= n; i++) bs |= bs << a[i];
	for(int i = mid; i <= 4000000; i++){
		if(bs[i]){
			cout << i << endl;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;

int main() {
    int a, b, x; cin >> a >> b >> x;
    int cnt = 100, V = a * a * b, flag = 1;
    double pi = 3.14159265358979;
    double angle_min = 0.0, angle_max = 90.0;
    if (2 * x < a * a * b) flag = 0;
    while (cnt--) {
        double theta = (angle_min + angle_max) / 2.0;
        if (flag) {
            if (pow(a, 3) * tan(theta / 180.0 * pi) / 2.0 + x < V) angle_min = theta;
            else angle_max = theta;
        } else {
            if (a * b * b * tan((90.0 - theta) / 180.0 * pi) / 2.0 > x) angle_min = theta;
            else angle_max = theta; 
        }
    }
    double ans = angle_min;
    cout << fixed << setprecision(10) << ans << endl;
}

Measured memory_bytes: 512