Language: C++

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Dsiagnostics;
 
class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    Scanner cin;


    void calc()
    {
        cin = new Scanner();
        int N=cin.nextInt();
        int b[]=cin.ArrayInt(N,-1);

        List<int> L=new List<int>(b);
        List<int> ans=new List<int>();
        while(L.count>0){
          bool flag=False;
          for(int i=L.count-1;i>=0;i--){
            if(L[i]==i){
              ans.add(i);
              L.RemoveAt(i);
              flag=True;
              break;
            }
          }
          if(!flag){
            Console.WriteLine(-1);
            return;
          }
        }
        ans.Reverse();
        Console.WriteLine(String.Join("\n",ans));
    }
        
      
    }

}




Compiler output:
a.cc:1:7: error: expected nested-name-specifier before 'System'
    1 | using System;
      |       ^~~~~~
a.cc:2:7: error: expected nested-name-specifier before 'System'
    2 | using System.Collections.Generic;
      |       ^~~~~~
a.cc:3:7: error: expected nested-name-specifier before 'System'
    3 | using System.Linq;
      |       ^~~~~~
a.cc:4:7: error: expected nested-name-specifier before 'System'
    4 | using System.Text;
      |       ^~~~~~
a.cc:5:7: error: expected nested-name-specifier before 'System'
    5 | using System.Threading.Tasks;
      |       ^~~~~~
a.cc:6:7: error: expected nested-name-specifier before 'System'
    6 | using System.IO;
      |       ^~~~~~
a.cc:7:7: error: expected nested-name-specifier before 'System'
    7 | using System.Dsiagnostics;
      |       ^~~~~~
a.cc:11:5: error: 'string' does not name a type
   11 |     string[] s;
      |     ^~~~~~
a.cc:14:9: error: expected unqualified-id before '[' token
   14 |     char[] cs = new char[] { ' ' };
      |         ^
a.cc:16:11: error: expected ':' before 'Scanner'
   16 |     public Scanner()
      |           ^~~~~~~~
      |           :
a.cc:22:11: error: expected ':' before 'string'
   22 |     public string next()
      |           ^~~~~~~
      |           :
a.cc:22:12: error: 'string' does not name a type
   22 |     public string next()
      |            ^~~~~~
a.cc:33:11: error: expected ':' before 'int'
   33 |     public int nextInt()
      |           ^~~~
      |           :
a.cc:37:11: error: expected ':' before 'int'
   37 |     public int[] ArrayInt(int N, int add = 0)
      |           ^~~~
      |           :
a.cc:37:15: error: expected unqualified-id before '[' token
   37 |     public int[] ArrayInt(int N, int add = 0)
      |               ^
a.cc:47:11: error: expected ':' before 'long'
   47 |     public long nextLong()
      |           ^~~~~
      |           :
a.cc:52:11: error: expected ':' before 'long'
   52 |     public long[] ArrayLong(int N, long add = 0)
      |           ^~~~~
      |           :
a.cc:52:16: error: expected unqualified-id before '[' token
   52 |     public long[] ArrayLong(int N, long add = 0)
      |                ^
a.cc:62:11: error: expected ':' before 'double'
   62 |     public double nextDouble()
      |           ^~~~~~~
      |           :
a.cc:68:11: error: expected ':' before 'double'
   68 |     public double[] ArrayDouble(int N, double add = 0)
      |           ^~~~~~~
      |           :
a.cc:68:18: error: expected unqualified-id before '[' token
   68 |     public double[] ArrayDouble(int N, double add = 0)
      |                  ^
a.cc:77:2: error: expected ';' after class definition
   77 | }
      |  ^
      |  ;
a.cc: In constructor 'Scanner::Scanner()':
a.cc:18:9: error: 's' was not declared in this scope
   18 |         s = new string[0];
      |         ^
a.cc:18:17: error: 'string' does not name a type
   18 |         s = new string[0];
      |                 ^~~~~~
