akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll N, L;
    cin >> N >> L;
    vector<string> S(N);
    rep(i, N) cin >> S[i];
    sort(S.begin(), S.end());
    rep(i, N) {
        cout << S[i];
    }
    cout << '\n';
}

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


Measured memory_bytes: 256
/**
 *    Coded by : lucky_21
 *               --------Lokesh Singh
**/

#include<bits/stdc++.h>
using namespace std;

#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

#define     F           first
#define     S           second
#define     pb          push_back
#define     lb          lower_bound
#define     ub          upper_bound
#define     pii         pair<int,int>
#define     all(x)      x.begin(),x.end()
#define     fix         fixed<<setprecision(10)
#define     rep(i,a,b)  for(int i=int(a);i<=int(b);i++)
#define     repb(i,b,a) for(int i=int(b);i>=int(a);i--)
#define     FastIO      ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)

typedef double db;
typedef long long ll;

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

signed main(){
    FastIO;
    int n,k;
    cin>>n>>k;
    vector<int>v(n);
    for(int &i:v) cin>>i;
    sort(all(v));
    int ans=0;
    rep(i,0,k-1) ans+=v[i];
    cout<<ans;
    return 0;
}


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

int main() {
    int n, x = 0, max = 0;
    char *s;

    scanf("%d", &n);
    s = (char *)malloc(sizeof(char) * n + 1);
    scanf("%s", s);

    for (int i = 0; i < n; i++) {
        if (*(s + i) == 'I') {
            x++;
        } else if (*(s + i) == 'D') {
            x--;
        }
        if (max < x) {
            max = x;
        }
    }
    printf("%d\n", max);

    if (s != NULL) {
        free(s);
        s = NULL;
    }
    return 0;
}


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

#define MAX_N 100000
#define MAX_A 1000000000

long long int valid_num = 0;
long long int valid[MAX_N];

long long int hash[MAX_N*10];

long long int rehash_f(long long int num, int plus_num){
	return (num + plus_num + rand()) % (MAX_N*10);
}

long long int hash_f(long long int num)
{
	srand(10);
	int b = (num + rand()) % (MAX_N*10);
	if(hash[b] == num){
		hash[b] = 0;
		valid[valid_num] = num;
		valid_num++;
	}
	else if(hash[b] != 0){
		for(int i = 1; hash[b] != 0; i++){
			b = rehash_f(num, i);
			if(hash[b] == num){
				hash[b] = 0;
				valid[valid_num] = num;
				valid_num++;
			}
		}
		hash[b] = num;
	}
	else {
		hash[b] = num;
	}
}

int main()
{
	long long int a[MAX_N];
	long long int N;
	long long int s;

	for(int i = 0; i < N; i++){
		hash[i] = 0;
	}

	scanf("%lld", &N);
	for(int i = 0; i < N; i++){
		scanf("%lld", &a[i]);
		hash_f(a[i]);
	}

	if(valid_num >= 2){
		long long int tmp = valid[0];
		long long int max_i = 0;
		for(int i = 1; i < valid_num; i++){
			if(tmp < valid[i]){
				tmp = valid[i];
				max_i = i;
			}
		}
		valid[max_i] = 0;
		s = tmp;
		tmp = valid[0];
		max_i = 0;
		for(int i = 1; i < valid_num; i++){
			if(tmp < valid[i]){
				tmp = valid[i];
				max_i = i;
			}
		}
		s = s * tmp;

		printf("%lld\n", s);
	} else {
		printf("0\n");
	}
	return 0;
}

Measured memory_bytes: 9088
def e_dividing_chocolate():
    # 参考: https://note.com/tanon_cp/n/ne70a87d249ed
    H, W, K = [int(i) for i in input().split()]
    Choco = [list(input()) for _ in range(H)]

    # 左上のマスを (0, 0)、右下のマスを (col, row) としたとき、2 点で張られる
    # 長方形区間の内部に含まれる 1 (ホワイトチョコレートのマス) の数を累積和で管理
    cumsum = [[0] * W for _ in range(H)]
    for row in range(H):
        for col in range(W):
            if Choco[row][col] == '1':
                cumsum[row][col] += 1
            if row != 0:
                cumsum[row][col] += cumsum[row - 1][col]
            if col != 0:
                cumsum[row][col] += cumsum[row][col - 1]
            if row != 0 and col != 0:
                cumsum[row][col] -= cumsum[row - 1][col - 1]

    def count_white_chocolate(x1, y1, x2, y2):
        """左上のマスを (x1, y1)、右下のマスを (x2, y2) としたとき、2 点で張られる
        長方形区間の内部に含まれる 1 (ホワイトチョコレートのマス) の数"""
        ret = cumsum[y2][x2]
        if x1 != 0:
            ret -= cumsum[y2][x1 - 1]
        if y1 != 0:
            ret -= cumsum[y1 - 1][x2]
        if x1 != 0 and y1 != 0:
            ret += cumsum[y1 - 1][x1 - 1]
        return ret

    ans = (H - 1) + (W - 1)  # 1 マスに分けてしまえば要求を満たすことは保証されている
    # 横の切り方は全探索する
    for bits in range(1 << (H - 1)):
        count = 0  # 何回チョコに切り込みを入れたか？

        # 横の切り込みをどこに入れるかを決める
        cut_row = []
        cut_flag = format(bits, 'b')[::-1]
        for k, flag in enumerate(cut_flag):
            if flag == '1':
                count += 1
                # k 行目と (k+1) 行目の間を切るとき、長方形区間の最下段は k 行目
                cut_row.append(k)
        cut_row.append(H - 1)  # チョコ全体での最下段も加えておく

        # col1-col2 の間は切り込みを入れないでもホワイトチョコが K 個以下である
        col1 = 0
        for col2 in range(W - 1):
            row1 = 0
            for row2 in cut_row:
                if count_white_chocolate(col1, row1, col2, row2) > K:
                    count = float('inf')  # 現在の横の切り込みの入れ方では要求を満たせない

                # col2 列目と col2+1 列目の間に縦に切り込みを入れなければならない
                if (count_white_chocolate(col1, row1, col2, row2) <= K
                        and count_white_chocolate(col1, row1, col2 + 1, row2) > K):
                    # ここで縦に切り込みを入れ、右の区画へ移動
                    count += 1
                    col1 = col2 + 1
                    break
                row1 = row2 + 1  # 下の区画へ移動

        # 最後に縦に切り込みを入れた区画の右の区画はまだ調べていないので、調べる
        row1 = 0
        for row2 in cut_row:
            if count_white_chocolate(col1, row1, W - 1, row2) > K:
                count = float('inf')
            row1 = row2 + 1

        ans = min(ans, count)
    return ans

