Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
# input data
n=int(input())
u=[]
v=[]
w=[]
for i in range(0,n-1):
	ui,vi,wi = map(int, input().split())
	u.append(ui)
	v.append(vi)
	w.append(wi%2)


# solve
ans=[]
for i in range(0,n+1):
	ans.append(-1)

_neighbors=[]
for i in range(0,n+1):
	_neighbors.append([])

for i in range(0,n-1):
	_neighbors[u[i]].append([v[i], w[i]])
	_neighbors[v[i]].append([u[i], w[i]])

# paint v with c=0,1 and its neighbors
def bfs(u,c):
	if ans[u] != -1:
		return

	ans[u] = c

	for vw in _neighbors[u]:
		if vw[1] == 0:
			bfs(vw[0],c)
		else:
			bfs(vw[0],1-c)

bfs(1,0)

for i in range(1,n+1):
	print(ans[i])


Fixed submission:
import sys

sys.setrecursionlimit(100000)

# input data
n=int(input())
u=[]
v=[]
w=[]
for i in range(0,n-1):
	ui,vi,wi = map(int, input().split())
	u.append(ui)
	v.append(vi)
	w.append(wi%2)


# solve
ans=[]
for i in range(0,n+1):
	ans.append(-1)

_neighbors=[]
for i in range(0,n+1):
	_neighbors.append([])

for i in range(0,n-1):
	_neighbors[u[i]].append([v[i], w[i]])
	_neighbors[v[i]].append([u[i], w[i]])

# paint v with c=0,1 and its neighbors
def bfs(u,c):
	if ans[u] != -1:
		return

	ans[u] = c

	for vw in _neighbors[u]:
		if vw[1] == 0:
			bfs(vw[0],c)
		else:
			bfs(vw[0],1-c)

bfs(1,0)

for i in range(1,n+1):
	print(ans[i])

Buggy python submission (verdict: Runtime Error):
# input data
n=int(input())
u=[]
v=[]
w=[]
for i in range(0,n-1):
	ui,vi,wi = map(int, input().split())
	u.append(ui)
	v.append(vi)
	w.append(wi%2)


# solve
ans=[]
for i in range(0,n+1):
	ans.append(-1)

_neighbors=[]
for i in range(0,n+1):
	_neighbors.append([])

for i in range(0,n-1):
	_neighbors[u[i]].append([v[i], w[i]])
	_neighbors[v[i]].append([u[i], w[i]])

# paint v with c=0,1 and its neighbors
def bfs(u,c):
	if ans[u] != -1:
		return

	ans[u] = c

	for vw in _neighbors[u]:
		if vw[1] == 0:
			bfs(vw[0],c)
		else:
			bfs(vw[0],1-c)

bfs(1,0)

print(ans)



Fixed submission:
import sys

sys.setrecursionlimit(100000)

# input data
n=int(input())
u=[]
v=[]
w=[]
for i in range(0,n-1):
	ui,vi,wi = map(int, input().split())
	u.append(ui)
	v.append(vi)
	w.append(wi%2)


# solve
ans=[]
for i in range(0,n+1):
	ans.append(-1)

_neighbors=[]
for i in range(0,n+1):
	_neighbors.append([])

for i in range(0,n-1):
	_neighbors[u[i]].append([v[i], w[i]])
	_neighbors[v[i]].append([u[i], w[i]])

# paint v with c=0,1 and its neighbors
def bfs(u,c):
	if ans[u] != -1:
		return

	ans[u] = c

	for vw in _neighbors[u]:
		if vw[1] == 0:
			bfs(vw[0],c)
		else:
			bfs(vw[0],1-c)

bfs(1,0)

for i in range(1,n+1):
	print(ans[i])
Buggy python submission (verdict: Time Limit Exceeded):
# input
n, k = list(map(int, input().split()))
s = input()

# solve

##. number of consecutive 0 groups and 1 groups
##. ex:
##.  s = '11101010110011'
##.       0: 0, 0, 0, 00
##.       1: 111, 1, 1, 11, 11
##.  zeros = [1, 1, 1, 2]
##.  ones = [3, 1, 1, 2, 2]
##.   (always count the edges of s as 1)
zeros = []
ones = []
_c = '1'
count = 0
for c in s:
	if _c == c:
		count += 1
	else:
		if _c == '0':
			zeros.append(count)
		else:
			ones.append(count)
		_c = c
		count = 1

if c == '0':
	zeros.append(count)
	ones.append(0)
else:
	ones.append(count)

if len(zeros) <= k:
	## flip all 0's
	ans = len(s)
else:
  ## flip k consecutive zero groups
  ans = 0
  i = 0
  while i + k <= len(zeros):
	  _ans = sum(zeros[i:i+k]) + sum(ones[i:i+k+1])
	  ans = max(ans, _ans)
	  i += 1

print(ans)

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

# solve

##. number of consecutive 0 groups and 1 groups
##. ex:
##.  s = '11101010110011'
##.       0: 0, 0, 0, 00
##.       1: 111, 1, 1, 11, 11
##.  zeros = [1, 1, 1, 2]
##.  ones = [3, 1, 1, 2, 2]
##.   (always count the edges of s as 1)
zeros = []
ones = []
_c = '1'
count = 0
for c in s:
	if _c == c:
		count += 1
	else:
		if _c == '0':
			zeros.append(count)
		else:
			ones.append(count)
		_c = c
		count = 1

if c == '0':
	zeros.append(count)
	ones.append(0)
else:
	ones.append(count)

if len(zeros) <= k:
	## flip all 0's
	ans = len(s)
else:
  ## flip k consecutive zero groups
  ans = 0

  i = 0
  _ans = sum(zeros[i:i+k]) + sum(ones[i:i+k+1])
  ans = _ans

  i = 1
  while i + k <= len(zeros):
#	  _ans = sum(zeros[i:i+k]) + sum(ones[i:i+k+1])
	  _ans += zeros[i+k-1] - zeros[i-1] + ones[i+k] - ones[i-1]
	  ans = max(ans, _ans)
	  i += 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# input data
n = int(input())
b = list(map(int, input().split()))

# solve
ans = []

# check if _b can be constructed.
# returns True/False
def dfs(_b, _ans):
	
	for i in range(0, len(_b)):
		
		if i + 1 == _b[i]:
			_b2 = _b[:]
			_ans2 = _ans[:]
			_ans2.append(_b2[i])
			_b2.pop(i)
			
			if dfs(_b2, _ans2) == True:
				return True
	
	if len(_b) == 0:
		## print answer
		_ans.reverse()
		for i in _ans:
			print(i)
		return True
		
	else:
		return False


if not dfs(b,[]):
	print(-1)

Fixed submission:
# input data
n = int(input())
b = list(map(int, input().split()))

# solve
ans = []

# necessary condition
def cond(_b):
	hist = [0]*(len(_b)+1)
	
	for i in range(0, len(_b)):
		if _b[i] > i + 1:
			return False
	
	return True

# check if _b can be constructed.
# returns True/False
def dfs(_b, _ans):
	
	if not cond(_b):
		return False
	
	for i in range(0, len(_b)):
		
		if i + 1 == _b[i]:
			_b2 = _b[:]
			_ans2 = _ans[:]
			_ans2.append(_b2[i])
			_b2.pop(i)
			
			if dfs(_b2, _ans2) == True:
				return True
	
	if len(_b) == 0:
		## print answer
		_ans.reverse()
		for i in _ans:
			print(i)
		return True
		
	else:
		return False


if not dfs(b,[]):
	print(-1)
Buggy python submission (verdict: Runtime Error):
# import sys
# sys.setrecursionlimit(10**5)
# from collections import defaultdict
geta = lambda fn: list(map(fn, input().split()))
gete = lambda fn: fn(input())

def main():
    N = gete(int)

    cur, prev = [0]*3, [0]*3

    for _ in range(N):
        a, b, c = geta(int)
        prev, cur = cur, prev
        cur[0] = max(prev[1], prev[2]) + a
        cur[1] = max(prev[2], prev[0]) + b
        cur[2] = max(prev[0], prev[1]) + c


    print(max(cur))

if __name__ == "__main__":
    main()

Fixed submission:
# dp[i]:  minimum possible total cost to reach Stone i.
# dp[1] = 0
# dp[2] = |h[2]-h[1]|
# dp[i+2] = min{ dp[i] + |h[i]-h[i+2]|,  dp[i+1] + |h[i+1]-h[i+2]| }
# dp[0] = INF, h[0] = INF

INF = 10**9

N, K = map(int, input().split())
h = [INF] + list(map(int, input().split()))

dp = [INF]*(N+1)
dp[1] = 0

for i in range(1, N+1):
    for j in range(1, K+1):
        if i+j > N:
            break

        tmp = dp[i] + abs(h[i] - h[i+j])

        if tmp < dp[i+j]:
            dp[i+j] = tmp

print(dp[N])

Buggy python submission (verdict: Time Limit Exceeded):
# import sys
# sys.setrecursionlimit(10**5)
# from collections import defaultdict
geta = lambda fn: list(map(fn, input().split()))
gete = lambda fn: fn(input())

def main():
    N, K = geta(int)
    h = geta(int)

    INF = 1 << 60
    dp = [INF for _ in range(N)]
    dp[0], dp[1] = 0, abs(h[0] - h[1])

    for i in range(2, N):
        lb = i - K if i > K else 0
        for j in range(lb, i):
            tmp = dp[j] + abs(h[j] - h[i])
            if tmp < dp[i]:
                dp[i] = tmp

    print(dp[N - 1])

if __name__ == "__main__":
    main()

Fixed submission:
# dp[i]:  minimum possible total cost to reach Stone i.
# dp[1] = 0
# dp[2] = |h[2]-h[1]|
# dp[i+2] = min{ dp[i] + |h[i]-h[i+2]|,  dp[i+1] + |h[i+1]-h[i+2]| }
# dp[0] = INF, h[0] = INF

INF = 10**9

N, K = map(int, input().split())
h = [INF] + list(map(int, input().split()))

dp = [INF]*(N+1)
dp[1] = 0

for i in range(1, N+1):
    for j in range(1, K+1):
        if i+j > N:
            break

        tmp = dp[i] + abs(h[i] - h[i+j])

        if tmp < dp[i+j]:
            dp[i+j] = tmp

print(dp[N])

Buggy python submission (verdict: Time Limit Exceeded):
# import sys
# sys.setrecursionlimit(10**5)
# from collections import defaultdict
geta = lambda fn: list(map(fn, input().split()))
gete = lambda fn: fn(input())

N, K = geta(int)
h = geta(int)

INF = 1 << 60
dp = [INF] * N
dp[0], dp[1] = 0, abs(h[0] - h[1])

for i in range(2, N):
    lb = i - K if i > K else 0
    dp[i] = min([dp[j] + abs(h[j] - h[i]) for j in range(lb, i)])

print(dp[N - 1])


Fixed submission:
# dp[i]:  minimum possible total cost to reach Stone i.
# dp[1] = 0
# dp[2] = |h[2]-h[1]|
# dp[i+2] = min{ dp[i] + |h[i]-h[i+2]|,  dp[i+1] + |h[i+1]-h[i+2]| }
# dp[0] = INF, h[0] = INF

INF = 10**9

N, K = map(int, input().split())
h = [INF] + list(map(int, input().split()))

dp = [INF]*(N+1)
dp[1] = 0

for i in range(1, N+1):
    for j in range(1, K+1):
        if i+j > N:
            break

        tmp = dp[i] + abs(h[i] - h[i+j])

        if tmp < dp[i+j]:
            dp[i+j] = tmp

print(dp[N])
Buggy python submission (verdict: Runtime Error):
# import sys
# sys.setrecursionlimit(10**5)
# from collections import defaultdict
geta = lambda fn: list(map(fn, input().split()))
gete = lambda fn: fn(input())

N = gete(int)

cur = [0] * 3

for _ in range(N):
    a, b, c = geta(int)
    prev = cur.copy()
    cur[0] = max(prev[1], prev[2]) + a
    cur[1] = max(prev[2], prev[0]) + b
    cur[2] = max(prev[0], prev[1]) + c

print(max(cur))


Fixed submission:
N = int(input())
act = []
for _ in range(N):
    act.append(tuple(map(int, input().split())))

dp = [[0]*3 for _ in range(N)]

for i in range(3):
    dp[0][i] = act[0][i]

for i in range(1, N):
    for j in range(3):
        dp[i][j] = max(dp[i-1][(j+1) % 3], dp[i-1][(j+2) % 3]) + act[i][j]


print(max(dp[N-1]))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline


def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


def main():
    s = gete()
    t = gete()

    dp = [[""] * (len(t) + 1) for _ in range(len(s) + 1)]

    for i, si in enumerate(s):
        for j, tj in enumerate(t):
            if si == tj:
                dp[i + 1][j + 1] = dp[i][j] + si
            else:
                x, y = dp[i][j + 1], dp[i + 1][j]
                dp[i + 1][j + 1] = x if len(x) > len(y) else y

    print(dp[len(s)][len(t)])


if __name__ == "__main__":
    main()

Fixed submission:
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline


def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


def main():
    s = gete()
    t = gete()
    ans = ""

    dp = [[0] * (len(t) + 1) for _ in range(len(s) + 1)]

    for i, si in enumerate(s):
        for j, tj in enumerate(t):
            if si == tj:
                dp[i + 1][j + 1] = dp[i][j] + 1
            else:
                dp[i + 1][j + 1] = max(dp[i][j + 1], dp[i + 1][j])

    i, j = len(s), len(t)

    ans_r = ""
    while i > 0 and j > 0:
        if s[i - 1] == t[j - 1]:
            ans_r += s[i - 1]
            i -= 1
            j -= 1
        elif dp[i - 1][j] == dp[i][j]:
            i -= 1
        else:
            j -= 1

    print(ans_r[::-1])


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10**8)


def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


def main():
    N = gete(int)
    # p = tuple(geta(lambda s: int(s.decode()[2:])))
    p = tuple(geta(float))

    cur = [0] * (N + 1)
    cur[0] = 1

    for i, pi in enumerate(p, 1):
        upd = [0] * (N + 1)
        qi = 1 - pi

        upd[0] = cur[0] * qi
        for j in range(1, i + 1):
            upd[j] = cur[j - 1] * pi + cur[j] * qi
        cur = upd

    print(sum(cur[N // 2 + 1:]))


if __name__ == "__main__":
    main()

Fixed submission:
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10**8)


def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


def main():
    N = gete(int)
    # p = tuple(geta(lambda s: int(s.decode()[2:])))
    p = tuple(geta(float))

    dp = [[0] * (i + 2) for i in range(N + 1)]
    dp[0][0] = 1

    for i, pi in enumerate(p, 1):
        qi = 1 - pi
        dpi = dp[i]
        dpi1 = dp[i - 1]

        dpi[0] = dpi1[0] * qi

        for j in range(1, i + 1):
            dpi[j] = dpi1[j - 1] * pi + dpi1[j] * qi

    print(sum(dp[N][N // 2 + 1:]))


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
from typing import List


class Solution:

    def solve(self, N: int, M: int, cakes) -> int:

        sign = []
        for i in [1, -1]:
            for j in [1, -1]:
                for k in [1, -1]:
                    sign.append((i, j, k))

        def sumprod(c, s):
            ret = 0
            for i in range(len(c)):
                ret += c[i] * s[i]
            return ret

        candidates = []
        for s in sign:
            cakes = sorted(cakes, key=lambda c: sumprod(c, s))

            xyz = [0, 0, 0]
            for i in range(M):
                for j in range(3):
                    xyz[j] += cakes[i][j]

            candidates.append(
                sum([abs(xyz_) for xyz_ in xyz])
            )

        return max(candidates)


if __name__ == '__main__':

    # standard input
    N, M = map(int, input().split())
    cakes = []
    for i in range(N):
        cakes.append(tuple(map(int, input().split())))

    # solve
    solution = Solution()
    print(solution.solve(N, M, cakes))


Fixed submission:
class Solution:

    def solve(self, N: int, M: int, cakes) -> int:

        sign = []
        for i in [1, -1]:
            for j in [1, -1]:
                for k in [1, -1]:
                    sign.append((i, j, k))

        def sumprod(c, s):
            ret = 0
            for i in range(len(c)):
                ret += c[i] * s[i]
            return ret

        candidates = []
        for s in sign:
            cakes = sorted(cakes, key=lambda c: sumprod(c, s))

            xyz = [0, 0, 0]
            for i in range(M):
                for j in range(3):
                    xyz[j] += cakes[i][j]

            candidates.append(
                sum([abs(xyz_) for xyz_ in xyz])
            )

        return max(candidates)


if __name__ == '__main__':

    # standard input
    N, M = map(int, input().split())
    cakes = []
    for i in range(N):
        cakes.append(tuple(map(int, input().split())))

    # solve
    solution = Solution()
    print(solution.solve(N, M, cakes))
Buggy python submission (verdict: Runtime Error):
import math

n = int(input())
t = []
for _ in range(n):
    t.append(int(input()))

ans = t[0]
for ti in t:
    ans = ans * ti // math.gcd(ans, ti)


print(ans)


Fixed submission:
import fractions

n = int(input())
t = []
for _ in range(n):
    t.append(int(input()))

ans = t[0]
for ti in t:
    ans = ans * ti // fractions.gcd(ans, ti)


print(ans)
Buggy python submission (verdict: Runtime Error):
, b, c, d = map(int, input().split())

print(max(a*b, c*d))

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

print(max(a*b, c*d))
Buggy python submission (verdict: Runtime Error):
if X>=30:
  print('Yes')
else:
  print('No')


Fixed submission:
n = int(input())
if n >= 30:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
n = int(input()).
if n>=30:
  print("Yes")
else:
  print("No")



Fixed submission:
n = int(input())
if n >= 30:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
N=int(input())
D=int(input())
ans = 0
i=1
while i<=N:
  i+=1
  X=int(input())
  Y=int(input())
  if X * X + Y * Y <= D * D:
    ans += 1
print(ans)


Fixed submission:
N, D = map(int,input().split())
ans = 0
i = 1
while i <= N:
  i += 1
  X, Y = map(int,input().split())
  
  if X * X + Y * Y <= D * D:
    ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
N=int(input())
D=int(input())
ans = 0
for i in range(1,N):
  X=int(input())
  Y=int(input())
  if X * X + Y * Y <= D * D:
    ans += 1
print(ans)

Fixed submission:
N, D = map(int,input().split())
ans = 0
i = 1
while i <= N:
  i += 1
  X, Y = map(int,input().split())
  
  if X * X + Y * Y <= D * D:
    ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
read N, D as int
ans = 0
for i = 1, ..., N:
	read X, Y as int
	if X * X + Y * Y <= D * D:
		ans += 1
 write ans


Fixed submission:
N, D = map(int,input().split())
ans = 0
i = 1
while i <= N:
  i += 1
  X, Y = map(int,input().split())
  
  if X * X + Y * Y <= D * D:
    ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
b=int(input())
count=1
i=1
while i<=n:
  p = int(input())
  q = int(input())  
  r = abs(complex(p,q))
  a=int(r)
  i+=1
if a==b:
  count+=1
print(count)

Fixed submission:
N, D = map(int,input().split())
ans = 0
i = 1
while i <= N:
  i += 1
  X, Y = map(int,input().split())
  
  if X * X + Y * Y <= D * D:
    ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
x = int(input())
i = 1
n= 0
if x % 2 == 0 or x % 5 == 0:
    print(-1)
else:
    for i in range(1, 1000000):

        l = 7 * (10**i - 1) // 9
        n+=1
        if l % x == 0:
            break
    print(n)


Fixed submission:
k = int(input())
a=0
for i in range (1,10**6):
    a=10*a+7
    a%=k
    if a==0:
      ans=i
      break;
    else:
      ans=-1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
x = int(input())
i = 1
n= 0
if x % 2 == 0:
    print(-1)
else:
    for i in range(1, 1000000):

        l = 7 * (10**i - 1) // 9
        n+=1
        if l % x == 0:
            break
    print(n)


Fixed submission:
k = int(input())
a=0
for i in range (1,10**6):
    a=10*a+7
    a%=k
    if a==0:
      ans=i
      break;
    else:
      ans=-1
print(ans)
Buggy python submission (verdict: Runtime Error):
s = str(input())
s=s.lower(s)

if s.find('rr') != -1:
    print("2")
elif s.find('r') !=-1:
    print("1")
else :
    print ("0")


Fixed submission:
s = str(input())
s=s.lower()

if s=="rrr":
    print('3')
elif s.find('rr') != -1:
    print("2")
elif s.find('r') != -1:
    print("1")
else:
    print ("0")

Buggy python submission (verdict: Runtime Error):


s=input()
s=s.trim()
if s=="rrs" or s=="srr":
    print("2")
elif s=="rrr":
    print("3")
elif s=="sss":
    print('0')
else:
    print('1')


Fixed submission:
s = str(input())
s=s.lower()

if s=="rrr":
    print('3')
elif s.find('rr') != -1:
    print("2")
elif s.find('r') != -1:
    print("1")
else:
    print ("0")

Buggy python submission (verdict: Runtime Error):

s=input()
s=s.trim()
if s=="rrs" || s=="srr":
    print("2")
else if s=="rrr":
    print("3")
else if s=="sss":
    print('0')
else:
    print('1')


Fixed submission:
s = str(input())
s=s.lower()

if s=="rrr":
    print('3')
elif s.find('rr') != -1:
    print("2")
elif s.find('r') != -1:
    print("1")
else:
    print ("0")
Buggy python submission (verdict: Runtime Error):

n,m = map(int,input().split())
import math
def c(n,k):
    return math.factorial(n)//math.factorial(k)//math.factorial(n-k)

print(c(n,2) + c(m,2))

Fixed submission:

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

print(n*(n-1)//2 + m*(m-1)//2)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

import copy

from collections import Counter


ans = [0] * n
for i in range(n):
    b = Counter(a)
    b[a[i]] -= 1
    for w,v in b.items():
        if v >= 2:
            ans[i] += v*(v-1)//2

print(*ans)


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

import copy

from collections import Counter


ans = [0] * n
b = Counter(a)
sm = 0
for i,j in b.items():
    if j >= 2:
        sm += j*(j-1)//2

for i in range(n):
    ans[i] = sm - b[a[i]] + 1
print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

import copy

from collections import Counter


ans = [0] * n
for i in range(n):
    b = Counter(a)
    b[a[i]] -= 1
    for w,v in b.items():
        if v >= 2:
            ans[i] += v*(v-1)//2

print(*ans)


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

import copy

from collections import Counter


ans = [0] * n
b = Counter(a)
sm = 0
for i,j in b.items():
    if j >= 2:
        sm += j*(j-1)//2

for i in range(n):
    ans[i] = sm - b[a[i]] + 1
print(*ans)
Buggy python submission (verdict: Runtime Error):
import math
a,b,c = map(int, input().split())

ans = 'No'

ans = 'Yes' if a+b+2*math.sqrt(a*b)<c else ans
print(ans)

Fixed submission:
import math
# import bisect
# import heapq
# from copy import deepcopy
# from collections import deque
# from collections import Counter
# from itertools import accumulate
# from itertools import permutations
# import numpy as np

# n,k = map(int, input().split())
# n = int(input())
# p = list(map(int, input().split()))

a =[ 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(a[k-1])
Buggy python submission (verdict: Runtime Error):
n, w = map(int, input().split())


if n == 1 or w == 1: 
    ans = 1
elif n % 2 == 0 or w % 2 == 0:
    ans = int((n * w) / 2.)

else:
    ans = int((n * w) / 2.) + 1

print(ans)

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


if n == 1 or w == 1: 
    ans = 1
elif n % 2 == 0 or w % 2 == 0:
    ans = int((n * w) / 2.)

else:
    ans = int((n * w) / 2.) + 1

print(ans)

Buggy python submission (verdict: Runtime Error):

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

if n % 2 == 0 or w % 2 == 0:
    ans = int((n * w) / 2.)

else : ans = int((n * w) / 2.) + 1

print(ans)

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


if n == 1 or w == 1: 
    ans = 1
elif n % 2 == 0 or w % 2 == 0:
    ans = int((n * w) / 2.)

else:
    ans = int((n * w) / 2.) + 1

print(ans)

Buggy python submission (verdict: Runtime Error):
n,w = map(long, input().split())
ans = (n * w) // 2 + 1
 
if n % 2 == 0 or w % 2 == 0:
    ans = (n * w) // 2
print(ans)

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


if n == 1 or w == 1: 
    ans = 1
elif n % 2 == 0 or w % 2 == 0:
    ans = int((n * w) / 2.)

else:
    ans = int((n * w) / 2.) + 1

print(ans)

Buggy python submission (verdict: Runtime Error):
# import bisect
# import heapq
# from copy import deepcopy
# from collections import deque
# from collections import Counter
# from itertools import accumulate
# from itertools import permutations
# import numpy as np
import math
a,b,c = map(float, input().split())
# n = int(input())
# p = list(map(int, input().split()))


ans = 'Yes' if a + b + (2 * math.sqrt(a * b)) < c else 'No'

print(ans)


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


if n == 1 or w == 1: 
    ans = 1
elif n % 2 == 0 or w % 2 == 0:
    ans = int((n * w) / 2.)

else:
    ans = int((n * w) / 2.) + 1

print(ans)