Language: C++

using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Numerics;

namespace PriorityQueue
{
    class Program
    {
        static bool ok(string s, int k, BigInteger maxi)
        {
            BigInteger sum = 0;
            foreach (char c in s)
            {
                int x = c - '0';
                sum = sum * 10 + x;
                if (sum > maxi)
                {
                    sum = x;
                    k--;
                }
            }
            return k >= 0 && sum <= maxi;
        }


        static void Main()
        {
            int k = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();
            BigInteger left = -1, right = BigInteger.Parse(s);
            while (left + 1 < right)
            {
                var mid = (left + right) / 2;
                if (ok(s, k, mid)) right = mid;
                else left = mid;
            }
            Console.WriteLine(right);
            Console.ReadKey();
        }
    }
}


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.Collections;
      |       ^~~~~~
a.cc:3:7: error: expected nested-name-specifier before 'System'
    3 | using System.Collections.Generic;
      |       ^~~~~~
a.cc:4:7: error: expected nested-name-specifier before 'System'
    4 | using System.Diagnostics;
      |       ^~~~~~
a.cc:5:7: error: expected nested-name-specifier before 'System'
    5 | using System.Linq;
      |       ^~~~~~
a.cc:6:7: error: expected nested-name-specifier before 'System'
    6 | using System.Text;
      |       ^~~~~~
a.cc:7:7: error: expected nested-name-specifier before 'System'
    7 | using System.Threading.Tasks;
      |       ^~~~~~
a.cc:8:7: error: expected nested-name-specifier before 'System'
    8 | using System.Numerics;
      |       ^~~~~~
a.cc:14:24: error: 'string' has not been declared
   14 |         static bool ok(string s, int k, BigInteger maxi)
      |                        ^~~~~~
a.cc:14:41: error: 'BigInteger' has not been declared
   14 |         static bool ok(string s, int k, BigInteger maxi)
      |                                         ^~~~~~~~~~
a.cc:45:6: error: expected ';' after class definition
   45 |     }
      |      ^
      |      ;
a.cc: In static member function 'static bool PriorityQueue::Program::ok(int, int, int)':
a.cc:16:13: error: 'BigInteger' was not declared in this scope
   16 |             BigInteger sum = 0;
      |             ^~~~~~~~~~
a.cc:17:22: error: expected primary-expression before 'char'
   17 |             foreach (char c in s)
      |                      ^~~~
a.cc:17:13: error: 'foreach' was not declared in this scope
   17 |             foreach (char c in s)
      |             ^~~~~~~
a.cc:27:30: error: 'sum' was not declared in this scope
   27 |             return k >= 0 && sum <= maxi;
      |                              ^~~
a.cc: In static member function 'static void PriorityQueue::Program::Main()':
a.cc:33:21: error: expected primary-expression before 'int'
   33 |             int k = int.Parse(Console.ReadLine());
      |                     ^~~
a.cc:34:13: error: 'string' was not declared in this scope
   34 |             string s = Console.ReadLine();
      |             ^~~~~~
a.cc:35:13: error: 'BigInteger' was not declared in this scope
   35 |             BigInteger left = -1, right = BigInteger.Parse(s);
      |             ^~~~~~~~~~
a.cc:36:20: error: 'left' was not declared in this scope
   36 |             while (left + 1 < right)
      |                    ^~~~
a.cc:36:31: error: 'right' was not declared in this scope
   36 |             while (left + 1 < right)
      |                               ^~~~~
a.cc:38:17: error: 'var' was not declared in this scope
   38 |                 var mid = (left + right) / 2;
      |                 ^~~
a.cc:39:24: error: 's' was not declared in this scope
   39 |                 if (ok(s, k, mid)) right = mid;
      |                        ^
a.cc:39:30: error: 'mid' was not declared in this scope
   39 |                 if (ok(s, k, mid)) right = mid;
      |                              ^~~
a.cc:42:13: error: 'Console' was not declared in this scope
   42 |             Console.WriteLine(right);
      |             ^~~~~~~
a.cc:42:31: error: 'right' was not declared in this scope
   42 |             Console.WriteLine(right);
      |                               ^~~~~