Source Code
#include<iostream>
#include<algorithm>

using namespace std;

int main() {

    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int TC; cin >> TC;
    while(TC--) {

        int n; cin >> n;

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

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

            int b; cin >> b;
            if(b > arr[i]) mx = max(mx, b - arr[i]);

        }

        cout << mx << "\n";

    }

    return 0;

}
Copy
Garden Walls MahmoudKhalid
GNU G++17
70 ms
1.1 MB
Accepted