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

Fixed submission:
n, a, b = map(int, input().split())
ans = 0
for i in range(1, n+1):
  if a<= sum(int(c) for c in str(i)) <= b:
    ans += i
print(ans)

Buggy submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
ans = 0
for i in range(1, n+1):
  if a<= sum(int(c) for c in str(i)) <= b:
    ams += i
print(ans)
Problem p03493 (python)

Fixed submission:
print(input().count('1'))

Buggy submission (verdict: Runtime Error):
print(input().count(1))

Buggy submission (verdict: Runtime Error):
counter = 0
for s[i] in range(2):
  if s[i] == 1:
    counter += 1
  else:
    pass
print(counter)

Buggy submission (verdict: Runtime Error):
s1 , s2, s3 = map(int, input().split())
print(s1 + s2 + s3)
Problem p02899 (python)

Fixed submission:
def solve():
  N = int(input())
  A = sorted([(i, int(v)) for i, v in enumerate(input().split())])
  sortedList = [-1] * N
  for i, a in A:
    sortedList[a - 1] = str(i + 1)
  return ' '.join(sortedList)

print(solve())

Buggy submission (verdict: Runtime Error):
def solve():
  N, K = map(int, input().split())
  H = [int(i) for i in input().split()]
  return len(list(filter(lambda h: h >= K, H)))

print(solve())
Problem p02900 (python)

Fixed submission:
def gcd(a,b):
  while b!=0:
    a,b=b,a%b
  return a

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def solve():
  A, B = map(int, input().split())
  return len(set(prime_factorize(gcd(A, B)))) + 1

print(solve())

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

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def solve():
  A, B = map(int, input().split())
  return len(set(prime_factorize(gcd(A, B)))) + 1

print(solve())
Problem p02976 (python)

Fixed submission:
from sys import setrecursionlimit
setrecursionlimit(10**8)

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

if M % 2 == 1:
    print(-1)
    exit()

E = [[] for i in range(N + 1)]
used_e = [False] * M
ans = []

for i in range(M):
    A, B = map(int, input().split())
    E[A].append((B, i))
    E[B].append((A, i))

visited = [False] * (N + 1)


def dfs(prev, v):
    if visited[v]: return
    visited[v] = True
    cnt = 0

    for to, i in E[v]:
        dfs(v, to)
        if not used_e[i]: cnt += 1

    for to, i in E[v]:
        if cnt % 2 == 1 and to == prev: continue
        if not used_e[i]:
            ans.append((v, to))
            used_e[i] = True


dfs(0, 1)

for a in ans: print(*a)

Buggy submission (verdict: Runtime Error):
N, M = [int(i) for i in input().split()]

if M % 2 == 1:
    print(-1)
    exit()

E = [[] for i in range(N + 1)]
used_e = [False] * M
ans = []

for i in range(M):
    A, B = map(int, input().split())
    E[A].append((B, i))
    E[B].append((A, i))

visited = [False] * (N + 1)


def dfs(prev, v):
    if visited[v]: return
    visited[v] = True
    cnt = 0

    for to, i in E[v]:
        dfs(v, to)
        if not used_e[i]: cnt += 1

    for to, i in E[v]:
        if cnt % 2 == 1 and to == prev: continue
        if not used_e[i]:
            ans.append((v, to))
            used_e[i] = True


dfs(0, 1)

for a in ans: print(*a)

Buggy submission (verdict: Runtime Error):
def solve():
  N, M = map(int, input().split())
  graph = [[] for i in range(N)]
  cnt = 0
  for i in range(M):
    A, B = map(lambda v: int(v) - 1, input().split())
    graph[A].append(B)
    graph[B].append(A)
  if M % 2 == 1:
    print(-1)
    return

  while cnt < N:
    for i in range(N):
      if len(graph[i]) % 2 == 1: continue
      for j in graph[i]:
        print(i + 1, j + 1)
        graph[j].remove(i)
        cnt += 1

solve()
Problem p02981 (python)

Fixed submission:
def solve():
  N, A, B = map(int, input().split())
  return min(N * A, B)

print(solve())

Buggy submission (verdict: Runtime Error):
def solve():
  L, R = map(int, input().split())
  ans = 2019
  for i in range(L, R):
    for j in range(i + 1, R + 1):
      v = i * j % 2019
      if v < ans: ans = v
      if ans == 0: return
  return ans

print(solve())
Problem p02995 (python)

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

def solve():
  A, B, C, D = map(int, input().split())
  A = A - 1
  CD = C * D // gcd(C, D)
  num_C = (B // C) - (A // C)
  num_D = (B // D) - (A // D)
  num_CD = (B // CD) - (A // CD)
  return B - A - num_C - num_D + num_CD

print(solve())

Buggy submission (verdict: Runtime Error):
import math

def solve():
  A, B, C, D = map(int, input().split())
  A = A - 1
  CD = C * D // math.gcd(C, D)
  num_C = (B // C) - (A // C)
  num_D = (B // D) - (A // D)
  num_CD = (B // CD) - (A // CD)
  return B - A - num_C - num_D + num_CD

print(solve())
Problem p03067 (python)

Fixed submission:
def solve():
  A, B, C = map(int, input().split())
  return 'Yes' if min(A, B) < C and C < max(A, B) else 'No'

print(solve())

Buggy submission (verdict: Runtime Error):
def solve():
  N = int(input())
  S = input()
  stones = []
  look = S[0]
  cnt = 0

  if S[0] == '.': stones.append(0)
  for s in S:
    if look == s: cnt += 1
    else:
      stones.append(cnt)
      cnt = 1
      look = s
  stones.append(cnt)
  if S[N - 1] == '#': stones.append(0)

  count = sum(stones[1::2])
  ans = count

  for i in range(0, len(stones), 2):
    count = count + stones[i] - stones[i + 1]
    if ans > count: ans = count
  return ans

print(solve())
Problem p03069 (python)

Fixed submission:
def solve():
  N = int(input())
  S = input()
  stones = []
  look = S[0]
  cnt = 0

  if S[0] == '.': stones.append(0)
  for s in S:
    if look == s: cnt += 1
    else:
      stones.append(cnt)
      cnt = 1
      look = s
  stones.append(cnt)
  if S[N - 1] == '#': stones.append(0)

  count = sum(stones[1::2])
  ans = count

  for i in range(0, len(stones), 2):
    count = count + stones[i] - stones[i + 1]
    if ans > count: ans = count
  return ans

print(solve())

Buggy submission (verdict: Runtime Error):
def solve():
  N = int(input())
  S = input()
  stones = []
  look = S[0]
  cnt = 0

  if S[0] == '.': stones.append(0)
  for s in S:
    if look == s: cnt += 1
    else:
      stones.append(cnt)
      cnt = 1
      look = s
  stones.append(cnt)
  if S[N - 1] == '#': stones.append(0)

  count = sum(stones[1::2])
  ans = count

  for i in range(0, N - 2, 2):
    count = count + stones[i] - stones[i + 1]
    if ans > count: ans = count
  return ans

print(solve())
Problem p03078 (python)

Fixed submission:
X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

AB = []
for a in A:
  for b in B:
    AB.append(a + b)

AB.sort(reverse=True)
AB = AB[:min(3001, X * Y * Z + 1)]
ABC = []
for c in C:
  for ab in AB:
    ABC.append(ab + c)
ABC.sort(reverse=True)
for i in range(K):
  print(ABC[i])

Buggy submission (verdict: Runtime Error):
from itertools import product

X, Y, Z, K = map(int, input().split())
A = sorted([int(i) for i in input().split()])
B = sorted([int(i) for i in input().split()])
C = sorted([int(i) for i in input().split()])

def solve():
  AB = []
  for a in A:
    for b in B:
      AB.append(a + b)

  AB.sort(reversed=True)
  AB = AB[:min(3001, X * Y * Z + 1)]
  ABC = []
  for ab in AB:
    for c in C:
      ABC.append(ab + c)
  ABC.sort(reverse=True)
  print(ABC[:K], sep='\n')

solve()
Problem p03086 (python)

Fixed submission:
import re

def solve():
  S = input()
  parts = re.split(r'[^ACGT]', S)
  return max(list(map(lambda s: len(s), parts)))

print(solve())

Buggy submission (verdict: Runtime Error):
import re

def solve():
  S = input()
  parts = re.split(r'[^ACGT]', S)
  return max(*map(lambda s: len(s), parts))

print(solve())
Problem p03088 (python)

Fixed submission:
N, MOD = int(input()), 10 ** 9 + 7
memo = [{} for i in range(N+1)]

def ok(last4):
	for i in range(4):
		t = list(last4)
		if i >= 1:
			t[i-1], t[i] = t[i], t[i-1]
		if ''.join(t).count('AGC') >= 1:
			return False
	return True

def dfs(cur, last3):
	if last3 in memo[cur]:
		return memo[cur][last3]
	if cur == N:
		return 1
	ret = 0
	for c in 'ACGT':
		if ok(last3 + c):
			ret = (ret + dfs(cur + 1, last3[1:] + c)) % MOD
	memo[cur][last3] = ret
	return ret

print(dfs(0, 'TTT'))

Buggy submission (verdict: Runtime Error):
N, MOD = int(input()), 10 ** 9 + 7
dp = [ [ [ [0] * 4 ] * 4 ] * 4 ] * 101
'''
長さ0の文字列は1
0, 1, 2に関する制約しかないので、Sは、333Sと考えても問題がない
'''
dp[0][3][3][3] = 1

for length in range(N):
  for i in range(4):
    for j in range(4):
      for k in range(4):
        if dp[length][i][j][k] == 0: continue
        for a in range(a):
          if a == 2 and i == 1 and j == 0: continue
          if a == 2 and i == 0 and j == 1: continue
          if a == 1 and i == 2 and j == 0: continue
          if a == 2 and i == 1 and k == 0: continue
          if a == 2 and j == 1 and k == 0: continue
          dp[length + 1][a][i][j] += dp[length][i][j][k]
          dp[length + 1][a][i][j] %= MOD

ans = 0
for i in range(4):
  for j in range(4):
    for k in range(4):
      ans += dp[N][i][j][k]
      ans %= MOD

print(ans)
Problem p03090 (python)

Fixed submission:
N = int(input())

def solve(N):
  fmt = '{} {}'
  ans = []
  sub = []
  if N % 2 == 1:
    ans = solve(N - 1)
    for i in range(1, N):
      ans.append(fmt.format(i, N))
  else:
    for i in range(1, N + 1):
      for j in range(i + 1, N + 1):
        if j == N - i + 1: continue
        ans.append(fmt.format(i, j))
  return ans

ans = solve(N)
print(len(ans))
[print(a) for a in ans]

Buggy submission (verdict: Runtime Error):
def solve():
  N = int(input())
  M = (N - 2) * 2
  for i in range(3, N + 1):
    print(f'1 {i}\n{i - 1} {i}')

solve()
Problem p03128 (python)

Fixed submission:
L = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]

N, M = map(int, input().split())
A = [int(a) for a in input().split()]
B = [(A[i], L[A[i]]) for i in range(M)]

X = [0] + ([-1] * N)
for i in range(1, N+1):
  for b in B:
    if b[1] <= i:
      X[i] = max(X[i], X[i-b[1]] * 10 + b[0])

print(X[N])

Buggy submission (verdict: Runtime Error):
L = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]

N, M = map(int, input().split())
A = [int(a) for a in input().split()]
B = [(A[i], L[A[i]]) for i in range(M)]

X = [0] + ([-1] * N)
for i in range(1, N+1):
  for b in B:
    X[i] = max(X[i], X[i-b[1]] * 10 + b[0])

print(X[N])
Problem p03130 (python)

Fixed submission:
def solve():
  count = [0] * 4
  for i in range(3):
    A, B = map(int, input().split())
    count[A - 1] += 1
    count[B - 1] += 1

  time = [0] * 2
  for c in count:
    if c != 1 and c != 2: continue
    time[c - 1] += 1

  return 'YES' if time[0] == 2 and time[1] == 2 else 'NO'

print(solve())

Buggy submission (verdict: Runtime Error):
def solve():
  count = [0] * 4
  for i in range(3):
    A, B = map(int, input().split())
    count[A - 1] += 1
    count[B - 1] += 1

  time = [0] * 2
  for c in count:
    if c == 0: continue
    time[c - 1] += 1

  return 'YES' if time[0] == 2 and time[1] == 2 else 'NO'

print(solve())

Buggy submission (verdict: Runtime Error):
def solve():
  count = [0] * 4
  for i in range(3):
    A, B = map(int, input().split())
    count[A - 1] += 1
    count[B - 1] += 1

  time = [0] * 2
  for c in count:
    time[c - 1] += 1

  return 'YES' if time[0] == 2 and time[1] == 2 else 'NO'

print(solve())

Buggy submission (verdict: Runtime Error):
def solve():
  count = [0] * 4
  for i in range(3):
    A, B = map(int, input().split())
    count[A - 1] += 1
    count[B - 1] += 1

  time = [0] * 2
  for c in count:
    time[c - 1] += 1

  return 'YES' if time[0] == 2 and time[1] == 2 else 'NO'

print(solve())
Problem p03138 (python)

Fixed submission:
def solve():
  N, K = map(int, input().split())
  A = [int(i) for i in input().split()]
  B = [0] * 40
  for i in range(40):
    for a in A:
      if a & (1 << i): B[i] += 1

  X = 0
  for i in range(39, -1, -1):
    if X + (1 << i) > K: continue
    if B[i] < N - B[i]: X += 1 << i

  ans = 0
  for a in A:
    ans += a ^ X

  return ans

print(solve())

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

def solve():
  N, K = map(int, input().split())
  X = [int(i) for i in input().split()]
  x = reduce(xor, X)
  maxNum = max(X)
  d = int(log(maxNum, 2))
  D = int(log(K, 2))
  while D > d:
    x |= 1 << D
    D -= 1
  ans = 0
  for a in X:
    ans += a ^ x
  return ans

print(solve())
Problem p03145 (python)

Fixed submission:
from functools import reduce
from operator import mul

def solve():
	L = [int(i) for i in input().split()]
	return reduce(mul, L) // (2 * max(L))

print(solve())

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

def solve():
	L = [int(i) for i in input().split()]
	return reduce(mul, L) // (2 * max(L))

print(solve())
Problem p03147 (python)

Fixed submission:
def solve():
	N = int(input())
	h = [int(i) for i in input().split()]
	ans = 0
	for i in range(0, N):
		ans += max(h[i] - (0 if i - 1 < 0 else h[i - 1]), 0)
	return ans

print(solve())

Buggy submission (verdict: Runtime Error):
def solve():
	N = int(input())
	h = [int(i) for i in input().split()]
    ans = 0
	for i in range(1, N):
		ans += max(h[i] - (0 if i - 1 < 0 else h[i - 1]), 0)
	return ans

print(solve())

Buggy submission (verdict: Runtime Error):
def solve():
	N = int(input())
	h = [int(i) for i in input().split()]
    return N * max(h) - sum(h)

print(solve())
Problem p03149 (python)

Fixed submission:
def solve(arr):
  flag = [ False ] * 10
  for value in arr:
    flag[value] = True
  return 'YES' if flag[1] and flag[9] and flag[7] and flag[4] else 'NO'


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

print(solve(arr))

Buggy submission (verdict: Runtime Error):
import operator

def solve(A, B):
  diff = list(map(operator.sub, A, B))
  shortage  = list(filter(lambda d: d < 0, diff))
  remainder = list(filter(lambda d: d > 0, diff))
  remainder.sort(reverse=True)
  short_sum = sum(shortage)
  if short_sum == 0: return 0
  counter = len(shortage)
  for r in remainder:
    short_sum += r
    counter += 1
    if short_sum >= 0: return counter
  return -1

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

print(solve(A, B))
Problem p03160 (python)

Fixed submission:
N = int(input())
H = list(map(int, input().split()))
dp = [10 ** 9] * N
dp[0] = 0

for i in range(N):
  if i + 1 < N: dp[i + 1] = min(dp[i + 1], dp[i] + abs(H[i] - H[i + 1]))
  if i + 2 < N: dp[i + 2] = min(dp[i + 2], dp[i] + abs(H[i] - H[i + 2]))

print(dp[-1])

Buggy submission (verdict: Runtime Error):
n, k = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]

def frog(n, k, h):
    d = [float('inf')] * n
    d[0] = 0

    for i in range(1, n):
        d[i] = min(
            d[j] + abs(h[i] - h[j]) for j in range(max(i - k, 0), i)
        )
    return d[n - 1]


print(frog(n, k, h))
Problem p03219 (python)

Fixed submission:
def solve(X, Y):
	ans = []
	
	ans.append(str(X + Y // 2))
	
    # Output according to format
	ans = '\n'.join(ans)
	return ans

# receive inputs
X, Y = list(map(int, input().split()))

# print outputs
print(solve(X, Y))

Buggy submission (verdict: Runtime Error):
def solve(X, Y):
	ans = []


	# append output array
    ans.append(str(X + Y // 2))

    # Output according to format
    ans = '\n'.join(ans)
    return ans

# receive inputs
X, Y = list(map(int, input().split()))

# print outputs
print(solve(X, Y))
Problem p03231 (python)

Fixed submission:
from fractions import gcd
 
 
def solve(n, m, s, t):
    g = gcd(n, m)
    ng = n // g
    mg = m // g
 
    for h in range(g):
        if s[ng * h] != t[mg * h]:
            return -1
    return ng * mg * g
 
 
n, m = list(map(int, input().split()))
s = input()
t = input()
print(solve(n, m, s, t))

Buggy submission (verdict: Runtime Error):
from fractions import gcd

N, M = list(map(int, input().split()))
S = input()
T = input()

d = gcd(N, M)
n = N // d
m = M // d
f = True

for i in range(d):
    if S[n*i] != T[m*i]:
        f = false
        break

print(n * m * d if f else -1)

Buggy submission (verdict: Runtime Error):
from fractions import gcd

N, M = list(map(int, input().split()))
S = input()
T = input()

d = gcd(N, M)
n = N // d
m = M // d
f = True

for i in range(d):
    if S[n*i] != T[m*i]:
        f = false
        break

print(N * M // d if f else -1)

Buggy submission (verdict: Runtime Error):
def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)

N, M = list(map(int, input().split()))
S = input()
T = input()

d = gcd(N, M)
n = N // d
m = M // d
f = True

for i in range(1, d):
    if S[n*i] != T[m*i]:
        f = false
        break

print(N * M // d if f else -1)
Problem p03475 (python)

Fixed submission:
N = int(input())
array = []

for i in range(N-1):
  _input = str(input().replace('\r','')).split(' ')
  array.append((int(_input[0]), int(_input[1]), int(_input[2])))

for i in range(N-1):
  time = array[i][0] + array[i][1]
  for j in range(i+1, N-1):
    if array[j][1] > time:
      time = array[j][1]
    elif time % array[j][2] != 0:
      time = time - time % array[j][2] + array[j][2]
    time = time + array[j][0]
  print(time)

print(0)

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

for i in range(N-1):
  _input = str(input().replace('\r','')).split(' ')
  print(_input)
  array.append((int(_input[0]), int(_input[1], int(_input[2]))))

for i in range(N-1):
  time = array[i][0] + array[i][1]
  for j in range(i+1, N-1):
    if array[j][1] > time:
      time = array[j][1]
    elif time % array[j][2] != 0:
      time = time - time % array[j][2] + array[j][2]
    time = time + array[j][0]
  print(time)

print(0)

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

for i in range(N-1):
  _input = str(input()).split(' ')
  array.append((int(_input[0]), int(_input[1], int(_input[2]))))

for i in range(N-1):
  time = array[i][0] + array[i][1]
  for j in range(i+1, N-1):
    if array[j][1] > time:
      time = array[j][1]
    elif time % array[j][2] != 0:
      time = time - time % array[j][2] + array[j][2]
    time = time + array[j][0]
  print(time)

print(0)

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

for i in N-1:
  input = input().split(' ')
  array.append((input[0], input[1]))

for i in N-1:
  time = array[i][0] + array[i][1]
  for j in range(i+1, N-1):
    if array[j][1] > time:
      time = array[j][1]
    time = time + array[j][0]
  print(time)


print(0)
Problem p03476 (python)

Fixed submission:
num = [True]*100001
num[0] = num[1] = False
for i in range(2,317):
  if num[i]:
    for j in range(i**2, 100000, i):
      num[j] = False

c = [0]*100002
for i in range(3, 100001, 2):
  if (num[i]) and (num[int((i+1)/2)]):
    c[i] = c[i] + 1

for i in range(3, 100001):
  c[i] = c[i] + c[i-1]

for i in range(int(input())):
  _input = input().split(' ')
  print(c[int(_input[1])] - c[int(_input[0])-1])

Buggy submission (verdict: Runtime Error):
num = [True]*(100000)
num[0] = num[1] = False
for i in range(2,int(max**0.5)+1):
  if num[i]:
    for j in range(i**2, max, i):
      num[j] = False

for i in int(input()):
  _input = input().split(' ')
  sum = 0
  for i in range(int(_input[0]), int(_input[1])+1):
    if (num[i]) and (num[int((i+1)/2)]):
      sum = sum + 1
  print(sum)

Buggy submission (verdict: Runtime Error):
Q = int(input())
LR = []
max = 0

for i in range(Q):
  _input = input().split(' ')
  LR.append((int(_input[0]), int(_input[1])))
  if max < LR[i][1]:
    max = LR[i][1]

num = [True]*(max+1)
num[0] = num[1] = False
for i in range(2,int(max**0.5)+1):
  if num[i]:
    for j in range(i**2, max, i):
      num[j] = False

for i in range(Q):
  sum = 0
  if LR[i][0] % 2 == 0:
    for i in range(LR[i][0]+1, LR[i][1]+1, 2):
      if (num[i]) and (num[(i+1)/2]):
        sum = sum + 1
  else:
    for i in range(LR[i][0], LR[i][1]+1, 2):
      if (num[i]) and (num[(i+1)/2]):
        sum = sum + 1
  print(sum)

Buggy submission (verdict: Runtime Error):
def prime(n):
  num = [True]*n
  num[0] = num[1] = False
  for i in xrange(2,int(n**0.5)+1):
    if num[i]:
      for j in xrange(i**2, n, i):
        num[j] = False
        return [i for i in xrange(2,n) if num[i]]

Q = int(input())
LR = []
max = 0
for i in range(Q):
  _input = input().split(' ')
  LR.append((int(_input[0]), int(_input[1])))
  if max < LR[i][1]:
    max = LR[i][1]

prime = prime(max)

for i in range(Q):
  sum = 0
  for num in range(LR[i][0], LR[i][1]+1):
    if (num in prime) and ((num+1) / 2 in prime):
      sum = sum + 1
  print(sum)

Q = int(input())
LR = []
max = 0
for i in range(Q):
  _input = input().split(' ')
  LR.append((int(_input[0]), int(_input[1])))
  if max < int(_input[1]):
    max = int(_input[1])

prime = prime(max)

for i in range(Q):
  sum = 0
  for num in range(LR[i][0], LR[i][1]+1):
    if (num in prime) and ((num+1) / 2 in prime):
      sum = sum + 1
  print(sum)
Problem p03495 (python)

Fixed submission:
N,K = map(int,input().split())
A = [int(j) for j in input().split()]
count = [0] * N
for a in A:
  count[a - 1] += 1

count.sort(reverse=True)
print(sum(count[K:]))

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
A = map(int, input().split())
count = [0] * N
for a in A:
  count[a] += 1

count.sort(reverse=True)
print(sum(count[K:]))
Problem p03731 (python)

Fixed submission:
from functools import reduce; from operator import add; print((lambda T, L: (reduce(add, (lambda t, l: [min(i - j, t) for i, j in zip(l[1:], l[:-1])])(T, L)) + T) if len(L) > 1 else T)(int(input().split()[1]), list(map(int, input().split()))))

Buggy submission (verdict: Runtime Error):
from functools import reduce; from operator import add; print((lambda T, L: reduce(add, (lambda t, l: [min(i - j, t) for i, j in zip(l[1:], l[:-1])])(T, L), initializer=T))(int(input().split()[1]), list(map(int, input().split()))))

Buggy submission (verdict: Runtime Error):
from functools import reduce; from operator import add; print((lambda T, L: T + reduce(add, (lambda t, l: [min(i - j, t) for i, j in zip(l[1:], l[:-1])])(T, L)))(int(input().split()[1]), list(map(int, input().split()))))

Buggy submission (verdict: Runtime Error):
from functools import reduce; from operator import add; print((lambda T, L: T + reduce(add, (lambda t, l: [min(i - j, t) for i, j in zip(l[1:], l[:-1])])(T, L)))(int(input().split()[1]), list(map(int, input().split()))))