stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 1.7677340591294812x):
/// Code By t_bone_289 (Tushar Singh)

/// An Immature Programmer.... I'm still developing !!

#include<bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>

#include <ext/pb_ds/trie_policy.hpp>

using namespace std;

using namespace __gnu_pbds;

#define pll pair<ll,ll>

#define fi first

#define se second

#define mp make_pair

#define pb emplace_back

#define endl '\n'

#define M 1000000007

#define error(x) cout << #x << " = " << x << endl;

#define pi 3.14159265358979323846

typedef long long ll;

typedef long double ld;

template <typename T>

void ContainerError(T &v){cout<<"{";for(auto &x:v){cout<<x<<',';}cout<<"}"<<endl;return;}

typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

ll powmod(ll base,ll exp,ll MOD){ll res=1;while(exp>0){if(exp%2==1) res=(res*base)%MOD;base=(base*base)%MOD;exp/=2;}return (res%MOD);}

ll mpow(ll base,ll exp){ll res=1;while(exp>0){if(exp%2==1) res=(res*base);base=(base*base);exp/=2;}return (res);}

ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}

int main()

{

    ios_base::sync_with_stdio(0);

    cin.tie(0);

    cout.tie(0);

    ll n;

    cin>>n;

    vector<ll> v1;

    vector<ll> v2;

    vector<ll> v(n);

    for(auto &x:v)

    {

        cin>>x;

        if(x<0)

        {

            v1.pb(x);

        }

        else

        {

            v2.pb(x);

        }

    }

    sort(v1.begin(),v1.end());

    reverse(v1.begin(),v1.end());

    sort(v2.begin(),v2.end());

    ll sz1 = v1.size();

    ll sz2 = v2.size();

    if(sz1%2==0)

    {

        ll ans=0;

        for(auto x:v)

        {

            ans += abs(x);

        }

        cout<<ans;

        return 0;

    }

    if((sz1&1))

    {

        ll ans=0;

        for(auto x:v)

        {

            ans += abs(x);

        }

        if(sz2!=0){ans -= 2*min(abs(v1[0]),abs(v2[0]));}

        else

        {

            ans -= 2*abs(v1[0]);

        }

        cout<<ans;

        return 0;

    }

    return 0;

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 1.7826694093653488x):
#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; }

ll dp[N + 7][2];

bool vis[N + 7][2];

ll arr[N + 7];

int n;



int main() {

	ios_base::sync_with_stdio(0);

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

	cin >> n;

	for ( int i = 0; i < n; ++i ) cin >> arr[i];

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

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

		dp[i][0] = max(dp[i - 1][0] + arr[i], dp[i - 1][1] - arr[i]);

		dp[i][1] = max(dp[i - 1][0] - arr[i], dp[i - 1][1] + arr[i]);

	}

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

    return 0;

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 1.7732071494663932x):
#include<bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>

#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;

using namespace std;

#define Khela ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

#define ll long long int

#define llu long long unsigned int

#define pf printf

#define sf scanf

#define f first

#define s second

#define pb push_back

#define mk make_pair

#define pii pair<int ,int>

 

int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};

int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};

int dx4[] = {0, 0, 1, -1};

int dy4[] = {1, -1, 0, 0};

 

typedef tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;

int Set(int N,int pos){return N=N | (1<<pos);}

int reset(int N,int pos){return N= N & ~(1<<pos);}

bool check(int N,int pos){return (bool)(N & (1<<pos));}

const int Max=1e9+100;

const ll Maxx=1e18+500;

const int sz=1e3+100;

 

int main()

{

    Khela

    ll a,b,c,i,j,k,q,p,x,y,ct,ct1,m,l,r,x1,y1,mn,h,sum1,in,z,mid,n,mx;

    char ch;

    double d;

    string str1,str2,str;

    bool bl,bl1;

    int t,cs=1;

    while(cin>>n)

    {

        ll ara[n+2];

        for(i=0;i<n;i++) cin>>ara[i];

        ll last=0;

        ara[n]=0ll;

        ll sum=0;

        ll mn=Maxx;

        ll ct=0;

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

            if(ara[i]>=0){

                if(ct>0){

                    if((ct+last)%2==0) last=0;

                    else last=1;

                }

                ct=0;

            }

            else{

                ++ct;

            }

            sum+=abs(ara[i]);

            if(i<n) mn=min(mn,abs(ara[i]));

        }

        if(last>0) sum-=(2*mn);

        cout<<sum<<endl;

    } 











}
// Slower C++ solution:
# 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;

}


// Faster C++ solution for the same problem (measured speedup: 9.28237276127634x):
# 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;

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 5.235795410741225x):
#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;

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 3.549240213372107x):
/*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;

}
// Slower C++ solution:
#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);

}


// Faster C++ solution for the same problem (measured speedup: 9.038660967513316x):
#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);

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 5.04395993054652x):
#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);

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 5.075034252544954x):
#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;

}
// Slower C++ solution:
#include<bits/stdc++.h>

#define X first

#define Y second

using namespace std;



const int S=(1<<20)+5;

char buf[S],*H,*T;

inline char Get() {

	if(H==T) T=(H=buf)+fread(buf,1,S,stdin);

	if(H==T) return -1;

	return *H++;

}

inline int read() {

	int x=0;

	char c=Get();

	while(!isdigit(c)) c=Get();

	while(isdigit(c)) x=x*10+c-'0',c=Get();

	return x;

}



typedef pair<int,int> pii;

const double pi=acos(-1);

const int N=200010;

const int MX=1e8+5;

int x1,yy1,x2,yy2,n,tot=0,lis;

int g[N],idx[N],a[N],f[N],gx[N],ax[N];

pii pnt[N];

bool deled[N];



int LIS() {

	int res=0;

	memset(g,0x7f,sizeof(g));

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

		auto it=lower_bound(g+1,g+1+n,a[i]);

		if(*it==0x7f7f7f7f) res++;

		*it=a[i];

	}

	return res;

}



int main() {

	x1=read();

	yy1=read();

	x2=read();

	yy2=read();

	n=read();

	for(int i=1; i<=n; i++) pnt[i].X=read(),pnt[i].Y=read();

	if(x2<x1||yy2<yy1) {

		if(x1<=x2) goto swap2;

		x1=MX-x1;

		x2=MX-x2;

		for(int i=1; i<=n; i++) pnt[i].X=MX-pnt[i].X;

		if(yy1<=yy2) goto work;

swap2:

		yy1=MX-yy1;

		yy2=MX-yy2;

		for(int i=1; i<=n; i++) pnt[i].Y=MX-pnt[i].Y;

	}

work:

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

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

		if(pnt[i].X>=x1&&pnt[i].X<=x2&&pnt[i].Y>=yy1&&pnt[i].Y<=yy2) a[++tot]=pnt[i].Y;

	double ans=100.0*(x2-x1+yy2-yy1)+(pi*5-20)*(lis=LIS());

	if(lis==min(x2-x1,yy2-yy1)+1) ans+=pi*5;

output:

	printf("%.12lf\n",ans);

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 9.145677362622388x):
#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;

}