You are given a collection of N gems, each with a specific value and cost associated with it. Your task is to determine which gems to choose in order to maximize the expression ( X - Y ), where:
( X ) is the total value of the gems you choose.
( Y ) is the total cost of those gems.
Inputs
An integer ( N ) representing the number of gems (1 ≤ ( N ) ≤ 1000).
An array of integers ( V ) of size ( N ) representing the values of the gems, where ( V[i] ) is the value of the i-th gem (0 ≤ ( V[i] ) ≤ 1000).
An array of integers ( C ) of size ( N ) representing the costs of the gems, where ( C[i] ) is the cost of the i-th gem (0 ≤ ( C[i] ) ≤ 1000).
Output
A single integer representing the maximum possible value of ( X - Y ).
Examples
Example 1:
Input:
text
N = 3
V = [3, 5, 2]
C = [2, 3, 4]
Output:
text
3
Explanation: Choosing the first gem gives ( X - Y = 3 - 2 = 1 ). Choosing the second gem gives ( X - Y = 5 - 3 = 2 ). Choosing both yields ( X - Y = (3 + 5) - (2 + 3) = 8 - 5 = 3 ). No other combination yields a better result.
Example 2:
Input:
text
N = 2
V = [4, 7]
C = [5, 6]
Output:
text
1
Explanation: Choosing the first gem gives ( X - Y = 4 - 5 = -1 ). Choosing the second gives ( X - Y = 7 - 6 = 1 ). Thus, the maximum value is achieved by selecting the second gem.
Note
You may choose to select none of the gems, which would yield ( X - Y = 0 ).
Solution Placement
Please place your solution code inside the /app/ directory.
Important: place your implementation at /app/solution.py so the verifier can run it.