stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include <iostream>

#include <algorithm>

#include <string>

#include <vector>

#include <cstdio>

#include <cmath>

#include <cstring>

#include <cstdlib>

#define endl '\n'

#define ll long long

#define pb push_back

#define pi 3.14159265358979323846264338327950288419716939937510

#define RUN_FAST ios::sync_with_stdio(false);

#define sz 100

using namespace std;



int main()

{

    RUN_FAST;

    ll n, x, tmp, i, j, cnt;

    ll sum=0;

    vector <ll> v;

    scanf("%lld", &n);

    tmp=n;

    while (tmp--) {

        scanf("%lld", &x);

        sum+=x;

        v.push_back(x);

    }

    ll arr[100110]={0};

    sort(v.begin(), v.end());

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

        cnt=1;

        tmp=v[i];

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

            if (v[j]!=tmp) {

                break;

            }

            cnt++;

        }

        arr[tmp]=cnt;

        i=j-1;

    }

    ll q, a, b;

    scanf("%lld", &q);

    while (q--) {

        scanf("%lld %lld", &a, &b);

        tmp=arr[a];

        sum-=tmp*a;

        sum+=tmp*b;

        arr[b]=arr[b]+tmp;

        arr[a]=0;

        printf("%lld\n", sum);

    }

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.8069464510457773x):
#include <iostream>

#include <algorithm>

#include <string>

#include <vector>

#include <cstdio>

#include <cmath>

#include <cstring>

#include <cstdlib>

#define endl '\n'

#define ll long long

#define pb push_back

#define pi 3.14159265358979323846264338327950288419716939937510

#define RUN_FAST ios::sync_with_stdio(false);

#define sz 100

using namespace std;



ll arr[100110];



int main()

{

    RUN_FAST;

    ll n, x, tmp, i, j, cnt;

    ll sum=0;

    scanf("%lld", &n);

    tmp=n;

    while (tmp--) {

        scanf("%lld", &x);

        arr[x]++;

        sum+=x;

    }

    ll q, a, b;

    scanf("%lld", &q);

    while (q--) {

        scanf("%lld %lld", &a, &b);

        tmp=arr[a];

        sum-=tmp*a;

        sum+=tmp*b;

        arr[b]=arr[b]+tmp;

        arr[a]=0;

        printf("%lld\n", sum);

    }

    return 0;

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

#include <cstdio>

#include <cstring>

#include <cstdlib>

#include <cmath>

#include <cstring>

#include<queue>

#include<algorithm>

using namespace std;

const int maxn = 1e6+5;

int n;

int pre[maxn];

int main() {

    cin>>n;

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

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

	}

	int ans=0;

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

    	int s1=pre[0],s2=0;

    	for(int j=i;j!=0;j=(j-1)&i){

    	    if (pre[j]>s1) {

				s2=s1;

				s1=pre[j];

			}

    	    else if(pre[j]>s2) s2=pre[j]; 

    	}

    	ans=max(ans,s1+s2);

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

    } 

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.150763584265776x):
#include<cstdio>

#include<algorithm>

#define rep(i,l,r) for (int i=(l); i<=(r); i++)

using namespace std;



const int N=300010;

int n,m,a[N],r[N],mx[N];



int main(){

    scanf("%d",&m); int n=1<<m;

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

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

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

            r[j]=max(r[j],a[i]+mx[j]),mx[j]=max(mx[j],a[i]);

    for (int i=1; i<n; i++) printf("%d\n",r[i]=max(r[i],r[i-1]));

    return 0;

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

#include<vector>

using namespace std;



int main(){

    int s;

    vector<int> a(1000000);

    cin >> s;

    a.at(0) = s;



    int i = 0;

    while(1){

        if(a.at(i)%2 == 0){

            a.at(i+1) = a.at(i) / 2;

            for(int j = 0; j < i+1; j++){

                if(a.at(i+1) == a.at(j)){

                    cout << i+2 << endl;

                    return 0;

                }

            }

            i++;

        }else{

            a.at(i+1) = 3*a.at(i) + 1;

            for(int j = 0; j < i+1; j++){

                if(a.at(i+1) == a.at(j)){

                    cout << i+2 << endl;

                    return 0;

                }

            }

            i++;

        }

    }



}

// Faster C++ solution for the same problem (measured speedup: 5.011569145123247x):
#include<iostream>

#include<vector>

#include<map>

using namespace std;



const int mod = 1000000007;

const int MAX_N = 1000000;



int func(int n){

    if(n%2){

        return 3*n+ 1;

    }else{

        return n/2;

    }

}



int main(){

    int s;

    cin >> s;

    map<int,int> mp;

    

    //mp[s]の初期値は０だった。

    //一度登場するとインクリメントが行われる。

    mp[s]++;

    //最短で一致するとa2となるので。

    int count = 2;



    while(1){

        //この時点でｓは別物のｓとなる。

        s = func(s);



        //なるほど、同じ数字が出てくると同じ配列？の通し番号

        //にアクセスすることを利用しているのか。

        if(mp[s]){

            cout << count << endl;

            return 0;

        }

        //一度登場するとインクリメントが行われる。

        mp[s]++;

        count++;

        

    }

    





    



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



using namespace std;



int main()

{

int x,y;

cin>>x>>y;

for(int i=y-x+1;i<y+x;i++){

    cout<<i<<" ";

}

return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.213504075442337x):
////sfef

#include<stdio.h>

int main(){



int k,x,i,p,q,r;

scanf("%d %d",&k,&x);

p=(x-(k-1));

q=(x+(k-2));

r=(x+(k-1));

if(k==1)

{

    printf("%d",x);

}

else{

    for(i=p;i<=q;i++)    

    {

        printf("%d ",i);

    }

    printf("%d",r);

}



return 0;

}
// Slower C++ solution:
#pragma GCC optimize("O3")



#include <bits/stdc++.h>



typedef long long ll;

typedef unsigned long long ull;

typedef long double ld;

#define F first

#define S second

#define pii pair<int,int>

#define pll pair<ll, ll>

#define vi vector<int>

#define vll vector<ll>

#define vii vector<pii>

#define read(FILE)  freopen(FILE, "r", stdin);

#define out(FILE) freopen(FILE, "w", stdout);

#define clr(x, y) memset(x,y,sizeof(x));

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

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

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

#define forr(i, m, n) for(int i=m ; i<=n ; i++)

#define endl '\n'

#define pb push_back

#define re return

const int N = 1e5 + 5;

const int OO = 1e9 + 7;

using namespace std;

int n, a[N], k;

int dp[N];



int solve(int i) {

    if (i == n - 1) re 0;

    if (i > n - 1) re OO;

    int &res = dp[i];

    if (~res) re res;

    res = abs(a[i + 1] - a[i]) + solve(i + 1);

    if (i < n - 2) {

        forr(j, 2, k) {

            res = min(res, abs(a[i + j] - a[i]) + solve(i + j));

        }

    }

    re res;

}



int main() {

    IO;

    cin >> n >> k;

    rep(i, 0, n) cin >> a[i];

    memset(dp, -1, sizeof dp);

    cout << solve(0);





}




// Faster C++ solution for the same problem (measured speedup: 7.378559422747063x):
#include <cstdio>

#include <algorithm>

#include <vector>

using namespace std;

 

int n,dp[100005],a[100005],k; 

int main(){

	scanf("%d%d",&n,&k);

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

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

	}

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

		dp[i]=dp[i-1]+abs(a[i]-a[i-1]);

		for (int j=max(1,i-k);j<i;j++){

			dp[i]=min(dp[i],dp[j]+abs(a[i]-a[j])); 

		}

	}

	printf("%d\n",dp[n]);

	return 0;

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

#define ll long long 

using namespace std;

ll n,k,a[100010],dp[100010];

inline int read(){

     int x=0,f=1;

     char ch=getchar();

     while(ch<'0'||ch>'9'){

         if(ch=='-')

             f=-1;

         ch=getchar();

     }

     while(ch>='0'&&ch<='9'){

         x=(x<<1)+(x<<3)+(ch^48);

         ch=getchar();

     }

     return x*f;

 }

int main ( )

{

	n=read();k=read();

	for(int i=1;i<=n;i++) a[i]=read();

	memset(dp,0x7f,sizeof(dp));

	dp[1]=0;

	for(ll i=2;i<=n;i++)

		for(ll j=1;j<=k&&i-j>=1;j++)

		   dp[i]=std::min(dp[i],dp[i-j]+abs(a[i]-a[i-j]));

	cout<<dp[n];

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.764194244886376x):
//#pragma GCC target("avx2")

//#pragma GCC optimize("O3")

   

//#include <x86intrin.h>

#include <bits/stdc++.h>   

#include <ext/pb_ds/assoc_container.hpp>

#include <ext/pb_ds/tree_policy.hpp>

 

using namespace __gnu_pbds;

using namespace std;



template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

     

#define F first

#define S second           

#define lb lower_bound               

#define ub upper_bound

#define pb push_back

#define pf push_front    

#define ppb pop_back

#define mp make_pair                                     

#define bpp __builtin_popcountll                                                                                        

#define sqr(x) ((x) * (x)) 

#define al 0x3F3F3F3F

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

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

#define in insert

#define ppf pop_front

#define endl '\n'

//#define int long long

 

typedef unsigned long long ull;

typedef long long ll;

typedef long double ld;

typedef pair <int, int> pii;

 

const int mod = (int)1e9 + 7;

const int N = (int)3e5 + 123;

const ll inf = (ll)1e18 + 1;



const double pi = acos (-1.0);

const double eps = 1e-7;                  

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

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



int n, k;

ll h[N];

ll dp[N];



inline void boost () {                    

   ios_base :: sync_with_stdio (NULL);

   cin.tie (NULL), cout.tie (NULL);          

}                                                     



inline void Solve () {

   cin >> n >> k;

   dp[1] = 0;

   for (int i = 1; i <= n; i ++) cin >> h[i];

   for (int i = 2; i <= n; i ++) dp[i] = inf;

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

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

         if (i + j <= n) dp[i + j] = min (dp[i + j], dp[i] + abs (h[i] - h[i + j]));

      }

   }

   cout << dp[n];

}



