TnT/CodeNet4Repair huggingface dataset:
Problem:
Three poles stand evenly spaced along a line. Their heights are a, b and c meters, from left to right. We will call the arrangement of the poles _beautiful_ if the tops of the poles lie on the same line, that is, b-a = c-b.  Determine whether the arrangement of the poles is beautiful.

Incorrect submission (verdict: Wrong Answer):

a, b, c = map(int, input().split())


if b-a == c-b:
    print('Yes')
else:
    print('No')

Fixed, accepted submission:

a, b, c = map(int, input().split())


if b-a == c-b:
    print('YES')
else:
    print('NO')
Problem:
Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has 3 keys on it: the `0` key, the `1` key and the backspace key.  To begin with, he is using a plain text editor with this keyboard. This editor always displays one string (possibly empty). Just after the editor is launched, this string is empty. When each key on the keyboard is pressed, the following changes occur to the string:    * The `0` key: a letter `0` will be inserted to the right of the string.   * The `1` key: a letter `1` will be inserted to the right of the string.   * The backspace key: if the string is empty, nothing happens. Otherwise, the rightmost letter of the string is deleted.  Sig has launched the editor, and pressed these keys several times. You are given a string s, which is a record of his keystrokes in order. In this string, the letter `0` stands for the `0` key, the letter `1` stands for the `1` key and the letter `B` stands for the backspace key. What string is displayed in the editor now?

Incorrect submission (verdict: Wrong Answer):
words="010B"
s=""
for word in words:
    if word=="B":
        s=s[:-1]
    else:
        s=s+word
print(s)

Fixed, accepted submission:
words=input()
s=""
for word in words:
    if word=="B":
        s=s[:-1]
    else:
        s=s+word
print(s)
Problem:
Given is a rooted tree with N vertices numbered 1 to N. The root is Vertex 1, and the i-th edge (1 \leq i \leq N - 1) connects Vertex a_i and b_i.  Each of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0.  Now, the following Q operations will be performed:    * Operation j (1 \leq j \leq Q): Increment by x_j the counter on every vertex contained in the subtree rooted at Vertex p_j.  Find the value of the counter on each vertex after all operations.

Incorrect submission (verdict: Wrong Answer):
N,Q = map(int, input().split())
edge = [[int(e) for e in input().split()] for _ in range(N-1)]
question = [[int(q) for q in input().split()] for _ in range(Q)]

L = [[] for _ in range(N)]
for i in range(N-1):
    L[edge[i][0]-1].append(edge[i][1]-1)
    L[edge[i][1]-1].append(edge[i][0]-1)
    
qlist = [0]*N
for i in range(Q):
    qlist[question[i][0]-1] += question[i][1]
    
cnt = [0]*N
q = [[0, qlist[0]]]
cnt[0] = qlist[0]
while q:
    temp = q.pop(0)
    v = temp[0]
    c = temp[1]
    for i in L[v]:
        if cnt[i] == 0:
            q.append([i, c+qlist[i]])
            cnt[i] = c+qlist[i]
            
for i in range(N):
    print(cnt[i])

Fixed, accepted submission:
N,Q = map(int, input().split())
E = [[] for _ in range(N)]
for _ in range(N-1):
    a,b = map(int, input().split())
    E[a-1].append(b-1)
    E[b-1].append(a-1)
C = [0]*N
for _ in range(Q):
    p,x = map(int, input().split())
    C[p-1] += x

from collections import deque
q = deque()
q.append((0, C[0]))
ans = [-1]*N
ans[0] = C[0]
while q:
    temp = q.pop()
    u = temp[0]
    c = temp[1]
    for v in E[u]:
        if ans[v] == -1:
            ans[v] = c+C[v]
            q.append((v, c+C[v]))

print(*ans)
Problem:
We have N cards. A number a_i is written on the i-th card.   Alice and Bob will play a game using these cards. In this game, Alice and Bob alternately take one card. Alice goes first.   The game ends when all the cards are taken by the two players, and the score of each player is the sum of the numbers written on the cards he/she has taken. When both players take the optimal strategy to maximize their scores, find Alice's score minus Bob's score.

Incorrect submission (verdict: Wrong Answer):
N = input()
a = sorted(map(int,input().split()))
print(sum(a[::2]) - sum(a[1::2]))

