akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <iomanip>
#include <algorithm>
#include <sstream>
#include <string>
#include <math.h>
#include <set>
using namespace std;
typedef long long ll;
 
int main() {
	int n , a[100001] , b[100001] = {} , x = 0 , y = 0;
	cin >> n;
	for (int i=0;i<n;i++) cin >> a[i];
	for (int i=0;i<n;i++) b[a[i]]++;
	for (int i=0;i<=100000;i++) {
		if (b[i]) {
			if (b[i]%2) x++;
			else y++;
		}
	}
	if (y%2) cout << x + y - 1;
	else cout << x + y;
}

Measured memory_bytes: 1024
#include<stdio.h>

int main(void)
{
  int W,H,N,x,y,a;
  int ansx = 0,ansy = 0;
  scanf("%d%d%d",&W,&H,&N);
  
  for(int i = 0;i < N;i++)
  {
    scanf("%d%d%d",&x,&y,&a);
    switch(a)
    {
      case 1:
        if(ansx < x){ansx = x;}
        break;
      case 2:
        if(x < W){W = x;}
        break;
      case 3:
        if(ansy < y){ansy = y;}
        break;
      case 4:
        if(y < H){H = y;}
        break;
    }
  }
  
  if(W <= ansx || H <= ansy){printf("0");}
  else{printf("%d",(W - ansx) * (H - ansy));}
  
  return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
bool setMap();
void search(int x,int y);
int map[12][12];
int w=12;
int h=12;


int main(void)
{
	while(setMap()){
	}
}

bool setMap(){
	char t;
	int count=0;
	int r;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			
			r=scanf(" %c ",&t);
			if(r<1){
				return false;
			}
			
			map[i][j]=t-'0';
		}
	}
	
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if(map[i][j]==1){
				search(j,i);
				count++;
			}
		}
	}
	printf("%d\n",count);
	return true;
}


void search(int x,int y){
	if(w>x && x>=0 && h>y && y>=0 && map[y][x]==1){
		map[y][x]=0;
		search(x+1,y);
		search(x-1,y);
		search(x,y+1);
		search(x,y-1);
	}
}

Measured memory_bytes: 0
#include <cmath>
#include <cstdio>
#include <cstring>
#include <algorithm>
using std::min; using std::max;
using std::swap; using std::sort;
using std::upper_bound;
typedef long long ll;

template<typename T>
void read(T &x) {
	int flag = 1; x = 0; char ch = getchar();
	while(ch < '0' || ch > '9') { if(ch == '-') flag = -flag; ch = getchar(); }
	while(ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
	x *= flag;
}

const int _ = 1e5 + 10, __ = 18;
int n, m, q, x[_], fa[__][_], Log[_], pw[_];

int main () {
	read(n), Log[0] = -1, pw[0] = 1;
	for(int i = 1; i <= n; ++i) read(x[i]);
	read(m), read(q);
	for(int i = 1; i <= n; ++i)
		Log[i] = Log[i >> 1] + 1, pw[i] = min(_, pw[i - 1] * 2);
	for(int i = 1; i <= n; ++i)
		fa[0][i] = upper_bound(x + 1, x + n + 1, x[i] + m) - x - 1;
	for(int i = 1; i <= Log[n]; ++i)
		for(int j = 1; j <= n; ++j)
			fa[i][j] = fa[i - 1][fa[i - 1][j]];
	for(int i = 1; i <= q; ++i) {
		int x, y; read(x), read(y);
		if(x > y) swap(x, y);
		if(x == y) { printf("%d\n", 0); continue; }
		int now = x, ret = 0;
		for(int j = Log[n]; j >= 0; --j)
			if(fa[j][now] < y) ret += pw[j], now = fa[j][now];
		printf("%d\n", ret + 1);
	}
	return 0;
} 


Measured memory_bytes: 8960
l = [111,222,333,444,555,666,777,888,999]
x = int(input())
ans = 0
for i in range(len(l)):
    if x == l[-1]:
        ans = l[-1]
        break
    elif x <= 111:
        ans = 111
        break
    elif l[i] == x:
        ans = l[i]
        break
    elif l[i] < x <= l[i+1]:
        ans = l[i+1]
        break
        
print(ans)

Measured memory_bytes: 3064
#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 FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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 (a>b) { a=b; return 1; } return 0; }



int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(25);

  int n, m;
  cin >> n >> m;
  map<int, int> c;
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    c[a]++, c[b]++;
  }

  rep(i, n + 1) {
    if (c[i] & 1) {
      cout << "NO\n";
      return 0;
    }
  }
  cout << "YES\n";




  
  return 0;
}

Measured memory_bytes: 4992
#include "bits/stdc++.h"
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

#ifndef _DEBUG
#define main_ main
#endif
#define FOR(i,s,e) for (int i = int(s); i != int(e); i++)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)

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

template <typename T>
using keyVal = pair<string, T>;
template<typename T>
bool val_greater(const keyVal<T>& left, const keyVal<T>& right) {
	return left.second > right.second;
}

void init_global() {}

int main_() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	ll N;  cin >> N;
	ll ans = INF;
	for (ll i = 1; i*i <= N; ++i) {
		if (N%i == 0) {
			ll b = N / i;
			ll d = to_string(b).size();
			ans = min(ans, d);
		}
	}

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


