Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import math
a,b=map(int,input().split())
c=list(map(int,input().split()))

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    #divisors.sort()
    return divisors
d=make_divisors(sum(c))


m=1
for i in d:
  d=[0 for j in range(a)]
  for j in range(a):
    d[j]=c[j]%i
  d.sort()
  for j in range(a):
    k=sum(d[:j]) 
    l=(a-j)*i-sum(d[j:])
    if k==l and k+l<=b*2:
      m=max(i,m)
      break
print(m)


Fixed submission:
import math
from itertools import accumulate
a,b=map(int,input().split())
c=list(map(int,input().split()))

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort(reverse = True)
    return divisors
d=make_divisors(sum(c))


m=1
for i in d:
  e=[]
  for j in range(a):
    e.append(c[j]%i)
  e.sort()
  acc_m = list(accumulate(e))
  e=[i-e[j] for j in range(a)]
  acc_p = list(accumulate(e))
  for j in range(a):
    k=acc_m[j]
    l=acc_p[-1]-acc_p[j]
    if k==l and k+l<=b*2:
      print(i)
      exit()

Buggy python submission (verdict: Time Limit Exceeded):
import math
a,b=map(int,input().split())
c=list(map(int,input().split()))

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors
d=make_divisors(sum(c))


m=1
for i in d:
  d=[0 for i in range(a)]
  for j in range(a):
    d[j]=c[j]%i
  d.sort()
  for j in range(a):
    k=sum(d[:j]) 
    l=(a-j)*i-sum(d[j:])
    if k==l and k+l<=b*2:
      m=i
      break
print(m)


Fixed submission:
import math
from itertools import accumulate
a,b=map(int,input().split())
c=list(map(int,input().split()))

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort(reverse = True)
    return divisors
d=make_divisors(sum(c))


m=1
for i in d:
  e=[]
  for j in range(a):
    e.append(c[j]%i)
  e.sort()
  acc_m = list(accumulate(e))
  e=[i-e[j] for j in range(a)]
  acc_p = list(accumulate(e))
  for j in range(a):
    k=acc_m[j]
    l=acc_p[-1]-acc_p[j]
    if k==l and k+l<=b*2:
      print(i)
      exit()
Buggy python submission (verdict: Time Limit Exceeded):
a=int(input())
b=[int(input()) for i in range(a)]
c=[]
for i in range(a):
  d=0
  for j in range(len(c)):
    if b[i]>c[j]:
      d=1
      c[j]=b[i]
      break
  if d==0:
    e=b[i]
    c.append(e)    
print(len(c))

Fixed submission:
a=int(input())
b=[int(input()) for i in range(a)]
LIS = [b[0]]
for i in range(1,len(b)):
  if b[i] <= LIS[-1]:
    LIS.append(b[i])
  else:
    lo=0
    hi=len(LIS)
    while lo < hi:
      mid=(lo+hi)//2
      if b[i]>LIS[mid]:
        hi =mid
      else:
        lo=mid+1  
    LIS[lo] = b[i]
print(len(LIS))
Buggy python submission (verdict: Runtime Error):
import copy
a=int(input())
b=(list(map(int, input().split())))
bb = copy.copy(b)
c=0
d=[]
n=0
f=b[0]
d.append(f)
b.pop(0)
print(1^2)
print(2^3)
print(3^1)

def kakunin(bb,d):
  while c==0:
    cc=0
    for i in range(len(bb)):
      print(d)
      if d[len(d)-2]==d[len(d)-1]^bb[i]:
        g=bb[i]
        d.append(g)
        bb.pop(i)
        cc=1
        if len(d)==a and d[0]==d[len(d)-2]^d[len(d)-1]:
          global ccc
          ccc=1
          return
        break
    if cc==0:
      ccc=0
      return
      
