TnT/CodeNet4Repair huggingface dataset:
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())
previous_t = 0
for i in range(n):
    t, x, y = list(map(int, input().split()))
    print(t)
    print(x)
    print(y)
    if x + y > t:
        print("No")
        break
    if (x + y) % 2 != t % 2:
        print("No")
        break
    if previous_t > 0 and (abs(x - previous_x) + abs(y - previous_y) > (t - previous_t)):
        print("No")
        break
    previous_t = t
    previous_x = x
    previous_y = y
else:
    print("Yes")


Fixed, accepted submission:
n = int(input())
previous_t = 0
ans = "Yes"
for i in range(n):
    t, x, y = list(map(int, input().split()))
    if x + y > t:
        ans = "No"
        break
    if (x + y) % 2 != t % 2:
        ans = "No"
        break
    if previous_t > 0 and (abs(x - previous_x) + abs(y - previous_y) > (t - previous_t)):
        ans = "No"
        break
    previous_t = t
    previous_x = x
    previous_y = y

print(ans)
Problem:
In _K-city_ , there are n streets running east-west, and m streets running north-south. Each street running east-west and each street running north-south cross each other. We will call the smallest area that is surrounded by four streets a block. How many blocks there are in K-city?

Incorrect submission (verdict: Wrong Answer):
s = input()
print(s[0] + str(len(s[1:-1])) + s[-1])

Fixed, accepted submission:
a,b = map(int,input().split())
print((int(a)-1) * (int(b)-1) )
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 = map(int, input().split())
print('{} {}'.format(max(a, b), max(0, n-a-b)))

Fixed, accepted submission:
n, a, b = map(int, input().split())
print('{} {}'.format(min(a, b), max(0, a+b-n)))
Problem:
There are N cities and M roads. The i-th road (1≤i≤M) connects two cities a_i and b_i (1≤a_i,b_i≤N) bidirectionally. There may be more than one road that connects the same pair of two cities. For each city, how many roads are connected to the city?

Incorrect submission (verdict: Wrong Answer):
from collections import OrderedDict
n, m = map(int, input().split())
info = OrderedDict()
for i in range(0, n + 1):
    info[i] = 0
for i in range(0, m):
    a, b = map(int, input().split())
    info[a] = info[a] + 1
    info[b] = info[b] + 1
for value in info.values():
    print(value)


Fixed, accepted submission:
n, m = map(int, input().split())
l = list()
[l.extend(input().split()) for i in range(0, m)]
[print(l.count(str(i))) for i in range(1, n + 1)]
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())
t = 0
i = 0
while t < x:
    t = int(t*(1.01))
    i += 1

print(ans)

Fixed, accepted submission:
x = int(input())
t = 100
i = 0
while t < x:
    t = int(t*(1.01))
    i += 1
 
print(i)
Problem:
Write a program which reads two integers a and b, and calculates the following values:    * a ÷ b: d (in integer)   * remainder of a ÷ b: r (in integer)   * a ÷ b: f (in real number)

Incorrect submission (verdict: Wrong Answer):
lis = [int(x) for x in input().split()]
print(str(lis[0]//lis[1]) + " " + str(lis[0] % lis[1]) + " " + str(lis[0]/lis[1]))


Fixed, accepted submission:
lis = [int(x) for x in input().split()]
print(lis[0]//lis[1],end = " ")
print(lis[0]%lis[1],end = " ")
a = lis[0]/lis[1]
print("{0:.5f}".format(a))
Problem:
A group of people played a game. All players had distinct scores, which are positive integers.  Takahashi knows N facts on the players' scores. The i-th fact is as follows: the A_i-th highest score among the players is B_i.  Find the maximum possible number of players in the game.

Incorrect submission (verdict: Wrong Answer):
n=int(input())
a=0
ans=0
for i in range(n):
  x,y=map(int,input().split())
  if a<x:
    ans=x+y-1
    a=x
print(ans)

Fixed, accepted submission:
n=int(input())
a=0
ans=0
for i in range(n):
  x,y=map(int,input().split())
  if a<x:
    ans=x+y
    a=x
print(ans)
Problem:
You are given a positive integer X. Find the largest _perfect power_ that is at most X. Here, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not less than 2.

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

Fixed, accepted submission:
x = int(input())
m = 1
for i in range(2,(x+1)//2):
  tmp = 0
  k = 0
  while tmp <= x:
    m = max(m,tmp)
    tmp = i**k
    k+=1
print(m)
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())

if (N-A)%500==0:
    print("Yes")
else:
    print ("No")

Fixed, accepted submission:
N=int(input())
A=int(input())
import sys
for i in range (0,1000):
    for j in range(A+1):
        if N==500*i+j:
            print ('Yes')
            sys.exit()

print ('No')
Problem:
In AtCoder, a person who has participated in a contest receives a _color_ , which corresponds to the person's rating as follows:    * Rating 1-399 : gray   * Rating 400-799 : brown   * Rating 800-1199 : green   * Rating 1200-1599 : cyan   * Rating 1600-1999 : blue   * Rating 2000-2399 : yellow   * Rating 2400-2799 : orange   * Rating 2800-3199 : red  Other than the above, a person whose rating is 3200 or higher can freely pick his/her color, which can be one of the eight colors above or not.   Currently, there are N users who have participated in a contest in AtCoder, and the i-th user has a rating of a_i.   Find the minimum and maximum possible numbers of different colors of the users.

Incorrect submission (verdict: Wrong Answer):
n = int(input())
v = list(map(int, input().split()))
c = [0] * 9
for i in range(0, n):
  if v[i] >= 3200:
    c[8] += 1
  else:
    c[v[i]//400] += 1
a = 0
for i in range(0, 8):
  a += c[i]
print(a, min(a, a+c[8]))

Fixed, accepted submission:
n = int(input())
v = list(map(int, input().split()))
c = [0] * 9
for i in range(0, n):
  if v[i] >= 3200:
    c[8] += 1
  else:
    c[v[i]//400] += 1
a = 0
for i in range(0, 8):
  if c[i] > 0:
    a += 1
print(max(a, 1), a+c[8])
Problem:
There are three positive integers A, B and C written on a blackboard. E869120 performs the following operation K times:    * Choose one integer written on the blackboard and let the chosen integer be n. Replace the chosen integer with 2n.  What is the largest possible sum of the integers written on the blackboard after K operations?

Incorrect submission (verdict: Wrong Answer):
x= list(map(int,input().split()))
k = int(input())
max = 0


for f in range(3):
    temp = 0
    for i in range(k):
        temp = temp + x[f] * 2
    if temp > max:
        max = temp

print(max)
    

Fixed, accepted submission:
a = list(map(int, input().split()))
print((sum(a)-max(a))+max(a)*(2**int(input())))
Problem:
You are given a string S consisting of `0` and `1`. Find the maximum integer K not greater than |S| such that we can turn all the characters of S into `0` by repeating the following operation some number of times.    * Choose a contiguous segment [l,r] in S whose length is at least K (that is, r-l+1\geq K must be satisfied). For each integer i such that l\leq i\leq r, do the following: if S_i is `0`, replace it with `1`; if S_i is `1`, replace it with `0`.

Incorrect submission (verdict: Wrong Answer):
# -*- coding: utf-8 -*-

import sys
input = sys.stdin.readline

def io_generator():
	return input()

#+++++++++++++++++++

def main(io):
	s=list(io())
	if len(s)% 2==1:
		center=len(s)//2
		mm=s[center]
		ret=center
		for ca,cb in zip(s[:center-1:-1],s[center+1:]):
			#print(ca,cb)
			if ca == mm and cb == mm:
				ret += 1
			else:
				break
	else:
		center=len(s)//2
		ret=center
		mm=-1
		la=s[center:-1]
		lb=s[center:]
		for ca, cb in zip(la, lb):
			#print(mm,ca,cb, center)
			if (mm == ca or mm == -1) and ca == cb:
				ret+=1
				mm=ca
			else:
				break
	return ret

#++++++++++++++++++++

if __name__ == "__main__":
	io= lambda : io_generator()
	print (main(io))

Fixed, accepted submission:
# -*- coding: utf-8 -*-

import sys
input = sys.stdin.readline

def io_generator():
	return input()

#+++++++++++++++++++

def main(io):
	s=list(io())[:-1]
	if len(s)% 2==1:
		center=len(s)//2
		mm=s[center]
		ret=center+1
		la=s[center-1::-1]
		lb=s[center+1:]
		for ca,cb in zip(la,lb):
			#print(ca,cb,mm)
			if ca == mm and cb == mm:
				ret += 1
			else:
				break
	else:
		center=len(s)//2
		ret=center
		mm=-1
		la=s[center-1::-1]
		lb=s[center:]
		for ca, cb in zip(la, lb):
			if (mm == ca or mm == -1) and ca == cb:
				ret+=1
				mm=ca
			else:
				break
				
	if 0:
		print(la)
		print(lb)
		print(mm)
	return ret

#++++++++++++++++++++

if __name__ == "__main__":
	io= lambda : io_generator()
	print (main(io))
Problem:
We call a 4-digit integer with three or more consecutive same digits, such as 1118, **good**.  You are given a 4-digit integer N. Answer the question: Is N **good**?

Incorrect submission (verdict: Wrong Answer):
if len(set(int(i) for i in input())) < 2:
  print("Yes")
else:
  print("No")

Fixed, accepted submission:
N = input()
if (N[0] == N[1] and N[1] == N[2]) or (N[1] == N[2] and N[2] == N[3]):
  print("Yes")
else:
  print("No")
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):
#! /usr/local/bin/python3
# coding: utf-8

def insertion_sort(a):
    for i in range(1, len(a)):
        w = a[i]
        j = i - 1
        while j >= 0 and w < a[j]:
            a[j + 1] = a[j]
            j -= 1
        a[j + 1] = w
        print(" ".join(map(str, a)))

n = int(input())
a = [int(i) for i in input().split()]
insertion_sort(a)



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

def insertion_sort(a):
    for i in range(1, len(a)):
        print(" ".join(map(str, a)))
        w = a[i]
        j = i - 1
        while j >= 0 and w < a[j]:
            a[j + 1] = a[j]
            j -= 1
        a[j + 1] = w

n = int(input())
a = [int(i) for i in input().split()]
insertion_sort(a)
print(" ".join(map(str, a)))
Problem:
On some day in January 2018, Takaki is writing a document. The document has a column where the current date is written in `yyyy/mm/dd` format. For example, January 23, 2018 should be written as `2018/01/23`.  After finishing the document, she noticed that she had mistakenly wrote `2017` at the beginning of the date column. Write a program that, when the string that Takaki wrote in the date column, S, is given as input, modifies the first four characters in S to `2018` and prints it.

Incorrect submission (verdict: Wrong Answer):
s=list(input())
s[3]="8"
print(s)

Fixed, accepted submission:
s=list(input())
s[3]="8"
print(''.join(s))
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())
print("Even" if (a+b)%2 == 0 else "Odd")

Fixed, accepted submission:
a, b = map(int, input().split())
print("Even" if (a*b)%2 == 0 else "Odd")
Problem:
Write a program which reads a sequence of $n$ integers $a_i (i = 1, 2, ... n)$, and prints the minimum value, maximum value and sum of the sequence.

Incorrect submission (verdict: Wrong Answer):
a = list(map(int,input().split()))
print(min(a),max(a),sum(a))

Fixed, accepted submission:
input()
a = list(map(int, input().split()))
print(min(a) ,max(a) ,sum(a))
Problem:
There are N positive integers written on a blackboard: A_1, ..., A_N.  Snuke can perform the following operation when all integers on the blackboard are even:    * Replace each integer X on the blackboard by X divided by 2.  Find the maximum possible number of operations that Snuke can perform.

Incorrect submission (verdict: Time Limit Exceeded):
input()
strs = input().split(' ')
nums = [int(i) for i in strs]

ct = 0
b_flag = False
while(1):
  for num in nums:
    if num % 2 == 0:
      continue
    else:
      b_flag = True
      break
  if b_flag:
    break
  ct += 1
print(ct)
  

Fixed, accepted submission:
input()
strs = input().split(' ')
nums = [int(i) for i in strs]

ct = 0
b_flag = False
while(1):
  for i, num in enumerate(nums):
    if num % 2 == 0:
      nums[i] = num/2
      continue
    else:
      b_flag = True
      break  
  if b_flag:
    break
  ct += 1
print(ct)
Problem:
On some day in January 2018, Takaki is writing a document. The document has a column where the current date is written in `yyyy/mm/dd` format. For example, January 23, 2018 should be written as `2018/01/23`.  After finishing the document, she noticed that she had mistakenly wrote `2017` at the beginning of the date column. Write a program that, when the string that Takaki wrote in the date column, S, is given as input, modifies the first four characters in S to `2018` and prints it.

Incorrect submission (verdict: Wrong Answer):
i = input()
i[3] == "8"
print(i)

Fixed, accepted submission:
i = input()
print(i[:3]+"8"+i[4:])
Problem:
Write a program which reads an integer _n_ and draws a Koch curve based on recursive calles of depth _n_.  The Koch curve is well known as a kind of   You should start (0, 0), (100, 0) as the first segment.

Incorrect submission (verdict: Wrong Answer):
import math
n = int(input())

def three(p1x, p1y, p2x, p2y):
    dx = (p2x - p1x)
    dy = (p2y - p1y)
    sx = dx / 3 + p1x
    sy = dy / 3 + p1y
    tx = p2x - (dx / 3)
    ty = p2y - (dy / 3)

    mtx = tx - sx
    mty = ty - sy

    rad = math.radians(60)
    mux = mtx * math.cos(rad) - (mty * math.sin(rad))
    muy = mtx * math.sin(rad) + (mty * math.cos(rad))

    ux = mux + sx
    uy = muy + sy

    return [sx, sy, ux, uy, tx, ty]

def koch(p1x, p1y, p2x, p2y, n):
    if 0 == n:
        print(*[p1x, p1y])
    if 0 < n:
        sx, sy, ux, uy, tx, ty = three(p1x, p1y, p2x, p2y)
        koch(p1x, p1y, sx, sy, n - 1)
        koch(sx, sy, ux, uy, n - 1)
        koch(ux, uy, tx, ty, n - 1)
        koch(tx, ty, p2x, p2y, n - 1)

koch(0.00000000, 0.00000000, 100.00000000, 0.00000000, n)
print(*[100.00000000, 100.00000000])

Fixed, accepted submission:
import math
n = int(input())

def three(p1x, p1y, p2x, p2y):
    dx = (p2x - p1x)
    dy = (p2y - p1y)
    sx = dx / 3 + p1x
    sy = dy / 3 + p1y
    tx = p2x - (dx / 3)
    ty = p2y - (dy / 3)

    mtx = tx - sx
    mty = ty - sy

    rad = math.radians(60)
    mux = mtx * math.cos(rad) - (mty * math.sin(rad))
    muy = mtx * math.sin(rad) + (mty * math.cos(rad))

    ux = mux + sx
    uy = muy + sy

    return [sx, sy, ux, uy, tx, ty]

def koch(p1x, p1y, p2x, p2y, n):
    if 0 == n:
        print('{:.8f} {:.8f}'.format(p1x, p1y))
    if 0 < n:
        sx, sy, ux, uy, tx, ty = three(p1x, p1y, p2x, p2y)
        koch(p1x, p1y, sx, sy, n - 1)
        koch(sx, sy, ux, uy, n - 1)
        koch(ux, uy, tx, ty, n - 1)
        koch(tx, ty, p2x, p2y, n - 1)

koch(0.00000000, 0.00000000, 100.00000000, 0.00000000, n)
print('{:.8f} {:.8f}'.format(100.00000000, 0.00000000))
Problem:
Let w be a string consisting of lowercase letters. We will call w _beautiful_ if the following condition is satisfied:    * Each lowercase letter of the English alphabet occurs even number of times in w.  You are given the string w. Determine if w is beautiful.

Incorrect submission (verdict: Wrong Answer):
w=input()
w_list=list(w)
w_unique=list(set(w_list))
c=0
for x in w_unique:
    if w_list.count(x)%2==0:
        c=c
    else:
        c+=1
        
if c==0:
    print('YES')
    
else:
    print("NO")
    

        

Fixed, accepted submission:
w=input()
w_list=list(w)
w_unique=list(set(w_list))
c=0
for x in w_unique:
    if w_list.count(x)%2==0:
        c=c
    else:
        c+=1
        
if c==0:
    print('Yes')
    
else:
    print("No")
Problem:
You are given a string S of length N consisting of `(` and `)`. Your task is to insert some number of `(` and `)` into S to obtain a _correct bracket sequence_.   Here, a correct bracket sequence is defined as follows:    * `()` is a correct bracket sequence.   * If X is a correct bracket sequence, the concatenation of `(`, X and `)` in this order is also a correct bracket sequence.   * If X and Y are correct bracket sequences, the concatenation of X and Y in this order is also a correct bracket sequence.   * Every correct bracket sequence can be derived from the rules above.  Find the shortest correct bracket sequence that can be obtained. If there is more than one such sequence, find the lexicographically smallest one.

Incorrect submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
while True:
  c = 0
  for i in range(len(s)):
    if s[i] == "(":
      c += 1
    else:
      c -= 1
    if c < 0:
      s = "(" + s
      break
  if c > 0:
    s = s + ")"
  if c == 0:
    print(s)
  


Fixed, accepted submission:
n = int(input())
s = input()
while True:
  c = 0
  for i in range(len(s)):
    if s[i] == "(":
      c += 1
    else:
      c -= 1
    if c < 0:
      s = "(" + s
      break
  if c > 0:
    s = s + ")"
  if c == 0:
    print(s)
    break
Problem:
As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (x, y) coordinate system.  We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells.      Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side):      In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point.  Your task is to write a program which reads a sequence of points of fall (x, y) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density.  You may assume that the paper always consists of 10 × 10, and 0 ≤ x < 10, 0 ≤ y < 10\.

Incorrect submission (verdict: Wrong Answer):
a = [[0] * 14 for _ in range(14)]
while True:
    try:
        x, y, s = map(int, input().split(','))
    except:
        break
    x += 2
    y += 2
    for d in [(0, 0), (0, -1), (0, 1), (-1, 0), (1, 0)]:
        a[x + d[0]][y + d[1]] += 1
    if s >= 2:
        for d in [(1, 1), (1, -1), (-1, 1), (-1, -1)]:
            a[x + d[0]][y + d[1]] += 1
    if s == 3:
        for d in [(0, 2), (0, -2), (2, 0), (-2, 0)]:
            a[x + d[0]][y + d[1]] += 1
print(sum(a[i][2:12].count(0) for i in range(2, 12)))
print(max(max(a[i]) for i in range(14)))
print(a)

Fixed, accepted submission:
a = [[0] * 14 for _ in range(14)]
while True:
    try:
        x, y, s = map(int, input().split(','))
    except:
        break
    x += 2
    y += 2
    for d in [(0, 0), (0, -1), (0, 1), (-1, 0), (1, 0)]:
        a[x + d[0]][y + d[1]] += 1
    if s >= 2:
        for d in [(1, 1), (1, -1), (-1, 1), (-1, -1)]:
            a[x + d[0]][y + d[1]] += 1
    if s == 3:
        for d in [(0, 2), (0, -2), (2, 0), (-2, 0)]:
            a[x + d[0]][y + d[1]] += 1
print(sum(a[i][2:12].count(0) for i in range(2, 12)))
print(max(max(a[i][2:12]) for i in range(2, 12)))
Problem:
Print all the integers that satisfies the following in ascending order:    * Among the integers between A and B (inclusive), it is either within the K smallest integers or within the K largest integers.

Incorrect submission (verdict: Wrong Answer):
A, B, K = map(int,input().split())
ans = []
for i in range(A, B+1)[:K]:
  ans.append(i)
for i in range(A, B+1)[-K:]:
  ans.append(i)
for a in list(set(ans)):
  print(a)

Fixed, accepted submission:
A, B, K = map(int,input().split())
x = set()
for i in range(A, B+1)[:K]:
  x.add(i)
for i in range(A, B+1)[-K:]:
  x.add(i)
for xx in sorted(x):
  print(xx)
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 = input()
t=''
for i in range (len(s)):
  if i % 2 == 0:
    t = s[i]
    print(t)

  


Fixed, accepted submission:
s = input()
t=''
for i in range (len(s)):
  if i % 2 == 0:
    t = t+s[i]
print(t)