Language: C++

using System;
class Program
{
static int mainVertex;
static int[] howlong = new int[n];//頂点kからの距離
for(int i = 0; i < n; i++) howlong[i] = -1;
int n = int.Parse(Console.ReadLine());//int.Parseは文字列を整数に変換。
for(int i = 0; i < n; i++) static List<int[]> nextList[i] = new List<int[]>();//隣接リスト

	static void Main()
	{
    for(int i = 0; i < n; i++)
    {
    int[] nums = Array.ConvertAll(Console.ReadLine().Split(' '),int.Parse);//１行ごとに受け取る
    int[] numsSub = new int[2]{nums[1]-1, nums[2]};
    int[] numsSubB = new int[2]{nums[0]-1, nums[2]};
    nextList[nums[0]-1].Add(numsSub);//隣接リストへ追加。第2成分は距離。
    nextList[nums[1]-1].Add(numsSubB);
    }

    string[] inputSub = Console.ReadLine().Split(' ');
	  int q = int.Parse(inputSub[0]);
	  k = int.Parse(inputSub[1]);
    k--;
    mainVertex = k;
    howlong[k] = 0;
    Length(k,0);//頂点kの、頂点kからの距離は０
    for(int i = 0; i < q; i++)
    {
    string[] input = Console.ReadLine().Split(' ');//Splitで区切り文字を指定して複数個受け取る。
    int xx = int.Parse(input[0]);
    int yy = int.Parse(input[1]);
      Console.WriteLine(xx+yy);
    }
	
	Console.WriteLine((a+b+c) + " " + s);//WriteLineをWriteとすると、改行なしで出力。
	}

  static void Length(int vertexNum, int length)//頂点番号と、頂点kからの距離
  {
    for(int i = 0; i < nextList[vertexNum].Count(); i++)
    {
      int x = howlong[nextList[vertexNum][i][0]];
      int y = nextList[vertexNum][i][1];
      if(x != -1)
      {
        x = y + length;
        Length(nextList[vertexNum][i],x);
      }
    }
  }
  
}

Compiler output:
a.cc:1:7: error: expected nested-name-specifier before 'System'
    1 | using System;
      |       ^~~~~~
a.cc:5:11: error: expected unqualified-id before '[' token
    5 | static int[] howlong = new int[n];//頂点kからの距離
      |           ^
a.cc:6:1: error: expected unqualified-id before 'for'
    6 | for(int i = 0; i < n; i++) howlong[i] = -1;
      | ^~~
a.cc:6:16: error: 'i' does not name a type
    6 | for(int i = 0; i < n; i++) howlong[i] = -1;
      |                ^
a.cc:6:23: error: 'i' does not name a type
    6 | for(int i = 0; i < n; i++) howlong[i] = -1;
      |                       ^
a.cc:8:1: error: expected unqualified-id before 'for'
    8 | for(int i = 0; i < n; i++) static List<int[]> nextList[i] = new List<int[]>();//隣接リスト
      | ^~~
a.cc:8:16: error: 'i' does not name a type
    8 | for(int i = 0; i < n; i++) static List<int[]> nextList[i] = new List<int[]>();//隣接リスト
      |                ^
a.cc:8:23: error: 'i' does not name a type
    8 | for(int i = 0; i < n; i++) static List<int[]> nextList[i] = new List<int[]>();//隣接リスト
      |                       ^
a.cc:53:2: error: expected ';' after class definition
   53 | }
      |  ^
      |  ;
a.cc:7:9: error: expected primary-expression before 'int'
    7 | int n = int.Parse(Console.ReadLine());//int.Parseは文字列を整数に変換。
      |         ^~~
a.cc: In static member function 'static void Program::Main()':
a.cc:12:24: error: invalid use of member 'Program::n' in static member function
   12 |     for(int i = 0; i < n; i++)
      |                        ^
a.cc:7:5: note: declared here
    7 | int n = int.Parse(Console.ReadLine());//int.Parseは文字列を整数に変換。
      |     ^
a.cc:14:8: error: structured binding declaration cannot have type 'int'
   14 |     int[] nums = Array.ConvertAll(Console.ReadLine().Split(' '),int.Parse);//１行ごとに受け取る
      |        ^~
a.cc:14:8: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:14:8: error: empty structured binding declaration
a.cc:14:11: error: expected initializer before 'nums'
   14 |     int[] nums = Array.ConvertAll(Console.ReadLine().Split(' '),int.Parse);//１行ごとに受け取る
      |           ^~~~
