요번엔 defaultdict로. import sys input = sys.stdin.readline from heapq import heappush,heappop from collections import defaultdict for test in range(int(input())): k = int(input()) check = defaultdict(int) max_heap=[] min_heap=[] for i in range(k): command,n = input().split() n=int(n) if command=='D': if n==1: while max_heap and not check[-max_heap[0]]: heappop(max_heap) if max_heap: check[-max_heap..