def top_player_ids(info, statistics, formula, numplayers):
    """
    Inputs:
      info       - Baseball data information dictionary
      statistics - List of batting statistics dictionaries
      formula    - function that takes an info dictionary and a
                   batting statistics dictionary as input and
                   computes a compound statistic
      numplayers - Number of top players to return
    Outputs:
      Returns a list of tuples, player ID and compound statistic
      computed by formula, of the top numplayers players sorted in
      decreasing order of the computed statistic.
    """

    top_players = []
    top_players_list = []
    
    for values in statistics:
        key = "".join(values[info["playerid"]])
        value = formula(info,values)
        top_players.append((key, value))

    for _ in range(numplayers):
        max_val, max_player = 0, ""
        for player in top_players:
            if player[1] > max_val and player not in top_players_list:
                max_val = player[1]
                max_player = player[0]
        top_players_list.append((max_player, max_val))
    return top_players_list