TnT/CodeNet4Repair huggingface dataset:
Problem:
Takahashi has a strong stomach. He never gets a stomachache from eating something whose "best-by" date is at most X days earlier. He gets a stomachache if the "best-by" date of the food is X+1 or more days earlier, though.  Other than that, he finds the food delicious if he eats it not later than the "best-by" date. Otherwise, he does not find it delicious.  Takahashi bought some food A days before the "best-by" date, and ate it B days after he bought it.  Write a program that outputs `delicious` if he found it delicious, `safe` if he did not found it delicious but did not get a stomachache either, and `dangerous` if he got a stomachache.

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

if b-a > x:
    print("dangerous")
else:
    print("delicious")

Fixed, accepted submission:
x,a,b = (int(i) for i in input().split())

if b-a <= 0:
    print("delicious")
elif b-a <= x:
    print("safe")
else:
    print("dangerous")
Problem:
You are given two positive integers A and B. Compare the magnitudes of these numbers.

Incorrect submission (verdict: Wrong Answer):
a = input()
b = input()

al = len(a)
bl = len(b)

if al>bl:
    print('GREATER')
elif al<bl:
    print('LESS')
else:
    i = 0
    check = 0
    for i in range(al):
        if a[i] == b[i]:
            pass
        else:
            check += int(a[i]) - int(b[i])
            break

    if check > 0:
        print('GRAETER')
    elif check < 0:
        print('LESS')
    else:
        print('EQUAL')

Fixed, accepted submission:
a = input()
b = input()

al = len(a)
bl = len(b)

if al>bl:
    print('GREATER')
elif al<bl:
    print('LESS')
else:
    i = 0
    check = 0
    for i in range(al):
        if a[i] == b[i]:
            pass
        else:
            check += int(a[i]) - int(b[i])
            break

    if check > 0:
        print('GREATER')
    elif check < 0:
        print('LESS')
    else:
        print('EQUAL')
Problem:
Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.

Incorrect submission (verdict: Wrong Answer):
if input() in "aiueo".split():
    print("vowel")
else:
    print("consonant")

Fixed, accepted submission:
if input() in list("aiueo"):
    print("vowel")
else:
    print("consonant")
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+i)
for i in range(K):
  print(B-i)


