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

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

x = list(map(lambda x: abs(x - X), x))


def gcd(a, b):
    if a % b == 0:
        return b
    else:
        return gcd(b, a % b)

ans = x[0]
for i in x:
    ans = min(ans, gcd(i, ans))
print(ans)

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

def gcd(*numbers):
    return reduce(math.gcd, numbers)

## 最初に入力回数が与えられて、そのあとデータが入力される。といったパターン
nums = list(map(int, input().split())) # "1 2 3"と入力
N = nums[0]
X = nums[1]

nums = list(map(int, input().split())) # "1 2 3"と入力

a=[]
for item in nums:
	a.append(abs(item - X))


print(gcd (*a))

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

def gcd(*numbers):
    return reduce(math.gcd, numbers)

## 最初に入力回数が与えられて、そのあとデータが入力される。といったパターン
nums = list(map(int, input().split())) # "1 2 3"と入力
N = nums[0]
X = nums[1]

nums = list(map(int, input().split())) # "1 2 3"と入力

a=[]
for item in nums:
	a.append(abs(item - X))


print(gcd (*a))
Problem p03273 (python)

Fixed submission:
H, W = map(int, input().split())

A = [input() for i in range(H)]

row = []
column = []

for i in range(len(A)):
        for j in range(len(A[i])):
                if A[i][j] == "#":
                        row.append(i)
                        break

for i in range(W):
        for j in range(len(A)):
                if A[j][i] == "#":
                        column.append(i)
                        break


for i in range(len(A)):
        flag = True
        for j in range(len(A[i])):
                if i in row:
                        if j in column:
                                print(A[i][j], end = "")
                else:
                        flag = False
                        continue
        if flag:
                print("")

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
maze = [input() for i in range(H)]


delete_candidate = []
for i in range(H):
        flag = False
        for j in maze[i]:
                if j == "#":
                        flag = True
                        continue
        if flag == False:
                delete_candidate.append(i)

for i in delete_candidate:
        del maze[i]

delete_candidate = []
for j in range(W):
        flag = False
        for i in range(len(maze)):
                if maze[i][j] == "#":
                        flag = True
                        continue
        if flag == False:
                delete_candidate.append(j)


for i in range(len(maze)):
        for j in range(len(maze[i])):  
                if j in delete_candidate:
                        continue
                print(maze[i][j], end = "")
        print("")
Problem p03274 (python)

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

ans = 100000000000
#最初と最後だけ調べればOK
for i in range(N - K + 1):
    tmp_min = x[i]
    tmp_max = x[i + K - 1]
    tmp = 0
    if tmp_min < 0:
        #混合の場合
        if tmp_max > 0:
            #+に先に行く場合
            if abs(tmp_min) > tmp_max:
                tmp = tmp_max * 2
                tmp += abs(tmp_min)
            #-に先に行く場合
            else:
                tmp = abs(tmp_min) * 2
                tmp += tmp_max
        #すべてマイナスの場合
        else:
            tmp = abs(tmp_min)
    else:
        tmp = tmp_max
    ans = min(ans, tmp)
print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
x = list(map(int,input().split()))


#最初と最後だけ調べればOK
for i in range(N - K + 1):
    tmp_min = x[i]
    tmp_max = x[i + K - 1]

    if tmp_min < 0:
        #混合の場合
        if tmp_max < 0:
            #+に先に行く場合
            if abs(tmp_min) > tmp_max:
                tmp = tmp_max * 2
                tmp += abs(tmp_min)
            #-に先に行く場合
            else:
                tmp = abs(tmp_min) * 2
                tmp += tmp_max
        #すべてマイナスの場合
        else:
            tmp = abs(tmp_min)
    else:
        tmp = tmp_max
    ans = min(ans, tmp)
print(ans)
Problem p03353 (python)

Fixed submission:
s = input()
K = int(input())


sub_string = []
for i in range(len(s)):
    for j in range(0, len(s) + 1 - i):
        if j > K:
            break
        sub_string.append(s[i:i+j])

#重複の排除
sub_string = set(sub_string)
#辞書順にソートする
sub_string = sorted(sub_string)
#空白を削除
sub_string.remove('')
print(sub_string[K - 1])

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


sub_string = []
for i in range(len(s)):
    for j in range(0, len(s) + 1 - i):
        sub_string.append(s[i:i+j])