Measured memory_bytes: 256
function Main(input) {
  input.trim();
  input = input.split(" ").map(Number);
  if(input[0]==input[1]){

    console.log("Yes")
  }else{
    console.log("No")
  }
}Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());
function arr1dto2d (arr){
	for(var i=0;i<arr.length;i++){
    arr[i]=arr[i].split(" ").map(Number);
    }
  return arr;
}


Measured memory_bytes: 22964
import java.util.*;

public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int ab = b + a * (int)Math.pow(10,((int)Math.log10(b) + 1));
    int check =0;
    for (int i=1; i<400; i++) {
      if(i * i == ab) {
        check++; 
        break;
      }
    }
    if (check != 0) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
}

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

struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

int res[100005];

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

  for (int i = 0; i < n; i++) {
    int tmp;
    cin >> tmp;

    res[tmp]++;
    res[tmp + 1]++;
    res[tmp - 1]++;
  }

  int max = -100;
  for (int i = 0; i < 100005; i++) {
    if (max < res[i]) {
      max = res[i];
    }
  }

  cout << max << endl;

  return (0);
}


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


    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ');
            int L = int.Parse(input[0]);
            int R = int.Parse(input[1]);
            int d = int.Parse(input[2]);
            int count = 0;
            for(int i = L; i <= R; i++){
                if(i % d == 0){
                    count++;
                }
            }
            Console.WriteLine(count);
        }
    }

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

using namespace std;

#define ll long long
#define ld long double

//#define TEST

int cnt1(int a) {
	int cnt = 0;
	while (a) {
		a /= 2;
		++cnt;
	}
	return cnt;
}

signed main() {
	int n; cin >> n;
	vector<ll> a(n);
	int tmp = 0;
	vector<int> op;
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
		tmp ^= a[i];
		op.push_back(cnt1(a[i] ^ (a[i] - 1)));
	}

	if (!tmp) {
		cout << 0 << endl;
		return 0;
	}

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

#ifdef TEST
	cout << "----------op----------" << endl;
	for (auto opi : op)
		cout << opi << " ";
	cout << endl;
#endif

	vector<int> bt(31, 0);
	for (int i = 0; i < 31; ++i)
		if ((1 << i) & tmp)
			++bt[i];

	vector<int> need;
	for (int i = 0; i < 30; ++i) {
		if (bt[i] != bt[i + 1])
			need.push_back(i + 1);
	}

#ifdef TEST
	cout << "---------need---------" << endl;
	for (auto ni : need)
		cout << ni << " ";
	cout << endl;
#endif

	for (auto ni : need) {
		if ((*lower_bound(op.begin(), op.end(), ni)) != ni) {
			cout << -1 << endl;
			return 0;
		}
	}

	cout << need.size() << endl;

	return 0;
}

Measured memory_bytes: 1660
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

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() {
  int s;
  cin >> s;

  map<int, int> m;
  m[s]++;

  repp(i, 2, 1000000) {
    if (s % 2 == 0) {
      s /= 2;
    } else {
      s = 3 * s + 1;
    }
    m[s]++;
    if (m[s] == 2) {
      cout << i << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
using namespace std;
 //greedy
int main()
{
    int A, B, C, T;
    scanf("%d %d %d %d",&A,&B,&C,&T);

        /*int temp = 0, b = B, c = C, cnt = 0;
        while(A >= 0)
        {
            temp = 0;
            int token = 500 * (A--);
            temp += token;
            if(temp > T)
            {
                temp -= token;
                continue;
            }
            else if(temp == T)
            {
                cnt++;
                temp -= token;
                continue;
            }
            else
            {
                B = b;
                while(B >= 0)
                {
                    int token2 = 100 * (B--);
                    temp += token2;
                    if(temp > T)
                    {
                        temp -= token2;
                        continue;
                    }
                    else if(temp == T)
                    {
                        cnt++;
                        temp -= token2;
                        continue;
                    }
                    else
                    {
                        C = c;
                        while(C > 0)
                        {
                            int token3 = 50 * (C--);
                            temp += token3;
                            if(temp > T)
                            {
                                temp -= token3;
                                continue;
                            }
                            else if(temp == T)
                            {
                                cnt++;
                                temp -= token3;
                                break;
                            }
                        }
                    }
                }
            }
        }*/
    int cnt = 0;
    for(int a = 0;a <= A;a++)
    {
        for(int b = 0;b <= B;b++ )
        {
            for(int c = 0;c <= C;c++)
            {
                if(a * 500 + b * 100 + c * 50 == T)
                    cnt++;
            }
        }
    }
    printf("%d",cnt);
    return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpl;

#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

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

  string s;
  cin>>s;

  bool flag=false;
  string cmp="";
  REP(i,5){
    cmp += "hi";
    if(cmp==s)
      flag=true;
  }

  if(flag)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;

}



Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main {
	static int mod = (int) 1e9 + 7;
	static int DX[] = { -1, 0, 1, 0 }, DY[] = { 0, -1, 0, 1 };

	public static void main(String[] args) {
		FastScanner fs = new FastScanner(System.in);
		char s[] = fs.next().toCharArray();
		int len = s.length;
		for(int i=0;i<len;i++) {
			char now = s[i];
			if(i+1>=len)continue;
			if(s[i+1]==now) {
				System.out.println((i+1)+ " "+(i+2));
				return;
			}
			if(i+2>=len)continue;
			if(s[i+2]==now) {
				System.out.println((i+1)+ " "+(i+3));
				return;
			}
		}
		System.out.println("-1 -1");
	}
}

//高速なScanner
class FastScanner {
	private BufferedReader reader = null;
	private StringTokenizer tokenizer = null;

	public FastScanner(InputStream in) {
		reader = new BufferedReader(new InputStreamReader(in));
		tokenizer = null;
	}

	public String next() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public String nextLine() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken("\n");
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}

	public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nextInt();
		return a;
	}

	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nextLong();
		return a;
	}
}

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

