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: Runtime Error

Solution code:
import numpy as np
from operator import itemgetter

N = int(input())

list = []
for i in range(N):
    a,b=input().split()
    list.append([a, int(b),i+1])
sort1 = sorted(list, key=itemgetter(0))
if N == 1:
  print(1)
else:
  ans = []
  kari = []
  end = 1
  k = 1
  for i in range(0,N-1):
    if end == 1:
      kari.append(sort1[i])
      else:
        k = 0
        if sort1[i][0] == sort1[i+1][0]:  
          kari.append(sort1[i+1])
          end = 0
          if i+1 > N-2:
            kari.sort(key=itemgetter(1),reverse=True)
            ans.extend(kari)

            else:
              kari.sort(key=itemgetter(1),reverse=True)
              ans.extend(kari)
              if i+1 > N-2:
                ans.append(sort1[i+1])
                kari = []
                end = 1
  print(sort1)
  print(ans)
  for i in range(0,len(ans)):
      print(ans[i][2])

Submission status: Runtime Error

Solution code:
#include<stdio.h>
#include <string.h>
int main(void){
    int n,i,j,x[10] = {1,2,3,4,5,6,7,8,9,10};
    scanf("%d",&n);
    char s[100][11],tmp_s[11];
    int d[100],tmp_d;
    for(i=0;i<n;++i){
       scanf("%s %d",&s[i],&d[i]);
    }
    for(i=0;i<n;++i){
        for(j=i+1;j<n;++j){
            if(strcmp(s[i],s[j])>0){
                strcpy(tmp_s,s[i]);
                tmp_d = d[i];
                strcpy(s[i],s[j]);
                d[i] = d[j];
                strcpy(s[j],tmp_s);
                d[j] = tmp_d;
                tmp_d = x[i];
                x[j] =x[i];
                x[i] = tmp_d;
            }else if(strcmp(s[i],s[j])==0){
                if(d[i] > d[j]){
                    strcpy(tmp_s,s[i]);
                    tmp_d = d[i];
                    strcpy(s[i],s[j]);
                    d[i] = d[j];
                    strcpy(s[j],tmp_s);
                    d[j] = tmp_d;
                    tmp_d = x[i];
                    x[j] =x[i];
                    x[i] = tmp_d;
                }
            }
        }
    }
    for(i=0;i<n;++i){
        printf("%d\n",x[i]);
    }
    return 0;
}

Submission status: Runtime Error

Solution code:
#d=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
#import numpy as np
#n=int(input())
#import fractions
#S=input()
#import math
#lis=list(map(int,input().split()))

n=int(input())
sp={}
for i in range(n):
    li=input().split()
    li.append(i+1)
    if li[0] not in sp:
        sp[li[0]]=[li]
    else:
        sp[li[0]].append(li)
        sp[li[0]].sort(reverse=True)
items_sorted = sorted(sp.items())
print(items_sorted)
for i in range(n):
    for j in range(len(items_sorted[i])):
        print(items_sorted[i][j+1][2])

Submission status: Runtime Error

Solution code:
citys = {}
number = {}
N = int(input())
for n in range(N):
    S, P = input().split(" ")
    if S in citys.keys():
        citys[S].append(int(P))
    else:
        citys[S] = [int(P)]
    number[int(P)] = int(n+1)
citys_name = list(citys.keys())
for city in sorted(citys_name):
    if len(citys[city]) == 1:
        print(number[citys[city]][0])
    else:
        for i in (citys[city]).sort(reverse=True):
            print(number[i])

Submission status: Runtime Error

Solution code:
n=int(input())
S=[]
P=[]
for i in range(n):
  s,p=input().split()
  q=int(p)
  S.append(s)
  P.append(q)
T=sorted(list(set(S)))
A=[]
for j in range(len(T)):
  U=[]
  for k in range(n):
    if T[j]==S[k]:
      U.append(P[k])
      sorted(U,reverse=True)
      A.append(U)
def flatten(nested_list):
  return[e for inner_list in nested_list for e inner_list]
B=flatten(A)
for l in range(n):
  print(P.index(B[l]))

Submission status: Runtime Error

Solution code:
import numpy as np
N = int(input())
name_list = []
score_list = []
score_list_new = []
for i in range(N):
  name, score =  map(str,input().split())
  name_list.append(name)
  score_list.append(int(score))
index_name = np.argsort(name_list)
for i in range (len(score_list)):
  score_list_new.append(score_list[index_name[i]])
for i in range(len(index_name)):
  for j in range(i,len(index_name)):
  	if (name_list[i] == name_index[j]) and (score_list_new[i] < score_list_new[j]):
      index_name[i], index_name[j] = index_name[j], index_name[i]
    else:
      None  
for i in range(len(index_name)):
  print(index_name[i])

Submission status: Runtime Error

Solution code:
from collections import defaultdict

N = int(input())
S = [0] * N
P = [0] * N

city_point = {}

for i in range(N):
    inp = input().split()
    S[i] = inp[0]
    P[i] = inp[1]
    city_point[i] = {'city': S[i], 'point': int(P[i])}
    
sorted_list = sorted(city_point.items(), key=lambda x: (x[1]['city'], x[1]['point']))

for key in sorted_list:
    print(key + 1)

Submission status: Runtime Error

Solution code:
#input
N = int(input())
S, P = [], []
rstrnt = []
for i in range(int(N)):
    ###S[i],P[i] に入力したいが型が違うので詰んでる
    rstrnt[i-1] = [ i, S[i-1] ,P[i-1] ]
sorted(rstrnt, key=2, reverse=True)#Pを降順でソート
sorted(rstrnt, key=1)#Sを昇順でソート

#output
###出力どうすんねん

Submission status: Runtime Error

Solution code:
import numpy as np
from nltk.classify.maxent import calculate_empirical_fcount
N = int(input())
SList = []
PList = []
dic = {}
Slist = []
aa = []
for _ in range(N):
    S, P = input().split()
    dic[S] = int(P)
    Slist.append(S)
    aa.append((int(P), S))
dic = sorted(dic.items())

sortedS = list(sorted(set(Slist)))

for i in range(len(sortedS)):
    tempV = []
    tempI = []
    for j in range(N):
        if aa[j][1] == sortedS[i]:
            tempV.append(aa[j][0])
            tempI.append(j)
    indexList = np.argsort(tempV)
    for k in reversed(indexList):
        print(tempI[k] + 1)

Submission status: Runtime Error

Solution code:
n=int(input())
S=[]
P=[]
for i in range(n):
  s,p=input().split()
  q=int(p)
  S.append(s)
  P.append(p)
T=sorted(set(S))
A=[]
for j in range(len(T)):
  U=[]
  for k in range(n):
    if T[j]==S[k]:
      U.append(P[k])
      sorted(U,reverse=True)
      A.append(U)
def flatten(nested_list):
  return[e for inner_list in nested_list for e inner_list]
B=flatten(A)
for l in range(n):
  print(P.index(B[l]))

Submission status: Runtime Error

Solution code:
import numpy as np
from nltk.classify.maxent import calculate_empirical_fcount
N = int(input())
SList = []
PList = []
dic = {}
Slist = []
aa = []
for _ in range(N):
    S, P = input().split()
    dic[S] = int(P)
    Slist.append(S)
    aa.append((int(P), S))
dic = sorted(dic.items())

sortedS = list(sorted(set(Slist)))

for i in range(len(sortedS)):
    tempV = []
    tempI = []
    for j in range(N):
        if aa[j][1] == sortedS[i]:
            tempV.append(aa[j][0])
            tempI.append(j)
    indexList = np.argsort(tempV)
    for k in reversed(indexList):
        print(tempI[k] + 1)

Submission status: Runtime Error

Solution code:
a=int(input())
b=[]
ans=[]
hoge=0;
fuga="";
c={}
d={}
j=0
for i in range(a):
    x,y=map(str,input().split())
    b.append(x)
    c[i]=[x,str(y)]
    d[x+str(y)]=i+1
b.sort()
for piyo in b:
    ans.append(0)
    hoge=0

    for i in range(a):
        if c[i][0]==piyo:
            if int(c[i][1])>int(hoge):
                hoge=c[i][1]
                fuga=c[i][1]
                ans[-1]=i
    p=ans[-1]
    print(d[c[p][0]+c[p][1]])
    c[ans[-1]]=[None,None]

Submission status: Runtime Error

Solution code:

a = sorted([input().split() + [str(i+1)] for i in range(n)])

a.append(['end', '0', '0'])

tmp = []
ans = []

for i in range(n):
    tmp.append(a[i])
    if a[i][0] != a[i+1][0]:
        ans.append(sorted(tmp, key=lambda x: int(x[1]), reverse=True))
        tmp = []

[print(c[2]) for c in ans[0]]

Submission status: Runtime Error

Solution code:
N = input()

S =[]
P =[]

for i in range(N):
    s,p = [int(i) for i in input().split()]
    S.append(s)
    P.append(p)

d1 = dict(zip(key,value))
d2 = sorted(d1.items(),key=lambda x:x[1],reverse=True)
d3 = sorted(d2.items())

for j in range(N):
    print(d3[j])

Submission status: Runtime Error

Solution code:
#b.py
n = int(input())
lis = [list(input().split())+[x] for x in range(n)]
lis = sorted(lis,key=lambda x:x[0])
now = lis[0][0]
ans_lis = []
sublis = []
for x in lis:
    if x[0] == now:
        sublis.append(x)
    else:
        now = x[0]
        sublis = sorted(sublis,key=lambda x:int(x[1]),reverse=True)
        print(int(x[1]))
        ans_lis.append(sublis)
        sublis = []
        sublis.append(x)
for x in ans_lis:
    print(x[2]+1)

Submission status: Runtime Error

Solution code:
from operator import itemgetter
from sys import stdin

def cast(sp, i):
  return (sp[0], int(sp[1]), i)

def main():
  N = input()
  SP = [cast(stdin.readline().rstrip().split(), i+1) for i in range(N)]
  #ans = sorted(SP, key=itemgetter(1, 0), reverse=[True, False])
  ans = sorted(SP, key=itemgetter(1), reverse=True)
  #print(ans)
  ans = sorted(SP, key=itemgetter(0))
  #print(ans)
  for x in ans:
    print(x[2])

if __name__ == '__main__':
  main()

Submission status: Runtime Error

Solution code:
from operator import itemgetter
from sys import stdin

def cast(sp, i):
  return (sp[0], int(sp[1]), i)

def main():
  N = input()
  SP = [cast(stdin.readline().rstrip().split(), i+1) for i in range(N)]
  #ans = sorted(SP, key=itemgetter(1, 0), reverse=[True, False])
  ans = sorted(SP, key=itemgetter(1), reverse=True)
  #print(ans)
  ans = sorted(SP, key=itemgetter(0))
  #print(ans)
  ans = map(lambda x: x[2], ans)
  print(ans)

if __name__ == '__main__':
  main()

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline

n = int(input())
x = [list(input().split()) for _ in range(n)]

for i in range(n):
    x[i][1] = int(x[i][1])

X = []
for i in range(len(x)):
    X.append(int(x[i][1]))
    
xx = sorted(x)
flag = True
temp = xx[0][0]
l = []
ans = []
l.append(xx[0][1])
for i in range(1, n):
    if temp == xx[i][0]:
        l.append(xx[i][1])
        flag = True
    else:
        flag = False
        l.sort(reverse=True)
        for j in l:
            ans.append(j)

        l = []
        temp = xx[i][0]
        l.append(xx[i][1])


if len(x) == 2 : ans.append(xx[i][1])


if flag:
    l.sort(reverse=True)
    for j in l:
        ans.append(j)
    
ans = [int(a) for a in ans]
for i in range(n):
    print(X.index(ans[i]) + 1)

Submission status: Runtime Error

Solution code:
def gen_switch(i, n):
    ret = []
    str_bin = format(i, '011b')
    for k in range(n):
        ret.append(int(str_bin[-k-1]))
    ret.reverse()
    return ret


input_line = raw_input()
splitted_line = input_line.split(" ")
n = int(splitted_line[0])
m = int(splitted_line[1])


my_mtx = []

for i in range(m):
    my_list = [0] * n
    splitted_line = raw_input().split(" ")

    for j in range(len(splitted_line)):
        if j != 0:
            my_list[int(splitted_line[j])-1] = 1

    my_mtx.append(my_list)

splitted_line = raw_input().split(" ")
my_list = []

for item in splitted_line:
    my_list.append(int(item))


count = 0

# print(my_list)

for i in range(2 ** n):
    my_switch = gen_switch(i, n)
    for j in range(m):
        my_sum = 0
        for k in range(len(my_switch)):
            my_sum = my_sum + (my_switch[k] * my_mtx[j][k])
        if my_sum % 2 != my_list[j]:
            break
        if j == m - 1:
            count = count + 1

print(count)

Submission status: Runtime Error

Solution code:
number = int(raw_input())
my_set = set()
for i in range(number):
    input_line = raw_input()
    splitted_line = input_line.split(" ")
    my_set.add((splitted_line[0], - int(splitted_line[1]), i+1))

my_sorted = sorted(my_set)

for item in my_sorted:
    print(item[2])

Submission status: Runtime Error

Solution code:
N = int(input())
A = [0 for i in range(N)]
for i in range(N):
    A[i] = map(str,input().split())
for i in range(N):
    A[i].append(str(i))

B = sorted(A, key=lambda x: x[1], reverse=True)

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

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

Submission status: Runtime Error

Solution code:
import numpy as np
from operator import itemgetter

N = int(input())

list = []
for i in range(N):
    a,b=input().split()
    list.append([a, int(b),i+1])
sort1 = sorted(list, key=itemgetter(0))
ans = []
kari = []
end = 1
k = 1
for i in range(0,N-1):
    if end == 1:
    	kari.append(sort1[i])
    else:
      	k = 0
    if sort1[i][0] == sort1[i+1][0]:  
        kari.append(sort1[i+1])
        if i+1 > N-2:
        	kari.sort(key=itemgetter(1),reverse=True)
        	ans.extend(kari)
        end = 0
    else:
        kari.sort(key=itemgetter(1),reverse=True)
        ans.extend(kari)
        if i+1 > N-2:
        	ans.extend(sort1[i+1])
        kari = []
        end = 1

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

Submission status: Runtime Error

Solution code:
number = int(input())
my_set = set()
for i in range(number):
    input_line = raw_input()
    splitted_line = input_line.split(" ")
    my_set.add((splitted_line[0], - int(splitted_line[1]), i+1))

my_sorted = sorted(my_set)

for item in my_sorted:
    print(item[2])

Submission status: Runtime Error

Solution code:
number = int(input())
my_set = set()
for i in range(number):
    input_line = raw_input()
    splitted_line = input_line.split(" ")
    my_set.add((splitted_line[0], - int(splitted_line[1]), i+1))

my_sorted_1 = sorted(my_set)
 
for item in my_sorted_1:
    print(item[2])

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline

n = int(input())
x = [list(input().split()) for _ in range(n)]

for i in range(n):
    x[i][1] = int(x[i][1])

X = []
for i in range(len(x)):
    X.append(int(x[i][1]))
xx = sorted(x)
flag = True
temp = xx[0][0]
l = []
ans = []
l.append(xx[0][1])
for i in range(1, n):
    if temp == xx[i][0]:
        l.append(xx[i][1])
        flag = True
    else:
        flag = False
        l.sort(reverse=True)
        for j in l:
            ans.append(j)

        l = []
        temp = xx[i][0]
        l.append(xx[i][1])



if flag:
    l.sort(reverse=True)
    for j in l:
        ans.append(j)
    
ans = [int(a) for a in ans]

for i in range(n):
    print(X.index(ans[i]) + 1)

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline

n = int(input())
x = [list(input().split()) for _ in range(n)]

for i in range(n):
    x[i][1] = int(x[i][1])

X = []
for i in range(len(x)):
    X.append(int(x[i][1]))
xx = sorted(x)

temp = xx[0][0]
l = []
ans = []
l.append(xx[0][1])
for i in range(1, n):
    if temp == xx[i][0]:
        l.append(xx[i][1])
        flag = True
    else:
        flag = False
        l.sort(reverse=True)
        for j in l:
            ans.append(j)

        l = []
        temp = xx[i][0]
        l.append(xx[i][1])



if flag:
    l.sort(reverse=True)
    for j in l:
        ans.append(j)
    
ans = [int(a) for a in ans]

for i in range(n):
    print(X.index(ans[i]) + 1)

Submission status: Runtime Error

Solution code:
N = int(input())
sp=[[0]*3 for i in range(N)]
for i in range(N):
    sp[i][0], sp[i][1] = input.split()
    sp[i][1] = int(sp[i][1])
    sp[i][2] = i

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

Submission status: Runtime Error

Solution code:

from operator import itemgetter
from operator import attrgetter
N = int(input())
li = []

for i in range(N):
    li.append(list(map(str, input().split())))
    li[i][1]  = int (li[i][1])


copyli = li.copy()
ans = []
##copyli.sort()
a = sorted(copyli, key = itemgetter(1),  reverse=True)
c = sorted(a, key = itemgetter(0))


##copyli.sort(key=attrgetter(1), reverse=True)

for i in range(N):
    for j in range(N):
        if (li[j][0] == c[i][0]) and (li[j][1] == c[i][1]):
            ans.append(j+1)

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

Submission status: Runtime Error

Solution code:
from operator import itemgetter

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

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default
for i in ans:
    print(my_index(sp, i)+1)

Submission status: Runtime Error

Solution code:
import copy
from operator import itemgetter
from operator import attrgetter
N = int(input())
li = []

for i in range(N):
    li.append(list(map(str, input().split())))
    li[i][1]  = int (li[i][1])


copyli = li.copy()
ans = []
##copyli.sort()
a = sorted(copyli, key = itemgetter(1),  reverse=True)
c = sorted(a, key = itemgetter(0))


##copyli.sort(key=attrgetter(1), reverse=True)

for i in range(N):
    for j in range(N):
        if (li[j][0] == c[i][0]) and (li[j][1] == c[i][1]):
            ans.append(j+1)

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

Submission status: Runtime Error

Solution code:
N = int(input())
restourants = dict()

for i in range(N):
    S, P = map(str,input().split())
    if S not in restourants:
        restourants[S] = {}
    restourants[S][int(P)] = i+1
for k, v in sorted(restourants.items()):
    if len(v)>1:
        v = sorted(v.items(),reverse=True)
  
    
    for i in v:
        print(i[1])

Submission status: Runtime Error

Solution code:

N = int(input())

list = []

for i in range(N):
    A, B = input().split()

    A = A + "000000000000"
    A = A[:10]
    B = str(2000-int(B))+str(i+1001)
    list.append(A+B)

list = merge_sort(list)

for i in list:
    print(int(i[-3:]))

Submission status: Runtime Error

Solution code:
N = int(input())
restourants = dict()

for i in range(N):
    S, P = map(str,input().split())
    if S not in restourants:
        restourants[S] = {}
    restourants[S][int(P)] = i+1
for k, v in sorted(restourants.items()):
    if len(v)>1:
        v = sorted(v.items(),reverse=True)
    
    for i in v:
        print(i[1])

Submission status: Runtime Error

Solution code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCorder
{
    class Program
    {

        static void Main(string[] args)
        {

            int n = int.Parse(Console.ReadLine());
            var list = new List<hoge>();
            for (var i = 1; i <= n; i++)
            {
                var s  = Console.ReadLine().Split(" ");
                list.Add(new hoge(i, s[0], s[1]));
            }

            foreach(var v in list.OrderByDescending(x => x.score).OrderBy(x => x.name))
            {
                Console.WriteLine(v.seq.ToString());
            }
        }
        public class hoge
        {
            public int seq { get; set; }
            public string name { get; set; }
            public int score { get; set; }

            public hoge(int seq,string name, string score)
            {
                this.seq = seq;
                this.name = name;
                this.score = int.Parse(score);
            }
        }
    }
}

Submission status: Runtime Error

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

S_mid = sorted(S, key=lambda x:P[x])
S_fin = sorted(range(len(S_mid)), key=lambda idx:S_mid[idx])
# fin = sorted(range(N), key=lambda idx: S_mid[idx])
for i in fin:
    print (i)

Submission status: Runtime Error

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].argsort()[::-1],:]
SPs3=SPs2[SPs2[:,1].argsort(),:][:,0]

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

Submission status: Runtime Error

Solution code:

N = int(input())
S=[0]*N
P=[0]*N 
for i in range(N):
    S[i], P[i] = input().split()
    P[i] = int(P[i])

S_mid = sorted(S, key=lambda idx: P[idx] )
fin = sorted(range(N), key=lambda idx: S_mid[idx])
for i in fin:
print (i)

Submission status: Runtime Error

Solution code:
import pandas as pd

N=int(input())

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

df=pd.DataFrame(datalist)
df.columns=["num","name","point"]
df.sort_values(by="point",inplace=True,ascending=False)
df.sort_values(by="name",inplace=True)
df.reset_index(inplace=True)
for i in range(N):
    print(df.num[i])

Submission status: Runtime Error

Solution code:
import pandas as pd
import numpy as np

N = input()
N = int(N)
a_np = np.ones((N,1))
a_pd = pd.DataFrame(a_np,columns=['A'])
a_pd['B']=None
a_pd['C']=None
for i in range(0,N):
    S, P = map(str, input().split())
    P = int(P)
    a_pd.loc[i,:] = [i,S,P]
    #print(i,S,P)
b_pd = a_pd.sort_values(['B','C'],ascending=[True, False])
b_pd = b_pd.reset_index()
print(b_pd)
c = b_pd.loc[:,'A']
for j in range(0,N):
    print(int(c[j]+1))

Submission status: Runtime Error

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].argsort()[::-1],:]
SPs3=SPs2[SPs2[:,1].argsort(),:][0,:]

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

Submission status: Runtime Error

Solution code:
n=int(input())
dct={}
P=[]
for i in range(n):
  s,p=input().split()
  q=int(p)
  dct[s]=q
  P.append(q)
T=sorted(dct.items(),key=lambda x:x[0])
for j in range(n-1):
  if T[j][0]==T[j+1][0]:
    if T[j][1]<T[j+1][1]:
      T[j][1],T[j+1][1]=T[j+1][1],T[j][1]
U=T.values()
for k in range(n):
  print((P.index(U[k]))+1)

Submission status: Runtime Error

Solution code:
import pandas as pd
n = int(input())
shops = [0]*n
points = [0]*n
nums = [i for i in range(1,n+1)]
for i in range(n):
    shops[i],points[i] = input().split()
d = pd.DataFrame({'shops':shops,'points':points,'nums':nums})    
l = d.sort_values('shops').sort_values('points', ascending=False)['nums'].tolist()
for i in range(len(l)):
    print(l[i])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:

n = input()
list = []

for i in range(n):
    print("str: ")
    s,p = input().split()
    
    #s, p = sp[0], int(sp[1])
    list.append([i+1, s, p])
"""
list.append([1, "test2", 3])
list.append([2, "test3", 1])
list.append([3, "test1", 5])
list.append([4, "test1", 4])
"""

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

Submission status: Runtime Error

Solution code:
import pandas as pd
N = int(input())
DF = []
for i in range(N):
    S1, SP = input().split()
    DF = DF + [[i+1, S1, int(SP)]]
DF1 = sorted(DF, key=lambda x:x[2], reverse=True)
DF2 = sorted(DF1, key=lambda x:x[1], reverse=False)
for i in range(N):
    print(DF2[i][0])

Submission status: Runtime Error

Solution code:

n = input()
list = []

for i in range(n):
    print("str: ")
    sp = input().split()
    s = str(sp[0])
    p = int(sp[1])

    #s, p = sp[0], int(sp[1])
    list.append([i+1, s, p])
"""
list.append([1, "test2", 3])
list.append([2, "test3", 1])
list.append([3, "test1", 5])
list.append([4, "test1", 4])
"""

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n=int(input())
dct={}
P=[]
for i in range(n):
  s=input()
  p=int(input())
  dct[s]=p
  P.append(p)
T=sorted(dct.items(),key=lambda x:x[0])
for j in range(n-1):
  if T[j][0]==T[j+1][0]:
    if T[j][1]<T[j+1][1]:
      T[j][1],T[j+1][1]=T[j+1][1],T[j][1]
U=T.values()
for k in range(n):
  print((P.index(U[k]))+1)

Submission status: Runtime Error

Solution code:
import pandas as pd

N = int(input())
df = pd.DataFrame({"city":0,"Point":0},index=["test",])

for i in range(N):
    s, p = input().split()
    add_df = pd.DataFrame({ 'city' : s,'Point' : p},index=[i + 1,])
    df = df.append(add_df)

df = df.drop("test")
df["Point"] = df["Point"].astype(int)
df_s = df.sort_values(['city', 'Point'], ascending=[True, False]).reset_index()


for i in range(len(df_s)):
    print(df_s["index"].values[i])

Submission status: Runtime Error

Solution code:
import pandas as pd
N = int(input())
city_score = [[i for i in input().split()] for i in range(N)]
all = list()
for i in range(N):
    all.append([city_score[i][0], int(city_score[i][1])*-1, i+1])
df = pd.DataFrame(all, columns=['city', 'score', 'index'])
df = df.sort_values(["city","score"])
result = list(df["index"].values)
for i in result:
    print(i)

Submission status: Runtime Error

Solution code:
n=int(input())
i = 1
alllist = []
while i < n :
  a,b=map(str, input().split())
  c = [a ,int(b),i]
  alllist.append(c)
  i += 1
alllist.sort(key=lambda x:-x[1],reverse=True)
#print(alllist[0][2])
j = 0
while j < n :
  print(alllist[j][2])
  j += 1

Submission status: Runtime Error

Solution code:
n=int(input())
i = 1
alllist = []
while i < n :
  a,b=map(str, input().split())
  c = [a ,int(b),i]
  alllist.append(c)
  i += 1
alllist.sort(key=lambda x:-x[1],reverse=True)
#print(alllist[0][2])
j = 0
while j < n :
  print(alllist[j-1][2])
  j += 1

Submission status: Runtime Error

Solution code:
# input
N = int(input())
SA = [str(input()) for i in range(N)]

# process
cities = list(set([x.split()[0] for x in SA]))
cities.sort()

for y in cities:
    each_SA = [i for i in SA if y in i]
    each_points = [int(x.split()[1]) for x in each_SA]
    each_points.sort(reverse=True)
    for j in each_points:
        print(SA.index(y + ' ' + str(j)) + 1)

Submission status: Runtime Error

Solution code:
N = int(input())
all_point_list = [input().split() for _ in range(N)]
for each_list in all_point_list:
    each_list[1] = int(each_list[1])
sorted_all_list = sorted(all_point_list)
for sorted_point in sorted_all_list:
    print(all_point_list.index(sorted_point+1))

Submission status: Runtime Error

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

for p in P:
    print(p[0])

Submission status: Runtime Error

Solution code:
# input
N = int(input())
SA = [str(input()) for i in range(N)]

# process
cities = list(set([x.split()[0] for x in SA]))
cities.sort()
print(cities)

for y in cities:
    each_SA = [i for i in SA if y in i]
    each_points = [int(x.split()[1]) for x in each_SA]
    each_points.sort(reverse=True)
    for j in each_points:
        print(SA.index(y + ' ' + str(j)) + 1)

Submission status: Runtime Error

Solution code:
n = int(input())
from operator import itemgetter
a=[]
for i in range(n):
  a.append(tuple(map(str,input().split()),i))
a1= sorted(a,key=itemgetter(0))
a2=sorted(a1,key=itemgetter(1),reverse=True)
for i in range(n):
  print(a2[i][2])

Submission status: Runtime Error

Solution code:
n = int(input())
l = []
for i in range(n):
    d = {}
    d["index"] = i+1
    d["city"], d["score"] = input().split()
    l.append(d)
results = []
for city in citys:
    sorted_scores = sorted([l[i]["score"] for i in range(n) if l[i]["city"] == city], reverse=True)
    for score in sorted_scores:
        candidate = [l[i]["index"] for i in range(n) if (l[i]["city"] == city)&(l[i]["score"] == score)][0]
        results.append(candidate)
print(*results, sep="\n")

Submission status: Runtime Error

Solution code:
import fractions
import numpy as np
import os
import sys
from pandas import DataFrame

n=int(input())
d=[]
for i in range(n):
    a,b=input().split()
    t=[a,int(b),int(i)]
    d.append(t)

df=DataFrame(d)
df=df.sort_values(by=1,ascending=False)
df=df.sort_values(by=0)


df=df.iloc[:,2]
for i in df:
    print(i+1)

Submission status: Runtime Error

Solution code:
N = int(input())
array = []
for i in range(N):
    array.append(list(map(str, input().split())))
array_new = sorted(array, key=lambda x: (x[0], -x[1]))
for i in range(N):
    print(int(array.index(array_new[i])+1))

Submission status: Runtime Error

Solution code:
import pandas as pd
N = int(input())
S = []
P = []
for i in range(N):
    S1, SP = input().split()
    S = S + [S1]
    P = P + [int(SP)]
df = pd.DataFrame({'city': S, 'point': P})
df = df.sort_values(by=['point'], ascending=False)
df = df.sort_values(by=['city'], ascending=True)
for x in df.index:
    print(x+1)

Submission status: Runtime Error

Solution code:
N=int(input())

SP = [list(input().split()) for _ in range(N)]

sp=[]
count=1
for s,p in SP:
    sp.append([s,int(p),count])
    count+=1
    
#sp.sort(key=lambda x:x[1],reverse=True)
sp.sort(key=lambda x:(x[0],-x[1]))

for i in len(sp):
    print(sp[i][2])

Submission status: Runtime Error

Solution code:
import pandas as pd
import numpy as np

N=int(input())

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

df=pd.DataFrame(datalist)
df.columns=["num","name","point"]
df.sort_values(by="point",inplace=True,ascending=False)
df.sort_values(by="name",inplace=True)
df.reset_index(inplace=True)
for i in range(N):
    print(df.num[i])

Submission status: Runtime Error

Solution code:
import pandas as pd

Submission status: Runtime Error

Solution code:
N =int(raw_input())
S =[]
P =[]
for i in range(N):
    s,p=map(str,raw_input().split())
    S.append(s)
    P.append(p)
ss=sorted(list(set(S)))
for i in range(len(ss)):
    a =[]
    b =[]
    for j in range(N):
        if ss[i]==S[j]:
            a.append(j)
            b.append(P[i])
    c = list(sorted(b)).reverse()
    if len(c)>0:
        for k in c:
            for j in range(len(b)):
                if k == b[j]:
                    print(a[j])