Problem:


Score : 200 points

Problem Statement

You have decided to write a book introducing good restaurants.
There are N restaurants that you want to introduce: Restaurant 1, Restaurant 2, ..., Restaurant N. Restaurant i is in city S_i, and your assessment score of that restaurant on a 100-point scale is P_i.
No two restaurants have the same score.

You want to introduce the restaurants in the following order:

The restaurants are arranged in lexicographical order of the names of their cities.

If there are multiple restaurants in the same city, they are arranged in descending order of score.

Print the identification numbers of the restaurants in the order they are introduced in the book.

Constraints

1 ≤ N ≤ 100

S is a string of length between 1 and 10 (inclusive) consisting of lowercase English letters.

0 ≤ P_i ≤ 100

P_i is an integer.

P_i ≠ P_j (1 ≤ i < j ≤ N)

Input

Input is given from Standard Input in the following format:

N
S_1 P_1
:
S_N P_N

Output

Print N lines. The i-th line (1 ≤ i ≤ N) should contain the identification number of the restaurant that is introduced i-th in the book.

Sample Input 1

6
khabarovsk 20
moscow 10
kazan 50
kazan 35
moscow 60
khabarovsk 40

Sample Output 1

3
4
6
1
5
2

The lexicographical order of the names of the three cities is kazan < khabarovsk < moscow. For each of these cities, the restaurants in it are introduced in descending order of score. Thus, the restaurants are introduced in the order 3,4,6,1,5,2.

Sample Input 2

10
yakutsk 10
yakutsk 20
yakutsk 30
yakutsk 40
yakutsk 50
yakutsk 60
yakutsk 70
yakutsk 80
yakutsk 90
yakutsk 100

Sample Output 2

10
9
8
7
6
5
4
3
2
1



Sample input:
6
khabarovsk 20
moscow 10
kazan 50
kazan 35
moscow 60
khabarovsk 40


Sample output:
3
4
6
1
5
2

Submission status: Wrong Answer

Solution code:
N = int(input())
rest = {}
cities = []
for i in range(N):
    k,s = input().split()
    if k not in rest:
        rest[k] = []
        cities.append(k)
    rest[k].append([int(s),i+1])
print(sorted(rest))
cities.sort()
for k in cities:
    rest[k].sort(reverse = True)
    for i in rest[k]:
        print(i[1])

Submission status: Wrong Answer

Solution code:
N = int(input())
rest = {}
cities = []
for i in range(N):
    k,s = input().split()
    if k not in rest:
        rest[k] = []
        cities.append(k)
    rest[k].append([int(s),i+1])
print(sorted(rest))
for k in cities:
    rest[k].sort(reverse = True)
    for i in rest[k]:
        print(i[1])

Submission status: Wrong Answer

Solution code:
N = int(input())
rest = {}
cities = []
for i in range(N):
    k,s = input().split()
    if k not in rest:
        rest[k] = []
        cities.append(k)
    rest[k].append([int(s),i+1])
print(sorted(rest))
for k in cities:
    rest[k].sort(reverse = True)
    for i in range(len(rest[k])):
        print(rest[k][i][1])

Submission status: Wrong Answer

Solution code:
from operator import itemgetter

if __name__ == '__main__':
    n = int(input())
    input_list = [input() for i in range(n)]
    restaurant_list = []
    for index, _input in enumerate(input_list):
        _restaurant_data = {'id': index + 1, 'region': _input.split()[0], 'point': _input.split()[1]}
        restaurant_list.append(_restaurant_data)

    restaurant_list.sort(key=itemgetter('point'), reverse=True)
    restaurant_list.sort(key=itemgetter('region'))
    for restaurant in restaurant_list:
        print(restaurant['id'])

Submission status: Wrong Answer

Solution code:
N = int(input())

SP = []
for i in range(N):
    str = input().split()
    SP.append([str[0] ,int(str[1])*-1,i])

SP.sort()

print(SP)
for i in range(N):
    print(SP[i][2]+1)

Submission status: Wrong Answer

Solution code:
N=int(input())
book1={}
for i in range(1,N+1):
    string,point=input().split()
    point=int(point)
    if  string in book1.keys():
        book1[string][point]=i
    else:
        book1[string]={point:i}
for keys in sorted(book1.keys()):
    for point in reversed(list(book1[keys].keys())):
        print(book1[keys][point])

Submission status: Wrong Answer

Solution code:
from collections import Counter
from collections import defaultdict
l={}
t=[]
k=defaultdict(list)
for _ in range(int(input())):
    x,y=map(str,input().split())
    l[x,int(y),_]=_
    t.append(x)
r=Counter(t)
a=sorted(r.keys())
c=sorted(l.keys())
#print(a)
#print(c)
#print(r)
t=0
for i in r.values():
    t=t+i
    for f in range(i):
        print(c[t-f-1][2]+1)

Submission status: Wrong Answer

Solution code:
# Nの値（レストランの数）を数値型で入力
N = int(input())
#ループのときに使うCntを初期化
Cnt = 0
Cnt2 = 0
#リスト作成
mylist_str = []
while Cnt != N: 
    S,P = map(str,input().split())
    Ketu = S + ' ' + P
    mylist_str.append(Ketu)
    Cnt = Cnt + 1

while Cnt2 != N:
        print(mylist_str[Cnt2])
        Cnt2 = Cnt2 + 1

Submission status: Wrong Answer

Solution code:
from operator import itemgetter
n = int(input())
l = [list(map(str,input().split())) for _ in range(n)]
#print(l)
l1 = sorted(l,key=itemgetter(1),reverse=True)
#print(l1)
l2 = sorted(l1,key=itemgetter(0))
#print(l2)
for i in l2:
  print(l.index(i)+1)

Submission status: Wrong Answer

Solution code:
N=input()
N=int(N)
S=[100]*N
P=[100]*N
for num in range(N):
    S[num]=input().split()
    S[num].append(num+1)
    S[num][1]=int(S[num][1])
print(S)
S.sort()
flag=0
flag2=0
while(flag==0):
    flag2=0
    for num in range(0,N-1):
        if(S[num][0]==S[num+1][0]):
            if(S[num][1]<S[num+1][1]):
                S[num],S[num+1]=S[num+1],S[num]
                flag2=1
    if(flag2==0):
        flag=1
    
            
print(S)
for num in range(N):
    print(S[num][2])

Submission status: Wrong Answer

Solution code:
b=[]
c=int(input())
for i in range(c):
  a=input().split()
  a.append(i+1)
  a[1]=int(a[1])
  b.append(a)


b.sort()
for i in range(c):
  print(b[i][2])

Submission status: Wrong Answer

Solution code:
N=input()
N=int(N)
S=[100]*N
P=[100]*N
for num in range(N):
    S[num]=input().split()
    S[num].append(num+1)
    S[num][1]=int(S[num][1])
S.sort()
for num in range(N-1):
    if(S[num][0]==S[num+1][0]):
        if(S[num][1]<S[num+1][1]):
            S[num],S[num+1]=S[num+1],S[num]
for num in range(N):
    print(S[num][2])

Submission status: Wrong Answer

Solution code:
N = int(input())
restaurant = []
for i in range(0, N):
	shop = input().split()
	restaurant.append([i+1, shop[0], shop[1]])
restaurant.sort(key = lambda val: val[2], reverse = True)
restaurant.sort(key = lambda val: val[1])
for i in range(0, N):
	print(restaurant[i][0])

Submission status: Wrong Answer

Solution code:
N = int(input())
restaurant = []
for i in range(0, N):
	shop = input().split()
	restaurant.append([i+1, shop[0], shop[1]])
restaurant.sort(key = lambda val: (val[1], val[2]))
for i in range(0, N):
	print(restaurant[i][0])

Submission status: Wrong Answer

Solution code:

import numpy

N = int(input())

scores = {}
indexes = {}
for i in range(N):
    s, p = input().split()
    p = int(p)
    if s in scores:
        scores[s].append(p)
        indexes[s].append(i)
    else:
        scores[s] = [p]
        indexes[s] = [i]

print(scores)
print(indexes)

# scores = {'khabarovsk': [20, 40], 'moscow': [10, 60], 'kazan': [50, 35]}
# indexes = {'khabarovsk': [0, 5], 'moscow': [1, 4], 'kazan': [2, 3]}
# N = 6

for s in sorted(scores.keys()):
    for i in numpy.argsort(scores[s])[::-1]:
        print(indexes[s][i]+1)

Submission status: Wrong Answer

Solution code:
N = int(input())
lst = []
for i in range(N):
  data = input().split(" ")
  lst.append([data[0], int(data[1]), i+1])
 
s = sorted(lst, key = lambda x: (x[0], x[1]))
 
for i in s:
  print(i[2])

Submission status: Wrong Answer

Solution code:
N = int(input())
lst = []
for i in range(N):
  data = input().split(" ")
  lst.append([data[0], int(data[1]), i+1])
 
s = sorted(lst)
 
for i in s:
  print(i[2])

Submission status: Wrong Answer

Solution code:
N = int(input())
lst = []
for i in range(N):
  data = input().split(" ")
  lst.append([data[0], int(data[1]), i+1])

s = sorted(lst, key = lambda x: (x[1], x[2]))

for i in s:
  print(i[2])

Submission status: Wrong Answer

Solution code:
from __future__ import print_function
# import numpy as np
# import numpypy as np
import sys
input = sys.stdin.readline

def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)

import math
import string
import fractions
from fractions import Fraction
from fractions import gcd
def lcm(n,m):
    return int(n*m/gcd(n,m))

import re
import array
import copy
import functools
import operator

import collections
import itertools
import bisect
import heapq


from heapq import heappush
from heapq import heappop

# from itertools import accumulate
# from collections import deque
import random

from queue import PriorityQueue as pqueue

def main():
    
    n = int(input())
    dict={}
    for i in range(1,n+1):
        str_x,num = input().split()
        num =int(num)
        if (str_x in dict):
            dict[str_x].put([num,i])
            # dict[str_x].sort(key = lambda x : x[1])
        else:
            a=pqueue()
            dict[str_x]=a
            dict[str_x].put([num,i])
            # a.put([num,i])
    eprint(dict)
    ll = sorted(list(dict.items()))
    eprint(ll)
    # for i in ll:
    #     for j in i[1]:
    #         print(j[1])
    for item in ll:
        while item[1].qsize():
            print((item[1].get())[1])
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from __future__ import print_function
# import numpy as np
# import numpypy as np
import sys
input = sys.stdin.readline

def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)

import math
import string
import fractions
from fractions import Fraction
from fractions import gcd
def lcm(n,m):
    return int(n*m/gcd(n,m))

import re
import array
import copy
import functools
import operator

import collections
import itertools
import bisect
import heapq


from heapq import heappush
from heapq import heappop

# from itertools import accumulate
# from collections import deque
import random


def main():
    n = int(input())
    dict={}
    for i in range(1,n+1):
        str_x,num = input().split()
        num =int(num)
        if (str_x in dict):
            dict[str_x].append([num,i])
            dict[str_x].sort(key = lambda x : x[1])
        else:
            dict[str_x]=[[num,i]]
    eprint(dict)
    ll = list(dict.items())
    eprint(ll)
    for i in ll:
        for j in i[1]:
            print(j[1])
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

N = int(input())
di = defaultdict(list)

for n in range(1, N + 1):
    S, P = input().split()
    P = int(P)
    di[S].append({n: P})

li = sorted(di.items(), key=lambda x: x[0])

print(li)

di2 = {}

for tu in li:
    for mini_dict in tu[1]:
        for k, v in mini_dict.items():
            di2[k] = v
    sorted_di2 = sorted(di2.items(), key=lambda x: x[1], reverse=True)
    for tup2 in sorted_di2:
        print(tup2[0])

    sorted_di2 = []
    di2 = {}

Submission status: Wrong Answer

Solution code:
import copy
N = int(input())
SP = [[] for _ in range(N)]
for i in range(N):
    SP[i] = list(input().split())
    SP[i][1] = int(SP[i][1])
    
unique = list(set(s[0] for s in SP))
unique.sort(reverse=True)
for i, uni in enumerate(unique):
    for j, S in enumerate(SP):
        if uni == S[0]:
            S[0] = i

print(SP)
copy_SP = copy.copy(SP)
SP.sort(reverse=True)
for i, c in enumerate(SP):
    for j, sp in enumerate(copy_SP):
        if c == sp:
            print(j+1)

Submission status: Wrong Answer

Solution code:
n = int(input());
for el in sorted(sorted([[i]+input().split() for i in range(n)], key=lambda x:x[2])[::-1], key=lambda x:x[1]): print(el[0]+1)

Submission status: Wrong Answer

Solution code:
# -*- coding; utf 8 -*-
# Guidebook
# 2019. 5/28
# 市名をアルファベット順
# 同じ市内なら点数が高い順
# 出力は与えられた番号 (1 origin)


class Guidebook(object):
    def __init__(self, num, city, score):
        self.num = num
        self.city = city
        self.score = score


def print_number(N, guidebook):
    for i in range(N):
        print(guidebook[i].num+1)


def score_sort(N, guidebook):
    for i in range(N-1):
        for j in range(N-1):
            if guidebook[j].score < guidebook[j+1].score:
                guidebook[j], guidebook[j+1] = (
                    guidebook[j+1], guidebook[j] )


def city_sort(N, guidebook):
    for i in range(N-1):
        for j in range(N-1):
            if str(guidebook[j].city) > str(guidebook[j+1].city):
                guidebook[j], guidebook[j+1] = (
                    guidebook[j+1], guidebook[j] )


if __name__ == '__main__':
    N = int(input()) # number of restaurants
    guidebook = []
    for i in range(N):
        s, p = input().split()
        restaurant = Guidebook(i+1, s, int(p))
        guidebook.append(restaurant)

    score_sort(N, guidebook)
    city_sort(N, guidebook)
    print_number(N, guidebook)

Submission status: Wrong Answer

Solution code:
n = int(input())
sp = []
for i in range(n):
    s, p = map(str, input().split())
    sp.append([s, int(p), i + 1])

sp.sort(key = lambda x:(x[0], x[1]))

for e in sp:
    print(e[2])

Submission status: Wrong Answer

Solution code:
from operator import itemgetter

def input_list(num,args):
    for i in range(num):
        S,P = input().split()
        args.append([S,P])


def sort_list(*args):
    tmp=sorted(args,key=itemgetter(1),reverse=1)
    dict_sorted=sorted(tmp,key=itemgetter(0))

    return dict_sorted



def main():
    # restaurant=[['N1',88],['N2',85],['N3',92],['N7',21],['N4',34],['N8',45],['N2',24],['N2',35]]                                                                                       
    # num=8                                                                                                                                                                              

    num=int(input())
    # [[] for i in range(5)]                                                                                                                                                             
    restaurant=[]

    input_list(num,restaurant)

    # print(restaurant)                                                                                                                                                                  

    restaurant_sorted=sort_list(*restaurant)

    for i in range(num):
        for j in range(num):
            if restaurant_sorted[i][1]==restaurant[j][1]:
                print(j+1)



if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
from operator import itemgetter

def input_list(num,args):
    for i in range(num):
        S,P = input().split()
        args.append([S,P])

def sort_list(*args):
    tmp=sorted(args,key=itemgetter(1),reverse=1)
    dict_sorted=sorted(tmp,key=itemgetter(0))

    return dict_sorted



def main():
    # restaurant=[['N1',88],['N2',85],['N3',92],['N7',21],['N4',34],['N8',45],['N2',24],['N2',35]]                                                                                       
    # num=8                                                                                                                                                                              

    num=int(input())
    # [[] for i in range(5)]                                                                                                                                                             
    restaurant=[]

    input_list(num,restaurant)

    # print(restaurant)                                                                                                                                                                  

    restaurant_sorted=sort_list(*restaurant)

    for i in range(num):
        for j in range(num):
            if restaurant_sorted[i][1]==restaurant[j][1]:
                print(j)



if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())
restraunt = [[] for i in range(n)]
for i in range(n):
    s, p = input().split()
    p = int(p)
    restraunt[i] = [i, s, p]
restraunt.sort(key = lambda restraunt: (restraunt[1], restraunt[2]), reverse = True)
for i in range(n):
    print(restraunt[i][0])

Submission status: Wrong Answer

Solution code:
n = int(input())
restraunt = [[] for i in range(n)]
for i in range(n):
    s, p = input().split()
    p = int(p)
    restraunt[i] = [i, s, p]
restraunt.sort(key = lambda restraunt: (restraunt[1], restraunt[2]), reverse = True)
print(restraunt)

Submission status: Wrong Answer

Solution code:
N = int(input().strip())

list = [input().strip().split() for i in range(N)]


from operator import itemgetter

sort1 = sorted(list, key=itemgetter(1), reverse=True)

sort2 = sorted(sort1, key=itemgetter(0))


for i in range(N):
    print(list.index(sort2[i]) + 1)

Submission status: Wrong Answer

Solution code:
N = int(input().strip())

list = [input().strip().split() for i in range(N)]

from operator import itemgetter
sort1 = sorted(list, key=itemgetter(1), reverse=True)
sort2 = sorted(sort1, key=itemgetter(0))

for i in range(N):
    print(sort2.index(list[i]) + 1)

Submission status: Wrong Answer

Solution code:
n = int(input())
name = []
score = []
for i in range(n):
    name_tmp, score_tmp = map(str, input().split())
    score_tmp = int(score_tmp)
    name.append(name_tmp)
    score.append(score_tmp)
    
name_kind = list(set(name))
name_sort = sorted(name)

for i in range(len(name_kind)):
    name_sort.remove(name_kind[i])

final_score = []
for i in range(len(name_sort)):
    tmp_index = [j for j in range(len(name)) if name[j]== name_sort[i]]
    sc = []
    for k in range(len(tmp_index)):
        sc.append(score[tmp_index[k]])
    sc = sorted(sc, reverse=True)
    for h in range(len(sc)):
        final_score.append(sc[h])
    
answer = []
for i in range(len(final_score)):
    tmp = [j for j in range(len(score)) if score[j]== final_score[i]]
    answer.append(tmp[0])
    
for i in range(len(answer)):
    print(answer[i]+1)

Submission status: Wrong Answer

Solution code:
N = int(input())
SP = []
for _ in range(N):
  SP.append(input().split())
ans = sorted(range(len(SP)), key=lambda k: SP[k],reverse=True)
[print(i+1) for i in ans]

Submission status: Wrong Answer

Solution code:
N = int(input())
SP = []
for _ in range(N):
  SP.append(input().split())
ans = sorted(range(len(SP)), key=lambda k: SP[k],reverse=True)
[print(i) for i in ans]

Submission status: Wrong Answer

Solution code:
n=int(input())
s=[]
b=[1]*n
for i in range(n):
    r,p=input().split()
    s.append(p)
for j in range(n):
    for k in range(n):
        if s[j]>s[k]:
            b[j]+=1
for q in b:
    print(q)

Submission status: Wrong Answer

Solution code:
#B

n = int(input())
S=[]

for i in range(n):
    s,p = (x for x in input().split())
    S.append((s,p, i+1))

S = sorted(S, key=lambda x: x[1], reverse=True)
S = sorted(S, key=lambda x: x[0])

for i in S:
    print(i[2])

Submission status: Wrong Answer

Solution code:
import functools as f

def to_num(a, b):
    if a > b:
        return 1
    if b > a:
        return -1
    return 0

def cmp(a, b):
    if (a[0] == b[0]):
        return to_num(b[1], a[1])
    return to_num(a[0], b[0])

n = int(input())
A = []
for i in range(n):
    a, b = input().split()
    A.append([a, int(b), i + 1])
#print(A)
A.sort(key=f.cmp_to_key(cmp))
for i in range(n):
    A[i].append(i + 1)
#print(A)
A.sort(key=lambda x: x[2])
#print(A)
for i in range(n):
    print(A[i][3])

Submission status: Wrong Answer

Solution code:
N = int(input())
List = []
for i in range(N):
  s, p = input().split(" ")
  p_num  = 100 - int(p)
  value = s + '_' +str(p_num)
  List.append([value, i+1])
  
List.sort()
for l in List:
  print(l[1])

Submission status: Wrong Answer

Solution code:
N = int(input())
A = []
B = []
for i in range(N):
    n,a=input().split()
    A.append(n)
    B.append(int(a))
for i in range(N):
    c = i
    for k in range(i+1,N):
        if A[i] > A[k]:
            l = B[k]
            B[k] = B[i]
            B[i] = l
            l = A[k]
            A[k] = A[i]
            A[i] = l
            c = k
        elif A[i] == A[k]:
            if B[i] < B[k]:
                l = B[k]
                B[k] = B[i]
                B[i] = l
                l = A[k]
                A[k] = A[i]
                A[i] = l
                c = k

    print(c+1)

Submission status: Wrong Answer

Solution code:
N = int(input())
l = []
for i in range(N):
    S, P = input().split()
    P = int(P)
    l.append([S, -P, i+1])
l.sort
for l_ in l:
    print(l_[2])

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N = i2n()
    L = [0] * N
    for i in range(N):
        s, p = i2s().split()
        L[i] = (s, int(p), i)

    L.sort(key=lambda x: (x[0], -x[1]))
    for l in L:
        print(l[2])

main()

Submission status: Wrong Answer

Solution code:
N = int(input())
A = []
for i in range(N):
	tem_data = input().split()
	A.append([tem_data[0] , int(tem_data[1]) , i])
A = sorted(A , key = lambda x: (x[0] , -x[1]))
for name , score  , number in A:
	print(number)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = []
for i in range(N):
	tem_data = input().split()
	A.append([tem_data[0] , int(tem_data[1]) , i])
A = sorted(A , key = lambda x: (x[0] , -x[1]))
for name , score  , number in A:
	print(name , score , number)

Submission status: Wrong Answer

Solution code:
n = int(input())
x = [list(map(str,input().split())) for i in range(n)]
for i in range(n):
    x[i][1]=int(x[i][1])
a = [i for i in range(1,n+1)]
a = sorted(a,key=lambda y:(x[y-1][0],x[y-1][1]),reverse=True)
for i in a:
    print(i)

Submission status: Wrong Answer

Solution code:
from operator import itemgetter, attrgetter
N = int(input())
A = []
for i in range(N):
    tmp = input().split()
    A.append([tmp[0],-int(tmp[1]),i])
A.sort()
A.sort(key=itemgetter(0,1))
print([A[i][2]+1 for i in range(N)])

Submission status: Wrong Answer

Solution code:
from sys import stdin
from collections import defaultdict

N = int(input())
lines = stdin.readlines()

dic = defaultdict(dict)

for i, line in enumerate(lines):
    line = line.strip().split()
    if i==0:
        tuple1 = ([i+1, line[0], int(line[1])],)
    else:
        tuple1 = tuple1 + ([i+1, line[0], int(line[1])],)


#print(tuple1)

tuple1 = sorted(tuple1, key = lambda x:x[2], reverse=True)
result = sorted(tuple1, key = lambda x:x[1])
print(result)

Submission status: Wrong Answer

Solution code:
from sys import stdin
from collections import defaultdict
from collections import OrderedDict

N = int(input())
lines = stdin.readlines()

dic = defaultdict(dict)

for i, line in enumerate(lines):
    line = line.strip().split()
    dic[line[0]][i+1] = int(line[1])

#for i in dic:
#    print(i,":",dic[i])

sorted(dic, key=str.lower)
for k in dic.keys():
    dick = dic[k]
#    print(dick)
    dick = OrderedDict(sorted(dick.items(), key = lambda x:x[1]))
#    print(dick)
    for i in dick.keys():
        print(i)

Submission status: Wrong Answer

Solution code:
import numpy as np

s = np.array([input().split() for _ in range(int(input()))])
s = [i[0]+str(100-int(i[1])) for i in s]
s = np.argsort(s,axis=0)

for i in s:
    print(i+1)

Submission status: Wrong Answer

Solution code:
from sys import stdin
from collections import defaultdict

lines = stdin.readlines()

dic = defaultdict(dict)

for i, line in enumerate(lines):
    line = line.strip().split()
    if i > 0:
        dic[line[0]][i] = (int(line[1]))
sorted(dic, key=str.lower)
for k in dic.keys():
        for i in dic[k].keys():
                print(i)

Submission status: Wrong Answer

Solution code:
n = int(input())

a = [input().split() for i in range(n)]

li=[]
for i in range(n):
    li.append([a[i][0],100- int(a[i][1]), i+1])
    print(li)

li.sort()

for i in range(n):
  print("{}\n".format(li[i][2]))

Submission status: Wrong Answer

Solution code:
N = int(input())
list = []
for i in range(N):
  line = input().split()
  line = [i] + line
  list.append(line)
list.sort( key=lambda x: (x[1], -int(x[2])) )
for i in range(N):
  print(list[i][0])

Submission status: Wrong Answer

Solution code:
n = int(input())
ls = []
for i in range(1,n+1):
  s,p = input().split()
  ls.append([i,s,int(p)])
ls.sort(key=lambda x:(x[1], x[2]))
for j in range(len(ls)):
  print(ls[j][0])

Submission status: Wrong Answer

Solution code:
n=int(input())
a=[]
b=[i+1 for i in range(n)]
for i in range(n):
  m,l=(j for j in input().split())
  a.append([m,l])
for i in range(n):
  for j in range(n-1):
    if a[j+1][0]<a[j][0] or (a[j+1][0]==a[j][0] and a[j][1]<a[j+1][1]):
                 c=a[j]
                 a[j]=a[j+1]
                 a[j+1]=c
                 d=b[j]
                 b[j]=b[j+1]
                 b[j+1]=d
for i in range(n):
  print(b[i])

Submission status: Wrong Answer

Solution code:
n=int(input())
a=[]
b=[i+1 for i in range(n)]
for i in range(n):
  m,l=(j for j in input().split())
  a.append([m,l])
for i in range(n):
  for j in range(n-1):
    if a[j+1][0]<a[j][0] or (a[j+1][0]==a[j][0] and a[j][1]<a[j+1][1]):
                 c=a[j]
                 a[j]=a[j+1]
                 a[j+1]=c
                 d=b[j]
                 b[j]=b[j+1]
                 b[j+1]=d
for i in range(n):
  for j in range(n):
    if b[j]==i+1:
      print(j+1)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=[]
b=[i for i in range(n)]
for i in range(n):
  m,l=(j for j in input().split())
  a.append([m,l])
for i in range(n):
  for j in range(n):
    if a[j-1][0]<a[j][0] or (a[j-1][0]==a[j][0] and a[j-1][1]<a[j][1]):
                 c=a[j]
                 a[j-1]=a[j]
                 a[j]=c
                 d=b[j-1]
                 b[j-1]=b[j]
                 b[j]=d
for i in range(n):
  print(b[i]+1)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=[]
b=[i for i in range(n)]
for i in range(n):
  m,l=(j for j in input().split())
  a.append([m,l])
for i in range(n):
  for j in range(n-1):
    if a[j][0]<a[j+1][0] or (a[j][0]==a[j+1][0] and a[j][1]<a[j+1][1]):
                 c=a[j]
                 a[j]=a[j+1]
                 a[j+1]=c
                 d=b[j]
                 b[j]=b[j+1]
                 b[j+1]=d
for i in range(n):
  print(b[i]+1)

Submission status: Wrong Answer

Solution code:
n = int(input())
a =[[input().split() ,i+1] for i in range(n)]
b = sorted(a, key=lambda x:x[1], reverse=True)
b = sorted(b, key=lambda x:x[0])
for i in range(n):
  print(b[i][1])

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
n = int(input())
l1, l2 = [], []
l3 = []
d = defaultdict(dict)

for i in range(n):
    s,  p = (x for x in input().split())
    p = int(p)
    d[s][i] = p

s_sorted = sorted(d.items(), key=lambda x:x[0])

for i in s_sorted :
    s = sorted(i[1].values(), reverse = True)
    l3.append(s)


for i in range(len(s_sorted)) :
    for k, v in sorted(s_sorted[i][1].items(), key=lambda x: -x[1]) :
        print(k)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
n = int(input())
l1, l2 = [], []
l3 = []
d = defaultdict(dict)

for i in range(n):
    s,  p = (x for x in input().split())
    p = int(p)
    d[s][i] = p

s_sorted = sorted(d.items(), key=lambda x:x[0])

for i in s_sorted :
    s = sorted(i[1].values(), reverse = True)
    l3.append(s)


for i in range(len(s_sorted)) :
    for k, v in sorted(s_sorted[i][1].items(), key=lambda x: -x[1]) :
        print(v)

Submission status: Wrong Answer

Solution code:
N=int(input())
info=[input().split() for i in range(N)] #mojiretu
#print(info)
from operator import itemgetter
dic1={}
for i in range(len(info)):
    dic1[i+1]=info[i]
#print(dic1)
info1=sorted(info,key=lambda x:int(x[1]),reverse=True)
info2=sorted(info1,key=itemgetter(0))
print(info2)
for i in info2:
    for key,value in dic1.items():
        if value==i:
            print(key)

Submission status: Wrong Answer

Solution code:
N=int(input())
info=[input().split() for i in range(N)] #mojiretu
#print(info)
from operator import itemgetter
dic1={}
for i in range(len(info)):
    dic1[i+1]=info[i]
#print(dic1)
info1=sorted(info,key=itemgetter(1),reverse=True)
info2=sorted(info1,key=itemgetter(0))
#print(info2)
for i in info2:
    for key,value in dic1.items():
        if value==i:
            print(key)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
n = int(input())
l1, l2 = [], []
l3 = []
d = defaultdict(dict)

for i in range(n):
    s,  p = (x for x in input().split())
    p = int(p)
    d[s][i] = p

s_sorted = sorted(d.items(), key=lambda x:x[0])

for i in s_sorted :
    s = sorted(i[1].values(), reverse = True)
    l3.append(s)


for i in range(len(s_sorted)) :
    for ii in l3[i]:
        print(s_sorted[i][0] + ' ' + str(ii))

Submission status: Wrong Answer

Solution code:
N=int(input())
info=[input().split() for i in range(N)] #mojiretu
#print(info)
from operator import itemgetter
dic1={}
for i in range(len(info)):
    dic1[i+1]=info[i]
#print(dic1)
info1=sorted(info,key=itemgetter(1),reverse=True)
info2=sorted(info1,key=itemgetter(0))
#print(info1)
for i in info2:
    for key,value in dic1.items():
        if value==i:
            print(key)

Submission status: Wrong Answer

Solution code:
N=int(input())
info=[input().split() for i in range(N)] #mojiretu
#print(info)
dic1={}
for i in range(len(info)):
    dic1[i+1]=info[i]
#print(dic1)
info1=sorted(info)
#print(info1)
for i in info1:
    for key,value in dic1.items():
        if value==i:
            print(key)

Submission status: Wrong Answer

Solution code:
n = int(input())
S = []

for i in range(n):
    a, b = input().split()
    S.append([a, -int(b), i + 1])

#ソートの時に０番目を基準にソートし，次に１番目を基準にソートする
S.sort()
print(S)

for i in range(n):
    print(S[i][2])

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
SP=[]
SPs=[]
for i in range(n):
    SP=[i]
    for j in input().split():
        SP.append(j)
    SPs.append(SP)

SPs=np.array(SPs)
SPs2=SPs[SPs[:,2].astype(int).argsort()[::-1],:]
SPs3=SPs2[SPs2[:,1].argsort(),:][:,0]

for i in range(n):
    print(int(SPs3[i])+1)

Submission status: Wrong Answer

Solution code:
import math


def main():
    N = int(input())
    SP = [list(input().split()) + [i + 1] for i in range(N)]
    SP.sort(key=lambda x: (x[0], -int(x[1])))

    print(SP)

    for i in map(lambda x: x[2], SP):
        print(i)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from operator import itemgetter
n = int(input())
s = [input().split() for i in range(n)]
for i in range(len(s)):
    s[i].append(i+1)
    s[i][1] = int(s[i][1])
s.sort(key = itemgetter(1))
s.sort(key = itemgetter(0))

for i in range(n):
    print(s[i][2])

Submission status: Wrong Answer

Solution code:
from operator import itemgetter
n=int(input())
x,y,s=list(),list(),list()
for i in range(1,n+1):
	S=input().split()
	S.append(i)
	s.append(S)
y=sorted(s,key=itemgetter(0))
for i in range(n):
	for j in range(1,n):
		if((y[j-1][0]==y[j][0])&(y[j-1][1]<y[j][1])):
			y[j-1],y[j]=y[j],y[j-1]
for i in range(n):
	print(y[i][2])

Submission status: Wrong Answer

Solution code:
N=int(input())

SP=[]
for i in range(N):
    SP.append(input().split())
    SP[i][1] = int(SP[i][1])
    SP[i].append(i)
    print(SP)

SP = sorted(SP, key=lambda x:(x[0],-x[1]))

for j in range(N):
    print(SP[j][2]+1)