import sys
input = sys.stdin.readline
a = int(input())
b = int(input())
f = abs(a - b) // 2
s = (abs(a - b) + 1) // 2
print(f * (f + 1) // 2 + s * (s + 1) // 2)
#include<iostream>
using namespace std;
int main(){
int a,b;
cin>>a>>b;
if(a>b){
int temp=a;
a=b;
b=temp;
}
if((b-a)%2==0||(a-b)%2==0){
int c=(b-a)/2;
int sum=0;
for(int i=1;i<=c;i++){
sum=sum+i;
}
cout<<2*sum<<endl;
}
else{
int m=(b-a+1)/2;
int sum1=0;
for(int i=1;i<=m;i++){
sum1=sum1+i;
}
int m1=(b-a-1)/2;
int sum2=0;
for(int i=1;i<=m1;i++){
sum2=sum2+i;
}
cout<<(sum1+sum2)<<endl;
}
}
1718C - Tonya and Burenka-179 | 834A - The Useless Toy |
1407D - Discrete Centrifugal Jumps | 1095B - Array Stabilization |
291B - Command Line Arguments | 1174B - Ehab Is an Odd Person |
624B - Making a String | 1064C - Oh Those Palindromes |
1471A - Strange Partition | 1746A - Maxmina |
1746B - Rebellion | 66C - Petya and File System |
1746C - Permutation Operations | 1199B - Water Lily |
570B - Simple Game | 599C - Day at the Beach |
862A - Mahmoud and Ehab and the MEX | 1525A - Potion-making |
1744D - Divisibility by 2n | 1744C - Traffic Light |
1744A - Number Replacement | 1744B - Even-Odd Increments |
637B - Chat Order | 546C - Soldier and Cards |
18D - Seller Bob | 842B - Gleb And Pizza |
1746D - Paths on the Tree | 1651E - Sum of Matchings |
19A - World Football Cup | 630P - Area of a Star |