while c==0:
  n+=1    
  bb = copy.copy(b)
  f=b[0]
  d.append(f)
  b.pop(0)
  bb.pop(0)
  kakunin(bb,d)
  b.append(f)
  if ccc==1:
    print("Yes")
    break
  else:
    d=[f]
  if n>=a:
    print("No")
    break

Fixed submission:
a=int(input())
b=list(map(int, input().split()))
c=list(set(b))
t=0
d=[0 for i in range(len(c))]
if a==1:
  print("Yes")
else:
  if len(c)==1:
    if c[0]==0:
      print("Yes")
    else:
      print("No")
  elif len(c)==2:
    for i in range(len(c)):
      e=c[i]
      d[i]=b.count(e)
    if (c[0]==0 and d[0]*2==d[1])or (c[1]==0 and d[1]*2==d[0]):
      print("Yes")
    else:
      print("No")
  elif len(c)>3:
    print("No")
  else:  
    for i in range(len(c)):
      e=c[i]
      d[i]=b.count(e)
    if d[0]==d[1]and d[0]==d[2] and c[0]==c[1]^c[2]:
      print("Yes")
    else:
      print("No")

Buggy python submission (verdict: Runtime Error):
import copy
a=int(input())
b=(list(map(int, input().split())))
bb = copy.copy(b)
c=0
d=[]
n=0
f=b[0]
d.append(f)
b.pop(0)

def kakunin(bb,d):
  while c==0:
    cc=0
    for i in range(len(bb)):
      if d[len(d)-2]==d[len(d)-1]^bb[i]:
        g=bb[i]
        d.append(g)
        bb.pop(i)
        cc=1
        if len(d)==a and d[0]==d[len(d)-2]^d[len(d)-1]:
          global ccc
          ccc=1
          return
    if cc==0:
      ccc=0
      return
      
while c==0:
  n+=1    
  bb = copy.copy(b)
  f=b[0]
  d.append(f)
  b.pop(0)
  bb.pop(0)
  kakunin(bb,d)
  b.append(f)
  if ccc==1:
    print("Yes")
    break
  else:
    d=[f]
  if n>=a:
    print("No")
    break

Fixed submission:
a=int(input())
b=list(map(int, input().split()))
c=list(set(b))
t=0
d=[0 for i in range(len(c))]
if a==1:
  print("Yes")
else:
  if len(c)==1:
    if c[0]==0:
      print("Yes")
    else:
      print("No")
  elif len(c)==2:
    for i in range(len(c)):
      e=c[i]
      d[i]=b.count(e)
    if (c[0]==0 and d[0]*2==d[1])or (c[1]==0 and d[1]*2==d[0]):
      print("Yes")
    else:
      print("No")
  elif len(c)>3:
    print("No")
  else:  
    for i in range(len(c)):
      e=c[i]
      d[i]=b.count(e)
    if d[0]==d[1]and d[0]==d[2] and c[0]==c[1]^c[2]:
      print("Yes")
    else:
      print("No")
Buggy python submission (verdict: Time Limit Exceeded):
a=int(input())
b=list(map(int,input().split()))
cc=1
d=[0 for i in range(a)]
d[0]=sum(b[0::2])-sum(b[1::2])
e=str(d[0])
for i in range(1,a):
  d[i]=b[i-1]*2-d[i-1]
  e=e+" "+str(d[i])

print(e)

Fixed submission:
a=int(input())
b=list(map(int,input().split()))
cc=1
d=[0 for i in range(a)]
d[0]=sum(b[0::2])-sum(b[1::2])
print(str(d[0]), end="")
for i in range(1,a):
  d[i]=b[i-1]*2-d[i-1]
  print(" "+str(d[i]), end="")

Buggy python submission (verdict: Time Limit Exceeded):
a=int(input())
b=list(map(int,input().split()))
cc=1
d=[0 for i in range(a)]
c=sum(b[1::2])*2
d[0]=sum(b)-c
e=str(d[0])
for i in range(1,a):
  d[i]=b[i-1]*2-d[i-1]
  e=e+" "+str(d[i])

