TnT/CodeNet4Repair huggingface dataset:
Problem:
AtCoDeer the deer has found two positive integers, a and b. Determine whether the concatenation of a and b in this order is a square number.

Incorrect submission (verdict: Wrong Answer):
a,b = map(int,input().split())
n = b//10
jud = a*10**(n+1)+b
m = int(jud**.5)
if abs(m*m-jud)< 1e-6:
  print('Yes')
else:
  print('No')


Fixed, accepted submission:
a = int(input().replace(" ", ""))
 
b = a**0.5
c = b - int(b)
 
if c == 0.0:
    print("Yes")
else:
    print("No")
Problem:
You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively.    An example of a trapezoid  Find the area of this trapezoid.

Incorrect submission (verdict: Wrong Answer):
a=int(input())
b=int(input())
h=int(input())
print((a+b)*h/2)

Fixed, accepted submission:
a=int(input())
b=int(input())
h=int(input())
print((a+b)*(int(h/2)))
Problem:
There are N empty boxes arranged in a row from left to right. The integer i is written on the i-th box from the left (1 \leq i \leq N).  For each of these boxes, Snuke can choose either to put a ball in it or to put nothing in it.  We say a set of choices to put a ball or not in the boxes is good when the following condition is satisfied:    * For every integer i between 1 and N (inclusive), the total number of balls contained in the boxes with multiples of i written on them is congruent to a_i modulo 2.  Does there exist a good set of choices? If the answer is yes, find one good set of choices.

Incorrect submission (verdict: Wrong Answer):
def main():
    n, *a = map(int, open(0).read().split())
    res = []
    for i in range(1, n):
        x = sum(a[i - 1::i])
        b = x % 2
        if x > 0 and b == 0:
            print(-1)
            exit()
        if a[i - 1]:
            res.append(i - 1)

    ans = ' '.join(map(str, res))
    print(sum(a))
    print(ans)


if __name__ == '__main__':
    main()


Fixed, accepted submission:
def solve():
    N, *a_l = map(int, open(0).read().split())
    a_l = [0] + a_l

    for i in range(N//2, 0, -1):
        a_l[i] = sum(a_l[i::i]) % 2

    b_l = [i for i, x in enumerate(a_l) if x]

    print(len(b_l))
    if len(b_l) != 0:
        print(' '.join(map(str, b_l)))


if __name__ == '__main__':
    solve()
Problem:
Write a program which reads three integers, and prints them in ascending order.

Incorrect submission (verdict: Wrong Answer):
a, b, c = map(int, input().split())
if(a > b) :
  a, b = b, a
  if(b > c) :
    b, c = c, b
  else :
    pass
else :
  if(b > c) :
    b, c = c, b
  else :
    pass
print(a, b, c)


Fixed, accepted submission:
a, b, c = map(int, input().split())

if a < b :
    if b < c :
        print(a, b, c)
    elif a < c :
        print(a, c, b)
    else :
        print(c, a, b)
elif b < a :
    if a < c :
        print(b, a, c)
    elif b < c :
        print(b, c, a)
    else :
        print(c, b, a)
Problem:
You are given three integers A, B and C. Determine whether C is not less than A and not greater than B.

Incorrect submission (verdict: Wrong Answer):
a = list(map(int,input().split()))
if a[0] <= a[2] <= a[1]:
  print("YES")
else:
  print("NO")

Fixed, accepted submission:
A,B,C = map(int,input().split())

if A<=C<=B:
  print("Yes")
else:
  print("No")
Problem:
Takahashi, who works at DISCO, is standing before an iron bar. The bar has N-1 notches, which divide the bar into N sections. The i-th section from the left has a length of A_i millimeters.  Takahashi wanted to choose a notch and cut the bar at that point into two parts with the same length. However, this may not be possible as is, so he will do the following operations some number of times **before** he does the cut:    * Choose one section and expand it, increasing its length by 1 millimeter. Doing this operation once costs 1 yen (the currency of Japan).   * Choose one section of length at least 2 millimeters and shrink it, decreasing its length by 1 millimeter. Doing this operation once costs 1 yen.  Find the minimum amount of money needed before cutting the bar into two parts with the same length.

Incorrect submission (verdict: Wrong Answer):
N = int(input())
A = list(map(int, input().split()))

left = 0
right = sum(A)
ans = 0
for a in A:
    left += a
    right -= a
    ans = min(ans, abs(left - right))

print(ans)


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

left = 0
right = sum(A)
ans = float('inf')
for a in A:
    left += a
    right -= a
    ans = min(ans, abs(left - right))

print(ans)
Problem:
Find the largest square number not exceeding N. Here, a _square number_ is an integer that can be represented as the square of an integer.

Incorrect submission (verdict: Wrong Answer):
# coding: utf-8
from math import sqrt
N = int(input())
print(int(sqrt(N)))

Fixed, accepted submission:
# coding: utf-8
from math import sqrt
N = int(input())
print(int(sqrt(N))**2)
Problem:
Snuke built an online judge to hold a programming contest.  When a program is submitted to the judge, the judge returns a verdict, which is a two-character string that appears in the string S as a contiguous substring. (The judge can return any two-character substring of S.)  Determine whether the judge can return the string `AC` as the verdict to a program.

Incorrect submission (verdict: Wrong Answer):
s = list(input())
for i in range(len(s)):
    if s[i] == "A":
        for j in range(i, len(s)):
            if s[j] == "C":
                print("YES")
                exit()
print("NO")

Fixed, accepted submission:
s = list(input())
for i in range(len(s)):
    if s[i] == "A":
        if s[i + 1] == "C":
            print("Yes")
            exit()
print("No")
Problem:
We have a grid of H rows and W columns of squares. The color of the square at the i-th row from the top and the j-th column from the left (1 \leq i \leq H, 1 \leq j \leq W) is given to you as a character c_{i,j}: the square is white if c_{i,j} is `.`, and black if c_{i,j} is `#`.  Consider doing the following operation:    * Choose some number of rows (possibly zero), and some number of columns (possibly zero). Then, paint red all squares in the chosen rows and all squares in the chosen columns.  You are given a positive integer K. How many choices of rows and columns result in exactly K black squares remaining after the operation? Here, we consider two choices different when there is a row or column chosen in only one of those choices.

Incorrect submission (verdict: Wrong Answer):
import itertools
h,w,k = map(int,input().split())
c = [[0]*w]*h
for i in range(h):
	c[i] = input()
	c[i] = list(c[i])

counter = 0	
ans = 0
b = 0
for (i,j) in itertools.product(range(h), range(w)):
	if c[i][j] == '#':
		b += 1
if b == k:
	ans += 1

for hl in range(1,h+1):
	for wl in range(1,w+1):
		for	hi in itertools.combinations(range(h),hl):
			for wj in itertools.combinations(range(w),wl):
				for i in hi:
					for j in range(w):
						if c[i][j] == '#':
							counter += 1
				for j in wj:
					for i in range(h):
						if c[i][j] == '#':
							counter += 1
				if b - counter == k:
					ans += 1
				counter = 0
for hl in range(h+1):
	for hi in itertools.combinations(range(h),hl):
		for i in hi:
			for j in range(w):
				if c[i][j] == '#':
					counter += 1
		if b - counter == k:
				ans += 1
				counter = 0
for wl in range(w+1):
	for wj in itertools.combinations(range(w),wl):
		for j in wj:
			for i in range(h):
				if c[i][j] == '#':
					counter += 1
		if b - counter == k:
				ans += 1
				counter = 0
print(ans)

Fixed, accepted submission:
import copy
import itertools
h,w,k = map(int,input().split())
c = [[0]*w]*h
for i in range(h):
	c[i] = input()
	c[i] = list(c[i])

counter = 0	
ans = 0
b = 0
for (i,j) in itertools.product(range(h), range(w)):
	if c[i][j] == '#':
		b += 1

for hl in range(h+1):
	for wl in range(w+1):
		for	hi in itertools.combinations(range(h),hl):
			for wj in itertools.combinations(range(w),wl):
				C = copy.deepcopy(c)
				for i in hi:
					for j in range(w):
						if C[i][j] == '#':
							counter += 1
							C[i][j] = '.'
				for j in wj:
					for i in range(h):
						if C[i][j] == '#':
							counter += 1
				if b - counter == k:
					ans += 1
				counter = 0
print(ans)
Problem:
We have a 3 \times 3 grid. A number c_{i, j} is written in the square (i, j), where (i, j) denotes the square at the i-th row from the top and the j-th column from the left.   According to Takahashi, there are six integers a_1, a_2, a_3, b_1, b_2, b_3 whose values are fixed, and the number written in the square (i, j) is equal to a_i + b_j.   Determine if he is correct.

Incorrect submission (verdict: Wrong Answer):
gridNumber = []
numbers = []
for i in range(3):
    gridNumber.append(list(map(int, input().split())))

a1=0
b1=gridNumber[0][0] - a1
b2=gridNumber[0][1] - a1
b3=gridNumber[0][2] - a1

a2=gridNumber[0][1] - b1
a3=gridNumber[0][2] - b1

numbers.append([a1+b1, a1+b2, a1+b3])
numbers.append([a2+b1, a2+b2, a2+b3])
numbers.append([a3+b1, a3+b2, a3+b3])

for i in range(3):
    for j in range(3):
        if not(numbers[i][j] == gridNumber[i][j]):
            print("No")
            quit()
        else:
            pass

print("Yes")




Fixed, accepted submission:
gridNumber = []
numbers = []
for i in range(3):
    gridNumber.append(list(map(int, input().split())))

a1=0
b1=gridNumber[0][0] - a1
b2=gridNumber[0][1] - a1
b3=gridNumber[0][2] - a1

a2=gridNumber[1][0] - b1
a3=gridNumber[2][0] - b1

numbers.append([a1+b1, a1+b2, a1+b3])
numbers.append([a2+b1, a2+b2, a2+b3])
numbers.append([a3+b1, a3+b2, a3+b3])

for i in range(3):
    for j in range(3):
        if not(numbers[i][j] == gridNumber[i][j]):
            print("No")
            quit()
        else:
            pass

print("Yes")
Problem:
AtCoDeer the deer is going on a trip in a two-dimensional plane. In his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i.  If AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1). Note that **he cannot stay at his place**. Determine whether he can carry out his plan.