Fixed, accepted submission:
A,B,K=map(int, input().split())
L = []
for i in range(min(K,(B-A+2)//2)):
  L.append(A+i)
for i in range(min(K,(B-A+2)//2)):
  L.append(B-i)
L = sorted(list(set(L)))
for i in L:
  print(i)
Problem:
You are given a positive integer X. Find the largest _perfect power_ that is at most X. Here, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not less than 2.

Incorrect submission (verdict: Wrong Answer):
x=int(input())
cnt=0
a=[]
for i in range(1,11):
    for j in range(1,32):
        a.append(j**i)
a=[l for l in a if l <= x]
print(max(a))

Fixed, accepted submission:
x=int(input())
a=[]
for i in range(2,11):
    for j in range(1,32):
        a.append(j**i)
a=[l for l in a if l <= x]
print(max(a))
Problem:
Compute A \times B, truncate its fractional part, and print the result as an integer.

Incorrect submission (verdict: Wrong Answer):
a, b = input().strip().split()
a, b = [int(a), float(b)]
b = b*100 + 0.000000001
print(b)
print(a*int(b)//100)

Fixed, accepted submission:
a, b = input().strip().split()
a, b = [int(a), float(b)]
b = b*100 + 0.000000001

print(a*int(b)//100)
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):
X = list(map(int, input().split()))

M = max(X)

if 3*M %2 == sum(X)%2:
    N = (3*M-sum(X))/2

else:
    N = (3*(M+1)-sum(X))/2

print(N)        


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

M = max(X)

if 3*M %2 == sum(X)%2:
    N = (3*M-sum(X))/2

else:
    N = (3*(M+1)-sum(X))/2

print(int(N))
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):
l = list(map(int, input().split()))
K = int(input())

def check(nums):
    if nums[0] < nums[1]:
        if nums[1] < nums[2]:
            print('yes')
            exit(0)

check(l)
for i in range(K):
    if l[0] > l[1]:
        l[1] *= 2
        check(l)
        continue
    elif l[1] > l[2]:
        l[2] *= 2
        check(l)
        continue

print('no')

exit(0)


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

def check(nums):
    if nums[0] < nums[1]:
        if nums[1] < nums[2]:
            print('Yes')
            exit(0)

check(l)
for i in range(K):
    if l[0] >= l[1]:
        l[1] *= 2
        check(l)
        continue
    elif l[1] >= l[2]:
        l[2] *= 2
        check(l)
        continue

print('No')

exit(0)
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())

c=0
for m in range(1,M+1):
    for d in range(1,D+1):
        if d>=10:
            t=str(d)
            if int(t[0])*int(t[1]) == m:
                c+=1

print(c)

Fixed, accepted submission:
# coding: utf-8
# Your code here!

M, D = map(int,input().split())

c=0
for m in range(1,M+1):
    for d in range(1,D+1):
        if d>=10:
            t=str(d)
            if int(t[0])>1 and int(t[1])>1 and int(t[0])*int(t[1]) == m:
                c+=1

print(c)
Problem:
You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively.    An example of a trapezoid  Find the area of this trapezoid.

Incorrect submission (verdict: Wrong Answer):
a=int(input())
b=int(input())
h=int(input())

print((a+b)*h*0.5)

Fixed, accepted submission:
a=int(input())
b=int(input())
h=int(input())

print(int((a+b)*h*0.5))
Problem:
Give a pair of integers (A, B) such that A^5-B^5 = X. It is guaranteed that there exists such a pair for the given integer X.

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

memo = []
A = 0
while True:
    A += 1
    A5 = A ** 5
    memo.append(A5)
    if A5 > X:
        try:
            i = memo.index(A5 - X)
        except ValueError:
            continue
        else:
            B = i
            break
    else:
        try:
            i = memo.index(X - A5)
        except ValueError:
            continue
        else:
            B = -i
            break

print(A, B)
    


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

memo = []
A = -1
while True:
    A += 1
    A5 = A ** 5
    memo.append(A5)
    if A5 > X:
        try:
            i = memo.index(A5 - X)
        except ValueError:
            continue
        else:
            B = i
            break
    else:
        try:
            i = memo.index(X - A5)
        except ValueError:
            continue
        else:
            B = -i
            break

print(A, B)
Problem:
You are given four digits N_1, N_2, N_3 and N_4. Determine if these can be arranged into the sequence of digits "1974".

Incorrect submission (verdict: Wrong Answer):
a,b,c,d=[int(n) for n in input().split(' ')]

N = [1, 9, 7, 4]

if a not in N:
    print("No")
else:
    N.remove(a)
    if b not in N:
        print("No")
    else:
        N.remove(b)
        if c not in N:
            print("No")
        else:
            N.remove(c)
            if d not in N:
                print("Np")
            else:
                print("Yes")

        

Fixed, accepted submission:
N =[int(n) for n in input().split(' ')]
 
M = [1, 9, 7, 4]
 
if set(N)==set(M):
    print("YES")
else:
    print("NO")
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):
cards = {
        'S': [0 for _ in range(13)],
        'H': [0 for _ in range(13)],
        'C': [0 for _ in range(13)],
        'D': [0 for _ in range(13)],
}
n = int(input())
for _ in range(n):
    (s, r) = input().split()

Fixed, accepted submission:
cards = {
        'S': [0 for _ in range(13)],
        'H': [0 for _ in range(13)],
        'C': [0 for _ in range(13)],
        'D': [0 for _ in range(13)],
        }
   
n = int(input())
for _ in range(n):
    (s, r) = input().split()
    r = int(r)
    cards[s][r - 1] = r
   
for s in ('S', 'H', 'C', 'D'):
    for r in range(13):
        if cards[s][r] == 0:
            print( '{0:s} {1:d}'.format(s, r+1))
Problem:
It is September 9 in Japan now.  You are given a two-digit integer N. Answer the question: Is 9 contained in the decimal notation of N?

Incorrect submission (verdict: Wrong Answer):
n = input()
print('Yes') if (n[0]==9 or n[1]==9) else print('No')

Fixed, accepted submission:
n = input()
print('Yes') if (n[0]=='9' or n[1]=='9') else print('No')
Problem:
How many ways are there to choose two distinct positive integers totaling N, disregarding the order?

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

count = 0

for i in range(1,int(N/2)+1):
    if i + N-i == N:
        count+=1
print(count) 

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

count = 0

if N % 2 == 0:
    for i in range(1,int(N/2)):
        if i != N-i:
            count+=1
else:
    for i in range(1,int(N/2)+1):
        if i != N:
            count+=1
print(count)
Problem:
You are given a string S of length N. Among its subsequences, count the ones such that all characters are different, modulo 10^9+7. Two subsequences are considered different if their characters come from different positions in the string, even if they are the same as strings.  Here, a subsequence of a string is a concatenation of **one or more** characters from the string without changing the order.

Incorrect submission (verdict: Wrong Answer):
import collections
line = int(input())
string = list(input())
print(string)
data = collections.Counter(string)
sum = 1
for word in data:
    sum *= (data[word] + 1)
print(sum - 1)

Fixed, accepted submission:
# coding: utf-8

import collections
line = int(input())
string = list(input())
data = collections.Counter(string)
sum = 1
for word in data:
    sum *= (data[word] + 1)
answer = (sum - 1)%(10**9 + 7)
print(answer)
Problem:
An expression is given in a line. Two consequtive symbols (operand or operator) are separated by a space character.  You can assume that +, - and * are given as the operator and an operand is a positive integer less than 106

Incorrect submission (verdict: Wrong Answer):
def is_operator(ele):
    if ele == "+" or ele == "-" or ele == "*":
        return True
    else:
        return False

def calc_reverse_polish_notation(A):
    stack = []
    for i in A:
        if is_operator(i):
            a = stack.pop()
            b = stack.pop()
            ans = eval("{0} {1} {2}".format(b, i, a))
            stack.append(ans)
        else:
            stack.append(i)
    return stack.pop()

A = list(map(str,input().split()))


Fixed, accepted submission:
def is_operator(ele):
    if ele == "+" or ele == "-" or ele == "*":
        return True
    else:
        return False

def calc_reverse_polish_notation(A):
    stack = []
    for i in A:
        if is_operator(i):
            a = stack.pop()
            b = stack.pop()
            ans = eval("{0} {1} {2}".format(b, i, a))
            stack.append(ans)
        else:
            stack.append(i)
    return stack.pop()

A = list(map(str,input().split()))

print(calc_reverse_polish_notation(A))
Problem:
Find the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive).

Incorrect submission (verdict: Wrong Answer):
n, a, b = map(int,input().split(' '))
total = 0
for num in range(1,n+1):
    split_nums = [int(s) for s in list(str(num))]
    sum = 0
    for s in split_nums:
        sum += s
    if a <= sum and sum <= b:
        print(split_nums, sum)
        total += num
print(total)

Fixed, accepted submission:
n, a, b = map(int,input().split(' '))
total = 0
for num in range(1,n+1):
    split_nums = [int(s) for s in list(str(num))]
    sum = 0
    for s in split_nums:
        sum += s
    if a <= sum and sum <= b:
        total += num
print(total)
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 = int(input())
a = sorted(list(map(int,input().split())))
print(sum(a[::2])-sum(a[1::2]))

Fixed, accepted submission:
N = int(input())
A = sorted(list(map(int,input().split())), reverse = True)
a = 0 
b = 0
for i in range(len(A)):
    if i%2 == 0:
        a += A[i]
    else:
        b += A[i]
print(a-b)
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):
def main():
    s = sorted(input())
    print('Yes' if s=='abc' else 'No')

