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

#include<bits/stdc++.h>

using namespace std;

int compare_int(const void *a, const void *b)
{
        return *(int*)a - *(int*)b;
}

int main(void)
{
        int a[100010]={0};
        int b[100010] = {0};
        int c[100010] = {0};
        int n;

        cin >> n;
        for(int i = 0; i < n; i++) cin >> a[i];
        for(int i = 0; i < n; i++) cin >> b[i];
        for(int i = 0; i < n; i++) cin >> c[i];
        qsort(a, n, sizeof(int), compare_int);
        qsort(b, n, sizeof(int), compare_int);
        qsort(c, n, sizeof(int), compare_int);

        int cntb[100010] = {0};
        int idxa = 0;
        for(int i = 0; i < n; i++){
                for(; idxa < n && b[i] > a[idxa]; idxa++);
                cntb[i] = idxa;
        }

        int sumb[100010] = {0};
        sumb[0] = cntb[0];
        for(int i = 1; i < n; i++){
                sumb[i] = sumb[i-1] + cntb[i];
        }

        int cnt = 0;
        int idxb = 0;
        for(int i = 0; i < n; i++){
                for(; idxb < n && c[i] > b[idxb]; idxb++);
                if(idxb>0) cnt += sumb[idxb-1];
        }

        cout << cnt << endl;
        reutrn 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:9: error: 'reutrn' was not declared in this scope
   46 |         reutrn 0;
      |         ^~~~~~
Language: C++

#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <climits>
#include <cmath>

using namespace std;

int numOfElement(const vector<int>& vec, int max) {
  int left = 0;
  int right = vec.size() - 1;
  int mid = 0;
  while (left < right) {
    int mid = ((left + right) / 2) + left;
    if (max == vec[mid]) {
    }
    else if (max < vec[mid]) {
      right = mid - 1;
    }
    else {
      left = mid + 1;
    }
  }

  if (vec[right] <= max) {
    return right + 1;
  }
  return right;
}

int main() {

  int n;
  cin >> n;

  vector< vector<int> > vec;
  for (int i = 0; i < 3; ++i) {
    vec.push_back(vector<int>());
    vec[i].reserve(n);
    for (int j = 0; j < n; ++j) {
      int val;
      cin >> val;
      vec[i].push_back(val);
    }
    cin.ignore();

    sort(vec[i].begin(), vec[i].end());
  }

  int sum = 0;
  for (int i = 0; i < n; ++i) {
    int numOfBElem = numOfElement(vec[1], vec[2][i]);
    int numOfAElem = numOfElement(vec[0], vec[1][numOfBElem - 1]);
    sum += numOfBElem * numOfAElem;
  }
  cout << sum << endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:48:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   48 |     sort(vec[i].begin(), vec[i].end());
      |     ^~~~
      |     sqrt
Language: C++

#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <stack>
#include <queue>

#define REP(i,a,n) for(int i=a;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define vsort(v) sort(v.begin(),v.end())
#define asort(a,n) sort(a, a + n)
#define vi vector<int>
#define vd vector<double>

using namespace std;

int counter = 0;

int N;
int a[100001];
int b[100001];
int c[100001];
int bmemo[100001];


int main(){
    ios::sync_with_stdio(false);
    
    cin >> N;
    rep(i, N)
        cin >> a[i];
    
    rep(i, N)
        cin >> b[i];

    rep(i, N)
        cin >> c[i];
    
    asort(a, N);
    asort(b, N);
    asort(c, N);
    memset(bmemo, -1, sizeof(b));
    int ans = 0;

    for(int i = N - 1;i >= 0;--i){
        for(int j = N - 1;j>= 0; --j){
            if(b[j] <= a[i]){
                break;
            }
            if(bmemo[j] == -1){
                for(int k = N - 1;k >= 0;--k){
                    //a[i], b[j], c[k]
                    if(c[k] <= b[j]){
                        bmemo[j] = counter;
                        ans += counter;
                        counter = 0;
                        break;     
                    }
                    counter++;
                }
            }else{
                ans += bmemo[j];
            }
            
        }
    }

    ans += counter;
    /*
    for(int i = N - 1;i >= 0;--i){
        for(int j = N - 1;j>= 0; --j){
            if(b[j] <= a[i])
                break;
            for(int k = N - 1;k >= 0;--k){
                //a[i], b[j], c[k]
                if(c[k] <= b[j])
                    break;
                counter++;
            }
        }
    }
    */



    cout << ans << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:45:5: error: 'memset' was not declared in this scope
   45 |     memset(bmemo, -1, sizeof(b));
      |     ^~~~~~
a.cc:10:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    9 | #include <queue>
  +++ |+#include <cstring>
   10 |
Language: C++

#include<iostream>
using namespace std;
int main(){
  int N;
  cin>>N;
  int a[N],b[N],c[N];
  for(int i=0;i<N;i++)cin>>a[i];
  for(int i=0;i<N;i++)cin>>b[i];
  for(int i=0;i<N;i++)cin>>c[i];
  sort(a,a+N);
  sort(b,b+N);
  sort(c,c+N);
  int cgb[N];
  for(int j=0;j<N;j++){
    cgb[j]=0;
      for(int r=0;r<N;r++){
        if(b[j]<c[r])cgb[j]=N-r;
        break;
    }
  }
  int ans;
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      if(a[i]<b[j])ans+=cgb[j];
    }
  }
  cout<<ans;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   10 |   sort(a,a+N);
      |   ^~~~
      |   short
Language: C++

#include <cstdio>
#include <cmath>
#include <vector>
#include <iostream>
#include <set>
#include <queue>
#include <cstring>
#include <string>
#include <algorithm>
using namespace std;
#define mst(a,b) memset((a),(b),sizeof(a))
#define rush() int T;scanf("%d",&T);while(T--)
typedef long long ll;
ll a[100005],b[100005],c[100005],sum[100005],tmp,ans;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	for(int i=1;i<=n;i++)
		cin>>b[i];
	for(int i=1;i<=n;i++)
		cin>>c[i];
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	sort(c+1,c+n+1);
	for(int i=1;i<=n;i++){
		sum[i]=sum[i-1]+(n-(upper_bound(c+1,c+n+1,b[i])-(c+1)));
	}
	b[n+1]=a[n]+3;
	for(int i=1;i<=n;i++){
		tmp=(upper_bound(b+1,b+n+2,a[i])-b);
		if(tmp>n)
			break;
		else 
			ans+=(sum[n]-sum[tmp-1]);
	}
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:14: error: 'n' was not declared in this scope; did you mean 'yn'?
   16 |         cin>>n;
      |              ^
      |              yn
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;

void vread(int n, int a[100001])
{
    for (int i = 0; i < n; ++i)
        cin >> a[i];
}

int main()
{
    int n, a[100001], b[100001], c[100001];
    cin >> n;
    vread(n, a);
    vread(n, b);
    vread(n, c);

    sort(a, a + n);
    sort(b, b + n);
    sort(c, c + n);

    long long nr[100001], lf, rt, cnt = 0;
    int lf, rt;
    for (int j = 0; j < n; ++j) {
        lf = 0; rt = n - 1;
        while (lf <= rt) {
            if (c[(lf + rt) / 2] > b[j])
                rt = (lf + rt) / 2 - 1;
            else
                lf = (lf + rt) / 2 + 1;
        }
        nr[j] = n - lf;
    }

    for (int j = n - 2; j >= 0; --j)
        nr[j] += nr[j + 1];

    for (int i = 0; i < n; ++i) {
        lf = 0, rt = n - 1;
        while (lf <= rt) {
            if (b[(lf + rt) / 2] > a[i])
                rt = (lf + rt) / 2 - 1;
            else
                lf = (lf + rt) / 2 + 1;
        }
        if (lf < n)
            cnt += nr[lf];
    }
    cout << cnt;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:9: error: conflicting declaration 'int lf'
   24 |     int lf, rt;
      |         ^~
a.cc:23:27: note: previous declaration as 'long long int lf'
   23 |     long long nr[100001], lf, rt, cnt = 0;
      |                           ^~
a.cc:24:13: error: conflicting declaration 'int rt'
   24 |     int lf, rt;
      |             ^~
a.cc:23:31: note: previous declaration as 'long long int rt'
   23 |     long long nr[100001], lf, rt, cnt = 0;
      |                               ^~
Language: C++

#include<iostream>
using namespace std;
int main(){
  int N;
  cin>>N;
  int a[N],b[N],c[N];
  for(int i=0;i<N;i++)cin>>a[i];
  for(int i=0;i<N;i++)cin>>b[i];
  for(int i=0;i<N;i++)cin>>c[i];
  a.sort();
  b.sort();
  c.sort();
  int cgb[N];
  for(int j=0;j<N;j++){
    cgb[j]=0;
      for(int r=0;r<N;r++){
        if(b[j]<c[r])cgb[j]+=1;
    }
  }
  int ans;
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      if(a[i]<b[j])ans+=cgb[j];
    }
  }
  cout<<ans;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:5: error: request for member 'sort' in 'a', which is of non-class type 'int [N]'
   10 |   a.sort();
      |     ^~~~
a.cc:11:5: error: request for member 'sort' in 'b', which is of non-class type 'int [N]'
   11 |   b.sort();
      |     ^~~~
a.cc:12:5: error: request for member 'sort' in 'c', which is of non-class type 'int [N]'
   12 |   c.sort();
      |     ^~~~
Language: C++

#include <iostream>
using namespace std;

int main ()
{
  int n;
  cin >> n;
  int a[n], b[n], c[n];
  for (int i = 0; i != n; ++i) {
    cin >> a[i];
  }
  for (int i = 0; i != n; ++i) {
    cin >> b[i];
  }
  for (int i = 0; i != n; ++i) {
    cin >> c[i];
  }
  sort(a, a+n);
  sort(b, b+n);
  sort(c, c+n);
  int ans;
  for (int i = 0; i != n; ++i) {
    for (int j = 0; j != n; ++j) {
      if (a[i] < b[j]) {
	for (int k = 0; k != n; ++k){
	  if (b[j] < c[k]) {
	    ans += 1;
	  }
	}
      }
    }
  }
  cout << ans;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   18 |   sort(a, a+n);
      |   ^~~~
      |   short
Language: C++

#include<iostream>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<cstdio>
using namespace std;
int main()
{
	long int A[10000] = {0}, long B[10000] = {0}, long C[10000] = {0};
	int N,count = 0;
	cin>> N;
	for (int i = 0; i < N; i++){
		cin>> A[i];
	}
	for (int i = 0; i < N; i++){
		cin>> B[i];	
	}
	for (int i = 0; i < N; i++){
		cin>> C[i];	
	}
	
	for (int i = 0; i < N; i++){
		for (int j = 0; j < N; j++){
			if (A[i] >= B[j]) continue;
			for (int k = 0; k < N; k++){
				if (B[j] >= C[k]) continue;
				//printf("%d %d %d\n",A[i],B[j],C[k]);
				count++;
			}
		}	
	}
	printf("%d\n",count);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:34: error: expected unqualified-id before 'long'
    9 |         long int A[10000] = {0}, long B[10000] = {0}, long C[10000] = {0};
      |                                  ^~~~
a.cc:9:53: error: expected primary-expression before ',' token
    9 |         long int A[10000] = {0}, long B[10000] = {0}, long C[10000] = {0};
      |                                                     ^
a.cc:9:55: error: expected primary-expression before 'long'
    9 |         long int A[10000] = {0}, long B[10000] = {0}, long C[10000] = {0};
      |                                                       ^~~~
a.cc:16:23: error: 'B' was not declared in this scope
   16 |                 cin>> B[i];
      |                       ^
a.cc:19:23: error: 'C' was not declared in this scope
   19 |                 cin>> C[i];
      |                       ^
a.cc:24:37: error: 'B' was not declared in this scope
   24 |                         if (A[i] >= B[j]) continue;
      |                                     ^
a.cc:26:37: error: 'B' was not declared in this scope
   26 |                                 if (B[j] >= C[k]) continue;
      |                                     ^
a.cc:26:45: error: 'C' was not declared in this scope
   26 |                                 if (B[j] >= C[k]) continue;
      |                                             ^
Language: C++

#include <iostream>
#include <algorithm>
#include <string>
#include <functional>

using namespace std;

long long inputData[3][100000] = {};
long long data1[100000] = {};
long long data2[100000] = {};
long long data3[100000] = {};

int main()
{
	long long n, cnt = 0;
	cin >> n;
	for (long long i = 0; i < 3; i++)
	{
		for (long long j = 0; j < n; j++)
		{
			cin >> inputData[i][j];
		}
	}
	memcpy(data1, &inputData[0], 100000);
	memcpy(data2, &inputData[1], 100000);
	memcpy(data3, &inputData[2], 100000);

	sort(data1, data1 + n, greater<long long>());
	sort(data2, data2 + n, greater<long long>());
	sort(data3, data3 + n, greater<long long>());

	for (long long i = 0; i < n; i++)
	{
		for (long long j = 0; j < n; j++)
		{
			if (data1[i] >= data2[j]) break;
			for (long long k = 0; k < n; k++)
			{
				if (data1[i] < data2[j] && data2[j] < data3[k])
				{
					cnt++;
				}
				else
				{
					break;
				}
			}
		}
	}
	cout << cnt;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:9: error: 'memcpy' was not declared in this scope
   24 |         memcpy(data1, &inputData[0], 100000);
      |         ^~~~~~
a.cc:5:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <functional>
  +++ |+#include <cstring>
    5 |
Language: C++

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
using namespace std;
void rsort(long long A[],long long l,long long r)
{
	if(r-l<2)
	{
		return;
	}
	long long mid = (r+l)/2;
	rsort(A,l,mid);
	rsort(A,mid,r);
	long long B[r-l];
	long long x = l;
	long long y = mid;
	for(long long i = 0;i<r-l;i++)
	{
		if(A[x] >= A[y] && x < mid && y < r)
		{
			B[i] = A[x];
			x++;
		}
		else if(y < r)
		{
			B[i] = A[y];
			y++;
		}
		else
		{
			B[i] = A[x];
			x++;
		}
	}
	for(long long i = 0;i<r-l;i++)
		A[l+i] = B[i];
}
long long main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);
	long long n,a[100001],b[100001],c[100001];
	long long res=0,x[100001];
	cin>>n;
	for(long long i = 0;i<n;i++)
	{
		cin>>c[i];
	}
	rsort(c,0,n);
	for(long long i = 0;i<n;i++)
	{
		cin>>b[i];
	}
	rsort(b,0,n);
	for(long long i = 0;i<n;i++)
	{
		cin>>a[i];
	}
	rsort(a,0,n);
	long long k = 0;
	for(long long i = 0;i<n;i++)
	{
		for(k;k<n;k++)
		{
			if(c[k] < b[i])
			{
				x[i] = n - k;
				//cout<<x[i]<<' ';
				break;
			}
		}
	}
	//cout<<'\n';
	for(long long i = 2;i<=n;i++)
	{
		x[n-i]+=x[n-i+1];
	}
	k = 0;
	for(long long i = 0;i<n;i++)
	{
		for(k;k<n;k++)
		{
			if(b[k] < a[i])
			{
				res+=x[k];
				//cout<<x[k]<<' '<<k<<' ';
				break;
			}
		}
	}
	cout<<res;
	return 0;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include<iostream>
using namespace std;
int main(){
  int N;
  cin>>N;
  int a[N],b[N],c[N];
  for(int i=0;i<N;i++)cin>>a[i];
  for(i=0;i<N;i++)cin>>b[i];
  for(i=0;i<N;i++)cin>>c[i];
  int bga[N]=0;
  int cgb[N]=0;
  for(int j=0;j<N;j++){
      for(int r=0;r<N;r++){
        if(b[j]<c[r])cgb[j]+=1;
    }
  }
  int ans;
  for(i=0;i<N;i++){
    for(int j=0;j<N;j++){
      if(a[i]<b[j])ans+=cgb[j];
    }
  }
  cout<<ans;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:7: error: 'i' was not declared in this scope
    8 |   for(i=0;i<N;i++)cin>>b[i];
      |       ^
a.cc:9:7: error: 'i' was not declared in this scope
    9 |   for(i=0;i<N;i++)cin>>c[i];
      |       ^
a.cc:10:14: error: array must be initialized with a brace-enclosed initializer
   10 |   int bga[N]=0;
      |              ^
a.cc:11:14: error: array must be initialized with a brace-enclosed initializer
   11 |   int cgb[N]=0;
      |              ^
a.cc:18:7: error: 'i' was not declared in this scope
   18 |   for(i=0;i<N;i++){
      |       ^
Language: C

#include<stdio.h>
void main(){
	int n,m,i,j,t=0;
	int a[10000],b[10000],c[10000];
	d=scanf("%d",&n);
	for(i=0;i<n;i++){
		d=scanf("%d",&a[i]);
		}
	for(i=0;i<n;i++){
		d=scanf("%d",&b[i]);
		}
	for(i=0;i<n;i++){
		d=scanf("%d",&c[i]);
		}
	for(i=0;i<n;i++){
		for(j=0;j<n;j++){
			for(m=0;m<n;m++){
				if(a[i]<b[j]&&b[j]<c[m]) t++;
			}
		}
	}
	printf("%d\n",t);
}

Compiler output:
main.c: In function 'main':
main.c:5:9: error: 'd' undeclared (first use in this function)
    5 |         d=scanf("%d",&n);
      |         ^
main.c:5:9: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

/*input
6
3 14 159 2 6 53
58 9 79 323 84 6
2643 383 2 79 50 288
*/
#include <string.h>
#include <cstring>
#include <cmath>
#include <math.h>
#include <iostream>
using namespace std;

int main()
{
	int n;
	cin>>n;
	long int a[100000],b[100000],c[100000];
	int i;
	for(i=0;i<n;i++)
	{
		cin>>a[i];
	}
	sort(a,a+n);
	for(i=0;i<n;i++)
	{
		cin>>b[i];
	}
	sort(b,b+n);
	for(i=0;i<n;i++)
	{
		cin>>c[i];
	}
	sort(c,c+n);
	long long int tc=0;
	for(i=0;i<n;i++)
	{
		int v=n-1;
		for(int j=n-1;j>=0;j--)
		{
			if(b[j]<c[i])
			{
				for(int k=v;k>=0;k--)
				{
					if(a[k]<b[j])
					{
						tc+=(k+1);
						v=k;
						break;
					}
				}
			}
		}
	}
	cout<<tc;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:9: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   24 |         sort(a,a+n);
      |         ^~~~
      |         sqrt
Language: C++

#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <stdio.h>
#include <stdlib.h>
#include <list>

using namespace std;

const double pi = 3.14159265358979323846;
const int mod = 1000000007;

int main(){
  int N;
  int A[100000], B[100000], C[100000];

  cin >> N;
  for(int i=0; i<N; i++) cin >> A[i];
  for(int i=0; i<N; i++) cin >> B[i];
  for(int i=0; i<N; i++) cin >> C[i];

  sort(A, A+N);
  sort(B, B+N);
  sort(C, C+N);

  long long combination_ab[100000], combination_bc[100000];

  for(int idx_b = 0; idx_b < N; idx_b++){
    int *ptr = lower_bound(C, C+N, B[idx_b]+1);
    if(ptr<C+N) combination_bc[idx_b] = distance(ptr,C+N);
  }

  for(int idx_a = 0; idx_a < N; idx_a++){
    int *ptr = lower_bound(B, B+N, A[idx_a]+1);
    while(ptr<B+N){
      combination_ab[idx_a] += combination_bc[distance(B,ptr)];
      ptr++;
    }
  }

  cout << accumulate(combination_ab,combination_ab+N,0) << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:44:11: error: 'accumulate' was not declared in this scope
   44 |   cout << accumulate(combination_ab,combination_ab+N,0) << endl;
      |           ^~~~~~~~~~
Language: C++

#include<iostream>
#include<algorithm>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<vector>
#include<deque>
#include<map>
#include<set>

using namespace std;

int N;
vector<int> A, B, C;

int input(){
  cin >> N;
  A.resize(N);
  B.resize(N);
  C.resize(N);
  for( int i = 0; i < N; i++ ){ cin >> A[i]; }
  for( int i = 0; i < N; i++ ){ cin >> B[i]; }
  for( int i = 0; i < N; i++ ){ cin >> C[i]; }
  sort(A.begin(), A.end());
  sort(B.begin(), B.end());
  sort(C.begin(), C.end());
  return 0;
}

int main(){
  input();
  // B_iを用いてBとCで構築できる個数．
  vector<long> nBC(N);
  for( int i = 0; i < N; i++ ){
    int dist = distance(upper_bound(C.begin(), C.end(), B[i]), C.end());
    nBC[i] = dist;
  }

  long n = 0;
  for( int i = 0; i < N; i++ ){
    int dist = distance(B.begin(), upper_bound(B.begin(), B.end(), A[i]));
    n += accumulate(nBC.begin()+dist, nBC.end(), 0);
  }
  cout << n << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:10: error: 'accumulate' was not declared in this scope
   42 |     n += accumulate(nBC.begin()+dist, nBC.end(), 0);
      |          ^~~~~~~~~~
Language: C++

s = input()
k = int(s)
# print(k)
pre = sum([int(c) for c in s])
ans = pre
a = k
for _ in range(2*k):
    a += k
    b = a
    now = 0
    while b > 0:
        r = b % 10
        if r: now += r
        b //= 10
    # print(a, now)
    ans = min(ans, now)
    # if pre == now: break
print(ans)


Compiler output:
a.cc:3:3: error: invalid preprocessing directive #print
    3 | # print(k)
      |   ^~~~~
a.cc:15:7: error: invalid preprocessing directive #print
   15 |     # print(a, now)
      |       ^~~~~
a.cc:17:20: error:  ':' without preceding '?'
   17 |     # if pre == now: break
      |                    ^
a.cc:17: error: unterminated #if
   17 |     # if pre == now: break
a.cc:1:1: error: 's' does not name a type
    1 | s = input()
      | ^
Language: C++

/**
*    created: 16.05.2020 09:01:26
**/

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

int main() {
    int n;
    cin >> n;
    int ans=inf;
    rep(i,100000){
        if(i==0)
            continue;
        ll x = n * i;
        ll a = 0;
        while(x!=0){
            a +=x % 10;
            x /= 10;
        }
        ans = min(a, ans);
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:18: error: no matching function for call to 'min(ll&, int&)'
   24 |         ans = min(a, ans);
      |               ~~~^~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:5:
/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:   template argument deduction/substitution failed:
a.cc:24:18: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   24 |         ans = min(a, ans);
      |               ~~~^~~~~~~~
/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, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:24:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   24 |         ans = min(a, ans);
      |               ~~~^~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
const lint mod=1e9+7;

int sumDig(int x){
  int cnt = 0;
  while(x > 0){
    cnt += x%10;
    x /= 10;
  }
  return cnt;
}

int main()
{
  int k;
  cin >> k;

  int min = 100000;
  FOR(i,1,10000)
    int tmp = sumDig(k*i);
    if(tmp < min) min = tmp;
  }

  cout << min << "\n";
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:8: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   33 |     if(tmp < min) min = tmp;
      |        ^~~
      |        tm
a.cc: At global scope:
a.cc:36:3: error: 'cout' does not name a type
   36 |   cout << min << "\n";
      |   ^~~~
a.cc:37:3: error: expected unqualified-id before 'return'
   37 |   return 0;
      |   ^~~~~~
a.cc:38:1: error: expected declaration before '}' token
   38 | }
      | ^
Language: C++

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

struct Node{
	int point;
	int dis;
	bool done;
	Node *mul;
	Node *add;
};

int main()
{
	int k;
	cin >> k;
	deque<pair<int, int> > c;
	vector<Node> a(k);
	rep(i, k){
		if(i==k-1){
			a[i]=new Node{i, INT_MAX, false, &a[(i*10)%k], &a[0]};
			break;
		}
		a[i] = new Node{i, INT_MAX, false, &a[(i*10)%k], &a[i+1]};
	}

	a[1].dis = 1;
	a[1].done = true;	
	c.push_back(make_pair(1, 1));
	while(c.size()!=0){
		pair<int, int> tmp = c.front();
		c.pop_front();
		a[tmp.first].dis = tmp.second;
		if(a[tmp.first].mul->done == false){
			c.push_front(make_pair(a[tmp.first].mul->point, tmp.second));
			a[tmp.first].mul->done = true;
		}
		if(a[tmp.first].add->done == false){
			c.push_back(make_pair(a[tmp.first].add->point, tmp.second+1));
			a[tmp.first].add->done = true;
		}

	}

	cout << a[0].dis << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:23:77: error: no match for 'operator=' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<Node>, Node>::value_type' {aka 'Node'} and 'Node*')
   23 |                         a[i]=new Node{i, INT_MAX, false, &a[(i*10)%k], &a[0]};
      |                                                                             ^
a.cc:7:8: note: candidate: 'constexpr Node& Node::operator=(const Node&)'
    7 | struct Node{
      |        ^~~~
a.cc:7:8: note:   no known conversion for argument 1 from 'Node*' to 'const Node&'
a.cc:7:8: note: candidate: 'constexpr Node& Node::operator=(Node&&)'
a.cc:7:8: note:   no known conversion for argument 1 from 'Node*' to 'Node&&'
a.cc:26:73: error: no match for 'operator=' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<Node>, Node>::value_type' {aka 'Node'} and 'Node*')
   26 |                 a[i] = new Node{i, INT_MAX, false, &a[(i*10)%k], &a[i+1]};
      |                                                                         ^
a.cc:7:8: note: candidate: 'constexpr Node& Node::operator=(const Node&)'
    7 | struct Node{
      |        ^~~~
a.cc:7:8: note:   no known conversion for argument 1 from 'Node*' to 'const Node&'
a.cc:7:8: note: candidate: 'constexpr Node& Node::operator=(Node&&)'
a.cc:7:8: note:   no known conversion for argument 1 from 'Node*' to 'Node&&'
Language: Java

import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        
        Set<Integer> digitS = new HashSet<>();
        int i = 1;
        while(true) {
           long mul = k * i;
           long ds = digitSum(num);
           if(ds == k) break;
           digitS.add(ds);
           i++;
        }
        int min = Integer.MAX_VALUE;
        for(int d : digitS)
          min = Math.min(min, d);

        System.out.println(min);
    }

    private static int digitSum(long num) {
      int sum = 0;
      while(num > 0) {
        sum += num % 10;
        sum /= 10;
      }
      return sum;
    }
}


Compiler output:
Main.java:12: error: cannot find symbol
           long ds = digitSum(num);
                              ^
  symbol:   variable num
  location: class Main
Main.java:14: error: incompatible types: long cannot be converted to Integer
           digitS.add(ds);
                      ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
2 errors
Language: C++

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

int main()
{
  long long n;
  cin>>n;
  long long min=INT_MAX;
  for(long long i=2;i<10000;i++)
  {
    long long b=n*i;
    long long sum=0;
    while(b)
    {
     sum=sum+(b%10);
     b=b/10;
    }
    if(sum<min) min=sum;
    
  }
  
  cout<<sum<<endl;
  
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:9: error: 'sum' was not declared in this scope
   22 |   cout<<sum<<endl;
      |         ^~~
Language: C++

#include<bits/stdc++.h>
#define pii pair<int,int>
#define F first
#define S second
#define mp make_pair
using namespace std;
const int N=1e5+5;
int dist[N];
int n;
deque<pii>q;
void bfs()
{
	q.push_back(mp(1,1));
	for(int i=0;i<N;i++)dist[i]=1e9;
	dist[1]=1;
	while(true)
	{
		pii p=q.front();q.pop_front();
		if(p.F==0&&!flag)
		{
			cout<<p.S<<endl;
			return;
		}
		if(!flag&&dist[p.F*10%n]==1e9)
		{
			dist[p.F*10%n]=p.S;
			q.push_front(mp(p.F*10%n,p.S));
		}
		if(dist[(p.F+1)%n]==1e9)
		{
			dist[(p.F+1)%n]=p.S+1;
			q.push_back(mp((p.F+1)%n,p.S+1));
		}
		flag=false;
	}
}
signed main()
{
	cin>>n;
	bfs();
	return 0;
}


Compiler output:
a.cc: In function 'void bfs()':
a.cc:19:29: error: 'flag' was not declared in this scope
   19 |                 if(p.F==0&&!flag)
      |                             ^~~~
a.cc:24:21: error: 'flag' was not declared in this scope
   24 |                 if(!flag&&dist[p.F*10%n]==1e9)
      |                     ^~~~
a.cc:34:17: error: 'flag' was not declared in this scope
   34 |                 flag=false;
      |                 ^~~~
Language: C++

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

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,b,a) for (int i = (b) - 1; i >= (a); i--)
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL) INF;

int sum(LL x, int marg)
{
	int res = 0;
	while(x)
	{
		res += x % 10;
		x /= 10;
		if (res > marg) break;
	}
	return res;
}

int f(int k)
{
	LL x = k;
	int iter = 0;
	int res = sum(x);
	while(true)
	{
		iter++;
		if (iter == 10000)
		{
			iter = 0;
			if (clock() / (double)CLOCKS_PER_SEC > 1.9) break;
		}

		int cur = sum(x, res);
		res = min(res, cur);
		x += k;
	}

	return res;
}

int main(int argc, char* argv[])
{
	//ios::sync_with_stdio(false); cin.tie(0);

	int k;
	cin>>k;
	cout<<f(k)<<endl;

}


Compiler output:
a.cc: In function 'int f(int)':
a.cc:38:22: error: too few arguments to function 'int sum(LL, int)'
   38 |         int res = sum(x);
      |                   ~~~^~~
a.cc:22:5: note: declared here
   22 | int sum(LL x, int marg)
      |     ^~~
Language: C++

#include <bits/stdc++.h>
#define rg register
#define LL long long 

using namespace std;

const int M=500010;
const int N=1000010;
inline int read(){
	int x=0,f=1;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int cnt,head[M],nxt[N<<1],to[N<<1],w[N<<1];
void add(int x,int y,int z){
	to[++cnt]=y;
	w[cnt]=z;
	nxt[cnt]=head[x];
	head[x]=cnt;
}
int d[M];bool vis[M];
void spfa(){
	queue<int>q;
	memset(d,63,sizeof(d));
//	memset(vis,false,sizeof(vis));
	d[1]=0;q.push(1);vis[1]=true;
	while(!q.empty()){
		int k=q.front();q.pop();vis[k]=false;
		for(int i=head[k];i;i=nxt[i]){
			int kk=to[i];
			if(d[kk]-d[k]>w[i]){
				d[kk]=d[k]+w[i];
				if(!vis[kk]){
					vis[kk]=true;
					q.push(kk);
				}
			}
		}
	}
}
int main()
{
//	freopen("magic.in","r",stdin);
//	freopen("magic.out","w",stdout);
	int k=read();
	if(k==1){puts("1");continue;}
	for(rg int i=0;i<k;i++){
		add(i,(i+1)%k,1);
		add(i,(i*10)%k,0);
	}
	spfa();
	printf("%d\n",d[0]+1);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:28: error: continue statement not within a loop
   47 |         if(k==1){puts("1");continue;}
      |                            ^~~~~~~~
a.cc:48:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   48 |         for(rg int i=0;i<k;i++){
      |                    ^
Language: C++

#include <iostream>
#include <vector>
#include <queue>
using namespace std;
constexpr long long INF = 1LL << 62;

struct Edge {
    int src, dst, cost;
    Edge(int s, int d, int c = 1) : src(s), dst(d), cost(c) {}
    bool operator<(const Edge &e){ return cost < e.cost;}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

int main() {
    int k; cin >> k;

    Graph g(k);
    for(int i=0; i < k; ++i) {
        g[i].emplace_back(i, (i * 10) % k, 0);
        g[i].emplace_back(i, (i + 1) % k, 1);
    }

    vector<long long> dist(k, INF);
    deque<int> dq;
    dq.push_front(1);
    dist[1] = 1;

    while(!dq.empty()) {
        int v = dq.front(); dq.pop_front();

        for(Edge e : g[v]) {
            if(chmin(dist[e.dst], dist[e.src] + e.cost)) {
                if(e.cost == 0) dq.push_front(e.dst);
                else dq.push_back(e.dst);
            }
        }
    }
    
    cout << dist[0] << '\n';
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:16: error: 'chmin' was not declared in this scope
   33 |             if(chmin(dist[e.dst], dist[e.src] + e.cost)) {
      |                ^~~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;

struct Edge {
    int src, dst, cost;
    Edge(int s, int d, int c = 1) : src(s), dst(d), cost(c) {}
    bool operator<(const Edge &e){ return cost < e.cost;}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

// O(|V|+|E|)log|V|)
void dijkstra(int s, Graph &g, vector<long long> &dist) {
    using Info = pair<long long, int>;
    // init
    dist.assign(g.size(), INF);
    dist[s] = 0;
    priority_queue<Info, vector<Info>, greater<Info> > pq;
    pq.emplace(0, s);
    
    // main
    while(!pq.empty()){
        long long d = pq.top().first;
        int v = pq.top().second;
        pq.pop();
        if(dist[v] < d) continue;
        for(Edge e : g[v]){
            if(dist[e.dst] > dist[v] + e.cost){
                dist[e.dst] = dist[v] + e.cost;
                pq.emplace(dist[e.dst], e.dst);
            }
        }
    }

}

int main() {
    int k; cin >> k;

    // build a graph
    Graph g(k+1);
    for(int i = 1; i < k; ++i) {
        g[i].emplace_back(i, (i+1) %k, 1);
        g[i].emplace_back(i, (i*10)%k, 0);
    }

    // calc
    vector<long long> dist;
    dijkstra(1, g, dist);

    // out
    cout << dist[0] + 1 << '\n';
    return 0;
}

Compiler output:
a.cc: In function 'void dijkstra(int, Graph&, std::vector<long long int>&)':
a.cc:19:27: error: 'INF' was not declared in this scope
   19 |     dist.assign(g.size(), INF);
      |                           ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

const int K_MAX = 1e5+5;
bool reached[K_MAX];

int solve(){
  int K;cin >> K;
  deque<PII> dq(1,PIL(1,1));
  reached[1] = true;
  while(!dq.empty()){
    //cout << dq.front().first SP dq.front().second << endl;
    if(dq.front().first == 0) return count;
    int val1 = (dq.front().first+1)%K;
    int val2 = (dq.front().first*10)%K;
    int count = dq.front().second;
    dq.pop_front();
    if(val2==0) return count;
    if(!reached[val2]) dq.push_front(PII(val2,count));
    reached[val2] = true;

    if(!reached[val1]) dq.push_back(PII(val1,count+1));
    reached[val1] = true;
  }
  return 0;
}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  cout << solve() << endl;
  return 0;
}



Compiler output:
a.cc: In function 'int solve()':
a.cc:41:38: error: cannot resolve overloaded function 'count' based on conversion to type 'int'
   41 |     if(dq.front().first == 0) return count;
      |                                      ^~~~~
Language: C++

#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_D main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LLONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
// functions

#endif


int main_D() {
    cin.tie(0);
    ios::sync_with_stdio(false);


    ll K; cin >> K;
    ll ans = LINF;
    FOR(i,1,1000000) {
        ans = min(ans, digit_sum(K*i));
    }

    cout << ans << endl;


    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:24: error: 'digit_sum' was not declared in this scope
   36 |         ans = min(ans, digit_sum(K*i));
      |                        ^~~~~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <iomanip>
#include <cstdio>

using namespace std;

const int N = 100010;

int n;

int dist[N];
deque<int> dq;

inline void Update(int u, int v, int w){
    if(dist[v] > dist[u] + w){
        dist[v] = dist[u] + w;
        if(w) dq.push_back(v);
        else dq.push_front(v);
    }
    return;
}

void Dijkstra(){
    memset(dist, 0x3f, sizeof(dist));
    dist[1] = 1;
    dq.push_back(1);
    while(!dq.empty()){
        int u = dq.front();
        dq.pop_front();
        Update(u, (u+1) % n, 1);
        Update(u, u*10%n, 0);
    }
    return ;
}

int main(){
    scanf("%d", &n);
    Dijkstra();
    printf("%d\n", dist[0]);
    return 0;
}


Compiler output:
a.cc: In function 'void Dijkstra()':
a.cc:32:5: error: 'memset' was not declared in this scope
   32 |     memset(dist, 0x3f, sizeof(dist));
      |     ^~~~~~
a.cc:12:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   11 | #include <cstdio>
  +++ |+#include <cstring>
   12 |
Language: C++

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

int main(){
  long long int k; cin >> k;
  long long int ans = 1000000009;
  for(int itr=1;i<30000000;i++){
  	long long int t = k*(long long)i;
  	long long int a = 1;
    long long int ta = 0;
    while(a <= t) a = a*10;
    while(a != 0){
      ta += t / a;
      t = t % a;
      a = a / 10;
    }
    ans = min(ans, ta);
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:17: error: 'i' was not declared in this scope
    7 |   for(int itr=1;i<30000000;i++){
      |                 ^
Language: C++

#include<bits/stdc++.h>
using namespace std ;
#define ll long long
#define ld long double
#define fast ios_base::sync_with_stdio(false) ;cin.tie(NULL);cout.tie(NULL)
#define F(i,a,b) for(int i= (int)(a); i<(int)(b);i++)
#define FI(i,a,b) for(int i=(int)(a);i<=(int)(b);i++)
#define RF(i,a,b) for(int i = (int)(a); i >= (int)(b); i--)
#define what_is(x) cerr << #x << " is " << x << endl;
#define ms(x,a) memset(x,(int)(a),sizeof(x))
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define pii pair<int,int>
#define vi vector<int >
#define pb push_back
#define endl '\n'
#define mp make_pair
#define ff first
#define ss second
#define MOD 1000000007
const int N = 1e6+7 ;
string s ;
bool vis[N] ;
deque<pii> dq ;
int main(){fast ;
	int k ;
	cin >> k ;
	dq.push_front({1,1}) ;
	while(!dq.empty()){
		auto now = dq.front() ;
		if(vis[now.ff])
			continue ;
		vis[now.ff] = true ;
		if(!now.ff){
			return cout << now.ss << endl , 0 ;
		}
		dq.push_front({now.ff * 10 % k , now.ss}) ;
		dq.push_back({(now.ff+1) % k , now,ss+1}) ;
	}
}




Compiler output:
a.cc: In function 'int main()':
a.cc:19:12: error: 'second' was not declared in this scope
   19 | #define ss second
      |            ^~~~~~
a.cc:38:52: note: in expansion of macro 'ss'
   38 |                 dq.push_back({(now.ff+1) % k , now,ss+1}) ;
      |                                                    ^~
a.cc:38:29: error: no matching function for call to 'std::deque<std::pair<int, int> >::push_back(<brace-enclosed initializer list>)'
   38 |                 dq.push_back({(now.ff+1) % k , now,ss+1}) ;
      |                 ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/deque:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:139,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_deque.h:1538:7: note: candidate: 'void std::deque<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; value_type = std::pair<int, int>]'
 1538 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_deque.h:1538:35: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::deque<std::pair<int, int> >::value_type&' {aka 'const std::pair<int, int>&'}
 1538 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_deque.h:1553:7: note: candidate: 'void std::deque<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; value_type = std::pair<int, int>]'
 1553 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_deque.h:1553:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::deque<std::pair<int, int> >::value_type&&' {aka 'std::pair<int, int>&&'}
 1553 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
Language: C++

#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
 
int sum_digit(long long x){
  int res=0;
  while(x>0){
    res += x%10;
    x /=10;
  }
  return res;
}
 
int main(){
  int k;
  cin>>k;
  long long temp=0;
  long long ans=1e18;
  for(int i=1;i<100000;i++){
    temp += k;
    ans = min(ans,sum_digit(temp));
  }
  cout<<ans<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:14: error: no matching function for call to 'min(long long int&, int)'
   21 |     ans = min(ans,sum_digit(temp));
      |           ~~~^~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 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:   template argument deduction/substitution failed:
a.cc:21:14: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   21 |     ans = min(ans,sum_digit(temp));
      |           ~~~^~~~~~~~~~~~~~~~~~~~~
/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, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:21:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   21 |     ans = min(ans,sum_digit(temp));
      |           ~~~^~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <boost/multiprecision/cpp_int.hpp>
#include <algorithm>
#include <stdio.h>
#include <chrono>
using namespace std;

inline boost::multiprecision::cpp_int f(boost::multiprecision::cpp_int i) {
	boost::multiprecision::cpp_int ret = 0;
	while (i>0){
		ret += i % 10;
		i /= 10;
	}
	return ret;
}
int main(void) {
	boost::multiprecision::cpp_int n, m, ret=1000;
	scanf("%d", &n);
	m=n;
	chrono::system_clock::time_point start=chrono::system_clock::now();
	while (chrono::duration_cast<chrono::milliseconds>(chrono::system_clock::now() - start).count() < 1980) {
		res = min(res, f(m));
		m+=n;
	}
	printf("%llu", res);
	return 0;
}


Compiler output:
a.cc:1:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
    1 | #include <boost/multiprecision/cpp_int.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <boost/multiprecision/cpp_int.hpp>
#include <algorithm>
#include <stdio.h>
#include <chrono>
using namespace std;

inline int f(boost::multiprecision::cpp_int i) {
	int ret = 0;
	while (i>0){
		ret += i % (boost::multiprecision::cpp_int)10;
		i /= 10;
	}
	return ret;
}
int main(void) {
	boost::multiprecision::cpp_int n, m;
	int res=1000;
	scanf("%d", &n);
	m=n;
	chrono::system_clock::time_point start=chrono::system_clock::now();
	while (chrono::duration_cast<chrono::milliseconds>(chrono::system_clock::now() - start).count() < 1980) {
		res = min(res, f(m));
		m+=n;
	}
	printf("%llu", res);
	return 0;
}


Compiler output:
a.cc:1:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
    1 | #include <boost/multiprecision/cpp_int.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <boost/multiprecision/cpp_int.hpp>
#include <algorithm>
#include <stdio.h>
#include <chrono>
using namespace std;

inline int f(boost::multiprecision::cpp_int i) {
	int ret = 0;
	while (i>0){
		ret += i % 10;
		i /= 10;
	}
	return ret;
}
int main(void) {
	boost::multiprecision::cpp_int n, m;
	int res=1000;
	scanf("%d", &n);
	m=n;
	chrono::system_clock::time_point start=chrono::system_clock::now();
	while (chrono::duration_cast<chrono::milliseconds>(chrono::system_clock::now() - start).count() < 1980) {
		res = min(res, f(m));
		m+=n;
	}
	printf("%llu", res);
	return 0;
}


Compiler output:
a.cc:1:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
    1 | #include <boost/multiprecision/cpp_int.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.