collections.Counter()

  • + 0 comments

    nShoes = int(input()) nSizes = input().split() nSizes = list(map(lambda x: int(x), nSizes)) nCust = int(input()) totalEarnings = 0 for _ in range(nCust): preferSizePrice = input().split() preferSizePrice = list(map(lambda x: int(x), preferSizePrice)) if preferSizePrice[0] in nSizes: nSizes.remove(preferSizePrice[0]) totalEarnings += preferSizePrice[1] print(totalEarnings)