Fixed, accepted submission:
N = input()
a = sorted(map(int,input().split()),reverse=True)
print(sum(a[0::2]) - sum(a[1::2]))
Problem:
Today is August 24, one of the five Product Days in a year.  A date m-d (m is the month, d is the date) is called a Product Day when d is a two-digit number, and all of the following conditions are satisfied (here d_{10} is the tens digit of the day and d_1 is the ones digit of the day):    * d_1 \geq 2   * d_{10} \geq 2   * d_1 \times d_{10} = m  Takahashi wants more Product Days, and he made a new calendar called Takahashi Calendar where a year consists of M month from Month 1 to Month M, and each month consists of D days from Day 1 to Day D.  In Takahashi Calendar, how many Product Days does a year have?

Incorrect submission (verdict: Wrong Answer):
# -*- coding: utf-8 -*-

if __name__ == '__main__':
    M, D = map(int, input().split())
    #D10 = int(D[0])
    #D1 = int(D[1])

    count = 0
    for m in range(1,M+1):
        for d in range(1,D+1):
            if d>=10:
                d_ = str(d)
                D10 = int(d_[0])
                D1 = int(d_[1])
                D_ = D10 * D1
                if m == D_ and D10>=2 and D1>=2:
                    print(d_,m)
                    count += 1
                else:
                    D_ = 0

    print(count)


Fixed, accepted submission:
# -*- coding: utf-8 -*-

if __name__ == '__main__':
    M, D = map(int, input().split())
    #D10 = int(D[0])
    #D1 = int(D[1])

    count = 0
    for m in range(1,M+1):
        for d in range(1,D+1):
            if d>=10:
                d_ = str(d)
                D10 = int(d_[0])
                D1 = int(d_[1])
                D_ = D10 * D1
                if m == D_ and D10>=2 and D1>=2:
                    count += 1
                else:
                    D_ = 0

    print(count)
