Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03244 (python)

Fixed submission:
from collections import Counter
n = int(input())
vl = [int(i) for i in input().split()]
oc = Counter(a for i, a in enumerate(vl) if i % 2 == 0)
ec = Counter(a for i, a in enumerate(vl) if i % 2 == 1)
ol = sorted(((v, k) for k, v in oc.items()), reverse=True)
el = sorted(((v, k) for k, v in ec.items()), reverse=True)

if ol[0][1] != el[0][1]:
    print(n - ol[0][0] - el[0][0])
else:
    res = 1 << 30
    if len(ol) == len(el) == 1:
        res = n // 2
    if len(ol) > 1:
        res = min(res, n - ol[1][0] - el[0][0])
    if len(el) > 1:
        res = min(res, n - ol[0][0] - el[1][0])
    print(res)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
vl = [int(i) for i in input().split()]
oc = Counter(a for i, a in enumerate(vl) if i % 2 == 0)
ec = Counter(a for i, a in enumerate(vl) if i % 2 == 1)
ol = sorted(((v, k) for k, v in oc.items()), reverse=True)
el = sorted(((v, k) for k, v in ec.items()), reverse=True)

if ol[0][1] != el[0][1]:
    print(n - ol[0][0] - el[0][0])
else:
    if len(ol) == len(el) == 1:
        res = n // 2
    if len(ol) > 1:
        res = min(res, n - ol[1][0] - el[0][0])
    if len(el) > 1:
        res = min(res, n - ol[0][0] - el[1][0])
    print(res)

Buggy submission (verdict: Runtime Error):
n = int(input())
vl = [int(i) for i in input().split()]
oc = Counter(a for i, a in enumerate(vl) if i % 2 == 0)
ec = Counter(a for i, a in enumerate(vl) if i % 2 == 1)
ol = sorted(((v, k) for k, v in oc.items()), reverse=True)
el = sorted(((v, k) for k, v in ec.items()), reverse=True)

if ol[0][1] != el[0][1]:
    print(n - ol[0][0] - el[0][0])
else:
    if ol[0][0] >= el[0][0]:
        if len(el) >= 2:
            print(n - ol[0][0] - el[1][0])
        else:
            print(n - ol[0][0])
    else:
        if len(ol) >= 2:
            print(n - ol[1][0] - el[0][0])
        else:
            print(n - el[0][0])
Problem p03262 (python)

Fixed submission:
from functools import reduce

n, s = map(int, input().split())
xl = [abs(int(i) - s) for i in input().split()]

def gcd_(a, b):
    while b:
        a, b = b, a%b
    return a
def gcd(*numbers):
    return reduce(gcd_, numbers)

print(gcd(*xl))

Buggy submission (verdict: Runtime Error):
n, s = map(int, input().split())
xl = [abs(int(i) - s) for i in input().split()]

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

y = xl[0]
for i in range(1,n-1):
    if xl[i]%y != 0:
        y = gcd(y, x[i])
print(y)
Problem p03574 (python)

Fixed submission:
import numpy as np
h, w = map(int, input().split())
num_array = np.zeros((h, w))
space_array = np.ones((h, w))

mine_map = np.array(
    [np.array([0 if i == "." else 1 for i in input()]) for j in range(h)])
space_array = mine_map.copy()

for i, s in enumerate(mine_map):
    for j, m in enumerate(s):
        if m == 1: # m=mass
            il, iu = i-1, i+2
            jl, ju = j-1, j+2
            il, jl = max(il, 0), max(jl, 0)
            iu, ju = min(iu, h), min(ju, w)
            num_array[il:iu, jl:ju] += 1

for i, s in enumerate(space_array):
    out = ["#" if m == 1 else str(int(num_array[i,j])) for j, m in enumerate(s)]
    print("".join(out))

Buggy submission (verdict: Runtime Error):
import numpy as np
h, w = map(int, input().split())
num_array = np.zeros((h, w))
space_array = np.ones((h, w))

