TnT/CodeNet4Repair huggingface dataset:
Problem:
There are N people numbered 1 to N. Each person wears a red hat or a blue hat.  You are given a string s representing the colors of the people. Person i wears a red hat if s_i is `R`, and a blue hat if s_i is `B`.  Determine if there are more people wearing a red hat than people wearing a blue hat.

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

cnt = 0
for s in S:
  if "R" == cnt:
    cnt += 1

if cnt > N - cnt:
  print("Yes")
else:
  print("No")

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

cnt = 0
for s in S:
  if "R" == s:
    cnt += 1

if cnt > N - cnt:
  print("Yes")
else:
  print("No")
Problem:
Takahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank.  The bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.)  Assuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or above for the first time?

Incorrect submission (verdict: Wrong Answer):
import math
x = int(input())
t = 100
count = 0
while t <= x:
  count += 1
  t = t+(math.floor(t*1/100))
print(count)

Fixed, accepted submission:
import math
x = int(input())
t = 100
count = 0
while t < x:
  count += 1
  t = t+(math.floor(t*1/100))
print(count)
Problem:
Two students of AtCoder Kindergarten are fighting over candy packs.  There are three candy packs, each of which contains a, b, and c candies, respectively.  Teacher Evi is trying to distribute the packs between the two students so that each student gets the same number of candies. Determine whether it is possible.  Note that Evi cannot take candies out of the packs, and the whole contents of each pack must be given to one of the students.

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

Fixed, accepted submission:
a, b, c = map(int, input().split())
if a + b == c or b + c == a or c + a == b:
    print("Yes")
else:
    print("No")
Problem:
There are three houses on a number line: House 1, 2 and 3, with coordinates A, B and C, respectively. Print `Yes` if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print `No` otherwise.

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

if A < C < B:
  print('YES')
elif B < C < A:
  print('YES')
else:
  print('NO')
  

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

if A < C < B:
  print('Yes')
elif B < C < A:
  print('Yes')
else:
  print('No')
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("NYoe s"[a<=c<=b])

Fixed, accepted submission:
a,b,c=map(int,input().split());print("NYoe s"[a<=c<=b::2])
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())
a = 0
if n % 2 == 0:
    a = n / 2 - 1
else:
    a = (n-1)/2

print(a)


Fixed, accepted submission:
n = int(input())
a = 0
if n % 2 == 0:
    a = n / 2 - 1
else:
    a = (n-1)/2

print(int(a))
Problem:
Joisino wants to evaluate the formula "A op B". Here, A and B are integers, and the binary operator op is either `+` or `-`. Your task is to evaluate the formula instead of her.

Incorrect submission (verdict: Wrong Answer):
A, Op, B = input().split()
A = int(A)
B = int(B)
 
if A == '+':
    print(A+B)
elif Op == '-':
    print(A-B)

Fixed, accepted submission:
A, Op, B = input().split()
A = int(A)
B = int(B)
 
if Op == '+':
    print(A+B)
elif Op == '-':
    print(A-B)
Problem:
AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.

Incorrect submission (verdict: Wrong Answer):
a, b = map(int, input().split())
if (a * b) / 2 == 0:
  print("Even")
else:
  print("Odd")

Fixed, accepted submission:
a, b = map(int, input().split())
if a*b%2 == 0:
  print("Even")
else:
  print("Odd")
Problem:
Let f(n) be the number of triples of integers (x,y,z) that satisfy both of the following conditions:    * 1 \leq x,y,z   * x^2 + y^2 + z^2 + xy + yz + zx = n  Given an integer N, find each of f(1),f(2),f(3),\ldots,f(N).

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

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

for i in ans:
    print(i)

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

ans =[0]*(N+1)
for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            s = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if s <= N:
                ans[s] += 1

for i in range(1, N+1):
    print(ans[i])
Problem:
Two students of AtCoder Kindergarten are fighting over candy packs.  There are three candy packs, each of which contains a, b, and c candies, respectively.  Teacher Evi is trying to distribute the packs between the two students so that each student gets the same number of candies. Determine whether it is possible.  Note that Evi cannot take candies out of the packs, and the whole contents of each pack must be given to one of the students.

Incorrect submission (verdict: Wrong Answer):
a=map(int,input().split())
ans='No'
if 2*max(a)==sum(a):
  ans='Yes'
print(ans)

Fixed, accepted submission:
a=list(map(int,input().split()))
ans='No'
if 2*max(a)==sum(a):
  ans='Yes'
print(ans)
Problem:
Write a program which reads the two dices constructed in the same way as [Dice I](description.jsp?id=ITP1_11_A), and determines whether these two dices are identical. You can roll a dice in the same way as [Dice I](description.jsp?id=ITP1_11_A), and if all integers observed from the six directions are the same as that of another dice, these dices can be considered as identical.

Incorrect submission (verdict: Wrong Answer):
import random
def N():
    num=Dice[0]
    Dice[0]=Dice[1]
    Dice[1]=Dice[5]
    Dice[5]=Dice[4]
    Dice[4]=num
def E():
    num=Dice[0]
    Dice[0]=Dice[3]
    Dice[3]=Dice[5]
    Dice[5]=Dice[2]
    Dice[2]=num
def W():
    num=Dice[0]
    Dice[0]=Dice[2]
    Dice[2]=Dice[5]
    Dice[5]=Dice[3]
    Dice[3]=num
def S():
    num=Dice[0]
    Dice[0]=Dice[4]
    Dice[4]=Dice[5]
    Dice[5]=Dice[1]
    Dice[1]=num
Dice=[int(i) for i in input().split()]
Dice2=[int(i) for i in input().split()]
if (Dice[0] in Dice2)==False:
    print('No')
else:
    while True:
        rand=random.randint(1,4)
        if rand==1:
            N()
        elif rand==2:
            E()
        elif rand==3:
            W()
        else:
            S()
        if Dice[0]==Dice2[0]:
            break
    for i in range(3):
        N()
        W()
        S()
        if Dice==Dice2:
            break
    if Dice==Dice2:
        print('Yes')
    else:
        print('No')

Fixed, accepted submission:
def N():
    num=Dice[0]
    Dice[0]=Dice[1]
    Dice[1]=Dice[5]
    Dice[5]=Dice[4]
    Dice[4]=num
def E():
    num=Dice[0]
    Dice[0]=Dice[3]
    Dice[3]=Dice[5]
    Dice[5]=Dice[2]
    Dice[2]=num
def W():
    num=Dice[0]
    Dice[0]=Dice[2]
    Dice[2]=Dice[5]
    Dice[5]=Dice[3]
    Dice[3]=num
def S():
    num=Dice[0]
    Dice[0]=Dice[4]
    Dice[4]=Dice[5]
    Dice[5]=Dice[1]
    Dice[1]=num
Dice=[int(i) for i in input().split()]
Dice2=[int(i) for i in input().split()]
if (Dice[0] in Dice2)==False:
    print('No')
else:
    for j in range(6):
        if j%2==0:
            N()
        else:
            W()
        for i in range(4):
            N()
            W()
            S()
            if Dice==Dice2:
                break
        if Dice==Dice2:
            break 
    if Dice==Dice2:
        print('Yes')
    else:
        print('No')
Problem:
Dolphin resides in two-dimensional Cartesian plane, with the positive x-axis pointing right and the positive y-axis pointing up.   Currently, he is located at the point (sx,sy). In each second, he can move up, down, left or right by a distance of 1.   Here, both the x\- and y-coordinates before and after each movement must be integers.   He will first visit the point (tx,ty) where sx < tx and sy < ty, then go back to the point (sx,sy), then visit the point (tx,ty) again, and lastly go back to the point (sx,sy).   Here, during the whole travel, he is not allowed to pass through the same point more than once, except the points (sx,sy) and (tx,ty).   Under this condition, find a shortest path for him.

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