if __name__ == '__main__':
    main()

Fixed, accepted submission:
def main():
    s = sorted(input())
    print('Yes' if s==['a','b','c'] else 'No')

if __name__ == '__main__':
    main()
Problem:
Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode:                 for i = 1 to A.length-1     key = A[i]     /* insert A[i] into the sorted sequence A[0,...,j-1] */     j = i - 1     while j >= 0 and A[j] > key         A[j+1] = A[j]         j--     A[j+1] = key   Note that, indices for array elements are based on 0-origin.  To illustrate the algorithms, your program should trace intermediate result for each step.

Incorrect submission (verdict: Wrong Answer):
def insertion_sort(array, element_number):
    for i in range(1, element_number):
        v = array[i]
        j = i - 1

        while(j>=0 and array[j] > v):
            array[j+1] = array[j]
            j = j - 1

        array[j+1] = v

        for k in range(0, element_number):
            if k < element_number:
                print(array[k] + ' ', end='')
            else:
                print(array[k], end='')

        if i < element_number-1:
            print('\n', end='')

def test():
    element_number = int(input())
    input_array = input().split()

    insertion_sort(input_array, element_number)

if __name__ == '__main__':
    test()

Fixed, accepted submission:
def insertion_sort(array):
    for i in range(len(array)):
        v = array[i]
        j = i - 1

        while(j>=0 and array[j] > v):
            array[j+1] = array[j]
            j = j - 1

        array[j+1] = v

        print(' '.join(map(str, array)))

    return array

if __name__ == '__main__':
    element_number = int(input())
    input_array = list(map(int, input().split()))

    insertion_sort(input_array)
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):
A, B, C = list(map(int, input().split()))

flag = False
for i in range(1, B + 1):
    remainder = A * i % B
    if remainder == C:
        flag = True
if flag:
    print("Yes")
else:
    print("No")


Fixed, accepted submission:
import math

A,B,C = map(int,input().split())

print('YES' if C % math.gcd(A,B) == 0 else 'NO')
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):
from collections import defaultdict
import queue

N,M = map(int,input().split())

guide = {}  
room = defaultdict(list)   

for i in range(M):
    a,b = map(int,input().split())
    room[a].append(b)
    room[b].append(a)

