akhauriyash/Code-Regression huggingface dataset:
/*
String[]の初期化、整数の型がlongになっているか
関数（splitとかcontainsとか）内では"+"とかは正規表現となされるので"\\+"とする
配列のコピーはarr1=arr.clone()
HashSet<>[]はおのおの初期化した？？？？？
 */
import java.util.*;
import java.awt.*;
import java.awt.geom.*;
import static java.lang.System.*;
import static java.lang.Math.*;
public class Main {
    public static void main(String[] $) {
        Scanner sc = new Scanner(in);
        int n = sc.nextInt();
        int ans = Integer.MAX_VALUE;
        for (int i = 0; i <= n; i+=6) {
            int six=i;
            int nine=n-six-(n-six)%9;
            if(six+nine<=n)ans=min(ans,count(six,6)+count(nine,9)+n-six-nine);
        }
        out.println(ans);
    }
    static int count(int n,int p){
        int c=0;
        while (n>0){
            c+=n%p;
            n/=p;
        }
        return c;
    }
}

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

typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007;


int main(){
    
    int N,K;cin>>N>>K;
    vector<int> S(N);
    for(int i=0;i<N;i++){
        cin>>S[i];
    }
    ll dp[N+1][2*K+1];
    for(int i=0;i<N+1;i++){
        for(int j=0;j<2*K+1;j++){
            if(j) dp[i][j]=0;
            else dp[i][j]=1;
        }
    }
    dp[0][0]=1;
    for(int i=1;i<N+1;i++){
        for(int j=1;j<=K;j++){
            if(S[i-1]>=j){
                dp[i][j]=(dp[i-1][j]+dp[i][j-1])%mod;
            }else{
                dp[i][j]=(mod+dp[i-1][j]+dp[i][j-1]-dp[i-1][j-1-S[i-1]])%mod;
            }
        }
    }
    cout<<dp[N][K]<<endl;
}


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

int main(){
    int H1,M1,H2,M2,K;

    cin >> H1 >> M1 >> H2 >> M2 >> K;

    int m1=H1*60+M1;
    int m2=H2*60+M2;

    int ans=(m2-m1)-K;

    cout << ans << endl;
    

}

Measured memory_bytes: 3632
n, k = gets.split.map(&:to_i)
ary = gets.split.map(&:to_i)
sum = ary.uniq.count-k
a = Hash.new
ary.each do |i|
  a[i].nil? ? a[i] = 1 : a[i] += 1
end
count = 0
if sum>0
  a.min_by(sum) { |k,l| l }.each do |m|
    count+=m[1]
  end
  puts count
else
  puts 0
end

Measured memory_bytes: 41436
#include<stdio.h>
#include<algorithm>
#include<iostream>
#include<vector>
#include<cassert>

using namespace std;

const long long MM = 1e9+7;

vector <vector <int> > adj;
vector <int> F[2]; // black=0, white=1
vector <bool> visited; 
int N;

void dfs(int root) {

  visited.at(root) = true;

  F[1].at(root) = 1;
  F[0].at(root) = 1;
  for (auto v: adj.at(root)) {
    if (!visited.at(v)) {
      dfs(v);

      F[1].at(root)  = (
        F[1].at(root) * ( 
            (F[0].at(v) + F[1].at(v)) % MM
        )
      ) % MM;

      F[0].at(root)  = (
        F[0].at(root) *  F[1].at(v)
      ) % MM;
    }
  }
}

int main() {
  cin >> N;
  assert( N >= 1 && N <= 1e5);

  F[0].assign(N+1, 0);
  F[1].assign(N+1, 0);

  adj.assign(N+1, {});
  visited.assign(N+1, false);

  for (auto i = 0; i < N-1; i++) {
    int u, v;
    cin >> u >> v;
    adj.at(u).push_back(v);
    adj.at(v).push_back(u);
  }


  dfs(1);

  cout << (F[0].at(1) + F[1].at(1)) % MM;
  return 0;  
}

Measured memory_bytes: 13440
import java.util.*;

public class Main {
    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int N = Integer.parseInt(sc.next());
	int T = Integer.parseInt(sc.next());
	int c[] = new int[N];
	int t[] = new int[N];
	for (int i = 0; i < N; i++) {
	    c[i] = Integer.parseInt(sc.next());
	    t[i] = Integer.parseInt(sc.next());
	}

	int minT = t[0];
	for (int i = 1; i< N; i++) {
	    int v = t[i];
	    if (v < minT) {
		minT = v;
	    }
	}

	int minC = c[0];
	for (int i = 0; i < N; i++) {
	    int v = t[i];
	    int w = c[i];
	    if (v <= T && w < minC) {
		minC = w;
	    }
	}

	if (T < minT) {
	    System.out.println("TLE");
	} else {
	    System.out.println(minC);
	}
    }
}


Measured memory_bytes: 21844
N = int(input())
A = list(map(int, input().split()))

counter = 0
for i in range(1,N):
    for j in reversed(range(i, N)):
        if A[j] < A[j - 1]:
            temp = A[j]
            A[j] = A[j - 1]
            A[j - 1] = temp
            counter = counter + 1

print(' '.join([str(a) for a in A]))
print(counter)




Measured memory_bytes: 5608
#include <bits/stdc++.h>
 
using namespace std;
 
int r,c,n,x,y,ans[200][200];
 