print(e_dividing_chocolate())


Measured memory_bytes: 47580
#include <iostream>
#include <string> 
#include <vector> 
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include <math.h>
using namespace std;

#define int long long
#define endl "\n"
#define all(v)  v.begin(),v.end()
#define fir first
#define sec second
#define fro front
#define m_p make_pair
#define mod 1000000007
#define INF 2000000000
#define rep(i,n)  for(int i=0; i<(int) (n); i++)
#define vecin(v) for(int i=0; i<(int)v.size(); i++)cin>>v[i];
using namespace std;

const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
int jousu(int x00, int y00) {
	int z00 = 1;
	for (int i = 0; i < y00; i++) {
		z00 *= x00;
	}
	return z00;
}
int keta(int x00) {
	int z00 = x00;
	int w00 = 0;
	while (z00 != 0) {
		z00 /= 10;
		w00++;
	}
	return w00;
}
int krag(double xx) {
	return INF - (int)(INF - xx);
}


int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int modpow(int a, int n) {
	int res = 1;
	while (n > 0) {
		if (n & 1) res* a% mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
int com(int xx, int yy) {
	int zz = 1;
	for (int i = xx; i > xx - yy; i--) {
		zz *= i;
		zz %= mod;
	}
	for (int i = 1; i <= yy; i++) {
		zz *= modinv(i, mod);
		zz %= mod;
	}
	return zz;
}
int gcd(int xx, int yy) {
	int p = xx;
	int q = yy;
	if (q > p)swap(p, q);
	while (p % q != 0) {
		p %= q;
		swap(p, q);
	}
	return q;
}
int lcm(int xx, int yy) {
	return xx * yy / gcd(xx, yy);
}
bool prime(int xx) {
	int a = xx;
	for (int i = 2; i * i <= xx; i++) {
		if (xx % i == 0) {
			return 0;
		}
	}
	return 1;
}



signed main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (c > b) swap(b, c);
	if (b > a)swap(a, b);
	if (c > a)swap(a, c);
	cout << b * c / 2 << endl;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include"string"
#include"math.h"
#include <algorithm>
#include<vector>
using namespace std;

int abs(int a){
	if(a<0)return -a;
	return a;
}
long long gcd(long long a,long long b){
	long long d;
	if(a<b){
		long long c;
		c=a;
		a=b;
		b=c;
	}
	d=a%b;
	if(d==0){
		return b;
	}else{
		gcd(b,d);
	}
}

long long lcm(long long a,long long b){
	return (a*b)/gcd(a,b);
}


long long N,K,M,re,spot,r,L;
bool p[10001],s[30000000],f[30000000],t[30000000];
long long dp[101][10001],ans,sss[3000000];
int sft[3000000];
string S,T;

void b(int a,int *stf,bool A,bool B, bool C){
	if(a<100000000){
	stf[K]=(a*10)+3;
	t[K]=true;
	s[K]=A;
	f[K]=B;
	K++;
	b(stf[K-1],stf,s[K-1],f[K-1],t[K-1]);

	stf[K]=(a*10)+5;
	f[K]=true;
	s[K]=A;
	t[K]=C;
	K++;
	b(stf[K-1],stf,s[K-1],f[K-1],t[K-1]);

	stf[K]=(a*10)+7;
	s[K]=true;
	t[K]=C;
	f[K]=B;
	K++;
	b(stf[K-1],stf,s[K-1],f[K-1],t[K-1]);
	}
	

}

int main(){
	cin>>N;
	b(0,sft,false,false,false);

		for(int i=0;i<K;i++){
			
			if(s[i]==true&&t[i]==true&&f[i]==true&&sft[i]<=N){
			ans++;
			}
		}
			cout<<ans<<endl;
	return 0;
}


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

void wybzdjsmjjfbgtn(int &d,int p,int a)
{
	if(p<0)
		return;
	if(d<0||d>p+a)
		d=p+a;
}

signed main()
{
	int N,M;
	cin>>N>>M;
	int T=1<<N;
	vector<int> dp(T,-1);
	dp[0]=0;
	while(M--)
	{
		int a,b,key=0,S=T;
		cin>>a>>b;
		while(b--)
		{
			int c;
			cin>>c;
			c--;
			key|=1<<c;
		}
		while(S--)
			wybzdjsmjjfbgtn(dp[S|key],dp[S],a);
	}
	cout<<dp[T-1]<<endl;
}

Measured memory_bytes: 256
/*input
4 5
1 2
3 4
1 3
2 3
1 4
*/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;

#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
int mod = 1000000007;
#define PI 3.14159265
#define endl '\n'
#define debug(x) cout << #x << " = " << x << endl;
#define MAX 100001

template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(ll a, ll b) {a += b; if (a < 0) a += mod; return a;}
inline int sub(ll a, ll b) {a -= b; if (a < 0) a += mod; return a;}
inline int mul(ll a, ll b) {return (a * 1ll * b) % mod;}
inline int pwr(ll x, ll y) {
    int ans = 1 % mod;
    while (y) {
        if (y & 1) ans = mul(ans, x);
        x = mul(x, x);
        y >>= 1;
    }
    return ans;
}
inline int inv(int a) {return pwr(a, mod - 2);}

vector <int> adj[MAX];
ll dc;

struct DSU {
    int connected;
    int par[MAX], sz[MAX];
    DSU(int n) {
        for (int i = 1; i <= n; i++) {
            par[i] = i;
            sz[i] = 1;
        }
        connected = n;
    }
    int getPar(int k) {
        while (k != par[k]) {
            par[k] = par[par[k]];
            k = par[k];
        }
        return k;
    }
    void unite(int u, int v) {
        int par1 = getPar(u), par2 = getPar(v);
        if (par1 == par2) return;
        connected--;
        if (sz[par1] > sz[par2])
            swap(par1, par2);
        dc = sz[par2] * 1ll * sz[par1];
        sz[par2] += sz[par1];
        sz[par1] = 0;
        par[par1] = par[par2];
    }
};


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll n, m;
    cin >> n >> m;
    int u, v;
    vector <PII> edge;
    for (int i = 0; i < m; i++) {
        cin >> u >> v;
        adj[u].pb(v);
        adj[v].pb(u);
        edge.pb({u, v});
    }
    ll temp = (n * (n - 1)) / 2;
    vector <ll> ans;
    ans.pb(temp);
    DSU dsu(n + 1);
    for (int i = m - 1; i >= 1; i--) {
        u = edge[i].first;
        v = edge[i].second;
        dc = 0;
        dsu.unite(u, v);
        temp -= dc;
        ans.pb(temp);
    }
    reverse(all(ans));
    for (auto it : ans) {
        cout << it << endl;
    }
    
    return 0;
}


Measured memory_bytes: 9712
/* 
	Author: ankrypt
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int
#define ff first
#define ss second
#define all(x) x.begin(), x.end() 
#define ub upper_bound
#define lb lower_bound
#define MAX_INT 15
#define fi(a, b, c, d) for(int a = b; a < c; a += d)
#define fl(a, b, c, d) for(ll a = b; a < c; a += d)
#define fei(a, b, c, d) for(int a = b; a <= c; a += d)
#define fel(a, b, c, d) for(ll a = b; a <= c; a += d)
#define quit exit(0)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pcl pair<char, ll>
#define psl pair<string, ll>

ll N, M, A, B, C;
ll arr[MAX_INT], arr1[MAX_INT], data[MAX_INT];
vector<ll> V;
string S = "";

int main() {
	cin >> S;
	ll found = 0;
	fi(i, 0, S.size(), 1) {
		if(S[i] == 'P') {
			found = 1;
		}
		if(S[i] == '?') {
			// if(!found) {
			// 	S[i] = 'P';
			// 	found = 1;
			// }
			// else {
				S[i] = 'D';
			// }
		}
	}
	cout << S << "\n";

	return 0;
}
/*
	Powered by Buggy Plugin
*/




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


int main() {
    float a, b;
    cin >> a >> b;
    if(12.5 * a >= 10 * b + 10 || 10 * b >= 12.5 * a + 12.5) {
        cout << -1 << "\n";
    }
    else if(10 * b >= 12.5 * a) {
        cout << 10 * b << "\n";
    }
    else {
        if(12.5 * a == (int)(12.5 * a)) {
            cout << 12.5 * a << "\n";
        }
        else {
            cout << (int)(12.5 * a + 1) << "\n";
        }
    }
}

Measured memory_bytes: 3772
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
#define pb(a) push_back(a)
#define ALL(a) a.begin(),a.end()
#define UNQ(a) a.erase(unique(a.begin(),a.end()),a.end())
int main(){
  ll FX[60],FY[60],FZ[60],EX[60],EY[60],EZ[60];
  vector< ll > x, y, z;
  int n, K;
  cin >> n >> K;
  for(int i = 0 ; i < n ; i++ ){
    cin >> FX[i] >> FY[i] >> FZ[i];
    cin >> EX[i] >> EY[i] >> EZ[i];
  }
  for(int i = 0 ; i < n ; i++ ){
    x.pb(FX[i]),y.pb(FY[i]),z.pb(FZ[i]),x.pb(EX[i]),y.pb(EY[i]),z.pb(EZ[i]);
  }
  sort(ALL(x)), sort(ALL(y)), sort(ALL(z));
  UNQ(x),UNQ(y),UNQ(z);
  ll ans = 0ll;
  for(int i = 0 ; i < x.size() - 1 ; i++ ){
    for(int j = 0 ; j < y.size() - 1 ; j++ ){
      for(int k = 0 ; k < z.size() - 1 ; k++ ){
	int cnt = 0;
	for(int l = 0 ; l < n ; l++ ){
	  if(FX[l] <= x[i] && x[i+1] <= EX[l] &&
	     FY[l] <= y[j] && y[j+1] <= EY[l] &&
	     FZ[l] <= z[k] && z[k+1] <= EZ[l]) cnt++;
	}
	if(cnt >= K) ans += (x[i+1] - x[i]) * (y[j+1] - y[j]) * (z[k+1] - z[k]);
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 1232
# coding: utf-8
# Your code here!
N,K=map(int,input().split())
A=list(map(int,input().split()))

dp=[0]*(K+1)

for i in range(K+1):    
    for a in A:
        if i+a<=K:
            if dp[i]==0:
                dp[i+a]=1

print("First" if dp[-1]==1 else "Second")


Measured memory_bytes: 73768
#include<iostream>
#include<set>
#include <bitset>
#include<queue>
#include<vector>
#include<map>
#include<stack>
#include <cstdio>
#include<algorithm>
#include <sstream>
#include<string>
#include<string.h>
#include <cmath>
#include <iomanip>
#include <string>
#include<list>
#include <limits>
#include <numeric>
#include <type_traits>
#define int long long
#define ll long long
#define mod  1000000007
#define inf 1e17
#define rep(i,j,n) for(int i=j;i<n;i++)
#define P pair<int,int>
double pi = 3.141592653589793;
using namespace std;
//ここから始めよう
vector<int> G[114514];
set<int>pinc;
vector<int> path;
void num(int s){
    rep(i,0,G[s].size()){
        if(pinc.count(G[s][i])==0){
            pinc.insert(G[s][i]);
            path.insert(path.begin(),G[s][i]);
            num(G[s][i]);
            return;
        }
    }
    return;
}
void sum(int s){
    rep(i,0,G[s].size()){
        if(pinc.count(G[s][i])==0){
            pinc.insert(G[s][i]);
            path.push_back(G[s][i]);
            sum(G[s][i]);
            return;
        }
    }
    return;
}
signed main(){
    int n,m;cin>>n>>m;
    rep(i,0,m){
        int a,b;cin>>a>>b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    //pathのスタートを0,エンドをG[0][0]で初期設定
    
    int s=0,t=G[0][0];
    pinc.insert(s);pinc.insert(t);
    path.push_back(s); path.push_back(t);
    num(s);sum(t);
    cout<<path.size()<<endl;
    rep(i,0,path.size()){
        cout<<path[i]+1<<" ";
    }cout<<endl;
    return 0;
}

Measured memory_bytes: 12148
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args)throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		while(true){
			int n = Integer.parseInt(br.readLine());
			if(n==0) break;

			int[] x = new int[n];
			int[] y = new int[n];
			boolean[][] map = new boolean[5001][5001];

			for(int i=0; i<n; i++){
				String line[] = br.readLine().split(" ");
				x[i] = Integer.parseInt(line[0]);
				y[i] = Integer.parseInt(line[1]);
				map[x[i]][y[i]] = true;
			}

			int answer = 0;
			for(int i=0;i<n-1;i++){
				for(int j=i+1;j<n;j++){
					int xchange = x[j]-x[i];
					int ychange = y[j]-y[i];
					int s = xchange*xchange + ychange*ychange;
					if(s>answer){
						if(0 <= x[i]+ychange && x[i]+ychange <= 5000 && 0 <= y[i]-xchange && y[i]-xchange <= 5000 &&
							0 <= x[j]+ychange && x[j]+ychange <= 5000 && 0 <= y[j]-xchange && y[j]-xchange <= 5000){
						if(map[x[i]+ychange][y[i]-xchange] && map[x[j]+ychange][y[j]-xchange]){
							answer = s;
							break;
						}}else if(0 <= x[i]-ychange && x[i]-ychange <= 5000 && 0 <= y[i]+xchange && y[i]+xchange <= 5000 &&
								0 <= x[j]-ychange && x[j]-ychange <= 5000 && 0 <= y[j]+xchange && y[j]+xchange <= 5000){
						if(map[x[i]-ychange][y[i]+xchange] && map[x[j]-ychange][y[j]+xchange]){
							answer = s;
							break;
						}}
					}
				}
			}
			System.out.println(answer);
		}
	}
}

Measured memory_bytes: 124220
N = int(input())
P = list(map(int,input().split()))
M = [P[0]]
min = P[0]
for i in range(1,N):
    if min > P[i]:
        min = P[i]
    M.append(min)
c = 0
for i in range(N):
    if P[i] == M[i]:
        c += 1
print(c)

Measured memory_bytes: 24744
/* This code was submitted by
  "Anand Dubey" on 
   14th January 2019
*/


#include <bits/stdc++.h> // Include every standard library 
using namespace std; 
  
typedef long long LL; 
typedef pair<int, int> pii; 
typedef pair<LL, LL> pll; 
typedef pair<string, string> pss; 
typedef vector<int> vi; 
typedef vector<vi> vvi; 
typedef vector<pii> vii; 
typedef vector<LL> vl; 
typedef vector<vl> vvl; 
  
double EPS = 1e-9; 
int INF = 1000000005; 
long long INFF = 1000000000000000005LL; 
double PI = acos(-1); 
int dirx[8] = { -1, 0, 0, 1, -1, -1, 1, 1 }; 
int diry[8] = { 0, 1, -1, 0, -1, 1, -1, 1 }; 
  
#ifdef TESTING 
#define DEBUG fprintf(stderr, "====TESTING====\n") 
#define VALUE(x) cerr << "The value of " << #x << " is " << x << endl 
#define debug(...) fprintf(stderr, __VA_ARGS__) 
#else 
#define DEBUG 
#define VALUE(x) 
#define debug(...) 
#endif 
  
#define FOR(a, b, c) for (int(a) = (b); (a) < (c); ++(a)) 
#define FORN(a, b, c) for (int(a) = (b); (a) <= (c); ++(a)) 
#define FORD(a, b, c) for (int(a) = (b); (a) >= (c); --(a)) 
#define FORSQ(a, b, c) for (int(a) = (b); (a) * (a) <= (c); ++(a)) 
#define FORC(a, b, c) for (char(a) = (b); (a) <= (c); ++(a)) 
#define FOREACH(a, b) for (auto&(a) : (b)) 
#define REP(i, n) FOR(i, 0, n) 
#define REPN(i, n) FORN(i, 1, n) 
#define MAX(a, b) a = max(a, b) 
#define MIN(a, b) a = min(a, b) 
#define SQR(x) ((LL)(x) * (x)) 
#define RESET(a, b) memset(a, b, sizeof(a)) 
#define fi first 
#define se second 
#define mp make_pair 
#define pb push_back 
#define ALL(v) v.begin(), v.end() 
#define ALLA(arr, sz) arr, arr + sz 
#define SIZE(v) (int)v.size() 
#define SORT(v) sort(ALL(v)) 
#define REVERSE(v) reverse(ALL(v)) 
#define SORTA(arr, sz) sort(ALLA(arr, sz)) 
#define REVERSEA(arr, sz) reverse(ALLA(arr, sz)) 
#define PERMUTE next_permutation 
#define TC(t) while (t--) 
  
inline string IntToString(LL a) 
{ 
    char x[100]; 
    sprintf(x, "%lld", a); 
    string s = x; 
    return s; 
} 
  
inline LL StringToInt(string a) 
{ 
    char x[100]; 
    LL res; 
    strcpy(x, a.c_str()); 
    sscanf(x, "%lld", &res); 
    return res; 
} 
  
inline string GetString(void) 
{ 
    char x[1000005]; 
    scanf("%s", x); 
    string s = x; 
    return s; 
} 
  
inline string uppercase(string s) 
{ 
    int n = SIZE(s); 
    REP(i, n) 
    if (s[i] >= 'a' && s[i] <= 'z') 
        s[i] = s[i] - 'a' + 'A'; 
    return s; 
} 
  
inline string lowercase(string s) 
{ 
    int n = SIZE(s); 
    REP(i, n) 
    if (s[i] >= 'A' && s[i] <= 'Z') 
        s[i] = s[i] - 'A' + 'a'; 
    return s; 
} 
  
inline void OPEN(string s) 
{ 

} 
  
int main() 
{ 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin>>s;
    int n=s.length(),c=0;
    FOR(i,0,n/2)
    {
        if(s[i]!=s[n-1-i])
            c++;
    }
    cout<<c<<endl;
    return 0; 
} 

Measured memory_bytes: 256
import java.io.*;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;

public class Main {

    static class Pair<K, V>{
        K key;
        V val;

        public Pair(K key, V val){
            this.key = key;
            this.val = val;
        }
    }

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));

        String[] inputs = br.readLine().split(" ");
        int N = Integer.parseInt(inputs[0]);
        long K = Long.parseLong(inputs[1]);

        List<Pair<Integer, Integer>> operations = new ArrayList<>();

        for(int i = 0; i < N; i++){
            inputs = br.readLine().split(" ");
            int a = Integer.parseInt(inputs[0]);
            int b = Integer.parseInt(inputs[1]);

            Pair<Integer, Integer> operation = new Pair<>(a, b);
            operations.add(operation);
        }

        operations.sort((Comparator.comparingInt(o -> o.key)));

        long idx = 0;
        for(Pair<Integer, Integer> operation : operations){
            if(idx <= K && K <= idx + operation.val){
                bw.write(String.format("%d\n", operation.key));
                bw.flush();
                return;
            }
            idx += operation.val;
        }
    }
}


