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

Fixed submission:
A,B=map(int, input().split())
if A < 2*B:
  print(0)
else:
  print(A-2*B)

Buggy submission (verdict: Runtime Error):
A,B=map(int, input().split())
if A < 2*B:
  print(0)
else:
  print(A-2B)
Problem p03471 (python)

Fixed submission:
N,Y=map(int,input().split())
for i in range(N+1):
  for k in range(N+1-i):
    m = N-i-k
    if 10000*i + 5000*k + 1000*m == Y:
      print(i,k,m)
      exit()
print(-1,-1,-1)

Buggy submission (verdict: Runtime Error):
N,Y=map(int,input().split())
for i in range(N+1):
  for k range(N+1-i):
    int m = N-i-k
    if 10000*i + 5000*k + 1000*m == Y:
      print(i k m)
      exit()
print('-1' '-1' '-1')

Buggy submission (verdict: Runtime Error):
N = int(input())
money = int(input())
Y = money//(10**4)
H = money//(10**3)
N = money//(10**2)
for i in range(Y+1):
  for k in range(H+1):
    for m in range(N+1):
       if money = (10**4)*i +(10**3)*k+(10**2)*m:
          print(i,k,m,sep=" ")
Problem p03478 (python)

Fixed submission:
N,A,B=map(int,input().split())
E = 0
def ans(N):
  K = str(N)
  T = list(map(int,K))
  return (sum(T)) 
  
S = list(range(N+1))
for i in S:
  num = ans(S[i])
  if num >= A and num <= B:
    E += S[i]
print(E)

Buggy submission (verdict: Runtime Error):
N,A,B=map(int,input().split())
S = list(range(N+1).split(''))
print(S)
Problem p03494 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
count = 0
while True:
  for i in range(N):
    if A[i]%2 != 0:
      print(count)
      exit()
    A[i] /= 2
  count+=1

Buggy submission (verdict: Runtime Error):
htN = int(input())
A = map(int, input().split())
C=0
while True:
  for i in A:
    if A[i]%2 != 0:
        print(C)
        exit()
    A[i]/=2
    C+=1

Buggy submission (verdict: Runtime Error):
htN = int(input())
A = list(map(int, input().split()))
C=0
while True:
  for i in A:
    if A[i]%2 != 0:
        print(C)
        exit()
    A[i]/=2
    C+=1

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
C=0
while True:
  for i in A:
    if i%2 != 0::
        print(C)
        exit()
    A[i]/=2
    C+=1

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
C=0
while true:
  for i in A:
    if i%2 != 0::
        print(C)
        exit()
    A[i]/=2
    C+=1
Problem p02813 (python)

Fixed submission:
import sys
import itertools

N = int(sys.stdin.readline())
P = [int(v) for v in sys.stdin.readline().split()]
Q = [int(v) for v in sys.stdin.readline().split()]
Ps = [list(v) for v in itertools.permutations(range(1, N + 1),N)]
Ps = sorted(Ps)

def find(l1):
    for i, l3 in enumerate(Ps):
        if l3 == l1:
            return i
    return 0

print(abs(find(P) - find(Q)))

Buggy submission (verdict: Runtime Error):
import itertools

N = int(sys.stdin.readline())
P = [int(v) for v in sys.stdin.readline().split()]
Q = [int(v) for v in sys.stdin.readline().split()]
Ps = [list(v) for v in itertools.permutations(range(1, N + 1),N)]
Ps = sorted(Ps)

def find(l1):
    for i, l3 in enumerate(Ps):
        if l3 == l1:
            return i
    return 0


print(abs(find(P) - find(Q)))
Problem p02936 (python)

Fixed submission:
from sys import stdin,setrecursionlimit
input = stdin.readline
setrecursionlimit(1000000) 

N, Q = map(int, input().split())
T = [[] for _ in range(2 * (10 ** 5))]
for _ in range(N - 1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    T[a].append(b)
    T[b].append(a)

d = [0] * N

for _ in range(Q):
    p, x = map(int, input().split())
    d[p - 1] += x

def dfs(u, v):
    global d
    for p in T[u]:
        if p == v:
            continue
        d[p] += d[u]
        dfs(p, u)

dfs(0, -1)

for v in d:
    print(v)

Buggy submission (verdict: Runtime Error):

N, Q = map(int, input().split())
T = {}
for i in range(N - 1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    if a in T:
        T[a].append(b)
    else:
        T[a] = [b]
    if b in T:
        T[b].append(a)
    else:
        T[b] = [a]

d = [0] * N

for i in range(Q):
    p, x = map(int, input().split())
    d[p - 1] += x

def dfs(u, v = -1):
    global d
    if u in T:
        for p in T[u]:
            if p != v:
                d[p] += d[u]
                dfs(p, u)

dfs(0)


print(' '.join(map(str, d)))

Buggy submission (verdict: Runtime Error):

N, Q = map(int, input().split())
T = {}
for i in range(N - 1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    if a in T:
        T[a].append(b)
    else:
        T[a] = [b]
    if b in T:
        T[b].append(a)
    else:
        T[b] = [a]

d = [0] * N

for i in range(Q):
    p, x = map(int, input().split())
    d[p - 1] += x

def dfs(u, v = -1):
    if u in T:
        for p in T[u]:
            if p != v:
                d[p] += d[u]
                dfs(p, u)

dfs(0)


print(' '.join(map(str, d)))

Buggy submission (verdict: Runtime Error):
N, Q = map(int, input().split())
A = []
B = []

for i in range(N - 1):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

P = []
X = []
for i in range(Q):
    p, x = map(int, input().split())
    P.append(p)
    X.append(x)


T = {}
for i in range(len(A)):
    a = A[i]
    b = B[i]
    if a in T:
        T[a].append(b)
    else:
        T[a] = [b]

def subnode(n, l):
    l.append(n)
    if n in T:
        for n2 in T[n]:
            l = subnode(n2, l)
    return l

T2 = {}
for i in range(1, N + 1):
    T2[i] = subnode(i, [])

d = [0] * N

for i in range(len(P)):
    p = P[i]
    x = X[i]
    l = T2[p]
    for i in l:
        d[i - 1] += x


print(' '.join(map(str, d)))

Buggy submission (verdict: Runtime Error):

N, Q = map(int, input().split())
A = []
B = []

for i in range(N - 1):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

P = []
X = []
for i in range(Q):
    p, x = map(int, input().split())
    P.append(p)
    X.append(x)

T = {}
for i in range(len(A)):
    a = A[i]
    b = B[i]
    if a in T:
        T[a].append(b)
    else:
        T[a] = [b]

d = [0] * N

def inctree(p, x):
    d[p - 1] += x
    if p in T:
        l = T[p]
        for p2 in l:
            inctree(p2, x)

for i in range(len(P)):
    p = P[i]

    x = X[i]
    inctree(p, x)


print(' '.join(map(str, d)))
Problem p02947 (python)

Fixed submission:
import collections
import math

inp = int(input())
A = []
for a in range(inp):
    A.append(input())

def charcnt(s):
    cset = {}
    for c in s:
        if c in cset:
            cset[c] += 1
        else:
            cset[c] = 1
    sortedset = sorted(cset.items(), key=lambda x:x[0])
    s = ""
    for k, v in sortedset:
        s += k + str(v)
    return s

sorted = [charcnt(v) for v in A]    

def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result


counted = collections.Counter(sorted)
cnt = 0
for v in counted.values():
    if v > 1:
        cnt += cmb(v, 2)
print(int(cnt))

Buggy submission (verdict: Runtime Error):
import collections
import math

inp = int(input())
A = []
for a in range(inp):
    A.append(input())

def charcnt(s):
    cset = {}
    for c in s:
        if c in cset:
            cset[c] += 1
        else:
            cset[c] = 1
    sortedset = sorted(cset.items(), key=lambda x:x[0])
    s = ""
    for k, v in sortedset:
        s += k + str(v)
    return s

sorted = [charcnt(v) for v in A]    

counted = collections.Counter(sorted)
cnt = 0
for v in counted.values():
    if v > 1:
        cnt += math.factorial(v) / 2
print(int(cnt))
Problem p03160 (python)

Fixed submission:
N = int(input())

H = [int(v) for v in input().strip().split(' ')]

dp = [int(10 ** 10)] * N

dp[0] = 0
dp[1] = abs(H[0] - H[1])

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

print(dp[-1])

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

def jump(i):
    if i == 0:
        return 0
    a = abs(H[i] - H[i - 1]) + jump(i - 1)
    if i == 1:
        return a
    b = abs(H[i] - H[i - 2]) + jump(i - 2)
    return min(a, b)

print(jump(len(H) - 1))
Problem p03161 (python)

Fixed submission:
import sys
import numpy as np

N, K = [int(v) for v in input().strip().split(' ')]

H = np.array([int(v) for v in sys.stdin.readline().strip().split(' ')])

dp = np.zeros(N, dtype=int)

for i in range(1, N):
    st = max(0, i - K)
    dp[i] = min(dp[st : i] + np.abs(H[i] - H[st : i]))

print(dp[-1])

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

def memoize(f):
    cache = {}
    def helper(x):
        if x not in cache:
            cache[x] = f(x)
        return cache[x]
    return helper


@memoize
def jump(i):
    if i == 0:
        return 0
    mn = int(10 ** 9)
    for j in range(1, K + 1):
        if i - j >= 0:
            mn = min(mn, abs(H[i] - H[i - j]) + jump(i - j))
    return mn

print(jump(N - 1))
Problem p02922 (python)

Fixed submission:
A,B = map(int, input().split())
 
count = 1
while True:
    if B == 1 :
        print(0)
        break
    if B - A <= 0:
        print (count)
        break
    else:
        B = B - A + 1
        count += 1

Buggy submission (verdict: Runtime Error):
A,B = map(int, input().split())
 
count = 1
while True:
  	if B == 1 :
        print(0)
        break
    if B - A <= 0:
        print (count)
        break
    else:
        B = B - A + 1
        count += 1

Buggy submission (verdict: Runtime Error):
A,B = map(int, input().split())
 
count = 1
while True:
  	if B == 1 :
      print(0)
      break
    if B - A <= 0:
        print (count)
        break
    else:
        B = B - A + 1
        count += 1
Problem p02814 (python)

Fixed submission:
#%%
import fractions
def gcd_base(x, y):
    return fractions.gcd(x, y)

def gcd_list(l):
    tmp = l[0]
    for i in range(1, len(l)):
        tmp = gcd_base(tmp, l[i])
    return tmp

import fractions
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(l):
    tmp = l[0]
    for i in range(1, len(l)):
        tmp = lcm_base(tmp, l[i])
        if tmp > 10**9:
            tmp = -1
            break
    return tmp

n, m = map(int, input().split())
a = list(map(lambda x: int(x)//2 , input().split()))
f1 = True

lcm = lcm_list(a)
if lcm == -1:
    ans = 0
else:
    for i in range(n):
        if (lcm // a[i]) % 2 == 0:
            ans = 0 
            f1 = False
            break
    if f1:
        ans = (m + lcm) // (2 * lcm)
print(ans)

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

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

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

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)


n, m = map(int, input().split())
a = list(map(int, input().split()))
flag = True
ans = 0

for i in range(n):
    a[i] /= 2
tmp = int(gcd_list(a))
#print(tmp)
for i in range(n):
    a[i] //= tmp
    a[i] = int(a[i])
    if a[i] % 2 == 0:
        flag = False

if flag:
    tmp = lcm_list(a)
    ans = (m+tmp) // (2*tmp) 
else:
    ans = 0

print(ans)

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

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

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

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)


n, m = map(int, input().split())
a = list(map(int, input().split()))
flag = True
for i in range(n):
    if a[i] % 2 == 1:
        flag = False
ans = 0

for i in range(n):
    a[i] /= 2
tmp = int(gcd_list(a))
for i in range(n):
    a[i] //= tmp
    a[i] = int(a[i])
    if a[i] % 2 == 0:
        flag = False

if flag:
    tmp = lcm_list(a)
    ans = (m-tmp) // (2*tmp) + 1
else:
    ans = 0

print(ans)
Problem p02846 (python)

Fixed submission:
#%%
t1, t2 = map(int, input().split())
a1, a2 = map(int, input().split())
b1, b2 = map(int, input().split())

x = (a1-b1) * t1
y = x + (a2-b2) * t2
#print(x, y)

def p(x, y):
    if x%y == 0:
        return abs(x//y)
    else:
        return abs(x//y) + 1

if y == 0:
    ans = 'infinity'
else:
    if x%y != 0:
        if x < 0 and y > 0 :
            ans = (abs(x//y) + 1) * 2 - 3
        elif x > 0 and y < 0 :
            ans = (abs(x//y) + 1) * 2 - 3
        else:
            ans = 0
    else:
        if x < 0 and y > 0 :
            ans = (abs(x//y) + 1) * 2 - 2
        elif x > 0 and y < 0 :
            ans = (abs(x//y) + 1) * 2 - 2
        else:
            ans = 0


print(ans)

Buggy submission (verdict: Runtime Error):
#%%
t1, t2 = map(int, input().split())
a1, a2 = map(int, input().split())
b1, b2 = map(int, input().split())

x = (a1-b1) * t1
y = x + (a2-b2) * t2

if y == 0:
    ans = 'infinity'
else:
    if x < 0 and y > 0 :
        ans = (abs(x//y) + 1) * 2 - 3
    elif x > 0 and y < 0 :
        ans = (abs(x//y) + 1) * 2 - 3

print(ans)
Problem p02882 (python)

Fixed submission:
#%%
import math 

a, b, x = map(int, input().split())
if x == a*a*b:
    print(0)
elif x >= a*a*b/2:
    y = 2*(b-x/(a**2))
    ans = math.degrees(math.atan(a/y))
    print(90 - ans)
else:
    y = 2*(x/(a*b))
    ans = math.degrees(math.atan(y/b))
    print(90 - ans)

Buggy submission (verdict: Runtime Error):
#%%
import math 

a, b, x = map(int, input().split())
if x >= a*a*b/2:
    y = 2*(b-x/(a**2))
    ans = math.degrees(math.atan(a/y))
    print(90 - ans)
else:
    y = 2*(x/(a*b))
    ans = math.degrees(math.atan(y/b))
    print(90 - ans)

Buggy submission (verdict: Runtime Error):
#%%

#%%
n = int(input())

def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct

l = factorize(n)


import itertools
c = list(itertools.product(range(2), repeat=len(l)))
#print(c)

flag = False
k = 10**15
for i in range(len(c)):
    a = 1
    b = 1
    for j in range(len(c[i])):
        if c[i][j] == 0:
            a *= l[j]
        else:
            b *= l[j]
    k = min(k, a+b)
    

print(k-2)
Problem p02901 (python)

Fixed submission:
#%%
N, M = map(int, input().split())

a = [0] * M
b = [0] * M
c = [[] for _ in range(M)]
for i in range(M):
    a[i], b[i] = map(int, input().split())
    c[i] = list(map(int, input().split()))

inf = float('inf') 
cost = [inf] * (2**N)
cost[0] = 0

movement = []
for i in range(M):
    move = 0
    for j in range(len(c[i])):
        move += 2 ** (c[i][j]-1)
    movement.append(move)

for i in range(2**N):
    for j in range(M):
        move2 = movement[j] 
        if cost[i|move2] > cost[i]+a[j]:
            cost[i|move2] = cost[i]+a[j]

if cost[2**N-1] == inf:
    print(-1)
else:
    print(cost[2**N-1])

Buggy submission (verdict: Runtime Error):
#%%
N, M = map(int, input().split())

a = [0] * M
b = [0] * M
c = [[] for _ in range(M)]
for i in range(M):
    a[i], b[i] = map(int, input().split())
    c[i] = list(map(int, input().split()))

inf = float('inf') 
cost = [inf] * (2**N)
cost[0] = 0

movement = []
for i in range(M):
    move = 0
    for j in range(len(c[i])):
        move += 2 ** (c[i][j]-1)
    movement.append(move)

for i in range(2**N):
    for j in range(M):
        move2 = movement[j] 
        if cost[i|move2] < cost[i]+a[j]:
        cost[i|move2] = cost[i]+a[j]

if cost[2**N-1] == inf:
    print(-1)
else:
    print(cost[2**N-1])
Problem p02909 (python)

Fixed submission:
a = input()
if a == 'Sunny':
    ans = 'Cloudy'
elif a == 'Cloudy':
    ans = 'Rainy'
else:
    ans = 'Sunny'

print(ans)

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

dp = [[0] * n for _ in range(n)]
for i in range(n-1, -1, -1):
    for j in range(n-1, -1, -1):
        if s[i] == s[j]:
            if j+1 <= n-1 and i+1 <= n-1:
                dp[i][j] = dp[i+1][j+1] + 1
            else:
                dp[i][j] = 1
                
for i in range(n):
    for j in range(n):
        dp[i][j] = min(abs(i-j), dp[i][j])

ans = 0
for i in range(n):
    ans = max(ans, max(dp[i]))
print(ans)
Problem p02937 (python)

Fixed submission:
#%%

#%%
import bisect
s = list(input())
t = list(input())
alpha2num = lambda c: ord(c) - ord('a')
count = [0] * 26
count_t = [0] * 26
ind = [[] for _ in range(26)]
for i in range(len(s)):
    count[alpha2num(s[i])] += 1
    ind[alpha2num(s[i])].append(i)
for i in range(len(t)):
    count_t[alpha2num(t[i])] += 1

flag = True
for i in range(26):
    if count_t[i] >= 1 and count[i] == 0:
        flag = False

if flag:
    ans = 0
    tmp = -1
    i = 0
    while True:
        a = bisect.bisect_right(ind[alpha2num(t[i])], tmp)
        #print(i, tmp, a)
        if 0 <= a < count[alpha2num(t[i])]:
            tmp = ind[alpha2num(t[i])][a]
            i += 1
        else:
            tmp = -1
            ans += 1
        if i >= len(t):
            break
    ans = ans * len(s) + tmp + 1
    print(ans)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
alpha2num = lambda c: ord(c) - ord('a') 

s = list(input())
alpha = [[] for i in range(26)]
a = 'abcdefghijklmnopqrstuvwxyz'

for i in range(len(s)):
    alpha[alpha2num(s[i])].append(i)

#print(alpha)

t = list(input())
l = [0] * 26
ans = 0


s_unique = list(set(s))
t_unique = list(set(t))
check = 0

for i in t_unique:
    if i in s_unique:
        pass
    else:
        check = 1

if check == 0:

    for i in range(len(t)):
        if i == 0:
            last = alpha[alpha2num(t[i])][l[alpha2num(t[i])]]
        else:
            if l[alpha2num(t[i])] >= len(alpha[alpha2num(t[i])]):
                l = [0] * 26
                last = tmp
                ans += 1
            else:
                tmp = alpha[alpha2num(t[i])][l[alpha2num(t[i])]]
                l[alpha2num(t[i])] += 1
    #            print(tmp)
                if tmp < last:
                    l = [0] * 26
                    last = tmp
                    ans += 1
                else:
                    last = tmp

#    print(ans)
    print(max(ans * len(s) + tmp + 1, len(s)))

else:
    print(-1)

Buggy submission (verdict: Runtime Error):
alpha2num = lambda c: ord(c) - ord('a') 

s = list(input())
alpha = [[] for i in range(26)]
a = 'abcdefghijklmnopqrstuvwxyz'

for i in range(len(s)):
    alpha[alpha2num(s[i])].append(i)

#print(alpha)

t = list(input())
l = [0] * 26
ans = 0


s_unique = list(set(s))
t_unique = list(set(t))
check = 0

for i in t_unique:
    if i in s_unique:
        pass
    else:
        check = 1

if check == 0:

    for i in range(len(t)):
        if i == 0:
            last = alpha[alpha2num(t[i])][l[alpha2num(t[i])]]
        else:
            if l[alpha2num(t[i])] >= len(alpha[alpha2num(t[i])]):
                l = [0] * 26
                last = tmp
                ans += 1
            else:
                tmp = alpha[alpha2num(t[i])][l[alpha2num(t[i])]]
                l[alpha2num(t[i])] += 1
    #            print(tmp)
                if tmp < last:
                    l = [0] * 26
                    last = tmp
                    ans += 1
                else:
                    last = tmp

#    print(ans)
    print(ans * len(s) + tmp + 1)

else:
    print(-1)
Problem p02952 (python)

Fixed submission:
N = int(input())
l = len(str(N))
ans = 0

if l != 1:
    if l%2 == 0:
        for i in range(0, l, 2):
            ans += 9*(10**i)
    else:
        for i in range(0,l-2, 2):
            ans += 9*(10**i)
            #print(ans)
        ans += N - int('9'*(len(str(N))-1))
else:
    ans = N

print(ans)
#print(l)

Buggy submission (verdict: Runtime Error):
N = int(input())
l = len(str(N))
ans = 0

if l%2 == 0:
    for i in range(0, l, 2):
        ans += 9*(10**i)
else:
    for i in range(0,l-2, 2):
        ans += 9*(10**i)
        #print(ans)
    ans += N - int('9'*(len(str(N))-1))

print(ans)
#print(l)

Buggy submission (verdict: Runtime Error):
N = int(input())
l = len(str(N))
ans = 0

if l%2 == 0:
    for i in range(0, l, 2):
        ans += 9*(10**i)
else:
    for i in range(0,l-2, 2):
        ans += 9*(10**i)
        #print(ans)
    ans += N - int('9'*(len(str(N))-1))

print(ans)
#print(l)
Problem p02975 (python)

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

if len(a_unique) == 1 and a[0] == 0:
    ans = 'Yes'
elif len(a) % 3 == 0 :
    if len(a_unique) == 3:
        if bin(a_unique[0]) == bin(a_unique[1] ^ a_unique[2]) and bin(a_unique[1]) == bin(a_unique[0] ^ a_unique[2]) and bin(a_unique[2]) == bin(a_unique[1] ^ a_unique[0]) and a.count(a_unique[1]) == N//3 and a.count(a_unique[0]) == N//3 :
            ans = 'Yes'
        else:
            ans = 'No'
    elif len(a_unique) == 2:
        if a_unique[0] == 0 and a.count(a_unique[1]) == N//3 * 2:
            ans = 'Yes'
        else:
            ans = 'No'
    else:
        ans = 'No'
else:
    ans = 'No'

print(ans)

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

if len(d_unique) == 1:
    if d_unique[0] == 0:
        print('Yes')
    else:
        print('No')

else:
    if N%3 != 0 :
        print('No')

    else :
        if len(d_unique) == 2 :
            i1 = d_unique[0]
            i2 = d_unique[1]
            len_i1 = d.count(i1)
            len_i2 = d.count(i2)
            if len_i1 ==  N/3 and i1 & i2 & i2 = 0:
                print('Yes')
            elif len_i2 ==  N/3 and i1 & i1 & i2 != 0:
                print('Yes')                
            else :
                print('No')

        elif len(d_unique) == 3 :
            i1 = d_unique[0]
            i2 = d_unique[1]
            i3 = d_unique[2]
            len_i1 = d.count(i1)
            len_i2 = d.count(i2)
            len_i3 = d.count(i3)
            if i1 & i2 & i3 != 0:
                print('No')     
            else:
                if len_i1 ==  N/3 and len_i2 == N/3 :
                    print('Yes')
                else :
                    print('No')

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

if len(d_unique) == 1:
    if d_unique[0] == 0:
        print('Yes')
    else:
        print('No')

else:
    if N%3 != 0 :
        print('No')

    else :
        if len(d_unique) == 2 :
            i1 = d_unique[0]
            i2 = d_unique[1]
            len_i1 = d.count(i1)
            len_i2 = d.count(i2)
            if len_i1 ==  N/3 and i1 & i2 & i2 = 0: :
                print('Yes')
            elif len_i2 ==  N/3 and i1 & i1 & i2 != 0: :
                print('Yes')                
            else :
                print('No')

        elif len(d_unique) == 3 :
            i1 = d_unique[0]
            i2 = d_unique[1]
            i3 = d_unique[2]
            len_i1 = d.count(i1)
            len_i2 = d.count(i2)
            len_i3 = d.count(i3)
            if i1 & i2 & i3 != 0:
                print('No')     
            else:
                if len_i1 ==  N/3 and len_i2 == N/3 :
                    print('Yes')
                else :
                    print('No')
Problem p02981 (python)

Fixed submission:
d = list(map(int, input().split()))
N = d[0]
A = d[1]
B = d[2]

if N*A >= B :
    print(B)
else:
    print(N*A)

Buggy submission (verdict: Runtime Error):
d = list(map(int, input().split()))
N = d[0]
A = d[1]
B = d[2]

if N*A >= B :
    return(B)
else:
    return(N*A)

Buggy submission (verdict: Runtime Error):
d = list(map(int, input().split()))
N = d[0]
A = d[1]
B = d[2]

if N*A >= B :
    return(N*A)
else:
    return(B)