TnT/CodeNet4Repair huggingface dataset:
Problem:
Takahashi received _otoshidama_ (New Year's money gifts) from N of his relatives.  You are given N values x_1, x_2, ..., x_N and N strings u_1, u_2, ..., u_N as input. Each string u_i is either `JPY` or `BTC`, and x_i and u_i represent the content of the otoshidama from the i-th relative.  For example, if x_1 = `10000` and u_1 = `JPY`, the otoshidama from the first relative is 10000 Japanese yen; if x_2 = `0.10000000` and u_2 = `BTC`, the otoshidama from the second relative is 0.1 bitcoins.  If we convert the bitcoins into yen at the rate of 380000.0 JPY per 1.0 BTC, how much are the gifts worth in total?

Incorrect submission (verdict: Wrong Answer):
a = int(input())
i = 0
b = []
for i in range(a):
    b.append(input().split())

print(b)
money_bit_all = 0
money_all = 0

for i in range(a):
    money_bit = 0
    if 'BTC' in b[i]:
        money_bit = 380000.0 * float(b[i][0])
        money_bit_all = money_bit_all + money_bit

    else:
        money_all = money_all + float(b[i][0])

print(money_all + money_bit_all)

Fixed, accepted submission:
a = int(input())
i = 0
b = []
for i in range(a):
    b.append(input().split())

money_bit_all = 0
money_all = 0

for i in range(a):
    money_bit = 0
    if 'BTC' in b[i]:
        money_bit = 380000.0 * float(b[i][0])
        money_bit_all = money_bit_all + money_bit

    else:
        money_all = money_all + float(b[i][0])

print(money_all + money_bit_all)
Problem:
An elementary school student Takahashi has come to a variety store.  He has two coins, A-yen and B-yen coins (yen is the currency of Japan), and wants to buy a toy that costs C yen. Can he buy it?  Note that he lives in Takahashi Kingdom, and may have coins that do not exist in Japan.

Incorrect submission (verdict: Wrong Answer):
import sys
stdin = sys.stdin

sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

a,b,c = li()

if a+b <= c:
    print("Yes")
else:
    print("No")

Fixed, accepted submission:
import sys
stdin = sys.stdin

sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

a,b,c = li()

if a+b >= c:
    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):
sx,sy,tx,ty = list(map(int, input().split()))

result = ""
dy = ty-sy
dx = tx-sx

for i in range(dy):
    result += "U"
for i in range(dx):
    result += "R"
for i in range(dy+1):
    result += "D"
for i in range(dx):
    result += "L"

result += "L"
for i in range(dy+1):
    result += "U"
for i in range(dx+1):
    result += "R"
result += "D"

result += "R"
for i in range(dy+1):
    result += "D"
for i in range(dx+1):
    result += "L"
result += "U"
print(result)


Fixed, accepted submission:
sx,sy,tx,ty = list(map(int, input().split()))

result = ""
dy = ty-sy
dx = tx-sx

for i in range(dy):
    result += "U"
for i in range(dx):
    result += "R"
for i in range(dy):
    result += "D"
for i in range(dx):
    result += "L"

result += "L"
for i in range(dy+1):
    result += "U"
for i in range(dx+1):
    result += "R"
result += "D"

result += "R"
for i in range(dy+1):
    result += "D"
for i in range(dx+1):
    result += "L"
result += "U"
print(result)
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):
N = list(map(int, input().split()))

if (N[0] > N[2]) and (N[1] < N[2]):
    print("Yes")
else:
    print("No")

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

if ((N[0] > N[2]) and (N[1] < N[2])) or ((N[0] < N[2]) and (N[1] > N[2])):
    print("Yes")
else:
    print("No")
Problem:
You are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.

Incorrect submission (verdict: Wrong Answer):
s = list(input().split())

ans = []
for i in range(len(s)):
    if i % 2 == 0:
        ans.append(s[i])

print(''.join(ans))

Fixed, accepted submission:
s = list(input())

ans = []
for i in range(len(s)):
    if i % 2 == 0:
        ans.append(s[i])