Measured memory_bytes: 49284
import collections
N = int(input())
tree = [[] for i in range(N+1)]

for i in range(N-1):
    u, v, w = map(int, input().split())
    tree[u].append([v, w])
    tree[v].append([u, w])

for i in range(1, N+1):
    if len(tree[i]) == 1:
        start = i
        break
queue = collections.deque()
queue.append([start, 0])
ans = [-1] * (N+1)
ans[start] = 0


while len(queue) > 0:
    now = queue.popleft()
    for next in tree[now[0]]:
        if ans[next[0]] == -1:
            queue.append(next)
            ans[next[0]] = (ans[now[0]] + next[1])%2
for i in range(1, N+1):
    print(ans[i])


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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;


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

  LL W, H, V, T, X, Y, P, Q;
  cin >> W >> H >> V >> T >> X >> Y >> P >> Q;

  T *= V;
  LL ans = 0;
  for(LL ix=-(T/W)-1;ix<=(T/W)+2;++ix){
	LL x = ix * W + (ix%2==0?P: W-P);
	LL dx = x - X;
	LL t = T*T - dx*dx;
	if(t < 0) continue;
	LL iy = max(0ll, (LL)((sqrt(t) + Y) / H) - 1ll);
	for(;;++iy){
	  LL y = iy * H + (iy%2==0?Q: H-Q);
	  LL dy = y - Y;
	  if(dx*dx + dy*dy > T*T)
		break;
	}
	ans += iy;

	iy = min(-1ll, (LL)((-sqrt(t) + Y) / H+1));
	for(;;--iy){
	  LL y = iy * H + (iy%2==0?Q: H-Q);
	  LL dy = y - Y;
	  if(dx*dx + dy*dy > T*T)
		break;
	}
	ans += max(0ll, -iy-1);
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3220
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i <= (n); i++)
#define repi(i,a,b) for (int i = (a); i < (b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  
  if(a+b+c - max({a,b,c}) == max({a,b,c}))
    cout << "Yes" << endl;
  else 
    cout << "No" << endl;
}

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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 60)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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