a.cc:15:8: error: structured binding declaration cannot have type 'int'
   15 |     int[] numsSub = new int[2]{nums[1]-1, nums[2]};
      |        ^~
a.cc:15:8: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:15:8: error: empty structured binding declaration
a.cc:15:11: error: expected initializer before 'numsSub'
   15 |     int[] numsSub = new int[2]{nums[1]-1, nums[2]};
      |           ^~~~~~~
a.cc:16:8: error: structured binding declaration cannot have type 'int'
   16 |     int[] numsSubB = new int[2]{nums[0]-1, nums[2]};
      |        ^~
a.cc:16:8: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:16:8: error: empty structured binding declaration
a.cc:16:11: error: expected initializer before 'numsSubB'
   16 |     int[] numsSubB = new int[2]{nums[0]-1, nums[2]};
      |           ^~~~~~~~
a.cc:17:5: error: 'nextList' was not declared in this scope
   17 |     nextList[nums[0]-1].Add(numsSub);//隣接リストへ追加。第2成分は距離。
      |     ^~~~~~~~
a.cc:17:14: error: 'nums' was not declared in this scope
   17 |     nextList[nums[0]-1].Add(numsSub);//隣接リストへ追加。第2成分は距離。
      |              ^~~~
a.cc:17:29: error: 'numsSub' was not declared in this scope
   17 |     nextList[nums[0]-1].Add(numsSub);//隣接リストへ追加。第2成分は距離。
      |                             ^~~~~~~
a.cc:18:29: error: 'numsSubB' was not declared in this scope
   18 |     nextList[nums[1]-1].Add(numsSubB);
      |                             ^~~~~~~~
a.cc:21:5: error: 'string' was not declared in this scope
   21 |     string[] inputSub = Console.ReadLine().Split(' ');
      |     ^~~~~~
a.cc:21:12: error: expected primary-expression before ']' token
   21 |     string[] inputSub = Console.ReadLine().Split(' ');
      |            ^
a.cc:22:19: error: expected primary-expression before 'int'
   22 |           int q = int.Parse(inputSub[0]);
      |                   ^~~
a.cc:23:11: error: 'k' was not declared in this scope
   23 |           k = int.Parse(inputSub[1]);
      |           ^
a.cc:23:15: error: expected primary-expression before 'int'
   23 |           k = int.Parse(inputSub[1]);
      |               ^~~
a.cc:26:5: error: 'howlong' was not declared in this scope; did you mean 'long'?
   26 |     howlong[k] = 0;
      |     ^~~~~~~
      |     long
a.cc:30:12: error: expected primary-expression before ']' token
   30 |     string[] input = Console.ReadLine().Split(' ');//Splitで区切り文字を指定して複数個受け取る。
      |            ^
a.cc:31:14: error: expected primary-expression before 'int'
   31 |     int xx = int.Parse(input[0]);
      |              ^~~
a.cc:32:14: error: expected primary-expression before 'int'
   32 |     int yy = int.Parse(input[1]);
      |              ^~~
a.cc:33:7: error: 'Console' was not declared in this scope
   33 |       Console.WriteLine(xx+yy);
      |       ^~~~~~~
a.cc:36:9: error: 'Console' was not declared in this scope
   36 |         Console.WriteLine((a+b+c) + " " + s);//WriteLineをWriteとすると、改行なしで出力。
      |         ^~~~~~~
a.cc:36:28: error: 'a' was not declared in this scope
   36 |         Console.WriteLine((a+b+c) + " " + s);//WriteLineをWriteとすると、改行なしで出力。
      |                            ^
a.cc:36:30: error: 'b' was not declared in this scope
   36 |         Console.WriteLine((a+b+c) + " " + s);//WriteLineをWriteとすると、改行なしで出力。
      |                              ^
a.cc:36:32: error: 'c' was not declared in this scope
   36 |         Console.WriteLine((a+b+c) + " " + s);//WriteLineをWriteとすると、改行なしで出力。
      |                                ^
a.cc:36:43: error: 's' was not declared in this scope
   36 |         Console.WriteLine((a+b+c) + " " + s);//WriteLineをWriteとすると、改行なしで出力。
      |                                           ^
a.cc: In static member function 'static void Program::Length(int, int)':
a.cc:41:24: error: 'nextList' was not declared in this scope
   41 |     for(int i = 0; i < nextList[vertexNum].Count(); i++)
      |                        ^~~~~~~~
a.cc:43:15: error: 'howlong' was not declared in this scope; did you mean 'long'?
   43 |       int x = howlong[nextList[vertexNum][i][0]];
      |               ^~~~~~~
      |               long