x = c - a
y = d - b

z = []
z += y * 'U'
z += x * 'R'
z += y * 'D'
z += (x + 1) * 'L'
z += (y + 1) * 'U'
z += (1 + x) * 'R'
z += 'U'
z += 'R'
z += (y + 1) * 'U'
z += (1 + x) *'L'
z += 'U'


print(''.join(z))

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

x = c - a
y = d - b

z = []
z += y * 'U'
z += x * 'R'
z += y * 'D'
z += (x + 1) * 'L'
z += (y + 1) * 'U'
z += (1 + x) * 'R'
z += 'D'
z += 'R'
z += (y + 1) * 'D'
z += (1 + x) *'L'
z += 'U'

print(''.join(z))
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):
N=int(input())
arr=list(map(int,input().split()))
for key in range(1,len(arr)):
    temp=arr[key]
    i=key-1
    while i>=0 and arr[i]>temp:
        arr[i+1]=arr[i]
        i-=1
    arr[i+1]=temp
    print(*arr)

Fixed, accepted submission:
N=int(input())
arr=list(map(int,input().split()))
print(' '.join(map(str,arr)))
for key in range(1,len(arr)):
    temp=arr[key]
    i=key-1
    while i>=0 and arr[i]>temp:
        arr[i+1]=arr[i]
        i-=1
    arr[i+1]=temp
    print(*arr)
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 = list(input())
print("Yes" if N[0] == 9 or N[1] == 9 else "No")

Fixed, accepted submission:
N = list(input())
print("Yes" if N[0] == "9" or N[1] == "9" else "No")
Problem:
Snuke has N integers: 1,2,\ldots,N. He will choose K of them and give those to Takahashi.  How many ways are there to choose K consecutive integers?

Incorrect submission (verdict: Wrong Answer):
N, K = input().split(" ")
print(N)

Fixed, accepted submission:
line = input().split(" ")
N = int(line[0])
M = int(line[1])

count = 0
    
for i in range(1, N+1):
    for j in range(M):
        if i+j > N:
            break
        if j == M-1:
            count += 1

print(count)
Problem:
We conducted a survey on newspaper subscriptions. More specifically, we asked each of the N respondents the following two questions:    * Question 1: Are you subscribing to Newspaper X?   * Question 2: Are you subscribing to Newspaper Y?  As the result, A respondents answered "yes" to Question 1, and B respondents answered "yes" to Question 2.  What are the maximum possible number and the minimum possible number of respondents subscribing to both newspapers X and Y?  Write a program to answer this question.

Incorrect submission (verdict: Wrong Answer):
n,a,b = list(map(int, input().split()))
print(max(a,b), max(a+b-n,0))

Fixed, accepted submission:
n,a,b = list(map(int, input().split()))
print(min(a,b), max(a+b-n,0))
Problem:
There are three houses on a number line: House 1, 2 and 3, with coordinates A, B and C, respectively. Print `Yes` if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print `No` otherwise.

Incorrect submission (verdict: Wrong Answer):
a,b,c = map(int, input().split())
if ((a<b)&(b<c))|((a>b)&(b>c)):
  print ("Yes")
else:
  print("No")

Fixed, accepted submission:
a,b,c = map(int, input().split())
if ((a<c)&(c<b))|((a>c)&(c>b)):
  print ("Yes")
else:
  print("No")
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 = input()
if 'AC' in S:
  print("AC")
else:
  print("NO")

Fixed, accepted submission:
S = input()
if 'AC' in S:
  print("Yes")
else:
  print("No")
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())
sum = 0

for i in range(1, n+1):
    tmpi = 0
    for c in str(i):
        tmpi += int(c)
    if tmpi >= a and b >= tmpi:
        sum += tmpi
print(sum)

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

for i in range(1, n+1):
    tmpi = 0
    for c in str(i):
        tmpi += int(c)
    if tmpi >= a and b >= tmpi:
        sum += i
print(sum)
Problem:
Snuke lives at position x on a number line. On this line, there are two stores A and B, respectively at position a and b, that offer food for delivery.  Snuke decided to get food delivery from the closer of stores A and B. Find out which store is closer to Snuke's residence.  Here, the distance between two points s and t on a number line is represented by |s-t|.

Incorrect submission (verdict: Wrong Answer):
a = 0
a, b, c = (abs(int(i) - a) for i in input().split())
if b > c:
  print("B")
else:
  print("A")




Fixed, accepted submission:
x, a, b = (int(i) for i in input().split())
if abs(a-x) > abs(b-x):
  print("B")
else:
  print("A")
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):
s=input()
n = len(s)

for i in range(n): 
    for j in range(i,n): #
        tmp = s[:i]+s[j:]
        if tmp == "keyence":
            print("YES")
            quit()

print("NO")


Fixed, accepted submission:

a = list(map(int,input().split()))

if 1 in a:
    if 9 in a:
        if 7 in a:
            if 4 in a:
                print("YES")
            else :
                print("NO")
        else :
            print("NO")            
    else :
        print("NO")
else :
    print("NO")
Problem:
E869120 has A 1-yen coins and infinitely many 500-yen coins.   Determine if he can pay exactly N yen using only these coins.

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

amari = N % 500
if amari <= A:
    print("YES")
else:
    print("NO")

Fixed, accepted submission:
N = int(input())
A = int(input())
 
amari = N % 500
if amari <= A:
  print("Yes")
else:
  print("No")
Problem:
In programming languages like C/C++, a goto statement provides an unconditional jump from the "goto" to a labeled statement. For example, a statement "goto CHECK_NUM;" is executed, control of the program jumps to CHECK_NUM. Using these constructs, you can implement, for example, loops.  Note that use of goto statement is highly discouraged, because it is difficult to trace the control flow of a program which includes goto.  Write a program which does precisely the same thing as the following program (this example is wrtten in C++). Let's try to write the program without goto statements.                 void call(int n){   int i = 1;  CHECK_NUM:   int x = i;   if ( x % 3 == 0 ){     cout << " " << i;     goto END_CHECK_NUM;   }  INCLUDE3:   if ( x % 10 == 3 ){     cout << " " << i;     goto END_CHECK_NUM;   }   x /= 10;   if ( x ) goto INCLUDE3;  END_CHECK_NUM:   if ( ++i <= n ) goto CHECK_NUM;    cout << endl; }

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

for i in range(3,a+1):
    if i% 3==0:
        print(" "+str(i),end=" ")

  
    

Fixed, accepted submission:
n = int(input())
for i in range(1, n + 1):
    if i % 3 == 0:
        print(' ' + str(i), end='')
    else:
        s = str(i)
        if '3' in s:
            print(' ' + str(i), end='')
print('')
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):
a=int(input())
print(a*800-200*a//15)

Fixed, accepted submission:
a=int(input())
print(a*800-200*(a//15))
Problem:
Snuke and Raccoon have a heap of N cards. The i-th card from the top has the integer a_i written on it.  They will share these cards. First, Snuke will take some number of cards from the top of the heap, then Raccoon will take all the remaining cards. Here, both Snuke and Raccoon have to take at least one card.  Let the sum of the integers on Snuke's cards and Raccoon's cards be x and y, respectively. They would like to minimize |x-y|. Find the minimum possible value of |x-y|.

Incorrect submission (verdict: Wrong Answer):
N = int(input())
A = list(map(int,input().split()))
X = [0]*N

S = sum(A)
ans = 10**11

for i in range(1,N):
    X[i] = X[i-1] + A[i]
    t = abs(X[i]+X[i]-S)
    ans = min(ans,t)

print(ans)
    

Fixed, accepted submission:
n=int(input())
a=list(map(int,input().split()))
from itertools import accumulate
s=list(accumulate(a))
a_sum=sum(a)
ans=10**18
if n==2:
  print(abs(a[0]-a[1]))
  exit(0)
for i in range(1,n-1):
  x=s[i]
  y=a_sum-x
  ans=min(ans,abs(x-y))
print(ans)
Problem:
We will say that two integer sequences of length N, x_1, x_2, ..., x_N and y_1, y_2, ..., y_N, are _similar_ when |x_i - y_i| \leq 1 holds for all i (1 \leq i \leq N).  In particular, any integer sequence is similar to itself.  You are given an integer N and an integer sequence of length N, A_1, A_2, ..., A_N.  How many integer sequences b_1, b_2, ..., b_N are there such that b_1, b_2, ..., b_N is similar to A and the product of all elements, b_1 b_2 ... b_N, is even?

Incorrect submission (verdict: Wrong Answer):
n = int(input())
a = [int(i) for i in input().split()]
print(a)

cnt = 0
for i in range(n):
    if a[i] % 2 == 0:
        cnt += 1

x = 3 ** n - 2 ** cnt

print(x)

Fixed, accepted submission:
n = int(input())
a = [int(i) for i in input().split()]

cnt = 0
for i in range(n):
    if a[i] % 2 == 0:
        cnt += 1

x = 3 ** n - 2 ** cnt

print(x)
Problem:
You are given an integer N. Find the number of the positive divisors of N!, modulo 10^9+7.

Incorrect submission (verdict: Wrong Answer):
n = int(input())
ps = [0] * (n + 1)
for i in range(2, n + 1):
    x = i
    p = 2
    while x > 1:
        while x % p == 0:
            ps[p] += 1
            x //= p
        p += 1
print (ps)
ans = 1
for c in ps:
    ans = (ans * (c + 1)) % 1000000007
print (ans)

Fixed, accepted submission:
n = int(input())
ps = [0] * (n + 1)
for i in range(2, n + 1):
    x = i
    p = 2
    while x > 1:
        while x % p == 0:
            ps[p] += 1
            x //= p
        p += 1
ans = 1
for c in ps:
    ans = (ans * (c + 1)) % 1000000007
print (ans)
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):
#coding: utf-8
print(["vowel", "consonant"][input() in "aiueo"])

Fixed, accepted submission:
#coding: utf-8
print(["consonant","vowel"][input() in "aiueo"])
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):
#atcoder template
def main():
    import sys
    imput = sys.stdin.readline
    
    
    #input
    N, M = map(int, input().split())
    AB = [map(int, input().split()) for _ in range(M)]

    C = [[] for _ in range(N+1)]
    for a, b in AB:
        C[a].append(b)
        C[b].append(a)     

    #output
    
    from collections import deque

    
    search_stack = deque([1])

    signpost = [-1] * (N+1)

    while search_stack:
        next_position = search_stack.popleft()
        for node in C[next_position]:
            if signpost[node] == -1:
                signpost[node] = next_position
                search_stack.append(node)

    print("Yes")
    for i in range(2, N):
        print(signpost[i])

    
if __name__ == "__main__":
    main()

Fixed, accepted submission:
#atcoder template
def main():
    import sys
    imput = sys.stdin.readline
    
    
    #input
    N, M = map(int, input().split())
    AB = [map(int, input().split()) for _ in range(M)]

    C = [[] for _ in range(N+1)]
    for a, b in AB:
        C[a].append(b)
        C[b].append(a)     

    #output
    
    from collections import deque

    
    search_stack = deque([1])

    signpost = [-1] * (N+1)

    while search_stack:
        next_position = search_stack.popleft()
        for node in C[next_position]:
            if signpost[node] == -1:
                signpost[node] = next_position
                search_stack.append(node)

    print("Yes")
    for i in range(2, N+1):
        print(signpost[i])
    
if __name__ == "__main__":
    main()
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())
a = list(input() for i in range(n))
print(sorted(a))

Fixed, accepted submission:
n, l = map(int, input().split())
a = list(input() for i in range(n))
ans = ''
for i in sorted(a):
  ans += i
print(ans)