stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include<bits/stdc++.h>



using namespace std;



int main(){

    string s,c;

    int n,i,j,k;

    cin>>n>>s;

    int len=s.size();

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

        if(s[i]+n>'Z'){cout<<char(s[i]+n-26);}

        else {cout<<char(s[i]+n);}

    }



    return 0;

}


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

#include <string.h>



int main (){



    int n;

    scanf("%d", &n);

    char str[10000];

    scanf("%s", str);

    for(int i = 0; i < strlen(str); i++){

        str[i] = str[i] + n;

        if(str[i] >= 91) str[i] -= 26;

    }



    printf("%s", str);





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

using namespace std;

int main(){



    int n;

    cin >> n;



    string s;

    cin >> s;



    for(int i=0;i<s.length();i++){

        s[i] = (s[i] - 'A' + n) % 26 + 'A';

    }



    cout << s << endl;

    return 0;

}


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

#include <string.h>



int main (){



    int n;

    scanf("%d", &n);

    char str[10000];

    scanf("%s", str);

    for(int i = 0; i < strlen(str); i++){

        str[i] = str[i] + n;

        if(str[i] >= 91) str[i] -= 26;

    }



    printf("%s", str);





}
// Slower C++ solution:
#include <iostream>

#include <bits/stdc++.h>

using namespace std;

int n,a;

string s;

char c;

int main()

{

    cin >> n >> s;

    for(int i=0;i<s.length();i++){

        if(static_cast<char>(s[i] + n)<'A'||static_cast<char>(s[i] + n)>'Z') cout << static_cast<char>(s[i] -26+ n);

       else cout << static_cast<char>(s[i] + n);

    }

    return 0;

}


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

#include <string.h>

int main (){

	char kata[10001];

	int angka;

	scanf ("%d", &angka);

	scanf ("%s", &kata);

	int panjang = strlen(kata);

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

		if(kata[i]+angka>'Z'){

			kata[i]=kata[i]-(26-angka);

		}else{

			kata[i]+=angka;

		}

	}

	printf ("%s", kata);

}
// Slower C++ solution:
#include <iostream>



using namespace std;



int main(int argc, char const *argv[])

{

    int n;

    string s, s1 = "";

    cin >> n >> s;

    for (char i : s)

    {

        int p1, p2, t;

        t = n;

        p1 = (int)i;

        p2 = min(90, p1 + t);

        t -= (p2 - p1);

        if (t > 0)

            p2 = 65 + t - 1;

        s1.push_back((char(p2)));

    }

    cout << s1;

    return 0;

}


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

#include <string.h>

int main (){

	char kata[10001];

	int angka;

	scanf ("%d", &angka);

	scanf ("%s", &kata);

	int panjang = strlen(kata);

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

		if(kata[i]+angka>'Z'){

			kata[i]=kata[i]-(26-angka);

		}else{

			kata[i]+=angka;

		}

	}

	printf ("%s", kata);

}
// Slower C++ solution:


#include<vector>

#include<iostream>



using namespace std;



int main(){

    int n; 

    cin>>n;

    string s;

    cin>>s;

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

    {

        int temp = s[i] - 65;

        temp = (temp + n ) %26;

        temp += 65;

        s[i] = temp;

    }

    cout<<s;





  



    return 0;

}

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

#include <string.h>

int main (){

	char kata[10001];

	int angka;

	scanf ("%d", &angka);

	scanf ("%s", &kata);

	int panjang = strlen(kata);

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

		if(kata[i]+angka>'Z'){

			kata[i]=kata[i]-(26-angka);

		}else{

			kata[i]+=angka;

		}

	}

	printf ("%s", kata);

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



using namespace std;



int main(){

    string s,c;

    int n,i,j,k;

    cin>>n>>s;

    int len=s.size();

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

        if(s[i]+n>'Z'){cout<<char(s[i]+n-26);}

        else {cout<<char(s[i]+n);}

    }



    return 0;

}


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