Problem:
You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`.

Incorrect submission (verdict: Wrong Answer):
print ("YES" if len(set(input())) == 3 else "NO")


Fixed, accepted submission:
print ("Yes" if len(set(input())) == 3 else "No")
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):
a,b = map(int,input().split())
if (a*b)%2 == 1:
    print(int(a*b)/2+1)
else:
    print(int(a*b)/2)

Fixed, accepted submission:
a,b = map(int,input().split())
if a == 1 or b == 1:
    print(1)
elif (a*b)%2 == 1:
    print(int((a*b)/2+1))
else:
    print(int((a*b)/2))
Problem:
M-kun is a competitor in AtCoder, whose highest rating is X.   In this site, a competitor is given a _kyu_ (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:    * From 400 through 599: 8-kyu   * From 600 through 799: 7-kyu   * From 800 through 999: 6-kyu   * From 1000 through 1199: 5-kyu   * From 1200 through 1399: 4-kyu   * From 1400 through 1599: 3-kyu   * From 1600 through 1799: 2-kyu   * From 1800 through 1999: 1-kyu  What kyu does M-kun have?

Incorrect submission (verdict: Wrong Answer):
x = int(input())
sum = 600
for i in range(8, 0, -1):
    if x < sum:
        print(i)
        break
    sum += 20

Fixed, accepted submission:
x = int(input())
sum = 600
for i in range(8, 0, -1):
    if x < sum:
        print(i)
        break
    sum += 200
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())

list = []

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

for i in range(k):
    list.append(b-i)

for x in list:
    print(x)       


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

t = []

for i in range(k):
    if i+a <= b:
        t.append(i+a)

for i in range(k):
    if b-i >= a:
        t.append(b-i)

y = list(set(t))

for x in sorted(y):
    print(x)
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,B,C = map(int,input().split())

print('YNeos'[A<=C<=B::2])

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

print(' YNeos'[A<=C<=B::2])
Problem:
There are N children in AtCoder Kindergarten. Mr. Evi will arrange the children in a line, then give 1 candy to the first child in the line, 2 candies to the second child, ..., N candies to the N-th child. How many candies will be necessary in total?

Incorrect submission (verdict: Wrong Answer):
N=int(input())
s=0
for i in range(1,N):
    s=s+i
    
print(s)

Fixed, accepted submission:
N=int(input())
s=0
for i in range(1,N+1):
    s=s+i
    
print(s)
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):
n=int(input())
num=int((n-1)**(1/2))
print((num+1)**2)

Fixed, accepted submission:
print((int((int(input()))**(1/2)))**2)
Problem:
Write a program which calculates the cube of a given integer x.

Incorrect submission (verdict: Wrong Answer):
import math

print(1)
x = int(input("x="))

print(2)
y = int(math.pow(x,3))

print(y)

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

print(x*x*x)
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):
n = int(input())
l = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
for _ in range(n):
  b, f, r, v = map(int, input().split())
  l[b - 1][f - 1][r - 1] += v
for b in range(4):
  for f in range(3):
    print(*l[b][f])
  print("#" * 20)


Fixed, accepted submission:
n = int(input())
l = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
for _ in range(n):
  b, f, r, v = map(int, input().split())
  l[b - 1][f - 1][r - 1] += v
for b in range(4):
  for f in range(3):
    for r in range(10):
      print(" %d" % l[b][f][r], end = "")
    print("")
  if b != 3:
    print("#" * 20)
Problem:
You are given three integers A, B and C. Find the minimum number of operations required to make A, B and C all equal by repeatedly performing the following two kinds of operations in any order:    * Choose two among A, B and C, then increase both by 1.   * Choose one among A, B and C, then increase it by 2.  It can be proved that we can always make A, B and C all equal by repeatedly performing these operations.

Incorrect submission (verdict: Wrong Answer):
T=list(map(int,input().split()))
T.sort()
L1=T[0]
L2=T[1]
L3=T[2]
ans=0
ans+=L3-L2
print(ans)
ans+=(L3-ans-L1+1)//2+(L3-L1-ans)%2
print(ans)

Fixed, accepted submission:
T=list(map(int,input().split()))
T.sort()
L1=T[0]
L2=T[1]
L3=T[2]
ans=0
ans+=L3-L2
ans+=(L3-ans-L1+1)//2+(L3-L1-ans)%2
print(ans)
Problem:
Takahashi loves numbers divisible by 2.  You are given a positive integer N. Among the integers between 1 and N (inclusive), find the one that can be divisible by 2 for the most number of times. The solution is always unique.  Here, the number of times an integer can be divisible by 2, is how many times the integer can be divided by 2 without remainder.  For example,    * 6 can be divided by 2 once: 6 -> 3.   * 8 can be divided by 2 three times: 8 -> 4 -> 2 -> 1.   * 3 can be divided by 2 zero times.

Incorrect submission (verdict: Wrong Answer):
n = int(input())
split_num = 0
flag = 0
while flag == 0:
    if n % 2 == 1:
        flag += 1
        break
    else:
        split_num += 1
        n = n / 2
print(split_num)

Fixed, accepted submission:
n = int(input())
cnt = 0
num = 1
for i in range(1,n+1):
    a = 0
    c = i
    while c % 2 == 0:
        c = c // 2
        a += 1
    if a > cnt:
        num = i
        cnt = a
print(num)
Problem:
Write a program which calculates the area and circumference of a circle for given radius r.

Incorrect submission (verdict: Wrong Answer):
from math import pi
r = float(input())
area=r*r*pi
cir =(r+r)*pi
print(f'{(area):.6f}{(cir):.6f}')



Fixed, accepted submission:
from math import pi
r = float(input())
area = r * r * pi
cir =(r+r) * pi
print(f'{(area):.6f} {(cir):.6f}')
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):
R,C = list(map(int, input().split()))

if R % 2 == 0:
    print(R / 2 * C)
else:
    if C % 2 == 0:
        print(((R // 2 + 1) + (R // 2)) * C / 2)
    else:
        print((R // 2 + 1)*(C//2+1) + (R // 2)*(C//2))

Fixed, accepted submission:
h, w = map(int,input().split())

if h == 1 or w == 1:
    print(1)
elif h % 2 == 1 and w % 2 == 1:
    print(h * w// 2 + 1)
else:
    print(h * w // 2)
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):
result = 0
A = int(input()) #500
B = int(input()) #100
C = int(input()) #50
X = int(input()) 

for a in range(A):
  if a * 500 <= X:
    tmp = a * 500
    for b in range(B):
      if tmp + b * 100 <= X:
        tmp += b * 100
        for c in range(C):
          if tmp + c * 50 <= X:
	          tmp += c * 50
          if tmp == X:
            result += 1

print(result)



Fixed, accepted submission:
result = 0
A = int(input()) #500
B = int(input()) #100
C = int(input()) #50
X = int(input()) 
  
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
          if 500*a + 100*b + 50*c == X:
            result += 1
 
print(result)
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=["","",""]
for i in range(3):
    a[i]=int(input())
x=int(input())
cnt=0
for i in range(a[0]+1):
    print("----i="+str(i))
    for j in range(a[1]+1):
        print("----j="+str(j))
        
        for k in range(a[2]+1):
            ans = x-500*i - 100*j - 50*k
            print("----k="+str(k) + str(ans))
            if ans==0:
                cnt+=1
print(cnt)

Fixed, accepted submission:
a=["","",""]
for i in range(3):
    a[i]=int(input())
x=int(input())
cnt=0
for i in range(a[0]+1):
    for j in range(a[1]+1):
        for k in range(a[2]+1):
            ans = x-500*i - 100*j - 50*k
            if ans==0:
                cnt+=1
print(cnt)
Problem:
You are given an H × W grid.   The squares in the grid are described by H strings, S_1,...,S_H.   The j-th character in the string S_i corresponds to the square at the i-th row from the top and j-th column from the left (1 \leq i \leq H,1 \leq j \leq W).   `.` stands for an empty square, and `#` stands for a square containing a bomb.  Dolphin is interested in how many bomb squares are horizontally, vertically or diagonally adjacent to each empty square.   (Below, we will simply say "adjacent" for this meaning. For each square, there are at most eight adjacent squares.)   He decides to replace each `.` in our H strings with a digit that represents the number of bomb squares adjacent to the corresponding empty square.  Print the strings after the process.

