Language: C++

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cctype>
#include<string>
#include<algorithm>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <utility> 
using namespace std;

using ll = long long;





int main()
{
	int H, W;
	cin >> H >> W;
	int N;
	cin >> N;

	vector< vector<int> > data(H,vector<int>(W,0));

	int cnt = 0;
	for (int i = 0; i < N; i++) {
		int a;
		cin >> a;
		for (int j = 0; j < a; j++) {
			data[cnt/W][cnt%W] = a;
			cnt++;
		}
	}

	for (int i = 0; i < H; i++) {
		if (i % 2 == 0) {
			for (int j = 0; j < W; j++) {
				if (j != 0)
					cout << " " << data[i][j];
				else
					cout << data[i][j];
			}
		}
		else {
			for (int j = W-1; j >= 0; j--) {
				if (j != W-1)
					cout << " " << data[i][j];
				else
					cout << data[i][j];
			}
		}
		cout << endl;
	}
	

	





	return 0;
}
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cctype>
#include<string>
#include<algorithm>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <utility> 
using namespace std;

using ll = long long;





int main()
{
	int H, W;
	cin >> H >> W;
	int N;
	cin >> N;

	vector< vector<int> > data(H,vector<int>(W,0));

	int cnt = 0;
	for (int i = 0; i < N; i++) {
		int a;
		cin >> a;
		for (int j = 0; j < a; j++) {
			data[cnt/W][cnt%W] = a;
			cnt++;
		}
	}

	for (int i = 0; i < H; i++) {
		if (i % 2 == 0) {
			for (int j = 0; j < W; j++) {
				if (j != 0)
					cout << " " << data[i][j];
				else
					cout << data[i][j];
			}
		}
		else {
			for (int j = W-1; j >= 0; j--) {
				if (j != W-1)
					cout << " " << data[i][j];
				else
					cout << data[i][j];
			}
		}
		cout << endl;
	}
	

	





	return 0;
}
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cctype>
#include<string>
#include<algorithm>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <utility> 
using namespace std;

using ll = long long;





int main()
{
	int H, W;
	cin >> H >> W;
	int N;
	cin >> N;

	vector< vector<int> > data(H,vector<int>(W,0));

	int cnt = 0;
	for (int i = 0; i < N; i++) {
		int a;
		cin >> a;
		for (int j = 0; j < a; j++) {
			data[cnt/W][cnt%W] = a;
			cnt++;
		}
	}

	for (int i = 0; i < H; i++) {
		if (i % 2 == 0) {
			for (int j = 0; j < W; j++) {
				if (j != 0)
					cout << " " << data[i][j];
				else
					cout << data[i][j];
			}
		}
		else {
			for (int j = W-1; j >= 0; j--) {
				if (j != W-1)
					cout << " " << data[i][j];
				else
					cout << data[i][j];
			}
		}
		cout << endl;
	}
	

	





	return 0;
}
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cctype>
#include<string>
#include<algorithm>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <utility> 
using namespace std;

using ll = long long;





int main()
{
	int H, W;
	cin >> H >> W;
	int N;
	cin >> N;

	vector< vector<int> > data(H,vector<int>(W,0));

	int cnt = 0;
	for (int i = 0; i < N; i++) {
		int a;
		cin >> a;
		for (int j = 0; j < a; j++) {
			data[cnt/W][cnt%W] = i+1;
			cnt++;
		}
	}

	for (int i = 0; i < H; i++) {
		if (i % 2 == 0) {
			for (int j = 0; j < W; j++) {
				if (j != 0)
					cout << " " << data[i][j];
				else
					cout << data[i][j];
			}
		}
		else {
			for (int j = W-1; j >= 0; j--) {
				if (j != W-1)
					cout << " " << data[i][j];
				else
					cout << data[i][j];
			}
		}
		cout << endl;
	}
	

	





	return 0;
}


Compiler output:
a.cc:87:5: error: redefinition of 'int main()'
   87 | int main()
      |     ^~~~
a.cc:20:5: note: 'int main()' previously defined here
   20 | int main()
      |     ^~~~
a.cc:154:5: error: redefinition of 'int main()'
  154 | int main()
      |     ^~~~
a.cc:20:5: note: 'int main()' previously defined here
   20 | int main()
      |     ^~~~
a.cc:221:5: error: redefinition of 'int main()'
  221 | int main()
      |     ^~~~
a.cc:20:5: note: 'int main()' previously defined here
   20 | int main()
      |     ^~~~