#include <string.h>

int main (){

	char kata[10001];

	int angka;

	scanf ("%d", &angka);

	scanf ("%s", &kata);

	int panjang = strlen(kata);

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

		if(kata[i]+angka>'Z'){

			kata[i]=kata[i]-(26-angka);

		}else{

			kata[i]+=angka;

		}

	}

	printf ("%s", kata);

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

using namespace std;

int main(){



    int n;

    cin >> n;



    string s;

    cin >> s;



    for(int i=0;i<s.length();i++){

        s[i] = (s[i] - 'A' + n) % 26 + 'A';

    }



    cout << s << endl;

    return 0;

}


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

#include <string.h>

int main (){

	char kata[10001];

	int angka;

	scanf ("%d", &angka);

	scanf ("%s", &kata);

	int panjang = strlen(kata);

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

		if(kata[i]+angka>'Z'){

			kata[i]=kata[i]-(26-angka);

		}else{

			kata[i]+=angka;

		}

	}

	printf ("%s", kata);

}
// Slower C++ solution:
#include <iostream>

#include <bits/stdc++.h>

using namespace std;

int n,a;

string s;

char c;

int main()

{

    cin >> n >> s;

    for(int i=0;i<s.length();i++){

        if(static_cast<char>(s[i] + n)<'A'||static_cast<char>(s[i] + n)>'Z') cout << static_cast<char>(s[i] -26+ n);

       else cout << static_cast<char>(s[i] + n);

    }

    return 0;

}


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

#include <string.h>

int main(){

	int swap;

	scanf("%d", &swap);

	char kata[10000];

	scanf("%s", kata);

	for(int i = 0; i < strlen(kata); i++){

		kata[i] += swap;

		if(kata[i] > 'Z'){

			kata[i] -= 26;

		}

	}

	for(int i = 0; i < strlen(kata); i++){

		printf("%c", kata[i]);

	}

	

	return 0;

}
// Slower C++ solution:
#include <iostream>



using namespace std;



int main(int argc, char const *argv[])

{

    int n;

    string s, s1 = "";

    cin >> n >> s;

    for (char i : s)

    {

        int p1, p2, t;

        t = n;

        p1 = (int)i;

        p2 = min(90, p1 + t);

        t -= (p2 - p1);

        if (t > 0)

            p2 = 65 + t - 1;

        s1.push_back((char(p2)));

    }

    cout << s1;

    return 0;

}


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

#include <string.h>

int main(){

	int swap;

	scanf("%d", &swap);

	char kata[10000];

	scanf("%s", kata);

	for(int i = 0; i < strlen(kata); i++){

		kata[i] += swap;

		if(kata[i] > 'Z'){

			kata[i] -= 26;

		}

	}

	for(int i = 0; i < strlen(kata); i++){

		printf("%c", kata[i]);

	}

	

	return 0;

}
// Slower C++ solution:


#include<vector>

#include<iostream>



using namespace std;



int main(){

    int n; 

    cin>>n;

    string s;

    cin>>s;

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

    {

        int temp = s[i] - 65;

        temp = (temp + n ) %26;

        temp += 65;

        s[i] = temp;

    }

    cout<<s;





  



    return 0;

}

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

#include <string.h>

int main(){

	int swap;

	scanf("%d", &swap);

	char kata[10000];

	scanf("%s", kata);

	for(int i = 0; i < strlen(kata); i++){

		kata[i] += swap;

		if(kata[i] > 'Z'){

			kata[i] -= 26;

		}

	}

	for(int i = 0; i < strlen(kata); i++){

		printf("%c", kata[i]);

	}

	

	return 0;

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



using namespace std;



int main(){

    string s,c;

    int n,i,j,k;

    cin>>n>>s;

    int len=s.size();

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

        if(s[i]+n>'Z'){cout<<char(s[i]+n-26);}

        else {cout<<char(s[i]+n);}

    }



    return 0;

}


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

