akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <utility>
#include <functional>
#include <deque>
#include <cctype>
#include <stack>
#include <bitset>

using ll = long long;
typedef unsigned long long ull;
typedef std::pair<ll, ll>p;
struct edge { int to, cost; };

ll min(ll a, ll b) {
	if (a >= b)return b;
	else return a;
}
ll max(ll a, ll b) {
	if (a >= b)return a;
	else return b;
}
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;
}

const ll Z = 1000000007;
const ll INF = 1 << 30;
const ll INF2 = 9000000000000000000LL;
bool flag = true;
bool fl = true;
bool f = true;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
std::string abc = "abcdefghijklmnopqrstuvwxyz";

int main() {
	std::string s, t = "AKIHABARA";
	std::cin >> s;
	std::stack<char>st;
	if (s.size() >= 10)std::cout << "NO" << std::endl;
	else {
		for (int i = 0;i < s.size();i++) {
			if (s[i] == 'A') {
				st.push(s[i]);
				flag = false;
			}
			else if (s[i] == 'K' || s[i] == 'B' || s[i] == 'R') {
				if (flag)st.push('A'), st.push(s[i]);
				else st.push(s[i]), flag = true;
			}
			else st.push(s[i]), flag = true;
		}
		if (st.top() != 'A')st.push('A');
		if (st.size() != t.size()) {
			std::cout << "NO" << std::endl;
			f = false;
		}
		if (f) {
			for (int i = t.size() - 1;i >= 0;i--) {
				char c = st.top();
				st.pop();
				if (c != t[i]) {
					std::cout << "NO" << std::endl;
					fl = false;
					break;
				}
			}
			if (fl)std::cout << "YES" << std::endl;
		}
	}
	}

Measured memory_bytes: 256
#include<cstdio>
using namespace std;
const int maxn = 100000;
long long b[maxn + 10];
long long w[maxn + 10];
int main()
{
	int n,k;
	long long x;
	scanf("%d%d",&n,&k);
	for(int i = 1;i <= n;++i)
	{
		w[i] += w[i - 1];
		b[i] += b[i - 1];
		scanf("%lld",&x);
		if(x > 0)
			w[i] += x;
		if(x < 0)
			b[i] -= x;
	}
	long long mina = b[k] - b[0];
	if(w[k] - w[0] < mina)
		mina = w[k] - w[0];
	for(int i = 1;i <= n - k;++i)
	{
		long long temp = b[k + i] - b[i];
		if(temp < mina)
			mina = temp;
		temp = w[k + i] - w[i];
		if(temp < mina)
			mina = temp;
	}
	printf("%lld",w[n] - mina);
	return 0;
}

Measured memory_bytes: 1664
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<iomanip>
#include<map>
#include<cmath>
#include<cstdio>
#define rep(i,n) for(int i=0; i<(n); ++i)
using namespace std;
using ll =long long;
using P = pair<int,int>;

int main(){
    ll h,w;
    cin >> h >> w;
    ll ans=(h*w);
    if(h==1 || w == 1){
        cout << 1 << endl;
        return 0;
    }
    if(ans%2==0){
        cout << ans/2 << endl;
        return 0;
    }else
        cout << ans/2+1 << endl;
    return 0;
}

Measured memory_bytes: 256
from math import sqrt,floor

def main():
    n = int(input())
    rn = floor(sqrt(n))
    movestep = 10**12
    for i in range(1, rn + 1):
        if n % i == 0:
            step = i + int(n / i) - 2
            if movestep > step:
                movestep = step
    print(movestep)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include <cmath>
#include <limits>
#include <utility>
#include <map>
#include <iomanip>
#include <queue>
#include <cctype>
#include <stack>
#include <random>
#include <list>
#include <numeric>
#include <chrono>
#include <set>


#define rep(i,p,q) for(ll i = p;i < q;i++)
#define ll long long

using namespace std;

vector<vector<ll>> graph;
vector<ll> query;
vector<ll> ans;
vector<ll> visited;


const long long MAX_N = 1 << 17;
const long long MOD = 1000000007;

long long dat[2 * MAX_N - 1];

ll fact(ll n) {
	if (n == 1) return 1;
	if (n == 0) return 0;
	return n * fact(n - 1);
}

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

//ABC152
/*
//D
int main(void) {
	string n;
	cin >> n;
	if (n.size() == 1) {
		cout << n << endl;
	}
	else {
		ll top = n[0] - '0';
		ll botom = n[n.size() - 1] - '0';

		ll ans = 0;
		rep(i, 1, 10) {
			rep(j, i, 10) {
				ll count = 0;
				if (max(i,j) > top && i != j)continue;
				ll roop = botom == 0 ? n.size() - 1 : n.size();
				rep(k, 0, roop) {
					if (k == n.size() - 1 && ((max(i, j) > top || (max(i, j) == top && min(i, j) > botom)))) continue;
					if (k > 0 && i != j)count += 2;
					else count++;
				}
				if (count == 0)continue;
				ans += count == 1 ? 1 : count * (count - 1);
			}
		}

		cout << ans << endl;
	}
	

}
*/

//C
int main(void) {
	ll n;
	cin >> n;
	vector<ll> p = vector<ll>(n);
	rep(i, 0, n) cin >> p[i];
	vector<ll> m = vector<ll>(n);
	m[0] = p[0];
	rep(i, 1, n) {
		m[i] = min(p[i], m[i - 1]);
	}
	ll ans = 0;
	rep(i, 0, n) ans += m[i] == p[i];
	cout << ans << endl;
}

