Problem:
Score : 100 points

Problem Statement

You have three tasks, all of which need to be completed.

First, you can complete any one task at cost 0.

Then, just after completing the i-th task, you can complete the j-th task at cost |A_j - A_i|.

Here, |x| denotes the absolute value of x.

Find the minimum total cost required to complete all the task.

Constraints

All values in input are integers.

1 \leq A_1, A_2, A_3 \leq 100

Input

Input is given from Standard Input in the following format:

A_1 A_2 A_3

Output

Print the minimum total cost required to complete all the task.

Sample Input 1

1 6 3

Sample Output 1

5

When the tasks are completed in the following order, the total cost will be 5, which is the minimum:

Complete the first task at cost 0.

Complete the third task at cost 2.

Complete the second task at cost 3.

Sample Input 2

11 5 5

Sample Output 2

6

Sample Input 3

100 100 100

Sample Output 3

0

Solution in C++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<queue>
#include<set>
#include<map>
#include<stack>
#include<time.h>
#include<cstdlib>
#include<cmath>
#include<list>
using namespace std;
#define MAXN 100100
#define eps 1e-7
#define For(i,a,b) for(int i=a;i<=b;i++)
#define Fore(i,a,b) for(int i=a;i>=b;i--)
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define mkp make_pair
#define pb push_back
#define cr clear()
#define sz size()
#define met(a,b) memset(a,b,sizeof(a))
#define iossy ios::sync_with_stdio(false)
#define fre freopen
#define pi acos(-1.0)
#define inf 1e9+9
#define Vector Point
const int Mod=1e9+7;
const long long Maxx=2e18;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int,int> pii;
struct node{
	int l,r;
	int id;
	bool operator < (const node &a)const{
		return r>a.r;
	}
};
bool cmp(node a,node b){
	if(a.l==b.l) return a.r<b.r;
	return a.l<b.l;
}
node a[MAXN],b[MAXN];
priority_queue<node>q;
int vis[MAXN];
int n,m,tmp;
void solve(){
	cin>>n>>m;
	while(!q.empty()) q.pop();
	met(vis,0);
	For(i,1,m){
		scanf("%d%d",&a[i].l,&a[i].r);
	}
	sort(a+1,a+1+m,cmp);
	For(i,1,m){
		if(!tmp) {b[tmp++]=a[i];continue;}
		if(b[tmp-1].l<=a[i].l && b[tmp-1].r>=a[i].r) b[tmp-1]=a[i];
		else if(b[tmp-1].l>=a[i].l && b[tmp-1].r<=a[i].r) continue;
		else b[tmp++]=a[i];
	}
	tmp=0;
	For(i,1,m)
		if(!vis[i]) b[tmp++]=a[i];
	sort(b,b+tmp,cmp);
	met(vis,0);
	For(i,0,tmp-1){
		b[i].id=i;
		q.push(b[i]);
	}
	int now=0,ans=0;
	while(!q.empty()){
		node tp=q.top();
		if(vis[tp.id]) {q.pop();continue;}
		while(now<tmp){
			if(b[now].l<tp.r) vis[b[now].id]=1,now++;
			else break;
		}
		q.pop();
		ans++;
	}
	cout<<ans<<endl;
}
int main(){
//  fre("in.txt","r",stdin);
    int t=0;
    solve();
    return 0;
}