print(''.join(ans))
Problem:
In a factory, there are N robots placed on a number line. Robot i is placed at coordinate X_i and can extend its arms of length L_i in both directions, positive and negative.  We want to remove zero or more robots so that the movable ranges of arms of no two remaining robots intersect. Here, for each i (1 \leq i \leq N), the movable range of arms of Robot i is the part of the number line between the coordinates X_i - L_i and X_i + L_i, excluding the endpoints.  Find the maximum number of robots that we can keep.

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

    readline = sys.stdin.readline

    N = int(readline())
    XL = [list(map(int, readline().split())) for _ in [0] * N]
    arm = [(x + length, x + length) for x, length in XL]
    arm.sort()
    time, ans = 0, 0
    for i in range(N):
        end, start = arm[i]
        if time <= start:
            ans += 1
            time = end
    print(ans)


main()

Fixed, accepted submission:
def resolve():
    
    import sys
    
    readline = sys.stdin.readline

    N = int(readline())
    XL = [list(map(int, readline().split())) for _ in [0] * N]

    
    t = [(x + length, x - length) for x, length in XL]
    
    
    t.sort()               
    time = -float('inf')   
    ans = 0
    for i in range(N):
        end, start = t[i]  
        if time <= start:  
            ans += 1
            time = end     
    print(ans)

if __name__ == "__main__":
    resolve()
Problem:
Write a program which reads two integers a, b and an operator op, and then prints the value of a op b.  The operator op is '+', '-', '*' or '/' (sum, difference, product or quotient). The division should truncate any fractional part.

Incorrect submission (verdict: Wrong Answer):
while 1:
    n = input()

    if "?" in n:
        break
    print(eval(n))



Fixed, accepted submission:
while 1:
    n = input()
    if "?" in n:
        break
    print(int(eval(n)))
Problem:
Write a program which computes the digit number of sum of two integers a and b.

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

print( len(str(c)) )

Fixed, accepted submission:
while (1):
	try:
		a, b = map(int, input().split())
	except:
		break
	c = a+b
	print( len(str(c)) )
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):
x = int(input())
print(x*(x+1)/2)

Fixed, accepted submission:
x = int(input())
print(int(x*(x+1)/2))
Problem:
AtCoDeer the deer is going on a trip in a two-dimensional plane. In his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i.  If AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1). Note that **he cannot stay at his place**. Determine whether he can carry out his plan.

Incorrect submission (verdict: Wrong Answer):
N = int(input())
for i in range(N):
  t,x,y = map(int,input().split())
  if (x + y) > t or (x + y + t)%2 != 2:
    print("NO")
    exit()
print("YES")


Fixed, accepted submission:
N = int(input())
for i in range(N):
  t,x,y = map(int,input().split())
  if (x + y) > t or (x + y + t)%2 != 0:
    print("No")
    exit()
print("Yes")
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):
def judge():
  if a*b % 2 == 0:
    return 'Even'
  else:
    return 'Odd'

Fixed, accepted submission:
a, b = map(int, input().split())
 
if a*b % 2 == 0:
  print('Even')
else:
  print('Odd')
Problem:
You are given an integer N.  Find a triple of positive integers h, n and w such that 4/N = 1/h + 1/n + 1/w.  If there are multiple solutions, any of them will be accepted.

Incorrect submission (verdict: Wrong Answer):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq 
from itertools import *
import math
import re
import string

N = int(input())

def get_a(N):
    a = 1
    while True:
        if N < 4 * a:
            return a, 4*a-N, N*a
        a += 1

def get_b(N1, N2):
    b = 1
    while True:
        if N2 < b * N1:
            return b, b*N1-N2, b*N2
        b += 1

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def solve(N):
    a, N1, N2 = get_a(N)
    print("a,N1,N2 = ", a, N1, N2)
    b, N1, N2 = get_b(N1, N2)
    print("b,N1,N2 = ", b, N1, N2)
    g = gcd(N1,N2)
    N1 //= g
    N2 //= g
    
    print(a, b, N2)

for N in range(1, 100):
    solve(N)

solve(N)



Fixed, accepted submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq 
from itertools import *
import math
import re
import string

N = int(input())

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def solve(N):
    for a in range(1, 3501):
        N1 = 4*a - N
        N2 = N * a
        if N1 < 0: continue
        for b in range(1, 3501):
            N3 = b * N1 - N2
            N4 = b * N2
            if N4 > 0 and N3 > 0 and N4 % N3 == 0:
                print(a, b, N4//N3)
                return
    
solve(N)
Problem:
Snuke has an empty sequence a.  He will perform N operations on this sequence.  In the i-th operation, he chooses an integer j satisfying 1 \leq j \leq i, and insert j at position j in a (the beginning is position 1).  You are given a sequence b of length N. Determine if it is possible that a is equal to b after N operations. If it is, show one possible sequence of operations that achieves it.

Incorrect submission (verdict: Wrong Answer):
n = int(input())
B = list(map(int, input().split()))
flag = False
for i in range(n):
  if B[i]+1 > i:
    flag = True
if flag:
  print(-1)
else:
  for j in range(n):
    print(B[j])

Fixed, accepted submission:
n = int(input())
B = list(map(int, input().split()))
A = []
C = []
flag = True
j = 0
if max(B) > n:
  flag = False
if flag:
  while j < n:
    A = []
    for i in range(n-j):
      if B[i] == i+1:
        A.append(i+1)
    if A ==[]:
      flag = False
      break
    else:
      C.append(B[max(A)-1])
      del B[max(A)-1]
      j += 1
if flag:
  for k in range(1, n+1):
    print(C[-k])
else:
  print(-1)
Problem:
    This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top- right rail track is used for the exit. Ten cars, which have numbers from 1 to 10 respectively, use the rail tracks.  We can simulate the movement (comings and goings) of the cars as follow:    * An entry of a car is represented by its number.   * An exit of a car is represented by 0  For example, a sequence                 1 6 0 8 10   demonstrates that car 1 and car 6 enter to the rail tracks in this order, car 6 exits from the rail tracks, and then car 8 and car 10 enter.  Write a program which simulates comings and goings of the cars which are represented by the sequence of car numbers. The program should read the sequence of car numbers and 0, and print numbers of cars which exit from the rail tracks in order. At the first, there are no cars on the rail tracks. You can assume that 0 will not be given when there is no car on the rail tracks.

Incorrect submission (verdict: Wrong Answer):
garage = []
cars = []
while True:
    num = int(input())
    if num == 0:
        cars.append(garage.pop())
    else:
        garage.append(num)
        print(garage)
    if not garage:
        break
[print(car) for car in cars]

Fixed, accepted submission:
garage = []
while True:
    try:
        car = int(input())
    except:
        break
    if car == 0:
        print(garage.pop())
    else:
        garage.append(car)
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())
for i in range(1, N+1):
    if A <= sum(int(x) for x in str(i)) <= B:
        print(i)


Fixed, accepted submission:
N, A, B = map(int, input().split())
cnt = 0
for i in range(1, N+1):
    if A <= sum(int(x) for x in str(i)) <= B:
        cnt += i
print(cnt)
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):
a,b,c = map(int, input().split())
if c >= b:
  print('delicious')
elif c - b <= a:
  print('safe')
else:
  print('dangerous')

Fixed, accepted submission:
a,b,c = map(int, input().split())
if b >= c:
  print('delicious')
elif c - b <= a:
  print('safe')
else:
  print('dangerous')
Problem:
Alice and Brown loves games. Today, they will play the following game.  In this game, there are two piles initially consisting of X and Y stones, respectively. Alice and Bob alternately perform the following operation, starting from Alice:    * Take 2i stones from one of the piles. Then, throw away i of them, and put the remaining i in the other pile. Here, the integer i (1≤i) can be freely chosen as long as there is a sufficient number of stones in the pile.  The player who becomes unable to perform the operation, loses the game.  Given X and Y, determine the winner of the game, assuming that both players play optimally.

Incorrect submission (verdict: Wrong Answer):
X,Y = map(int,input().split())

print("Alice" if abs(X-Y)>=1 else "Bob")


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

print("Brown" if abs(X-Y) <= 1 else "Alice")
Problem:
We have a grid of H rows and W columns of squares. The color of the square at the i-th row from the top and the j-th column from the left (1 \leq i \leq H, 1 \leq j \leq W) is given to you as a character c_{i,j}: the square is white if c_{i,j} is `.`, and black if c_{i,j} is `#`.  Consider doing the following operation:    * Choose some number of rows (possibly zero), and some number of columns (possibly zero). Then, paint red all squares in the chosen rows and all squares in the chosen columns.  You are given a positive integer K. How many choices of rows and columns result in exactly K black squares remaining after the operation? Here, we consider two choices different when there is a row or column chosen in only one of those choices.

Incorrect submission (verdict: Wrong Answer):
import itertools
h,w,k=map(int,input().split())
lst=[list(input()) for i in range(h)]
lst2=[lst[i] for i in range(h)]

pin=0
for i in range(h):
  pin+=lst[i].count('#')

ans=0

for hei in itertools.product(range(2),repeat=h):
  for wid in itertools.product(range(2),repeat=w):
    cnt=0
    for i in range(h):
      for j in range(w):
        if hei[i]==1 and wid[j]==1 and lst[i][j]=="#":
          cnt+=1
    
    if cnt==k:
      ans+=1

Fixed, accepted submission:
import itertools
h,w,k=map(int,input().split())
lst=[list(input()) for i in range(h)]
lst2=[lst[i] for i in range(h)]

pin=0
for i in range(h):
  pin+=lst[i].count('#')

ans=0

for hei in itertools.product(range(2),repeat=h):
  for wid in itertools.product(range(2),repeat=w):
    cnt=0
    for i in range(h):
      for j in range(w):
        if hei[i]==1 and wid[j]==1 and lst[i][j]=="#":
          cnt+=1
    
    if cnt==k:
      ans+=1

    
print(ans)
Problem:
Takahashi bought a piece of apple pie at ABC Confiserie. According to his memory, he paid N yen (the currency of Japan) for it.  The consumption tax rate for foods in this shop is 8 percent. That is, to buy an apple pie priced at X yen before tax, you have to pay X \times 1.08 yen (rounded down to the nearest integer).  Takahashi forgot the price of his apple pie before tax, X, and wants to know it again. Write a program that takes N as input and finds X. We assume X is an integer.  If there are multiple possible values for X, find any one of them. Also, Takahashi's memory of N, the amount he paid, may be incorrect. If no value could be X, report that fact.

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

b = x//1.08
x1 = int(b*1.08)
x2 = int((b+1)*1.08)

if x1 == x:
  print(b)
elif x2 == x:
  print(b+1)
else:
  print(-1)

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

b = int(x/1.08)
x1 = int(b*1.08)
x2 = int((b+1)*1.08)

if x1 == x:
  print(b)
elif x2 == x:
  print(b+1)
else:
  print(":(")
Problem:
Write a program which reads an integer $S$ [second] and converts it to $h:m:s$ where $h$, $m$, $s$ denote hours, minutes (less than 60) and seconds (less than 60) respectively.

Incorrect submission (verdict: Wrong Answer):
x = int(input())
s = x % 60
x //= 60
m = x % 60
m //= 60
print("{}:{}:{}".format(x, m, s))


Fixed, accepted submission:
x = int(input())
s = x % 60
x //= 60
m = x % 60
x //= 60
print("{}:{}:{}".format(x, m, s))
Problem:
Snuke loves working out. He is now exercising N times.  Before he starts exercising, his _power_ is 1. After he exercises for the i-th time, his power gets multiplied by i.  Find Snuke's power after he exercises N times. Since the answer can be extremely large, print the answer modulo 10^{9}+7.

Incorrect submission (verdict: Wrong Answer):
n = int(input())
k = 1
for i in range(1,n+1):
  k = k**i
print(k%(10**9+7))

Fixed, accepted submission:
n = int(input())
k = 1
for i in range(1,n+1):
  k = k*i%(10**9+7)
print(k)
Problem:
Takahashi is a user of a site that hosts programming contests.   When a user competes in a contest, the _rating_ of the user (not necessarily an integer) changes according to the _performance_ of the user, as follows:    * Let the current rating of the user be a.   * Suppose that the performance of the user in the contest is b.   * Then, the new rating of the user will be the avarage of a and b.  For example, if a user with rating 1 competes in a contest and gives performance 1000, his/her new rating will be 500.5, the average of 1 and 1000.  Takahashi's current rating is R, and he wants his rating to be exactly G after the next contest.   Find the performance required to achieve it.

Incorrect submission (verdict: Wrong Answer):
import sys

S = input()
T = input()
cnt = 0 
i = 0
j = 0
while j < len(S):
    if T[-i] == S[-j] or S[-j] == "?":
        i += 1
        cnt += 1
    else:
        i, cnt = 0, 0
    j += 1
    if i == len(T) and (T[-i] == S[-j] or S[-j] == "?"):
        l = 0
        for l in range(len(S)):
            if S[l] == "?" and (l <= len(S)-j-1 or len(S)-j-1+len(T) < l):
                print("a",end="")
            elif S[l] == "?":
                print(T[-cnt+1],end="")
                cnt -= 1
            else:
                print(S[l],end="")
        print()
        sys.exit()
print("UNRESTORABLE")


Fixed, accepted submission:
R = int(input())
G = int(input())
print(2*G-R)
Problem:
In the online judge system, a judge file may include multiple datasets to check whether the submitted program outputs a correct answer for each test case. This task is to practice solving a problem with multiple datasets.  Write a program which reads an integer x and print it as is. Note that multiple datasets are given for this problem.

Incorrect submission (verdict: Wrong Answer):
while True:
    a=int(input())
    if a == 0:
        break
    print("Case 1: {0}".format(a))

Fixed, accepted submission:
i=1
while True:
    a=int(input())
    if a == 0:
        break
    print("Case {0}: {1}".format(i,a))
    i=i+1
Problem:
A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647.  Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers.  If given integers or the sum have more than 80 digits, print "overflow".

Incorrect submission (verdict: Wrong Answer):
n = int(input())
for i in range(n):
	x = int(input())
	y = int(input())
	ans = x + y
	if(ans <= 10**80):
		print(ans)
	else:
		print("overflow")


Fixed, accepted submission:
n = int(input())
for i in range(n):
	x = int(input())
	y = int(input())
	ans = x + y
	if(ans < 10**80):
		print(ans)
	else:
		print("overflow")
Problem:
You are given a string S consisting of lowercase English letters. Determine whether all the characters in S are different.

Incorrect submission (verdict: Wrong Answer):
s=input()
if len(s) == len(set(s)):
    print('Yes')
else:
    print('No')

Fixed, accepted submission:
s=input()
if len(s) == len(set(s)):
    print('yes')
else:
    print('no')
Problem:
We will buy a product for N yen (the currency of Japan) at a shop.  If we use only 1000-yen bills to pay the price, how much change will we receive?  Assume we use the minimum number of bills required.

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

Fixed, accepted submission:
n=int(input())
c=n%1000
if c==0:
  print(0)
else:
  print(1000-c)
Problem:
Evi has N integers a_1,a_2,..,a_N. His objective is to have N equal **integers** by transforming some of them.  He may transform each integer at most once. Transforming an integer x into another integer y costs him (x-y)^2 dollars. Even if a_i=a_j (i≠j), he has to pay the cost separately for transforming each of them (See Sample 2).  Find the minimum total cost to achieve his objective.

Incorrect submission (verdict: Wrong Answer):
N = int( input())
A = list( map( int, input().split()))
ans = 10**6
for i in range(N):
    a = A[i]
    cost = 0
    for j in range(N):
        cost += (A[j]-a)**2
    ans = min( ans, cost)
print(ans)

Fixed, accepted submission:
N = int( input())
A = list( map( int, input().split()))
ans = 10**6
for a in range(-100, 101):
    cost = 0
    for j in range(N):
        cost += (A[j]-a)**2
    ans = min( ans, cost)
print(ans)