TnT/CodeNet4Repair huggingface dataset:
Problem:
The programming contest named _Concours de Programmation Comtemporaine Interuniversitaire_ (CPCI) has a judging system similar to that of ICPC; contestants have to submit correct outputs for two different inputs to be accepted as a correct solution. Each of the submissions should include the program that generated the output. A pair of submissions is judged to be a correct solution when, in addition to the correctness of the outputs, they include an identical program.  Many contestants, however, do not stop including a different version of their programs in their second submissions, after modifying a single string literal in their programs representing the input file name, attempting to process different input. The organizers of CPCI are exploring the possibility of showing a special error message for such _close_ submissions, indicating contestants what's wrong with such submissions. Your task is to detect such close submissions.

Incorrect submission (verdict: Wrong Answer):
a1 = input()
a2 = input()
b1 = a1.split('"')
b2 = a2.split('"')
cnt = 0
if len(b1)==len(b2):
    for i in range(0,len(b1)):
        if i%2==0:
            if b1[i]!=b2[i]:
                cnt+=10000
                break
        if i%2!=0:
            if b1[i]!=b2[i]:
                cnt+=1
else:
    cnt+=10000

if cnt>1:
    print("DIFFERENT")
if cnt==1:
    print("CLOSE")
if cnt==0:
    print("IDENTICAL")


Fixed, accepted submission:
st = []
while(1):
    a1 = input()
    if a1 =='.':
        break
    a2 = input()
    b1 = a1.split('"')
    b2 = a2.split('"')
    cnt = 0
    if len(b1)==len(b2):
        for i in range(0,len(b1)):
            if i%2==0:
                if b1[i]!=b2[i]:
                    cnt+=10000
                    break
            if i%2!=0:
                if b1[i]!=b2[i]:
                    cnt+=1
    else:
        cnt+=10000
    
    if cnt>1:
        st.append("DIFFERENT")
    if cnt==1:
        st.append("CLOSE")
    if cnt==0:
        st.append("IDENTICAL")

for i in range(len(st)):
    print(st[i])
Problem:
We have a sandglass that runs for X seconds. The sand drops from the upper bulb at a rate of 1 gram per second. That is, the upper bulb initially contains X grams of sand.  How many grams of sand will the upper bulb contains after t seconds?

Incorrect submission (verdict: Wrong Answer):
input = str(input())

word = [x for x in input]
word = word[::2]

print(word)

Fixed, accepted submission:
sand,t = map(int,input().split(" "))

if t >= sand:
  print(0)
  
else:
  print(sand - t)
Problem:
Write a program which reads three integers, and prints them in ascending order.

Incorrect submission (verdict: Wrong Answer):

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

for i in range(2,0,-1):
    k = 0
    while k < i:
        if table[k] > table[k+1]:
            table[k],table[k+1] = table[k+1],table[k]
        k += 1;


print(table[0],table[1],table[2])
Problem:
    A directed acyclic graph (DAG) can be used to represent the ordering of tasks. Tasks are represented by vertices and constraints where one task can begin before another, are represented by edges. For example, in the above example, you can undertake task B after both task A and task B are finished. You can obtain the proper sequence of all the tasks by a topological sort.  Given a DAG $G$, print the order of vertices after the topological sort.

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

import sys
import os
import pprint
from queue import Queue

"""Topological Sort"""




V, E = list(map(int, input().split()))
G = [[] for i in range(V)]
indig = [0] * V 
for i in range(V):
    s, t = list(map(int, input().split()))
    G[s].append(t)
    indig[t] += 1

q = Queue()
out = []

def bfs(node_index):
    q.put(node_index)

    while not q.empty():
        u = q.get()
        out.append(u)

        
        for index in G[u]:
            indig[index] -= 1
            if indig[index] == 0:
                q.put(index)

# bfs?????????
indig_copy = indig[:]
for i in range(V):
    if indig_copy[i] == 0:
        bfs(node_index=i)


print(out)

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

import sys
import os
import pprint
from queue import Queue

"""Topological Sort"""




V, E = list(map(int, input().split()))
G = [[] for i in range(V)]
indig = [0] * V 
for i in range(E):
    s, t = list(map(int, input().split()))
    G[s].append(t)
    indig[t] += 1

q = Queue()
out = []

def bfs(node_index):
    q.put(node_index)

    while not q.empty():
        u = q.get()
        out.append(u)

        
        for index in G[u]:
            indig[index] -= 1
            if indig[index] == 0:
                q.put(index)

# bfs?????????
indig_copy = indig[:]
for i in range(V):
    if indig_copy[i] == 0:
        bfs(node_index=i)