mine_map = np.array(
    ((0 if i == "." else 1 for i in input())) for j in range(h))
space_array = mine_map.copy()

for i, s in enumerate(mine_map):
    for j, m in enumerate(s):
        if m == 1: # m=mass
            il, iu = i-1, i+2
            jl, ju = j-1, j+2
            il, jl = max(il, 0), max(jl, 0)
            iu, ju = min(iu, h), min(ju, w)
            num_array[il:iu, jl:ju] += 1

for i, s in enumerate(space_array):
    out = ("#" if m == 1 else str(int(num_array[i,j])) for j, m in enumerate(s))
    print("".join(out))
Problem p03074 (python)

Fixed submission:
N, K = map(int, input().split())
S = input()
last_s = "0"
count = 0
A = []
for i, s in enumerate(S):
	if i == 0:
		count += 1
	else:
		if s != last_s:
			A.append(count)
			count = 0
		count += 1
	last_s = s

if count != 0:
	A.append(count)

A.append(0)
A.append(0)

val = 0

if S[0] == "0":
	val = sum(A[:2*K])
	currentMax = val
	old = A[0]
	new = sum(A[2*K:2*K+2])
	val += new - old
	if val > currentMax:
		currentMax = val
	
	for i in range(1, len(A)-2*K, 2):
		old_sum_of_two = sum(A[i:i+2])
		sum_of_two = sum(A[i+2*K+1:i+2*K+3])
		val += sum_of_two - old_sum_of_two
		if val > currentMax:
			currentMax = val
	print(currentMax)
else:
	val = sum(A[:2*K+1])
	currentMax = val
	for i in range(0, len(A)-2*K, 2):
		old_sum_of_two = sum(A[i:i+2])
		sum_of_two = sum(A[i+2*K+1:i+2*K+3])
		val += sum_of_two - old_sum_of_two
		if val > currentMax:
			currentMax = val
	print(currentMax)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = input()
last_s = "0"
count = 0
A = []
for i, s in enumerate(S):
	if i == 0:
		if s == "1":
			count += 1
		else:
			count -= 1
	else:
		if s != last_s:
			A.append(count)
			count = 0
		if s == "1":
			count += 1
		else:
			count -= 1
	last_s = s

if count != 0:
	A.append(count)

for i in range(10):
	A.append(0)


val = 0
if A[0] < 0:
	for i in range(2*K): 
		val += abs(A[i])
	currentMax = val
	old = abs(A[0])
	new = abs(A[1+2*K+1]) + abs(A[1+2*K+3])
	val += new - old
	if val > currentMax:
		currentMax = val
	for i in range(3, len(A)-2*K-2, 2):
		old_sum_of_two = abs(A[i]) + abs(A[i+1])
		sum_of_two = sum(A[i+2*K+1:i+2*K+3])
		val += sum_of_two - old_sum_of_two
		if val > currentMax:
			currentMax = val
	print(currentMax)
else:
	for i in range(2*K+1): 
		val += abs(A[i])
	currentMax = val
	for i in range(0, len(A)-2*K-2, 2):
		old_sum_of_two = abs(A[i]) + abs(A[i+2])
		sum_of_two = abs(A[i+2*K+1]) + abs(A[i+2*K+2])
		val += sum_of_two - old_sum_of_two
		if val > currentMax:
			currentMax = val
	print(currentMax)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = input()
last_s = "0"
count = 0
A = []
for i, s in enumerate(S):
	if i == 0:
		count += 1
	else:
		if s != last_s:
			A.append(count)
			count = 0
		count += 1
	last_s = s

if count != 0:
	A.append(count)

B = []

for i in range(len(S)-(2*K+1)-1):
	B.append(sum(A[2*i:2*i+2*K+1]))

print(max(B))
Problem p03141 (python)

Fixed submission:
import numpy as np
N = int(input())
ApB = []

for i in range(N):
	temp1, temp2 = map(int, input().split())
	s = temp1 + temp2
	ApB.append([s, temp1, temp2, i])

ApB.sort()
score = 0
for i in range(N):
	if i % 2 == 0:
		score += ApB.pop()[1]
	else:
		score -= ApB.pop()[2]

print(score)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
ApB = []
ApB_dict = {}

for i in range(N):
	temp1, temp2 = map(int, input().split())
	s = temp1 + temp2
	ApB.append([s, temp1, temp2, i])
	ApB_dict.setdefault(s, 0)
	ApB_dict[s] += 1

ApB.sort()
ApB.reverse()
score = 0
for i in range(N):
	len_ApB = len(ApB)
	temp_ApB = ApB[0][0]
	num = ApB_dict[temp_ApB]
	if i % 2 == 0:
		if num == 1:
			score += ApB.pop(0)[1]
		else:
			l = ApB[0:len_ApB][1]
			Ind = np.argmax(l)
			score += ApB.pop(Ind)[1]
			ApB_dict[temp_ApB] -= 1
	else:
		if num == 1:
			score -= ApB.pop(0)[2]
		else:
			l = ApB[len_ApB-num:len_ApB][2]
			Ind = np.argmax(l)
			score -= ApB.pop(Ind)[2]
			ApB_dict[temp_ApB] -= 1
	#print("score:", score,"ApB:", ApB)

print(score)
Problem p02995 (python)

Fixed submission:
import fractions

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

def multiple(A, B, C): #number of multiples of C between A and B
    return B//C - (A-1)//C

A, B, C, D = map(int, input().split())

allnumbers = B-A+1

ans = allnumbers - (multiple(A,B,C) + multiple(A,B,D) - multiple(A,B,lcm(C,D)))

print(ans)

Buggy submission (verdict: Runtime Error):
import fraction

def lcm(x, y):
    return (x * y) // fraction.gcd(x, y)

def multiple(A, B, C): #number of multiples of C between A and B
    return int((B+0.5)//C - (A-0.5)//C)

A, B, C, D = map(int, input().split())

allnumbers = B-A+1

ans = allnumbers - (multiple(A,B,C) + multiple(A,B,D) - multiple(A,B,lcm(C,D)))

print(ans)

Buggy submission (verdict: Runtime Error):
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

def multiple(A, B, C): #number of multiples of C between A and B
    return int((B+0.5)//C - (A-0.5)//C)

A, B, C, D = map(int, input().split())

allnumbers = B-A+1

ans = allnumbers - (multiple(A,B,C) + multiple(A,B,D) - multiple(A,B,lcm(C,D)))

print(ans)
Problem p03085 (python)

Fixed submission:
input = raw_input()
 
base = {"A":"T", "T":"A", "C":"G", "G":"C"}
 
print base[input]

Buggy submission (verdict: Runtime Error):
input = raw_input()

base = {"A":"T", "T":"A", "C":"T", "T":"C"}

print base[input]
Problem p03146 (python)

Fixed submission:
an = int(input())

numbers = [an]
while True:
  if an%2 == 1:
    an = 3*an+1
  else:
    an = an//2
  if an in numbers:
    print(len(numbers)+1)
    break
  else:
    numbers.append(an)

Buggy submission (verdict: Runtime Error):
an = int(input())

numbers = [an]
while True:
	if an%2 == 1:
		an = 3*an+1
	else:
		an = an//2
	if an in numbers:
		print(len(numbers)+1)
        break
    else:
		numbers.append(an)

Buggy submission (verdict: Runtime Error):
an = int(input())

numbers = []
while True:
	if an%2 == 1:
		an = 3*an+1
	else:
		an = an//2
	if an in numbers:
		print(len(numbers)+1)
        break
    else:
		numbers.append(an)
Problem p03206 (python)

Fixed submission:
data = ["Christmas Eve Eve Eve", "Christmas Eve Eve", "Christmas Eve", "Christmas"]

print(data[int(input())-22])

Buggy submission (verdict: Runtime Error):
data = ["Christmas Eve Eve Eve", "Christmas Eve Eve", "Christmas Eve", "Christmas"]

print(data(int(input())-22))

Buggy submission (verdict: Runtime Error):
data = ["Christmas Eve Eve Eve", "Christmas Eve Eve", "Christmas Eve", "Christmas"]

print(data(int(input())-22))
Problem p03238 (python)

Fixed submission:
age = int(input())
if age == 1:
  print("Hello World")
else:
  print(int(input())+int(input()))

Buggy submission (verdict: Runtime Error):
age = input()
if age == 1:
  print("Hello World")
else:
  print(input()+input())
Problem p03243 (python)

Fixed submission:
X = int(input())

if 100 <= X <= 111:
  n = 111
elif X <= 222:
  n = 222
elif X <= 333:
  n = 333
elif X <= 444:
  n = 444
elif X <= 555:
  n = 555
elif X <= 666:
  n = 666
elif X <= 777:
  n = 777
elif X <= 888:
  n = 888
elif X <= 999:
  n = 999
else:
  print("error")

print(n)

Buggy submission (verdict: Runtime Error):
X = int(input)

if 100 <= X <= 111:
  n = 111
elif X <= 222:
  n = 222
elif X <= 333:
  n = 333
elif X <= 444:
  n = 444
elif X <= 555:
  n = 555
elif X <= 666:
  n = 666
elif X <= 777:
  n = 777
elif X <= 888:
  n = 888
elif X <= 999:
  n = 999
else:
  print("error")

print(n)
Problem p03264 (python)

Fixed submission:
K = int(input())

if K%2 == 0:
  ak = K**2//4
else:
  ak = (K**2-1)//4

print(ak)

Buggy submission (verdict: Runtime Error):
K = int(input())

if K%2 == 0:
  ak = k**2//4
else:
  ak = (k**2-1)//4

print(ak)

Buggy submission (verdict: Runtime Error):
K = int(input)

if K%2 == 0:
  ak = k**2//4
else:
  ak = (k**2-1)//4

print(ak)
Problem p03352 (python)

Fixed submission:
X = int(input())

bekijosu=[1]

for i in range(2, 1001):
    for j in range(2,10):
        if i ** j <= 1000:
            bekijosu.append(i ** j)

print(max([n for n in bekijosu if n <= X]))

Buggy submission (verdict: Runtime Error):
X = int(input())

bekijosu=[]

for i in range(2, 1001):
    for j in range(2,10):
        if i ** j <= 1000:
            bekijosu.append(i ** j)

print(max([n for n in bekijosu if n <= X]))
Problem p03448 (python)

Fixed submission:
A, B, C, X = (int(input()) for i in range(4))

cnt = 0
for a in range(A+1):
  for b in range(B+1):
    for c in range(C+1):
      if 500*a + 100*b + 50*c == X:
        cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
A, B, C, X = (int(input()) for i in range(4))

cnt = 0
for a in range(A+1):
  for b in range(B+1):
  	for c in range(C+1):
    	if 500*a + 100*b + 50*c == X:
        	cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
A, B, C, X = (int(input()) for i in range(4))

cnt = 0
for a in range(A+1):
  for b in range(B+1)
  	for c in range(C+1)
    	if 500*a + 100*b + 50*c == X:
        	cnt += 1
print(cnt)
Problem p03471 (python)

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

for x in range(N+1):
  for y in range(N+1):
    z = N-(x+y)
    if z < 0: break
    elif 10000*x + 5000*y + 1000*z == Y:
      print(x,y,z)
      sys.exit()

print(-1,-1,-1)

Buggy submission (verdict: Runtime Error):
import sys
N, Y = map(int, input().split())
 
for x in range(N+1)[::-1]:
  if x <= N:
    for y in range(N-i+1)[::-1]:
      if x+y <= N:
        z = N-(x+y)
        if 10000*x + 5000*y + 1000*z == Y:
          print(x,y,z)
          sys.exit()
 
print(-1,-1,-1)

Buggy submission (verdict: Runtime Error):
import sys
N, Y = map(int, input().split())

for x in range(N+1)[::-1]:
  for y in range(N+1)[::-1]:
	if x+y <= N:
      z = N-(x+y)
      if 10000*x + 5000*y + 1000*z == Y:
        print(x,y,z)
        sys.exit()

print(-1,-1,-1)

Buggy submission (verdict: Runtime Error):
import sys
N, Y = map(int, input().split())

for x in range(N+1):
  for y in range(N+1):
    z = N-(x+y)
    if 10000*x + 5000*y + 1000*z = Y:
      print(x,y,z)
      sys.exit()

print(-1,-1,-1)
Problem p03737 (python)

Fixed submission:
s1, s2, s3 = input().split()

ans = s1[0].upper() + s2[0].upper() + s3[0].upper()
print(ans)

Buggy submission (verdict: Runtime Error):
s1, s2, s3 = input().split()

ans = s1[0].upper()+s1[1].upper()+s1[2].upper()
print(ans)
Problem p03738 (python)

Fixed submission:
A, B = int(input()), int(input())

if A==B:
  ans = 'EQUAL'
elif A<B:
  ans = 'LESS'
else:
  ans = 'GREATER'

print(ans)

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())

if A==B:
  ans = 'EQUAL'
elif A<B:
  ans = 'LESS'
else:
  ans = 'GREATER'

print(ans)
Problem p02973 (python)

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

import bisect as bi


def solve():
    N = int(input())
    A = []
    heads = []
    for _ in range(N):
        A.append(int(input()))
    a = A.pop()
    bi.insort(heads, a)
    while A:
        a = A.pop()
        if a < heads[-1]:
            j = bi.bisect(heads, a)
            del heads[j]
        bi.insort(heads, a)
    return len(heads)
  

def main():
    print(solve())


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import heapq


def solve():
    N = int(input())
    A = []
    heads = []
    for _ in range(N):
        A.append(int(input()))
    a = A.pop()
    heapq.heappush(heads, -a)
    while A:
        a = A.pop()
        h = -heapq.heappop(heads)
        if a < h:
            for b in heads[::-1]:
                if - b > a:
                    heads.remove(b)
                    heapq.heapify(heads)
                    heapq.heappush(heads, -a)
                    break
        else:
            heapq.heappush(heads, -a)
            heapq.heappush(heads, -h)
    return len(heads)
  

def main():
    print(solve())


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import heapq


def solve():
    N = int(input())
    A = []
    heads = []
    for _ in range(N):
        A.append(int(input()))
    a = A.pop()
    heapq.heappush(heads, -a)
    while A:
        a = A.pop()
        h = -heapq.heappop(heads)
        if a < h:
            for b in heads[::-1]:
                if - b > a:
                    heads.remove(b)
                    heapq.heappush(heads, -a)
                    break
        else:
            heapq.heappush(heads, -a)
            heapq.heappush(heads, -h)
    return len(heads)
  

def main():
    print(solve())


if __name__ == "__main__":
    main()
Problem p03007 (python)

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


def main():
    N = int(input())
    A = sorted(list(map(int, input().split())))
    if A[0] >= 0:
        printAllPlus(A)
    elif A[-1] <= 0:
        printAllMinus(A)
    else:
        printMixed(A)


def printMixed(nums):
    i = -1
    for k, n in enumerate(nums):
        if n >= 0:
            i = k
            break
    plus = nums[i:]
    minus = nums[:i]
    print(sum(plus) - sum(minus))
    while len(plus) > 1:
        p = plus.pop()
        m = minus.pop()
        print(m, p)
        minus.append(m - p)
    p0 = plus.pop()
    for m in minus:
        print(p0, m)
        p0 -= m


def printAllPlus(nums):
    ans = sum(nums) - 2 * nums[0]
    print(ans)
    tmp = nums[0]
    for n in nums[1:-1]:
        print(tmp, n)
        tmp -= n
    print(nums[-1], tmp)


def printAllMinus(nums):
    nums.reverse()
    ans = -sum(nums) + 2 * nums[0]
    print(ans)
    tmp = nums[0]
    for n in nums[1:]:
        print(tmp, n)
        tmp -= n


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys


def main():
    N = int(input())
    A = sorted(list(map(int, input().split())))
    if A[0] > 0:
        printAllPlus(A)
        sys.exit()
    elif A[N - 1] < 0:
        printAllMinus(A)
        sys.exit()

    i = -1
    for k, n in enumerate(A):
        if n >= 0:
            i = k
            break
    plus = A[i:]
    minus = A[:i]
    print(sum(plus) - sum(minus))
    while len(plus) > 1:
        p = plus.pop()
        m = minus.pop()
        print(m, p)
        minus.append(m - p)
    p0 = plus.pop()
    for m in minus:
        print(p0, m)
        p0 -= m


def printAllPlus(nums):
    ans = sum(nums) - 2 * nums[0]
    print(ans)
    tmp = nums[0]
    for n in nums[1:-1]:
        print(tmp, n)
        tmp -= n
    print(nums[-1], tmp)


def printAllMinus(nums):
    nums.reverse()
    ans = -sum(nums) + 2 * nums[0]
    print(ans)
    tmp = nums[0]
    for n in nums[1:]:
        print(tmp, n)
        tmp -= n


if __name__ == "__main__":
    main()
Problem p03049 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 5)

N = int(input())
right_A = 0
left_B = 0
B_to_A = 0
AB_count = 0

for _ in range(N):
    target = input()
    AB_count += target.count('AB')
    if target[0] == 'B' and target[-1] == 'A':
        B_to_A += 1
    elif target[0] == 'B':
        left_B += 1
    elif target[-1] == 'A':
        right_A += 1

def recursive(x, y, z):
    if z == 0:
        return min(x, y)
    elif x == y == 0:
        return z - 1
    else:
        return recursive(x, y, z-1) + 1

print(recursive(right_A, left_B, B_to_A) + AB_count)

Buggy submission (verdict: Runtime Error):
N = int(input())
right_A = 0
left_B = 0
B_to_A = 0
AB_count = 0

for _ in range(N):
    target = input()
    AB_count += target.count('AB')
    if target[0] == 'B' and target[-1] == 'A':
        B_to_A += 1
    elif target[0] == 'B':
        left_B += 1
    elif target[-1] == 'A':
        right_A += 1

def recursive(x, y, z):
    if z == 0:
        return min(x, y)
    elif x == y == 0:
        return z - 1
    else:
        return recursive(x, y, z-1) + 1

print(recursive(right_A, left_B, B_to_A) + AB_count)
Problem p03061 (python)

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

N = int(input())
A = list(map(int, input().split()))
divisors = sorted(make_divisors(A[0]) + make_divisors(A[1]), reverse=True)