int main() {
string s,t;
int a,b;
string u;
cin >> s >> t;
cin >> a >> b;
cin >> u;
if(u == s){
    cout << (a-1) << " " << b << endl;
} else 
    cout << a << " " << (b-1) << endl;
}

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

using namespace std;

typedef long long ll;

const int MAXN=1e5+10;

ll ans=0;
int n,q,cnt[MAXN]={0};

int main() {
	ios::sync_with_stdio(0);
	cin>>n;
	for(int i=1,x; i<=n; ++i) {
		cin>>x;
		++cnt[x];
		ans+=x;
	}
	cin>>q;
	for(int i=1,b,c; i<=q; ++i) {
		cin>>b>>c;
		ans=ans-1LL*cnt[b]*b+1LL*cnt[b]*c;
		cnt[c]+=cnt[b],cnt[b]=0;
		cout<<ans<<'\n'; 
	}
	return 0; 
}

Measured memory_bytes: 4036
using System;
using System.Collections.Generic;
using System.Linq;
public class GFG
{
    class Pair
    {
        public int Num;
        public int diff;
    }
    public static void Main()
    {

        var n = int.Parse(Console.ReadLine());

        var arr = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        int count = 0;
        int[] cnt = new int[1000010];

        for (int i = 0; i < n; i++)
        {
            cnt[arr[i]]++;
        }

        var ng = new bool[1000010];

        for (int i = 1; i < 1000010; i++)
        {
            if (cnt[i] > 1)
            {
                ng[i] = true;
            }
            if (cnt[i] > 0)
            {
                for (int j = i * 2; j < 1000010; j += i)
                {
                    ng[j] = true;
                }
            }
        }

        int ans = 0;
        foreach (var item in arr)
        {
            if (!ng[item])
            {
                ++ans;
            }
        }

        Console.Write(ans);


    }



}


Measured memory_bytes: 45180
h,w,d = map(int,input().split())
if d%2:
  for i in range(h):
    for j in range(w):
      if (i+j)%2:
        print("R",end="")
      else:
        print("G",end="")
    print()
