1. N, M, T = [int(i) for i in input().split()]
    2. # 输入order
    3. orders = []
    4. for _ in range(M):
    5. order = [int(i) for i in input().split()]
    6. orders.append(order)
    7. # 创建hash_dict, 优先级priority初始为0
    8. hash_dict = {storeID : 0 for storeID in range(1, N + 1)}
    9. priority_list = [0]*(N + 1)
    10. # 遍历orders,同时维护hash_dict
    11. for t in range(1, T+1):
    12. # 取出所有t时间的订单
    13. id_list = [id_[1] for id_ in orders if id_[0] == t]
    14. for storeID in hash_dict.keys():
    15. orderCount = id_list.count(storeID)
    16. if orderCount == 0:
    17. hash_dict[storeID] = max(0, hash_dict[storeID] - 1)
    18. else:
    19. hash_dict[storeID] += orderCount*2
    20. if hash_dict[storeID] > 5:
    21. priority_list[storeID] = 1
    22. elif hash_dict[storeID] <= 3:
    23. priority_list[storeID] = 0
    24. # print(hash_dict)
    25. print(sum(priority_list))