for v in out:
    print(v)
Problem:
Write a program which reads three integers a, b and c, and prints "Yes" if a < b < c, otherwise "No".

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

if a < b < c:
  print('YES')

else:
  print('NO')


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

if a < b < c:
  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())

print(''.join(s[0:2]))

Fixed, accepted submission:
s = input()

print(s[0::2])
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=str()
x=s.count("1")
print(x)



Fixed, accepted submission:
from sys import stdin
a=stdin.readline().rstrip()
x=a.count("1")
print(x)
Problem:
We have a string s consisting of lowercase English letters. Snuke can perform the following operation repeatedly:    * Insert a letter `x` to any position in s of his choice, including the beginning and end of s.  Snuke's objective is to turn s into a palindrome. Determine whether the objective is achievable. If it is achievable, find the minimum number of operations required.

Incorrect submission (verdict: Wrong Answer):
s = input()
t = s.replace("x", "")

flag = 1
for i in range(len(t)):
    if t[i] != t[~i]:
        flag = 0

if flag == 0:
    print(-1)
else:
    ans = 0
    t = s[::-1]
    c = 0
    for i in range(len(s)):
        if c >= len(t):
            if s[i] == "x":
                ans += 1
            continue
        if t[c] == s[i]:
            c += 1
            continue
        else:
            if s[i] == "x":
                ans += 1
                continue
            else:
                while t[c] == "x":
                    ans += 1
                    c += 1
                else:
                    c += 1
    print(ans//2)


Fixed, accepted submission:
s = input()
t = s.replace("x", "")

flag = 1
for i in range(len(t)):
    if t[i] != t[~i]:
        flag = 0

if flag == 0:
    print(-1)
else:
    ans = 0
    t = s[::-1]
    c = 0
    for i in range(len(s)):
        if c >= len(t):
            if s[i] == "x":
                ans += 1
            continue
        if t[c] == s[i]:
            c += 1
            continue
        else:
            if s[i] == "x":
                ans += 1
                continue
            else:
                while t[c] == "x":
                    ans += 1
                    c += 1
                else:
                    c += 1
    ans += len(t) - c
    print(ans//2)
Problem:
Polygons are the most fundamental objects in geometric processing. Complex figures are often represented and handled as polygons with many short sides. If you are interested in the processing of geometric data, you'd better try some programming exercises about basic operations on polygons.  Your job in this problem is to write a program that computes the area of polygons.  A polygon is represented by a sequence of points that are its vertices. If the vertices p1, p2, ..., pn are given, line segments connecting pi and pi+1 (1 <= i <= n-1) are sides of the polygon. The line segment connecting pn and p1 is also a side of the polygon.  You can assume that the polygon is not degenerate. Namely, the following facts can be assumed without any input data checking.    * No point will occur as a vertex more than once.   * Two sides can intersect only at a common endpoint (vertex).   * The polygon has at least 3 vertices.  Note that the polygon is not necessarily convex. In other words, an inner angle may be larger than 180 degrees.

Incorrect submission (verdict: Wrong Answer):
while 1:
    n=int(input())
    if n==0:break
    p=[complex(*map(int,input().split())) for _ in range(n)]
    s,pre=0,p[0]
    while p:
        now=p.pop()
        s+=now.real*pre.imag-now.imag*pre.real
        pre=now
    print(abs(s)/2);input()

Fixed, accepted submission:
c=0
while 1:
    n=int(input())
    if n==0:break
    c+=1
    p=[complex(*map(int,input().split())) for _ in range(n)]
    s,pre=0,p[0]
    while p:
        now=p.pop()
        s+=now.real*pre.imag-now.imag*pre.real
        pre=now
    print(c,abs(s)/2);input()
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):
#import numpy as np
#import functools

#from itertools import combinations as comb
#from itertools import combinations_with_replacement as comb_with
#from itertools import permutations as perm
#import collections as C #most_common
#import math
#import sympy

N = int(input())
#A,B= map(int,input().split())
#P = list(map(int,input().split()))
#S = str(input())
#T = str(input())
a=0
b=0
c=0
d=0
for i in range(N):
    S = str(input())
    if S=='AC':
        a+=1
    elif S=='WA':
        b+=1
    elif S=='TLE':
        c+=1
    else:
        d+=1

print('AC ×',a)
print('WA ×',b)
print('TLE ×',c)
print('RE ×',d)


Fixed, accepted submission:
#import numpy as np
#import functools

#from itertools import combinations as comb
#from itertools import combinations_with_replacement as comb_with
#from itertools import permutations as perm
#import collections as C #most_common
#import math
#import sympy

N = int(input())
#A,B= map(int,input().split())
#P = list(map(int,input().split()))
#S = str(input())
#T = str(input())
a=0
b=0
c=0
d=0
for i in range(N):
    S = str(input())
    if S=='AC':
        a+=1
    elif S=='WA':
        b+=1
    elif S=='TLE':
        c+=1
    else:
        d+=1

print('AC x',a)
print('WA x',b)
print('TLE x',c)
print('RE x',d)
Problem:
You are given three integers A, B and C. Find the minimum number of operations required to make A, B and C all equal by repeatedly performing the following two kinds of operations in any order:    * Choose two among A, B and C, then increase both by 1.   * Choose one among A, B and C, then increase it by 2.  It can be proved that we can always make A, B and C all equal by repeatedly performing these operations.

Incorrect submission (verdict: Wrong Answer):
import math
def kaisuu(hoge):
	a = sorted(hoge)
	A = a[2]
	B = a[1]
	C = a[0]
	print(a)
	return math.floor(A-((B+C)/2))


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

count = 0
for i in X:
	if i % 2 == 0:
		count+=1

if count == 0 or count == 3:
	print(kaisuu(X))
elif count == 1:
	for i in range(3):
		if X[i] % 2 == 1:
			X[i]+=1
	print(kaisuu(X)+1)
else:
	for i in range(3):
		if X[i] % 2 == 0:
			X[i]+=1
	print(kaisuu(X)+1)

Fixed, accepted submission:
import math
def kaisuu(hoge):
	a = sorted(hoge)
	A = a[2]
	B = a[1]
	C = a[0]
	return math.floor(A-((B+C)/2))


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

count = 0
for i in X:
	if i % 2 == 0:
		count+=1

if count == 0 or count == 3:
	print(kaisuu(X))
elif count == 1:
	for i in range(3):
		if X[i] % 2 == 1:
			X[i]+=1
	print(kaisuu(X)+1)
else:
	for i in range(3):
		if X[i] % 2 == 0:
			X[i]+=1
	print(kaisuu(X)+1)
Problem:
10^{10^{10}} participants, including Takahashi, competed in two programming contests. In each contest, all participants had distinct ranks from first through 10^{10^{10}}-th.  The _score_ of a participant is the product of his/her ranks in the two contests.  Process the following Q queries:    * In the i-th query, you are given two positive integers A_i and B_i. Assuming that Takahashi was ranked A_i-th in the first contest and B_i-th in the second contest, find the maximum possible number of participants whose scores are smaller than Takahashi's.

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


def solve_worst(number_1, number_2):
    cases = 0
    if number_1 < number_2:
        number_1, number_2 = number_2, number_1
    if (number_1 * number_2) % (number_2 + 1) == 0:
        max_1 = number_1 * number_2 // (number_2 + 1) - 1
    else:
        max_1 = number_1 * number_2 // (number_2 + 1)
    cases += max_1
    if (number_1 * number_2) % (number_1 + 1) == 0:
        max_2 = number_1 * number_2 // (number_1 + 1) - 1
    else:
        max_2 = number_1 * number_2 // (number_1 + 1)
    cases += max_2
    return cases


if __name__ == '__main__':
    Q = int(input())
    for i in range(Q):
        A, B = map(int, input().split())
        worst_cases = solve_worst(A, B)
        print(worst_cases)

Fixed, accepted submission:
# coding=utf-8
import math


def solve_worst(number_1, number_2):
    cases = 0
    if number_1 < number_2:
        number_1, number_2 = number_2, number_1

    if (number_1 * number_2) % (number_1 + 1) == 0:
        max_2 = number_1 * number_2 // (number_1 + 1) - 1
    else:
        max_2 = number_1 * number_2 // (number_1 + 1)
    cases += max_2

    min_sqrt = math.floor(math.sqrt(number_1 * number_2))
    if min_sqrt == number_2:
        min_sqrt = number_2 + 1
    cases += min_sqrt - number_2

    if (number_1 * number_2) % min_sqrt == 0:
        max_1 = number_1 * number_2 // min_sqrt - 2
    else:
        max_1 = number_1 * number_2 // min_sqrt - 1

    cases += max_1

    return cases


if __name__ == '__main__':
    Q = int(input())
    for i in range(Q):
        A, B = map(int, input().split())
        worst_cases = solve_worst(A, B)
        print(worst_cases)
Problem:
We have N squares assigned the numbers 1,2,3,\ldots,N. Each square has an integer written on it, and the integer written on Square i is a_i.  How many squares i satisfy both of the following conditions?    * The assigned number, i, is odd.   * The written integer is odd.

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

masu_list = []
for i in range(n):
    if not i%2==0:
        masu_list.append(i)
    else:
        pass

answer_list=[]
for masu in masu_list:
    masu = masu-1
    answer_list.append(x[masu])

answer = [int(s) for s in answer_list]
answer_list_2=[]
for ans in answer:
    if not ans%2==0:
         answer_list_2.append(ans)
    else:
        pass
print(len(answer_list_2))

Fixed, accepted submission:
n = int(input())
x = input().split()

masu_list = []
for i in range(n):
    i=i+1
    if not i%2==0:
        masu_list.append(i)
    else:
        pass

answer_list=[]
for masu in masu_list:
    masu = masu-1
    answer_list.append(x[masu])

answer = [int(s) for s in answer_list]
answer_list_2=[]
for ans in answer:
    if not ans%2==0:
         answer_list_2.append(ans)
    else:
        pass
print(len(answer_list_2))
Problem:
The programming contest named _Concours de Programmation Comtemporaine Interuniversitaire_ (CPCI) has a judging system similar to that of ICPC; contestants have to submit correct outputs for two different inputs to be accepted as a correct solution. Each of the submissions should include the program that generated the output. A pair of submissions is judged to be a correct solution when, in addition to the correctness of the outputs, they include an identical program.  Many contestants, however, do not stop including a different version of their programs in their second submissions, after modifying a single string literal in their programs representing the input file name, attempting to process different input. The organizers of CPCI are exploring the possibility of showing a special error message for such _close_ submissions, indicating contestants what's wrong with such submissions. Your task is to detect such close submissions.

Incorrect submission (verdict: Wrong Answer):
def vals(arr):
    even = True
    res = [[], []]
    tmp = []
    for e in arr:
        if e == "\"":
            even = not even
            res[even].append(tmp)
            tmp = []
            continue
        tmp.append(e)
    even = not even
    res[even].append(tmp)
    return res


while True:
    str1 = input()
    if str1 == ".":
        break
    a = vals(str1)
    b = vals(input())
    print(a)
    print(b)
    res = 0
    for (x, y) in zip(a[0], b[0]):
        if x != y:
            res = 2
            break
    if res == 0:
        for (a, b) in zip(a[1], b[1]):
            if a != b:
                if res == 1:
                    break
                res += 1
    if res == 0:
        print("IDENTICAL")
    elif res == 1:
        print("CLOSE")
    else:
        print("DIFFERENT")



Fixed, accepted submission:
def vals(arr):
    even = True
    res = [[], []]
    tmp = []
    for e in arr:
        if e == "\"":
            even = not even
            res[even].append(tmp)
            tmp = []
            continue
        tmp.append(e)
    even = not even
    res[even].append(tmp)
    return res


while True:
    str1 = input()
    if str1 == ".":
        break
    a = vals(str1)
    b = vals(input())
    res = 0
    if len(a[0]) != len(b[0]) or len(a[1]) != len(b[1]) :
        res = 2
    else:
        for (x, y) in zip(a[0], b[0]):
            if x != y:
                res = 2
                break
    if res == 0:
        for (a, b) in zip(a[1], b[1]):
            if a != b:
                res += 1
                if res == 2:
                    break
    if res == 0:
        print("IDENTICAL")
    elif res == 1:
        print("CLOSE")
    else:
        print("DIFFERENT")
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 else 'Odd')

Fixed, accepted submission:
a, b = map(int, input().split())
if a*b % 2 == 0:
  print('Even')
else:
  print('Odd')
Problem:
You are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times:    * Append one of the following at the end of T: `dream`, `dreamer`, `erase` and `eraser`.

Incorrect submission (verdict: Wrong Answer):
S = input()[::-1]
dividor = ['dream','dreamer','erase','eraser']
j=0
while True:
    flag = 0
    for d in dividor:
        print(S[j:j+len(d)])
        if S[j:j+len(d)]==d[::-1]:
            flag = 1
            j+=len(d)
            if j==len(S):
                print("YES")
                quit()
    if flag==0:
        print("NO")
        quit()

Fixed, accepted submission:
S = input()[::-1]
dividor = ['dream','dreamer','erase','eraser']
j=0
while True:
    flag = 0
    for d in dividor:
        if S[j:j+len(d)]==d[::-1]:
            flag = 1
            j+=len(d)
            if j==len(S):
                print("YES")
                quit() 
    if flag==0:
        print("NO")
        quit()
Problem:
Takahashi's house has only one socket.  Takahashi wants to extend it with some number of power strips, each with A sockets, into B or more empty sockets.  One power strip with A sockets can extend one empty socket into A empty sockets.  Find the minimum number of power strips required.

