stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include<bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;

using namespace std;



typedef long long ll;

typedef pair<int,int> ii;

typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;



int main() {

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

	int N; cin>>N;

	vector<vector<int>> F(N,vector<int>(10,0));

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

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

			cin>>F[i][j];

	vector<vector<int>> P(N,vector<int>(11,0));

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

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

			cin>>P[i][j];

	int ans=INT_MIN;

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

		vector<int> ct(N,0);

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

			if(bt&(1<<i))

				for (int j=0; j<N; j++)

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

		int ret=0;

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

			ret+=P[i][ct[i]];

		ans=max(ans,ret);

	}

	cout<<ans<<"\n";

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.1031409868589128x):
#include <bits/stdc++.h>



#include <fstream>

#include <ext/pb_ds/assoc_container.hpp>

#include <ext/pb_ds/tree_policy.hpp>



typedef long long ll;

typedef long double ld;

using namespace std;

#define endl "\n"

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

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

using namespace __gnu_pbds;

const int N=100+5, mxN=(1<<22);

int mod=1e9+7;

int n;

ll ans=-1e18;

int arr[N][11],cost[N][12];

void brutefor(int i, int mask)

{

    if(i==10)

    {

        if(mask==0)

            return;

  ll localans=0;

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

    {



        int co=0;

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

        {

            if(arr[x][j]==1&&((mask>>j)&1)==1)

            {

                co++;

            }



        }

        localans+=cost[x][co];



    }

    ans=max(ans,localans);







    }

    else

    {

        brutefor(i+1,mask);

        mask=(mask|(1<<i));

        brutefor(i+1,mask);







    }





}



int main()

{

    FIO

    cin>>n;

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

    {

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

        {

            cin>>arr[i][j];

        }



    }



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

    {

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

        {

            cin>>cost[i][j];

        }



    }

     brutefor(0,0);

     cout<<ans;





    return 0;



}
// Slower C++ solution:
#include<bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;

using namespace std;



typedef long long ll;

typedef pair<int,int> ii;

typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;



int main() {

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

	int N; cin>>N;

	vector<vector<int>> F(N,vector<int>(10,0));

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

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

			cin>>F[i][j];

	vector<vector<int>> P(N,vector<int>(11,0));

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

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

			cin>>P[i][j];

	int ans=INT_MIN;

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

		vector<int> ct(N,0);

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

			if(bt&(1<<i))

				for (int j=0; j<N; j++)

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

		int ret=0;

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

			ret+=P[i][ct[i]];

		ans=max(ans,ret);

	}

	cout<<ans<<"\n";

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.1002969501517665x):
#include <bits/stdc++.h>



using namespace std;

#define ll long long

#define ld long double

#define f first

#define s second

const int N = 1e2+5;



ll n , a[N] , cost[N][15] , ans=-1e18;



void solve(int bt , int cur)

{

    if (bt == 10)

    {

        ll sum=0 , tmp , c;

        c = __builtin_popcount(cur);

        if (c == 0) return;



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

        {

            tmp = cur&a[i];

            c = __builtin_popcount(tmp);

            sum += cost[i][c];

        }

        ans = max(ans , sum);

        return;

    }



    solve(bt+1 , cur);

    solve(bt+1 , cur|(1<<bt));

}



int main()

{

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



    cin >> n;

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

    {

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

        {

            int x;

            cin >> x;

            if (x) a[i] |= (1<<j);

        }

    }

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

    {

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

            cin >> cost[i][j];

    }



    solve(0,0);

    cout << ans << "\n";



    return 0;

}
// Slower C++ solution:
#include<iostream>

#include<string>

using namespace std;



int n = 10;

int S[10];

int idx = 0;

int bit_array[1024][10];



int F[100][10];

int P[100][11];



void rec(int i) {

    if (i == n) {

        for (int j = 0; j < n; j++) bit_array[idx][j] = S[j];

        idx++;

        return;

    }



    rec(i + 1);

    S[i] = 1;

    rec(i + 1);

    S[i] = 0;



    return;

}



void makeCombination() {

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

        S[i] = 0;

    }

    rec(0);

    return;

}



