TnT/CodeNet4Repair huggingface dataset:
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):
lc = [[int(w) for w in input().split()] for i in range(3)]


def ch1(la, lb, aindex):
    return la[aindex] + lb[0] == lc[aindex][0]\
        and la[aindex] + lb[1] == lc[aindex][1]\
        and la[aindex] + lb[2] == lc[aindex][2]


cond = False

for i in range(100):
    if cond:
        break
    for j in range(100):
        la = [i//100, (i % 100)//10, i % 10]
        lb = [j//100, (j % 100)//10, j % 10]
        if ch1(la, lb, 0):
            if ch1(la, lb, 1):
                if ch1(la, lb, 2):
                    cond = True
            else:
                j += 9
        else:
            j += 99


print("Yes" if cond else "No")


Fixed, accepted submission:
lc = [[int(w) for w in input().split()] for i in range(3)]
cond = True

lb = lc[0]
a2 = lc[1][0]-lb[0]
a3 = lc[2][0]-lb[0]
la = [0, a2, a3]
for i in range(3):
    for j in range(3):
        if lc[i][j] != la[i]+lb[j]:
            cond = False
            break

print("Yes" if cond else "No")
Problem:
A balance scale tips to the left if L>R, where L is the total weight of the masses on the left pan and R is the total weight of the masses on the right pan. Similarly, it balances if L=R, and tips to the right if L<R.  Takahashi placed a mass of weight A and a mass of weight B on the left pan of a balance scale, and placed a mass of weight C and a mass of weight D on the right pan.  Print `Left` if the balance scale tips to the left; print `Balanced` if it balances; print `Right` if it tips to the right.

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

if a + b < c + d:
    print("Left")
if a + b > c + d:
    print("Right")
if a + b == c + d:
    print("Balance")

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

if a + b > c + d:
    print("Left")
if a + b < c + d:
    print("Right")
if a + b == c + d:
    print("Balanced")
Problem:
The commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word "bill" refers to only these.  According to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situation is possible, and if it is, find a possible set of bills contained in the envelope. Assume that his grandfather is rich enough, and the envelope was large enough.

Incorrect submission (verdict: Wrong Answer):
y,n1 = map(int,input().split())
k10=-1
k5=-1
k1=-1
n=n1
for i in range(n//10000+1):
    n=n1
    if(n//10000==y and n%10000==0):
        k10=n//10000
        k5=0
        k1=0
        break
    else:
        i=n//10000-i
        n-=i*10000
        for j in range(n//5000+1):
            n=n1
            if(n//5000==(y-i) and n%5000==0):
                k10=i
                k5=n//5000
                k1=0
                break
            else:
                j=n//5000-j
                n-=j*5000
                if(n//1000==(y-i-j) and n%1000==0):
                    k10=i
                    k5=j
                    k1=n//1000
                    break
    if(k1!=-1):
        break
    
print(k10,k5,k1)



Fixed, accepted submission:
y,n1 = map(int,input().split())
k10=-1
k5=-1
k1=-1
n=n1
for i in range(n//10000+1):
    n=n1
    if(n//10000==y and n%10000==0):
        k10=n//10000
        k5=0
        k1=0
        break
    elif(n//10000>y):
        break
    else:
        i=n//10000-i
        n-=i*10000
        for j in range(n//5000+1):
            n=n1-i*10000
            if(n//5000==(y-i) and n%5000==0):
                k10=i
                k5=n//5000
                k1=0
                break
            elif(n//5000>y-i):
                break
            else:
                n=n1-i*10000
                j=n//5000-j
                n-=j*5000
                if(n//1000==(y-i-j) and n%1000==0):
                    k10=i
                    k5=j
                    k1=n//1000
                    break
    if(k1!=-1):
        break
    
print(k10,k5,k1)
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 = input().rstrip().split()
print("YES" if len(a) == 5 and len(b) == 7 and len(c) == 5 else "NO")

Fixed, accepted submission:

def main():
    A = sorted(map(int, input().split()))
    flg = A == [5, 5, 7]
    print("YES" if flg else "NO")


if __name__ == "__main__":
    main()
Problem:
In this problem, a date is written as Y-M-D. For example, 2019-11-30 means November 30, 2019.  Integers M_1, D_1, M_2, and D_2 will be given as input.   It is known that the date 2019-M_2-D_2 follows 2019-M_1-D_1.   Determine whether the date 2019-M_1-D_1 is the last day of a month.

Incorrect submission (verdict: Wrong Answer):
m1, d1 = map(int, input().split())
m2, d2 = map(int, input().split())
if m1 != m2:
  print(0)
else:
  print(1)

Fixed, accepted submission:
m1, d1 = map(int, input().split())
m2, d2 = map(int, input().split())
if m1 != m2:
  print(1)
else:
  print(0)
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())
pay = 0
while N <= pay:
  pay += 1000
  
print(pay -N)

Fixed, accepted submission:
N = int(input())
pay = 0
while N > pay:
  pay += 1000
print(pay-N)
Problem:
You are given an integer sequence of length n, a_1, ..., a_n. Let us consider performing the following n operations on an empty sequence b.  The i-th operation is as follows:    1. Append a_i to the end of b.   2. Reverse the order of the elements in b.  Find the sequence b obtained after these n operations.

Incorrect submission (verdict: Wrong Answer):
n = int(input())
a = input().split()

b = [0]*n

for i in range(n//2):
    b[i] = a[-1-2*i]
    b[n-i-1] = a[-2-2*i]

if n % 2 == 1:
    b[n//2] = a[0]

print(b)


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

b = [0]*n

for i in range(n//2):
    b[i] = a[-1-2*i]
    b[n-i-1] = a[-2-2*i]

if n % 2 == 1:
    b[n//2] = a[0]

print(' '.join(b))
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):
from collections import deque

def main():
    n, q = list(map(int, input().split(" ")))
    v_dict = {i: [] for i in range(n)}
    for _ in range(n-1):
        a, b = list(map(int, input().split(" ")))
        v_dict[a-1].append(b-1)

    point_list = [0]*n
    for _ in range(q):
        p, x = list(map(int, input().split(" ")))
        stack = deque([p-1]) 
        while stack:
            cur = stack.pop()
            point_list[cur]+=x
            for next_i in v_dict[cur]:
                stack.append(next_i)
   
    for i in range(n):
        print(point_list[i], end=" ")

if __name__=="__main__":
    main()


Fixed, accepted submission:
from collections import deque

def main():
    n, q = list(map(int, input().split(" ")))
    v_list = [[] for i in range(n)]
    for _ in range(n-1):
        a, b = list(map(int, input().split(" ")))
        v_list[a-1].append(b-1)
        v_list[b-1].append(a-1)

    p_x_list = [0]*n
    for _ in range(q):
        p, x = list(map(int, input().split(" ")))
        p_x_list[p-1]+=x

    point_list = [0]*n
    checked_list = [0]*n
    stack = deque([0]) 
    while stack:
        cur = stack.pop()
        checked_list[cur] = 1
        point_list[cur]+=p_x_list[cur]
        for next_i in v_list[cur]:
            if checked_list[next_i]:
                continue
            stack.append(next_i)
            point_list[next_i]+=point_list[cur]
   
    print(*point_list)

if __name__=="__main__":
    main()
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):
import copy
a = list(map(int,input().split()))
nokori  = copy.copy(a)
count = max(a)
nokori.remove(count)
if a[0] == a[1] == a[2]:
    print("NO")
if int(nokori[0] + nokori[1]) == count:
    print("YES")
else:
    print("NO")



Fixed, accepted submission:
import copy
a = list(map(int,input().split()))
nokori  = copy.copy(a)
count = max(a)
nokori.remove(count)
"""
if a[0] == a[1] == a[2]:
    print("No")
"""
if int(nokori[0] + nokori[1]) == count:
    print("Yes")
else:
    print("No")
Problem:
Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7.  Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation:    * Operation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward.  For example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure. If the die is rotated toward the right as shown in the figure, the side showing 3 will face upward. Besides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back.    Find the minimum number of operation Snuke needs to perform in order to score at least x points in total.

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

if x <= 6:
    print(1)
else:
    div = x % 11
    if div <= 6:
        print(2 * x // 11 + 1)
    else:
        print(2 * x // 11 + 2)

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

if x <= 6:
    print(1)
elif 7 <= x <= 10:
    print(2)
else:
    div = x % 11
    shou = x // 11
    if div == 0:
        print(2 * shou)
    elif div <= 6:
        print(2 * shou + 1)
    else:
        print(2 * shou + 2)
Problem:
Mammy decided to give Taro his first shopping experience. Mammy tells him to choose any two items he wants from those listed in the shopping catalogue, but Taro cannot decide which two, as all the items look attractive. Thus he plans to buy the pair of two items with the highest price sum, not exceeding the amount Mammy allows. As getting two of the same item is boring, he wants two different items.  You are asked to help Taro select the two items. The price list for all of the items is given. Among pairs of two items in the list, find the pair with the highest price sum not exceeding the allowed amount, and report the sum. Taro is buying two items, not one, nor three, nor more. Note that, two or more items in the list may be priced equally.

Incorrect submission (verdict: Wrong Answer):
while 1:
    str=input().split()
    n=int(str[0])
    m=int(str[1])
    if n==0 and m==0: break
    str=input().split()
    a=[0]*n
    for i in range(n):
        a[i]=int(str[i])
    a.sort()
    a.reverse()
    print(a)
    flag=0
    max=0
    for i in range(n):
        if flag!=0: break
        for j in range(i+1,n):
            v=a[i]+a[j]
            if m>=v:
                if max<v: max=v
    if max==0: print("NONE")
    else: print(max)



Fixed, accepted submission:
while 1:
    str=input().split()
    n=int(str[0])
    m=int(str[1])
    if n==0 and m==0: break
    str=input().split()
    a=[0]*n
    for i in range(n):
        a[i]=int(str[i])
    a.sort()
    a.reverse()
    flag=0
    max=0
    for i in range(n):
        if flag!=0: break
        for j in range(i+1,n):
            v=a[i]+a[j]
            if m>=v:
                if max<v: max=v
    if max==0: print("NONE")
    else: print(max)
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):
N = int(input()) 
s = [input() for i in range(N)] 
ac = s.count("AC")
wa = s.count("wa")
tle = s.count("TLE")
re = s.count("RE")
print("AC x "+str(ac))
print("WA x "+str(wa))
print("TLE x "+str(tle))
print("RE x "+str(re))

Fixed, accepted submission:
N = int(input()) 
s = [input() for i in range(N)] 
ac = s.count("AC")
wa = s.count("WA")
tle = s.count("TLE")
re = s.count("RE")
print("AC x "+str(ac))
print("WA x "+str(wa))
print("TLE x "+str(tle))
print("RE x "+str(re))
Problem:
We have N pieces of ropes, numbered 1 through N. The length of piece i is a_i.  At first, for each i (1≤i≤N-1), piece i and piece i+1 are tied at the ends, forming one long rope with N-1 knots. Snuke will try to untie all of the knots by performing the following operation repeatedly:    * Choose a (connected) rope with a total length of at least L, then untie one of its knots.  Is it possible to untie all of the N-1 knots by properly applying this operation? If the answer is positive, find one possible order to untie the knots.

Incorrect submission (verdict: Wrong Answer):
n,l = map(int,input().split())
a = list(map(int,input().split()))
for i in range(n-1):
  if a[i] + a[i+1] >= l:
    print("Possible")
    break
else:
  print("Impossible")
  exit()
li = [range(1,i+1)]+[range(n,i+1,-1)]+[i+1]
print(" ".join(map(str, li)))

Fixed, accepted submission:
n,l = map(int,input().split())
a = list(map(int,input().split()))
for i in range(n-1):
  if a[i] + a[i+1] >= l:
    print("Possible")
    break
else:
  print("Impossible")
  exit()
li = list(range(1,i+1))+list(range(n-1,i+1,-1))+[i+1]
for x in li:
  print(x)
Problem:
There are N positive integers written on a blackboard: A_1, ..., A_N.  Snuke can perform the following operation when all integers on the blackboard are even:    * Replace each integer X on the blackboard by X divided by 2.  Find the maximum possible number of operations that Snuke can perform.

Incorrect submission (verdict: Wrong Answer):
import sys

n = input()
l = list(map(int, input().split()))

loop = 0

while (1):
  for i in l:
    if (i % (2 ** loop) != 0):
      print(loop)
      sys.exit(0)
  loop = loop + 1

Fixed, accepted submission:
import sys

n = input()
l = list(map(int, input().split()))

loop = 0

while (1):
  for i in l:
    if i % (2 ** (loop + 1)) != 0:
      print(loop)
      sys.exit(0)
  loop = loop + 1
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):
price = 800
i_ate = int(input())

ans = price * i_ate - (200 * (i_ate % 15))
print(ans)

Fixed, accepted submission:
price = 800
i_ate = int(input())

ans = (price * i_ate) - (200 * (i_ate // 15))
print(ans)
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):
def main():
    X = int(input())
    lst = [i * 200 + 400 for i in range(8)]
    lst.reverse()
    print(lst)
    for i, l in enumerate(lst):
        if X >= l:
            print(i+1)
            break

if __name__ == '__main__':
    main()

Fixed, accepted submission:
def main():
    X = int(input())
    lst = [i * 200 + 400 for i in range(8)]
    lst.reverse()
    for i, l in enumerate(lst):
        if X >= l:
            print(i+1)
            break

if __name__ == '__main__':
    main()
Problem:
An _X -layered kagami mochi_ (X ≥ 1) is a pile of X round mochi (rice cake) stacked vertically where each mochi (except the bottom one) has a smaller diameter than that of the mochi directly below it. For example, if you stack three mochi with diameters of 10, 8 and 6 centimeters from bottom to top in this order, you have a 3-layered kagami mochi; if you put just one mochi, you have a 1-layered kagami mochi.  Lunlun the dachshund has N round mochi, and the diameter of the i-th mochi is d_i centimeters. When we make a kagami mochi using some or all of them, at most how many layers can our kagami mochi have?

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

print(len(mochi))

Fixed, accepted submission:
n = int(input())
d = [int(input()) for i in range(n)]

num = [0]*101
for i in range(n):
    num[d[i]] += 1

ans = 0
for i in range(101):
    if num[i] > 0:  
        ans += 1
print(ans)
Problem:
We have a sandglass that runs for X seconds. The sand drops from the upper bulb at a rate of 1 gram per second. That is, the upper bulb initially contains X grams of sand.  How many grams of sand will the upper bulb contains after t seconds?

Incorrect submission (verdict: Wrong Answer):
S = input()
print(S[::2])

Fixed, accepted submission:
x,t = map(int, input().split())
print(x-t if x-t >= 0 else 0)
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 = list(map(int, input().split()))

x = [i for i in range(a, b+1)]
xx = list(set(x[:k] + x[-2:]))
for xi in xx:
  print(xi)

Fixed, accepted submission:
a,b,k=map(int,input().split())
l=range(a,b+1)
ans=sorted(set(l[:k])|set(l[-k:]))
for i in ans:
    print(i)
Problem:
You are given an integer K. Print the string obtained by repeating the string `ACL` K times and concatenating them.  For example, if K = 3, print `ACLACLACL`.

Incorrect submission (verdict: Wrong Answer):
S = input()
print(S*3)

Fixed, accepted submission:
K = int(input())
print('ACL'*K)
Problem:
There are N balls in the xy-plane. The coordinates of the i-th of them is (x_i, i). Thus, we have one ball on each of the N lines y = 1, y = 2, ..., y = N.  In order to collect these balls, Snuke prepared 2N robots, N of type A and N of type B. Then, he placed the i-th type-A robot at coordinates (0, i), and the i-th type-B robot at coordinates (K, i). Thus, now we have one type-A robot and one type-B robot on each of the N lines y = 1, y = 2, ..., y = N.  When activated, each type of robot will operate as follows.    * When a type-A robot is activated at coordinates (0, a), it will move to the position of the ball on the line y = a, collect the ball, move back to its original position (0, a) and deactivate itself. If there is no such ball, it will just deactivate itself without doing anything.    * When a type-B robot is activated at coordinates (K, b), it will move to the position of the ball on the line y = b, collect the ball, move back to its original position (K, b) and deactivate itself. If there is no such ball, it will just deactivate itself without doing anything.  Snuke will activate some of the 2N robots to collect all of the balls. Find the minimum possible total distance covered by robots.

Incorrect submission (verdict: Wrong Answer):
N = int(input())
K = int(input())
x = [int(x) for x in input().split()]
ans = 0
for i in x:
  ans+=min(abs(K-i),i)
print(ans)

Fixed, accepted submission:
N = int(input())
K = int(input())
x = [int(x) for x in input().split()]
ans = 0
for i in x:
  ans+=2*min(abs(K-i),i)
print(ans)
Problem:
On some day in January 2018, Takaki is writing a document. The document has a column where the current date is written in `yyyy/mm/dd` format. For example, January 23, 2018 should be written as `2018/01/23`.  After finishing the document, she noticed that she had mistakenly wrote `2017` at the beginning of the date column. Write a program that, when the string that Takaki wrote in the date column, S, is given as input, modifies the first four characters in S to `2018` and prints it.

Incorrect submission (verdict: Wrong Answer):
s = input()
s.replace('7', '8', 1)
print(s)

Fixed, accepted submission:
s = input()
print('2018' + s[4:])
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:
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):
print(int(input())%1000)

Fixed, accepted submission:
a=int(input())
r=a%1000
if r==0:
  print(r)
else:
  print(1000-r)