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

Fixed submission:
n, k = map(int, input().split())
a = sorted(list(map(int, input().split())))
c = float("inf")
for i in range(n-1):
  if a[i] == a[i+1]:
    continue
  else:
    c = min(c, a[i+1]-a[i])
    if c == 1:
      break
if k > a[-1]:
  print("IMPOSSIBLE")
else:
  kr = k%c
  for i in a:
    if kr == i%c:
      print("POSSIBLE")
      exit()
  print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
a = sorted(list(map(int, input().split())))
c = float("inf")
for i in range(n-1):
  c = min(c, a[i+1]-a[i])
  if c == 1:
    break
if k > a[-1]:
  print("IMPOSSIBLE")
else:
  kr = k%c
  for i in a:
    if kr == i%c:
      print("POSSIBLE")
      exit()
  print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
a = sorted(list(map(int, input().split())))
c = float("inf")
for i in range(n-1):
  c = min(c, a[i+1]-a[i])
  if c == 1:
    break
if k > a[-1]:
  print("IMPOSSIBLE")
else:
  kr = k%c
  for i in a:
    if kr == i%c:
      print("POSSIBLE")
      exit()
  print("IMPOSSIBLE")
Problem p03666 (python)

Fixed submission:
N, A, B, C, D = map(int, input().split())
E = B - A
for m in range(N):
  if C*(N-1-m) - D*m <= E <= -C*m + (N-1-m)*D:
    print("YES")
    break
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
N, A, B, C, D = map(int, input().split())
E = B - A
for m in range(N):
  if C*(N-1-m) - D*m <= E <= -C*m + (N-1-m)*D:
    print("YES")
    break
else
print("NO")
Problem p03668 (python)

Fixed submission:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)

n = int(input())
T = [[] for _ in range(n)]
for _ in range(n-1):
  a, b = map(int, input().split())
  a -= 1
  b -= 1
  T[a].append(b)
  T[b].append(a)
def dfs(v, par=-1):
  res = 0
  for nv in T[v]:
    if nv == par:
      continue
    res ^= dfs(nv, v)+1
  return res
if dfs(0) == 0:
  print("Bob")
else:
  print("Alice")

Buggy submission (verdict: Runtime Error):
import sys
n=int(input())
sys.setrecursionlimit(n)
T=[[]for _ in"_"*(n+1)]
for _ in range(n-1):a,b=map(int,input().split());T[a]+=b,;T[b]+=a,
def d(v,p):
 r=0
 for s in T[v]:
  if s!=p:r^=d(s,v)+1
 return r
print("ABloibc e"[d(1,1)<1::2])

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(k:=2*n)
n=int(input())
T=[[]for _ in"_"*k]
for _ in range(n-1):a,b=map(int,input().split());T[a]+=b,;T[b]+=a,
def d(v,p):
 r=0
 for s in T[v]:
  if s!=p:r^=d(s,v)+1
 return r
print("ABloibc e"[d(1,1)<1::2])
Problem p03674 (python)

Fixed submission:
from collections import Counter

U = 10**5+1
MOD = 10**9+7
 
fact = [1]*(U+1)
fact_inv = [1]*(U+1)
 
for i in range(1,U+1):
    fact[i] = (fact[i-1]*i)%MOD
fact_inv[U] = pow(fact[U], MOD-2, MOD)
 
for i in range(U,0,-1):
    fact_inv[i-1] = (fact_inv[i]*i)%MOD
    
def comb(n, k):
    if k < 0 or k > n:
        return 0
    z = fact[n]
    z *= fact_inv[k]
    z %= MOD
    z *= fact_inv[n-k]
    z %= MOD
    return z
  
n = int(input())
A = list(map(int, input().split()))
x = Counter(A).most_common()[0][0]
left = A.index(x)
right = A[::-1].index(x)
print(n)
for k in range(2, n+2):
  ans = comb(n+1, k) - comb(left+right, k-1)
  ans %= MOD
  print(ans)

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

U = 10**5
MOD = 10**9+7
 
fact = [1]*(U+1)
fact_inv = [1]*(U+1)
 
for i in range(1,U+1):
    fact[i] = (fact[i-1]*i)%MOD
fact_inv[U] = pow(fact[U], MOD-2, MOD)
 
for i in range(U,0,-1):
    fact_inv[i-1] = (fact_inv[i]*i)%MOD
    
def comb(n, k):
    if k < 0 or k > n:
        return 0
    z = fact[n]
    z *= fact_inv[k]
    z %= MOD
    z *= fact_inv[n-k]
    z %= MOD
    return z
  
n = int(input())
A = list(map(int, input().split()))
x = Counter(A).most_common()[0][0]
left = A.index(x)
right = A[::-1].index(x)
print(n)
for k in range(2, n+2):
  ans = comb(n+1, k) - comb(left+right, k-1)
  ans %= MOD
  print(ans)
Problem p03680 (python)

Fixed submission:
n = int(input())
A = [ int(input()) for i in range(n) ]
c = 0
temp = 1
s = set()
while temp not in s:
  s.add(temp)
  temp = A[temp-1]
  c += 1
  if temp == 2:
    print(c)
    exit()
print(-1)

Buggy submission (verdict: Runtime Error):
n = int(input())
A = [ int(input()) for i in range(n) ]
c = 0
temp = 1
s = {1}
while temp not in s:
  temp = A[temp-1]
  c += 1
  i temp == 2:
    print(c)
    exit()
  s.add(temp)
print(-1)
Problem p03737 (python)

Fixed submission:
a, b, c = map(str, input().split())
print(str.upper(a[0]+b[0]+c[0]))

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
print(str.upper(a[0]+b[0]+c[0]))
Problem p03746 (python)

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

n, m = map(int, input().split())
G = [[] for _ in range(n)]
for _ in range(m):
  a, b = map(int, input().split())
  a -= 1
  b -= 1
  G[a].append(b)
  G[b].append(a)
seen = [False]*n
def dfs(v, rep):
  seen[v] = True
  for nv in G[v]:
    if seen[nv]:
      continue
    rep.append(nv+1)
    dfs(nv, rep)
    break
  else:
    return rep
L1, L2 = [], []
dfs(0, L1)
dfs(0, L2)
ANS = L2[::-1] + [1] + L1
print(len(ANS))
print(*ANS)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
G = [[] for _ in range(n)]
for _ in range(m):
  a, b = map(int, input().split())
  a -= 1
  b -= 1
  G[a].append(b)
  G[b].append(a)
seen = [False]*n
def dfs(v, rep):
  seen[v] = True
  for nv in G[v]:
    if seen[nv]:
      continue
    rep.append(nv+1)
    dfs(nv, rep)
    break
  else:
    return rep
L1, L2 = [], []
dfs(0, L1)
dfs(0, L2)
ANS = L2[::-1] + [1] + L1
print(len(ANS))
print(*ANS)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**7)

n, m = map(int, input().split())
G = [[] for _ in range(n)]
for _ in range(n):
  a, b = map(int, input().split())
  a -= 1
  b -= 1
  G[a].append(b)
  G[b].append(a)
seen = [False]*n
def dfs(v, rep):
  seen[v] = True
  for nv in G[v]:
    if seen[nv]:
      continue
    rep.append(nv+1)
    dfs(nv, rep)
    break
  else:
    return rep
L1, L2 = [], []
dfs(0, L1)
dfs(0, L2)
ANS = L2[::-1] + [1] + L1
print(len(ANS))
print(*ANS)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
G = [[] for _ in range(n)]
for _ in range(n):
  a, b = map(int, input().split())
  a -= 1
  b -= 1
  G[a].append(b)
  G[b].append(a)
seen = [False]*n
def dfs(v, rep):
  seen[v] = True
  for nv in G[v]:
    if seen[nv]:
      continue
    rep.append(nv+1)
    dfs(nv, rep)
    break
  else:
    return rep
L1, L2 = [], []
dfs(0, L1)
dfs(0, L2)
ANS = L2[::-1] + [1] + L1
print(len(ANS))
print(*ANS)
Problem p03747 (python)

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

n, l, t = map(int, input().split())
XW = [list(map(int, input().split())) for _ in range(n)]
L = []
cnt = 0
for i, xw in enumerate(XW):
  x, w = xw
  L.append((x+t*(3-2*w))%l)
  cnt += (x+t*(3-2*w))//l
L.sort()
for i in range(cnt, cnt+n):
  print(L[i%n])

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

n, l, t = map(int, input().split())
XW = [list(map(int, input().split())) for _ in range(n)]
L = []
for i, xw in enumerate(XW):
  x, w = xw
  if w == 1:
    L.append((x+t)%l)
  else:
    L.append((x-t)%l)
L.sort()
x_0, w_0 = XW[0]
b = 0
for x, w in XW[1:]:
  if w_0 == w:
    continue
  if w_0 == 1:
    if x-x_0 > 2*t:
      continue
    b += 1 + (2*t - (x-x_0)) // l
  else:
    if l-(x-x_0) > 2*t:
      continue
    b -= 1 + (2*t - (l-(x-x_0))) // l
m = L.index(L[b])
for i in range(m, m+n):
  print(L[i%n])
Problem p03795 (python)

Fixed submission:
n = int(input())
print(800*n - 200*(n//15))

Buggy submission (verdict: Runtime Error):
n = int(input())
print(800*n - 200*(n//15)
Problem p03801 (python)

Fixed submission:
import sys
read = sys.stdin.read

n, *A = map(int, read().split())
S = sorted([(a, i) for i, a in enumerate(A)], reverse=True)
X, Y = zip(*S)
m = 10**9
L = [0]*n
for i, y in enumerate(Y):
  m = min(m, y)
  if i == n-1:
    L[m] += (i+1) * X[i]
  else:
    L[m] += (i+1) * (X[i] - X[i+1])
print(*L, sep="\n")

Buggy submission (verdict: Runtime Error):
import sys
read = sys.stdin.read
from itertools import accumulate

n, *A = map(int, read().split())
S = []
now = 0
for a in A:
  if now < a:
    now = a
    S.append(a)
l = len(S)
C = [0]*l
D = {e:i for i, e in enumerate(S)}
K = [-1]*l
for i, a in enumerate(A):
  idx = D[a]
  if K[idx] == -1:
    K[idx] = i
  C[idx] += 1
S = [0] + S
C = list(accumulate(C[::-1]))[::-1]
L = [0]*n
for i, k in enumerate(K):
  L[k] = (S[i+1]-S[i]) * C[i]
print(*L, sep="\n")
Problem p03807 (python)

Fixed submission:
n = int(input())
A = list(map(int, input().split()))
c = 0
for i in A:
  if i%2:
    c += 1
if c%2==0:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
[NO][YES]?k2?K[1-d0<G+]dsGx0k3|Rp
Problem p03827 (python)

Fixed submission:
n = int(input())
s = input()
x = 0
ans = 0
for i in s:
  if i=="I":
    x+=1
    ans = max(x, ans)
  else:
    x-=1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
x = 0
ans = 0
for i in s:
  if i=="I:
    c+=1
  else:
    c-=1
    ans = max(c, ans)
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
x = 0
ans = 0
for i in s:
  if i=="I:
    c+=1
  else:
    c-=1
    ans = max(c, ans)
print(ans
Problem p03854 (python)

Fixed submission:
if input().replace("eraser", "").replace("erase", "").replace("dreamer", "").replace("dream", "") == "":
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
if input().replace("eraser", "").replace("erase", "").replace("dreamer", "").replace("dream", "") == "":
  peinr("YES")
else:
  print("NO")
Problem p03860 (python)

Fixed submission:
a, b, c = map(str, input().split())
print("A"+b[0]+"C")

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
print("A"+b[0]+"C")
Problem p03880 (python)

Fixed submission:
n = int(input())
A = [int(input()) for _ in range(n)]
m = 30
C = [False]*m
x = 0
for a in A:
  x ^= a
  for i in range(m):
    if a>>i & 1:
      C[i] = True
      break
total = 0
ans = 0
for i in range(m-1, -1, -1):
  if (x>>i & 1) ^ total:
    if C[i]:
      ans += 1
      total ^= 1
    else:
      print(-1)
      break
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
read = sys.stdin.read
import numpy as np

n = int(input())
A = np.array(read().split(), dtype=np.int64)
m = 30
C = np.zeros(m, dtype=bool)
used = np.zeros(m, dtype=bool)
x = 0
for a in A:
  x ^= a
for i in range(m):
  idx = np.where(A>>i & 1)
  if np.any(~used[idx]):
    C[i] = True
  used[idx] = True
total = 0
ans = 0
for i in range(m-1, -1, -1):
  if (x>>i & 1) ^ total:
    if C[i]:
      ans += 1
      total ^= 1
    else:
      print(-1)
      break
else:
  print(ans)
Problem p03893 (python)

Fixed submission:
x = int(input())
now = 3
for _ in range(x):
  now = now*2+1
print(now-1)

Buggy submission (verdict: Runtime Error):
print(4<<int(input())-2)
Problem p03949 (python)

Fixed submission:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)

INF = 10**10
n = int(input())
T = [[] for _ in range(n+1)]
for _ in range(n-1):
  a, b = map(int, input().split())
  T[a].append(b)
  T[b].append(a)
k = int(input())
VP = tuple(tuple(map(int, input().split())) for _ in range(k))
P = [-1]*(n+1)
A = [-1]*(n+1)
r, c = VP[0]
for v, p in VP:
  P[v] = p
def dfs1(v, par=-1, color=c%2):
  if P[v] == -1:
    l = -INF
    r = INF
  else:
    l = P[v]
    r = P[v]
  for nv in T[v]:
    if nv == par:
      continue
    nl, nr = dfs1(nv, v, color^1)
    l = max(l, nl-1)
    r = min(r, nr+1)
  if l&1 ^ color:
    l += 1
  if r&1 ^ color:
    r -= 1
  if l > r:
    print("No")
    exit()
  P[v] = (l, r)
  return P[v]
dfs1(r)
def dfs2(v, ini, par=-1):
  l, r = P[v]
  if l == r:
    A[v] = l
  else:
    if l <= ini-1 <= r:
      A[v] = ini-1
    else:
      A[v] = ini+1
  for nv in T[v]:
    if nv == par:
      continue
    dfs2(nv, A[v], v)
dfs2(r, P[r][0])
print("Yes")
print(*A[1:], sep="\n")

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)

n = int(input())
T = [[] for _ in range(n+1)]
for _ in range(n-1):
  a, b = map(int, input().split())
  T[a].append(b)
  T[b].append(a)
k = int(input())
VP = tuple(tuple(map(int, input().split())) for _ in range(k))
P = [-1]*(n+1)
A = [-1]*(n+1)
r, c = PV[0]
for v, p in VP:
  P[v] = p
C = [None]*(n+1)
def dfs1(v, par=-1, color=c%2):
  if P[v] == -1:
    l = -float("inf")
    r = float("inf")
  else:
    l = P[v]
    r = P[v]
  for nv in T[v]:
    if nv == par:
      continue
    nl, nr = dfs1(nv, v, color^1)
    l = max(l, nl-1)
    r = min(r, nr+1)
  if l ^ color:
    l += 1
  if r ^ color:
    r -= 1
  if l > r:
    print("No")
    exit()
  P[v] = (l, r)
  return P[v]
dfs1(r)
def dfs2(v, ini, par=-1):
  l, r = P[v]
  if l <= ini-1 <= r:
    A[v] = ini-1
  else:
    A[v] = ini+1
  for nv in T[v]:
    if nv == par:
      continue
    dfs2(nv, A[v], v)
dfs2(r, P[r][0])
print("Yes")
print(*A[1:], sep="\n")
Problem p04003 (python)

Fixed submission:
import sys
input = sys.stdin.readline
from collections import defaultdict, deque

n, m = map(int, input().split())
G = defaultdict(set)
U = 10**6
seen = set()
for _ in range(m):
  p, q, c = map(int, input().split())
  G[p+U*c].add((q+U*c, 0))
  G[q+U*c].add((p+U*c, 0))
  G[p+U*c].add((p-U, 0))
  G[q+U*c].add((q-U, 0))
  G[p-U].add((p+U*c, 1))
  G[q-U].add((q+U*c, 1))
que = deque()
que.append((1-U, 0))
while que:
  v, cnt = que.popleft()
  if v in seen:
    continue
  if v == n-U:
    print(cnt)
    exit()
  seen.add(v)
  for nv, cost in G[v]:
    if cost == 0:
      que.appendleft((nv, cnt+cost))
    else:
      que.append((nv, cnt+cost))
print(-1)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
from collections import defaultdict, deque

n, m = map(int, input().split())
G = defaultdict(set)
seen = set()
for _ in range(n):
  p, q, c = map(int, input().split())
  G[(p, c)].add(((q, c), 0))
  G[(q, c)].add(((p, c), 0))
  G[(p, c)].add(((p, -1), 0))
  G[(q, c)].add(((q, -1), 0))
  G[(p, -1)].add(((p, c), 1))
  G[(q, -1)].add(((q, c), 1))
que = deque()
que.append(((1, -1), 0))
while que:
  v, cnt = que.popleft()
  if v in seen:
    continue
  if v == (n, -1):
    print(cnt)
    exit()
  seen.add(v)
  for nv, cost in G[v]:
    if cost == 0:
      que.appendleft((nv, cnt+cost))
    else:
      que.append((nv, cnt+cost))
print(-1)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
from collections import defaultdict, deque

n, m = map(int, input().split())
G = defaultdict(set)
seen = set()
for _ in range(n):
  p, q, c = map(int, input().split())
  G[(p, c)].add(((q, c), 0))
  G[(q, c)].add(((p, c), 0))
  G[(p, c)].add(((p, -1), 0))
  G[(q, c)].add(((q, -1), 0))
  G[(p, -1)].add(((p, c), 1))
  G[(q, -1)].add(((q, c), 1))
que = deque()
que.append(((1, -1), 0))
while que:
  v, cnt = que.popleft()
  if v in seen:
    continue
  if v == (n, -1):
    print(cnt)
    break
  seen.add(v)
  for nv, cost in G[v]:
    if cost == 0:
      que.appendleft((nv, cnt+cost))
    else:
      que.append((nv, cnt+cost))
Problem p04026 (python)

Fixed submission:
入力 = input()
for i in range(len(入力)-1):
  if 入力[i]==入力[i+1]:
    print(i+1, i+2)
    exit()
  elif i<len(入力)-2 and 入力[i]==入力[i+2]:
    print(i+1, i+3)
    exit()
print(-1, -1)

Buggy submission (verdict: Runtime Error):
入力 = input()
for i in range(len(入力)-1):
  if 入力[i]==入力[i+1]:
    print(i+1, i+2)
    exit()
  elif i<n-2 and 入力[i]==入力[i+2]:
    print(i+1, i+3)
    exit()
print(-1, -1)
Problem p04045 (python)

Fixed submission:
n, k = map(int, input().split())
A = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"} - set(input().split())
while True:
  s = set(str(n))
  if s <= A:
    print(n)
    break
  n += 1

Buggy submission (verdict: Runtime Error):
import bisect
n, k = input().split()
A = sorted(list({i for i in range(10)} - set(map(int, input().split()))))
greater = False
ans = ""
for i in n:
  if greater:
    ans += str(A[0])
  else:
    t = A[bisect.bisect_left(A, int(i))]
    if t > int(i):
      greater = True
    ans += str(t)
print(ans)
Problem p02582 (python)

Fixed submission:
s = input()
if s == 'RRR': print(3)
elif s == 'RRS': print(2)
elif s == 'SRR': print(2)
elif s == 'SSS': print(0)
else: print(1)

Buggy submission (verdict: Runtime Error):
s = input()
if s == 'RRR': print(3)
elif s == 'RRS' print(2)
elif s == 'SRR': print(2)
else: print(1)
Problem p02691 (python)

Fixed submission:
n = int(input())
l = list(map(int, input().split()))
t1 = []
t2 = []
for i in range(n):
    t1.append(l[i] + i)
    t2.append(i - l[i])
count = {}
for i in t1: count[i] = 0
for i in t2: count[i] = 0
for i in t1: count[i] -= -1
ans = 0
for i in t2:
    if i > 0:
        if count[i] != 0:
            ans += count[i]
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
l = list(map(int, input().split()))
t1 = []
t2 = []
for i in range(n):
    t1.append(l[i] + i)
    t2.append(i - l[i])
# print(t1, t2)
count = [0] * (2 * 100005)
for i in t1: count[i] -= -1
ans = 0
for i in t2:
    if i > 0:
        if count[i] != 0:
            ans += count[i]
print(ans)
Problem p02720 (python)

Fixed submission:
def lun(s):
    ch = 1
    temp = int(s[0])
    for i in s[1: ]:
        i = int(i)
        if abs(i - temp) > 1:
            ch = 0
            break
        temp = i
    return ch
k = int(input())
d = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
l = ['1', '2', '3', '4', '5', '6', '7', '8', '9']
while 1:
    for i in l:
        for j in d:
            # print(i, j)
            s = i + str(j)
            if lun(s): l.append(s)
        if len(l) >= 100002: break
    if len(l) >= 100002: break
print(l[k - 1])

Buggy submission (verdict: Runtime Error):
def lun(s):
    ch = 1
    temp = int(s[0])
    for i in s[1: ]:
        i = int(i)
        if abs(i - temp) > 1:
            ch = 0
            break
        temp = i
    return ch
k = int(input())
d = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
l = ['1', '2', '3', '4', '5', '6', '7', '8', '9']
while 1:
    for i in l:
        for j in d:
            # print(i, j)
            s = i + str(j)
            if lun(s): l.append(s)
        if len(l) >= 10000: break
    if len(l) >= 10000: break
k = input()
print(l[k])
Problem p02732 (python)

Fixed submission:
n = int(input())
l = list(map(int, input().split()))
freq = [0] * (2 * (10**5) + 5)
for i in l: freq[i] -= -1
count = 0
for i in range(2 * (10**5) + 5):
    if freq[i] >= 2:
        temp = (freq[i] * (freq[i] - 1)) // 2
        count += temp
for i in l:
    if freq[i] == 1: print(count)
    else:
        temp = freq[i] - 1
        if temp == 1: print(count - 1)
        else:
            yoyo = ((freq[i] * (freq[i] - 1)) // 2) - ((temp * (temp - 1)) // 2)
            print(count - yoyo)

Buggy submission (verdict: Runtime Error):
n = int(input())
l = list(map(int, input().split()))
freq = [0] * (10**5 + 5)
for i in l: freq[i] -= -1
count = 0
for i in range(10**5 + 5):
    if freq[i] >= 2:
        temp = (freq[i] * (freq[i] - 1)) // 2
        count += temp
for i in l:
    if freq[i] == 1: print(count)
    else:
        temp = freq[i] - 1
        if temp == 1: print(count - 1)
        else:
            yoyo = ((freq[i] * (freq[i] - 1)) // 2) - ((temp * (temp - 1)) // 2)
            print(count - yoyo)
Problem p02882 (python)

Fixed submission:
import math
a, b, x = [int(x) for x in input().split()]
y = 2 * (b - (x / (a * a)))
if x == a * a * b: print(0)
elif y <= b:
    value = a / y
    print(90 - math.degrees(math.atan(value)))
else:
    y = (2 * x) / (a * b)
    v = b / y
    print(math.degrees(math.atan(v)))

Buggy submission (verdict: Runtime Error):
import math
a, b, x = [int(x) for x in input().split()]
y = 2 * (b - (x / (a * a)))
if y <= b:
    value = a / y
    print(90 - math.degrees(math.atan(value)))
else:
    y = (2 * x) / (a * b)
    v = b / y
    print(math.degrees(math.atan(v)))
Problem p02888 (python)

Fixed submission:
import sys
input = sys.stdin.readline
def main():
  n = int(input())
  l = list(map(int, input().split()))
  l.sort()
  l.append(99999999)
  c = 0
  for i in range(n - 2):
      t = i + 2
      for j in range(i + 1, n - 1):
          for k in range(t, n + 1):
              if l[i] + l[j] <= l[k]:
                  t = k
                  break
          if t > j: c += t - j - 1
          if j + 1 == t: t += 1
  print(c)
if __name__ == "__main__":
  main()

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
def main():
  n = int(input())
  l = list(map(int, input().split()))
  n = 2000
  l = []
  l.sort()
  l.append(99999999)
  c = 0
  for i in range(n - 2):
      t = i + 2
      for j in range(i + 1, n - 1):
          for k in range(t, n + 1):
              if l[i] + l[j] <= l[k]:
                  t = k
                  break
          if t > j: c += t - j - 1
          if j + 1 == t: t += 1
  print(c)
if __name__ == "__main__":
  main()
Problem p03035 (python)

Fixed submission:
a,b = map(int,input().split())
if(a >= 13):
	print(b)
elif(a >= 6):
	print(b // 2)
else:
	print(0)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
if(a >= 13):
	print(b)
else if(a >= 6):
	print(b // 2)
else:
	print(0)
Problem p03160 (python)

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

dp=[]
dp.append(0)
dp.append(abs(h[0]-h[1]))

for i in range (2,N):
    dp.append(min(dp[i-2]+abs(h[i]-h[i-2]),dp[i-1]+abs(h[i]-h[i-1])))

print(dp[N-1])

Buggy submission (verdict: Runtime Error):
[N,K]=list(map(int, input().split()))
h=list(map(int, input().split()))
K=min(N,K)
 
dp=[[0 for i in range(K+1)] for j in range(N)]
 
for i in range (1,K):
    for j in range (0,i):
        dp[i][j]=dp[i-j-1][K]+abs(h[i-j-1]-h[i])
        dp[i][K]=min(dp[i][0:j+1])
 
for i in range (K,N):
    for j in range (0,K):
        dp[i][j]=dp[i-j-1][K]+abs(h[i-j-1]-h[i])
        dp[i][K]=min(dp[i][0:K])
 
print(dp[N-1][K])
Problem p03583 (python)

Fixed submission:
N = int(input())
for a in range(1,3501):
    for b in range(1,3501):
        m =  (4*a*b) - N*(a+b)
        if m> 0 and N*a*b % m == 0:
            c = (N*a*b)//m
            break
    else:
        continue
    break
print(a,b,c)

Buggy submission (verdict: Runtime Error):
N = int(input())
for a in range(1,3501):
    for b in range(1,3501):
        m =  (4*a*b) - N*(a+b)
        if m> 0 & N*a*b % m == 0:
            c = (N*a*b)//m
            break
    else:
        continue
    break
print(a,b,c)

Buggy submission (verdict: Runtime Error):
N = int(input())
for a in range(1,3501):
    for b in range(1,3501):
        m =  (4*a*b) - N*(a+b)
        if m>= 0 & N*a*b % m == 0:
            c = (N*a*b)//m
            break
    else:
        continue
    break
print(a,b,c)