@staticmethod
def get_problem_ids(ids, available_ids):
    """CodeChef problems are encoded with a sequences that are combinations
        of uppercase latin letters and digits. This function handles conversion
        from:

            - numbers,
            - single latin letters.

        >>> available_ids = ['SUBINC', 'WDTBAM', 'TIMEASR', 'KSPHERES', 'ADTRI']
        >>> SiteCodeChef.get_problem_ids([], available_ids)
        []

        >>> SiteCodeChef.get_problem_ids(['subinc', 'test', 'b', 'D', '5'], available_ids)
        ['ADTRI', 'KSPHERES', 'SUBINC', 'WDTBAM']
        """
    selected_ids = []
    if isinstance(ids, list):
        for id in ids:
            if id is not None:
                idx = None
                if id.isdigit():
                    idx = int(id) - 1
                elif id.isalpha() and len(id) > 1:
                    id_upper = id.upper()
                    if id_upper in available_ids:
                        selected_ids.append(id_upper)
                elif id.isalpha():
                    if id.islower():
                        idx = ord(id) - ord('a')
                    elif id.isupper():
                        idx = ord(id) - ord('A')
                if idx is not None and idx < len(available_ids):
                    selected_ids.append(available_ids[idx])
    return sorted(set(selected_ids))
