stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include<iostream>

#include<algorithm>

#include<string>

#include<cstring>

using namespace std;



int main()

{

	int n, i,j,temp,way[101];

	cin >> n;

	int f[101][10];

	long long p[101][11],ans,re;

	for (i = 0; i < n; i++)

		for (j = 0; j < 10; j++)

			cin >> f[i][j];

	for (i = 0; i < n; i++)

		for (j = 0; j < 11; j++)

			cin >> p[i][j];

	for (int t = 1023; t ; t--)

	{

		re = 0;

		temp = t;

		memset(way, 0, sizeof(way));

		for (i = 0; i < 10; i++)

		{

			if (temp & 1)

			{

				for (j = 0; j < n; j++)

				{

					if (f[j][i])

						way[j]+=1;

				}

			}

			temp>>=1;

		}

		for (i = 0; i < n; i++)

			re += p[i][way[i]];

		if (t == 1023)

			ans = re;

		else

			if (re > ans)

				ans = re;

	}

	cout << ans << endl;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>

#include <stdlib.h>



int main()

{

    int num;

    int t[100][10];

    scanf("%d",&num);

    int i;

    int p[100][11];

    for(i=0;i<num;i++)

    {

        scanf("%d %d %d %d %d %d %d %d %d %d ",&t[i][0],&t[i][1],&t[i][2],&t[i][3],&t[i][4],&t[i][5],&t[i][6],&t[i][7],&t[i][8],&t[i][9]);

    }

    for(i=0;i<num;i++)

    {

        scanf("%d %d %d %d %d %d %d %d %d %d %d",&p[i][0],&p[i][1],&p[i][2],&p[i][3],&p[i][4],&p[i][5],&p[i][6],&p[i][7],&p[i][8],&p[i][9],&p[i][10]);

    }

    int count,count1;

    int max,sum;

    int a[10];

    for(count1=1;count1<1024;count1++)

    {

        count=count1;

        int j;

        for(j=0;j<10;j++)

        {

            a[j]=count%2;

            count=count>>1;

        }

        int n;

        for(n=0;n<num;n++)

        {

            int m;

            int count2=0;

            for(m=0;m<10;m++)

            if((t[n][m]==1)&&(a[m]==1))

            {

                count2++;

            }

                if(n==0)

                    sum=p[n][count2];

                else

                    sum+=p[n][count2];

        }

        if(count1==1)

            max=sum;

        if(max<sum)

                max=sum;

    }

    printf("%d",max);



    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <iomanip>

#include <algorithm>

#include <vector>

#include <string>

#include <map>

#include <math.h>

#include <set>

using namespace std;



int n;

int P[110][11];

int F[110][11];

int ans = -1000000000;



void DFS(int x, string s){

    if(s.size() == 11){

        if(s == "00000000000"){

            return;

        }

        int cnt[110] = {0};

        for (int i = 1; i <= 10; i++) {

            for (int j = 1; j <= n; j++) {

                if(s[i] == '1' && F[j][i] == 1) cnt[j]++;

            }

        }

        int profit = 0;

        for (int i = 1; i <= n; i++) {

            profit += P[i][cnt[i]];

        }

        ans = max(ans, profit);

        return;

    }

    string tmp = s;

    tmp.push_back('0');

    DFS(x+1, tmp);

    tmp = s;

    tmp.push_back('1');

    DFS(x+1, tmp);

}



int main(){

    cin >> n;

    for (int i = 1; i <= n; i++) {

        for (int j = 1; j <= 10; j++) {

            cin >> F[i][j];

        }

    }

    for (int i = 1; i <= n; i++) {

        for (int j = 0; j <= 10; j++) {

            cin >> P[i][j];

        }

    }



    DFS(0,"0");



    cout << ans << endl;

}


// Optimized solution to the same problem (faster):
#include <iostream>

#include <iomanip>

#include <algorithm>

#include <vector>

#include <string>

#include <map>

#include <math.h>

using namespace std;



int n;

int P[110][11];

int F[110][11];

int ans = -(1<<30);



int main(){

    cin >> n;

    for (int i = 0; i < n; i++) for (int j = 0; j < 10; j++) cin >> F[i][j];

    for (int i = 0; i < n; i++) for (int j = 0; j <= 10; j++)cin >> P[i][j];

    for (int b = 1; b < 1<<10; b++) {

        int profit = 0;

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

            int cnt = 0;

            for (int j = 0; j < 10; j++) {

                if(b>>j&F[i][j]) cnt++;

            }

            profit += P[i][cnt];

        }

        ans = max(ans, profit);

    }

    cout << ans << endl;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

/* typedef */

typedef long long ll;

typedef pair<int, int> pii;

/* constant */

const int INF = 1 << 30;

const ll LINF = 1LL << 50;

const int NIL = -1;

const int MAX = 10000;

const int mod = 1000000007;

const double pi = 3.141592653589;

/* global variables */

/* function */

/* main */

int main(){

    int N; cin >> N;



    vector<int> v(N);

    vector<vector<int> > p(N, vector<int>(11));

    int a;

    for (int i = 0; i < N; i++) {

        int tmp = 0;

        for (int j = 0; j < 10; j++) {

            cin >> a; tmp += a * (1 << j);

        }

        v[i] = tmp;

    }

    for (int i = 0; i < N; i++) for (int j = 0; j < 11; j++) cin >> p[i][j];



    int ans = -INF;

    for (int b = 1; b < (1 << 10); b++) {

        int tmp = 0;

        for (int i = 0; i < N; i++) {

            int cnt = 0, c = b & v[i];

            for (int j = 0; j < 10; j++) { if (c & (1 << j)) cnt++; }

            tmp += p[i][cnt];

        }

        ans = max(tmp, ans);

    }

    cout << ans << '\n';

}


// Optimized solution to the same problem (faster):
#include <cstdio>

int N;

int F[100][14];

int P[100][15];

int main() {

    scanf("%d", &N);

    for (int i = 0; i < N; i++) {

        for (int j = 0; j < 10; j++) scanf("%d", &F[i][j]);

    }

    for (int i = 0; i < N; i++) {

        for (int j = 0; j < 11; j++) scanf("%d", &P[i][j]);

    }

    int res = -(1<<30);

    for (int b = 1; b < (1 << 10); b++) {

        int cc = 0;

        for (int i = 0; i < N; i++) {

            int c = 0;

            for (int j = 0; j < 10; j ++) {

                if ((b>>j & 1) and F[i][j]) c++;

            }

            cc += P[i][c];

        }

        if (res < cc ) res = cc;

    }

    printf("%d\n", res);

}




// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<string>

#include<vector>

#include<algorithm>

#include<map>

#include<set>

#include<cstdio>

#include<cmath>

#include<numeric>

#include<queue>

#include<stack>

#define repp(i,a,b) for(int i=(int)a;i<(int)b;++i)

#define repm(i,a,b) for(int i=(int)a;i>(int)b;--i)

using ll=long long;

static const ll mod = 1e9 + 7;

static const ll INF = 1LL << 50;

using namespace std;



int main() {

	int n;

	cin >> n;

	ll maxv = -1000000005;

	vector<vector<int>>f(n, vector<int>(10, 0)), p(n, vector<int>(11));

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

		for (int j = 0; j < 10; ++j)cin >> f[i][j];

	}

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

		for (int j = 0; j < 11; ++j)cin >> p[i][j];

	}

	for (int bit = 1; bit < (1 << 10); ++bit) {

		vector<int>count(n, 0);

		ll sum = 0;

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

			for (int j = 0; j < 10; ++j) {

				if ((bit&1<<j) && f[i][j]==1)++count[i];

			}

			sum += p[i][count[i]];

		}

		maxv = max(maxv, sum);

	}

	cout << maxv << endl; return 0;

}

// Optimized solution to the same problem (faster):
#include<iostream>

#include<string>

#include<vector>

#include<algorithm>

#include<map>

#include<set>

#include<cstdio>

#include<cmath>

#include<deque>

#include<numeric>

#include<queue>

#include<stack>

#include<cstring>

#include<limits>

#include<functional>

#include<unordered_set>

#include<iomanip>

#include<cassert>

#include<regex>

#include<bitset>

#include<complex>

#include<chrono>

#include<random>

#define rep(i,a) for(int i=(int)0;i<(int)a;++i)

#define pb push_back

#define eb emplace_back

#define all(x) x.begin(),x.end()

using ll=long long;

constexpr ll mod = 1e9 + 7;

constexpr ll INF = 1LL << 60;



ll gcd(ll n, ll m) {

	ll tmp;

	while (m!=0) {

		tmp = n % m;

		n = m;

		m = tmp;

	}

	return n;

}



ll lcm(ll n, ll m) {

	return abs(n * m) / gcd(n, m);//gl=xy

}

 

template<class T> inline bool chmin(T& a, T b) {

    if (a > b) {

        a = b;

        return true;

    }

    return false;

}

template<class T> inline bool chmax(T& a, T b) {

    if (a < b) {

        a = b;

        return true;

    }

    return false;

}

 