int main(void)
{
    scanf("%d%d%d",&r,&c,&n);
    x=1,y=1;
    for(int i=1,cnt;i<=n;i++)
    {
        scanf("%d",&cnt);
        while(cnt--)
        {
            ans[x][y]=i;
            if(y==c&&x%2==1)
                y=c,x++;
            else if(y==1&&x%2==0)
                y=1,x++;
            else if(x&1)
                y++;
            else
                y--;
        }
    }
    for(int i=1;i<=r;i++)
    for(int j=1;j<=c;j++)
        printf("%d%c",ans[i][j],j==c?'\n':' ');
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <set>

using namespace std;

int main() {
    int N, M;
    string s;

    cin >> N;

    set<string> U;

    for (int i = 0; i < N; i++) {
        cin >> s;
        U.insert(s);
    }

    cin >> M;

    bool lock = true;

    for (int i = 0; i < M; i++) {
        cin >> s;
        if (U.find(s) == U.end()) {
            cout << "Unknown " << s << endl;
        } else if (lock) {
            cout << "Opened by " << s << endl;
            lock = false;
        } else {
            cout << "Closed by " << s << endl;
            lock = true;
        }
    }
    return 0;
}


Measured memory_bytes: 3180
#include <limits>
#include <initializer_list>
#include <utility>
#include <bitset>
#include <tuple>
#include <type_traits>
#include <functional>
#include <string>
#include <array>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iterator>
#include <algorithm>
#include <complex>
#include <random>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <regex>
#include <cassert>
#include <cstddef>
#ifdef CPP17
#include <variant>
#endif

#define endl codeforces

#define ALL(v) std::begin(v), std::end(v)
#define ALLR(v) std::rbegin(v), std::rend(v)

using ll = std::int64_t;
using ull = std::uint64_t;
using pii = std::pair<int, int>;
using tii = std::tuple<int, int, int>;
using pll = std::pair<ll, ll>;
using tll = std::tuple<ll, ll, ll>;
using size_type = ssize_t;
template <typename T> using vec = std::vector<T>;
template <typename T> using vvec = vec<vec<T>>;

template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return std::min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return std::max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }

template <typename T, std::size_t Head, std::size_t... Tail> 
struct multi_dim_array { using type = std::array<typename multi_dim_array<T, Tail...>::type, Head>; };

template <typename T, std::size_t Head> 
struct multi_dim_array<T, Head> { using type = std::array<T, Head>; };

template <typename T, std::size_t... Args> using mdarray = typename multi_dim_array<T, Args...>::type;

#ifdef CPP17
template <typename T, typename F, typename... Args> 
void fill_seq(T &t, F f, Args... args) { 
    if constexpr (std::is_invocable<F, Args...>::value) { 
        t = f(args...); 
    } else { 
        for (size_type i = 0; i < t.size(); i++) fill_seq(t[i], f, args..., i); 
    } 
}
#endif

template <typename T> vec<T> make_v(size_type sz) { return vec<T>(sz); }

template <typename T, typename... Tail> 
auto make_v(size_type hs, Tail&&... ts) { 
    auto v = std::move(make_v<T>(std::forward<Tail>(ts)...)); 
    return vec<decltype(v)>(hs, v); 
}

namespace init__ { 
struct InitIO { 
    InitIO() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(30); } 
} init_io; 
}


int main() {
    std::string s, t;
    std::cin >> s >> t;
    ll ans = 0;
    for (size_type i = 0; i < s.size(); i++) ans += (s[i] != t[i]);
    std::cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 3724
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

const ll mod=1e14+7;
ll mu(ll a,ll b){
  return (ll)a*b%mod;
}
ll ad(ll a,ll b){
  if((a+=b)>=mod)a-=mod;
  return a;
}
ll pw(ll a,ll b,ll c=1LL){
  for(;b;b>>=1,a=mu(a,a))if(b&1)c=mu(c,a);
  return c;
}
ll dv(ll a,ll b){
  return mu(a,pw(b,mod-2));
}

void comb(ll *c, ll n){
  c[0] = 1;
  rep1(i,n){
    c[i] = c[i - 1]*(n + 1 - i)/i;
  }
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,a,b;
  cin >> n >> a>>b;
  ll v[n];
  rep(i,n) cin >> v[i];
  sort(v,v+n);
  reverse(v,v+n);
  ll res=0;
  ll pre=v[0];
  ll c=0;
  ll k=0;
  ll ina=0;
  rep(i,n){
    if(i<a) pre = v[i];
  }
  rep(i,n){
    if(pre==v[i]) c++;
    if(i<a && pre==v[i]) ina++;
  }
  ll C[c+1];
  comb(C,c);
  //  cout << ina << endl;
  if(v[0]==pre){
    for(int i=a; i<=min(b,c);i++){
      res+=C[i];
    }
  }
  else{
    res+=C[ina];
  }
  ll sum=0;
  rep(i,a) sum+=v[i];
  cout << fixed;
  cout << setprecision(12) << (((long double)(sum))/((long double)(a))) << endl;

  
  cout << res<<endl;

  
  return 0;
    

}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){

	int n , x;
	int sum;

	while(1){

		int ans = 0;
		cin >> n >> x;
		if(n == 0 && x == 0) break;

		for(int i = 1; i <= n; i++){
			for(int j = i+1; j <= n; j++){
				for(int k = j+1; k <= n; k++){
					if(i < x || j < x || k < x){
						sum = i + j + k;
						if(sum == x){
							ans++;
						}
					}
				}
			}
		}

		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 3076
N, M = map(int, input().split())
cnt = 0
tables = [2*i for i in range(N)] + [2*i+1 for i in range(M)]
for i in range(len(tables)-1):
  for j in range(i+1, len(tables)):
    if not (tables[i] + tables[j]) % 2:
      cnt += 1
print(cnt)

Measured memory_bytes: 38896
#include <iostream>
#include <vector>

using namespace std;

int main() {
	int n, k, d[10]{};
	vector<int> l;
	cin >> n >> k;
	for (int i = 0; i < k; i++) {
		int t;
		cin >> t;
		d[t] = 1;
	}
	for (int i = 0; i < 10; i++) {
		if (d[i] == 0)l.push_back(i);
	}
	for (int i = 0; i < 5; i++) {
		int x[5]{ 0 };
		for (int a = 0; a < 10-k; a++) {
			if (i >= 4)x[4] = l[a];
			for (int b = 0; b < 10-k; b++) {
				if (i >= 3)x[3] = l[b];
				for (int c = 0; c < 10-k; c++) {
					if (i >= 2)x[2] = l[c];
					for (int d = 0; d < 10-k; d++) {
						if (i >= 1)x[1] = l[d];
						for (int e = 0; e < 10-k; e++) {
							x[0] = l[e];
							int t = x[4] * 10000 + x[3] * 1000 + x[2] * 100 + x[1] * 10 + x[0];
							if (t >= n) {
								cout << t << endl;
								return 0;
							}
						}
					}
				}
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
const int MaxN = 100;
const int Pt = 10;
using namespace std;
int a[MaxN + 5] , n;
int f[MaxN + 5][15];
int main()
{
	while(~scanf("%d" , &n)){
		for(int i = 0;i <= n;i++){
			for(int j = 0;j <= 9;j++){
				f[i][j] = -(1 << 30);
			}
		}
		f[0][0] = 0;
		for(int i = 1;i <= n;i++) scanf("%d" , &a[i]);
		for(int i = 1;i <= n;i++){
			for(int j = 0;j <= 9;j++){
				int t = (j - (a[i] % Pt) + Pt) % Pt;
				f[i][j] = max(f[i - 1][j] , f[i - 1][t] + a[i]);
			}
		}
		int Max = 0;
		for(int i = 1;i <= 9;i++) Max = max(Max , f[n][i]);
		printf("%d\n" , Max);
	}
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<map>
#include<iomanip>
#include<tuple>
#include<bitset>


using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define printfloat(x) cout << fixed << setprecision(7) << (x) << endl;
#define printbit(x) cout << bitset<15>(x) << endl;
using ll = long long int;



long double pi = 3.14159265359;

int n;
double long v[1000];
double long ans;

int main(){
    cin >> n;
    rep(i,n){
        cin >> v[i];
    }
    sort(v,v+n);
    ans = v[0];
    for(int i=1;i<n;i++){
        ans = (ans+v[i])/2;
        // cout << v[i] << endl;
    }
    printfloat(ans);


return 0;
}

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

int main()
{
int i;
int N;
int K;

	ios::sync_with_stdio( false );
	cin.tie( 0 );

	cin >> N;
	cin >> K;

	i = ( N - 1 ) / ( K - 1 );
	if( ( N - 1 ) % ( K - 1 ) > 0 ) i++;

	cout << i << endl;

	return 0;
}





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

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;

#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)

static const ll INF = 1e15;

int main(void)
{
	string s;
	cin >> s;
	int cs[3] = {0,0,0};
	int n = s.size();
	for (char c : s) {
		int index = c - 'a';
		cs[index]++;
	}
	bool ok = true;
	for (int i = 0; i < 3; i++) {
		if (abs(cs[i] - cs[(i + 1) % 3]) > 1) {
			ok = false;
		}
	}
	if (ok) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	return 0;
}


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

using namespace std;

#define LL long long
#define N 5005
#define INF 0x3f3f3f3f3f3f3f3fLL

const LL mod=1000000007;

LL n,m,x,y,ans,c,tot,sum,a[N],sz[N],mx[N],head[N],fac[N],ifac[N],f[N][N];
struct edge{LL v,nxt;}e[N*2];

void add(LL x,LL y){e[++tot].v=y; e[tot].nxt=head[x]; head[x]=tot;}

void dfs(LL u,LL fa){
	sz[u]=1; mx[u]=0;
	for (LL i=head[u],v;i;i=e[i].nxt)
		if ((v=e[i].v)!=fa){
			dfs(v,u); sz[u]+=sz[v]; mx[u]=max(mx[u],sz[v]);
		}
	mx[u]=max(mx[u],n-sz[u]);
	if (mx[u]<mx[c]) c=u;
}

void getsz(LL u,LL fa){
	sz[u]=1;
	for (LL i=head[u],v;i;i=e[i].nxt)
		if ((v=e[i].v)!=fa){
			dfs(v,u); sz[u]+=sz[v];
		}
}

LL inv(LL x){return x==1?1:(mod-mod/x)*inv(mod%x)%mod;}

LL C(LL x,LL y){return fac[x]*ifac[y]%mod*ifac[x-y]%mod;}

LL P(LL x,LL y){return fac[x]*ifac[x-y]%mod;}

int main(){
	scanf("%lld",&n);
	for (LL i=1;i<n;i++){
		scanf("%lld%lld",&x,&y);
		add(x,y); add(y,x);
	}
	mx[c=0]=INF; dfs(1,0);
	for (LL i=1;i<=n;i++)
		if (i!=c && mx[i]==mx[c]){
			ans=1;
			for (LL i=1;i<=n/2;i++)
				(ans*=i)%=mod;
			printf("%lld\n",ans*ans%mod);
			return 0;
		}
	getsz(c,0);
	for (LL i=head[c];i;i=e[i].nxt)
		a[++m]=sz[e[i].v];
	fac[0]=1; for (LL i=1;i<=n;i++) fac[i]=fac[i-1]*i%mod;
	ifac[n]=inv(fac[n]); for (LL i=n-1;i>=0;i--) ifac[i]=ifac[i+1]*(i+1)%mod;
	sum=0; f[0][0]=1;
	for (LL i=1;i<=m;i++){
		sum+=a[i];
		for (LL j=0;j<=sum;j++)
			for (LL k=0;k<=a[i] && k<=j;k++)
				(f[i][j]+=f[i-1][j-k]*C(a[i],k)%mod*P(a[i],k)%mod)%=mod;
	}
	for (LL i=0;i<=n;i++) (ans+=f[m][i]*fac[n-i]%mod*(i&1?-1:1)+mod)%=mod;
	printf("%lld\n",ans);
	
	return 0;
}
			

Measured memory_bytes: 194432
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int ans = 753;
        for (int i = 0; i < s.length() - 2; i++) {
            int num = Integer.parseInt(s.substring(i, i + 3));
            if (Math.abs(num - 753) < ans) {
                ans = Math.abs(num - 753);
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 23508
#include <iostream>
#include <string>
#include <vector>

const std::vector<std::string> ts{"JOI", "IOI"};

void solve(const std::string& s) {
    std::vector<int> ans(2, 0);
    for (int i = 0; i < (int)s.length(); ++i) {
        for (int j = 0; j < 2; ++j) {
            if (s.substr(i, ts[j].length()) == ts[j]) ++ans[j];
        }
    }

    for (auto a : ans) std::cout << a << "\n";
}

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

    std::string s;
    while (std::cin >> s) { solve(s); }

    return 0;
}



Measured memory_bytes: 3256
import math
from datetime import date

def main():
		
	s = input()
	ans = []

	for c in s:
		if c != 'B':
			ans.append(c)
		else:
			if len(ans) != 0:
				ans.pop();

	line = ""
	for c in ans:
		line += c

	print(line)
	
main()


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

#define F first
#define S second
#define pb push_back
#define all(x) x.begin(), x.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

const int N = 21, K = 100010;
const int MOD = 1000000007;
const int LOG = 20;

int n, a[N][N];
ll dp[(1 << N) + 10];

int main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;
	for (int i = 0; i < n; i++){
		for (int j = 0; j < n; j++) cin >> a[i][j];
	}
	dp[0] = 1;
	for (int mask = 1; mask < (1 << n); mask++){
		for (int j = 0; j < n; j++){
			if (mask & (1 << j)){
				dp[mask] += dp[mask ^ (1 << j)] * a[j][__builtin_popcount(mask) - 1];
				dp[mask] %= MOD;
			}
		}
	}
	cout << dp[(1 << n) - 1];



	return 0;
}

Measured memory_bytes: 16640
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {

    input!{
        s: String,
    }
    let k: String = "keyence".to_string();

    for i in 0..s.len() {
        for j in i..s.len()+1 {
            let mut t = String::new();
            for (ind, s_) in s.chars().enumerate() {
                if ind < i || j <= ind {
                    t.push(s_);
                }
            }

            if t == k {
                println!("YES");
                return;
            }
        }
    }
    println!("NO");
}



Measured memory_bytes: 4352
n=int(input())

k9=5
k6=6
n9=9**k9
smin=n
for i9 in range(n9):
    ii9=i9
    s=0
    m=0
    astr=""
    for ii in range(1,k9+2):
        r9=ii9%9
        ii9=(ii9-r9)//9    
        s=s*9+r9
        m=m+r9
        astr=astr+str(r9)
#    print("i9",i9,"astr",astr,"s",s,"m",m)
    
    nr=n-s
    nr1=nr
#    print("nr",nr,"m",m)
    
    if nr==0:
        snra=m
#        print(nr,m)
    elif nr>0:
        snra=m
        for jj in range(k6,-1,-1):
            nra=nr1//(6**jj)
            nr1=nr1%(6**jj)
            snra=snra+nra
#        print("jj",jj,"nra",nra,"nr1",nr1)
    if smin>snra:
        smin=snra
print(smin)


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <string>

using namespace std;

int main() {
	int n, m;
	cin >> n >> m;
	priority_queue<long> q;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		q.push(a);
	}

	for (int i = 0; i < m; i++) {
		int a = q.top();
		q.pop();
		q.push(a / 2);
	}

	long ans = 0;
	while (!q.empty()) {
		ans += q.top();
		q.pop();
	}

	cout << ans << endl;
}

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

int main() {
  string S;
  cin >>S;
  if(S.at(2)==S.at(3) && S.at(4)==S.at(5)){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <tuple>
#include <cassert>

using namespace std;

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define mp(a,b) make_pair((a), (b))
#define mt(a,b,c) make_tuple((a),(b),(c))

typedef long long ll;

int main(){
    int n; cin >> n;
    vector<int> a(n), b(n), c(n);
    rep(i,n) cin >> a[i]; 
    rep(i,n) cin >> b[i]; 
    rep(i,n-1) cin >> c[i];
    int sat = 0;
    int pre = -2;
    rep(i,n){
        sat += b[a[i]-1];
        if(a[i] == pre+1) sat += c[a[i]-2];
        pre = a[i];
    } 
    cout << sat << endl;
    return 0;
}

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

int main() {
  int a, b, ans;
  cin >> a >> b;

  ans = a * b;
  if (ans / 2.0 == ans / 2) {
    cout << "Even" << endl;
  }
  else {
    cout << "Odd" << endl;
  }
}


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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;cin >> n;
	vector<vector<int>> a(n,vector<int>(26));
	rep(i,n){
		string s;cin >> s;
		rep(j,s.size()){
			a.at(i).at(s.at(j)-'a')++;
		}
	}
	string ans="";
	rep(i,26){
		int cnt=100;
		rep(j,n){
			cnt=min(cnt,a.at(j).at(i));
		}
		char c='a'+i;
		rep(j,cnt){
			ans+=c;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
 
int A[20000000], B[20000000], C[20000000], n;

int main(void)
{
 
  int i;
  int vmax = 0;
 
  scanf("%d",&n);
 
  for(i = 1;i <= n;i++)
    {
      scanf("%d", &A[i]);
      if(vmax < A[i])
    {
      vmax = A[i];
    }
    }
 
  CountingSort(vmax);
 
  for(i = 1;i <= n;i++)
    {
      if(i > 1) printf(" ");
      printf("%d",B[i]);
    }
  printf("\n");
  return 0;
}

void CountingSort(int k)
{
  int i, j;
  for(i = 0; i <= k; i++)
    {
      C[i] = 0;
    }
  for(j = 1;j <= n;j++)
    {
      C[A[j]]++;
    }
  for(i = 1;i <= k;i++)
    {
      C[i] = C[i] + C[i - 1];
    }
  for(j = n;j > 0;j--)
    {
      B[C[A[j]]] = A[j];
      C[A[j]]--;
    }
}

Measured memory_bytes: 21076
import scala.io.StdIn._

object Main {
  def main(args: Array[String]): Unit = {
    solve
  }

  def solve(): Unit = {
    val input = readLine().split(" ")
    val n = input(0).toInt
    val p = input(1).toInt
    val s = readLine.toCharArray

    if (10 % p == 0) {
      var ans = 0L
      for (i <- 0 until n) {
        if ((s(i) - '0') % p == 0) {
          ans += i + 1
        }
      }
      println(ans)

    } else {
      val d = new Array[Int](n + 1)
      var ten = 1
      for (i <- n - 1 to 0 by -1) {
        val a = (s(i) - '0') * ten % p
        d(i) = (d(i + 1) + a) % p
        ten = ten * 10 % p
      }

      var ans = 0L
      val count = new Array[Long](p)
      for (i <- n to 0 by -1) {
        ans += count(d(i))
        count(d(i)) += 1
      }
      println(ans)
    }
  }
}


Measured memory_bytes: 29384
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <set>
#include <stdio.h>
#include <math.h>
using namespace std;
typedef long long int lli;
const long long int MaxN=300005;
const lli mod=1e9+7;
#define fst first
#define snd second
#define mp make_pair
const float pi=3.1415926535897932384626433832795028;
	lli mcd(lli a,lli b){
		if(a==0)return b;
		return mcd(b%a,a);
	}
	lli arr[MaxN];
	void solve(){
		lli N,x,i,j,p,q,res=1,tot=0;
		cin>>N;
		for(i=1;i<=N;i++){
			cin>>arr[i];
			if(arr[i]==res)res+=1;
		}
		if(res==1)res=N+2;
		cout<<N-(res-1);
		
	}
int main(){
	//cin.tie(0),ios_base::sync_with_stdio(0);
	lli i,t;
	t=1;
	for(i=1;i<=t;i++){
		solve();
	}
}


Measured memory_bytes: 1792
N, Ma, Mb = map(int, input().split())

INF = 10 ** 18
dp = [[[INF] * (10*N+1) for _ in range(10*N+1)] for _ in range(N+1)]

dp[0][0][0] = 0
for i in range(N):
    a, b, c = map(int, input().split())
    for j in range(10*N+1-a):
        for k in range(10*N+1-b):
            if dp[i][j][k] == INF:
                continue
            dp[i+1][j][k] = min(dp[i+1][j][k], dp[i][j][k])
            dp[i+1][j+a][k+b] = min(dp[i+1][j+a][k+b], dp[i][j][k]+c)

ans = INF
for j in range(1, 10*N+1):
    if j * Ma > 10 * N  or j * Mb > 10 * N:
        break

    ans = min(ans, dp[N][j*Ma][j*Mb])

if ans == INF:
    ans = -1

print(ans)

Measured memory_bytes: 59496
#include <iostream>
#include <fstream>
#include <cassert>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#include <random>
#include <complex>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-7;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int n,m;
vvd a;

int main(){
	cin>>n>>m;
	a=vvd(n,vd(m));
	for(int i=0;i<n;i++) for(int j=0;j<m;j++) cin>>a[i][j];
	vvd dp(1<<n,vd(m));
	for(int i=0;i<1<<n;i++) for(int j=m-1;j>=0;j--){
		for(int k=0;k<n;k++) if(i&1<<k){
			double tmp=0,p=1;
			for(int l=j;l<m;l++){
				tmp+=p*(1-a[k][l])*dp[i-(1<<k)][l];
				p*=a[k][l];
			}
			dp[i][j]=max(dp[i][j],tmp+p);
		}
	}
	cout<<syosu(11)<<dp[(1<<n)-1][0]<<endl;
}

Measured memory_bytes: 13708
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int n = Integer.parseInt(scanner.next());
    int k = Integer.parseInt(scanner.next());
    int a, cost, di;
    int[] h = new int[n];
    for (int i = 0; i < n; i++) {
      h[i] = Integer.parseInt(scanner.next());
    }
    int dp[] = new int[n];
    dp[0] = 0;
    dp[1] = Math.abs(h[1] - h[0]);
    for (int i=2; i < n; i++) {
      a = Math.min(i, k);
      di = (int) Math.pow(10, 10);
      for (int j = 1; j < a+1; j++) {
        cost = dp[i-j] + Math.abs(h[i-j]-h[i]);
        if (di > cost) {
          di = cost;
        }
      }
      dp[i] = di;
    }
    System.out.println(dp[n-1]);
  }
}


Measured memory_bytes: 49252
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<vector>
#include<cstdlib>
using namespace std;
int main()
{
    int a,b;
    while(scanf("%d %d",&a,&b)!=EOF)
    {
        int Max=-10000000;
        Max = max(Max,a+b);
        Max = max(Max,a*b);
        Max = max(Max,a-b);
        printf("%d\n",Max);
    }
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main() {
  //変数nを定義
  int n;
  scanf("%d",&n);
  //奇数桁まるまるをカウント
  int x =10,res = 0;
    while(x<=n){
        res += x - x/10;
        x*=100;
    }
    if(n>=x/10){
        res += n -x/10 + 1;
    }
  printf("%d\n",res);
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cmath>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <cstring>

using namespace std;

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ll long long
#define pii pair < int, int >
#define pll pair < long long, long long>
#define ull unsigned long long
#define vi vector < int >
#define vll vector < long long >
#define sz(a) (int)a.size()
#define forit(it, s) for(__typeof(s.begin()) it = s.begin(); it != s.end(); it++)
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x))
#define fname "searching"

const int inf = (int)1e9;
const ll INF = (ll)1e18;
const double eps = 1e-9;
const double pi = acos(-1.0);
const int mod = (int)1e9 + 7;

string s, t;
set<string> st;

void check(){
    for(int i = 0; i < sz(s) - sz(t) + 1; ++i){
        // cout << i << " ";
        string cur = s;
        
        for(int j = 0; j < i; ++j) cur[j] = (cur[j] == '?' ? 'a' : cur[j]);
        for(int j = i + sz(t); j < sz(s); ++j) cur[j] = (cur[j] == '?' ? 'a' : cur[j]);
        
        bool ok = 1;
        for(int j = 0; j < sz(t); ++j){
            if(cur[i + j] == t[j]) continue;
            else if(cur[i + j] == '?') cur[i + j] = t[j];
            else{
                ok = 0;
                break;
            }
        }
        if(ok) st.insert(cur);
    }
}

string solve(){
    cin >> s >> t;
    check();
    return sz(st) ? *st.begin() : "UNRESTORABLE";
}

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

    cout << solve() << "\n";
    
    return 0;
}

Measured memory_bytes: 256
/**
 * A <-> B : P
 * B <-> C : Q
 * C <-> A : R
 */

#include <iostream>
#include <set>
using namespace std;

int main(){
    int P, Q, R;
    cin >> P;
    cin >> Q;
    cin >> R;

    int res = P + Q;
    if(res > Q + R) res = Q + R;
    if(res > R + P) res = R + P;

    cout << res << endl;
}

Measured memory_bytes: 256
# coding:utf-8

import sys
import math
import time
#import numpy as np
import collections
from collections import deque
from collections import Counter
import queue
import copy
import bisect
import heapq
import itertools


#sys.setrecursionlimit(10**7)
#N, Q = map(int, input().split())
#G = [list(input()) for i in range(H)]
#INF = V * 10001
#A = [int(i) for i in input().split()]
#AB = [list(map(int, input().split())) for _ in range(K)]

N = int(input())
ans = 0

if(N%2==0):
  ans = N//2
else:
  ans = (N+1)//2

print(ans/N)



Measured memory_bytes: 74944
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(var, begin, end) for (int var = (begin); var <= (end); var++)
#define RFOR(var, begin, end) for (int var = (begin); var >= (end); var--)
#define REP(var, length) FOR(var, 0, length - 1)
#define RREP(var, length) RFOR(var, length - 1, 0)
#define EACH(value, var) for (auto value : var)
#define SORT(var) sort(var.begin(), var.end())
#define REVERSE(var) reverse(var.begin(), var.end())
#define RSORT(var) SORT(var); REVERSE(var)
#define OPTIMIZE_STDIO ios::sync_with_stdio(false); cin.tie(0); cout.precision(10); cout << fixed
#define endl '\n'

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

void solve(istream& cin, ostream& cout) {
  string s;
  cin >> s;
  int k;
  cin >> k;
  int n = s.size();
  vector<string> v;
  FOR(j, 1, min(n, 5)) {
    FOR(i, 0, n-j) {
      v.push_back(s.substr(i, j));
    }
  }
  SORT(v);
  // 重複要素を削除
  v.erase(unique(v.begin(), v.end()), v.end());
  cout << v[k - 1] << endl;
}

#ifndef TEST
int main() {
  OPTIMIZE_STDIO;
  solve(cin, cout);
  return 0;
}
#endif


Measured memory_bytes: 4268
#include <bits/stdc++.h>
#define rep(x, y) for(int x = 0; x < (y); x++)
#define REP(x, z, y) for(int x = (z); x < (y); x++)
#define all(x) x.begin(), x.end()
#define len(x) (sizeof(x) / sizeof(x[0]))
#define split_str(str, sp_word) istringstream stream(str); string res; for(int cnt = 0; getline(stream,res,sp_word); cnt++)
#define scanln(x) fgets(x, sizeof x, stdin)
#define down_queue(x) priority_queue<x>
#define up_queue(x) priority_queue<x, vector<x>, greater<x>>
#define i_str(x) atoi(x.c_str())
#define digit(x) ((int)log10((double)(x)) + 1)
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define out(x) cout << (x) << endl;
#define outs(x) for(auto i : x) cout << i << " ";
using namespace std;
const int MOD = 1000000007; 
typedef long long ll;
typedef string str;

ll gcd(ll a,ll b){while(b){ll tmp = a % b;a = b;b = tmp;}return a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}

int main() {
  int n;cin >> n;
  vector<ll> t(n);
  ll ans;
  cin >> ans;

  rep(i,n - 1){
    ll tmp;
    cin >> tmp;
    ans = lcm(ans,tmp);
  }

  out(ans);

  return 0;
}

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

int main(void) {
    int a, b;
    cin >> a >> b;
	string symbol = "==";
	if (a < b) {
		symbol = "<";
	} else if (a > b) {
		symbol = ">";
	}
	cout << "a " << symbol << " b" << endl;

	return 0;
}


Measured memory_bytes: 3192
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <complex>
#include <tuple>

#define FAST ios_base::sync_with_stdio(false); cin.tie(0)
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
// #define repr(i, a, b) for(int i=int(a); i>=int(b); i--)
#define reps(i,n) for(int i=1;i<=int(n);++i)
#define repr(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define reprs(i,x) for(int i=((int)(x));i>0;i--)
#define iceil(x,y) (x+y-1)/y
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define all(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define LF "\n"

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef pair<int, PII> PP;


int main(){
	FAST;
	ll n;
	cin >> n;
	ll rt = (ll)sqrt(n);
	// cout << "rt=" << rt << LF;

	for(ll i=rt+1; i>0; i--) {
		if (n%i==0) {
			if (i==1) { 
				cout << n-1 << LF;
				return 0;
			}
			else {
				cout << (i-1)+((n/i)-1);
				cout << LF;
				return 0;
			}
		}
	}

	return 0;
}

Measured memory_bytes: 256
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
typedef pair<LL, LL> pii;
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)

string s;

int main(){
    cin >> s;
    int n = (int)s.size();
    s += "QQQ";
    LL ans = 0;
    LL cnta = 0, cntbc = 0;
    REP(i, n){
        if(s[i] == 'A'){
            ans += cnta * cntbc;
            cntbc = 0;
            cnta++;
        }
        else if(s[i] == 'B' && s[i + 1] == 'C'){
            cntbc++;
            i++;
        }else{
            ans += cnta * cntbc;
            cnta = 0;
            cntbc = 0;
        }
    }
    ans += cnta*cntbc;
    cout << ans << endl;
}

Measured memory_bytes: 640
#include<iostream>
using namespace std;
int main() {
    string S, T;
    cin >> S >> T;

    int res = 0;
    for(int i = 0; i < S.size(); i++) {
        if(S[i] != T[i]) {
            res++;
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 3924
#include <bits/stdc++.h>
using namespace std;
#define lo long
const int lmax=1999999999;
const long long lmx=1999999999999999999;
int main(){std::ios::sync_with_stdio(false);
int a,b;
cin>>a>>b;
if(a+b==15)
cout<<"+"<<endl;
else
if(a*b==15)
{
	cout<<"*"<<endl;
}
else
{
	cout<<"x"<<endl;
}
}
/*

                   *         *
                  * *       * *
                 *   *     *   *
                *     *   *     *
               *       * *       *
               *        *        *
                *               *
                 *             *
                  *           *
                   *         *
                    *       *
                     *     *
                      *   *
                       * *
                        *



*/





Measured memory_bytes: 256
N,M,Q=map(int,input().split())
LR=[list(map(lambda x:int(x)-1,input().split())) for i in range(M)]
pq=[list(map(lambda x:int(x)-1,input().split())) for i in range(Q)]
_list=[[0 for _ in range(N)] for i in range(N)]
for i in range(M):
    _list[LR[i][0]][LR[i][1]]+=1
for i in range(N):
    for j in range(N-1):
        _list[i][j+1]+=_list[i][j]
for i in range(N):
    for j in range(N-1,0,-1):
        _list[j-1][i]+=_list[j][i]
for i in range(Q):
    print(_list[pq[i][0]][pq[i][1]])

Measured memory_bytes: 73272
// C++ includes used for precompiling -*- C++ -*-

// Copyright (C) 2003-2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library.  This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.

// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.

// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
// <http://www.gnu.org/licenses/>.

/** @file stdc++.h
 *  This is an implementation file for a precompiled header.
 */

// 17.4.1.2 Headers

// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#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>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
// #include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#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>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#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>
#endif

using namespace std;
typedef long long ll;

ll n, k, x;
string s;

int main()
{
  cin >> n >> x;
  ll m[n];
  ll sum = 0;
  ll mn = 100000000;
  for (ll i = 0; i < n; i++)
  {
    cin >> m[i];
    sum += m[i];
    mn = min(mn, m[i]);
  }
  cout << n + (x - sum) / mn << endl;
}


Measured memory_bytes: 256
using System;

namespace ABC168C
{
    class Program
    {
        static void Main(string[] args)
        {
            var wo = Console.ReadLine().Split(" ");
            double a = int.Parse(wo[0]);
            double b = int.Parse(wo[1]);
            double h = int.Parse(wo[2]);
            double m = int.Parse(wo[3]);
            double s, x;
            h = (h*60 + m)*0.5 ;
            m = m * 6;
            if (h > m)
                s = h - m;
            else
                s = m - h;
            if (s >= 180)
                s = 360 - s;
            s = s / 180 * Math.PI;
            x = Math.Sqrt(a * a + b * b - 2 * a * b * Math.Cos(s));

            Console.WriteLine(x);
           
        }
    }
}

Measured memory_bytes: 18668
import math

N, A, B = map(int, input().split())
h = [int(input()) for _ in range(N)]


def check(t):
    cnt = 0
    ab = A - B
    bt = B * t
    for i in range(N):
        cnt += max(0, math.ceil((h[i] - bt) / ab))
    return cnt <= t


left = 1
right = max(h)
while right - left > 1:
    mid = (left + right) // 2
    if check(mid):
        right = mid
    else:
        left = mid
print(right)


Measured memory_bytes: 7068
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define reps(i,a,b) for(int i=a;i<b;++i)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U &u,const V... v){for(auto &e:u)fill_v<T>(e,v...);}

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

    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    rep(i, k) {
        vector<int> imos(n+1);
        rep(j, n) {
            imos[max(j-a[j], 0)]++;
            imos[min(j+1+a[j], n)]--;
        }
        rep(j, n) {
            imos[j+1] += imos[j];
            a[j] = imos[j];
        }
        bool flag = true;
        rep(j, n) {
            if (a[j] != n) flag = false;
        }
        if (flag) break;
    }
    rep(i, n) cout << a[i] << (i == n-1 ? '\n' : ' ');
}


Measured memory_bytes: 4940
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int N;cin>>N;
  int A=1;
  for (int i=1; i<=N; i++){
    A=A*i;
    A=A%(1000000000+7);
  }
  cout<<A<<endl;
}

  
  

Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define Rep(i,a,b) for(register int i=(a);i<=int(b);++i)
#define Dep(i,a,b) for(register int i=(a);i>=int(b);--i)
#define rep(i,a,b) for(register int i=(a);i<int(b);++i)
#define mem(x,v) memset(x,v,sizeof(x))
#define gc getchar
#define pc putchar
#define fi first
#define queue QQQ
#define se second
#define debug(x) cout << #x" = " << x << endl;
#define pp(x,y) cout << "pp: " << x << " " << y << endl;
#define rank __RAnK
inline ll read(){
	register ll x=0,f=1;register char c=gc();
	for(;!isdigit(c);c=gc())if(c=='-')f=-1;
	for(;isdigit(c);c=gc())x=(x<<1)+(x<<3)+(c^48);
	return x*f;
}
#define rd read
void write(ll x){if(x<0)x=-x,pc('-');if(x>=10)write(x/10);putchar(x%10+'0');}
void writeln(ll x){write(x);puts("");}
const int maxn = 2e5+233;
const int mod = 1e9+7;
int n;
int c1[maxn],c2[maxn],cnt[maxn],a[maxn],tot,D[maxn],invD[maxn];
int zero[maxn],S[maxn];
#define lowbit(x) ((x) & (-x))
inline int qpow(int a,int b){
	int ans = 1;
	for(;b;b>>=1,a=1ll*a*a%mod)
		if(b&1) ans=1ll*ans*a%mod;
	return ans;
}
void add(int c[],int x,int v){
	for(;x<=n;x+=lowbit(x))
		(c[x] += v) %= mod;
}
int query(int c[],int x){
	int ans = 0;
	for(;x;x-=lowbit(x))
		(ans += c[x]) %= mod;
	return ans;
}
int main(){
	n = rd();
	Rep(i,1,n) cnt[a[i]=rd()]++;
	Dep(i,n-1,1) cnt[i]+=cnt[i+1];
	tot = 1;
	Dep(i,n,1) cnt[i] -= n-i;
	Dep(i,n,1) tot = 1ll * tot * cnt[i] % mod; 
	if(!tot){puts("0");return 0;}
	S[0] = 1;D[0] = 1;
	Rep(i,1,n){
		if(cnt[i]==1) D[i] = D[i-1]; else  
					  D[i] = 1ll * (cnt[i]-1) * qpow(cnt[i],mod-2) % mod * D[i-1] % mod;
		if(cnt[i]==1){
			zero[i] = zero[i-1] + 1;
			S[zero[i]] = i;
		} else{
			zero[i] = zero[i-1];
		}
		invD[i] = qpow(D[i],mod-2);
	}
	mem(c1,0);mem(c2,0);
	ll ans = 0;
	Rep(i,1,n){
		ans = (ans + 1ll * tot * qpow(2,mod-2) %mod * (query(c1,a[i]) - query(c1,a[i]-1))) % mod;//same
		ans = (ans + 1ll * tot * qpow(2,mod-2) %mod * D[a[i]] %mod * (query(c2,a[i]-1) - query(c2,S[zero[a[i]]]) + mod) % mod) % mod;//small
		add(c1,a[i],1);
		add(c2,a[i],invD[a[i]]);
	}//相同的
//	writeln(ans);
	mem(c1,0);mem(c2,0);
	Dep(i,n,1){
		ans = (ans - 1ll * tot * qpow(2,mod-2) %mod * D[a[i]] %mod * (query(c2,a[i]-1) - query(c2,S[zero[a[i]]]) + mod)% mod + mod) % mod;
		ans = (ans + 1ll * query(c1,a[i]-1) * tot) % mod;
		add(c1,a[i],1);
		add(c2,a[i],invD[a[i]]);
	} 
	writeln(ans);
	return 0;
}
/*
考虑枚举出某个数

需要查询它右边的答案

1、右边和它相同的。 
	倒着做， 
2、右边比它小的。 

3、右边比它大的。 

sum * sum(D[i]) / (sum(D[])) 
*/

Measured memory_bytes: 6528
import java.util.Scanner;

public class Main {
    public static void main(String[] arg) {
        Scanner scan = new Scanner(System.in);
        int craneLeg, turtleLeg, headTotal, legTotal; 
        int craneCnt, turtleCnt;
        
        craneLeg = 2;
        turtleLeg = 4;
        headTotal = scan.nextInt();
        legTotal = scan.nextInt();
        
        for(int i = 0; i <= headTotal; i++) {
            craneCnt = i;
            turtleCnt = headTotal - i;

            if(craneCnt * craneLeg + turtleCnt * turtleLeg == legTotal) {
                System.out.println("Yes");
                scan.close();
                return;
            }
        }
        System.out.println("No");
        scan.close();
        return;
    }
}

Measured memory_bytes: 35884
#include <iostream>
using namespace std;
int main(void){
int N;
cin >> N;
int a[N];
int k=0;
for(int i=0;i<N;i++){
    cin >> a[i];
}

int flag;
int count=0;
for(int i=0;i<N;i++){
    if(a[i]==1 && flag==0){flag=1;count=1;}
    else if(a[i]==1){count++;}
     else if(k<count){flag=0;k=count;count=0;}
     else{flag=0;count=0;}
}
if(count>k)
k=count;
    cout << k+1 << endl;
    
}


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

int main() {

  int x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;  

  int dx = y2 - y1;
  int dy = x2 - x1;

  cout << x2 - dx << " " << y2 + dy << " " << x1 - dx << " " << y1 + dy << endl;

}

Measured memory_bytes: 256