a.cc: In member function 'int Scanner::nextInt()':
a.cc:35:16: error: expected primary-expression before 'int'
   35 |         return int.Parse(next());
      |                ^~~
a.cc:35:16: error: expected ';' before 'int'
a.cc:35:19: error: expected unqualified-id before '.' token
   35 |         return int.Parse(next());
      |                   ^
a.cc: In member function 'long int Scanner::nextLong()':
a.cc:49:16: error: expected primary-expression before 'long'
   49 |         return long.Parse(next());
      |                ^~~~
a.cc:49:16: error: expected ';' before 'long'
a.cc:49:20: error: expected unqualified-id before '.' token
   49 |         return long.Parse(next());
      |                    ^
a.cc: In member function 'double Scanner::nextDouble()':
a.cc:64:16: error: expected primary-expression before 'double'
   64 |         return double.Parse(next());
      |                ^~~~~~
a.cc:64:16: error: expected ';' before 'double'
a.cc:64:22: error: expected unqualified-id before '.' token
   64 |         return double.Parse(next());
      |                      ^
a.cc: At global scope:
a.cc:82:11: error: expected ':' before 'Myon'
   82 |     public Myon() { }
      |           ^~~~~
      |           :
a.cc:83:11: error: expected ':' before 'static'
   83 |     public static int Main()
      |           ^~~~~~~
      |           :
a.cc:120:6: error: expected ';' after class definition
  120 |     }
      |      ^
      |      ;
a.cc: In static member function 'static int Myon::Main()':
a.cc:85:19: error: expected ';' before '.' token
   85 |         new Myon().calc();
      |                   ^
a.cc: In member function 'void Myon::calc()':
a.cc:94:27: error: no match for 'operator=' (operand types are 'Scanner' and 'Scanner*')
   94 |         cin = new Scanner();
      |                           ^
a.cc:9:7: note: candidate: 'constexpr Scanner& Scanner::operator=(const Scanner&)'
    9 | class Scanner
      |       ^~~~~~~
a.cc:9:7: note:   no known conversion for argument 1 from 'Scanner*' to 'const Scanner&'
a.cc:9:7: note: candidate: 'constexpr Scanner& Scanner::operator=(Scanner&&)'
a.cc:9:7: note:   no known conversion for argument 1 from 'Scanner*' to 'Scanner&&'
a.cc:96:21: error: 'class Scanner' has no member named 'ArrayInt'
   96 |         int b[]=cin.ArrayInt(N,-1);
      |                     ^~~~~~~~
a.cc:98:9: error: 'List' was not declared in this scope
   98 |         List<int> L=new List<int>(b);
      |         ^~~~
a.cc:98:14: error: expected primary-expression before 'int'
   98 |         List<int> L=new List<int>(b);
      |              ^~~
a.cc:99:14: error: expected primary-expression before 'int'
   99 |         List<int> ans=new List<int>();
      |              ^~~
a.cc:100:15: error: 'L' was not declared in this scope
  100 |         while(L.count>0){
      |               ^
a.cc:101:21: error: 'False' was not declared in this scope
  101 |           bool flag=False;
      |                     ^~~~~
a.cc:104:15: error: 'ans' was not declared in this scope
  104 |               ans.add(i);
      |               ^~~
a.cc:106:20: error: 'True' was not declared in this scope
  106 |               flag=True;
      |                    ^~~~
a.cc:111:13: error: 'Console' was not declared in this scope
  111 |             Console.WriteLine(-1);
      |             ^~~~~~~
a.cc:115:9: error: 'ans' was not declared in this scope
  115 |         ans.Reverse();
      |         ^~~
a.cc:116:9: error: 'Console' was not declared in this scope
  116 |         Console.WriteLine(String.Join("\n",ans));
      |         ^~~~~~~
a.cc:116:27: error: 'String' was not declared in this scope
  116 |         Console.WriteLine(String.Join("\n",ans));
      |                           ^~~~~~
a.cc: At global scope:
a.cc:122:1: error: expected declaration before '}' token
  122 | }
      | ^