akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <unordered_map>
#include <set>
#include <algorithm>
#include <utility>
#include <cmath>
using namespace std;

typedef long long llong;
typedef unsigned long long ullong;
// -2.1e-9 <= int <= 2.1e9
// -9.2e-18 <= long long <= 9.2e18
// 0 <= unsigned int <= 4.2e9
// 0 <= unsigned long long <= 18.4e18
// cout << fixed << setprecision(10);

int main() {
    string S;
    cin >> S;
    if (S[S.size()-1]=='s')
        S = S + "es";
    else
        S = S + "s";
    cout << S << endl;
}


Measured memory_bytes: 3628
x,y = gets.chomp.split.map(&:to_i)
cnt=0
if y.abs >= x.abs
    cnt+=1 if x<0
    cnt+=y.abs-x.abs
    cnt+=1 if y<0
else
    cnt+=1 if x>0
    cnt+=x.abs-y.abs
    cnt+=1 if y>0
end
puts cnt

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

int n,a[100009];
int main(){
	scanf("%d",&n);
	int i,x,y;
	for (i=1; i<=n; i++) scanf("%d",&a[i]);
	sort(a+1,a+n+1);
	for (i=1; i<=n; i++){
		if (i==1){
			x=1; y=a[i]&1^1;
		} else if (a[i]==a[i-1]){
			if (x==1) y^=1; else x--;
		} else{
			y^=(a[i-1]^x)&1; x=a[i-1];
			if (!y && a[i-1]==n-i+1){
				puts("First"); break;
			}
			y=(a[i]^x)&1;
		}
		if (a[i]>=n-i+1){
			puts((((n-i+1)^x^y)&1)?"First":"Second");
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
//関数
const long INF=10000000000;

void display(long j,vector<long> x){
    cout<<"data "<<j<<" display_start"<<endl;
    for(int i=0;i<x.size();i++){
        cout<<x.at(i)<<" ";
    }
    cout<<endl<<"display_end"<<endl<<endl;
}


//main
int main() {
    
    //入力
    long A,B,T;
    cin>>A>>B>>T;
    
    
    
    
    //出力
    cout<<(T/A)*B<<endl;
}

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

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

	if(a<b && b<c)
	{
		cout<<"Yes"<<endl;
		return 0;
	}
	else if(b<=a)
	{
			while(k--)
			{
				b*=2;
				if(b>a)
					break;
			}
			if(a<b && b<c)
			{
				cout<<"Yes"<<endl;
				return 0;
			}
			else
			{
				if(b>=c)
				{
					while(k--)
					{
						c*=2;
						if(c>b)
							break;
					}
					if(a<b && b<c)
					{
						cout<<"Yes"<<endl;
						return 0;
					}
					else
					{
						cout<<"No"<<endl;
					}
				}
			}
	}
	else 
	{
		if(b>=c)
		{
			while(k--)
			{
				c*=2;
				if(c>b)
				break;
			}
			if(a<b && b<c)
			{
				cout<<"Yes"<<endl;
				return 0;
			}
			else
			{
				cout<<"No"<<endl;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#include <iostream>
#include <string>

int main(void)
{
    using namespace std;
    int n;
    cin >> n;

    string n_ = to_string(n);
    int s = 0;
    for(int i = 0; i < n_.length(); ++i) {
        s += (n_.at(i) - '0');
    }
    cout << (n % s == 0 ? "Yes" : "No") << endl;    
}

Measured memory_bytes: 256
class BIT:
    '''
    All methods use 0-based index while the implementation use 1-based index
    '''
    def __init__(self, N, val=0):
        self.data = [val] * (N + 1)
        self.N = N
    
    def add_at(self, idx, val):
        i = idx + 1
        while i <= self.N:
            self.data[i] += val
            i += i & (-i)
    
    def sum_to(self, idx):
        res = 0
        i = idx + 1
        while i > 0:
            res += self.data[i]
            i -= i & (-i)
        return res
    
    def sum_in(self, l, r): # [l, r]
        return self.sum_to(r) - self.sum_to(l - 1)
    
    
class Query:
    def __init__(self, i, l, r):
        self.i = i
        self.l = l
        self.r = r
    
    
N, Q = map(int, input().split())
C = list(map(int, input().split()))
    
queries = [[] for _ in range(N)]
for i in range(Q):
    l, r = map(int, input().split())
    l, r = l - 1, r - 1
    queries[r].append(Query(i, l, r))
    
bit = BIT(N)
last = [-1] * (max(C) + 1)
    
query_idx = 0
ans = [-1] * Q
for i, c in enumerate(C):
    if last[c] != -1:
        bit.add_at(last[c], -1)    
    bit.add_at(i, +1)
    last[c] = i
    
    for q in queries[i]:
        ans[q.i] = bit.sum_in(q.l, q.r)
    
print('\n'.join(map(str, ans)))

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

using namespace std;

#define all(x) x.begin(), x.end()
#define sz(x) (int) x.size()
#define pb push_back
#define endl '\n'
#define snd second
#define fst first
#define fastio cin.tie(NULL),cout.sync_with_stdio(true)

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector <int> vi;
typedef pair <int,int> ii;
typedef pair <ii,int> iii;

const int mod = 1e9 + 7;
const ll INF = (1LL<<50);
const int N = 1005;

int n,m;
int see[N][N];
char v[N][N];
int dz[] = {0,-1,-2,1,2};

bool valid(int x, int y){
	return x >= 0 and x < n and y >= 0 and y < m and v[x][y] == '.';
}

int main(){
	fastio;
	cin >> n >> m;
	ii cord[2];
	for(int i = 0; i < 2; i++)
		cin >> cord[i].fst >> cord[i].snd;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++){
			cin >> v[i][j];
			see[i][j] = mod;
		}
	}
	deque<ii> q;
	q.push_front({cord[0].fst-1, cord[0].snd-1});
	see[cord[0].fst-1][cord[0].snd-1] = 0;
	while(!q.empty()){
		int x = q.front().fst, y = q.front().snd;
		q.pop_front();
		for(int i = 0; i < 5; i++){
			for(int j = 0; j < 5; j++){
				int newx = x + dz[i], newy = y + dz[j];
				if(!valid(newx, newy))
					continue;
				bool adj = ((abs(dz[i]) + abs(dz[j])) <= 1);
				if(adj and see[newx][newy] > see[x][y]){
					see[newx][newy] = see[x][y];
					q.push_front({newx,newy});
				}
				if(!adj and see[newx][newy] > see[x][y] + 1) {
					see[newx][newy] = see[x][y] + 1;
					q.push_back({newx,newy});
				}

			}
		}
	}
	int ans = see[cord[1].fst-1][cord[1].snd-1];
	cout << (ans >= mod? -1 : ans) << '\n';
	return 0;
}


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

int main(){
	int ans=0,tmp=0;
	int a[5];
	for(int i=0;i<5;i++) cin>>a[i];
	for(int i=0;i<5;i++){
		if(a[i]%10==0){
			ans+=a[i];
			tmp++;
		}
		if(tmp==5){
			cout<<ans;
			return 0;
		}
	}
	for(int i=0;i<5;i++){
		if(a[i]%10==9){
			ans+=a[i];
			tmp++;
		if(tmp==5){
			cout<<ans;
			return 0;
		}
		ans+=1;
		}
	}
	for(int i=0;i<5;i++){
		if(a[i]%10==8){
			ans+=a[i];
			tmp++;
		if(tmp==5){
			cout<<ans;
			return 0;
		}
		ans+=2;
		}
	}
	for(int i=0;i<5;i++){
		if(a[i]%10==7){
			ans+=a[i];
			tmp++;
		if(tmp==5){
			cout<<ans;
			return 0;
		}
		ans+=3;
		}
	}
	for(int i=0;i<5;i++){
		if(a[i]%10==6){
			ans+=a[i];
			tmp++;
		if(tmp==5){
			cout<<ans;
			return 0;
		}
		ans+=4;
		}
	}
	for(int i=0;i<5;i++){
		if(a[i]%10==5){
			ans+=a[i];
			tmp++;
		if(tmp==5){
			cout<<ans;
			return 0;
		}
		ans+=5;
		}
	}
	for(int i=0;i<5;i++){
		if(a[i]%10==4){
			ans+=a[i];
			tmp++;
		if(tmp==5){
			cout<<ans;
			return 0;
		}
		ans+=6;
		}
	}
	for(int i=0;i<5;i++){
		if(a[i]%10==3){
			ans+=a[i];
			tmp++;
		if(tmp==5){
			cout<<ans;
			return 0;
		}
		ans+=7;
		}
	}
	for(int i=0;i<5;i++){
		if(a[i]%10==2){
			ans+=a[i];
			tmp++;
			if(tmp==5){
				cout<<ans;
				return 0;
			}
			ans+=8;
		}
	}
	for(int i=0;i<5;i++){
		if(a[i]%10==1){
			ans+=a[i];
			tmp++;
			if(tmp==5){
				cout<<ans;
				return 0;
			}
			ans+=9;
		}
	}
	return 0;
}


Measured memory_bytes: 256
public class Main {

	public void run(java.io.InputStream in, java.io.PrintStream out) {
		final java.util.Scanner sc = new java.util.Scanner(in);
		final RankInADynamicSubset lis = new RankInADynamicSubset(sc.nextInt());
		final int q = sc.nextInt();
		
		for (int i = 0; i < q; ++i) {
			final int com = sc.nextInt();
			final int x = sc.nextInt();
			final int y = sc.nextInt();
			
			if (com == 0) {
				lis.add(x, y);
			} else if (com == 1) {
				out.println(lis.currentRankOf(x, y));
			}
		}
		
		sc.close();
	}
	
	public static void main(String[] args) {
		(new Main()).run(System.in, System.out);
	}

	private static class RankInADynamicSubset {
		private int[] d;
		private int   n;
		
		public RankInADynamicSubset(int n) {
			this.n = 1;
			while (this.n < n) {
				this.n *= 2;
			}
			d = new int[this.n * 2];
			java.util.Arrays.fill(d, 2147483647);
		}
		
		public void add(int i, int x) {
			i = n + i;
			d[i] = x;
			while (i != 1) {
				i /= 2;
				d[i] = Math.min(d[i * 2], d[i * 2 + 1]);
			}
		}
		
		public int currentRankOf(int s, int t) {
			return currentRankOf(s, t, 0, n - 1, 1);
		}
		
		private int currentRankOf(int s, int t, int lb, int ub, int i) {
			final int m = (lb + ub) / 2;
			int res;
			
			if (s <= lb && ub <= t) {
				return (d[i]);
			}
			
			res = Integer.MAX_VALUE;
			if (s <= m) {
				res = Math.min(res, currentRankOf(s, t, lb, m, i * 2));
			}
			if (m + 1 <= t) {
				res = Math.min(res, currentRankOf(s, t, m + 1, ub, i * 2 + 1));
			}
			
			return (res);
		}
	}
	
}

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

public class Main {

	public static void main(String[] args) {
		 Scanner scan = new Scanner(System.in);
		 
		 int N = scan.nextInt();
		 int d[] = new int[N];
		 
		 for (int i = 0; i < N; i++) {
			 d[i] = scan.nextInt();
		 }
		 
		 Arrays.sort(d);
		 
		 int K = d[N / 2] - d[N / 2 - 1];
		 
		System.out.println(K);
		 scan.close();

	}

}


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

int main(){
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  if(A * B < C * D) cout << C * D << endl;
  if(A * B > C * D) cout << A * B << endl;
  if(A * B == C * D) cout << A * B << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int N, Q, cnt = 0, flag = 0;
  string S;
  vector<long long int> l_v, r_v;
  vector<vector<long long int>> hit_v;
  //cin >> N >> Q;
  cin >> S;
  for (int i = 0; i < 3; i++) {
    if (S[i] == S[i+1]) {
      flag = 1;
    }
  }
  if (flag == 1) printf("Bad\n");
  else printf("Good\n");
  // for (int i = 0; i < Q; i++) {
  //   long long int l, r;
  //   cin >> l >> r;
  //   l_v.push_back(l);
  //   r_v.push_back(r);
  // }

  // for (int i = 0; i < S.size()-1; i++) {
  //   if (S[i] == 'A' && S[i+1] == 'C') {
  //     cnt++;
  //     hit_v.push_back({i, i+1});
  //   }
  // }
  // for (int i = 0; i < Q; i++) {
  //   cnt = 0;
  //   for (int j = 0; j < hit_v.size(); j++) {
  //     if (l_v[i]-1 <= hit_v[j][0] && hit_v[j][1] <= r_v[i]-1) {
  //       cnt ++;
  //     }
  //     else if (hit_v[j][1] > r_v[i]-1) {
  //       break;
  //     }
  //   }
  //   cout << cnt << endl;
  // } 
  
  // char S[1000000] = {0};
  // vector<int> s_v, s_01v, s_10v;
  // cin >> S;
  // //cout << strlen(S) << endl;
  // for (int i = 0; i < strlen(S); i++) {
  //   s_v.push_back(S[i] - '0');
  //   switch(i%2) {
  //   case 0:
  //     s_01v.push_back(0);
  //     s_10v.push_back(1);
  //     break;
  //   case 1:
  //     s_01v.push_back(1);
  //     s_10v.push_back(0);
  //     break;
  //   }
  // }
  // long long int cnt_01 = 0, cnt_10 = 0;

  // for (int i = 0; i < strlen(S); i++) {
  //   if (s_01v[i] != s_v[i]) cnt_01++;
  //   if (s_10v[i] != s_v[i]) cnt_10++;
  // }
  // if (cnt_01 > cnt_10) {
  //   cout << cnt_10 << endl;
  // }
  // else {
  //   cout << cnt_01 << endl;
  // }
  // for (int i = 0; i < strlen(S); i++) {
  //   printf("%d ", s_v[i]);
  // }
  return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))

mx_i = 0
for i, e in enumerate(a):
    if abs(e) > abs(a[mx_i]):
        mx_i = i

ans = []
for i in range(n):
    if i == mx_i:
        continue
    a[i] += a[mx_i]
    ans.append([mx_i + 1, i + 1])

if a[mx_i] > 0:
    for i in range(n - 1):
        if a[i] > a[i+1]:
            a[i+1] += a[i]
            ans.append([i + 1, i + 2])

else:
    for i in range(n - 1, 0, -1):
        if a[i] < a[i-1]:
            a[i-1] += a[i]
            ans.append([i + 1, i])

print(len(ans))
for row in ans:
    print(*row)


Measured memory_bytes: 3188
// Seek knowledge from the Cradle to the Grave !!
// https://www.linkedin.com/in/syed-mujtaba

#include <bits/stdc++.h>
using namespace std;
#define int             long long
#define ld              long double
#define ll              long long
#define pb              push_back
#define fi              first
#define se              second
#define MAXN            200064
#define mod             1000000009 // 998244353 // 1e9 + 7
#define MAX             8000000000000000064LL
#define MIN            -8000000000000000064LL
#define mt              make_tuple
#define eps             1e-6
#define endl            '\n'
#define test            int T_T; cin>>T_T; while(T_T--)
#define fast_io         ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

void solve()
{

}


signed main()
{
	fast_io
	// test
	{
		int h1, m1, h2, m2, k;
		cin >> h1 >> m1 >> h2 >> m2 >> k;
		int t1 = h1* 60 + m1;
		int t2 = h2 * 60 + m2;
		cout << (t2 - t1) - k << endl;
	}	
}

Measured memory_bytes: 3652
n,m,l = input().split()
a = [input().split() for i in range(int(n))]
b = [input().split() for i in range(int(m))]

M = []

"""
a[0][0]*b[0][0]+a[0][1]*b[1][0]
a[0][0]*b[0][1]+a[0][1]*b[1][1]
a[0][0]*b[0][2]+a[0][1]*b[1][2]

a[1][0]*b[0][0]+a[1][1]*b[1][0]
a[1][0]*b[0][1]+a[1][1]*b[1][1]
a[1][0]*b[0][2]+a[1][1]*b[1][2]

a[2][0]*b[0][0]+a[2][1]*b[1][0]
a[2][0]*b[0][1]+a[2][1]*b[1][1]
a[2][0]*b[0][2]+a[2][1]*b[1][2]
"""
for i in range(0, len(a)):
    ci = []
    for k in range(0, int(l)):
        cik = 0
        for j in range(0,int(m)):
            cik = cik + int(a[i][j]) * int(b[j][k])
        ci = ci + [cik]
    M = M + [ci]


for i in range(int(n)):
    for j in range(int(l)):
        if j != int(l)-1:
            print(str(M[i][j]) + " ", end="")
        else:
            print(M[i][j])



Measured memory_bytes: 7540
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;

const LL inf = 0x3f3f3f3f3f3f3f3f;
const int N = 55, M = 110;
struct Edge {
	int to, next;
	LL a, b;
}e[M * 2];
int head[N], idx;
LL c[N], d[N];
LL dis[N][2510];
int n, m, s;

void add(int u, int v, LL a, LL b) {
	e[++idx].to = v;
	e[idx].next = head[u];
	e[idx].a = a;
	e[idx].b = b;
	head[u] = idx;
}

void spfa() {
	queue<PII> q;
	for(int i = 1; i <= n; i++) {
		for(int j = 0; j <= 2500; j++) {
			dis[i][j] = inf;
		}
	}
	dis[1][s] = 0;
	q.push({1, s});
	while(!q.empty()) {
		int u = q.front().first, w = q.front().second; q.pop();
		for(int i = head[u]; i; i = e[i].next) {
			int v = e[i].to;
			LL a = e[i].a, b = e[i].b;
			if(w >= a && dis[v][w - a] > dis[u][w] + b) {
				dis[v][w - a] = dis[u][w] + b;
				q.push({v, w - a});
			}
		}
		if(dis[u][min(w + c[u], (LL)2500)] > dis[u][w] + d[u]) {
			dis[u][min(w + c[u], (LL)2500)] = dis[u][w] + d[u];
			q.push({u, min(w + c[u], (LL)2500)});
		}
	}
}

int main() {
	scanf("%d%d%d", &n, &m, &s);
	s = min(s, 2500);
	while(m--) {
		int u, v;
		LL a, b;
		scanf("%d%d%lld%lld", &u, &v, &a, &b);
		add(u, v, a, b);
		add(v, u, a, b);
	}
	for(int i = 1; i <= n; i++) {
		scanf("%lld %lld", &c[i], &d[i]);
	}
	spfa();
	for(int i = 2; i <= n; i++) {
		LL res = inf;
		for(int j = 0; j <= 2500; j++) res = min(res, dis[i][j]);
		printf("%lld\n", res);
	}
	return 0;
}


Measured memory_bytes: 5048
#include<bits/stdc++.h> 
using namespace std; 
#define ll long long  
#define all(x) x.begin(),x.end()

int const N = 3e5+1;
int n, h,w; 


int main(){
     cin >> n >> h >> w;
     ll an = 0 ;
     for(int i=0;i<n;++i){
         for(int j=0;j<n;++j){
             int x = i , y = j ;
             if(x + h <= n && y + w <= n)++an;
         }
     }
    cout << an << "\n";
}
    

Measured memory_bytes: 256
from math import ceil
a, b, c, x, y = map(int, input().split())

def foo(z):
    res = a*max(x-z//2, 0) + b*max(y-z//2, 0) + c*z
    #print (z, res)
    return res
candid = []
for z in range(max(x, y)*2+1):
    candid.append(foo(z))
print (min(candid))

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

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <climits>
#include <bitset>
#include <array>
#include <deque>
#include <queue>
#include <map>
#include <set>
#define all(x) (x).begin(),(x).end()

const int MOD = 1e9 + 7;

void solve(){

}
int main(){
    int A,B,K;
    cin >> A >> B >> K;
    vector<int> ans;
    int cnt = 0;
    for (int i = 1; i <= 100; ++i) {
        if (A % i == 0 && B % i == 0) {
            cnt++;
            ans.push_back(i);
        }
    }
    cout << ans[ans.size()-K] << endl;

    return 0;
}


Measured memory_bytes: 888
N,M=map(int,input().split(' '))

m=[[] for i in range(N)]

for i in range(M):
  x,y=map(int,input().split(' '))
  m[x-1].append(y-1)
  m[y-1].append(x-1)

sign=[0]
signed_map=[-1]*N
signed_map[0]=1
while True:
  signed=sign
  sign=[]
  for s in signed:
    for room in m[s]:#サインされた場所から繋がってるとこを回る
      if signed_map[room]==-1:
        signed_map[room]=s+1
        sign.append(room)
  if sign==[]:break

print('Yes')
for ch in signed_map[1:]:
  print(ch)

Measured memory_bytes: 37476
import java.util.*;
public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int k = sc.nextInt();
    String s = sc.next();
    char[] c = new char[n];

    for(int i=0 ; i<n ; i++){
      c[i] = s.charAt(i);
    }
    if(c[k-1]=='A') c[k-1]='a';
    if(c[k-1]=='B') c[k-1]='b';
    if(c[k-1]=='C') c[k-1]='c';

    for(int i=0 ; i<n ; i++){
      System.out.print(c[i]);
    }
    System.out.println();
  }
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i < (n);++i)
#define reps(i,n) for(int i = 1;i <= (n);++i)
using namespace std;
int main(){
  int a[10] = {};
  cin >> a[0] >> a[1] >> a[2];
  sort(a,a+3);
  cout << a[2] * 10 + a[1] + a[0] << '\n';
  return 0;
}

Measured memory_bytes: 256
# @oj: atcoder
# @id: hitwanyang
# @email: 296866643@qq.com
# @date: 2020-04-27 10:29
# @url:https://atcoder.jp/contests/abc164/tasks/abc164_a
import sys,os
from io import BytesIO, IOBase
import collections,itertools,bisect,heapq,math,string
# region fastio

BUFSIZE = 8192

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
# ------------------------------
def main():
    nums=list(map(int,input().split()))
    s,w=nums[0],nums[1]
    if w>=s:
        print ("unsafe")
    else:
        print ("safe")
if __name__ == "__main__":
    main()

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

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

  int arr[26]={0}, i;
  for(i=0; i<w.length(); i++){
    arr[(int)w[i]-97]++;
  }

  for(i=0; i<26; i++){
    if(arr[i]%2!=0){
        cout<<"No\n";
        break;
    }
  }
  if(i==26)
    cout<<"Yes\n";
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Atcoder
{
    class Atcoderrrrrrr
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');

            int N = int.Parse(s[0]);int H = int.Parse(s[1]);int W = int.Parse(s[2]);

            int ans = 0;
            for(int i = 0; i < N; i++)
            {
                string[] d = Console.ReadLine().Split(' ');
                int A = int.Parse(d[0]); int B = int.Parse(d[1]);

                if(A>=H && B >= W)
                {
                    ans++;
                }
            }
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 11092
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepLRE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define rSort(v) sort(v.rbegin(), v.rend())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

ll dx[9] = {-1, 1, 0, 0, -1, -1, 1, 1, 0};
ll dy[9] = {0, 0, -1, 1, -1, 1, -1, 1, 0};

/* Macros reg. ends here */

const ll INF = 1LL << 50;

int main() {
  // ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  ll h, w;
  cin >> h >> w;

  vector<string> mp(h);
  ll bcnt = 0;
  rep(i,h) {
    cin >> mp[i];
    rep(j,w) if(mp[i][j] == '#') bcnt++;
  }

  queue<P> que;
  vvll dist(h, vll(w, INF));
  que.emplace(0, 0);
  dist[0][0] = 0;
  while(!que.empty()){
    ll y, x;
    tie(y, x) = que.front();
    que.pop();
    rep(i, 4){
      ll ny = y + dy[i];
      ll nx = x + dx[i];
      bool ok = 0 <= ny && ny < h && 0 <= nx && nx < w;
      if(ok){
        if(dist[ny][nx] == INF && mp[ny][nx] == '.') {
          que.emplace(ny, nx);
          dist[ny][nx] = dist[y][x] + 1;
        }
      }
    }
  }
  
  if(dist[h-1][w-1] == INF) {
    cout << -1 << endl;
    return 0;
  }

  ll ans = h*w - bcnt - dist[h-1][w-1] - 1;
  cout << ans << endl;

  return 0;
}


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

int main() {
  string S,T;
  int a=0;
  cin>>S;
  cin>>T;
  if(S.size()+1!=T.size()){
    cout<<"No"<<endl;
  } else {
    for(int i=0;i<S.size();i++){
      if(S[i]!=T[i]){
        a=1;
        break;
      }
    }
    if(a==1) cout<<"No"<<endl;
    if(a==0) cout<<"Yes"<<endl;
  }
}
    
  

Measured memory_bytes: 3624
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace Test1 {

    


    class ClassMain {

       

        public static void Main(String[] args) {
            string line;
            while ((line = Console.ReadLine()) != null) {
                if (double.Parse(line) < 0) { break; }
                string[] strs = line.Split('.');

                if (strs.Length < 2) { strs = new string[] { strs[0], "0" }; }
                while (strs[1].Length < 4) { strs[1] += "0"; }

                bool[] digits = new bool[4];
                int syousuu = int.Parse(strs[1]);
                if (syousuu / 5000 > 0) { 
                    digits[0] = true;
                    syousuu %= 5000;
                }
                if (syousuu / 2500 > 0) {
                    digits[1] = true;
                    syousuu %= 2500;
                }
                if (syousuu / 1250 > 0) {
                    digits[2] = true;
                    syousuu %= 1250;
                }
                if (syousuu / 625 > 0) {
                    digits[3] = true;
                    syousuu %= 625;
                }
                if (syousuu > 0) { Console.WriteLine("NA"); continue; }

                int seisuu = int.Parse(strs[0]);
                bool[] seidigits = new bool[8];
                int basem = 2*2*2*2* 2*2*2;
                if (seisuu > basem*2-1) { Console.WriteLine("NA"); continue; }
                for (int i = 0; i < 8; i++) {
                    if (seisuu / basem > 0) {
                        seidigits[i] = true;
                        seisuu %= basem;
                    }
                    basem /= 2;
                }
                StringBuilder sb = new StringBuilder();
                for (int i = 0; i < 8; i++) {
                    if (seidigits[i]) { sb.Append("1"); }
                    else { sb.Append("0"); }
                }
                sb.Append(".");
                for (int i = 0; i < 4; i++) {
                    if (digits[i]) { sb.Append("1"); }
                    else { sb.Append("0"); }
                }
                Console.WriteLine(sb.ToString());
            }
        }

        
    }



    
}

Measured memory_bytes: 5820
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,n,s) for(int i = s; i < (n); ++i)
#define rsrep(i,n,s) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;

int main() {
    int n;
    cin >> n;
    vint a(3*n);
    rep(i, 3*n) cin >> a[i];
    sort(rall(a));
    ll ans = 0;
    rep(i, n) {
        ans += a[2*i+1];
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1408
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cwchar>
#include <cwctype>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <codecvt>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize("Ofast")
using namespace std;
typedef int64_t ll;
typedef long double ld;
const ll INF=(1LL<<60);
const ld pi=acosl((ld)1);
const ll mod = 1000000007;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};

bool solve(){
  ll n;cin>>n;
  vector<ll>mp(10000,false);
  mp[1]=true;
  for(int j=2;j<=n;j++){
    for(int i=2;pow(j,i)<=n;i++){
      mp[pow(j,i)]=true;
    }
  }
  ll ans=1;
  rep(i,n+1)if(mp[i])ans=max(ans,i);
  cout<<ans<<endl;
  
  return false;
}

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout<<fixed;
	cout<<setprecision(30);
	return solve();
}


Measured memory_bytes: 512
def main():
    s=list(input())
    n=len(s)+1
    ans=[0 for _ in range(n)]
    for i in range(n-1):
        if s[i]=="<":
            ans[i+1]=ans[i]+1
    s.reverse()
    ans.reverse()
    for i in range(n-1):
        if s[i]==">":
            ans[i+1]=max(ans[i]+1,ans[i+1])
    print(sum(ans))    
if __name__ == "__main__":
    main()

Measured memory_bytes: 27848
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]

ab = sorted(ab, key=lambda x: x[1])
s = ab[0][1]
ans = 1
for i in ab:
    if s <= i[0]:
        ans += 1
        s = i[1]
print(ans)

Measured memory_bytes: 29400
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define pb push_back
const int maxn = 10000;
const int INF32 = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7 = 1'000'000'007;
const int MOD9 = 1'000'000'009;
const int mod = MOD7;

void ERROR(int num) { cout << "ERROR" << num << endl; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
int dx[8]={-1,0,1,0,1,1,-1,-1};
int dy[8]={0,-1,0,1,1,-1,1,-1};

vector<vector<char>> G;
vector<vector<int>> L;
vector<vector<int>> R;
vector<vector<int>> U;
vector<vector<int>> D;

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

    int H, W;
    cin >> H >> W;
    G.resize(H);
    rep(i,H) G[i].resize(W);
    rep(i,H)rep(j,W) cin >> G[i][j];

    L.resize(H);
    rep(i,H) L[i].resize(W);
    R.resize(H);
    rep(i,H) R[i].resize(W);
    U.resize(H);
    rep(i,H) U[i].resize(W);
    D.resize(H);
    rep(i,H) D[i].resize(W);
    //L
    rep(i,H){
      int cnt = 0;
      rep(j,W){
        if(G[i][j]=='.') cnt++;
        else cnt=0;
        L[i][j]=cnt;
      }
    }
    //R
    rep(i,H){
      int cnt = 0;
      for(int j = W-1; j>=0; j--){
        if(G[i][j]=='.') cnt++;
        else cnt=0;
        R[i][j]=cnt;
      }
    }
    //U
    rep(j,W){
      int cnt = 0;
      rep(i,H){
        if(G[i][j]=='.') cnt++;
        else cnt=0;
        U[i][j]=cnt;
      }
    }
    //D
    rep(j,W){
      int cnt = 0;
      for(int i = H-1; i>=0; i--){
        if(G[i][j]=='.') cnt++;
        else cnt=0;
        D[i][j]=cnt;
      }
    }

    //ans
    int ans = 0;
    rep(i,H) rep(j,W){
      int total = 0;
      if(G[i][j] =='.'){
        total = L[i][j]+R[i][j]+U[i][j]+D[i][j]-3;
        //printf("(%d,%d), L:%d R:%d U:%d D:%d\n", i,j,L[i][j], R[i][j],U[i][j], D[i][j]);
        ans = max(ans,total);
      }
    }
    cout << ans << endl;

} 

Measured memory_bytes: 69120
#include <iostream>
using namespace std;
int main(void){
    // Here your code !
    int a,b,c;
    cin >> a >> b >> c;
    if(a==b){
        cout << c;
    }
    else if(a==c){
        cout << b;
    }
    else{
        cout << a;
    }
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace ABC165D
{
    class Program
    {
        static void Main(string[] args)
        {
            long[] ABN = Console.ReadLine().Split().Select(long.Parse).ToArray();

            long a = Math.Min(ABN[1] - 1, ABN[2]);
            long ans = (long)((double)ABN[0] / ABN[1] * a);

            Console.WriteLine(ans);
            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 19040
#!/usr/bin/env python3
# Streamline 

def main():
    N = list(map(int, (input().strip().split(' '))))
    M = N[1]
    N = N[0]
    X = list(map(lambda xi: int(xi), input().strip().split(' ')))
    X = sorted(X)

    if False and N >= M: # 不要
        min_steps = 0
    else:
        L = list()
        i = 0
        while i+1 < len(X):
            L.append(X[i+1]-X[i])
            i += 1
        L = sorted(L, reverse=True)
        min_steps = X[-1] - X[0] - sum(L[0:N-1])

    print(min_steps)

if __name__ == "__main__":
    main()

Measured memory_bytes: 13704
s = input()
counter = 0
ans = 0
len = len(s)
for i in range(len):
    if s[i] == "A":
        counter += 1
    elif s[i] == "T":
        counter += 1
    elif s[i] == "G":
        counter += 1
    elif s[i] == "C":
        counter += 1
    else:
        if counter > ans:
            ans = counter
        
        counter = 0

if counter > ans:
    ans = counter
    
print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)

const int MOD = 1000000007;

const int INF_32 = 1LL << 30;
const int64_t INF_64 = 1LL << 60;

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

    if (1 - L <= 0) { // remove 1st apple
        cout << (L - 1) * (N - 1) + (N - 1) * (N + 2) / 2 << endl;
    } else if (1 - L >= N + 1) { // remove Nth apple
        cout << (L - 1) * (N - 1) + (N - 1) * N / 2 << endl;
    } else {
        cout << (L - 1) * N + N * (N + 1) / 2 << endl;
    }
}

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

typedef long long int   ll;
#define cases           int t;cin>>t;while(t--)
#define FIO             ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define scan(n)         scanf("%d",&n)
#define pb              push_back
#define vi              vector<int>
#define ii              pair<int,int>

using namespace std;

int main(){
    ll x;
    cin>>x;
    ll sum=100;
    ll t=0;
    while(sum<x){
        sum=(double)sum*1.01;
//        cout<<sum<<endl;
        t++;
//        cout<<t<<endl;
    }
    cout<<t;
}


Measured memory_bytes: 3620
/**
 * @author: Jun
 * @date  : 03-14-2019
 **/
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
 
#define el '\n'
#define MOD 1000000007

int a,b;
 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin >> a >> b;
    if(b%a==0){
        cout << a+b << el;
    } else {
        cout << b-a<< el;
    }
    return 0;
}

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

int main(){
  /*
  int n, i, j;
  cin >> n;
  vector<int> A(n);
  rep(i, n) cin >> A[i];
  */
 int k;
 cin >> k;
 vector<int> A(32);
 A = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
 int s = A[k-1];
 cout << s << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>

#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) x.begin(), x.end()


using namespace std;
const int MAXN = 10e5 + 5;
const int INF = 0x7f7f7f7f;
typedef long long ll;
int m[MAXN];

int main() {
#ifndef ONLINE_JUDGE
    freopen("../input.txt", "r", stdin);
    freopen("../output.txt", "w", stdout);
#endif
    int n;
    cin >> n;
    vector<int> a(n);
    int ax;
    rep(i, n) {
        cin >> a[i];
        if (i) ax ^= a[i];
        else ax = a[i];
    }
    rep(i, n - 1) {
        cout << (ax ^ a[i]) << " ";
    }
    cout << (ax ^ a[n - 1]) << endl;
    return 0;
}


Measured memory_bytes: 4040
#include<stdio.h>
int main( )
{
int A,B;
scanf("%d",&A);
scanf("%d",&B);

if((A==1 && B ==2 )||(A==2 && B==1))
printf("3");

if((A==2 && B ==3 )||(A==3 && B==2))
printf("1");

if((A==1 && B ==3 )||(A==3 && B==1))
printf("2");

}

Measured memory_bytes: 128
def main():
    n, a, b = [int(x) for x in input().split()]
    print(calc(n, a, b))
    return


def calc(n ,a, b):
    if a % 2 == b % 2:
        return abs(a - b) // 2
    else:
        if a > b:
            a, b = b, a
        if a - 1 < n - b:
            return calc(n, 1, b - a) + a
        else:
            return calc(n, a + n - b + 1, n) + n - b + 1


if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
/*
    Mbak Sana Dong
    Mbak Chaeyoung Dong
*/
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int arr[200200];
int cnt[200200];
int main()
{
    int n,i,j,k,x,y,ans,curr,m;
    int tc;
    cin >> n >> m;
    for(i=1;i<=n;i++) {
        cin >> arr[i];
    }
    while(m--)
    {
        int mini = n;
        for(i=1;i<=n;i++) {
            mini = min(mini, arr[i]);
        }
        if(mini >= n - 1) {
            for(i=1;i<=n;i++) {
                arr[i] = n;
            }
            break;
        }
        for(i=1;i<=n;i++) {
            int l = max(1, i - arr[i]);
            int r = min(n, i + arr[i]);
            cnt[l]++;
            cnt[r+1]--;
        }
        curr = 0;
        for(i=1;i<=n;i++) {
            curr += cnt[i];
            arr[i] = curr;
            mini = min(mini ,curr);
        }
        for(i=1;i<=n;i++) cnt[i] = 0;
    }
    for(i=1;i<=n;i++) cout << arr[i] << " ";
    cout << endl;
    return 0;
}


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

int main(){
    int n, caseNum = 1;
    while(cin >> n, n){
        int mat[n][n];
        int i = 0, j = 0;
        int num = 1;

        for(int wave = 0; wave <= n+n-2; wave++){
            if(wave % 2 == 1){
                for(i = max(0, wave-n+1); i < min(wave+1,n); i++)   mat[i][wave-i] = num++;
            }else{
                for(j = max(0, wave-n+1); j < min(wave+1,n); j++)   mat[wave-j][j] = num++;
            }
        }

        cout << "Case " << caseNum++ << ":" << endl;
        for(int i = 0; i < n; i++){
            for(int j = 0; j < n; j++){
                cout << right << setw(3) << mat[i][j];
            }
            cout << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3156
#include <bits/stdc++.h>
using namespace std;
int main()
{   long long  int a,b,c,k,sum=0;
    cin>>a>>b>>c>>k;
    while(k>0)
    {
        while(a>0 &&k>0)
        {
            a--;
            sum+=1;
            k--;
            
        }
        while(b>0 && k>0)
        {
            b--;
            k--;
        }
        while(c>0 && k>0)
        {
            c--;
            sum-=1;
            k--;
        }
    }
    cout<<sum;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define ceiv(a, b) (1 + (int)((a) - 1)/(int)(b))
//#define int long long

signed main(){
    int n, x;
    cin >> n >> x;
    
    int minimum = INT_MAX;
    rep(i,n){
        int m; cin >> m;
        x -= m;
        minimum = min(minimum, m);
    }
    
    cout << n + x/minimum << endl;
}

Measured memory_bytes: 256
#include<algorithm>//everybody dies in their nightmares
#include<iostream>
#include<cstring>
#include<cstdio>
#include<set>
#include<map>
#include<queue>
#include<deque>
#include<string>
#include<vector>
#include<sstream>
#include<cmath>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#define f(i,a,b) for(register int i=a;i<=b;++i)
#define ff(i,a,b) for(register int i=a;i>=b;--i)
#define debug(x) cerr << #x << " : " << x << " " << endl
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
const ll mod = 1e9 + 7;
const double tiaohe = 0.57721566490153286060651209;
ll oula(ll x) { ll res = x;f(i, 2, x / i) { if (x % i == 0) { res = res / i * (i - 1);while (x % i == 0) x /= i; } }if (x > 1) res = res / x * (x - 1);return res; }
ll quickmod(ll a, ll n, ll m) { ll s = 1;while (n) { if (n & 1) { s = s * a % m; }a = (a*a) % m;n = n / 2; }return s; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
void ex_gcd(ll a, ll b, ll &x, ll &y, ll &d) { if (!b) { d = a, x = 1, y = 0; } else { ex_gcd(b, a % b, y, x, d);y -= x * (a / b); } }
ll inv(ll t, ll p) { ll d, x, y;ex_gcd(t, p, x, y, d);return d == 1 ? (x % p + p) % p : -1; }
bool isPrime(ll x) { if (x == 2)return true;if (x % 2 == 0)return false;for (ll i = 2;i*i <= x;i++) if (x % i == 0)return false; return true; }
//double a = log(n) +tiaohe + 1.0 / (2 * n);
double eqa = (1 + sqrt(5.0)) / 2.0;

const int N = 6e5 + 5;
int t;
const double p = 3.1415926;
int a[N];
int main()
{
	ll n, m;
	while (cin >> n >> m)
	{
		ll sum = 0;
		f(i, 1, m) { scanf("%d", &a[i]);sum += a[i]; }
		if (sum > n)puts("-1");
		else cout << n - sum << endl;
	}
	return 0;
}

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

int main(){
  int H,W;
  cin >>H>>W;
  string shapu ="#";
  string waku(W+2,'#');
  cout << waku << endl;
  for(int i=0;i<H;i++){
    string S;
    cin >>S;
    S=shapu+S+shapu;
    cout << S<<endl;
  }
  cout << waku << endl;
}

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

char str[1024];
bool f[1024][1024];

int main()
{
	scanf("%s", str);
	int n = strlen(str);
	for (int i = 0; i < n; i++){
		f[i][i] = true;
	}
	for (int t = 0; t < n / 2; t++){
	for (int w1 = 0; w1 < n; w1 += 3){
		for (int w2 = 0; w2 < n; w2 += 3){
			for (int i = 0; i < n; i++){
				int j = i + w1 + 1;
				int k = i + w1 + w2 + 2;
				if (str[i] != 'm') continue;
				if (str[j] != 'e') continue;
				if (str[k] != 'w') continue;
				if (!f[i + 1][j]) continue;
				if (!f[j + 1][k]) continue;
				f[i][k + 1] = true;
			}
		}
	}
	}
	puts(f[0][n] ? "Cat" : "Rabbit");
}

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

int main() {
	ll n;
	cin>>n;
	ll ans=0,l=0,r,cnt;
	for(ll i=1;i<=n;i++) {
		l = i;
		r = (n/i)*i;
		cnt = (r/i) - (l/i) + 1;
		ans += (cnt * (l+r)/2);
	}
	cout<<ans;
}

Measured memory_bytes: 3640
#include<stdio.h>
#include<cstring>
#include<algorithm>
using namespace std;
#define MAX 2000000
#define INFTY (1<<30)

int H, A[MAX+1];

void maxHeapify(int i){
  int l,r, largest;
  l = 2 * i;
  r = 2 * i + 1;

  if(l <= H && A[l] > A[i]) largest = l;
  else largest = i;
  if(r <= H && A[r] > A[largest]) largest = r;

  if(largest != i){
    swap(A[i], A[largest]);
    maxHeapify(largest);
  }
}

int extract(){
  int maxv;
  if(H < 1) return -INFTY;
  maxv = A[1];
  A[1] = A[H--];
  maxHeapify(1);
  return maxv;
}


void increaseKey(int i, int key){
  if(key < A[i]) return ;
  A[i] = key;
  while(i > 1&& A[i/2] < A[i]){
    swap(A[i], A[i/2]);
    i = i/2;
  }
}

void insert(int key){
  H++;
  A[H] = -INFTY;
  increaseKey(H, key);
}

int main(){
  int key;
  char com[10];

  while(1){
    scanf("%s", com);

    if(com[0] == 'e' && com[1] == 'n') break;
    if(com[0] == 'i'){
      scanf("%d", &key);
      insert(key);
    }else{
      printf("%d\n", extract());
    }
  }

  return 0;
}
			



Measured memory_bytes: 6576
#include<map>
#include<queue>
#include<cmath>
#include<bitset>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
const int maxn=1e5+100,P=1e9+7;
int f[110][maxn],n,a[maxn],k;
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	f[0][0]=1;
	for(int i=1;i<=n;i++){
		int sum=0;
		for(int j=0;j<=k;j++){
			sum+=f[i-1][j],sum%=P;
			if(j>a[i]) sum-=f[i-1][j-a[i]-1],sum%=P;
			f[i][j]=sum;
		}
	}
	printf("%d\n",(f[n][k]%P+P)%P);
	return 0;
}


Measured memory_bytes: 40320
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

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

	_ = nextInt()
	_ = nextInt()
	M := nextInt()

	hc := make(map[int]int)
	wc := make(map[int]int)
	hx, wx := 0, 0
	ps := make(map[[2]int]bool)
	for i := 0; i < M; i++ {
		h := nextInt()
		w := nextInt()
		hc[h]++
		wc[w]++

		hx = max(hx, hc[h])
		wx = max(wx, wc[w])
		ps[[2]int{h, w}] = true
	}

	hs := make([]int, 0)
	for h, c := range hc {
		if c == hx {
			hs = append(hs, h)
		}
	}
	ws := make([]int, 0)
	for w, c := range wc {
		if c == wx {
			ws = append(ws, w)
		}
	}

	ans := hx + wx - 1
	for i := 0; i < len(hs); i++ {
		h := hs[i]
		for j := 0; j < len(ws); j++ {
			w := ws[j]
			p := [2]int{h, w}
			if !ps[p] {
				ans = hx + wx
				break
			}
		}
	}

	fmt.Println(ans)
}

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


Measured memory_bytes: 83156
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

int main()
{
	int N;
	in >> N;
	std::vector<int>a(N);
	rep(i, N) in >> a[i];

	long double avg = 0;
	rep(i, N)
	{
		avg += a[i];
	}
	avg /= N;
	long double num = 114514;
	int idx;
	rep(i, N)
	{
		if (std::abs(a[i] - avg) < num)
		{
			num = std::abs(a[i] - avg);
			idx = i;
		}
	}

	out << idx << std::endl;
	return 0;
}


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

int main(){
    int h,w,k;
    cin >> h >> w >> k;
    vector<string> s(h);
    int tot = 0;
    rep(i,h){
        cin >> s.at(i);
        
    }
    int ans = 0;
    rep(i,1<<h){
        rep(j,1<<w){
            int cnt = 0;
            rep(ii,h){
                rep(jj,w){
                    if(i>>ii&1) continue;
                    if(j>>jj&1) continue;
                    if(s.at(ii).at(jj) == '#') cnt++;
                }
            }
            if(cnt == k) ans++;

        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int N;
    cin >> N;

    int max_H = 0;
    int cnt = 0;

    for (int i = 0; i < N; i++){
        int H;
        cin >> H;

        if (H >= max_H){
            cnt++;
            max_H = H;
        }
    }

    cout << cnt << endl;
}

Measured memory_bytes: 256