#include <string.h>

int main(){

	int swap;

	scanf("%d", &swap);

	char kata[10000];

	scanf("%s", kata);

	for(int i = 0; i < strlen(kata); i++){

		kata[i] += swap;

		if(kata[i] > 'Z'){

			kata[i] -= 26;

		}

	}

	for(int i = 0; i < strlen(kata); i++){

		printf("%c", kata[i]);

	}

	

	return 0;

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

using namespace std;

int main(){



    int n;

    cin >> n;



    string s;

    cin >> s;



    for(int i=0;i<s.length();i++){

        s[i] = (s[i] - 'A' + n) % 26 + 'A';

    }



    cout << s << endl;

    return 0;

}


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

#include <string.h>

int main(){

	int swap;

	scanf("%d", &swap);

	char kata[10000];

	scanf("%s", kata);

	for(int i = 0; i < strlen(kata); i++){

		kata[i] += swap;

		if(kata[i] > 'Z'){

			kata[i] -= 26;

		}

	}

	for(int i = 0; i < strlen(kata); i++){

		printf("%c", kata[i]);

	}

	

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <bits/stdc++.h>

using namespace std;

int n,a;

string s;

char c;

int main()

{

    cin >> n >> s;

    for(int i=0;i<s.length();i++){

        if(static_cast<char>(s[i] + n)<'A'||static_cast<char>(s[i] + n)>'Z') cout << static_cast<char>(s[i] -26+ n);

       else cout << static_cast<char>(s[i] + n);

    }

    return 0;

}


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

#include <string.h>

 

int main (){

	int n;

	char str[100005];



	scanf("%d", &n);

	scanf("%s", str);

	

	int len = strlen(str);

	

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

		if (str[i] + n > 'Z'){

			str[i] -= 26- n;

		}

		else{

			str[i] += n;

		}

	}

	

	printf("%s", str);

	return 0;

}
// Slower C++ solution:
#include <iostream>



using namespace std;



int main(int argc, char const *argv[])

{

    int n;

    string s, s1 = "";

    cin >> n >> s;

    for (char i : s)

    {

        int p1, p2, t;

        t = n;

        p1 = (int)i;

        p2 = min(90, p1 + t);

        t -= (p2 - p1);

        if (t > 0)

            p2 = 65 + t - 1;

        s1.push_back((char(p2)));

    }

    cout << s1;

    return 0;

}


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

#include <string.h>

 

int main (){

	int n;

	char str[100005];



	scanf("%d", &n);

	scanf("%s", str);

	

	int len = strlen(str);

	

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

		if (str[i] + n > 'Z'){

			str[i] -= 26- n;

		}

		else{

			str[i] += n;

		}

	}

	

	printf("%s", str);

	return 0;

}
// Slower C++ solution:


#include<vector>

#include<iostream>



using namespace std;



int main(){

    int n; 

    cin>>n;

    string s;

    cin>>s;

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

    {

        int temp = s[i] - 65;

        temp = (temp + n ) %26;

        temp += 65;

        s[i] = temp;

    }

    cout<<s;





  



    return 0;

}

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

#include <string.h>

 

int main (){

	int n;

	char str[100005];



	scanf("%d", &n);

	scanf("%s", str);

	

	int len = strlen(str);

	

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

		if (str[i] + n > 'Z'){

			str[i] -= 26- n;

		}

		else{

			str[i] += n;

		}

	}

	

	printf("%s", str);

	return 0;

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



using namespace std;



int main(){

    string s,c;

    int n,i,j,k;

    cin>>n>>s;

    int len=s.size();

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

        if(s[i]+n>'Z'){cout<<char(s[i]+n-26);}

        else {cout<<char(s[i]+n);}

    }



    return 0;

}


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

#include <string.h>

 

int main (){

	int n;

	char str[100005];



	scanf("%d", &n);

	scanf("%s", str);

	

	int len = strlen(str);

	

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

		if (str[i] + n > 'Z'){

			str[i] -= 26- n;

		}

		else{

			str[i] += n;

		}

	}

	

	printf("%s", str);

	return 0;

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

using namespace std;

int main(){



    int n;

    cin >> n;



    string s;

    cin >> s;



    for(int i=0;i<s.length();i++){

        s[i] = (s[i] - 'A' + n) % 26 + 'A';

    }



    cout << s << endl;

    return 0;

}


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

#include <string.h>

 

int main (){

	int n;

	char str[100005];



	scanf("%d", &n);

	scanf("%s", str);

	

	int len = strlen(str);

	

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

		if (str[i] + n > 'Z'){

			str[i] -= 26- n;

		}

		else{

			str[i] += n;

		}

	}

	

	printf("%s", str);

	return 0;

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

#define NMAX 200000

#define RMAX 1000000000

int main()

{

	int a[NMAX] = {0};

	int n = 0;

	scanf("%d", &n);

	int maxv = 0;

	int minv = 0;

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

	{

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

	}

	minv = a[0];

	maxv = a[1] - a[0];

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

	{

		maxv = (maxv > a[i] - minv)?maxv:(a[i] - minv);

		minv = (minv < a[i])?minv:a[i];

	}

	printf("%d\n", maxv);

	return 0;

}


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

#define NMAX 200000

#define RMAX 1000000000

int main()

{

	int a[NMAX] = {0};

	int temp = 0;

	int n = 0;

	scanf("%d", &n);

	int maxv = 0;

	int minv = 0;

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

	{

		scanf("%d", &temp);

		if(i == 0)

		{

			minv = temp;

		}

		else if(i == 1)

		{

			maxv = temp - minv;

			minv = (minv < temp)?minv:temp;

		}

		else

		{

			maxv = (maxv > temp - minv)?maxv:(temp-minv);

			minv = (minv < temp)?minv:temp;

		}

	}

	printf("%d\n", maxv);

	return 0;

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

#include <algorithm>

using namespace std;



int main()

{

    long int arr[200010]={0};

    long int arrmin;

    long int dmax;

    int n=0;

    scanf("%d",&n);

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

        scanf("%ld",&arr[i]);

        if(i==0){

            arrmin=arr[0];

            continue;

        } 

        if(i==1) dmax=arr[1]-arr[0];

        if(arr[i-1]<=arr[i]){

            dmax=max(arr[i]-arrmin,dmax);

        }else{

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

        }        

    } 

    printf("%ld\n",dmax);





    return 0;

}


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

#include <algorithm>

using namespace std;



int main()

{

    int minv;

    int dmax=-2000000000;

    int var;

    int n;

    scanf("%d",&n);

    scanf("%d",&minv);

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

        scanf("%d",&var);

        dmax=max(var-minv,dmax);

        minv=min(var,minv);

    } 

    printf("%d\n",dmax);





    return 0;

}
// Slower C++ solution:
#include<iostream>

#include<algorithm>

const int MAX = 200005;

using namespace std;

int main()

{

    int a[MAX];

    int n;

    cin>>n;

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

    {

        cin>>a[i];

    }

    int maxv = a[1]-a[0];

    int mina = a[0];

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

    {

        maxv = max(maxv,a[i]-mina);

        mina = min(a[i],mina);

    }

    cout<<maxv<<endl;

    return 0;

}

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

#include<algorithm>

using namespace std;

const int MAX=200001;

int a[MAX];

int main()