i64 n, a[101010];
void solve(){
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	sort(a,a+n, greater<i64>());
	
	i64 ma = 0, ma2 = 0;
	for(int i = 1; i < n; i++){
		if(a[i] == a[i-1]){
			if(ma == 0) ma = a[i];
			else{
				ma2 = a[i];
				break;
			}
			i++;
		}
	}
	cout << ma*ma2 << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}


Measured memory_bytes: 1024
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<stack>
#include<cstring>

using namespace std;

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

int main(){
	
	while(1){
		char str[111];
		gets(str);
		
		if(str[0]=='.' && strlen(str)==1)break;
		
		int valid = 1;
		stack<char> c;
		int n = strlen(str);
		rep(i,n){
			if(str[i]=='(' || str[i]=='['){
				c.push(str[i]);
			}
			if(str[i]==')' || str[i]==']'){
				if(c.empty()){
					valid=0;
					break;
				}
				char s = c.top();
				c.pop();
				
				if((str[i]==')' && s=='[')||
					(str[i]==']' && s=='(')){
					valid=0;
					break;	
				}
			}
		}
		if(!c.empty())valid=0;
		
		if(valid)puts("yes");
		else puts("no");
	}
}

Measured memory_bytes: 1124
def is_pal(s)
  return s == s.reverse
