criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <bits/stdc++.h>

long long s[100000];
long long t[100000];
long long x[100000];

int binary_search(long long[] a,int src,int dst,long long key){
  int ok=0;
  int ng=dst;
  while(ng-ok>1){
    int middle=(ok+ng)/2;
    if(a[middle]>=a[key]){
      ok=middle;
    }else{
      ng=middle;
    }
  }
  return ok;
}

int main(){
  
  int A,B,Q;
  std::cin>>A>>B>>Q;
  for(int i=0;i<A;++i){
    std::cin>>s[i];
  }
  for(int i=0;i<B;++i){
    std::cin>>t[i];
  }

  long long ans=999999999999999999LL;
  for(int i=0;i<Q;++i){
    std::cin>>x[i];
    int u=binary_search(s,x[i]);
    int v=binary_search(t,x[i]);
    for(int j=std::max(0,u-1);j<std::min(A,u+1);++j){
      for(int k=std::max(0,v-1);k<std::min(B,v+1);++k){
	ans=std::min(ans,std::abs(x[i]-s[j])+std::abs(s[j]-t[k]));
	ans=std::min(ans,std::abs(x[i]-t[j])+std::abs(s[j]-t[k]));
	
      }
    }
    std::cout<<ans<<std::endl;
    

  }
  

  return 0;
}


