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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define ALL(v) (v).begin(), (v).end()
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO  cout << "NO"  << endl
#define No  cout << "No"  << endl

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;

int N, A, B, C;
vi l;
int ans;

void dfs(int n, int a, int b, int c, int ma, int mb, int mc)
{
    if(n == N)
    {
        if(a == 0 || b == 0 || c == 0) return;
        ans = min(ans, max(ma-1, 0)*10+max(mb-1, 0)*10+max(mc-1, 0)*10+abs(A-a)+abs(B-b)+abs(C-c));
        return;
    }
    dfs(n+1, a, b, c, ma, mb, mc);
    dfs(n+1, a+l[n], b, c, ma+1, mb, mc);
    dfs(n+1, a, b+l[n], c, ma, mb+1, mc);
    dfs(n+1, a, b, c+l[n], ma, mb, mc+1);
}

void solve()
{
    cin >> N >> A >> B >> C;
    l.resize(N); REP(i, N) cin >> l[i];
    ans = INF;
    dfs(0, 0, 0, 0, 0, 0, 0);
    cout << ans << endl;
}
    
int main() 
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
const double EPS = 1e-10;
const double g = 9.8;	//??????????????? 
const int MAX_N = 55; 

//?????\ 
int N;
double V, X, Y;
double L[MAX_N], R[MAX_N], B[MAX_N], T[MAX_N];

//????????\vy??????????????´???????°????t?§????????????? 
double calc(double vy, double t){
	return vy * t - g * t * t / 2;
}

//a??????lb???ub????????? 
int cmp(double lb, double ub, double a){
	return a < lb + EPS ? -1 : a > ub - EPS ? 1 : 0;
}

//??????????°???????????????????(qx, qy)??¶????????????????????????
bool check(double qx, double qy)
{
    //??????????????¨x?????????y????????????????????????vx???vy????????????(qx, qy)?????¶??´???t
    //????§£??????????¨????vx^2 + vy ^2 = V^2, vx * t = 1x, vy * t - 1/2 g t^2 = qy
    double a = g * g / 4, b = g * qy - V * V, c = qx * qx + qy * qy;
    double D = b * b - 4 * a * c;
    if (D < 0 && D > -EPS)
        D = 0;
    if (D < 0)
        return false;
    for (int d = -1; d <= 1; d += 2){       //????????????????¨?????????????????§£?????????
        double t2 = (-b + d * sqrt(D)) / (2 * a);
        if (t2 <= 0)
            continue;
        double t = sqrt(t2);
        double vx = qx / t, vy = (qy + g * t * t / 2) / t;

        //??????????????????????????£??????
        double yt = calc(vy, X / vx);
        if (yt < Y - EPS)
            continue;

        bool ok = true;
        for (int i = 0; i < N; i++){
            if (L[i] >= X)
                continue;
            //????????¨?????£???????????????????????´?????????????¢????
            if (R[i] == X && Y <= T[i] && B[i] <= yt)
                ok = false;
            //????????¨?£???°????????£??????????????????????????°????¢????
            int yL = cmp(B[i], T[i], calc(vy, L[i] / vx));   //?????§???????????????
            int yR = cmp(B[i], T[i], calc(vy, R[i] / vx));   //?????§???????????????
            int xH = cmp(L[i], R[i], vx * (vy / g));      //????????????????????????
            int yH = cmp(B[i], T[i], calc(vy, vy / g));
            if (xH == 0 && yH >= 0 && yL < 0)
                ok = false;
            if (yL * yR <= 0)
                ok = false;
        }
        if (ok)
            return true;
    }
    return false;
}

void solve(){
	//???????????\??????????¢???? 
 	for(int i = 0; i < N; i++){
 		R[i] = min(R[i], X);
	}
	bool ok = check(X, Y);			//??´??\?????????????????? 
	for(int i = 0; i < N; i++){
	 	ok |= check(L[i], T[i]);	//?????????????§?????????? 
	 	ok |= check(R[i], T[i]);	//?????????????§?????????? 
	}
	puts(ok ? "Yes" : "No");
}
int main(){
 	while(scanf("%d%lf%lf%lf",&N,&V,&X,&Y)!=EOF){
 		for(int i = 0; i < N; i++)
 			scanf("%lf%lf%lf%lf",&L[i],&B[i],&R[i],&T[i]);	
		solve();
	}
 	return 0;
}

Measured memory_bytes: 2756
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned int u32;
typedef pair<int, int> p;
int Inf = 1000000000;
ll inf = 1000000000000;
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,k;
	cin >> n >> k;
	ll a[220000], i;
	for (i = 0; i < n; i++) {
		cin >> a[i];
	}
	ll ans = 0;
	stable_sort(a, a + n, greater<int>());
	for (i = k; i < n; i++) {
		ans += a[i];
	}
	cout << ans;
	return(0);
}

Measured memory_bytes: 2560
x=int(input())
if x==2:
  print(2)
else:
  prime = False
  while prime == False:
    c=0
    for i in range(2,int(x**0.5)+1):
      if x%i != 0:
        c=c+1
    if c==int(x**0.5)-1:
      print(x)
      prime=True
    x=x+1

Measured memory_bytes: 3188
fn read<T: std::str::FromStr>(
    stdin_lock: &mut std::io::StdinLock,
    buf: &mut Vec<u8>,
    delimiter: u8,
) -> T {
    buf.clear();
    let l = std::io::BufRead::read_until(stdin_lock, delimiter, buf).unwrap();
    buf.truncate(l - 1); // remove delimiter
    let s = unsafe { std::str::from_utf8_unchecked(&buf) };
    s.parse().unwrap_or_else(|_| panic!("read"))
}

fn main() {
    let stdin = std::io::stdin();
    let mut stdin_lock = stdin.lock();
    let mut buf: Vec<u8> = Vec::new();
    let a = read(&mut stdin_lock, &mut buf, b' ');
    let b = read(&mut stdin_lock, &mut buf, b'\n');
    println!("{}", solve(a, b));
}