ans = 0
for d in divisors:
    ok_cnt = 0
    for a in A:
        if a % d == 0:
            ok_cnt += 1
    if ok_cnt >= N-1:
        ans = d
        break
print(ans)

Buggy submission (verdict: Runtime Error):
from functools import reduce
from math import gcd

N = int(input())
A = list(map(int, input().split()))

def gcd_list(nums):
    return reduce(gcd, nums)

ans = -1

for i in range(N-1):
    g = gcd_list(A[:i] + A[i+1:])
    if g > ans:
        ans = g

g = gcd_list(A[:N-1])
if g > ans:
    ans = g

print(ans)

Buggy submission (verdict: Runtime Error):
from functools import reduce
from math import gcd

N = int(input())
A = list(map(int, input().split()))

def gcd_list(nums):
    return reduce(gcd, nums)

ans = -1

for i in range(N):
    g = gcd_list(A[:i] + A[i+1:])
    if g > ans:
        ans = g

print(ans)
Problem p03079 (python)

Fixed submission:
A, B, C = map(int, input().split())
if A == B and B == C:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
if A == B and B == C:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
if A == B == C:
    print('Yes')
else:
    print('No')
Problem p03607 (python)

Fixed submission:
N = int(input())
ans = 0
nums = set()
for _ in range(N):
    A = int(input())
    if A in nums:
        ans -= 1
        nums.remove(A)
    else:
        ans += 1
        nums.add(A)
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
ans = 0
nums = set([])
for _ in range(N):
    A = int(input())
    if A in nums:
        ans -= 1
        nums.clear(A)
    else:
        ans += 1
        nums.add(A)
