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

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
import numpy as np
A = np.array(A)
A_inv = 1/A
print(1/np.sum(A_inv))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
import numpy as np
A = np.array(A)
1_A = 1/A
print(1/np.sum(1_A))
Problem p02947 (python)

Fixed submission:
N = int(input())
S =[]
for i in range(N):
  s = list(str(input()))
  s.sort()
  s = ''.join(s)
  S.append(s)
from collections import Counter
l = Counter(S)
count = []
for i in l.values():
  count.append(i*(i-1)/2)
print(int(sum(count)))

Buggy submission (verdict: Runtime Error):
N = int(input())
S =[[] for _ in range(N)]
for i in range(N):
  s = list(str(input()))
  s.sort()
  s = ''.join(s)
  S[i].append(s)
from collections import Counter
l = Counter(S)
count = []
for i in l.values:
  count.append(i*(i-1)/2)
print(sum(count))
Problem p02953 (python)

Fixed submission:
N = int(input())
H = list(map(int, input().split()))
 
for i in range(1, N):
    if H[i] < H[i - 1]:
        H[i] += 1
for i in range(1, N):
    if H[i] < H[i - 1]:
        print('No')
        exit(0)
print('Yes')

Buggy submission (verdict: Runtime Error):
N = int(input())
H = list(map(int, input().split()))
key = 0
for i in range(N-1, 1, -1):
    if H[i]>H[i+1]:
      H[i]-=1
    if H[i]>H[i+1]:
      key += 1
      break
if key == 0:
  print('Yes')
else:
  print('No')
Problem p02958 (python)

Fixed submission:
N = int(input())
p = list(map(int, input().split()))
count = 0
for i in range(N):
  if p[i] != i+1:
    count += 1
if count >=3:
  print("NO")
else:
  print("YES")

Buggy submission (verdict: Runtime Error):
N = int(input())
p = list(map(int, input().split()))
count = 0
for i in range(N):
  if p[i] != i+1:
    count ++
if count >=3:
  print("NO")
else:
  print("YES")
Problem p02971 (python)

Fixed submission:
import numpy as np
#import heapq
N = int(input())
A = []
for _ in range(N):
  A.append(int(input()))
A = np.array(A)
A_max_1 = np.max(A)
A_max_index = np.argmax(A)
A = np.delete(A, A_max_index)
A_max_2 = np.max(A)
answer = []
for i in range(N):
  if not i == A_max_index:
    answer.append(A_max_1)
  else:
    answer.append(A_max_2)
for i in range(N):
  print(answer[i])

Buggy submission (verdict: Runtime Error):
import numpy as np
import heapq
N = int(input())
A = []
for _ in range(N):
  A.append(int(input()))
A = np.array(A)
answer = []
for i in range(N):
  A_temp = np.delete(A, i)
  answer.append(heapq.pop(A_temp))
for i in range(N):
  print(answer[i])
Problem p02995 (python)

Fixed submission:
from fractions import gcd

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

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

div_A_C = (A-1)//C
div_A_D = (A-1)//D

div_B_C = B//C
div_B_D = B//D

CD = lcm(C, D)

div_A_CD = (A-1)//CD
div_B_CD = B // CD
C_or_D = (div_B_C+div_B_D-div_B_CD)-(div_A_C+div_A_D-div_A_CD) 
print(B-A+1-C_or_D)

Buggy submission (verdict: Runtime Error):
from fractions import gcd
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

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

div_A_C = (A-1)//C
div_A_D = (A-1)//D

div_B_C = B//C
div_B_D = B//D

CD = lcm(C, D)

div_A_CD = (A-1)//CD
div_B_CD = B // CD
C_or_D = (div_B_C+div_B_D-div_B_CD)-(div_A_C+div_A_D-div_A_CD) 
print(B-A+1-C_or_D)
Problem p03044 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**7)
N = int(input())
a = [[] for _ in range(N)]
ans = [0]*N
for _ in range(N-1):
  u, v, w = map(int, input().split())
  a[u-1].append([v-1, w])
  a[v-1].append([u-1, w])