Incorrect submission (verdict: Wrong Answer):
while True:
    try:
        A, B = map(int, input().split())
        if A >= B:
            print(1)
        else:
            A -= 1
            B -= 1
            print(-(-B//A))
    except EOFError:
        break

Fixed, accepted submission:
while True:
    try:
        A, B = map(int, input().split())
        if B == 1:
            print(0)
        elif A >= B:
            print(1)
        else:
            A -= 1
            B -= 1
            print(-(-B//A))
    except EOFError:
        break
Problem:
Write a program to simulate rolling a dice, which can be constructed by the following net.                  As shown in the figures, each face is identified by a different label from 1 to 6.  Write a program which reads integers assigned to each face identified by the label and a sequence of commands to roll the dice, and prints the integer on the top face. At the initial state, the dice is located as shown in the above figures.

Incorrect submission (verdict: Wrong Answer):
#!/usr/bin/env python

faces = list(map(int, input().split()))
print(faces)
command = list(input())
print(command)


def dice(face, command):
    face_1 = {"E": 4, "W": 3, "S": 5, "N": 2}
    face_2 = {"E": 4, "W": 3, "S": 1, "N": 6}
    face_3 = {"E": 2, "W": 5, "S": 1, "N": 6}
    face_4 = {"E": 5, "W": 2, "S": 1, "N": 6}
    face_5 = {"E": 4, "W": 3, "S": 6, "N": 1}
    face_6 = {"E": 4, "W": 3, "S": 2, "N": 1}

    rulebase = [face_1, face_2, face_3, face_4, face_5, face_6]

    return rulebase[face - 1][command]


top = 1

for c in command:
    top = dice(top, c)
    print(top)

print(faces[top - 1])


Fixed, accepted submission:
#!/usr/bin/env python

label = list(map(int, input().split()))
command = list(input())

faces = [1, 2, 3, 4, 5, 6]


def dice(command):

    if command == "N":
        faces[0], faces[1], faces[4], faces[5] = faces[1], faces[5], faces[0], faces[4]

    elif command == "S":
        faces[0], faces[1], faces[4], faces[5] = faces[4], faces[0], faces[5], faces[1]

    elif command == "E":
        faces[0], faces[2], faces[3], faces[5] = faces[3], faces[0], faces[5], faces[2]

    else:  # command W
        faces[0], faces[2], faces[3], faces[5] = faces[2], faces[5], faces[0], faces[3]


for c in command:
    dice(c)

print(label[faces[0] - 1])
Problem:
Find the number of _palindromic numbers_ among the integers between A and B (inclusive). Here, a palindromic number is a positive integer whose string representation in base 10 (without leading zeros) reads the same forward and backward.

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

kA = int(A[0:3])*100 + int(A[1:2])*10 + int(A[0:1])
kB = int(B[0:3])*100 + int(B[1:2])*10 + int(B[0:1])

maxB = int(B[0:3]) + int(kB <= int(B))
maxA = int(A[0:3]) + int(kA > int(A))

print(maxB - maxA)

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

kA = int(A[0:3]) * 100 + int(A[1:2]) * 10 + int(A[0:1])
kB = int(B[0:3]) * 100 + int(B[1:2]) * 10 + int(B[0:1])

maxB = int(B[0:3]) + int(kB <= int(B))
maxA = int(A[0:3]) + int(kA < int(A))

print(maxB - maxA)
Problem:
It is November 18 now in Japan. By the way, 11 and 18 are adjacent Lucas numbers.  You are given an integer N. Find the N-th Lucas number.  Here, the i-th Lucas number L_i is defined as follows:    * L_0=2   * L_1=1   * L_i=L_{i-1}+L_{i-2} (i≥2)

Incorrect submission (verdict: Wrong Answer):
n=int(input())
l=[]
l.append(2)
l.append(1)
if n==1:
    print(n)
    exit()
for i in range(2,n+1):
    l.append(l[i-2]+l[i-1])
    print(i,l[i])
    if n==i:
        print(l[i])
        exit()


Fixed, accepted submission:
n=int(input())
l=[]
l.append(2)
l.append(1)
if n==1:
    print(n)
    exit()
for i in range(2,n+1):
    l.append(l[i-2]+l[i-1])
    if n==i:
        print(l[i])
        exit()