stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

int main(void){

    

    int N;

    int h[100000] = {};

    

    cin >> N;

    for(int i = 0; i < N; i++){

        cin >> h[i];

    }

    

    // DPの宣言と初期値を設定

    long long dp[100001];

    dp[0] = 0;

    dp[1] = abs(h[1]-h[0]);

    

    for(int i = 1; i < N-1; i++){

        int jump_One = dp[i] + abs(h[i+1] - h[i]);

        int jump_Tow = dp[i-1] + abs(h[i+1] - h[i-1]);

        dp[i+1] = min(jump_One, jump_Tow);

    }



    cout << dp[N-1] << endl;

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;

int main(void){

    

    int N;

    cin >> N ;

    int h[100010];

    for(int i = 1; i <= N; i++){

        cin >> h[i];

    }

    

    int dp[100010];

    dp[0] = 0;

    dp[1] = abs(h[2] - h[1]);

    

    for(int i = 2; i < N; i++){

        dp[i] = min(dp[i-1] + abs(h[i+1] - h[i]), dp[i-2] + abs(h[i+1] - h[i-1]));

    }

    

    cout << dp[N-1] << endl;

    





}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

int main(void){

    

    int N;

    int h[100000] = {};

    

    cin >> N;

    for(int i = 0; i < N; i++){

        cin >> h[i];

    }

    

    // DPの宣言と初期値を設定

    long long dp[100001];

    dp[0] = 0;

    dp[1] = abs(h[1]-h[0]);

    

    for(int i = 2; i < N; i++){

        dp[i] = min( dp[i-1] + abs(h[i] - h[i-1]), dp[i-2] + abs(h[i] - h[i-2]) );

    }



    cout << dp[N-1] << endl;

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;

int main(void){

    

    int N;

    cin >> N ;

    int h[100010];

    for(int i = 1; i <= N; i++){

        cin >> h[i];

    }

    

    int dp[100010];

    dp[0] = 0;

    dp[1] = abs(h[2] - h[1]);

    

    for(int i = 2; i < N; i++){

        dp[i] = min(dp[i-1] + abs(h[i+1] - h[i]), dp[i-2] + abs(h[i+1] - h[i-1]));

    }

    

    cout << dp[N-1] << endl;

    





}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

 

typedef long long ll;

typedef pair<int, int> P;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

 

template <class T> inline bool chmin(T &a, T b) {if (a > b){a = b;return true;}return false;}

template <class T> inline bool chmax(T &a, T b) {if (a < b){a = b;return true;}return false;}



const int NM = 1e5+10;

const ll INF = 1LL << 60;

ll h[NM];

ll dp[NM];



int main() {

    int N; cin >> N;

    rep(i, N) {

        cin >> h[i];

    }

    rep(i, NM) dp[i] = INF;

    dp[0] = 0;

    for(int i=0; i<N; i++) {

       dp[i+1] = min(dp[i+1], dp[i] + abs(h[i+1] - h[i]));

       if(i+2 < N){

            dp[i+2] = min(dp[i+2], dp[i] + abs(h[i+2] - h[i]));

       }

    }

    cout << dp[N-1] << endl;



}

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

typedef pair<int, int> P;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

#define all(x) (x).begin(),(x).end()

template <class T> inline bool chmin(T &a, T b) {if (a > b){a = b;return true;}return false;}

template <class T> inline bool chmax(T &a, T b) {if (a < b){a = b;return true;}return false;}

const ll INF = 1LL << 60;



//dp_a

int main(){

    cin.tie(0);

    ios::sync_with_stdio(false);

    int n;cin>>n;

    vector<int> h(n+2, 0);

    rep(i,n){

        cin>>h[i];

    }

    vector<ll> dp(n+2, INF);

    dp[0]=0;

    for(int i=0;i<n;i++){

        chmin(dp[i+1], dp[i]+abs(h[i+1]-h[i]));

        chmin(dp[i+2], dp[i]+abs(h[i+2]-h[i]));

    }

    cout<<dp[n-1]<<endl;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



#define REP(i, a, b) for(int i = (a); i <= (b); i++)

#define PER(i, a, b) for(int i = (a); i >= (b); i--)

#define rep(i, a, b) for(int i = (a); i < (b); i++)

#define debug(x) cerr << #x << " = " << x << endl;

#define SET(c, v) memset(c, v, sizeof c)

#define pi 3.14159265358979323846264338

#define all(S) (S).begin(), (S).end()

#define INF 0x3f3f3f3f

#define mod 1000000007

#define pf push_front

#define pb push_back

#define mk make_pair

#define MAX 100000

#define MA1 10000



#define S second

#define F first

typedef long long ll;

typedef long double lf;

typedef pair<int, int> ii;

typedef pair<int, ii> pii;

typedef unsigned long long int ull;

int v[MAX], pd[MAX], N;



int solve(int i) {

	int &ans = pd[i];

	if(i == N-1) return 0;

	if(i >= N) return 1 << 30;

	if(ans != -1) return ans;

	return ans = min(solve(i+1) + abs(v[i] - v[i+1]), solve(i+2) + abs(v[i] - v[i+2]));

}



int main(int argc, char** argv) {

	scanf("%d", &N);

	rep(i, 0, N) scanf("%d", &v[i]);

	memset(pd, -1, sizeof pd);

	printf("%d\n", solve(0));

	return 0;

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;

 

#define REP(i, a, b) for(int i = (a); i <= (b); i++)

#define PER(i, a, b) for(int i = (a); i >= (b); i--)

#define rep(i, a, b) for(int i = (a); i < (b); i++)

#define all(S) (S).begin(), (S).end()

#define pf push_front

#define pb push_back

#define mk make_pair

#define S second

#define F first

typedef long long ll;

typedef long double lf;

typedef pair<int, int> ii;

const int MAX = 1e5+5;

int N, a[MAX];

ll pd[MAX];



ll solve() {

	pd[2] = abs(a[2] - a[1]);

	REP(i, 3, N) {

		pd[i] = pd[i-1]+abs(a[i]-a[i-1]);

		pd[i] = min(pd[i], pd[i-2]+abs(a[i]-a[i-2]));

	}

	return pd[N];

}



int main(int argc, char ** argv) {

	scanf("%d", &N);

	REP(i, 1, N) scanf("%d", &a[i]);

	printf("%I64d\n", solve());

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <cstdio>

#include <cstdlib>

#include <algorithm>

#include <vector>

#define repi(i,a,b) for(int i=(a);i<(b);++i)

#define rep(i,a) repi(i,0,a)

#define all(a) (a).begin(), (a).end()



using ll = long long;



ll N;

ll A[100010];

std::vector<ll> ma, minus;

ll S;



int main()

{

  scanf( "%lld", &N );



  rep( i, N )

  {

    scanf( "%lld", A+i );



    if( A[i] >= 0 )

      ma.push_back( A[i] );

    

    if( A[i] < 0 )

      minus.push_back( -A[i] );



    S += llabs(A[i]);

  }



  std::sort( all(ma) );

  std::sort( all(minus) );



  ll ans = 0;



  if( minus.size() & 1 )

  {

    if( !minus.empty() ) rep( i, minus.size()-1 )

      ans += minus[i+1];



    if( !ma.empty() && !minus.empty() )

    {

      if( ma[0] < minus[0] )

      {

        ans += minus[0];

        ans -= ma[0];

      }

      else

      {

        ans -= minus[0];

        ans += ma[0];

      }

    }

    else

    {

      if( !ma.empty() )

        ans += ma[0];

      if( !minus.empty() )

        ans -= minus[0];

    }



    if( !ma.empty() ) rep( i, ma.size()-1 )

      ans += ma[i+1];

  }

  else

    ans = S;



  printf( "%lld\n", ans );



  return 0;

}

// Optimized solution to the same problem (faster):
#include <cstdio>

#include <algorithm>

#define repi(i,a,b) for(int i=(a);i<(b);++i)

#define rep(i,a) repi(i,0,a)

#define all(a) (a).begin(), (a).end()



using ll = long long;



ll N;

ll A[100010];

ll dp[100010][2];



int main()

{

  scanf( "%lld", &N );

  rep( i, N )

    scanf( "%lld", A+i );



  dp[0][0] = A[0], dp[0][1] = -A[0];



  rep( i, N )

  {

    dp[i+1][0] = std::max( dp[i][0]+A[i+1], dp[i][1]-A[i+1] );

    dp[i+1][1] = std::max( dp[i][0]-A[i+1], dp[i][1]+A[i+1] );

  }



  printf( "%lld\n", dp[N-1][0] );



  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
//   _/                _/                 _/_/_/   _/

//_/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/

// _/     _/    _/   _/     _/    _/  _/_/_/     _/

//_/     _/    _/   _/     _/    _/  _/    _/   _/

// _/_/   _/_/       _/_/   _/_/      _/_/     _/

#include<iostream>

#include<algorithm>

#include<cmath>

#include<iomanip>

#include<set>

#include<map>

#include<queue>

#include<vector>

using namespace std;

typedef long long ll;

const int MOD=1e9+7;

const double pi=3.14159265358979323846;

const int inf=1e9;

const ll INF=5e18;

typedef pair<int,int> P;

int main() {

  cin.tie(0),cout.tie(0);

  ios::sync_with_stdio(false);

  ll n,a[100005]={},ans=0,cnt=0,x=INF;

  cin >> n;

  for(int i=0; i<n; i++) {

    cin >> a[i];

    if(a[i]<0) {

      cnt++;

    }

    ans+=abs(a[i]);

    x=min(x,abs(a[i]));

  }

  cout << (cnt%2?ans-=2*x:ans) << endl;

}

// Optimized solution to the same problem (faster):
//   _/                _/                 _/_/_/   _/

//_/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/

// _/     _/    _/   _/     _/    _/  _/_/_/     _/

//_/     _/    _/   _/     _/    _/  _/    _/   _/

// _/_/   _/_/       _/_/   _/_/      _/_/     _/

#include<iostream>

#include<algorithm>

#include<cmath>

#include<iomanip>

#include<set>

#include<map>

#include<queue>

#include<vector>

#include<random>

using namespace std;

typedef long long ll;

const int MOD=1e9+7;

const double pi=3.14159265358979323846;

const int inf=1e9;

const ll INF=1e18;

int main() {

  cin.tie(0),cout.tie(0);

  ios::sync_with_stdio(false);

  ll n,a,ans=0,cnt=0,x=inf;

  cin >> n;

  for(int i=0; i<n; i++) {

    cin >> a;

    if(a<0) {

      cnt++;

    }

    ans+=abs(a);

    x=min(x,abs(a));

  }

  cout << (cnt%2?ans-=x*2:ans) << endl;

 }

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>



using namespace std;

#define PROBLEM "E"

#define MAX 100010



int main(){



	#ifdef DBG

	freopen("problem" PROBLEM ".in", "r", stdin);

	freopen("problem" PROBLEM ".out", "w", stdout);

	#endif



	int N;



	cin >> N;

	long long int a[MAX];

	memset(a, 0, sizeof(a));

	int count = 0;



	for(int i = 0 ; i < N ; i++){



		cin >> a[i];

		if(a[i] < 0)

			count++;

	}



	transform(a, a+N, a, [](long long i){



		return abs(i);

	});



	int tmp = *std::min_element(a, a+N);



	if(count % 2 == 0)

		cout << accumulate(a, a+N, (long long)0) << endl;

	else

		cout << accumulate(a, a + N, (long long)0) - 2*tmp << endl;



	return 0;

}

// Optimized solution to the same problem (faster):
#include <iostream>

#include <vector>

#include <math.h>

using namespace std;

int main() {

    long long n,num;

    cin>>n;

    vector<long long>v;

    for(int i=0;i<n;i++){

        cin>>num;

        v.push_back(num);

    }

    long long mi = 1000000;

    int minus = 0;

    long long sum = 0;

    for(int i=0;i<v.size();i++){

        if(v[i]<0)minus++;

        mi = min(abs(v[i]),mi);

        sum += abs(v[i]);

    }

    if(minus % 2 == 1){

        sum -= 2 * mi;

        

    }

    cout<<sum<<endl;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
# include <bits/stdc++.h>

using namespace std;

const int N = 1000 * 1000 + 10, mod = 1e9 + 7;

int r[N], c[N];

long long ans = 1, sr, sc, cnt;

int main() {

	int n, m;

	cin >> n >> m;

	memset(r, -1, sizeof(r));

	memset(c, -1, sizeof(c));

	for (int i = 0; i < n; i++) {

		int x;

		cin >> x;

		x--;

		if (r[x] != -1) {

			cout << 0;

			return 0;

		}

		r[x] = i;

	}

	for (int i = 0; i < m; i++) {

		int x;

		cin >> x;

		x--;

		if (c[x] != -1) {

			cout << 0;

			return 0;

		}

		c[x] = i;

	}

	for (int i = n * m - 1; i >= 0; i--) {

		if (r[i] >= 0 && c[i] >= 0) {

			cnt++, sr++, sc++;

			continue;

		}

		if (r[i] == -1 && c[i] == -1) {

//			cout << "rc : i = " << i<< " : " << ans << " : : ";

			if (sr * sc - cnt <= 0) {

				cout << 0;

				return 0;

			}

			ans = (ans * (sr * sc - cnt)) % mod;

//			cout << ans << endl;

			cnt++;

			continue;

		}

		if (r[i] == -1) {

			if (!sc) {

				cout << 0;

				return 0;

			}

//			cout << "r : i = " << i << " : " << ans << " : : ";

			ans = ans * sc % mod;

//			cout << ans << endl;

			cnt++, sr++;

			continue;

		}

		if (c[i] == -1) {

			if (!sr) {

				cout << 0;

				return 0;

			}

//			cout << "c : i = " << i << " : " << ans << " : : ";

			ans = ans * sr % mod;

//			cout << ans << endl;

			cnt++, sc++;

			continue;

		}

	}

	cout << ans;

	return 0;

}


// Optimized solution to the same problem (faster):
# include <bits/stdc++.h>

using namespace std;

const int N = 1000 * 1000 + 10, mod = 1e9 + 7;

int r[N], c[N];

long long ans = 1, sr, sc;

int main() {

	int n, m;

	cin >> n >> m;

	for (int i = 0; i < n; i++) {

		int x;

		cin >> x;

		x--;

		r[x] = 1;

	}

	for (int i = 0; i < m; i++) {

		int x;

		cin >> x;

		x--;

		c[x] = 1;

	}

	for (int i = n * m - 1; i >= 0; i--) {

		if (!r[i] && !c[i]) {

			if (sr * sc - (n * m - i - 1) <= 0) {

				cout << 0;

				return 0;

			}

			ans = (ans * (sr * sc - (n * m - i - 1))) % mod;

			continue;

		}

		if (!r[i]) {

			if (!sc) {

				cout << 0;

				return 0;

			}

			ans = ans * sc % mod;

			sr++;

			continue;

		}

		if (!c[i]) {

			if (!sr) {

				cout << 0;

				return 0;

			}

			ans = ans * sr % mod;

			sc++;

			continue;

		}

		sr++, sc++;

	}

	cout << ans;

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <stdint.h>



#include <iostream>

using namespace std;



int main(void) {

  int64_t N;

  cin >> N;

  int64_t a[5];

  for (int64_t i = 0; i < 5; ++i) cin >> a[i];

  int64_t mn = 1000000000000000;



  for (int64_t i = 0; i < 5; ++i) {

    if (a[i] < mn) {

      mn = a[i];

    }

  }

  cout << (N + mn - 1) / mn + 4 << endl;



  return 0;

}


// Optimized solution to the same problem (faster):
#include <stdint.h>

#include <stdio.h>



int main(void) {

  int64_t N;

  // cin >> N;

  scanf("%ld", &N);

  int64_t a[5];

  for (int64_t i = 0; i < 5; ++i) scanf("%ld", a + i);

  int64_t mn = 1000000000000000;



  for (int64_t i = 0; i < 5; ++i) {

    if (a[i] < mn) {

      mn = a[i];

    }

  }

  printf("%ld\n", (N + mn - 1) / mn + 4);



  return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;



const int N = (int)1e5 + 10;

const double eps = 1e-8;



template <typename T> inline T gcd(T a, T b) { a = abs(a), b = abs(b); while ( b ) { a %= b; swap(a, b); } return a; }

vector <pair <int, int> > adj[N + 7];





int main() {

	ios_base::sync_with_stdio(0);

	cin.tie(0); cout.tie(0);

	ll n, arr[10];

	ll mn = (ll)1e18;

	cin >> n;

	for ( int i = 0; i < 5; ++i ) {

		cin >> arr[i];

		mn = min(arr[i], mn);

	}

	ll ans = 4 + ceil(n*1.0 / mn*1.0);

	cout << ans << endl;

    return 0;

}


// Optimized solution to the same problem (faster):
/*Bismillahir Rahmanir Rahim*/

#include<bits/stdc++.h>

using namespace std;

int main()

{

    long long int n,i,j,min,a[10];

    cin>>n;

    min=1000000000000009;

    for(i=0; i<5; i++)

    {

        cin>>a[i];

        if(a[i]<min)

            min=a[i];

    }

    if(n%min==0)

        cout<<(n/min)+4<<endl;

    else

       cout<<(n/min)+5<<endl;

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <sstream>

#include <iomanip>

#include <cstdio>

#include <cstdlib>

#include <cmath>

#include <cctype>

#include <cstring>

#include <vector>

#include <list>

#include <queue>

#include <deque>

#include <stack>

#include <map>

#include <set>

#include <algorithm>

#include <iterator>

#include <bitset>

#include <ctime>

#include <complex>



using namespace std;



#define FOR(i,a,b) for (int i = (a); i < (b); i++)

#define RFOR(i,b,a) for (int i = (b)-1; i >= (a); i--)

#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)

#define FILL(a,value) memset(a, value, sizeof(a))



#define SZ(a) (int)a.size()

#define ALL(a) a.begin(), a.end()

#define PB push_back

#define MP make_pair



typedef unsigned long long LL;

typedef vector<int> VI;

typedef pair<int, int> PII;



const double PI = acos(-1.0);

const int INF = 1000 * 1000 * 1000 + 7;

const LL LINF = INF * (LL) INF;



const double EPS = 1e-6;

const int MAX = 2000 * 100 + 47;





PII A[MAX];

PII B[MAX];

int DP[MAX];



int main()

{

    int x, y, xx, yy;

    scanf("%d%d%d%d", &x, &y, &xx, &yy);

    int n;

    scanf("%d", &n);

    FOR(i, 0, n)

        scanf("%d%d", &A[i].first, &A[i].second);

    

    if (x > xx)swap(x, xx), swap(y, yy);

    if (y > yy)

    {

        FOR(i, 0, n) A[i].second *= -1;

        y *= -1, yy *= -1;

    }

    int sz = 0;

    FOR(i, 0, n)

    {

        if (A[i].first < x || A[i].first > xx)continue;

        if (A[i].second < y || A[i].second > yy)continue;

        B[sz++] = A[i];

    }

    sort(B, B + sz);

    FOR(i, 0, MAX)

        DP[i] = INF;

    int mx = 0;

    FOR(i, 0, sz)

    {

        int j = lower_bound(DP, DP + n, B[i].second) - DP;

        DP[j] = B[i].second;

        mx = max(mx, j+1);

    }

    double ans = (xx - x) + (yy - y);

    ans *= 100;

    if (mx == xx - x + 1 || mx == yy - y + 1)ans += 5 * PI;

    ans += mx * (5 * PI - 20);

    printf("%.11f\n", ans);

}


// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstring>

#include<algorithm>

#include<cmath>

#define SF scanf

#define PF printf

#define MAXN 200010

#define x first

#define y second

using namespace std;

typedef long long ll;

pair<int,int> p[MAXN];

const double Pi=acos(-1);

int xl,yl,xr,yr;

int fx,fy;

int n;

int st[MAXN];

int main(){

	SF("%d%d%d%d",&xl,&yl,&xr,&yr);

	if(xl>xr)

		fx=-1;

	else

		fx=1;

	if(yl>yr)

		fy=-1;

	else

		fy=1;

	xl*=fx,xr*=fx,yl*=fy,yr*=fy;

	SF("%d",&n);

	for(int i=1;i<=n;i++){

		SF("%d%d",&p[i].x,&p[i].y);

		p[i].x*=fx;

		p[i].y*=fy;

		if(p[i].x<xl||p[i].x>xr||p[i].y<yl||p[i].y>yr){

			n--;

			i--;

			continue;

		}

	}

	sort(p+1,p+1+n);

	int top=0;

	for(int i=1;i<=n;i++){

		if(top==0||st[top]<p[i].y)

			st[++top]=p[i].y;

		else{

			int pos=lower_bound(st+1,st+1+top,p[i].y)-st;

			st[pos]=p[i].y;	

		}

	}

	double ans=(xr-xl)*100.0+(yr-yl)*100.0;

	ans=ans+(double)top*(Pi*5.0-20.0);

	if(top==min(xr-xl+1,yr-yl+1))

		ans+=Pi*5;

	PF("%.11lf",ans);

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<algorithm>

#include<cstdio>

#include<cmath>

using namespace std;

const double PI=acos(-1);

struct xxx{int x,y;}d[201000];

int a[201000],s[201000];

bool cmp(xxx a,xxx b){return a.x<b.x;}

int LIS1(int n)

{

	int sz=0;

	for(int i=1;i<=n;i++)

	{

		if(sz==0||a[i]>s[sz])s[++sz]=a[i];

		else

		{

			int l=1,r=sz+1;

			while(l<r)

			{

				int mid=(l+r)>>1;

				if(s[mid]<a[i])l=mid+1;

				else r=mid;

			}

			s[r]=a[i];

		}

	}

	return sz;

}

int LIS2(int n)

{

	int sz=0;

	for(int i=1;i<=n;i++)

	{

		if(sz==0||a[i]<s[sz])s[++sz]=a[i];

		else

		{

			int l=1,r=sz+1;

			while(l<r)

			{

				int mid=(l+r)>>1;

				if(s[mid]>a[i])l=mid+1;

				else r=mid;

			}

			s[r]=a[i];

		}

	}

	return sz;

}

int main()

{

	int sx,sy,tx,ty;scanf("%d%d%d%d",&sx,&sy,&tx,&ty);bool ok=0;

	if(sx>tx)swap(sx,tx),swap(sy,ty);if(sy>ty)ok=1;

	int n;scanf("%d",&n);

	for(int i=1;i<=n;i++){int X,Y;scanf("%d%d",&X,&Y);d[i].x=X;d[i].y=Y;}

	sort(d+1,d+n+1,cmp);int cnt=0;//for(int i=1;i<=n;i++)cout<<d[i].x<<" "<<d[i].y<<endl;

	for(int i=1;i<=n;i++)if(d[i].x<sx||d[i].x>tx||d[i].y<min(sy,ty)||d[i].y>max(sy,ty))continue;else a[++cnt]=d[i].y;

//	for(int i=1;i<=cnt;i++)cout<<a[i];

	int sz=0;if(ok==0)sz=LIS1(cnt);else sz=LIS2(cnt);

	long long ans1=1ll*(tx-sx+max(sy,ty)-min(sy,ty))*100ll,ans2=0;

	if(sz==min(tx-sx,max(sy,ty)-min(sy,ty))+1)ans2+=5;

	ans2+=sz*5;ans1-=sz*20;

	printf("%.15lf",(double)ans1+(double)ans2*PI);

	return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstring>

#include<algorithm>

#include<cmath>

#define SF scanf

#define PF printf

#define MAXN 200010

#define x first

#define y second

using namespace std;

typedef long long ll;

pair<int,int> p[MAXN];

const double Pi=acos(-1);

int xl,yl,xr,yr;

int fx,fy;

int n;

int st[MAXN];

int main(){

	SF("%d%d%d%d",&xl,&yl,&xr,&yr);

	if(xl>xr)

		fx=-1;

	else

		fx=1;

	if(yl>yr)

		fy=-1;

	else

		fy=1;

	xl*=fx,xr*=fx,yl*=fy,yr*=fy;

	SF("%d",&n);

	for(int i=1;i<=n;i++){

		SF("%d%d",&p[i].x,&p[i].y);

		p[i].x*=fx;

		p[i].y*=fy;

		if(p[i].x<xl||p[i].x>xr||p[i].y<yl||p[i].y>yr){

			n--;

			i--;

			continue;

		}

	}

	sort(p+1,p+1+n);

	int top=0;

	for(int i=1;i<=n;i++){

		if(top==0||st[top]<p[i].y)

			st[++top]=p[i].y;

		else{

			int pos=lower_bound(st+1,st+1+top,p[i].y)-st;

			st[pos]=p[i].y;	

		}

	}

	double ans=(xr-xl)*100.0+(yr-yl)*100.0;

	ans=ans+(double)top*(Pi*5.0-20.0);

	if(top==min(xr-xl+1,yr-yl+1))

		ans+=Pi*5;

	PF("%.11lf",ans);

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

#define fi first

#define se second

using namespace std;

const int N=200005;

const long double pi=acos(-1);

int X1,X2,Y1,Y2,n,fx=1,fy=1,st[N],top;

pair<int,int>p[N];

int main()

{

	scanf("%d%d%d%d",&X1,&Y1,&X2,&Y2);

	if(X1>X2)

		fx=-1,X1*=-1,X2*=-1;

	if(Y1>Y2)

		fy=-1,Y1*=-1,Y2*=-1;

	scanf("%d",&n);

	for(int i=1;i<=n;i++)

	{

		scanf("%d%d",&p[i].fi,&p[i].se);

		p[i].fi*=fx,p[i].se*=fy;

		if(!(X1<=p[i].fi&&p[i].fi<=X2&&Y1<=p[i].se&&p[i].se<=Y2))n--,i--;

	}

	sort(p+1,p+1+n);

	for(int i=1;i<=n;i++)

		if(!top||p[i].se>st[top])

			st[++top]=p[i].se;

		else

			*upper_bound(st+1,st+1+top,p[i].se)=p[i].se;

	long double ans=100.0L*(X2-X1+Y2-Y1)+(pi-4)*5*top;

	if(top==min(X2-X1+1,Y2-Y1+1))ans+=pi*5;

	printf("%.20Lf\n",ans);

	return 0;

}


// Optimized solution to the same problem (faster):
#include <cstdio>

#include <algorithm>

#include <cmath>

#include <cctype>

#define RI register int

#define Tp template <typename T>

#define y1 DEEP_DARK_FANTACY

#define y2 VAN

using namespace std;

inline char nc(){

	static char buf[100000],*L=buf,*R=buf;

	return L==R&&(R=(L=buf)+fread(buf,1,100000,stdin),L==R)?EOF:*L++;

}

inline void read(int& ret){

	ret=0; int f=1;char ch=nc();

	while (ch<'0'||ch>'9'){if (ch=='-') f=-1;ch=nc();}

	while (ch>='0'&&ch<='9') ret=ret*10+ch-'0',ch=nc();

	ret*=f;

}

const int N=2e6+5;

int x1,x2,y1,y2,n,F[N],top,dec;

struct dat{int x,y;}p[N];

double Ans;

inline bool valid(int i){

	return ((p[i].x>=x1&&p[i].x<=x2)||(p[i].x>=x2&&p[i].x<=x1))&&((p[i].y>=y1&&p[i].y<=y2)||(p[i].y>=y2&&p[i].y<=y1));

}

inline bool cmp1(dat A,dat B){return A.x<B.x||(A.x==B.x&&A.y<B.y);}

inline bool cmp2(dat A,dat B){return A.x<B.x||(A.x==B.x&&A.y>B.y);}

int main(){

	read(x1), read(y1), read(x2), read(y2), read(n);

	for (int i=1;i<=n;i++) read(p[i].x), read(p[i].y);

	if (x1>x2) swap(x1,x2), swap(y1,y2);

	F[0]=-2e9;

	if (y1<y2){

		sort(p+1,p+n+1,cmp1);

		for (int i=1;i<=n;i++) if (valid(i))

			if (F[top]<p[i].y) F[++top]=p[i].y; else F[upper_bound(F+1,F+top+1,p[i].y)-F]=p[i].y;

	} else{

		sort(p+1,p+n+1,cmp2);

		for (int i=1;i<=n;i++) if (valid(i))

			if (F[top]<-p[i].y) F[++top]=-p[i].y; else F[upper_bound(F+1,F+top+1,-p[i].y)-F]=-p[i].y;

	}

	double delta=20.0-2.0*M_PI_4*10.0;

	if (top==min(abs(x1-x2),abs(y1-y2))+1) 	Ans=(abs(x2-x1)+abs(y1-y2))*100.0-(top-1)*1.0*delta+(M_PI*10.0-20);

		else Ans=((x2-x1)+abs(y1-y2))*100.0-top*1.0*delta;

	printf("%.11lf\n",Ans);

	return 0;

}

// Fastest known solution for this problem: