Problem:
Score : 200 points

Problem Statement

In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter.

It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower.

Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover.

Assume also that the depth of the snow cover is always at least 1 meter.

Constraints

1 \leq a < b < 499500(=1+2+3+...+999)

All values in input are integers.

There is no input that contradicts the assumption.

Input

Input is given from Standard Input in the following format:

a b

Output

If the depth of the snow cover is x meters, print x as an integer.

Sample Input 1

8 13

Sample Output 1

2

The heights of the two towers are 10 meters and 15 meters, respectively.
Thus, we can see that the depth of the snow cover is 2 meters.

Sample Input 2

54 65

Sample Output 2

1

Solution in C# (.NET Core 3.1.201) (judge verdict: Runtime Error)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = ReadInt();
            int b = ReadInt();
            int d = b - a;
            d = (d * (d + 1) / 2) - b;

            WriteLine(d);
        }

        //以下標準出入力用のメソッド
        [System.Runtime.InteropServices.DllImport("msvcrt.dll")]
        private static extern int scanf(string format, out long l);
        public static long ReadLong()
        {
            long l;
            scanf("%ld", out l);
            return l;
        }
        public static int ReadInt()
        {
            return (int)ReadLong();
        }
        public static int[] ReadInts(int n)
        {
            int[] nums = new int[n];
            for (int i = 0; i < n; i++)
                nums[i] = ReadInt();
            return nums;
        }
        public static long[] ReadLongs(int n)
        {
            long[] nums = new long[n];
            for (int i = 0; i < n; i++)
                nums[i] = ReadLong();
            return nums;
        }
        [System.Runtime.InteropServices.DllImport("msvcrt.dll")]
        private static extern int scanf(string format, out double l);
        public static double ReadDouble()
        {
            double d;
            scanf("%lf", out d);
            return d;
        }
        [System.Runtime.InteropServices.DllImport("msvcrt.dll")]
        private static extern int scanf(string format, out char c);
        public static char ReadChar()
        {
            char c;
            while (true)
            {
                scanf("%c", out c);
                if (c != '\n')
                    break;
            }
            return c;
        }
        public static string ReadLine()
        {
            StringBuilder sb = new StringBuilder();
            char c;
            do
            {
                scanf("%c", out c);
                if (c != '\n')
                    sb.Append(c);
            } while (c != '\n');
            return sb.ToString();
        }
        [System.Runtime.InteropServices.DllImport("msvcrt.dll")]
        private static extern void printf(string s);
        public static void Write(string s) { printf(s); }
        public static void Write(char c) { printf(c.ToString()); }
        public static void Write(long n) { printf(n.ToString()); }
        public static void Write(int n) { printf(n.ToString()); }
        public static void Write(double d) { printf(d.ToString()); }
        public static void WriteLine() { printf("\n"); }
        public static void WriteLine(string s) { printf(s + "\n"); }
        public static void WriteLine(char c) { WriteLine(c.ToString()); }
        public static void WriteLine(long n) { WriteLine(n.ToString()); }
        public static void WriteLine(int n) { WriteLine(n.ToString()); }
        public static void WriteLine(double d) { WriteLine(d.ToString()); }
        public static void WriteLine(string[] s)
        {
            for (int i = 0; i < s.Length - 1; i++)
                Write(s[i] + " ");
            WriteLine(s[s.Length - 1]);
        }
        public static void WriteLine(char[] c)
        {
            for (int i = 0; i < c.Length - 1; i++)
                Write(c[i] + " ");
            WriteLine(c[c.Length - 1]);
        }
        public static void WriteLine(long[] n)
        {
            for (int i = 0; i < n.Length - 1; i++)
                Write(n[i] + " ");
            WriteLine(n[n.Length - 1]);
        }
        public static void WriteLine<T>(ICollection<T> ic)
        {
            foreach (var i in ic)
                Write(i + " ");
            WriteLine("\b");
        }
        public static void WriteLine(int[] n)
        {
            for (int i = 0; i < n.Length - 1; i++)
                Write(n[i] + " ");
            WriteLine(n[n.Length - 1]);
        }
        public static void WriteLine(double[] d)
        {
            for (int i = 0; i < d.Length - 1; i++)
                Write(d[i] + " ");
            WriteLine(d[d.Length - 1]);
        }
        public static void WriteLines(string[] s) { foreach (var i in s) WriteLine(i); }
        public static void WriteLines(char[] c) { foreach (var i in c) WriteLine(i); }
        public static void WriteLines(long[] c) { foreach (var i in c) WriteLine(i); }
        public static void WriteLines(int[] c) { foreach (var i in c) WriteLine(i); }
        public static void WriteLines(double[] d) { foreach (var i in d) WriteLine(i); }
        public static void WriteLines<T>(ICollection<T> ic) { WriteLines(ic.ToArray()); }
    }
}