Measured memory_bytes: 3328
<?php
  list($N, $X) = explode(" ", trim(fgets(STDIN)));
  
  $x = array_map('intval', explode(" ", trim(fgets(STDIN))));

  for ($i=0; $i<$N; $i++) {
    $x[$i] = abs($x[$i]-$X);
  }

  $ans = $x[0];
  for ($i=1; $i<$N; $i++) {
    $ans = gmp_gcd($ans, $x[$i]);
  }

  echo $ans;

Measured memory_bytes: 26724
#include<bits/stdc++.h>
using namespace std;
int slove(int x,int y,int n);
const int BufferSize=1<<16;
char buffer[BufferSize],*head,*tail;
inline char Getchar() {
    if(head==tail) {
        int l=fread(buffer,1,BufferSize,stdin);
        tail=(head=buffer)+l;
    }
    return *head++;
}
inline int read() {
    int x=0,f=1;char c=Getchar();
    for(;!isdigit(c);c=Getchar()) if(c=='-') f=-1;
    for(;isdigit(c);c=Getchar()) x=x*10+c-'0';
    return x*f;
}
int main(void)
{
    int N,Q;
    N=read(),Q=read();
    while(Q)
    {
        Q--;
        int x,y;
        x = read(),y = read();
        if(N==1)
            printf("%d\n",min(x,y));
        else
        printf("%d\n",slove(x,y,N));
    }
    return 0;
}
int slove(int x,int y,int n)
{
    while(x!=y)
    {
        if(x > y)
            x = (x+n-2)/n;
        else
            y = (y+n-2)/n;
    }
    return x;
}



Measured memory_bytes: 1280
#include <iostream>
#include <algorithm>
#include <climits>
#include <vector>
#include <stack>
#include <cmath>
#include <queue>
#include <set>
#include <map>
using namespace std;

int main() {
    long long n;
    cin >> n;
    map<char, long long> m;
    for (long long i = 0; i < n; ++i) {
        string s;
        cin >> s;
        m[s[0]]++;
    }
    string march = "MARCH";
    long long sum = 0;
    for (long long mm = 0; mm < 2; ++mm) {
        for (long long a = 0; a <2 ; ++a) {
            for (long long r = 0; r < 2; ++r) {
                for (long long c = 0; c <2 ; ++c) {
                    for (long long h = 0; h <2 ; ++h) {
                        if(mm + a + r + c + h == 3) {
                            long long xx[5] = {m['M'] * mm, m['A'] * a,
                                          m['R'] * r,
                                          m['C'] * c,
                                          m['H'] * h};
                            sort(xx, xx+5);
                            long long hoge = xx[4] * xx[3] * xx[2];
                            sum += hoge;
                        }

                    }

                }

            }

        }
    }

    cout << sum << endl;

    return 0;
}


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

int main() {
  int n;
  cin >> n;
  int num = 0;
  
  for (int i = 0; i < n; i++) {
    int l, r;
    cin >> l >> r;

    int seat;
    seat = r - l + 1;
    num += seat;
  }
  cout << num << endl;
}

Measured memory_bytes: 256
#pragma region template
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vvvld = vector<vvld>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template <typename T>
using pqrev = priority_queue<T, vector<T>, greater<T>>;
#define rep(i, n) for (ll i = 0, i##_end = (n); i < i##_end; i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for (ll i = (a), i##_end = (b); i < i##_end; i++)
#define reprb(i, a, b) for (ll i = (b)-1, i##_end = (a); i >= i##_end; i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
//*
constexpr ll MOD = 1e9 + 7;
/*/
constexpr ll MOD = 998244353;
//*/
constexpr ll INF = 1e+18;
constexpr ld EPS = 1e-12L;
constexpr ld PI = 3.14159265358979323846L;
constexpr ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
constexpr ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
template <typename S, typename T>
constexpr bool chmax(S &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename S, typename T>
constexpr bool chmin(S &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif
template <typename T>
bool print_(const T &a) {
  cout << a;
  return true;
}
template <typename T>
bool print_(const vector<T> &vec) {
  for (auto &a : vec) {
    cout << a;
    if (&a != &vec.back()) {
      cout << " ";
    }
  }
  return false;
}
template <typename T>
bool print_(const vector<vector<T>> &vv) {
  for (auto &v : vv) {
    for (auto &a : v) {
      cout << a;
      if (&a != &v.back()) {
        cout << " ";
      }
    }
    if (&v != &vv.back()) {
      cout << "\n";
    }
  }
  return false;
}
void print() { cout << "\n"; }
template <typename Head, typename... Tail>
void print(Head &&head, Tail &&... tail) {
  bool f = print_(head);
  if (sizeof...(tail) != 0) {
    cout << (f ? " " : "\n");
  }
  print(forward<Tail>(tail)...);
}
#pragma endregion

void Pr(bool f){
  cout << (f ? "Yes" : "No") << "\n";
  exit(0);
}

ll cnt[100010];

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  ll n;
  cin >> n;
  vll a(n);
  rep(i, n){
    cin >> a[i];
    cnt[a[i]]++;
  }
  ll q;
  cin >> q;
  ll ans = 0;
  rep(i, 100010){
    ans += i*cnt[i];
  }
  while(q--){
    ll b, c;
    cin >> b >> c;
    ll k = cnt[b];
    cnt[c] += k;
    ans += k*c;
    ans -= k*b;
    cnt[b] = 0;
  print(ans);
  }
}


Measured memory_bytes: 4820
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int x = sc.nextInt();

        if(a > x || a+b < x){
            System.out.println("NO");
        }else if(a+b >= x){
            System.out.println("YES");
        }
    }
}

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

int main(){
	
	int n,m;
	cin >> n >> m;
	string s;
	cin >> s;
	
	string cc = "";
	rep(i,m) cc += "1";
	
	if(s.find(cc) != std::string::npos){
		cout << -1 << endl;
		return 0;
	}
	
	reverse(s.begin(), s.end());
	
	vector<int> res;
	int p = 0;
	while(p < n){
		int up = m;
		while(true){
			if(p+up < n+1 && s[p+up] == '0'){
				res.push_back(up);
				p += up;
				break;
			}
			else{
				up--;
			}
		}
	}
	
	reverse(res.begin(), res.end());
	rep(i,res.size()) cout << res[i] << " ";
	return 0;
}

Measured memory_bytes: 1144
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
//#define at(x,i) get<i>(x);//
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main(){
    ll n,k;cin >> n >>k;
    vl v(n);
    rep(i,n)cin >> v[i];
    vl m(n);
    ll tmp=0;
    per(i,n){
        chmax(tmp,v[i]);
        m[i]=tmp;
    }
    vl mini(n);
    rep(i,n)mini[i]=m[i]-v[i];
    tmp=0;
    ll cnt=0;
    rep(i,n)chmax(tmp,mini[i]);
    rep(i,n)if(tmp==mini[i])cnt++;
    cout <<cnt <<endl;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1001001001
#define LINF 1001001001001001001
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

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

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

  vector<ll> S(N + 1, 0);
  for (int i = 1; i <= N; i++) S[i] = S[i - 1] + A[i];

  ll ans = LINF;
  for (int i = 1; i <= N; i++) {
    if (i == 1 || i == N - 1 || i == N) continue;
    ll PQ = S[i] - S[0];
    ll RS = S[N] - S[i];

    ll maximum = -1, maximum2 = -1;
    ll minimum = LINF, minimum2 = LINF;
    decltype(S)::iterator it;

    it = lower_bound(S.begin(), S.begin() + i + 1, PQ / 2);
    maximum = max(maximum, max(S[i] - *it, *it - S[0]));
    minimum = min(minimum, min(S[i] - *it, *it - S[0]));
    it--;
    maximum = min(maximum, max(S[i] - *it, *it - S[0]));
    minimum = max(minimum, min(S[i] - *it, *it - S[0]));

    it = lower_bound(S.begin() + i + 2, S.end(), RS / 2 + PQ);
    maximum2 = max(maximum2, max(S[N] - *it, *it - S[i]));
    minimum2 = min(minimum2, min(S[N] - *it, *it - S[i]));
    it--;
    maximum2 = min(maximum2, max(S[N] - *it, *it - S[i]));
    minimum2 = max(minimum2, min(S[N] - *it, *it - S[i]));
    
    ans = min(ans, max(maximum, maximum2) - min(minimum, minimum2));
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 6428
import sys
n = int(input())
a = list(map(int,input().split()))
'''
for num in a:
  i = a.index(num)
  if(num in a[i+1:]):
    print("NO")
    sys.exit()
print("YES")
'''

i=0
a.sort()
while(i<n-1):
  if(a[i] == a[i+1]):
    print("NO")
    sys.exit()
  i += 1
print("YES")

Measured memory_bytes: 26808
N,Y = map(int,input().split())

res = [-1] * 3
for x in range(N + 1):
	for y in range(N + 1):
		if x + y > N:
			break
		z = N - x - y
		if 10000 * x + 5000 * y + 1000 * z == Y:
			res[0], res[1], res[2] = x, y, z
			break

print(" ".join(map(str,res)))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e18
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;

int a[310][310];
signed main()
{
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            cin >> a[i][j];
            a[i][j]--;
        }
    }
    vector<int> hold(m, true);
    int ans = INF;
    for (int i = 0; i < m; i++)
    {
        vector<int> v(m, 0);
        for (int j = 0; j < n; j++)
        {
            for (int k = 0; k < m; k++)
            {
                if(hold[a[j][k]]){
                    v[a[j][k]]++;
                    break;
                }
            }
        }
        int tmp = 0;
        int id;
        for (int i = 0; i < m; i++)
        {
            if(tmp<v[i]){
                tmp = v[i];
                id = i;
            }
        }
        chmin(ans, tmp);
      //  cerr << tmp << endl;
       // show(hold);
       // show(v);
        hold[id] = false;
    }
    cout << ans << endl;

    return 0;
}

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

int n;
string s;

void solve(){
  cin >> n >> s;
  int maxa = 0;
  for(int i = 1; i < s.length(); i++){
    vector<int> l(26, 0), ans(26, 0);
    for(int j = 0; j < i; j++){
      l[s[j] - 'a'] = 1;
    }
    for(int j = i; j < s.length(); j++){
      if(l[s[j] - 'a'] == 1) ans[s[j] - 'a'] = 1;
    }
    int a = 0;
    for(int j = 0; j < ans.size(); j++){
      if(ans[j] == 1) a++;
    }
    maxa = max(a, maxa);
  }
  cout << maxa << endl;
  return;
}
int main(){
  solve();
  return 0;
}


