Source Code
#include<iostream>
using namespace std;

int main() {

	int iterations, size;
	int diff;
	int* a;
	int* b;
	cin >> iterations;
	for (int i = 0; i < iterations; i++) {
		diff = 0;
		cin >> size;
		a = new int[size];
		b = new int[size];
		for (int j = 0; j < 2; j++) {
			for (int k = 0; k < size; k++) {
				if (j == 0) {
					cin >> a[k];
				}
				else {
					cin >> b[k];
					if (a[k]-b[k] < diff) {
						diff = a[k] - b[k];
					}
				}
			}
		}
		cout << diff * -1 << endl;
		delete[] a;
		delete[] b;
	}

	return 0;
}
Copy
Garden Walls MarwanMoraly
GNU G++17
104 ms
2.5 MB
Accepted