print(room)

q = queue.Queue()

for i in room[1]:
    q.put(i)
    guide[i] = 1

while not(q.empty()):
    x = q.get()
    for i in room[x]:
        if i not in guide:
            guide[i]=x
            q.put(i)

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


Fixed, accepted submission:
from collections import defaultdict
import queue

N,M = map(int,input().split())

guide = {}
room = defaultdict(list)

for i in range(M):
    a,b = map(int,input().split())
    room[a].append(b)
    room[b].append(a)


q = queue.Queue()

for i in room[1]:
    q.put(i)
    guide[i] = 1

while not(q.empty()):
    x = q.get()
    for i in room[x]:
        if i not in guide:
            guide[i]=x
            q.put(i)



if len(guide) != N:
    print("No")
else:
    print("Yes")
    for i in range(2,N+1):
        print(guide[i])
Problem:
Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i.  Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.

Incorrect submission (verdict: Wrong Answer):
s = input()
count = 0
for i in range(3):
    if s==1:
        count= count + 1

Fixed, accepted submission:
a = input()
c=0
for i in range(len(a)):
    if a[i] == '1':
        c = c + 1
print(c)
Problem:
Rng is preparing a problem set for a qualification round of CODEFESTIVAL.  He has N candidates of problems. The difficulty of the i-th candidate is D_i.  There must be M problems in the problem set, and the difficulty of the i-th problem must be T_i. Here, one candidate of a problem cannot be used as multiple problems.  Determine whether Rng can complete the problem set without creating new candidates of problems.

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

cou = 0
if N >= M:
    for i in range(M):
        if T[i] in D:
            D.remove(T[i])
            cou += 1
        else:
            x = 'No'
            break
            
    if cou == M:
        x = 'Yes'
else:
    x = 'No'

print(x)

Fixed, accepted submission:
N = int(input())
D = list(map(int, input().split()))
M = int(input())
T = list(map(int, input().split()))

D_dic = {k: 0 for k in D}
T_dic = {k: 0 for k in T}

for i in range(N):
    d = D[i]
    if D_dic[d]:
        a = D_dic[d] + 1
        D_dic[d] = a
    else:
        D_dic[d] = 1
    
for j in range(M):
    t = T[j]
    if T_dic[t]:
        b = T_dic[t] + 1
        T_dic[t] = b
    else:
        T_dic[t] = 1

cou = 0
if N >= M:
    for k in range(M):
        tk = T[k]
        try:
            if D_dic[tk]:
                c = D_dic[tk] - 1
                D_dic[tk] = c
                cou += 1
            else:
                x = 'NO'
                break
        except KeyError:
            x = 'NO'
            break
            
    if cou == M:
        x = 'YES'
else:
    x = 'NO'

print(x)
Problem:
Give a pair of integers (A, B) such that A^5-B^5 = X. It is guaranteed that there exists such a pair for the given integer X.

Incorrect submission (verdict: Wrong Answer):
x = int(input())
y = []
count = 0
for i in range(0, 70):
  y.append(i*i*i*i*i)
for i in y:
  count += 1
  for j in y[:count]:
    y2 = i + j
    y3 = i - j
    if y2 == x:
      print(str(i) + " " + str(j))
      break;
    if y3 == x:
      print(str(i) + " -" + str(j))
      break;

Fixed, accepted submission:
x = int(input())
y = []
count1 = 0
flag = 0
for i in range(0, 130):
  y.append(i*i*i*i*i)
for i in y:
  if i == x:
    print("0 -" + str(count1))
    flag = 1
    break;
  count1 += 1
count1 = 0
for i in y:
  if flag == 1:
    break;
  count2 = 0
  for j in y[:count1]:
    y2 = i + j
    y3 = i - j
    if y2 == x:
      print(str(count1) + " -" + str(count2))
      flag = 1
      break;
    if y3 == x:
      print(str(count1) + " " + str(count2))
      flag = 1
      break;
    count2 +=1
  count1 += 1
Problem:
Based on some criterion, Snuke divided the integers from 1 through 12 into three groups as shown in the figure below. Given two integers x and y (1 ≤ x < y ≤ 12), determine whether they belong to the same group.  

Incorrect submission (verdict: Wrong Answer):
x, y = map(int, input().split())
A=[1, 3, 5, 7, 8, 10, 12]
B=[4, 6, 9, 11]
C=[2]
if (x in A and y in A) or (x in B and y in B) or (x in C and y in C):
    print("YES")
else:
    print("NO")

Fixed, accepted submission:
A={1, 3, 5, 7, 8, 10, 12}
B={4, 6, 9, 11}
x = set(map(int, input().split()))
print("Yes" if x <= A or x <= B else "No")