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

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

import numpy as np

d = [0] * n

d[1] = np.abs(h[1] - h[0])

for i in range(n-2):
    d[i+2] = min(d[i]+np.abs(h[i+2]-h[i]), d[i+1]+np.abs(h[i+2]-h[i+1]))

print(d[n-1])

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

import numpy as np

d = [0] * n

d[1] = np.abs(h[1] - h[0])

for i in range(n-2):
    d[i+2] = min(d[i]+np.abs(h[i+2]-h[i]), d[i+1]+np.abs(h[i+2]-h[i+1]))



import pandas as pd
df = pd.DataFrame(d)

print(d[n-1])
Problem p03163 (python)

Fixed submission:
import sys
input = sys.stdin.readline

N, W = [int(i) for i in input().split()]

def ans(N, W):
    d = [0] * (W+1)

    for i in range(N):
        wi, vi = [int(i) for i in input().split()]
        for w in range(W, wi - 1, -1):
            v_ = d[w - wi] + vi
            if v_ > d[w]:
                d[w] = v_
    return d[W]

print(ans(N, W))

Buggy submission (verdict: Runtime Error):
def knapsack():
    n, max_w = map(int, input().split())
    dp = defaultdict(int)
    dp[0] = 0
    for _ in range(n):
        w, v = map(int, input().split())
        for item in list(dp.keys()):
            dp[item+w] = max(dp[item] + v, dp[item+w])
    max_v = 0
    for w, v in dp.items():
        if w <= max_w:
            max_v = max(v, max_v)
    print(max_v)
    

knapsack()
Problem p03164 (python)

Fixed submission:
import sys
input = sys.stdin.readline

N, W = [int(i) for i in input().split()]

def ans(N, W):
    d = [float("inf")] * (N * 1000 + 1)
    d[0] = 0
    V = 0

    for i in range(N):
        wi, vi = [int(i) for i in input().split()]
        V = V + vi

        for v in range(V, vi-1, -1):
            w_ = d[v - vi] + wi
            if w_ < d[v]:
                d[v] = w_

    for v in range(V, -1, -1):
        if d[v] <= W:
            return v

print(ans(N, W))

Buggy submission (verdict: Runtime Error):
def knapsack():
    n, max_w = map(int, input().split())
    dp = defaultdict(int)
    dp[0] = 0
    for _ in range(n):
        w, v = map(int, input().split())
        for item in list(dp.keys()):
            dp[item+w] = max(dp[item] + v, dp[item+w])
    max_v = 0
    for w, v in dp.items():
        if w <= max_w:
            max_v = max(v, max_v)
    print(max_v)
    
    
knapsack()

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

N, W = [int(i) for i in input().split()]

def ans(N, W):
    d = [float("inf")] * N * 1000
    d[0] = 0
    V = 0

    for i in range(N):
        wi, vi = [int(i) for i in input().split()]
        V = V + vi

        for v in range(V, vi-1, -1):
            w_ = d[v - vi] + wi
            if w_ < d[v]:
                d[v] = w_

    for v in range(V, -1, -1):
        if d[v] <= W:
            return v

print(ans(N, W))

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

N, W = [int(i) for i in input().split()]

def ans(N, W):
    d = [float("inf")] * N * 1000
    d[0] = 0
    V = 0

    for i in range(N):
        wi, vi = [int(i) for i in input().split()]
        V = V + vi

        for v in range(V, V-vi-1, -1):
            w_ = d[v - vi] + wi
            if w_ < d[v]:
                d[v] = w_

    for v in range(V, -1, -1):
        if d[v] <= W:
            return v

print(ans(N, W))

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

N, W = [int(i) for i in input().split()]

def ans(N, W):
    d = [0] * (W+1)

    for i in range(N):
        wi, vi = [int(i) for i in input().split()]
        for w in range(W, wi - 1, -1):
            v_ = d[w - wi] + vi
            if v_ > d[w]:
                d[w] = v_
    return d[W]

print(ans(N, W))
Problem p03166 (python)

Fixed submission:
from collections import defaultdict
import sys

sys.setrecursionlimit(10 ** 6)


def rec(node):
    if memo[node]:
        return memo[node]

    res = 0
    for next_node in edge[node]:
        res = max(res, rec(next_node) + 1)

    memo[node] = res
    return res