Measured memory_bytes: 256
/**
 * Created by hiramekun at 20:52 on 2019-08-24.
 */

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
template<typename T> using pq = priority_queue<T>;
template<typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template<typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll inf = ll(1e9);
const ll mod = inf + 7;
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define each(i, mp) for(auto& i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template<class T>
ostream &operator<<(ostream &out, const vector<T> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << ' ';
    return out;
}


template<class T>
istream &operator>>(istream &in, vector<T> &list) {
    ll n = list.size();
    rep(i, n) in >> list[i];
    return in;
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

void solve() {
    ll n, k;
    cin >> n >> k;
    vl a(n);
    rep(i, n) cin >> a[i];

    vl inis(n);
    rep(i, n - 1) {
        for (ll j = i + 1; j < n; ++j) {
            if (a[i] > a[j]) inis[i]++;
        }
    }
    vl vals(n);
    rep(i, n) {
        rep(j, n) {
            if (a[i] > a[j]) vals[i]++;
        }
    }
    ll ans = 0;
    rep(i, n) {
        ans += inis[i] * k % mod;
        ans += (vals[i] * (((k * (k - 1)) % mod * modinv(2, mod)) % mod)) % mod;
        ans %= mod;
    }

    cout << ans << '\n';

}

int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
        solve();
#ifdef MY_DEBUG
    }
#endif
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
const ll mod=1e9+7;

int main(){
	int A,B;
	cin >> A >> B;

	int ans;
	if((B-1)%(A-1)==0){
		ans=(B-1)/(A-1);
	}else{
		ans=(B-1)/(A-1)+1;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,popcnt,abm,mmx,avx")
// #pragma comment(linker, "/stack:200000000"]
 
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <bitset>
#include <stack>
#include <random>
#include <fstream>
#include <sstream>
#include <chrono>

#define fi first
#define se second
#define pb push_back
#define ll long long
#define ld long double
#define hm unordered_map 
#define pii pair<int, int>
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define cinv(v) for (auto& x: v) cin >> x
#define fr(i, n) for (int i = 0; i < n; ++i)
#define fl(i, l, n) for (int i = l; i < n; ++i)

#define int ll

using namespace std;

#ifdef __LOCAL
	#define dbg(x) cerr << #x << " : " << x << '\n'
	const int maxn = 20;
#else 
	#define dbg(x)
	const int maxn = 1e5 + 20;
#endif

//tg: @galebickosikasa
 
ostream& operator << (ostream& out, vector<int>& v) {
	for (auto& x: v) out << x << ' ';
	return out;
}

ostream& operator << (ostream& out, pii& v) {
	out << v.fi << ", " << v.se;
	return out;
}

istream& operator >> (istream& in, pii& a) {
	in >> a.fi >> a.se;
	return in;
}

const ll inf = (ll) 2e9;
const ld pi = asin (1) * 2;
const ld eps = 1e-8;
const ll mod = (ll)1e9 + 7;
const ll ns = 97;
const int maxlog = 20;

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

int dp[maxn][maxlog];

int get (int a, int b) {
	if (a > b) swap (a, b);
	int ans = 0;
	for (int i = maxlog - 1; i >= 0; --i) {
		// dbg (dp[a][i]);
		if (dp[a][i] < b) {
			ans += (1<<i);
			a = dp[a][i];
		}
	}
	return ans + 1;
}

signed main () {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int n;
	cin >> n;
	vector<int> goo (n);
	cinv (goo);
	int L;
	cin >> L;
	fr (i, n) {
		int x = goo[i];
		auto it = upper_bound (all (goo), x + L) - goo.begin () - 1;
		dp[i][0] = it;
		dbg (i);
		dbg (it);
	}
	dp[n - 1][0] = n - 1;
	for (int i = n - 1; i >= 0; --i) {
		fl (j, 1, maxlog) {
			dp[i][j] = dp[dp[i][j - 1]][j - 1];
		}
	}
	int q;
	cin >> q;
	fr (i, q) {
		int a, b;
		cin >> a >> b;
		--a, --b;
		cout << get (a, b) << '\n';
	}






}

Measured memory_bytes: 19580
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:https://atcoder.jp/contests/code-festival-2016-qualb/tasks/codefestival_2016_qualB_d>
 問題文============================================================
 D - Greedy customers
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    int N; cin >> N;
    vector<ll> A(N); for(auto& in:A) cin >> in;
    
    res += A[0]-1;
    A[0] = 1;
    ll maxv = 1;
    for(int i = 1; i < N; i++){
        if(A[i] == maxv + 1){
            maxv++;
            continue;
        }
        if(A[i] <= maxv) continue;
        ll D = A[i] - (maxv+1);
        ll cnt = D/(maxv + 1);
        res += cnt;
        
        A[i] -= D/(maxv + 1)*(maxv + 1);
        D -= D/(maxv + 1)*(maxv + 1);
        
        if(D){
            res++;
        }
    }
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <string>
#include <utility>
#include <queue>
#include <unordered_set>
#include <set>
#include <unordered_map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <fstream>
using namespace std;
#define sL(i) i << 1
#define sR(i) i << 1 | 1
#define mp make_pair
#define pb push_back
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pair<int,int>, int> ppi;
const int MOD = 1e9 + 7;
const int INF = 2e9 + 5;

int T;
ll A, B, C, D;

ll gcd(ll x, ll y){
    if (y == 0) return x;
    return gcd(y, x % y);
}

int main(){
    cin.sync_with_stdio(0);
    cin.tie(0);
    // ofstream cout("out2.txt");
    cin >> T;
    while (T--) {
        cin >> A >> B >> C >> D;
        if (A < B) {cout << "No\n"; continue;}
        if (B > D) {cout << "No\n"; continue;}
        if (C >= B - 1) {cout << "Yes\n"; continue;}
        if (D % B != 0) {
            ll d = D % B;
            ll common = gcd(d, B);
            if (B - C - 1 >= common) {
                cout << "No\n"; 
            } else {
                cout << "Yes\n";
            }
            continue;
        }
        ll a = A % B;
        if (a > C) cout << "No\n";
        else cout << "Yes\n";
    }
}

Measured memory_bytes: 384
#include <stdio.h>
#define swap(type, x, y)  do{ type t = x; x = y; y = t; } while(0)

void quick(int array[], int left, int right){
  int pl = left, pr = right, x = array[(left + right) / 2];
  do{
    while(array[pl] < x)  pl++;
    while(array[pr] > x)  pr--;
    if(pl <= pr){
      swap(int, array[pl], array[pr]);
      pl++, pr--;
    }
  }while(pl <= pr);
  if(pl < right) quick(array, pl, right);
  if(pr > left)  quick(array, left, pr);
}

int main(){
  int n;  scanf("%d", &n);
  int a[200005] = {0};
  for(int i=1; i<=n; i++)  scanf("%d", a+i);

  quick(a, 1, n);

  int ans = 0;

  if(a[1] == 1){
    if(a[2] != 1)  ans = 1;
    printf("%d\n", ans);
    return 0;
  }

  int isNo[1000006] = {0};

  for(int i=1; i<=n; i++){
    if(a[i-1]==a[i] || a[i]==a[i+1]){ isNo[a[i]] = 1;  continue; }
    int soin[120] = {0}, ai = a[i];
    for(int s=2; s*s<=ai; s++)
      while(ai%s == 0){
	soin[++soin[0]] = s;
	ai /= s;
      }
    if(ai != 1)  soin[++soin[0]] = ai;
    int isOk = 1;
    for(int bit=1; bit<(1<<soin[0]); bit++){
      int yaku = 1;
      for(int j=1; j<=soin[0]; j++)
	if(bit & (1<<(j-1)))
	  yaku *= soin[j];
      if(isNo[yaku]){
	isOk = 0;
	break;
      }
    }
    if(isOk)  ans++;
    isNo[a[i]] = 1;
  }

  printf("%d\n", ans);
  
  return 0;
}


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


int main() {
	int N;
	cin >> N;
	vector<int> a(N);
	
	string ans = "Yes";
	rep(i,N){
		cin >> a[i];
	}
	
	for(int i = N-1; i >= 1; i--){
		if(a[i-1] <= a[i]){
			// 何もしない
		}
		else if(a[i-1] == a[i] + 1){
			a[i-1]--;
		}
		else{
			ans = "No";
			break;
		}
	}
	
	
	cout << ans << endl;
  
}


Measured memory_bytes: 640
n = $stdin.readline.to_i
a = $stdin.readline.chomp.split.map(&:to_i)
m = 10 ** 6
d = Array.new(m + 1)

2.step(m) do |i|
  next if !d[i].nil?
  
  d[i] = i
  (m / i).times do |j|
    k = (j + 1) * i
    next if !d[k].nil?
    d[k] = i
  end
end

g = a[0]
pc = true
h = Hash.new(false)
n.times do |i|
  g = g.gcd(a[i])
  x = a[i]
  q = []
  while pc && x > 1
    if h[d[x]]
      pc = false
      break
    end

    q << d[x]
    x /= d[x]
  end

  q.uniq.each do |y|
    h[y] = true
  end
end

if pc
  puts "pairwise coprime"
elsif g == 1
  puts "setwise coprime"
else
  puts "not coprime"
end

Measured memory_bytes: 123020
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>
#include <list>

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

vector<int> ans;
vector<vector<pair<int, int>>> g;

void dfs(int now, int col, int p)
{
	int can = 1;
	//set<int> used;
	//used.insert(col);
	for (auto x : g[now])
	{
		if (x.first == p)continue;
		//while (used.count(can))++can;
		if (col == can)++can;
		ans[x.second] = can;
		dfs(x.first, can, now);
		++can;
	}
}

int main()
{
	int n; cin >> n;
	ans.resize(n - 1);
	g.resize(n);
	rep(i, 0, n - 2)
	{
		int a, b; cin >> a >> b;
		--a, --b;
		g[a].push_back({ b,i });
		g[b].push_back({ a,i });
	}
	dfs(0, 0, 0);
	int cnt = 0;
	for (auto x : g)cnt = max(cnt, (int)x.size());
	cout << cnt << endl;
	for (int x : ans)cout << x << endl;
}


Measured memory_bytes: 8320
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

int main()
{
	string s;
	int sum = 700;

	cin >> s;

	for (int i = 0; i < 3; i++) {
		if (s[i] =='o')
			sum += 100;
	}

	cout << sum << endl;


	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define sayyes cout<<"Yes"<<endl;
#define sayno cout<<"No"<<endl;
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
const int mod =1e9+7;

int main()
{
    string s;
    cin>>s;
    int n=s.length();
    int border=n-1;
    reverse(s.begin(),s.end());
    ll ans=0;
    rep(i,n)
    {
        if(s[i]=='B')
        {
            ans+=border-(n-i-1);
            border--;
        }

    }
    cout<<ans;
}


Measured memory_bytes: 640
import math

A, B, H, M = map(int, input().split())

H_degree = H / 12 + (1 / 12) * (M / 60)
M_degree = M / 60

# print(H_degree, M_degree)

triangle_degree = abs(H_degree - M_degree)

# import ipdb; ipdb.set_trace()
C = (A**2 + B**2 - 2 * A * B * math.cos(triangle_degree * 2 * math.pi)) ** (1/2)
print(C)


Measured memory_bytes: 9556
n=int(input())
a=list(map(int,input().split()))
a.append(0)
bbefore=0
before=a.pop(0)
s=abs(before-bbefore)
lst=[]
for i in a:
   s+=abs(i-before)
   lst.append(abs(i-before)+abs(before-bbefore)-abs(i-bbefore))
   bbefore=before
   before=i
for i in lst:
   print(s-i)

Measured memory_bytes: 13920
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
#define REP(i, x, y) for(ll i = x; i < y; i++)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-11;

ll nums[60];
ll p[60];

ll solve(int lev, ll num) {
    if (lev == 0) {
        if (num == 1) {
            return 1;
        } else {
            return 0;
        }
    } else {
        if (num == 1) {
            return 0;
        } else if (num <= nums[lev - 1] + 1) {
            return solve(lev - 1, num - 1);
        } else if (num == nums[lev - 1] + 2) {
            return p[lev - 1] + 1;
        } else if (num <= nums[lev - 1] * 2 + 2) {
            return solve(lev - 1, num - (nums[lev - 1] + 2)) + p[lev - 1] + 1;
        } else {
            return p[lev - 1] * 2 + 1;
        }
    }
}

int main() {
    ll N, X;
    cin >> N >> X;
    nums[0] = 1;
    p[0] = 1;
    REP(i, 1, 55) {
        nums[i] = nums[i - 1] * 2 + 3;
        p[i] = p[i - 1] * 2 + 1;
    }
    ll ans = solve(N, X);
    cout << ans << endl;
}


Measured memory_bytes: 256
from collections import defaultdict
import heapq

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parent = [i for i in range(n)]
        self.rank = [0 for i in range(n)]

    def getParent(self):
        return [self.find(i) for i in range(N)]

    def find(self, x):
        if self.parent[x] == x:
            return x
        else:
            self.parent[x] = self.find(self.parent[x])
            return self.parent[x]

    def unite(self, x, y):
        root_x = self.find(x)
        root_y = self.find(y)
        if (root_x == root_y):
            return
        elif self.rank[root_x] > self.rank[root_y]:
            self.parent[root_y] = root_x

        elif self.rank[root_y] > self.rank[root_x]:
            self.parent[root_x] = root_y

        else:
            self.parent[root_x] = root_y
            self.rank[root_y] += 1

    def isSame(self, x, y):
        return self.find(x) == self.find(y)

    def memsInGroup(self, x):
        """
        O(N)かかります
        """
        root = self.find(x)
        return [i for i in range(N) if root == self.find(i)]

    def sizeOfGroup(self, x):
        return len(self.memsInGroup(x))

class Edge:

    def __init__(self, u, v, cost):
        self.u = u
        self.v = v
        self.cost = cost

N = int(input())
vertex = {}
for i in range(N):
    x, y = map(int, input().split())
    vertex[i] = (x, y)

sortX = sorted(vertex.items(), key=lambda x:x[1][0])
sortY = sorted(vertex.items(), key=lambda x:x[1][1])

edges = []

for i in range(N-1):
    v1 = sortX[i]
    v2 = sortX[i+1]
    edges.append(Edge(v1[0]-1, v2[0]-1, abs(v1[1][0] - v2[1][0])))

for i in range(N-1):
    v1 = sortY[i]
    v2 = sortY[i+1]
    edges.append( Edge(v1[0]-1, v2[0]-1, abs(v1[1][1] - v2[1][1]) ) )

edges.sort(key = lambda x: x.cost)
uf = UnionFind(N)

res = 0
for e in edges:
    if not uf.isSame(e.u, e.v):
        uf.unite(e.u, e.v)
        res += e.cost

print(res)


Measured memory_bytes: 149008
Uses math;
var n, i, t : integer;
    w : array[1..100] of integer;
    s1, s2, ans : integer;
begin
  readln(n);
  for i := 1 to n do read(w[i]);
  ans := 10000;
  for t := 1 to n - 1 do begin
    s1 := 0;  s2 := 0;
    for i := 1 to t do s1 := s1 + w[i];
    for i := t + 1 to n do s2 := s2 + w[i];
    ans := Min(ans, Abs(s1 - s2));
  end;
  writeln(ans);
end.

Measured memory_bytes: 128
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

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

func getString() string {
	sc.Scan()
	return sc.Text()
}

// Link :
type Link struct {
	id int
	to int
}

// Node :
type Node struct {
	link []Link
}

var node []Node
var route []int = make([]int, 0)

// DFS :
func DFS(from, to, prev int) bool {
	if from == to {
		return true
	}
	for _, v := range node[from].link {
		if v.to == prev {
			continue
		}
		if DFS(v.to, to, from) {
			route = append(route, v.id)
			return true
		}
	}
	return false
}

func main() {
	sc.Split(bufio.ScanWords)
	N := getInt()
	node = make([]Node, N)
	for i := 0; i < N-1; i++ {
		a := getInt() - 1
		b := getInt() - 1
		node[a].link = append(node[a].link, Link{i, b})
		node[b].link = append(node[b].link, Link{i, a})
	}

	M := getInt()
	u := make([]int, M)
	v := make([]int, M)
	for i := 0; i < M; i++ {
		u[i] = getInt() - 1
		v[i] = getInt() - 1
	}

	//out(node)
	//out(u, v)
	//out("start")

	x := make([][]int, M)
	for i := 0; i < M; i++ {
		route = make([]int, 0)
		DFS(u[i], v[i], -1)
		//out("from", u[i], "to", v[i], "route", route)
		x[i] = make([]int, N-1)
		for _, v := range route {
			x[i][v] = 1
		}
	}

	//out(x)

	bits := make([]int, M)
	for i := 0; i < M; i++ {
		for j := 0; j < N-1; j++ {
			bits[i] <<= 1
			if x[i][j] == 1 {
				bits[i] |= 1
			}
		}
		//		fmt.Printf("%b\n", bits[i])
	}

	//	out("-----")
	ans := 1 << uint(N-1)
	n := 1 << uint(M)
	for i := 1; i < n; i++ {
		l := 0
		idx := 0
		cnt := 0
		for j := i; j != 0; j >>= 1 {
			if j%2 == 1 {
				l |= bits[idx]
				cnt++
			}
			idx++
		}
		//		fmt.Printf("bits %d = %b cnt %d\n", i, l, cnt)
		flg := 0
		for j := l; j != 0; j >>= 1 {
			if j%2 == 1 {
				flg++
			}
		}
		flg = N - 1 - flg
		//		out(flg)
		if cnt%2 == 1 {
			ans -= 1 << uint(flg)
		} else {
			ans += 1 << uint(flg)
		}
	}
	out(ans)
}


Measured memory_bytes: 640
#include <stdio.h>
int n, x;
char s[200001];
char t[200001];
int main() {
	scanf(" %s", s);
	scanf(" %s", t);
	while (s[n] != NULL) {
		if (s[n] != t[n])x++;
		n++;
	}
	printf("%d\n", x);
}

Measured memory_bytes: 2124
#include <iostream>
#include <algorithm>

using namespace std;

typedef long long int lli;

struct P{
	int t;
	int s;
	lli d;
};

bool comp(const P& a, const P& b)
{
	return a.t < b.t;
}

int main()
{
	int n, m, c;
	P a[20001];
	bool af[20001];
	
	while(cin>>n>>m && (n+m)){
		for(int i = 0; i < m; i++){
			cin >> a[i].t >> a[i].s >> a[i].d;
		}
		c = 0;
		fill(af, af+(n+1), false);
		sort(a, a+m, comp);
		af[1] = true;
		
		for(int i = 0; i < m; i++){
			af[a[i].d] = (af[a[i].s]|af[a[i].d]);
		}
		
		for(int i = 1; i <= n; i++){
			if(af[i]){
				c++;
			}
		}
		
		cout << c << endl;
	}

	return 0;
}

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

int top, front, a;

void dice(string str);

int main(void)
{
	int n;
	while (scanf("%d", &n), n){
		string str;
		int res = 1;
		top = 1;
		front = 2;
		a = 3;
		for (int i = 0; i < n; i++){
			cin >> str;
			dice(str);
			res += top;
		}
		printf("%d\n", res);
	}
	
	return 0;
}

void dice(string str)
{
	int tmp;
	if (str == "North"){
		tmp = top;
		top = front;
		front = 7 - tmp;
	}
	if (str == "East"){
		tmp = a;
		a = top;
		top = 7 - tmp;
	}
	if (str == "West"){
		tmp = top;
		top = a;
		a = 7 - tmp;
	}
	if (str == "South"){
		tmp = front;
		front = top;
		top = 7 - tmp;
	}
	if (str == "Right"){
		tmp = front;
		front = a;
		a = 7 - tmp;
	}
	if (str == "Left"){
		tmp = a;
		a = front;
		front = 7 - tmp;
	}
}

Measured memory_bytes: 0
#include <iostream>
#include <numeric>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)






int main() {
	int s;
	cin >> s;
	string k = "NO";
	if (s == 3 || s == 5 || s == 7) {
		k = "YES";
	}
	cout <<k<< endl;
}


Measured memory_bytes: 256
using System;

class Program {
    private static int Main() {
        var input = Console.ReadLine();
        var values = input.Split( ' ' );

        var x1 = double.Parse( values[ 0 ] );
        var y1 = double.Parse( values[ 1 ] );
        var x2 = double.Parse( values[ 2 ] );
        var y2 = double.Parse( values[ 3 ] );

        var d = Math.Sqrt( Math.Pow( x1 - x2, 2 ) + Math.Pow( y1 - y2, 2 ) );
        Console.WriteLine( d );

        return 0;
    }
}

Measured memory_bytes: 20032
#include <stdio.h>

int main(void){
    int map[100][100],i,j,t,w,h,sign;
    char line[101];
    scanf("%d %d",&h,&w);
    for(i=0;t=0,sign=0,i<h;i++){
        scanf("%s",line);
        for(j=0;j<w;j++){
            if(line[j]=='.' && sign==0)
                printf("-1%s",j==w-1?"":" ");
            if(line[j] == 'c'){
                t=0;
                sign=1;
                printf("%d%s",t++,j==w-1?"":" ");
            }
            else if(sign != 0)
                printf("%d%s",t++,j==w-1?"":" ");
        }
        printf("\n");
    }
    return 0;
}

Measured memory_bytes: 604
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t,n,k,ba=1;
    cin>>n>>k;
    for(int t=1;;t++)
    {
    	ba=ba*k;
		if(ba>n)
		{
            cout<<t;
            return 0;
		}
    }
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <vector>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iostream>

typedef long long ll;
typedef long long int lli;

#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)

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

using namespace std;

// gcd
int gcd(int a, int b){
    if(a==0)
        return b;
    return gcd(b%a,a);
}
// gcd array
int findGCD(int arr[], int n){
    int result = arr[0];
    for (int i=1; i < n; i++)
        result = gcd(arr[i], result);

    return result;
}

// sort big to small
// sort(A,A+N, greater<int>());

int main() {
    char N[100];
    int a=0;
    scanf("%s", N);
    for(int i=0; i<4; i++){
        a = 10*a + (N[i]-'0');
    }
    for(int i=5; i<7; i++){
        a = 10*a + (N[i]-'0');
    }
    for(int i=8; i<10; i++){
        a = 10*a + (N[i]-'0');
    }

    if(a<=20190430){
        cout << "Heisei" << endl;
    }else{
        cout << "TBD" << endl;
    }
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <bitset>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <queue>

#define mp make_pair
#define pb push_back


typedef long long ll;
typedef long double ld;

using namespace std;
const int MX = 1000000;
const ll MOD = 1e9 + 7;
ll pw3[MX];
ll fc[MX];
ll bfc[MX];
ll dp[MX];
ll dp1[MX];

ll pw(ll a, ll b) {
	ll ans = 1;
	while (b) {
		while (!(b & 1))
			b >>= 1, a = (a * a) % MOD;
		ans = (ans * a) % MOD, --b;
	}
	return ans;
}

void init() {
	pw3[0] = 1;
	for (int i = 1; i < MX; ++i)
		pw3[i] = (pw3[i - 1] * 3) % MOD;
	fc[0] = 1;
	for (int i = 1; i < MX; ++i)
		fc[i] = (fc[i - 1] * i) % MOD;
	for (int i = 0; i < MX; ++i)
		bfc[i] = pw(fc[i], MOD - 2);
}

ll cnk(ll n, ll k) {
	if (k > n)
		return 0;
	return fc[n] * bfc[k] % MOD * bfc[n - k] % MOD;
}

int n, m, k;

int main() {
	scanf("%d%d%d", &n, &m, &k);
	init();
	dp1[0] = 1;
	for (int i = 1; i <= m + k; ++i)
		dp1[i] = (dp1[i - 1] * 2) % MOD;
	for (int i = 1; i <= m + k; ++i)
		dp[i] = (dp[i - 1] * 2 + cnk(i - 1, m) + cnk(i - 1, k)) % MOD;
	for (int i = 0; i <= m + k; ++i)
		dp1[i] = (dp1[i] - dp[i] + MOD) % MOD;
	ll ans = 0;
	for (int i = 0; i <= m + k; ++i) {
		ans += dp1[i] * pw3[m + k - i] % MOD * cnk(i + n - 1, n - 1) % MOD;
		ans %= MOD;
	}
	cout << ans << "\n";
	return 0;
}




Measured memory_bytes: 33024
#include<stdio.h>
int main(void){
    int N, A[200], ans, flag, i;
    ans = 0;
    scanf("%d", &N);
    for(i = 0; i < N; i++){
        scanf("%d", &A[i]);
    }
    flag = 0;
    while(flag == 0){
        for(i = 0; i < N; i++){
            if(A[i] % 2 == 1){
                flag = 1;
                break;
            }
        }
        if(flag == 0){
            ans++;
            for(i = 0; i < N; i++) A[i] /= 2;
        }
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <algorithm>
#include <deque>
using namespace std;

#define INF 1e18
#define int long long

signed main() {
    int n; cin >> n;
    int ans = 0;
    for(int i = 0; i < n; i++) {
        int a; cin >> a;
        ans += a;
    }

    cout << ans - n << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rREP(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    int ary[n];
    rep(i,n) {
        int tmpx;
        cin >> tmpx;
        --tmpx;
        ary[i] = tmpx;
    }
    int now_at = 0;
    int flag = 0;
    rep(i,n)
    {
        if (now_at == 1) {
            flag = i;
            break;
        }
        now_at = ary[now_at];
    }
    if (flag!=0)
    {
        cout << flag << endl;
    }
    else
    {
        cout << -1 << endl;
    }
    
}


Measured memory_bytes: 640
import numpy as np
n = int(input())
a = np.zeros(n, dtype=int)
buf = input().split()
for i in range(n):
	a[i] = int(buf[i])

gamma = np.argmax(a)
alpha = a[gamma]
a[gamma] = -1
bata = a[np.argmin(np.abs(a-alpha/2))]
print(alpha, bata)

Measured memory_bytes: 21448
n,k=map(int,input().split())
ans=0
for i in range(1,n+1):
    if i>=k:
        ans+=1/n
    else:
        y=1
        while True:
            x=i*2**y
            if x<k:
                y+=1
            else:
                break
        ans+=1/n*(1/2)**y
print(ans)

Measured memory_bytes: 3060