Source Code
#include <iostream>
#include<bits/stdc++.h>
#include <cmath>
#include <string>
#include <algorithm>
#define sareeeee3 ios_base::sync_with_stdio(false);cout.tie(NULL);cin.tie(NULL);
using namespace std;
using veci=vector<int>;
using vecl=vector<long long>;
#define ll long long
/*
ll kwys(ll k){

}
*/




void result()
{
    ll n;
    cin>>n;
    int a[n];
    int b[n];
    for (int i = 0; i <n ; ++i) {
        cin>>a[i];
    }
    for (int i = 0; i <n ; ++i) {
        cin>>b[i];
    }
    ll maxx{};
    ll x{};
    for (int i = 0; i <n ; ++i) {
        if(a[i]<b[i]){
            x=b[i]-a[i];
            if(x>maxx){
                maxx=x;
            }
        }
    }
    cout<<maxx;


}

int main ()
{
    int t=1;
    cin>>t;
    sareeeee3

#ifndef ONLINE_JUDGE
   // freopen("tests.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif

    while (t--)
    {
        result();
        cout<<"\n";
    }

}
Copy
Garden Walls Mostafa_Fouad
GNU G++17
73 ms
1.9 MB
Accepted