TnT/CodeNet4Repair huggingface dataset:
Problem:
Let f(n) be the number of triples of integers (x,y,z) that satisfy both of the following conditions:    * 1 \leq x,y,z   * x^2 + y^2 + z^2 + xy + yz + zx = n  Given an integer N, find each of f(1),f(2),f(3),\ldots,f(N).

Incorrect submission (verdict: Wrong Answer):
N = int(input())
ans = [0 for _ in range(N + 1)]

for x in range(1, 100):
  for y in range(1, 100):
    for z in range(1, 100):
      v = x * x + y * y + z * z  + x * y + y * z + z * x
      if v < N:
        ans[v] += 1

for i in range(N):
  print(ans[i])

Fixed, accepted submission:
N = int(input())
ans = [0 for _ in range(N + 1)]

for x in range(1, 101):
  for y in range(1, 101):
    for z in range(1, 101):
      v = x * x + y * y + z * z  + x * y + y * z + z * x
      if v > N:
        continue
      ans[v - 1] += 1

for i in range(N):
  print(ans[i])
Problem:
E869120 found a chest which is likely to contain treasure.   However, the chest is locked. In order to open it, he needs to enter a string S consisting of lowercase English letters.   He also found a string S', which turns out to be the string S with some of its letters (possibly all or none) replaced with `?`.  One more thing he found is a sheet of paper with the following facts written on it:    * Condition 1: The string S contains a string T as a contiguous substring.   * Condition 2: S is the lexicographically smallest string among the ones that satisfy Condition 1.  Print the string S.   If such a string does not exist, print `UNRESTORABLE`.

Incorrect submission (verdict: Wrong Answer):
s=input()
t=input()
if t in s:
    ans=s.replace("?","a")
    print(ans)

Fixed, accepted submission:
s=input()
t=input()
for i in range(len(t)-1,len(s))[::-1]:
    if s[i]==t[-1] or s[i]=="?":
        if all(s[i-j]==t[-1-j] or s[i-j]=="?" for j in range(len(t))):
            s=s.replace("?","a")
            print(s[:i-len(t)+1]+t+s[i+1:])
            exit()
print("UNRESTORABLE")
Problem:
We have a board with H horizontal rows and W vertical columns of squares. There is a bishop at the top-left square on this board. How many squares can this bishop reach by zero or more movements?  Here the bishop can only move diagonally. More formally, the bishop can move from the square at the r_1-th row (from the top) and the c_1-th column (from the left) to the square at the r_2-th row and the c_2-th column if and only if exactly one of the following holds:    * r_1 + c_1 = r_2 + c_2   * r_1 - c_1 = r_2 - c_2  For example, in the following figure, the bishop can move to any of the red squares in one move:  

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

a = inp[0]*inp[1]

if (a %2 == 1):
    b = int(a/2)+1
else:
    b = a/2

print(b)


Fixed, accepted submission:
inp = list(map(int,input().split()))
 
a = inp[0]*inp[1]

if (inp[0]==1 or inp[1]==1):
    print("1")
else:
    if (a %2 == 1):
        b = int(a/2)+1
        print('{:.19g}'.format(b))
    else:
        b = a/2
        print('{:.19g}'.format(b))
Problem:
Snuke has decided to construct a string that starts with `A` and ends with `Z`, by taking out a substring of a string s (that is, a consecutive part of s).  Find the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with `A` and ends with `Z`.

Incorrect submission (verdict: Wrong Answer):
s=input()
st=s.find("A")
ed=s.rfind("Z")
print(s[st:ed+1])

Fixed, accepted submission:
s=input()
st=s.find("A")
ed=s.rfind("Z")
print(len(s[st:ed+1]))
Problem:
Taro is going to play a card game. However, now he has only n cards, even though there should be 52 cards (he has no Jokers).  The 52 cards include 13 ranks of each of the four suits: spade, heart, club and diamond.

Incorrect submission (verdict: Wrong Answer):
d = {"S":[1,2,3,4,5,6,7,8,9,10,11,12,13],
     "H":[1,2,3,4,5,6,7,8,9,10,11,12,13],
     "D":[1,2,3,4,5,6,7,8,9,10,11,12,13],
     "C":[1,2,3,4,5,6,7,8,9,10,11,12,13]}
n = int(input())
for i in range(n):
    N, M = map(str,input().split())
    d[N][int(M)-1] ="None"
print("Answer")
for j in range(len(d)):
    if j==1:
        list_d = d["S"]
        c = "S"
    elif j == 2:
        list_d = d["H"]
        c = "H"
    elif j == 3:
        list_d = d["C"]
        c = "C"
    else:
        list_d = d["D"]
        c = "D"
    for i in range(len(list_d)):
        if(list_d[i] != "None"):
            print(c , list_d[i])


Fixed, accepted submission:
d = {"S":[1,2,3,4,5,6,7,8,9,10,11,12,13],
     "H":[1,2,3,4,5,6,7,8,9,10,11,12,13],
     "C":[1,2,3,4,5,6,7,8,9,10,11,12,13],
     "D":[1,2,3,4,5,6,7,8,9,10,11,12,13]}
n = int(input())
for i in range(n):
    N, M = map(str,input().split())
    d[N][int(M)-1] ="None"

for j in range(len(d)):
    if j==0:
        list_d = d["S"]
        c = "S"
    elif j == 1:
        list_d = d["H"]
        c = "H"
    elif j == 2:
        list_d = d["C"]
        c = "C"
    else:
        list_d = d["D"]
        c = "D"
    for i in range(len(list_d)):
        if(list_d[i] != "None"):
            print(c , list_d[i])
Problem:
Takahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank.  The bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.)  Assuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or above for the first time?

Incorrect submission (verdict: Wrong Answer):
x = int(input())
a = 100
import sys
for i in range(10**7):
  a = int(a*1.01)
  if a>x:
    print(i+1)
    sys.exit()

Fixed, accepted submission:
x = int(input())
a = 100

import sys
for i in range(10**7):
  a = int(a*1.01)
  if a>=x:
    print(i+1)
    sys.exit()
Problem:
Given an integer N not less than 3, find the sum of the interior angles of a regular polygon with N sides.  Print the answer in degrees, but do not print units.

Incorrect submission (verdict: Wrong Answer):
l = list(map(str, input().split()))
if(l.count("x") < 8):
    print("YES")
else:
    print("NO")

Fixed, accepted submission:

l = int(input())
print(180*(l-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):
n = int(input())
a = int(input())
print('Yes' if (-n%500)<=a else 'No')

Fixed, accepted submission:
n = int(input())
a = int(input())
print('Yes' if (n%500)<=a else 'No')
Problem:
Two students of AtCoder Kindergarten are fighting over candy packs.  There are three candy packs, each of which contains a, b, and c candies, respectively.  Teacher Evi is trying to distribute the packs between the two students so that each student gets the same number of candies. Determine whether it is possible.  Note that Evi cannot take candies out of the packs, and the whole contents of each pack must be given to one of the students.

Incorrect submission (verdict: Wrong Answer):
a, b, c = map(int, input().split())
if a+b==c or b+c==a or c+a==b:
	print("YES")
else:
  print("NO")

Fixed, accepted submission:
a, b, c = map(int, input().split())
if a+b==c or b+c==a or c+a==b:
	print("Yes")
else:
    print("No")
Problem:
Print all the integers that satisfies the following in ascending order:    * Among the integers between A and B (inclusive), it is either within the K smallest integers or within the K largest integers.

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

for i in range(k):
    print(a + k)

for i in range(k):
    print(b - (k - 1) + i)

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

for i in range(k):
    if i == 0:
        ans = [a + i]
    else:
        if a + i <= b:
            ans.append(a + i)
        else:
            break
            
for i in range(k):
    p = b - (k - 1) + i
    if p < a:
        break
    
    elif p not in ans:
        ans.append(p)
        
    else:
        continue


for i in range(len(ans)):
    print(ans[i])
Problem:
In 2937, DISCO creates a new universe called DISCOSMOS to celebrate its 1000-th anniversary.  DISCOSMOS can be described as an H \times W grid. Let (i, j) (1 \leq i \leq H, 1 \leq j \leq W) denote the square at the i-th row from the top and the j-th column from the left.  At time 0, one robot will be placed onto each square. Each robot is one of the following three types:    * Type-H: Does not move at all.   * Type-R: If a robot of this type is in (i, j) at time t, it will be in (i, j+1) at time t+1. If it is in (i, W) at time t, however, it will be instead in (i, 1) at time t+1. (The robots do not collide with each other.)   * Type-D: If a robot of this type is in (i, j) at time t, it will be in (i+1, j) at time t+1. If it is in (H, j) at time t, however, it will be instead in (1, j) at time t+1.  There are 3^{H \times W} possible ways to place these robots. In how many of them will every square be occupied by one robot at times 0, T, 2T, 3T, 4T, and all subsequent multiples of T?  Since the count can be enormous, compute it modulo (10^9 + 7).

Incorrect submission (verdict: Wrong Answer):
def gcd(x,y):
    if x<y:
        x,y=y,x
    if y==0:
        return x
    else:
        return gcd(y,x%y)
    
H,W,T=map(int,input().split())
mod=10**9+7

h=gcd(H,T)
w=gcd(W,T)
H//=h
W//=w

print(h,w,H,W)
ans=pow(2,H,mod)+pow(2,W,mod)+pow(2,gcd(H,W),mod)-3
print(pow(ans,h*w,mod))

Fixed, accepted submission:
def gcd(x,y):
    if x<y:
        x,y=y,x
    if y==0:
        return x
    else:
        return gcd(y,x%y)
    
H,W,T=map(int,input().split())
mod=10**9+7

h=gcd(H,T)
w=gcd(W,T)
H//=h
W//=w

ans=pow(2,H,mod)+pow(2,W,mod)+pow(2,gcd(H,W),mod)-3
print(pow(ans,h*w,mod))
Problem:
You manage 4 buildings, each of which has 3 floors, each of which consists of 10 rooms. Write a program which reads a sequence of tenant/leaver notices, and reports the number of tenants for each room.  For each notice, you are given four integers b, f, r and v which represent that v persons entered to room r of fth floor at building b. If v is negative, it means that −v persons left.  Assume that initially no person lives in the building.

Incorrect submission (verdict: Wrong Answer):
array=[[0 for i in range(10)]for j in range(12)]
n=int(input())

for i in range(n):
    call=list(map(int,input().split()))
    array[(call[0]-1)*3-1+call[1]][call[2]-1]+=call[3]
for i in range(0,12):
    if i%3==0 and i!=0:
        for j in range(10):
            print("#",end=" ")
        print()
    for j in range(10):
        print(array[i][j],end=" ")
    print()

Fixed, accepted submission:
array=[[0 for i in range(10)]for j in range(12)]
n=int(input())

for i in range(n):
    call=list(map(int,input().split()))
    array[(call[0]-1)*3-1+call[1]][call[2]-1]+=call[3]
for i in range(0,12):
    if i%3==0 and i!=0:
        for j in range(20):
            print("#",end="")
        print()
    for j in range(10):
        print(" "+str(array[i][j]),end="")
    print()
Problem:
Print all the integers that satisfies the following in ascending order:    * Among the integers between A and B (inclusive), it is either within the K smallest integers or within the K largest integers.

Incorrect submission (verdict: Wrong Answer):
a, b, k = map(int, input().split())
ans = []

for i in range(k):
    if a + i > b - i:
        break
    ans.append(a + i)
    ans.append(b - i)

for i in set(ans):
    print(i)

Fixed, accepted submission:
a, b, k = map(int, input().split())
ans = []

for i in range(k):
    if a + i > b - i:
        break
    ans.append(a + i)
    ans.append(b - i)

for i in sorted(set(ans)):
    print(i)
Problem:
We ask you to select some number of positive integers, and calculate the sum of them.  It is allowed to select as many integers as you like, and as large integers as you wish. You have to follow these, however: each selected integer needs to be a multiple of A, and you need to select at least one integer.  Your objective is to make the sum congruent to C modulo B. Determine whether this is possible.  If the objective is achievable, print `YES`. Otherwise, print `NO`.

Incorrect submission (verdict: Wrong Answer):
v = input().split(" ")

a = int(v[0])
b = int(v[1])
c = int(v[2])

amari = []

tmp1 = 0
tmp2 = 0

for i in range(1, b + 1, 1):
    
    tmp1 += a
    
    amari.append(tmp1 % b)

if c in amari:
    print("Yes")
else:
  print("No")

Fixed, accepted submission:
v = input().split(" ")

a = int(v[0])
b = int(v[1])
c = int(v[2])

amari = []

tmp1 = 0
tmp2 = 0

for i in range(1, b + 1, 1):
    
    tmp1 += a
    
    amari.append(tmp1 % b)

if c in amari:
  print("YES")
else:
  print("NO")
Problem:
Square1001 has seen an electric bulletin board displaying the integer 1. He can perform the following operations A and B to change this value:    * Operation A: The displayed value is doubled.   * Operation B: The displayed value increases by K.  Square1001 needs to perform these operations N times in total. Find the minimum possible value displayed in the board after N operations.

Incorrect submission (verdict: Time Limit Exceeded):
n = int(input())
k = int(input())
s = 1
while n > 0:
  if s < k:
    s = s*2
  else:
    s += k
print(s)

Fixed, accepted submission:
n = int(input())
k = int(input())
s = 1
while n > 0:
  if s < k:
    s = s*2
  else:
    s += k
  n -= 1
print(s)
Problem:
You manage 4 buildings, each of which has 3 floors, each of which consists of 10 rooms. Write a program which reads a sequence of tenant/leaver notices, and reports the number of tenants for each room.  For each notice, you are given four integers b, f, r and v which represent that v persons entered to room r of fth floor at building b. If v is negative, it means that −v persons left.  Assume that initially no person lives in the building.

Incorrect submission (verdict: Wrong Answer):
rooms = [0] * (4*3*10)
count = int(input())
for i in range(count):
    b, f, r, v = [int(x) for x in input().split()]
    rooms[30*(b-1) + 10*(f-1) + r] += v

for i, room in enumerate(rooms):
    if i%30 == 0:
        print('#'*20)
    if (i+1)%10 == 0:
        print(room)
    else:
        print(room, end=' ')

Fixed, accepted submission:
rooms = [0] * (4*3*10)
count = int(input())
for i in range(count):
    b, f, r, v = [int(x) for x in input().split()]
    rooms[30*(b-1) + 10*(f-1) + (r-1)] += v
  
for i, room in enumerate(rooms, start=1):
    print('', room, end='')
    if i%10 == 0:
        print()
    if i%30 == 0 and i%120 != 0:
        print('#'*20)
Problem:
AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.

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

if a * b // 2 == 0:
    print("Even")
else:
    print("Odd")






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

if a * b % 2 == 0:
    print("Even")
else:
    print("Odd")
Problem:
There is a rectangle in the xy-plane, with its lower left corner at (0, 0) and its upper right corner at (W, H). Each of its sides is parallel to the x-axis or y-axis. Initially, the whole region within the rectangle is painted white.  Snuke plotted N points into the rectangle. The coordinate of the i-th (1 ≦ i ≦ N) point was (x_i, y_i).  Then, he created an integer sequence a of length N, and for each 1 ≦ i ≦ N, he painted some region within the rectangle black, as follows:    * If a_i = 1, he painted the region satisfying x < x_i within the rectangle.   * If a_i = 2, he painted the region satisfying x > x_i within the rectangle.   * If a_i = 3, he painted the region satisfying y < y_i within the rectangle.   * If a_i = 4, he painted the region satisfying y > y_i within the rectangle.  Find the area of the white region within the rectangle after he finished painting.

Incorrect submission (verdict: Wrong Answer):
W, H, N = map(int, input().split())
left_under = (0, 0)
right_top = (W, H)
for _ in range(N):
	x, y, a = map(int, input().split())
	if a == 1:
		left_under = (x, left_under[1])
	elif a == 2:
		right_top = (x, right_top[1])
	elif a == 3:
		left_under = (left_under[0], y)
	elif a == 4:
		right_top = (right_top[1], y)

if right_top[0] - left_under[0] <= 0 or right_top[1] - left_under[1] <= 0:
	print(0)
else:
	print((right_top[0] - left_under[0])*(right_top[1] - left_under[1]))

Fixed, accepted submission:
W, H, N = map(int, input().split())
left_under = (0, 0)
right_top = (W, H)
for _ in range(N):
	x, y, a = map(int, input().split())
	if a == 1:
		left_under = (max([x, left_under[0]]), left_under[1])
	elif a == 2:
		right_top = (min([x,right_top[0]]), right_top[1])
	elif a == 3:
		left_under = (left_under[0], max([y,left_under[1]]))
	elif a == 4:
		right_top = (right_top[0], min([y,right_top[1]]))
 
if right_top[0] - left_under[0] <= 0 or right_top[1] - left_under[1] <= 0:
	print(0)
else:
	print((right_top[0] - left_under[0])*(right_top[1] - left_under[1]))
Problem:
We will buy a product for N yen (the currency of Japan) at a shop.  If we use only 1000-yen bills to pay the price, how much change will we receive?  Assume we use the minimum number of bills required.

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

Fixed, accepted submission:
N=int(input())
if N%1000>0:
    print(1000-N%1000)
else:
    print(0)
Problem:
Our world is one-dimensional, and ruled by two empires called Empire A and Empire B.  The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y.  One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes inclined to put the cities at coordinates y_1, y_2, ..., y_M under its control.  If there exists an integer Z that satisfies all of the following three conditions, they will come to an agreement, but otherwise war will break out.    * X < Z \leq Y   * x_1, x_2, ..., x_N < Z   * y_1, y_2, ..., y_M \geq Z  Determine if war will break out.

Incorrect submission (verdict: Wrong Answer):
n,m,X,Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
x.append(X)
y.append(Y)
x.sort()
y.sort()
if x[-1] < y[0]:
        print("NO WAR")
else:
        print("WAR")

Fixed, accepted submission:
n,m,X,Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
x.append(X)
y.append(Y)
if max(x) < min(y):
        print("No War")
else:
        print("War")
Problem:
Your task is to perform a simple table calculation.  Write a program which reads the number of rows r, columns c and a table of r × c elements, and prints a new table, which includes the total sum for each row and column.

Incorrect submission (verdict: Wrong Answer):
r,c = map(int,input().split())
total = 0
for i in range(r):
    li = list(map(int,input().split()))
    sub = sum(li)
    li.append(sub)
    total += sub
    if i == r-1 : li.append(total)
    strli = " ".join([str(i) for i in li])
    print(strli)

Fixed, accepted submission:
r,c = map(int,input().split())
rc=[]
total=[]
for _ in range(r): rc.append(list(map(int,input().split())))
for i in range(r): rc[i].append(sum(rc[i]))
for i in zip(*rc): total.append(sum(i))
rc.append(total)
for col in rc: print(*col)
Problem:
Two children are playing tag on a number line. (In the game of tag, the child called "it" tries to catch the other child.) The child who is "it" is now at coordinate A, and he can travel the distance of V per second. The other child is now at coordinate B, and she can travel the distance of W per second.  He can catch her when his coordinate is the same as hers. Determine whether he can catch her within T seconds (including exactly T seconds later). We assume that both children move optimally.

Incorrect submission (verdict: Wrong Answer):
A,V = map(int,input().split())
B,W = map(int,input().split())
T = int(input())
if A<B and (V-W)*T>B-A:
    print("Yes")
elif A>B and (V-W)*T>A-B:
    print("Yes")
else:
    print("No")


Fixed, accepted submission:
A,V = map(int,input().split())
B,W = map(int,input().split())
T = int(input())
if A<B and (V-W)*T>=B-A:
    print("YES")
elif A>B and (V-W)*T>=A-B:
    print("YES")
else:
    print("NO")
Problem:
Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters.  Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s.  Given the name of the contest, print the abbreviation of the name.

Incorrect submission (verdict: Wrong Answer):
A,B,C=input().split()
print(B[0])

Fixed, accepted submission:
A,B,C=input().split()
print("A"+B[0]+"C")
Problem:
You are given three integers A, B and C.  Determine if there exists an equilateral triangle whose sides have lengths A, B and C.

Incorrect submission (verdict: Wrong Answer):
ABC = list(map(int, input().split()))
if ABC[0] + ABC[1] < ABC[2] or ABC[1] + ABC[2] < ABC[0] or ABC[0] + ABC[2] < ABC[1]:
  print("Yes")
else:
  print("No")

Fixed, accepted submission:
ABC = list(map(int, input().split()))
if ABC[0] == ABC[1] and ABC[1]==ABC[2] and ABC[2]==ABC[0]:
  print("Yes")
else:
  print("No")
Problem:
There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs.  Determine if it is possible that there are exactly X cats among these A + B animals.

Incorrect submission (verdict: Wrong Answer):
cat, hatena, x = map(int, input().split()) 
kakutei_cat = cat - x
if kakutei_cat >= hatena:
  print('YES')
else:
  print('NO')

Fixed, accepted submission:
a, b, x = map(int, input().split()) 
if a <= x <= a + b:
  print('YES')
else:
  print('NO')
Problem:
Sitting in a station waiting room, Joisino is gazing at her train ticket.  The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive).  In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds.  The given input guarantees that there is a solution. If there are multiple solutions, any of them will be accepted.

Incorrect submission (verdict: Wrong Answer):
# -*- coding: utf-8 -*-
from itertools import product
import sys
 
def main(A, B, C, D):
    for op1, op2, op3 in product(("+", "-"), repeat=3):
        e = A + op1 + B + op2 + C + op3 + D
        print(e)
        x = eval(e)
        if x == 7:
            print(e + "=7")
            sys.exit()
    
if(__name__ == "__main__"):
    A, B, C, D = list(input())
    
    main(A, B, C, D)

Fixed, accepted submission:
# -*- coding: utf-8 -*-
 
def main(S):
    for i in range(1 << len(S)):
        st = str(S[0])
        num = int(S[0])
        for j in range(len(S)-1):
            if((i >> j) & 1):
                st = st + "+" + str(S[j+1])
                num += int(S[j+1])
            else:
                st = st + "-" + str(S[j+1])
                num -= int(S[j+1])
        if(num == 7):
            print(st + "=7")
            break
    
if(__name__ == "__main__"):
    S = list(input())
    
    main(S)
Problem:
You have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan). In how many ways can we select some of these coins so that they are X yen in total?  Coins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that coin are different.

Incorrect submission (verdict: Wrong Answer):
A = int(input()) 
B = int(input()) 
C = int(input()) 
X = int(input()) 

count = 0
a = 0
b = 0
c = 0
while a <= A:
    a += 1
    while b <= B:
        b +=1
        while c <= C:
            c +=1
            total = 500 * a + 100 * b + 50 * c
            if total == X:
                count += 1
print(count)


Fixed, accepted submission:
A = int(input()) 
B = int(input()) 
C = int(input()) 
X = int(input()) 

count = 0
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            total = 500 * a + 100 * b + 50 * c
            if total == X:
                count += 1
print(count)