Language: C++

using System;
class Program
{
static int mainVertex;
static int[] howlong = new int[n];//頂点kからの距離
static int n;

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