using namespace std;

//ここから



ll f[105][10];

ll p[105][11];

void solve(){

  int n;

  cin>>n;

  ll ans=-INF;

  rep(i,n){

    rep(j,10)cin>>f[i][j];

  }

  rep(i,n)rep(j,11)cin>>p[i][j];

  for(int bit=0;bit<(1<<10);++bit){

    ll sum=0;

    if(bit==0)continue;

    rep(i,n){

      ll cnt=0;

      rep(j,10){

        if(bit&(f[i][j]<<j))++cnt;

      }

      sum+=p[i][cnt];

    }

    chmax(ans,sum);

  }

  cout<<ans;

}



int main(){

	ios::sync_with_stdio(false);

  cin.tie(0);

	cout<<fixed<<setprecision(15);

  solve();

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <cstdio>

#include <algorithm>

#define INF -1000000001

using namespace std;

int N, F[100][5][2], P[100][11], s[10] = {0};

int rec(int p) {

  if(p > 10) {

    int sum = 0, m[100] = {0};

    for(int i = 0; i < N; i++) {

      for(int j = 0; j < 10; j++) {

        if(!s[j]) continue;

        m[i] += F[i][j/2][j%2];

      }

      sum += P[i][m[i]];

    }

    int t = 0;

    for(int i = 0; i < 10; i++) t += s[i];

    if(!t) return INF;

    return sum;

  }

  s[p] = 0; int sum0 = rec(p+1);

  s[p] = 1; int sum1 = rec(p+1);

  return max(sum0, sum1);

}

int main() {

  scanf("%d", &N);

  for(int i = 0; i < N; i++) {

    for(int j = 0; j < 10; j++) scanf("%d", &F[i][j/2][j%2]);

  }

  for(int i = 0; i < N; i++) {

    for(int j = 0; j < 11; j++) scanf("%d", &P[i][j]);

  }

  printf("%d", rec(0));

}

// Optimized solution to the same problem (faster):
#include <cstdio>

#include <algorithm>

#define INF -1000000001

using namespace std;

int N, F[100][10], P[100][11], s[10] = {0};

int dfs(int dpt, int cnt) {

  if(dpt > 9) {

    if(!cnt) return INF;

    int sum = 0, m[100] = {0};

    for(int i = 0; i < N; i++) {

      for(int j = 0; j < 10; j++) {

        if(!s[j]) continue;

        m[i] += F[i][j];

      }

      sum += P[i][m[i]];

    }

    return sum;

  }

  s[dpt] = 0; int sum0 = dfs(dpt+1, cnt);

  s[dpt] = 1; int sum1 = dfs(dpt+1, cnt+1);

  return max(sum0, sum1);

}

int main() {

  scanf("%d", &N);

  for(int i = 0; i < N; i++) {

    for(int j = 0; j < 10; j++) scanf("%d", &F[i][j]);

  }

  for(int i = 0; i < N; i++) {

    for(int j = 0; j < 11; j++) scanf("%d", &P[i][j]);

  }

  printf("%d", dfs(0, 0));

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

 

int main() {

  int n,cost,rpta=0; cin >> n;

  vector<int> num(n);

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

    cin>>num[i];}

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

    cin>>cost;

    if(num[i]-cost>0)

      rpta+=num[i]-cost;}

  cout<<rpta;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



#define endl '\n'



int main()

{

    int n, i, s=0;

    scanf("%d", &n);

    int a[n], b[n];



    for(i=0; i<n; i++) scanf("%d", &a[i]);



    for(i=0; i<n; i++)

    {

        scanf("%d", &b[i]);

        b[i]=a[i]-b[i];



        if(b[i]>0) s+=b[i];

    }



    printf("%d", s);



    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

int main() {

	int n,val,sum=0;

	vector<int> v;

	vector<int> c;

	cin>>n;

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

		cin>>val;

		v.push_back(val);

	}

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

		cin>>val;

		c.push_back(val);

	}

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

		v[i]-=c[i];

	}

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

		if(v[i]>0) sum+=v[i];

	}

	cout<<sum<<endl;

	return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