fn solve(a: i16, b: i16) -> i16 {
    (a - 1) * (b - 1)
}

#[test]
fn example1() {
    assert_eq!(1, solve(2, 2))
}

#[test]
fn example2() {
    assert_eq!(24, solve(5, 7))
}


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

#define ed cout << "\n";
#define speed                         \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define ll long long
#define ffor(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(i, n) ffor(i, 0, n)
#define All(obj) (obj).begin(), (obj).end()
#define INF ((ll)1e9 + 7)
#define c(a) cout << a << "\n";
using namespace std;
const int N = 100005;

int main()
{
    speed;
    cout << fixed << setprecision(6);
    /*start*/
    string s, t;
    cin >> s >> t;
    rep(i,s.length()){
        if(s[i]!=t[i]){
            c("No");
            return 0;
        }
    }
    c("Yes");
    return 0;
}


Measured memory_bytes: 3648
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<cmath>
#include<cstring>
#include<climits>
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
#define LL long long
//#define getchar() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2) ? EOF : *p1++)
//char buf[(1 << 21) + 1], *p1 = buf, *p2 = buf;
inline int read() {
	bool f=0;int x=0;char c=getchar();
	while(c<'0'||'9'<c){if(c==EOF)exit(0);if(c=='-')f=1;c=getchar();}
	while('0'<=c&&c<='9') x=(x<<3)+(x<<1)+(c^48),c=getchar();
	return !f?x:-x;
}
#define MAXN 200000
#define MAXM 500000
#define INF 0x3f3f3f3f
struct Edge{
	int nxt,v,cap;
}edge[2*MAXM+5];
int ecnt,head[MAXN+5],cur[MAXN+5];
void Init(){
	ecnt=-1,memset(head,-1,sizeof(head));
	return ;
}
void Addedge(int u,int v,int cap){
	//printf("%d %d %d\n",u,v,cap);
	edge[++ecnt]=(Edge){head[u],v,cap},head[u]=ecnt;
	edge[++ecnt]=(Edge){head[v],u,0},head[v]=ecnt;
	return ;
}
int N,S,T;
int dep[MAXN+5];
bool BFS(){
	queue<int> Q;
	for(int i=0;i<=N;i++)
		dep[i]=INF;
	dep[S]=0,Q.push(S);
	while(!Q.empty()){
		int u=Q.front();Q.pop();
		for(int i=head[u];~i;i=edge[i].nxt){
			int v=edge[i].v,cap=edge[i].cap;
			if(dep[v]==INF&&cap)
				dep[v]=dep[u]+1,Q.push(v);
		}
	}
	return dep[T]<INF;
}
int DFS(int u,int aug){
	if(u==T) return aug;
	int flow=0,f;
	for(int &i=cur[u];~i;i=edge[i].nxt){
		int v=edge[i].v,cap=edge[i].cap;
		if(dep[v]==dep[u]+1&&cap&&(f=DFS(v,min(aug,cap)))){
			aug-=f,flow+=f;
			edge[i].cap-=f,edge[i^1].cap+=f;
			if(!aug) break;
		}
	}
	return flow;
}
int Dinic(){
	int Max_Flow=0;
	while(BFS())
		memcpy(cur,head,sizeof(head)),Max_Flow+=DFS(S,INF);
	return Max_Flow;
}
queue<int> Q;
int ma[MAXN+5];
bool vis[MAXN+5];
vector<int> G[MAXN+5];
int cho1[MAXN+5],cho2[MAXN+5];
int main(){
	Init();
	int n=read();
	N=2*n+2,S=2*n+1,T=2*n+2;
	for(int i=1;i<n;i++)
		Addedge(S,i,1);
	for(int i=2;i<=n;i++)	
		Addedge(i+n-1,T,1);
	for(int i=1;i<n;i++){
		int c=read();
		for(int j=1;j<=c;j++){
			int w=read();
			G[w].push_back(i);
			if(w!=1)
				Addedge(i,w+n-1,1);
		}
	}
	int ans=Dinic();
	if(ans!=n-1)
		puts("-1"),exit(0);
	for(int s=1;s<n;s++)
		for(int i=head[s];~i;i=edge[i].nxt)
			if(!edge[i].cap)
				ma[s]=edge[i].v-(n-1);
	Q.push(1);
	int cnt=0;
	while(!Q.empty()){
		cnt++;
		int u=Q.front();Q.pop();
		for(int i=0;i<(int)G[u].size();i++){
			int s=G[u][i];
			if(vis[s]) continue;
			vis[s]=1,Q.push(ma[s]);
			cho1[s]=u,cho2[s]=ma[s];
		}
	}
	if(cnt!=n)
		puts("-1"),exit(0);
	for(int i=1;i<n;i++)
		printf("%d %d\n",cho1[i],cho2[i]);
	return 0;
}
//

Measured memory_bytes: 24924
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cerr << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cerr<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 500010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = (1 << 30) - 1;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
mt19937 rng; //use it by rng() % mod, shuffle(all(vec), rng)
///////////////////////////////////////////////////////////////////////////////////////////////////

int N;
ll A[MAX_N], B[MAX_N];

void solve() {
	cin >> N;
	rep(i, 0, N) cin >> A[i] >> B[i];
	reverse(A, A + N);
	reverse(B, B + N);
	ll res = 0;
	ll s = 0;
	rep(i, 0, N) {
		ll a = A[i], b = B[i];
		a += s;
		res += (b - a % b) % b;
		s += (b - a % b) % b;
		// debug(i, s);
	}
	cout << res << "\n";
}

uint32_t rd() {
	uint32_t res;
#ifdef __MINGW32__
	asm volatile("rdrand %0" :"=a"(res) ::"cc");
#else
	res = std::random_device()();
#endif
	return res;
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
    cerr << fixed;
	cerr.precision(6);
	rng.seed(rd());
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
	if(!freopen("in.txt", "rt", stdin)) return 1;
#endif	
	solve();
    cerr << "Time: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}



Measured memory_bytes: 5120
#include <iostream>
#include <iterator>
#include <set>
#include <vector>

using namespace std;

int main()
{
    int no_of_elements;
    cin >> no_of_elements;

    multiset <int> H;
    for(int i = 1; i <= no_of_elements; i++)
    {
        int health;
        cin >> health;
        H.insert(health);
    }

    while(H.size() > 1)
    {
        multiset <int> :: iterator it1 = H.begin();

        int smallest = (*it1);

        multiset <int> :: iterator it2 = (--H.end());

        int largest = (*it2);

        H.erase(it2);

        largest %= smallest;

        if(largest > 0)
            H.insert(largest);
    }

    multiset <int> :: iterator it = H.begin();
    int survivor = (*it);

    cout << survivor;
    return 0;
}


Measured memory_bytes: 4992
#include <iostream>
#include <algorithm>
using namespace std;
const int nmax=100005;
long long a[nmax],sum[nmax];
int n,i,lst;
int main()
{
    cin>>n;
    for(i=1;i<=n;i++)
        cin>>a[i];
    sort(a+1,a+n+1);
    lst=1;
    for(i=1;i<=n;i++)
    {
        sum[i]=sum[i-1]+a[i];
        if(a[i]>2*sum[i-1])
            lst=i;
    }
    cout<<n-lst+1;
    return 0;
}


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

int main(int argc, const char * argv[]) {
    // insert code here...
    int a,b;
    string op;
    while (true) {
        cin >> a >> op >> b;
        if (op == "+") cout << a+b <<  endl;
        else if(op == "-") cout << a-b <<  endl;
        else if(op == "*") cout << a*b <<  endl;
        else if(op == "/") cout << a/b <<  endl;
        else if(op=="?") break;
    }
    
    return 0;
}

Measured memory_bytes: 1204
from sys import stdin
from itertools import repeat
def main():
    n, m = map(int, stdin.readline().split())
    dat = map(int, stdin.read().split(), repeat(10, 2 * m))
    la = [None] * (n + 1)
    xt = [None] * (2 * m)
    j = 0
    for i in xrange(m):
        x, y = dat[j], dat[j+1]
        xt[j] = la[y]
        la[y] = j
        j += 1
        xt[j] = la[x]
        la[x] = j
        j += 1
    st = [1]
    pu = st.append
    po = st.pop
    col = [None] * (n + 1)
    col[1] = 1
    while st:
        x = po()
        y = la[x]
        nc = 3 - col[x]
        while y is not None:
            t = dat[y]
            if col[t] is None:
                col[t] = nc
                pu(t)
            else:
                col[t] |= nc
            y = xt[y]
    ans = 0
    p = [0] * 3
    for i in xrange(1, n + 1):
        if col[i] == 3:
            ans = 0
            break
        ans += p[col[i]]
        p[col[i]] += 1
    print n * (n - 1) / 2 - m - ans
main()


Measured memory_bytes: 20084
//21:16-23:16
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
#define mod 1000000007
ll C[55][55];
int main(){
    int A=0,B=0,n,p;
    cin >> n >> p;
    rep(i,n){
        int a; cin >> a;
        if(a%2==0)A++; else B++;
    }
    C[0][0] = 1;
    for(int i=1;i<55;i++) for(int j=0;j<=i;j++){
        if(j==0 || j==i) C[i][j] = 1;
        else C[i][j] = C[i-1][j-1]+C[i-1][j];
    }
    ll ans = 0;
    for(int i=0;i<=B;i++){
        if(p == i%2){
            ans += (1LL<<A) * C[B][i];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <deque>
#include <climits>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
//#include <tuple>

#define INF INT_MAX>>1 
#define SIZE 100010
#define MOD 1000000007
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define rep2(i, from, to) for(int i=(from); i<(int)(to); i++)
#define all(obj) (obj).begin(), (obj).end()
#define lpair pair<ll, ll>
#define vint vector<ll>
#define vinput(name) for(int i=0; i<(int)(name.size()); i++) cin >> name[i];
#define voutput(name) for(int i=0; i<(int)(name.size()); i++) cout << name[i] << endl;
typedef long long ll;

using namespace std;

ll ans = 0;

int main(void){
	int n; cin >> n;
	map <string, int> counts;
	int max_count = 0;;
	rep(i, n){
		string str; cin >> str;
		counts[str]++;
		max_count = max(max_count, counts[str]);
	}

	for(auto p: counts){
		if(p.second == max_count){
			cout << p.first << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 26240
#include <stdio.h>

typedef struct {
  char pic;
  int value;
} trump;

int main(){

  int i,j,a,b,n,minj,flag_buble=1,flag_select=1;
  trump c[36],buble[36],select[36],tmp;
  
  //in
  scanf("%d",&n);
  
  for(i=0;i<n;i++){
    while(1){
      scanf("%c",&c[i].pic);
      if(c[i].pic != 'D' && c[i].pic != 'C' && c[i].pic != 'S' && c[i].pic != 'H') 
	continue;
      scanf("%d",&c[i].value);
      break;
    }
  }
  
  //copy
  for(i=0;i<n;i++){
    buble[i] = c[i];
    select[i] = c[i];
  }
  //bublesort
  for(i=0;i<n;i++){
    for(j=n-1;j>i;j--){
      if(buble[j].value < buble[j-1].value){
	tmp = buble[j-1];
	buble[j-1] = buble[j];
	buble[j] = tmp;
      }
    }
  }

  //SelectionSort
  for(i=0;i<n;i++){
    minj = i;
    for(j=i;j<n;j++){
      if(select[j].value<select[minj].value) minj=j;
    }
    //swap
    if(i!=minj){
      tmp = select[i];
      select[i] = select[minj];
      select[minj] = tmp;
    } 
  }

  //compare
  for(i=0;i<n;i++){
    for(j=i+1;j<n;j++){
      for(a=0;a<n;a++){
	for(b=a+1;b<n;b++){
	  if(c[i].value==c[j].value && c[i].value==buble[b].value 
	     && c[i].pic==buble[b].pic && c[j].value==buble[a].value 
	     && c[j].pic==buble[a].pic) flag_buble=0;
	  
	  if(c[i].value==c[j].value && c[i].value==select[b].value 
	     &&c[i].pic==select[b].pic && c[j].value==select[a].value 
	     && c[j].pic==select[a].pic) flag_select=0;
	}
      }
    } 
  }
  
  //out
  for(i=0;i<n;i++){
    
    if(i!=0) printf(" ");
    printf("%c%d",buble[i].pic,buble[i].value);
  }
  if(flag_buble==1) printf("\nStable\n");
  else printf("\nNot stable\n");

  for(i=0;i<n;i++){
    
    if(i!=0) printf(" ");
    printf("%c%d",select[i].pic,select[i].value);
  }
  if(flag_select==1) printf("\nStable\n");
  else printf("\nNot stable\n");

  return 0;

}

Measured memory_bytes: 612
#include <stdio.h>
int main(void) {
int w,h,x,y,r;
scanf("%d",&w);
scanf("%d",&h);
scanf("%d",&x);
scanf("%d",&y);
scanf("%d",&r);
if( x >= r && y >= r && w-x >= r && h-y >= r ) {
printf("Yes\n");
} else {
printf("No\n");
}
return 0;
}

Measured memory_bytes: 1012
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define N 5003
#define ll long long

using namespace std;

int n, m, a, b;
int pos[N];
ll f[N][N << 1];

int main(){
	cin >> n >> a >> b; m = n * 2 + 1;
	for(int i = 1; i <= n; ++i){
		int x; scanf("%d", &x);
		pos[x] = i * 2;
	}
	memset(f, 127, sizeof f);
	for(int j = 1; j <= m; ++j) f[0][j] = 0;
	for(int i = 1; i <= n; ++i)
		for(int j = 1; j <= m; ++j){
			ll tmp = (j != pos[i]) * (j < pos[i] ? b : a);
			tmp += f[i - 1][j - !(j & 1)]; 
			f[i][j] = min(f[i][j - 1], tmp);
		}
	cout << f[n][m] << endl;
	return 0;
}

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

ans = ""

digit_count = 1
check = 26

while N > check:
    digit_count += 1
    check += 26 ** digit_count

offset = check - 26 ** digit_count

N -= offset + 1

while digit_count > 0:
    ans = "" + chr(ord("a") + N % 26) + ans
    N //= 26
    digit_count -= 1

print(ans)

Measured memory_bytes: 9092
#include <iostream>
#include <cstdio>
#include <cstdlib>

using namespace std;

#define STACKSIZE 1000

struct stack {
    int num;
    int data[STACKSIZE];
} stack_t;

bool push(stack *stk, int push_data) {
    if (stk->num < STACKSIZE) {
        stk->data[stk->num] = push_data;
        stk->num++;
        return true;
    } else {
        return false;
    }
}

int pop(stack *stk) {
    if (stk->num > 0) {
        return stk->data[--stk->num];
    } else {
        return -1000000000;
    }
}

void printStack(stack *stk) {
    cout << "[";
    for (int i = 0; i < stk->num; ++i) {
        cout << " " << stk->data[i];
    }
    cout << "]" << endl;
}

int main() {
    int a, b;
    char ch[100];

    while (scanf("%s", ch) != EOF) {
        switch (ch[0]) {
            case '+':
                a = pop(&stack_t);
                b = pop(&stack_t);
                push(&stack_t, (a + b));
                break;
            case '-':
                a = pop(&stack_t);
                b = pop(&stack_t);
                push(&stack_t, b - a);
                break;
            case '*':
                a = pop(&stack_t);
                b = pop(&stack_t);
                push(&stack_t, a * b);
                break;
            default:
                push(&stack_t, atoi(ch));
                break;
        }
        //printStack(&stack_t);
    }
    
    cout << pop(&stack_t) << endl;

    return 0;
}



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

#define endl '\n'

void io(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.precision(15);
}
int mark[27] ;
string s ;
int solve(char ch){
    string ss = s ;
    int ret = 0 ;
    int n = s.length() ;
    for(int iter = 0 ; iter < n ; iter++){
        bool ok = 1 ;
        for(int i = 0 ; i < n ; i++){
            ok &= (ss[i] == ch) ;
        }
        if(ok){
            break; 
        }
        ret += 1 ;
        int lidx = -1 ;
        for(int i = 1 ; i < n ; i++){
            if(ss[i] != ch && ss[i-1] == ch){
                lidx = i ;
            }
        }
        if(lidx != -1){
            ss[lidx] = ch ;
        }
        else{
            lidx = n  ;
        }
        for(int i = 1; i < lidx; i++){
            if(ss[i] == ch){
                ss[i-1] = ch ;
            }
        }
    }
    return ret ;
}
int main(int argc,char* argv[]) { 
    io() ;
    cin >> s;
    for(auto c:s){
        mark[c - 'a'] = 1 ;
    }
    int fans = s.length() ;
    for(char ch = 'a'; ch <= 'z'; ch++){
        if(mark[ch-'a']){
            int tmp = solve(ch) ;
            fans = min(fans, tmp) ;
        }
    }
    cout << fans << endl ;
    return 0 ; 
}

Measured memory_bytes: 256
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

class UnionFind {
private:
	vector<int> data;
	int root(int x) { return data[x] < 0 ? x : data[x] = root(data[x]); }

public:
	UnionFind(int size) : data(size, -1) { }
	bool is_same(int x, int y) { return root(x) == root(y); }
	int size(int x) { return -data[root(x)]; }

	bool unify(int x, int y) {
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
			return true;
		}
		return false;
	}
};


int main() {

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

	int N, M;
	cin >> N >> M;

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

	UnionFind uf(N);
	for (int i = 0; i < M; i++) {
		int x, y;
		cin >> x >> y;
		x--, y--;
		uf.unify(x, y);
	}

	cout << count_if(p.begin(), p.end(), [&](int e) {return uf.is_same(e, p[e]); }) << "\n";

	return 0;
}

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

int main() {
	int N;
	long A, B, ans = 0;
	cin >> N >> A >> B;
	vector<long> X(N);
	for (long& i : X) cin >> i;
	for (int i = 1; i < N; i++) ans += min((X[i] - X[i - 1]) * A, B);
	cout << ans;
}

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

int main(void)
{
	int n, s[101], i, b, ans = 0, max = 0, count = 0;
	scanf("%d", &n);
	for(i = 0; i < n; i++){
		b = scanf("%d", &s[i]);
	}

	// まず全部たす
	for(i = 0; i < n; i++){
		ans = ans + s[i];
	}
	if(ans % 10 == 0){
		count++;
		for(i = 0; i < n; i++){
			if(s[i] % 10 != 0){
				if(max < ans - s[i]){
					max = ans - s[i];
				}
			}
		}
	}
	else{
		printf("%d", ans);
	}
	if(count > 0)
		printf("%d", max);
		
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>

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

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

typedef long long ll;

using namespace std;

int dp[3002];
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  int mod=1e9+7;
  string s;
  cin>>n>>s;
  dp[1]=1;
  rep(i,n-1)
  {
    if(s[i]=='<')
    {
      int sum=0;
      repi(j,1,i+3)
      {
        sum+=dp[j];
        dp[j]=sum-dp[j];
        if(sum>mod)sum-=mod;
      }
    }
    else
    {
      for(int j=i+1;j>1;j--)
      {
        dp[j-1]+=dp[j];
        if(dp[j-1]>mod)dp[j-1]-=mod;
      }
    }
  }
  ll res=0;
  repi(i,1,n+1)res+=dp[i];
  cout<<res%mod<<endl;

  return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define SORT(c) sort((c).begin(),(c).end())
#define MOD 1000000007 //S(vector).size()
using namespace std;
typedef unsigned long long ll;

int main(void){
	int n;
	cin >> n;
	string opr;
	int num;

	list<int> L;
	rep(i, n){
		cin >> opr;
		if(opr != "deleteLast" && opr != "deleteFirst") cin >> num;

		if(opr == "insert"){
			L.push_front(num);
		}
		else if(opr == "delete"){
			for(auto it = L.begin(); it != L.end(); it++){
				if(*it == num){
					L.erase(it);
					break;
				}
			}
		}
		else if(opr == "deleteFirst"){
			L.pop_front();
		}
		else if(opr == "deleteLast"){
			L.pop_back();
		}
	}
	int i = 0;
	for(auto it = L.begin(); it != L.end(); it++){
		if(i++) printf(" ");
		printf("%d", *it);
	}
	printf("\n");

	return 0;
}



Measured memory_bytes: 34496
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 100005;
const ll MOD = 1e9 + 7;

ll n, k, ans = 1;
vector<int> conn[N];
int par[N], c[N];

void dfs(int v, int p) {
    par[v] = p;
    for (auto u : conn[v]) {
        if (u != p) {
            ++c[v];
            dfs(u, v);
        }
    }
}

int main() {
    cin.sync_with_stdio(0); cin.tie(0);
    cin >> n >> k;
    for (int i = 0; i < n - 1; ++i) {
        int a, b;
        cin >> a >> b;
        --a; --b;
        conn[a].push_back(b);
        conn[b].push_back(a);
    }
 
    dfs(0, -1);

    queue<pair<int, int>> q;
    q.push({0, k});

    while (!q.empty()) {
        pair<int, int> v = q.front(); 
        q.pop();
        ans = ((ans % MOD) * (v.second % MOD)) % MOD;
        // cout << v.first << ' ' << ans << '\n';
        ll pos = k - 1;
        if (par[v.first] != -1) --pos;
        for (auto u : conn[v.first]) {
            if (u == par[v.first]) continue;
            q.push({u, pos--});
            pos = max(0ll, pos);
        }
    }
    
    cout << ans % MOD;
}


Measured memory_bytes: 14516
#include<bits/stdc++.h>
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long LL;
typedef pair<int,int> PII;
inline LL read()
{
	LL x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
	return x*f;
}
const int N=1000008,mod=1e9+7;
inline void add_ans(int &x,int y)
{
	x+=y;
	if(x>=mod)	x-=mod;
	if(x<0)		x+=mod;
}
int x,x2,x3,x4,x5,x6;
int y,y2,y3,y4,y5,y6;
int fac[N*2],ifac[N*2];
struct node{
	int x,y,t;
}a[4],b[4];
int ans;
inline int C(int x,int y)
{
	if(x<y)	return 0;
	return 1ll*fac[x]*ifac[y]%mod*ifac[x-y]%mod;
}
inline int solve(int t1,int t2)
{
	int tmp=0;
	int x=a[t1].x,x2=b[t2].x,y=a[t1].y,y2=b[t2].y;
	for(int i=x3;i<=x4;++i){
		add_ans(tmp,1ll*C(i+y3-1-x-y,i-x)*C(x2+y2-i-y3,x2-i)%mod*(-i-y3)%mod);
	}
	for(int i=x3;i<=x4;++i){
		add_ans(tmp,1ll*C(i+y4-x-y,i-x)*C(x2+y2-i-y4-1,x2-i)%mod*(i+y4+1)%mod);
	}
	for(int j=y3;j<=y4;++j){
		add_ans(tmp,1ll*C(x3+j-1-x-y,j-y)*C(x2+y2-x3-j,y2-j)%mod*(-j-x3)%mod);
	}
	for(int j=y3;j<=y4;++j){
		add_ans(tmp,1ll*C(x4+j-x-y,j-y)*C(x2+y2-x4-1-j,y2-j)%mod*(j+x4+1)%mod);
	}
	return tmp;
}
int main()
{
	x=read();x2=read();x3=read();x4=read();x5=read();x6=read();
	y=read();y2=read();y3=read();y4=read();y5=read();y6=read();
	fac[0]=fac[1]=1;
	ifac[0]=ifac[1]=1;
	for(int i=2;i<=x6+y6;++i){
		fac[i]=1ll*fac[i-1]*i%mod;
		ifac[i]=1ll*(mod-mod/i)*ifac[mod%i]%mod;
	}
	for(int i=2;i<=x6+y6;++i){
		ifac[i]=1ll*ifac[i-1]*ifac[i]%mod;
	}
	a[0]=(node){x2,y2,1};
	a[1]=(node){x2,y-1,-1};
	a[2]=(node){x-1,y2,-1};
	a[3]=(node){x-1,y-1,1};
	b[0]=(node){x5,y5,1};
	b[1]=(node){x5,y6+1,-1};
	b[2]=(node){x6+1,y5,-1};
	b[3]=(node){x6+1,y6+1,1};
	for(int i=0;i<4;++i){
		for(int j=0;j<4;++j){
			add_ans(ans,a[i].t*b[j].t*solve(i,j));
		}
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 15872
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>
#include <functional>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define EB emplace_back
#define GREATER(T) T, VT<T> greater<T>
template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

int main(void) {
    int N, X;
    cin >> N >> X;
    VI L(N);
    REP(i, N) cin >> L[i];

    int cnt = 1;
    int pre = 0;
    REP(i, N) {
        pre = pre + L[i];
        if (pre <= X) cnt++;
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scanf("%s", &s)

	count := 0
	for i := 0; i < len(s)/2; i++ {
		if s[i] != s[len(s)-i-1] {
			count++
		}
	}

	fmt.Printf("%d\n", count)
}


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

const int INF = 1000000000;

int main()
{
	while(true){
		int n;
		cin >> n;

		if(n==0)
			break;

		int T[10][10];
		for(int i=0; i<10; i++){
			for(int j=0; j<10; j++){
				if(i==j){
					T[i][j] = 0;
				}
				else{
					T[i][j] = INF;
				}
			}
		}

		int m = 0;

		for(int i=0; i<n; i++){
			int a, b, c;
			cin >> a >> b >> c;

			T[a][b] = T[b][a] = c;

			if(a+1>m){
				m = a+1;
			}
			if(b+1>m){
				m = b+1;
			}
		}

		for(int k=0;k<m;k++){
			for(int i=0;i<m;i++){
				for(int j=0;j<m;j++){
					if(T[i][j]>T[i][k]+T[k][j]){
						T[i][j]=T[i][k]+T[k][j];
					}
				}
			}
		}


		int x[m];
		for(int i=0;i<m;i++)
			x[i]=0;
		
		int city,num;
		for(int i=0;i<m;i++){
			for(int j=0;j<m;j++){
				x[i]=x[i]+T[i][j];
			}
			if(num>x[i]||i==0){
				num=x[i];
				city=i;
			}
		}
		
		cout<<city<<' '<<num<<endl;
		
	}


	return 0;
}

Measured memory_bytes: 2920
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <map>
#include <cstdlib>
#include <sstream>
#include <bitset>
using namespace std;

typedef long long ll;

int main()
{
   int N,K;
   cin >> N >> K;
   string S;
   cin >> S;
   S[K-1]=S[K-1]-('A'-'a');
   cout << S << endl;



    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
using namespace std;
int a[5],b[5]={0,1,0,-1};
int n=3,k,ans;
int main()
{
	for(int i=1;i<=n;++i)
	scanf("%d",&a[i]);
	scanf("%d",&k);
	for(int i=1;i<=n;++i)
	{
		if(k>=a[i])k-=a[i],ans+=a[i]*b[i];
		else
		{
			ans+=k*b[i];
			break;
		}
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 3840
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // 標準入力から取得
        Scanner scan = new Scanner(System.in);
        // 取得した文字を格納する可変長リスト
        ArrayList<String> scList = new ArrayList<>();
        
        for (int i = 0; i >= 0; i++) {
            try {
                // 可変長リストに標準入力の値を格納
                scList.add(scan.nextLine());
            } catch (Exception e) {
                break;
            }
        }
        
        Set<String> gacha = new HashSet<String>();
        
        for (int i = 0; i < scList.size(); i++) {
            if (i != 0) {
                gacha.add(scList.get(i));
            }
        }
        System.out.println(gacha.size());
    }
}

Measured memory_bytes: 81520
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int a,b;
  cin >> a >> b;
	
  cout << (a-1)*(b-1) << endl;
  return 0;
}


Measured memory_bytes: 636
#include <vector>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <math.h>
#include <list>

using namespace std;

int sum_digit(int n) {
	if (n == 0) return 0;
	else return n % 10 + sum_digit(n / 10);
}
int absolute(int a) {
	if (a < 0) return -a;
	else return a;
}

int main()
{
  int n; cin >> n;
  vector<int> a(n); for(int i = 0; i < n; i++) cin >> a.at(i);
  
  int i = n-1;
  if(n == 1) cout << a.at(i);
  if(n % 2 == 1){
  	while(i > 0){
      cout << a.at(i) << ' ';
      i -= 2;
    }
    while(i <= n-2){
      if(i != n - 2) cout << a.at(i) << ' ';
      else cout << a.at(i);
      if(i == 0) i++;
      else i += 2;
    }
  }
  if(n % 2 == 0){
  	while(i > 1){
      cout << a.at(i) << ' ';
      i -= 2;
    }
    while(i <= n-2){
      if(i != n - 2) cout << a.at(i) << ' ';
      else cout << a.at(i);
      if(i == 1) i--;
      else i += 2;
    }
  }
}

Measured memory_bytes: 2944
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>

using namespace std;
using ll = long long int;
#define rep(i,n) for(int i = 0; i < n; i++)
#define FOR(i, a, b)  for(int i = (a); i < (b) ; i++)

#define pb push_back
#define SORT(v,n) sort(v, v+n)
#define ALL(x) (x).begin(),(x).end()
#define debug(x) cerr << #x << ": " << x << '\n'
#define elif else if
#define itn ll
#define int ll
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
///                →,↑,←,↓,↗,↖,↙,↘
int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;


signed main() {
	ios::sync_with_stdio(false);
	int h, w;
	cin >> h >> w;
	vector<string> g(h);
	int i;
	rep(i, h) cin >> g[i];
	//. #
	int x, y;
	rep(y, h) {
		rep(x, w) {
			int k;
			int bombnum = 0;
			rep(k, 8) {
				int lx = x + dx[k];
				int ly = y + dy[k];
				if (lx >= 0 and lx < w and ly >= 0 and ly < h) {
					if (g[ly][lx] == '#') bombnum++;
				}
			}
			if(g[y][x] != '#')
				g[y][x] = bombnum + '0';
		}
	}
	rep(i, h) {
		cout << g[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<math.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<set>
#include<cstring>
#include<map>
 
 
using namespace std;
#define int long long int
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define mp make_pair
#define pb push_back
#define mod 1000000007
//#define mod 998244353

int N,M;

//union find
struct union_find{
    int *parent; //parent[i]=parent of i
    int N;
    union_find(int N):N(N){
        parent=new int[N];
        rep(i,N)parent[i]=i; //init
    }
    int root(int x){ // take the root of x 
        if(parent[x]==x) return x;
        parent[x]=root(parent[x]); // recursion
        return parent[x];
    }
    void unite(int x,int y){// unite tree y to tree x
        int rx=root(x);
        int ry=root(y);
        if(rx==ry) return;
        parent[ry]=rx;
    }
    bool same(int x,int y){
        int rx=root(x);
        int ry=root(y);
        return rx==ry;
    }
    bool IsAllSameTree(){
        int rt=parent[0];
        rep(i,N){
            if(rt!=parent[i])return false;
        }
        return true;
    }
    int countClasses(){//破壊的
        int cnt=0;
        rep(i,N)root(i);
        sort(parent,parent+N);
        rep(i,N-1){
            if(parent[i+1]!=parent[i])cnt++;
        }
        return cnt+1;
    }
};

signed main(){
    scanf("%lld %lld",&N,&M);
    union_find uf(N);
    rep(i,M){
        int x,y,z;
        scanf("%lld %lld %lld",&x,&y,&z);x--;y--;
        uf.unite(x,y);
    }
    int ans=uf.countClasses();
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 4088
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

N,X = map(int,input().split())

x = list(map(int,input().split()))

x = [abs(i-X) for i in x]


d = x[0]

for i in x:
	d = gcd(d,i)
print(d)

Measured memory_bytes: 14252
using System;

namespace ABC139B
{
    static class Program
    {
        static void Main()
        {
            double[] nbrs = Array.ConvertAll(Console.ReadLine().Split(), double.Parse);
            double A = nbrs[0];
            double B = nbrs[1];

            double res = Math.Ceiling((B - 1) / (A - 1));
            Console.WriteLine(res);
        }
    }
}

Measured memory_bytes: 13140
/**
 *    author:  tourist
 *    created: 03.02.2018 17:25:43       
**/
#include <bits/stdc++.h>

using namespace std;

class dsu {
  public:
  vector<int> p;
  int n;

  dsu(int _n) : n(_n) {
    p.resize(n);
    iota(p.begin(), p.end(), 0);
  }

  inline int get(int x) {
    return (x == p[x] ? x : (p[x] = get(p[x])));
  }

  inline bool unite(int x, int y) {
    x = get(x);
    y = get(y);
    if (x != y) {
      p[x] = y;
      return true;
    }
    return false;
  }
};

int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  dsu d(n);
  for (int i = 0; i < m; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    d.unite(x, y);
  }
  vector< vector<int> > comp(n);
  for (int i = 0; i < n; i++) {
    comp[d.get(i)].push_back(a[i]);
  }
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (!comp[i].empty()) {
      cnt++;
    }
  }
  if (cnt == 1) {
    puts("0");
    return 0;
  }
  int choose = 2 * cnt - 2;
  long long ans = 0;
  vector<int> other;
  for (int i = 0; i < n; i++) {
    if (!comp[i].empty()) {
      sort(comp[i].begin(), comp[i].end());
      ans += comp[i][0];
      choose--;
      for (int j = 1; j < (int) comp[i].size(); j++) {
        other.push_back(comp[i][j]);
      }
    }
  }
  if (choose > (int) other.size()) {
    puts("Impossible");
    return 0;
  }
  sort(other.begin(), other.end());
  for (int i = 0; i < choose; i++) {
    ans += other[i];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 6528
x = int(input())
for i in range(240):
    a = -120 + i
    for j in range(240):
        b = -120 + j
        c = a ** 5 - b ** 5
        if c == x:
            ans1 = a
            ans2 = b
            break
print(str(ans1) + " " + str(ans2))

Measured memory_bytes: 9032
import itertools

num_of_sunuke, num_of_sweetstypes = map(int, input().split())

num_of_havingsweetssunuke= []
havingsweetssunukes = []

for _ in range(num_of_sweetstypes):
    num_of_havingsweetssunuke.append(int(input()))
    havingsweetssunukes.append(list(map(int, input().split())))

set_all = set(range(1, num_of_sunuke + 1))
set_havingsweets = set(itertools.chain.from_iterable(havingsweetssunukes))

print(len(set_all - set_havingsweets))

Measured memory_bytes: 9116
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {

    public static void main(String[] args) throws Exception {
        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(is);

        List<String> mylist = new ArrayList<>();

        // 標準入力からの値を変数strinputに代入
        String strinput = reader.readLine();

        while (strinput != null) {

            mylist.add(strinput);
            strinput = reader.readLine();

        }

        String arr01[] = mylist.get(0).split(" ");
        int x = Integer.valueOf(arr01[0]);
        int sho = x / 100;
        if (x <= sho * 105) {
            System.out.println(1);
        } else {
            System.out.println(0);
        }
    }

}


Measured memory_bytes: 22996
#coding utf-8
import collections

def main():
    question_c()

def question_c():
    n = int(input())
    st = [input() for i in range(n)]

    c = collections.Counter(st)
    most = list(c.most_common())

    ans = []

    for i in range(len(most)):
        if most[0][1] == most[i][1]:
            ans.append(most[i][0])

    ans = sorted(ans)
    for box in ans:
        print(box)
main()

Measured memory_bytes: 49328
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

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

    vector<string> ans(100, "");
    for(int i = 0; i < 50; i++) {
        rep(j, 100) ans[i] += "#";
    }
    for(int i = 50; i < 100; i++) {
        rep(j, 100) ans[i] += '.';
    }
    
    a--;
    b--;

    for(int i = 1; i < 50; i += 2){
        if(a == 0) break;
        for(int j = 1; j < 100; j += 2){
            if(a == 0) break;
            ans[i][j] = '.';
            a--;
        }
    }
    for(int i = 51; i < 100; i += 2){
        if(b == 0) break;
        for(int j = 1; j < 100; j += 2){
            if(b == 0) break;
            ans[i][j] = '#';
            b--;
        }
    }
    cout << "100 100" << endl;
    rep(i, 100) cout << ans[i] << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <utility>
#include <map>
#define maxn 105
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef map<int,int> :: iterator Ite;
int n;
map <int,int> fac;
void factorize(int x){
	for(int i=2;i * i <= x;i++){
		if(x % i == 0){
			while(x % i == 0){
				fac[i]++;
				x /= i;
			}
		}
	}
	if(x != 1) fac[x]++;
}
int a[maxn],k;
int dp[maxn];
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++) factorize(i);
	for(Ite it = fac.begin();it != fac.end();it++){
		a[++k] = it -> second;
	}
	dp[1] = 1;
	for(int i=1;i<=k;i++){
		for(int j=75;j>=1;j--){
			for(int k=2;k<=a[i] + 1;k++){
				if(j % k == 0) dp[j] += dp[j / k];
			}
		}
	}
	printf("%d\n",dp[75]);
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Text.RegularExpressions;
using CompLib.Util;

public class Program
{

    public void Solve()
    {
        var sc = new Scanner();
        string s = sc.Next();
        var r = new Regex("^(hi)+$");
        if (r.IsMatch(s))
        {
            Console.WriteLine("Yes");
        }
        else
        {
            Console.WriteLine("No");
        }
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 16208
#include<cstdio>
#define mod 998244353
long long n,s,f1[3005][3005],f2[3005][3005],a[3005],p[3005],ans;
int main(){
	scanf("%lld%lld",&n,&s);
	for(int i=1;i<=n;++i)scanf("%lld",&a[i]),p[i]=p[i-1]+a[i];
	for(int i=1;i<=n;++i){
		(f1[i][a[i]]+=i)%=mod;
		for(int j=0;j<=s;++j){
			f2[i][j]+=f2[i-1][j];
			if(j>a[i])
				(f1[i][j]+=f2[i-1][j-a[i]])%=mod;
			(f2[i][j]+=f1[i][j])%=mod;
		}
		ans=(ans+f1[i][s]*(n-i+1)%mod)%mod;
	}
	return printf("%lld",ans),0;
}

Measured memory_bytes: 141184
#include <iostream>
#include <vector>
#include <utility>
#include <string>
#include <algorithm>
#include <numeric>

using namespace std;

int main() {
	int n, min = -1;
	vector<int> v;
	for (;;) {
		cin >> n;
		if (n == 0) break;
		v.resize(n);
		for (int i = 0; i < n; i++) cin >> v[i];

		sort(v.begin(), v.end());

		for (int i = 0; i < n - 1; i++) {
			if (min == -1)min = v[i + 1] - v[i];
			else if (min > v[i + 1] - v[i]) min = v[i + 1] - v[i];
		}
		cout << min << endl;
		min = -1;
	}
}

Measured memory_bytes: 3128
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define ll long long
#define mod 1000000007

const int sz=2e5+5;
ll inf=1e15;

ll par[sz],sze[sz];

int root(int i)
{
    while(i!=par[i])
    {
        par[i]=par[par[i]];
        i=par[i];
    }
 
    return i;
}
 
void unio(int x,int y)
{
    int ra=root(x);
    int rb=root(y);
    // cout<<ra<<" "<<rb<<endl;
    if(ra==rb)
        return ;
    if(sze[ra]<sze[rb])
        swap(ra,rb);
    par[rb]=ra;
    // ll res=size[ra]*size[rb];
    sze[ra]+=sze[rb];
 
    // cout<<res<<endl;
 
    // return res;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t=1;
    // cin>>t;
    while(t--)
    {
        ll n,m;
        cin>>n>>m;
        for(int i=0;i<n+1;i++){
            par[i]=i;
            sze[i]=1;
        }
        for(int i=0;i<m;i++){
            int u,v;
            cin>>u>>v;
            unio(u,v);

        }
        ll res=0;
        for(int i=1;i<=n;i++){
            res=max(res,sze[root(i)]);
        }

        cout<<res;
    }

    return 0;
}

Measured memory_bytes: 6736