print(ans)
Problem p03611 (python)

Fixed submission:
N = int(input())
nums = [0] * 100002
data = list(map(int, input().split()))
for A in data:
    nums[A-1] += 1
    nums[A] += 1
    nums[A+1] += 1
print(max(nums))

Buggy submission (verdict: Runtime Error):
N = int(input())
nums = [0] * 10000
data = list(map(int, input().split()))
for A in data:
    nums[A-1] += 1
    nums[A] += 1
    nums[A+1] += 1
print(max(nums))
Problem p02995 (python)

Fixed submission:

def calGCD(x,y):
    while(y > 0):
        x, y = y, x % y
    return x

A,B,C,D = [int(i) for i in input().split()]

CD = C * D // calGCD(C,D)

cntC = (B // C) - (A // C)
cntD = (B // D) - (A // D)
cntCD = (B // CD) - (A // CD)

if A % C == 0:
    cntC += 1
if A % D == 0:
    cntD += 1
if A % CD == 0:
    cntCD += 1

ans = B - A + 1 - (cntC + cntD - cntCD)
print(ans)

Buggy submission (verdict: Runtime Error):

import math

A,B,C,D = [int(i) for i in input().split()]

CD = C * D // math.gcd(C,D)

cntC = (B // C) - (A // C)
cntD = (B // D) - (A // D)
cntCD = (B // CD) - (A // CD)

if A % C == 0:
    cntC += 1
if A % D == 0:
    cntD += 1
if A % CD == 0:
    cntCD += 1

ans = B - A + 1 - (cntC + cntD - cntCD)
print(ans)
Problem p03150 (python)

Fixed submission:
ans = "keyence"

s = input()
flag=0
if ans in s:
  flag=1
  print("YES")
else:
  for i in range(1,len(ans)):
    if s[:i] == ans[:i] and s[i-len(ans):] == ans[i-len(ans):]:
      flag=1
      print("YES")
      break
if flag==0:
  print("NO")

Buggy submission (verdict: Runtime Error):
ans = list("keyence")

S = input()
for i in range(len(S)):
  if S[i] == ans[0]:
    ans.pop(0)

if len(ans) == 0:
  print("YES")
else:
  print("NO")
Problem p03229 (python)

Fixed submission:
from collections import deque
N = int(input())
 
num = []
for i in range(N):
  num.append(int(input()))
  
num = deque(sorted(num))
ans = deque([num.popleft()])
 
for i in range(N-2):
  if i % 4 == 0:
    ans.append(num.pop())
  elif i % 4 == 1:
    ans.appendleft(num.pop())
  elif i % 4 == 2:
    ans.append(num.popleft())
  else:
    ans.appendleft(num.popleft())

answer = max(abs(num[0]-ans[0]), abs(num[0]-ans[-1]))
for i in range(len(ans)-1):
  answer += abs(ans[i] - ans[i+1])
  
print(answer)

Buggy submission (verdict: Runtime Error):
N = int(input())

num = []
for i in range(N):
  num.append(int(input()))
  
num = sorted(num)
ans = [num[0]]
num.pop(0)

for i in range(len(num)-1):
  if i % 4 == 0:
    ans.append(num[-1])
    num.pop(-1)
  elif i % 4 == 1:
    ans = [num[-1], *ans]
    num.pop(-1)
  elif i % 4 == 2:
    ans.append(num[0])
    num.pop(0)
  else:
    ans = [num[0], *ans]
    num.pop(0)

answer = max(abs(num[0]-ans[0]), abs(num[0]-ans[-1]))
for i in range(len(ans)-1):
  answer += abs(ans[i] - ans[i+1])
  
print(answer)