print(e)

Fixed submission:
a=int(input())
b=list(map(int,input().split()))
cc=1
d=[0 for i in range(a)]
d[0]=sum(b[0::2])-sum(b[1::2])
print(str(d[0]), end="")
for i in range(1,a):
  d[i]=b[i-1]*2-d[i-1]
  print(" "+str(d[i]), end="")

Buggy python submission (verdict: Time Limit Exceeded):
a=int(input())
b=list(map(int,input().split()))
cc=1
c=0
d=[0 for i in range(a)]
while cc<a:
  c+=b[cc]*2
  cc+=2
d[0]=sum(b)-c
e=str(d[0])
for i in range(1,a):
  d[i]=b[i-1]*2-d[i-1]
  e=e+" "+str(d[i])

print(e)

Fixed submission:
a=int(input())
b=list(map(int,input().split()))
cc=1
d=[0 for i in range(a)]
d[0]=sum(b[0::2])-sum(b[1::2])
print(str(d[0]), end="")
for i in range(1,a):
  d[i]=b[i-1]*2-d[i-1]
  print(" "+str(d[i]), end="")
Buggy python submission (verdict: Runtime Error):
import math
a,b=map(int,input().split())
for i in range(1,b+1):
  c=math.factorial(a-b+1)//(math.factorial(i)*math.factorial(a-b+1-i))
  d=math.factorial(b-1)//(math.factorial(i-1)*math.factorial(b-i))
  print((c*d)%1000000007)


Fixed submission:
import math
a,b=map(int,input().split())
for i in range(1,b+1):
  if a-b+1<i:
    print(0)
  else:
    c=math.factorial(a-b+1)//(math.factorial(i)*math.factorial(a-b+1-i))
    d=math.factorial(b-1)//(math.factorial(i-1)*math.factorial(b-i))
    print((c*d)%1000000007)
Buggy python submission (verdict: Runtime Error):
a,b,c=int(input())
print(a+b+c)

Fixed submission:
a,b,c=input()
a=int(a)
b=int(b)
c=int(c)
print(a+b+c)
Buggy python submission (verdict: Time Limit Exceeded):
a=int(input())
b=[int(j) for j in input().split()]
c=True
d=0
while c==True:
  for i in b:
    if i%2!=0:
      c=False
    else :
      i=i//2
  if c==True:
    d+=1
    
print(d)

Fixed submission:
a=int(input())
b=[int(j) for j in input().split()]
c=True
d=0
while c==True:
  for i in range(len(b)):
    if b[i]%2!=0:
      c=False
    else :
      b[i]=b[i]//2
  if c==True:
    d+=1
    
print(d)
Buggy python submission (verdict: Runtime Error):
a,b=[int(input()) for i in range(2)]
c=[str(input()) for i in range(a)]
for i in range(a):
  c[i]="."+c[i]+"."
c=["."*(b+2)]+c +["."*(b+2)]
d=[["0"for i in range(b)]for j in range(a)]
for i in range(1,a+1):
  for j in range(1,b+1):
    f=0
    for k in range(-1,2):
      for l in range(-1,2):
        if c[i+k][j+l]=="#":
          f+=1
    d[i-1][j-1]=str(f)
for i in range(1,a+1):
  for j in range(1,b+1):
    if c[i][j]=="#":
      d[i-1][j-1]="#"
for i in range(a):
  dd=""
  for j in range(b):
    dd+=str(d[i][j])
  print(dd)

Fixed submission:
a,b=map(int,input().split())
c=[str(input()) for i in range(a)]
for i in range(a):
  c[i]="."+c[i]+"."
c=["."*(b+2)]+c +["."*(b+2)]
d=[["0"for i in range(b)]for j in range(a)]
for i in range(1,a+1):
  for j in range(1,b+1):
    f=0
    for k in range(-1,2):
      for l in range(-1,2):
        if c[i+k][j+l]=="#":
          f+=1
    d[i-1][j-1]=str(f)