int main() {

    makeCombination();



    int N, profit, open_num, max_prof = -1000000000;

    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 < 11; j++) {

            cin >> P[i][j];

        }

    }



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

        profit = 0;

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

            open_num = 0;

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

                if (bit_array[i][k] == 1 && F[j][k] == 1) open_num++;

            }

            profit += P[j][open_num];

        }

        max_prof = max(max_prof, profit);

    }



    cout << max_prof << endl;



    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 3.988340717370555x):
#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)&& F [ i ][ j ]) c ++;

cc += P [ i ][ c ];

}

if ( res < cc ) res = cc ;

}

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

}
// Slower C++ solution:
#include<iostream>

#include<vector>

#include<algorithm>

#include<queue>

#include<map>

#include<stack>

#include<cmath>

#include<iomanip>

#include<set>

#include<numeric>

#include<sstream>

#include<random>

#include<cassert>

using namespace std;

typedef long long ll;

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

#define rrep(i, st, n) for (int i = st; i < n; ++i)

using pii = pair<int, int>;

const int inf = 1e9 + 7;

int dy[] = {0, 0, -1, 1, -1, 1, -1, 1};

int dx[] = {1, -1, 0, 0, -1, 1, 1, -1};

#define ceil(a, b) a / b + !!(a % b)



int ans = -inf;

int a[20];

int f[105][10];

int p[105][11];

int n;

void func() {

    

    rep(i, 20) {

        if (a[i] != 0) break;

        if (i == 19) return;

    }

    

    int score = 0;

    //rep(i, 10) cout << a[i] << " "; cout << endl;

    rep(i, 105) {

        int tmp = 0;

        rep(j, 10) if (a[j] == 1 && f[i][j] == 1) tmp++;

        score += p[i][tmp];

    }

    ans = max(ans, score);

}

void dfs(int pos) {

    if (pos == 10) {

        func();

        return;

    }

    a[pos] = 0; dfs(pos + 1);

    a[pos] = 1; dfs(pos + 1);

}

int main() {

    cin >> n;

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

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

    dfs(0);

    cout << ans << endl;

    

}


// Faster C++ solution for the same problem (measured speedup: 1.8071233710434247x):
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

#define F first

#define S second

#define pii pair<int, int>

#define eb emplace_back

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

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

#define rep3(i, l, n) for (int i = l; i < n; ++i)

#define chmax(a, b) a = (a >= b ? a : b)

#define chmin(a, b) a = (a <= b ? a : b)

#define out(a) cout << a << endl

#define outa(a, n) rep(_, n) cout << a[_] << " "; cout << endl

#define SZ(v) (int)v.size()

#define inf (int)(1e9+7)

#define abs(x) (x >= 0 ? x : -(x))



int main() {

    ios::sync_with_stdio(false);

    cin.tie(0);

    // 計算量の見積もり間違ってた

    int n;

    cin >> n;

    int f[n][10];

    int p[n][11];

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

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

    int ans = -inf;

    rep(i, (1 << 10)) {

        if (i == 0) continue;

        int c[n]; fill_n(c, n, 0); // いくつ営業するか

        rep(j, 10) {

            if (i & (1 << j)) { // 営業する時間帯

                rep(k, n) {

                    if (f[k][j]) {

                        c[k]++;

                    }

                }

            }

        }

        int sum = 0;

        rep(j, n) {

            sum += p[j][c[j]];

        }

        // out(sum);

        chmax(ans, sum);

    }

    out(ans);

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 5.170031088278244x):
#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;

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 1.1591854652687776x):
#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;

}
// Slower C++ solution:
#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';

}


// Faster C++ solution for the same problem (measured speedup: 3.7168929716772925x):
#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);

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 1.105408545590615x):
#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;

}
// Slower C++ solution:
#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));

}

// Faster C++ solution for the same problem (measured speedup: 1.2297561835983888x):
#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));

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 5.2381207336835836x):
#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;

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 5.255503472061572x):
#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;

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 5.358759534060596x):
#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;

}
// Slower C++ solution:
#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);

}

// Faster C++ solution for the same problem (measured speedup: 5.314718130500171x):
#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;

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 5.227012690498745x):
#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;

}