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

#define ll long long int

#define ff first

#define ss second

#define eps 1e-9



using namespace std;



int main()

{



    ll t,n,m,f,a,b,c,l,r,q,k,x,y,z,ans,mn,mx,sum=0;



    cin>>n;



    vector< pair<ll,ll> > arr(n);



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

    {

        cin>>arr[i].ff;

    }



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

    {

        cin>>arr[i].ss;

    }



    sort(arr.begin(),arr.end(),[](auto &a,auto &b)

         {

             return (a.ff-a.ss) > (b.ff-b.ss);

         });



         x=y=0;

         ans=0;

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

         {

             x+=arr[i].ff;

             y+=arr[i].ss;



             ans = max(ans,x-y);

         }



         cout<<ans<<endl;





}


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



#define endl '\n'



int main()

{

    int n, i, s=0;

    scanf("%d", &n);

    int a[n], b[n];



    for(i=0; i<n; i++) scanf("%d", &a[i]);



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

    {

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

        b[i]=a[i]-b[i];



        if(b[i]>0) s+=b[i];

    }



    printf("%d", s);



    return 0;

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

using namespace std;

int main()

{

    int n,v[60],c[60],r,ans=0;

    cin>>n;

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

    {

        cin>>v[i];

    }

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

    {

        cin>>c[i];

    }

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

    {

        r=v[i]-c[i];

        if(r>0)

        ans=ans+r;

    }

    cout<<ans<<endl;

    return 0;

}


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



#define endl '\n'



int main()

{

    int n, i, s=0;

    scanf("%d", &n);

    int a[n], b[n];



    for(i=0; i<n; i++) scanf("%d", &a[i]);



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

    {

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

        b[i]=a[i]-b[i];



        if(b[i]>0) s+=b[i];

    }



    printf("%d", s);



    return 0;

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

#define ull unsigned long long

#define ll long long

#define endl '\n'

#define pb push_back

#define mp make_pair

#define mod 1000000007

#define line cout<<"----------------------------------"<<endl

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

#define filein freopen("input.txt","r",stdin)

#define fileout freopen("output.txt","w",stdout)

using namespace std;

const ll mx=200009;

ll n; 

ll val[mx],cost[mx]; 

ll maxi=0; 

void call(ll ind, ll sum, ll c)

{

    if(ind==n) 

    {

        maxi=max(maxi,sum-c);

        return ; 

    }

    call(ind+1,sum+val[ind],c+cost[ind]);

    call(ind+1,sum,c);

}

int main()

{

    cin>>n; 

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

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

    call(0,0,0);

    cout<<maxi<<endl; 

}


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



#define endl '\n'



int main()

{

    int n, i, s=0;

    scanf("%d", &n);

    int a[n], b[n];



    for(i=0; i<n; i++) scanf("%d", &a[i]);



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

    {

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

        b[i]=a[i]-b[i];



        if(b[i]>0) s+=b[i];

    }



    printf("%d", s);



    return 0;

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

#include<sstream>

#include<cstdlib>

#include<cctype>

#include<cmath>

#include<algorithm>

#include<set>

#include<queue>

#include<stack>

#include<list>

#include<iostream>

#include<fstream>

#include<numeric>

#include<string>

#include<assert.h>

//#include<unordered_map>

//#include<unordered_set>

#include<vector>

#include<cstring>

#include<map>

#include<iterator>

#include <iomanip>

#include<bits/stdc++.h>



using namespace std;

#define lead_zero(x)    __builtin_clzll(x)

#define trail_zero(x)   __builtin_ctz(x)

#define total_1s(x)     __builtin_popcount(x)

#define ll long long int

#define pi 3.14159265358979323846

#define filein freopen("input.txt", "r", stdin)

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

#define maxx 1000000005

#define nullptr NULL



int main()

{

    ll t;





        int n;

        cin>>n;

        int v[n+5],c[n+5],sum=0;

        forn(i,n)

        {

            cin>>v[i];

        }

        forn(i,n)

        {

            cin>>c[i];

        }

        forn(i,n)

        {

            if((v[i]-c[i])>0)

                sum+=(v[i]-c[i]);

        }

        cout<<sum<<endl;





    return 0;



}


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



#define endl '\n'



int main()

{

    int n, i, s=0;

    scanf("%d", &n);

    int a[n], b[n];



    for(i=0; i<n; i++) scanf("%d", &a[i]);



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

    {

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

        b[i]=a[i]-b[i];



        if(b[i]>0) s+=b[i];

    }



    printf("%d", s);



    return 0;

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

using namespace std;

using ll = long long;



int main() {

  //ios_base::sync_with_stdio(false);

  //cin.tie(nullptr);

  int n;

  cin >> n;

  int v[n], c[n];

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

    cin >> v[i];

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

    cin >> c[i];

  int sum = 0;

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

    int diff = v[i] - c[i];

    if(diff>0)

      sum += diff;

  }

  cout << sum;

  return 0;

}

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



#define endl '\n'



int main()

{

    int n, i, s=0;

    scanf("%d", &n);

    int a[n], b[n];



    for(i=0; i<n; i++) scanf("%d", &a[i]);



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

    {

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

        b[i]=a[i]-b[i];



        if(b[i]>0) s+=b[i];

    }



    printf("%d", s);



    return 0;

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

#include<cstdlib>



using namespace std;



int main(){



    ios::sync_with_stdio(false);



    int n,*v,*c;

    int x=0,y=0;



    cin>>n;



    v = (int*) malloc(n*sizeof(int));

    c = (int*) malloc(n*sizeof(int));



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

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

        cin>>c[i];

        if(c[i]<v[i]){

            x+=v[i];

            y+=c[i];

        }

    }



    cout<<x-y<<endl;



    return 0;

}

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

#include <string.h>

#include <math.h>

int main ()

{

    int n, p=0;

    scanf ("%d", &n);

    int v[n], c[n];

    for (int i=0;i<n;i++) scanf ("%d", &v[i]);

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

        scanf ("%d", &c[j]);

        if (c[j]<=v[j]) p=p+v[j]-c[j];

    }

    if (p>0) printf ("%d", p);

    else printf ("0");

    return 0;

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



using namespace std;



int main(){

    int n, i, c;

    cin >> n;

    int v[n];

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

        cin >> v[i];

    }

    int dif=0;



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

        cin >> c;

        if(dif+v[i]-c > dif){

            dif+=v[i]-c;

        }

    }

    cout << dif << endl;



    return 0;

}




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

#include <string.h>

#include <math.h>

int main ()

{

    int n, p=0;

    scanf ("%d", &n);

    int v[n], c[n];

    for (int i=0;i<n;i++) scanf ("%d", &v[i]);

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

        scanf ("%d", &c[j]);

        if (c[j]<=v[j]) p=p+v[j]-c[j];

    }

    if (p>0) printf ("%d", p);

    else printf ("0");

    return 0;

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

using namespace std;

int main()

{

    int a,b,c,d,n,t,i,j,k,x,y,m,p,s,mx,mn;

    cin>>t;

    int ar[t],br[t],sum=0;

    for(p=0; p<t; p++)

    {

        cin>>ar[p];

    }

    for(p=0; p<t; p++)

    {

        cin>>br[p];

    }

    for(p=0;p<t;p++)

    {

        if(ar[p]>br[p])

        {

            sum=sum+(ar[p]-br[p]);

        }



    }

    cout<<sum<<endl;

}


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

#include <string.h>

#include <math.h>

int main ()

{

    int n, p=0;

    scanf ("%d", &n);

    int v[n], c[n];

    for (int i=0;i<n;i++) scanf ("%d", &v[i]);

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

        scanf ("%d", &c[j]);

        if (c[j]<=v[j]) p=p+v[j]-c[j];

    }

    if (p>0) printf ("%d", p);

    else printf ("0");

    return 0;

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

#include <cmath>

#include <vector>

#include <algorithm>

#include <string>

#include <set>

#include <map>

#include <list>

#include <time.h>

#include <math.h>

#include <random>

#include <deque>

#include <queue>

#include <cassert>

#include <unordered_map>

#include <unordered_set>

#include <iomanip>

#include <bitset>

#include <sstream>

#include <chrono>

#include <cstring>

#include<bits/stdc++.h>



using namespace std;



typedef long long ll;

typedef double db;



#define ft first

#define sd second

#define flag bool fl=true



#define mod 1000003

#define N 100001

#define MX 1000000001

#define MXX 1000000000000000001



#define pb push_back

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

#define T int t, qq=0; cin>>t; while(qq++<t)

#define fast ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)

#define scarr(array, size) for(int i=0;i<size;i++) cin>>array[i]



#define deg(rad) (rad*180.0)/pi

#define pi acos(-1)

#define log(n) (int)log2(n)

#define logg(a)(b) log(b)/log(a)





/*

//----------useful_functions----------



long long extended_euclid(ll a, ll b, ll &x, ll &y){//ax+by=c

    if(b==0)

    {

        x=1, y=0;

        return a;

    }



    ll x1, y1;

    ll d=extended_euclid(b, a%b, x1, y1);

    x=y1;

    y=x1-y1*(a/b);

    return d;

}

long long bigMod(ll a, ll b){//(a^b)%mod

    ll ans=1;

    while(b)

    {

        if(b%2==1) ans=(ans*a)%mod;

        a=(a*a)%mod;

        b/=2;

    }

    return ans%mod;

}

long long modInverse(ll a, ll b){//a*x=1 mod b

    ll x, y;

    ll gcd=extended_euclid(a, b, x, y);



    if(gcd==1) return ((x%b)+b)%b;

    else return 1;

}

long long nCr(ll n, ll r){//n<=1e6

    //declare globally-> ll fact[1000001];

    fact[1]=1;

    for(ll i=2;i<1000001;i++)

        fact[i]=(i*fact[i-1])%mod;



    return (fact[n]*modInverse(fact[r], mod)*modInverse(fact[n-r], mod))%mod;

}

long long josephus(ll n, ll k){//k'th person is killed out of n in the circle

    if(n==1) return 1;

    else return (josephus(n-1, k)+k-1)%n+1;

}

vector<int> sieve(ll n){//get primes up to n<=1e6 and the numbers can be handled up to 1e12

    bool fl[n+1];

    vector<int> primes;

    for(int i=0;i<=n;i++) fl[i]=false;



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

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

            fl[j]=true;



    primes.pb(2);

    for(int i=3;i<=n;i+=2) if(!fl[i]) primes.pb(i);

    return primes;

}



*/



int main()

{

    int n,ans=0;

    cin>>n;



    int a[n], b[n];

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

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



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

        ans+=max(0, a[i]-b[i]);

    cout<<ans;



//        cout<<"Case "<<qq<<": ";

}


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

#include <string.h>

#include <math.h>

int main ()

{

    int n, p=0;

    scanf ("%d", &n);

    int v[n], c[n];

    for (int i=0;i<n;i++) scanf ("%d", &v[i]);

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

        scanf ("%d", &c[j]);

        if (c[j]<=v[j]) p=p+v[j]-c[j];

    }

    if (p>0) printf ("%d", p);

    else printf ("0");

    return 0;

}
// Slower C++ solution:
//#pragma GCC         optimize("O3")

#include            <bits/stdc++.h>

#include            <ext/pb_ds/assoc_container.hpp>

#include            <ext/pb_ds/tree_policy.hpp>

#define FastIO      ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)

#define pb          push_back

#define mp          make_pair

#define mem(x,i)    memset(x,i,sizeof(x))

#define ff          first

#define ss          second

#define popcount(x) __builtin_popcount(x)

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

#define Case(t)     for(int ks=1;ks<=t;ks++)

#define fileout     freopen("output.txt","w",stdout)

#define filein      freopen("input.txt","r",stdin)

#define D(x)        cerr<< __LINE__ <<": "<< #x << " = "<<(x) <<'\n';

#define endl        '\n'



using namespace std;

using namespace __gnu_pbds;



using ll  = long long;

using ld  = long double;

using ull = unsigned long long;

using pii = pair<int,int>;

using pll = pair<ll,ll>;

using pil = pair<int,ll>;



const int INF    = 0x3f3f3f3f;

const ll LL_INF  = 0x3f3f3f3f3f3f3f3f;

const double PI  = acos(-1);

const double eps = 1e-4;

const int mod    = 1e9+7;

const int mx     = 5e5+5;

template <typename T>  using orderedSet =

    tree<T, null_type, less_equal<T>,

    rb_tree_tag, tree_order_statistics_node_update>;//find_by_order,order_of_key*/



/*------------------------------Graph Moves----------------------------*/

//const int fx[]= {+1,-1,+0,+0};

//const int fy[]= {+0,+0,+1,-1};

//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move

//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move

//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move

//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move

/*---------------------------------------------------------------------*/



//ll powmod(ll a,ll b){ll res=1;a%=mod;assert(b>=0);for(; b; b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

/*----------------------BitMask-----------------------------------------*/

//inline int setBit(int N,int pos){return N=N | (1<<pos);}

//inline int resetBit(int N,int pos){return N= N & ~(1<<pos);}

//inline bool checkBit(int N,int pos){return (bool) (N& (1<<pos));}



int main()

{

    int n;

    cin>>n;

    int a[n],b[n];

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

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

    int ans=0;

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

    {

        ans+=max(0,a[i]-b[i]);

    }

    cout<<ans<<endl;

}


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

#include <string.h>

#include <math.h>

int main ()

{

    int n, p=0;

    scanf ("%d", &n);

    int v[n], c[n];

    for (int i=0;i<n;i++) scanf ("%d", &v[i]);

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

        scanf ("%d", &c[j]);

        if (c[j]<=v[j]) p=p+v[j]-c[j];

    }

    if (p>0) printf ("%d", p);

    else printf ("0");

    return 0;

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

using namespace std;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#define REP(i,x) for(int i=0;i<(int)(x);i++)

#define REPS(i,x) for(int i=1;i<=(int)(x);i++)

#define mp(a,b) make_pair(a, b)

#define pb push_back

#define eb emplace_back

#define ll long long

int main() {

    int N;

    cin>>N;

    int ar[N];

    int ar2[N];

    REP(i,N)

    {

        cin>>ar[i];

    }

    REP(i,N)

    {

        cin>>ar2[i];

    }int c=0;

    REP(i,N)

    {

        if(ar[i]>ar2[i])

        c+=ar[i]-ar2[i];

    }

    cout<<c<<endl;

}

    

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

#include <string.h>

#include <math.h>

int main ()

{

    int n, p=0;

    scanf ("%d", &n);

    int v[n], c[n];

    for (int i=0;i<n;i++) scanf ("%d", &v[i]);

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

        scanf ("%d", &c[j]);

        if (c[j]<=v[j]) p=p+v[j]-c[j];

    }

    if (p>0) printf ("%d", p);

    else printf ("0");

    return 0;

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

using namespace std;

#define ll long long

#define inf 1e18

#define gap " "

#define pi 2 * acos (0.0)



int main()

{

    

    int n;

    cin>> n;

    int a[n],b[n];

    int s=0;

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

        cin>> a[i];

    }

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

        cin>> b[i];

    }

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

        if ((a[i]-b[i])>0) s=s+(a[i]-b[i]);

    }

    cout << s <<endl;



}


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

#include <string.h>

#include <math.h>

int main ()

{

    int n, p=0;

    scanf ("%d", &n);

    int v[n], c[n];

    for (int i=0;i<n;i++) scanf ("%d", &v[i]);

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

        scanf ("%d", &c[j]);

        if (c[j]<=v[j]) p=p+v[j]-c[j];

    }

    if (p>0) printf ("%d", p);

    else printf ("0");

    return 0;

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

#define ll long long int

using namespace std;



int main(void)

{

	ll n,s=0;

	cin>>n;

	ll c[n],v[n];

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

	{

		cin>>c[i];

	}

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

	{

		cin>>v[i];

	}

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

	{

		if(c[i]-v[i]>0)

		{

			s+=(c[i]-v[i]);

		}

	}

	cout<<s<<endl;

}

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

#include <string.h>

#include <math.h>

int main ()

{

    int n, p=0;

    scanf ("%d", &n);

    int v[n], c[n];

    for (int i=0;i<n;i++) scanf ("%d", &v[i]);

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

        scanf ("%d", &c[j]);

        if (c[j]<=v[j]) p=p+v[j]-c[j];

    }

    if (p>0) printf ("%d", p);

    else printf ("0");

    return 0;

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

using namespace std;



const int N = 22;



int main() {

    int n;

    array<int, N> v, c;



    cin >> n;

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

        cin >> v[i];

    }

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

        cin >> c[i];

    }



    int ans = INT_MIN;

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

        int cur_v = 0, cur_c = 0;

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

            if (i & (1 << j)) {

                cur_v += v[j];

                cur_c += c[j];

            }

        }

        ans = max(ans, cur_v - cur_c);

    }



    cout << ans << endl;

}




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

#include <string.h>

#include <math.h>

int main ()

{

    int n, p=0;

    scanf ("%d", &n);

    int v[n], c[n];

    for (int i=0;i<n;i++) scanf ("%d", &v[i]);

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

        scanf ("%d", &c[j]);

        if (c[j]<=v[j]) p=p+v[j]-c[j];

    }

    if (p>0) printf ("%d", p);

    else printf ("0");

    return 0;

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

#include<cmath>

#include<cstring>

#define pb              push_back

#define pi              acos(-1.0)

#define loop(i,a,n)     for(int i=a;i<n;i++)

#define rloop(i,n,a)    for(int i=n;i>=a;i--)

#define ll              long long int

#define ff              first

#define ss              second

#define pii             pair<ll,ll>

#define sc1(a)          scanf("%d",&a)

#define sc2(a,b)        scanf("%d %d",&a,&b)

#define sc3(a,b,c)      scanf("%d %d %d",&a,&b,&c)

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

#define ms(a,b)         memset(a,b,sizeof a)

#define FastIO          ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)

#define fileout         freopen("output.txt","w",stdout)

#define filein          freopen("input.txt","r",stdin)

#define inf             2e9+5

#define Q               int q;cin>>q;while(q--)

