Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
s=list(map(int,input()))
count=0
k=len(s)-2
i=0
while i<=k:
    if s[i]!=s[i+1]:
        s.remove(s[i])
        s.remove(s[i])
        k-=2
        count+=2
        if i!=0:
            i-=1
    else:
        i+=1
    
print(count) 


Fixed submission:
n=input()
a=n.count('1')
b=n.count('0')
if a<b:
    print(2*a)
else:
    print(2*b)
Buggy python submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
lcount=[0]*10**9
count=0
for i in l:
    lcount[i]+=1
    if lcount[i]>i:
        count+=1
for j in l:
    if lcount[j]<j:
        count+=1
print(count)

Fixed submission:
n=int(input())
l=list(map(int,input().split()))
count=0
lcount=[0]*(10**5+1)
for i in l:
    if i>10**5:
        count+=1
    else:
        lcount[i]+=1
        if lcount[i]>i:
            count+=1
for j in l:
    if j<=10**5 and lcount[j]<j:
        count+=1
print(count)
Buggy python submission (verdict: Runtime Error):
n=int(input())
l=list(map(str,input().split()))
lis=[0]
count=0
for i in range(n):
  if l[i]='D':
    lis.append(count-1)
    count-=1
  else:
    lis.append(count+1)
    count+=1
print(max(lis))

Fixed submission:
n=int(input())
l=list(map(str,input()))
count=0
lis=[0]
for i in range(n):
    if  l[i]=='D':
        lis.append(count-1)
        count-=1
    else:
        lis.append(count+1)
        count+=1
print(max(lis))
Buggy python submission (verdict: Runtime Error):
n=int(input())
i=1
num=0
suml=[0]
while num<=10**2:
    num+=i
    suml.append(num)
    i+=1

j=1
while n>suml[j]:
    j+=1
k=suml[j]-n
for ii in range(1,j+1):
    if ii!=k:
        print(ii)

Fixed submission:
n=int(input())
i=1
num=0
suml=[0]
while num<=10**7+1000:
    num+=i
    suml.append(num)
    i+=1

j=1
while n>suml[j]:
    j+=1
k=suml[j]-n
for ii in range(1,j+1):
    if ii!=k:
        print(ii)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict
import sys
# Binary Indexed Tree (Fenwick Tree)
class BIT():
    def __init__(self, n):
        '''
        n = 要素数
        要素の添字iは 0 <= i < n となる
        '''
        self.n = n
        self.bit = [0] * (n + 1)

    def add(self, i, value):
        '''i番目の要素にvalueを加算する O(logN)'''
        i = i + 1
        while i <= self.n:
            self.bit[i] += value
            i += i & -i

    def _sum(self, i):
        s = 0
        while i > 0:
            s += self.bit[i]
            i -= i & -i
        return s

    def sum(self, l, r):
        '''区間[l, r)の和を求める O(logN)'''
        return self._sum(r) - self._sum(l)


input = sys.stdin.readline
N, Q = map(int, input().split())
C = list(map(int, input().split()))
LR = [tuple(map(int, input().split())) for _ in range(Q)]
query = [[] for _ in range(N)]
for i, (l, r) in enumerate(LR):
    query[l-1].append((i, r-1))

hist = defaultdict(lambda: -1)
nx = [-1] * N
for i in range(N-1, -1, -1):
    nx[i] = hist[C[i]]
    hist[C[i]] = i

bit = BIT(N)
ans = [None]*Q
for l in range(N-1,-1,-1):
    if nx[l] != -1:
        bit.add(nx[l],-1)
    for i,r in query[l]:
        ans[i] = (r-l+1) + bit.sum(l,r+1)

print(*ans,sep = '\n')

Fixed submission:
from collections import defaultdict
import sys
# Binary Indexed Tree (Fenwick Tree)
class BIT():
    def __init__(self, n):
        '''
        n = 要素数
        要素の添字iは 0 <= i < n となる
        '''
        self.n = n
        self.bit = [0] * (n + 1)

    def add(self, i, value):
        '''i番目の要素にvalueを加算する O(logN)'''
        i = i + 1
        while i <= self.n:
            self.bit[i] += value
            i += i & -i

    def _sum(self, i):
        s = 0
        while i > 0:
            s += self.bit[i]
            i -= i & -i
        return s

    def sum(self, l, r):
        '''区間[l, r)の和を求める O(logN)'''
        return self._sum(r) - self._sum(l)


input = sys.stdin.readline
N, Q = map(int, input().split())
C = list(map(int, input().split()))
LR = [tuple(map(int, input().split())) for _ in range(Q)]
query = [[] for _ in range(N)]
for i, (l, r) in enumerate(LR):
    query[l-1].append((i, r-1))

hist = defaultdict(lambda: -1)
nx = [-1] * N
for i in range(N-1, -1, -1):
    nx[i] = hist[C[i]]
    hist[C[i]] = i

bit = BIT(N)
ans = [None]*Q
for l in range(N-1,-1,-1):
    if nx[l] != -1:
        bit.add(nx[l],-1)
    for i,r in query[l]:
        ans[i] = (r-l+1) + bit.sum(l,r+1)

print(*ans,sep = '\n')
Buggy python submission (verdict: Time Limit Exceeded):
a,b,c = map(int, input().split())
k = int(input())

while k:
    if a>=b:
        b *= 2
        k -= 1
    elif b>=c:
        c *= 2
        k -= 1

if a<b and b<c:
    print("Yes")
else:
    print("No")



Fixed submission:
a,b,c = map(int, input().split())
k = int(input())

while k:
    if a>=b:
        b *= 2
        k -= 1
    elif b>=c:
        c *= 2
        k -= 1
    else:
        break

if a<b and b<c:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = list(map(int, input().split()))
s = 1
for i in range(k):
    s *= a[i]
# s = sum(a[:k])
pre = s
for i in range(1,n-k+1):
    s /= a[i-1]
    s *= a[i+k-1]
    if s > pre:
        print("Yes")
    else:
        print("No")
    pre = s




Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))
# s = 1
# for i in range(k):
#     s *= a[i]
# # s = sum(a[:k])
# pre = s
for i in range(1,n-k+1):
    if a[i+k-1]/a[i-1]>1:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
a.sort()
f=[1]*(2*10**5+10)
from collections import Counter
c=Counter(a)
ans=0
for ai in a:
  if c[ai]==1 and f[ai]==1:ans+=1
  for i in range(ai,2*10**5,ai):
    f[i]=0
print(ans)



Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a.sort()
from collections import Counter
c=Counter(a)
f=[1]*(10**6+1)
ans=0
for ai in a:  
  if c[ai]==1 and f[ai]==1:ans+=1
  if f[ai]==1:
    for i in range(ai,10**6+1,ai):
      f[i]=0
print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
a.sort()
f=[1]*(2*10**5+1)
from collections import Counter
c=Counter(a)
ans=0
for ai in a:
  if c[ai]==1 and f[ai]==1:ans+=1
  for i in range(ai,2*10**5,ai):
    f[i]=0
print(ans)



Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a.sort()
from collections import Counter
c=Counter(a)
f=[1]*(10**6+1)
ans=0
for ai in a:  
  if c[ai]==1 and f[ai]==1:ans+=1
  if f[ai]==1:
    for i in range(ai,10**6+1,ai):
      f[i]=0
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
a = list(map(int,input().split()))

d = 60
dp = [[-1]*N for _ in range(d+1)]
for i in range(N):
    dp[0][i] = a[i]-1

for i in range(d):
    for j in range(N):
        dp[i+1][j] = dp[i][dp[i][j]]

ans = 0

for i in range(d):
    if K & (1<<i):
        ans = dp[i][ans]

print(ans+1)




Fixed submission:
n,k=map(int,input().split())
a=list(map(int,input().split()))
visited=[]
o=(n+1)*[-1]
cycle,l=1,0
v=1
while o[v]==-1:
  o[v]=len(visited)
  visited.append(v)
  v=a[v-1]
cycle=len(visited)-o[v]
l=o[v]
if k<l:
  print(visited[k])
else:
  k-=l
  k%=cycle
  print(visited[l+k])

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

d = 60
dp = [[-1]*N for _ in range(d+1)]
for i in range(n):
    dp[0][i] = a[i]-1

for i in range(d):
    for j in range(n):
        dp[i+1] = dp[i][dp[i][j]]

ans = 0

for i in range(d):
    if K & (1<<i):
        ans = dp[i][ans]

print(ans)




Fixed submission:
n,k=map(int,input().split())
a=list(map(int,input().split()))
visited=[]
o=(n+1)*[-1]
cycle,l=1,0
v=1
while o[v]==-1:
  o[v]=len(visited)
  visited.append(v)
  v=a[v-1]
cycle=len(visited)-o[v]
l=o[v]
if k<l:
  print(visited[k])
else:
  k-=l
  k%=cycle
  print(visited[l+k])

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

d=60
dp=[[-1]*n for i in range(d+1)]
for i,aa in enumerate(a):
  dp[0][i]=aa-1
for i in range(d):
  for j in range(n):
    dp[i+1][j]=dp[i][dp[i][j]]
ans=0
for i in range(d):
  if k&(1<<i):
    ans=dp[i][ans]
print(ans+1)


Fixed submission:
n,k=map(int,input().split())
a=list(map(int,input().split()))
visited=[]
o=(n+1)*[-1]
cycle,l=1,0
v=1
while o[v]==-1:
  o[v]=len(visited)
  visited.append(v)
  v=a[v-1]
cycle=len(visited)-o[v]
l=o[v]
if k<l:
  print(visited[k])
else:
  k-=l
  k%=cycle
  print(visited[l+k])

Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(int,input().split()))
from collections import Counter
c=Counter()
c[1]+=1

cycle_num=-1
i=0
cnt=0
b=[]
while cnt<2*10**5+1:
  c[a[i]]+=1
  b.append(a[i])
  if c[a[i]]>1 or a[i]==1:
    cycle_num=a[i]
    break
  i=a[i]-1
  cnt+=1
# print(b)
# print(cycle_num)
cycle=[]
b=[1]+b
for i,bb in enumerate(b):
  if bb==cycle_num:
    cycle=b[i:]
    break
  else:
    if i!=0:
      k-=1
    if k==0:
      print(bb)
      exit(0)
# print(cycle)
# syuuki=len(cycle)-1
syuuki=len(cycle)
print(cycle[(k%syuuki)+1])


Fixed submission:
n,k=map(int,input().split())
a=list(map(int,input().split()))
visited=[]
o=(n+1)*[-1]
cycle,l=1,0
v=1
while o[v]==-1:
  o[v]=len(visited)
  visited.append(v)
  v=a[v-1]
cycle=len(visited)-o[v]
l=o[v]
if k<l:
  print(visited[k])
else:
  k-=l
  k%=cycle
  print(visited[l+k])
Buggy python submission (verdict: Runtime Error):
def comb(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

n,m,k=map(int,input().split())
mod=998244353
fac=[1]*n
finv=[1]*n
inv=[0]*n
inv[1]=1
for i in range(2,n):
  fac[i]=fac[i-1]*i%mod
  inv[i]=mod-inv[mod%i]*(mod//i)%mod
  finv[i]=finv[i-1]*inv[i]%mod

ans=0
for i in range(k+1):
  ans+=m*comb(n-1,i)*pow(m-1,n-1-i,mod)
  ans%=mod
print(ans)


Fixed submission:
class Combination:
    def __init__(self, n, mod):
        self.fact = [1]
        for i in range(1, n + 1):
            self.fact.append(self.fact[-1] * i % mod)
        self.inv_fact = [0] * (n + 1)
        self.inv_fact[n] = pow(self.fact[n], mod - 2, mod)
        for i in reversed(range(n)):
            self.inv_fact[i] = self.inv_fact[i + 1] * (i + 1) % mod
        self.mod = mod

    def factorial(self, k):

        return self.fact[k]

    def inverse_factorial(self, k):
        return self.inv_fact[k]

    def permutation(self, k, r):
        if k < r:
            return 0
        return (self.fact[k] * self.inv_fact[k - r]) % self.mod

    def combination(self, k, r):
        if k < r:
            return 0
        return (self.fact[k] * self.inv_fact[k - r] * self.inv_fact[r]) % self.mod

    def combination_large(self, k, r):
        if k < r:
            return 0
        res = 1
        for l in range(r):
            res *= (k - l)
            res %= self.mod
        return (res * self.inv_fact[r]) % self.mod

n, m, k = map(int, input().split())
mod = 998244353
cmb = Combination(10**6, mod)

ans = 0
for i in range(k+1):
    ans += m*cmb.combination(n-1, i)*pow(m-1, n-1-i, mod)
    ans %= mod
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# ABC161_C
from fractions import gcd
n,k=map(int,input().split())
if k==1:
    print(0)
    exit()


while n>abs(n-k):
    n=abs(n-k)
if n==k:
    n=0
print(n)
# ans=0
# ans=gcd(n,k)

# print(ans)
# ans=0
# # a=abs(n-k)
# ans=n%a
# print(ans)
# a=abs(n-k)
# # t=0
# while n>a:
#     n=n%a
# print(n)




Fixed submission:
# ABC161_C
n,k=map(int,input().split())
t=n%k
print(min(t,k-t))

Buggy python submission (verdict: Time Limit Exceeded):
# ABC161_C
from fractions import gcd
n,k=map(int,input().split())
if k==1:
    print(0)
    exit()


while n>abs(n-k):
    n=abs(n-k)
if n==k:
    n=0
print(n)
# ans=0
# ans=gcd(n,k)

# print(ans)
# ans=0
# # a=abs(n-k)
# ans=n%a
# print(ans)
# a=abs(n-k)
# # t=0
# while n>a:
#     n=n%a
# print(n)




Fixed submission:
# ABC161_C
n,k=map(int,input().split())
t=n%k
print(min(t,k-t))
Buggy python submission (verdict: Time Limit Exceeded):
n,x,y=map(int,input().split())
for k in range(1,n):
  cnt=0
  for i in range(1,n):
    for j in range(i+1,n+1):
      d=min(abs(j-i),abs(x-i)+1+abs(j-y),abs(y-i)+1+abs(j-x))
      if d==k:cnt+=1
  print(cnt)




Fixed submission:
# ABC160_D
from collections import deque,Counter
n,x,y=map(int,input().split())
G=[[] for i in range(n)]
dist=[-1]*n
for i in range(n-1):
    a=i
    b=i+1
    G[a].append([b,1])
    G[b].append([a,1])
G[x-1].append([y-1,1])
G[y-1].append([x-1,1])


ans=[]
for i in range(n-1):
    q=deque()
    q.append(i)
    dist=[-1]*n
    dist[i]=0
    while q:
        cur=q.popleft()
        for nx,nx_dist in G[cur]:
            if dist[nx]==-1:
                dist[nx]=dist[cur]+nx_dist
                q.append(nx)
    for j in range(i+1,n):
        ans.append(dist[j])

ans=Counter(ans)
for i in range(n-1):
    print(ans[i+1])
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
from collections import Counter
c=Counter(a)
for i in range(n):
  t=0
  for k,v in c.items():
    if k==a[i]:
      v-=1
    t+=v*(v-1)//2
  print(t)

Fixed submission:
# ABC159_D
from collections import defaultdict as dd
n=int(input())
a=list(map(int,input().split()))
d=dd(int)
for aa in a:
    d[aa]+=1
a_sum=0
for k,v in d.items():
    # if v>=2:
    a_sum+=v*(v-1)//2

for i,aa in enumerate(a):
    s=a_sum
    t=d[a[i]]
    s-=t*(t-1)//2
    t-=1
    s+=t*(t-1)//2
    print(s)
# for k,v in d.items()
Buggy python submission (verdict: Runtime Error):
# ABC 157 C
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nms = lambda: map(str, input().split())
nl = lambda: list(map(int, input().split()))
n,m=nm()
l=[0]*3
check=[0]*3
for i in range(m):
    s,c=map(int,input().split())
    s-=1
    if l[s]!=c:
        check[s]+=1
    l[s]=c
# print(l)
ans=''
if sum(l)==0:
    ans='0'
    if n==1:
        print(0)
        exit()
    else:
        print(-1)
        exit()

for cc in check:
    if cc>1:
        print(-1)
        exit()

is_zero=True

for ll in l:
    if ll==0 and is_zero==True:
        continue
    else:
        is_zero=False
        ans+=str(ll)

# print(ans)
ans2=''
for i in range(n):
    ans2+=ans[i]
print(ans2)

Fixed submission:
# ABC 157 C
n,m=map(int,input().split())
C=[list(map(int,input().split())) for i in range(m)]

for i in range(1000):
    S=str(i)

    if len(S)==n:
        for s,c in C:
            s-=1
            if S[s]==str(c):
                True
            else:
                break
        else:
            print(i)
            exit()

print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
# Binary Indexed Tree (Fenwick Tree)
class BIT():
    def __init__(self, n):
        self.n = n
        self.bit = [0] * (n + 1)

    def add(self, i, value):
        i = i + 1
        while i <= self.n:
            self.bit[i] += value
            i += i & -i

    def _sum(self, i):
        s = 0
        while i > 0:
            s += self.bit[i]
            i -= i & -i
        return s

    def sum(self, l, r):
        return self._sum(r) - self._sum(l)

n = int(input())
S = input()
q = int(input())
Query = [input().split() for _ in range(q)]

bits = [BIT(n) for i in range(26)]
s = []
for i,c in enumerate(S):
    bits[ord(c) - ord("a")].add(i,1)
    s.append(c)

for q_type,fr,to in Query:
    if q_type == "1":
        i = int(fr)-1
        bits[ord(s[i]) - ord("a")].add(i,-1)
        bits[ord(to) - ord("a")].add(i,1)
        s[i] = to
    else:
        l,r = int(fr)-1,int(to)
        tmp = 0
        for i in range(26):
            if bits[i].sum(l,r):
                tmp += 1
        print(tmp)



Fixed submission:
# Binary Indexed Tree (Fenwick Tree)
class BIT():
    def __init__(self, n):
        self.n = n
        self.bit = [0] * (n + 1)

    def add(self, i, value):
        i = i + 1
        while i <= self.n:
            self.bit[i] += value
            i += i & -i

    def _sum(self, i):
        s = 0
        while i > 0:
            s += self.bit[i]
            i -= i & -i
        return s

    def sum(self, l, r):
        return self._sum(r) - self._sum(l)

n = int(input())
S = input()
q = int(input())
Query = [input().split() for _ in range(q)]

bits = [BIT(n) for i in range(26)]
s = []
for i,c in enumerate(S):
    bits[ord(c) - ord("a")].add(i,1)
    s.append(c)

for q_type,fr,to in Query:
    if q_type == "1":
        i = int(fr)-1
        bits[ord(s[i]) - ord("a")].add(i,-1)
        bits[ord(to) - ord("a")].add(i,1)
        s[i] = to
    else:
        l,r = int(fr)-1,int(to)
        tmp = 0
        for i in range(26):
            if bits[i].sum(l,r):
                tmp += 1
        print(tmp)
Buggy python submission (verdict: Time Limit Exceeded):
# ABC 152 C
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
snm = lambda: map(str, input().split())
nl = lambda: list(map(int, input().split()))
n=ni()
p=nl()
s=[]
ans=0
for i in range(n):
    if i==0:
        ans+=1
        s.append(p[i])
        continue
    if p[i]<=min(s):
        ans+=1
    s.append(p[i])
print(ans)

Fixed submission:
# ABC 152 C
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
snm = lambda: map(str, input().split())
nl = lambda: list(map(int, input().split()))
n=ni()
p=nl()
s=[]
ans=0
min_v=10**6
for i in range(n):
    if i==0:
        ans+=1
        s.append(p[i])
        min_v=min(min_v,p[i])
        continue
    if p[i]<=min_v:
        ans+=1
    s.append(p[i])
    min_v=min(min_v,p[i])
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# ABC 152 C
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
snm = lambda: map(str, input().split())
nl = lambda: list(map(int, input().split()))
n=ni()
p=nl()
ans=0
for i in range(n):
    if i==0:
        ans+=1
        continue
    if p[i]<=min(p[:i]):
        ans+=1
print(ans)

Fixed submission:
# ABC 152 C
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
snm = lambda: map(str, input().split())
nl = lambda: list(map(int, input().split()))
n=ni()
p=nl()
s=[]
ans=0
min_v=10**6
for i in range(n):
    if i==0:
        ans+=1
        s.append(p[i])
        min_v=min(min_v,p[i])
        continue
    if p[i]<=min_v:
        ans+=1
    s.append(p[i])
    min_v=min(min_v,p[i])
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
def lcm(x,y):
  return (x*y)//gcd(x,y)
n=int(input())
a=list(map(int,input().split()))
mod=10**9+7
lcm_val=a[0]
for i in range(n-1):
  lcm_val=lcm(lcm_val,a[i+1])
# print(lcm_val)
b=[]
for aa in a:
  b.append(lcm_val//aa)

ans=0
for bb in b:
  ans+=bb
print(ans%mod)

Fixed submission:
from fractions import gcd
def lcm(x,y):
  return (x*y)//gcd(x,y)
n=int(input())
a=list(map(int,input().split()))
mod=10**9+7
lcm_val=a[0]
for i in range(n-1):
  lcm_val=lcm(lcm_val,a[i+1])
# print(lcm_val)
b=[]
ans=0
for aa in a:
  ans+=lcm_val//aa

print(ans%mod)

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
def lcm(x,y):
  return (x*y)//gcd(x,y)
n=int(input())
a=list(map(int,input().split()))
mod=10**9+7
lcm_val=a[0]
for i in range(n-1):
  lcm_val=lcm(lcm_val,a[i+1])
# print(lcm_val)
b=[]
for aa in a:
  b.append((lcm_val//aa)%mod)

ans=0
for bb in b:
  ans+=bb
  ans%mod
print(ans%mod)

Fixed submission:
from fractions import gcd
def lcm(x,y):
  return (x*y)//gcd(x,y)
n=int(input())
a=list(map(int,input().split()))
mod=10**9+7
lcm_val=a[0]
for i in range(n-1):
  lcm_val=lcm(lcm_val,a[i+1])
# print(lcm_val)
b=[]
ans=0
for aa in a:
  ans+=lcm_val//aa

print(ans%mod)

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
def lcm(x,y):
  return (x*y)//gcd(x,y)
n=int(input())
a=list(map(int,input().split()))
mod=10**9+7
lcm_val=a[0]
for i in range(n-1):
  lcm_val=lcm(lcm_val,a[i+1])
# print(lcm_val)
b=[]
for aa in a:
  b.append((lcm_val//aa)%mod)

ans=0
for bb in b:
  ans+=bb
  ans%mod
print(ans%mod)

Fixed submission:
from fractions import gcd
def lcm(x,y):
  return (x*y)//gcd(x,y)
n=int(input())
a=list(map(int,input().split()))
mod=10**9+7
lcm_val=a[0]
for i in range(n-1):
  lcm_val=lcm(lcm_val,a[i+1])
# print(lcm_val)
b=[]
ans=0
for aa in a:
  ans+=lcm_val//aa

print(ans%mod)
Buggy python submission (verdict: Runtime Error):
# C - Subarray Sum
n,k,s=map(int,input().split())
a=k*s+(n-k)*(s+1)
print(*a)

Fixed submission:
# C - Subarray Sum
n,k,s=map(int,input().split())
a=[]
a+=[s]*k
if s!=10**9:
    a+=[s+1]*(n-k)
else:
    a+=[1]*(n-k)
print(*a)
Buggy python submission (verdict: Time Limit Exceeded):
# ABC151 D
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))
from collections import deque
def bfs(sy,sx):
    q = deque([[sy,sx]])
    visited[sy][sx]=0
    while q:
        y,x = q.popleft()
        for j,k in ([1,0],[-1,0],[0,1],[0,-1]):
            ny,nx = y+j,x+k
            if ny<0 or ny>h-1 or nx<0 or nx>w-1 or path[ny][nx]=="#":
                continue
            if path[ny][nx]=="." and visited[ny][nx]==-1:
                visited[ny][nx]=visited[y][x]+1
                q.append([ny,nx])
        ret=-1
        for i in range(h):
            for j in range(w):
                ret=max(visited[i][j],ret)
    return ret
h,w=nm()
path=[input() for i in range(h)]
visited = [[-1]*w for i in range(h)]
sy,sx=0,0
gy,gx=0,0
ans=0
for i in range(h):
    for j in range(w):
        if path[i][j]=='#':
            continue
        sy,sx=i,j
        visited = [[-1]*w for i in range(h)]
        t=bfs(sy,sx)
        ans=max(t,ans)
print(ans)


Fixed submission:
# ABC151 D
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))
from collections import deque
def bfs(sy,sx):
    q = deque([[sy,sx]])
    visited[sy][sx]=0
    while q:
        y,x = q.popleft()
        for j,k in ([1,0],[-1,0],[0,1],[0,-1]):
            ny,nx = y+j,x+k
            if ny<0 or ny>h-1 or nx<0 or nx>w-1 or path[ny][nx]=="#":
                continue
            if path[ny][nx]=="." and visited[ny][nx]==-1:
                visited[ny][nx]=visited[y][x]+1
                q.append([ny,nx])
    ret=-1
    for i in range(h):
        for j in range(w):
            ret=max(visited[i][j],ret)
    return ret
h,w=nm()
path=[input() for i in range(h)]
visited = [[-1]*w for i in range(h)]
sy,sx=0,0
gy,gx=0,0
ans=0
for i in range(h):
    for j in range(w):
        if path[i][j]=='#':
            continue
        sy,sx=i,j
        visited = [[-1]*w for i in range(h)]
        t=bfs(sy,sx)
        ans=max(t,ans)
print(ans)