Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03361 (python)

Fixed submission:
h, w = map(int, input().split())
s = ["."*(w+2)]+["."+input()+"." for i in range(h)]+["."*(w+2)]
for i in range(1, h+1):
    for j in range(1, w+1):
        if s[i][j]=="#" and s[i-1][j]==s[i][j-1]==s[i][j+1]==s[i+1][j]==".":
            print("No")
            exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
h, w = map(int, input().split())
s = [input() for i in range(h)]
for i in range(h):
    for j in range(w):
        if s[i][j]=="#":
            ans = "No"
            for x, y in [(-1, 0), (0, -1), (0, 1), (1, 0)]:
                if  0<=i+x<h and 0<=j+y<w and s[i+x][j+y]=="#":
                    ans = "Yes"
            if ans == "No":
                print(ans)
                exit()
print(ans)
Problem p03424 (python)

Fixed submission:
n = int(input())
s = list(input().split())

if "Y" in s:
    print("Four")
else:
    print("Three")

Buggy submission (verdict: Runtime Error):
n = int(input())
s = list(map(int, input().split()))

if "Y" in s:
    print("Four")
else:
    print("Three")
Problem p03471 (python)

Fixed submission:
n, Y = map(int, input().split())
for x in range(n+1):
    for y in range(n-x+1):
        z = n-x-y
        if (x*10000 + y*5000 + z*1000) == Y:
            print(x, y, z)
            exit()
print(-1, -1, -1)

Buggy submission (verdict: Runtime Error):
n, Y = map(int, input())
for x in range(2001):
    for y in range(2001):
        z = n-x-y
        if (x*10000 + y*5000 + z*1000) == Y:
            print(x, y, z)
            exit()
print(-1, -1, -1)
Problem p03493 (python)

Fixed submission:
s = input()
print(s.count("1"))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
l = []
for i in a:
    count = 0
    for j in range(1, 31):
        if i%(2**j) == 0:
            count += 1
        else:
            l.append(count)
            break
print(min(l))
Problem p03494 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
l = []
for i in a:
    count = 0
    for j in range(1, 31):
        if i%(2**j) == 0:
            count += 1
        else:
            l.append(count)
            break
print(min(l))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
l = []
for i in a:
    count = 0
    for j in range(1, 30):
        if i%(2**j) == 0:
            count += 1
        else:
            l.append(count)
            break
print(min(l))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
l = []
for i in a:
    count = 0
    for j in range(1, 20):
        if i%(2**j) == 0:
            count += 1
        else:
            l.append(count)
            break
print(min(l))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
l = []
for i in a:
    count = 0
    for j in range(1, 11):
        if i%(2**j) == 0:
            count += 1
        else:
            l.append(count)
            break
print(min(l))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
l = []
for i in a:
    count = 0
    for j in range(1, 10):
        if i%(2**j) == 0:
            count += 1
        else:
            l.append(count)
print(min(l))
Problem p03625 (python)

Fixed submission:
import collections
n = int(input())
a = list(map(int, input().split()))
a = collections.Counter(a)
ans = []
for i, j in a.items():
    if j >= 2:
        for _ in range(j):
            ans.append(i)
ans.sort(reverse=True)
if len(ans) == 0:
    print(0)
else:
    print(ans[0]*ans[3])

Buggy submission (verdict: Runtime Error):
a.sort(reverse=True)
ans = []
for i in range(n-1):
    if a[i] == a[i+1]:
        ans.append(a[i])
ans1 = set(ans)
ans2 = sorted(ans1, reverse=True)
if len(ans1) == 1 and a.count(ans[0]) >= 4:
    print(ans[0]**2)
elif len(ans1) >= 2:
    print(ans2[0]*ans2[1])
else:
    print(0)
Problem p03632 (python)

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

alice = []
bob = []
for i in range(a, b+1):
    alice.append(i)
#print(alice)
for j in range(c, d+1):
    bob.append(j)
#print(bob)

count=0
for i in range(len(alice)):
    if alice[i] in bob:
        count += 1

if count>0:
    print(count-1)
else:
    print(count)

Buggy submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())

alice = []
bob = []
for i in range(a, b+1):
    alice.append(i)
#print(alice)
for j in range(c, d+1):
    bob.append(j)
#print(bob)

combine_alice_bob = alice + bob
#print(combine_alice_bob)
for i in range(len(alice)):
    for j in range(len(bob)):
        if (alice[i]==bob[j] and alice[i+1]==bob[j+1]) or (bob[i]==alice[j] and bob[i+1]==alice[j+1]):
            alice_bob = set(combine_alice_bob)
            print(len(combine_alice_bob)-len(alice_bob)-1)
            exit()
        elif alice[0]==bob[j] and alice[-1]==bob[j]:
            print(len(alice)-1)
            exit()
        elif bob[0]==alice[j] and bob[-1]== alice[j]:
            print(len(bob)-1)
            exit()
print(0)

Buggy submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())

alice = []
bob = []
for i in range(a, b+1):
    alice.append(i)
#print(alice)
for j in range(c, d+1):
    bob.append(j)
#print(bob)

combine_alice_bob = alice + bob
#print(combine_alice_bob)
for i in range(len(alice)):
    for j in range(len(bob)):
        if (alice[i]==bob[j] and alice[i+1]==bob[j+1]) or (bob[i]==alice[j] and bob[i+1]==alice[j+1]):
            alice_bob = set(combine_alice_bob)
            print(len(combine_alice_bob)-len(alice_bob)-1)
            exit()

print(0)
Problem p03633 (python)

Fixed submission:
from fractions import gcd
from functools import reduce
def lcm_base(x, y):
    return (x * y) // gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

n = int(input())
t = [int(input()) for i in range(n)]
print(lcm_list(t))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

n = int(input())
t = [int(input()) for i in range(n)]
print(lcm_list(t))
Problem p03860 (python)

Fixed submission:
a, b, c = input().split()
print(a[0]+b[0]+c[0])

Buggy submission (verdict: Runtime Error):
a,b,x = map(int, input().split())
b_num = int(b//x)
a_num = int((a-1)//x)
ans = b_num - a_num
print(ans)

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

count = 0
if a == 0:
    count = 1

#print((a/x).is_integer())

if (a/x).is_integer() == True:
    #print("BBBBBBBBBB")
    print((b//x)-(a//x)+1)

if (a/x).is_integer() == False:
    #print("aaaaaaaaaaaaaa")
    print((b//x)-(a//x))
Problem p03861 (python)

Fixed submission:
a,b,x = map(int, input().split())
b_num = int(b//x)
a_num = int((a-1)//x)
ans = b_num - a_num
print(ans)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())

print(k*(k-1)**(n-1))
Problem p03944 (python)

Fixed submission:
w, h, n = map(int, input().split())
ans_list = [0,0,w,h]
for i in range(n):
    x, y, a = map(int, input().split())
    if a == 1 and ans_list[0]<x:
        ans_list[0] = x
    elif a == 2 and ans_list[2]>x:
        ans_list[2] = x
    elif a == 3 and ans_list[1]<y:
        ans_list[1] = y
    elif a == 4 and ans_list[3]>y:
        ans_list[3] = y
    ans = (ans_list[2]-ans_list[0])*(ans_list[3]-ans_list[1])
    if ans <= 0:
        print(0)
        exit()
print(ans)

Buggy submission (verdict: Runtime Error):
w, h, n = map(int, input().split())
ans_list = [0,0,w,h]
for i in range(n):
    x, y, a = map(int, input().split())
    if a == 1:
        ans_list[0] = x
    elif a == 2:
        ans_list[2] = x
    elif a == 3:
        ans_list[1] = y
    else:
        ans_list[3] = y
print(max((ans_list[2]-ans_list[0])*(ans_list[3]-ans_list[1])),0)
Problem p03998 (python)

Fixed submission:
ABC = "ABC"
s = [input()+ABC[i] for i in range(3)]
turn = s[0]
card = 0
count = [1, 0, 0]

for i in range(305):
    if turn[card] == "a":
        turn = s[0]
        card = count[0]
        count[0] += 1
    elif turn[card] == "b":
        turn = s[1]
        card = count[1]
        count[1] += 1
    else:
        turn = s[2]
        card = count[2]
        count[2] += 1
    
    if turn[card] == "A":
        print("A")
        exit()
    if turn[card] == "B":
        print("B")
        exit()
    if turn[card] == "C":
        print("C")
        exit()

Buggy submission (verdict: Runtime Error):
s = [list(input()) for i in range(3)]
turn = s[0]
for i in range(300):
    if "a" == turn.pop(0):
        turn = s[0]
    elif "b" == turn.pop(0):
        turn = s[1]
    else:
        turn = s[2]
    
    if not s[0]:
        print("A")
        exit()
    if not s[1]:
        print("B")
        exit()
    if not s[2]:
        print("C")
        exit()
Problem p03200 (python)

Fixed submission:
# your code goes here
import numpy as np

def main():
	s = input()
	ans = 0
	w = 0
	for i in range(len(s)):
		c = s[len(s)-1-i]
		if(c == 'B'):
			if(w > 0):
				ans += w
		else:
			w += 1
	
	print(ans)
	
main()

Buggy submission (verdict: Runtime Error):
# your code goes here
import numpy as np

def a(s, w, ans):
	if(s == ""):
		return ans
	elif(s[-1] == 'B'):
		if(w == 0):
			return a(s[:-1], 0, ans)
		else:
			return a(s[:-1], w, ans+w)
	else:
		return a(s[:-1], w+1, ans)

def main():
	s = input()
	print(a(s, 0, 0))
	
main()

Buggy submission (verdict: Runtime Error):
# your code goes here
import numpy as np

def a(s, w):
	if(s == ""):
		return 0
	elif(s[-1] == 'B'):
		if(w == 0):
			return a(s[:-1], 0)
		else:
			return a(s[:-1], w)+w
	else:
		return a(s[:-1], w+1)

def main():
	s = input()
	print(a(s, 0))
	
	
	
	
	
main()
Problem p03214 (python)

Fixed submission:
# your code goes here
import numpy as np

def main():
	n = int(input())
	a = list(map(int, input().split()))
	m = np.mean(a)
	r = 0
	
	for i in range(n):
		if ((a[i]-m)**2 < (a[r]-m)**2):
			r = i
	print(r)
	
main()

Buggy submission (verdict: Runtime Error):
import numpy as np
 
def main():
	n = int(input())
	s = input()
	q = int(input())
	klist = list(map(int, input().split()))
	
	for times in range(q):
		r = 0
		k = klist[times]
		nowd, nowm, nowdm = 0, 0, 0
		for i in range(n):
			c = s[i]
			if (c == "D"):
				nowd += 1
			elif (c == "M"):
				nowm += 1
				nowdm += nowd
			elif(c == "C"):
				r += nowdm
			if(i >= k-1):
				cc = s[i-k+1]
				if (cc == "D"):
					nowd -= 1
					nowdm -= nowm
				elif (cc == "M"):
					nowm -= 1
		print(r)
main()
Problem p03231 (python)

Fixed submission:
import numpy as np# your code goes here
def eucrid(a, b):
	if (a > b):
		buf = a
		a = b
		b = buf
	if (b % a == 0):
		return a
	else:
		return eucrid(b%a, a)
		
def main():
	buf = input().split()
	s = input()
	t = input()
	n = len(s)
	m = len(t)
	
	big = n*m//eucrid(n, m)
	flag = big
	"""
	for i in range(big):
		if (i%(big//n) == 0 and i%(big//m) == 0):
			#print(i, n, m)
			#print((i+1)//(big//n), (i+1)//(big//m))
			if(s[(i+1)//(big//n)] != t[(i+1)//(big//m)]):
				flag = -1
	"""			
	for i in range(n):
		if((i*(big//n))%(big//m) == 0):
			if(s[i] != t[(i*(big//n))//(big//m)]):
				flag = -1

	print(flag)
	#print(s, t, n, m)
	
	
main()

Buggy submission (verdict: Runtime Error):
import numpy as np# your code goes here
def eucrid(a, b):
	if (a > b):
		buf = a
		a = b
		b = buf
	if (b % a == 0):
		return a
	else:
		return eucrid(b%a, a)
		
def main():
	buf = input().split()
	s = input()
	t = input()
	n = len(s)
	m = len(t)
	
	big = n*m//eucrid(n, m)
	flag = big
	for i in range(big):
		if (i%(big//n) == 0 and i%(big//m) == 0):
			#print(i, n, m)
			#print((i+1)//(big//n), (i+1)//(big//m))
			if(s[(i+1)//(big//n)] != t[(i+1)//(big//m)]):
				flag = -1
				
	print(flag)
	#print(s, t, n, m)
	
	
main()

Buggy submission (verdict: Runtime Error):
import numpy as np# your code goes here
def eucrid(a, b):
	if (a > b):
		buf = a
		a = b
		b = buf
	if (b % a == 0):
		return a
	else:
		return eucrid(b%a, a)
		
def main():
	buf = input().split()
	s = input()
	t = input()
	n = len(s)
	m = len(t)
	
	big = n*m//eucrid(n, m)
	flag = big
	for i in range(big):
		if (i%(big//n) == 0 and i%(big//m) == 0):
			print(i, n, m)
			print((i+1)//(big//n), (i+1)//(big//m))
			if(s[(i+1)//(big//n)] != t[(i+1)//(big//m)]):
				flag = -1
				
	print(flag)
	#print(s, t, n, m)
	
	
main()
Problem p03282 (python)

Fixed submission:
# your code goes here
S = str(input())
K = int(input())
#print(S, K)
count = 0
while(count < len(S) and S[count] == "1"):
	count += 1
#print(count)
if(K <= count):
	print("1")
else:
	print(S[count])

Buggy submission (verdict: Runtime Error):
# your code goes here
S = str(input())
K = int(input())
#print(S, K)
count = 0
while(S[count] == "1" and count < len(S)):
	count += 1
if(K <= count):
	print("1")
else:
	print(S[count])

Buggy submission (verdict: Runtime Error):
# your code goes here
S = str(input())
K = int(input())
#print(S, K)
count = 0
while(S[count] == "1" and count <= len(S)):
	count += 1
if(K <= count):
	print("1")
else:
	print(S[count])

Buggy submission (verdict: Runtime Error):
# your code goes here
S = str(input())
K = int(input())
#print(S, K)
count = 0
while(S[count] == "1" and count <= K):
	count += 1
if(K <= count):
	print("1")
else:
	print(S[count])

Buggy submission (verdict: Runtime Error):
# your code goes here
S = str(input())
K = int(input())
#print(S, K)
count = 0
while(S[count] == "1"):
	count += 1
if(K <= count):
	print("1")
else:
	print(S[count])
Problem p03285 (python)

Fixed submission:
import numpy as np
a = int(input())
if(a > 7):
	c = np.zeros(a)
	for i in range(7):
		if(i == 3 or i == 6):
			c[i] = 1
	#print(c)
	for i in range(7, c.shape[0]):
		if(c[i-4] == 1 or c[i-7] == 1):
			c[i] = 1
	if(c[-1] == 1):
		print("Yes")
	else:
		print("No")
else:
	if(a == 4 or a == 7):
		print("Yes")
	else:
		print("No")

Buggy submission (verdict: Runtime Error):
import numpy as np
a = int(input())
c = np.zeros(a)
for i in range(7):
	if(i == 3 or i == 6):
		c[i] = 1
#print(c)
for i in range(7, 40):
	if(c[i-4] == 1 or c[i-7] == 1):
		c[i] = 1
if(c[-1] == 1):
	print("Yes")
else:
	print("No")
Problem p02548 (python)

Fixed submission:
N = int(input())
ans = 0
for a in range(1,N):
  ans += (N-1)//a
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
ans = 0
for a in range(N):
  ans += (N//a)
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
ans = 0
for a in range(N):
  ans += N//a
print(ans)
Problem p02573 (python)

Fixed submission:
import sys
input = sys.stdin.readline
class UnionFind():
    def __init__(self, n):
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x
N,M = map(int,input().split())
uf = UnionFind(N)
for m in range(M):
    temp = [int(i)-1 for i in input().split()]
    uf.union(temp[0],temp[1])
print(-min(uf.parents))

Buggy submission (verdict: Runtime Error):
from math import gcd
from collections import defaultdict
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return [a[0] for a in arr]

N = int(input())
A = sorted([int(i) for i in input().split()])
dict_A = defaultdict(int)
dep_flag = False
for a in A:
  dict_A[a] += 1
  if a != 1 and dict_A[a] >= 2:
    dep_flag=True
if dep_flag == False:  
  all_flag = True
  devisors = set()
  for n in range(N-1):
      if n == 0:
          g = gcd(A[n],A[n+1])
      else:
          g = gcd(A[n+1],g)
      temp = factorization(A[n])
      for t in temp:
          if t in devisors:
              all_flag=False
          else:
              devisors.add(t)
  if all_flag and g == 1:
      print('pairwise coprime')
  elif g==1:
      print('setwise coprime')
  else:
      print('not coprime')
else:
    print('not coprime')
Problem p02615 (python)

Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]
A = sorted(A,reverse=True)
ans = A[0]
if N==2:
    print(ans)
else:
    A = A[1:]
    for i in range(N-2):
        idx = i//2
        ans += A[idx]
    print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(i) for i in input().split()]
A = sorted(A,reverse=True)
ans = a[0]
if n==2:
    print(ans)
else:
    a = a[1]
    for i in range(N-2):
        idx = i//2
        ans += a[idx]
    print(ans)
Problem p02621 (python)

Fixed submission:
N = int(input())
print(N + N*N + N **3)

Buggy submission (verdict: Runtime Error):
N = int(input())
print(N + N*N + N **300
Problem p02640 (python)

Fixed submission:
X,Y = map(int,input().split())
if Y % 2 == 0 and X * 4 >= Y and X * 2 <= Y:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
X,Y = map(int,input().split())
if Y % 2 == 0 and X * 4 >= Y and X * 2 <= Y:
    print("Yes")
else 
    print("No")

Buggy submission (verdict: Runtime Error):
X,Y = map(int,input().split())
if Y % 2 == 0 and X * 4 >= Y and if X * 2 <= Y:
    print("Yes")
else 
    print("No")
Problem p02641 (python)

Fixed submission:
X,N = map(int,input().split())
P = [int(i) for i in input().split()]
ans = 100000
flag = False
for i in range(-1,102):
    if i in P:
        pass
    else:
        if abs(X - ans) > abs(X-i):
            flag = True
            ans = i
print(ans)

Buggy submission (verdict: Runtime Error):
X,N = map(int,input().split())
P = [int(i) for i in input().split()]
for i in range(1,101):
    if i in P:
        pass
    else:
        if "ans" in locals():
          if abs(X-ans) > abs(X-i):
            ans = i
        else:
            ans = i
print(ans) if N != 0 else print(X)

Buggy submission (verdict: Runtime Error):
X,N = map(int,input().split())
P = [int(i) for i in input().split()]
for i in range(1,100):
    if i in P:
        pass
    else:
        if abs(X-ans) > abs(X-i):
            ans = i
print(ans) if N != 0 else print(X)
Problem p02646 (python)

Fixed submission:
A,V = map(int,input().split())
B,W = map(int,input().split())
T = int(input())

if W>=V:
  print("NO")
elif abs(B-A)/(V-W) <= T:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
A,V = map(int,input().split())
B,W = map(int,input().split())
T = int(input())

if abs(B-A)/(V-W) <= T:
  print("YES")
else:
  print("NO")
Problem p02727 (python)

Fixed submission:
X,Y,A,B,C = map(int,input().split())
P = [int(i) for i in input().split()]
Q = [int(i) for i in input().split()]
R = [int(i) for i in input().split()]
from collections import deque
P_sort = sorted(P,reverse=True)[0:X]
Q_sort = sorted(Q,reverse=True)[0:Y]
R_sort = deque(sorted(R,reverse=True)[0:X+Y])
PQ = sorted(P_sort + Q_sort)
for i in range(len(PQ)):
    if R_sort[0] > PQ[i]:
        r = R_sort.popleft()
        PQ[i] = r
    if not R_sort:
      break
print(sum(PQ))

Buggy submission (verdict: Runtime Error):
X,Y,A,B,C = map(int,input().split())
P = [int(i) for i in input().split()]
Q = [int(i) for i in input().split()]
R = [int(i) for i in input().split()]
from collections import deque
P_sort = sorted(P,reverse=True)[0:X]
Q_sort = sorted(Q,reverse=True)[0:Y]
R_sort = deque(sorted(R,reverse=True)[0:X+Y])
PQ = sorted(P_sort + Q_sort)
for i in range(len(PQ)):
    if R_sort[0] > PQ[i]:
        r = R_sort.popleft
        PQ[i] = r
print(sum(PQ))
Problem p02783 (python)

Fixed submission:
import math
H,A = map(int,input().split())
print(math.ceil(H/A))

Buggy submission (verdict: Runtime Error):
import math.ceil
H,A = map(int,input().split())
print(ceil(H/A))
Problem p02813 (python)

Fixed submission:
N = int(input())
P = tuple(int(i) for i in input().split())
Q = tuple(int(i) for i in input().split())

seq = tuple(range(1,N+1))
import itertools
p_list = list(itertools.permutations(seq))
for i,p in enumerate(p_list):
  if p == P:
    p_idx = i
  if p == Q:
    q_idx = i
print(abs(p_idx-q_idx))

Buggy submission (verdict: Runtime Error):
N = int(input())
P = (int(i) for i in input().split())
Q = (int(i) for i in input().split())

seq = tuple(range(N))
import itertools
p_list = list(itertools.permutations(seq))
for i,p in enumerate(p_list):
  if p_list == P:
    p_idx = i
  elif p_list == Q:
    q_idx = i
print(abs(p_idx-q_idx))
Problem p02838 (python)

Fixed submission:
import sys
input = sys.stdin.readline
N = int(input())
A = [int(i) for i in input().split()]
count0 = [0 for i in range(60)]
count1 = [0 for i in range(60)]
for a in A:
    a_tmp = bin(a).replace("0b","")
    a_tmp = a_tmp.zfill(60)
    for i,b in enumerate(a_tmp):
        if b == "1":
            count1[i] += 1
        else:
            count0[i] += 1
cnt = 0
ans = 0
for c0,c1 in zip(count0[::-1],count1[::-1]):
    ans += c0*c1*(2**cnt)
    cnt += 1
print(ans%(10**9+7))

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline()
N = int(input())
A = [int(i) for i in input().split()]
count0 = [0 for i in range(60)]
count1 = [0 for i in range(60)]
for a in A:
    a_tmp = bin(a).replace("0b","")
    a_tmp = a_tmp.zfill(60)
    for i,b in enumerate(a_tmp):
        if b == "1":
            count1[i] += 1
        else:
            count0[i] += 1
cnt = 0
ans = 0
for c0,c1 in zip(count0[::-1],count1[::-1]):
    ans += c0*c1*(2**cnt)
    cnt += 1
print(ans%(10**9+7))
Problem p02882 (python)

Fixed submission:
a,b,x = list(map(int,input().split()))
from math import acos
from math import sqrt
from math import degrees
if (x/(a*a))*2 <= b:
    S = x/a
    y = 2*x/(a*b)
    c = sqrt(y*y + b * b)
    z = (b*b + c*c - y*y)/(2*c)
    theta = degrees(acos(z/b))
else:
    S = x/a
    y = (2*S)/a - b
    y = b - y
    c = sqrt(a * a + y * y)
    z = (y*y - a*a + c*c)/(2*c)
    if y == 0:
        y = 0.00000000001
    theta = degrees(acos(z/y))
print(90-theta)

Buggy submission (verdict: Runtime Error):
a,b,x = list(map(int,input().split()))
from math import acos
from math import sqrt
from math import degrees
if (x/(a*a))*2 <= b:
    S = x/a
    y = 2*x/(a*b)
    c = sqrt(y*y + b * b)
    z = (b*b + c*c - y*y)/(2*c)
    theta = degrees(acos(z/b))
else:
    S = x/a
    y = (2*S)/a - b
    y = b - y
    c = sqrt(a * a + y * y)
    z = (y*y - a*a + c*c)/(2*c)
    theta = degrees(acos(z/y))
print(90-theta)