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

sys.setrecursionlimit(2000000)

def re(r,k,l):
    if k==0:return r
    while(k<l[0]):
        l=l[1:]
    return re(r+1,k-l[0],l)





n=int(input())
i=1
l6=[]
ans=10**5
while(i<n):
    l6.append(i)
    i*=6
i=1
l9=[]
while(i<n):
    l9.append(i)
    i*=9
l6.sort(reverse=True)
l9.sort(reverse=True)
for i in range(n+1):
    ans=min(ans,re(0,n-i,l6)+re(0,i,l9))
print(ans)

Fixed submission:
import sys

sys.setrecursionlimit(2000000)

def re(r,k,l):
    if k==0:return r
    while(k<l[0]):
        l=l[1:]
    return re(r+1,k-l[0],l)





n=int(input())
i=1
l6=[]
ans=10**5
while(i<=n):
    l6.append(i)
    i*=6
i=1
l9=[]
while(i<=n):
    l9.append(i)
    i*=9
l6.sort(reverse=True)
l9.sort(reverse=True)
for i in range(n+1):
    ans=min(ans,re(0,n-i,l6)+re(0,i,l9))
print(ans)

Buggy python submission (verdict: Runtime Error):
def re(r,k,l):
    if k==0:return r
    while(k<l[0]):
        l=l[1:]
    return re(r+1,k-l[0],l)





n=int(input())
i=1
l6=[]
ans=10**5
while(i<n):
    l6.append(i)
    i*=6
i=1
l9=[]
while(i<n):
    l9.append(i)
    i*=9
l6.sort(reverse=True)
l9.sort(reverse=True)
for i in range(n):
    ans=min(ans,re(0,n-i,l6)+re(0,i,l9))
print(ans)

Fixed submission:
import sys

sys.setrecursionlimit(2000000)

def re(r,k,l):
    if k==0:return r
    while(k<l[0]):
        l=l[1:]
    return re(r+1,k-l[0],l)





n=int(input())
i=1
l6=[]
ans=10**5
while(i<=n):
    l6.append(i)
    i*=6
i=1
l9=[]
while(i<=n):
    l9.append(i)
    i*=9
l6.sort(reverse=True)
l9.sort(reverse=True)
for i in range(n+1):
    ans=min(ans,re(0,n-i,l6)+re(0,i,l9))
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
if n==1:
    print("0")
    exit()
l=[list(map(int,input().split())) for _ in range(n-1)]
for i in range(n):
    t=0
    k=i
    while k<n-1:
        if l[k][1]>t:
            t=l[k][0]+l[k][1]
            k+=1
            continue
        elif t%l[k][2]==0:
            t+=l[k][0]
            k+=1
            continue
        else:t+=1
    print(t)

Fixed submission:
n=int(input())
if n==1:
    print("0")
    exit()
l=[list(map(int,input().split())) for _ in range(n-1)]
for i in range(n):
    t=0
    k=i
    while k<n-1:
        if l[k][1]>t:
            t=l[k][0]+l[k][1]
            k+=1
            continue
        elif t%l[k][2]==0:
            t+=l[k][0]
            k+=1
            continue
        else:t+=l[k][2]-t%l[k][2]
    print(t)
Buggy python submission (verdict: Time Limit Exceeded):
s=input()
a=s.find("A")
z0=s.count("Z")
for i in range (z0-1):
    s=s[:s.find("Z")]+"a"+s[s.find("Z")+1:]
z=s.find("Z")
print(z-a+1)
    

Fixed submission:
s=input()
for i in range(len(s)):
    if s[i]=="A":
        a=i
        break
for j in range(len(s)):
    if s[-j-1]=="Z":
        z=(len(s)-j)
        break
print(z-a)

Buggy python submission (verdict: Runtime Error):
s=input()
a=s.find("A")
z0=s.count("Z")
for i in range (z0-1):
    s=s[:s.find("Z")]+"a"+s[s.find("Z")+1:]
    z=s.find("Z")
print(z-a+1)
    

Fixed submission:
s=input()
for i in range(len(s)):
    if s[i]=="A":
        a=i
        break
for j in range(len(s)):
    if s[-j-1]=="Z":
        z=(len(s)-j)
        break
print(z-a)

Buggy python submission (verdict: Runtime Error):
s=input()
a=s.find("a")
z0=s.count("z")
for i in range (z0-1):
    s=s[:s.find("z")]+"a"+s[s.find("z")+1:]
    z=s.find("z")
print(z-a+1)
    

Fixed submission:
s=input()
for i in range(len(s)):
    if s[i]=="A":
        a=i
        break
for j in range(len(s)):
    if s[-j-1]=="Z":
        z=(len(s)-j)
        break
print(z-a)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
k=1
ans=0
for i in range (n):
    k=k*(i+1)
for j in range(k):
    if k%(j+1)==0:
        ans+=1
print(ans%1000000007)


Fixed submission:
n=int(input())
l=[k for k in range(1,n+1)]
phrase=[]
ans=1
a=1
def prime(x):
    i=2
    while i*i<=x:
        if x%i==0:
            return False
        i+=1
    return True
for i in range(2,n+1):
    if prime(i):
        phrase.append(i)
for j in phrase:
    for m in range(n):
        while l[m]%j==0:
            a+=1
            l[m]=l[m]/j
    ans=ans*a
    a=1
print(ans%1000000007)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
dp = [[-1 for _ in range(N+1)] for _ in range(100)]
dp[0][0] = 1000
for n in range(1,N):
    for i in range(250):
        # n日目
        for j in range(250):
        # n-1日目
            if dp[j][n-1] != -1:
                dp[i][n] = max(dp[j][n-1]+(j-i)*A[n-1],dp[i][n])
ans = 1000
for i in range(20):
    if dp[i][-2] != -1:
        if dp[i][-2]+i*A[-1] > ans:
            ans = dp[i][-2]+i*A[-1]
print(ans)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
# 単純な話
money = 1000
stock = 0
for i in range(N-1):
    if A[i]<A[i+1]:
        stock += money//A[i]
        money %= A[i]
        money += stock*A[i+1]
        stock = 0
print(money)
Buggy python submission (verdict: Runtime Error):
N = int(input())
ans = 0
for i in range(1,N+1):
    last = N//j
    ans += ((1+last)*last//2)*i
print(ans)

Fixed submission:
N = int(input())
ans = 0
for i in range(1,N+1):
    last = N//i
    ans += ((1+last)*last//2)*i
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
import sympy
num = 0
for i in range(1,N+1):
    num += i*sympy.divisor_count(i)
print(num)

Fixed submission:
N = int(input())
ans = 0
for i in range(1,N+1):
    last = N//i
    ans += ((1+last)*last//2)*i
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
import sympy
num = 0
for i in range(1,N+1):
    num += i*sympy.divisor_count(i)
print(num)

Fixed submission:
N = int(input())
ans = 0
for i in range(1,N+1):
    last = N//i
    ans += ((1+last)*last//2)*i
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
def convert(n,k):
    result = ""
    while n>0:
        result = al[(n%k)-1]+result
        n //= k
    return result
print(convert(N,26))

Fixed submission:
n = int(input())
al=["z"]+[chr(ord('a') + i) for i in range(25)]
result = ""
while n>0:
    if n%26 !=0:
        result = al[n%26]+result
        n //= 26
    else:
        result = al[n%26]+result
        n //= 26
        n -= 1
print(result)
Buggy python submission (verdict: Runtime Error):
X,N = map(int,input().split())
if N>0:
    p = list(map(int,input().split()))
ans = []
for i in range(100):
    ans.append(X-i)
    ans.append(X+i)
import sys
for j in ans:
    if j not in p:
        print(j)
        sys.exit()

Fixed submission:
X,N = map(int,input().split())
if N>0:
    p = list(map(int,input().split()))
else:
    p = []
ans = []
for i in range(100):
    ans.append(X-i)
    ans.append(X+i)
import sys
for j in ans:
    if j not in p:
        print(j)
        sys.exit()
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
A.sort()
ans = 0
while len(A)>1:
    p = A[0]
    if A[0] != A[1]:
        A = [j for j in A if j % p !=0]
        ans += 1
    else:
        A = [j for j in A if j % p !=0]
if len(A)==1:
    print(ans+1)
else:
    print(ans)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
A.sort()
from collections import Counter
AA = Counter(A)
dp = [True]*(A[-1]+1)
ans = 0
for k,v in AA.items():
    if dp[k]==True and v == 1:
        ans += 1
    for i in range(A[-1]//k+1):
        dp[k*i] = False
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
A.sort()
ans = 0
while len(A)>1:
    p = A[0]
    if len(A)==1:
        ans += 1
    else:
        if A[0] != A[1]:
            A = [j for j in A if j % p !=0]
            ans += 1
        else:
            A = [j for j in A if j % p !=0]
if len(A)==1:
    print(ans+1)
else:
    print(ans)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
A.sort()
from collections import Counter
AA = Counter(A)
dp = [True]*(A[-1]+1)
ans = 0
for k,v in AA.items():
    if dp[k]==True and v == 1:
        ans += 1
    for i in range(A[-1]//k+1):
        dp[k*i] = False
print(ans)
Buggy python submission (verdict: Runtime Error):
A,B = map(float,input().split())
Aint = int(A)
Bint = int(B*100)
print(int((A*B100)//100))

Fixed submission:
from decimal import *
A,B = map(str,input().split())
print(int(Decimal(A)*Decimal(B)))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))

ans = 0
for i in range(N):
    for j in range(i,N):
        if j-i==A[i]+A[j]:
            ans += 1
print(ans)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
L = []
for i in range(N):
    L.append(i-A[i])
R = []
for j in range(N):
    R.append(j+A[j])
from collections import Counter
LL = Counter(L)
RR = Counter(R)
ans = 0
for k,v in RR.items():
    ans += v*LL[k]
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))

ans = 0
for i in range(N):
    for j in range(j,N):
        if j-i==A[i]+A[j]:
            ans += 1
print(ans)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
L = []
for i in range(N):
    L.append(i-A[i])
R = []
for j in range(N):
    R.append(j+A[j])
from collections import Counter
LL = Counter(L)
RR = Counter(R)
ans = 0
for k,v in RR.items():
    ans += v*LL[k]
print(ans)
Buggy python submission (verdict: Runtime Error):
A,B,N = map(int,input().split())

if N<= B-1:
    ans = (N*A)//B
else:
    ans = ((B-1)*A)//B
    
print(ans)

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

for i in range(0,B-A+1):
    if (A+i)%K==0:
        print("OK")
        sys.exit()
else:
    print("NG")
Buggy python submission (verdict: Runtime Error):
A,B,N = map(int,input().split())

if N<= B-1:
    ans = (N*A)//B
else:
    ((B-1)*A)//B
    
print(ans)

Fixed submission:
A,B,N = map(int,input().split())

if N<= B-1:
    ans = (N*A)//B
else:
    ans = ((B-1)*A)//B
    
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import collections
S = input()

a = []
s = int(S[-1])
for i in range(2,len(S)+1):
    s += int(S[-i])*(10**(i-1))
    #print(s)
    a.append(s%2019)

A = collections.Counter(a)
#print(A)

ans = 0
for i in A.values():
    if i>=2:
        ans += int(i*(i-1)/2)

ans += A[0]
print(ans)

Fixed submission:
S = input()
dp = [0 for i in range(2019)]
dp[0] = 1

num = 0
for i,j in enumerate(S[::-1]):
    num += int(j)*(pow(10,i,2019))
    dp[num%2019] += 1

ans = 0
for m in dp:
    if m >= 2:
        ans += int(m*(m-1)/2)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
ans = 0
for i in range(len(S)):
    s = S[i]
    for j in range(i+1,len(S)):
        s += S[j]
        #print(s)
        if int(s)%2019==0:
            ans += 1
print(ans)

Fixed submission:
S = input()
dp = [0 for i in range(2019)]
dp[0] = 1

num = 0
for i,j in enumerate(S[::-1]):
    num += int(j)*(pow(10,i,2019))
    dp[num%2019] += 1

ans = 0
for m in dp:
    if m >= 2:
        ans += int(m*(m-1)/2)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
ans = 0
for i in range(len(S)):
    for j in range(i,len(S)):
        s = int(S[i:j+1])
        # print(s)
        if s%2019==0:
            ans += 1
print(ans)

Fixed submission:
S = input()
dp = [0 for i in range(2019)]
dp[0] = 1

num = 0
for i,j in enumerate(S[::-1]):
    num += int(j)*(pow(10,i,2019))
    dp[num%2019] += 1

ans = 0
for m in dp:
    if m >= 2:
        ans += int(m*(m-1)/2)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
import fractions
import itertools
A = list(itertools.product(range(1,K+1),repeat=3))
ans = 0
for i in A:
    num = i[0]
    for j in range(1,3):
        num = fractions.gcd(num,i[j])
    ans += num
print(ans)

Fixed submission:
K = int(input())
import math
from functools import reduce


def gcd (*numbers):
  return reduce(math.gcd,numbers)

ans = 0
for a in range(1,K+1):
  for b in range(1,K+1):
    for c in range(1,K+1):
      ans += gcd(a,b,c)

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

if N>=K:
    x = N%K
    print(min(x,abs(K-x))
else:
    print(min(N,abs(K-N))

Fixed submission:
N,K = map(int,input().split())

if N>=K:
    x = N%K
    print(min(x,abs(K-x)))
else:
    print(min(N,abs(K-N)))

Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())



if N>=K:
    x = N%K
    print(min(x,abs(K-x))
else:
          N<K
          print(min(N,abs(K-N))

Fixed submission:
N,K = map(int,input().split())

if N>=K:
    x = N%K
    print(min(x,abs(K-x)))
else:
    print(min(N,abs(K-N)))

Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())

if N%K==0:
    print(0)
else:
    x = abs(N-K)
    for i in range(N/K):
        x = min(x,abs(x-K))
    print(x)    

Fixed submission:
N,K = map(int,input().split())

if N>=K:
    x = N%K
    print(min(x,abs(K-x)))
else:
    print(min(N,abs(K-N)))
Buggy python submission (verdict: Time Limit Exceeded):
import collections
K = int(input())

def lunlun(x):
  X = collections.deque(str(x))
  if len(X)==1:
    return True
  for i in range(len(X)-1):
   if abs(int(X[1]) - int(X.popleft())) >1:
     return False
  return True

i = 0
j = 1
while i<K:
  if lunlun(j):
    i +=1
  j += 1

print(j-1)

Fixed submission:
from collections import deque
import sys
K = int(input())
q = deque([1,2,3,4,5,6,7,8,9])
num = 0
if K<=9:
    print(q[K-1])
    sys.exit()
for i in range(10**5):
    p = q.popleft()
    num += 1
    if num == K:
        print(p)
    if p%10 != 0:
        q.append(p*10+p%10-1)
    q.append(p*10+p%10)
    if p%10 != 9:
        q.append(p*10+p%10+1)

Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())

def lunlun(n):
    x = str(n)
    if len(x)==1:
        return True
    else:
        for i in range(len(x)-1):
            if abs(int(x[i])-int(x[i+1]))>1:
                return False
        else:
            return True

i = 0
j = 1
while i<K:
  if lunlun(j):
    i +=1
  j += 1

print(j-1)

Fixed submission:
from collections import deque
import sys
K = int(input())
q = deque([1,2,3,4,5,6,7,8,9])
num = 0
if K<=9:
    print(q[K-1])
    sys.exit()
for i in range(10**5):
    p = q.popleft()
    num += 1
    if num == K:
        print(p)
    if p%10 != 0:
        q.append(p*10+p%10-1)
    q.append(p*10+p%10)
    if p%10 != 9:
        q.append(p*10+p%10+1)
Buggy python submission (verdict: Runtime Error):
K,N = map(int,input().split())
A = list(map(int,input().split()))

B = [K]*N
for i in range(N):
    B[i] += A[i]
    
C = A+B

for i in range(2*N):
    ans = 2*K
    l = 0
    if i<N:
        for j in range(N-1):
            l += C[i+j+1]-C[i+j]
        if l<ans:
            ans = l
    else:
        for j in range(N-1):
            l += C[i-j]-C[i-j-1]
        if l<ans:
            ans = l
            
print(ans)

Fixed submission:
S = input()

if S[2]==S[3] and S[4]==S[5]:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
import collections
import copy
N = int(input())
A = list(map(int,input().split()))
AA = collections.Counter(A)

for i in range(N):
    ans = 0
    AAA = copy.copy(AA)
    AAA[A[i]] -= 1
    for j in AAA.values():
        if j>=2:
            ans += int(j*(j-1)/2)
    print(ans)

Fixed submission:
import collections
import copy
N = int(input())
A = list(map(int,input().split()))
AA = collections.Counter(A)
ans = sum([i*(i-1)//2 for i in AA.values()])

for i in range(N):
    num = ans
    num -= AA[A[i]]-1
    print(num)

Buggy python submission (verdict: Time Limit Exceeded):
import collections
import copy
N = int(input())
A = list(map(int,input().split()))

for i in range(N):
    ans = 0
    AA = copy.copy(A)
    AA.pop(i)
    AAA = collections.Counter(AA)
    for j in AAA.values():
        if j>=2:
            ans += int(j*(j-1)/2)
    print(ans)

Fixed submission:
import collections
import copy
N = int(input())
A = list(map(int,input().split()))
AA = collections.Counter(A)
ans = sum([i*(i-1)//2 for i in AA.values()])

for i in range(N):
    num = ans
    num -= AA[A[i]]-1
    print(num)

Buggy python submission (verdict: Runtime Error):
import collections
N = int(input())
A = list(map(int,input().split()))

for i in range(N):
    ans = 0
    AA = A.copy()
    AA.pop(i)
    AAA = collections.Counter(AA)
    for j in AAA.values():
        if j>=2:
            ans += int(j*(j-1)/2)
    print(ans)

Fixed submission:
import collections
import copy
N = int(input())
A = list(map(int,input().split()))
AA = collections.Counter(A)
ans = sum([i*(i-1)//2 for i in AA.values()])

for i in range(N):
    num = ans
    num -= AA[A[i]]-1
    print(num)
Buggy python submission (verdict: Runtime Error):
H,W = map(int,input().split())
for i in range(W):
    if i%2==0:
        if H%2==0:
            num += H//2
        else:
            num += H//2+1
    else:
        num += H//2
print(num)

Fixed submission:
H,W = map(int,input().split())
if H==1 or W==1:
    print(1)
else:
    if H%2==0 or W%2==0:
        print(H*W//2)
    else:
        print(H*W//2+1)
Buggy python submission (verdict: Time Limit Exceeded):
n,a,b = map(int,input().split())
# nCr(r:1~n)-nCa-nCb
mod = 10**9+7
def comb(n,r):
    res = 1
    for i in range(1,n+1):
        res = res*i%mod
    for i in range(1,r+1):
        res = res*pow(i,mod-2,mod)%mod
    for i in range(1,n-r+1):
        res = res*pow(i,mod-2,mod)%mod
    return res
ans = 0
for i in range(1,n+1):
    ans = (ans+comb(n,i))%mod
print((ans-comb(n,a)-comb(n,b))%mod)

Fixed submission:
n,a,b = map(int,input().split())
mod = 10**9+7
from functools import reduce

def comb(r):
    num = reduce(lambda x, y: x * y % mod, [n - r + k + 1 for k in range(r)])
    dem = reduce(lambda x, y: x * y % mod, [k+1 for k in range(r)])
    return num*pow(dem,mod-2,mod)%mod

ans = (pow(2,n,mod)-1-comb(a)-comb(b))%mod
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
P = [int(p) for p in input().split()]

E = []
for i in range(len(P)):
  E.append((1+P[i])/2)

Ex = []
for j in range(0,len(P)-K+1):
  Ex.append(sum(E[j:j+K]))

print(max(Ex))

Fixed submission:
N,K = map(int,input().split())
p = list(map(int,input().split()))
from itertools import accumulate
pac = [0]+list(accumulate(p))
num = 0
for i in range(N-K+1):
    num = max(pac[i+K]-pac[i],num)
print((K+num)/2)

Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
P = [int(p) for p in input().split()]

E = []
for i in range(len(P)):
  E.append((1+P[i])/2)

Ex = []
for j in range(0,len(P)-K+1):
  Ex.append(sum(E[j:j+K]))

print(max(Ex))

Fixed submission:
N,K = map(int,input().split())
p = list(map(int,input().split()))
from itertools import accumulate
pac = [0]+list(accumulate(p))
num = 0
for i in range(N-K+1):
    num = max(pac[i+K]-pac[i],num)
print((K+num)/2)
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**18)

N = int(input())
memo={0:1,1:1,2:2}

def func(n):
    if n in memo:
        return memo[n]
    memo[n] = n*func(n-2)
    return memo[n]

f = list(str(func(N)))  
ans = 0

for i in range(1,len(f)):
    if f[-i]== "0":
        ans += 1
    else:
        break
print(ans)

Fixed submission:
N = int(input())
ans = 0
if N%2 == 1:
    print(0)
else:
    for i in range(1,len(str(N))+100):
        ans += N//(2*5**i)
    print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
memo={0:1,1:1,2:2}

def func(n):
    if n in memo:
        return memo[n]
    memo[n] = n*func(n-2)
    return memo[n]

f = list(str(func(N)))  
ans = 0

for i in range(1,len(f)):
    if f[-i]== "0":
        ans += 1
    else:
        break
print(ans)

Fixed submission:
N = int(input())
ans = 0
if N%2 == 1:
    print(0)
else:
    for i in range(1,len(str(N))+100):
        ans += N//(2*5**i)
    print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())

def func(n):
    if n<2:
        return 1
    else:
        return n*func(n-2)

f = list(str(func(N)))  
ans = 0

for i in range(1,len(f)):
    if f[-i]== "0":
        ans += 1
    else:
        break
print(ans)

Fixed submission:
N = int(input())
ans = 0
if N%2 == 1:
    print(0)
else:
    for i in range(1,len(str(N))+100):
        ans += N//(2*5**i)
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
mod = 10**9+7
ans = 0
for i in range(N):
    for j in range(i,N):
        ans += (A[i]^A[j])%mod
print(ans%mod)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
mod = 10**9+7
ans = 0

for bit in range(60):
    m = 1 << bit
    # bit桁目のbitが立っている時の数
    c = sum(a&m for a in A) >> bit
    # bit桁目の1の合計
    ans += (c*(N-c))<<bit
    # 繰り上がりのない足し算
    ans %= mod
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
mod = 10**9+7
for i in range(N):
    for j in range(i,N):
        ans += (i^j)%mod
print(ans%mod)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
mod = 10**9+7
ans = 0

for bit in range(60):
    m = 1 << bit
    # bit桁目のbitが立っている時の数
    c = sum(a&m for a in A) >> bit
    # bit桁目の1の合計
    ans += (c*(N-c))<<bit
    # 繰り上がりのない足し算
    ans %= mod
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
mod = 10**9+7
from itertools import combinations
AA = list(combinations(A,2))
ans = 0
for a,b in AA:
    ans += a^b
print(ans%mod)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
mod = 10**9+7
ans = 0

for bit in range(60):
    m = 1 << bit
    # bit桁目のbitが立っている時の数
    c = sum(a&m for a in A) >> bit
    # bit桁目の1の合計
    ans += (c*(N-c))<<bit
    # 繰り上がりのない足し算
    ans %= mod
print(ans)
Buggy python submission (verdict: Runtime Error):
A,B = map(int,input())
if 1<=A<=9 and 1<=B<=9:
  print(A*B)
else:
  print("-1")

Fixed submission:
A,B = map(int,input().split())
if 1<=A<=9 and 1<=B<=9:
  print(A*B)
else:
  print("-1")
Buggy python submission (verdict: Runtime Error):
import math
a,b,x = map(int,input().split())

if x>=a*a*b/2:
  tanθ = math.degrees(math.atan(a**2/(2*(a*b-x/a))))
elif 0<x<a*a*b/2:
  tanθ = math.degrees(math.atan(2*x/(a*b*b)))
elif x==0:
  tanθ = 90

print(90-tanθ)

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

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

print(90-tanθ)

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

if x>=a*a*b/2:
  tanθ = math.degrees(math.atan(a**2/(2*(a*b-x/a))))
else:
  tanθ = math.degrees(math.atan(2*x/(a*b*b)))

print(90-tanθ)

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

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

print(90-tanθ)
Buggy python submission (verdict: Runtime Error):
A,B = int(input())
L = A-2*B

if L>=0:
    print(L)
else:
    print(0)

Fixed submission:
A,B = map(int,input().split())
L = A-2*B

if L>=0:
    print(L)
else:
    print(0)