end

s = gets.chomp

s1 = s[0..(s.size-1)/2-1]
s2 = s[(s.size+3)/2-1..s.size-1]

puts (is_pal(s) && is_pal(s1) && is_pal(s2) && s.size%2==1) ? "Yes" : "No"


Measured memory_bytes: 1788
/*
ID: Aman Raj
LANG: C++
TASK: prefix
*/
//#include<iostream>
#include <stdio.h>
//#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
#include<math.h>
typedef  long long  ll;
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val

using namespace std;
using namespace __gnu_pbds;

#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
//#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
//#define mod (311111111111113)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
//#define flush fflush(stdout)
#define primeDEN 727999983
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#include <fstream>
// find_by_order()  // order_of_key
typedef tree<
	int,
	null_type,
	less<int>,
	rb_tree_tag,
	tree_order_statistics_node_update>
	ordered_set;


   bool comp(pair<ll,ll> p1, pair<ll,ll> p2)
   {
    if(p1.first!=p2.first)return p1.first < p2.first;
     else return p1.second < p2.second;
   }



   ll power1(ll a, ll b)//a raised to power b
   {  if(b<=0) return 1; if(b==1) return a;
       ll c=power1(a,b/2);
        c*=c;c%=mod;if(b%2==1) c*=a;c%=mod;
        return c;
   }
   ll mi(ll a,ll m)
   { ll c= power1(a,m-2);

     return c;
   }
   ll findpower(ll a,ll b)
   {
       ll i=0;
       ll c=1;
        while(1)
        {
            c*=2;

            if(c>a)return i;
            i++;
        }
   }


vector<ll> dpfact;
   ll fact(ll a)
   { return dpfact[a];

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

  //ll n,m,k;
   //vector<ll> vans;
    //ll ans=0;

   //vector<vector<int> > v;
     vector<ll> visited;
      //vector<ll> vans;



   /* pair<ll,ll> dfs(ll p)
   { visited[p]=1;
     pair<ll,ll> p={0,0};
        for(auto x:v[p])
        {
            if(!visited[x])a+=dfs(x);
        }
       return a+1;

   }
*/

   int main()
{    ofstream fout("tcase.txt");
      ll n,k; cin>>n>>k;
       ll ans=0;
        for(ll i=0;i<n;i++){ll a;cin>>a;if(a>=k)ans++;  }
    cout<<ans;
    return 0;
 }


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
const Int MOD=1000000007;
signed main(){
  string a,b,c;
  cin>>a>>b>>c;
  if(a=="0"){
    a="$";
  }else{
    for(Int i=(Int)a.size();i>0;i--){
      if(a[i-1]!='0'){
	a[i-1]--;
	break;
      }
    }
  }
  //cout<<a<<" "<<b<<endl;
  vector<vector<Int> > dp2(c.size()+1,vector<Int>(10,0));
  if(c.size()>1){
    Int n=c.size();
    vector<Int> dp(n+1,0);
    dp[0]=-1;dp[1]=0;
    Int i=2,j=0;
    while(i<=(Int)n){
      if(c[i-1]==c[j]){
	dp[i]=j+1;
	i++;j++;
      }else if(j>0){
	j=dp[j];
      }else{
	dp[i]=0;
	i++;
      }
    }
    //cout<<c<<endl;
    //for(Int i=0;i<=n;i++) cout<<i<<" "<<dp[i]<<endl;
    //for(Int j=0;j<10;j++) dp2[0][j]=(c[0]-'0'==j);
    for(Int i=0;i<=n;i++){
      for(Int j=0;j<10;j++){
	//cout<<i<<" "<<j<<endl;
	Int k=i;
	while(k>=0&&c[k]-'0'!=j){
	  //cout<<k<<endl;
	  k=dp[k];
	}
	if(k<0) k++;
	if(c[k]-'0'==j) k++;
	dp2[i][j]=k;
	
	//cout<<i<<" "<<j<<":"<<dp2[i][j]<<endl;
      }
    }
  }else{
    dp2[0][c[0]-'0']=dp2[1][c[0]-'0']=1;
  }
  
  auto calc=[&](string s,string t){
    if(s=="$") return 0LL;
    Int res=0;
    Int n=s.size(),m=t.size();
    vector<vector<Int> > po(2,vector<Int>(n+1,0));
    po[0][n]=po[1][n]=1;
    for(Int i=n;i>0;i--){
      po[1][i-1]=po[1][i]*10%MOD;
      po[0][i-1]=((s[i-1]-'0')*po[1][i]%MOD+po[0][i])%MOD;
    }

    vector<vector<vector<Int> > > dp(2,vector<vector<Int> >(n+1,vector<Int>(m+1,0)));
    if(t!="0"){
      dp[0][0][0]=1;
      for(Int k=0;k<2;k++){
	for(Int i=0;i<n;i++){
	  for(Int j=0;j<=m;j++){
	    if(i==0&&j==0&&t=="0") continue;
	    for(Int a=0;a<10;a++){
	      if(!k&&a>(s[i]-'0')) continue;
	      //cout<<k<<" "<<i<<" "<<j<<" "<<a<<":"<<(k||(a<(s[i]-'0')))<<" "<<dp2[j][a]<<endl;
	      dp[k||(a<(s[i]-'0'))][i+1][dp2[j][a]]+=dp[k][i][j];
	      dp[k||(a<(s[i]-'0'))][i+1][dp2[j][a]]%=MOD;
	    }
	  }
	  //cout<<k<<" "<<i<<":"<<dp[k][i][m]<<" "<<po[k][i]<<endl;
	  res+=dp[k][i][m]*po[k][i];
	  res%=MOD;
	}
      }
      //cout<<dp[0][n][m]<<" "<<dp[1][n][m]<<endl;
      res+=dp[0][n][m]+dp[1][n][m];
      res%=MOD;
    }else{
      res=1;
      dp[0][0][0]=1;
      for(Int k=0;k<2;k++){
	for(Int i=0;i<n;i++){
	  for(Int j=0;j<2;j++){
	    for(Int a=0;a<10;a++){
	      if(!k&&a>(s[i]-'0')) continue;
	      //cout<<k<<" "<<i<<" "<<j<<" "<<a<<":"<<(k||(a<(s[i]-'0')))<<" "<<dp2[j][a]<<endl;
	      dp[k||(a<(s[i]-'0'))][i+1][j||a]+=dp[k][i][j];
	      dp[k||(a<(s[i]-'0'))][i+1][j||a]%=MOD;
	    }
	  }
	  //cout<<k<<" "<<i<<":"<<dp[k][i][1]<<" "<<po[1][i+1]<<endl;
	 
	  
	  res+=dp[k][i][1]*po[!(!k&&s[i]=='0')][i+1];
	  res%=MOD;
	}
      }
    }
    return res;
  };
  Int ans=0;
  ans+=calc(b,c);
  ans%=MOD;
  ans+=MOD-calc(a,c);
  ans%=MOD;
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 116044
#include<stdio.h>
int main()
{
	int one[2]={0},two[2]={0},three[2]={0},tenn,sum[2]={0};
	for(int i1=0;i1<2;i1++){
	for(int i=0;i<10;i++){
		scanf("%d",&tenn);
		if(one[i1]<=tenn){
			three[i1]=two[i1];
			two[i1]=one[i1];
			one[i1]=tenn;
		}
		else if(two[i1]<=tenn){
			three[i1]=two[i1];
			two[i1]=tenn;
		}
		else if(three[i1]<=tenn){
			three[i1]=tenn;
		}
	}
	sum[i1]=one[i1]+two[i1]+three[i1];
	}
	printf("%d %d\n",sum[0],sum[1]);
	return 0;
}

Measured memory_bytes: 1024
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <utility>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <tuple>
#include <set>
#include <map>
#include <functional>
#include <cmath>
#include <cstring>
using namespace std;
#define sci(n) scanf("%lld", &(n))
#define scd(n) scanf("%Ld", &(n))
typedef long long LL;
typedef long double LD;
typedef pair<LL, LL> pll;
int main(void)
{
	vector<LL> p; LL n,sum=0;
	sci(n);
	p.resize(n);
	for (int i = 0; i < n; i++) { sci(p[i]); }
	sort(p.begin(), p.end());
	p[n - 1] /= 2;
	for (int i = 0; i < n; i++) { sum += p[i]; }
	cout << sum;
	return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
P=[]
for i in range(N):
  x,y=map(int, input().split())
  P.append([x,y])
C=[]
for i in range(M):
  a,b=map(int, input().split())
  C.append([a,b])

for p in P:
  mind=10**18
  for j in range(M):
    d=abs(p[0]-C[j][0])+abs(p[1]-C[j][1])
    if d<mind:
      ans=j+1
      mind=d
  print(ans)

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

int main() 
{
  int n;
  cin >> n;
  int a[n], b[n];
  int c[n] = {};
  for (int i = 0; i < n; ++i) cin >> a[i];
  
  int l = 1;
  while (l <= n) {
    for (int i = n/l - 1; i > n/(l+1) - 1; --i) {
      for (int j = 2; j <= l; ++j) {
        c[i] += b[(i+1) * j - 1];
      }
      b[i] = a[i] ^ (c[i] % 2);
    }
    ++l;
  }
  
  int count = 0;
  for (int i = 0; i < n; ++i) {
    count += b[i];
  }
  cout << count << endl;
  for (int i = 0; i < n; ++i) {
    if (b[i] == 1) {
      cout << i + 1 << " " ;
    }
  }
  return 0;
}

Measured memory_bytes: 3200
using namespace std;

int main(void)
{
	int t;
	cin >> t;
	for(int i = 0; i < t; i++){
		int d, s1, s2;
		int max_up = 0, max_down = 0;
		
		cin >> d;
		cin >> s1 >> s2;
		max_up = s2 > s1 ? s2 - s1 : 0;
		max_down = s1 > s2 ? s1 - s2 : 0;

		for( int j = 2; j < d; j++){
			int tmp;
			cin >> tmp;

			max_up = max(max_up, tmp > s2 ? tmp - s2 : 0);
			max_down = max(max_down, s2 > tmp ? s2 - tmp : 0);

			s2 = tmp;
		}

		cout << max_up << ' ' << max_down << '\n';
	}
	return 0;
}

Measured memory_bytes: 0
import sys
for e in sys.stdin:
  data = e.replace('\n', '')
  countJOI = 0
  countIOI = 0

  for i in range(len(data) - 2):
    c = data[i:i+3]
    if (c == 'JOI'):
      countJOI += 1
    elif(c == 'IOI'):
      countIOI += 1
  print(countJOI)
  print(countIOI)



Measured memory_bytes: 5576
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <ctime>
 
using namespace std;
 
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
 
long gcd(long a, long b){
	if (a%b==0){
		return b;
	}
	else{
		return gcd(b,a%b);
	}
}
 
long lcm(long a, long b){
	return (a*b) / gcd(a,b);
}
 
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a < b) { a = b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a > b) { a = b; return 1; } return 0; }
 
typedef long long ll;
 
const ll INF = 1ll<<60;
const ll MOD = 1000000007;
const double EPS = 1e-10;

int m[1005];

int main(){
	int n, x;
	
	cin >> n >> x;
	
	int mini = 10000;
	
	REP(i,n){
		cin >> m[i];
		if (m[i] < mini) mini = m[i];
		
		x -= m[i];
	}
	
	int ans = n + x/mini;
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
function getLines(input){
	return input.split("\n").map((s)=>s.trim())
}
function parseLine(line){
	return line.split(" ").map((s)=>s.trim());
}
function parseLineToInt(line){
	return line.split(" ").map((s)=>parseInt(s.trim()));
}
// parameter "input" gets all data
function Main(input) {
	// the first line is assigned to input[0], the second line is assigned to input[1] similarly.	
	input = getLines(input).map(parseLineToInt);
	var n = input[0][0];
	var t=input[0][1];
	input.shift()
	input=input.filter((ct)=>ct[1]<=t)

	if(input.length==0){
		console.log('TLE')
	}else{
		input.sort((a,b)=>a[0]-b[0])
		console.log(input[0][0]);
	}
	
}
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 21064
#include<iostream>
#include<cmath>
#include<tuple>
using namespace std;
int p, q;
int main() {
	while (true) {
		cin >> p >> q;
		if (p == 0 && q == 0)break;
		tuple<int, int, double>x, y;
		x = make_tuple(0, 0, 0);
		y = make_tuple(0, 0, 100000);
		double T = sqrt(1.0*p);
		for (int i = 1; i <= q; i++) {
			double I = T*i;
			int J = I;
			double K = 1.0*J / i;
			double L = 1.0*(J + 1) / i;
			if (K > get<2>(x) && J <= q) {
				x = make_tuple(J, i, K);
			}
			if (L < get<2>(y) && J + 1 <= q) {
				y = make_tuple(J + 1, i, L);
			}
		}
		cout << get<0>(y) << '/' << get<1>(y) << ' ';
		cout << get<0>(x) << '/' << get<1>(x) << endl;
	}
	return 0;
}

Measured memory_bytes: 3076
A = sorted( [input()[::-1] for i in range(5)] )
c = 0
while (A[0][0] == "0" and c<5):
  tmp = A.pop(0)
  A.append(tmp)
  c+=1

A = [int(a[::-1]) for a in A][::-1]

def roundUp(n):
  return n if n%10==0 else n + (10-n%10)

print(sum([roundUp(A[i]) for i in range(4)]) + A[4])


Measured memory_bytes: 3060
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>

typedef long long ll;

using namespace std;

int main() {
  	ll k;
    ll i=0;
    cin>>k;
    cout<<"50"<<endl;
    ll n = 50;
    while(n--)
    {
        printf("%lld",49-i+((49-i+k)/50));
        i++;
        if(n)
            printf(" ");
        else
            printf("\n");
	}
	return 0;
}




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

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

    if (s == "RRR") cout << 3 << endl;
    else if (s == "SRR" || s == "RRS") cout << 2 << endl;
    else if (s == "SSR" || s == "SRS" || s == "RSS" || s == "RSR") cout << 1 << endl;
    else cout << 0 << endl;

    return 0;
}

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

#define endl '\n'
#define ends ' '
#define die(x) return cout << x << endl, 0
#define all(v) v.begin(), v.end()
#define sz(x) (int)(x.size())
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cerr << ends << H; debug_out(T...); }
#define debug(...) cerr << "{" << #__VA_ARGS__ << "}:", debug_out(__VA_ARGS__)
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
 
