akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

#define ALL(v) begin(v),end(v)
#define REP(i,n) for(int i=0;i<(n);++i)

typedef vector<vector<char>> piece;

struct solver{
	int n;
	solver(int n_) : n(n_) {}
	piece in[6];
	vector<char> filled;

	void rot(piece &p){
		piece q(n, vector<char>(n));
		REP(i, n)
		REP(j, n){
			q[i][j] = p[j][n - i - 1];
		}
		p.swap(q);
	}

	void rev(piece &p){
		reverse(ALL(p));
	}

	void dfs(int num, int rem){
		if(num == 6){ throw true; }
		int maxtp = num == 0 ? 1 : 6;
		int maxa = num == 0 ? 1 : 8;
		REP(tp, maxtp){
			if(!(rem >> tp & 1)){ continue; }
			piece p = in[tp];
			vector<int> idxs;
			REP(a, maxa){
				idxs.clear();
				if(num % 3 == 0){
					int i = num < 3 ? 0 : n - 1;
					REP(j, n) REP(k, n){
						if(p[j][k]){ idxs.push_back(i * n * n + j * n + k); }
					}
				}
				else if(num % 3 == 1){
					int j = num < 3 ? 0 : n - 1;
					REP(i, n) REP(k, n){
						if(p[i][k]){ idxs.push_back(i * n * n + j * n + k); }
					}
				}
				else{
					int k = num < 3 ? 0 : n - 1;
					REP(i, n) REP(j, n){
						if(p[i][j]){ idxs.push_back(i * n * n + j * n + k); }
					}
				}
				sort(ALL(idxs));

				bool ok = true;
				for(int t : idxs){
					if(filled[t]){
						ok = false;
						break;
					}
				}
				if(ok){
					for(int t : idxs){
						filled[t] = 1;
					}
					dfs(num + 1, rem ^ (1 << tp));
					for(int t : idxs){
						filled[t] = 0;
					}
				}

				rev(p);
				if(a & 1){ rot(p); }
			}
		}
	}

	bool solve() try{
		int sum = 0;
		REP(i, 6){
			piece p(n, vector<char>(n));
			string s;
			REP(j, n){
				cin >> s;
				REP(k, n){
					if(s[k] == 'X'){
						p[j][k] = 1;
						++sum;
					}
				}
			}
			in[i] = p;
		}

		if(sum != n * n * n - (n - 2) * (n - 2) * (n - 2)){
			return false;
		}

		filled.assign(n * n * n, 0);
		dfs(0, 63);
		return false;
	} catch(bool ans){ return ans; }
};

int main(){
	int n;
	while(cin >> n && n){
		bool ans = solver(n).solve();
		cout << (ans ? "Yes\n" : "No\n");
	}
}



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

int main() {
    int a, b;
    cin >> a >> b;
    set<int> ans = {1,2,3};

    ans.erase(a);
    ans.erase(b);
    cout << *ans.begin() << endl;

}