Incorrect submission (verdict: Wrong Answer):
N=int(input())
ans=0
for i in range(N):
    t,x,y = map(int,input().split())
    if x+y<=t and t%2==(x+y)%2:
        print('No')
        exit() 
print('Yes')

Fixed, accepted submission:
n=int(input())
for _ in range(n):
    t, x, y = map(int, input().split())
    if  x + y > t or (t -x -y) % 2:
        print("No")
        exit() 
print("Yes")
Problem:
Takahashi, who works at DISCO, is standing before an iron bar. The bar has N-1 notches, which divide the bar into N sections. The i-th section from the left has a length of A_i millimeters.  Takahashi wanted to choose a notch and cut the bar at that point into two parts with the same length. However, this may not be possible as is, so he will do the following operations some number of times **before** he does the cut:    * Choose one section and expand it, increasing its length by 1 millimeter. Doing this operation once costs 1 yen (the currency of Japan).   * Choose one section of length at least 2 millimeters and shrink it, decreasing its length by 1 millimeter. Doing this operation once costs 1 yen.  Find the minimum amount of money needed before cutting the bar into two parts with the same length.

Incorrect submission (verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))
harf=sum(a)//2
l,r,i=0,a[0],0
while r<harf:
    i+=1
    l=r
    r+=a[i]
print(min(harf-l,r-harf))

Fixed, accepted submission:
n=int(input())
a=list(map(int,input().split()))
harf=sum(a)/2
l,r,i=0,a[0],0
while r<harf:
    i+=1
    l=r
    r+=a[i]
print(int(min(harf-l,r-harf)*2))
Problem:
Iroha is very particular about numbers. There are K digits that she dislikes: D_1, D_2, ..., D_K.  She is shopping, and now paying at the cashier. Her total is N yen (the currency of Japan), thus she has to hand at least N yen to the cashier (and possibly receive the change).  However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.  Find the amount of money that she will hand to the cashier.

Incorrect submission (verdict: Wrong Answer):
import re

#input_1st="1000 8"
#input_2nd="1 3 4 5 6 7 8 9"
input_1st=input()
input_2nd=input()

N, K = input_1st.split(" ")
D = input_2nd.split(" ")

pattern = re.compile("|".join(D))
print(pattern)

for ans in range(int(N), 10000):
    result = re.findall(pattern, str(ans))
    if not result:
        print(ans)
        break

Fixed, accepted submission:
input_1st=input()
input_2nd=input()

N, K = input_1st.split(" ")
D = input_2nd.split(" ")

for ans in range(int(N), 100000):
    flg = True
    for i in range(len(str(ans))):
        if str(ans)[i] in D:
          flg = False
          break

    if flg:
        print(ans)
        break
Problem:
Snuke has a favorite restaurant.  The price of any meal served at the restaurant is 800 yen (the currency of Japan), and each time a customer orders 15 meals, the restaurant pays 200 yen back to the customer.  So far, Snuke has ordered N meals at the restaurant. Let the amount of money Snuke has paid to the restaurant be x yen, and let the amount of money the restaurant has paid back to Snuke be y yen. Find x-y.

Incorrect submission (verdict: Wrong Answer):
N = int(input())

x = 800 * N
y = (N % 15) * 200

print(x - y)

Fixed, accepted submission:
N = int(input())

