Language: C++

using System;

public class Program
{

    public void Solve()
    {
        var sc = new Scanner();
        int n = sc.NextInt();
        if (n % 2 == 0)
        {
            Console.WriteLine("0.5");
        }
        else
        {
            double even = (double) (n / 2) / n;
            Console.WriteLine((double)1-even);
        }
    }

    public static void Main(string[] args)
    {
        new Program().Solve();
    }
}

class Scanner
{
    public Scanner()
    {
        _pos = 0;
        _line = new string[0];
    }

    const char Separator = ' ';
    private int _pos;
    private string[] _line;

    #region スペース区切りで取得

    public string Next()
    {
        if (_pos >= _line.Length)
        {
            _line = Console.ReadLine().Split(Separator);
            _pos = 0;
        }

        return _line[_pos++];
    }

    public int NextInt()
    {
        return int.Parse(Next());
    }

    public long NextLong()
    {
        return long.Parse(Next());
    }

    public double NextDouble()
    {
        return double.Parse(Next());
    }

    #endregion

    #region 型変換

    private int[] ToIntArray(string[] array)
    {
        var result = new int[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = int.Parse(array[i]);
        }

        return result;
    }

    private long[] ToLongArray(string[] array)
    {
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = long.Parse(array[i]);
        }

        return result;
    }

    private double[] ToDoubleArray(string[] array)
    {
        var result = new double[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = double.Parse(array[i]);
        }

        return result;
    }

    #endregion

    #region 配列取得

    public string[] Array()
    {
        if (_pos >= _line.Length)
            _line = Console.ReadLine().Split(Separator);

        _pos = _line.Length;
        return _line;
    }

    public int[] IntArray()
    {
        return ToIntArray(Array());
    }

    public long[] LongArray()
    {
        return ToLongArray(Array());
    }

    public double[] DoubleArray()
    {
        return ToDoubleArray(Array());
    }

    #endregion
}

Compiler output:
a.cc:39:6: error: invalid preprocessing directive #region
   39 |     #region スペース区切りで取得
      |      ^~~~~~
a.cc:67:6: error: invalid preprocessing directive #endregion
   67 |     #endregion
      |      ^~~~~~~~~
a.cc:69:6: error: invalid preprocessing directive #region
   69 |     #region 型変換
      |      ^~~~~~
a.cc:104:6: error: invalid preprocessing directive #endregion
  104 |     #endregion
      |      ^~~~~~~~~
a.cc:106:6: error: invalid preprocessing directive #region
  106 |     #region 配列取得
      |      ^~~~~~
a.cc:132:6: error: invalid preprocessing directive #endregion
  132 |     #endregion
      |      ^~~~~~~~~
a.cc:1:7: error: expected nested-name-specifier before 'System'
    1 | using System;
      |       ^~~~~~
a.cc:3:1: error: expected unqualified-id before 'public'
    3 | public class Program
      | ^~~~~~
a.cc:29:11: error: expected ':' before 'Scanner'
   29 |     public Scanner()
      |           ^~~~~~~~
      |           :
a.cc:36:12: error: expected ':' before 'int'
   36 |     private int _pos;
      |            ^~~~
      |            :
a.cc:37:12: error: expected ':' before 'string'
   37 |     private string[] _line;
      |            ^~~~~~~
      |            :
a.cc:37:13: error: 'string' does not name a type
   37 |     private string[] _line;
      |             ^~~~~~
a.cc:41:11: error: expected ':' before 'string'
   41 |     public string Next()
      |           ^~~~~~~
      |           :
a.cc:41:12: error: 'string' does not name a type
   41 |     public string Next()
      |            ^~~~~~
a.cc:52:11: error: expected ':' before 'int'
   52 |     public int NextInt()
      |           ^~~~
      |           :
a.cc:57:11: error: expected ':' before 'long'
   57 |     public long NextLong()
      |           ^~~~~
      |           :
a.cc:62:11: error: expected ':' before 'double'
   62 |     public double NextDouble()
      |           ^~~~~~~
      |           :
a.cc:71:12: error: expected ':' before 'int'
   71 |     private int[] ToIntArray(string[] array)
      |            ^~~~
      |            :
a.cc:71:16: error: expected unqualified-id before '[' token
   71 |     private int[] ToIntArray(string[] array)
      |                ^
a.cc:82:12: error: expected ':' before 'long'
   82 |     private long[] ToLongArray(string[] array)
      |            ^~~~~
      |            :
a.cc:82:17: error: expected unqualified-id before '[' token
   82 |     private long[] ToLongArray(string[] array)
      |                 ^
a.cc:93:12: error: expected ':' before 'double'
   93 |     private double[] ToDoubleArray(string[] array)
      |            ^~~~~~~
      |            :
a.cc:93:19: error: expected unqualified-id before '[' token
   93 |     private double[] ToDoubleArray(string[] array)
      |                   ^
a.cc:108:11: error: expected ':' before 'string'
  108 |     public string[] Array()
      |           ^~~~~~~
      |           :
a.cc:108:12: error: 'string' does not name a type
  108 |     public string[] Array()
      |            ^~~~~~
a.cc:117:11: error: expected ':' before 'int'
  117 |     public int[] IntArray()
      |           ^~~~
      |           :
a.cc:117:15: error: expected unqualified-id before '[' token
  117 |     public int[] IntArray()
      |               ^
a.cc:122:11: error: expected ':' before 'long'
  122 |     public long[] LongArray()
      |           ^~~~~
      |           :
a.cc:122:16: error: expected unqualified-id before '[' token
  122 |     public long[] LongArray()
      |                ^
a.cc:127:11: error: expected ':' before 'double'
  127 |     public double[] DoubleArray()
      |           ^~~~~~~
      |           :
a.cc:127:18: error: expected unqualified-id before '[' token
  127 |     public double[] DoubleArray()
      |                  ^
a.cc:133:2: error: expected ';' after class definition
  133 | }
      |  ^
      |  ;
a.cc: In constructor 'Scanner::Scanner()':
a.cc:32:9: error: '_line' was not declared in this scope; did you mean 'inline'?
   32 |         _line = new string[0];
      |         ^~~~~
      |         inline
a.cc:32:21: error: 'string' does not name a type
   32 |         _line = new string[0];
      |                     ^~~~~~
a.cc: In member function 'int Scanner::NextInt()':
a.cc:54:16: error: expected primary-expression before 'int'
   54 |         return int.Parse(Next());
      |                ^~~
a.cc:54:16: error: expected ';' before 'int'
a.cc:54:19: error: expected unqualified-id before '.' token
   54 |         return int.Parse(Next());
      |                   ^
a.cc: In member function 'long int Scanner::NextLong()':
a.cc:59:16: error: expected primary-expression before 'long'
   59 |         return long.Parse(Next());
      |                ^~~~
a.cc:59:16: error: expected ';' before 'long'
a.cc:59:20: error: expected unqualified-id before '.' token
   59 |         return long.Parse(Next());
      |                    ^
a.cc: In member function 'double Scanner::NextDouble()':
a.cc:64:16: error: expected primary-expression before 'double'
   64 |         return double.Parse(Next());
      |                ^~~~~~
a.cc:64:16: error: expected ';' before 'double'
a.cc:64:22: error: expected unqualified-id before '.' token
   64 |         return double.Parse(Next());
      |                      ^