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 = input()

names = []
points = []
ans = []
for i in range(int(N)):
    name, point = str(input()).split(" ")
    names.append(name)
    points.append(int(point))
    ans.append(int(i+1))

for i in range(int(N)):
    j = int(N) - 1
    while j > i:
        if names[i] > names[j]:
            t = names[i]
            names[i] = names[j]
            names[j] = t
            ans[i] ^= ans[j]
            ans[j] ^= ans[i]
            ans[i] ^= ans[j]
        elif names[i] == names[j]:
            if points[i] < points[j]:
                ans[i] ^= ans[j]
                ans[j] ^= ans[i]
                ans[i] ^= ans[j]
                points[i] ^= points[j]
                points[j] ^= points[i]
                points[i] ^= points[j]
        j -= 1

for c in ans:
    print(c)

Submission status: Wrong Answer

Solution code:
N = input()

names = []
points = []
ans = []
for i in range(int(N)):
    name, point = str(input()).split(" ")
    names.append(name)
    points.append(int(point))
    ans.append(int(i+1))

for i in range(int(N)):
    j = int(N) - 1
    while j > i:
        if names[i] > names[j]:
            t = names[i]
            names[i] = names[j]
            names[j] = t
            ans[i] ^= ans[j]
            ans[j] ^= ans[i]
            ans[i] ^= ans[j]
        elif names[i] == names[j]:
            if points[i] < points[j]:
                t = names[i]
                names[i] = names[j]
                names[j] = t
                ans[i] ^= ans[j]
                ans[j] ^= ans[i]
                ans[i] ^= ans[j]
                points[i] ^= points[j]
                points[j] ^= points[i]
                points[i] ^= points[j]
        j -= 1

for c in ans:
    print(c)

Submission status: Wrong Answer

Solution code:
class restaurant:
    def __init__(self, id_num, name, point):
        self.id_num = id_num
        self.name = name
        self.point = point
        self.ordername = name + "-" + str(100 - point)

N = int(raw_input())
Restaurant = []
for i in range(N):
    tmp = raw_input().split()
    name = tmp[0]
    point = int(tmp[1])
    Restaurant.append(restaurant(i + 1, name, point))

S = [r.ordername for r in Restaurant]
S = sorted(S)
for s in S:
    for r in Restaurant:
        if s == r.ordername:
            print r.id_num

Submission status: Wrong Answer

Solution code:
class restaurant:
    def __init__(self, id_num, name, point):
        self.id_num = id_num
        self.name = name
        self.point = point
        self.ordername = name + str(100 - point)

N = int(raw_input())
Restaurant = []
for i in range(N):
    tmp = raw_input().split()
    name = tmp[0]
    point = int(tmp[1])
    Restaurant.append(restaurant(i + 1, name, point))

S = [r.ordername for r in Restaurant]
S = sorted(S)
for s in S:
    for r in Restaurant:
        if s == r.ordername:
            print r.id_num

Submission status: Wrong Answer

Solution code:
N=int(input())
book=[]
for i in range(N):
    s,p =input().split()
    book.append([(s,-1*p),i])
    
s=sorted(book, key=lambda x:  x[0][1])
v=sorted(s, key=lambda x: x[0][0])
for i in range(N):
    print(v[i][1]+1)

Submission status: Wrong Answer

Solution code:
N=int(input())
book=[]
for i in range(N):
    s,p =input().split()
    book.append([(s,p),i])
    
s=sorted(book, key=lambda x:  x[0][1], reverse=True)
v=sorted(s, key=lambda x: x[0][0])
for i in range(N):
    print(v[i][1]+1)

Submission status: Wrong Answer

Solution code:
N=int(input())
book=[]
for i in range(N):
    s,p =input().split()
    book.append((s,p))
    
s=sorted(book, key=lambda x:  x[1], reverse=True)
v=sorted(s, key=lambda x: x[0])
for i in v:
    print(book.index(i)+1)

Submission status: Wrong Answer

Solution code:
n = int(input())

list = []

for i in range(n):
	city,score = input().split()
	list.append({'id': i + 1, 'city': city, 'score': score})

list = sorted(list, key=lambda x:x['score'], reverse=True)
list = sorted(list, key=lambda x:x['city'])

for dict in list:
	print(dict['id'])

Submission status: Wrong Answer

Solution code:
number=int(input())
book=[]
for i in range(0,number):
  book.append(input().split())
for i in range(0,len(book)):
    book[i][1]=int(book[i][1])
    book[i].append(i+1)
book1=sorted(book,key=lambda x: -x[1])
book2=sorted(book1,key=lambda x: x[0])
for i in range(0,len(book2)):
  print(book[i][2])

Submission status: Wrong Answer

Solution code:
n = int(input())
li = []
for i in range(1, n+1):
    name, point = input().split()
    point = int(point)
    li.append([name, -point, i])

li.sort()

print(li)
for ans in li:
    print(ans[2])
    continue

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

N = int(input())
rest = []
for i in range(N):
    c, s = input().split()
    s = -int(s)
    rest.append([c, s, i])

rest = sorted(rest, key=lambda x: [x[0], x[1]])
for r in rest:
    print(r[2])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
restaurants = []

for i in range(N):
    index = i + 1
    S, P = input().split()

    restaurants.append( (index, str(S), int(P)) )

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

for i in range(N):
    print (restaurants[i][0])

Submission status: Wrong Answer

Solution code:
N = int(input())
s = []
for i in range(N):
    tmp = input().split()
    tmp .append(i+1)
    s.append(tmp)


s.sort(key=lambda x: x[1], reverse=True)
s.sort(key=lambda x: x[0])
for x in s:
    print(x[2])

Submission status: Wrong Answer

Solution code:
n = int(input())
di = {}
li = []
for x in range(n):
    input_data = list(input().split())
    if input_data[0] not in di:
        di[input_data[0]] = {int(input_data[1]): x}
        li.append(input_data[0])
    else:
        di[input_data[0]][int(input_data[1])] = x

li.sort()
print(di)
for res in li:
    point_di = di[res]
    point_di_sorted = sorted(point_di.items(), key=lambda x:-x[0])
    for _,rank in point_di_sorted:
        print(rank + 1)

Submission status: Wrong Answer

Solution code:
import collections as cl

N=int(input())

L = []

for i in range(N):
  S,P_ = input().split()
  P = int(P_)
  
  flg = False
  for j in range(len(L)):
    if L[j][0]>S or (L[j][0]==S and L[j][1]<P):
      L.insert(j,(S,P,i))
      flg = True
      break
  if flg==False:
    L.append((S,P,i))
        
I = [0]*N
for i in range(N):
  I[L[i][2]] = i+1

for i in range(N):
  print(I[i])

Submission status: Wrong Answer

Solution code:
import collections as cl

N=int(input())

L = []

for i in range(N):
  S,P_ = input().split()
  P = int(P_)
  
  flg = False
  for j in range(len(L)):
    if L[j][0]>S or (L[j][0]==S and L[j][1]>P):
      L.insert(j,(S,P,i))
      flg = True
      break
  if flg==False:
    L.append((S,P,i))
    
I = [0]*N
for i in range(N):
  I[L[i][2]] = i+1

for i in range(N):
  print(I[i])

Submission status: Wrong Answer

Solution code:
N = int(input())
L=[]
for _ in range(N):
    tmp = input().split()
    L.append((tmp[0],int(tmp[1])))

L.sort(key=lambda x:x[0])
L.sort(reverse=True, key=lambda x:x[1])

for i in L:
    print(i[1])

Submission status: Wrong Answer

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

N = int(input())
di = []
tmp =[]

for i in range(N):
    si, pi = input().split()
    pi = int(pi) * (-1)
    tmp = [si, pi, i]
    di.append(tmp)


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

print(di)

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

Submission status: Wrong Answer

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

N = int(input())
di = []
tmp =[]

for i in range(N):
    tmp = input().split()
    tmp.append(i)
    di.append(tmp)

di.sort(reverse=True, key=lambda x: x[1])
di.sort(key=lambda x: x[0])

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

Submission status: Wrong Answer

Solution code:
n =int (input())
#listにlistを足す[string]+[int]=['string',int]
lst = [list(input().split())+[i+1] for i in range(n)]

#sortedで判定に-を用いると降順
lst2 = sorted(lst, key=lambda x:(x[0],int(x[1])))
for p in range(n):
    print(lst[p][2])

Submission status: Wrong Answer

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

N = int(input())
di = {}

for i in range(N):
    tmp = input().split()
    di[i] = tmp

di_sorted = sorted(di.items(), reverse=True, key=lambda x: x[1][1])
di_sorted = sorted(di.items(), key=lambda x: x[1][0])

for i, j in di_sorted:
    print(i+1)

Submission status: Wrong Answer

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

N = int(input())
di = {}

for i in range(N):
    tmp = input().split()
    di[i] = tmp

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

for i, j in di_sorted:
    print(i+1)

Submission status: Wrong Answer

Solution code:
n = int(input())
lst = [list(input().split())+[i+1] for i in range(n)]

#print(lst)

lst = sorted(lst, key= lambda x:(x[0],-int(x[1])))
print(lst)
for i in range(n):
   print(lst[i][2])

Submission status: Wrong Answer

Solution code:
n = int(input())
lst = [list(input().split())+[i+1] for i in range(n)]

# print(lst)

lst = sorted(lst, key= lambda x:x[0])

for i in range(len(lst)):
    print(lst[i][2])

Submission status: Wrong Answer

Solution code:
n = int(input())
lst = [list(input().split())+[i+1] for i in range(n)]

# print(lst)

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

for i in range(len(lst)):
    print(lst[i][2])

Submission status: Wrong Answer

Solution code:
n = int(input())

s = {}
for i in range(n):
    a, b=input().split()
    if a in s:
        s[a].append((i+1, int(b)))
    else:
        s[a]=[(i+1, int(b))]

print(s)
for key in sorted(s):
    for i, score in sorted(s[key], key=lambda t:~t[1]):
        print(i)

Submission status: Wrong Answer

Solution code:
from sys import stdin

n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]
#print(*data, sep='\n')
tmp = sorted(data, key=lambda x:x[1], reverse=True)
ans = sorted(tmp, key=lambda x:x[0])
for i in range(n) :print(data.index(ans[i])+1)

Submission status: Wrong Answer

Solution code:
# B
# Guidebook

N = int(input())

sp_list = []

for i in range(N):
    
    sp = input().split(" ")
    sp.append(str(i+1))
    sp_list.append(sp)

#print(sp_list)

sp_list.sort(key = lambda x: -int(x[1]))
sp_list.sort(key = lambda x: x[0])

for i in sp_list:
    print(sp_list)
#    print(N + 1 - int(i[2]))

Submission status: Wrong Answer

Solution code:
# B
# Guidebook

N = int(input())

sp_list = []

for i in range(N):
    
    sp = input().split(" ")
    sp.append(str(i+1))
    sp_list.append(sp)

#print(sp_list)

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

for i in sp_list:
    print(N + 1 - int(i[2]))

Submission status: Wrong Answer

Solution code:
# B
# Guidebook

N = int(input())

sp_list = []

for i in range(N):
    
    sp = input().split(" ")
    sp.append(str(i+1))
    sp_list.append(sp)

#print(sp_list)

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

for i in sp_list:
    print(int(i[2]))

Submission status: Wrong Answer

Solution code:
from operator import itemgetter

n = int(input())
e = [input().split() for j in range(n)]
for i in range(n):
    e[i].append(i)
restaurant = sorted(e,key=itemgetter(1),reverse=True)
restaurant.sort(key=itemgetter(0))

for i in range(n):
    print(restaurant[i][2]+1)

Submission status: Wrong Answer

Solution code:
from operator import itemgetter

n = int(input())
e = [[j for j in input().split()] for i in range(n)] 
f = [[i,e[i]] for i in range(n)]

restaurant = sorted(f,key=itemgetter(0),reverse=True)
restaurant.sort(key=itemgetter(1))

for i in range(n):
    print(restaurant[i][0]+1)

Submission status: Wrong Answer

Solution code:
from operator import itemgetter

n = int(input())
e = [[j for j in input().split()] for i in range(n)] 
f = [[i,e[i]] for i in range(n)]

restaurant = sorted(f,key=itemgetter(1))
restaurant.sort(key=itemgetter(0),reverse=True)
for i in range(n):
    print(restaurant[i][0]+1)

Submission status: Wrong Answer

Solution code:
from operator import itemgetter

n = int(input())
e = [[j for j in input().split()] for i in range(n)] 
f = [[i,e[i]] for i in range(n)]

restaurant = sorted(e,key=itemgetter(0,1))
print(restaurant)

Submission status: Wrong Answer

Solution code:
P = int(input())
res= []
for i in range(P):
  a, b = input().split(' ')
  res.append((a,b,i+1))
res2 = sorted(res, key = lambda x:x[1], reverse = True)
res3 = sorted(res2, key = lambda x:x[0])
for j in range(P):
  print(res3[j][2])

Submission status: Wrong Answer

Solution code:
P = int(input())
res= []
for i in range(P):
  a, b = input().split(' ')
  res.append((a,b))
res2 = sorted(res, key = lambda x:x[1], reverse = True)
res3 = sorted(res2, key = lambda x:x[0])
for j in range(P):
  print(res.index(res3[j])+1)

Submission status: Wrong Answer

Solution code:
P = int(input())
res= []
for i in range(P):
  a, b = input().split()
  res.append((a,b))
res2 = sorted(res, key = lambda x:x[1], reverse = True)
res3 = sorted(res2, key = lambda x:x[0])
for j in range(P):
  print(str(res.index(res3[j])+1))

Submission status: Wrong Answer

Solution code:
P = int(input())
res= []
for i in range(P):
  a, b = input().split()
  res.append((a,b))
res2 = sorted(res, key = lambda x:x[1], reverse = True)
res3 = sorted(res2, key = lambda x:x[0])
for j in range(P):
  print(res.index(res3[j])+1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
P = int(input())
res= []
for i in range(P):
    a, b = input().split()
    res.append((a,b))
    print(res)
res2 = sorted(res, key = lambda x:(x[0],x[1]))
for i in range(P):
    print(res.index(res2[i]))

Submission status: Wrong Answer

Solution code:
N=int(input())

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



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

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

Submission status: Wrong Answer

Solution code:
import numpy as np
N=int(input())
a=[]
for i in range(N):
    s,p=input().split()
    p=int(p)
    a.append([s,p,i+1])
a.sort(key=lambda x:(x[0],x[1]))
i=0
while i<N:
    last=a[i][0]
    i+=1
    if i<N and last==a[i][0]:
        s=i-1
        g=i
        while 1:
            i+=1
            if i>=N or last!=a[i][0]:
                g=i
                break
        for j in reversed(range(s,g)):
            print(a[j][2])
        if i==N-1:
            break
    else:
        print(a[i-1][2])

Submission status: Wrong Answer

Solution code:
import numpy as np
N=int(input())
a=[]
for i in range(N):
    s,p=input().split()
    p=int(p)
    a.append([s,p,i+1])
a.sort(key=lambda x:(x[0],x[1]))
i=0
while i<N:
    last=a[i][0]
    i+=1
    if i<N and last==a[i][0]:
        s=i-1
        g=i
        while 1:
            if i>=N or last!=a[i][0]:
                g=i
                break
            i+=1
        for j in reversed(range(s,g)):
            print(a[j][2])
        if i==N-1:
            break
    else:
        print(a[i-1][2])

Submission status: Wrong Answer

Solution code:
import numpy as np
N=int(input())
a=[]
for i in range(N):
    s,p=input().split()
    p=int(p)
    a.append([s,p,i+1])
a.sort(key=lambda x:(x[0],x[1]))
a=np.array(a)
print(a)
i=0
while i<N:
    last=a[i][0]
    i+=1
    if i<N and last==a[i][0]:
        s=i-1
        g=i
        while 1:
            if i>=N or last!=a[i][0]:
                g=i
                break
            i+=1
        for j in reversed(range(s,g)):
            print(a[j][2])
        if i==N-1:
            break
    else:
        print(a[i-1][2])

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
n=int(input())
A=[]
for i in range(n):
    a=(i+1,)+tuple(input().split())
    A.append(a)
A.sort(key=lambda x:x[2],reverse=True)
A.sort(key=lambda x:x[1])
for m in range(n):
    print(A[m][0])

Submission status: Wrong Answer

Solution code:
N = int(input())
assign = []
for index in range(1,N+1):
    S, P = map(str, input().split())
    P = int(P)
    assign.append([S, P, index])

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3

if __name__ == '__main__':
    n = int(input())
    ary = []
    city = []
    ans = []
    for i in range(n):
        x, y = input().split()
        city.append(x)
        ary.append([x, int(y), i+1])
    
    city.sort()
    ct = dict.fromkeys(city)
    city = list(dict.fromkeys(ct))

    for c in city:
        tmp = [x for x in ary if x[0] == c]
        tmp.sort(reverse=True)
        for t in tmp:
            ans.append(t)

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

Submission status: Wrong Answer

Solution code:
n=int(input())
li=[0]*n
for i in range(n):
    a=input().split()
    li[i]=[a[0], -int(a[1]), i+1]

li.sort(key=lambda x:(x[0],int(x[1])))
print(li)
for i in li:
    print(i[2])

Submission status: Wrong Answer

Solution code:
n=int(input())
t=[]
for i in range(n):
  a=input().split()
  b=[i+1,a[0],(-1)*a[1]]
  t.append(b)

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

Submission status: Wrong Answer

Solution code:
N = int(input())
L = [list(map(str, input().split())) for _ in range(N)]

for i in range(N):
    L[i].append(i+1)

L.sort(key=lambda x:x[1], reverse=True)
L.sort(key=lambda x:x[0])

for l in L:
    print(l[2])

Submission status: Wrong Answer

Solution code:
n = int(input())
dct=[]
for i in range(n):
  d = input().split()
  name = d[0]
  score = int(d[1])
  dct.append([name,-score,i+1])

dct.sort()
print(dct)
for i in range(n):
  print(dct[i][2])

Submission status: Wrong Answer

Solution code:
n = int(input())
dct=[]
for i in range(n):
  d = input().split()
  name = d[0]
  score = int(d[1])
  dct.append([name,score,i+1])

dct.sort()
for i in range(n):
  print(dct[i][2])

Submission status: Wrong Answer

Solution code:
n = int(input())
list1 = []
for i in range(n):
  a,b = map(str,input().split())
  list1.append([a,int(b)*-1,i+1])
listsort = sorted(list1,key = lambda x : (x[0],x[1]))
for j in range(n):
  
  print(listsort.index(list1[j])+1)

Submission status: Wrong Answer

Solution code:
N = int(input())
SP = []
[SP.append(input().split()) for i in range(N)]
for i in range(N):
    SP[i][1] = int(SP[i][1])
SP.sort(reverse=True)
SP.sort(key=lambda x: x[0])
print(SP)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())

list2=[]

for i in range(n):
    list=[j for j in input().split()]
    list[1]=int(list[1])
    list2.append(list)

#print(list2)

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

#print(list3)

for i in list2:
    print(list3.index(i)+1)

Submission status: Wrong Answer

Solution code:
N=int(input())
Index=[]
S=[]
P=[]
for i in range(N):
  Index.append(i+1)
  s,p=input().split()
  S.append(s)
  P.append(p)
#print(S)
#print(P)

for i in range(N):
  deleteIndex=0
  outputIndex=Index[0]
  minS=S[0]
  maxP=P[0]
  for j in range(1,N-i):
    if (S[j] < minS) or ((S[j] == minS) and (P[j] > maxP)):
      deleteIndex=j
      outputIndex=Index[j]
      minS=S[j]
      maxP=P[j]
  print(outputIndex)
  del Index[deleteIndex]
  del S[deleteIndex]
  del P[deleteIndex]

Submission status: Wrong Answer

Solution code:
n= int(input())
s = [[input().split()]for i in range(n)]
s1 = sorted(s)
for i in range(n):
    print(s.index(s[i]))

Submission status: Wrong Answer

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

for i in range(n):
    s, p = input().split()
    p = 100 - int(p)
    if p == 100:
        restaurant = s + " " + str(p) + " " + str(i+1)
    elif p == 0:
        restaurant = s + " 00" + str(p) + " " + str(i + 1)
    else:
        restaurant = s + " 0" + str(p) + " " + str(i + 1)
    restaurants.append(restaurant)
sorted_restaurants = sorted(restaurants)

for i in range(n):
    id = sorted_restaurants[i].split()[-1]
    print(id)

Submission status: Wrong Answer

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

for i in range(n):
    s, p = input().split()
    p = 100 - int(p)
    if p == 100:
        restaurant = s + " " + str(p) + " " + str(i+1)
    else:
        restaurant = s + " 0" + str(p) + " " + str(i + 1)
    restaurants.append(restaurant)
sorted_restaurants = sorted(restaurants)

for i in range(n):
    id = sorted_restaurants[i].split()[-1]
    print(id)

Submission status: Wrong Answer

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

for i in range(n):
    s, p = input().split()
    p = 100 - int(p)
    restaurant = s + " " + str(p) + " " + str(i+1)
    restaurants.append(restaurant)
sorted_restaurants = sorted(restaurants)

for i in range(n):
    id = sorted_restaurants[i].split()[-1]
    print(id)

Submission status: Wrong Answer

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

for i in range(n):
    s, p = input().split()
    p = 100 - int(p)
    restaurant = s + " " + str(p) + " " + str(i+1)
    restaurants.append(restaurant)
sorted_restaurants = sorted(restaurants)

for i in range(n):
    id = sorted_restaurants[i].split()[2]
    print(id)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
def guide():
    n = int(raw_input())
    d = {}
    j = []
    for _ in range(n):
        a, b = raw_input().split(' ')
        j.append(int(b))
        d[int(b)] = a

    c = {}
    f = []
    for a in d:
        e = d[a]
        f.append(e)
        if c.has_key(e):
            c[e].append(a)
        else:
            c[e] = []
            c[e].append(a)

    f = list(set(f))
    f.sort()
    h = []
    for g in f:
        print(c[g])
        c[g].sort(reverse=True)
        print(c[g])
        h += c[g]

    for k in h:
        print(j.index(k)+1)

guide()

Submission status: Wrong Answer

Solution code:
from operator import itemgetter
N = int(input())
guide = []
for i in range(N):
  lst = input().split(' ')
  guide.append([i+1,lst[0],int(lst[1])])
guide = sorted(guide, key=itemgetter(2),reverse=True)
guide = sorted(guide, key=itemgetter(1))

print(guide)

Submission status: Wrong Answer

Solution code:
import sys

def main():
    num = int(sys.stdin.readline())
    
    input = [None] * num

    for i in range(num):
        read = sys.stdin.readline().split()
        input[i] = [i+1, read[0], int(read[1])]

    input.sort(key=lambda x:(x[1], x[2]))

    for restaurant in input:
        print(restaurant[0])

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys

def main():
    num = int(sys.stdin.readline())
    
    input = [None] * num

    for i in range(num):
        read = sys.stdin.readline().split()
        input[i] = [i, read[0], int(read[1])]

    input.sort(key=lambda x:(x[1], x[2]))

    for restaurant in input:
        print(restaurant[0])

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def make_guide():
    num = int(input())
    lst = [(i + 1, input().split()) for i in range(num)]
    # TODO fix
    # 同じものが存在したら、っていう条件のもとでないとダメ
    # あと数字は降順
    lst = sorted(sorted(lst, key=lambda t: t[1][1], reverse=True), key=lambda t: t[1][0])
    return lst


def test_display():
    lst = make_guide()
    for i, lst in lst:
        print(str(i) + " " + lst[0] + " " + lst[1])


def display():
    lst = make_guide()
    for i, guides in lst:
        print(i)


if __name__ == "__main__":
    display()

Submission status: Wrong Answer

Solution code:
def make_guide():
    num = int(input())
    lst = [(i + 1, input().split()) for i in range(num)]
    lst = sorted(sorted(lst, key=lambda t: t[1][1]), key=lambda t: t[1][0])
    return lst


def test_display():
    lst = make_guide()
    for i, lst in lst:
        print(str(i) + " " + lst[0] + " " + lst[1])


def display():
    lst = make_guide()
    for i, guides in lst:
        print(i)


if __name__ == "__main__":
    display()

Submission status: Wrong Answer

Solution code:
N = int(input())
S = [[i for i in input().split()] for i in range(N)]

for i in range(N):
    S[i][1] = -int(S[i][1])

s = sorted(S)

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

Submission status: Wrong Answer

Solution code:
N = int(input())
Arr = []
tmp = []
for i in range(N):
    tmp = list(map(str, input().split()))
    tmp.append(i+1)
    Arr.append(tmp)

Arr.sort(key=lambda x: x[1], reverse=True)
Arr.sort(key=lambda x: x[0])

for i in range(N):
    print(Arr[i][2])

Submission status: Wrong Answer

Solution code:
from operator import itemgetter
n=int(input())
sp=[]
for i in range(n):
    sp.append(list(map(str,input().split())))
b=sorted(sp,reverse=True, key=itemgetter(1))
c=sorted(b, key=itemgetter(0))
for i in range(n):
    print(1+sp.index(c[i]))

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3

N = int(input())
SP = []
for i in range(N):
    SP.append({"id" :i, "data": input().split()})

tmp = sorted(SP, key=lambda x:x["data"][1], reverse=True)

for k in sorted(tmp, key=lambda x:x["data"][0]):
    print(k["id"]+1)

Submission status: Wrong Answer

Solution code:
n = int(input())
data =[]
for i in range(n):
  sity, score = input().split()
  data.append([sity, int(score),i+1])
  
data.sort(key=lambda x:x[0])
data.sort(key=lambda x:x[1], reverse=True)
for j in range(n):
  print(data[j][2])

Submission status: Wrong Answer

Solution code:
for*_,i in sorted((t[:2],-int(t.split()[-1]),i)for i,t in enumerate(open(0)))[1:]:print(i)

Submission status: Wrong Answer

Solution code:
for*_,i in sorted((t[:3],-int(t.split()[-1]),i)for i,t in enumerate(open(0)))[1:]:print(i)

Submission status: Wrong Answer

Solution code:
for*_,i in sorted((t[:5],-int(t.split()[-1]),i)for i,t in enumerate(open(0)))[1:]:print(i)

Submission status: Wrong Answer

Solution code:
for*_,i in sorted((t.split()[0],-int(t[-3:]),i)for i,t in enumerate(open(0)))[1:]:print(i)

Submission status: Wrong Answer

Solution code:
for*_,i in sorted((t[:5],-int(t[-3:]),i)for i,t in enumerate(open(0)))[1:]:print(i)

Submission status: Wrong Answer

Solution code:
n = int(input())
list1 = []
for i in range(n):
  a,b = map(str,input().split())
  list1.append([a,int(b),i+1])
list1 = sorted(list1,key = lambda x : x[0])
for j in range(n):
  print(list1[j][2])

Submission status: Wrong Answer

Solution code:
num = int(input())
guide = [[i for i in input().split()] for j in range(0, num)]
dic = 1
for i in range(0, len(guide)):
    guide[i].append(dic)
    dic += 1
guide.sort(reverse=True)
guide_book = sorted(guide, key=lambda x : x[0])

for i in range(0, len(guide)):
    print(guide_book[i][2])

Submission status: Wrong Answer

Solution code:
n = int(input())
li_w = list()

for _ in range(n):
    li_w.append(input().split())

li_sorted = sorted(li_w, key=lambda x: (x[0], 100 - int(x[1])))
for a in li_w:
    print(li_sorted.index(a) + 1)

Submission status: Wrong Answer

Solution code:
n = int(input())
li_w = list()

for _ in range(n):
    li_w.append(input().split())

li_sorted = sorted(li_w, key=lambda x: (x[0], 100 - int(x[1])))
for a in li_w:
    print(li_sorted.index(a))

Submission status: Wrong Answer

Solution code:
import math
print("test")

Submission status: Wrong Answer

Solution code:
N=int(input())

datalist=[]
for i in range(N):
    a=input().split()
    datalist.append([i+1]+a)

print("test")

Submission status: Wrong Answer

Solution code:
N=int(input())
print(N)

Submission status: Wrong Answer

Solution code:
n = int(input())
res = {}
for i in range(0, n):
  s, p = [elem for elem in input().split()]
  if not s in res:
    res[s] = [(p, i + 1)]
  else:
    res[s].append((p, i + 1))

for key in sorted(res.keys()):
  for score, idx in sorted(res[key], reverse=-1):
    print(idx)

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    SP = [list(input().split()) for i in range(N)]
    for i, SPl in enumerate(SP):
        SPl.append(i+1)
    # print(SP)
    SP.sort(reverse=True, key=lambda x: x[1])
    # print(SP)
    SP.sort(key=lambda x: x[0])
    # print(SP)

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


if __name__ == "__main__":
    main()