Language: C++

using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using System.Runtime.CompilerServices;
using static MyUtil;

class MyUtil
{
    public static int[] ReadIntArray()
    {
	return ReadLine().Split().Select(x => int.Parse(x)).ToArray();
    }
}

class Program
{
    public static void Main()
    {
	var tmp = ReadIntArray();
	int h = tmp[0], w = tmp[1];
	int n = int.Parse(ReadLine());

	int[] d = new int[h*w];
	int idx = 0;

	int[] a = ReadIntArray();
	for (int i = 0; i < n; i++)
	{
	    for (int j = 0; j < a[i]; j++)
	    {
		d[idx++] = i+1;
	    }
	}

	for (int i = 0; i < h; i++)
	{
	    string s = "";
	    int baseIdx = i * w;

	    if ((i&1) == 0)
	    {
		for (int j = 0; j < w; j++)
		{
		    s += d[baseIdx + j].ToString();
		}
	    }
	    else
	    {
		for (int j = w-1; j >= 0; j--)
		{
		    s += d[baseIdx + j].ToString();
		}
	    }

	    WriteLine(s);
	}
    }
}


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 'static'
    4 | using static System.Console;
      |       ^~~~~~
a.cc:5:7: error: expected nested-name-specifier before 'System'
    5 | using System.Runtime.CompilerServices;
      |       ^~~~~~
a.cc:6:7: error: expected nested-name-specifier before 'static'
    6 | using static MyUtil;
      |       ^~~~~~
a.cc:10:11: error: expected ':' before 'static'
   10 |     public static int[] ReadIntArray()
      |           ^~~~~~~
      |           :
a.cc:10:22: error: expected unqualified-id before '[' token
   10 |     public static int[] ReadIntArray()
      |                      ^
a.cc:14:2: error: expected ';' after class definition
   14 | }
      |  ^
      |  ;
a.cc:18:11: error: expected ':' before 'static'
   18 |     public static void Main()
      |           ^~~~~~~
      |           :
a.cc:59:2: error: expected ';' after class definition
   59 | }
      |  ^
      |  ;
a.cc: In static member function 'static void Program::Main()':
a.cc:20:9: error: 'var' was not declared in this scope
   20 |         var tmp = ReadIntArray();
      |         ^~~
a.cc:21:17: error: 'tmp' was not declared in this scope
   21 |         int h = tmp[0], w = tmp[1];
      |                 ^~~
a.cc:22:17: error: expected primary-expression before 'int'
   22 |         int n = int.Parse(ReadLine());
      |                 ^~~
a.cc:24:12: error: structured binding declaration cannot have type 'int'
   24 |         int[] d = new int[h*w];
      |            ^~
a.cc:24:12: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:24:12: error: empty structured binding declaration
a.cc:24:15: error: expected initializer before 'd'
   24 |         int[] d = new int[h*w];
      |               ^
a.cc:27:12: error: structured binding declaration cannot have type 'int'
   27 |         int[] a = ReadIntArray();
      |            ^~
a.cc:27:12: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:27:12: error: empty structured binding declaration
a.cc:27:15: error: expected initializer before 'a'
   27 |         int[] a = ReadIntArray();
      |               ^
a.cc:30:33: error: 'a' was not declared in this scope
   30 |             for (int j = 0; j < a[i]; j++)
      |                                 ^
a.cc:32:17: error: 'd' was not declared in this scope
   32 |                 d[idx++] = i+1;
      |                 ^
a.cc:38:13: error: 'string' was not declared in this scope
   38 |             string s = "";
      |             ^~~~~~
a.cc:39:31: error: 'w' was not declared in this scope
   39 |             int baseIdx = i * w;
      |                               ^
a.cc:45:21: error: 's' was not declared in this scope
   45 |                     s += d[baseIdx + j].ToString();
      |                     ^
a.cc:45:26: error: 'd' was not declared in this scope
   45 |                     s += d[baseIdx + j].ToString();
      |                          ^
a.cc:52:21: error: 's' was not declared in this scope
   52 |                     s += d[baseIdx + j].ToString();
      |                     ^
a.cc:52:26: error: 'd' was not declared in this scope
   52 |                     s += d[baseIdx + j].ToString();
      |                          ^
a.cc:56:23: error: 's' was not declared in this scope
   56 |             WriteLine(s);
      |                       ^
a.cc:56:13: error: 'WriteLine' was not declared in this scope
   56 |             WriteLine(s);
      |             ^~~~~~~~~