def get_the_final_state(input_1):
    """
    Input_1: a list of dictionaries of marginal counts e.g: [{'1': 1046, '0': 1002}, {'1': 1001, '0': 1047}] (e.g: output of Qtic.simulate)
    Return the state that corresponds to higher frequency for each qubit
    """
    record = []
    for item in input_1:
        if len(item) == 1:
            record.append(int(list(item.keys())[0]))
        elif item['1'] > item['0']:
            record.append(1)
        else:
            record.append(0)
    return record