Sort by

recency

|

4546 Discussions

|

  • + 0 comments

    from math import inf

    if name == 'main': arr = {} lowest = second = inf for _ in range(int(input())): name = input() score = float(input())

        arr[score] = arr.get(score, []) + [name]
    
        if score < lowest:
            second = lowest
            lowest = score
        elif score < second and score > lowest: second = score
    
    print('\n'.join(sorted(arr[second])))
    
  • + 0 comments
    if __name__ == '__main__':
        students = []
        for _ in range(int(input())):
            name = input()
            score = float(input())
            students.append([name, score])
        sorted_arr = sorted(students,key=lambda item: (item[1], item[0]))
        lowest_score = sorted_arr[0][1]
        second_lowest_score = -1
        for i in range( len(sorted_arr)-1):
            if (sorted_arr[i][1] != sorted_arr[i+1][1]) & (second_lowest_score == -1):
                second_lowest_score = sorted_arr[i+1][1]
                print(sorted_arr[i+1][0])
            elif sorted_arr[i+1][1] == second_lowest_score:
                print(sorted_arr[i+1][0])
    
  • + 0 comments
    records = []
    if __name__ == '__main__':
        for _ in range(int(input())):
            name = input()
            score = float(input())
            records.append([name, score])
        
        records.sort(key=lambda x: (x[1], x[0]))
        
        lowest_score = records[0][1]
        
        second_lowest_score = None
        for name, score in records:
            if score > lowest_score:
                second_lowest_score = score
                break
        
        second_lowest_names = [name for name, score in records if score == second_lowest_score]
        
        second_lowest_names.sort()
        
        for name in second_lowest_names:
            print(name)
    
  • + 0 comments

    Hope this will help

    records = []
    
    if __name__ == '__main__':
        for _ in range(int(input())):
            name = input()
            score = float(input())
            records.append([name, score])
            
    scores = sorted(list(set([i[1] for i in records])))
    scores = scores[1]
    a = []
    for i in records :
        if i[1] == scores :
            a.append(i[0])
    a1 = sorted(a)
    
    for i in a1 :
        print(i)
        
    
  • + 0 comments

    All test cases passed

    if name == 'main': students=[] student=[] for _ in range(int(input())): name = input() score = float(input()) students.append([name,score])

    score=sorted(set([student[1] for student in students]))
    second_lowest=score[1]
    
    names=([student[0] for student in students if second_lowest==student[1]])
    names.sort()
    

    for i in names: print(i)