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

#include <map>

#include <algorithm>

using namespace std;

int main() {

    unsigned long long  mon, special_moves , attacks=0 ;

cin >> mon >> special_moves ;

int monh[mon];

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

    cin >> monh[i];

}

sort(monh , monh+mon);

if (special_moves>mon){

        

    }

else if (special_moves>=0){

    if (special_moves==0){

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

            attacks+=monh[i];

        }

    }

    else {

        for(int i=0 ; i<mon-special_moves ; i++ ){

            attacks+=monh[i];

        }

    }

}

cout  << attacks << endl ;

    return 0 ;

}


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

#include<algorithm>

long long n,k,ans,h[200005];

int main(){

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

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

	std::sort(h,h+n);

	for(int i=0,j=n-k;i<j;++i)ans+=h[i];

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

	return 0;

}

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

#include <cmath>

#include <algorithm>

#include <set>



using namespace std;



int main()

{

   

    long long x, y, sum=0, res=0;



    long long arr[200005];



    cin >> x >> y;



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



        cin >> arr[i];



        sum += arr[i];

    }



    if (y >= x) {

        cout << 0;



        return 0;



    }





    sort (arr, arr + x);



    x = x - 1;



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



        res += arr[x];



        x--;



    }





    cout << sum - res;



  

}

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

#include<algorithm>

long long n,k,ans,h[200005];

int main(){

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

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

	std::sort(h,h+n);

	for(int i=0,j=n-k;i<j;++i)ans+=h[i];

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

	return 0;

}

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

#include <bits/stdc++.h>

#include<algorithm>

#include<cmath>

using namespace std;



int main()

{

    long long n,s,x;

    cin>>n>>s;

    vector<long long > v;

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

    cin>>x;

    v.push_back(x);

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

    long long k=v.size(),sum=0;

    if(s>=n){

       cout<<0;

    }else if(s<n){

    if(s>0){

    for(long long i=(k-1);i>0;i--){

    v[i]=0;

    s--;

    if(s==0)

        break;

    }}

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

     sum+=v[i];

    }

    cout<<sum;

    }

        return 0;

    }


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

#include<algorithm>

long long n,k,ans,h[200005];

int main(){

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

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

	std::sort(h,h+n);

	for(int i=0,j=n-k;i<j;++i)ans+=h[i];

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

	return 0;

}

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



using namespace std;



const int mxn = 2e5;



int a[mxn + 11];



int main(){

	int n, k;

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

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

		scanf("%d", a + i);

	}

	sort(a, a + n);

	long long ans = 0;

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

		ans += a[i];

	}

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

	return 0;

}


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

#include<algorithm>

long long n,k,ans,h[200005];

int main(){

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

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

	std::sort(h,h+n);

	for(int i=0,j=n-k;i<j;++i)ans+=h[i];

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

	return 0;

}

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

#include <vector>

#include <algorithm>

#include <numeric>



using namespace std;



int main()

{

    unsigned long long int N,K;

    unsigned long long int sum=0,val;

    vector<unsigned long long int> monsters;



    cin>>N>>K;

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

    {

        cin>>val;

        monsters.push_back(val);

    }

    if(K>=N)

    {

        cout<<0;

    }

    else

    {



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

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

        {

            sum+=monsters[i];

        }

        cout<<sum;

    }

    return 0;

}


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

#include<algorithm>

long long n,k,ans,h[200005];

int main(){

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

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

	std::sort(h,h+n);

	for(int i=0,j=n-k;i<j;++i)ans+=h[i];

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

	return 0;

}

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



using namespace std;



int func(int n)

{

    int p=n;

    int q;

    int b[10];

    int i=0;

    while(p)

    {

      q=p%10;

      b[i]=q;

      p=p/10;

      i++;

    }



    i--;

    int o=3;

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

    {

        if(b[j]-b[j+1]==1)o=1;

            else

        {

            o=0;

            break;

        }

    }

    return o;

}



int main()

{

    int n;

    int a[1005];

    scanf("%d",&n);



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

    {

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

    }



    int c,d;

    int ans=-1;



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

    {

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

        {

            if(i!=j)

            {

                c=a[i]*a[j];



                d=func(c);



                if(d==1 or d==3) ans=max(ans,c);

            }

        }

    }



    cout<<ans<<endl;

}

// Optimized solution to the same problem (faster):


#include <algorithm>

#include <bitset>

#include <cassert>

#include <cctype>

#include <climits>

#include <cmath>

#include <complex>

#include <cstdio>

#include <cstdlib>

#include <cstring>

#include <ctime>

#include <functional>

#include <iomanip>

#include <list>

#include <map>

#include <numeric>

#include <queue>

#include <set>

#include <stack>

#include <string>