{



  int n;

  scanf("%d",&n);

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

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

    int maxv=-2000000000;

    int minv=a[0];

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

    {

        maxv=max(maxv,a[i]-minv);

        minv=min(minv,a[i]);

    }

    printf("%d\n",maxv);

    return 0;



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

#include<string.h>

#include<iostream>

#include<algorithm>

#define maxn 200010

int a[maxn];

using namespace std;



int main()

{

    int n,k,mavx=-2000000000,mivn;

    scanf("%d",&n);

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

    {

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

    }



    mivn=a[1];



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

    {

        mavx=max(a[i]-mivn,mavx);

        mivn=min(a[i],mivn);

    }



    printf("%d\n",mavx);

    return 0;

    }

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

#include<algorithm>

using namespace std;

const int MAX=200001;

int a[MAX];

int main()

{



  int n;

  scanf("%d",&n);

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

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

    int maxv=-2000000000;

    int minv=a[0];

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

    {

        maxv=max(maxv,a[i]-minv);

        minv=min(minv,a[i]);

    }

    printf("%d\n",maxv);

    return 0;



}
// Slower C++ solution:
#include <iostream>

#include <algorithm>



using namespace std;



int main() {

  int n, R[200000 + 5];

  cin >> n;

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

    cin >> R[i];

  }

  int ans = R[1] - R[0];

  int minv = min(R[0], R[1]);

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

    ans = max(ans, R[i] - minv);

    minv = min(minv, R[i]);

  }

  cout << ans << endl;

  return 0;

}

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

#include<algorithm>

using namespace std;

const int MAX=200001;

int a[MAX];

int main()

{



  int n;

  scanf("%d",&n);

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

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

    int maxv=-2000000000;

    int minv=a[0];

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

    {

        maxv=max(maxv,a[i]-minv);

        minv=min(minv,a[i]);

    }

    printf("%d\n",maxv);

    return 0;



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

using namespace std;

const int INF = 0x3f3f3f3f;

int main()

{

	int n,num;

	while(~scanf("%d",&n)) {

		scanf("%d",&num);

		int maxx=-INF,minn=num;

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

			scanf("%d",&num);

			maxx=max(maxx,num-minn);

			minn=min(minn,num);

		}

		printf("%d\n",maxx);

	}	

 	return 0;

}

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

#include<algorithm>

using namespace std;

const int MAX=200001;

int a[MAX];

int main()

{



  int n;

  scanf("%d",&n);

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

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

    int maxv=-2000000000;

    int minv=a[0];

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

    {

        maxv=max(maxv,a[i]-minv);

        minv=min(minv,a[i]);

    }

    printf("%d\n",maxv);

    return 0;



}
// Slower C++ solution:
#include<string>

#include<cctype>

#include<iostream>

#include<cstdio>

#include<cmath>

#include<queue>

using namespace std;

#define inf 0x3f3f3f3f

const int maxn = 200000 + 8;



int a[maxn];

int n;



int main()

{

    scanf("%d",&n);

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

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

    }



    int minv = a[0];

    int maxv = -2000000000;

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

        maxv = max(maxv,a[i] - minv);

        minv = min(minv,a[i]);

    }

    printf("%d\n",maxv);

    return 0;

}

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

#include<algorithm>

using namespace std;

const int MAX=200001;

int a[MAX];

int main()

{



  int n;

  scanf("%d",&n);

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

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

    int maxv=-2000000000;

    int minv=a[0];

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

    {

        maxv=max(maxv,a[i]-minv);

        minv=min(minv,a[i]);

    }

    printf("%d\n",maxv);

    return 0;



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

using namespace std;



int main()

{

	int Min = INT_MAX;

	int Max = -INT_MAX;

	

	int n,temp;

	cin >> n;

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

	{

		cin >> temp;

		if(i != 1) Max = max(temp - Min, Max);

		Min = min(Min,temp);

	}

	

	cout << Max <<endl;

	return 0;

}

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

#include<algorithm>

using namespace std;

const int MAX=200001;

int a[MAX];

int main()

{



  int n;

  scanf("%d",&n);

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

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

    int maxv=-2000000000;

    int minv=a[0];

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

    {

        maxv=max(maxv,a[i]-minv);

        minv=min(minv,a[i]);

    }

    printf("%d\n",maxv);

    return 0;



}
// Slower C++ solution:
#include<cstdio>

#include<iostream>

using namespace std;

int sun[1000000];



int main()

{

	int n;

	scanf("%d",&n);

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

	{

		scanf("%d",&sun[i]);

	}int maxv=-2000000000;

	 int minv=sun[0];

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

	{

		maxv=max(maxv,sun[i]-minv);

		minv=min(minv,sun[i]);

	}

	printf("%d\n",maxv);

	return 0;

}

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

#include<algorithm>

using namespace std;

const int MAX=200001;

int a[MAX];

int main()

{



  int n;

  scanf("%d",&n);

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

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

    int maxv=-2000000000;

    int minv=a[0];

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

    {

        maxv=max(maxv,a[i]-minv);

        minv=min(minv,a[i]);

    }

    printf("%d\n",maxv);

    return 0;



}
// Slower C++ solution:
#include<iostream>

#include<cstdio>

#include<algorithm>

using namespace std;

int main()

{

    int a[220000];

    int n;

    cin>>n;

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

    {

        cin>>a[i];

    }

     int maxa=-9999999999;

     int maxq=a[0];

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

     {



        maxa=max(maxa,a[i]-maxq);

        maxq=min(maxq,a[i]);

     }

     cout<<maxa<<endl;

     return 0;

}

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

#include<algorithm>

using namespace std;

const int MAX=200001;

int a[MAX];

int main()

{



  int n;

  scanf("%d",&n);

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

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

    int maxv=-2000000000;

    int minv=a[0];

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

    {

        maxv=max(maxv,a[i]-minv);

        minv=min(minv,a[i]);

    }

    printf("%d\n",maxv);

    return 0;



}
// Slower C++ solution:
#include<iostream>

#include<algorithm>

const int MAX = 200005;

using namespace std;

int main()

{

    int a[MAX];

    int n;

    cin>>n;

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

    {

        cin>>a[i];

    }

    int maxv = a[1]-a[0];

    int mina = a[0];

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

    {

        maxv = max(maxv,a[i]-mina);

        mina = min(a[i],mina);

    }

    cout<<maxv<<endl;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.309464759382921x):
//#define LOCAL



#include <cstdio>

#include <algorithm>

using namespace std;



int main()

{

	#ifdef LOCAL

		freopen("E:\\Temp\\input.txt", "r", stdin);

		freopen("E:\\Temp\\output.txt", "w", stdout);

	#endif



	int a, b, n, minv, maxv = -2e9;

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

	--n; minv = b;

	while(n--) {

		scanf("%d", &a);

		maxv = max(maxv, a-minv);

		minv = min(minv, a);

		//printf("minv=%d, maxv=%d\n", minv, maxv);

	}



	printf("%d\n", maxv);



	return 0;

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

#include<string.h>

#include<iostream>

#include<algorithm>

#define maxn 200010

int a[maxn];

using namespace std;



int main()

{

    int n,k,mavx=-2000000000,mivn;

    scanf("%d",&n);

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

    {

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

    }



    mivn=a[1];



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

    {

        mavx=max(a[i]-mivn,mavx);

        mivn=min(a[i],mivn);

    }



    printf("%d\n",mavx);

    return 0;

    }

// Faster C++ solution for the same problem (measured speedup: 5.202832751124437x):
//#define LOCAL



#include <cstdio>

#include <algorithm>

using namespace std;



int main()

{

	#ifdef LOCAL

		freopen("E:\\Temp\\input.txt", "r", stdin);

		freopen("E:\\Temp\\output.txt", "w", stdout);

	#endif



	int a, b, n, minv, maxv = -2e9;

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

	--n; minv = b;

	while(n--) {

		scanf("%d", &a);

		maxv = max(maxv, a-minv);

		minv = min(minv, a);

		//printf("minv=%d, maxv=%d\n", minv, maxv);

	}



	printf("%d\n", maxv);



	return 0;

}