#define endl '\n'



int main()

{

    int n, i, s=0;

    scanf("%d", &n);

    int a[n], b[n];



    for(i=0; i<n; i++) scanf("%d", &a[i]);



    for(i=0; i<n; i++)

    {

        scanf("%d", &b[i]);

        b[i]=a[i]-b[i];



        if(b[i]>0) s+=b[i];

    }



    printf("%d", s);



    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <vector>

using namespace std;



int HOST[20];



int DP(vector <int> V, int n){

  if (n < 0)

    return 0;

  if (!HOST[n])

    HOST[n] = max(V[n] + DP(V,n-1), DP(V,n-1));

  return HOST[n];

}



int main() {

  ios_base::sync_with_stdio(false);



  int n, x, y, i;

  cin >> n;

  vector <int> V (n);

  for (i = 0; i < n; i++)

    cin >> V[i];

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

    cin >> x;

    V[i] -= x;

  }

  

  cout << DP(V, n-1) << endl;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



#define endl '\n'



int main()

{

    int n, i, s=0;

    scanf("%d", &n);

    int a[n], b[n];



    for(i=0; i<n; i++) scanf("%d", &a[i]);



    for(i=0; i<n; i++)

    {

        scanf("%d", &b[i]);

        b[i]=a[i]-b[i];



        if(b[i]>0) s+=b[i];

    }



    printf("%d", s);



    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

     

#define all(A) begin(A), end(A)

#define rall(A) rbegin(A), rend(A)

#define sz(A) int(A.size())

#define pb push_back

#define mp make_pair

     

using namespace std;

     

typedef long long ll;

typedef pair <int, int> pii;

typedef vector <int> vi;

typedef vector <ll> vll;



int n;

vi v, c;



int backtrack (int pos, int x, int y) {

  if (pos == n) return x - y;

  return max(backtrack(pos + 1, x + v[pos], y + c[pos]), backtrack(pos + 1, x, y));

}



int main () {

  ios::sync_with_stdio(false); cin.tie(0);

  cin >> n;

  v.resize(n);

  c.resize(n);

  for (int& elem: v) cin >> elem;

  for (int& elem: c) cin >> elem;

  cout << backtrack(0, 0, 0) << '\n';

  return (0);

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



#define endl '\n'



int main()

{

    int n, i, s=0;

    scanf("%d", &n);

    int a[n], b[n];



    for(i=0; i<n; i++) scanf("%d", &a[i]);



    for(i=0; i<n; i++)

    {

        scanf("%d", &b[i]);

        b[i]=a[i]-b[i];



        if(b[i]>0) s+=b[i];

    }



    printf("%d", s);



    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int main(){

	long long n1,suma1=0,y1;

	cin>>n1;

	y1=n1*2;

	long long c1[y1];

	for(int i=0;i<y1;i++){

		cin>>c1[i];

		}

	for(int i=0;i<n1;i++){

		if(c1[i]-c1[i+n1]>0){

			suma1=suma1+(c1[i]-c1[i+n1]);

		}

	}

	cout<<suma1;

	return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



#define endl '\n'



int main()

{

    int n, i, s=0;

    scanf("%d", &n);

    int a[n], b[n];



    for(i=0; i<n; i++) scanf("%d", &a[i]);



    for(i=0; i<n; i++)

    {

        scanf("%d", &b[i]);

        b[i]=a[i]-b[i];



        if(b[i]>0) s+=b[i];

    }



    printf("%d", s);



    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

#define ll long long int

#define ff first

#define ss second

#define eps 1e-9



using namespace std;



int main()

{



    ll t,n,m,f,a,b,c,l,r,q,k,x,y,z,ans,mn,mx,sum=0;



    cin>>n;



    vector< pair<ll,ll> > arr(n);



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

    {

        cin>>arr[i].ff;

    }



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

    {

        cin>>arr[i].ss;

    }



    sort(arr.begin(),arr.end(),[](auto &a,auto &b)

         {

             return (a.ff-a.ss) > (b.ff-b.ss);

         });



         x=y=0;

         ans=0;

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

         {

             x+=arr[i].ff;

             y+=arr[i].ss;



             ans = max(ans,x-y);

         }



         cout<<ans<<endl;





}


// Optimized solution to the same problem (faster):
#include <stdio.h>



#define endl '\n'



int main()

{

    int n, i, s=0;

    scanf("%d", &n);

    int a[n], b[n];



    for(i=0; i<n; i++) scanf("%d", &a[i]);



    for(i=0; i<n; i++)

    {

        scanf("%d", &b[i]);

        b[i]=a[i]-b[i];



        if(b[i]>0) s+=b[i];

    }



    printf("%d", s);



    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int main()

{

    int n,v[60],c[60],r,ans=0;

    cin>>n;

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

    {

        cin>>v[i];

    }

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

    {

        cin>>c[i];

    }

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

    {

        r=v[i]-c[i];

        if(r>0)

        ans=ans+r;

    }

    cout<<ans<<endl;

    return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



#define endl '\n'



int main()

{

    int n, i, s=0;

    scanf("%d", &n);

    int a[n], b[n];



    for(i=0; i<n; i++) scanf("%d", &a[i]);



    for(i=0; i<n; i++)

    {

        scanf("%d", &b[i]);

        b[i]=a[i]-b[i];



        if(b[i]>0) s+=b[i];

    }



    printf("%d", s);



    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#define ull unsigned long long

#define ll long long

#define endl '\n'

#define pb push_back

#define mp make_pair

#define mod 1000000007

#define line cout<<"----------------------------------"<<endl

#define fast ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);

#define filein freopen("input.txt","r",stdin)

#define fileout freopen("output.txt","w",stdout)

using namespace std;

const ll mx=200009;

ll n; 

ll val[mx],cost[mx]; 

ll maxi=0; 

void call(ll ind, ll sum, ll c)

{

    if(ind==n) 

    {

        maxi=max(maxi,sum-c);

        return ; 

    }

    call(ind+1,sum+val[ind],c+cost[ind]);

    call(ind+1,sum,c);

}

int main()

{

    cin>>n; 

    for(ll i=0;i<n;i++) cin>>val[i]; 

    for(ll i=0;i<n;i++) cin>>cost[i]; 

    call(0,0,0);

    cout<<maxi<<endl; 

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



#define endl '\n'



int main()

{

    int n, i, s=0;

    scanf("%d", &n);

    int a[n], b[n];



    for(i=0; i<n; i++) scanf("%d", &a[i]);



    for(i=0; i<n; i++)

    {

        scanf("%d", &b[i]);

        b[i]=a[i]-b[i];



        if(b[i]>0) s+=b[i];

    }



    printf("%d", s);



    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<cstdio>

#include<sstream>

#include<cstdlib>

#include<cctype>

#include<cmath>

#include<algorithm>

#include<set>

#include<queue>

#include<stack>

#include<list>

#include<iostream>

#include<fstream>

#include<numeric>

#include<string>

#include<assert.h>

//#include<unordered_map>

//#include<unordered_set>

#include<vector>

#include<cstring>

#include<map>

#include<iterator>

#include <iomanip>

#include<bits/stdc++.h>



using namespace std;

#define lead_zero(x)    __builtin_clzll(x)

#define trail_zero(x)   __builtin_ctz(x)

#define total_1s(x)     __builtin_popcount(x)

#define ll long long int

#define pi 3.14159265358979323846

#define filein freopen("input.txt", "r", stdin)

#define forn(i,n) for(int i=0;i<n;i++)

#define maxx 1000000005

#define nullptr NULL



int main()

{

    ll t;





        int n;

        cin>>n;

        int v[n+5],c[n+5],sum=0;

        forn(i,n)

        {

            cin>>v[i];

        }

        forn(i,n)

        {

            cin>>c[i];

        }

        forn(i,n)

        {

            if((v[i]-c[i])>0)

                sum+=(v[i]-c[i]);

        }

        cout<<sum<<endl;





    return 0;



}


// Optimized solution to the same problem (faster):
#include <stdio.h>



#define endl '\n'



int main()

{

    int n, i, s=0;

    scanf("%d", &n);

    int a[n], b[n];



    for(i=0; i<n; i++) scanf("%d", &a[i]);



    for(i=0; i<n; i++)

    {

        scanf("%d", &b[i]);

        b[i]=a[i]-b[i];



        if(b[i]>0) s+=b[i];

    }



    printf("%d", s);



    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

using ll = long long;



int main() {

  //ios_base::sync_with_stdio(false);

  //cin.tie(nullptr);

  int n;

  cin >> n;

  int v[n], c[n];

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

    cin >> v[i];

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

    cin >> c[i];

  int sum = 0;

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

    int diff = v[i] - c[i];

    if(diff>0)

      sum += diff;

  }

  cout << sum;

  return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



#define endl '\n'



int main()

{

    int n, i, s=0;

    scanf("%d", &n);

    int a[n], b[n];



    for(i=0; i<n; i++) scanf("%d", &a[i]);



    for(i=0; i<n; i++)

    {

        scanf("%d", &b[i]);

        b[i]=a[i]-b[i];



        if(b[i]>0) s+=b[i];

    }



    printf("%d", s);



    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<cstdlib>



using namespace std;



int main(){



    ios::sync_with_stdio(false);



    int n,*v,*c;

    int x=0,y=0;



    cin>>n;



    v = (int*) malloc(n*sizeof(int));

    c = (int*) malloc(n*sizeof(int));



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

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

        cin>>c[i];

        if(c[i]<v[i]){

            x+=v[i];

            y+=c[i];

        }

    }



    cout<<x-y<<endl;



    return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>

#include <string.h>

#include <math.h>

int main ()

{

    int n, p=0;

    scanf ("%d", &n);

    int v[n], c[n];

    for (int i=0;i<n;i++) scanf ("%d", &v[i]);

    for (int j=0;j<n;j++) {

        scanf ("%d", &c[j]);

        if (c[j]<=v[j]) p=p+v[j]-c[j];

    }

    if (p>0) printf ("%d", p);

    else printf ("0");

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>



using namespace std;



int main(){

    int n, i, c;

    cin >> n;

    int v[n];

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

        cin >> v[i];

    }

    int dif=0;



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

        cin >> c;

        if(dif+v[i]-c > dif){

            dif+=v[i]-c;

        }

    }

    cout << dif << endl;



    return 0;

}




// Optimized solution to the same problem (faster):
#include <stdio.h>

#include <string.h>

#include <math.h>

int main ()

{

    int n, p=0;

    scanf ("%d", &n);

    int v[n], c[n];

    for (int i=0;i<n;i++) scanf ("%d", &v[i]);

    for (int j=0;j<n;j++) {

        scanf ("%d", &c[j]);

        if (c[j]<=v[j]) p=p+v[j]-c[j];

    }

    if (p>0) printf ("%d", p);

    else printf ("0");

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int main()

{

    int a,b,c,d,n,t,i,j,k,x,y,m,p,s,mx,mn;

    cin>>t;

    int ar[t],br[t],sum=0;

    for(p=0; p<t; p++)

    {

        cin>>ar[p];

    }

    for(p=0; p<t; p++)

    {

        cin>>br[p];

    }

    for(p=0;p<t;p++)

    {

        if(ar[p]>br[p])

        {

            sum=sum+(ar[p]-br[p]);

        }



    }

    cout<<sum<<endl;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>

#include <string.h>

#include <math.h>

int main ()

{

    int n, p=0;

    scanf ("%d", &n);

    int v[n], c[n];

    for (int i=0;i<n;i++) scanf ("%d", &v[i]);

    for (int j=0;j<n;j++) {

        scanf ("%d", &c[j]);

        if (c[j]<=v[j]) p=p+v[j]-c[j];

    }

    if (p>0) printf ("%d", p);

    else printf ("0");

    return 0;

}


// Fastest known solution for this problem: