Language: C++

import numpy as np

def padding_id(id):
    padded_id = id
    id_length = len(id)
    for i in range(6-id_length):
        padded_id = "0" + padded_id
    return padded_id

def main():
    string = input().split(' ')
    N = int(string[0])
    M = int(string[1])
    P = np.zeros(M, dtype='int32')
    Y = np.zeros(M, dtype='int32')
    Y_per_P = {}
    for i in range(M):
        string = input().split(' ')
        P[i] = int(string[0])
        Y[i] = int(string[1])
        if P[i] in Y_per_P:
            Y_per_P[P[i]]['year'] = np.append(Y_per_P[P[i]]['year'], Y[i])
        else:
            Y_per_P[P[i]] = {'year': np.asarray([Y[i]])}
    for key in Y_per_P.keys():
        Y_per_P[key]['sorted_id'] = np.argsort(Y_per_P[key]['year'])

    for p, y in zip(P, Y):
        y_filter = Y_per_P[p]['year'] == y
        id = Y_per_P[p]['sorted_id'][y_filter]
        print(padding_id(str(p)) + padding_id(str(id[0]+1)))


if __name__ == '__main__':
    main()


Compiler output:
a.cc:14:27: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
   14 |     P = np.zeros(M, dtype='int32')
      |                           ^~~~~~~
a.cc:15:27: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
   15 |     Y = np.zeros(M, dtype='int32')
      |                           ^~~~~~~
a.cc:22:27: warning: multi-character character constant [-Wmultichar]
   22 |             Y_per_P[P[i]]['year'] = np.append(Y_per_P[P[i]]['year'], Y[i])
      |                           ^~~~~~
a.cc:22:61: warning: multi-character character constant [-Wmultichar]
   22 |             Y_per_P[P[i]]['year'] = np.append(Y_per_P[P[i]]['year'], Y[i])
      |                                                             ^~~~~~
a.cc:24:30: warning: multi-character character constant [-Wmultichar]
   24 |             Y_per_P[P[i]] = {'year': np.asarray([Y[i]])}
      |                              ^~~~~~
a.cc:26:22: warning: multi-character literal with 9 characters exceeds 'int' size of 4 bytes
   26 |         Y_per_P[key]['sorted_id'] = np.argsort(Y_per_P[key]['year'])
      |                      ^~~~~~~~~~~
a.cc:26:61: warning: multi-character character constant [-Wmultichar]
   26 |         Y_per_P[key]['sorted_id'] = np.argsort(Y_per_P[key]['year'])
      |                                                             ^~~~~~
a.cc:29:31: warning: multi-character character constant [-Wmultichar]
   29 |         y_filter = Y_per_P[p]['year'] == y
      |                               ^~~~~~
a.cc:30:25: warning: multi-character literal with 9 characters exceeds 'int' size of 4 bytes
   30 |         id = Y_per_P[p]['sorted_id'][y_filter]
      |                         ^~~~~~~~~~~
a.cc:34:16: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
   34 | if __name__ == '__main__':
      |                ^~~~~~~~~~
a.cc:1:1: error: 'import' does not name a type
    1 | import numpy as np
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:17:5: error: expected unqualified-id before 'for'
   17 |     for i in range(M):
      |     ^~~
a.cc:25:5: error: expected unqualified-id before 'for'
   25 |     for key in Y_per_P.keys():
      |     ^~~