#重複の排除
sub_string = set(sub_string)
#辞書順にソートする
sub_string = sorted(sub_string)
#空白を削除
sub_string.remove('')
print(sub_string[K - 1])
Problem p03436 (python)

Fixed submission:
H, W = map(int, input().split())
G = [input() for _ in range(H)]
sy, sx, gy, gx = 0, 0, H - 1, W - 1
seen = [[-1] * W for _ in range(H)]

if G[sy][sx] == '#' or G[gy][gx] == '#':
    print(-1)
    exit()

from collections import deque
que = deque()
que.append([sy, sx])
seen[sy][sx] = 0
while que:
    y, x = que.popleft()
    for d in [-1, 0], [1, 0], [0, -1], [0, 1]:
        dy = y + d[0]
        dx = x + d[1]
        if dy < 0 or H <= dy or dx < 0 or W <= dx:
            continue
        if G[dy][dx] == '#':
            continue
        if seen[dy][dx] > -1:
            continue
        que.append([dy, dx])
        seen[dy][dx] = seen[y][x] + 1

count = 0
bunpu = [0] * (H * W + 1)
if seen[gy][gx] == -1:
    print(-1)
    exit()
else:
    all = H * W
    black = 0
    for i in range(H):
        for j in range(W):
            if G[i][j] == '#':
                black += 1
    #start point = 0,0 
    ans = all - black - seen[gy][gx] - 1
print(ans)

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
G = [input() for _ in range(H)]
sy, sx, gy, gx = 0, 0, H - 1, W - 1
seen = [[-1] * W for _ in range(H)]

if G[sy][sx] == '#' or G[gy][gx] == '#':
    print(-1)
    exit()

from collections import deque
que = deque()
que.append([sy, sx])
seen[sy][sx] = 0
while que:
    y, x = que.popleft()
    for d in [-1, 0], [1, 0], [0, -1], [0, 1]:
        dy = y + d[0]
        dx = x + d[1]
        if dy < 0 or H <= dy or dx < 0 or W <= dx:
            continue
        if G[dy][dx] == '#':
            continue
        if seen[dy][dx] > -1:
            continue
        que.append([dy, dx])
        seen[dy][dx] = seen[y][x] + 1

count = 0
bunpu = [0] * (H * W + 1)
if seen[gy][gx] == -1:
    print(-1)
else:
    all = H * W
    black = 0
    for i in range(H):
        for j in range(W):
            if G[i][j] == '#':
                black += 1
    #start point = 0,0 
    ans = all - black - seen[gy][gx] - 1
print(ans)

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
G = [input() for _ in range(H)]
sy, sx, gy, gx = 0, 0, H - 1, W - 1
seen = [[-1] * W for _ in range(H)]

if G[sy][sx] == '#' or G[gy][gx] == '#':
    print(-1)
    exit()

from collections import deque
que = deque()
que.append([sy, sx])
seen[sy][sx] = 0
while que:
    y, x = que.popleft()
    for d in [-1, 0], [1, 0], [0, -1], [0, 1]:
        dy = y + d[0]
        dx = x + d[1]
        if dy < 0 or H <= dy or dx < 0 or W <= dx:
            continue
        if G[dy][dx] == '#':
            continue
        if seen[dy][dx] > -1:
            continue
        que.append([dy, dx])
        seen[dy][dx] = seen[y][x] + 1

count = 0
bunpu = [0] * (H * W + 1)
if seen[gy][gx] == -1:
    print(-1)
else:
    all = H * W
    black = 0
    for i in range(H):
        for j in range(W):
            if G[i][j] == '#':
                black += 1
    #start point = 0,0 
    ans = all - black - seen[gy][gx] - 1
print(ans)
Problem p03502 (python)

Fixed submission:
N = int(input())

def fx(N):
  ans = 0
  for i in str(N):
    ans += int(i)
  return ans
  
if N % fx(N) == 0:
  print("Yes")
else:
  print("No")

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

def fx(N):
  ans = 0
  while N // 10 != 0:
    ans += N % 10
    N = N //10
  return ans
  
if N % fx(N) == 0:
  print("Yes")
else:
  print("No")
Problem p03611 (python)

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

