Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
a = input() 
b = input()
if (a % 3) * (b % 3) * ((a + b) % 3) == 0:
    print "Possible"
else:
    print "Impossible"

Fixed submission:
a, b = map(int, raw_input().split())
if any([x % 3 == 0 for x in [a, b, a+b]]):
    print "Possible"
else:
    print "Impossible"
Buggy python submission (verdict: Runtime Error):
n = int(intput())
a = int(input())
print(n**2 - a)

Fixed submission:
n=int(input())
a=int(input())
print(n**2-a)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(int(x) for x in input().split())
a = len(A)
sa = sorted(A)
su = 0
p = 10**9+7
for i in range(a):
        su += sa[i]*(sum(sa[i+1:])%p)%p

print(su%p)


Fixed submission:
N = int(input())
A = list(int(x) for x in input().split())
B = [0]
a = len(A)
sa = sorted(A)
su = 0
p = 10**9+7

for i in range(a):
    B.append(B[i] + sa[i])

for j in range(a):
    su += sa[j]*B[j]

print(su%p)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(int(x) for x in input().split())
a = len(A)
sa = sorted(A)
su = 0
for i in range(a):
    for j in range(a):
        if i<j:
            su += A[i]*A[j]

print(su%(10**9+7))

Fixed submission:
N = int(input())
A = list(int(x) for x in input().split())
B = [0]
a = len(A)
sa = sorted(A)
su = 0
p = 10**9+7

for i in range(a):
    B.append(B[i] + sa[i])

for j in range(a):
    su += sa[j]*B[j]

print(su%p)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(int(x) for x in input().split())
a = len(A)
sa = sorted(A)
su = 0
for i in range(a):
        su += sa[i]*sum(sa[i+1:])

print(su%(10**9+7))

Fixed submission:
N = int(input())
A = list(int(x) for x in input().split())
B = [0]
a = len(A)
sa = sorted(A)
su = 0
p = 10**9+7

for i in range(a):
    B.append(B[i] + sa[i])

for j in range(a):
    su += sa[j]*B[j]

print(su%p)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(int(x) for x in input().split())
a = len(A)
su = 0
for i in range(a):
    for j in range(i+1,a):
        su += A[i]*A[j]

print(su%(10**9+7))


Fixed submission:
N = int(input())
A = list(int(x) for x in input().split())
B = [0]
a = len(A)
sa = sorted(A)
su = 0
p = 10**9+7

for i in range(a):
    B.append(B[i] + sa[i])

for j in range(a):
    su += sa[j]*B[j]

print(su%p)
Buggy python submission (verdict: Runtime Error):
for i in range(le):
    for j in range(i+1,le):
        for k in range(j+1,le):
            if (L[i] + L[j] > L[k] and
                L[i] + L[k] > L[j] and
                    L[k] + L[j] > L[i] ):
                         if (L[i] != L[j] and
                            L[i] != L[k] and
                            L[k] != L[j]):
                                score += 1

print(score)

Fixed submission:
N = int(input())

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

le = len(L)

score = 0

for i in range(le):
    for j in range(i+1,le):
        for k in range(j+1,le):
            if (L[i] + L[j] > L[k] and
                L[i] + L[k] > L[j] and
                    L[k] + L[j] > L[i] ):
                         if (L[i] != L[j] and
                            L[i] != L[k] and
                            L[k] != L[j]):
                                score += 1

print(score)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
import sys

def input():
    return sys.stdin.readline().rstrip()

N = int(input())
li = list(map(int, input().split()))

ans = 1
for i in li:
    ans *= i

if ans > int(1e18):
    print(-1)
else:
    print(ans)

Fixed submission:
from collections import deque
import sys

def input():
    return sys.stdin.readline().rstrip()

N = int(input())
li = list(map(int, input().split()))
li.sort()

ans = 1
for i in li:
    ans *= i
    if (ans > int(1e18)):
        print(-1)
        sys.exit(0)

if ans > int(1e18):
    print(-1)
else:
    print(ans)
Buggy python submission (verdict: Runtime Error):
x=str(input())
y=str(input())
def idx(x,y):
	if len(y)-len(x)!=1:
  		return False
	else:
  		for i in range(0,len(x)):
    		if x[i]!=y[i]:
      			return False
        return True
