TnT/CodeNet4Repair huggingface dataset:
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())
box = [a,b,c]
count1 = box.count(5)
count2 = box.count(7)
if count1 == 2 and count2 ==1:
    print('Yes')
else:
    print('No')

Fixed, accepted submission:
a,b,c=map(int, input().split())
box = [a,b,c]
count1 = box.count(5)
count2 = box.count(7)
if count1 == 2 and count2 ==1:
    print('YES')
else:
    print('NO')
Problem:
Write a program which computes the digit number of sum of two integers a and b.

Incorrect submission (verdict: Wrong Answer):
while True:
    try:
        x = list(map(int, input().split(' ')))
        n = x[0] * x[1]
        print(len(str(n)))
    except EOFError:
        break

Fixed, accepted submission:
while True:
    try:
        x = list(map(int, input().split(' ')))
        n = x[0] + x[1]
        print(len(str(n)))
    except EOFError:
        break
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())

strlist = [input() for i in range(n)]
intlist = [int(x) for x in strlist]
sortlist = sorted(intlist)

print(sortlist)

temp = 0
ans = 0

for d in sortlist:
  if int(d) > temp:
    temp = int(d)
    ans += 1

print(ans)

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

strlist = [input() for i in range(n)]
intlist = [int(x) for x in strlist]
sortlist = sorted(intlist)

temp = 0
ans = 0

for d in sortlist:
  if int(d) > temp:
    temp = int(d)
    ans += 1

print(ans)
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 = [i for i in input()]
if "AC"in s:
    print("Yes")
else:
    print("No")

Fixed, accepted submission:
s = input()
if "AC"in s:
    print("Yes")
else:
    print("No")
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):
def solve():
    N, M, X, Y = map(int, input().split())
    x = list(map(int, input().split()))
    y = list(map(int, input().split()))
    
    max_x = max(X, max(x))
    min_y = min(Y, min(y))
    if max_x < min_y:
        print('NO War')
    else:
        print('War')


if __name__ == '__main__':
    solve()


Fixed, accepted submission:
def solve():
    N, M, X, Y = map(int, input().split())
    x = list(map(int, input().split()))
    y = list(map(int, input().split()))
    
    max_x = max(X, max(x))
    min_y = min(Y, min(y))
    if max_x < min_y:
        print('No War')
    else:
        print('War')


if __name__ == '__main__':
    solve()
Problem:
Let's first write a program to calculate the score from a pair of input and output. You can know the total score by submitting your solution, or an official program to calculate a score is often provided for local evaluation as in this contest. Nevertheless, writing a score calculator by yourself is still useful to check your understanding of the problem specification. Moreover, the source code of the score calculator can often be reused for solving the problem or debugging your solution. So it is worthwhile to write a score calculator unless it is very complicated.

Incorrect submission (verdict: Wrong Answer):
d =int(input())
c = list(map(int, input().split())) 
s = []
t = []

d_l = []
score = 0
soft = 0

for i in range(d):
    s.append(0)
    s[i] = list(map(int, input().split()))

for i in range(26):
    d_l.append(0)
    
for i in range(d):
    t = int(input())
    soft = 0
    
    for j in range(26):
        if t-1 == j:
            d_l[j] = 0
            score = s[i][j]
        else:
            d_l[j] += 1
            soft += c[j] * d_l[j]
    
    score -= soft
    print(score)
    
    

Fixed, accepted submission:
d =int(input())
c = list(map(int, input().split())) 
s = []
t = []

d_l = []
score = 0
soft = 0

for i in range(d):
    s.append(0)
    s[i] = list(map(int, input().split()))

for i in range(26):
    d_l.append(0)
    
for i in range(d):
    t = int(input())
    soft = 0
    
    for j in range(26):
        if t-1 == j:
            d_l[j] = 0
            score += s[i][j]
        else:
            d_l[j] += 1
            soft += c[j] * d_l[j]
    
    score -= soft
    print(score)
Problem:
AtCoDeer the deer recently bought three paint cans. The color of the one he bought two days ago is a, the color of the one he bought yesterday is b, and the color of the one he bought today is c. Here, the color of each paint can is represented by an integer between 1 and 100, inclusive.  Since he is forgetful, he might have bought more than one paint can in the same color. Count the number of different kinds of colors of these paint cans and tell him.

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

