Language: C++

using System;
using System.Linq;

namespace CSharp
{
    static class Program
    {
        static void Main(string[] args)
        {
            int n, y;
            ReadInt(out n, out y);

            var answers = from i in Enumerable.Range(0, y / 10000 + 1)
                          from j in Enumerable.Range(0, (y - 10000 * i) / 5000 + 1)
                          let k = (y - 10000 * i - 5000 * j) / 1000
                          where k >= 0
                          where i + j + k == n
                          select new { i, j, k };

            var ans = answers.FirstOrDefault();
            if (ans == null)
            {
                Console.WriteLine("-1 -1 -1");
            }
            else
            {
                Console.WriteLine($"{ans.i} {ans.j} {ans.k}");
            }
        }

        #region Helpers

        static int[] ReadIntArray() => Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        static long[] ReadLongArray() => Console.ReadLine().Split().Select(s => long.Parse(s)).ToArray();

        static int[] ReadLineIntArray(int count) => Enumerable.Repeat(0, count).Select(_ => int.Parse(Console.ReadLine())).ToArray();
        static long[] ReadLineLongArray(int count) => Enumerable.Repeat(0, count).Select(_ => long.Parse(Console.ReadLine())).ToArray();

        static string ReadString() => Console.ReadLine();
        static int ReadInt() => int.Parse(Console.ReadLine());
        static long ReadLong() => long.Parse(Console.ReadLine());

        static void ReadInt(out int first)
        {
            var array = ReadIntArray();
            first = array[0];
        }

        static void ReadInt(out int first, out int second)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
        }

        static void ReadInt(out int first, out int second, out int third)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
            third = array[2];
        }

        static void ReadInt(out int first, out int second, out int third, out int fourth)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
            third = array[2];
            fourth = array[3];
        }

        static void ReadLong(out long first)
        {
            var array = ReadLongArray();
            first = array[0];
        }

        static void ReadLong(out long first, out long second)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
        }

        static void ReadLong(out long first, out long second, out long third)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
            third = array[2];
        }

        static void ReadLong(out long first, out long second, out long third, out long fourth)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
            third = array[2];
            fourth = array[3];
        }

        #endregion
    }
}

Compiler output:
a.cc:31:10: error: invalid preprocessing directive #region
   31 |         #region Helpers
      |          ^~~~~~
a.cc:103:10: error: invalid preprocessing directive #endregion
  103 |         #endregion
      |          ^~~~~~~~~
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:8:26: error: 'string' has not been declared
    8 |         static void Main(string[] args)
      |                          ^~~~~~
a.cc:8:35: error: expected ',' or '...' before 'args'
    8 |         static void Main(string[] args)
      |                                   ^~~~
a.cc:33:19: error: expected unqualified-id before '[' token
   33 |         static int[] ReadIntArray() => Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();
      |                   ^
a.cc:34:20: error: expected unqualified-id before '[' token
   34 |         static long[] ReadLongArray() => Console.ReadLine().Split().Select(s => long.Parse(s)).ToArray();
      |                    ^
a.cc:36:19: error: expected unqualified-id before '[' token
   36 |         static int[] ReadLineIntArray(int count) => Enumerable.Repeat(0, count).Select(_ => int.Parse(Console.ReadLine())).ToArray();
      |                   ^
a.cc:37:20: error: expected unqualified-id before '[' token
   37 |         static long[] ReadLineLongArray(int count) => Enumerable.Repeat(0, count).Select(_ => long.Parse(Console.ReadLine())).ToArray();
      |                    ^
a.cc:39:16: error: 'string' does not name a type
   39 |         static string ReadString() => Console.ReadLine();
      |                ^~~~~~
a.cc:40:33: error: invalid pure specifier (only '= 0' is allowed) before 'int'
   40 |         static int ReadInt() => int.Parse(Console.ReadLine());
      |                                 ^~~
a.cc:40:20: error: initializer specified for static member function 'static int CSharp::Program::ReadInt()'
   40 |         static int ReadInt() => int.Parse(Console.ReadLine());
      |                    ^~~~~~~
a.cc:41:35: error: invalid pure specifier (only '= 0' is allowed) before 'long'
   41 |         static long ReadLong() => long.Parse(Console.ReadLine());
      |                                   ^~~~
a.cc:41:21: error: initializer specified for static member function 'static long int CSharp::Program::ReadLong()'
   41 |         static long ReadLong() => long.Parse(Console.ReadLine());
      |                     ^~~~~~~~
a.cc:43:29: error: 'out' has not been declared
   43 |         static void ReadInt(out int first)
      |                             ^~~
a.cc:43:29: error: two or more data types in declaration of 'first'
a.cc:49:29: error: 'out' has not been declared
   49 |         static void ReadInt(out int first, out int second)
      |                             ^~~
a.cc:49:29: error: two or more data types in declaration of 'first'
a.cc:49:42: error: expected ')' before ',' token
   49 |         static void ReadInt(out int first, out int second)
      |                            ~             ^
      |                                          )
a.cc:49:21: error: 'static void CSharp::Program::ReadInt(...)' cannot be overloaded with 'static void CSharp::Program::ReadInt(...)'
   49 |         static void ReadInt(out int first, out int second)
      |                     ^~~~~~~
a.cc:43:21: note: previous declaration 'static void CSharp::Program::ReadInt(...)'
   43 |         static void ReadInt(out int first)
      |                     ^~~~~~~
a.cc:49:44: error: variable or field 'out' declared void
   49 |         static void ReadInt(out int first, out int second)
      |                                            ^~~
a.cc:49:44: error: expected ';' at end of member declaration
   49 |         static void ReadInt(out int first, out int second)
      |                                            ^~~
      |                                               ;
a.cc:49:52: error: expected ';' at end of member declaration
   49 |         static void ReadInt(out int first, out int second)
      |                                                    ^~~~~~
      |                                                          ;
a.cc:49:58: error: expected unqualified-id before ')' token
   49 |         static void ReadInt(out int first, out int second)
      |                                                          ^
a.cc:56:29: error: 'out' has not been declared
   56 |         static void ReadInt(out int first, out int second, out int third)
      |                             ^~~
a.cc:56:29: error: two or more data types in declaration of 'first'
a.cc:56:42: error: expected ')' before ',' token
   56 |         static void ReadInt(out int first, out int second, out int third)
      |                            ~             ^
      |                                          )
a.cc:56:21: error: 'static void CSharp::Program::ReadInt(...)' cannot be overloaded with 'static void CSharp::Program::ReadInt(...)'
   56 |         static void ReadInt(out int first, out int second, out int third)
      |                     ^~~~~~~
a.cc:43:21: note: previous declaration 'static void CSharp::Program::ReadInt(...)'
   43 |         static void ReadInt(out int first)
      |                     ^~~~~~~
a.cc:56:44: error: variable or field 'out' declared void
   56 |         static void ReadInt(out int first, out int second, out int third)
      |                                            ^~~
a.cc:56:44: error: expected ';' at end of member declaration
   56 |         static void ReadInt(out int first, out int second, out int third)
      |                                            ^~~
      |                                               ;
a.cc:56:58: error: redeclaration of 'int CSharp::Program::second'
   56 |         static void ReadInt(out int first, out int second, out int third)
      |                                                          ^
a.cc:49:52: note: previous declaration 'int CSharp::Program::second'
   49 |         static void ReadInt(out int first, out int second)
      |                                                    ^~~~~~
a.cc:56:60: error: expected ';' at end of member declaration
   56 |         static void ReadInt(out int first, out int second, out int third)
      |                                                            ^~~
      |                                                               ;
a.cc:56:68: error: expected ';' at end of member declaration
   56 |         static void ReadInt(out int first, out int second, out int third)
      |                                                                    ^~~~~
      |                                                                         ;
a.cc:56:73: error: expected unqualified-id before ')' token
   56 |         static void ReadInt(out int first, out int second, out int third)
      |                                                                         ^
a.cc:64:29: error: 'out' is not a type
   64 |         static void ReadInt(out int first, out int second, out int third, out int fourth)
      |                             ^~~
a.cc:64:29: error: two or more data types in declaration of 'first'
a.cc:64:42: error: expected ')' before ',' token
   64 |         static void ReadInt(out int first, out int second, out int third, out int fourth)
      |                            ~             ^
      |                                          )
a.cc:64:21: error: 'static void CSharp::Program::ReadInt(...)' cannot be overloaded with 'static void CSharp::Program::ReadInt(...)'
   64 |         static void ReadInt(out int first, out int second, out int third, out int fourth)
      |                     ^~~~~~~
a.cc:43:21: note: previous declaration 'static void CSharp::Program::ReadInt(...)'
   43 |         static void ReadInt(out int first)
      |                     ^~~~~~~
a.cc:64:44: error: variable or field 'out' declared void
   64 |         static void ReadInt(out int first, out int second, out int third, out int fourth)
      |                                            ^~~
a.cc:64:44: error: expected ';' at end of member declaration
   64 |         static void ReadInt(out int first, out int second, out int third, out int fourth)
      |                                            ^~~
      |                                               ;
a.cc:64:58: error: redeclaration of 'int CSharp::Program::second'
   64 |         static void ReadInt(out int first, out int second, out int third, out int fourth)
      |                                                          ^
a.cc:49:52: note: previous declaration 'int CSharp::Program::second'
   49 |         static void ReadInt(out int first, out int second)
      |                                                    ^~~~~~
a.cc:64:60: error: expected ';' at end of member declaration
   64 |         static void ReadInt(out int first, out int second, out int third, out int fourth)
      |                                                            ^~~
      |                                                               ;
a.cc:64:60: error: redeclaration of 'int CSharp::Program::out'
a.cc:56:60: note: previous declaration 'int CSharp::Program::out'
   56 |         static void ReadInt(out int first, out int second, out int third)
      |                                                            ^~~
a.cc:64:73: error: redeclaration of 'int CSharp::Program::third'
   64 |         static void ReadInt(out int first, out int second, out int third, out int fourth)
      |                                                                         ^
a.cc:56:68: note: previous declaration 'int CSharp::Program::third'
   56 |         static void ReadInt(out int first, out int second, out int third)
      |                                                                    ^~~~~
a.cc:64:75: error: expected ';' at end of member declaration
   64 |         static void ReadInt(out int first, out int second, out int third, out int fourth)
      |                                                                           ^~~
      |