Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n=int(input())
T=[int(input()) for _ in range(n)]
T.sort(reverse=True)

def gcd(x,y):
    if x<y:
        x,y=y,x
    if y==0:
        return x
    return gcd(y, x%y)

ans=int(T[0]/gcd(T[0], T[1]))*T[1]
for i in range(2, n):
    ans=int(T[i]/gcd(ans,T[i]))*ans

print(ans)

Fixed submission:
import numpy as np
n=int(input())
T=np.array([int(input()) for _ in range(n)], dtype=np.int64)

def gcd(x,y):
    if x<y:
        x,y=y,x
    if y==0:
        return x
    return gcd(y, x%y)

ans=1
for t in T:
    ans*=t//gcd(t, ans)

print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
T=[int(input()) for _ in range(n)]
T.sort(reverse=True)

def gcd(x,y):
    if x<y:
        x,y=y,x
    if y==0:
        return x
    return gcd(y, x%y)

ans=int(T[0]/gcd(T[0], T[1]))*T[1]
for i in range(2, n):
    ans=int(T[i]/gcd(ans,T[i]))*ans

print(ans)

Fixed submission:
import numpy as np
n=int(input())
T=np.array([int(input()) for _ in range(n)], dtype=np.int64)

def gcd(x,y):
    if x<y:
        x,y=y,x
    if y==0:
        return x
    return gcd(y, x%y)

ans=1
for t in T:
    ans*=t//gcd(t, ans)

print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
T=[int(input()) for _ in range(n)]

def gcd(x,y):
    if x<y:
        x,y=y,x
    if y==0:
        return x
    return gcd(y, x%y)

ans=1
for t in T:
    g=gcd(ans, t)
    ans=int(ans*t/g)

print(ans)

Fixed submission:
import numpy as np
n=int(input())
T=np.array([int(input()) for _ in range(n)], dtype=np.int64)

def gcd(x,y):
    if x<y:
        x,y=y,x
    if y==0:
        return x
    return gcd(y, x%y)

ans=1
for t in T:
    ans*=t//gcd(t, ans)

print(ans)
Buggy python submission (verdict: Runtime Error):
rgb=list(input())
rgb = int("".join(rgb))
if rgb%4==0:
  print("YES")
else:
  print("NO")

Fixed submission:
a=list(input().split())
n=int("".join(a))
if n%4==0:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
h,w=map(int,input().split())
pic=[["#" for i in range(w+2)]]
for i in range(h):
  s=list(input())
  s="#"+s+"#"
  pic.append(s)
pic.append(["#" for i in range(w+2)])

for i in pic:
  print("".join(i))

Fixed submission:
h,w=map(int,input().split())
pic=[["#" for i in range(w+2)]]
for i in range(h):
  s=list(input())
  s=["#"]+s+["#"]
  pic.append(s)
pic.append(["#" for i in range(w+2)])

for i in pic:
  print("".join(i))
Buggy python submission (verdict: Time Limit Exceeded):
mod=10**9+7
n, m=map(int,input().split())
x=tuple(map(int,input().split()))
y=tuple(map(int,input().split()))

lx=[]
for i in range(0, n-1):
    for j in range(i, n):
        lx.append(x[j]-x[i])
ly=[]
for i in range(0, m-1):
    for j in range(i, m):
        ly.append(y[j]-y[i])

ans=0
for i in lx:
    for j in ly:
        ans+=i*j
        ans%=mod
print(ans)

Fixed submission:
mod=10**9+7
n, m=map(int,input().split())
x=tuple(map(int,input().split()))
y=tuple(map(int,input().split()))

lx, ly=0, 0
for i in range(n):
    lx+= i*x[i]-(n-i-1)*x[i]
    lx%=mod
for i in range(m):
    ly+= i*y[i]-(m-i-1)*y[i]
    ly%=mod

print((lx*ly)%mod)

Buggy python submission (verdict: Time Limit Exceeded):
mod=10**9+7
n, m=map(int,input().split())
x=tuple(map(int,input().split()))
y=tuple(map(int,input().split()))

lx=[]
for i in range(0, n-1):
    for j in range(i, n):
        lx.append(x[j]-x[i])
ly=[]
for i in range(0, m-1):
    for j in range(i, m):
        ly.append(y[j]-y[i])

ans=0
for i in lx:
    for j in ly:
        ans+=i*j
        ans%=mod
print(ans)

Fixed submission:
mod=10**9+7
n, m=map(int,input().split())
x=tuple(map(int,input().split()))
y=tuple(map(int,input().split()))

lx, ly=0, 0
for i in range(n):
    lx+= i*x[i]-(n-i-1)*x[i]
    lx%=mod
for i in range(m):
    ly+= i*y[i]-(m-i-1)*y[i]
    ly%=mod

print((lx*ly)%mod)
Buggy python submission (verdict: Runtime Error):
n=int(input())
S=input()

ans=[0]*(n+1)
for i,s in S:
  if s=="I":
    ans[i+1]=ans[i]+1
  elif s=="D":
    ans[i+1]=ans[i]-1

print(max(ans))

Fixed submission:
n=int(input())
S=input()

ans=[0]*(n+1)
for i,s in enumerate(S):
  if s=="I":
    ans[i+1]=ans[i]+1
  elif s=="D":
    ans[i+1]=ans[i]-1

print(max(ans))
Buggy python submission (verdict: Time Limit Exceeded):
k,s=map(int,input().split())

val=list(range(0, k+1))
n=len(val)
ans=0

for i in range(n):
    if val[i]>s:
        break
    for j in range(n):
        if val[i]+val[j]>s:
            break
        if s-(val[i]+val[j]) in val:
            ans+=1
            continue
print(ans)


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

ans=0
for x in range(0, k+1):
    if x>s:
        break
    for y in range(0, k+1):
        if x+y>s:
            break
        z=s-x-y
        if 0<=z and z<=k:
            ans+=1
            continue
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
k,s=map(int,input().split())

val=list(range(0, k+1))[::-1]
n=len(val)
ans=0

for i in range(n):
    if val[i]>s:
        continue
    for j in range(n):
        if val[i]+val[j]>s:
            continue
        for k in range(n):
            if val[i]+val[j]+val[k]==s:
                ans+=1
                break
print(ans)


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

ans=0
for x in range(0, k+1):
    if x>s:
        break
    for y in range(0, k+1):
        if x+y>s:
            break
        z=s-x-y
        if 0<=z and z<=k:
            ans+=1
            continue
print(ans)
Buggy python submission (verdict: Runtime Error):
s=input()[::-1]

phrase=("dream"[::-1],
        "dreamer"[::-1],
        "erase"[::-1],
        "eraser"[::-1])


def dayDream(word):
    if word[:7] in phrase:
        return dayDream(word[7:])
    elif word[:6] in phrase:
        return dayDream(word[6:])
    elif word[:5] in phrase:
        return dayDream(word[5:])
    
    if len(word)==0:
        return True
    else:
        return False

print("YES") if dayDream(s) else print("NO")

Fixed submission:
s=input()[::-1]

isOk=False
while len(s)>=5:
    if s[:5]=="maerd" or s[:5]=="esare":
        s=s[5:]
    elif len(s)>=6 and s[:6]=="resare":
        s=s[6:]
    elif len(s)>=7 and s[:7]=="remaerd":
        s=s[7:]
    else:
        break
    
    if len(s)==0:
        isOk=True

print("YES") if isOk else print("NO")

Buggy python submission (verdict: Runtime Error):
s=input()[::-1]

phrase=("dream"[::-1],
        "dreamer"[::-1],
        "erase"[::-1],
        "eraser"[::-1])


def dayDream(word):
    if word[:7] in phrase:
        return dayDream(word[7:])
    elif word[:6] in phrase:
        return dayDream(word[6:])
    elif word[:5] in phrase:
        return dayDream(word[5:])
    
    if len(word)==0:
        return True
    else:
        return False


print(dayDream(s))

Fixed submission:
s=input()[::-1]

isOk=False
while len(s)>=5:
    if s[:5]=="maerd" or s[:5]=="esare":
        s=s[5:]
    elif len(s)>=6 and s[:6]=="resare":
        s=s[6:]
    elif len(s)>=7 and s[:7]=="remaerd":
        s=s[7:]
    else:
        break
    
    if len(s)==0:
        isOk=True

print("YES") if isOk else print("NO")
Buggy python submission (verdict: Runtime Error):
print(len(set([input().split()])))


Fixed submission:
print(len(set(list(input().split()))))
Buggy python submission (verdict: Time Limit Exceeded):
s=input()
for i in range(len(s)//2):
  s=s.replace("ST", "")
print(len(s))

Fixed submission:
x = input()

s = 0
t = 0
nokori = 0
disappear = 0

for i in x:
    if i == "S":
        s += 1
    else:
        if s > 0:
            disappear += 2
            s -= 1

print(len(x)-disappear)

Buggy python submission (verdict: Time Limit Exceeded):
s=input()
ans=len(s)

bef=s
while True:
    aft=bef.replace("ST", "")
    if len(bef)==len(aft):
        break
    bef=aft

print(len(aft))

Fixed submission:
x = input()

s = 0
t = 0
nokori = 0
disappear = 0

for i in x:
    if i == "S":
        s += 1
    else:
        if s > 0:
            disappear += 2
            s -= 1

print(len(x)-disappear)
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
import numpy as np
S = input()

d = defaultdict(list)
for i, s in enumerate(S):
    d[s].append(i + 1)


ans = (-1, -1)
for _, v in d.items():
    dif = np.diff(v).tolist()
    if 1 in dif:
        i = dif.index(1)
        ans = (v[i], v[i + 1])
        break
    elif 2 in dif:
        i = dif.index(1)
        ans = (v[i], v[i + 1])
        break

print(*ans, sep=" ")


Fixed submission:
from collections import defaultdict
import numpy as np
S = input()

d = defaultdict(list)
for i, s in enumerate(S):
    d[s].append(i + 1)


ans = (-1, -1)
for k, v in d.items():
    dif = np.diff(v).tolist()
    if 1 in dif:
        i = dif.index(1)
        ans = (v[i], v[i + 1])
        break
    elif 2 in dif:
        i = dif.index(2)
        ans = (v[i], v[i + 1])
        break

print(*ans, sep=" ")
Buggy python submission (verdict: Time Limit Exceeded):
n, l = map(int, input().split())
a = list(map(int, input().split()))

ans = []
seen = [0] * (n - 1)
while True:
    changed = False
    for i in range(n - 1):
        if not seen[i] and a[i] + a[i + 1] >= l:
            seen[i] = 1
            ans.append(i + 1)
            a[i] = l
            a[i + 1] = l
            changed = True
    if not changed:
        break

if len(ans) == n - 1:
    print("Possible")
    print(*ans[::-1], sep="\n")
else:
    print("Impossible")   



Fixed submission:
import heapq
N, K = map(int, input().split())
A = list(map(int, input().split()))

knot = []
for i in range(N - 1):
    heapq.heappush(knot, (-A[i]-A[i+1], i))

ans = []
seen = [False]*N
while knot:
    L, i = heapq.heappop(knot)
    L = -L

    if seen[i]:
        continue
    if L < K:
        break

    seen[i] = True
    ans.append(i + 1)

    if i + 1 < N - 1:
        heapq.heappush(knot, (-L - A[i + 1], i + 1))
    if i - 1 >= 0:
        heapq.heappush(knot, (-L - A[i - 1], i - 1))

if len(ans) != N - 1:
    print("Impossible")
else:
    print("Possible")
    print(*ans[::-1], sep="\n")
Buggy python submission (verdict: Time Limit Exceeded):
n,m,k = map(int,input().split())
mod = 998244353
def pascal(n):
    line = [1]
    for k in range(n):
        line.append(int(line[k] * (n-k) // (k+1)) )
    return line
line = pascal(n-1)
#print(line)

mm1 = [1]

for i in range(1, n+1):
    mm1 += [(mm1[-1] * (m-1)) % mod]

mm = [1]
for i in range(1, n+1):
    mm += [(mm[-1] * (m)) % mod]

ans = 0
for i in range(k+1):
    if i == 0:
        ans += (mm1[n-1] * m ) % mod
        continue
    if i == n-1:
        ans += (m)
        break
    ans += (mm1[n-1-i] * line[i] * m) % mod

ans = (ans)%mod
print(ans)



Fixed submission:
max_n=2 * 10**5
mod=998244353
fact, inv_fact = [0] * (max_n + 1), [0] * (max_n + 1)
fact[0] = 1
for i in range(max_n):
    fact[i + 1] = fact[i] * (i + 1) % mod

inv_fact[-1] = pow(fact[-1], mod - 2, mod)
for i in reversed(range(max_n)):
    inv_fact[i] = inv_fact[i + 1] * (i + 1) % mod

def nCr_mod(n, r):
    res = 1
    while n or r:
        a, b = n % mod, r % mod
        if a < b:
            return 0
        res = res * fact[a] % mod * inv_fact[b] % mod * inv_fact[a - b] % mod
        n //= mod
        r //= mod
    return res
n,m,k = map(int,input().split())


mm1 = [1]

for i in range(1, n+1):
    mm1 += [(mm1[-1] * (m-1)) % mod]

mm = [1]
for i in range(1, n+1):
    mm += [(mm[-1] * (m)) % mod]

ans = 0
for i in range(k+1):
    if i == 0:
        ans += (mm1[n-1] * m ) % mod
        continue
    if i == n-1:
        ans += (m)
        break
    ans += (mm1[n-1-i] * nCr_mod(n-1,i) * m) % mod

ans = (ans)%mod
print(ans)
Buggy python submission (verdict: Runtime Error):
x,y=map(int, input().split())
if x==y==1:
    print(1000000)
else:
    print([300000,200000,100000][x-1]+[300000,200000,100000][y-1])

Fixed submission:
x,y=map(int, input().split())
if x==y==1:
    print(1000000)
else:
    t=0
    if x<=3: t+=[300000,200000,100000][x-1]
    if y<=3: t+=[300000,200000,100000][y-1]
    print(t)
Buggy python submission (verdict: Runtime Error):
#: Author - Soumya Saurav
import sys,io,os,time
from collections import defaultdict
from collections import OrderedDict
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect,math,heapq
alphabet = "abcdefghijklmnopqrstuvwxyz"

input = sys.stdin.readline

########################################

n = int(input())
arr = list(map(int , input().split()))
ans = 0
for i in range(1,n+1):
	if arr[i]&1 and i&1:
		ans+=1
print(ans)









Fixed submission:
#: Author - Soumya Saurav
import sys,io,os,time
from collections import defaultdict
from collections import OrderedDict
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect,math,heapq
alphabet = "abcdefghijklmnopqrstuvwxyz"

input = sys.stdin.readline

########################################

n = int(input())
arr = list(map(int , input().split()))
ans = 0
for i in range(1,n+1):
	if arr[i-1]&1 and i&1:
		ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
#: Author - Soumya Saurav
import sys,io,os,time
from collections import defaultdict
from collections import OrderedDict
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect,math,heapq
alphabet = "abcdefghijklmnopqrstuvwxyz"

input = sys.stdin.readline

########################################

n , m , k = map(int , input().split())
a = list(map(int , input().split()))
b = list(map(int , input().split()))
i = 0
j = 0
ans = 0
while k:
	#print(k,i,j,ans)
	f = 1
	if i < n and a[i] < b[j]:
		if k - a[i] >= 0:
			k-=a[i]
			ans+=1
			i+=1
			f = 0
			if i == n: i = n-1
	elif j < m and b[j] < a[i]:
		if k - b[j] >= 0:
			k-=b[j]
			ans+=1
			j+=1
			f = 0
	if f: break
	if i >= n  and j >= m: break
print(ans)
	








Fixed submission:
#: Author - Soumya Saurav
import sys,io,os,time
from collections import defaultdict
from collections import OrderedDict
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect,math,heapq
alphabet = "abcdefghijklmnopqrstuvwxyz"

input = sys.stdin.readline

########################################

N, M, K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
a, b=[0], [0]
for i in range(N):
	a.append(a[i]+A[i])
for i in range(M):
	b.append(b[i]+B[i])
	
ans, j=0, M
for i in range(N+1):
	if a[i] > K :
		break
	while b[j] > K - a[i]:
		j-=1
	ans=max(ans, i+j)
print(ans)
Buggy python submission (verdict: Runtime Error):
#: Author - Soumya Saurav
import sys,io,os,time
from collections import defaultdict
from collections import OrderedDict
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect,math,heapq
alphabet = "abcdefghijklmnopqrstuvwxyz"

input = sys.stdin.readline
from numba import*
########################################
@njit('i8(i8)',cache=1)
def main():
	mxn =  10**7
	divs = [0]*(mxn + 11)
	for i in range(1,mxn+1):
		for j in range(0, mxn+1,i):
			divs[j]+=1

	n = int(input())
	ans = 0
	for i in range(1,n+1):
		ans+=i*divs[i]
	print(ans)


main()




Fixed submission:
#: Author - Soumya Saurav
import sys,io,os,time
from collections import defaultdict
from collections import OrderedDict
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect,math,heapq
alphabet = "abcdefghijklmnopqrstuvwxyz"

input = sys.stdin.readline
sys.setrecursionlimit(10**6)
########################################
mxn =  10**7
divs = [0]*(mxn + 11)
for i in range(1,mxn+1):
	for j in range(0, mxn+1,i):
		divs[j]+=1

n = int(input())
ans = 0
for i in range(1,n+1):
	ans+=i*divs[i]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#: Author - Soumya Saurav
import sys,io,os,time
from collections import defaultdict
from collections import OrderedDict
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect,math,heapq
alphabet = "abcdefghijklmnopqrstuvwxyz"

input = sys.stdin.readline
sys.setrecursionlimit(10**6)
########################################
mxn =  10**7
divs = [0]*(mxn + 11)
for i in range(1,mxn+1):
	for j in range(0, mxn+1,i):
		divs[j]+=1

n = int(input())
ans = 0
for i in range(1,n+1):
	ans+=i*divs[i]
print(ans)




Fixed submission:
#: Author - Soumya Saurav
import sys,io,os,time
from collections import defaultdict
from collections import OrderedDict
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect,math,heapq
alphabet = "abcdefghijklmnopqrstuvwxyz"

input = sys.stdin.readline
sys.setrecursionlimit(10**6)
########################################
mxn =  10**7
divs = [0]*(mxn + 11)
for i in range(1,mxn+1):
	for j in range(0, mxn+1,i):
		divs[j]+=1

n = int(input())
ans = 0
for i in range(1,n+1):
	ans+=i*divs[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
#: Author - Soumya Saurav
import sys,io,os,time
from collections import defaultdict
from collections import OrderedDict
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect,math,heapq
alphabet = "abcdefghijklmnopqrstuvwxyz"

input = sys.stdin.readline

########################################

x = list(map(int , input().split()))
for i in range(x):
	if x[i] == 0:
		print(i+1)
		exit()









Fixed submission:
#: Author - Soumya Saurav
import sys,io,os,time
from collections import defaultdict
from collections import OrderedDict
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect,math,heapq
alphabet = "abcdefghijklmnopqrstuvwxyz"

input = sys.stdin.readline

########################################

x = list(map(int , input().split()))
for i in range(len(x)):
	if x[i] == 0:
		print(i+1)
		exit()
Buggy python submission (verdict: Time Limit Exceeded):
import sys,io,os,time
from collections import defaultdict
from collections import OrderedDict
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect,math,heapq
alphabet = "abcdefghijklmnopqrstuvwxyz"

ans = 1
n = int(input())
arr = list(map(int , input().split()))
for i in range(n):
	ans*=arr[i]
if ans > 10**18:
	print(-1)
else:
	print(ans)



Fixed submission:
ans = 1
n = int(input())
arr = sorted(list(map(int , input().split())))
f  = 1
for i in range(n):
	ans*=arr[i]
	#print(ans)
	if ans > 10**18:
		f = 0
		break
#print(ans)
if f: print(ans)
else: print(-1)

Buggy python submission (verdict: Runtime Error):
input = sys.stdin.readline
from collections import defaultdict
from collections import OrderedDict
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect,math,heapq
alphabet = "abcdefghijklmnopqrstuvwxyz"

ans = 1
n = int(input())
arr = list(map(int , input().split()))
for i in range(n):
	ans*=arr[i]
if ans > 10**18:
	print(-1)
else:
	print(ans)

Fixed submission:
ans = 1
n = int(input())
arr = sorted(list(map(int , input().split())))
f  = 1
for i in range(n):
	ans*=arr[i]
	#print(ans)
	if ans > 10**18:
		f = 0
		break
#print(ans)
if f: print(ans)
else: print(-1)

Buggy python submission (verdict: Time Limit Exceeded):

ans = 1
n = int(input())
arr = list(map(int , input().split()))
for i in range(n):
	ans*=arr[i]
if ans > 10**18:
	print(-1)
else:
	print(ans)



Fixed submission:
ans = 1
n = int(input())
arr = sorted(list(map(int , input().split())))
f  = 1
for i in range(n):
	ans*=arr[i]
	#print(ans)
	if ans > 10**18:
		f = 0
		break
#print(ans)
if f: print(ans)
else: print(-1)
Buggy python submission (verdict: Runtime Error):

a, b = map(float, input().split())
print(math.floor(a*b))



Fixed submission:
from decimal import Decimal
a, b = map(Decimal, input().split())
#print(a*b)
c = a*b
c = int(c)
print(c)
Buggy python submission (verdict: Runtime Error):
n = int(input())
arr = list(map(int , input().split()))
s = sum(arr)
f = 1
if n == 0:
  if arr[0] != 1:
    print(-1)
    exit()
  else:
    print(1)
    exit()
elif a[0]!=0:
  print(-1)
  exit()
ans = 1
node = 1
for i in range(1,n+1):
  node=min(2*node, s)
  ans+=node
  node-=a[i]
  s-=a[i]
  if node < 0:
    print(-1)
  	f = 0
    exit()
if f: print(ans)

Fixed submission:

from collections import defaultdict
from collections import OrderedDict
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect,math,heapq
alphabet = "abcdefghijklmnopqrstuvwxyz"
n = int(input())
a= list(map(int , input().split()))
s = sum(a)
f = 1
if n == 0:
  if a[0] != 1:
    print(-1)
    exit()
  else:
    print(1)
    exit()
elif a[0]!=0:
  print(-1)
  exit()
ans = 1
node = 1
for i in range(1,n+1):
  node=min(2*node, s)
  ans+=node
  node-=a[i]
  s-=a[i]
  if node < 0:
    print(-1)	
    exit()
if f: print(ans)
Buggy python submission (verdict: Runtime Error):
from decimal import Decimal
import math
a , b, h , m = map(int , input().split())
angh = (h/12)*360 + (m/60)*30
angm = (m/60)*360
#print("h , m ",angh,angm)
ang = abs(angh-angm)
ang = min(360-ang,ang)
#print("ang :",ang)
#if ang == 180: print(0); exit()
if ang == 0: print(0); exit()
print("{:.50f}".format(Decimal((a*a + b*b - 2*a*b*math.cos(Decimal(math.radians(ang)))).sqrt())))



Fixed submission:
from decimal import Decimal
import math
a , b, h , m = map(int , input().split())
angh = (h/12)*360 + (m/60)*30
angm = (m/60)*360
#print("h , m ",angh,angm)
ang = abs(angh-angm)
#ang = min(360-ang,ang)
#print("ang :",ang)
#if ang == 180: print(0); exit()
#if ang == 0: print(0); exit()
val = a*a + b*b - 2*a*b*math.cos(math.radians(ang))
print(val**0.5)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict
from collections import deque
n , m = map(int , input().split())
g = defaultdict(list)
for i in range(m):
	u , v = map(int , input().split())
	g[u].append(v)
	g[v].append(u)
#print(g)
visited = [False]*(n+1)
a = [10**10]*(n+1)
q = deque()
q.append(1)
while q:
	node = q.popleft()
	visited[node] = True
	for ele in g[node]:
		if not visited[ele]:
			if a[ele] == 10**10: a[ele] = node
			q.append(ele)
#print(ans)
#print(a)
print("Yes")
for i in a[2:]:
	print(i)


Fixed submission:
from collections import defaultdict
from collections import deque
n , m = map(int , input().split())
g = defaultdict(list)
for i in range(m):
	u , v = map(int , input().split())
	g[u].append(v)
	g[v].append(u)
#print(g)
visited = [False]*(n+1)
a = [10**10]*(n+1)
q = deque()
q.append(1)
while q:
	node = q.popleft()
	visited[node] = True
	for ele in g[node]:
		if not visited[ele]:
			if a[ele] != 10**10: 
				continue
			a[ele] = node
			q.append(ele)
#print(ans)
#print(a)
print("Yes")
for i in a[2:]:
	print(i)

Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
from collections import deque
n , m = map(int , input().split())
g = defaultdict(list)
for i in range(m):
	u , v = map(int , input().split())
	g[u].append(v)
	g[v].append(u)
#print(g)
visited = [False]*(n+1)
a = [10**10]*(n+1)
q = deque()
q.append(1)
while q:
	node = q.popleft()
	visited[node] = True
	for ele in g[node]:
		if not visited[ele]:
			a[ele] = node
			q.append(ele)
	depth+=1
#print(ans)
#print(a)
print("YES")
for i in a[2:]:
	print(i)


Fixed submission:
from collections import defaultdict
from collections import deque
n , m = map(int , input().split())
g = defaultdict(list)
for i in range(m):
	u , v = map(int , input().split())
	g[u].append(v)
	g[v].append(u)
#print(g)
visited = [False]*(n+1)
a = [10**10]*(n+1)
q = deque()
q.append(1)
while q:
	node = q.popleft()
	visited[node] = True
	for ele in g[node]:
		if not visited[ele]:
			if a[ele] != 10**10: 
				continue
			a[ele] = node
			q.append(ele)
#print(ans)
#print(a)
print("Yes")
for i in a[2:]:
	print(i)