main () {                                       

// freopen (".in", "r", stdin);    

// freopen (".out", "w", stdout);              

   boost ();

   int tt = 1;

   //cin >> tt;   

   while (tt --) {

      Solve ();

   }                                               

   return 0;      

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

using namespace std;

#define endl '\n'

#define INF 0x3f3f3f3f



const int N = 1e5;



int dp[N+5];

int arr[N+5];



int main(){



	ios_base::sync_with_stdio(0);

	int n, k; cin >>n >>k;

	for(int i = 1; i<=n; i++) cin >>arr[i];

	arr[0] = arr[1];

	

	dp[0] = dp[1] = 0;

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

		int temp = INF;

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

			if(i-j > 0){ 						

				temp = min(temp, dp[i-j] + abs(arr[i] - arr[i-j]));

			} 

			else break;

		}

		dp[i] = temp;

	}

	

	cout <<dp[n] <<endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.286614783575652x):
#include <cstdio>

#include <algorithm>

#include <vector>

using namespace std;

 

int n,dp[100005],a[100005],k; 

int main(){

	scanf("%d%d",&n,&k);

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

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

	}

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

		dp[i]=dp[i-1]+abs(a[i]-a[i-1]);

		for (int j=max(1,i-k);j<i;j++){

			dp[i]=min(dp[i],dp[j]+abs(a[i]-a[j])); 

		}

	}

	printf("%d\n",dp[n]);

	return 0;

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

using namespace std;



int main()

{





    int k;

    cin>>k;

    string s;

    cin>>s;



    if(s.length()>k)

    {

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

        {

            cout << s[i];

        }

        cout << "...";

    }

    else cout << s << endl;







    return 0;

}


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

#include<string.h>



int main()

