Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):


# def main():
#     n = int(input())
#     al = list(map(int, input().split()))
#     all_xor = 0
#     for a in al:
#         all_xor = all_xor ^ a

#     ans = []
#     for a in al:
#         curr_ans = all_xor ^ a
#         ans.append(curr_ans)

#     print(*ans)


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


N_MAX = 2*(10**6)
MOD = 10**9 + 7
fac, finv, inv = [0]*N_MAX ,[0]*N_MAX, [0]*N_MAX
def com_init():
    fac[0], fac[1] = 1, 1
    finv[0], finv[1] = 1, 1
    inv[1] = 1
    for i in range(2, N_MAX):
        fac[i] = fac[i - 1] * i % MOD
        inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD
        finv[i] = finv[i - 1] * inv[i] % MOD

def com(n, k):
    if n < k: return 0
    if n < 0 or k < 0: return 0
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD


def com(n, k):
    ans = 1
    for i in range(n-k+1,n+1):
        ans *= i
        ans %= MOD
    return (ans * finv[k]) % MOD


def main():
    k = int(input())
    s = input()
    n = len(s)

    com_init()

    ans = 0
    for i in range(0,n):
        ans += (pow(25,k-i,MOD) * pow(26,i,MOD))*com(n+k-i-1,k-1)

    print(ans%MOD)


if __name__ == "__main__":
    main()

Fixed submission:


# def main():
#     n = int(input())
#     al = list(map(int, input().split()))
#     all_xor = 0
#     for a in al:
#         all_xor = all_xor ^ a

#     ans = []
#     for a in al:
#         curr_ans = all_xor ^ a
#         ans.append(curr_ans)

#     print(*ans)


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


N_MAX = 2*(10**6)
MOD = 10**9 + 7
fac, finv, inv = [0]*N_MAX ,[0]*N_MAX, [0]*N_MAX
def com_init():
    fac[0], fac[1] = 1, 1
    finv[0], finv[1] = 1, 1
    inv[1] = 1
    for i in range(2, N_MAX):
        fac[i] = fac[i - 1] * i % MOD
        inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD
        finv[i] = finv[i - 1] * inv[i] % MOD

def com(n, k):
    if n < k: return 0
    if n < 0 or k < 0: return 0
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD


def main():
    k = int(input())
    s = input()
    n = len(s)

    com_init()

    ans = 0
    for i in range(0,k+1):
        ans += (pow(25,k-i,MOD) * pow(26,i,MOD))*com(n+k-i-1,n-1)

    print(ans%MOD)


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())

if m%2 == 0:
    for i in range(m//2):
        print(1+i, 1+m-i)
        print(1+m+i, m-i)

else:
    center = (n+2-1)//2
    for i in range(m//2):
        print(1+i, center-i)
        print(center+1+i, n-i)
    print(i+m//2+1, i+m//2+2)


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

right = 2*m+1

if m%2 == 0:
    for i in range(m//2):
        print(1+i, 1+m-i)
        print(2+m+i, right-i)

else:
    center = m+1
    for i in range(m//2):
        print(1+i, center-i)
        print(center+1+i, right-i)
    print(m//2+1, m//2+2)
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    s = input()
    rem_l = [0]*2019
    rem_l[0] = 1
    curr_rem = 0
    for i, s_i in enumerate(s[::-1]):
        num = int(s_i)
        curr_rem = (curr_rem + num*pow(10,i))%2019
        rem_l[curr_rem] += 1

    ans = 0
    for r in rem_l:
        ans += r*(r-1)//2

    print(ans)

if __name__ == "__main__":
    main()

Fixed submission:
def main():
    s = input()
    rem_l = [0]*2019
    rem_l[0] = 1
    curr_rem = 0
    for i, s_i in enumerate(s[::-1]):
        num = int(s_i)
        curr_rem = (curr_rem + num*pow(10,i,2019))%2019
        rem_l[curr_rem] += 1

    ans = 0
    for r in rem_l:
        ans += r*(r-1)//2

    print(ans)

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):

import math
from functools import reduce
# def gcd(*numbers):
#     return reduce(math.gcd, numbers)

k = int(input())
res = 0
for c in range(1,k+1):
    for b in range(1,k+1):
        for a in range(1,k+1):
            # res += gcd(a,b,c)
            gcd1 = math.gcd(a,b)
            gcd2 = math.gcd(gcd1,c)
            res += gcd2
print(res)

Fixed submission:
import math
from functools import reduce
# def gcd(*numbers):
#     return reduce(math.gcd, numbers)

k = int(input())
res = 0
for c in range(1,k+1):
    for b in range(1,k+1):
        gcd_cd = math.gcd(c,b)
        for a in range(1,k+1):
            # res += gcd(a,b,c)
            gcd_abc = math.gcd(a,gcd_cd)
            res += gcd_abc
print(res)

Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce
def gcd(*numbers):
    return reduce(math.gcd, numbers)

k = int(input())
res = 0
for c in range(1,k+1):
    for b in range(1,k+1):
        for a in range(1,k+1):
            res += gcd(a,b,c)
print(res)

Fixed submission:
import math
from functools import reduce
# def gcd(*numbers):
#     return reduce(math.gcd, numbers)

k = int(input())
res = 0
for c in range(1,k+1):
    for b in range(1,k+1):
        gcd_cd = math.gcd(c,b)
        for a in range(1,k+1):
            # res += gcd(a,b,c)
            gcd_abc = math.gcd(a,gcd_cd)
            res += gcd_abc
print(res)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = str(input())

r = s.count('R')
g = s.count('G')
b = s.count('B')
all_count = r*g*b

reduce = 0
for i in range(1, n-2+1):
    for j in range(i+1, n-1+1):
        k = 2*j -i
        if k > n: continue
        if s[i-1] != s[j-1] and s[i-1] != s[k-1] and s[j-1] != s[k-1]:
            reduce += 1
print(all_count - reduce)

Fixed submission:
n = int(input())
s = str(input())

r = s.count('R')
g = s.count('G')
b = s.count('B')
all_count = r*g*b

reduce = 0
for i in range(1, n-2+1):
    for j in range(i+1, (n+i)//2+1):
        k = 2*j -i
        if k > n: continue
        if s[i-1] != s[j-1] and s[i-1] != s[k-1] and s[j-1] != s[k-1]:
            reduce += 1
print(all_count - reduce)
Buggy python submission (verdict: Runtime Error):

import math
from functools import reduce
# def gcd(*numbers):
#     return reduce(math.gcd, numbers)

k = int(input())
res = 0
for c in range(1,k+1):
    for b in range(1,k+1):
        for a in range(1,k+1):
            # res += gcd(a,b,c)
            gcd1 = math.gcd(a,b)
            gcd2 = math.gcd(gcd1,c)
            res += gcd2
print(res)

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

cnt_l = [0]*(k+1)
MOD = 10**9+7

for i in range(k,0,-1):
    multi_cnt = k//i
    cnt = pow(multi_cnt,n,MOD)
    
    i_multi = i+i
    while i_multi <= k:
        cnt -= cnt_l[i_multi]
        i_multi+=i

    cnt_l[i] = cnt%MOD

ans = 0
for i, cnt in enumerate(cnt_l):
    ans += i*cnt
    ans %= MOD

# print(cnt_l)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,p = map(int, input().split())
s = input()

if p%2 == 0:
    ans = 0
    for i, si in enumerate(s):
        if int(si)%2 == 0:
            ans += (i+1)
    print(ans)
    exit()

if p%5 == 0:
    ans = 0
    for i, si in enumerate(s):
        if int(si)%5 == 0:
            ans += (i+1)
    print(ans)
    exit()


prem = [0]*p
prem[0] = 1
curr_rem = 0
ans = 0
s = s[::-1]
for i,si in enumerate(s):
    sii = int(si)
    curr_rem = (sii*pow(10,i)+curr_rem)%p
    ans += prem[curr_rem]
    prem[curr_rem] += 1

print(ans)
    

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

if p%2 == 0:
    ans = 0
    for i, si in enumerate(s):
        if int(si)%2 == 0:
            ans += (i+1)
    print(ans)
    exit()

if p%5 == 0:
    ans = 0
    for i, si in enumerate(s):
        if int(si)%5 == 0:
            ans += (i+1)
    print(ans)
    exit()


prem = [0]*p
prem[0] = 1
curr_rem = 0
ans = 0
s = s[::-1]
for i,si in enumerate(s):
    sii = int(si)
    curr_rem = (sii*pow(10,i,p)+curr_rem)%p
    ans += prem[curr_rem]
    prem[curr_rem] += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
#A1 ~ Aiまでの和 O(logN)
def BIT_query(BIT,idx):
    res_sum = 0
    while idx > 0:
        res_sum += BIT[idx]
        idx -= idx&(-idx)
    return res_sum

#Ai += x O(logN)
def BIT_update(BIT,idx,x):
    while idx <= n:
        BIT[idx] += x
        idx += idx&(-idx)
    return


alps = 'abcdefghijklmnopqrstuvwxyz'

n = int(input())
s = input()
char_hd_d = {}
for alp in alps:
    char_hd_d[alp] = [0]*(n+1)

for i, si in enumerate(s):
    BIT_update(char_hd_d[si], i+1, 1)

q = int(input())
ansl = []
for _ in range(q):
    command, a, b = input().split()
    if command == '1':
        i = int(a)
        c = b
        i_char = s[i-1]
        BIT_update(char_hd_d[i_char], i, -1)
        BIT_update(char_hd_d[c], i, 1)
        s[i-1] = c 
    else:
        l,r = int(a),int(b)
        cnt = 0
        for alp in alps:
            if BIT_query(char_hd_d[alp], r) - BIT_query(char_hd_d[alp], l-1) > 0:
                cnt += 1
        ansl.append(cnt)

for a in ansl:
    print(a)            

Fixed submission:
#A1 ~ Aiまでの和 O(logN)
def BIT_query(BIT,idx):
    res_sum = 0
    while idx > 0:
        res_sum += BIT[idx]
        idx -= idx&(-idx)
    return res_sum

#Ai += x O(logN)
def BIT_update(BIT,idx,x):
    while idx <= n:
        BIT[idx] += x
        idx += idx&(-idx)
    return


alps = 'abcdefghijklmnopqrstuvwxyz'

n = int(input())
s = list(input())
char_hd_d = {}
for alp in alps:
    char_hd_d[alp] = [0]*(n+1)

for i, si in enumerate(s):
    BIT_update(char_hd_d[si], i+1, 1)

q = int(input())
ansl = []
for _ in range(q):
    command, a, b = input().split()
    if command == '1':
        i = int(a)
        c = b
        i_char = s[i-1]
        BIT_update(char_hd_d[i_char], i, -1)
        BIT_update(char_hd_d[c], i, 1)
        s[i-1] = c 
    else:
        l,r = int(a),int(b)
        cnt = 0
        for alp in alps:
            if BIT_query(char_hd_d[alp], r) - BIT_query(char_hd_d[alp], l-1) > 0:
                cnt += 1
        ansl.append(cnt)

for a in ansl:
    print(a)
Buggy python submission (verdict: Time Limit Exceeded):
def pow_k(x, n):
    if n == 0:
        return 1
    K = 1
    while n > 1:
        if n % 2 != 0:
            K *= x
        x *= x
        n //= 2
        x%=MOD
    return K * x

# nCk
K_MAX = 10**7
MOD = 10**9 + 7
fac, finv, inv = [0]*(K_MAX+1), [0]*(K_MAX+1), [0]*(K_MAX+1)
# nCk (k<=10^7, n<=10^9)
def com_init():
    finv[0], finv[1] = 1, 1
    inv[1] = 1
    for i in range(2,K_MAX+1):
        inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD
        finv[i] = finv[i - 1] * inv[i] % MOD

def com(n, k):
    ans = 1
    for i in range(n-k+1,n+1):
        ans *= i
        ans %= MOD
    return (ans * finv[k]) % MOD


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

all_comb = pow_k(2,n)
a_comb = com(n,a)
b_comb = com(n,b)

ans = all_comb - a_comb - b_comb -1
print(ans%MOD)


Fixed submission:
def pow_k(x, n):
    if n == 0:
        return 1
    K = 1
    while n > 1:
        if n % 2 != 0:
            K *= x
        x *= x
        n //= 2
        x%=MOD
    return K * x

# nCk
K_MAX = 10**7
MOD = 10**9 + 7
fac, finv, inv = [0]*(K_MAX+1), [0]*(K_MAX+1), [0]*(K_MAX+1)
# nCk (k<=10^7, n<=10^9)
def com_init():
    finv[0], finv[1] = 1, 1
    inv[1] = 1
    for i in range(2,K_MAX+1):
        inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD
        finv[i] = finv[i - 1] * inv[i] % MOD

def com(n, k):
    ans = 1
    for i in range(n-k+1,n+1):
        ans *= i
        ans %= MOD
    return (ans * finv[k]) % MOD


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

all_comb = pow_k(2,n)
a_comb = com(n,a)
b_comb = com(n,b)

ans = all_comb - a_comb - b_comb -1
print(ans%MOD)
Buggy python submission (verdict: Runtime Error):
l = list(map(int,input().split()))
l.sort()
if (l[0]==l[1] and l[1]) != l[2] or (l[0] != l[1] and l[1]==l[2]:
  print('Yes')
else:
  print('No')

Fixed submission:
l = list(map(int,input().split()))
l.sort()
if (l[0]==l[1] and l[1] != l[2]) or (l[0] != l[1] and l[1]==l[2]):
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
H, N = map(int, input().split()) 
abl = []
for _ in range(N):
    ab = list(map(int, input().split()) )
    abl.append(ab)

dp = [10**8]*(2*H+1)
dp[0] = 0
for h in range(H+1):
    for ab in abl:
        a,b = ab
        dp[h+a] = min(dp[h+a], dp[h]+b)

print(min( dp[H:] ))

Fixed submission:
H, N = map(int, input().split()) 
abl = []
for _ in range(N):
    ab = list(map(int, input().split()) )
    abl.append(ab)

dp = [10**8]*(2*10**4+1)
dp[0] = 0
for h in range(H+1):
    for ab in abl:
        a,b = ab
        dp[h+a] = min(dp[h+a], dp[h]+b)

print(min( dp[H:] ))

Buggy python submission (verdict: Runtime Error):
H, N = map(int, input().split()) 
abl = []
for _ in range(N):
    ab = list(map(int, input().split()) )
    abl.append(ab)

dp = [10**8]*(2*H)
dp[0] = 0
for h in range(H+1):
    for ab in abl:
        a,b = ab
        dp[h+a] = min(dp[h+a], dp[h]+b)

print(min( dp[H:] ))

Fixed submission:
H, N = map(int, input().split()) 
abl = []
for _ in range(N):
    ab = list(map(int, input().split()) )
    abl.append(ab)

dp = [10**8]*(2*10**4+1)
dp[0] = 0
for h in range(H+1):
    for ab in abl:
        a,b = ab
        dp[h+a] = min(dp[h+a], dp[h]+b)

print(min( dp[H:] ))
Buggy python submission (verdict: Runtime Error):
from fractions import gcd
from math import gcd

def lcm(x,y):
    return (x * y) // gcd(x, y)


def get_2(x):
    curr_2 = 0
    curr_x = x
    while curr_x%2 != 0:
        curr_x = curr_x//2
        curr_2 += 1
    return curr_2

n,m = map(int, input().split())
al = list(map(int, input().split()))

a2_set = set()
a2_set.add(get_2(al[0]))
for a in al:
    two_cnt = get_2(a)
    if two_cnt not in a2_set:
        print(0)
        exit()
    a2_set.add(two_cnt)


curr_lcm = 1
for a in al:
    curr_lcm = lcm(curr_lcm, a//2)

if n==1:
    curr_lcm*=2
    lcm_cnt = (m-curr_lcm//2)//curr_lcm
else:

lcm_cnt = m//curr_lcm
lcm_cnt = (lcm_cnt+2-1)//2

# print(curr_lcm)
print(lcm_cnt)





Fixed submission:
from fractions import gcd
from math import gcd

def lcm(x,y):
    return (x * y) // gcd(x, y)


def get_2(x):
    curr_2 = 0
    curr_x = x
    while curr_x%2 == 0:
        curr_x = curr_x//2
        curr_2 += 1
    return curr_2

n,m = map(int, input().split())
al = list(map(int, input().split()))


if n == 1:
    cnt = (m-al[0]//2)//al[0] + 1
    print(cnt)
    exit()



a2_set = set()
a2_set.add(get_2(al[0]))
for a in al:
    two_cnt = get_2(a)
    if two_cnt not in a2_set:
        print(0)
        exit()
    a2_set.add(two_cnt)


curr_lcm = 1
for a in al:
    curr_lcm = lcm(curr_lcm, a//2)

lcm_cnt = m//curr_lcm
lcm_cnt = (lcm_cnt+2-1)//2

# print(curr_lcm)
print(lcm_cnt)
Buggy python submission (verdict: Runtime Error):

n = int(input())
cl = list(map(int, input().split()))
cl.sort(reverse=True)
MOD = 10**9+7

ans = 0
num = pow(2,n-1,MOD)
inc = pow(2,n-2,MOD)
for i in range(n):
    ans += num*cl[i]
    ans%=MOD
    num += inc
    num%=MOD

ans *= pow(2,n,MOD)
ans%=MOD
print(ans)

Fixed submission:

n = int(input())
cl = list(map(int, input().split()))
cl.sort(reverse=True)
MOD = 10**9+7

ans = 0
num = pow(2,n-1,MOD)
inc = pow(2,n-2,MOD)
for i in range(n):
    ans += num*cl[i]
    ans%=MOD
    num += inc
    num%=MOD

ans *= pow(2,n,MOD)
ans%=MOD
print(ans)

Buggy python submission (verdict: Runtime Error):

n = int(input())
cl = list(map(int, input().split()))
cl.sort(reverse=True)
MOD = 10**9+7

ans = 0
num = pow(2,n-1,MOD)
inc = pow(2,n-2,MOD)
for i in range(n):
    ans += num*cl[i]
    ans%=MOD
    num += inc
    num%=MOD

ans *= pow(2,n,MOD)
ans%=MOD
print(ans)

Fixed submission:

n = int(input())
cl = list(map(int, input().split()))
cl.sort(reverse=True)
MOD = 10**9+7

ans = 0
num = pow(2,n-1,MOD)
inc = pow(2,n-2,MOD)
for i in range(n):
    ans += num*cl[i]
    ans%=MOD
    num += inc
    num%=MOD

ans *= pow(2,n,MOD)
ans%=MOD
print(ans)
Buggy python submission (verdict: Runtime Error):
s=input()
t=input()
print(t+s)

Fixed submission:
s,t=input().split()
print(t+s)
Buggy python submission (verdict: Runtime Error):
import math

a, b = map(int, input().split()) 
print(a*b/math.gcd(a,b))

Fixed submission:
import fractions

a, b = map(int, input().split()) 
print(a*b//fractions.gcd(a,b))

Buggy python submission (verdict: Runtime Error):
import math
a, b = map(int, input().split()) 
print(a*b//math.gcd(a,b))

Fixed submission:
import fractions

a, b = map(int, input().split()) 
print(a*b//fractions.gcd(a,b))
Buggy python submission (verdict: Runtime Error):
from collections import deque

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

val_cnt = [0]*k
val_cnt[0] = 1
val_q = deque([0])

ans = 0
curr_sum = 0
for i in range(n):
    curr_sum += al[i]
    curr_sum %= k
    val = (curr_sum - (i+1))%k
    ans += val_cnt[val]
    val_cnt[val] += 1
    val_q.append(val)
    if len(val_q) >= k:
        poped = val_q.popleft()
        val_cnt[poped] -= 1

print(ans)

Fixed submission:
from collections import deque

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

val_cnt = {}
val_cnt[0] = 1
val_q = deque([0])
if k == 1:
    print(0)
    exit()

ans = 0
curr_sum = 0
for i in range(n):
    curr_sum += al[i]
    curr_sum %= k
    val = (curr_sum - (i+1))%k
    val_cnt.setdefault(val,0)
    ans += val_cnt[val]
    val_cnt[val] += 1
    val_q.append(val)
    if len(val_q) >= k:
        poped = val_q.popleft()
        val_cnt[poped] -= 1

print(ans)
Buggy python submission (verdict: Runtime Error):

import math

def main():
    s = str(input())
    first = s[0]
    cnt_l = []
    tmp_cnt = 1
    prev_s = first
    for curr_s in s[1:]:
        if prev_s != curr_s:
            cnt_l.append(tmp_cnt)
            tmp_cnt = 1
        else:
            tmp_cnt+=1
        prev_s = curr_s
    cnt_l.append(tmp_cnt)

    ans_l = []
    last_num = 0
    if first == '>':
        down_cnt = ans_l[0]
        for d in range(down_cnt):
            ans_l.append(down_cnt-1-d)
        ans_l = ans_l[1:]

    # if first == '<':
    # print(cnt_l)
    ans_l.append(0)
    last_num = 0
    for i in range(math.ceil(len(cnt_l)/2)):
        # print('i',i)
        up_cnt = cnt_l[i*2]
        if i*2+1 >= len(cnt_l):
            down_cnt = 0
        else:
            down_cnt = cnt_l[i*2+1]
        # print(up_cnt,down_cnt)
        # print()
        for u in range(up_cnt):
            if u != up_cnt-1:
                last_num+=1
                ans_l.append(last_num)
            else:
                last_num = max(last_num+1, down_cnt)
                ans_l.append(last_num)
        for d in range(down_cnt):
            if d==0:
                if last_num > down_cnt:
                    last_num = down_cnt-1
                else:
                    last_num-=1
                ans_l.append(last_num)
            else:
                last_num-=1
                ans_l.append(last_num)

    # print(ans_l)
    print(sum(ans_l))

if __name__ == "__main__":
    main()

Fixed submission:

import math

def main():
    s = str(input())
    first = s[0]
    cnt_l = []
    tmp_cnt = 1
    prev_s = first
    for curr_s in s[1:]:
        if prev_s != curr_s:
            cnt_l.append(tmp_cnt)
            tmp_cnt = 1
        else:
            tmp_cnt+=1
        prev_s = curr_s
    cnt_l.append(tmp_cnt)

    ans_l = []
    last_num = 0
    if first == '>':
        down_cnt = cnt_l[0]
        for d in range(down_cnt):
            ans_l.append(down_cnt-d)
        cnt_l = cnt_l[1:]

    # if first == '<':
    # print(cnt_l)
    ans_l.append(0)
    last_num = 0
    for i in range(math.ceil(len(cnt_l)/2)):
        # print('i',i)
        up_cnt = cnt_l[i*2]
        if i*2+1 >= len(cnt_l):
            down_cnt = 0
        else:
            down_cnt = cnt_l[i*2+1]
        # print(up_cnt,down_cnt)
        # print()
        for u in range(up_cnt):
            if u != up_cnt-1:
                last_num+=1
                ans_l.append(last_num)
            else:
                last_num = max(last_num+1, down_cnt)
                ans_l.append(last_num)
        for d in range(down_cnt):
            if d==0:
                if last_num > down_cnt:
                    last_num = down_cnt-1
                else:
                    last_num-=1
                ans_l.append(last_num)
            else:
                last_num-=1
                ans_l.append(last_num)

    # print(ans_l)
    print(sum(ans_l))

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
import math
a,b,x = map(int, input().split())

tan = (a*a*a)/(2*(a*a*b-x))
tan_thre = a/b

if tan > tan_thre:
    ans = math.degrees(math.atan(tan))
    print(90-ans)
else:
    tan = 2*x/(a*b*b)
    ans = math.degrees(math.atan(tan))
    print(90-ans)

Fixed submission:
import math
a,b,x = map(int, input().split())

if a*a*b == x:
    print(0)
    exit()

tan = (a*a*a)/(2*(a*a*b-x))
tan_thre = a/b

if tan > tan_thre:
    ans = math.degrees(math.atan(tan))
    print(90-ans)
else:
    tan = 2*x/(a*b*b)
    ans = math.degrees(math.atan(tan))
    print(90-ans)
Buggy python submission (verdict: Time Limit Exceeded):
import bisect

def main():
    n = int(input())
    ll = list(map(int, input().split()))
    ll.sort()

    ans = 0
    for i in range(n-2):
        e1 = ll[i]
        for j in range(i+1, n-1):
            e2 = ll[j]
            ans += bisect.bisect_left(ll[j+1:], e1+e2)

    print(ans)


if __name__ == "__main__":
    main()

Fixed submission:
import bisect

n = int(input())
ll = list(map(int, input().split()))
ll.sort()

ans = 0
for i in range(n-2):
    e1 = ll[i]
    for j in range(i+1, n-1):
        e2 = ll[j]
        ans += bisect.bisect_left(ll[j+1:], e1+e2)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import bisect

n = int(input())
ll = list(map(int, input().split()))
ll.sort()

ans = 0
for i in range(n-2):
    e1 = ll[i]
    for j in range(i+1, n-1):
        e2 = ll[j]
        ans += bisect.bisect_left(ll[j+1:], e1+e2)

print(ans)

Fixed submission:
import bisect

n = int(input())
ll = list(map(int, input().split()))
ll.sort()

ans = 0
for i in range(n-2):
    e1 = ll[i]
    for j in range(i+1, n-1):
        e2 = ll[j]
        ans += bisect.bisect_left(ll[j+1:], e1+e2)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

N, M = map(int, input().split()) 
asl = []
for _ in range(M):
    a, b = map(int, input().split()) 
    cl = list(map(int, input().split())) 
    s = 0
    for c in cl:
        s += 1<<(c-1)
    asl.append([a,s])

INF = 10**8
dp = [INF]*(2**N)
dp[0] = 0
for i in range(2**N):
    for as_v in asl:
        a, s = as_v
        dp[i|s] = min(dp[i]+a ,dp[i|s])

ans = dp[2**N-1]
if ans == INF:
    print(-1)
else:
    print(ans)


Fixed submission:
N, M = map(int, input().split()) 
asl = []
for _ in range(M):
    a, b = map(int, input().split()) 
    cl = list(map(int, input().split())) 
    s = 0
    for c in cl:
        s += 1<<(c-1)
    asl.append([a,s])

INF = 10**8
dp = [INF]*(2**N)
dp[0] = 0
for i in range(2**N):
    for as_v in asl:
        a, s = as_v
        dp[i|s] = min(dp[i]+a ,dp[i|s])

ans = dp[2**N-1]
if ans == INF:
    print(-1)
else:
    print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
ans(n*(n-1)//2)

Fixed submission:
n = int(input())
print(n*(n-1)//2)