TnT/CodeNet4Repair huggingface dataset:
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):
num = input()

ls = [0] * 3
for i in range(2 ** 3):
    make7 = int(num[0])
    for j in range(3):
        if (i >> j) & 1:
            make7 += int(num[j+1])
            ls[j] = "+"
        else:
            make7 -= int(num[j+1])
            ls[j] = "-"
    if make7 == 7:
        print(num[0] + ls[0] + num[1] + ls[1] + num[2] + ls[2] + num[3])
        exit()


Fixed, accepted submission:
num = input()

ls = [0] * 3
for i in range(2 ** 3):
    make7 = int(num[0])
    for j in range(3):
        if (i >> j) & 1:
            make7 += int(num[j+1])
            ls[j] = "+"
        else:
            make7 -= int(num[j+1])
            ls[j] = "-"
    if make7 == 7:
        print(num[0] + ls[0] + num[1] + ls[1] + num[2] + ls[2] + num[3] + "=7")
        exit()
Problem:
The commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word "bill" refers to only these.  According to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situation is possible, and if it is, find a possible set of bills contained in the envelope. Assume that his grandfather is rich enough, and the envelope was large enough.

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

f = False
for i in range(N+1):
    for j in range(N+1-i):
        if (Y-(10000*i + 5000*j))//1000 <=N-(i+j) and Y-(10000*i + 5000*j) >= 0:
            f = True
            anls = [i,j,(Y-(10000*i + 5000*j))//1000]

if f:
    print(anls[0],anls[1],anls[2])
else:
    print(-1,-1,-1)



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

f = False
for i in range(N+1):
    for j in range(N+1-i):
        if (Y-(10000*i + 5000*j))//1000 ==N-(i+j) and (Y-(10000*i + 5000*j))>=0:
            f = True
            anls = [i,j,N-(i+j)]

if f:
    print(anls[0],anls[1],anls[2])
else:
    print(-1,-1,-1)
Problem:
Snuke has one biscuit and zero Japanese yen (the currency) in his pocket. He will perform the following operations exactly K times in total, in the order he likes:    * Hit his pocket, which magically increases the number of biscuits by one.   * Exchange A biscuits to 1 yen.   * Exchange 1 yen to B biscuits.  Find the maximum possible number of biscuits in Snuke's pocket after K operations.

Incorrect submission (verdict: Wrong Answer):
K,A,B = (int(i) for i in input().split())
if A+2>=B:
    print(1+K)
else:
    Bis = A
    K-=A-1
    print(K)
    Bis += int(K/2)*(B-A)
    if(K)%2==1:
        Bis+=1
    print(Bis)



Fixed, accepted submission:
K,A,B = (int(i) for i in input().split())
if A+2>=B:
    print(1+K)
else:
    Bis = A
    K-=A-1
    Bis += int(K/2)*(B-A)
    if(K)%2==1:
        Bis+=1
    print(Bis)
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 = map(int, input().split())

if any((a * i) % b == c for i in range(1, b+1)):
    print('Yes')
else:
    print('No')
    





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

if any((a * i) % b == c for i in range(1, b+1)):
    print('YES')
else:
    print('NO')
Problem:
Takahashi has N balls. Initially, an integer A_i is written on the i-th ball.  He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls.  Find the minimum number of balls that Takahashi needs to rewrite the integers on them.

Incorrect submission (verdict: Time Limit Exceeded):
N,K = map(int, input().split())
A = [int(i) for i in input().split()]

l=[]
for i in range(N+1):
  l.append(A.count(i))

ls = sorted(l,reverse=True)

j= K
ans = 0
while ls[j] != 0:
  ans += ls[j]

print(ans)

Fixed, accepted submission:
import collections as co
N,K = map(int, input().split())
A = list(map(int, input().split()))

ldic = co.Counter(A)        
l = list(ldic.values())
ls = sorted(l,reverse=True)

print(sum(ls[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):
print(2 * int(input()) - int(input()))

Fixed, accepted submission:
print(-int(input()) + 2 * int(input()))
Problem:
An _X -layered kagami mochi_ (X ≥ 1) is a pile of X round mochi (rice cake) stacked vertically where each mochi (except the bottom one) has a smaller diameter than that of the mochi directly below it. For example, if you stack three mochi with diameters of 10, 8 and 6 centimeters from bottom to top in this order, you have a 3-layered kagami mochi; if you put just one mochi, you have a 1-layered kagami mochi.  Lunlun the dachshund has N round mochi, and the diameter of the i-th mochi is d_i centimeters. When we make a kagami mochi using some or all of them, at most how many layers can our kagami mochi have?

Incorrect submission (verdict: Wrong Answer):
N,ans,x=int(input()),0,0
s=sorted([int(input()) for i in range(N)])
print(s)
for i in range(N):
    if s[i]>x:
        ans+=1
        x=s[i]
print(ans)        

Fixed, accepted submission:
N,ans,x=int(input()),0,0
s=sorted([int(input()) for i in range(N)])
for i in range(N):
    if s[i]>x:
        ans+=1
        x=s[i]
print(ans)
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):
a = [1,3, 5,7,8,10,12]
b = [4,6,9,11]
c = [2]

x, y = map(int,input().split())

for i in a,b:
    if x in i and y in i:
        print('yes')
        break
    else:
        print('no')
        break

Fixed, accepted submission:
a = [1,3, 5,7,8,10,12]
b = [4,6,9,11]
c = [2]

x, y = map(int,input().split())
ans = []

for i in a,b:
    if x in i and y in i:
        ans.append('Yes')
    else:
        ans.append('No')
        
if 'Yes' in ans:
    print('Yes')
else:
    print('No')
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 = input().split()
g = ['4', '6', '9', '11']

if (x == y == 2) or g.count(x) == g.count(y) == 1:
	print('Yes')
else:
	print('No')

Fixed, accepted submission:
x, y = input().split()
a = ['4', '6', '9', '11']
b = ['1', '3', '5', '7', '8', '10', '12']

if (x == y == '2'):
	print('Yes')
elif (a.count(x) == a.count(y) == 1):
	print('Yes')
elif (b.count(x) == b.count(y) == 1):
	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):
from collections import deque, Counter, defaultdict
from itertools import chain, combinations
import json
# import numpy as np
import bisect
import sys
import math
import bisect
from functools import lru_cache

sys.setrecursionlimit(10 ** 8)

M = 10 ** 9 + 7
INF = 10 ** 17


def main():
    N = int(input())
    # A = [int(a) for a in input().split()]
    c = 1
    d = 100
    while True:
        d = int(d * 1.01)
        if d > N:
            print(c)
            return
        c += 1


if __name__ == "__main__":
    main()


Fixed, accepted submission:
from collections import deque, Counter, defaultdict
from itertools import chain, combinations
import json
# import numpy as np
import bisect
import sys
import math
import bisect
from functools import lru_cache

sys.setrecursionlimit(10 ** 8)

M = 10 ** 9 + 7
INF = 10 ** 17


def main():
    N = int(input())
    # A = [int(a) for a in input().split()]
    c = 1
    d = 100
    while True:
        d = int(d * 1.01)
        if d >= N:
            print(c)
            return
        c += 1


if __name__ == "__main__":
    main()
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()
ans=0
for i in range(3):
  if s[i]=="1":
    ans+=1

Fixed, accepted submission:
s=input()
ans=0
for i in range(3):
  if s[i]=="1":
    ans+=1
print(ans)
Problem:
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:                 this is a pen   is would become:                 uijt jt b qfo   Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".

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

sentence = ''.join([line for line in f])

ceasar1 = str.maketrans(string.ascii_lowercase, string.ascii_lowercase[1:] + string.ascii_lowercase[:1])
for i in range(len(string.ascii_lowercase)):
    sentence = sentence.translate(ceasar1)
    for word in ['the', 'this', 'that']:
        if sentence.find(word) != -1:
            print(sentence)
            break

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

ceasar1 = str.maketrans(string.ascii_lowercase, string.ascii_lowercase[1:] + string.ascii_lowercase[:1])

for sentence in f:
    for i in range(len(string.ascii_lowercase)):
        sentence = sentence.translate(ceasar1)
        if 'the' in sentence or 'this' in sentence or 'that' in sentence:
            print(sentence, end='')
            break
Problem:
You are given a string S of length N consisting of lowercase English letters, and an integer K. Print the string obtained by replacing every character in S that differs from the K-th character of S, with `*`.

Incorrect submission (verdict: Wrong Answer):
n=input()
m=input()
l=int(input())
kotae=""
key=m[l-1]

for i in range(len(m)):
    if m[i] != key:
        kotae=kotae+"*"
    else:
        kotae=kotae+key
        

Fixed, accepted submission:
n=input()
m=input()
l=int(input())
kotae=""
key=m[l-1]

for i in range(len(m)):
    if m[i] != key:
        kotae=kotae+"*"
    else:
        kotae=kotae+key
print(kotae)
Problem:
Snuke has decided to play a game using cards. He has a deck consisting of N cards. On the i-th card from the top, an integer A_i is written.  He will perform the operation described below zero or more times, so that the values written on the remaining cards will be pairwise distinct. Find the maximum possible number of remaining cards. Here, N is odd, which guarantees that at least one card can be kept.  Operation: Take out three arbitrary cards from the deck. Among those three cards, eat two: one with the largest value, and another with the smallest value. Then, return the remaining one card to the deck.

Incorrect submission (verdict: Wrong Answer):
N = int(input())
A = list(map(int, input().split()))
D = {}
for a in A:
    if a not in D: D[a] = 0
    D[a] += 1

n2 = 0
for k in D:
    D[k] = 2 if D[k]%2==0 else 1
    if D[k]==2: n2+=1

print(len(D) + n2%2)

Fixed, accepted submission:
N = int(input())
A = list(map(int, input().split()))
D = {}
for a in A:
    if a not in D: D[a] = 0
    D[a] += 1

n2 = 0
for k in D:
    D[k] = 2 if D[k]%2==0 else 1
    if D[k]==2: n2+=1

print(len(D) - n2%2)
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())
if B-A <= 0:
  print("delicious")
elif B-A >= X:
  print("safe")
else:
  print("dangerous")

Fixed, accepted submission:
X,A,B = map(int,input().split())
if B-A <= 0:
  print("delicious")
elif B-A <= X:
  print("safe")
else:
  print("dangerous")
Problem:
Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A.  The problem has N test cases.  For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`, `WA`, `TLE`, and `RE`, respectively.  See the Output section for the output format.

Incorrect submission (verdict: Wrong Answer):
n = int(input())
ac = []
wa = []
tle = []
re = []
for _ in range(n):
    i = input()
    if i == "WA":
        wa.append(i)
    elif i == "AC":
        ac.append(i)
    elif i == "TLE":
        tle.append(i)
    else:
        re.append(i)

print("AC ×", str(len(ac)))
print("WA ×", str(len(wa)))
print("TLE ×", str(len(tle)))
print("RE ×", str(len(re)))

Fixed, accepted submission:
n = int(input())
ac = []
wa = []
tle = []
re = []
for _ in range(n):
    i = input()
    if i == "WA":
        wa.append(i)
    elif i == "AC":
        ac.append(i)
    elif i == "TLE":
        tle.append(i)
    else:
        re.append(i)

print("AC x", len(ac))
print("WA x", len(wa))
print("TLE x", len(tle))
print("RE x", len(re))
Problem:
Given an integer N not less than 3, find the sum of the interior angles of a regular polygon with N sides.  Print the answer in degrees, but do not print units.

Incorrect submission (verdict: Wrong Answer):
print((int(input())-3)*180)

Fixed, accepted submission:
print((int(input())-2)*180)
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):
x = int(input())

print(x % 1000)

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

a = x % 1000

if a == 0:
  print("0")
  exit()

print(1000 - a)
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):
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    s = input()
    ans = 0
    for i in s:
        if i == '0':
            ans += 1
    
    print(ans)

solve()


Fixed, accepted submission:
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    s = input()
    ans = 0
    for i in s:
        if i == '1':
            ans += 1
    
    print(ans)

solve()
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):
import math
A, B, C = list(map(int, input().split()))
K = int(input())
#A, B, C = [7, 4, 2]
#K = 3

i = math.floor(A/B)
K -= i
B = B * (2 ** i)
j = math.floor(B/C)
K -= j
C = C * (2 ** j)
if K >= 0:
    print("Yes")
else:
    print("No")

Fixed, accepted submission:
import math
A, B, C = list(map(int, input().split()))
K = int(input())
#A, B, C = [7, 6, 100]
#K = 3

i = max(math.ceil(math.log2((A+1)/B)),0)
K -= i
B = B * (2 ** i)
j = max(math.ceil(math.log2((B+1)/C)),0)
K -= j
C = C * (2 ** j)
if K >= 0:
    print("Yes")
else:
    print("No")
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):
group = [[1, 3, 5, 7, 8, 10, 12],[4, 6, 9, 11],[2]]
x, y = list(map(int, input().split()))
for g in group:
    if x in g and y in g:
        print("Yes")
        break
print("No")

Fixed, accepted submission:
import sys
group = [[1, 3, 5, 7, 8, 10, 12],[4, 6, 9, 11],[2]]
x, y = list(map(int, input().split()))
for g in group:
    if (x in g) and (y in g):
        print("Yes")
        sys.exit()
print("No")
Problem:
ある工場では，各営業所から製品生産の注文を受けている． 前日の注文をまとめて，各製品の生産合計を求めたい．  入力ファイルの１行目には注文データの数 n が書いてあり， 続く n 行には製品名と注文数が空白で区切られて書いてある． 製品名は5文字以内の英大文字で書かれている． 注文データには同じ製品が含まれていることもあり，順序はバラバラである．  この注文データの中に現れる同じ製品の注文数を合計し， 出力ファイルに製品名と合計を空白を区切り文字として出力しなさい． ただし，製品名に次の順序を付けて，その順で出力すること．  順序：文字の長さの小さい順に，同じ長さのときは，前から比べて 最初に異なる文字のアルファベット順とする．  入力データにおける製品数，注文数とその合計のどれも106以下である．  出力ファイルにおいては， 出力の最後の行にも改行コードを入れること．

Incorrect submission (verdict: Wrong Answer):
data = {}
for i in range(int(input())):
	p,n = input().split();
	data[p] = data.get(p,0) + int(n)
for i, j in sorted(data.items()):
    print (i, j)

Fixed, accepted submission:
data = {}
for i in range(int(input())):
	p,n = input().split();
	data[p] = data.get(p,0) + int(n)
for i, j in sorted([[len(a),a] for a in data.keys()]):
    print (j, data[j])
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: Time Limit Exceeded):
x=int(input())
times=0
money=100
while money<x:
  money*1.01
  times+=1
  
print(times)

Fixed, accepted submission:
x=int(input())
t=100
cnt=0
while t<x:
  t=t+t//100
  cnt+=1
print(cnt)
Problem:
Write a program which performs a sequence of commands to a given string $str$. The command is one of:    * print a b: print from the a-th character to the b-th character of $str$   * reverse a b: reverse from the a-th character to the b-th character of $str$   * replace a b p: replace from the a-th character to the b-th character of $str$ with p  Note that the indices of $str$ start with 0.

Incorrect submission (verdict: Wrong Answer):
s = input()
n = int(input())
for i in range(n):
 a = list(input().split())
 if a[0] == 'replace':
  temp = s[int(a[1]):int(a[2])+1]
  s.replace(temp, a[3])
 elif a[0] == 'reverse':
  temp = s[int(a[1]):int(a[2])+1]
  s.replace(temp, temp[::-1])
 elif a[0] == 'print':
  print(s[int(a[1]):int(a[2])+1])
  

Fixed, accepted submission:
s = input()
n = int(input())
for i in range(n):
 a = list(input().split())
 temp = s[int(a[1]):int(a[2])+1]
 if a[0] == 'replace':
  temp3 = a[3]
  s = list(s)
  seq = 0
  for i in range(int(a[1]), int(a[2])+1):
   s[i] = temp3[seq]
   seq += 1
  s = ''.join(s)
 elif a[0] == 'reverse':
  temp2 = temp[::-1]
  s = s.replace(temp, temp2, 1)
 elif a[0] == 'print':
  print(temp)
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):
r = int(input())
g = int(input())

print((r + g) / 2)

Fixed, accepted submission:
r = int(input())
g = int(input())

print(2*g - r)
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())
if n == 1:
  print(n)
else:
  print(int(n * (n + 1) / 2))
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 = map(int, input().split())
for i in range(A, A*B, A):
    print(i)
    if i % B == C:
        print('Yes')
        exit()
print('No')

Fixed, accepted submission:
A, B, C = map(int, input().split())
for i in range(A, A*B, A):
    if i % B == C:
        print('YES')
        exit()
print('NO')