{

	int n;

	scanf("%d",&n);

	char str[102];

	scanf("%s",&str);

	int len=strlen(str);

	if(len>n)

	{

		str[n]='.';

		str[n+1]='.';

		str[n+2]='.';

		str[n+3]='\0';

	}

	printf("%s",str);

	return 0;

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

#define rep(X,A,B) for(int X=A;X<=B;X++)

#define tep(X,A,B) for(int X=A;X>=B;X--)

#define LL long long

const int N=300010;

const int M=100010;

const int maxn=100000;

using namespace std;



int n;

int a[M],b[M];

LL num[N],tot;



int lowbit(int x){

	return x&(-x);

}



LL GET(int x){

	LL res=num[0];

	while(x>0){

		res+=num[x];

		x-=lowbit(x);

	}

	return res;

}



void ADD(int x){

	while(x<=200000){

		num[x]++;

		x+=lowbit(x);

	}

}



int CHK(int x){

	rep(i,0,200000)num[i]=0;

	ADD(maxn);

	int now=100000;

	LL res=0;

	rep(i,1,n){

		if(a[i]<=x)now++;

		  else now--;

		res+=GET(now-1);

		ADD(now);

	}

	if(res>=(tot/2+1))return 1;

	return 0;

}



int main(){

	scanf("%d",&n);

	tot=(LL)(n+1)*n/2;

	rep(i,1,n)scanf("%d",&a[i]),b[i]=a[i];

	sort(b+1,b+n+1);

	int R=unique(b+1,b+n+1)-b-1;

	int L=1,ans=0;

	while(L<=R){

		int mid=(L+R)>>1;

		if(CHK(b[mid]))R=mid-1,ans=b[mid];

		  else L=mid+1;

	}

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

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 2.536075614032987x):
#include <cstdio>

#include <cstring>

#include <algorithm>

#define ll long long

#define inf 1<<30

#define il inline 

il void readl(ll &x){

    x=0;ll f=1;char c=getchar();

    while(c<'0'||c>'9'){if(c=='-')f=-f;c=getchar();}

    while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}

    x*=f;

}

il void read(int &x){

    x=0;int f=1;char c=getchar();

    while(c<'0'||c>'9'){if(c=='-')f=-f;c=getchar();}

    while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}

    x*=f;

}

using namespace std;



#define N 100010

#define lowbit(x) x&-x

int c[N*10];

int n,a[N],s[N*10];

void add(int x){

    for(int i=x;i<=2*N;i+=lowbit(i))c[i]++;

}

ll query(int x){

    ll sum=0;

    for(int i=x;i>0;i-=lowbit(i))sum+=c[i];

    return sum;

}

bool check(int x){

    for(int i=1;i<=2*N;i++)c[i]=0;

    s[0]=0;

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

        s[i]=s[i-1]+(a[i]>=x?1:-1);

    ll sum=0;

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

        sum+=query(s[i]+N);

        add(s[i]+N);

    }

    return sum>=1ll*n*(n+1)/4;

}

int main(){

    read(n);

    int l=0,r=0;

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

        read(a[i]);

        r=max(r,a[i]);

    }

    int ans=0;

    while(l<=r){

        int mid=(l+r)>>1;

        if(check(mid)) l=mid+1;

        else r=mid-1;

    }

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

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

#include <set>

#include <vector>

#include <map>

#include <queue>

#include <stdio.h>

#include <string.h>

#include <algorithm>

#define ll long long



using namespace std;



int n, k, arr[100005];

int dp[100005];



int solve(int i)

{

	if (i == n - 1)return 0;

	if (dp[i] != -1)return dp[i];

	dp[i] = abs(arr[i] - arr[i + 1]) + solve(i + 1);

	for (int j = i + 2; j <= i + k && j < n; j++)

	{

		dp[i] = min(dp[i], abs(arr[i] - arr[j]) + solve(j));

	}

	return dp[i];

}



int main()

{

	memset(dp, -1, sizeof dp);

	cin >> n >> k;

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

	cout << solve(0) << '\n';

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.3839260408270766x):


#include <bits/stdc++.h>



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

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

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

#define M_PI 3.14159265358979323846

#define mod 1000000007

#define endl "\n"

using namespace std;

using ll = long long;

using lli = long long int;

using ld = long double;





const int N = 5e5 + 6, inf = 2e9;

int n,k;

int arr[N], dp[N];

int main()

{

	MEGA_MIND



		cin >> n >>k;

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

	{

		dp[i] = inf;

		cin >> arr[i];

	}



	dp[0] = 0;

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

	{

		for (int j = i+1; j <= i + k; j++)

		{

			if(j<n)

				dp[j] = min(abs(arr[i] - arr[j]) + dp[i], dp[j]);

		}

	}

	cout << dp[n - 1] << endl;

	return 0;

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

#include<stdio.h>

#include<cstring>

#include<cmath>

#include<algorithm>

#include<vector>

#include<map>

#include<queue>

#define ll long long

int pos(int n)

{

    if(n<0)

        return 0;

    else

        return n;

}

using namespace std;

int main()

{

    int n;

    cin>>n;

    int a[n],b[n];

    int cnt=0;

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

    {

        cin>>a[i];

    }

    if(a[0]>1)

    {

        cout<<-1<<endl;

    }

    else

    {

        int nn=n;;

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

        {

            for(int j=n-1; j>=0; j--)

            {

                if(a[j]==j+1)

                {

                    b[cnt++]=a[j];

                    for(int k=j; k<n-1; k++)

                    {

                        a[k]=a[k+1];

                    }

                    n--;

                    break;

                }

            }

        }

        if(cnt!=nn)

        {

            cout<<-1<<endl;

        }

        else

        {

            for(int i=cnt-1; i>=0; i--)

            {

                cout<<b[i]<<endl;

            }

        }

    }

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.287562046125563x):
#include<cstdio>



using namespace std;



int a[101];

int b[101];

int main(){

	int n;

	scanf("%d",&n);

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

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

	for(int i=n;i;i--){

		int o=0;

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

			if(a[j]==j)o=j;

		if(o==0){

			printf("-1\n");

			return 0;

		}

		b[++b[0]]=o;

		for(int j=o;j<i;j++)

			a[j]=a[j+1];

	}

	for(int i=b[0];i;i--)

		printf("%d\n",b[i]);

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

using namespace std;

const int N=2e5+5;



long long arr[N];

int solve()

{

    string s;

    cin>>s;

    int n=s.size();

    stack<char> ans;

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

    {

       if(s[i]=='B') {

           if (ans.size())

               ans.pop();

       }

       else

           ans.push(s[i]);

    }

    s="";

    while(ans.size())

    {

        s+=ans.top();

        ans.pop();

    }

    reverse(s.begin(), s.end());

    cout<<s;

    return 0;

}



int main()

{

#ifndef ONLINE_JUDGE

   // freopen("input.txt" ,"r" ,stdin);

   // freopen("output.txt" ,"w" ,stdout);

#endif

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);



   // int t;

   // cin>>t;

   // while(t--)

        solve();



    return 0;

}

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

#include<string.h>

int main(){

    char G[100], H[100];

    int A=0;

    scanf("%s", G);

    int len=strlen(G);

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

    {

        if(G[i]=='B')

        {

            A--;

            if(A<0)

                A=0;

        }

        else

            H[A++]=G[i];

    }

    H[A]='\0';

    printf("%s\n", H);

    return 0;

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

#include<cmath>

#include<cstring>

#include<iostream>

#include<algorithm>

#include<cstdlib>

using namespace std;

int N,K,h[100005],dp[100005];

int main(){

	scanf("%d%d",&N,&K);

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

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

	dp[1] = 0;dp[2] = abs(h[2] - h[1]);

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

		dp[i] = 0x3f3f3f3f;

		for(int j = K;j >= 1;j--){

		if(i-j>0)

			dp[i] = min(dp[i],dp[i-j]+abs(h[i]-h[i-j]));

		}

	}

	printf("%d\n",dp[N]);

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.6602042059160038x):
#include <cstdio>

#include <algorithm>

#include <cmath>

using namespace std;



int h[(int)1e5], dp[(int)1e5], K, N;





int main()

{

	K = N = 0;

	for(int j = 1;j <= 1e5;j++)

	{

		dp[j] = 1e9;

	}

	scanf("%d %d", &N, &K);

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

	{

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

	}

	dp[1] = 0;

	dp[2] = dp[1] + abs(h[1] - h[2]);

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

	{

		for(int j = 1;j <= K;j++)		

		{

			dp[i + j] = min(dp[i + j], dp[i] + abs(h[i] - h[i + j]));

		}

	}

	printf("%d\n", dp[N]);

	return 0;	

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

#include <string>

#include <cstring>

#include <stdlib.h>

#include <math.h>

#include <algorithm>

#include <vector>

#include <set>

#include <map>

#include <queue>

#include <list>

#include <iterator>

#include <assert.h>

#pragma warning(disable:4996) 



typedef long long ll;

#define MIN(a, b) ((a)>(b)? (b): (a))

#define MAX(a, b) ((a)<(b)? (b): (a))

#define LINF 9223300000000000000

#define INF 2140000000

const long long MOD = 1000000007;

using namespace std;





ll a[16][16];



int main(int argc, char* argv[])

{

    int n;

    scanf("%d", &n);



    int i,j;

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

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

            scanf("%lld", &a[i][j]);

        }

    }



    int z[17];

    vector<ll> dp(1<<n);

    int k;

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

        int siz=0;

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

            if(k & (1<<i)) z[siz++]=i;

        }



        dp[k]=0;

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

            for(j=i+1; j<siz; j++) {

                dp[k] += a[z[i]][z[j]];

            }

        }



        ll max=0;

        for(i=0; i<(1<<siz); i++) {

            int tmp0=0;

            for(j=0; j<siz; j++) {

                if(i & (1<<j)) tmp0 |= (1<<z[j]);

            }

            ll val = dp[tmp0]+dp[k^tmp0];

            max = MAX(max, val);

        }

        dp[k] = max;

    }

    printf("%lld\n", dp[(1<<n)-1]);



    return 0;

}


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

#include <string>

#include <cstring>

#include <stdlib.h>

#include <math.h>

#include <algorithm>

#include <vector>

#include <set>

#include <map>

#include <queue>

#include <list>

#include <iterator>

#include <assert.h>

#pragma warning(disable:4996) 



typedef long long ll;

#define MIN(a, b) ((a)>(b)? (b): (a))

#define MAX(a, b) ((a)<(b)? (b): (a))

#define LINF 9223300000000000000

#define INF 2140000000

const long long MOD = 1000000007;

using namespace std;





ll a[16][16];

ll dp[1<<16];



int main(int argc, char* argv[])

{

    int n;

    scanf("%d", &n);



    int i,j;

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

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

            scanf("%lld", &a[i][j]);

        }

    }



    int mm=(1<<n);

    int z[17];

    int k;

    for(k=0; k<mm; k++) {

        int siz=0;

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

            if(k & (1<<i)) z[siz++]=i;

        }



        dp[k]=0;

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

            for(j=i+1; j<siz; j++) {

                dp[k] += a[z[i]][z[j]];

            }

        }

    }



    for(k=0; k<mm; k++) {

        int siz=0;

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

            if(k & (1<<i)) z[siz++]=i;

        }

        ll max=0;

        int MM=(1<<siz);

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

            int tmp0=0;

            for(j=0; j<siz; j++) {

                if(i & (1<<j)) tmp0 |= (1<<z[j]);

            }

            ll val = dp[tmp0]+dp[k^tmp0];

            max = MAX(max, val);

        }

        dp[k] = max;

    }

    printf("%lld\n", dp[mm-1]);



    return 0;

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

#include<iomanip>

#include<stdio.h>

using namespace std;



int main(){

	int N,K;

	cin>>N>>K;

	int cnt=0;

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

		int t;

		cin>>t;

		if(t>=K)

			cnt++;

	}

	cout<<cnt<<endl;

	return 0;

}

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

int main()

{

    int N,K,h[100000],n,i;

    scanf("%d%d",&N,&K);

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

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

    if(h[i]>=K){

        n=n+1;

      }

    }

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

    return 0;

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

#include<cstring>

using namespace std;

int main()

{

	int n;

	cin>>n;

	string s;

	cin>>s;

	int d=s.length();

	if(d<=n)

    cout<<s;

    else

    {

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

    	cout<<s[i];

	    cout<<"...";

	}

}

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



int main(){

	int k;

	char word[100];

	scanf("%d", &k);

	scanf("%s", &word);

	

	int len = 0;

	

	for(int i = 0; word[i] != '\0'; i++){

		len++;

	}

	

	if(len <= k){

		printf("%s\n", word);

	}

	else{

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

			printf("%c", word[i]);

		}

		printf("...\n");

	}

	return 0;

}