Incorrect submission (verdict: Wrong Answer):
H,W = map(int, input().split())
print(H,W)
S = [input() for i in range(H)]

count = []
for i in range(H):
    for j in range(W):
        if S[i][j] == ".":
            cnt = 0
            for x in [-1, 0, 1]:
                for y in [-1, 0, 1]:
                    if 0 <= i+x < H and 0 <= j+y < W:
                        if S[i+x][j+y] == "#":
                            cnt += 1
            print(cnt,end="")
        else:
            print("#",end="")
    print()








Fixed, accepted submission:
H,W = map(int, input().split())
S = [input() for i in range(H)]

count = []
for i in range(H):
    for j in range(W):
        if S[i][j] == ".":
            cnt = 0
            for x in [-1, 0, 1]:
                for y in [-1, 0, 1]:
                    if 0 <= i+x < H and 0 <= j+y < W:
                        if S[i+x][j+y] == "#":
                            cnt += 1
            print(cnt,end="")
        else:
            print("#",end="")
    print()
Problem:
Iroha loves _Haiku_. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order.  To create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each of the phrases once, in some order.

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

if sorted((a,b,c)) == [5,5,7]:
    print("Yes")
else:
    print("No")

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

if sorted((a,b,c)) == [5,5,7]:
    print("YES")
else:
    print("NO")
Problem:
Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A.  The problem has N test cases.  For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`, `WA`, `TLE`, and `RE`, respectively.  See the Output section for the output format.

Incorrect submission (verdict: Wrong Answer):
# import sys;input = lambda : sys.stdin.readline()
import collections
d=collections.defaultdict(lambda:0)
for _ in range(int(input())):
    s=input()
    d[s]+=1
print("AC X",d['AC'])
print("WA X",d['WA'])
print("TLE X",d["TLE"])
print("RE X",d['RE'])


Fixed, accepted submission:
# import sys;input = lambda : sys.stdin.readline()
import collections
d=collections.defaultdict(lambda:0)
for _ in range(int(input())):
    s=input()
    d[s]+=1
print("AC x",d['AC'])
print("WA x",d['WA'])
print("TLE x",d["TLE"])
print("RE x",d['RE'])
Problem:
You are given a image with a height of H pixels and a width of W pixels. Each pixel is represented by a lowercase English letter. The pixel at the i-th row from the top and j-th column from the left is a_{ij}.  Put a box around this image and output the result. The box should consist of `#` and have a thickness of 1.

Incorrect submission (verdict: Wrong Answer):
H, W = map(int,input().split())
S = [list(input()) for i in range(H)]

Ans = []
for i in range(H+2) :
    Ansi = ["#" for x in range(W+2)]
    if i != 0 and i != H+1 :
        for j in range(W) :
            print(i, j)
            Ansi[j+1] = S[i-1][j]
    Ans.append(Ansi)

for i in range(H+2) :
    print("".join(Ans[i]))


Fixed, accepted submission:
H, W = map(int,input().split())
S = [list(input()) for i in range(H)]

Ans = []
for i in range(H+2) :
    Ansi = ["#" for x in range(W+2)]
    if i != 0 and i != H+1 :
        for j in range(W) :
            Ansi[j+1] = S[i-1][j]
    Ans.append(Ansi)

for i in range(H+2) :
    print("".join(Ans[i]))
Problem:
We have a tree with N vertices numbered 1 to N. The i-th edge in the tree connects Vertex u_i and Vertex v_i, and its length is w_i. Your objective is to paint each vertex in the tree white or black (it is fine to paint all vertices the same color) so that the following condition is satisfied:    * For any two vertices painted in the same color, the distance between them is an even number.  Find a coloring of the vertices that satisfies the condition and print it. It can be proved that at least one such coloring exists under the constraints of this problem.

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

data = []

for i in range(N-1):
    a, b, c = map(int, input().split())

    data.append((a,b,c))
    data.append((b,a,c))

data.sort()

ans = [0] * (N+1)
went = [False] * (N+1)

went[0] = True
went[1] = True
before = 1

for i in range(2*(N-1)):
    a, b, c = data[i]
    if went[a]:
       if not went[b]:
           went[b] = True
           if c % 2 == 0:
               ans[b] = ans[a]
           else:
               ans[b] = 1 - ans[a]

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

print()

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

data = [[] for _ in range(N+1)]

for i in range(N-1):
    a, b, c = map(int, input().split())

    data[a].append((b,c))
    data[b].append((a,c))


ans = [0] * (N+1)
went = [False] * (N+1)

went[0] = True
went[1] = True
go = [1]

while len(go) > 0:
    before = go.pop()
    for i, c in data[before]:
        if not went[i]:
            went[i] = True
            if c % 2 == 0:
                ans[i] = ans[before]
            else:
                ans[i] = 1 - ans[before]
            go.append(i)

for i in range(1, N+1):
    print(ans[i])
Problem:
Today is August 24, one of the five Product Days in a year.  A date m-d (m is the month, d is the date) is called a Product Day when d is a two-digit number, and all of the following conditions are satisfied (here d_{10} is the tens digit of the day and d_1 is the ones digit of the day):    * d_1 \geq 2   * d_{10} \geq 2   * d_1 \times d_{10} = m  Takahashi wants more Product Days, and he made a new calendar called Takahashi Calendar where a year consists of M month from Month 1 to Month M, and each month consists of D days from Day 1 to Day D.  In Takahashi Calendar, how many Product Days does a year have?

Incorrect submission (verdict: Wrong Answer):
M,D = map(int, input().split())
ans = 0
for i in range(1, M+1):
  for j in range(1, D+1):
    tmp = 1
    while(j > 0):
      tmp *= j%10
      j = j // 10
    if tmp == i:
      ans += 1
print(ans)

Fixed, accepted submission:
M,D = map(int, input().split())
ans = 0
for i in range(1,M+1):
  for j in range(2, D//10 + 1):
    for k in range(2, 10):
      if j*10 + k > D:
        break
      else:
        if j*k == i:
          ans += 1
print(ans)
Problem:
Snuke is buying a bicycle. The bicycle of his choice does not come with a bell, so he has to buy one separately.  He has very high awareness of safety, and decides to buy two bells, one for each hand.  The store sells three kinds of bells for the price of a, b and c yen (the currency of Japan), respectively. Find the minimum total price of two different bells.

Incorrect submission (verdict: Wrong Answer):
a, b, c = map(int, input().split())
print(sum(sorted([a, b, c])[:1]))

Fixed, accepted submission:
a, b, c = map(int, input().split())
print(a + b + c - max([a, b, c]))