n, m = map(int, input().split())
memo = [0] * (n + 1)
edge = defaultdict(list)

for i in range(m):
    x, y = map(int, input().split())
    edge[x].append(y)

ans = 0
for i in range(1, n + 1):
    ans = max(ans, rec(i))

print(ans)

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


def rec(node):
    if dp[node]:
        return dp[node]

    res = 0
    for next_node in edge[node]:
        res = max(res, rec(next_node) + 1)

    dp[node] = res
    return res


n, m = map(int, input().split())
dp = [0] * (n + 1)
edge = defaultdict(list)

for i in range(m):
    x, y = map(int, input().split())
    edge[x].append(y)

ans = 0
for i in range(1, n + 1):
    ans = max(ans, rec(i))

print(ans)
Problem p03244 (python)

Fixed submission:
from collections import Counter

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

even = a[1::2]
odd = a[::2]

c_even = Counter(even)
c_odd = Counter(odd)

arr_even = c_even.most_common()
arr_odd = c_odd.most_common()

sum_even = sum(x[1] for x in arr_even)
sum_odd = sum(x[1] for x in arr_odd)

min_sum = sum_even - arr_even[0][1] + n // 2

for i, x in arr_even:
    for j, y in arr_odd:
        if i != j:
            cnt = sum_even - x + sum_odd - y
            min_sum = min(min_sum, cnt)
            break
        else:
            continue

print(min_sum)

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

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

even = a[1::2]
odd = a[::2]

c_even = Counter(even)
c_odd = Counter(odd)

arr_even = c_even.most_common()
arr_odd = c_odd.most_common()

sum_even = sum(x[1] for x in arr_even)
sum_odd = sum(x[1] for x in arr_odd)

min_sum = sum_even - arr_even[0] + n // 2

for i, x in arr_even:
    for j, y in arr_odd:
        if i != j:
            cnt = sum_even - x + sum_odd - y
            min_sum = min(min_sum, cnt)
            break
        else:
            continue

print(min_sum)
Problem p03261 (python)

Fixed submission:
n = int(input())

words = [input() for _ in range(n)]

spoken = {words[0]}

