TnT/CodeNet4Repair huggingface dataset:
Problem:
There are N children in AtCoder Kindergarten. Mr. Evi will arrange the children in a line, then give 1 candy to the first child in the line, 2 candies to the second child, ..., N candies to the N-th child. How many candies will be necessary in total?

Incorrect submission (verdict: Wrong Answer):
n = int(input())
print(n * (n + 1) / 2)

Fixed, accepted submission:
n = int(input())
print(n * (n + 1) // 2)
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):
num=int(input())
x=800*num
y=int(num/15)
s=x-y
print(s)

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

x=user*800
y=(int(user/15))*200

print(x-y)
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())
yen=int(N/1000)
oturi=N-1000*yen
print(oturi)

Fixed, accepted submission:
N= int(input())
yen=int(N/1000)
if N%1000==0:
    oturi=0
else:
    oturi=1000*(yen+1)-N
print(oturi)
Problem:
Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters.  Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s.  Given the name of the contest, print the abbreviation of the name.

Incorrect submission (verdict: Wrong Answer):
s = input()
''.join([i[0] for i in s.split() ])

Fixed, accepted submission:
s = input()
print(''.join([i[0] for i in s.split() ]))
Problem:
Snuke has come to a store that sells boxes containing balls. The store sells the following three kinds of boxes:    * Red boxes, each containing R red balls   * Green boxes, each containing G green balls   * Blue boxes, each containing B blue balls  Snuke wants to get a total of exactly N balls by buying r red boxes, g green boxes and b blue boxes. How many triples of non-negative integers (r,g,b) achieve this?

Incorrect submission (verdict: Wrong Answer):
R, G, B, N = map(int, input().split())
Ans = 0
for r in range(N//R+1):
  rest = N - R*r
  for g in range(N//G+1):
    rest = rest - G*g
    if rest % G == 0:
      Ans +=1
      
print(Ans)

Fixed, accepted submission:
R, G, B, N = map(int, input().split())
counter = 0
r_max = N//R+1
for r in range(r_max+1):
  temp = N - R*r
  for g in range(temp//G+1):
    now = temp - G*g
    if now% B == 0 and now//B >= 0:
      counter +=1
print(counter)
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 -*-
c = str(input())
S = {"a","i","u","e","o"}
if c in S is True:
  print("vowel")
else:
  print("consonant")

Fixed, accepted submission:
# -*- coding: utf-8 -*-
c = str(input())
if c == "a" or c == "i" or c == "u" or c == "e" or c == "o":
  print("vowel")
else:
  print("consonant")
Problem:
You manage 4 buildings, each of which has 3 floors, each of which consists of 10 rooms. Write a program which reads a sequence of tenant/leaver notices, and reports the number of tenants for each room.  For each notice, you are given four integers b, f, r and v which represent that v persons entered to room r of fth floor at building b. If v is negative, it means that −v persons left.  Assume that initially no person lives in the building.

Incorrect submission (verdict: Wrong Answer):
l = [[[0] * 10 for _ in range(3)] for _ in range(4)]
for _ in range(int(input())):
    b, f, r, v = map(int, input().split())
    l[b - 1][f - 1][r - 1] += v

for x in range(4):
    for y in range(3):
        print(*l[x][y])
    print("####################")

Fixed, accepted submission:
l = [[[0] * 10 for _ in range(3)] for _ in range(4)]
for _ in range(int(input())):
    b, f, r, v = map(int, input().split())
    l[b - 1][f - 1][r - 1] += v

for x in range(4):
    for y in range(3):
        print("", *l[x][y])
    if x != 3:
        print("#" * 20)
Problem:
In AtCoder Kingdom, Gregorian calendar is used, and dates are written in the "year-month-day" order, or the "month-day" order without the year.   For example, May 3, 2018 is written as 2018-5-3, or 5-3 without the year.  In this country, a date is called _Takahashi_ when the month and the day are equal as numbers. For example, 5-5 is Takahashi.   How many days from 2018-1-1 through 2018-a-b are Takahashi?

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

ans = a-1

for i in range(1,b-1):
  if a==i:
    ans = ans+1
    break

print(ans)

Fixed, accepted submission:
a,b = map(int,input().split())
 
ans = a-1
 
for i in range(1,b+1):
  if a==i:
    ans = ans+1
    break
print(ans)
Problem:
Iroha is very particular about numbers. There are K digits that she dislikes: D_1, D_2, ..., D_K.  She is shopping, and now paying at the cashier. Her total is N yen (the currency of Japan), thus she has to hand at least N yen to the cashier (and possibly receive the change).  However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.  Find the amount of money that she will hand to the cashier.

Incorrect submission (verdict: Wrong Answer):
# cook your dish here
s=input()
m=s.split()
n,k=m[0],m[1];
s=input()
m=s.split()
list=[]
nlist=[]

    
    
for i in m:
    list.append(int(i))
for i in range(0,10):
    if i not in list:
        nlist.append(i)

num=[int(d) for d in str(n)]
for i in range(len(num)):
    if (num[(-1)*i]) not in list:
        continue
    else:
        for j in nlist:
            if(j>num[(-1)*i]):
                num[(-1)*i]=j
for i in num:
    print(i,end="")
        
    



Fixed, accepted submission:
n, k = map(int, input().split())
d = list(map(int, input().split()))
w = [False] * 10
for i in d:
	w[i] = True
def check(n):
	while n:
		if w[n % 10]:
			return False
		n //= 10
	return True
ans = n
while not check(ans):
	ans += 1
print(ans)
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())
ans = 1000 - n
print(ans)

Fixed, accepted submission:
n = int(input())
ans = 1000 - (n % 1000)
print(ans) if ans != 1000 else print(0)
Problem:
We have a board with H horizontal rows and W vertical columns of squares. There is a bishop at the top-left square on this board. How many squares can this bishop reach by zero or more movements?  Here the bishop can only move diagonally. More formally, the bishop can move from the square at the r_1-th row (from the top) and the c_1-th column (from the left) to the square at the r_2-th row and the c_2-th column if and only if exactly one of the following holds:    * r_1 + c_1 = r_2 + c_2   * r_1 - c_1 = r_2 - c_2  For example, in the following figure, the bishop can move to any of the red squares in one move:  

Incorrect submission (verdict: Wrong Answer):
h,w =  map(int, input().split())

if (h*w)%2==0:
    print((h*w)/2)
else:
    print(((h*w)+1)/2)

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

if (h == 1) or (w == 1):
    print(1)
elif (h*w)%2==0:
    print(int((h*w)/2))
else:
    print(int(((h*w)+1)/2))
Problem:
There is an image with a height of H pixels and a width of W pixels. Each of the pixels is represented by either `.` or `*`. The character representing the pixel at the i-th row from the top and the j-th column from the left, is denoted by C_{i,j}.  Extend this image vertically so that its height is doubled. That is, print a image with a height of 2H pixels and a width of W pixels where the pixel at the i-th row and j-th column is equal to C_{(i+1)/2,j} (the result of division is rounded down).

Incorrect submission (verdict: Wrong Answer):
# coding = SJIS

h, w = map(int, input().split())
for i in range(h):
    a = str(input())
    for j in range(1):
        print(a)


Fixed, accepted submission:
# coding = SJIS

h, w = map(int, input().split())
row = []

for i in range(h):
    row.append(str(input()))

for i in range(h):
    for j in range(2):
        print(row[i])
Problem:
E869120 found a chest which is likely to contain treasure.   However, the chest is locked. In order to open it, he needs to enter a string S consisting of lowercase English letters.   He also found a string S', which turns out to be the string S with some of its letters (possibly all or none) replaced with `?`.  One more thing he found is a sheet of paper with the following facts written on it:    * Condition 1: The string S contains a string T as a contiguous substring.   * Condition 2: S is the lexicographically smallest string among the ones that satisfy Condition 1.  Print the string S.   If such a string does not exist, print `UNRESTORABLE`.

Incorrect submission (verdict: Wrong Answer):
S = list(input())
T = list(input())
LS = len(S)
LT = len(T)
for i in range(LS - LT + 1):
    for j in range(LT):
        if S[i + j] != T[j] and S[i + j] != "?":
            break
        if j == LT - 1:
            for k in range(LT):
                S[i + k] = T[k]
            s = str(S).replace("?", "a")
            print(S)
            exit()
# S = S.replace("?", "a")
print("UNRESTORABLE")


Fixed, accepted submission:
S = list(input())
T = list(input())
LS = len(S)
LT = len(T)
for i in reversed(range(LS - LT + 1)):
    for j in range(LT):
        if S[i + j] != T[j] and S[i + j] != "?":
            break
        if j == LT - 1:
            for k in range(LT):
                S[i + k] = T[k]
            s = str("".join(S)).replace("?", "a")
            print(s)
            exit()
print("UNRESTORABLE")
Problem:
The postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen `-`, and the other characters are digits from `0` through `9`.  You are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom.

Incorrect submission (verdict: Wrong Answer):
a,b=map(int,input().split())
s=input()
d=s[:a]+s[a+1:]
if s[a]=='-' and '-' not in d:
  print('YES')
else:
  print('NO')

Fixed, accepted submission:
a,b=map(int,input().split())
s=input()
d=s[:a]+s[a+1:]
if s[a]=='-' and '-' not in d:
  print('Yes')
else:
  print('No')
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())

y = (a / 15) * 200

x = a * 800

print(x-y)

Fixed, accepted submission:
a = int(input())
print((a * 800)-((a // 15) * 200))
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())
if N[0] == 9 or N[1] == 9:
  print("Yes")
else:
  print("No")

Fixed, accepted submission:
N = input()
if N[0] == "9"or N[1] == "9":
  print("Yes")
else:
  print("No")
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 = map(int,input().split())

print('delicious' if B <= A else 'safe' if A+B <= X else 'dangerous')

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

print('delicious' if B <= A else 'safe' if B <= A+X else 'dangerous')
Problem:
You are given two positive integers a and b. Let x be the average of a and b. Print x rounded up to the nearest integer.

Incorrect submission (verdict: Wrong Answer):

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


if ((a+b)/2)%1==0:
    print((a+b)/2)
else:
    print((a+b)/2-((a+b)/2)%1+1)


Fixed, accepted submission:

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

print((a+b+1)//2)
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):
import sys

N, Y = [int(x) for x in sys.stdin.readline().strip().split()]

a = Y // 10000
b = (Y - a * 10000) // 5000
c = (Y - a * 10000 - b * 5000) // 1000

if a + b + c > N:
    print("-1 -1 -1")
else:
    print(a, b, c)


Fixed, accepted submission:
import sys

N, Y = [int(x) for x in sys.stdin.readline().strip().split()]

a = Y // 10000
b = (Y - a * 10000) // 5000
c = (Y - a * 10000 - b * 5000) // 1000

while 1:
    t = a + b + c
    if N >= t + 9 and a > 0:
        a -= 1
        c += 10
        continue
    if N >= t + 4 and b > 0:
        b -= 1
        c += 5
        continue
    if N > t and a > 0:
        a -= 1
        b += 2
        continue
    break

if a + b + c != N or a < 0 or b < 0 or c < 0:
    print("-1 -1 -1")
else:
    print(a, b, c)
    #print(a + b + c)
    #print(a*10000+b*5000+c*1000)
Problem:
You are given a string S consisting of lowercase English letters. Find the lexicographically (alphabetically) smallest lowercase English letter that does not occur in S. If every lowercase English letter occurs in S, print `None` instead.

Incorrect submission (verdict: Wrong Answer):
import sys

s=list(input())
snum=len(list(set(s)))
if snum==26:
    print('None')
    sys.exit(0)
s.sort()
print(s[0])


Fixed, accepted submission:
import sys
sin={'a','b','c','d','e','f','g','h','i','j','k','l',
     'm','n','o','p','q','r','s','t','u','v','w','x',
     'y','z'}
s=list(input())
snum=len(list(set(s)))
if snum==26:
    print('None')
    sys.exit(0)

kotae=list(sin-set(s))
kotae.sort()
print(kotae[0])
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):
def check(i,A,B):
    k = 0
    for j in range(len(str(i))):
        k += i % 10
        i = int(i/10)
    if k >= A and k <= B:
        return 1
    else:
        return 0

N,A,B = map(int,input().split())
num = 0
for i in range(N + 1):
    c = check(i,A,B)
    if c == 1:
        print(i)
        num += i
print(num)

Fixed, accepted submission:
n,a,b = map(int,input().split())
total = 0
for i in range(1,n+1):
    tmp = list(str(i))
    for j in range(len(tmp)):
        tmp[j] = int(tmp[j])
    tmp = sum(tmp)
    if a <= tmp <= b:
        total += i
print(total)
Problem:
Sitting in a station waiting room, Joisino is gazing at her train ticket.  The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive).  In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds.  The given input guarantees that there is a solution. If there are multiple solutions, any of them will be accepted.

Incorrect submission (verdict: Wrong Answer):
s = input()
op = ["+","-"]
for i in range(1 << len(s) - 1):
    tmp = s[0]
    for j in range(len(s) - 1):
        if ((i >> j) & 1):
            tmp += op[0]
        else:
            tmp += op[1]
        tmp += s[j+1]
    ans = eval(tmp)
    if ans == 7:
        print(ans)


Fixed, accepted submission:
s = input()
op = ["+","-"]
ans = ""
for i in range(1 << len(s) - 1):
    tmp = s[0]
    for j in range(len(s) - 1):
        if ((i >> j) & 1):
            tmp += op[0]
        else:
            tmp += op[1]
        tmp += s[j+1]
    ans_ = eval(tmp)
    if ans_ == 7:
        ans = tmp+"=7"
print(ans)
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):
def abc083b():    
    n, a, b = map(int,input().split())

    cnt = 0
    for i in range(1, n + 1):    
        if a <=sum([int(num) for num in str(i)]) <= b:
            cnt += 1
    print(cnt)

if __name__ == '__main__':
    abc083b()

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

    cnt = 0
    for num in range(n + 1):    
        if a <=sum([int(i) for i in str(num)]) <= b:
            cnt += num
    print(cnt)

if __name__ == '__main__':
    abc083b()
Problem:
We have a board with H horizontal rows and W vertical columns of squares. There is a bishop at the top-left square on this board. How many squares can this bishop reach by zero or more movements?  Here the bishop can only move diagonally. More formally, the bishop can move from the square at the r_1-th row (from the top) and the c_1-th column (from the left) to the square at the r_2-th row and the c_2-th column if and only if exactly one of the following holds:    * r_1 + c_1 = r_2 + c_2   * r_1 - c_1 = r_2 - c_2  For example, in the following figure, the bishop can move to any of the red squares in one move:  

Incorrect submission (verdict: Wrong Answer):
h, w = map(int, input().split())
print(round(h*w))
  

Fixed, accepted submission:
h, w = map(int, input().split())
if(h == 1 or w == 1):
  print(1)
else:
  print((h*w+1)//2)
Problem:
There are N empty boxes arranged in a row from left to right. The integer i is written on the i-th box from the left (1 \leq i \leq N).  For each of these boxes, Snuke can choose either to put a ball in it or to put nothing in it.  We say a set of choices to put a ball or not in the boxes is good when the following condition is satisfied:    * For every integer i between 1 and N (inclusive), the total number of balls contained in the boxes with multiples of i written on them is congruent to a_i modulo 2.  Does there exist a good set of choices? If the answer is yes, find one good set of choices.

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

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    return divisors

li.reverse()

li_len = len(li)

li_ans = []
dic = {}
for n, l in enumerate(li):
    i = li_len - n
    s = 0
    if dic.get(i):
        s = dic[i]
    d2 = s % 2
    if l == d2:
        li_ans.append(0)
    else:
        divi = make_divisors(i)
        for d in divi:
            dic.setdefault(d, 0)
            dic[d] += 1
        li_ans.append(1)

li_ans.reverse()
print(sum(li_ans))
print(' '.join(map(str, li_ans)))

Fixed, accepted submission:
n=int(input())
a=list(map(int,input().split()))
t=[0]*n
p=[]
g=0
for i in range(n-1,-1,-1):
    if sum(t[i::i+1])%2!=a[i]:
        t[i]=1
        p.append(i+1)
        g+=1
print(g)
print(*p[::-1])
Problem:
Snuke signed up for a new website which holds programming competitions. He worried that he might forget his password, and he took notes of it. Since directly recording his password would cause him trouble if stolen, he took two notes: one contains the characters at the odd-numbered positions, and the other contains the characters at the even-numbered positions.  You are given two strings O and E. O contains the characters at the odd- numbered positions retaining their relative order, and E contains the characters at the even-numbered positions retaining their relative order. Restore the original password.

Incorrect submission (verdict: Wrong Answer):
O = list(input())
E = list(input())
N = len(O)+len(E)
if len(O)>len(E):
    E += ' '
elif len(O)<len(E):
    O += ' '
print(E)
print(O)
answer = []
for i,j in zip(O,E):
    answer.append(i)
    answer.append(j)
print(''.join(answer))

Fixed, accepted submission:
O = list(input())
E = list(input())
N = len(O)+len(E)
if len(O)>len(E):
    E += ' '
elif len(O)<len(E):
    O += ' '
answer = []
for i,j in zip(O,E):
    answer.append(i)
    answer.append(j)
print(''.join(answer))
Problem:
An integer X is called a Harshad number if X is divisible by f(X), where f(X) is the sum of the digits in X when written in base 10.  Given an integer N, determine whether it is a Harshad number.

Incorrect submission (verdict: Wrong Answer):
n=input()
print('Yes' if int(n)%sum(map(int,n)) else 'No')

Fixed, accepted submission:
n=input()
print('Yes' if int(n)%sum(map(int,n))==0 else 'No')
Problem:
We have a canvas divided into a grid with H rows and W columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j).   Initially, all the squares are white. square1001 wants to draw a picture with black paint. His specific objective is to make Square (i, j) black when s_{i, j}= `#`, and to make Square (i, j) white when s_{i, j}= `.`.   However, since he is not a good painter, he can only choose two squares that are horizontally or vertically adjacent and paint those squares black, for some number of times (possibly zero). He may choose squares that are already painted black, in which case the color of those squares remain black.   Determine if square1001 can achieve his objective.

Incorrect submission (verdict: Wrong Answer):
from collections import deque
H,W = map(int, input().split())
m = [input() for _ in range(H)]
visited=[[0]*W for _ in range(H)]
dhw = [(1,0),(-1,0),(0,1),(0,-1)]
def main():
  global visited
  for h in range(H):
    for w in range(W):
      if m[h][w]==".":
        continue
      for dh, dw in dhw:
        nh, nw = h+dh, w+dw
        if 0<=nh<H and 0<=nw<W:
          if m[nh][nw]=="#":
            break
      else:
        print("NO")
        return
  print("YES")
  return

if __name__ == "__main__":
  main()

Fixed, accepted submission:
from collections import deque
H,W = map(int, input().split())
m = [input() for _ in range(H)]
visited=[[0]*W for _ in range(H)]
dhw = [(1,0),(-1,0),(0,1),(0,-1)]
def main():
  global visited
  for h in range(H):
    for w in range(W):
      if m[h][w]==".":
        continue
      for dh, dw in dhw:
        nh, nw = h+dh, w+dw
        if 0<=nh<H and 0<=nw<W:
          if m[nh][nw]=="#":
            break
      else:
        print("No")
        return
  print("Yes")
  return

if __name__ == "__main__":
  main()