a_hash = {}
for i in range(N):
    if a[i] in a_hash:
        a_hash[a[i]] += 1
    else:
        a_hash[a[i]] = 1

a_sort = sorted(a_hash.items(), key = lambda x: x[0])
a_sort = list(a_sort)
ans_list = [0] * N

if len(a) == 1:
    print(1)
    exit()
if len(a_sort) == 1:
    print(a_sort[0][1])
    exit()

for i in range(len(a_sort)):
    if i == 0:
        if a_sort[0][0] == a_sort[1][0] - 1:
            ans_list[0] += a_sort[0][1] + a_sort[1][1]
    elif i == len(a_sort) -1:
        if a_sort[i][0] == a_sort[i-1][0] + 1:
            ans_list[i] += a_sort[i][1] + a_sort[i-1][1]
        else:
            ans_list[i] = a_sort[i][1]
    else:
        if a_sort[i][0] == a_sort[i-1][0] + 1:
            ans_list[i] += a_sort[i][1] + a_sort[i-1][1]
        if a_sort[i][0] == a_sort[i+1][0] - 1:
            ans_list[i] += a_sort[i+1][1]


print(max(ans_list))

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))

a_hash = {}
for i in range(N):
    if a[i] in a_hash:
        a_hash[a[i]] += 1
    else:
        a_hash[a[i]] = 1

a_sort = sorted(a_hash.items(), key = lambda x: x[0])
a_sort = list(a_sort)
ans_list = [0] * N

if len(a) == 1:
    print(1)
    exit()

for i in range(len(a_sort)):
    if i == 0:
        if a_sort[0][0] == a_sort[1][0] - 1:
            ans_list[0] += a_sort[0][1] + a_sort[1][1]
    elif i == len(a_sort) -1:
        if a_sort[i][0] == a_sort[i-1][0] + 1:
            ans_list[i] += a_sort[i][1] + a_sort[i-1][1]
        else:
            ans_list[i] = a_sort[i][1]
    else:
        if a_sort[i][0] == a_sort[i-1][0] + 1:
            ans_list[i] += a_sort[i][1] + a_sort[i-1][1]
        if a_sort[i][0] == a_sort[i+1][0] - 1:
            ans_list[i] += a_sort[i+1][1]


print(max(ans_list))

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))

a_hash = {}
for i in range(N):
    if a[i] in a_hash:
        a_hash[a[i]] += 1
    else:
        a_hash[a[i]] = 1

a_sort = sorted(a_hash.items(), key = lambda x: x[0])
a_sort = list(a_sort)
ans_list = [0] * N

if len(a) == 1:
    print(1)
    exit()

for i in range(len(a_sort)):
    if i == 0:
        if a_sort[0][0] == a_sort[1][0] - 1:
            ans_list[0] += a_sort[0][1] + a_sort[1][1]
    elif i == len(a_sort) -1:
        if a_sort[i][0] == a_sort[i-1][0] + 1:
            ans_list[i] += a_sort[i][1] + a_sort[i-1][1]
        else:
            ans_list[i] = a_sort[i][1]
    else:
        if a_sort[i][0] == a_sort[i-1][0] + 1:
            ans_list[i] += a_sort[i][1] + a_sort[i-1][1]
        if a_sort[i][0] == a_sort[i+1][0] - 1:
            ans_list[i] += a_sort[i+1][1]


print(max(ans_list))
Problem p03633 (python)

Fixed submission:
import sys
sys.setrecursionlimit(100000)

N = int(input())
T = [int(input()) for i in range(N)]

def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)

def lcm(a, b):
    return int((a * b) // gcd(a, b))

ans = T[0]
for i in range(1, N):
    ans = lcm(ans, T[i])

print(ans)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(100000)

N = int(input())
T = [int(input()) for i in range(N)]

def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)

def lcm(a, b):
    return int((a * b) / gcd(a, b))

ans = T[0]
for i in range(1, N):
    ans = lcm(ans, T[i])

print(ans)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(100000)

N = int(input())
T = [int(input()) for i in range(N)]

def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)

def lcm(a, b):
    return int((a * b) / gcd(a, b))

ans = T[0]
for i in range(1, len(T)):
    ans = lcm(ans, T[i])

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
T = [int(input()) for i in range(N)]

def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)

