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

A ,B ,H ,M =map(int,input().split())

dighour:float = 360*((H+M/60)/12)
digmin:float =  360*(M/60)
length:float = 0

deg = abs(dighour-digmin)

length = A**2 + B**2 - 2 * A * B math.cos(math.radians(deg))

'''
if dighour > digmin and abs(dighour - digmin) <= 180:
    length = math.sqrt((A **2 + B **2) - ((2*A*B) * math.cos(math.radians(abs(dighour-digmin)))))
elif dighour > digmin and abs(dighour - digmin) > 180:
    length = math.sqrt((A **2 + B **2) - ((2*A*B) * math.cos(math.radians(360 - abs(dighour-digmin)))))
elif dighour < digmin and abs(digmin - dighour) <= 180:
    length = math.sqrt((A **2 + B **2) - ((2*A*B) * math.cos(math.radians((abs(digmin-dighour))))))
elif dighour < digmin and abs(digmin - dighour) > 180:
    length = math.sqrt((A **2 + B **2) - ((2*A*B) * math.cos(math.radians((360 - abs(digmin-dighour))))))
'''

print(length)

Fixed submission:
import math

A ,B ,H ,M =map(int,input().split())

dighour:float = 30*H + M*0.5
digmin:float =  M * 6
length:float = 0

deg = abs(dighour-digmin)
length = math.sqrt(A**2 + B**2 - (2 * A * B * math.cos(math.radians(deg))))

'''
if dighour > digmin and abs(dighour - digmin) <= 180:
    length = math.sqrt((A **2 + B **2) - ((2*A*B) * math.cos(math.radians(abs(dighour-digmin)))))
elif dighour > digmin and abs(dighour - digmin) > 180:
    length = math.sqrt((A **2 + B **2) - ((2*A*B) * math.cos(math.radians(360 - abs(dighour-digmin)))))
elif dighour < digmin and abs(digmin - dighour) <= 180:
    length = math.sqrt((A **2 + B **2) - ((2*A*B) * math.cos(math.radians((abs(digmin-dighour))))))
elif dighour < digmin and abs(digmin - dighour) > 180:
    length = math.sqrt((A **2 + B **2) - ((2*A*B) * math.cos(math.radians((360 - abs(digmin-dighour))))))
'''

print(length)

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

A ,B ,H ,M =map(int,input().split())

dighour = 360 * ((H+M/60)/12)
digmin = 360 * (M/60)
length = 0
cosin = 0
if dighour > digmin and abs(dighour - digmin) <= 180:
    cosin = round(math.cos(math.radians(abs(dighour-digmin))),5)
    length = math.sqrt((A **2 + B **2) - ((2*A*B) * cosin))
elif dighour > digmin and abs(dighour - digmin) > 180:
    cosin = round(math.cos(math.radians(360 - abs(dighour-digmin)),5))
    length = math.sqrt((A **2 + B **2) - ((2*A*B) * cosin))
elif dighour < digmin and abs(digmin - dighour) <= 180:
    cosin = round(math.cos(math.radians(abs(digmin-dighour))),5)
    length = math.sqrt((A **2 + B **2) - ((2*A*B) * cosin))
elif dighour < digmin and abs(digmin - dighour) > 180:
    cosin = round(math.cos(math.radians(360 - abs(digmin-dighour)),5))
    length = math.sqrt((A **2 + B **2) - ((2*A*B) * cosin))

print(length)

Fixed submission:
import math

A ,B ,H ,M =map(int,input().split())

dighour:float = 30*H + M*0.5
digmin:float =  M * 6
length:float = 0

deg = abs(dighour-digmin)
length = math.sqrt(A**2 + B**2 - (2 * A * B * math.cos(math.radians(deg))))

'''
if dighour > digmin and abs(dighour - digmin) <= 180:
    length = math.sqrt((A **2 + B **2) - ((2*A*B) * math.cos(math.radians(abs(dighour-digmin)))))
elif dighour > digmin and abs(dighour - digmin) > 180:
    length = math.sqrt((A **2 + B **2) - ((2*A*B) * math.cos(math.radians(360 - abs(dighour-digmin)))))
elif dighour < digmin and abs(digmin - dighour) <= 180:
    length = math.sqrt((A **2 + B **2) - ((2*A*B) * math.cos(math.radians((abs(digmin-dighour))))))
elif dighour < digmin and abs(digmin - dighour) > 180:
    length = math.sqrt((A **2 + B **2) - ((2*A*B) * math.cos(math.radians((360 - abs(digmin-dighour))))))
'''

print(length)