def calc(u, b):
  for v, w in a[u]:
    if not b == v:
      ans[v]=(ans[u] + w)%2
      calc(v, u)
calc(0, -1)
for i in ans:
  if i % 2 == 0:
    print(0)
  else:
    print(1)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = [[] for _ in range(N)]
ans = [0]*N
for _ in range(N-1):
  u, v, w = map(int, input().split())
  a[u-1].append([v-1, w])
  a[v-1].append([u-1, w])
def calc(u, b):
  for v, w in a[u]:
    if not b == v:
      ans[v]=(ans[u] + w)%2
      calc(v, u)
calc(0, -1)
for i in ans:
  if i % 2 == 0:
    print(0)
  else:
    print(1)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = [[] for _ in range(N)]
ans = [0]*N
for _ in range(N-1):
  u, v, w = map(int, input().split())
  a[u-1].append([v-1, w])
  a[v-1].append([u-1, w])
def calc(u, b):
  print(u)
  for v, w in a[u]:
    if not b == v:
      ans[v]=(ans[u] + w)
      calc(v, u)
calc(0, -1)
print(ans)
for i in ans:
  if i % 2 == 0:
    print(0)
  else:
    print(1)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = [[] for _ in range(N)]
ans = [0]*N
for _ in range(N-1):
  u, v, w = map(int, input().split())
  a[u-1].append([v-1, w])
  a[v-1].append([u-1, w])
def calc(u, b):
  for v, w in a[u]:
    ans[v]=(ans[u] + w)
    if not b == v:
      calc(v, u)

calc(0, -1)
for i in ans:
  if i % 2 == 0:
    print(0)
  else:
    print(1)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = [[] for _ in range(N)]
ans = [0]*N
for _ in range(N-1):
  u, v, w = map(int, input().split())
  a[u-1].append([v-1, w])
  a[v-1].append([u-1, w])
print(a)
def calc(u, b):
  for v, w in a[u]:
    ans[v]=(ans[u] + w)
    if not b == v:
      calc(v, u)

calc(0, -1)
print(ans)
for i in ans:
  if i % 2 == 0:
    print(0)
  else:
    print(1)
Problem p03244 (python)

Fixed submission:
import numpy as np
n = int(input())
v = list(map(int, input().split()))
gu = [0] * (10**5 + 5)
ki = [0] * (10**5 + 5)

for i in range(n):
  if i % 2:
    ki[v[i]] += 1
  else:
    gu[v[i]] += 1
ki = np.array(ki)
gu = np.array(gu)

a = np.argmax(ki)
b = np.argmax(gu)

if a != b:
  print(n-ki[a]-gu[b])
else:
  gu = sorted(gu)
  ki = sorted(ki)
  print(min(n-ki[-1] - gu[-2], n-ki[-2]-gu[-1]))

Buggy submission (verdict: Runtime Error):
import numpy as np
n = int(input())
v = list(map(int, input().split()))
gu = [0] * (10**5)
ki = [0] * (10**5)

for i in range(n):
  if i % 2:
    ki[v[i]] += 1
  else:
    gu[v[i]] += 1
import numpy as np
ki = np.array(ki)
gu = np.array(gu)

a = np.argmax(ki)
b = np.argmax(gu)

if a != b:
  print(n-ki[a]-gu[b])
else:
  if a > b:
    gu = sorted(gu)
    print(n-ki[a] - gu[-2])
  else:
    ki = sorted(ki)
    print(n-ki[-2]-gu[b])
Problem p03371 (python)

Fixed submission:
def main():
  A, B, C, X, Y = map(int, input().split())
  print(min([C*max(X, Y)*2, A*X + B*Y, 2*C*Y+A*(max(0, X-Y)), 2*C*X + B*(max(0, Y-X))]))
if __name__ == "__main__":
  main()

Buggy submission (verdict: Runtime Error):
def main():
  A, B, C, X, Y = map(int, input().split())
  if A + B <= 2*C:
    print(A*X + B*Y)
  elif 2*C < A and 2*C < B:
    print(C*max(X,  Y)*2)
      print(A*X + B*Y)
  elif 2*C < A or 2*C < B:
    print(C*max(X,  Y)*2)
  else:
    if X < Y:temp = B
    else:  temp = A
    print(C*min(X, Y)*2 + temp*(abs(X-Y)))