else:
  cell = [["A" for i in range(2*d)] for j in range(2*d)]
  for i in range(d):
    for j in range(d):
      if (i+j)%2 == (d//2-1)%2:
        if abs(i-j) <= d//2-1 and d//2-1 <= i+j <= (d//2-1)*3:
          cell[i][j] = "R"
      elif j and cell[i][j-1] == "R":
        cell[i][j] = "R"
  for i in range(2*d):
    for j in range(2*d):
      if cell[(i-d)%(2*d)][(j-d)%(2*d)] == "R":
        cell[i][j] = "R"
      elif cell[(i-d//2)%(2*d)][(j-d//2)%(2*d)] == "R" or cell[(i+d//2)%(2*d)][(j+d//2)%(2*d)] == "R" :
        cell[i][j] = "G"
      elif cell[(i-d)%(2*d)][j] == "R" or cell[i][(j-d)%(2*d)] == "R":
        cell[i][j] = "B"
      elif cell[i][j] == "A":
        cell[i][j] = "Y"
  ans = [["A" for i in range(w)] for j in range(h)]
  for i in range(h):
    for j in range(w):
      x = cell[i%(2*d)][j%(2*d)]
      ans[i][j] = x
    print(*ans[i],sep="")

Measured memory_bytes: 90460
s = gets.chomp.chars
t = gets.chomp.chars
N = s.length
unless (t-s).empty?
  puts -1
  exit
end
s_chars = {}
s.each_with_index do |char, i|
  if s_chars[char].nil?
    s_chars[char] = [i]
  else
    s_chars[char].push(i)
  end
end
sum = 0
last_found = N-1
t.each do |char|
  index = s_chars[char].bsearch{|x| x > last_found}
  if index.nil?
    index = s_chars[char].first
    sum += (N - last_found + index)
  else
    sum += (index - last_found)
  end
    last_found = index
    # puts "sum:#{sum}"
end
puts sum

Measured memory_bytes: 13436
n=int(input())
A=[int(i) for i in input().split()]
mod=10**9+7
def inv(x):
  r=[1,0,x]
  w=[0,1,mod]
  while w[2]!=1:
    q=r[2]//w[2]
    r2=w
    w2=[r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
    r=r2
    w=w2
  return w[0]

import collections

P=collections.defaultdict(int)
ans=0
for a in A:
  ans=(ans+inv(a))%mod
  pf={}
  for i in range(2,int(a**0.5)+1):
    while a%i==0:
      pf[i]=pf.get(i,0)+1
      a//=i
  if a>1:
    pf[a]=1
  for p in pf.keys():
    P[p]=max(P[p],pf[p])
for p in P.keys():
  ans=(ans*pow(p,P[p],mod))%mod

print(ans)

Measured memory_bytes: 4580
#include<bits/stdc++.h>
using namespace std;
int selectionSort(int a[],int n)
{
    int i,j,t,sw=0,minj;
    for(i=0;i<n-1;i++)
    {
        minj=i;
        for(j=i+1;j<n;j++)
        {
            if(a[j]<a[minj])
                minj=j;
        }
        t=a[i];
        a[i]=a[minj];
        a[minj]=t;
        if(i!=minj)
            sw++;
    }
    return sw;
}
int main()
{
    int a[100],n,i,sw;
    cin>>n;
    for(i=0;i<n;i++)
        cin>>a[i];
    sw=selectionSort(a,n);
    for(i=0;i<n;i++)
    {
        if(i)
            cout<<" ";
        cout<<a[i];
    }
    cout<<endl;
    cout<<sw<<endl;
    return 0;
}


Measured memory_bytes: 3092
# coding: utf-8
# Your code here!
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

num = 0
pre = -2
for i in range(N):
    num += B[A[i] - 1]
    if A[i] == pre + 1:
        num += C[pre - 1]
    
    pre = A[i]
    
   
    

print(num)

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

namespace codeTester.contest190818
{
    class ProblemB
    {
        static List<long> aList = new List<long>();
        static double answer = 0.0;

        public static void Main(string[] args)
        {
            Input();
            Logic();
            Output();
        }

        static void Input()
        {
            string s = Console.ReadLine();
            aList = ReadSpaceSeparatedValues();
        }

        public static List<long> ReadSpaceSeparatedValues()
        {
            List<long> values = new List<long>();
            string[] inputs = Console.ReadLine().Split(' ');
            foreach (string input in inputs)
            {
                values.Add(long.Parse(input));
            }

            return values;
        }

        static void Logic()
        {
            // List<double> dList = aList.Select(x => (double)1 / x).ToList();
            double reciprocalSum = aList.Select(x => (double)1 / x).Sum();
            answer = 1 / reciprocalSum;
        }

        static void Output()
        {
            Console.WriteLine(answer.ToString());
        }

        static void DebugPrint(string msg)
        {
            // 提出時に消す
            // Console.WriteLine(msg);
        }
    }
}


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

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
#define loop(i, a) for (int i = 0; i < a; i++)
#define revloop(i, a) for (int i = a-1; i > -1; i--)
#define show(a) cout << a << "\n"
#define MOD 1000000007
#define V vector
#define S set
#define P pair
#define M map
#define PQ priority_queue

int main() {
    //freopen("inputs.txt", "r", stdin);
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if ((b < c)||(d < a)) show(0);
    else show(min(b, d) - max(a, c));

    return 0;
}


Measured memory_bytes: 256
#include  <stdio.h>

int main()
{
  int a, b, c, d, e, f;
  float x, y;
  
  
  while(scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e ,&f) != -1){
    
    x = (float)(e*c - b*f) / (a*e - b*d);
    y = (float)(a*f - c*d) /(a*e - b*d);
    
    if(-0.0005 < x && x <= 0) x = 0;
    
    if(-0.0005 < y && y <= 0) y = 0;
    
    printf("%.3f %.3f\n", x, y);
  }
  
  return 0;
}
  

Measured memory_bytes: 1756
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <cctype>
#include <string>
#include <map>
#include <set>
#include <math.h>
#include <cmath>
#define ll long long
#define lli long long int

using namespace std;
using P = pair<int,int>;

int main(){

  int N, a;
  cin >> N;
  vector<int> vec(N);
  int ans = 0;

  for (int i = 0; i < N; i++){
    cin >> a;
    vec.at(i) = a;
  }
  sort(vec.begin(), vec.end());

  int sum = accumulate(vec.begin(), vec.end(), 0);
  int n = vec.size();

  if(sum%10 != 0){
    cout << sum << endl;
    return 0;
  }

  for (int i = 0; i < n; i++) {
    if((sum -vec.at(i)) % 10 != 0){
      cout << sum -vec.at(i) << endl;
      return 0 ;
    }
  }

  cout << 0 << endl;

  return 0;
}

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

#define PI 3.14159265358979323846
#define EPS 0.0001

typedef pair<long long,long long> pt;

pt operator-(pt x,pt y){
    return make_pair(x.first-y.first,x.second-y.second);
}
double operator*(pt x, pt y){
    return x.first*y.second-x.second*y.first;
}

vector<pt> convex(pt ps[],int N){
    sort(ps,ps+N);
    int k=0;
    vector<pt> qs(N*2);

    for(int i=0;i<N;i++){
        while(k>1 && (qs[k-1]-qs[k-2])*(ps[i]-qs[k-1])<=0) k--;
        qs[k++]=ps[i];
    }
    for(int i=N-2,t=k;i>=0;i--){
        while(k>t && (qs[k-1]-qs[k-2])*(ps[i]-qs[k-1])<=0) k--;
        qs[k++]=ps[i];
    }

    qs.resize(k-1);
    return qs;
}

int main(){
    int N;
    cin >> N;
    double pr[100];
    double arg[100];
    pt pts[100];
    map<pt,int> index;

    for(int i=0;i<N;i++){
        long long x,y;
        cin >> x >> y;
        pts[i]=make_pair(x,y);
        index[pts[i]]=i;
    }

    vector<pt> qs=convex(pts,N);

    int M=qs.size();

    for(int i=0;i<M;i++){
        int a=i, b=(i+1)%M;
        pt vec=qs[b]-qs[a];
        arg[i]=atan2l(vec.second,-vec.first);
    }

    pr[0]=arg[0]-arg[M-1];
    for(int i=1;i<M;i++)
        pr[i]=arg[i]-arg[i-1];

    for(int i=0;i<M;i++){
        for(;pr[i]>0;pr[i]-=2*PI);
    }

    double res[100];
    for(int i=0;i<N;i++) res[i]=0;

    for(int i=0;i<M;i++){
        res[index[qs[i]]]=pr[i]/(-2.0*PI);
    }
    for(int i=0;i<N;i++){
        cout << res[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[int(1e5)+1];
int main()
{
  for(int i=0;i<int(1e5)+1;i++) a[i]=0;
  int n,t,l,r;
  cin>>n;
  t=n;
  while(t--)
  {
    cin>>l>>r;
    a[l]+=1;
    a[r]-=1;
  }
  int trav=0,c=0;
  for(int i=1;i<100001;i++)
  {
    trav+=a[i];
    if(trav)
      c++;
  }
  cout<<c+n<<"\n";
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#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()
{
	ios::sync_with_stdio(false);
	cin.tie(0);

	double			n;
	double			m;
	double			sum;
	cin >> n >> m;
	vector<double>	A(n);

	rep(i, n)
		cin >> A.at(i);
	sum = accumulate(A.begin(), A.end(), 0.0) / (4.0 * m);
	sort(A.rbegin(), A.rend());
	bool			flag;
	flag = true;
	rep(i, m)
	{
		if (A.at(i) < sum)
			flag = false;
	}
	if (flag)
		cout << "Yes" << "\n";
	else
		cout << "No" << "\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define PB push_back
#define MP make_pair
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define pri 1000000007 
using namespace std;

int main() {
	ll n,m;
	cin>>n>>m;
	vector <ll> a;
    for(ll i=0;i<n;i++){
    	ll d;
    	cin>>d;
    	a.PB(d);
    }
    vector <pair<ll,ll> > go;
    for(ll j=0;j<m;j++){
    	ll x,y;
    	cin>>x>>y;
    	go.PB(MP(y,x));
    }
    sort(all(a));
    sort(all(go));
    reverse(all(go));
    ll j=0;
    for(ll i=0;i<n;i++){
    	
    	if(a[i]<go[j].ff){
    		a[i]=go[j].ff;
    		go[j].ss--;
    		if(go[j].ss==0)j++;
    		if(j==m)break;
    	}
    	
    }
    ll ans=0;
    for(ll j=0;j<n;j++){
    	ans+=a[j];
    }
    cout<<ans<<endl;
    
	// your code goes here
	return 0;
}

Measured memory_bytes: 3444
#include<bits/stdc++.h>
using namespace std;
char m[21][21];
int cnt=1,w,h;
void dfs(int x,int y){
  int i,j;
  m[y][x]='#';
  for(i=-1;i<=1;++i){
    if(y+i<0) continue;
    if(m[y+i][x]=='.'){
      cnt++;
      dfs(x,y+i);
    }
  }
  for(j=-1;j<=1;++j){
    if(x+j<0) continue;
    if(m[y][x+j]=='.'){
      cnt++;
      dfs(x+j,y);
    }
  }
}
int main(){
  int i,j,x,y;
  while(cin>>w>>h){
    if(w==0&&h==0) break;
    for(i=0;i<21;++i)
      for(j=0;j<21;++j)
	m[i][j]=0;
    for(i=0;i<h;++i){
      for(j=0;j<w;++j){
	cin>>m[i][j];
	if(m[i][j]=='@'){
	  x=j;
	  y=i;
	}
      }
    }
    cnt=1;
    dfs(x,y);
    cout<<cnt<<endl;
  }
  return 0;
}

Measured memory_bytes: 3004
def main():
    N = int(input())
    S = input()
    lst = list(S)

    a = ['{:03d}'.format(i) for i in range(1000)]
    count = 0
    for i in range(len(a)):
        m,n,o = 0,1,2
        s = list(a[i])
        while m < n < o < len(lst) :
            if s[0] != lst[m]:
                m += 1
                n += 1
                o += 1
            elif s[1] != lst[n]:
                n += 1
                o += 1
            elif s[2] != lst[o]:
                o += 1
            else:
                count += 1
                break

    print(count)

if __name__ == "__main__":
    main()


Measured memory_bytes: 42732
<?php
if (basename(__FILE__) == basename($_SERVER['PHP_SELF'])) {
  while ($line = fgets(STDIN)) {
      $hour = (int)($line / 3600);
      $minutes = (int)(($line - ($hour * 3600)) / 60);
      $second = $line - ($hour * 3600 + $minutes * 60);
      echo $hour . ':' . $minutes . ':' . $second;
  }
}
?>

Measured memory_bytes: 15356
use proconio::input;
// use std::collections::HashMap;

#[allow(non_snake_case)]
fn main() {
    input! {
        D: i32,
    }

    if D == 22 {
        println!("Christmas Eve Eve Eve");
    } else if D == 23 {
        println!("Christmas Eve Eve");
    } else if D == 24 {
        println!("Christmas Eve");
    } else {
        println!("Christmas");
    }


}


Measured memory_bytes: 2132
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		long[]a = new long[n];

		for (int i=0; i<n; i++){
			a[i] = sc.nextLong();
			if (a[i] == 0){
				System.out.println(0);
				return;
			}
		}

		long ans=0;
		for (int i=0; i<n; i++){

			if (i == 0){
				ans = a[i];
			} else {
				long tmp = ans;
				ans *= a[i];
				if (ans > 1000000000000000000L){
					System.out.println(-1);
					return;
				} else if (ans / a[i] != tmp){
					System.out.println(-1);
					return;
				}
			}
		}
		System.out.println(ans);
	}

}

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

int main(){
  int N,M,C;
  cin >> N >> M >> C;
  vector<int> B(M);
  for(int i = 0; i < M; i++){
    cin >> B[i];
  }

  vector<vector<int>> A(N,vector<int>(M));
  for(int i = 0; i < N; i++){
    for(int j = 0; j < M; j++){
      cin >> A[i][j];
    }
  }
  
  int count = 0;
  for(int i = 0;i < N; i++){
    int sum = 0;
    for(int j = 0; j < M; j++){
      sum += A[i][j] * B[j];
    }
    if(sum + C > 0) count++;
  }
  cout << count <<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
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; }
typedef long long ll;
const long long INF = 1LL << 60;
int main()
{
    int N;
    cin >> N;

    cout << (N * 800) - ((N / 15) * 200) << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

import java.util.*;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        int N = in.nextInt();
        int[] A = new int[N];
        int[] B = new int[N];
        long tmp = 1_000_000_000_000L;
        long sum = 0L;
        int flag = 0;
        for (int i=0;i<N;i++) {
            A[i] = in.nextInt();
            B[i] = in.nextInt();
            if (A[i]!=B[i]) flag=1;
            sum += A[i];
            if (A[i]>B[i]) tmp = Math.min(tmp, B[i]);
        }
        if (flag==0) out.println(0);
        else out.println(sum-tmp);

        out.close();
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}


Measured memory_bytes: 32624
#define _USE_NATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <random>
#include <tuple>


using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
#define EPS 1e-9
const int INF = 1050000000;
const long long LINF = 1LL << 60;
const ll MOD = 1e9 + 7;
const int MINF = -1050000000;

int main() {
	int n,m;
	map<int, int> D,T;

	//vector<int> D,T;
	cin >> n;
	//D.resize(n);
	rep(i, n) {
		int x;
		cin >> x;
		D[x]++;
	}
	cin >> m;
	//T.resize(m);
	rep(i, m) {
		int x;
		cin >> x;
		T[x]++;
	}
	bool exist = true;
	for (auto x : T) {
		int target = x.first;
		int cnt = x.second;
		if (D[target] < cnt) {
			exist = false;
		}
	}
	if (exist) cout << "YES" << endl;
	else cout << "NO" << endl;
	
	return 0;
}


Measured memory_bytes: 18944
import java.util.Scanner;

public class Main {
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int X = sc.nextInt();
        int t = sc.nextInt();

        int times = (int)Math.ceil((double)N/X);
        System.out.println(times * t);
    }
}

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

int main() {
  int n; cin >> n;
  for(int i=0;i<n;i++) {
    if(n==1) {
      cout << 1 << endl;
    }
    else if(pow(2,i)>n) {
      cout << pow(2,i-1) << endl;
      break;
    }
  }
}

Measured memory_bytes: 256
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;

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

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

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

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

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

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

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

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

fn main() {
    input! {
        a: f64,
        b: f64,
        x: f64,
    }
    let h = x / a / a;
    let h_ = x / b / a;

    let floor = a * b;
    let acc = h_ * 2. / b;
    if x / (a * a) <= b / 2. {
        let res = 90. - acc.atan() * 180. / std::f64::consts::PI;
        println!("{}", res);
    } else {
        let acc = 2. * (b-h) / a;
        let res = acc.atan() * 180. / std::f64::consts::PI;
        println!("{}", res);
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
                using namespace std;
                typedef long long ll;
                #define INPUT()              freopen("input.txt", "r", stdin)
                #define OUTPUT()             freopen("output.txt", "w", stdout)
                #define F                    first
                #define S                    second
            //Templatefunctions
                template<typename T>T gcd(T x, T y) { if (y == 0)return x; else return gcd(y, x%y);}
                template <class T> T euclideanDistance(T x1 , T x2 , T y1 , T y2){return sqrt(( x1 - x2 ) * ( x1 - x2 ) + ( y1 - y2 ) * ( y1 - y2 ));}
                template <class T> T digitSum(T n){T sum = 0;while(n > 0)sum += n % 10,n /= 10;return sum;}
            //datatypes
                typedef long long int ll;
                typedef unsigned long long int ull;
                typedef long double ld;
            //constants
                const double INF = 1e+9;
                const double INFLL = 1e+18;
                const double EPS = 1e-9;
                const double PI = acos(-1);
                const int knightDir[8][2] = {{-2,-1},{-2,1},{-1,2},{1,2},{2,-1},{2,1},{-1,-2},{1,-2}};
                       //const int dx[]={0,0,0,1,1,1,-1,-1,-1};
                       //const int dy[]={-1,0,1,-1,0,1,-1,0,1};
                const int dx[] = {0 , 1 , 0 , -1};
                const int dy[] = {1 , 0 , -1 , 0};
            //helpers
                //#define MOD         1000000007LL
                #define MAX         1000005
                const ll MOD = 1000000000 + 7;
                int arr[MAX];
            //Global Variables


                int manhattanDis(int  x , int y , int x1 , int y1)
                {
                    return abs(x - x1) + abs(y - y1);
                }
                int main()
                {
                    int n , m ;
                    scanf("%d%d",&n,&m);
                    int studentx[55],studenty[55],signalx[55],signaly[55];
                    for(int i = 0 ; i < n ; i++)
                    {
                        scanf("%d%d",&studentx[i],&studenty[i]);
                    }

                    for(int i = 0 ; i < m ; i++)
                    {
                        scanf("%d%d",&signalx[i],&signaly[i]);
                    }

                    for(int i = 0 ; i < n ; i++)
                    {
                        int dis = INT_MAX,ans;
                        for(int j = 0 ; j < m ;j++)
                        {
                            int tdis = manhattanDis(studentx[i],studenty[i],signalx[j],signaly[j]);
                            if(tdis < dis)
                            {
                                dis = tdis;
                                ans = j+1;
                            }
                        }
                        printf("%d\n",ans);
                    }
                }


Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys

def gcd(a, b):
    if b == 0: return a
    return gcd(b, a % b)

def main():
    for line in sys.stdin:
        a, b = map(int, line.split())
        d = gcd(a, b)
        m = a * b // d
        print("{} {}".format(d, m))

if __name__ == "__main__": main()

Measured memory_bytes: 7744
#include <iostream>
using namespace std;
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <math.h>
#include <string>
#include <cstdlib>

int dx[8] = {1, 2, 1, 2, -1, -2, -1, -2}, dy[8] = {2, 1, -2, -1, -2, -1, 2, 1};

int main() {

	string s; cin >> s;
	for(int i = 0; i < s.length()-1; i++) {
		if(s[i] == s[i+1]) {cout << i+1 << " " << i+2 <<endl; return 0;}
		if(i != s.length()-2 ) {
			if(s[i] == s[i+2]) {cout << i+1 << " " << i+3 <<endl; return 0;}
		}
	}
	cout << -1 << " "  << -1 <<endl;
	return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>
#include<iomanip>

#define MOD 1e9+7;
#define INF 1e17+9;
#define PI acos(-1);

using namespace std;

int main(){
	int n;
	cin >> n;
	vector<int> t(n,0),x(n,0),y(n,0);
	for(int i=0;i<n;i++){
		cin >> t[i] >> x[i] >> y[i];
	}
	
	int dt;
	int dx;
	int dy;
	
	dt=abs(t[1]-t[0]);
	dx=abs(x[1]-x[0]);
	dy=abs(y[1]-y[0]);
	
	if((dt-(dx+dy))%2!=0 || dt<(dx+dy)){
		cout << "No" << endl;
		return 0;
	}
	
	for(int i=1;i<n;i++){
		dt=abs(t[i]-t[i-1]);
		dx=abs(x[i]-x[i-1]);
		dy=abs(y[i]-y[i-1]);
		if((dt-(dx+dy))%2!=0 || dt<(dx+dy)){
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define prArr(a) {cerr<<(#a)<<"={";int i=0;for(auto t:(a))cerr<<(i++?", ":"")<<t;cerr<<"}"<<endl;}
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){
  return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
//INSERT ABOVE HERE


signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  Int A, B;
  cin>>A>>B;

  Int ans = 0;
  for(ans = 0;; ans++){
    Int num = ans;

    Int total = 1;
    for(Int i=0;i<num;i++){
      total = total - 1 + A;
    }
    if(total >= B) break;
  }

  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int n;cin>>n;
  int p[n];
  int ans=INFINITY;
  int ans2;
  int cnt=0;
  for(int i=0;i<n;i++){
    cin>>p[i];
    ans2=ans;
    ans=min(ans,p[i]);
    if(ans2!=ans)cnt++;
  }
  cout<<cnt<<endl;
}

Measured memory_bytes: 1024
# WIP
import sys
sys_input = sys.stdin.readline
N = int(sys_input())
aaa = list(map(int, sys_input().split()))

# If all values are odd
aaa_remain = set(map(lambda x: x % 2, aaa))
if len(aaa_remain) == 1 and sum(aaa_remain) == 1:
    print(0)
    exit()

aaa_even = [a for a in aaa if a % 2 == 0]

n_divide = 0
is_dividable = True
for a in aaa_even:
    target_a = a
    while is_dividable:
        is_dividable = False if target_a % 2 else True
        if is_dividable:
            target_a = target_a//2
            n_divide += 1
    is_dividable = True

print(n_divide)


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

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	
	string s;
	cin>>s;
	if(s == "ABC")cout<<"ARC";
	else cout<<"ABC";
	
	return 0;
}


Measured memory_bytes: 3564
# 58
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


n = I()
h = LI()
ans = 0
while True:
    if max(h) == 0:
        break
    i = 0
    while i < n:
        if h[i] == 0:
            i += 1
        else:
            ans += 1
            while i < n and h[i] > 0:
                h[i] -= 1
                i += 1
print(ans)


Measured memory_bytes: 9088
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
#define REP(i, a, n) for(int i=a; i<n; i++)

int n, k;
int main()
{
	cin >> n >> k;

	int cnt = 1;
	REP(i, 0, n) {
		if (cnt * 2 < cnt + k) {
			cnt *= 2;
		}
		else cnt += k;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
x, y = map(int, input().split())
dif = abs(abs(x) - abs(y))
if x <= y:
    if x * y < 0:
        print(1 + dif)
    else:
        print(dif)
else:
    if x * y <= 0:
        print(1 + dif)
    else:
        print(2 + dif)

Measured memory_bytes: 3060
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;

public class Main{

	public static void main(String[] args) throws IOException {
		MyScanner sc = new MyScanner(System.in);
		int n=sc.nextInt();
		int k=sc.nextInt();
		long[] a = new long[n+1];
		long[] b = new long[n+1];
		for(int i=1; i<=n; i++) a[i] = sc.nextLong();
		for(int i=1; i<=n; i++) {
			b[i]=b[i-1]+Math.max(a[i], 0);
			a[i]=a[i-1]+a[i];
		}
		long ans=0;
		for(int i=1; i<=n; i++) {
			if(i+k-1<=n)
				ans=Math.max(ans, Math.max(a[i+k-1]-a[i-1],0)+b[i-1]+b[n]-b[i+k-1]);
		}
		System.out.println(ans);
		
 	}
	
	static void printArray(int[] a) {
		int n=a.length;
		for(int i=0; i<n; i++) {
			if(i==0) System.out.print(a[i]);
			else System.out.print(" "+a[i]);
		}
		System.out.println();
	}

	static class MyScanner
	{
		BufferedReader br;
		StringTokenizer st;
		public MyScanner(InputStream s) 
		{
			br=new BufferedReader(new InputStreamReader(s));
		}
		public String nextLine() throws IOException
		{
			return br.readLine();
		}
		public String next() throws IOException
		{
			while(st==null || !st.hasMoreTokens())
				st=new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		public int nextInt() throws IOException
		{
			return Integer.parseInt(next());
			
		}
		public double nextDouble() throws IOException
		{
			return Double.parseDouble(next());
		}
		public boolean ready() throws IOException
		{
			return br.ready();
		}
		public long nextLong() throws IOException
		{
			return Long.parseLong(next());
		}
	}
}


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

int main() {
	int a, b, c, d, r1, r2, r3;
    string s, op[2] = {"-", "+"};
	cin >> s;
    a=stoi(s.substr(0,1)); b=stoi(s.substr(1,1)); c=stoi(s.substr(2,1)); d=stoi(s.substr(3,1));
	for(int op1=0; op1<=1; op1++){
		if(op1 == 0) r1=a-b;
		else r1 = a+b;
		for(int op2=0;op2<=1;op2++){
			if(op2 == 0) r2 = r1-c;
			else r2 = r1+c;
			for(int op3=0; op3<=1; op3++) {
				if(op3 == 0) r3 = r2 - d;
				else r3 = r2 + d;
				if(r3 == 7) {
				    cout << to_string(a) << op[op1] << to_string(b) << op[op2] << to_string(c) << op[op3] << to_string(d) << "=7" << endl;
                    return 0;
				}
			}
		}
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
#define fore(i,a,b) for(ll i=(a);i<=(b);++i)
#define rep(i,n) fore(i,0,(n)-1)
#define rfore(i,a,b) for(ll i=(b);i>=(a);--i)
#define rrep(i,n) rfore(i,0,(n)-1)
#define all(x) (x).begin(),(x).end()
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
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;}
template<class T>
ll sum(const T& a){return accumulate(all(a),0LL);}

struct Dice {
    ll a[6];
    ll top(){
        return a[0];
    }
    void swap4(ll i1,ll i2,ll i3,ll i4){
        ll tmp=a[i1];
        a[i1]=a[i2];
        a[i2]=a[i3];
        a[i3]=a[i4];
        a[i4]=tmp;
    }
    void rotateE(){
        swap4(2,0,3,5);
    }
    void rotateN(){
        swap4(4,0,1,5);
    }
    void rotateS(){
        swap4(1,0,4,5);
    }
    void rotateW(){
        swap4(3,0,2,5);
    }
};

void solve(){
    Dice d;
    rep(i,6)cin>>d.a[i];
    string s;cin>>s;
    rep(i,s.size()){
        if(s[i]=='E')d.rotateE();
        if(s[i]=='N')d.rotateN();
        if(s[i]=='S')d.rotateS();
        if(s[i]=='W')d.rotateW();
    }
    cout<<d.top()<<endl;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    solve();
}



Measured memory_bytes: 3228