Source Code
#define ll long long
#define fr first
#define sc second
#define pb(x) push_back(x)
#define nxt continue
#define sz size()
#define umap unordered_map
#define uset unordered_set
#define cnt1bits(x) __builtin_popcountll(x)
#define gg(x) x.begin(), x.end()
#define MAX LONG_LONG_MAX
#define MIN LONG_LONG_MIN
 
#include <bits/stdc++.h>
using namespace std;
 
const ll MOD = 1e9 + 7;
 
void init() {
  #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
  #endif
 
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
}

int main() {
  init();

  ll n, ans = 0, x, i;

  cin >> n;

  vector<ll> a(n);

  for (ll& e : a)
    cin >> e;

  for (i = 0; i < n; ++i) {
    cin >> x;

    ans += a[i] - x;
  }

  cout << ans;

  return 0;
}
Copy
A Game of Darts Nedal
GNU G++17
38 ms
1.1 MB
Accepted