def lcm(a, b):
    return int((a * b) / gcd(a, b))

ans = T[0]
for i in range(1, len(T)):
    ans = lcm(ans, T[i])

print(ans)
Problem p03695 (python)

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

a.sort()
min_color = [0] * 8
max_color = [0] * 8
extra = 0

for i in a:
    if i >= 3200:
        if sum(min_color) == 0:
            min_color[0] = 1
        extra += 1
    else:
        min_color[i // 400] = 1
        max_color[i // 400] = 1


print( sum(min_color), sum(max_color) + extra)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))

a.sort()

min_color = [0] * 8
max_color = [0] * 8
extra = 0

for i in a:
    if i >= 3200:
        if sum(min_color) == 0:
            min_color[0] = 1
        if sum(max_color + extra) < 8:
            extra += 1
    else:
        min_color[i // 400] = 1
        max_color[i // 400] = 1


print( sum(min_color), sum(max_color) + extra)
Problem p03006 (python)

Fixed submission:


def main():
    n = input()
    if n == 1:
        print 1
        return
    xy = []
    for _ in xrange(n):
        x, y = map(int, raw_input().split())
        xy.append([x, y])
    count = {}
    for i in xrange(n):
        x0, y0 = xy[i]
        for j in xrange(n):
            if i == j:
                continue
            x1, y1 = xy[j]
            key = (x1 - x0, y1 - y0)
            try:
                count[key] += 1
            except KeyError:
                count[key] = 1
    print n - max(count.values())


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):


def main():
    n = input()
    xy = []
    for _ in xrange(n):
        x, y = map(int, raw_input().split())
        xy.append([x, y])
    count = {}
    for i in xrange(n - 1):
        x0, y0 = xy[i]
        for j in xrange(i + 1, n):
            x1, y1 = xy[j]
            key = (x1 - x0, y1 - y0)
            try:
                count[key] += 1
            except KeyError:
                count[key] = 1
    print n - max(count.values())


if __name__ == '__main__':
    main()
Problem p03026 (python)

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


def main():
    n = input()
    edges = []
    nodes = [0] * n
    children = {i: [] for i in xrange(n)}
    for _ in xrange(n - 1):
        a, b = map(int, raw_input().split())
        a -= 1
        b -= 1
        edges.append([a, b])
        nodes[a] += 1
        nodes[b] += 1
        children[a].append(b)
        children[b].append(a)

    cc = map(int, raw_input().split())
    cc.sort(reverse=True)
    ans = [0] * n

    def dfs(node, visited):
        for nex in children[node]:
            if nex in visited:
                continue
            visited.add(nex)
            dfs(nex, visited)
        ans[node] = cc.pop()

    while True:
        start = random.randrange(n)
        if len(children[start]) > 1:
            break
    dfs(start, {start})

    score = 0
    for a, b in edges:
        score += min(ans[a], ans[b])
    print score
    print ' '.join(map(str, ans))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):


def main():
    n = input()
    edges = []
    nodes = [0] * n
    children = {i: [] for i in xrange(n)}
    for _ in xrange(n - 1):
        a, b = map(int, raw_input().split())
        a -= 1
        b -= 1
        edges.append([a, b])
        nodes[a] += 1
        nodes[b] += 1
        children[a].append(b)
        children[b].append(a)

    def search(i, deg, dist, visited):
        ret = []
        for j in children[i]:
            if nodes[j] < deg:
                return dist
            if nodes[j] > deg:
                continue
            if j in visited:
                continue
            visited.add(j)
            ret.append(search(j, deg, dist + 1, visited))
        if ret:
            return min(ret)
        else:
            return dist

    def key(i):
        deg = nodes[i]
        return deg, search(i, deg, 1, {i})

    nodes = sorted([node for node in xrange(n)],
                   key=lambda i: key(i))
    cc = map(int, raw_input().split())
    cc.sort()
    ans = [0] * n
    for node, c in zip(nodes, cc):
        ans[node] = c
    score = 0
    for a, b in edges:
        score += min(ans[a], ans[b])
    print score
    print ' '.join(map(str, ans))


if __name__ == '__main__':
    main()
Problem p03037 (python)

Fixed submission:

def main():
    n, m = map(int, raw_input().split())
    min_id = 1
    max_id = n
    for _ in xrange(m):
        l, r = map(int, raw_input().split())
        min_id = max(min_id, l)
        max_id = min(max_id, r)
    print max(0, max_id - min_id + 1)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):

def main():
    n, m = map(int, raw_input().split())
    min_id = 1
    max_id = n
    for _ in xrange(m):
        l, r = map(int, raw_input().split())
        min_id = max(min_id, l)
        max_id = min(max_id, r)e
    print max(0, max_id - min_id + 1)


if __name__ == '__main__':
    main()
Problem p03085 (python)

Fixed submission:
print {'A': 'T', 'T': 'A', 'G': 'C', 'C': 'G'}[raw_input().strip()]

Buggy submission (verdict: Runtime Error):
print {'A': 'T', 'T': 'A', 'G': 'C', 'C': 'G'}[input().strip()]
Problem p03381 (python)

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

n = int(input())
xx = list([i, x] for i, x in enumerate(map(int, input().split())))
xx.sort(key=lambda x: x[1])

mid1 = xx[n // 2][1]
mid2 = xx[n // 2 - 1][1]
for i in range(n // 2):
    xx[i][1] = mid1
for i in range(n // 2, n):
    xx[i][1] = mid2

xx.sort()
print('\n'.join(str(x[1]) for x in xx))

Buggy submission (verdict: Runtime Error):
from collections import defaultdict


def main():
    h, w = map(int, input().split())
    s = []
    for _ in range(h):
        col = []
        s.append(col)
        for c in input().strip():
            col.append(ord(c))
    c_row = defaultdict(int)
    for col in s:
        c_row[tuple(sorted(col))] += 1
    if sum(c % 2 for c in c_row.values()) > h % 2:
        print('NO')
        return
    for row, c in c_row.items():
        if c % 2:
            count = defaultdict(int)
            for ch in row:
                count[ch] += 1
            if sum(cc % 2 for cc in count.values()) > w % 2:
                print('NO')
                return

    c_col = defaultdict(int)
    for col in zip(*s):
        c_col[tuple(sorted(col))] += 1
    if sum(c % 2 for c in c_col.values()) > w % 2:
        print('NO')
        return

    for col, c in c_col.items():
        if c % 2:
            count = defaultdict(int)
            for ch in col:
                count[ch] += 1
            if sum(cc % 2 for cc in count.values()) > h % 2:
                print('NO')
                return

    if s[0][0] == ord('b'):
        print('NO')
    else:
        print('YES')


main()
Problem p03403 (python)

Fixed submission:
def main():
    n = int(input())
    xx = [0] + list(map(int, input().split())) + [0]
    all_cost = sum(abs(xx[i+1] - xx[i]) for i in range(n+1))
    for i in range(n):
        a, b, c = xx[i:i+3]
        print(all_cost - abs(b - a) - abs(c - b) + abs(c - a))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    a, b = map(int, input().split())
    s, k = '.#'
    ans = [[k] * 100 for _ in range(50)] + [[s] * 100 for _ in range(50)]
    col = 0
    row = 0
    for _ in range(a - 1):
        ans[row][col] = s
        col += 2
        if col == 100:
            col = 0
            row += 2
    col = 0
    row = 99
    for _ in range(a - 1):
        ans[row][col] = k
        col += 2
        if col == 100:
            col = 0
            row -= 2
    print(100, 100)
    for row in ans:
        print(''.join(row))

if __name__ == '__main__':
    main()
Problem p03427 (python)

Fixed submission:

def score(s):
    return sum(map(int, s))


def main():
    s = input()
    best = score(s)
    for i in range(1, len(s)):
        ss = int(s) // 10**i * 10**i - 1
        best = max(best, score(str(ss)))
    print(best)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
from math import acos, hypot, pi


class Point:
    def __init__(self, i, x, y):
        self.i = i
        self.x = int(x)
        self.y = int(y)


class Line:
    def __init__(self, p1, p2):
        self.p1 = p1
        self.p2 = p2
        self.d2 = (p1.x - p2.x) ** 2 + (p1.y - p2.y) ** 2
        if p1.x == p2.x:
            self.a = 1
            self.b = 0
        else:
            self.a = p2.y - p1.y
            self.b = p1.x - p2.x
        self.c = -p1.y * self.b - p1.x * self.a

    def dist(self, p):
        f = self.a * p.x + self.b * p.y + self.c
        if f == 0:
            d12 = (self.p1.x - p.x) ** 2 + (self.p1.y - p.y) ** 2
            d22 = (self.p2.x - p.x) ** 2 + (self.p2.y - p.y) ** 2
            if self.d2 < max(d12, d22):
                return None
            return 0
        if f < 0:
            return -1
        else:
            return 1

    def kaku(self, other):
        x = self.a * other.a + self.b * other.b
        x /= hypot(self.a, self.b) * hypot(other.a, other.b)
        return pi - acos(x)


def make_p(n, pp):
    pids = {p.i: [] for p in pp}
    for i in range(n):
        if len(pids[i]) == 2:
            continue
        p1 = pp[i]
        for j in pids:
            if i == j or len(pids[j]) == 2:
                continue
            p2 = pp[j]
            line = Line(p1, p2)
            ptype = {0: 0, 1: 0, -1: 0, None: 0}
            for k in pids:
                if k == i or k == j:
                    continue
                ptype[line.dist(pp[k])] += 1
            if ptype[None]:
                continue
            if ptype[1] == 0 or ptype[-1] == 0:
                pids[i].append(j)
                pids[j].append(i)
    return pids


def main():
    n = int(input())
    if n == 2:
        print(0.5)
        print(0.5)
        return
    pp = []
    for i in range(n):
        p = Point(i, *input().split())
        pp.append(p)
    pids = make_p(n, pp)
    prob = [0.0] * n
    for i, nei in pids.items():
        if len(nei) == 2:
            l1 = Line(pp[i], pp[nei[0]])
            l2 = Line(pp[i], pp[nei[1]])
            kaku = l1.kaku(l2)
            prob[i] += kaku / (2 * pi)
    for p in prob:
        print(p)


if __name__ == '__main__':
    main()
Problem p02600 (python)

Fixed submission:
x=int(input())

if 400 <= x <= 599:
  print('8');
elif 600 <= x <= 799:
  print('7')
elif 800 <= x <= 999:
  print('6')
elif 1000 <= x <= 1199:
  print('5')
elif 1200 <= x <= 1399:
  print('4')
elif 1400 <= x <= 1599:
  print('3')
elif 1600 <= x <= 1799:
  print('2')
else:
  print('1')

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

if 400 <= x <= 599:
  print('8');
elif 600 <= x <= 799:
  print('7')
elif 800 <= x <= 999:
  print('6')
elif 1000 <= x <= 1199:
  print('5')
elif 1200 <= x <= 1399:
  print('4')
elif 1400 <= x <= 1599:
  rint('3')
elif 1600 <= x <= 1799:
  print('2')
else:
  print('1')
Problem p02631 (python)

Fixed submission:
n=int(input())
a=list(map(int, input().split()))

total = 0
for i in range(n):
  total = total ^ a[i]

for i in range(n):
  print(total^a[i])

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int, input().split()))

total=0
for i in range(n):
  total=total^a[i]
  
result=[]
for i in range(n):
  result.append(total^a[i])
L=' '.join(result)
print(L)
Problem p02641 (python)

Fixed submission:
x,n=map(int, input().split())
if n == 0:
  print(x)
  exit()
p=list(map(int, input().split()))
all=set(range(-100,102))
s_p=set(p)
kouho=sorted(all-s_p)

min_dis=201
for i in kouho:
  dis=abs(i-x)
  if min_dis > dis:
    min_i=i
    min_dis=dis
print(min_i)

Buggy submission (verdict: Runtime Error):
x,n=map(int, input().split())
if n == 0:
  print(x)
  exit()
p=list(map(int, input().split()))
all=set(range(1,101))
s_p=set(p)

min_dis=100
for i in all-s_p:
  dis=abs(i-x)
  if min_dis > dis:
    min_i=i
    min_dis=dis
print(min_i)

Buggy submission (verdict: Runtime Error):
x,n=map(int, input().split())
if n == 0:
  print(x)
  exit()
p=list(map(int, input().split()))
all=set(range(1,101))
s_p=set(p)

min_dis=100
for i in all-s_p:
  dis=abs(i-x)
  if min_dis > dis:
    min_i=i
    min_dis=dis
print(min_dis, min_i)