Problem:
Difference of Big Integers

Given two integers $A$ and $B$, compute the difference, $A - B$.

Input

Two integers $A$ and $B$ separated by a space character are given in a line.

Output

Print the difference in a line.

Constraints

$-1 \times 10^{100000} \leq A, B \leq 10^{100000}$

Sample Input 1

5 8

Sample Output 1

-3

Sample Input 2

100 25

Sample Output 2

75

Sample Input 3

-1 -1

Sample Output 3

0

Sample Input 4

12 -3

Sample Output 4

15

Solution in C# (judge verdict: Accepted)

using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using SB = System.Text.StringBuilder;
//using System.Text.RegularExpressions;
//using System.Globalization;
//using System.Diagnostics;
using static System.Console;
using System.Numerics;
using static System.Math;
using pair = Pair<int, int>;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    readonly Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 }; //→↓←↑
    readonly int mod = 1000000007;
    readonly int dom = 998244353;
    bool chmax<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }
    bool chmin<T>(ref T a, T b) where T : IComparable<T> { if (b.CompareTo(a) < 0) { a = b; return true; } return false; }

    void solve()
    {
        var x = BigInt.Parse(cin.next);
        var y = BigInt.Parse(cin.next);
        WriteLine(x - y);
    }

}

/// <summary>
/// <see cref="BaseWidth"/> * <see cref="MaxDigit"/> 桁に対応する多倍長整数
/// </summary>
class BigInt
{
    const long Base = (long)1e18;
    const int BaseWidth = 18;
    const int MaxDigit = 100000;
    byte negative;
    long[] digit = new long[MaxDigit];
    int size;

    public static BigInt Parse(string S)
    {
        BigInt num = new BigInt
        {
            negative = S[0] == '-' ? (byte)1 : (byte)0
        };
        int i = (S.Length - num.negative) % BaseWidth;
        if (i > 0) i -= BaseWidth;
        i += num.negative;
        for (; i < S.Length; i += BaseWidth)
        {
            long ret = 0L;
            for (int j = 0; j < BaseWidth; j++)
            {
                ret = 10 * ret + (i + j >= num.negative ? S[i + j] - '0' : 0);
            }
            num.digit[num.size++] = ret;
        }
        Array.Reverse(num.digit, 0, num.size);
        return num;
    }
    static BigInt Add(BigInt x, BigInt y)
    {
        var ret = new BigInt { size = Max(x.size, y.size), negative = x.negative };
        byte gain = 0;
        for (int i = 0; i < ret.size; i++)
        {
            ret.digit[i] = x.digit[i] + y.digit[i] + gain;
            if (ret.digit[i] >= Base)
            {
                ret.digit[i] -= Base;
                gain = 1;
            }
            else
            {
                gain = 0;
            }
        }
        if (gain == 1)
        {
            ret.digit[ret.size++] = 1;
        }
        return ret;
    }
    /// <summary>
    /// x, yの絶対値の比較、差を求めたときのsize, negative
    /// </summary>
    /// <param name="x"></param>
    /// <param name="y"></param>
    /// <param name="size"></param>
    /// <param name="negative"></param>
    /// <returns></returns>
    static int Compare(BigInt x, BigInt y, out int size, out byte negative)
    {
        int cmp = x.size.CompareTo(y.size);
        if (cmp != 0)
        {
            size = cmp < 0 ? y.size : x.size;
            negative = cmp < 0 ? y.negative : x.negative;
            return cmp;
        }
        else
        {
            for (int i = x.size - 1; i >= 0; i--)
            {
                int diff = x.digit[i].CompareTo(y.digit[i]);
                if (diff != 0)
                {
                    size = i + 1;
                    negative = diff < 0 ? y.negative : x.negative;
                    return diff;
                }
            }
            size = 1;
            negative = 0;
            return 0;
        }
    }
    static BigInt Sub(BigInt a, BigInt b)
    {
        var x = a;
        var y = b;
        int size; byte negative;
        if (Compare(x, y, out size, out negative) < 0) { var tmp = x; x = y; y = tmp; }
        var ret = new BigInt { size = size, negative = negative };
        byte gain = 0;
        for (int i = 0; i < ret.size; i++)
        {
            ret.digit[i] = x.digit[i] - y.digit[i] - gain;
            if (ret.digit[i] < 0)
            {
                ret.digit[i] += Base;
                gain = 1;
            }
            else
            {
                gain = 0;
            }
        }
        while (ret.size > 1 && ret.digit[ret.size - 1] == 0) ret.size--;
        return ret;
    }
    public static BigInt operator +(BigInt l, BigInt r)
    {
        if (l.negative == r.negative)
        {
            return Add(l, r);
        }
        else
        {
            return Sub(l, r);
        }
    }
    public static BigInt operator -(BigInt l, BigInt r)
    {
        r.negative ^= 1;
        return l + r;
    }
    public override string ToString()
    {
        string ret = "";
        if (negative == 1) ret += '-';
        ret += digit[size - 1];
        for (int i = size - 2; i >= 0; i--)
        {
            ret += digit[i].ToString().PadLeft(BaseWidth, '0');
        }
        return ret;
    }
}

static class Ex
{
    public static void join<T>(this IEnumerable<T> values, string sep = " ") => WriteLine(string.Join(sep, values));
    public static string concat<T>(this IEnumerable<T> values) => string.Concat(values);
    public static string reverse(this string s) { var t = s.ToCharArray(); Array.Reverse(t); return t.concat(); }

    public static int lower_bound<T>(this IList<T> arr, T val) where T : IComparable<T>
    {
        int low = 0, high = arr.Count;
        int mid;
        while (low < high)
        {
            mid = ((high - low) >> 1) + low;
            if (arr[mid].CompareTo(val) < 0) low = mid + 1;
            else high = mid;
        }
        return low;
    }
    public static int upper_bound<T>(this IList<T> arr, T val) where T : IComparable<T>
    {
        int low = 0, high = arr.Count;
        int mid;
        while (low < high)
        {
            mid = ((high - low) >> 1) + low;
            if (arr[mid].CompareTo(val) <= 0) low = mid + 1;
            else high = mid;
        }
        return low;
    }
}

class Pair<T, U> : IComparable<Pair<T, U>> where T : IComparable<T> where U : IComparable<U>
{
    public T f; public U s;
    public Pair(T f, U s) { this.f = f; this.s = s; }
    public int CompareTo(Pair<T, U> a) => f.CompareTo(a.f) != 0 ? f.CompareTo(a.f) : s.CompareTo(a.s);
    public override string ToString() => $"{f} {s}";
}

class Scanner
{
    string[] s; int i;
    readonly char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan => ReadLine().Split();
    public int[] scanint => Array.ConvertAll(scan, int.Parse);
    public long[] scanlong => Array.ConvertAll(scan, long.Parse);
    public double[] scandouble => Array.ConvertAll(scan, double.Parse);
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint => int.Parse(next);
    public long nextlong => long.Parse(next);
    public double nextdouble => double.Parse(next);
}