////////////////////////////////////////////////////////////////////

const int N = 4e2 + 2, M = 1e5 + 2;

bool D[N];
int X[M], Y[M];
bitset<N> S[N];

int main() {

	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	mt19937 Rnd(time(0));

	int n, m, ans = 0; cin >> n >> m;
	for (int i = 0; i < n; i++) S[i][i] = 1;
	for (int i = 0; i < m; i++) cin >> X[i] >> Y[i], X[i]--, Y[i]--;
	while (m--) {
		int x = X[m], y = Y[m];
		for (int i = 0; i < n; i++) {
			if (S[i][x] && S[i][y]) D[i] = true;
			else if (S[i][x]) S[i][y] = true;
			else if (S[i][y]) S[i][x] = true;
		}
	}
	for (int i = 0; i < n; i++) for (int j = 0; j < i; j++) if (D[i] + D[j] + (S[i] & S[j]).count() == 0) ans++;
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<map>
#include<set>

using namespace std;
using ll = long long;

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

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

int main() {
    char c[10];
    cin >> c;

    if ((c[0] == c[1] && c[0] != c[2] && c[2] == c[3])
    || (c[0] == c[2] && c[0] != c[3] && c[1] == c[3])
    || (c[0] == c[3] && c[0] != c[1] && c[1] == c[2])) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
package main

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

func main() {
	scanInit()

	x := nextInt()
	a := nextInt()
	b := nextInt()

	if a >= b {
		fmt.Println("delicious")
		return
	}
	if x >= b-a {
		fmt.Println("safe")
		return
	}
	fmt.Println("dangerous")
	return

}

// ---- readfunc
var sc = bufio.NewScanner(os.Stdin)

func scanInit() {
	const cap = 200 * 1024 // default=64*1024
	var buf = make([]byte, cap)
	sc.Buffer(buf, cap)
	sc.Split(bufio.ScanWords)
	return
}
func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}


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

using namespace std;

int main()
{
	int n,m;
	cin>>n>>m;
	long long sum=0;
	for(int i=0;i<m;i++)
	{
		int a;
		cin>>a;
		sum+=a;
	}
	if(sum<=n){cout<<n-sum;}
	else{cout<<"-1";}
	return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <cmath>
#include <queue>
using namespace std;
using uint = unsigned int;
using ull = unsigned long long;

int main() {
	
	uint N;
	cin >> N;
	
	vector<int> BP(N);
    iota(BP.begin(), BP.end(), 1);
	
	int K = 1;
	for(uint i=1; i<=N; i++) {
		K *= i;
	}
	
	int iP = 0;
	int kP = K;
	
	for(uint i=N; i>0; i--) {
		uint P;
		cin >> P;
		
		auto itr = find(BP.begin(), BP.end(), P);
		auto dst = distance(BP.begin(), itr);
		
		kP /= i;
		iP += (kP * dst);
		BP.erase(itr);
	}
	
	vector<int> BQ(N);
    iota(BQ.begin(), BQ.end(), 1);
	
	int kQ = K;
	int iQ = 0;
	
	for(uint i=N; i>0; i--) {
		uint P;
		cin >> P;
		
		auto itr = find(BQ.begin(), BQ.end(), P);
		auto dst = distance(BQ.begin(), itr);
		
		kQ /= i;
		iQ += kQ * dst;
		//cout << P << " " << kQ << " " << dst << " " << iQ << endl;
		BQ.erase(itr);
	}
	
	//cout << iP << " " << iQ << endl;
	cout << abs(iQ - iP);
	
	
	return 0;
}


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

int main() {
  int n, m, ans=0;
  cin >> n;  
  vector<string> b(n);
  rep(i,n) cin >> b.at(i);
  cin >> m;
  vector<string> r(m);
  rep(i,m) cin >> r.at(i);
  
  rep(i,n-1){
    int c=0;
    rep(j,n) if(b.at(i) == b.at(j)) c++;
    rep(j,m) if(b.at(i) == r.at(j)) c--;
    ans = max(ans,c);
  }
  cout << ans;
}

Measured memory_bytes: 256
// abc101_a
#include <iostream>
#include <string>
using namespace std;

int main(int argc, char *argv[])
{
  int n = 0;
  string s;
  cin >> s;
  for (int i = 0; i < 4; ++i) {
    if(s[i] == '+') n++;
    else n--;
  }
  cout << n << endl;
  return 0;
}


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

int main(){
  int N;
  cin >> N;
  int odd=0;
  for(int i=0; i<N; i++){
    int A;
    cin >> A;
    if(A%2!=0) odd++;
  }
  if(odd%2==0) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
typedef unsigned int uint;
using namespace std;

ll MOD = 1000000007;

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

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

  if(N%2==0){
    bool check = true;
    for(int i=0;i<N;i++){
      if(i%2==0 && cnt[i]!=0) check = false;
      if(i%2==1 && cnt[i]!=2) check = false;
    }
    if(!check){
      cout << 0 << endl;
      return 0;
    }
  }

  if(N%2==1){
    bool check = true;
    if(cnt[0]!=1) check = false;
    for(int i=1;i<N;i++){
      if(i%2==0 && cnt[i]!=2) check = false;
      if(i%2==1 && cnt[i]!=0) check = false;
    }
    if(!check){
      cout << 0 << endl;
      return 0;
    }
  }

  //=====================================================
  //答えが存在する
  if(N%2==1){
    ll ans = 1;
    for(int i=0;i<N/2;i++){
      ans *= 2;
      ans %= MOD;
    }
    cout << ans << endl;
    return 0;
  }

  if(N%2==0){
    ll ans = 1;
    for(int i=0;i<N/2;i++){
      ans *= 2;
      ans %= MOD;
    }
    cout << ans << endl;
    return 0;
  }
}


Measured memory_bytes: 1024
#abc077 c
import bisect
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))

a.sort()
c.sort()
ans=0
for i in b:
    na=bisect.bisect_left(a,i)
    nc=len(b)-bisect.bisect_right(c,i)
    ans+=(na*nc)
print(ans)


Measured memory_bytes: 22516