Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import Counter


def _i(): return int(sys.stdin.readline().strip())


def _ia(): return map(int, sys.stdin.readline().strip().split())


def main():
    n = _i()
    a = list(_ia())
    a.sort()
    c = Counter(a)
    w = set()
    o = []
    m = 10**6 + 1
    for ai in a:
        if ai in w:
            continue
        o.append(ai)
        for j in range(ai+ai, m, ai):
            w.add(j)

    cnt = 0
    for oi in o:
        if c[oi] == 1:
            cnt += 1
    return cnt


if __name__ == "__main__":
    print(main())


Fixed submission:
import sys
from collections import Counter


def _i(): return int(sys.stdin.readline().strip())


def _ia(): return map(int, sys.stdin.readline().strip().split())


def main():
    _ = _i()
    a = Counter(_ia())
    k = sorted(a.keys())
    m = max(k) + 1
    c = [False for i in range(m)]
    cnt = 0
    for ki in k:
        if c[ki]:
            continue
        if a[ki] == 1:
            cnt += 1
        for j in range(ki+ki, m, ki):
            c[j] = True

    return cnt


if __name__ == "__main__":
    print(main())
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from math import log10


def _i(): return int(sys.stdin.readline().strip())


def _ia(): return map(int, sys.stdin.readline().strip().split())


def main():
    _ = _i()
    a = list(_ia())
    tmp = 0 if min(a) == 0 else sum(log10(ai) for ai in a)
    if tmp < 19:
        ret = 1
        for ai in a:
            ret *= ai
        if ret <= 10**18:
            return ret

    return -1


if __name__ == "__main__":
    print(main())


Fixed submission:
import sys


def _i(): return int(sys.stdin.readline().strip())


def _ia(): return map(int, sys.stdin.readline().strip().split())


def main():
    _ = _i()
    m = 10**18
    ret = 1
    for ai in sorted(_ia()):
        ret *= ai
        if ret > m:
            return -1
    return ret


if __name__ == "__main__":
    print(main())
Buggy python submission (verdict: Time Limit Exceeded):
#!/bin/bash
''':'
docker run --rm -it -v $(cd $(dirname $0) && pwd):/vo:ro pypy:3-2.4.0 \
   /bin/bash -c "pypy3 /vo/$(basename $0) < /vo/input.txt"
exit $?
'''
import sys


def _i(): return int(sys.stdin.readline().strip())


def main():
    x = _i()
    i = 0
    while True:
        i5 = i ** 5
        if x > 2 * i5:
            i += 1
            continue
        for j in range(-i+1, i+1):
            j5 = j ** 5
            ij = i5 - j5
            if ij == x:
                return f"{i} {j}"
            if ij > x:
                break
        i += 1


if __name__ == "__main__":
    print(main())


Fixed submission:
#!/bin/bash
''':'
docker run --rm -it -v $(cd $(dirname $0) && pwd):/vo:ro pypy:3-2.4.0 \
   /bin/bash -c "pypy3 /vo/$(basename $0) < /vo/input.txt"
exit $?
'''
import sys


def _i(): return int(sys.stdin.readline().strip())


def main():
    x = _i()
    sq = [i**5 for i in range(120)]
    for i in range(1, 120):
        i5 = sq[i]
        for j in range(-i, i):
            j5 = sq[j] if j >= 0 else -sq[-j]
            if i5-j5 == x:
                return f"{i} {j}"


if __name__ == "__main__":
    print(main())
Buggy python submission (verdict: Runtime Error):
#!/bin/bash
''':'
docker run --rm -it -v $(cd $(dirname $0) && pwd):/vo:ro pypy:3-2.4.0 \
   /bin/bash -c "pypy3 /vo/$(basename $0) < /vo/g.inp"
exit $?
'''
import sys
import math

def _ia(): return [ int(x) for x in sys.stdin.readline().strip().split() ]


def main():
    n, a, b = _ia()
    count = math.ceil(n/(a+b))
    ball = []
    for _ in range(count):
        ball += ["b"] * a
        ball += ["r"] * b
    print(ball[:n].count("b"))



if __name__=="__main__":
    main()


Fixed submission:
#!/bin/bash
''':'
docker run --rm -it -v $(cd $(dirname $0) && pwd):/vo:ro pypy:3-2.4.0 \
   /bin/bash -c "pypy3 /vo/$(basename $0) < /vo/g.inp"
exit $?
'''
import sys

def _ia(): return [ int(x) for x in sys.stdin.readline().strip().split() ]


def main():
    n, a, b = _ia()
    #
    ab = n//(a+b)
    cnt = a * ab
    print(cnt + min(n-(a+b)*ab, a))


if __name__=="__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
#!/bin/bash
''':'
docker run --rm -it -v $(cd $(dirname $0) && pwd):/vo:ro pypy:3-2.4.0 \
   /bin/bash -c "pypy3 /vo/$(basename $0) < /vo/g.inp"
exit $?
'''
import sys
from collections import deque


def _s(): return sys.stdin.readline().strip()


def _sa(): return sys.stdin.readline().strip().split()


def _i(): return int(sys.stdin.readline().strip())


def main():
    s = deque([c for c in _s()])
    q = _i()
    flip = 0
    for _ in range(q):
        tmp = _sa()
        op = int(tmp[0])
        if op == 1:
            flip ^= 1
        else:
            loc = int(tmp[1]) - 1
            c = tmp[2]
            if flip ^ loc:
                s.append(c)
            else:
                s.appendleft(c)

    ans = ""
    n = len(s)
    for _ in range(n):
        if flip == 0:
            ans += s.popleft()
        else:
            ans += s.pop()
    return ans


if __name__ == "__main__":
    print(main())


Fixed submission:
#!/bin/bash
''':'
docker run --rm -it -v $(cd $(dirname $0) && pwd):/vo:ro pypy:3-2.4.0 \
   /bin/bash -c "pypy3 /vo/$(basename $0) < /vo/g.inp"
exit $?
'''
import sys
from collections import deque


def _s(): return sys.stdin.readline().strip()


def _sa(): return sys.stdin.readline().strip().split()


def _i(): return int(sys.stdin.readline().strip())


def main():
    s = deque([c for c in _s()])
    q = _i()
    flip = 0
    for _ in range(q):
        tmp = _sa()
        op = int(tmp[0])
        if op == 1:
            flip ^= 1
        else:
            loc = int(tmp[1]) - 1
            c = tmp[2]
            if flip ^ loc:
                s.append(c)
            else:
                s.appendleft(c)

    n = len(s)
    for _ in range(n):
        if flip == 0:
            print(s.popleft(), end="")
        else:
            print(s.pop(), end="")


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


def _i(): return int(sys.stdin.readline().strip())


def _ia(): return [int(x) for x in sys.stdin.readline().strip().split()]


def main():
    n, p = _ia()
    u = [1 if i == 0 else 0 for i in range(p)]
    s = _i()
    cnt = 0
    if p == 2 or p == 5:
        for i, c in enumerate(s):
            if int(c) % p == 0:
                cnt += i + 1
        return cnt

    m = 10
    for _ in range(n):
        ui = (s % m) % p
        cnt += u[ui]
        u[ui] += 1
        m *= 10

    return cnt


if __name__ == "__main__":
    print(main())


Fixed submission:
import sys


def _s(): return sys.stdin.readline().strip()


def _ia(): return map(int, sys.stdin.readline().strip().split())


n, p = _ia()
u = [1 if i == 0 else 0 for i in range(p)]
s = _s()
cnt = 0
if p == 2 or p == 5:
    for i, c in enumerate(s):
        if int(c) % p == 0:
            cnt += i + 1
else:
    b = 1
    m10 = 10 % p
    prev = 0
    for c in s[::-1]:
        ui = prev = (prev + int(c) * b) % p
        b = (b*m10) % p
        cnt += u[ui]
        u[ui] += 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
import numpy as np


def main():
    _ = input()
    x = np.asarray(list(map(int, input().split())))
    p = int(np.round(np.average(x)))
    print(np.sum((x - p) ** 2))


if __name__ == "__main__":
    main()


Fixed submission:
#!/bin/bash
''':'
docker run --rm -it -v $(cd $(dirname $0) && pwd):/vo:ro pypy:3-2.4.0 \
   /bin/bash -c "pypy3 /vo/$(basename $0) < /vo/g.inp"
exit $?
'''
import sys

def _i(): return int(sys.stdin.readline().strip())
def _ia(): return [ int(x) for x in sys.stdin.readline().strip().split() ]

n = _i()
x = sorted(_ia())

ans = -1
for p in range(min(x), max(x)+1):
   tmp = 0
   for xx in x:
      tmp += (xx-p)**2
   if ans <0 or tmp<ans: ans= tmp
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys

n= int(sys.stdin.readline())
ai= [ int(sys.stdin.readline()) for _ in range(n) ]
c= 1
l= [ -1 ]
for i in range(n-1):
    a = ai[i]
    k= -1
    for j in range(c):
        if l[j]<a:
            k= j
            break
    #
    if k>=0:
        l[k]= ai[i]
    else:
        c+=1
        l.append(None)
#
print( c )


Fixed submission:
#!/usr/bin/env python

import sys

def DBsearch(L,x,narrow):
    n= len(L)
    if n==0: return 0
    if narrow and x in L: return L.index(x)
    last = L[-1]
    if x<last: return n
    if not narrow and x==last: return n
    #
    idx= -1
    i= 0
    j= n-1
    while j>=i:
        if i==j:
            if x>L[i]: idx= i
            break
        #
        mid= i + (j-i)//2
        if x<L[mid]:
            i= mid+1
        elif x==L[mid]:
            if narrow:
                idx= mid
                j  = mid - 1
            else:
                i = mid + 1
        else:
            idx= mid
            j= mid-1
    #
    return idx
#
def lds(L,narrow):
    seq= []
    for x in L:
        if len(seq)==0 or x<seq[-1]:
            seq.append(x)
        elif x==seq[-1]:
            if narrow:
                seq[DBsearch(seq,x,narrow)]= x
            else:
                seq.append(x)
        else:
            seq[DBsearch(seq,x,narrow)]= x
    #
    return len(seq)
#
n= int(sys.stdin.readline())
ai= [ int(sys.stdin.readline()) for _ in range(n) ]
print( lds( ai,False ) )

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python

import sys

n= int(sys.stdin.readline())
ai= [ int(sys.stdin.readline()) for _ in range(n) ]
m= [ False ] * n
c= 0
for i in range(n):
    if m[i]: continue
    m[i]= True
    c+= 1
    j= i
    for k in range(j+1,n):
        if m[k]: continue
        if ai[j]<ai[k]:
            m[k]= True
            j= k
#
print( c )


Fixed submission:
#!/usr/bin/env python

import sys

def DBsearch(L,x,narrow):
    n= len(L)
    if n==0: return 0
    if narrow and x in L: return L.index(x)
    last = L[-1]
    if x<last: return n
    if not narrow and x==last: return n
    #
    idx= -1
    i= 0
    j= n-1
    while j>=i:
        if i==j:
            if x>L[i]: idx= i
            break
        #
        mid= i + (j-i)//2
        if x<L[mid]:
            i= mid+1
        elif x==L[mid]:
            if narrow:
                idx= mid
                j  = mid - 1
            else:
                i = mid + 1
        else:
            idx= mid
            j= mid-1
    #
    return idx
#
def lds(L,narrow):
    seq= []
    for x in L:
        if len(seq)==0 or x<seq[-1]:
            seq.append(x)
        elif x==seq[-1]:
            if narrow:
                seq[DBsearch(seq,x,narrow)]= x
            else:
                seq.append(x)
        else:
            seq[DBsearch(seq,x,narrow)]= x
    #
    return len(seq)
#
n= int(sys.stdin.readline())
ai= [ int(sys.stdin.readline()) for _ in range(n) ]
print( lds( ai,False ) )
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python

import sys

def fill(i,now):
    global iro, d1, k
    nuttayo = []
    for v in d1[i]:
        if iro[v]==0:
            now-=1
            iro[v]= now
            nuttayo.append(v)
    #
    for v in nuttayo: fill(v,k-1)

n,k = [ int(x) for x in sys.stdin.readline().split() ]
d1 = [ [] for _ in range(n) ]
for _ in range(n-1):
    ai,bi = [ int(x)-1 for x in sys.stdin.readline().split() ]
    d1[ai].append( bi )
    d1[bi].append( ai )
#
iro = [ 0 ] * n
iro[0] = k
fill(0,k)
i= 1
for j in iro: i= ( i * j ) % 1000000007
print( i )    


Fixed submission:
#!/usr/bin/env python

import sys

n,k = [ int(x) for x in sys.stdin.readline().split() ]
d1 = [ [] for _ in range(n) ]
for _ in range(n-1):
    ai,bi = [ int(x)-1 for x in sys.stdin.readline().split() ]
    d1[ai].append( bi )
    d1[bi].append( ai )
#
flag = [ True ] * n
flag[0] = False
total = k
now = k
nxt = [ d1[0] ]
while nxt:
    tmp= []
    for points in nxt:
        if now!=k: now= k-1
        for v in points:
            if not flag[v]: continue
            flag[v]= False
            tmp.append(v)
            now -= 1
            total= ( total * now ) % 1000000007
    #
    nxt= []
    for v in tmp:
        a= [ vv for vv in d1[v] if flag[vv] ]
        if a: nxt.append( a )
#
print( total )
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python

import sys
import math

def f(n,m):
    nm = n % m
    if nm==0: return n
    else: return n + m - nm
#
a,b,c,d = [ int(x) for x in sys.stdin.readline().split() ]
cd = c * d // math.gcd(c,d)

# nc
aa = f(a,c)
if aa>b: nc=0
else: nc= (b-aa)//c + 1

# nd
aa = f(a,d)
if aa>b: nd=0
else: nd= (b-aa)//d + 1

# ncd
aa = f(a,cd)
if aa>b: ncd= 0
else: ncd= (b-aa)//cd + 1
#
print( b-a+1 - ( nc + nd - ncd ) )


Fixed submission:
#!/usr/bin/env python

import sys

def gcd(aa,bb):
    aa, bb = max(aa,bb), min(aa,bb)
    while bb!=0:
        aa,bb=bb,aa%bb
    return aa

def f(n,m):
    nm = n % m
    if nm==0: return n
    else: return n + m - nm
#
a,b,c,d = [ int(x) for x in sys.stdin.readline().split() ]
cd = c * d // gcd(c,d)

# nc
aa = f(a,c)
if aa>b: nc=0
else: nc= (b-aa)//c + 1

# nd
aa = f(a,d)
if aa>b: nd=0
else: nd= (b-aa)//d + 1

# ncd
aa = f(a,cd)
if aa>b: ncd= 0
else: ncd= (b-aa)//cd + 1
#
print( b-a+1 - ( nc + nd - ncd ) )
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python

n = int( input() )
xy = []
for _ in range(n): xy.append( [ int(x) for x in input().strip().split() ] )
#
distmap = dict()
for i in range(n):
    xi,yi = xy[i]
    for j in range(i+1,n):
        xj, yj = xy[j]
        xd = xi - xj
        yd = yi - yj
        k = "{} {}".format(xd,yd)
        distmap[k]= distmap.get(k,0) + 1
#
d = max( distmap.values() )
print( n-d )

Fixed submission:
#!/usr/bin/env python

n = int( input() )
xy = []
for _ in range(n): xy.append( [ int(x) for x in input().strip().split() ] )
#
if n==1:
    print( 1 )
    exit()
#
xy.sort( key=lambda x: (x[0],x[1]) )
distmap = dict()
for i in range(n):
    xi,yi = xy[i]
    for j in range(i+1,n):
        xj, yj = xy[j]
        xd = xj - xi
        yd = yj - yi
        k = "{} {}".format(xd,yd)
        distmap[k]= distmap.get(k,0) + 1
#
d = max( distmap.values() )
print( n-d )
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python

import sys

n,m = [ int(x) for x in sys.stdin.readline().split() ]
ai= [ int(x) for x in sys.stdin.readline().split() ]
#
for i in range(m):
    bi, ci= [ int(x) for x in sys.stdin.readline().split() ]
    ai+= [ci]*bi
#
ai.sort()
s= 0
j= len(ai)
for i in range(n):
    j-=1
    s+= ai[j]
print( s )


Fixed submission:
#!/usr/bin/env python

import sys

n,m = [ int(x) for x in sys.stdin.readline().split() ]
k = dict()
for x in sys.stdin.readline().split():
    x = int(x)
    k[x]= k.get(x,0) + 1
#
for i in range(m):
    bi, ci= [ int(x) for x in sys.stdin.readline().split() ]
    k[ci]= k.get(ci,0) + bi
    #ai+= [ci]*bi
#
s = 0
rest= n
for val in sorted( k.keys(),reverse=True ):
    num = k[val]
    if rest>num:
        s+= num * val
        rest-= num
    else:
        s+= val * rest
        break
print( s )
Buggy python submission (verdict: Runtime Error):
import math

m = math.floor(n/2)
if n>2:
    q = int( n / m )
    lm= m
    s = n - 1
else:
    s = 0

while( m>1 ):
    m = math.floor(n/(q+1))
    r0 = n % ( m + 1 )
    if r0>=q:
        d= r0  - q
        if d%q==0:
            s+= ( m+1+int(d/q) )
    #
    # for next
    q = int( n/m )
    lm= m
#
print( s )


Fixed submission:
import math
n= int(input())

m = math.floor(n/2)
if n>2:
    q = int( n / m )
    lm= m
    s = n - 1
else:
    s = 0

while( m>1 ):
    m = math.floor(n/(q+1))
    r0 = n % ( m + 1 )
    if r0>=q:
        d= r0  - q
        if d%q==0:
            s+= ( m+1+int(d/q) )
    #
    # for next
    q = int( n/m )
    lm= m
#
print( s )

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

n= int(input())

m = math.floor(n/2)
q = int( n / m )
lm= m

s = n - 1
while( m!=1 ):
    m = math.floor(n/(q+1))
    r0 = n % ( m + 1 )
    if r0>=q:
        d= r0  - q
        if d%q==0:
            s+= ( m+1+int(d/q) )
    #
    # for next
    q = int( n/m )
    lm= m
#
print( s )


Fixed submission:
import math
n= int(input())

m = math.floor(n/2)
if n>2:
    q = int( n / m )
    lm= m
    s = n - 1
else:
    s = 0

while( m>1 ):
    m = math.floor(n/(q+1))
    r0 = n % ( m + 1 )
    if r0>=q:
        d= r0  - q
        if d%q==0:
            s+= ( m+1+int(d/q) )
    #
    # for next
    q = int( n/m )
    lm= m
#
print( s )
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = []
while 1:
    A.append(N%10)
    N = N//10
    if N <= 0:
        break

if sum(A)%9==0:print("Yes")
else:print("No")

Fixed submission:
A = list(input())
for n in range(len(A)):
    A[n] = int(A[n])

if sum(A)%9==0:print("Yes")
else:print("No")

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = []
while 1:
    A.append(N%10)
    N = N//10
    if N == 0:
        break

if sum(A)%9==0:print("Yes")
else:print("No")

Fixed submission:
A = list(input())
for n in range(len(A)):
    A[n] = int(A[n])

if sum(A)%9==0:print("Yes")
else:print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
m = 1000000007
s = 0
for i in range(n):
    s += a[i] * (sum(a[i + 1:n]) % m)
print(s % m)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
m = 1000000007
s = 0
suma = sum(a)
for i in range(n):
    suma -= a[i]
    s += a[i] * suma
print(s % m)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
m = 1000000007
s = 0
for i in range(n):
    s += a[i] * sum(a[i + 1:n])
print(s % m)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
m = 1000000007
s = 0
suma = sum(a)
for i in range(n):
    suma -= a[i]
    s += a[i] * suma
print(s % m)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
m = 1000000007
s = 0
for i in range(n):
    for j in range(i + 1, n):
        s += (a[i] * a[j]) % m
print(s % m)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
m = 1000000007
s = 0
suma = sum(a)
for i in range(n):
    suma -= a[i]
    s += a[i] * suma
print(s % m)
Buggy python submission (verdict: Runtime Error):
w=sorted(list(input()));s="Yes" 
for i in range(0,len(w),2):
    if w[i]!=w[i+1]:s="No"
print(s)

Fixed submission:
w=sorted(list(input()))+["_"];s="Yes" 
for i in range(1,len(w),2):
    if w[i]!=w[i-1]:s="No"
print(s)
Buggy python submission (verdict: Runtime Error):
s=list(input())
for i in range(len(s)-2):
    if s[i]==s[i+1]:
        print("{} {}".format(i+1,i+2))
        break
    elif s[i]==s[i+2]:
        print("{} {}".format(i+1,i+3))
        break
else:
    if s[i+1]==s[i+2]:
        print("{} {}".format(i+2,i+3))
    else:
        print("-1 -1")

Fixed submission:
s=list(input())
j=len(s)-2
for i in range(j):
    if s[i]==s[i+1]:
        print("{} {}".format(i+1,i+2))
        break
    elif s[i]==s[i+2]:
        print("{} {}".format(i+1,i+3))
        break
else:
    if s[j]==s[j+1]:
        print("{} {}".format(j+1,j+2))
    else:
        print("-1 -1")
Buggy python submission (verdict: Runtime Error):
n,l=map(n,l=map(int,input().split())
s=[]
for i in range(n):
    s.append(input())
print("".join(sorted(s)))

Fixed submission:
n,l=map(int,input().split())
s=[]
for i in range(n):
    s.append(input())
s="".join(sorted(s))
print(s)
Buggy python submission (verdict: Runtime Error):
n=int(input())

a=list(map(int,input().split()))

for i in range(len(a)-1):
    if a[i]>a[+1]:
        s+=0
    else:
        s+=a[i+1]-a[i]

print(s)

Fixed submission:
n=int(input())

row=list(map(int,input().split()))


s=0
for i in range(1,n):
    if row[i-1]>row[i]:
        s+=row[i-1]-row[i]
        row[i]=row[i-1]
print(s)
Buggy python submission (verdict: Runtime Error):
x,y=map(int,input().split())
a=0
s=0

for i in range(x+1):
    for k in range(x-i+1):
        a=4*i+2*k

        if a==y:
            s+=1

if s>=1:
    print("Yes")
else:
    print("No")


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

for i in range(len(a)):
    if a[i]==0:
        print(i+1)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())

a=[]


a=list(map(int,input().split()))


c=int(a[0])

for k in range(1,n):

    c*=int(a[k])

if c>10**18:
    print(-1)

else:
    print(c)


Fixed submission:
n=int(input())

a=[]

import sys

a=list(map(int,input().split()))


c=1
if a.count(0)>=1:
    print(0)
    sys.exit()

for k in range(n):

    c*=int(a[k])

    if c>10**18:
        print(-1)
        sys.exit()


print(c)
Buggy python submission (verdict: Runtime Error):
A,B,H,M=map(int,input().split())
import math

m=360*M/60
h=360*H/12+30*M/60

if m>=h:
    p=m-h

else:

    p=h-m

if H==M:
    print(0)
else:


    ans=(A**2+B**2-2*A*B*math.cos(math.radians(p)))**(1/2)

print(ans)


Fixed submission:
A,B,H,M=map(int,input().split())
import math

m=360*M/60
h=360*H/12+30*M/60

if m>=h:
    p=m-h

else:

    p=h-m


if p==0:
    print(abs(A-B))

else:

    l=math.radians(p)

    ans=(A**2+B**2-2*A*B*math.cos(l))**(1/2)

    print(ans)
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())

h=list(map(int,input().split()))
low=[]
high=[]

for i in range(m):

    a,b=map(int,input().split())

    if h[a-1]>h[b-1]:

        low.append(b)
        high.append(a)

    elif h[a-1]==h[b-1]:


        low.extend([a,b])

    elif h[a-1]<h[b-1]:

        low.append(a)
        high.append(b)

common=list(set(low)&set(high))

for k in range(len(common)):

    high.remove(common[k])

lh_or=list(set(low) ^ set(high))

g=n-len(lh_or)
high=list(set(high))

print(len(high)+g)


Fixed submission:
s=input()

if s=="ARC":

    print("ABC")

else:
    print("ARC")
Buggy python submission (verdict: Runtime Error):
a,b,n=map(int,input().split())
m=0
if n<=(10**7):


    for x in range(n+1):
        l=int(a*x/b)-a*int(x/b)

        if l>=m:

            m=l

else:
    for x in range(10**6,n+1):


        l=int(a*x/b)-a*int(x/b)
        if l>m:

            m=l
print(m)


Fixed submission:
K=int(input())
A,B=map(int,input().split())
i=0
import sys

while K*i<=B:



    if A<=K*i and K*i<=B:

        print("OK")

        sys.exit()
    else:
        i+=1

print("NG")