x = 800 * N
y = (N // 15) * 200

print(x - y)
Problem:
Taro's summer vacation starts tomorrow, and he has decided to make plans for it now.  The vacation consists of N days. For each i (1 \leq i \leq N), Taro will choose one of the following activities and do it on the i-th day:    * A: Swim in the sea. Gain a_i points of happiness.   * B: Catch bugs in the mountains. Gain b_i points of happiness.   * C: Do homework at home. Gain c_i points of happiness.  As Taro gets bored easily, he cannot do the same activities for two or more consecutive days.  Find the maximum possible total points of happiness that Taro gains.

Incorrect submission (verdict: Wrong Answer):
N = int(input())
lis = [list(map(int, input().split())) for _ in range(N)]
dp = [[0]*3 for _ in range(N+1)]
for k in range(3):
    dp[1][k] = lis[0][k]
print(dp)
for i in range(2, N+1):
    dp[i][0] = max(dp[i-1][1] + lis[i-1][1], dp[i-1][2] + lis[i-1][2])
    dp[i][1] = max(dp[i-1][0] + lis[i-1][0], dp[i-1][2] + lis[i-1][2])
    dp[i][2] = max(dp[i-1][0] + lis[i-1][0], dp[i-1][1] + lis[i-1][1])
    print(dp)
print(max(dp[N]))

Fixed, accepted submission:
N = int(input())
lis = [list(map(int, input().split())) for _ in range(N)]
dp = [[0]*3 for _ in range(N+1)]
for k in range(3):
    dp[1][k] = lis[0][k]
for i in range(2, N+1):
    dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + lis[i-1][0]
    dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + lis[i-1][1]
    dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + lis[i-1][2]
print(max(dp[N]))
Problem:
You are given strings s and t, consisting of lowercase English letters. You will create a string s' by freely rearranging the characters in s. You will also create a string t' by freely rearranging the characters in t. Determine whether it is possible to satisfy s' < t' for the lexicographic order.

Incorrect submission (verdict: Wrong Answer):
s = input()
t = input()

s = sorted(s)
t = sorted(t)

if s < t:
    print('Yes')
else:
    print('No')

Fixed, accepted submission:
s = input()
t = input()

s = sorted(s)
t = sorted(t, reverse=True)

if s < t:
    print('Yes')
else:
    print('No')
Problem:
Write a program which reads two integers a, b and an operator op, and then prints the value of a op b.  The operator op is '+', '-', '*' or '/' (sum, difference, product or quotient). The division should truncate any fractional part.

Incorrect submission (verdict: Wrong Answer):
a,op,b=input().split()
a=int(a)
b=int(b)
if op=='+':
  print(a+b)
elif op=='-':
  print(a-b)
elif op=='*':
  print(a*b)
elif op=='/':
  print(a//b)
else:
  pass


Fixed, accepted submission:
while 1:
  a,op,b = input().split()
  a = int(a)
  b = int(b)
  if op == "?":
    break
  else:
    if op == "+":
      x = a + b
      print(x)
    elif op == "-":
      x = a - b
      print(x)
    elif op == "*":
      x = a * b
      print(x)
    elif op == "/":
      x = a // b
      print(x)
    else:
      pass
Problem:
Let {\rm comb}(n,r) be the number of ways to choose r objects from among n objects, disregarding order. From n non-negative integers a_1, a_2, ..., a_n, select two numbers a_i > a_j so that {\rm comb}(a_i,a_j) is maximized. If there are multiple pairs that maximize the value, any of them is accepted.

Incorrect submission (verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))
b=max(a)
c=b
d=0
for i in a:
  if c<abs(b/2-i):c=abs(b/2-i);d=i
print(b,d)

Fixed, accepted submission:
n=int(input())
a=list(map(int,input().split()))
b=max(a)
c=b
d=0
for i in a:
  if c>=abs(b/2-i):c=abs(b/2-i);d=i
print(b,d)
Problem:
You are given three strings A, B and C. Check whether they form a _word chain_.  More formally, determine whether both of the following are true:    * The last character in A and the initial character in B are the same.   * The last character in B and the initial character in C are the same.  If both are true, print `YES`. Otherwise, print `NO`.

Incorrect submission (verdict: Wrong Answer):
a,b,c = input().split()
print('YNeos'[a[-1]!=b[0]or b[-1]!=c[0]::2])

Fixed, accepted submission:
a,b,c = input().split()
print('YNEOS'[a[-1]!=b[0] or b[-1]!=c[0]::2])
Problem:
E869120 has A 1-yen coins and infinitely many 500-yen coins.   Determine if he can pay exactly N yen using only these coins.

Incorrect submission (verdict: Wrong Answer):
def calc():

    amari = N % 500

    if amari >= A:
        return"Yes"

    else:
        return"No"

N = int(input())
A = int(input())

print(calc())

Fixed, accepted submission:
def calc():

    amari = N % 500

    if amari <= A:
        return"Yes"

    else:
        return"No"

N = int(input())
A = int(input())

print(calc())
Problem:
The International Competitive Programming College (ICPC) is famous for its research on competitive programming. Applicants to the college are required to take its entrance examination.  The successful applicants of the examination are chosen as follows.    * The score of any successful applicant is higher than that of any unsuccessful applicant.   * The number of successful applicants _n_ must be between _n_ min and _n_ max, inclusive. We choose _n_ within the specified range that maximizes the _gap._ Here, the _gap_ means the difference between the lowest score of successful applicants and the highest score of unsuccessful applicants.    * When two or more candidates for _n_ make exactly the same _gap,_ use the greatest _n_ among them.  Let's see the first couple of examples given in Sample Input below. In the first example, _n_ min and _n_ max are two and four, respectively, and there are five applicants whose scores are 100, 90, 82, 70, and 65. For _n_ of two, three and four, the gaps will be 8, 12, and 5, respectively. We must choose three as _n_ , because it maximizes the gap.  In the second example, _n_ min and _n_ max are two and four, respectively, and there are five applicants whose scores are 100, 90, 80, 75, and 65. For _n_ of two, three and four, the gap will be 10, 5, and 10, respectively. Both two and four maximize the gap, and we must choose the greatest number, four.  You are requested to write a program that computes the number of successful applicants that satisfies the conditions.

Incorrect submission (verdict: Wrong Answer):
while True:
    P = list()
    ans = list()
    tans = list()
    m, Mn, Mx = map(int, input().split())
    if m == 0 and Mn == 0 and Mx == 0:
        break
    for i in range(0, m):
        P.append(int(input()))

    for j in range(Mn-1, Mx, 1):
        ans.append(P[j]-P[j+1])
    print(ans)
    for k in range(0,len(ans)):
        if ans[k] == max(ans):
            tans.append(k)
    print(tans)
    print(max(tans)+Mn)



Fixed, accepted submission:
while True:
    P = list()
    ans = list()
    tans = list()
    m, Mn, Mx = map(int, input().split())
    if m == 0 and Mn == 0 and Mx == 0:
        break
    for i in range(0, m):
        P.append(int(input()))

    for j in range(Mn-1, Mx, 1):
        ans.append(P[j]-P[j+1])
    #print(ans)
    for k in range(0,len(ans)):
        if ans[k] == max(ans):
            tans.append(k)
    #print(tans)
    print(max(tans)+Mn)
Problem:
There is a hotel with the following accommodation fee:    * X yen (the currency of Japan) per night, for the first K nights   * Y yen per night, for the (K+1)-th and subsequent nights  Tak is staying at this hotel for N consecutive nights. Find his total accommodation fee.

Incorrect submission (verdict: Wrong Answer):
n=int(input())
k=int(input())
x=int(input())
y=int(input())
if n<=k:
  print (n*x)
else:
  print (n*k+y*(n-k))

Fixed, accepted submission:
n=int(input())
k=int(input())
x=int(input())
y=int(input())
if n<=k:
  print (n*x)
else:
  print (x*k+y*(n-k))
Problem:
Snuke has a favorite restaurant.  The price of any meal served at the restaurant is 800 yen (the currency of Japan), and each time a customer orders 15 meals, the restaurant pays 200 yen back to the customer.  So far, Snuke has ordered N meals at the restaurant. Let the amount of money Snuke has paid to the restaurant be x yen, and let the amount of money the restaurant has paid back to Snuke be y yen. Find x-y.

Incorrect submission (verdict: Wrong Answer):
n = int(input())
x =n*800
y =n*200/15
print(x-y)

Fixed, accepted submission:
n = int(input())
x =n*800
y =200*(n//15)
print(x-y)
Problem:
You are given two positive integers A and B. Compare the magnitudes of these numbers.

Incorrect submission (verdict: Wrong Answer):
A=int(input())
B=int(input())
if A>B:
 print ('greater')
elif A<B:
 print ('less')
else:
 print ('equal')


Fixed, accepted submission:
A=int(input())
B=int(input())
if A>B:
 print ('GREATER')
elif A<B:
 print ('LESS')
else:
 print ('EQUAL')
Problem:
You can obtain profits from foreign exchange margin transactions. For example, if you buy 1000 dollar at a rate of 100 yen per dollar, and sell them at a rate of 108 yen per dollar, you can obtain (108 - 100) × 1000 = 8000 yen.  Write a program which reads values of a currency $R_t$ at a certain time $t$ ($t = 0, 1, 2, ... n-1$), and reports the maximum value of $R_j - R_i$ where $j > i$ .

Incorrect submission (verdict: Wrong Answer):
# -*- coding: utf-8 -*-
"""
Created on Sun Aug 28 21:09:30 2016

@author: you
"""

n = int(input())


maxv = 0
minv = 10000000
price = 0

for i in range(n):
    x = int(input())
    if x < minv:
        minv = x
    if x > maxv:
        maxv = x
    if price < maxv - minv:
        price = maxv - minv

print(price)

Fixed, accepted submission:
# -*- coding: utf-8 -*-
"""
Created on Sun Aug 28 21:09:30 2016

@author: you
"""

n = int(input())

b = int(input())
maxv = b
minv = b

price = -1000000000

for i in range(n-1):
    x = int(input())
    flag = (x-b > 0)
    if flag:
        price = max(price, x-minv)
    else:
        if x < minv:
            minv = x
            maxv = x
        if price < x-b:
            price = x-b
    b = x

print(price)
Problem:
You are given nonnegative integers a and b (a ≤ b), and a positive integer x. Among the integers between a and b, inclusive, how many are divisible by x?

Incorrect submission (verdict: Wrong Answer):
a, b, x = map(int, input().split())

ans = 0
p = a
while p <= b:
    if p%x == 0:
        break
    p += 1

ans = ((b-p)/x) + 1

print(ans)

Fixed, accepted submission:
a, b, x = map(int, input().split())

p = 0
y = int(b//x) + 1

i = 1

while x*i <= b:
    if a <= x*i:
        p = x*i
        break
    i += 1

if p != 0:
    t = b-p
    s = t//x
    ans = s + 1
    if a == 0:
        ans += 1
    print(ans)
elif a == 0:
    print(1)
else:
    print(0)