if idx(x,y):
  print("Yes")
else:
  print("No")


Fixed submission:
def isokay(S,T):
    if len(T)-len(S)!=1:
        return False
    else:
        for i in range(len(S)):
            if S[i]!=T[i]:
                return False
    return True

S=input()
T=input()

if isokay(S,T):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
import math
def facts(n):
    ans = []
    for  i in range(1, int(math.sqrt(n)+1)):
        if(n%i==0):
            ans.append(i)
            ans.append(n//i)
    ans = sorted(list(dict.fromkeys(ans)))
    if(ans[-1]==n):
        ans = ans[:-1]
    return ans


n, m,k  = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
pa  = [0]
pb = [0]
ans = 0
for i in range(n):
    pa.append(a[i]+pa[i])
for i in range(m):
    pb.append(b[i]+pb[i])
for c in range(n+1):
    tmp=pa[c]
    if(tmp > k):
        break
    else:
        for d in range(m+1):
            if(pb[d] <= k-tmp):
                ans = max(ans, c+d)
            else:
                break
print(ans)

Fixed submission:
import math
def facts(n):
    ans = []
    for  i in range(1, int(math.sqrt(n)+1)):
        if(n%i==0):
            ans.append(i)
            ans.append(n//i)
    ans = sorted(list(dict.fromkeys(ans)))
    if(ans[-1]==n):
        ans = ans[:-1]
    return ans


n, m,k  = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
pa  = [0]
pb = [0]
ans = 0
for i in range(n):
    pa.append(a[i]+pa[i])
for i in range(m):
    pb.append(b[i]+pb[i])
for c in range(n+1):
    if(pa[c] > k):
        break
    else:
        while(pb[m] > k-pa[c]):
            m-=1
        ans = max(ans, c+m)
            
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
nums = list(map(int, input().split()))
ans = 1
for i in nums:
    ans*= i
    if(ans > int(1e18) and 0 not in nums):
        break
if(ans > int(1e18)):
    print(-1)
else:
    print(ans)


Fixed submission:
n = int(input())
nums = list(map(int, input().split()))
ans = 1
ok = True
if(0 in nums):
    print(0)
else:
    for i in nums:
        ans *= i
        if(ans > int(1e18)):
            ok = False
            break
    if(not ok):
        print(-1)
    else:
        print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
nums = list(map(int, input().split()))
ans = 1
for i in nums:
    ans*= i
if(ans > int(1e18)):
    print(-1)
else:
    print(ans)


Fixed submission:
n = int(input())
nums = list(map(int, input().split()))
ans = 1
ok = True
if(0 in nums):
    print(0)
else:
    for i in nums:
        ans *= i
        if(ans > int(1e18)):
            ok = False
            break
    if(not ok):
        print(-1)
    else:
        print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
i=1
facts = []
ans = 0
Number  =n
for i in range(2, Number + 1):
    if(Number % i == 0):
        isprime = 1
        for j in range(2, (i //2 + 1)):
            if(i % j == 0):
                isprime = 0
                break
        if (isprime == 1):
            facts.append(i)

facts = sorted(facts)
for i in range(len(facts)):
    cnt = 1
    while(n >= facts[i]**cnt):
        if(n%(facts[i]**cnt)==0):
            n//=(facts[i]**cnt)
            ans+=1
        cnt+=1
print(ans)



Fixed submission:
n=int(input())
i=1
facts = []
ans = 0
Number  =n
import math 
def factorize(n): 
    count = 0
    while ((n % 2 > 0) == False):  
        n >>= 1;  
        count += 1
    if (count > 0): 
        facts.append(2)
    for i in range(3, int(math.sqrt(n)) + 1): 
        count = 0
        while (n % i == 0):
            count += 1 
            n = int(n / i)
        if (count > 0): 
            facts.append(i)
        i += 2
    if (n > 2): 
        facts.append(n)
factorize(n)
facts = sorted(facts)
for i in range(len(facts)):
    cnt = 1
    while(n >= facts[i]**cnt):
        if(n%(facts[i]**cnt)==0):
            n//=(facts[i]**cnt)
            ans+=1
        cnt+=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import math
def fact(n):
    ans = 1
    for i in range(2, n+1):
        ans*= i
    return ans
def comb(n, c):
    return fact(n)//(fact(n-c)*c)

n, k = map(int, input().split())
a = list(map(int, input().split()))
cnt=  0
i = 1
cycle = ['1']

for c in range(n):
    i = a[i-1]
    if(i in cycle):
        break
    else:
        cycle.append(i)

ind = cycle.index(i)
k-= ind
rcycle = cycle[ind:]
if(k <= 0):
    print(cycle[k+ind])
else:
    now = (k+1)%len(rcycle)
    print(rcycle[now-1])

Fixed submission:
import math
def fact(n):
    ans = 1
    for i in range(2, n+1):
        ans*= i
    return ans
def comb(n, c):
    return fact(n)//(fact(n-c)*c)
'''
n, k = map(int, input().split())
a = list(map(int, input().split()))
cnt=  0
i = 1
cycle = ['1']

for c in range(n):
    i = a[i-1]
    if(i in cycle):
        break
    else:
        cycle.append(i)

ind = cycle.index(i)
k-= ind
rcycle = cycle[ind:]
if(k <= 0):
    print(cycle[k+ind])
else:
    now = (k+1)%len(rcycle)
    print(rcycle[now-1])
'''
n,k = map(int,input().split())
a = list(map(int,input().split()))
already = ["1"]
set = {"1"}
now = 1
 
for i in range(n):
    now = str(a[int(now)-1])
    if now in set:
        break
    else:
        already.append(now)
        set.add(now)
 
 
ind = already.index(now)
k -= ind
cycle = already[ind:]
 
if k <= 0:
    print(already[k+ind])
else:
    now = (k+1) % len(cycle)
    print(cycle[now-1])
Buggy python submission (verdict: Time Limit Exceeded):
x = int(input())
a, b = 0,0
done = False
for i in range(0,20000):
    for l in range(0, -20000, -1):
        if((i**5)-(l**5)==x):
            a = i
            b = l
            done  = True
            break
    if(done):
        break
print(a,b)


Fixed submission:
x = int(input())
a, b = 0,0
done = False
for i in range(-2000, 2000):
    for l in range(2000,-2000, -1):
        if((i**5)-(l**5)==x):
            a = i
            b = l
            print(a,b)
            done  = True
            break
    if(done):
        break

Buggy python submission (verdict: Time Limit Exceeded):
x = int(input())
a, b = 0,0
done = False
for i in range(0,x+1):
    for l in range(0, -i-1, -1):
        if((i**5)-(l**5)==x):
            a = i
            b = l
            done  = True
            break
    if(done):
        break
print(a,b)

Fixed submission:
x = int(input())
a, b = 0,0
done = False
for i in range(-2000, 2000):
    for l in range(2000,-2000, -1):
        if((i**5)-(l**5)==x):
            a = i
            b = l
            print(a,b)
            done  = True
            break
    if(done):
        break
Buggy python submission (verdict: Time Limit Exceeded):
import math
def fact(n):
    ans = 1
    for i in range(2, n+1):
        ans*= i
    return ans
def comb(n, c):
    return fact(n)//(fact(n-c)*c)

n = int(input())
nums = list(map(int, input().split()))
ans = 0
for f in range(1,n):
    for l in range(f+1, n+1):
        if(abs(f-l)==nums[f-1]+nums[l-1]):
            ans+=1
print(ans)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
vals = []
mappy = {}
ans = 0
for i in range(n):
    if(i+1-a[i] > 0):
        if(i+1-a[i] in mappy):
            mappy[i+1-a[i]]+=1
        else:
            mappy[i+1-a[i]] =1
for i in range(n):
    if(i+1+a[i]in mappy):
        ans+=mappy[i+1+a[i]]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
vals = []
ans = 0
for i in range(1, n+1):
    vals.append(i-a[i-1])
for i in range(n):
    for v in range(n):
        if(i+1+a[i] == vals[v] or i+1+a[i] == vals[v]):
            ans+=1
print(ans)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
vals = []
mappy = {}
ans = 0
for i in range(n):
    if(i+1-a[i] > 0):
        if(i+1-a[i] in mappy):
            mappy[i+1-a[i]]+=1
        else:
            mappy[i+1-a[i]] =1
for i in range(n):
    if(i+1+a[i]in mappy):
        ans+=mappy[i+1+a[i]]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 0
nums = list(map(int, input().split()))
for i in range(n):
    for l in range(n):
        if(i!=l and abs(l-i) == nums[i]+nums[l]):
            ans += 1
print(ans//2)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
vals = []
mappy = {}
ans = 0
for i in range(n):
    if(i+1-a[i] > 0):
        if(i+1-a[i] in mappy):
            mappy[i+1-a[i]]+=1
        else:
            mappy[i+1-a[i]] =1
for i in range(n):
    if(i+1+a[i]in mappy):
        ans+=mappy[i+1+a[i]]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ms = list(map(int, input().split()))
for i in range(1, n+1):
    print(ms.count(i))


Fixed submission:
import math
def fact(n):
    ans = 1
    for i in range(2, n+1):
        ans*= i
    return ans
def comb(n, c):
    return fact(n)//(fact(n-c)*c)

n = int(input())
b = {}
vals = list(map(int, input().split()))
for i in range(n-1):
    if(vals[i] in b):
        b[vals[i]]+=1
    else:
        b[vals[i]] = 1
for i in range(1, n+1):
    if(i in b):
        print(b[i])
    else:
        print(0)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ms = list(map(int, input().split()))
for i in range(1, n+1):
    print(ms.count(i))


Fixed submission:
import math
def fact(n):
    ans = 1
    for i in range(2, n+1):
        ans*= i
    return ans
def comb(n, c):
    return fact(n)//(fact(n-c)*c)

n = int(input())
b = {}
vals = list(map(int, input().split()))
for i in range(n-1):
    if(vals[i] in b):
        b[vals[i]]+=1
    else:
        b[vals[i]] = 1
for i in range(1, n+1):
    if(i in b):
        print(b[i])
    else:
        print(0)
Buggy python submission (verdict: Time Limit Exceeded):
import math
from decimal import *

n, w = map(int, input().split())
cost, weights = [],[]
for i in range(n):
    a,b = map(int, input().split())
    weights.append(a)
    cost.append(b)

def kp(pt, c, ans):
    if(pt==-1 or c==0):
        return ans
    else:
        var1, var2 = 0, 0
        var1= kp(pt-1, c, ans)
        if(c >= weights[pt]):
            var2 = cost[pt]+kp(pt-1, c-weights[pt], ans)
        ans = max(var1, var2)
    return ans
ans = kp(n-1, w, 0)
print(ans)

Fixed submission:
import math

n, w = map(int, input().split())
weights = []
costs = []
for i in range(n):
    a,b = map(int, input().split())
    weights.append(a)
    costs.append(b)
dp = [[0 for i in range(w+1)] for i in range(n)]
for i in range(w+1):
    if(i>= weights[0]):
        dp[0][i] = costs[0]

for i in range(1, n):
    for j in range(w+1):
        if(j >= weights[i]):
            val = max(dp[i-1][j], costs[i]+dp[i-1][j-weights[i]])
            dp[i][j] = val
        else:
            dp[i][j] =max(dp[i][j], dp[i-1][j])
print(dp[-1][-1])
Buggy python submission (verdict: Time Limit Exceeded):
import math

n, w = map(int, input().split())
weights = []
costs = []
for i in range(n):
    a,b = map(int, input().split())
    weights.append(a)
    costs.append(b)
dp = [[0 for i in range(w+1)] for i in range(n)]
for i in range(w+1):
    if(i>= weights[0]):
        dp[0][i] = costs[0]

for i in range(1, n):
    for j in range(w+1):
        if(j >= weights[i]):
            val = max(dp[i-1][j], costs[i]+dp[i-1][j-weights[i]])
            dp[i][j] = val
        else:
            dp[i][j] =max(dp[i][j], dp[i-1][j])
print(dp[-1][-1])

Fixed submission:
import math

n, W = map(int, input().split())
costs, weights = [], []
sum_vals = 0
for i in range(n):
    a,b =map(int, input().split())
    sum_vals+=b
    costs.append(b)
    weights.append(a)
dp = [int(10e18)+1]*(sum_vals+1)
dp[0] = 0
for item in range(0, n):
    for value_already in range(sum_vals-costs[item], -1, -1):
        dp[value_already+costs[item]] = min(dp[value_already+costs[item]], dp[value_already]+weights[item])
ans = 0
for i in range(1, sum_vals+1):
    if(dp[i]<= W):
        ans = max(ans, i)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
nums = list(map(int, input().split()))
for i in range(n):
    temp = list(nums)
    temp.pop(i)
    temp = sorted(temp)
    print(temp[(n+1)//2-1])


Fixed submission:
n = int(input())
a = [int(x) for x in input().split()]
x = sorted(a)
m1 = x[n // 2]
m2 = x[n // 2 - 1]
for i in range(n):
    if a[i] < m1: print(m1)
    else: print(m2)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
nums = list(map(int, input().split()))
meds = []
for i in range(n):
    temp = list(nums)
    temp.pop(i)
    temp = sorted(temp)
    meds.append(temp[(n+1)//2-1])
for i in meds:
    print(i)


Fixed submission:
n = int(input())
a = [int(x) for x in input().split()]
x = sorted(a)
m1 = x[n // 2]
m2 = x[n // 2 - 1]
for i in range(n):
    if a[i] < m1: print(m1)
    else: print(m2)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int, input().split()))
ans = 0
for i in range(N):
    for j in range(0, i):
        if P[j] < P[i]:
            break
    else:
        ans += 1
print(ans)


Fixed submission:
N = int(input())
P = list(map(int, input().split()))
ans = 1
dp = [0 for i in range(N + 1)]
dp[0] = P[0] # min
for i in range(N - 1):
    if P[i + 1] <= dp[i]:
        ans += 1
        dp[i + 1] = P[i + 1]
    else:
        dp[i + 1] = dp[i]

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def main(N, A):
    ans = 0
    for i in range(N-1):
        ans += A[i]*sum(A[i+1:])
        ans %= 10**9 + 7
        """
        for j in range(i+1, N):
            ans += A[i]*A[j]
            ans = ans % (10**9 + 7)
        """
    return ans

if __name__ == '__main__':
    N = int(input())
    A = list(map(int, input().split()))
    ans = main(N, A)
    print(ans)



Fixed submission:
def main(N, A):
    ans = 0
    culm = sum(A)
    for i in range(N-1):
        culm -= A[i]
        ans += A[i]*culm
        ans %= 10**9 + 7
    return ans

if __name__ == '__main__':
    N = int(input())
    A = list(map(int, input().split()))
    ans = main(N, A)
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations

def main(N, A):
    ans = 0
    for Ai, Aj in combinations(A, 2):
        ans += Ai*Aj
        ans = ans % (10**9 + 7)
    return ans

if __name__ == '__main__':
    N = int(input())
    A = list(map(int, input().split()))
    ans = main(N, A)
    print(ans)



Fixed submission:
def main(N, A):
    ans = 0
    culm = sum(A)
    for i in range(N-1):
        culm -= A[i]
        ans += A[i]*culm
        ans %= 10**9 + 7
    return ans

if __name__ == '__main__':
    N = int(input())
    A = list(map(int, input().split()))
    ans = main(N, A)
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def main(N, A):
    ans = 0
    for i in range(N-1):
        for j in range(i+1, N):
            ans += A[i]*A[j]
            ans = ans % (10**9 + 7)
    return ans

if __name__ == '__main__':
    N = int(input())
    A = list(map(int, input().split()))
    ans = main(N, A)
    print(ans)



Fixed submission:
def main(N, A):
    ans = 0
    culm = sum(A)
    for i in range(N-1):
        culm -= A[i]
        ans += A[i]*culm
        ans %= 10**9 + 7
    return ans

if __name__ == '__main__':
    N = int(input())
    A = list(map(int, input().split()))
    ans = main(N, A)
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
a=input().split()
c=[n for n in range(N)]
print(" ".join([str(a.index(str(_+1))+1) for _ in c]))


Fixed submission:
N=int(input())
A=list(map(int,input().split()))

d=[0 for n in range(N)]
for n in range(N):
    d[A[n]-1] = str(n+1)

print(" ".join(d))

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
a=input().split()
b=sorted([int(_) for _ in a])
print(" ".join([str(a.index(str(_))+1) for _ in b]))


Fixed submission:
N=int(input())
A=list(map(int,input().split()))

d=[0 for n in range(N)]
for n in range(N):
    d[A[n]-1] = str(n+1)

print(" ".join(d))

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
B=sorted(A)
print(' '.join([str(A.index(b)+1) for b in B]))


Fixed submission:
N=int(input())
A=list(map(int,input().split()))

d=[0 for n in range(N)]
for n in range(N):
    d[A[n]-1] = str(n+1)

print(" ".join(d))

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
B=sorted(A)
for b in B:
    if b == len(B):
        print(A.index(b)+1)
    else:
        print(A.index(b)+1,end=" ")


Fixed submission:
N=int(input())
A=list(map(int,input().split()))

d=[0 for n in range(N)]
for n in range(N):
    d[A[n]-1] = str(n+1)

print(" ".join(d))
Buggy python submission (verdict: Runtime Error):
s = input()
t = s[1]
s = s[0]
count = 0
for i in range(3):
	if s[i] == t[i]:
		count += 1

print(count)

Fixed submission:
s = input()
t = input()
count = 0
for i in range(3):
	if s[i] == t[i]:
		count += 1

print(count)
Buggy python submission (verdict: Runtime Error):
from sys import stdin
#a,b = [int(x) for x in stdin.readline().rstrip().split()]
"""
a,b = map(int,input().split())
s = input()
s = s.split(" ")
a = int(s[0])
b = int(s[1])
"""
s = list(map(int,input().split()))
a = int(s[0])
b = int(s[1])

count = 0
while b > 0:
  count += 1
  b -= (count*(a-1)+1):
    
print(count)


Fixed submission:
s = list(map(int,input().split()))
a = int(s[0])
b = int(s[1])

count = 0
while (b - (count*(a-1)+1)) > 0:
  count += 1
  
print(count)

Buggy python submission (verdict: Runtime Error):
from sys import stdin
a,b = [int(x) for x in stdin.readline().rstrip().split()]
"""
a,b = map(int,input().split())
s = input()
s = s.split(" ")
a = int(s[0])
b = int(s[1])
"""

count = 0
while b > 0:
  count += 1
  b -= (count*(a-1)+1):
    
print(count)


Fixed submission:
s = list(map(int,input().split()))
a = int(s[0])
b = int(s[1])

count = 0
while (b - (count*(a-1)+1)) > 0:
  count += 1
  
print(count)

Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
"""
s = input()
s = s.split(" ")
a = int(s[0])
b = int(s[1])
"""

count = 0
while b > 0:
  count += 1
  b -= (count*(a-1)+1):
    
print(count)


Fixed submission:
s = list(map(int,input().split()))
a = int(s[0])
b = int(s[1])

count = 0
while (b - (count*(a-1)+1)) > 0:
  count += 1
  
print(count)

Buggy python submission (verdict: Runtime Error):
s = str(input())
s = s.split(" ")
a = int(s[0])
b = int(s[1])

count = 0
while b > 0:
  count += 1
  b -= (count*(a-1)+1):
    
print(count)


Fixed submission:
s = list(map(int,input().split()))
a = int(s[0])
b = int(s[1])

count = 0
while (b - (count*(a-1)+1)) > 0:
  count += 1
  
print(count)

Buggy python submission (verdict: Runtime Error):
s = input()
s = s.split(" ")
a = int(s[0])
b = int(s[1])

count = 0
while b > 0:
  count += 1
  b -= (count*(a-1)+1):
    
print(count)

Fixed submission:
s = list(map(int,input().split()))
a = int(s[0])
b = int(s[1])

count = 0
while (b - (count*(a-1)+1)) > 0:
  count += 1
  
print(count)