#include <vector>

using namespace std;



typedef long long ll;

const int N = 1005;

const int M = 1000000007;



int nums[N];



bool check(long long num){

    int last_num=-1;

    while(num>0){

        int now = num%10;

        num/=10;



        if(last_num==-1){

            last_num = now;

        }else{

            if(now!=last_num-1){

                return false;

            }

            last_num = now;

        }



    }

    return true;

}



int main() {

    int n;

    scanf("%d",&n);

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

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

    }

    long long result = -1;

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

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

            long long tmp = nums[i]*nums[j];

            if(check(tmp)){

                if(tmp>result)

                    result = tmp;

            }

        }

    }

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

}

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

#include <cstring>

#include <cmath>

#include <algorithm>

#include <vector>

#include <string>

#include <map>

#include <set>

#include <cassert>

using namespace std;

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

#define per(i,a,n) for (int i=n-1;i>=a;i--)

#define pb push_back

#define mp make_pair

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

#define fi first

#define se second

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

typedef vector<int> VI;

typedef long long ll;

typedef pair<int,int> PII;

const ll mod=1000000007;

ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

// head



const int N=1010;

int n,a[N],ret;

bool valid(int x) {

	VI d;

	while (x) {

		d.pb(x%10);

		x/=10;

	}

	rep(i,0,SZ(d)-1) if (d[i]!=d[i+1]+1) return 0;

	return 1;

}

int main() {

	scanf("%d",&n);

	rep(i,0,n) scanf("%d",a+i);

	ret=-1;

	rep(i,0,n) rep(j,i+1,n) if (valid(a[i]*a[j])) ret=max(ret,a[i]*a[j]);

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

}

// Optimized solution to the same problem (faster):


#include <algorithm>

#include <bitset>

#include <cassert>

#include <cctype>

#include <climits>

#include <cmath>

#include <complex>

#include <cstdio>

#include <cstdlib>

#include <cstring>

#include <ctime>

#include <functional>

#include <iomanip>

#include <list>

#include <map>

#include <numeric>

#include <queue>

#include <set>

#include <stack>

#include <string>

#include <vector>

using namespace std;



typedef long long ll;

const int N = 1005;

const int M = 1000000007;



int nums[N];



bool check(long long num){

    int last_num=-1;

    while(num>0){

        int now = num%10;

        num/=10;



        if(last_num==-1){

            last_num = now;

        }else{

            if(now!=last_num-1){

                return false;

            }

            last_num = now;

        }



    }

    return true;

}



int main() {

    int n;

    scanf("%d",&n);

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

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

    }

    long long result = -1;

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

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

            long long tmp = nums[i]*nums[j];

            if(check(tmp)){

                if(tmp>result)

                    result = tmp;

            }

        }

    }

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

}

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

#include <iostream>

#include <cstdio>

#include <cstdlib>

#include <cmath>

#include <algorithm>

#include <cstring>

#include <stack>

#include <cctype>

#include <queue>

#include <string>

#include <vector>

#include<functional>

#include <set>

#include <map>

#include <climits>

#define lson root<<1,l,mid

#define rson root<<1|1,mid+1,r

#define fi first

#define se second

#define ping(x,y) ((x-y)*(x-y))

#define mst(x,y) ir(x,y,sizeof(x))

#define mcp(x,y) memcpy(x,y,sizeof(y))

using namespace std;

#define gamma 0.5772156649015328606065120

#define MOD 1000000007

#define inf 0x3f3f3f3f

#define N 100005

#define maxn 10005

typedef long long int LL;



int x[1010];

int main()

{

    int n,i;

    scanf("%d",&n);

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

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

    int ans=-1;

    int a,b,f,c,h,he;

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

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

        {

            if(a==b)

                continue;

            h=x[a]*x[b];

            if(h<ans)

                continue;

            he=h;

            c=h%10;

            h/=10;

            f=0;

            while(h)

            {

                int d=h%10;

                if(d==c-1)

                    c--;

                else

                {

                    f=1;

                    break;

                }

                h/=10;

            }

            if(f==0&&he>ans)

                ans=he;



        }

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



    return 0;

}

// Optimized solution to the same problem (faster):


#include <algorithm>

#include <bitset>

#include <cassert>

#include <cctype>

#include <climits>

#include <cmath>

#include <complex>

#include <cstdio>

#include <cstdlib>

#include <cstring>

#include <ctime>

#include <functional>

#include <iomanip>

#include <list>

#include <map>

#include <numeric>

#include <queue>

#include <set>

#include <stack>

#include <string>

#include <vector>

using namespace std;



typedef long long ll;

const int N = 1005;

const int M = 1000000007;



int nums[N];



bool check(long long num){

    int last_num=-1;

    while(num>0){

        int now = num%10;

        num/=10;



        if(last_num==-1){

            last_num = now;

        }else{

            if(now!=last_num-1){

                return false;

            }

            last_num = now;

        }



    }

    return true;

}



int main() {

    int n;

    scanf("%d",&n);

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

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

    }

    long long result = -1;

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

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

            long long tmp = nums[i]*nums[j];

            if(check(tmp)){

                if(tmp>result)

                    result = tmp;

            }

        }

    }

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

}

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

#include<iostream>

#include<sstream>

#include<algorithm>

using namespace std;

int a[1005];

int cmp(int a,int b)

{

    return a>b;

}

int cha(int n)

{

    stringstream ss;

    ss<<n;

    string s;

    ss>>s;

    for(int i=1; s[i]; i++)

    {

        if(s[i]-1!=s[i-1])

            return 0;

    }

    return 1;

}

int main()

{

    int n;

    while(~scanf("%d",&n))

    {

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

        {

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

        }

        sort(a,a+n,cmp);

        int ans=-1;

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

        {

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

            {

                if(i==j)continue;

                if(cha(a[i]*a[j]))

                {

                    ans=a[i]*a[j];

                    break;

                }

            }

            if(ans!=-1)

                break;

        }

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

    }

}

// Optimized solution to the same problem (faster):


#include <algorithm>

#include <bitset>

#include <cassert>

#include <cctype>

#include <climits>

#include <cmath>

#include <complex>

#include <cstdio>

#include <cstdlib>

#include <cstring>

#include <ctime>

#include <functional>

#include <iomanip>

#include <list>

#include <map>

#include <numeric>

#include <queue>

#include <set>

#include <stack>

#include <string>

#include <vector>

using namespace std;



typedef long long ll;

const int N = 1005;

const int M = 1000000007;



int nums[N];



bool check(long long num){

    int last_num=-1;

    while(num>0){

        int now = num%10;

        num/=10;



        if(last_num==-1){

            last_num = now;

        }else{

            if(now!=last_num-1){

                return false;

            }

            last_num = now;

        }



    }

    return true;

}



int main() {

    int n;

    scanf("%d",&n);

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

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

    }

    long long result = -1;

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

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

            long long tmp = nums[i]*nums[j];

            if(check(tmp)){

                if(tmp>result)

                    result = tmp;

            }

        }

    }

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

}

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

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

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

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

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

#define int long long

using namespace std;

typedef pair<int, int> P;



struct UF{

    vector<int> par;

    vector<int> sz;

    void init(int n){

        par.resize(n);

        sz.resize(n, 1);

        rep(i, 0, n) par[i] = i;

    }

    int find(int x){

        if(x == par[x]) return x;

        return par[x] = find(par[x]);

    }

    void unite(int x, int y){

        x = find(x); y = find(y);

        if(x == y) return;

        if(sz[x] < sz[y]) swap(x, y);

        sz[x] += sz[y];

        par[y] = x;

    }

    bool same(int x, int y){

        return find(x) == find(y);

    }

};



vector<int> lp[100010];//langauge id

vector<int> ls[100010];//person id

int n, m;



signed main(){

    cin >> n >> m;

    rep(i, 0, n){

        int k;

        cin >> k;

        rep(j, 0, k){

            int in;

            cin >> in;

            in--;

            lp[i]. push_back(in);

            ls[in]. push_back(i);

        }

    }

    UF uf;

    uf.init(n);

    rep(i, 0, m){

        if(ls[i].size() == 0) continue;

        rep(j, 1, ls[i].size()){

            uf.unite(ls[i][0], ls[i][j]);

        }

    }

    bool f = true;

    rep(i, 1, n){

        if(!uf.same(0, i)) f = false;

    }

    o((f ? "YES" : "NO"));

}

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

using namespace std;

using i64 = int64_t;

using vi = vector<i64>;

using vvi = vector<vi>;



int main() {

    int n, m;

    cin >> n >> m;

    vvi adj(n + m);

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

        int k;

        cin >> k;

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

            int a;

            cin >> a;

            a--;

            adj[i].push_back(n + a);

            adj[n + a].push_back(i);

        }

    }



    vi visited(n + m);

    function<void(int, int)> dfs = [&](int v, int p) {

        visited[v] = 1;

        for (int s : adj[v]) {

            if (s != p && !visited[s]) {

                dfs(s, v);

            }

        }

    };



    dfs(0, -1);



    int ok = 1;

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

        if (!visited[i]) {

            ok = 0;

            break;

        }

    }

    cout << (ok ? "YES" : "NO") << endl;

}

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

#define mem(s,t) memset(s,t,sizeof(s))

#define pb(s) push_back(s)

#define inf 0x3f3f3f3f

#define mn 100010

typedef long long ll;

using namespace std;

bool nusd[mn],musd[mn];

queue<int> q;

vector<int> K[mn],L[mn];

int main()

{

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

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

		int k,l;scanf("%d",&k);

		while(k--){

			scanf("%d",&l);

			L[i].pb(l);

			K[l].pb(i);

		}

	}

	int e=0;

	nusd[0]=1;

	q.push(e);

	while(!q.empty()){

		e=q.front();q.pop();

		for(int i=0;i<L[e].size();++i){

			int t=L[e][i];

			if(musd[t])continue;

			musd[t]=1;

			for(int j=0;j<K[t].size();++j){

				int p=K[t][j];

				if(nusd[p])continue;

				nusd[p]=1;

				q.push(p);

			}

		}

	}

	bool ok=1;

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

		if(!nusd[i])ok=0;

	}

	if(ok)printf("YES");else printf("NO");



    return 0;

}


// Optimized solution to the same problem (faster):
// In the name of God



#include <bits/stdc++.h>



using namespace std;



const int N = 1e5+5;



int p[2 * N];



int find_set(int u) {

	if(p[u] == u) return u;

	return p[u] = find_set(p[u]);

}



void union_set(int u, int v) {

	int pu = find_set(u);

	int pv = find_set(v);

	p[pu] = pv;

}



int main() {

	ios_base::sync_with_stdio(false);

	cin.tie(0);

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

	int n, m;

	cin >> n >> m;

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

		int k;

		cin >> k;

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

			int x;

			cin >> x;

			x--;

			union_set(i, n + x);

		}

	}

	set<int> s;

	for(int i = 0; i < n; i++) s.insert(find_set(i));

	if(s.size() == 1) cout << "YES";

	else cout << "NO";

	return 0;

}


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

using namespace std;



int n;

int par[100010];

int Rank[100010];



void init(int n)

{

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

    {

        par[i] = i;

        Rank[i] = 0;

    }

}

int find(int x)

{

    if (par[x] == x)

    {

        return x;

    }

    else

    {

        return par[x] = find(par[x]);

    }

}

void unit(int x, int y)

{

    x = find(x);

    y = find(y);

    if (x == y)

        return;



    if (Rank[x] < Rank[y])

    {

        par[x] = y;

    }

    else

    {

        par[y] = x;

        if (Rank[x] == Rank[y])

            Rank[x]++;

    }

}

bool same(int x, int y)

{

    return find(x) == find(y);

}



signed main()

{

    ios::sync_with_stdio(false);

    cin.tie(0);



    int m;

    cin >> n >> m;

    vector<int> cnt[100010];

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

    {

        int k;

        cin >> k;

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

        {

            int a;

            cin >> a;

            a--;

            cnt[a].push_back(i);

        }

    }

    init(n);

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

    {

        for (int j = 0; j < cnt[i].size(); j++)

        {

            unit(cnt[i][0], cnt[i][j]);

        }

    }

    bool f = true;

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

    {

        f = f && same(0, i);

    }

    if (f)

        cout << "YES" << endl;

    else

        cout << "NO" << endl;

}

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

#define INF 1e18

#define int long long

#define Rep(i, a, n) for (int i = (a); i < (n); i++)

#define rep(i, n) Rep(i, 0, n)

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

using namespace std;

typedef pair<int, int> P;

typedef pair<int, P> PP;

const int mod = 1000000007;



#define N 200010

int par[N], Rank[N], SIZE[N];



void init(int n)

{

    rep(i, n)

    {

        par[i] = i;

        Rank[i] = 0;

        SIZE[i] = 1;

    }

}

int find(int x)

{

    if (par[x] == x)

        return x;

    else

        return par[x] = find(par[x]);

}

void unit(int x, int y)

{

    x = find(x);

    y = find(y);

    if (x == y)

        return;



    if (Rank[x] < Rank[y])

    {

        par[x] = y;

        SIZE[y] += SIZE[x];

    }

    else

    {

        par[y] = x;

        SIZE[x] += SIZE[y];

        if (Rank[x] == Rank[y])

            Rank[x]++;

    }

}

bool same(int x, int y)

{

    return find(x) == find(y);

}



signed main()

{

    ios::sync_with_stdio(false);

    cin.tie(0);



    int n, m;

    cin >> n >> m;

    init(n + m);

    rep(i, n)

    {

        int k;

        cin >> k;

        rep(j, k)

        {

            int l;

            cin >> l;

            l += (n - 1);

            unit(i, l);

        }

    }

    rep(i, n) if (!same(0, i))

    {

        cout << "NO" << endl;

        return 0;

    }

    cout << "YES" << endl;

}

// Fastest known solution for this problem: