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

Q = int(input())

A = []
A_size = 0
A_med_min = 0
A_med_max = 0
MIN_SCORE = 0
for i in range(Q):
    q = input()
    if q[0]=="1": #更新
        dummy,a,b = map(int,q.split())
        #常にソート済リストを作れる
        bisect.insort_left(A,a)
        A_size+=1
        #中央値との差分からA群からなる最小値を更新
        sabun = 0
        if a<A_med_min:
            sabun = A_med_min - a
        elif a>A_med_max:
            sabun = a - A_med_max
        MIN_SCORE += sabun + b if A_size>1 else b
        #中央値の更新
        if A_size%2==0:
            A_med_min = A[(A_size//2)-1]
            A_med_max = A[A_size//2]
        else:
            A_med_min = A[A_size//2]
            A_med_max = A[A_size//2]
    elif q[0]=="2":
        print(A_med_min,MIN_SCORE)

Fixed submission:
import heapq

Q = int(input())

A_left = [] #最大を取り出すのでminus queueにする
A_right = [] #最小を取り出す
A_middle = 0
A_size = 0
MIN_SCORE = 0
for i in range(Q):
    q = input()
    if q[0]=="1": #更新
        dummy,a,b = map(int,q.split())
        A_size+=1
        sabun = 0
        if A_size==1: #初期設定
            A_middle = a
            sabun = 0
        elif A_size%2==0: #偶数処理
            if a <= A_middle:
                sabun = A_middle - a
                heapq.heappush(A_left,a*(-1))
                heapq.heappush(A_right,A_middle)
            else:
                sabun = a - A_middle
                heapq.heappush(A_left,A_middle*(-1))
                heapq.heappush(A_right,a)
            A_middle = 0 #デバッグ用
        else: #奇数処理
            if a<A_left[0]*(-1):
                sabun = A_left[0]*(-1) - a
                A_middle = heapq.heappop(A_left)*(-1)
                heapq.heappush(A_left,a*(-1))
            elif a>A_right[0]:
                sabun = a - A_right[0]
                A_middle = heapq.heappop(A_right)
                heapq.heappush(A_right,a)
            else:
                sabun = 0
                A_middle = a
        MIN_SCORE += sabun + b if A_size>1 else b
    elif q[0]=="2":
        if A_size%2==0:
            print(A_left[0]*(-1),MIN_SCORE)
        else:
            print(A_middle,MIN_SCORE)

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

Q = int(input())

A = []
A_size = 0
A_med_min = 0
A_med_max = 0
MIN_SCORE = 0
for i in range(Q):
    q = input()
    if q[0]=="1": #更新
        dummy,a,b = map(int,q.split())
        #常にソート済リストを作れる
        A.insert(bisect.bisect_left(A,a),a)
        A_size+=1
        #中央値との差分からA群からなる最小値を更新
        sabun = 0
        if a<A_med_min:
            sabun = A_med_min - a
        elif a>A_med_max:
            sabun = a - A_med_max
        MIN_SCORE += sabun + b if A_size>1 else b
        #中央値の更新
        if A_size%2==0:
            A_med_min = A[(A_size//2)-1]
            A_med_max = A[A_size//2]
        else:
            A_med_min = A[A_size//2]
            A_med_max = A[A_size//2]
    elif q[0]=="2":
        print(A_med_min,MIN_SCORE)

Fixed submission:
import heapq

Q = int(input())

A_left = [] #最大を取り出すのでminus queueにする
A_right = [] #最小を取り出す
A_middle = 0
A_size = 0
MIN_SCORE = 0
for i in range(Q):
    q = input()
    if q[0]=="1": #更新
        dummy,a,b = map(int,q.split())
        A_size+=1
        sabun = 0
        if A_size==1: #初期設定
            A_middle = a
            sabun = 0
        elif A_size%2==0: #偶数処理
            if a <= A_middle:
                sabun = A_middle - a
                heapq.heappush(A_left,a*(-1))
                heapq.heappush(A_right,A_middle)
            else:
                sabun = a - A_middle
                heapq.heappush(A_left,A_middle*(-1))
                heapq.heappush(A_right,a)
            A_middle = 0 #デバッグ用
        else: #奇数処理
            if a<A_left[0]*(-1):
                sabun = A_left[0]*(-1) - a
                A_middle = heapq.heappop(A_left)*(-1)
                heapq.heappush(A_left,a*(-1))
            elif a>A_right[0]:
                sabun = a - A_right[0]
                A_middle = heapq.heappop(A_right)
                heapq.heappush(A_right,a)
            else:
                sabun = 0
                A_middle = a
        MIN_SCORE += sabun + b if A_size>1 else b
    elif q[0]=="2":
        if A_size%2==0:
            print(A_left[0]*(-1),MIN_SCORE)
        else:
            print(A_middle,MIN_SCORE)