## Editorial for Chơi nhảy

Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.

Lưu ý: Các code mẫu dưới đây chỉ mang tính tham khảo và có thể không AC được bài tập này

#include <algorithm>
#include <cstdio>
using namespace std;
int a, b, c;
int main()
{
while (scanf("%d %d %d", &a, &b, &c) == 3)
printf("%d\n", max(b - a, c - b) - 1);
return 0;
}


#### Code mẫu của RR

#include <set>
#include <map>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <iomanip>
#include <complex>
#include <iostream>
#include <algorithm>

#include <ctime>
#include <deque>
#include <bitset>
#include <cctype>
#include <utility>
#include <cassert>

#define FOR(i,a,b) for(int i=(a),_b=(b); i<=_b; i++)
#define FORD(i,a,b) for(int i=(a),_b=(b); i>=_b; i--)
#define REP(i,a) for(int i=0,_a=(a); i<_a; i++)

#define DEBUG(x) { cout << #x << " = "; cout << (x) << endl; }
#define PR(a,n) { cout << #a << " = "; FOR(_,1,n) cout << a[_] << ' '; cout << endl; }
#define PR0(a,n) { cout << #a << " = "; REP(_,n) cout << a[_] << ' '; cout << endl; }
using namespace std;

int main() {
ios :: sync_with_stdio(false);
int a, b, c;
while (cin >> a >> b >> c) {
cout << max(b - a - 1, c - b - 1) << endl;
}
}


#### Code mẫu của skyvn97

#include<bits/stdc++.h>
#define MAX   111
#define FOR(i,a,b) for (int i=(a),_b=(b);i<=_b;i=i+1)
int f[MAX][MAX][MAX];
inline void maximize(int &x,const int &y) {
if (x<y) x=y;
}
int dp(int x,int y,int z) {
if (f[x][y][z]>=0) return (f[x][y][z]);
int &res=f[x][y][z];
res=0;
FOR(i,y+1,z-1) maximize(res,dp(y,i,z)+1);
FOR(i,x+1,y-1) maximize(res,dp(x,i,y)+1);
return (res);
}
int main(void) {
memset(f,-1,sizeof f);
int a,b,c;
while (scanf("%d%d%d",&a,&b,&c)==3) printf("%d\n",dp(a,b,c));
return 0;
}