Language: C++

using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;

using System.Linq;
using System.Text.RegularExpressions;
using System.Diagnostics;
using System.Threading; 


class Program
{
	public const int Inf = 1 << 29;
	private static int[,] dp = new int[100,100];
	private static int[,] arrayList = new int[100,100];
	private static int cnt = 0;
	static void Main()
	{
		
		int now = 0;
		string line;
		for (int i = 0; i < 100; ++i) {
			for (int j = 0; j < 100; j++) {
				dp[i, j] = -1;
				arrayList[i, j] = -1;
			}
		}
		while (!string.IsNullOrEmpty(line = Console.ReadLine())) {
			string[] s = line.Split(',');
			
			for (int i = 0; i < s.Length; i++)
			{
				arrayList[cnt, i] = int.Parse(s[i]);
			}
			cnt++;
		}
		
		Console.WriteLine(solve(0, 0));
	}

	static int solve(int a, int b)
	{

		if (cnt == a)
		{
			return 0;
		}
		if (b < 0 || arrayList[a,b] == -1)
		{
			return 0;
		}
		if (dp[a,b] >= 0)
		{
			return dp[a,b];
		}
		int res = 0;
		if (cnt / 2 >= a)
		{
			res = Math.Max(solve(a + 1, b) + arrayList[a,b], solve(a + 1, b + 1) + arrayList[a,b]);
		}
		else
		{
			res = Math.Max(solve(a + 1, b) + arrayList[a,b], solve(a + 1, b - 1) + arrayList[a,b]);
		}
		return dp[a,b] = res;
	}
}

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.Text;
      |       ^~~~~~
a.cc:3:7: error: expected nested-name-specifier before 'System'
    3 | using System.Collections;
      |       ^~~~~~
a.cc:4:7: error: expected nested-name-specifier before 'System'
    4 | using System.Collections.Generic;
      |       ^~~~~~
a.cc:6:7: error: expected nested-name-specifier before 'System'
    6 | using System.Linq;
      |       ^~~~~~
a.cc:7:7: error: expected nested-name-specifier before 'System'
    7 | using System.Text.RegularExpressions;
      |       ^~~~~~
a.cc:8:7: error: expected nested-name-specifier before 'System'
    8 | using System.Diagnostics;
      |       ^~~~~~
a.cc:9:7: error: expected nested-name-specifier before 'System'
    9 | using System.Threading;
      |       ^~~~~~
a.cc:14:15: error: expected ':' before 'const'
   14 |         public const int Inf = 1 << 29;
      |               ^~~~~~
      |               :
a.cc:15:16: error: expected ':' before 'static'
   15 |         private static int[,] dp = new int[100,100];
      |                ^~~~~~~
      |                :
a.cc:15:27: error: expected unqualified-id before '[' token
   15 |         private static int[,] dp = new int[100,100];
      |                           ^
a.cc:16:16: error: expected ':' before 'static'
   16 |         private static int[,] arrayList = new int[100,100];
      |                ^~~~~~~
      |                :
a.cc:16:27: error: expected unqualified-id before '[' token
   16 |         private static int[,] arrayList = new int[100,100];
      |                           ^
a.cc:17:16: error: expected ':' before 'static'
   17 |         private static int cnt = 0;
      |                ^~~~~~~
      |                :
a.cc:17:28: error: ISO C++ forbids in-class initialization of non-const static member 'Program::cnt'
   17 |         private static int cnt = 0;
      |                            ^~~
a.cc:68:2: error: expected ';' after class definition
   68 | }
      |  ^
      |  ;
a.cc: In static member function 'static void Program::Main()':
a.cc:22:17: error: 'string' was not declared in this scope
   22 |                 string line;
      |                 ^~~~~~
a.cc:25:33: error: 'dp' was not declared in this scope
   25 |                                 dp[i, j] = -1;
      |                                 ^~
a.cc:26:33: error: 'arrayList' was not declared in this scope
   26 |                                 arrayList[i, j] = -1;
      |                                 ^~~~~~~~~
a.cc:29:46: error: 'line' was not declared in this scope
   29 |                 while (!string.IsNullOrEmpty(line = Console.ReadLine())) {
      |                                              ^~~~
a.cc:29:53: error: 'Console' was not declared in this scope
   29 |                 while (!string.IsNullOrEmpty(line = Console.ReadLine())) {
      |                                                     ^~~~~~~
a.cc:30:32: error: expected primary-expression before ']' token
   30 |                         string[] s = line.Split(',');
      |                                ^
a.cc:32:45: error: 's' was not declared in this scope
   32 |                         for (int i = 0; i < s.Length; i++)
      |                                             ^
a.cc:34:33: error: 'arrayList' was not declared in this scope
   34 |                                 arrayList[cnt, i] = int.Parse(s[i]);
      |                                 ^~~~~~~~~
a.cc:34:53: error: expected primary-expression before 'int'
   34 |                                 arrayList[cnt, i] = int.Parse(s[i]);
      |                                                     ^~~
a.cc:39:17: error: 'Console' was not declared in this scope
   39 |                 Console.WriteLine(solve(0, 0));
      |                 ^~~~~~~
a.cc: In static member function 'static int Program::solve(int, int)':
a.cc:49:30: error: 'arrayList' was not declared in this scope
   49 |                 if (b < 0 || arrayList[a,b] == -1)
      |                              ^~~~~~~~~
a.cc:53:21: error: 'dp' was not declared in this scope
   53 |                 if (dp[a,b] >= 0)
      |                     ^~
a.cc:60:31: error: 'Math' was not declared in this scope
   60 |                         res = Math.Max(solve(a + 1, b) + arrayList[a,b], solve(a + 1, b + 1) + arrayList[a,b]);
      |                               ^~~~
a.cc:60:58: error: 'arrayList' was not declared in this scope
   60 |                         res = Math.Max(solve(a + 1, b) + arrayList[a,b], solve(a + 1, b + 1) + arrayList[a,b]);
      |                                                          ^~~~~~~~~
a.cc:64:31: error: 'Math' was not declared in this scope
   64 |                         res = Math.Max(solve(a + 1, b) + arrayList[a,b], solve(a + 1, b - 1) + arrayList[a,b]);
      |                               ^~~~
a.cc:64:58: error: 'arrayList' was not declared in this scope
   64 |                         res = Math.Max(solve(a + 1, b) + arrayList[a,b], solve(a + 1, b - 1) + arrayList[a,b]);
      |                                                          ^~~~~~~~~
a.cc:66:24: error: 'dp' was not declared in this scope
   66 |                 return dp[a,b] = res;
      |                        ^~