if __name__ == "__main__":
  main()
Problem p03471 (python)

Fixed submission:
def main():
  ans = [-1, -1, -1]
  N, Y = map(int, input().split())
  for i in range(N+1):
    for j in range(N+1-i):
      if 1000*i + 5000*j + 10000*(N-i-j) == Y:
        ans = [N-i-j, j, i]
  print(*ans)
if __name__ == "__main__":
  main()

Buggy submission (verdict: Runtime Error):
def main():
  ans = [-1, -1, -1]
  N, Y = map(int, input().split())
  for a in range(N+1):
    for b in range(N+1):
      for c in range(N+1):
        if 1000*a + 5000*b + 10000*c == Y and a + b + c = N:
          ans = [a, b, c]
  print(*ans)
if __name__ == "__main__":
  main()
Problem p03546 (python)

Fixed submission:
H, W = map(int, input().split())
cost = []
INF = 10**9
for i in range(10):
  cost.append(list(map(int, input().split())))
for i in range(10):
  cost[i][i] = INF
A = []
for i in range(H):
  A.append(list(map(int, input().split())))

d = [INF]*10
used = [False] *10
V = 10
def shortest_path(start = 1):#隣接行列の場合のダイクストラ法
  d[start] = 0
  while True:
    v = -1
    for u in range(V):
      if (not used[u]) and (v == -1 or d[u] < d[v]):v = u
    if v == -1:break
    used[v] = True
    for u in range(V):
      d[u] = min(d[u], d[v] + cost[u][v])
  
def main():
  shortest_path()
  ans = 0
  for i in range(H):
    for j in range(W):
      if A[i][j] != -1:
        ans += d[A[i][j]]
  print(ans)
if __name__ == "__main__":
  main()

Buggy submission (verdict: Runtime Error):
3 5
0 4 3 6 2 7 2 5 3 3
4 0 5 3 7 5 3 7 2 7
5 7 0 7 2 9 3 2 9 1
3 6 2 0 2 4 6 4 2 3
3 5 7 4 0 6 9 7 6 7
9 8 5 2 2 0 4 7 6 5
5 4 6 3 2 3 0 5 4 3
3 6 2 3 4 2 4 0 8 9
4 6 5 4 3 5 3 2 0 8
2 1 3 4 5 7 8 6 4 0
3 5 2 6 1
2 5 3 2 1
6 9 2 5 6
Problem p03565 (python)

Fixed submission:
def main():
  s = str(input())
  ans = s.replace('?', 'z')
  flag = False
  t = str(input())
  for i in range(len(s)-len(t)+1):
    temp_flag = True
    temp_ans = list(s)
    for j in range(len(t)):
      if s[i + j] == '?':
        temp_ans[i + j] = t[j]
        continue
      elif s[i+j] != t[j]:
        temp_flag = False
    if temp_flag:
      flag = True
      temp_ans = "".join(temp_ans)
      temp_ans = temp_ans.replace('?', 'a')
      ans = min(ans, temp_ans)
  if flag:
    print(ans)
  else:
    print("UNRESTORABLE")
    
if __name__ == "__main__":
  main()

Buggy submission (verdict: Runtime Error):
def main():
  s = str(input())
  ans = s.replace('?', 'z')
  flag = False
  t = str(input())
  for i in range(len(s)-len(t)+1):
    temp_flag = True
    temp_ans = list(s)
    for j in range(len(t)):
      if s[i + j] == '?':
        temp_ans[i + j] = t[j]
        continue
      elif s[i+j] != t[j]:
        temp_flag = False
    if temp_flag:
      flag = True
      temp_ans = "".join(temp_ans)
      temp_ans = temp_ans.replace('?', 'a')
      ans = min(ans, temp_ans)
  if flag:
    print(ans)
  else:
    print("UNRESTORABLE")
    
if __name__ == "__main__":
  main()
  else:
    print("UNRESTORABLE")
    
if __name__ == "__main__":
  main()
Problem p03844 (python)

Fixed submission:
a,b,c=map(str, input().split())
if b=="+":
  print(int(a)+int(c))
else:
  print(int(a)-int(c))

Buggy submission (verdict: Runtime Error):
a,b,c=map(str, input().split())
if b=="+":
  print(int(a)+int(b))
else:
  print(int(a)-int(b))

Buggy submission (verdict: Runtime Error):
a,b,c=map(str, input().split())
if b=="+":
  print(int(A)+int(B))
else:
  print(int(A)-int(B))
Problem p02742 (python)

Fixed submission:
A, B = map(int, input().split())
if A == 1 or B == 1:
  print(1)
elif (A*B) % 2 == 0:
  print(A*B//2)
else:
  print(A*B//2+1)

Buggy submission (verdict: Runtime Error):
if A == 1 or B == 1:
  print(1)
elif (A*B) % 2 == 0:
  print(A*B//2)
else:
  print(A*B//2+1)
Problem p02760 (python)

Fixed submission:
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(A: "List[List[int]]", N: int, b: "List[int]"):
    A_ = []
    for a_ in A:
        A_ += [[a__, False] for a__ in a_]
    for b_ in b:
        for a__ in A_:
            if a__[0] == b_:
                a__[1] = True
    if (A_[0][1] and ((A_[1][1] and A_[2][1]) or \
                        (A_[3][1] and A_[6][1]) or \
                        (A_[4][1] and A_[8][1]))) or \
            (A_[1][1] and A_[4][1] and A_[7][1]) or \
            (A_[2][1] and A_[5][1] and A_[8][1]) or \
            (A_[3][1] and A_[4][1] and A_[5][1]) or \
            (A_[6][1] and A_[7][1] and A_[8][1]) or \
            (A_[2][1] and A_[4][1] and A_[6][1]):
        print(YES)
    else:
        print(NO)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = [[int(next(tokens)) for _ in range(3)] for _ in range(3)]  # type: "List[List[int]]"
    N = int(next(tokens))  # type: int
    b = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(A, N, b)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
A=list(map(lambda x: (int(x), False), input().split()))
A+=list(map(lambda x: (int(x), False), input().split()))
A+=list(map(lambda x: (int(x), False), input().split()))

N = int(input())
for _ in range(N):
  n = int(input())
  for a, b in A:
    if a == n:
      b = True
if (A[0][1] and ((A[1][1] and A[2][1]) or \
                       (A[3][1] and A[6][1]) or \
                       (A[4][1] and A[8][1])) or \
          (A[1][1] and A[4][1] and A[7][1]) or \
          (A[2][1] and A[5][1] and A[8][1]) or \
          (A[3][1] and A[4][1] and A[5][1]) or \
          (A[6][1] and A[7][1] and A[8][1]) or \
          (A[2][1] and A[4][1] and A[6][1]):
    print("YES")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
A=list(map(lambda x: int(x), False), input().split()))
A+=list(map(lambda x: (int(x), False), input().split()))
A+=list(map(lambda x: (int(x), False), input().split()))

N = int(input())
for _ in range(N):
  n = int(input())
  for a, b in A:
    if a == n:
      b = True
if (A[0][1] and ((A[1][1] and A[2][1]) or \
                       (A[3][1] and A[6][1]) or \
                       (A[4][1] and A[8][1])) or \
          (A[1][1] and A[4][1] and A[7][1]) or \
          (A[2][1] and A[5][1] and A[8][1]) or \
          (A[3][1] and A[4][1] and A[5][1]) or \
          (A[6][1] and A[7][1] and A[8][1]) or \
          (A[2][1] and A[4][1] and A[6][1]):
    print("YES")
else:
    print("No")
Problem p03030 (python)

Fixed submission:
N = int(input())
R = []
for i in range(N):
  l = input().split()
  R.append((l[0], (-1)*int(l[1]), i))

R.sort()
for i in range(N):
  print(R[i][2]+1)

Buggy submission (verdict: Runtime Error):
N = int(input())
R = []
for i in range(N):
  l = input().split()
  R.append((l[0], (-1)*int(l[1]), i))

R.sort()
for i in range(N):
  print(R[2]+1)
Problem p03087 (python)

Fixed submission:
from bisect import bisect_right, bisect_left
N, Q = map(int, input().split())
S = input()
ac = []
for i in range(N-1):
  if S[i:i+2] == "AC":
    ac.append(i)
for i in range(Q):
  l, r = map(int, input().split())
  l -= 1
  r -= 1
  print(bisect_right(ac, r-1) - bisect_left(ac, l))

Buggy submission (verdict: Runtime Error):
from bisect import bisect, bisect_left
N, Q = map(input().split(), int)
S = input()
ac = []
for i in range(N-1):
  if S[i:i+1] == "AC":
    ac.append(i)
for i in range(Q):
  l, r = map(input().split(), int)
  l -= 1
  r -= 1
  print(bisect_right(ac, r-1) - bisect_left(ac, l))
Problem p02866 (python)

Fixed submission:
# -*- coding: utf-8 -*-
n = int(input())
d = list(map(int, input().split()))

cnt = dict()
for k in d:
    if k in cnt:
        cnt[k] += 1
    else:
        cnt[k] = 1

mod = 998244353

keys = cnt.keys()
pre = -1
rst = 1

if d[0] != 0:
    print(0)
    exit(0)


if cnt[0] != 1:
    print(0)
    exit(0)


for k in sorted(keys):
    if (pre + 1) != k:
        rst = 0
        break
    pre = k

    if k == 0:
        continue

    rst = (rst * (cnt[k-1] ** cnt[k])) % mod
    
print(rst)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
n = int(input())
d = list(map(int, input().split()))

cnt = dict()
for k in d:
    if k in cnt:
        cnt[k] += 1
    else:
        cnt[k] = 1

mod = 998244353

keys = cnt.keys()
pre = -1
rst = 1

if cnt[0] != 1:
    print(0)
    exit(0)

for k in sorted(keys):
    if (pre + 1) != k:
        rst = 0
        break
    pre = k

    if k == 0:
        continue

    rst = (rst * (cnt[k-1] ** cnt[k])) % mod
    
print(rst)
Problem p03043 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import math
n, k = map(int, input().split())

prop = 0.0
_prop = 0.0

if n >= k:
    _prop = (n - k) / n

end = min(n, k) + 1
for i in range(1, end):
    dest = k / i
    coin = math.ceil(math.log2(dest))
    __prop = (1 / n) * (1 / pow(2, coin))
    prop += __prop

print(prop + _prop)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import math
n, k = map(int, input().split())

prop = 0.0
_prop = 0.0

if n >= k:
    _prop = (n - k) / n

end = min(n, k) + 1
for i in range(1, end):
    dest = k / i
    coin = math.ceil(math.log2(dest))
    __prop = (1 / n) * (1 / pow(2, coin))
    prop += __prop

print(prop + _prop)
Problem p03078 (python)

Fixed submission:
# -*- coding: utf-8 -*-
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()))

bc = [i + j for i in b for j in c]
bc.sort(reverse=True)

abc = [i + j for i in a for j in bc[:min(k, len(bc))]]
abc.sort(reverse=True)

for i in range(k):
    print(abc[i])

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
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)

abc = []

for i, _a in enumerate(a):
    for j, _b in enumerate(b):
        if (i+1) * (j+1) > k:
            break
        for l, _c in enumerate(c):
            if (i+1) * (j+1) * (l+1) > k:
                break
            abc.append(_a + _b + _c)

for x in abc.sort(reverse=True)[:k]:
    print(x)
Problem p02573 (python)

Fixed submission:
n,m=map(int,input().split())
root=[-1]*n
def r(x):
  if root[x]<0:
    return x
  else:
    root[x]=r(root[x])
    return root[x]
def unite(x,y):
  x=r(x)
  y=r(y)
  if x==y:
    return
  root[x]+=root[y]
  root[y]=x
for i in range(m):
  a,b=map(int,input().split())
  a-=1
  b-=1
  unite(a,b)
ans=0
for i in range(n):
  ans=max(ans,-root[i])
print(ans)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
root=[-1]*n
def r(x):　#-1の項が何番目かを特定
  if root[x]<0: #x番目が-1ならx(>=0)を返す
    return x 
  else: #x番目が0以上なら-1の項に到達するまで回す
    root[x]=r(root[x]) 
    return root[x] #-1の項に到達したらその項が何番目かを返す
def unite(x,y):
  x=r(x)
  y=r(y)
  if x==y: #同じ項に到達した場合は処理の必要なし
    return
  root[x]+=root[y] #-1ずつ加算していく
  root[y]=x #-1を足した後は適当な数に変える(重複回避)
for i in range(m):
  a,b=map(int,input().split())
  a-=1 #リストの序数に合わせる
  b-=1
  unite(a,b) #各人間がどのくらい友達がいるか
ans=0
for i in range(n):
  ans=max(ans,-root[i]) #最多保有友人数が何人か
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n,m=map(int,input().split())
l=[]
for i in range(m):
  s=[]
  a,b=map(int,input().split())
  s.append(a)
  s.append(b)
  l.append(s)
def get_unique_list(seq):
    seen = []
    return [x for x in seq if (x or reversed(x)) not in seen and not seen.append(x)]
ls=get_unique_list(l)
cnt=Counter([x[0] for x in ls])
print(max(cnt.values())+1)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n,m=map(int,input().split())
l=[]
for i in range(m):
  s=[]
  a,b=map(int,input().split())
  s.append(a)
  s.append(b)
  l.append(s)
def get_unique_list(seq):
    seen = []
    return [x for x in seq if (x or reversed(x)) not in seen and not seen.append(x)]
ls=get_unique_list(l)
cnt=Counter([x[0] for x in ls])
print(max(cnt.values)+1)
Problem p02574 (python)

Fixed submission:
from math import gcd
from functools import reduce
NUM_MAX = 10**6 + 1
def solve(n, a):
    c = [0] * NUM_MAX
    for x in a:
        c[x] += 1
    t = any(sum(c[i::i]) > 1 for i in range(2, NUM_MAX))
    t += reduce(gcd, a) > 1
    return ["pairwise", "setwise", "not"][t] + " coprime"

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

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
k=10**6+1
def judge(n,a):
  c=[0]**k
  for x in a:
    c[x]=+1
  t=any(sum(c[i::i])>1 for i in range(2,k))
  t+=reduce(gcd,a)>1
  return ['pairwise','setwise','not'][t]+' coprime'
n=int(input())
a=list(map(int,input().split()))
print(judge(n,a))
Problem p02583 (python)

Fixed submission:
n=int(input())
l=list(map(int,input().split()))
l.sort()
a=0
b=0
c=0
ans=0
for i in range(n-2):
  a=l[i]
  for j in range(i+1,n-1):
    if l[j]!=a:
      b=l[j]
      for k in range(j+1,n):
        if l[k]!=b:
          c=l[k]
          if a+b>c:
            ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
l.sort()
s=0
i=0
while s==0:
  if l[i]==l[i+1]:
    l.remove(l[i])
  else:
    i+=1
    if len(l)-1==i:
      s+=1
a=len(l)
print((a*(a-1)*(a-2)/6)
Problem p02585 (python)

Fixed submission:
from numba import jit
@jit
def main():
  n,k=map(int,input().split())
  p=list(map(int,input().split()))
  c=list(map(int,input().split()))
  ans=-10**18
  for i in range(n):
    start,count=i,1
    val=c[start]
    while p[start]-1!=i: #ループ部分
      start=p[start]-1
      count+=1
      val+=c[start]
    start=i
    if val>0:
      a=(k//count-1)*val #一周目はループのどの部分から始めるのが最適かわからないので
      ans=max(a,ans)
      num=count+k%count
    else:
      a=0
      num=min(k,count)
    for _ in range(num):
      start=p[start]-1
      a+=c[start]
      ans=max(a,ans)
  print(ans)
main()

Buggy submission (verdict: Runtime Error):
from numba import njit
@njit(parallel=True)
def main():
  n,k=map(int,input().split())
  p=list(map(int,input().split()))
  c=list(map(int,input().split()))
  ans=-10**18
  for i in range(n):
    start,count=i,1
    val=c[start]
    while p[start]-1!=i: #ループ部分
      start=p[start]-1
      count+=1
      val+=c[start]
    start=i
    if val>0:
      a=(k//count-1)*val #一周目はループのどの部分から始めるのが最適かわからないので
      ans=max(a,ans)
      num=count+k%count
    else:
      a=0
      num=min(k,count)
    for _ in range(num):
      start=p[start]-1
      a+=c[start]
      ans=max(a,ans)
  print(ans)
main()

Buggy submission (verdict: Runtime Error):
from numba import njit
@njit
def main():
  n,k=map(int,input().split())
  p=list(map(int,input().split()))
  c=list(map(int,input().split()))
  ans=-10**18
  for i in range(n):
    start,count=i,1
    val=c[start]
    while p[start]-1!=i: #ループ部分
      start=p[start]-1
      count+=1
      val+=c[start]
    start=i
    if val>0:
      a=(k//count-1)*val #一周目はループのどの部分から始めるのが最適かわからないので
      ans=max(a,ans)
      num=count+k%count
    else:
      a=0
      num=min(k,count)
    for _ in range(num):
      start=p[start]-1
      a+=c[start]
      ans=max(a,ans)
  print(ans)
main()
Problem p02586 (python)

Fixed submission:
from numba import jit
import numpy as np
@jit
def main():
  R,C,K=map(int,input().split())
  scores=np.zeros((R,C),np.int64)
  for _ in range(K): #各マスにアイテム配置
    r,c,v=map(int,input().split())
    scores[r-1][c-1]=v
  dp=np.zeros((R+1,C+1,4),np.int64) #後のために余分に作っておく、scoresの配列は別なのでindexに注意
  for i in range(1,R+1):
    for j in range(1,C+1):
      for k in range(4):
        dp[i][j][k]=max(dp[i][j-1][k],dp[i-1][j][3]) #同じ行ですでに3つ拾ってから次の行にくるのかただ隣のマスに進むか
      for k in range(3,0,-1):
        dp[i][j][k]=max(dp[i][j][k],dp[i][j][k-1]+scores[i-1][j-1]) #そのマスでアイテムを拾うかどうか
  return dp[R][C][3]
print(main())

Buggy submission (verdict: Runtime Error):
from namba import jit
import numpy as np
@jit
def main():
  R,C,K=map(int,input().split())
  scores=np.zeros((R,C),np.int64)
  for _ in range(K): #各マスにアイテム配置
    r,c,v=map(int,input().split())
    scores[r-1][c-1]=v
  dp=np.zeros((R+1,C+1,4),np.int64) #後のために余分に作っておく、scoresの配列は別なのでindexに注意
  for i in range(1,R+1):
    for j in range(1,C+1):
      for k in range(4):
        dp[i][j][k]=max(dp[i][j-1][k],dp[i-1][j][3]) #同じ行ですでに3つ拾ってから次の行にくるのかただ隣のマスに進むか
      for k in range(3,0,-1):
        dp[i][j][k]=max(dp[i][j][k],dp[i][j][k-1]+scores[i-1][j-1]) #そのマスでアイテムを拾うかどうか
  return dp[R][C][3]
print(main())
Problem p02601 (python)

Fixed submission:
a,b,c=map(int,input().split())
k=int(input())
for i in range(1,k+1):
  if a>=b>=c or a>=c>=b:
    c=c*2
  elif b>=a>=c or b>=c>=a:
    c=c*2
  elif c>=b>a:
    c=c*2
  elif c>b==a:
    b=b*2
  elif c>a>=b:
    b=b*2
if c>b>a:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input())
k=int(input())
for i in range(1,k+1):
  if a>=b>=c or a>=c>=b:
    c=c*2
  elif b>=a>=c or b>=c>=a:
    c=c*2
  elif c>=b>a:
    c=c*2
  elif c>b==a:
    b=b*2
  elif c>a>=b:
    b=b*2
if c>b>a:
  print('Yes')
else:
  print('No')