Language: C++

class Allocation
{
    public static void Main()
    {
        var line = System.Console.ReadLine();
        string[] inputInfo = line.Split(' ');
        int luggageCount = int.Parse(inputInfo[0]);
        int truckCount = int.Parse(inputInfo[1]);
        int[] luggageW8 = new int[luggageCount];

        int totalW8 = 0;
        for (int i = 0; i < luggageCount; ++i)
        {
            luggageW8[i] = int.Parse(System.Console.ReadLine());
            totalW8 += luggageW8[i];
        }

        int searchCapacity = (totalW8 + truckCount - 1) / truckCount; //?°???°????????????
        int needTruckCount = 0;
        for (; needTruckCount != truckCount; )
        {
            needTruckCount = 1;
            int restCapacity = searchCapacity;
            for (int index = 0; index < luggageCount; ++index)
            {
                restCapacity -= luggageW8[index];
                if (restCapacity < 0)
                {
                    restCapacity = searchCapacity;
                    restCapacity -= luggageW8[index];
                    ++needTruckCount;
                    if (needTruckCount > truckCount)
                    {
                        ++searchCapacity;
                        break;
                    }
                }
            }
        }
        System.Console.WriteLine(searchCapacity);
    }
}

Compiler output:
a.cc:3:11: error: expected ':' before 'static'
    3 |     public static void Main()
      |           ^~~~~~~
      |           :
a.cc:42:2: error: expected ';' after class definition
   42 | }
      |  ^
      |  ;
a.cc: In static member function 'static void Allocation::Main()':
a.cc:5:9: error: 'var' was not declared in this scope
    5 |         var line = System.Console.ReadLine();
      |         ^~~
a.cc:6:9: error: 'string' was not declared in this scope
    6 |         string[] inputInfo = line.Split(' ');
      |         ^~~~~~
a.cc:6:16: error: expected primary-expression before ']' token
    6 |         string[] inputInfo = line.Split(' ');
      |                ^
a.cc:7:28: error: expected primary-expression before 'int'
    7 |         int luggageCount = int.Parse(inputInfo[0]);
      |                            ^~~
a.cc:8:26: error: expected primary-expression before 'int'
    8 |         int truckCount = int.Parse(inputInfo[1]);
      |                          ^~~
a.cc:9:12: error: structured binding declaration cannot have type 'int'
    9 |         int[] luggageW8 = new int[luggageCount];
      |            ^~
a.cc:9:12: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:9:12: error: empty structured binding declaration
a.cc:9:15: error: expected initializer before 'luggageW8'
    9 |         int[] luggageW8 = new int[luggageCount];
      |               ^~~~~~~~~
a.cc:14:13: error: 'luggageW8' was not declared in this scope
   14 |             luggageW8[i] = int.Parse(System.Console.ReadLine());
      |             ^~~~~~~~~
a.cc:14:28: error: expected primary-expression before 'int'
   14 |             luggageW8[i] = int.Parse(System.Console.ReadLine());
      |                            ^~~
a.cc:26:33: error: 'luggageW8' was not declared in this scope
   26 |                 restCapacity -= luggageW8[index];
      |                                 ^~~~~~~~~
a.cc:40:9: error: 'System' was not declared in this scope
   40 |         System.Console.WriteLine(searchCapacity);
      |         ^~~~~~