for i in range(1,a+1):
  for j in range(1,b+1):
    if c[i][j]=="#":
      d[i-1][j-1]="#"
for i in range(a):
  dd=""
  for j in range(b):
    dd+=str(d[i][j])
  print(dd)

Buggy python submission (verdict: Runtime Error):
a,b=[int(input()) for i in range(2)]
c=[str(input()) for i in range(a)]
for i in range(a):
  c[i]="."+c[i]+"."
c=["."*(b+2)]+c +["."*(b+2)]
d=[[0 for i in range(b)] for j in range(a)]

for i in range(1,a+2):
  for j in range(1,b+2):
    for k in range(-1.2):
      for l in range(-1,2):
        if c[i+k[j+l]]=="#"
          d[i-1[j-1]]+=1
          
for i in range(1,a+2):
  for j in range(1,b+2):
    if c[i[j]]=="#":
      d[i-1[j-1]]="#"
      
print(d)


Fixed submission:
a,b=map(int,input().split())
c=[str(input()) for i in range(a)]
for i in range(a):
  c[i]="."+c[i]+"."
c=["."*(b+2)]+c +["."*(b+2)]
d=[["0"for i in range(b)]for j in range(a)]
for i in range(1,a+1):
  for j in range(1,b+1):
    f=0
    for k in range(-1,2):
      for l in range(-1,2):
        if c[i+k][j+l]=="#":
          f+=1
    d[i-1][j-1]=str(f)
for i in range(1,a+1):
  for j in range(1,b+1):
    if c[i][j]=="#":
      d[i-1][j-1]="#"
for i in range(a):
  dd=""
  for j in range(b):
    dd+=str(d[i][j])
  print(dd)
Buggy python submission (verdict: Runtime Error):
N , K = [int(n) for n in input().split()]
S = input()
print(S[:K]+S[K].lower()+S[K+1:])

Fixed submission:
N , K = [int(n) for n in input().split()]
S = input()
print(S[:K-1]+S[K-1].lower()+S[K:])

Buggy python submission (verdict: Runtime Error):
N , K = [int(n) for n in input().split()]
S = input()
print(S[:K]+S[k].lower()+S[K:])

Fixed submission:
N , K = [int(n) for n in input().split()]
S = input()
print(S[:K-1]+S[K-1].lower()+S[K:])
Buggy python submission (verdict: Runtime Error):
N = int(input())
H = [int(n) for n in input().split()]
ans = 0
for i in range(1, N+1):
  t = max(H[:i])
  if t <= H[i]:
    ans += 1
print(ans)


Fixed submission:
N = int(input())
H = [int(n) for n in input().split()]
ans = 0
for i in range(1, N+1):
  t = max(H[:i])
  if t <= H[i-1]:
    ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
H = [int(n) for n in input().split()]
ans = 0
for i in range(N):
  t = max(H[:i])
  if t <= H[i]:
    ans += 1
print(ans)


Fixed submission:
N = int(input())
H = [int(n) for n in input().split()]
ans = 0
for i in range(1, N+1):
  t = max(H[:i])
  if t <= H[i-1]:
    ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
def main():
    N=int(input())
    a=list(map(int,input().split()))
    cal=1

    if a.index(0)==1:
        print(0)
        return

    for i in range(N):
        cal*=a[i]
        if cal>=10**18:
            print("-1")
            return

    print(cal)
    return


main()


Fixed submission:
def main():
    N=int(input())
    a=list(map(int,input().split()))
    cal=1

    if a.count(0)>=1:
        print(0)
        return

    for i in range(N):
        cal*=a[i]
        if cal>10**18:
            print("-1")
            return

    print(cal)
    return


main()

Buggy python submission (verdict: Runtime Error):
def main():
    N=int(input())
    a=list(map(int,input().split()))
    cal=1

    if a.index(0):
        print(0)
        return
        
    for i in range(N):
        cal*=a[i]
        if cal>=10**18:
            print("-1")
            return

    print(cal)
    return


main()


Fixed submission:
def main():
    N=int(input())
    a=list(map(int,input().split()))
    cal=1

    if a.count(0)>=1:
        print(0)
        return

    for i in range(N):
        cal*=a[i]
        if cal>10**18:
            print("-1")
            return

    print(cal)
    return


main()
Buggy python submission (verdict: Runtime Error):
def main():
    N,K=map(int,input().split())
    A=list(map(int,input().split()))
    cal=0
    time=[0]*N
    town=[]
    roop=[]

    while time[cal]!=2:
        if time[cal]==0:
            town.append(cal)

        else :
            roop.append(cal)

        time[cal]+=1
        cal=A[cal]-1
    if len(time)>K:
        print(town[K]+1)
        return

    else :
        print(roop[(K-(len(town)-len(roop)))%len(roop)]+1)
        return
main()


Fixed submission:
def main():
    N,K=map(int,input().split())
    A=list(map(int,input().split()))
    cal=0
    time=[0]*N
    town=[]
    roop=[]

    while time[cal]!=2:
        if time[cal]==0:
            town.append(cal)

        else :
            roop.append(cal)

        time[cal]+=1
        cal=A[cal]-1

    if len(town)>K:
        print(town[K]+1)
        return

    else :
        print(roop[(K-(len(town)-len(roop)))%len(roop)]+1)
        return
main()

Buggy python submission (verdict: Runtime Error):
def main():
    N,K=map(int,input().split())
    A=list(map(int,input().split()))
    cal=0
    time=[0]*N
    town=[]
    roop=[]

    while time[cal]!=2:
        if time[cal]==0:
            town.append(cal)

        else :
            roop.append(cal)

        time[cal]+=1
        cal=A[cal]-1

    if N>K:
        print(town[K]+1)
        return

    else :
        print(roop[(K-(len(town)-len(roop)))%len(roop)]+1)
        return
main()


Fixed submission:
def main():
    N,K=map(int,input().split())
    A=list(map(int,input().split()))
    cal=0
    time=[0]*N
    town=[]
    roop=[]

    while time[cal]!=2:
        if time[cal]==0:
            town.append(cal)

        else :
            roop.append(cal)

        time[cal]+=1
        cal=A[cal]-1

    if len(town)>K:
        print(town[K]+1)
        return

    else :
        print(roop[(K-(len(town)-len(roop)))%len(roop)]+1)
        return
main()
Buggy python submission (verdict: Runtime Error):

N,M=map(int,input().split())
h=list(map(int,input().split()))
t=[0]*N
for i in range(M):
    A,B=map(int,input().split())
    t[A-1] = max(t[A-1], H[B-1])
    t[B-1] = max(t[B-1], H[A-1])

ct=0
for j in range(N):
    if H[j]>[j]:
        ct+=1
print(ct)


Fixed submission:
N,M=map(int,input().split())
h=list(map(int,input().split()))
t=[0]*N
for i in range(M):
    A,B=map(int,input().split())
    t[A-1] = max(t[A-1], h[B-1])
    t[B-1] = max(t[B-1], h[A-1])

ct=0
for j in range(N):
    if h[j]>t[j]:
        ct+=1
print(ct)
Buggy python submission (verdict: Runtime Error):
x=int(input())

for i in range(1,120):
    for j in range(-120,120):
        if ((i**5)-(j**5))==x:
            print(i, j)
            exit()


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

x=min(N,B-1)

ans=((A*x)//B)-(A*(x//B))
print(ans)
Buggy python submission (verdict: Runtime Error):
N=int(input())

for i in range(1,N+1):
    if i%3==0 or i%5==0 or i%15==0:
        continue
        cal+=i

print(cal)


Fixed submission:
N=int(input())
cal=0
for i in range(1,N+1):
    if i%3==0 or i%5==0 or i%15==0:
        continue
    cal+=i

print(cal)
Buggy python submission (verdict: Runtime Error):
s=input()
if s[0]=s[1] and s[1]==s[2]:
  print("Yes")
  
else :
  print("No")


Fixed submission:
s=input()
if s[0]==s[1] and s[1]==s[2]:
  print("No")
  
else :
  print("Yes")

Buggy python submission (verdict: Runtime Error):
s=input()

if s[0]!==s[1] or s[1]==s[2]:
  print("Yes")
  
else :
  print("No")


Fixed submission:
s=input()
if s[0]==s[1] and s[1]==s[2]:
  print("No")
  
else :
  print("Yes")

Buggy python submission (verdict: Runtime Error):
s=input()

for i in range(0,1):
    if s[i]!=s[i+1]:
        X=Yse
        break
    else :
        X=No

print(X)


Fixed submission:
s=input()
if s[0]==s[1] and s[1]==s[2]:
  print("No")
  
else :
  print("Yes")

Buggy python submission (verdict: Runtime Error):
s=input()

for i in range(0,1):
    if s[i]!=s[i+1]:
        X=Yes
        break
    else :
        X=No

print(X)


Fixed submission:
s=input()
if s[0]==s[1] and s[1]==s[2]:
  print("No")
  
else :
  print("Yes")

Buggy python submission (verdict: Runtime Error):
s=input()

for i in range(0,2):
    if s[i]!=s[i+1]:
        X=Yes
        break
    else :
        X=No

print(X)


Fixed submission:
s=input()
if s[0]==s[1] and s[1]==s[2]:
  print("No")
  
else :
  print("Yes")

Buggy python submission (verdict: Runtime Error):
s=input()

for i in range(3):
  if s[i]==s[i+1]:
    print("Yes")
  else :
    print("No")

Fixed submission:
s=input()
if s[0]==s[1] and s[1]==s[2]:
  print("No")
  
else :
  print("Yes")
Buggy python submission (verdict: Runtime Error):
n,a,b=map(int,input(),split())
ans=N//(A+B)*A
r=N%(A+B)
ans+=min(r,A)

print(ans)



Fixed submission:
N,b,r=map(int,input().split())
ball,x,y=0,0,0
ans=0

ball=b+r
x=N%ball
y=N//ball

ans+=y*b

if x>b:
    ans+=b
else:
    ans+=x


print(ans)

Buggy python submission (verdict: Runtime Error):
n,a,b=map(int,input(),split())
ans=N/(A+B)
r=N%(A+B)
ans+=min(r,A)

print(ans)

Fixed submission:
N,b,r=map(int,input().split())
ball,x,y=0,0,0
ans=0

ball=b+r
x=N%ball
y=N//ball

ans+=y*b

if x>b:
    ans+=b
else:
    ans+=x


print(ans)
Buggy python submission (verdict: Runtime Error):
A,B=map(int,input().split())
cal,cal2=0,0
ans=[]

for i in range(1200):
    cal=math.floor(i*0.08)
    cal2=math.floor(i*0.1)

    if cal==A and cal2==B:
        ans.append(i)


if len(ans)>0:
    print(min(ans))
else :
    print(-1)


Fixed submission:
import math
A,B=map(int,input().split())
cal,cal2=0,0
ans=[]

for i in range(1200):
    cal=math.floor(i*0.08)
    cal2=math.floor(i*0.1)

    if cal==A and cal2==B:
        ans.append(i)


if len(ans)>0:
    print(min(ans))
else :
    print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
A,B=map(int,input().split())

for i in range(max(A,B),A*B+1):
    if i%A==0 and i%B==0:
        print(i)
        break
    i+=(min(A,B)-1)


Fixed submission:
A,B=map(int,input().split())
ma,mi=0,0
ma=max(A,B)
mi=min(A,B)

if A%B==0 or B%A==0:
    print(ma)

else :
    for i in range(2,ma+1):
        if (ma*i)%mi==0:
            print(ma*i)
            break
        i+=(mi-1)
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline


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


def main():
    N, M = map(int, input().split())
    tmp = list(map(int, input().split()))
    A = []
    for i in tmp:
        if i % 2 == 0:
            A.append(i)
    d = A[0]
    for a in A:
        d = lcm(d, a)
    ans = (2*M)//d/2
    ans = -(-ans//1)
    print(int(ans))


if __name__ == '__main__':
    main()


Fixed submission:
import sys
input = sys.stdin.readline


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


def main():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))

    t = 1
    for a in A:
        if a & 1:
            print(0)
            return
        else:
            t = lcm(t, a//2)
    for a in A:
        if t % a == 0:
            print(0)
            exit()

    ans = M//t/2
    ans = -(-ans//1)
    print(int(ans))


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline


def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = [0]*60
    for a in A:
        for i in range(len(B)):
            if a & (2**i):
                B[i] += 1
    ans = 0
    for i, b in enumerate(B):
        ans += 2**i * b * (N-b)
        ans %= 10**9+7
    print(ans)


if __name__ == '__main__':
    main()


Fixed submission:
import sys
input = sys.stdin.readline


def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = [0]*60
    for a in A:
        for i in range(len(B)):
            if a & (2**i):
                B[i] += 1
    ans = 0
    for i, b in enumerate(B):
        ans += 2**i * b * (N-b)
        ans %= 10**9+7
    print(ans)


if __name__ == '__main__':
    main()

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


def main():
    N = int(input())
    A = list(map(int, input().split()))
    ans = 0
    for i in range(N-1):
        for j in range(i, N):
            ans += A[i] ^ A[j]
            ans %= 10**9+7
    print(ans)


if __name__ == '__main__':
    main()


Fixed submission:
import sys
input = sys.stdin.readline


def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = [0]*60
    for a in A:
        for i in range(len(B)):
            if a & (2**i):
                B[i] += 1
    ans = 0
    for i, b in enumerate(B):
        ans += 2**i * b * (N-b)
        ans %= 10**9+7
    print(ans)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input=sys.stdin.readline

N,Q = map(int, input().split())

A = set() # 辺
for i in range(N-1):
    a,b = map(int, input().split())
    A.add((a,b))

P = [] # 足す操作
for i in range(Q):
    x,y = map(int, input().split())
    P.append((x,y))

V = [0]*N # 頂点のカウンター
for p in P:
    V[p[0]-1] += p[1] # P で指定されたノード・値で初期化

# 方針：親から子にカウンターの値を流していく。
# 根付き木なので、根から始めれば、ある辺（親から子）は一度処理するだけで良いはず。
parent = {1} # 親（最初は根）
while parent:
    children = set() # 子。根からの深さが同じの頂点（になるはず）
    for p in parent:
        tmp = set(a for a in A if p in a) # P を含む辺＝処理する辺
        child = set() # p を親に持つノードの index
        for a in tmp:
            child.add(a[1] if a[0] == p else a[0]) # 親と異なる値が子
        for c in child:
            V[c-1] += V[p-1] # 子のカウンターに、親のカウンターの値を足す
        A -= tmp # 処理済みの辺を除去
        children |= child # 子の集合の和を取る
    parent = children # 子の集合を次の親にする

print(*V)


Fixed submission:
import sys
input=sys.stdin.readline

N,Q = map(int, input().split())

V = [0]*N

A = []
for i in range(N-1):
    a,b = map(int, input().split())
    A.append((a,b))
A.sort()
P = []
for i in range(Q):
    x,y = map(int, input().split())
    P.append((x,y))
P.sort()

#print("V", V)
#print("A", A)
#print("P", P)

for p in P:
    V[p[0]-1] += p[1]
for a in A:
    V[a[1]-1] += V[a[0]-1]

print(*V)