Fixed, accepted submission:
x = list(map(int,input().split()))
print(len(set(x)))
Problem:
Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L.  She will concatenate all of the strings in some order, to produce a long string.  Among all strings that she can produce in this way, find the lexicographically smallest one.  Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds:    * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i.   * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.

Incorrect submission (verdict: Wrong Answer):
n, l = map(int, input().split())

l = []
i = 0
# while i <= n-1:
#     list[i] = list(input())


l = [input() for i in range(n)]
result = sorted(l)
# print('--------------')
# print(result)
# print('--------------')
for i in range(n):
    print(result[i])


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

l = []
i = 0

l = [input() for i in range(n)]
result = sorted(l)
s = ''.join(result)

print(s)
Problem:
M-kun has the following three cards:    * A red card with the integer A.   * A green card with the integer B.   * A blue card with the integer C.  He is a genius magician who can do the following operation at most K times:    * Choose one of the three cards and multiply the written integer by 2.  His magic is successful if both of the following conditions are satisfied after the operations:    * The integer on the green card is **strictly** greater than the integer on the red card.   * The integer on the blue card is **strictly** greater than the integer on the green card.  Determine whether the magic can be successful.

Incorrect submission (verdict: Wrong Answer):
A, B, C = map(int, input().split())
K = int(input())

for i in range(1, K):
  for ii in range(1, K - i):
    iii = K - i - ii
    A = A * (2 ** i)
    B = B * (2 ** ii)
    C = C * (2 ** iii)
    if A < B < C:
      print('Yes')
      exit(0)
print('No')




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

for i in range(K):
  for ii in range(K - i):
    iii = K - i - ii
    a = A * (2 ** i)
    b = B * (2 ** ii)
    c = C * (2 ** iii)
    if a < b < c:
      print('Yes')
      exit(0)
print('No')
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):
n, y = map(int, input().split(' '))
s_n = [0, 0, 0]
s_l = [10000, 5000, 1000]

for i, s in enumerate(s_l):
    if n > -1:
        s_n[i] = int(y/s)
        n = n - s_n[i]
        y = y - s * s_n[i]
    else:
        print('-1 -1 -1')

if n > -1:
    if y == 0:
        print(' '.join(map(str, s_n)))
    else:
        print('-1 -1 -1')
else:
    print('-1 -1 -1')

Fixed, accepted submission:
N, Y = map(int, input().split(' '))
res10000 = -1
res5000 = -1
res1000 = -1

for a in range(N+1):
    for b in range(N-a+1):
        c = N - a - b
        total = 10000*a + 5000*b + 1000*c
        if total == Y:
            res10000 = a
            res5000 = b
            res1000 = c

print(str(' '.join(map(str, [res10000, res5000, res1000]))))
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 = []
for i in range(N):
    s = str(input())
    S.append(s)

result = ['AC', 'WA', 'TLE', 'RE']
C = [S.count(r) for r in result]

for (re, c) in zip(result, C):
    print(re + 'x' + str(c))

Fixed, accepted submission:
N = int(input())
S = []
for i in range(N):
    s = str(input())
    S.append(s)

result = ['AC', 'WA', 'TLE', 'RE']
C = [S.count(r) for r in result]

for (re, c) in zip(result, C):
    print(re + ' x ' + str(c))
Problem:
There are three positive integers A, B and C written on a blackboard. E869120 performs the following operation K times:    * Choose one integer written on the blackboard and let the chosen integer be n. Replace the chosen integer with 2n.  What is the largest possible sum of the integers written on the blackboard after K operations?

Incorrect submission (verdict: Wrong Answer):
a,b,c=map(int,input().split())
print(max(a,b,c)*(2**int(input())+a+b+c-max(a,b,c)))

