Language: C++

using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;class Program
{
	static void Main(string[] args)
	{
        var exStdIn = new System.IO.StreamReader( "stdin.txt" );System.Console.SetIn( exStdIn );
		
		
		var kxd = Console.ReadLine().Split().Select(long.Parse).ToArray();
		long x = kxd[0], k = kxd[1], d = kxd[2];
		x = Abs(x);

		if(k<=x/d){
			Console.WriteLine(x-k*d);
			return;
		}
		k-=x/d;
		x = x%d;
		if(k%2==0)Console.WriteLine(x);
		else Console.WriteLine(d-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.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.IO;
      |       ^~~~~~
a.cc:6:7: error: expected nested-name-specifier before 'System'
    6 | using System.Linq;
      |       ^~~~~~
a.cc:7:7: error: expected nested-name-specifier before 'System'
    7 | using System.Numerics;
      |       ^~~~~~
a.cc:8:7: error: expected nested-name-specifier before 'System'
    8 | using System.Text;
      |       ^~~~~~
a.cc:9:7: error: expected nested-name-specifier before 'System'
    9 | using System.Text.RegularExpressions;
      |       ^~~~~~
a.cc:10:7: error: expected nested-name-specifier before 'System'
   10 | using System.Threading.Tasks;
      |       ^~~~~~
a.cc:11:7: error: expected nested-name-specifier before 'static'
   11 | using static System.Math;class Program
      |       ^~~~~~
a.cc:13:26: error: 'string' has not been declared
   13 |         static void Main(string[] args)
      |                          ^~~~~~
a.cc:13:35: error: expected ',' or '...' before 'args'
   13 |         static void Main(string[] args)
      |                                   ^~~~
a.cc:31:2: error: expected ';' after class definition
   31 | }
      |  ^
      |  ;
a.cc: In static member function 'static void Program::Main(int*)':
a.cc:15:9: error: 'var' was not declared in this scope
   15 |         var exStdIn = new System.IO.StreamReader( "stdin.txt" );System.Console.SetIn( exStdIn );
      |         ^~~
a.cc:15:65: error: 'System' was not declared in this scope
   15 |         var exStdIn = new System.IO.StreamReader( "stdin.txt" );System.Console.SetIn( exStdIn );
      |                                                                 ^~~~~~
a.cc:15:87: error: 'exStdIn' was not declared in this scope
   15 |         var exStdIn = new System.IO.StreamReader( "stdin.txt" );System.Console.SetIn( exStdIn );
      |                                                                                       ^~~~~~~
a.cc:18:21: error: expected ';' before 'kxd'
   18 |                 var kxd = Console.ReadLine().Split().Select(long.Parse).ToArray();
      |                     ^~~
a.cc:19:26: error: 'kxd' was not declared in this scope
   19 |                 long x = kxd[0], k = kxd[1], d = kxd[2];
      |                          ^~~
a.cc:20:21: error: 'Abs' was not declared in this scope
   20 |                 x = Abs(x);
      |                     ^~~
a.cc:22:20: error: 'k' was not declared in this scope
   22 |                 if(k<=x/d){
      |                    ^
a.cc:22:25: error: 'd' was not declared in this scope
   22 |                 if(k<=x/d){
      |                         ^
a.cc:23:25: error: 'Console' was not declared in this scope
   23 |                         Console.WriteLine(x-k*d);
      |                         ^~~~~~~
a.cc:26:17: error: 'k' was not declared in this scope
   26 |                 k-=x/d;
      |                 ^
a.cc:26:22: error: 'd' was not declared in this scope
   26 |                 k-=x/d;
      |                      ^
a.cc:28:27: error: 'Console' was not declared in this scope
   28 |                 if(k%2==0)Console.WriteLine(x);
      |                           ^~~~~~~
a.cc:29:22: error: 'Console' was not declared in this scope
   29 |                 else Console.WriteLine(d-x);
      |                      ^~~~~~~