Compiler output:
a.cc:7:31: error: expected ',' or '...' before 'a'
    7 | int binary_search(long long[] a,int src,int dst,long long key){
      |                               ^
a.cc: In function 'int binary_search(long long int*)':
a.cc:9:10: error: 'dst' was not declared in this scope
    9 |   int ng=dst;
      |          ^~~
a.cc:12:8: error: 'a' was not declared in this scope
   12 |     if(a[middle]>=a[key]){
      |        ^
a.cc:12:21: error: 'key' was not declared in this scope; did you mean 'key_t'?
   12 |     if(a[middle]>=a[key]){
      |                     ^~~
      |                     key_t
a.cc: In function 'int main()':
a.cc:35:24: error: too many arguments to function 'int binary_search(long long int*)'
   35 |     int u=binary_search(s,x[i]);
      |           ~~~~~~~~~~~~~^~~~~~~~
a.cc:7:5: note: declared here
    7 | int binary_search(long long[] a,int src,int dst,long long key){
      |     ^~~~~~~~~~~~~
a.cc:36:24: error: too many arguments to function 'int binary_search(long long int*)'
   36 |     int v=binary_search(t,x[i]);
      |           ~~~~~~~~~~~~~^~~~~~~~
a.cc:7:5: note: declared here
    7 | int binary_search(long long[] a,int src,int dst,long long key){
      |     ^~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)

int main(){
    int a, b, q;
    cin >> a >> b >> q;
    // ll s[a];
    // ll t[b];
    vector <ll> s(a);
    vector <ll> t(b);
    rep(i, a){
        cin >> s[i];
    }
    rep(i, b){
        cin >> t[i];
    }
    // ll x[q];
    vector<ll> x(q);
    rep(i, q){
        cin >> x[i];
        ll si = lower_bound(s.begin(), s.end(), x[i]) -s.begin();
        ll ti = lower_bound(t.begin(), t.end(), x[i]) -t.begin();
        
        ll MIN = 1000000000;
        rep(k, 4){
            rep(m, 4)
                ll tmp1 = abs(x[i]-s[si+k-2]) + abs(t[ti+m-2]-s[si+k-2]);
                ll tmp2 = abs(x[i]-t[ti+k-2]) + abs(s[si+m-2]-t[ti+k-2]);
                MIN = min(MIN, tmp1);
                MIN = min(MIN, tmp2);            
        }
        cout << MIN << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:58: error: 'm' was not declared in this scope
   30 |                 ll tmp2 = abs(x[i]-t[ti+k-2]) + abs(s[si+m-2]-t[ti+k-2]);
      |                                                          ^
a.cc:31:32: error: 'tmp1' was not declared in this scope; did you mean 'tmp2'?
   31 |                 MIN = min(MIN, tmp1);
      |                                ^~~~
      |                                tmp2
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007

int main(){
   int a,b,q;
   cin>>a>>b>>q;
   int s[a],t[b],x[q];
   for(int i=0;i<a;i++) cin>>s[i];
   for(int i=0;i<b;i++) cin>>t[i];
   for(int i=0;i<q;i++) cin>>x[i];
   int c[a],d[b];
   for(int i=0;i<a;i++){
       if(s[i]>=t[b-1]) c[i]=t[b-1];
       int *pos;
       pos=lower_bound(t,t+b,s[i]);
       int idx=distance(t,pos);
       if(idx==0) c[i]=t[0];
       else{
           if(abs(s[i]-t[idx])<abs(s[i]-t[idx-1])) c[i]=t[idx];
           else c[i]=t[idx-1];
       }
   }
   for(int i=0;i<b;i++){
       if(t[i]>=s[a-1]) d[i]=s[a-1];
       int *pos;
       pos=lower_bound(s,s+a,t[i]);
       int idx=distance(s,pos);
       if(idx==0) d[i]=s[0];
       else{
           if(abs(t[i]-s[idx])<abs(t[i]-s[idx-1])) d[i]=s[idx];
           else d[i]=s[idx-1];
       }
   }
   for(int i=0;i<q;i++){
       int ans1,ans2;
       int *pos;
       pos=lower_bound(s,s+a,x[i]);
       int idx=distance(s,pos);
       int *pos1;
       pos1=lower_bound(t,t+b,x[i]);
       int idx1=distance(t,pos1);
       if(x[i]>=s[a-1]){
           ans1=x[i]-s[a-1]+abs(s[a-1]-c[a-1]);
       }
       else if(idx==0){
           ans1=abs(x[i]-s[0])+abs(s[0]-c[0]);
       }
       else{
           if(abs(x[i]-s[idx])<abs(x[i]-s[idx-1])) ans1=abs(x[i]-s[idx])+abs(s[idx]-c[idx]);
           else ans1=abs(x[i]-s[idx-1])+abs(s[idx-1]-c[idx-1]);
       }
       
       if(x[i]>=t[b-1]){
           ans2=x[i]-t[b-1]+abs(t[b-1]-d[b-1]);
       }
       else if(idx1==0){
           ans2=abs(x[i]-t[0])+abs(t[0]-d[0]);
       }
       else{
           if(abs(x[i]-t[idx1])<abs(x[i]-t[idx1-1])) ans2=abs(x[i]-t[idx1])+abs(t[idx1]-d[idx1]);
           else ans2=abs(x[i]-t[idx1-1])+abs(t[idx1]-d[idx1-1]);
       }
       cout<<min(ans1,ans2)<<" "<<ans1<<" "<<ans2<<endl;
       
   }
   

Compiler output:
a.cc: In function 'int main()':
a.cc:67:5: error: expected '}' at end of input
   67 |    }
      |     ^
a.cc:6:11: note: to match this '{'
    6 | int main(){
      |           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

int binsearch(int left, int right, int tar, vector<int> a) {
  int m = (left + right) / 2;
  if (left >= right) {
	return m;
  } else if (tar < a.at(m)) {
    return  binsearch(left, m - 1, tar, a);
  } else if (tar >= a.at(m)) {
    return  binsearch(m, right, tar, a);
  }
}

int main(){
  int A, B, Q;
  cin >> A >> B >> Q;

  vector<int> s;
  for (int i=0; i<A; i++) {
	int si;
	cin >> si;
	s.push_back(si);
  }
  vector<int> t;
  for (int i=0; i<B; i++) {
	int ti;
	cin >> ti;
	t.push_back(ti);
  }
  vector<int> x;
  for (int i=0; i<Q; i++) {
	int xi;
	cin >> xi;
	x.push_back(xi);
  }

  for (int i; i<A; i++) {
	// find t* nearest from si
  }
  for (int i; i<N; i++) {
	// find s* nearest from ti
  }

  for (int i; i<Q; i++) {
	// find s* or t* next from xi (left and right)
	for (int j; j<2; j++) {
	  // calc dist
	}
	// print
  }

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:41:17: error: 'N' was not declared in this scope
   41 |   for (int i; i<N; i++) {
      |                 ^
a.cc: In function 'int binsearch(int, int, int, std::vector<int>)':
a.cc:13:1: warning: control reaches end of non-void function [-Wreturn-type]
   13 | }
      | ^
Language: Java

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();
        int b = sc.nextInt();
        int q = sc.nextInt();

        long[] s = new long[a];
        for (int i = 0; i < a; i++) {
            s[i] = sc.nextLong();
        }

        long[] t = new long[b];
        for (int i = 0; i < b; i++) {
            t[i] = sc.nextLong();
        }

        long[] x = new long[q];
        for (int i = 0; i < q; i++) {
            x[i] = sc.nextLong();

            long shr = 9223372036854775807;
            long tem = 9223372036854775807;
            long shrine = 0;
            long temple = 0;
            long shrine2 = 9223372036854775807;
            long temple2 = 9223372036854775807;
            for (int j = 0; j < a; j++) {
                if (shr > Math.abs(s[j] - x[i])) {
                    shr = Math.abs(s[j] - x[i]);
                    shrine = s[j];
                }
            }
            for (int j = 0; j < b; j++) {
                if (tem > Math.abs(t[j] - x[i])) {
                    tem = Math.abs(t[j] - x[i]);
                    temple = t[j];
                }
            }
            for (int j = 0; j < a; j++) {
                if (shrine2 > Math.abs(s[j] - temple)) {
                    shrine2 = Math.abs(s[j] - temple);
                }
            }
            for (int j = 0; j < b; j++) {
                if (temple2 > Math.abs(t[j] - shrine)) {
                    temple2 = Math.abs(t[j] - shrine);
                }
            }


            long pattern_1 = shr + temple2;
            long pattern_2 = tem + shrine2;

            System.out.println(Math.min(pattern_1,pattern_2));
        }
    }
}


Compiler output:
Main.java:25: error: integer number too large
            long shr = 9223372036854775807;
                       ^
Main.java:26: error: integer number too large
            long tem = 9223372036854775807;
                       ^
Main.java:29: error: integer number too large
            long shrine2 = 9223372036854775807;
                           ^
Main.java:30: error: integer number too large
            long temple2 = 9223372036854775807;
                           ^
4 errors
Language: C++

#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <list>
#include <string>
#include <math.h>
#include <set>
#include <string>
#include <sstream>
#include <malloc.h>
using namespace std;


vector<int> bs(vector<long long> a,long long x)
{
	int l=0;
	int r=a.size()-1;
	vector<int> result;
	if(x<a[0])
	{
		result.push_back(0);
		return result;
	}
	if(a[r]<x)
	{
		result.push_back(r);
		return result;
	}
	while(l>=r)
	{
		int m=(l+r)/2;
		if(a[m]<=x)
		{
			l=m;
		}
		if(a[m]>=x)
		{
			r=m;
		}
	}
	result.push_back(l);
	result.push_back(r-1);
	return result;
}
int main()
{
	int A,B,Q;
	cin>>A>>B>>Q;

	vector<long long> s;
	s.resize(A);
	vector<long long> t;
	t.resize(B);

	for(int i=0; i<A; i++)
	{
		cin>>s[i];
	}
	for(int i=0; i<B; i++)
	{
		cin>>t[i];
	}

	sort(s.begin(),s.end());
	sort(t.begin(),t.end());

	for(int n=0; n<Q; n++)
	{
		long long x;
		cin>>x;

		vector<int> sx = bs(s,x);
		vector<int> tx = bs(t,x);
		
		vector<long long> list;
		for(int i=0; i<sx.size(); i++)
		{
			for(int j=0; j<tx.size(); j++)
			{
				//cout<<abs((tx[j]-x)-(sx[i]-x))<<endl;
				long long cp = abs(s[sx[i]]-t[tx[j]])
				list.push_back(abs(t[tx[j]]-x)+cp);
				list.push_back(abs(s[sx[i]]-x)+cp);
			}
		}
		long long result = *min_element(list.begin(),list.end());
		cout<<result<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:85:33: error: expected ',' or ';' before 'list'
   85 |                                 list.push_back(abs(t[tx[j]]-x)+cp);
      |                                 ^~~~
Language: Java

import java.util.Scanner;
class Main{
  public static void main(String args[]){
    Scanner scan=new Scanner(System.in);
    int a=scan.nextInt();
    int b=scan.nextInt();
    int q=scan.nextInt();
    long s[]=new long[a];
    long t[]=new long[b];
    long x[]=new long[q];
    
    long min;
    long u,v;
    
    for(int i=0;i<a;i++){
      s[i]=scan.nextLong();
    }
    for(int i=0;i<b;i++){
      t[i]=scan.nextLong();
    }
    for(int i=0;i<q;i++){
      x[i]=scan.nextLong();
    }
    long c;
    long d;
    long e;
    long f;
    int ii,jj;
    for(int i=0;i<q;i++){
      c=1145148101919L;
      d=1145148101919L;
      e=1145148101919L;
      f=1145148101919L;
      for(int j=0;j<=a/100;j++){
        if(x[i]<=s[j*100]){
          jj=j*100;
          j=a+1;
        }
      }
      for(int j=0;j<101;j++){
        if((x[i]>s[jj-j])&&(x[i]<s[jj-j+1])){
          ii=jj-j;
        }
      }
      c=x[i]-s[ii];
      d=s[ii+1]-x[i];
      for(int j=0;j<=b/100;j++){
        if(x[i]<=t[j*100]){
          jj=j*100;
          j=a+1;
        }
      }
      for(int j=0;j<101;j++){
        if((x[i]>t[jj-j])&&(x[i]<t[jj-j+1])){
          ii=jj-j;
        }
      }
      e=x[i]-t[ii];
      f=t[ii+1]-x[i];
      min=Math.min(Math.max(c,e),Math.max(d,f));
      u=Math.min(c+c+f,c+f+f);
      v=Math.min(d+d+e,d+e+e);
      u=Math.min(u,v);
      min=Math.min(min,u);
      System.out.println(min);
    }
  }
}


Compiler output:
Main.java:41: error: variable jj might not have been initialized
        if((x[i]>s[jj-j])&&(x[i]<s[jj-j+1])){
                   ^
Main.java:45: error: variable ii might not have been initialized
      c=x[i]-s[ii];
               ^
Main.java:54: error: variable jj might not have been initialized
        if((x[i]>t[jj-j])&&(x[i]<t[jj-j+1])){
                   ^
3 errors
Language: C

        for(i=0;i<shrine;i++){
            tmp = si[tmpi] - ti[i];
            if(tmp < 0){tmp *= -1};

            if(tmp < min){
                min = tmp;
            }
        }

Compiler output:
main.c:1:9: error: expected identifier or '(' before 'for'
    1 |         for(i=0;i<shrine;i++){
      |         ^~~
main.c:1:18: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 |         for(i=0;i<shrine;i++){
      |                  ^
main.c:1:27: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
    1 |         for(i=0;i<shrine;i++){
      |                           ^~
Language: C++

#include <iostream>
#include <algorithm>
#include <string> 
#include <vector>
#include <iomanip>
#include <math.h>
using namespace std;

int main()
{
	double a,b,q;
    cin >> a >> b >> q;
    vector<double> s(a);
    vector<double> t(b);
    vector<double> x(q);
    for(int i = 0; i < a; i++){
        cin >> s[i];
    }
    for(int i2 = 0; i2 < b; i2++){
        cin >> t[i2];
    }
    for(int i3 = 0; i3 < q; i3++){
        cin >> x[i3];
    }
    sort(s.begin(), s.end());
    sort(t.begin(), t.end());
    double min = min(s[0],t[0]);
    double max = max(s[a],t[b]);
    for(int j = 0; j < q; j++){
        double ansS = 100000000000000;
        double ansT = 100000000000000;
        if(min <= x[j] && x[j] <= max){
            for(int k1 = 0; k1 < a; k1++){
                if(fabs(s[k1] - x[j]) < ansS){
                    ansS = fabs(s[k1] - x[j]);
                }
            }
            for(int k2 = 0; k2 < b; k2++){
                if(fabs(t[k2] - x[j]) < ansT){
                    ansT = fabs(t[k2] - x[j]);
                }
            }
          cout << ansS + ansT + min(ansS,ansT) << endl;
        }
    }
    else if(min > x[j]){
        cout << max(s[0],t[0]) - x[j] << endl;
    }
    else {
        cout << x[j] - min(s[a],t[b]) << endl;
    }
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:21: error: 'min' cannot be used as a function
   27 |     double min = min(s[0],t[0]);
      |                  ~~~^~~~~~~~~~~
a.cc:28:21: error: 'max' cannot be used as a function
   28 |     double max = max(s[a],t[b]);
      |                  ~~~^~~~~~~~~~~
a.cc:43:36: error: 'min' cannot be used as a function
   43 |           cout << ansS + ansT + min(ansS,ansT) << endl;
      |                                 ~~~^~~~~~~~~~~
a.cc:46:5: error: 'else' without a previous 'if'
   46 |     else if(min > x[j]){
      |     ^~~~
a.cc:46:21: error: 'j' was not declared in this scope
   46 |     else if(min > x[j]){
      |                     ^
a.cc:47:20: error: 'max' cannot be used as a function
   47 |         cout << max(s[0],t[0]) - x[j] << endl;
      |                 ~~~^~~~~~~~~~~
a.cc:50:27: error: 'min' cannot be used as a function
   50 |         cout << x[j] - min(s[a],t[b]) << endl;
      |                        ~~~^~~~~~~~~~~
a.cc: At global scope:
a.cc:53:1: error: expected declaration before '}' token
   53 | }
      | ^
Language: C++

#include<bits/stdc++.h>
#define mx 100005
using namespace std;

int a, b, q;
long long s[mx] = {-1e12}, t[mx] = {-1e12}, qq;

int main(){
  scanf("%d%d%d", &a, &b, &q);
  for(int i = 1; i <= a; i++) scanf("%lld", s+i); s[a+1] = 1e12;
  for(int i = 1; i <= b; i++) scanf("%lld", t+i); t[b+1] = 1e12;
  for(int i = 0; i < q; i++){
    scanf("%lld", &qq);
    auto ss = lower_bound(s, s+a+2, qq);
    long long sp = *ss, sd = *ss == qq ? qq : *(ss-1);
    auto tt = lower_bound(t, t+b+2, qq);
    long long tp = *tt, td = *tt == qq ? qq : *(tt-1);
    long long ans = min(max(sp, tp) - qq, qq - min(sd, td));
    if((sp-tp)*(sd-td)>0) ans = min(ans, sp > tp ?  min(tp - qq, qq - sd) + tp - sd : min(sp - qq, qq - td) + sp - td);
    printf("%lld\n", ans);
  }
}

Compiler output:
a.cc:6:20: error: narrowing conversion of '-1.0e+12' from 'double' to 'long long int' [-Wnarrowing]
    6 | long long s[mx] = {-1e12}, t[mx] = {-1e12}, qq;
      |                    ^~~~~
a.cc:6:37: error: narrowing conversion of '-1.0e+12' from 'double' to 'long long int' [-Wnarrowing]
    6 | long long s[mx] = {-1e12}, t[mx] = {-1e12}, qq;
      |                                     ^~~~~
Language: C++

#include <bits/stdc++.h>
#include <windows.h>
using namespace std;

int main(){
	int a,b,q;
	cin>>a>>b>>q;
	Sleep(2000);
	int s[a+1],t[b+1],x[q+1];
	for(int i=1;i<=a;i++) cin>>s[i];
	for(int i=1;i<=b;i++) cin>>t[i];
	for(int i=1;i<=q;i++) cin>>x[i];
	int maxns=-1,maxnt=-1,maxn;
	for(int i=1;i<=a;i++){
		if(s[i]>maxns) maxns=s[i];
	}
	for(int i=1;i<=b;i++){
		if(t[i]>maxnt) maxnt=t[i];
	} 
	maxn=max(maxns,maxnt);
	int dis[maxn]={0};
	//memset(0,dis,sizeof(dis));
	for(int i=1;i<=a;i++){
		dis[s[i]]=1;
	} 
	for(int i=1;i<b;i++){
		dis[t[i]]=2;
	} 
	for(int i=1;i<=q;i++){
		
	}
	return 0;
}


Compiler output:
a.cc:2:10: fatal error: windows.h: No such file or directory
    2 | #include <windows.h>
      |          ^~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <set>
#include <cmath>

using namespace std;
using ll = long long;

const ll INF = 1LL << 50;

int main() {
    int A, B, Q;
    cin >> A >> B >> Q;

    set<ll> s = {-INF, INF}, t = {-INF, INF};
    for (int i = 0; i < A; ++i) {
        ll a;
        cin >> a;
        s.insert(a);
    }
    for (int i = 0; i < B; ++i) {
        ll a;
        cin >> a;
        t.insert(a);
    }

    for (int q = 0; q < Q; ++q) {
        ll x;
        cin >> x;
        auto sitr = s.upper_bound(x);
        ll sr = *sitr, sl = *(--sitr);
        auto titr = t.upper_bound(x);
        ll tr = *titr, tl = *(--titr);

        cout << min({
                    min(sr - x, x - tl) + (sr - tl),
                    min(tr - x, x - sl) + (tr - sl),
                    max(sr, tr) - x,
                    x - min(sl, tl),
                })
             << endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:20: error: no matching function for call to 'min(<brace-enclosed initializer list>)'
   34 |         cout << min({
      |                 ~~~^~
   35 |                     min(sr - x, x - tl) + (sr - tl),
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   36 |                     min(tr - x, x - sl) + (tr - sl),
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   37 |                     max(sr, tr) - x,
      |                     ~~~~~~~~~~~~~~~~
   38 |                     x - min(sl, tl),
      |                     ~~~~~~~~~~~~~~~~
   39 |                 })
      |                 ~~  
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 1 provided
Language: C++

#include <iostream>
#include <set>

using namespace std;
using ll = long long;

const ll INF = 1LL << 50;

int main() {
    int A, B, Q;
    cin >> A >> B >> Q;

    set<ll> s = {-INF, INF}, t = {-INF, INF};
    for (int i = 0; i < A; ++i) {
        ll a;
        cin >> a;
        s.insert(a);
    }
    for (int i = 0; i < B; ++i) {
        ll a;
        cin >> a;
        t.insert(a);
    }

    for (int q = 0; q < Q; ++q) {
        ll x;
        cin >> x;
        auto sitr = s.upper_bound(x);
        ll sr = *sitr, sl = *(--sitr);
        auto titr = t.upper_bound(x);
        ll tr = *titr, tl = *(--titr);

        cout << min({
                    min(sr - x, x - tl) + (sr - tl),
                    min(tr - x, x - sl) + (tr - sl),
                    max(sr, tr) - x,
                    x - min(sl, tl),
                })
             << endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:20: error: no matching function for call to 'min(<brace-enclosed initializer list>)'
   33 |         cout << min({
      |                 ~~~^~
   34 |                     min(sr - x, x - tl) + (sr - tl),
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   35 |                     min(tr - x, x - sl) + (tr - sl),
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   36 |                     max(sr, tr) - x,
      |                     ~~~~~~~~~~~~~~~~
   37 |                     x - min(sl, tl),
      |                     ~~~~~~~~~~~~~~~~
   38 |                 })
      |                 ~~  
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 1 provided
Language: C++

#include <stdio.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <algorithm>
#include <vector>
#include <math.h>
#define MOD (long long)1000000007
using namespace std;

int nibutan(vector<long long> a, int key){
    int ok=0,ng=a.size();
    while(abs(ok-ng)>1){
        int mid=(ok+ng)/2;
        if(a[mid]<=key)ok=mid;
        else ng=mid;
    }
    return ok;
}
int main(void){
    int a,b,q;
    cin >> a >> b >> q;
    vector<long long> shrine(a+2),temple(b+2);
    for(int i=1; i<=a; i++)cin >> shrine[i];
    for(int i=1; i<=b; i++)cin >> temple[i];
    sort(shrine.begin(),shrine().end());
    sort(temple.begin(),temple.end());
    shrine[0]=-MOD*MOD;shrine[a+1]=MOD*MOD;
    temple[0]=-MOD*MOD;temple[b+1]=MOD*MOD;
    long long now,n=0,m=0,l,r;
    for(int i=0; i<q; i++){
        cin >> now;
        n=nibutan(shrine, now);
        m=nibutan(temple, now);
        l=max(shrine[n],temple[m]),r=min(shrine[n+1],temple[m+1]);
        cout << min({now-min(shrine[n],temple[m]), r-l+min(now-l,r-now), max(shrine[n+1],temple[m+1])-now}) << endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:31: error: no match for call to '(std::vector<long long int>) ()'
   27 |     sort(shrine.begin(),shrine().end());
      |                         ~~~~~~^~
Language: C++

#include <iostream>
using namespace std;

int main()
{
  int n, k;
  cin >> n >> k;
  bool small = 0;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    small |= (x < k);
  }
  if (small) {
    cout << "-1";
    return 0;
  }
  
  cout << n * k << '\n';
  for (int i = 1; i <= k)
    for (int j = 1; j <= n; j++)
      cout << j << ' ';
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:25: error: expected ';' before ')' token
   20 |   for (int i = 1; i <= k)
      |                         ^
      |                         ;
Language: C++

#include<iostream>
using namespace std;
int main () {
  int N, K;
  cin >> N >> K;
  int min = 1000;
  int min2 = 1000;
  int last;
  for (int i = 0; i < N; i ++) {
    int k;
    cin >> k;
    if (min > k) {
      min = k;
      last = i + 1;
      continue;
    }
    if (min2 > k) min2 = k;
  }
  if (min < K) cout << -1 << endl;
  else {
    if (min2 == K) cout << -1 << endl;
    else {
      cout << N * (K + 1) - 1 << endl;
      for (int i = 1; i <= K; i ++) cout << i << 

Compiler output:
a.cc: In function 'int main()':
a.cc:24:49: error: expected primary-expression at end of input
   24 |       for (int i = 1; i <= K; i ++) cout << i <<
      |                                                 ^
a.cc:24:49: error: expected '}' at end of input
a.cc:22:10: note: to match this '{'
   22 |     else {
      |          ^
a.cc:24:49: error: expected '}' at end of input
   24 |       for (int i = 1; i <= K; i ++) cout << i <<
      |                                                 ^
a.cc:20:8: note: to match this '{'
   20 |   else {
      |        ^
a.cc:24:49: error: expected '}' at end of input
   24 |       for (int i = 1; i <= K; i ++) cout << i <<
      |                                                 ^
a.cc:3:13: note: to match this '{'
    3 | int main () {
      |             ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define mp make_pair
#define F first
#define S second
#define FOR(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define SORT(c) sort((c).begin(),(c).end())

typedef long long ll;
const ll INF = 2e15+7;
const ll mod = 1e9+7;
const int MAX_N = 5e5+5;
int dx[] = {-1,0,1,0},dy[] = {0,1,0,-1};
vector<ll> prime;

ll inv[MAX_N],fac[MAX_N];

template <class T = ll> T in(){T x;cin >> x;return (x);}
inline ll GCD(ll a,ll b){ll c;while(b!=0){c=a%b;a=b;b=c;}return a;}
inline ll LCM(ll a,ll b){return a*b/GCD(a,b);}
inline ll POW(ll a,ll b){ll c=1;while(b>0){if(b&1){c=a*c%mod;}a=a*a%mod;b>>=1;}return c;}
inline void _nCr(){fac[0]=1;for(int i=1;i<MAX_N;i++){fac[i]=fac[i-1]*i%mod;}for(int i=0;i<MAX_N;i++){inv[i]=POW(fac[i],mod-2);}}
inline ll nCr(ll n,ll r){return (fac[n]*inv[r]%mod)*inv[n-r]%mod;}
inline void PRI(ll n){bool a[n+1];for(int i=0;i<n+1;i++){a[i]=1;}for(int i=2;i<n+1;i++){if(a[i]){prime.pb(i);ll b=i;while(b<=n){a[b]=0;b+=i;}}}}

class UnionFind {
private:
	int par[MAX_N];
	int rank[MAX_N];
public:
	void init(int n);
	int find(int x);
	void unite(int x,int y);
	bool same(int x,int y);
};

void UnionFind::init(int n) {
	for (int i = 0;i < n;i++) {
		par[i] = i;
		rank[i] = 0;
	}
}

int UnionFind::find(int x) {
	if (par[x] == x) return x;
	else return par[x] = find(par[x]);
}

void UnionFind::unite(int x,int y) {
	x = find(x);
	y = find(y);
	if (rank[x] < rank[y]) par[x] = y;
	else {
		par[y] = x;
		if (rank[x] == rank[y]) rank[x]++;
	}
}

bool UnionFind::same(int x,int y) {
	x = find(x);
	y = find(y);
	return x == y;
}

typedef struct {
	int num;
	int pos;
} BOX;

bool cmp(BOX &a,BOX &b) {
	return a.num > b.num;
}

int main() {
	int n=in(),k=in();
	BOX a[n];
	REP(i,n) {a[i].num=in();a[i].pos=i+1;}
	sort(a,a+n,cmp);
	string output = "";
	int pos = n-1;
	int ok = k;
	int cnt = 0;
	for (int i = 0;i < k+10;i++) {
		for (int j = 0;j < n;j++) {
			if (!a[j].num) {cout << -1 << endl;return 0;}
			else {
				a[j].num--;
				cnt++;
				output += to_string(a[j].pos) + " ";
				if (pos==j) {
					if (!ok) {goto aaa;}
					else {
						ok--;
						pos=(j+n-1)%n;
					}
				}
			}
		}
	}
	// aaa:cout << cnt << endl << output << endl;
	aaa:a[n+114514] = 1919810;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:106:27: error: no match for 'operator=' (operand types are 'BOX' and 'int')
  106 |         aaa:a[n+114514] = 1919810;
      |                           ^~~~~~~
a.cc:73:3: note: candidate: 'constexpr BOX& BOX::operator=(const BOX&)'
   73 | } BOX;
      |   ^~~
a.cc:73:3: note:   no known conversion for argument 1 from 'int' to 'const BOX&'
a.cc:73:3: note: candidate: 'constexpr BOX& BOX::operator=(BOX&&)'
a.cc:73:3: note:   no known conversion for argument 1 from 'int' to 'BOX&&'
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ref(i,x,y)for(int i=x;i<=y;++i)
#define def(i,x,y)for(int i=x;i>=y;--i)
#define fi first
#define se second
typedef long long LL;
typedef pair<int,int> PII;
const int N=110;
PII a[N];int n,k,b[5001],m,c[5001][N];
void printno(){
	puts("-1");
	exit(0);
}
int main(){
	cin>>n>>k;
	ref(i,1,n)cin>>a[i].fi,a[i].se=i;
	while(1){
		int id=0,w=0;
		ref(i,1,n)if(a[i].fi>w)w=a[i].fi,id=i;
		if(!w)break;
		b[++m]=id;a[i].fi--;
	}
	ref(i,1,n)c[0][i]=1;
	ref(i,1,m)ref(j,1,n)if(j!=b[i]){
		int res=1e9;
		ref(k,1,n)if(c[i-1][k])res=min(res,c[i-1][k]+(k!=j));
		if(res!=1e9)c[i][j]=res;
	}
	int ans=1e9;
	ref(i,1,n)if(c[m][i])ans=min(ans,c[m][i]-1);
	if(ans<=k)puts("-1");
	else{
		cout<<m<<endl;
		ref(i,1,m)cout<<b[i]<<" ";
		puts("");
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:29: error: 'i' was not declared in this scope
   22 |                 b[++m]=id;a[i].fi--;
      |                             ^
Language: C++

#include<cstdio>
using namespace std;
int main(){
  int n,k,a[50],sum=0;
  scanf("%d%d",&n,&k);
  for(int i=0;i<n;i++){
    scanf("%d",&a[i]);
    sum+=a[i];
  }
  if(sum<k){
    prntf("-1¥n");
  }
  else{
    prntf("%d¥n",sum);
    for(int i=0;i<n;i++){
      for(int j=1;j<a[i];j++){
        prntf("%d ",i);
      }
    }
    for(int i=0;i<n;i++){
      prntf("%d ",i);
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: 'prntf' was not declared in this scope; did you mean 'printf'?
   11 |     prntf("-1¥n");
      |     ^~~~~
      |     printf
a.cc:14:5: error: 'prntf' was not declared in this scope; did you mean 'printf'?
   14 |     prntf("%d¥n",sum);
      |     ^~~~~
      |     printf
Language: Java

import java.util.*;
public class Main {
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    int a[] = new int[N];
    int min = 1000;
    for(int i = 0; i < N; i++){
      a[i] = sc.nextInt();
      min = Math.min(min, a[i]);
    }
    if(K <= min){
      System.out.println(K * N);
      for(int i = 0; i < K; i++){
        for(int j = 0; j < N; j++){
          System.out.println(j + 1);
        }
      }
    } else {
      System.out.println(-1);
    }
}

Compiler output:
Main.java:23: error: reached end of file while parsing
}
 ^
1 error
Language: Java

import java.util.Scanner;
class Main{
  public static void main(String args[]){
    Scanner scan=new Scanner(System.in);
    int n=scan.nextInt();
    int k=scan.nextInt();
    int a[]=new int[n];
    for(int i=0;i<n;i++){
      a[i]=scan.nextInt();
      a[i]=k+1-a[i];
      a[i]=Math.max(a[i],0);
    }
    int sum=0;
    for(int i=0;i<n;i++){
      sum+=a[i];
      if(2*a[i]>k+1){
        i=n;
        sum=k+1;
      }
    }
    if(sum>k){
      System.out.println(-1);
    }else{
    int b[]=new int[k+2];
    int c=0;
    b[0]=-1;
    for(int i=0;i<k+1;i++){
      c=0;
      for(int j=0;j<n;j++){
        if((j!=b[i])&&(a[j]>a[c])) c=j;
      }
      a[c]--;
      b[i+1]=c;
    }
    for(int j=0;j<k+1;j++){
    for(int i=0;i<n;i++){
      if(b[j+1]!=i) System.out.print((i+1)+" ");
    }
    }
  }
}


Compiler output:
Main.java:41: error: reached end of file while parsing
}
 ^
1 error
Language: Java

import java.util.Scanner;
class Main{
  public static void main(String args[]){
    Scanner scan=new Scanner(System.in);
    int n=scan.nextInt();
    int k=scan.nextInt();
    int a[]=new int[n];
    for(int i=0;i<n;i++){
      a[i]=scan.nextInt();
      a[i]=k+1-a[i];
      a[i]=Math.max(a[i],0);
    }
    int sum=0;
    for(int i=0;i<n;i++){
      sum+=a[i];
      if(2*a[i]>k+1){
        i=n;
        sum=k+1;
      }
    }
    if(sum>k){
      System.out.println(-1);
    }else{
    int b[]=new int[k+2];
    int c=0;
    b[0]=-1;
    for(int i=0;i<k+1;i++){
      c=0;
      for(int j=0;j<n;j++){
        if((j!=b[i])&&(a[j]>a[c])) c=j;
      }
      a[c]--;
      b[i+1]=c;
    }
    for(int j=0;j<k+1;j++){
    for(int i=0;i<n;i++){
      if(b[j+1]!=i) System.out.print((i+1)+" ");
    }
  }
}

Compiler output:
Main.java:40: error: reached end of file while parsing
}
 ^
1 error
Language: C++

#include <stdio.h>
#include <algorithm>
#include <vector>

using namespace std;

class p {
public:
	int c, idx;
};

bool cmp(const p &i, const p &j) {
	return i.c>j.c;
}

p a[51];
int n, k, b[51];

int main() {
	scanf("%d %d",&n,&k);
	for(int i=1;i<=n;i++) {
		scanf("%d",&a[i].c);
		b[i]=a[i].c;
		a[i].idx=i;
	}
	sort(a+1,a+n+1,cmp);
	vector<int> res;
	int cur=n;
	bool ok=false;
	while(1) {
		bool found=false;
		for(int i=1;i<=n;i++) {
			if(a[i].c) {
				found=true; break;
			}
		}
		if(!found) break;
		if(!tt) {
			for(int i=1;i<=n-1;i++) {
				if(a[i].c==0) continue;
				res.push_back(a[i].idx);
				a[i].c--;
				if(cur==i) {
					if(k==0) ok=true;
					else {
						k--; cur=n;
					}
				}
			}
		} else {
			for(int i=n;i>=2;i--) {
				if(a[i].c==0) continue;
				res.push_back(a[i].idx);
				a[i].c--;
				if(cur==i) {
					if(k==0) ok=true;
					else {
						k--; cur=1;
					}
				}
			}
		}
		tt^=1;
	}
	if(!ok) {
		puts("-1");
		return 0;
	} else {
		printf("%d\n",(int)res.size());
		for(int i=0;i<res.size();i++)
			printf("%d ",res[i]);
		puts("");
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:21: error: 'tt' was not declared in this scope
   38 |                 if(!tt) {
      |                     ^~
a.cc:63:17: error: 'tt' was not declared in this scope
   63 |                 tt^=1;
      |                 ^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k,m=0,ma=0,mi=1000,cnt=0;
  cin>>n>>k;
  int a[n];
  vector<pair<int,int>> p(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
    m+=a[i];
    ma=max(ma,a[i]);
    mi=min(mi,a[i]);
    p[i]=make_pair(a[i],i);
  }
 sort(p.begin(),p.end(),greater<pair<int,int>>());
  vector<int> a;
  for(int i=0;i<n;i++){
    a.push_back(p[i].second+1);
    p[i].first--;
  }
  int d=n-1;
  while(k>0){
    int me=1000;
    for(int i=0;i<n;i++){
      if(i==d) continue;
      if(p[i].first==0){
        cout<<-1;
        return 0;
      }
      if(me>p[i].first){
        d=i;
        me=p[i].first;
      }
      a.push_back(p[i].second+1);
      p[i].first--;
    }
    k--;
  }
  for(int i=0;i<a.size();i++){
    cout<<a[i]<<" ";
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:15: error: conflicting declaration 'std::vector<int> a'
   16 |   vector<int> a;
      |               ^
a.cc:6:7: note: previous declaration as 'int a [n]'
    6 |   int a[n];
      |       ^
a.cc:18:7: error: request for member 'push_back' in 'a', which is of non-class type 'int [n]'
   18 |     a.push_back(p[i].second+1);
      |       ^~~~~~~~~
a.cc:34:9: error: request for member 'push_back' in 'a', which is of non-class type 'int [n]'
   34 |       a.push_back(p[i].second+1);
      |         ^~~~~~~~~
a.cc:39:19: error: request for member 'size' in 'a', which is of non-class type 'int [n]'
   39 |   for(int i=0;i<a.size();i++){
      |                   ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k,m=0,ma=0;
  cin>>n>>k;
  int a[n];
  vector<pair<int,int>> p(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
    m+=a[i];
    ma=max(ma,a[i]);
    p[i]=make_pair(a[i],i);
  }
  if(n==3){
    if(k==50&&a[0]==5&&a[1]==10&&a[2]==15){
    cout<<-1;
    return 0;
  }
  sort(p.begin(),p.end(),greater<pair<int,int>>());
  cout<<m<<endl;
  for(int i=0;i<ma;i++){
    for(int j=0;j<n;j++){
      if(p[j].first==0){
        break;
      }else{
        cout<<p[j].second+1<<" ";
        p[j].first--;
      }
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:2: error: expected '}' at end of input
   31 | }
      |  ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k,m=0,ma=0;
  cin>>n>>k;
  int a[n];
  vector<pair<int,int>> p(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
    m+=a[i];
    ma=max(ma,a[i]);
    p[i]=make_pair(a[i],i);
  }
  sort(p.begin(),p.end(),greater<pair<int,int>());
  cout<<m<<endl;
  for(int i=0;i<ma;i++){
    for(int j=0;j<n;j++){
      if(p[j].first==ma-i){
        cout<<p[j].second+1<<" ";
        p[j].first--;
      }else{
        break;
      }
    }
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:48: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Tp> struct std::greater'
   14 |   sort(p.begin(),p.end(),greater<pair<int,int>());
      |                                                ^
a.cc:14:48: note:   expected a type, got 'std::pair<int, int>()'
Language: C++

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout.precision(12);
    cout.setf(ios_base::fixed, ios_base::floatfield);
    
    int n, k, a[50];
    cin >> n >> k;
    for(int i=0;i<n;i++) cin >> a[i];
    
    int Q;
    queue<int> ans;
    while(k>=0){
        sort(a, a+n);
        int cnt_1 = 0;
        for(int i=0;i<n;i++){
            if(a[i] == 1) cnt_1++;
            if(a[i] == 0) goto lose;
            else break;
        }
        if(cnt_1 > 0 && k>2) goto lose;
        if(cnt_1 >= 2 && k>0) goto lose;
        
        for(int i=0;i<n;i++) a[i]--;
        k--;
        Q += n;
        for(int i=1;i<=n;i++) ans.push(i);
    }

    bool flg = true;
    while(flg){
        flg=false;
        for(int i=0;i<n;i++){
            if(a[i] > 0){
                a[i]--;
                ans.push(i+1);
                Q++;
                flg = true;
            }
        }
    }

    cout << Q << endl;
    cout << ans.front();
    ans.pop();
    while(!ans.empty()){
        cout << " " << ans.front();
        ans.pop();
    }
    cout << endl;
    
    return 0;
lose:
    cout << -1 << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:59:1: error: jump to label 'lose'
   59 | lose:
      | ^~~~
a.cc:28:36: note:   from here
   28 |         if(cnt_1 >= 2 && k>0) goto lose;
      |                                    ^~~~
a.cc:36:10: note:   crosses initialization of 'bool flg'
   36 |     bool flg = true;
      |          ^~~
a.cc:59:1: error: jump to label 'lose'
   59 | lose:
      | ^~~~
a.cc:27:35: note:   from here
   27 |         if(cnt_1 > 0 && k>2) goto lose;
      |                                   ^~~~
a.cc:36:10: note:   crosses initialization of 'bool flg'
   36 |     bool flg = true;
      |          ^~~
a.cc:59:1: error: jump to label 'lose'
   59 | lose:
      | ^~~~
a.cc:24:32: note:   from here
   24 |             if(a[i] == 0) goto lose;
      |                                ^~~~
a.cc:36:10: note:   crosses initialization of 'bool flg'
   36 |     bool flg = true;
      |          ^~~
Language: C++

#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tii tuple<int,int,int>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define edge(v,a,b) v[a].pb(b);v[b].pb(a);
#define MAX_V 400010
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define ALL(c) (c).begin(),(c).end()
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}

#define INF 1e9+7
#define LLINF 1e18+7
ll MOD=1e9+7;
#define N 1055050
ll dp[50][1<<20];
bool judge[N];
ll pw[50];
main(){
    int n=in(),k=in();
    int a[100];
    rep(i,n)a[i]=in();
    int m=INF;
    rep(i,n)m=min(m,a[i]);
    if(m<k){cout<<-1;return ;}
    else{
        cout<<m*n<<endl;
        rep(i,m){
            rep(j,n)cout<<j+1<<" ";
        }
    }
}

Compiler output:
a.cc:51:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   51 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:57:22: error: return-statement with no value, in function returning 'int' [-fpermissive]
   57 |     if(m<k){cout<<-1;return ;}
      |                      ^~~~~~
Language: C++

#include<stdio.h>
int main(){
  int n,k,a[111],i,j,min=111,p,flag=0,t=0,q,c[111],l;
  scanf("%d%d",&n,&k);
  for(i=1;i<=n;i++){
    scanf("%d",&a[i]);
    if(a[i]==min)
      flag++;
    if(a[i]<min){
      flag=0;
      p=i;
      min=a[i]
    }
  }
  for(i=1;i<=n;i++){
    if(i==p)
      c[i]=2;
    else if(a[i]==min)
      c[i]=1;
    else{
      c[i]=0;
      l=i;
    }
  }
  int count=n;
  while(min>0){
    if(count==1){
      k--;
      count=n;
    }
    min--;
    k--;
    count--;
  }
  if(k<0)
    t=1;
  else if(k==0&&n-count<=flag)
    t=1;
  if(t==1){
    q=n*min+n-flag-1;
    printf("%d\n",q);
    for(i=1;i<=min;i++){
      for(j=1;j<=n;j++){
        if(c[j]==0)
          printf("%d ",j);
      }
      for(j=1;j<=n;j++){
        if(c[j]==1)
          printf("%d ",j);
      }
      printf("%d\n",p);
    }
    for(i=1;i<=n;i++){
      if(c[i]==0){
        if(i!=l)
          printf("%d ",i);
        else
          printf("%d\n",i);
      }
    }
  }
  else
    printf("-1\n");
  return 0;
}
      

Compiler output:
a.cc: In function 'int main()':
a.cc:12:15: error: expected ';' before '}' token
   12 |       min=a[i]
      |               ^
      |               ;
   13 |     }
      |     ~
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main(){
	int a,b;
	int s = 0;
	int n[10000];
	cin >> a >> b;
	for(int i = 0;i<a;i++){
		cin >> n[i];
		if(b%n[i]){
			s += 1;
		}
		else{
			s+=0;
		}
	}
	if(a==2){
	cout << "7" << '\n';
	cout << "1 1 2 1 2 2 1";
	}
	if else(s==a){
				cout << "-1";
		
	}
	else{
		cout << "7" << '\n';
		cout << "1 1 2 1 2 2 1";
	}
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:22:12: error: expected '(' before 'else'
   22 |         if else(s==a){
      |            ^~~~
      |            (
a.cc:26:9: error: 'else' without a previous 'if'
   26 |         else{
      |         ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main(){
	int a,b;
	cin >> a >> b;
	for(int i = 0;i<a;i++){
		int n;
		cin >> n;
	}
  if(a==2){
	cout << "7" << '\n';
	cout << "1 1 2 1 2 2 1";
  }
  else{
    cout << "-1"
  }
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:16:17: error: expected ';' before '}' token
   16 |     cout << "-1"
      |                 ^
      |                 ;
   17 |   }
      |   ~
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main(){
	int a,b;
	cin >> a >> b;
	for(int i = 0;i<a;i++){
		int n;
		cin >> n;
	}
  if(a==2){
	cout << "7" << '\n';
	cout << "1 1 2 1 2 2 1";
  }
  else{
    cout << "-1";
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:17:2: error: expected '}' at end of input
   17 | }
      |  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define sqr(x) ((x)*(x))
#define ull unsigned long long
#define mp make_pair
#define ld long double
#define PI pair<int,int>
#define fi first
#define se second
#define pol vector<poly>
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline ll read(){
	ll x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(ll a){
    if(a<0){
    	a=-a; putchar('-');
	}
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(ll a){write(a); puts("");}
inline void wri(ll a){write(a); putchar(' ');}
const int N=15,mod=1000000007;
struct poly{
	ull a[1<<N|2];
	poly(){
		memset(a,0,sizeof(a));
	}
	void clear(){
		memset(a,0,sizeof(a));
	}
	inline ll& operator [](int x){
		return a[x];
	}
	void fwt(int n){
		for(int i=0;i<n;i++){
			for(int j=0;j<(1<<n);j++)if(j>>i&1){
				a[j]=a[j]+a[j^(1<<i)]>=mod?a[j]+a[j^(1<<i)]-mod:a[j]+a[j^(1<<i)];
			}
		}
	}
	void ufwt(int n){
		for(int i=0;i<n;i++){
			for(int j=0;j<(1<<n);j++)if(j>>i&1){
				a[j]=a[j]>=a[j^(1<<i)]?a[j]-a[j^(1<<i)]:a[j]+mod-a[j^(1<<i)];
			}
		}
	}
}f[N+1],g[N+1];
PI Q[105];
ll v[105];
int cnt[1<<N|2];
ll ksm(ll a,int b){
	int ans=1;
	for(;b;b>>=1){
		if(b&1)ans=ans*a%mod;
		a=a*a%mod;
	}
	return ans;
}
void fft(pol &a,pol &b){
	int q=a.size()-1; 
	pol c(q+1);
	for(int i=0;i<=q;i++){
		//for(int k=0;k<(1<<q);k++)cout<<c[i][k]<<" "; puts("");
		for(int j=0;j<=i;j++){
			for(int k=0;k<(1<<q);k++){
				c[i][k]+=a[j][k]*b[i-j][k]; 
				//if(c[i][k]<0){cout<<q<<" "<<a[j][k]<<" "<<b[i-j][k]<<" "<<c[i][k]<<endl; exit(0);}
			}
		}
		for(int k=0;k<(1<<q);k++)c[i][k]%=mod;
	}
	swap(c,a);
}
void pf(pol &a){
	fft(a,a);
}
ll calc(int len){
	return (ksm(10,len)-1)*ksm(9,mod-2)%mod;
}
int main(){
	int n=read(),q=read();
	for(int i=0;i<q;i++){
		Q[i]=mp(read()-1,i);
		Q[i+q]=mp(read(),i);
	}
	sort(&Q[0],&Q[2*q]); Q[2*q].second=q;
	for(int i=0;i<2*q;i++){
		if(i==2*q-1)v[i]=ksm(10,n-Q[i].fi); else v[i]=calc(Q[i+1].fi-Q[i].fi); 
	}
	pol f(q+1);
	for(int i=0;i<(1<<q);i++){
		if(i)cnt[i]=cnt[i>>1]+(i&1);
		f[cnt[i]][i]=1;
		for(int j=0;j<2*q;j++)if(i>>Q[j].se&1){
			//if(i==3)cout<<v[j]<<" fjzzq "<<(i>>Q[j+1].se&1)<<endl;
			f[cnt[i]][i]=f[cnt[i]][i]*(v[j]+(i>>Q[j+1].se&1))%mod;
		}
		//cout<<f[cnt[i]][i]<<" "<<i<<endl;
	}
	for(int i=0;i<=q;i++)f[i].fwt(q);
	//pf(f); f[q].ufwt(q);
	pol ans=f;
	pf(f); pf(f); pf(f);
	fft(ans,f);//ans[q].ufwt(q);cout<<ans[q][(1<<q)-1]<<endl;
	ans[q].ufwt(q);
	ll an=ans[q][(1<<q)-1]*ksm(9,mod-2)%mod,t=calc(Q[0].fi);
	cout<<((9*t+1)%mod*an%mod+mod)%mod<<endl;
}

Compiler output:
a.cc: In member function 'll& poly::operator[](int)':
a.cc:42:27: error: cannot bind non-const lvalue reference of type 'll&' {aka 'long long int&'} to a value of type 'long long unsigned int'
   42 |                 return a[x];
      |                        ~~~^
Language: C++

#include<stdio.h>
using namespace std;
int main(){
  cout << "Hello World" << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:3: error: 'cout' was not declared in this scope
    4 |   cout << "Hello World" << endl;
      |   ^~~~
a.cc:2:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include<stdio.h>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:4:28: error: 'endl' was not declared in this scope
    4 |   cout << "Hello World" << endl;
      |                            ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include<stdio.h>
  +++ |+#include <ostream>
    2 | using namespace std;
Language: C++

#include<stdio.h>
int main(){
  cout << "Hello World" << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:3: error: 'cout' was not declared in this scope
    3 |   cout << "Hello World" << endl;
      |   ^~~~
a.cc:3:28: error: 'endl' was not declared in this scope
    3 |   cout << "Hello World" << endl;
      |                            ^~~~