Fixed, accepted submission:
a,b,c=map(int,input().split())
print(max(a,b,c)*(2**int(input()))+a+b+c-max(a,b,c))
Problem:
There are two standard ways to represent a graph $G = (V, E)$, where $V$ is a set of vertices and $E$ is a set of edges; Adjacency list representation and Adjacency matrix representation.  An adjacency-list representation consists of an array $Adj[|V|]$ of $|V|$ lists, one for each vertex in $V$. For each $u \in V$, the adjacency list $Adj[u]$ contains all vertices $v$ such that there is an edge $(u, v) \in E$. That is, $Adj[u]$ consists of all vertices adjacent to $u$ in $G$.  An adjacency-matrix representation consists of $|V| \times |V|$ matrix $A = a_{ij}$ such that $a_{ij} = 1$ if $(i, j) \in E$, $a_{ij} = 0$ otherwise.  Write a program which reads a directed graph $G$ represented by the adjacency list, and prints its adjacency-matrix representation. $G$ consists of $n\; (=|V|)$ vertices identified by their IDs $1, 2,.., n$ respectively.

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

    n = int(input())
    adj = [[0 for i in range(n)] for j in range(n)]

    for i in range(n):
        tmp = list(map(int, input().split()))
        u = tmp[0]
        u = u -1
        k = tmp[1]
        v = tmp[2:]
        for j in range(k):
            adj[u][v[j]-1] = 1

    for i in range(n):
        print(" ".join(list(map(str, adj[i]))))

    for i in adj:
        print(*i)


if __name__ == "main":
    main()

Fixed, accepted submission:
def main():

    n = int(input())
    adj = [[0 for i in range(n)] for j in range(n)]

    for i in range(n):
        tmp = list(map(int, input().split()))
        u = tmp[0]
        u = u -1
        k = tmp[1]
        v = tmp[2:]
        for j in range(k):
            adj[u][v[j]-1] = 1

    for i in adj:
        print(*i)


if __name__ == "__main__":
    main()
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):

lst = input().split()


for i in lst:
  i = int(i)


lst.sort()


if lst == [5, 5, 7]:
  print('YES')
else:
  print('NO')

Fixed, accepted submission:

lst = input().split()
 

for i in range(len(lst)):
  lst[i] = int(lst[i])
 

lst.sort()
 

if lst == [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):
N = int(input())

ac = 0
wa = 0
tle = 0
re = 0

for i in range(1,N+1):
  S = str(input())
  if S == "AC":
    ac += 1
  elif S == "WA":
    wa += 1
  elif S == "TLE":
    tle += 1
  elif S == "RE":
    re += 1

print("AC × " + str(ac))
print("WA × " + str(wa))
print("TLE × " + str(tle))
print("AC × " + str(re))
  

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

ac = 0
wa = 0
tle = 0
re = 0

for i in range(1,N+1):
  S = str(input())
  if S == "AC":
    ac += 1
  elif S == "WA":
    wa += 1
  elif S == "TLE":
    tle += 1
  else:
    re += 1

print("AC x " + str(ac))
print("WA x " + str(wa))
print("TLE x " + str(tle))
print("RE x " + str(re))
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):
import math
n=int(input())

for p in range(1, n):
  right=math.floor(p*0.5)
  cnt=0
  for i in range(right):
    for j in range(right):
      for k in range(right):
        if i**2+j**2+k**2+i*j+j*k+k*i==p and i>0 and j>0 and k>0:
          cnt+=1
  print(cnt)

Fixed, accepted submission:
n=int(input())
lst=[0]*10000000
for i in range(1, 101):
  for j in range(1, i+1):
    for k in range(1, j+1):
      temp=i**2+j**2+k**2+i*j+j*k+k*i
      if i==j and j==k:
        lst[temp+1]+=1
      elif i==j and j!=k:
         lst[temp+1]+=3
      elif j==k and k!=i:
         lst[temp+1]+=3
      elif k==i and i!=j:
         lst[temp+1]+=3
      elif i!=j and j!=k and k!=i:
         lst[temp+1]+=6
for p in range(1, n+1):
  print(lst[p+1])
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.sort()
Y.sort()
Z=[i for i in range(x+1,y)]
if X[-1]<Y[0]:
  z=[i for i in range(X[-1]+1,Y[0])]
  if len(set(z)&set(Z))>0:
    print("No War")
  else:
    print("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.sort()
Y.sort()
Z=[i for i in range(x+1,y+1)]
if X[-1]<Y[0]:
  z=[i for i in range(X[-1]+1,Y[0]+1)]
  if len(set(z)&set(Z))>0:
    print("No War")
  else:
    print("War")
else:
  print("War")
Problem:
We will call a string that can be obtained by concatenating two equal strings an _even_ string. For example, `xyzxyz` and `aaaaaa` are even, while `ababab` and `xyzxy` are not.  You are given an even string S consisting of lowercase English letters. Find the length of the longest even string that can be obtained by deleting one or more characters from the end of S. It is guaranteed that such a non-empty string exists for a given input.

Incorrect submission (verdict: Time Limit Exceeded):
S = input()

while True:
  if S[0:len(S)//2] == S[len(S)//2:len(S)-1]:
    print(len(S))
  else:
    tmp = S[0:len(S)-2]
    S = tmp

Fixed, accepted submission:
S = input()
cnt = 0

for i in range(len(S)):
  if S[0:len(S)//2] == S[len(S)//2:len(S) + 1] and cnt != 0:
    print(len(S))
    exit()
  else:
    cnt += 1
    S = S[0:len(S) - 1]
Problem:
You are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times:    * Append one of the following at the end of T: `dream`, `dreamer`, `erase` and `eraser`.

Incorrect submission (verdict: Wrong Answer):
s = input().replace("eracer",'').replace('erace','').replace('dreamer','').replace('dreame','')
print('YES' if len(s) == 0 else 'NO')

Fixed, accepted submission:
s = input().replace("eraser",'').replace('erase','').replace('dreamer','').replace('dream','')
print('YES' if len(s) == 0 else '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):
N = int(input())

q, mod = divmod(N, 1000)

print(mod)

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

q, mod = divmod(N, 1000)

if mod == 0:
  print(0)
else:
  print(1000-mod)
Problem:
There is a cave.  The cave has N rooms and M passages. The rooms are numbered 1 to N, and the passages are numbered 1 to M. Passage i connects Room A_i and Room B_i bidirectionally. One can travel between any two rooms by traversing passages. Room 1 is a special room with an entrance from the outside.  It is dark in the cave, so we have decided to place a signpost in each room except Room 1. The signpost in each room will point to one of the rooms directly connected to that room with a passage.  Since it is dangerous in the cave, our objective is to satisfy the condition below for each room except Room 1.    * If you start in that room and repeatedly move to the room indicated by the signpost in the room you are in, you will reach Room 1 after traversing the minimum number of passages possible.  Determine whether there is a way to place signposts satisfying our objective, and print one such way if it exists.

Incorrect submission (verdict: Wrong Answer):
n, m = map(int, input().split())
edge = [list(map(int, input().split())) for _ in range(m)]

next_node = [[] for _ in range(n)]
for a, b in edge:
    next_node[a-1].append(b)
    next_node[b-1].append(a)

q = [1]
visit = [1]  + [0] * (n-1)
prev = [0]*n
while q:
    now = q.pop()
    for i in next_node[now-1]:
        if visit[i-1] == 0:
            q.append(i)
            visit[i-1] = 1
            prev[i-1] = now
print(prev[1:])

Fixed, accepted submission:
n, m = map(int, input().split())
edge = [list(map(int, input().split())) for _ in range(m)]

next_node = [[] for _ in range(n)]
for a, b in edge:
    next_node[a-1].append(b)
    next_node[b-1].append(a)

q = [1]
visit = [1]  + [0] * (n-1)
prev = [0] * n
while q:
    now = q.pop(0)
    for i in next_node[now-1]:
        if visit[i-1] == 0:
            q.append(i)
            visit[i-1] = 1
            prev[i-1] = now
print('Yes')
print(*prev[1:], sep='\n')
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())
status={'AC':0, 'WA':0, 'TLE':0, 'RE':0}
results = [input() for n in range(N)]
for result in results:
     if result in status.keys():
         status[result] += 1
for k, v in status.items():
    print('{} × {}'.format(k, v))

Fixed, accepted submission:
N = int(input())
status={'AC':0, 'WA':0, 'TLE':0, 'RE':0}
results = [input() for n in range(N)]
for result in results:
     if result in status.keys():
         status[result] += 1
for k, v in status.items():
    print('{} x {}'.format(k, v))
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):
li = list(map(int, input().split()))
a = 0
br = False
while True:
    for i in li:
        if i % 2 != 0:
            br = True
            break
    if br:
        break
    a += 1
    li = list(map(lambda x: x / 2, li))
print(a)

Fixed, accepted submission:
n = int(input())
li = list(map(int, input().split()))
a = 0
br = False
while True:
    for i in li:
        if i % 2 != 0:
            br = True
            break
    if br:
        break
    a += 1
    li = list(map(lambda x: x / 2, li))
print(a)