akhauriyash/Code-Regression huggingface dataset:
//by yjz
#include<bits/stdc++.h>
using namespace std;
#define FF first
#define SS second
#define PB push_back
#define MP make_pair
#define bged(v) (v).begin(),(v).end()
#define foreach(it,s) for(__typeof((s).begin()) it=(s).begin();it!=(s).end();it++)
typedef long long ll;
const int Imx=2147483647;
const ll Lbig=2e18;
const int mod=1e9+7;
//My i/o stream
struct fastio
{
	char s[100000];
	int it,len;
	fastio(){it=len=0;}
	inline char get()
	{
		if(it<len)return s[it++];it=0;
		len=fread(s,1,100000,stdin);
		if(len==0)return EOF;else return s[it++];
	}
	bool notend()
	{
		char c=get();
		while(c==' '||c=='\n')c=get();
		if(it>0)it--;
		return c!=EOF;
	}
}_buff;
#define geti(x) x=getnum()
#define getii(x,y) geti(x),geti(y)
#define getiii(x,y,z) getii(x,y),geti(z)
#define puti(x) putnum(x),putchar(' ')
#define putii(x,y) puti(x),puti(y)
#define putiii(x,y,z) putii(x,y),puti(z)
#define putsi(x) putnum(x),putchar('\n')
#define putsii(x,y) puti(x),putsi(y)
#define putsiii(x,y,z) putii(x,y),putsi(z)
inline ll getnum()
{
	ll r=0;bool ng=0;char c;c=_buff.get();
	while(c!='-'&&(c<'0'||c>'9'))c=_buff.get();
	if(c=='-')ng=1,c=_buff.get();
	while(c>='0'&&c<='9')r=r*10+c-'0',c=_buff.get();
	return ng?-r:r;
}
template<class T> inline void putnum(T x)
{
	if(x<0)putchar('-'),x=-x;
	register short a[20]={},sz=0;
	while(x)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1;i>=0;i--)putchar('0'+a[i]);
}
inline char getreal(){char c=_buff.get();while(c==' '||c=='\n')c=_buff.get();return c;}
int n,m;
int main()
{
	getii(n,m);
	int g=0,mx=0;
	for(int i=1;i<=n;i++)
	{
		int x;
		geti(x);
		mx=max(mx,x);
		g=__gcd(g,x);
	}
	if(m<=mx&&m%g==0)puts("POSSIBLE");
	else puts("IMPOSSIBLE");
	return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
#include<iostream>
#include <cmath>

using namespace std;

int main(){
  int a,b;
  cin >>a>>b;
  
  int ans=-1;
  for(int i=13;i<=1009;i++){
    //cout<<floor(i*0.08)<<" "<<floor(i*0.1)<<endl;
    if(floor(i*0.08)==a && floor(i*0.1)==b){
      ans=i;
      break;
    }
  }
    
  cout<<ans;
        
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define sp ' '
#define nyan "(=^・ω・^=)"
#define mkp make_pair
#define intmax 2147483647
#define llmax 9223372036854775807
#define lP pair<ll,ll>
#define iP pair<int,int>
typedef long long ll;
using namespace std;
const int mod = 1000000007;

string s;
int main() {
	cin >> s;
	for (int i = 0; i < s.size(); i += 2) {
		cout << s[i];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 512
#include <string.h>
#include <stdio.h>
#include <iostream>
#include <string>
#include <cstring>
#include <math.h>
#include <set>
#include <vector>
#include <algorithm>
#include <map>


using namespace std;

typedef long long ll;
#define INF 0x3f3f3f3f
#define ESP 1e-8;
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
const double PI = acos(-1.0);
#define N 200010
char S[N], T[N];
int len;

int idxset[200], char_cnt;
vector<int> vec[27];

int main(){
    int i;
    vector<int>::iterator it;
    while(scanf("%s%s", S+1, T+1)!=EOF){
        memset(idxset, -1, sizeof(idxset));
        char_cnt = 0;
        for(i = 1; i <= 26; i++)
            vec[i].clear();
        len = strlen(S+1);
        for(i = 1; i <= len; i++){
            int ch = S[i];
            if(idxset[ch]!=-1)
                vec[idxset[ch]].push_back(i);
            else{
                idxset[ch] = ++char_cnt;
                vec[char_cnt].push_back(i);
            }
        }

        for(i = 1; i <= len; i++){
            if(S[i]==T[i])
                continue;
            char ch1=S[i], ch2=T[i];
            int idx1=idxset[(int)ch1], idx2=idxset[(int)ch2];
            if(*vec[idx1].begin()<i || (idx2!=-1 && *vec[idx2].begin()<i))
                break;
            for(it=vec[idx1].begin(); it!=vec[idx1].end(); it++)
                S[*it] = ch2;
            if(idx2 != -1){
                for(it=vec[idx2].begin(); it!=vec[idx2].end(); it++)
                    S[*it] = ch1;
            }
            swap(idxset[(int)ch1], idxset[(int)ch2]);
        }

        if(i == len+1)
            printf("Yes\n");
        else
            printf("No\n");
    }

    return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>
#define H 250

int main(){
  int l,i;
  int A[H-1];

  scanf("%d",&l);

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

  for(i=1 ; i<l+1 ; i++){
    printf("node %d: key = %d, ",i,A[i]);
    if(i/2 >= 1){
      printf("parent key = %d, ",A[i/2]);
    }
    if(2*i <= l){
      printf("left key = %d, ",A[2*i]);
    }
    if(2*i+1 <= l){
      printf("right key = %d, ",A[2*i+1]);
    }
    printf("\n");
  }
  return 0;
}



Measured memory_bytes: 2044
#include<bits/stdc++.h>
#define ll long long
#define pii pair<ll,ll> 
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
int n;
ll a[100010];
pii b[100010];
ll c[100010];
ll d[100010];
int main(){
    cin>>n;
    for(int i=1;i<=n+1;i++)
        cin>>a[i],c[i]=a[i];
    for(int i=1;i<=n;i++)
        cin>>b[i].fi,b[i].se=i;
    for(int i=1;i<=n;i++){
        ll now=b[i].fi,pos=b[i].se;
        if(now>=a[pos]){
            now-=a[pos];
            a[pos]=0;
        }
        else
            a[pos]-=now,now=0;
        if(now>=a[pos+1]){
            now-=a[pos+1];
            a[pos+1]=0;
        }
        else
            a[pos+1]-=now,now=0;
    }
    ll ans=0,ans2=0;
    for(int i=1;i<=n+1;i++)
        ans+=c[i]-a[i];
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,n) for(ll i=0;i < (n);i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define SCANF(i) int i;scanf("%d",&i)
typedef long long ll;
using namespace std;
using P = pair<int,int>;
const long long INF = 1LL << 60;
const int IINF=100000000;
const int MOD = (int)1e9 + 7;
//約数列挙
vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    //sort(ret.begin(), ret.end()); // 昇順に並べる
    return ret;
}
vector<int> dx={1,0,-1,0};vector<int> dy={0,-1,0,1};

signed main () {
    ll n;cin >> n;
    vector<ll> tako(n);
    REP(i,n)cin >> tako[i];
    ll ans = 0;
    ll sum = 0;
    REP(i,n){
        sum += tako[i];
        sum %= MOD;
    }
    REP(i,n-1){
        sum -= tako[i];
        if(sum < 0)sum+=MOD;
        ans += (sum* tako[i])%MOD;
        ans %= MOD;
    }
    cout << ans << endl;
}//https://atcoder.jp/contests/abc177/tasks/abc177_c

Measured memory_bytes: 4808
#include <cstdio>
#include <map>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int a,b,c;
    scanf("%d%d%d", &a, &b, &c);
    int r = (a)*100+(b)*10+(c);
    if(r%4==0) printf("YES\n");
    else printf("NO\n");

        return 0;
}

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

const int MOD = 1000000007;

int main() {
    int N, M; cin >> N >> M;
    vector<int> issafe(N+1, true);
    for(int i = 0; i < M; ++i) {
        int a; cin >> a;
        issafe[a] = false;
    }
    
    vector<int> dp(N+1, 0);
    dp[0] = 1;
    if(issafe[1]) dp[1] = 1;
    for(int i = 2; i <= N; ++i) {
        if(issafe[i-1]) dp[i] += dp[i-1];
        if(issafe[i-2]) dp[i] += dp[i-2];
        dp[i] %= MOD;
    }
    
    cout << dp[N] << endl;
}


Measured memory_bytes: 1024
N,M=map(int,input().split())
A=[input() for n in range(N)]
B=[input() for m in range(M)]
wb=len(B[0])
hb=len(B)
for h in range(len(A)-hb+1):
    for w in range(len(A[0])-wb+1):
        f=True
        for b in range(hb):
            if A[h+b][w:w+wb] != B[b]:
                f=False
                break
        if f:
            print('Yes')
            exit()
print('No')



Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>
#include <algorithm>
typedef long long ll;
using namespace std;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
#define repi(i, n, init) for (ll i = init; i < (n); i++)

int main()
{
    int q;
    cin >> q;
    bool prime[int(1e5 + 1)] = {false};
    int sum[int(1e5 + 1)] = {0};
    int l[q], r[q];
    int Ma = 0;
    repi(i, q, 0)
    {
        cin >> l[i] >> r[i];
        Ma = max(Ma, r[i]);
    }
    repi(i, Ma + 1, 2)
    {
        if (!prime[i])
        {
            for (int j = i + i; j <= Ma; j += i)
            {
                prime[j] = true;
            }
        }
    }
    for (int i = 3; i <= Ma; i += 2)
    {
        if (!prime[i] && !prime[(i + 1) / 2])
            sum[i]++;
    }
    repi(i, Ma + 1, 3)
    {
        sum[i + 1] += sum[i];
    }
    repi(ri, q, 0)
    {
        cout << sum[r[ri]] - sum[l[ri] - 1] << endl;
    }

    return 0;
}


Measured memory_bytes: 1920
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
#define ff first
#define ss second
#define inf 2000000007
#define pb push_back
#define MAXN 2019
#define MOD 1000000007
using namespace std;
typedef pair<int,int> pii;

string S[MAXN];
int pre[MAXN][MAXN];
int suf[MAXN][MAXN];
int preC[MAXN][MAXN];
int sufC[MAXN][MAXN];

int32_t main(){
	fastio;
	int H,W;
	cin>>H>>W;
	for(int i=0;i<H;i++){
		cin>>S[i];
	}
	//inicializa 
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			if(j==0){
				if(S[i][j]=='#')pre[i][j]=0;
				else pre[i][j]=1;
			}else{
			if(S[i][j]=='#')pre[i][j]=0;
			else pre[i][j]=1 + pre[i][j-1];
			}
		}
	}
	
	for(int i=0;i<H;i++){
		for(int j=W-1;j>=0;j--){
			if(j==W-1){
				if(S[i][j]=='#')suf[i][j]=0;
				else suf[i][j]=1;
			}else{
			if(S[i][j]=='#')suf[i][j]=0;
			else suf[i][j]=1 + suf[i][j+1];
			}
		}
	}

	// pre e suf da coluna
	
	for(int i=0;i<W;i++){
		for(int j=0;j<H;j++){
			if(j==0){
				if(S[j][i]=='#')preC[j][i]=0;
				else preC[j][i]=1;
			}else{
			if(S[j][i]=='#')preC[j][i]=0;
			else preC[j][i]=1 + preC[j-1][i];
			}
		}
	}
	
	for(int i=0;i<W;i++){
		for(int j=H-1;j>=0;j--){
			if(j==H-1){
				if(S[j][i]=='#')sufC[j][i]=0;
				else sufC[j][i]=1;
			}else{
			if(S[j][i]=='#')sufC[j][i]=0;
			else sufC[j][i] = 1 + sufC[j+1][i];
			}
		}
	}
	
	int res=0;
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			int op1 = pre[i][j]+suf[i][j]+preC[i][j]+sufC[i][j];
		//	cout<<i<<" "<<j<<" "<<pre[i][j]<<" "<<suf[i][j]<<" "<<preC[i][j]<<" "<<sufC[i][j]<<endl;
			if(S[i][j]=='.')op1-=3;
			res=max(res,op1);
			
		}
		
		
	}
	cout<<res<<endl;
	
}

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

string s;
int sum=1;

int main()
{
	cin>>s;
	int l=s.length();
	for(int i=0;i<l-1;i++) {
		if(s[i]==s[i+1]) sum++;
		else sum=1;
		if(sum==3) { cout<<"Yes"<<endl; return 0; }
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
using System;

namespace ConsoleApp6
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int a = int.Parse(input[0]);
            int b = int.Parse(input[1]);
            if (a * b % 2 == 0) Console.WriteLine("Even");
            else Console.WriteLine("Odd");
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n; i >= 0; i--)
#define inf LLONG_MAX
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    string s; cin >> s;
    if (s[2] == s[3] && s[4] == s[5]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
n = int(input())
totalSum = (1+n)*n/2
fizz = ((3+(n//3)*3)/2)*(n//3)
buzz = ((5+(n//5)*5)/2)*(n//5)
fizzbuzz = ((15+(n//15)*15)/2)*(n//15)
print(int(totalSum-fizz-buzz+fizzbuzz))


Measured memory_bytes: 9124
import sys
from collections import deque

def main():
    input = sys.stdin.readline
    N, M = map(int, input().split())
    G = [[] for _ in range(3*N)]
    for _ in range(M):
        u, v = map(int, input().split())
        u, v = u-1, v-1

        G[3*u].append(3*v+1)
        G[3*u+1].append(3*v+2)
        G[3*u+2].append(3*v)

    S, T = map(int, input().split())
    S, T = 3*(S-1), 3*(T-1)

    cnt = 0
    q = deque()
    q.append(S)
    visited = [False] * (3*N)
    visited[S] = True
    while len(q) > 0:
        q_ = deque()
        cnt += 1
        while len(q) > 0:
            n = q.pop()
            for m in G[n]:
                if visited[m]:
                    continue

                if m == T:
                    return cnt // 3

                visited[m] = True
                q_.append(m)

        q = q_

    return -1


if __name__ == '__main__':
    print(main())


Measured memory_bytes: 50628
// 2013/11/05 Tazoe

#include <iostream>
using namespace std;

int main()
{
	for(int i=0; i<4; i++){
		int t, n;
		cin >> t >> n;

		if(t==1){
			cout << 6000*n << endl;
		}
		else if(t==2){
			cout << 4000*n << endl;
		}
		else if(t==3){
			cout << 3000*n << endl;
		}
		else if(t==4){
			cout << 2000*n << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1160
import sys
n, limit = map(int, sys.stdin.readline().split())
L = [list(map(int, sys.stdin.readline().split())) for _ in range(n)]
#print(L)
dp = [{} for i in range(n+1)]

for i in range(n):
    Lw, Lv = L[i][0], L[i][1] 
    dp[i+1][Lv] = min(Lw, dp[i].get(Lv, Lw))          #価値テーブルに重量を入れる
    for v, w in dp[i].items():
        dp[i+1][v] = min(w, dp[i+1].get(v, w)) #上下比較
        tmp_w= min(Lw+ w, dp[i+1].get(Lv+v, Lw+w))
        if tmp_w <=limit:
            dp[i+1][Lv+ v] = tmp_w
        
print(max(dp[-1].keys()))

Measured memory_bytes: 286344
#include<iostream>
#include<algorithm>
using namespace std;
int partition(int a[],int n)
{
   int x=a[n-1];
   int i=-1;
   for(int j=0;j<n-1;j++)
   {
      if(a[j]<=x)
      {
         i++;
         swap(a[j],a[i]);
      }
   }
   swap(a[i+1],a[n-1]);
   return i+1;
}


int main()
{
   int n;
   cin>>n;
   int a[n];
   for(int i=0;i<n;i++)
      cin>>a[i];
   int b=partition(a,n);
   for(int i=0;i<n;i++)
   {
      if(i>0)
         cout<<" ";
      if(i==b)
      {
         cout<<"["<<a[i]<<"]";
         continue;
      }
      cout<<a[i];
   }
   cout<<endl;
   return 0;
}

Measured memory_bytes: 3468
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define space " "
#define MOD (long long) 1000000007
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename T> void __f(const char* variable_name, T&& value){cout << variable_name << ": " << value << endl;}
template <typename T1, typename... T2> void __f(const char* names, T1&& arg1, T2&&... args){const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << ": " << arg1 << " |";__f(comma + 1, args...);}

const ll N = 5e5 + 5;
ll *v;
ll n,a,b,c,k;

void solve(){
    cin >> a >> b >> c >> k;
    if(a >= k)
        cout << k << endl;
    else if(a + b >= k)
        cout << a << endl;
    else
        cout << a + -1 * (k - (a + b)) << endl;
}

int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    ll t = 1;
    // cout << "\n\nBLAH BLAH BLAH\n\n";
    // cin >> t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
 
/********************************************
This code belongs to Pranay Mishra
The following template belongs to Anil Kumar
*******************************************/
 
#define bolt ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define endl "\n"
typedef long long ll;
typedef long double ld;
const int mod = 1000000007;
bool isPrime(ll n){if (n==0 || n==1) return false;for(ll i=2;i*i<=n;++i){if(n%i==0){return false;}}return true;}
ll factorial(ll n){return (n==1 || n==0) ? 1:n*factorial(n-1);}
ll power(ll x,ll y){ll res=1;x=x%mod;while(y>0){if(y&1)res=((res%mod)*(x%mod))%mod;y=y>>1;x=((x%mod)*(x%mod))%mod;}return res;}
ll ncr(ll n,ll r){ll res=1;if(r>n)return 0;if(r>n-r)r=n-r;for(ll i=0;i<r;i++){res=((res%mod)*((n-i)%mod))%mod;res=((res%mod)*(power(i+1,mod-2))%mod)%mod;}return res;}
ll gcd(ll a,ll b){if (a==0)return b;return gcd(b%a,a);}
ll lcm(ll a,ll b){return (a/gcd(a,b)*b);}
ll max(ll a,ll b){ll ans=a>b?a:b;return ans;}
ll min(ll a,ll b){ll ans=a<b?a:b;return ans;}
/***********************************************************************/
/***********************************************************************/
int main()
{
   bolt;
   ll a,b;
   cin>>a>>b;
   ll k=gcd(a,b);
   ll i=2;
   vector<long long int> st;
   if(k % 2 == 0){
       st.push_back(2);
       while(k % 2 == 0){
           k /= 2;
       }
   }
   for(ll i = 3 ; i * i <= k ;  i += 2){
       if(k % i == 0 ){
           st.push_back(i);
           while(k > 1 && k % i == 0 ){
               k /= i;
           }
       }
   }
   if(k > 1){
       st.push_back(k);
   }
   k = st.size() + 1;
   cout<<k;
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;
typedef long long int ll;
const int INF = 1000000000;
const double PI = 3.1415926535897932;
const ll MOD = 1000000007;

int main()
{
    int n;
    cin >> n;
    int cnt = 0;
    for (int i = 1; i <= n; i++) {
        if (i % 2 != 0) cnt++;
    }
    double ans = (double)cnt / (double)n;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
int a;
  scanf("%d",&a);
  if(a%2==0){
    printf("%lf\n",1.0/2);
  }else{
    if(a==1){
      printf("%lf\n",1.0);
    }else{
  		printf("%lf\n",((a/2)+1.0)/(a));
    }
	}
}


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

using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define REPO(i,n) for(int (i)=1; (i)<=(int)(n); (i)++)
#define SZ(v) ((int)(v).size())
#define ALL(v) (v).begin(),(v).end()
#define one first
#define two second
typedef long long ll;
typedef pair<int, int> pi;
const int INF = 0x3f2f1f0f;
const ll LINF = 1ll * INF * INF;

const int MAX_N = 1e5 + 100;

int N; pi List[MAX_N];
ll Ans[MAX_N];
int main() {
	cin >> N;
	REP(i, N) {
		int x; scanf("%d", &x);
		List[i] = pi(-x, i);
	}
	sort(List, List+N);
	REP(i, N) List[i].one *= -1;

	int ix = N+1, cnt = 0, h = INF;
	REP(i, N) {
		Ans[ix] += 1ll * cnt * (h - List[i].one);
		ix = min(ix, List[i].two);
		cnt++; h = List[i].one;
	}
	Ans[ix] += 1ll * cnt * h;
	REP(i, N) printf("%lld\n", Ans[i]);
	return 0;
}

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

int main(void){
  int n,i,j,a,sakki,ans = 1;
  char S[100][11];
  scanf("%d",&n);
  for (i = 0;i < n;i++) {
      scanf("%s",S[i]);
  }
  sakki = strlen(S[0]);
  for (i = 1;i < n;i++) {
      if (S[i][0] != S[i - 1][sakki - 1]) {
          ans = 0;
          break;
      } else {
          for (j = 0;j < i;j++) {
            a = strcmp(S[i],S[j]);
            if (a == 0) {
                ans = 0;
                break;
            }
          }
      }
      if (ans == 0) break;
      sakki = strlen(S[i]);
  }
  if (ans == 1) {
      printf("Yes\n");
  } else {
      printf("No\n");
  }
  return 0;
}


Measured memory_bytes: 128
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  string S;
  cin >> S;
  if (S.size() == 2) {
    cout << S << endl;
  } else {
    reverse(S.begin(), S.end());
    cout << S << endl;
  }
  return 0;
}

Measured memory_bytes: 3600
import sys
from pprint import pprint

import bisect

n = int(sys.stdin.readline().strip())
l = map(int, sys.stdin.readline().strip().split(" "))
l = sorted(l)
# pprint(l)

ans = 0
for i, l_i in enumerate(l[:-2]):
    for j, l_j in enumerate(l[:-1]):
        if j <= i:
            continue
        index = bisect.bisect_left(l, l_i + l_j)
        # print(l_i + l_j, index)
        # print("ij", i, j)
        ans += index - (j+1)
        
print(ans)

Measured memory_bytes: 48092
#include<bits/stdc++.h>
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

int main()
{
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	ll h;
	scanf("%lld",&h);
	ll cnt=1,ans=0;
	while(h>1)
	{
		ans+=cnt;
		cnt<<=1;
		h>>=1;
	}
	cout<<cnt+ans<<endl;
	return 0;
}


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

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    int i;
    for(i = 0; i < n; i++){
        cin >> a.at(i);
    }
    int re = a.at(0);
    int cnt = 0;
    int cnt2 = 0;
    for(i = 1; i < n; i++){
        if(a.at(i) <= re){
            cnt++;
        }
        else{
            if(cnt > cnt2){
                cnt2 = cnt;
            }
            cnt = 0;
        }
        re = a.at(i);
    }
    if(cnt > cnt2){
        cnt2 = cnt;
    }
    cout << cnt2 << endl;
    return 0;
}


Measured memory_bytes: 640
#!/usr/bin/env python3
def main():
    N = int(input())
    A = list(map(int, input().split()))
    pos = []
    neg = []
    for i in range(N):
        if A[i] >= 0:
            pos.append(A[i])
        else:
            neg.append(A[i])
    pos.sort()
    neg.sort(reverse=True)
    
    ans = []
    if len(pos) == 0:# 負だけ
        print(-sum(neg)+2*neg[0])
        now = neg[0]
        for i in range(1,N):
            print(now,neg[i])
            now -= neg[i]
    elif len(neg) == 0:# 正だけ
        print(sum(pos)-2*pos[0])
        now = pos[0]
        for i in range(1,N-1):
            print(now,pos[i])
            now -= pos[i]
        print(pos[N-1],now)
    else:
        p = 0
        n = 1
        ans = []
        now = pos[p]
        while n < len(neg):
            ans.append((now,neg[n]))
            now -= neg[n]
            n += 1
        
        p += 1
        now2 = neg[0]
        while p < len(pos):
            ans.append((now2,pos[p]))
            now2 -= pos[p]
            p += 1
        
        ans.append((now,now2))
        print(now-now2)
        for a in ans:
            print(a[0],a[1])

if __name__ == "__main__":
    main()

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

// Macros
#define F  first
#define S  second
#define PB push_back

// Rename Datatypes
using ll  = long long;
using ld  = long double;
using pii = pair<int,int>;

// Common Functions
ll fastpow(ll a, ll ex){ ll res = 1; while(ex){ if(ex & 1) res *= a; a *= a; ex >>= 1; } return res; }
ll fastpow(ll a, ll ex, ll m){ a %= m; ll res = 1; while(ex){ if(ex & 1) res = (a*res) % m; a = (a*a) % m; ex >>= 1; } return res; }
ll modinverse(ll a, ll m){ ll m0 = m, y = 0, x = 1; while (a > 1){ ll q = a / m; a %= m; swap(a,m); x -= q*y; swap(x,y); } if(x < 0) x += m0; return x; }

// HELPERS
//  Tedious Grid Movements
vector<pii> moves_grid = { {0,1} , {0,-1} , {1,0} , {-1,0} };
inline bool move_okay(int x, int y, int n, int m) { return 0 <= x and x < n and 0 <= y and y < m; }
//  Remember:
//   * vec.assign() GOOD; vec.resize() BAD
//   * comparator uses <

// Output, Common Containers
template <typename T> ostream& operator << (ostream& os, const vector<T>& v) { for (T i : v) os << i << ' '; return os; }
template <typename T> ostream& operator << (ostream& os, const set<T>& v)    { for (T i : v) os << i << ' '; return os; }
template <typename T, typename S> ostream& operator << (ostream& os, const pair<T,S>& v) { os << "(" << v.F << "=>" << v.S << ") "; return os; }
template <typename T, typename S> ostream& operator << (ostream& os, const map<T,S>& v)  { for (auto i : v) os << i << ' '; return os; }

// Debugging
#ifdef SANYAM1101
	#define trace(args...) do{ cerr << "Trace On! (Line: " << __LINE__ << ")\n"; d_f(string(#args), args); } while(0)
	void d_f(__attribute__((unused)) string str) {}
	template<typename Head, typename... Tails> void d_f(string str, Head H, Tails... T) { cerr << "\t" << str.substr(0, str.find(", ")) << " <=> [" << H << "]\n"; d_f(str.substr(str.find(", ") + 2), T...); }
#else
	#define trace(args...)
#endif


// CODE STARTS HERE

void solve(){
	string s;
	cin >> s;

	int n = s.size();

	auto palin = [](auto& str){
		auto x = str;
		reverse(x.begin(), x.end());
		return x == str;
	};

	string s1 = s, s2 = s.substr(0, (n - 1) / 2), s3 = s.substr((n + 3) / 2 - 1);

	cout << (palin(s1) and palin(s2) and palin(s3) ? "Yes" : "No") << "\n";
}

signed main (void){
	// Fast_IO
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	// Set Fixed Notation (default sucks), High Precision for Floating-Point Output
	cout << fixed << setprecision(20);

	// Multiple TCs
	int tt = 1;
	// cin >> tt;
	while(tt--) solve();
}


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

int main() {
  int N,K;
  cin >> N >> K;
  vector<int> l(N);
  for (int i = 0; i < N; i++) {
    cin >> l[i];
  }
  sort(l.begin(),l.end(), greater<int>());
  int sum = 0;
  for (int i = 0; i < K; i++) {
    sum += l[i];
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
      int x1 = scan.nextInt();
      int x2 = scan.nextInt();
      int x3 = scan.nextInt();
      int x4 = scan.nextInt();
      int x5 = scan.nextInt();
      int ans = 0;
      
      if(x1 == 0)
        ans = 1;
      else if(x2 == 0)
        ans = 2;
      else if(x3 == 0)
        ans = 3;
      else if(x4 == 0)
        ans = 4;
      else
        ans = 5;
      
      System.out.println(ans);
   }
}

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

using namespace std;

/**templates**/
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;

#define si(x) scanf("%d",&x)
#define sl(x) scanf("%lld",&x)
#define sull(x) scanf("%llu",&x)
#define sf(x) scanf("%lf",&x)
#define ss(x) scanf(" %s",x)
#define sc(x) scanf(" %c",&x)
#define pi acos(-1.0)
#define pb push_back
#define aa first
#define bb second
#define sz(x) (ll)(x).size()
#define cas printf("Case %lld: ",++t)
#define casline printf("Case %lld:\n",++t)
//#define cas cout<<"Case "<<++t<<": "
//#define casline cout<<"Case "<<++t<<":"<<endl;
#define distance(x1,y1,x2,y2)((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))
#define endl "\n"
#define bug cout<<"bugggggggggggg "<<endl;
#define fast ios_base::sync_with_stdio(0);cin.tie(nullptr); ///no printf/scanf
#define clean fflush(stdout)

const ll mod = 1000000007;
const ll inf = 1LL<<62;
const ll mx = 100005;
const double eps = 1e-10;

ll dx[10]={1,0,-1,0};
ll dy[10]={0,-1,0,1};
///ll dx[] = {1,-1,0,0,1,1,-1,-1} , dy[] = {0,0,1,-1,1,-1,1,-1}; /// 8 Direction
///ll dx[] = {1,-1,1,-1,2,2,-2,-2} , dy[] = {2,2,-2,-2,1,-1,1,-1}; /// Knight Direction

ll power(ll a,ll b)
{
    if(b==0)return 1;
    ll x=power(a,b/2);
    x=x*x;
    if(b%2)x=x*a;
    return x;
}

ll bigmod(ll a,ll b)
{
    if(b==0)return 1;
    ll x=bigmod(a,b/2)%mod;
    x=(x*x)%mod;
    if(b%2)x=(x*a)%mod;
    return x;
}

ll Set(ll N,ll pos){return N=N | (1LL<<pos);}
ll reset(ll N,ll pos){return N= N & ~(1LL<<pos);}
bool check(ll N,ll pos){return (bool)(N & (1LL<<pos));}

/**
        ...ENDING OF TEMPLATE...
*/

int main()
{
//    freopen("in.txt","r",stdin);
//    freopen("out.txt","w",stdout);
//    fast; ///no printf/scanf
    /** Use "long double"(%Lf) instead of double for precision safety*/
    ll tst,a,b,c,k,n,m,ans=0,t=0;
    double num;
    sl(a),sf(num);
    b=num*100 + 0.1;
    ll res = (a*b)/100;
//    cout<<a<<" "<<b<<" "<<res<<endl;
    cout<<res<<endl;



    return 0;
}


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

vector<int> merge(vector<int> a ,vector<int> b){
  a.insert(a.end(), b.begin(), b.end());
  std::sort(a.begin(),a.end());
  vector<int> temp = {a[3],a[2]};
  return temp;
}

int main(){
  int n;
  cin >> n;
  vector<int> a(1 << n);
  vector<int> ans(1 << n);
  for (int i = 0;i < 1 << n;i++){
    cin >> a.at(i);
  }
  vector<vector<int>> max(1 << n);
  for (int i = 0 ; i < 1 << n ; i++){
    max[i].resize(2);
    max[i][0] = a[i];
  }
  for (int i = 0 ; i < n ; i++){
    for (int j = 0 ;j < 1 << n ; j++){
      if (j & (1 << i)){
	vector<int> temp = merge(max[j],max[j^(1<<i)]);
	max[j] = temp;
      }
    }
  }
  for (int i = 1 ; i < 1 << n ; i++){
    ans[i] = std::max(max[i][0]+max[i][1],ans[i-1]);
    cout << ans[i] << endl;
  }
}

Measured memory_bytes: 19456
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>

using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, f, n) for (int i = (f); i < (n); i++)
ll const INF = 1LL << 60;

int main() {
    ll N, A, B;
    cin >> N >> A >> B;

    string S;
    cin >> S;

    int passcnt = 0;
    int passcnt_abroad = 0;

    for (int i = 0; i < S.length(); i++) {
        if (S[i] == 'a') {
            if (passcnt < A+B) {
                cout << "Yes" << endl;
                passcnt++;
            } else {
                cout << "No" << endl;
            }
        } else if (S[i] == 'b') {
            if (passcnt < A+B && passcnt_abroad < B) {
                cout << "Yes" << endl;
                passcnt++;
                passcnt_abroad++;
            } else {
                cout << "No" << endl;
            }
        } else if (S[i] == 'c') {
            cout << "No" << endl;
        }        
    }

    return 0;
}

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

using namespace std;

using ll = long long;

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

    int n, m;
    string s;

    cin >> n >> m >> s;
    vector<vector<int>> adj(n);
    vector<int> deg_a(n), deg_b(n);
    for (int i = 0, u, v; i < m; ++i) {
        cin >> u >> v;
        adj[u - 1].push_back(v - 1);
        adj[v - 1].push_back(u - 1);
        if (s[v - 1] == 'A') ++deg_a[u - 1];
        else ++deg_b[u - 1];
        if (s[u - 1] == 'A') ++deg_a[v - 1];
        else ++deg_b[v - 1];
    }

    int size = 0;
    queue<int> rm;
    for (int v = 0; v < n; ++v)
        if (deg_a[v] == 0 || deg_b[v] == 0) {
            ++size;
            rm.push(v);
        }

    while (!rm.empty()) {
        const int v = rm.front(); rm.pop();
        for (auto u : adj[v]) {
            if (deg_a[u] == 0 || deg_b[u] == 0) continue;

            if (s[v] == 'A') {
                --deg_a[u];
                if (deg_b[u] != 0 && deg_a[u] == 0) {
                    rm.push(u);
                    ++size;
                }
            }
            else {
                --deg_b[u];
                if (deg_a[u] != 0 && deg_b[u] == 0) {
                    rm.push(u);
                    ++size;
                }
            }
        }
    }

    if (size == n) cout << "No\n";
    else cout << "Yes\n";

    return 0;
}


Measured memory_bytes: 12240
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#define forn(i, n) for (long long i = 0; i < (long long) (n); ++i)
#define pb emplace_back
#define endl '\n'

template<typename T> void _dbg(const char*_s,T _h) { cerr<<_s<<" = "<<_h<<"\n"; }

template<typename T, typename... Ts> void _dbg(const char*_s,T _h,Ts... _t) {
    for(int _b=0;((_b+=*_s=='(')-=*_s==')')!=0||*_s!=',';)cerr<<*_s++;
    cerr<<" = "<<_h<<",";_dbg(_s+1,_t...);
}

#define int long long

#ifdef LOCAL
    #define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
    #define dbg(...)
#endif

const int N = 500 * 1000 + 17;
const int MOD = 1000 * 1000 * 1000 + 7;

int n;

bool read() {
    if (!(cin >> n))
        return false;

    return true;
}

void solve(int id = 0) {
    int ans = 0;

    forn (i, n + 1)
        if (i % 3 && i % 5)
            ans += i;

    cout << ans << endl;
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int T;
    T = 1;

    while (read())
        solve(T++);

    return 0;
}



Measured memory_bytes: 3612
a, b, c, d = list(map(int, input().rstrip().split()))

i = 0
result = None

while not result:
    if i % 2 == 0:
        c = c - b
        if c <= 0:
            result = 'Yes'
    else:
        a = a - d
        if a <= 0:
            result = 'No'

    i = i + 1

print(result)



Measured memory_bytes: 9072
n = int(input())
a = list(map(int, input().split()))
s = [a[0]]
for i in range(1, n):
    s.append(s[i - 1] + a[i])
ans = 10000000000000000000000000000000000000
for i in range(n-1):
    ans = min(ans, abs(s[i] - (s[n - 1] - s[i])))
print(ans)


Measured memory_bytes: 24828
#include <bits/stdc++.h>
 
using namespace std;
#define pb push_back
//#define mp make_pair
typedef long long int ll;

int ver[100001];

int main(){
    int n,m;
    scanf("%d%d",&n,&m);
    int a,b;
    for(int i = 0;i<m;i++){
        scanf("%d%d",&a,&b);
        ver[a]++;
        ver[b]++;
    }
    for(int i = 1;i<=n;i++){
        if(ver[i]%2==1){
            cout<<"NO";
            return 0;
        }
    }
    cout<<"YES";
    return 0;
}

Measured memory_bytes: 640
program kadai
implicit none
integer  ::  n,j
integer,allocatable  ::  w(:)
integer  ::  si(2)
integer  ::  ans1,ans2


read(*,*) n
allocate(w(n))
w=0
read(*,*) w
si=0
do j=1,n-1
    si(1)=sum(w(1:j))
    si(2)=sum(w(j+1:n))
    ans2=abs(si(1)-si(2))
    if (j==1) then
        ans1=ans2
    end if
    if(ans1>ans2 .and. j>1) then
        ans1=ans2
    end if
end do

write(*,*) ans1

end program kadai

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

#define rep(i,n) for(int i=0;i<(n);++i)

using namespace std;

int main () {
	string s1, s2, s3; cin >> s1 >> s2 >> s3;
	cout << s1[0] << s2[0] << s3[0] << '\n';

	return 0;

}

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

class UnionFind{
    public:
    //親の番号を格納する。親だった場合は-(その集合のサイズ)
    vector<int> parent;

    //-1で初期化
    //最初はすべてバラバラ
    UnionFind(int N){
        parent = vector<int>(N,-1);
    }

    //Aがどのグループに属しているか(Aの根)を調べる
    int root(int A){
        if(parent[A] < 0) return A;
        return parent[A]=root(parent[A]);
    }

    //自分のいるグループの頂点数を調べる
    int size(int A){
        return -parent[root(A)];
    }

    //AとBをくっつける
    bool connect(int A, int B) {
    //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        //既にくっついているからくっつけない
        if(A == B) return false; 

        //大きいほう(A)に小さいほう(B)をくっつける
        //大証が逆ならひっくり返す
        if(size(A) < size(B)) swap(A,B);

        //Aのサイズを更新する
        parent[A] += parent[B];
        //Bの親をAに変更する
        parent[B] = A;

        return true;
    }

    //AとBが同じグループならtrueを返す
    bool same(int A, int B){
        return root(A)==root(B);
    } 
};

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

    for(int i=0;i<m;i++){
        UnionFind uni(n);
        for(int j=0;j<m;j++){
            if(j!=i){
                uni.connect(a[j],b[j]);
            }
        }
        for(int j=1;j<n;j++){
            if(!uni.same(0,j)){
                ans++;
                break;
            }
        }
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 256
def c_colorful_leaderboard(N, A):
    from collections import defaultdict
    rating_list = defaultdict(int)
    rating_color = ['gray', 'brown', 'green',
                    'skyblue', 'blue', 'yellow', 'orange', 'red']  # AtCoderのレート色
    other = 0  # レート3200以上の選手の数
    for rating in A:
        r = rating // 400  # レート色は400刻みで変わるため
        if r >= 8:  # レート3200位上
            other += 1
        else:
            rating_list[rating_color[r]] += 1
    ans = '{} {}'.format(max(1, len(rating_list)), len(rating_list) + other)
    return ans

N=int(input())
A=[int(i) for i in input().split()]
print(c_colorful_leaderboard(N, A))

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, M;
  cin >> N >> M;
  vector<int> X(M);
  for (int i = 0; i < M; i++){
    cin >> X[i];
  }
  if (N >= M){
    cout << 0 << endl;
  } else {
    sort(X.begin(), X.end());
    vector<int> d(M - 1);
    for (int i = 0; i < M - 1; i++){
      d[i] = X[i + 1] - X[i];
    }
    sort(d.begin(), d.end());
    int ans = 0;
    for (int i = 0; i < M - N; i++){
      ans += d[i];
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<string>
#include<bitset>
#include<algorithm>
#include <map>
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

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

	long long number;
	number = abs(X) / D;
	if (number > K)
		number = K;
	if (X > 0)
		X = X - D * number;
	else
		X = X + D * number;
	K -= number;
	K = K % 2;
	if (K == 1) {
		if (X >= 0)
			X -= D;
		else
			X += D;
	}

	cout << abs(X) << endl;
	return 0;
}

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

using ll = long long;
using P = pair<int, int>;
#define rep1(i,n) for (int i=1; i<=n; i++)
#define rep0(i,n) for (int i=0; i<n; i++)
#define zarray(x,n) x[n+1]; rep1(i,n) {x[i]=0;} 

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

    string ans;
    ans = 'a';
    for (auto ch : "ABCDEFGHIJKLMNOPQRSTUVWXYZ") {
        if (ch == x[0]) {
            ans = 'A';
            break;
        }
    } 
    cout << ans << endl;
}


Measured memory_bytes: 3620
#include<iostream>
#include<math.h>
using namespace std;
bool rev(int x){
    int y;
    y=(x%10)*10000+((x/10)%10)*1000+((x/100)%10)*100
    +((x/1000)%10)*10+((x/10000)%10);
    if(y==x) return 1;
    else return 0;
}
main(){
    int ans;
    int a,b;
    cin>>a;
    cin>>b;
    for(int i=a;i<=b;i++){
        if(rev(i)) ans++;
    }
    cout<<ans;
  return 0;
    }

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

using namespace std;

#define FAST_IO ios_base::sync_with_stdio(0); \
				cin.tie(0); \
				cout.tie(0)
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(_v)             _v.begin(), _v.end()
#define sz(_v)              (int) _v.size()
#define first(_obj)         (*_obj.begin())
#define last(_obj)          (*prev(_obj.end()))
#define FIND(_obj, _val)    (_obj.find(_val) != _obj.end())
#define RESET(_a, _v)       fill_n(_a,sizeof(_a)/sizeof(_a[0]),_v)
#define REP(_i, _n)         for (int _i = 0; _i < (int) _n; _i++)
#define FOR(_i, _a, _b)     for (int _i = (int) _a; _i <= (int) _b; _i++)
#define FORD(_i, _a, _b)    for (int _i = (int) _a; _i >= (int) _b; _i--)
#define FORIT(_it, _obj)    for (auto _it = _obj.begin(); _it != _obj.end(); _it++)

// DEBUG UTIL
template<typename TF>
void debug(ostream &out, TF const &f) {
    out << f << std::endl;
}
 
template<typename TF, typename ... TR>
void debug(ostream &out, TF const &f, TR const& ... rest) {
    out << f << " ";
    debug( out, rest... );
}
 
#define DEBUG(...) debug(cerr, "[", #__VA_ARGS__, "]:", __VA_ARGS__)

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using pdd = pair<double,double>;
using vi = vector<int>;
using vii = vector<pii>;
using vll = vector<ll>;
using vs = vector<string>;

const int DR[] = {-1, 0, 1, 0, -1, 1, 1, -1}; // ccw
const int DC[] = {0, -1, 0, 1, -1, -1, 1, 1};
const double PI = acos(-1.0);
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = 1073741823;
const ll INFLL = 4e18;
const int MAX = 1e5;
const int NMAX = 100;

int N, K, mv[NMAX+5], dp[MAX+5], grundy[NMAX+5];

void read() {
	cin >> N >> K;
	REP(i, N) cin >> mv[i];
}

void solve() {
	dp[0] = 0;

	FOR(i, 1, K) {
		REP(j, N) {
			if (i - mv[j] < 0) break;
			grundy[dp[i - mv[j]]] = i;
		}

		FOR(j, 0, NMAX+3)
			if (grundy[j] != i) {
				dp[i] = j;
				break;
			}
	}

	cout << (dp[K] ? "First\n" : "Second\n");
}

int main() {
	FAST_IO;
	int TC = 1;
	FOR(tc, 1, TC) {
		read();
		solve();
	}
}

Measured memory_bytes: 640
#include<map>
#include<bits/stdc++.h>
#include<string>
#include<algorithm>
typedef long long int ll;
using namespace std;
#define MAXN 100005
#define X first
#define Y second
#define MOD 1000000007
#define inf 1e18
#define fr(a,b,c) for(ll a=b;a<c;++a)
#define pb push_back
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
ll t,n,i,j;

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'

using namespace std;

int n, k, a;
int arr[1000005];
int dp[1000005];

int costo(int x, int y)
{
    return abs(x - y);
}

void imprimir(int a[])
{
    for(int i = 0; i < n; i++)
    {
        cout << a[i] << " ";
    }
    cout << endl;
}

void inicializar()
{
    for(int i = 0; i < n; i++)
    {
        dp[i] = INT_MAX;
    }
    dp[0] = 0;
}

int solucion()
{
    inicializar();
    for(int i = 0; i < n; i++)
    {
        for(int j = 1; j <= k; j++)
        {
            dp[i + j] = min(dp[i + j], dp[i] + costo(arr[i], arr[i + j]));
        }
    }
    //imprimir(dp);
    return dp[n - 1];
}

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

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

    int resp = solucion();

    cout << resp << endl;
}


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

int main() {
  string S;
  cin >> S;
  int first = stoi(S.substr(0, 2)), second = stoi(S.substr(2, 2));
  bool first_mm = (1<=first && first<=12),
       second_mm = (1<=second && second<=12);
  if (first_mm) {
    if (second_mm) cout << "AMBIGUOUS";
    else cout << "MMYY";
  } else {
    if (second_mm) cout << "YYMM";
    else cout << "NA";
  }
  cout << endl;
}

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

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

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

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

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	a, b, c := nextInts(n), nextInts(n), nextInts(n-1)
	ans := 0
	for i := 0; i < n; i++ {
		ans += b[a[i]-1]
		if i < n-1 && a[i+1] == a[i]+1 {
			ans += c[a[i]-1]
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename Q_temp>
using smaller_queue = priority_queue <Q_temp, vector<Q_temp>, greater<Q_temp> >;

const int INF = (int) 1e9;
const ll LINF = (ll) 4e18;
const ll MOD = (ll) (1e9 + 7);
const double PI = acos(-1.0);

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbg2(x_) for(auto a_ : x_) cerr << a_ << " "; cerr << endl;
#define dbg3(x_ , sx_) rep(i, sx_) cerr << x_[i] << " "; cerr << endl;
vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

inline ll CEIL(ll a, ll b) {
    return (a + b - 1) / b;
}

void finish() {
    cout << -1 << endl;
    exit(0);
}

//------------------------------------------------------
const ll MAX_N = 200010;
ll fact[MAX_N];
ll fact_inv[MAX_N];

ll pow_mod(ll x, ll y, ll m = MOD) { //x^y mod m
    if (x == 0) return 0;
    ll prod = 1;
    while (y > 0) {
        if (y % 2 == 1) prod = (prod * x) % m;
        x = (x * x) % m;
        y /= 2;
    }
    return prod % m;
}

inline ll inv(ll a) {
    return pow_mod(a, MOD - 2);
}

void init_fact() {
    fact[0] = fact_inv[0] = 1;

    REP(i, 1, MAX_N) {
        fact[i] = (fact[i - 1] * i) % MOD;
        fact_inv[i] = inv(fact[i]);
    }
}

ll C_mod(ll n, ll r) {
    if (n < r) return 0;
    else return ((fact[n] * fact_inv[n - r]) % MOD * fact_inv[r]) % MOD;
}

inline ll H_mod(ll n, ll r) {
    return C_mod(n + r - 1, r);
}

inline ll P_mod(ll n, ll r) {
    return C_mod(n, r) * fact[r];
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, k;
    cin >> n >> k;
    if (n == k) {
        cout << 1 << endl;
        rep(i, k - 1) cout << 0 << endl;
        return 0;
    }
    init_fact();


    for (ll i = 1; i <= k; ++i) {
        ll ans = 1;
        ans *= C_mod(k - 1, i - 1);
        ans %= MOD;
        ll sum = 0;
        if (k == 1) {
            sum = 2;
        } else {
            if (i - 2 >= 0) sum += C_mod(n - k - 1, i - 2);
            sum += C_mod(n - k - 1, i - 1)*2;
            sum += C_mod(n - k - 1, i);
        }
        ans *= sum % MOD;
        ans %= MOD;
        cout << ans << endl;
    }
    return 0;
}



Measured memory_bytes: 3456
local s = io.read()
local t = {}
for i = 1, 26 do
  t[i] = false
end
for i = 1, #s do
  local z = s:sub(i, i):byte() - 96
  t[z] = true
end
local f = true
for i = 1, 26 do
  if not t[i] then print(string.char(96 + i)) f = false break end
end
if f then print("None") end


Measured memory_bytes: 760
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		
		int[] a = new int[n];
		
		for (int i = 0; i < n; i++) {
			
			a[i] = sc.nextInt();
			
		}
		
		Arrays.sort(a);
		
		int alice = 0, bob = 0;
		
		for (int i = n - 1, cnt = 1; i >= 0; i--, cnt++) {
			
			if (cnt % 2 == 1) {
				
				alice += a[i];
				
			} else {
				
				bob += a[i];
				
			}
			
		}
		
		System.out.println(alice - bob);
		
	}

}

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

int main()
{
	int p, q, r, x, y, z;
	scanf("%d %d %d", &p, &q, &r);
	x = p + q; y = p + r; z = q + r;
	printf("%d\n", min(x, min(y, z)));
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		int c = sc.nextInt();

		int[] b = new int[m];
		int[][] a = new int[n][m];

		for (int i = 0; i < m; i++) {
			b[i] = sc.nextInt();
		}

		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				a[i][j] = sc.nextInt();
			}
		}

		int count = 0;

		for (int i = 0; i < n; i++) {
			int cal = 0;
			for (int j = 0; j < m; j++) {
				cal += a[i][j] * b[j];
			}
			if (cal + c > 0) {
				count++;
			}
		}

		System.out.println(count);

	}

}

Measured memory_bytes: 36396
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define MAX(a, b, c) max(max(a, b), c)
using namespace std;

int main(){
  int n;
  scanf("%d",&n);
  int d[n];
  REP(i,n) scanf("%d",&d[i]);
  sort(d,d+n);
  	
  int cnt = 0;
  if(d[n/2-1] < d[n/2]){
  	for(int i=d[n/2-1]+1; i<=d[n/2]; i++) cnt++;
  }
  printf("%d\n",cnt);

}

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

using namespace std;

int mergeSort(int left, int right)
{
  if(left + 1 < right) {
    int mid = (left + right) >> 1;
    return (mergeSort(left, mid) + mergeSort(mid, right) + right - left);
  } else {
    return (0);
  }
}

int main()
{
  int N, A[500000];
  scanf("%d", &N);
  for(int i = 0; i < N; i++) scanf("%d", &A[i]);
  sort(A, A + N);
  for(int i = 0; i < N; i++) {
    if(i > 0) putchar(' ');
    printf("%d", A[i]);
  }
  putchar('\n');
  printf("%d\n", mergeSort(0, N));
}

Measured memory_bytes: 5180