#define check           cout<<"HI"<<endl;



//int x[]= {-1,0,0,1};

//int y[]= {0,-1,1,0};



using namespace std;



int main()

{

        int n,m=0;

        cin >> n;



        int a[n+5];

        int b[n+5];



        loop(i,0,n)cin>> a[i];

        loop(i,0,n)cin>> b[i];



        loop(i,0,n) if((a[i]-b[i])>0)m+=a[i]-b[i];

        cout<<m<<endl;

    }


























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

#include <string.h>

#include <math.h>

int main ()

{

    int n, p=0;

    scanf ("%d", &n);

    int v[n], c[n];

    for (int i=0;i<n;i++) scanf ("%d", &v[i]);

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

        scanf ("%d", &c[j]);

        if (c[j]<=v[j]) p=p+v[j]-c[j];

    }

    if (p>0) printf ("%d", p);

    else printf ("0");

    return 0;

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

using namespace std;

int main()

{

    int n;

    cin>>n;

    vector<int>v(n+2),c(n+2),d(n+2);

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

    {

        cin>>v[i];

    }

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

    {

        cin>>c[i];

    }

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

    {

        d[i]=v[i]-c[i];

    }

    long long ans=0;

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

    {

        if(d[i]>0)

            ans+=d[i];

    }

    cout<<ans<<endl;

}


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

#include <string.h>

#include <math.h>

int main ()

{

    int n, p=0;

    scanf ("%d", &n);

    int v[n], c[n];

    for (int i=0;i<n;i++) scanf ("%d", &v[i]);

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

        scanf ("%d", &c[j]);

        if (c[j]<=v[j]) p=p+v[j]-c[j];

    }

    if (p>0) printf ("%d", p);

    else printf ("0");

    return 0;

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

using namespace std;



int V[40];

int C[40];



int main()

{

	int n,x,i,j,y,z;

	cin>>n;

	int ans = 0;

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

		cin>>V[i];

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

		cin>>C[i];

	

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



		ans += max(0,V[i]-C[i]);

	}

	cout<<ans;

}

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

#include <string.h>

#include <math.h>

int main ()

{

    int n, p=0;

    scanf ("%d", &n);

    int v[n], c[n];

    for (int i=0;i<n;i++) scanf ("%d", &v[i]);

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

        scanf ("%d", &c[j]);

        if (c[j]<=v[j]) p=p+v[j]-c[j];

    }

    if (p>0) printf ("%d", p);

    else printf ("0");

    return 0;

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

#include <climits>

#include <cmath>

#include <iomanip>

#include <iostream>

#include <list>

#include <map>

#include <set>

#include <sstream>

#include <string>

#include <vector>



#define endl '\n'

#define ull unsigned long long

#define ll long long

#define ul unsigned long

#define ld long double

#define PI 3.14159265359



using namespace std;



int main() {

	ios_base::sync_with_stdio(false);

	cin.tie(nullptr);

	cout.tie(nullptr);

	int t = 1;

	// cin >> t;

	while (t--) {

		int n;

		cin >> n;

		vector<int> v(n), c(n);

		for (auto &i : v) {

			cin >> i;

		}

		for (auto &i : c) {

			cin >> i;

		}

		int m = INT_MIN;

		int s = 0;

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

			if (v[i] > c[i])

				s += v[i] - c[i];

			m = max(m, s);

		}

		cout << m;

	}

}

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

#include <string.h>

#include <math.h>

int main ()

{

    int n, p=0;

    scanf ("%d", &n);

    int v[n], c[n];

    for (int i=0;i<n;i++) scanf ("%d", &v[i]);

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

        scanf ("%d", &c[j]);

        if (c[j]<=v[j]) p=p+v[j]-c[j];

    }

    if (p>0) printf ("%d", p);

    else printf ("0");

    return 0;

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

#include<bits/stdc++.h>



using namespace std;



int main()

{

    int n,sum=0,i;

    cin >> n;

    int arr1[n];

    int arr2[n];

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

        cin >> arr1[i];

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

        cin >> arr2[i];

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

    {

        if(arr1[i]>arr2[i])

        {

            sum+=arr1[i]-arr2[i];

        }

    }

    cout << sum;



}


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

#include <string.h>

#include <math.h>

int main ()

{

    int n, p=0;

    scanf ("%d", &n);

    int v[n], c[n];

    for (int i=0;i<n;i++) scanf ("%d", &v[i]);

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

        scanf ("%d", &c[j]);

        if (c[j]<=v[j]) p=p+v[j]-c[j];

    }

    if (p>0) printf ("%d", p);

    else printf ("0");

    return 0;

}