for x, y in zip(words, words[1:]):
    if y[0] != x[-1]:
        print("No")
        exit()
    if y in spoken:
        print("No")
        exit()
    spoken.add(y)
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
n = int(input())
words = [input() for _ in range(n)]
print("Yes" if all([y[0] == x[-1] for x, y in zip(words, words[1:]]) and len(set(words)) == n else "No")

Buggy submission (verdict: Runtime Error):
n = int(input())
words = [input() for _ in range(n)]
print("Yes" if all([y[0] == x[-1] for x, y in zip(words, words[1:])) and len(set(words)) == n else "No")

Buggy submission (verdict: Runtime Error):
n = int(input())
words = [input() for _ in range(n)]
print("Yes" if all([y[0] == x[-1] for x, y in zip(words, words[1:]) and len(set(words)) == n else "No")
Problem p03262 (python)

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

import numpy as np

x = np.array(list(map(int, input().split())))
x -= X

x = np.abs(x)

M = x[0]
from fractions import gcd

for i in x[1:]:
  M = gcd(M, i)

print(M)

Buggy submission (verdict: Runtime Error):

import numpy as np

x = np.array(list(map(int, input().split())))
x -= X

x = np.abs(x)

M = x[0]
from fractions import gcd

for i in x[1:]:
  M = gcd(M, i)

print(M)
Problem p03273 (python)

Fixed submission:
h, w = map(int, input().split())

a = [list(input()) for i in range(h)]

a = [x for x in a if "#" in x]

aT = list(zip(*a))
aT = [x for x in aT if "#" in x]

a = list(zip(*aT))

for i in a:
    print("".join(i))

Buggy submission (verdict: Runtime Error):
h, w = map(int, input().split())
 
a = [list(input()) for i in range(h)]
 
for i in range(h):
  if "#" not in a[i]:
    del a[i]
 
aT = list(zip(*a))
 
for i in range(len(aT)):
  if "#" not in aT[i]:
    del aT[i]
 
a = list(zip(*aT))

for i in a:
  print(i)

Buggy submission (verdict: Runtime Error):
h, w = map(int, input().split())
 
a = [list(input()) for i in range(h)]
 
for i in range(h):
  if "#" not in a[i]:
    del a[i]
 
aT = zip(*a)
 
for i in range(len(aT)):
  if "#" not in aT[i]:
    del aT[i]
 
a = zip(*aT)
 
for i in a:
  print(i)

Buggy submission (verdict: Runtime Error):
h, w = map(int, input().split())

a = [input() for i in range(h)]

for i in range(h):
  if "#" not in a[i]:
    del a[i]

aT = zip(*a)

for i in range(len(aT)):
  if "#" not in aT[i]:
    del aT[i]

a = zip(*aT)

for i in a:
  print(i)
Problem p03274 (python)

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

min_t = 10 ** 9

import bisect

snuke = bisect.bisect_left(x, 0)
if snuke < n and x[snuke] == 0:
    k -= 1
    n -= 1
    del x[snuke]

for i in range(k+1):
    if i == 0:
        left = 0
    elif snuke - i >= 0:
        left = abs(x[snuke - i])
    else:
        left = 10 ** 9

    if k - i == 0:
        right = 0
    elif snuke + k - i - 1 <= n - 1:
        right = abs(x[snuke + k - i - 1])
    else:
        right = 10 ** 9

    min_t = min(min_t, min(left, right) * 2 + max(left, right))

print(min_t)

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

min_t = 10 ** 9

import bisect

snuke = bisect.bisect_left(x, 0)
if x[snuke] == 0:
    k -= 1
    n -= 1
    del x[snuke]

for i in range(k+1):
    if i == 0:
        left = 0
    elif snuke - i >= 0:
        left = abs(x[snuke - i])
    else:
        left = 10 ** 9

    if k - i == 0:
        right = 0
    elif snuke + k - i - 1 <= n - 1:
        right = abs(x[snuke + k - i - 1])
    else:
        right = 10 ** 9

    min_t = min(min_t, min(left, right) * 2 + max(left, right))

print(min_t)

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

min_t = 10 ** 9

import bisect

snuke = bisect.bisect_left(x, 0)
if x[snuke] == 0:
    k -= 1
    del x[snuke]

for i in range(k+1):
    if i == 0:
        left = 0
    elif snuke - i >= 0:
        left = abs(x[snuke - i])
    else:
        left = 10 ** 9

    if k - i == 0:
        right = 0
    elif snuke + k - i - 1 <= n - 1:
        right = abs(x[snuke + k - i - 1])
    else:
        right = 10 ** 9

    min_t = min(min_t, min(left, right) * 2 + max(left, right))

print(min_t)
Problem p03290 (python)

Fixed submission:
difficulties, goal = map(int, input().split())

pcs = [list(map(int, input().split())) for _ in range(difficulties)]

dp = [[0] * 1102 for _ in range(difficulties + 1)]

total_problem = 0
for d, pc in enumerate(pcs, 1):
    problem, complete = pc
    total_problem += problem

    score = {x: x*100*d for x in range(problem)}
    score[problem] = problem * 100 * d +complete

    for i in range(1, total_problem + 1):
        for j in range(0, i + 1):
            if i - j > problem:
                dp[d][i] = max(dp[d][i], dp[d - 1][j])
            else:
                dp[d][i] = max(dp[d][i], dp[d-1][j] + score[i-j])

for i, a in enumerate(dp[difficulties]):
    if a >= goal:
        print(i)
        exit()

Buggy submission (verdict: Runtime Error):
difficulties, goal = map(int, input().split())

pcs = [list(map(int, input().split())) for _ in range(difficulties)]

total_problem = 0
new_dp = [0] * 1001

for d, pc in enumerate(pcs, 1):
    dp = new_dp

    problem, complete = pc
    total_problem += problem

    score = {x: x*100*d for x in range(problem)}
    score[problem] = problem * 100 * d +complete

    for i in range(1, total_problem + 1):
        for j in range(0, i + 1):
            if i - j > problem:
                continue
            else:
                new_dp[i] = max(new_dp[i], dp[d-1][j] + score[i-j])

for i, a in enumerate(new_dp):
    if a >= goal:
        print(i)
        exit()
Problem p03328 (python)

Fixed submission:
a, b = map(int, input().split())
 
n = b - a
original_b = n * (n + 1) // 2
 
print(original_b - b)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input())

n = b - a
original_b = n * (n + 1) // 2

print(original_b - b)
Problem p03361 (python)

Fixed submission:
h, w = map(int, input().split())
a = [list(input()) for _ in range(h)]

for i in range(h):
  for j in range(w):
    if j > 0 and a[i][j-1] != "." and a[i][j] == "#":
      a[i][j] = "*"
    elif j < w - 1 and a[i][j+1] != "." and a[i][j] == "#":
      a[i][j] = "*"
    elif i > 0 and a[i-1][j] != "." and a[i][j] == "#":
      a[i][j] = "*"
    elif i < h - 1 and a[i+1][j] != "." and a[i][j] == "#":
      a[i][j] = "*"

print("No" if sum([row.count("#") for row in a]) else "Yes")

Buggy submission (verdict: Runtime Error):
h, w = map(int, input().split())
a = [list(input()) for _ in range(h)]

for i in range(h):
  for j in range(w):
    if j > 0 and a[i][j-1] != "." and a[i][j] = "#":
      a[i][j] = "*"
    elif j < w - 1 and a[i][j+1] != "." and a[i][j] = "#":
      a[i][j] = "*"
    elif i > 0 and a[i-1][j] != "." and a[i][j] = "#":
      a[i][j] = "*"
    elif i < h - 1 and a[i+1][j] != "." and a[i][j] = "#":
      a[i][j] = "*"

print("No" if sum([row.count("#") for row in a]) else "Yes")
Problem p03378 (python)

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

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

import bisect

l = bisect.bisect_left(a, x)

print(min(l, m-l))

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

a = map(int, input().split())

import bisect

l = bisect.bisect_left(a, x)

print(min(l, m-l))
Problem p03416 (python)

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

cnt = 0
for i in range(a, b+1):
    ii = str(i)
    if ii[0] == ii[4] and ii[1] == ii[3]:
        cnt += 1

print(cnt)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())


cnt = 0
for i in range(a, b+1):
    ii = str(i)
    if ii[0] == ii[4] and ii[1] == ii[3]:
        cnt += 1

print(cnt)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())


cnt = 0
for i in range(a, b+1):
    ii = str(i)
    if ii[0] == ii[4] and ii[1] == ii[3]:
        cnt += 1

print(cnt)
Problem p03425 (python)

Fixed submission:
from itertools import combinations
 
n = int(input())
 
count = {x:0 for x in "MARCH"}
 
for _ in range(n):
  s = input()[0]
  if s in count:
    count[s] += 1
 
sum_count = 0
for a, b, c in combinations("MARCH", 3):
  sum_count += count[a] * count[b] * count[c]
 
print(sum_count)

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

n = int(input())

count = {x:0 for x in "MARCH"}

for _ in range(n):
  s = input()[0]
  if s in count:
    count[s] += 1

sum_count = 0
for a, b, c in combinations("MARCH", 3):
  sum_count += count[a] * count[b] * count[c]

print(sum_count)
Problem p03427 (python)

Fixed submission:
s = input()

if int(s) < 10:
    print(int(s))
elif all([x == "9" for x in s[1:]]):
    print(int(s[0]) + 9 * (len(s) - 1))
else:
    print(int(s[0]) - 1 + 9 * (len(s) - 1))

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

if s < 10:
    print(s)
else:
    print(int(s[0]) - 1 + 9 * (len(s) - 1))
Problem p03434 (python)

Fixed submission:
n = int(input())

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

a.sort(reverse=True)

print(sum(a[::2]) - sum(a[1::2]))

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

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

a.sort(reverse=True)

print(a[::2] - a[1::2])
Problem p03474 (python)

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

s = input()
n = s[:a]+s[a+1:]

print("Yes" if s[a]=="-" and n.isdigit() else "No")

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

s = input()
n = s[:a]+s[a+1:]

print("Yes" if s[a]="-" and n.isdigit() else "No")
Problem p03485 (python)

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

print(-(-(a + b) // 2))

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

print(-(-(a + b) // 2)
Problem p03486 (python)

Fixed submission:
a = input()
b = input()

print("Yes" if sorted(a) < sorted(b)[::-1] else "No")

Buggy submission (verdict: Runtime Error):
a = input()
b = input()

a.sort()
b.sort(reverse=True)

print("Yes" if a < b else "No")

Buggy submission (verdict: Runtime Error):
a = input()
b = input()

x = a.sort()
y = b.sort(reverse=True)

print("Yes" if x < y else "No")
Problem p03543 (python)

Fixed submission:
x = input()
 
print("Yes" if x[0]==x[1]==x[2] or x[1]==x[2]==x[3] else "No")

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

print("Yes" if x[0]=x[1]=x[2] or x[1]=x[2]=x[3] else "No")
Problem p03547 (python)

Fixed submission:
x, y = input().split()

print(">" if x > y else "<" if x < y else "=")

Buggy submission (verdict: Runtime Error):
x, y = input()

print(">" if x > y else "<" if x < y else "=")
Problem p03558 (python)

Fixed submission:
import heapq


def small_multiple(k):
    # kの倍数で各桁の総数が最も小さくなるような、各桁の総数
    dist = [float("inf")] * k
    q = []
    # kで割った余りが1になるような最小の数は1
    heapq.heappush(q, (1, 1))

    while q:
        n, c = heapq.heappop(q)
        if dist[n] <= c:
            continue
        dist[n] = c

        if dist[(n + 1) % k] > c + 1:
            heapq.heappush(q, ((n + 1) % k, c + 1))
        if dist[(n * 10) % k] > c:
            heapq.heappush(q, ((n * 10) % k, c))

    print(dist[0])


def main():
    k = int(input())
    small_multiple(k)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import heapq


def small_multiple(k):
    # kの倍数で各桁の総数が最も小さくなるような、各桁の総数
    dist = [float("inf")] * k
    q = []
    # kで割った余りが1になるような最小の数は1
    heapq.heappush(q, (1, 1))
 
    while q:
        n, c = heapq.heappop(q)
        if dist[n] <= c:
            continue
        print(n, c)
        dist[n] = c
 
        if dist[(n+1) % k] > c + 1:
            heapq.heappush(q, ((n + 1) % k, c + 1))
        if dist[(n*10) % k] > c:
            heapq.heappush(q, ((n * 10) % k, c))
 
    print(dist[0])
 
 
def main():
	k = int(input())
    small_multiple(k)
 
 
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import heapq


def small_multiple(k):
    # kの倍数で各桁の総数が最も小さくなるような、各桁の総数
    dist = [float("inf")] * k
    q = []
    # kで割った余りが1になるような最小の数は1
    heapq.heappush(q, (1, 1))

    while q:
        n, c = heapq.heappop(q)
        if dist[n] <= c:
            continue
        print(n, c)
        dist[n] = c

        if dist[(n+1) % k] > c + 1:
            heapq.heappush(q, ((n + 1) % k, c + 1))
        if dist[(n*10) % k] > c:
            heapq.heappush(q, ((n * 10) % k, c))

    print(dist[0])


def main():
	k = int(input())
    small_multiple(k)


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

Fixed submission:
import sys

n = int(input())

def main():
    for i in range(1, 3500):
        for j in range(1, 3500):
            z = 4 * i * j - n * i - n * j
            if z > 0:
                x = n * i * j / z
                if x == int(x):
                    print(i, j, int(x))
                    sys.exit()


main()

Buggy submission (verdict: Runtime Error):
import sys

n = int(input())

def main():
    for i in range(1, 3500):
        for j in range(1, 3500):
            z = n * i * j / (4 * i * j - n * i - n * j)
            if z >= 1 and z == int(z):
                print(i, j, z)
                sys.exit()


main()
Problem p03598 (python)

Fixed submission:
_,k=input(),int(input())
print(2*sum(min(x,k-x) for x in map(int,input().split())))

Buggy submission (verdict: Runtime Error):
input()
print(2 * sum(min(x, int(input())-x) for x in list(map(int, input().split()))))
Problem p03607 (python)

Fixed submission:
import sys
input = sys.stdin.readline

import bisect

def main():
    n = int(input())
    s = []

    for i in range(n):
        a = int(input())
        i = bisect.bisect_left(s, a)
        if len(s) > i and s[i] == a:
            s.remove(a)
        else:
            s.insert(i, a)


    print(len(s))


main()

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

import bisect

def main():
    n = int(input())
    s = []

    for i in range(n):
        a = int(input())
        i = bisect.bisect_left(s, a)
        if len(s) > 0 and s[i] == a:
            s.remove(a)
        else:
            s.insert(i, a)


    print(len(s))


main()
Problem p03645 (python)

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

a = [list(sorted(map(int, input().split()))) for i in range(m)]
a.sort()

x = 0
li_a = []

while x < m and a[x][0]== 1:
    li_a.append(a[x][1])
    x += 1

a.sort(reverse=True, key=lambda x: x[1])

x = 0
li_b = []

while x < m and a[x][1] == n:
    li_b.append(a[x][0])
    x += 1

print("POSSIBLE" if set(li_a) & set(li_b) else "IMPOSSIBLE")

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

a = [list(sorted(map(int, input().split()))) for i in range(m)]
a.sort()

x = 0
li_a = []

while a[x][0]== 1 and x < m:
    li_a.append(a[x][1])
    x += 1

a.sort(reverse=True, key=lambda x: x[1])

x = 0
li_b = []

while a[x][1] == n and x < m:
    li_b.append(a[x][0])
    x += 1

print("POSSIBLE" if set(li_a) & set(li_b) else "IMPOSSIBLE")

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

a = [list(sorted(map(int, input().split()))) for i in range(m)]
a.sort()

x = 0
li_a = []

while a[x][0]== 1 and x < n:
    li_a.append(a[x][1])
    x += 1

a.sort(reverse=True, key=lambda x: x[1])

x = 0
li_b = []

while a[x][1] == n and x < n:
    li_b.append(a[x][0])
    x += 1

print("POSSIBLE" if set(li_a) & set(li_b) else "IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
import itertools

n, m = map(int, input().split())

a = [list(sorted(map(int, input().split()))) for i in range(m)]
a.sort()

x = 0
li_a = []

while a[x][0]== 1:
    li_a.append(a[x][1])
    x += 1

a.sort(reverse=True, key=lambda x: x[1])

x = 0
li_b = []

while a[x][1] == n:
    li_b.append(a[x][0])
    x += 1

print("POSSIBLE" if set(li_a) & set(li_b) else "IMPOSSIBLE")
Problem p03658 (python)

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

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

a.sort(reverse=True)

print(sum(a[:k]))

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

a = map(int, input().split())

a.sort(reverse=True)

print(sum(a[:k]))

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

a = map(int, input().split())

a.sort(reverse=True)

print(sum(a[:k])
Problem p03673 (python)

Fixed submission:
n = int(input())

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

import collections

b = collections.deque()

for i in range(n):
    if i % 2 == n % 2:
        b.append(a[i])
    else:
        b.appendleft(a[i])

print(*b)

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

a = list(map(int, input()))

import collections

b = collections.deque()

for i in range(n):
    if i % 2 == n % 2:
        b.appendleft(a[i])
    else:
        b.append(a[i])

print(*b)

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

a = list(map(int, input()))

import collections
b = collections.deque()

for i in range(n):
  if i %% 2 == n %% 2:
    b.appendleft(a[i])
  else:
    b.append(a[i])

print(*b)
Problem p03695 (python)

Fixed submission:
n = int(input())

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

colors = [0] * 8
over = 0

for score in scores:
    if score < 3200:
        colors[score // 400] += 1
    else:
        over += 1

ans = sum(color > 0 for color in colors)

if ans:
    print(ans, ans + over)
else:
    print(1, over)

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

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

colors = [0] * 8
over = 0

for score in scores:
    if score < 3200:
        colors[score // 400] += 1
    else:
        over += 1

ans = sum(colors > 0 for color in colors)

print(ans, ans + over)

Buggy submission (verdict: Runtime Error):
n = int(input())
scores = list(map(int, input().split()))
colors = [0] * 9

for score in scores:
    colors[score // 400] += 1

ans = sum(colors[x] > 0 for x in range(8))
print(ans, ans + colors[8])

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

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

colors = [0] * 9

for score in scores:
    colors[score // 400] += 1

ans = sum(colors[x] > 0 for x in range(8))\

print(ans, min(8, ans + colors[8]))