Language: C++

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