Measured memory_bytes: 256
N,M = map(int,input().split())
x,y = 1, N
used = [False for i in range(N+1)]
for i in range(M):
	if N % 2 == 0 and ((y-x) == N // 2 or used[y-x]):
		y -= 1
		print(x,y)
	else:
		print(x,y)
	used[y-x] = True
	used[N-(y-x)] = True
	x += 1
	y -= 1

Measured memory_bytes: 10448
#include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < n; i++)
#define REPR(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define FORR(i, m, n) for (ll i = m; i >= n; i--)
#define ALL(x) (x).begin(), (x).end()
const long long ILF = 1e18;
const long long MOD = 1e9 + 7;
using namespace std;
typedef long long ll;
int main() {
  string S;

  cin >> S;

  ll L = S.length();

  ll N = 13;

  ll dp[L][N];

  REP(i, L) {
    REP(j, N) { dp[i][j] = 0; }
  }
  if (S[L - 1] == '?') {
    REP(i, 10) { dp[L - 1][i] = 1; }
  } else {
    ll num = (ll)(S[L - 1] - '0');
    dp[L - 1][num] = 1;
  }

  ll digit = 10;

  FORR(i, L - 1, 1) {
    if (S[i - 1] == '?') {
      REP(j, N) {
        REP(k, 10) {
          dp[i - 1][(j + (k * digit) % N) % N] += dp[i][j];
          dp[i - 1][(j + (k * digit) % N) % N] %= MOD;
        }
      }
    } else {
      ll k = (ll)(S[i - 1] - '0');
      REP(j, N) {
        dp[i - 1][(j + (k * digit) % N) % N] += dp[i][j];
        dp[i - 1][(j + (k * digit) % N) % N] %= MOD;
      }
    }

    digit *= 10;
    digit %= N;
  }
  cout << dp[0][5];
  return 0;
}

Measured memory_bytes: 10624
#include <stdio.h>
#include <math.h>

int main(void){
    double d,a;
    double x1,y1,x2,y2;
    scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
    a = (x2-x1)*(x2-x1)+(y2-y1)*(y2-y1);
    d = sqrt(a);
    printf("%f",d);
    return 0; /*0?????????*/
}

Measured memory_bytes: 652
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <queue>
#include <set>
typedef long long lint;
const int N=1e5+5;
int n,sz[N];
std::set <int> tr[N];
std::set <lint> exi;
std::queue <lint> que;

inline int nxi(){
	int x=0;
	char c;
	while((c=getchar())>'9'||c<'0');
	while(x=x*10-48+c,(c=getchar())>='0'&&c<='9');
	return x;
}

namespace U{
	int fa[N],sz[N];
	int find_rt(const int x){
		return fa[x]?fa[x]=find_rt(fa[x]):x;
	}
}

inline lint get_id(const int x,const int y){
	return (lint)x*n+y-1;
}

void ins(int x,int y){
	if(x>y) std::swap(x,y);
	std::set <lint> ::iterator it=exi.find(get_id(x,y));
	if(it!=exi.end()){
		que.push(get_id(x,y));
		tr[x].erase(y);
		tr[y].erase(x);
		exi.erase(*it);
	}
	else{
		exi.insert(get_id(x,y));
		tr[x].insert(y);
		tr[y].insert(x);
	}
}

bool solve(){
	for(int i=1; i<n; ++i){
		if(que.empty()) return 0;
		lint tmp=que.front();
		que.pop();
		int x=tmp/n,y=tmp-(lint)n*x+1;
		x=U::find_rt(x);
		y=U::find_rt(y);
		assert(x!=y);
		if(sz[x]>sz[y]) std::swap(x,y);
		sz[y]+=sz[x];
		U::fa[x]=y;
		for(std::set <int> ::iterator it=tr[x].begin(); it!=tr[x].end(); ++it){
			if(*it==y) continue;
			assert(U::find_rt(*it)==*it);
			tr[*it].erase(x);
			ins(y,*it);
		}
		tr[x].clear();
	}
	return 1;
}

int main(){
#ifdef LOCAL
	freopen("d.in","r",stdin);
#endif
	n=nxi();
	for(int i=1; i<=n; ++i) sz[i]=1;
	for(int i=1; i<n; ++i) ins(nxi(),nxi());
	for(int i=1; i<n; ++i) ins(nxi(),nxi());
	puts(solve()?"YES":"NO");
	return 0;
}

Measured memory_bytes: 35968
import numpy as np

N = int(input())  

A = np.zeros(N) 
B = np.zeros(N) 

for i in range(N):
    A[i], B[i] = map(int, input().split())
    
B1 = np.argsort(B)

ans = "Yes"
 
k = 0
for i in range(N):
    k += A[B1[i]]
    if k > B[B1[i]]:
        ans = "No"
 
print(ans)

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

int main() {
  int N;
  cin >> N;
  vector<int> p(N);

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

  vector<int> v;

  int cnt = 0;
  for(int i = 0; i < N; i++) {
    if(p[i] == i + 1) {
      cnt += 1;
    }else {
      v.push_back(cnt);
      cnt = 0;
    }
  }

  if(cnt > 0) {
    v.push_back(cnt);
  }

  int ans = 0;

  for(int i: v) {
    if(i > 0) {
      ans += (i + 1) / 2;
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 1276
class diceClass:
	def __init__(self, valuelist):
		self.valuelist = valuelist
		self.t = valuelist[0]
		self.b = valuelist[5]
		self.n = valuelist[4]
		self.s = valuelist[1]
		self.e = valuelist[2]
		self.w = valuelist[3]

	def print(self):
		print('t={0}, b={1}, n={2}, s={3}, w={4}, e={5}'.format(self.t, self.b, self.n, self.s, self.e, self.w))

	def throw(self, direction):
		# N,S,W,E
		if direction == 'N':
			self.t, self.s, self.b, self.n = self.s, self.b, self.n, self.t
		elif direction == 'S':
			self.t, self.s, self.b, self.n = self.n, self.t, self.s, self.b
		elif direction == 'W':
			self.t, self.e, self.b, self.w = self.e, self.b, self.w, self.t
		elif direction == 'E':
			self.t, self.e, self.b, self.w = self.w, self.t, self.e, self.b

def compare(lst1, lst2):
	for i in lst1:
		if lst2.count(i) != 1:
			return False
	return True

n = int(input())
dirinput = 'WWWWSWWWWSWWWWSWWWWWSWWWWSSWWWW'
classes = []
for i in range(0,n):
	arrinput = list(map(int, input().split()))
	dice = diceClass(arrinput)
	dicresult = []
	for s in dirinput:
		dice.throw(s)
		if dicresult.count([[dice.t, dice.s], dice.e]) == 0:
			dicresult.append([[dice.t, dice.s], dice.e])
	classes.append(dicresult)

for i in range(0, len(classes)-1):
	for j in range(i+1,len(classes)):
		if compare(classes[i],classes[j]) == True:
			print('No')
			exit(0)

print('Yes')

#		print(classes[i])
#		for k in i:
#			if
#for s in dirinput:
#	dice.throw(s)
#	dice2.throw(s)
#	if dicresult1.count([[dice.t, dice.s], dice.e]) == 0:
#		dicresult1.append([[dice.t, dice.s], dice.e])
#	if dicresult2.count([[dice2.t, dice2.s], dice2.e]) == 0:
#		dicresult2.append([[dice2.t, dice2.s], dice2.e])

#print(dicresult1)
#print(dicresult2)

#for i in dicresult1:
#	if dicresult2.count(i) != 1:
#		print('No')
#		exit(0)

#print('Yes')


Measured memory_bytes: 5860
#include<bits/stdc++.h>
using namespace std;
namespace FAST_IO
{
	template<typename T> void read(T &a)
	{
		a=0;
		int f=1;
		char c=getchar();
		while(!isdigit(c))
		{
			if(c=='-')
			{
				f=-1;
			}
			c=getchar();
		}
		while(isdigit(c))
		{
			a=a*10+c-'0';
			c=getchar();
		}
		a=a*f;
	}
	template <typename T> void write(T a)
	{
		if(a<0)
		{
			a=-a;
			putchar('-');
		}
		if(a>9)
		{
			write(a/10);
		}
		putchar(a%10+'0');
	}
	template <typename T> void writeln(T a)
	{
		write(a);
		puts("");
	}
}
int n,k;
double ans;
int main()
{
 	cin>>n>>k;
    for (int i=1;i<=n;i++) 
	{
        int point=i;
        double r=1.0/n;
        while (point<k) 
		{
            point=point*2;
            r=r/2;
        }
        ans=ans+r;
    }
    printf("%.9lf",ans);
}

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

int main() {
    int a, b;
    cin>>a>>b;
    if (a>9 || b>9)
    {
        cout<<-1;
    }
    else if (a < 0 || b < 0)
    {
        cout<<-1;
    }
    else 
    {
        cout<<a*b;
    }
	return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

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

    char ans = '1';
    rep(i, min((ll)s.size(), k)) {
        if(s[i] != '1') {
            cout << s[i] << endl;
            return 0;
        }
    }

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

Measured memory_bytes: 256
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]

k = int(input())

print(a[k-1])

Measured memory_bytes: 38384
n,k = map(int,input().split())
if n % 2 == 0:
  if 2*k > n:
    print(-1)
  else:
    for i in range(n//2):
      print(k+2*i, k+(3*n)//2-1-i, k+2*n+i)
    for i in range(n//2):
      print(k+1+2*i, k+2*n-1-i, k+(5*n)//2+i)
else:
  if 2*k-1 > n:
    print(-1)
  else:
    for i in range((n+1)//2):
      print(k+2*i, k+(3*n-1)//2-i, k+2*n+i)
    for i in range((n-1)//2):
      print(k+1+2*i, k+2*n-1-i, k+(5*n+1)//2+i)

Measured memory_bytes: 5172
using System;
class Program
{
    static int gcd(int a, int b)
    {
        if (b == 0) return a;
        return gcd(b, a % b);
    }
    static int lcm(int a, int b)
    {
        return a / gcd(a, b) * b;
    }
    static void Main()
    {
        while (true)
        {
            string s = Console.ReadLine();
            if (s == null) break;
            string[] t = s.Split();
            int a = int.Parse(t[0]);
            int b = int.Parse(t[1]);
            Console.WriteLine(gcd(a, b) + " " + lcm(a, b));
        }
    }
}

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

using namespace std;

struct Node {
  long path;
  vector<int> to;
};

vector<int> topological_sort(vector<int>& in, vector<vector<int>>& out) {
  vector<int> s;
  for (size_t i = 1; i < in.size(); ++i) {
    if (in[i] == 0) {
      s.push_back(i);
    }
  }
  vector<int> res;
  for (size_t j = 0; j < s.size(); ++j) {
    res.push_back(s[j]);
    for (int i : out[s[j]]) {
      --in[i];
      if (in[i] == 0) {
        s.push_back(i);
      }
    }
  }
  return res;
}

int main() {
  int N, M;
  cin >> N >> M;
  vector<Node> nodes(N+1);
  vector<int> in(N+1);
  vector<vector<int>> out(N+1);
  for (int m = 0; m < M; ++m) {
    int from, to;
    cin >> from >> to;
    ++in[to];
    out[from].push_back(to);
    nodes[from].to.push_back(to);
  }
  vector<int> top = topological_sort(in, out); 

  long res = 0;
  for (int i : top) {
    for (int to : nodes[i].to) {
      nodes[to].path = max(nodes[to].path, nodes[i].path + 1);
      res = max(res, nodes[to].path);
    }
  }
  cout << res << endl;

  return 0;
}


Measured memory_bytes: 13308
#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;
#define MOD 1000000007
#define ll long long int
#define pair <ll, ll> pi
#define vector <ll> vi
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define SQ(a) (a) * (a)
#define ordered_set tree<ll, null_type, greater_equal<ll>, rb_tree_tag, tree_order_statistics_node_update> //greater_equal<ll> or less<ll>
// find_by_key()   order_of_key()
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
/*bool comp(string a, string b) {
if (a.size() != b.size()) return a.size() < b.size();
return a < b;
}*/

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    //freopen('input.txt', 'r', stdin);
    //freopen('output.txt', 'w', stdout);
    ll i, j, k, n, m, b, d, ans = 0,a,x,y;
    string s,t;
    cin>>s>>t;
    for(i=0;i<s.size();i++){
        if(s[i]!=t[i]){
            ans++;
        }
    }
    cout<<ans<<endl;

    return 0;
}   

Measured memory_bytes: 3804
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
#define fi first
#define se second
using namespace std;
typedef pair<int, int> P;

signed main(){
    int n, m;
    while(1){
        cin >> n >> m;
        int s = 0, t = 0;
        if(n + m == 0) break;
        int a[110] = {}, b[110] = {};
        rep(i, 0, n){
            cin >> a[i];
            s += a[i];
        }
        rep(i, 0, m){
            cin >> b[i];
            t += b[i];
        }
        int p = -1, q = -1;
        rep(i, 0, n){
            rep(j, 0, m){
                if(s - a[i] + b[j] == t + a[i] - b[j]){
                    if(p == -1){
                        p = a[i]; q = b[j];
                    }else if(p + q > a[i] + b[j]){
                        p = a[i]; q = b[j];
                    }
                }
            }
        }
        if(p == -1) cout << -1 << endl;
        else cout << p << " " << q << endl;
    } 
}

Measured memory_bytes: 2956
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
using u64 = unsigned long long;
#define REP(i, n) for (int i = 0; (i64)(i) < (i64)(n); ++i)

#ifdef ENABLE_DEBUG
template <typename T>
void debug(T value) {
  cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  cerr << value << ", ";
  debug(args...);
}
#define DEBUG(...)                              \
  do {                                          \
    cerr << " \033[33m (L" << __LINE__ << ") "; \
    cerr << #__VA_ARGS__ << ":\033[0m ";        \
    debug(__VA_ARGS__);                         \
    cerr << endl;                               \
  } while (0)
#else
#define debug(...)
#define DEBUG(...)
#endif

const i64 MOD = 1'000'000'007;

struct mint {
  long long x;
  mint(long long x = 0) : x((x % MOD + MOD) % MOD) {}
  mint operator-() const { return mint(-x); }
  mint& operator+=(const mint a) {
    if ((x += a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += MOD - a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= MOD;
    return *this;
  }
  mint operator+(const mint a) const { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(long long t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }

  // for prime MOD
  mint inv() const { return pow(MOD - 2); }
  mint& operator/=(const mint a) { return *this *= a.inv(); }
  mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream& is, mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin >> N;
  string S;
  cin >> S;
  vector<mint> dp(N);
  dp[0] = 1;
  for (int i = 1; i < N; ++i) {
    vector<mint> t(N + 1);
    swap(t, dp);
    if (S[i - 1] == '<') {
      dp[0] = 0;
      REP(k, i) { dp[k + 1] = dp[k] + t[k]; }
    } else {
      dp[i] = 0;
      for (int k = i - 1; k >= 0; --k) {
        dp[k] = dp[k + 1] + t[k];
      }
    }
  }
  mint ans;
  REP(i, N) { ans += dp[i]; }
  cout << ans << endl;
}


Measured memory_bytes: 3716
def typing(s, ans):
    for i in range(len(s)):
        if s[i] == '0':
            ans.append('0')
        elif s[i] == '1':
            ans.append('1')
        elif s[i] == 'B' and len(ans) != 0:
            ans.pop()
        else:
            continue

    print(''.join(ans))

S = str(input())
ANS = []
typing(S, ANS)

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

int main(){
  int N, M, C;
  cin >> N >> M >> C;
  vector<int> B(M);
  for (int i = 0; i < M; i++) cin >> B[i];
  vector<vector<int>> A(N);
  for (int i = 0; i < N; i++) A[i].resize(M);
  for (int i = 0; i < N; i++)
  {
    for (int j = 0; j < M; j++)
    {
      cin >> A[i][j];
    }
  }
  
  int ans = 0, feat;
  for (int i = 0; i < N; i++)
  {
    feat = C;
    for (int j = 0; j < M; j++)
    {
      feat += B[j] * A[i][j];
    }
    if (feat > 0) ans++;
  }
  cout << ans;
} 

Measured memory_bytes: 3640
S = input()
K = input()


K = int(K)
ans = 0
S = [c for c in S]

if len(set(S)) == 1:
    print((len(S)) * K //2)
    exit()

cnt = [1]
for i in range(len(S)-1):
    if S[i] == S[i+1]:
        cnt[-1] += 1
    else:
        cnt.append(1)

ans = 0
for i in cnt:
    ans += (i//2) * K

if S[0] == S[len(S)-1]:
    #頭と終わりが両方とも偶数、もしくは片側が奇数の時は上の計算ですでにダブり部分の処理は完了
    #片方だけ奇数の時は、繰り返しK一回につき1回の余分な余計な置換が必要
    #提出 #7882407参照
    if cnt[0]%2 == cnt[-1]%2 ==1:
        ans += K - 1
print(ans)



Measured memory_bytes: 3064
n = int(input())
V = list(map(int, input().split()))
E = {}
O = {}
now = 1
for i, v in enumerate(V):
    if now:
        if v in E.keys():
            E[v] += 1
        else:
            E[v] = 1
    else:
        if v in O.keys():
            O[v] += 1
        else:
            O[v] = 1
    now = 1 - now
E = sorted(E.items(), key=lambda x: -x[1])
O = sorted(O.items(), key=lambda x: -x[1])
if E[0][0] != O[0][0]:
    print(n - E[0][1] - O[0][1])
else:
    if len(E) == 1 and len(O) == 1:
        print(E[0][1])
    elif len(E) == 1:
        print(n-E[0][1]-O[1][1])
    elif len(O) == 1:
        print(n-E[1][1]-O[0][1])
    else:
        print(min(n-E[0][1]-O[1][1], n-E[1][1]-O[0][1]))

Measured memory_bytes: 17648
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<algorithm>
#include<cstdlib>
using namespace std;
typedef long long int ll;

int main()
{
    for(;;){
		int t,n;
		cin >>t;
		if(t==0)return 0;
		cin >> n;
		int time=0;
		for(int i=0;i<n;i++){
			int x,y;
			cin >> x >> y;
			time+=(y-x);
		}
		if(time>=t)printf("OK\n");
		else printf("%d\n",t-time);
	}
    return 0;
}

Measured memory_bytes: 1148
#include <iostream>
#define MAX 100001
using namespace std;

int main(){
  char c;

  int a[26]={};

  while(cin>>c){
    a[c-'a']++;
  }

  bool nouse = false;
  for(int i=0;i<26;i++){
    if(a[i]==0){
      cout<<(char)('a'+i)<<endl;
      nouse = true;
      break;
    }
  }

  if(nouse==false) cout<<"None"<<endl;
}


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

int main(){
    int n;
    cin>>n;
    string a,b,c;
    cin>>a>>b>>c;
    int ans=0;
    for (int i = 0; i < n; ++i) {
        ans+=2;
        if(a[i]==b[i])--ans;
        if(b[i]==c[i])--ans;
        if(c[i]==a[i])--ans;
        if(a[i]==b[i]&&b[i]==c[i]&&c[i]==a[i])++ans;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
 set<char> S;
  for(ll i=0;i<3;i++) {
char x;
    cin>>x;
    S.insert(x);
  }
  
  if(S.size()==3) {
cout<<"Yes"<<endl;
  }
  else {
cout<<"No"<<endl;
  }
}

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

using namespace std;

#define int long long
#define ALL(x) (x).begin(),(x).end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

typedef pair<int,int> PI;
typedef pair<int,pair<int,int>> PII;
static const int INF=1010000000000000017LL;
static const double eps=1e-12;
static const double pi=3.14159265358979323846;
static const int dx[4]={1,-1,0,0};
static const int dy[4]={0,0,1,-1};

template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}

int ans;

signed main(){
    for(int i=0;i<5;++i){
        int x;
        cin>>x;
        if(x==0)ans=i;
    }
    cout<<ans+1<<endl;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
#define sz(s) (int)(s.size())
#define vecprint(v) rep(i,0,v.size()-1)cout << v[i] << " ";cout << endl;
#define arrprint(v,n) rep(i,0,n-1)cout << v[i] << " ";cout << endl;
#define matprint(v,n,m) rep(i,0,n-1){rep(j,0,m-1){cout << v[i][j] << " ";}cout << endl;}
#define SORT(v) sort(v.begin(), v.end())
#define REV(v) reverse(v.begin(), v.end())
using namespace std;
const int mod=1000000007;
const long long INF=1001001001001001001;
typedef long long ll;
typedef pair<ll, ll> P;
template<typename T>
using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>; //小さいものから取り出す

int main(){
    int t;
    cin >> t;
    vector<ll> va(t),vb(t),vc(t),vd(t),vn(t);
    rep(i,0,t-1)cin >> vn[i] >> va[i] >> vb[i] >> vc[i] >> vd[i];

    rep(i,0,t-1){
        map<ll, ll> mp;
        ll n = vn[i],a = va[i], b = vb[i], c = vc[i], d = vd[i];
        priority_queue<P> q;
        q.push(make_pair(n,0));
        int amari;
        ll ans = INF;
        // int count = 0;
        ll nnow,ncoin;
        while(!q.empty()){
            // count++;
            P p = q.top();q.pop();
            ll now = p.first, coin = p.second;
            // cout << now << " " << coin << endl;
            // if(now == 0){ans = min(ans, coin);continue;}
            if(now == 0)continue;
            if(log10(now)+log10(d) <= 18)ans = min(ans, coin+now*d);
            if(now==1)continue;
            if(mp[now] != 0 && mp[now] < coin)continue;
            amari = now % 2;
            nnow = (now+(2-amari))/2, ncoin = coin + a + (2-amari)*d;
            if(amari != 0)if(mp[nnow] == 0 || mp[nnow] > ncoin){q.push(make_pair(nnow, ncoin));mp[nnow] = ncoin;}
            nnow = (now-amari)/2, ncoin = coin + a + amari*d;
            if(mp[nnow] == 0 || mp[nnow] > ncoin){q.push(make_pair(nnow, ncoin));mp[nnow] = ncoin;}

            amari = now % 3;
            nnow = (now+(3-amari))/3, ncoin = coin + b + (3-amari)*d;
            if(amari != 0)if(mp[nnow] == 0 || mp[nnow] > ncoin){q.push(make_pair(nnow, ncoin));mp[nnow] = ncoin;}
            nnow = (now-amari)/3, ncoin = coin + b + amari*d;
            if(mp[nnow] == 0 || mp[nnow] > ncoin){q.push(make_pair(nnow, ncoin));mp[nnow] = ncoin;}

            amari = now % 5;
            nnow = (now+(5-amari))/5, ncoin = coin + c + (5-amari)*d;
            if(amari != 0)if(mp[nnow] == 0 || mp[nnow] > ncoin){q.push(make_pair(nnow, ncoin));mp[nnow] = ncoin;}
            nnow = (now-amari)/5, ncoin = coin + c + amari*d;
            if(mp[nnow] == 0 || mp[nnow] > ncoin){q.push(make_pair(nnow, ncoin));mp[nnow] = ncoin;}
        }
        cout << ans << endl;
    }
    

//  printf("%.10f\n",ans);

    return 0;
}

Measured memory_bytes: 4592
object Main {
	def main(args:Array[String]) = {
		val sc = new java.util.Scanner(System.in)
		
		val a, b, c, x = sc.nextInt
		
		val list = for(p <- 0 to a; q <- 0 to b; r <- 0 to c) yield ( 500 * p + 100 * q + 50 * r )
		println( list.filter( _ == x ).size ) 
	}
}


Measured memory_bytes: 34480
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
int main() {
  int L;
  cin >> L;
  bool f = true;
  int N;
  int sum = 0;
  vector<pair<P,int>> G;
  for (int bit = 25; bit >= 0; bit--) {
    if ((1 << bit) & L) {
      if (f) {
        f = false;
        N = bit+1;
        for (int i = 1; i < N; i++) {
          G.push_back(make_pair(make_pair(i,i+1),0));
          G.push_back(make_pair(make_pair(i,i+1),(1 << i-1)));
        }
      } else {
        G.push_back(make_pair(make_pair(bit+1,N),sum));
      }
      sum += (1 << bit);
    }
  }
  int M = (int)G.size();
  cout << N << " " << M << endl;
  for (int i = 0; i < M; i++) {
    cout << G[i].F.F << " " << G[i].F.S << " " << G[i].S << endl;
  }
  return 0;
}

Measured memory_bytes: 3564
#include <stdio.h>

int main() {

    int i, n, k;
    while (scanf("%d", &n) && n ) {

	int less1Cnt = 0;
	int zeroCnt = 0;
	for ( i=0; i<n; ++i ) {
	    scanf("%d", &k);
	    if (k <= 1) ++less1Cnt;
	    if (k == 0) ++zeroCnt;
	}

	if (n == less1Cnt) printf("NA\n");
	else printf("%d\n", n - zeroCnt + 1);
    }

    return 0;
}



Measured memory_bytes: 2060
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
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;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const ll INF = 1ll<<30;
const ll longINF = 1ll<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;
const bool debug = 0;
//---------------------------------//

int N, M;
int S[2123], T[2123];
ll dp[2123], sum[2123];

int main() {
	cin >> N >> M;
	REP(i, N) scanf("%d", S + i);
	REP(i, M) scanf("%d", T + i);
	
	REP(i, N) {
		sum[0] = 1;
		REP(j, M) sum[j + 1] = (sum[j] + dp[j]) % MOD;
		
		for (int j = M - 1; j >= 0; j--) {
			if (S[i] != T[j]) continue;
			(dp[j] += sum[j]) %= MOD;
		}
	}
	
	ll ans = 1;
	REP(i, M) (ans += dp[i]) %= MOD;
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <queue>
using namespace std;

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

// メモ化再帰
// pos を出発した場合の最長の経路長を返す
long long dfs(int pos, vector<long long>& dist, vector<vector<int>>& G){
    if(dist[pos] >= 0) return dist[pos];
    long long ret = 0;
    for(int v: G[pos]){
        ret = max(ret, dfs(v, dist, G)+1);
    }
    return dist[pos] = ret;
}

int main()
{
    int N, M;
    cin >> N >> M;
    vector<vector<int>> G(N);
    REP(i, M){
        int x, y;
        cin >> x >> y;
        --x, --y;
        G[x].push_back(y);
    }

    // dist[i]: i から出発したときの最長の経路長
    vector<long long> dist(N, -1);
    REP(i, N) dfs(i, dist, G);
    cout << *max_element(dist.begin(), dist.end()) << endl;

    return 0;
}

Measured memory_bytes: 9216
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(S: str):
    if len(set([S[0],S[1],S[2]])) == 1: print(NO)
    else : print(YES)

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#pragma region
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <iomanip>
#include <cstdint>
#include <bitset>
#include <fstream>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()

#pragma region UnionFind
struct UnionFind
{
	vector<int> par;

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

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

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

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

	int size(int x)
	{
		return -par[root(x)];
	}
};
#pragma endregion
#pragma region GCD
int gcd(int a, int b)
{
	if (a%b == 0)return b;
	return gcd(b, a%b);
}
#pragma endregion
#pragma region chmin
template<class T> inline bool chmin(T& a, T b)
{
	if (a > b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma region chmax
template<class T> inline bool chmax(T& a, T b)
{
	if (a < b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma endregion


int main()
{
	int n, k; cin >> n >> k;
	vector<int> p(n); rep(i, n)cin >> p[i];
	sort(all(p));
	int res = 0;
	rep(i, k)res += p[i];
	cout << res << endl;
}

Measured memory_bytes: 3600
N = int(input())

e = [0] * (N+1)

for i in range(2, N+1):
    cur = i
    for j in range(2, i+1):
        while cur % j == 0:
            e[j] += 1
            cur //= j

cnt = 0

for i in range(2, N+1):
    for j in range(i+1, N+1):
        for k in range(2, N+1):
            if i == j or j == k or k == i:
                continue
            if e[i] >= 4 and e[j] >= 4 and e[k] >= 2:
                cnt += 1

for i in range(2, N+1):
    for j in range(2, N+1):
        if i == j or j == k or k == i:
            continue
        if e[i] >= 14 and e[j] >= 4:
            cnt += 1

for i in range(2, N+1):
    for j in range(2, N+1):
        if i == j or j == k or k == i:
            continue
        if e[i] >= 24 and e[j] >= 2:
            cnt += 1

for i in range(2, N+1):
    if e[i] >= 74:
        cnt += 1

print(cnt)

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cstring>
#include <functional>
#include <cmath>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define rep1(i,n) for(int i=1;i<=(n);++i)
#define all(c) (c).begin(),(c).end()
#define fs first
#define sc second
#define pb push_back
#define show(x) cout << #x << " " << x << endl
typedef pair<int,int> P;
int N,p[100000],go[100000];
bool visited[100000];
int dfs(int v){
	if(visited[v]&&go[v]==-2) return -2;
	if(visited[v]&&go[v]==-1) return -2;
	if(visited[v]) return go[v];
	visited[v]=true;
	return go[v]=dfs(v+p[v]);
}
int dp[100000],inf=1e9;
int main(){
	cin>>N;
	rep(i,N) cin>>p[i];
	rep(i,N) go[i]=-1;
	rep(i,N) if(p[i]==0) visited[i]=true,go[i]=i;
	rep(i,N){
		if(p[i]!=0&&!visited[i]) go[i]=dfs(i);
	}
	rep(i,N) dp[i]=inf;
	dp[0]=0;
	priority_queue<P,vector<P>,greater<P> > que;
	que.push(P(0,0));
	while(!que.empty()){
		P p=que.top();
		que.pop();
		int v=p.sc;
		if(dp[v]!=p.fs) continue;
		if(v==N-1) break;
		rep1(i,6){
			int nxt=min(N-1,v+i);
			if(go[nxt]!=-2){
				if(dp[go[nxt]]>dp[v]+1){
					dp[go[nxt]]=dp[v]+1;
					que.push(P(dp[go[nxt]],go[nxt]));
				}
			}
		}
	}
	cout<<dp[N-1]<<endl;
}

Measured memory_bytes: 3764
import numpy as np
MOD=10**9+7

S=[int(x) if x != "?" else -1 for x in input()]
N=len(S)

#現在考えてる1つ前の桁数で, 余りがiになる整数の個数
r=[0]*13

#まず1つ目の値が1の位とする
s=S[0]
if s != -1:
  r[s] = 1
else:
  for i in range(10):
    r[i] = 1

#桁を進めながら個数をカウント
for i in range(1,N):
  #dp[j]
  #現在考えている桁(i)を除く, 余りがjとなる整数の個数
  dp = [0]*26
  #桁が1つ上がるので, 1つ前のあまりが10倍になる
  for j in range(13):
    dp[j*10%13] += r[j] % MOD
  #アクセスを高速にするため2倍の長さをとる(dp[i]==di[i+13])
  dp[13:26] = dp[0:13]
  r=[0]*13
  s=S[i]
  if s == -1:
    w=sum(dp[4:14])
    for j in range(13):
      r[j] += w
      w += dp[j+1] -dp[j+4]
  else:
    for j in range(13):
      r[j] += dp[13-s+j]
print(r[5]%MOD)

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

int main() {
    int x;
    cin >> x;
    int max = 1;
    for(int i = 1; i <= x; ++i){
        for(int j = 2; j <= x; ++j){
            if(pow(i, j) <= x && pow(i, j) > max){
                     max = pow(i, j);
            }
        }
    }
    cout << max << endl;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define sc(x) scanf("%lld",&x);

const int mod = 1e9+7;
int qp(int n,int x=2)
{
    int ans = 1;
    while(n){
        if(n&1)ans=(ans*x)%mod;
        x = (x*x)%mod;
        n>>=1;
    }
    return ans;
}
int f[200005];
int invf[200006];
void init(int n)
{
    f[0]=1;
    for(int i=1;i<=n;i++){
        f[i]=(f[i-1]*i)%mod;
    }
    invf[n] = qp(mod-2,f[n]);

    invf[0] = 1;
    int x = n;
    for(int i=n-1;i>0;i--){
        invf[i] = (invf[i+1]*x)%mod;
        x = i;
    }
    

}
int C(int n,int m)
{
    return ((f[n]*invf[m])%mod*invf[n-m])%mod;
}
/*
int mulit(int a,int b,int m){
    int ans=0;
    while(b){
        if(b&1) ans=(ans+a)%m;
        a=(a<<1)%m;
        b>>=1;
    }
    return ans;
}

int quick_mod(int a,int b,int m){
    int ans=1;
    while(b){
        if(b&1){
            ans=mulit(ans,a,m);
        }
        a=mulit(a,a,m);
        b>>=1;
    }
    return ans;
}

int comp(int a,int b,int m){
    if(a<b) return 0;
    if(a==b) return 1;
    if(b>a-b) b=a-b;
    int ans=1,ca=1,cb=1;
    for(int i=0;i<b;i++){
        ca=ca*(a-i)%m;
        cb=cb*(b-i)%m;
    }
    ans=ca*quick_mod(cb,m-2,m)%m;
    return ans;
}
int A[50];
int B[50];

set<int> st;
int n,k;
void dfs(int x)
{
    if(x == 0){
        for(int i=1;i<=n;i++)B[i]=0;
        for(int i=1;i<=n;i++){
            B[A[i]]++;
        }
        int tmp=0;
        for(int i=1;i<=n;i++){
            tmp = (tmp*17+B[i])%mod;

        }
        //cout<<B[1]<<' '<<B[2]<<' '<<B[3]<<'\n';
        st.insert(tmp);
        return;
    }
    int t;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            if(A[i]!=j){
                t=A[i];
                A[i]=j;
                dfs(x-1);
                A[i]=t;
            }
        }
    }
}*/
signed main()
{
    int  n,k;

    sc(n)sc(k)
    init(n);
    if(k>=n-1)k = n-1;
    int ans =0;

    for(int i=1;i<=k;i++){
        ans=(ans+C(n-1,i)*C(n,i)%mod)%mod;
    }
    if(k>=2){
        ans = (ans+1)%mod;
    }

   cout<<ans<<'\n';
}


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

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

const ll INF = 1e18;

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

int main() {
  ll a,b,q;
  cin>>a>>b>>q;
  vector<ll> s(a+2);
  vector<ll> t(b+2);
  vector<ll> x(q);
  vector<ll> S(q);
  vector<ll> T(q);
  s[0]=-INF;
  t[0]=-INF;
  s[a+1]=INF;
  t[b+1]=INF;

  rep(i,a)cin>>s[i+1];
  rep(i,b)cin>>t[i+1];
  rep(i,q){
    ll ans=INF;
    cin>>x[i];
    ll si=lower_bound(s.begin(),s.end(),x[i])-s.begin();
    //S[i]=now;
    ll ti=lower_bound(t.begin(),t.end(),x[i])-t.begin();
  //  T[i]=now;
    ll lft=max(abs(x[i]-s[si-1]),abs(x[i]-t[ti-1]));
    ll rt=max(abs(x[i]-s[si]),abs(x[i]-t[ti]));
    ll lr=min(abs(x[i]-s[si-1])+abs(s[si-1]-t[ti]),abs(x[i]-t[ti])+abs(s[si-1]-t[ti]));
    ll rl=min(abs(x[i]-s[si])+abs(s[si]-t[ti-1]),abs(x[i]-t[ti-1])+abs(s[si]-t[ti-1]));

    ans=min(rt,lft);
    ans=min(ans,lr);
    ans=min(ans,rl);
    cout<<ans<<endl;
  ///  cout<<lft<<' '<<rt<<' '<<lr<<' '<<rl<<endl;


  }




}


Measured memory_bytes: 5248
#include <cstdio>
#include <iostream>
#include <algorithm>
#define oo 987654321
#define INT long long
using namespace std;

INT n, k, x = 1, t[100010], mx;

int main()
{
    ios::sync_with_stdio(false);
    cin>>n>>k;
    for(int i = 0 ; i < n ; i++ )
    {
        cin>>t[i];
        if( i == 0 ) x = t[i];
        x = __gcd(x, t[i]);
        mx = max(mx, t[i]);
    }
    if( mx < k ) return cout<<"IMPOSSIBLE"<<endl, 0;
    else
    {
        for(int i = 0 ; i < n ; i++ )
            if( (t[i]-k)%x == 0 ) return cout<<"POSSIBLE"<<endl, 0;
    }
    cout<<"IMPOSSIBLE"<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define PB push_back
#define MP make_pair
#define MOD 1000000007LL
#define endl "\n"
#define fst first
#define snd second
const ll UNDEF = -1;
const ll INF=1e18;
template<typename T> inline bool chkmax(T &aa, T bb) { return aa < bb ? aa = bb, true : false; }
template<typename T> inline bool chkmin(T &aa, T bb) { return aa > bb ? aa = bb, true : false; }
typedef pair<ll,ll> pll;
typedef vector<ll> vll;
const int mc=26;
void solve(string s){
	string ans;
	if (s=="zyxwvutsrqponmlkjihgfedcba") {
		ans="-1";
	}
	else if (s.length()<mc) {
		bitset<mc> used; used.reset();
		for (auto &w:s) used[w-'a']=true;
		int got=-1;
		for (int i=0;i<mc;i++) if (!used[i]) {got=i; break;}
		assert(got!=-1);
		char gotc=got+'a';
		ans=s+gotc;
	}
	else {
		assert(s.length()==mc);
		int got=0;
		for (int i=mc-2;i>=0;i--) {
			if (s[i]<s[i+1]) {
				got=i+1; break;
			}
		}
		assert(got!=0);
		//printf("got:%d %c\n",got,s[got-1]);
		bitset<mc> good; good.reset();
		for (int i=got;i<mc;i++) {
			good[s[i]-'a']=true;
		}
		int d=-1;
		for (int c=s[got-1]+1-'a';c<mc;c++) {
			if (good[c]) {d=c; break;}
		}
		assert(d!=-1);
		assert(d!=s[got-1]-'a');
		s[got-1]=d+'a';
		ans=s;
		ans.resize(got);
	}
	cout<<ans<<endl;
}

int main(){	
	ios_base::sync_with_stdio(false); cin.tie(0);
	string S;
	cin >> S;
	solve(S);
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int x, a , b;
  cin >> x >> a >> b;
  
  if ( abs(x-a) < abs(x-b)){
    cout << "A" << endl;
  }
  
  else{
    cout << "B" << endl;
  }
}

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


int main() {
	int n, x;
	cin >> n >> x;
	vector<int> m(n);
	for(int i=0; i<n; i++){
		cin >> m.at(i);
	}
	sort(m.begin(), m.end());
	int ans=n;
	int used=0;
	for(int i=0; i<n; i++){
		used += m.at(i);
	}
	cout << ans + (x-used)/m.at(0) << endl;
}



Measured memory_bytes: 256
package main

import (
  "container/list"
  "fmt"
)

type point struct {
  h, w int
}

var H int
var W int
var grid [50][50]byte
var dist [50][50]int

func main() {
  fmt.Scan(&H, &W)

  numWhites := 0
  var s string
  for i := 0; i < H; i++ {
    fmt.Scan(&s)
    for j := 0; j < W; j++ {
      grid[i][j] = s[j]

      dist[i][j] = -1
      if grid[i][j] == '.' {
        numWhites++
      }
    }
  }

  // (1, 0) (-1, 0), (0, 1), (0, -1)
  dh := []int{1, -1, 0, 0}
  dw := []int{0, 0,  1, -1}

  q := list.New()
  start := point{0, 0}
  q.PushBack(start)
  dist[0][0] = 0

  for q.Len() > 0 {
    e := q.Front()
    q.Remove(e)
    cur := e.Value.(point)
    if cur.h == H - 1  && cur.w == W - 1 {
      break
    }
    for i := 0; i < 4; i++ {
      next := point{cur.h + dh[i], cur.w + dw[i]}
      if next.h < 0 || H <= next.h || next.w < 0 || W <= next.w {
        continue
      }
      if grid[next.h][next.w] == '#' || dist[next.h][next.w] >= 0 {
        continue
      }
      dist[next.h][next.w] = dist[cur.h][cur.w] + 1
      q.PushBack(next)
    }
  }
  d := dist[H - 1][W - 1]
  if d < 0 {
    fmt.Println(-1)
  } else {
    ans := numWhites - d - 1
    fmt.Println(ans)
  }
}


Measured memory_bytes: 640
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

int grid[2000+1+1][2000+1+1];
int L[2000+1+1][2000+1+1];
int R[2000+1+1][2000+1+1];
int U[2000+1+1][2000+1+1];
int D[2000+1+1][2000+1+1];

int main() {
    int H, W;
    cin >> H >> W;

    for (int i = 1; i <= H; ++i) {
        string s;
        cin >> s;
        for (int j = 1; j <= W; ++j) {
            if (s[j - 1] == '#') grid[i][j] = 1;
        }
    }

    for (int i = 1; i <= H; ++i) {
        if(grid[i][1] == 0) L[i][1] = 1;

        for (int j = 2; j <= W; ++j) {
            if (grid[i][j] == 0) L[i][j] = L[i][j - 1] + 1;
        }
    }

    for (int i = 1; i <= H; ++i) {
        if(grid[i][W] == 0) R[i][W] = 1;

        for (int j = W - 1; j >= 1; --j) {
            if (grid[i][j] == 0) R[i][j] = R[i][j + 1] + 1;
        }
    }

    for (int i = 1; i <= W; ++i) {
        if(grid[1][i] == 0) U[1][i] = 1;

        for (int j = 2; j <= H; ++j) {
            if (grid[j][i] == 0) U[j][i] = U[j - 1][i] + 1;
        }
    }

    for (int i = 1; i <= W; ++i) {
        if(grid[H][i] == 0) D[H][i] = 1;

        for (int j = H - 1; j >= 1; --j) {
            if (grid[j][i] == 0) D[j][i] = D[j + 1][i] + 1;
        }
    }

    int ans = 0;
    for (int i = 1; i <= H; ++i) {
        for (int j = 1; j <= W; ++j) {
            if (grid[i][j] == 0)
                ans = max(ans, L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3);
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 78592
# -*- coding: utf-8 -*-

from collections import defaultdict, Counter, deque
from operator import itemgetter
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**9)
def inpl(): return list(map(int, input().split()))

N, Q = inpl()
G = [[] for _ in range(N)]

for _ in range(N-1):
    a, b = inpl()
    G[a-1].append(b-1)
    G[b-1].append(a-1)

S = [0]*N
for _ in range(Q):
    x, d = inpl()
    S[x-1] += d

searched = [0]*N
searched[0] = True
Q = deque([0])

while Q:
    p = Q.popleft()
    for q in G[p]:
        if searched[q]:
            continue
        searched[q] = True
        S[q] += S[p]
        Q.append(q)

print(*S)


Measured memory_bytes: 99888
A = list(map(int, input().split()))
A = sorted(A)
m = max(A)
B = [(m - a) // 2 for a in A]
count = 0
if len(set(A)) == 1:
    print(0)
elif len(set(A)) == 2:
    count = sum(B)
    if A[0] % 2 != A[2] % 2:
        if A[0] == A[1]:
            count += 1
        else:
            count += 2
    print(count)
else:
    count = sum(B)
    if A[0] % 2 == A[1] % 2 == A[2] % 2:
        pass
    elif A[0] % 2 == A[1] % 2:
        count += 1
    else:
        count += 2
    print(count)

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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

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

int main(){
    int n;cin>>n;
    vi a(n);
    rep(i,n)cin>>a[i];
    int t=0;
    rep(i,n){
        t^=a[i];
    }
    rep(i,n){
        int x=a[i]^t;
        if(i!=n-1)cout<<x<<' ';
        else cout<<x<<endl;
    }
}

Measured memory_bytes: 3988
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>

int main() {

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

    if ((a + b) % 2 == 0) {

        if (a > b) {
            int num = (a - b) / 2;
            printf("%d",b+num);
        } else {
            int num = (b - a) / 2;
            printf("%d", a + num);
        }
    } else {
        puts("IMPOSSIBLE");
    }

    return 0;

}


Measured memory_bytes: 128
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func getFloat() float64 {
	sc.Scan()
	n, _ := strconv.ParseFloat(sc.Text(), 64)
	return n
}

func sum(n []int) int {
	a := 0
	for _, v := range n {
		a += v
	}
	return a
}

func partseFloat(s string) (n float64) {
	n, _ = strconv.ParseFloat(s, 64)
	return
}

func main() {
	sc.Split(bufio.ScanWords)
	n, t, a := getInt(), getFloat(), getFloat()

	h := make([]float64, n)

	for i := range h {
		h[i] = getFloat()
	}

	var min float64
	min = 100000
	ans := 0

	for i, v := range h {
		tmp := t - 0.006*v
		if math.Abs(a-tmp) < min {
			min = math.Abs(a - tmp)
			ans = i
		}
	}
	fmt.Println(ans + 1)
}


Measured memory_bytes: 640
#import<cstdio>
#define r(a)for(int i=0;i<a;i++)
#define s (scanf("%d",&w),w)
#define c(a,b)a=a<b?a:b
int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p);}

Measured memory_bytes: 1032
//苦手 解説AC
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
using ll = long long;
const int INF = 2147483647;
const ll MOD = 1000000007;
// const ll INF = 1000000000000000000LL;

//最大公約数
ll gcd(ll a,ll b){
    if(a<b) swap(a,b);
    bool have_mod =true;
    while(have_mod){
        ll mod = a % b;
        if(mod == 0 ) have_mod = false;
        a = b;
        b = mod;
    }
    return a;
}

// 素因数分解
// 素因数(1は含まない)の値と数をペア型のvectorに入れる
vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

int main(){
    ll a,b;
    cin >> a >> b;
    ll g = gcd(a,b);
    auto pr = prime_factorize(g);
    cout << pr.size()+1 << endl;
	return 0;
}

Measured memory_bytes: 3600
import java.util.Scanner;
public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int t = sc.nextInt();
		int ans = b*(t/a);
		
		System.out.println(ans);

		sc.close();
	}

}



Measured memory_bytes: 24144
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

char s[100010];
ll a[100010];
int main(){
	scanf("%s",s);
	ll n=strlen(s);
	for(int i=0;i<n;){
		int l=i;
		while(s[i]=='R')i++;
		int m=i;
		while(i<n&&s[i]=='L')i++;
		int r=i;
		a[m-1]=(m-l+1)/2+(r-m)/2;
		a[m  ]=(m-l)/2+(r-m+1)/2;
	}
	rep(i,0,n)printf("%lld ",a[i]);
}

Measured memory_bytes: 1280