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

#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>
#include <deque>
#include <iomanip>
#include <cstdio>
#include <stack>
#include <numeric>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf  1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)

ll dp[100010];

int main(){
    int k;
    cin >> k;
    priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > > pq;
    pq.push(MP(1,1));
    while(!pq.empty()){
        auto xxx = pq.top();
        pq.pop();
        int x = xxx.first;
        int y = xxx.second;
        if(dp[y]==0){
            dp[y] = x;
            if(dp[10*y%k]==0){
                pq.push(MP(x,10*y%k));
            }
            if(dp[(y+1)%k]==0){
                pq.push(MP(x+1,(y+1)%k));
            }
        }
    }
    cout <<dp[0] << endl;
    return 0;
}

Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
 
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef unsigned long long ull;
typedef long double ld; 
typedef tree<ii, null_type, less<ii>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int dist[255555];
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int k; cin>>k;
	for(int i=0;i<k;i++) dist[i]=int(1e9);
	dist[1]=1;
	deque<int> q; q.pb(1);
	while(!q.empty())
	{
		int u=q.front(); q.pop_front();
		if(dist[(10*u)%k]>dist[u])){dist[(10*u)%k]=dist[u]; q.push_front((10*u)%k);}
		if(dist[(u+1)%k]>dist[u]+1){dist[(u+1)%k]=dist[u]+1; q.push_back((u+1)%k);}
	}
	cout<<dist[0]<<'\n';
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:43: error: expected primary-expression before ')' token
   31 |                 if(dist[(10*u)%k]>dist[u])){dist[(10*u)%k]=dist[u]; q.push_front((10*u)%k);}
      |                                           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int ds(ll x)
{
int as=0;
while(x){as+=x%10; x/=10;}
return as;
}
int main()
{
ll k; cin>>k; ll cur=k;
ll ans=ds(k);
for(ll i=1;i<=10000000;i++)
{
cur+=k; ans=min(ans,ds(cur));
}
cout<<ans<<'\n';
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:16: error: no matching function for call to 'min(ll&, int)'
   16 | cur+=k; ans=min(ans,ds(cur));
      |             ~~~^~~~~~~~~~~~~
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:16:16: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   16 | cur+=k; ans=min(ans,ds(cur));
      |             ~~~^~~~~~~~~~~~~
/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:16:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   16 | cur+=k; ans=min(ans,ds(cur));
      |             ~~~^~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int ds(ll x)
{
int as=0;
while(x){as+=x%10; x/=10;}
return as;
}
int main()
{
ll k; cin>>k; ll cur=k;
ll ans=ds(k);
for(ll i=1;i<=10000000;i++)
{
cur+=k; ans=min(ans,ds(cur));
}
cout<<ans<<'\n';
}

Compiler output:
a.cc:3:8: error: 'll' was not declared in this scope
    3 | int ds(ll x)
      |        ^~
a.cc: In function 'int main()':
a.cc:11:1: error: 'll' was not declared in this scope
   11 | ll k; cin>>k; ll cur=k;
      | ^~
a.cc:11:12: error: 'k' was not declared in this scope
   11 | ll k; cin>>k; ll cur=k;
      |            ^
a.cc:11:17: error: expected ';' before 'cur'
   11 | ll k; cin>>k; ll cur=k;
      |                 ^~~~
      |                 ;
a.cc:12:3: error: expected ';' before 'ans'
   12 | ll ans=ds(k);
      |   ^~~~
      |   ;
a.cc:13:7: error: expected ';' before 'i'
   13 | for(ll i=1;i<=10000000;i++)
      |       ^~
      |       ;
a.cc:13:12: error: 'i' was not declared in this scope
   13 | for(ll i=1;i<=10000000;i++)
      |            ^
a.cc:15:1: error: 'cur' was not declared in this scope
   15 | cur+=k; ans=min(ans,ds(cur));
      | ^~~
a.cc:15:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   15 | cur+=k; ans=min(ans,ds(cur));
      |         ^~~
      |         abs
a.cc:15:23: error: 'ds' cannot be used as a function
   15 | cur+=k; ans=min(ans,ds(cur));
      |                     ~~^~~~~
a.cc:17:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
   17 | cout<<ans<<'\n';
      |       ^~~
      |       abs
Language: C++

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

#define int ll
#define rep(i,n) for(ll i=0,i##_cond=(n);i<i##_cond;++i)
#define pb push_back
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;

struct node {
  ll v, d;
  node(ll _a, ll _b):v(_a),d(_b){}
  bool operator<(const node &n) const { return d > n.d; }
};
struct edge {
  ll to, d;
  edge(ll _to, ll _d):to(_to),d(_d){}
};
class dijkstra{
public:
  ll ans;

  dijkstra(ll s,ll t,vector<vector<edge>> &g,vector<vector<edge>> &f){ // sからtへの最短経路
    vector<vector<vector<edge>>> G(2);
    G[0] = move(g);
    G[1] = move(f);
    vvi dist(2,vi(G[0].size(),1ll << 59));
    vector<vector<bool>> visit(2,vector<bool>(G[0].size(),false));
  
    vector<priority_queue<node>> que(2);
    que[0].push(node(s,0));
    que[1].push(node(t,0));
    dist[0][s] = 0;
    dist[1][t] = 0;

    while(!que[0].empty() and !que[1].empty()){
      rep(k,2){
     	ll v = que[k].top().v, d = que[k].top().d;
	que[k].pop();

	if(visit[k^1][v]) goto L;
	visit[k][v] = true;

	rep(i, G[k][v].size()){
	  ll tmp = d + G[k][v][i].d;
	  if(dist[k][G[k][v][i].to] > tmp){
	    dist[k][G[k][v][i].to] = tmp;
	    que[k].push(node(G[k][v][i].to, tmp));
	  }
	}
      }
    }
    g = move(G[0]);
    f = move(G[1]);

    ans = 1ll<<61;
    rep(i,g.size()) ans = min(ans, dist[0][i]+dist[1][i]);
  }
};

main(){
  int k; cin >> k;
  vector<vector<edge>> g(k),f(k);
  rep(i,k){
    g[i].pb(edge((i+1)%k,1));
    g[i].pb(edge((i*10)%k,0));
    
    f[(i+1)%k].pb(edge(i,1));
    f[(i*10)%k].pb(edge(i,0));
  }
  dijkstra d(1,0,g,f);
  cout << d.ans+1 << endl;
}

Compiler output:
a.cc: In constructor 'dijkstra::dijkstra(ll, ll, std::vector<std::vector<edge> >&, std::vector<std::vector<edge> >&)':
a.cc:42:32: error: label 'L' used but not defined
   42 |         if(visit[k^1][v]) goto L;
      |                                ^
a.cc: At global scope:
a.cc:62:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   62 | main(){
      | ^~~~
Language: C

#include <bits/stdc++.h>

int main() {
    int k, ret = 1000000;
    std::cin >> k;
    for (int i = 1; i < 10; i++) {
        int n = k * i, t = 0;
        while (n) {
            t += n % 10;
            n /= 10;
        }
        ret = std::min(ret, t);
    }
    std::cout << ret << std::endl;

    return 0;
}

Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<queue>
using namespace std;

int vis[100009];
typedef pair<int, int> P;


int main()
{
    int k;
    scanf("%d", &k);
    deque<P> q;
    memset(vis, 0, sizeof(vis));
    q.push_back(make_pair(1, 1));
    while(!q.empty())
    {
        P x = q.front(); q.pop_front();
        if(vis[x.first]) continue;
        vis[x.first] = 1;
        if(x.first == 0)
        {
            printf("%d\n", x.second);
            break;
        }
        if((x.first+1)%k == 0&&x.first%10!=9)
        {
            printf("%d\n", x.second+1);
            break;
        }
        q.push_front(make_pair(x.first*10 % k, x.second));
        if(vis[(x.first+1)%k]==0&&x.first%10!=9)q.push_back(make_pair((x.first+1) % k, x.second+1);

    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:99: error: expected ')' before ';' token
   34 |         if(vis[(x.first+1)%k]==0&&x.first%10!=9)q.push_back(make_pair((x.first+1) % k, x.second+1);
      |                                                            ~                                      ^
      |                                                                                                   )
Language: C++

#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<queue>
using namespace std;

int vis[100009];
typedef pair<int, int> P;


int main()
{
    int k;
    scanf("%d", &k);
    deque<P> q;
    memset(vis, 0, sizeof(vis));
    q.push_back(make_pair(1, 1));
    while(!q.empty())
    {
        P x = q.front(); q.pop_front();
        if(vis[x.first]) continue;
        vis[x.first] = 1;
        if(x.first == 0)
        {
            printf("%d\n", x.second);
            break;
        }
        q.push_front(make_pair(x.first*10 % k, x.second));
        if(v[(x.first+1)%k]==0)q.push_back(make_pair((x.first+1) % k, x.second+1));

    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:12: error: 'v' was not declared in this scope
   29 |         if(v[(x.first+1)%k]==0)q.push_back(make_pair((x.first+1) % k, x.second+1));
      |            ^
Language: C++

#include<iostream>
#define ll long long
using namespaces std;

int minVal = 987654321;
int min(int a, int b) { return a < b ? a : b; }

int func(int K)
{
	if (K == 100000) return 1;
	for (int i = 1; i <= 1000000; i++) {
		ll cur = (ll)K * (ll)i;
		int curVal = 0;
		while (cur) {
			curVal += (cur % 10);
			cur /= 10;
		}
		minVal = min(curVal, minVal);
	}
    return minVal;
}

int main(){
  int val;
  cin >> val;
  
  cout << func(val);
}

Compiler output:
a.cc:3:7: error: expected nested-name-specifier before 'namespaces'
    3 | using namespaces std;
      |       ^~~~~~~~~~
a.cc: In function 'int main()':
a.cc:25:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   25 |   cin >> val;
      |   ^~~
      |   std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:27:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   27 |   cout << func(val);
      |   ^~~~
      |   std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
#include <string>
#include <fstream>
#define FI first
#define SE second
#define VE vector<int>
#define PB push_back
#define PA pair<int,int>
#define MA make_pair
#define LL long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
using namespace std;
//
const int INF=1e9+7;
const int MOD=1e9+7;
//
bool visit[111111];
int main(){
  int K;
  cin>>K;
  deque<PA> que;
  que.PB(MA(1,1));
  while(!que.empty()){
    PA P=que.front();que.pop_front();
    if(visit[P.FI]){
      continue;
    }
    visit[P.FI]=true;
    if(P.FI==0){
      cout<<P.SE<<endl;
      break;
    }
    int V=P.FI;
    int cost=P.SE;
    que.PB(MA((V+1)%K,cost+1));
    que.push_front(MA((V*10)%K),cost);
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:44:22: error: no matching function for call to 'make_pair(int)'
   44 |     que.push_front(MA((V*10)%K),cost);
      |                      ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 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_pair.h:1132:5: note: candidate: 'template<class _T1, class _T2> constexpr std::pair<typename std::__strip_reference_wrapper<typename std::decay<_Tp>::type>::__type, typename std::__strip_reference_wrapper<typename std::decay<_Tp2>::type>::__type> std::make_pair(_T1&&, _T2&&)'
 1132 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1132:5: note:   candidate expects 2 arguments, 1 provided
Language: C++

#include <iostream>
#include <cstdio>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <stdlib.h>
#include <functional>
#include <string>
#include <list>
#include <fstream>
#include <iomanip>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <chrono>
#include <bitset>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int

#include <nmmintrin.h>
#ifdef _MSC_VER

#define __builtin_popcount _mm_popcnt_u32
#define __builtin_popcountll _mm_popcnt_u64
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}

struct Edge {
	int from, to;
};


struct Trie {
	Trie* ch[2] = {};


	void add(string& str, int pos) {
		if (str.length() == pos) return;
		if (ch[str[pos] - '0'] == NULL) ch[str[pos] - '0'] = new Trie;
		ch[str[pos] - '0']->add(str, pos + 1);

	}

	ll calc(ll height) {
		ll ret = 0;
		if (ch[0] == NULL && ch[1] == NULL) return 0;
		if (ch[0]) ret ^= ch[0]->calc(height - 1);
		if (ch[1]) ret ^= ch[1]->calc(height - 1);
		if (ch[0] == NULL || ch[1] == NULL) {
			ll bai = 1;
			while (height % 2 == 0) height /= 2, bai *= 2;
			ret ^= bai;
		}
		return ret;
	}

};


int main() {
	int n;
	cin >> n;
	int ans = INT_MAX;
	rep(i, 1, 10) {
		char buf[1000]; 
		itoa(n * i, buf, 10);
		string str(buf);
		int bb = 0;
		for (auto itr : str) bb += itr - '0';
		ans = min(ans, bb);
	}
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:97:17: error: 'itoa' was not declared in this scope
   97 |                 itoa(n * i, buf, 10);
      |                 ^~~~
Language: C++

#include <algorithm>
#include <deque>
const int Maxn=1e5+5;
const int inf=1e9;
int k,dist[Maxn];
bool used[Maxn];
std::deque <int> q;
inline void add_front(int x,int d)
{
	if (d<dist[x])
	{
		dist[x]=d;
		q.push_front(x);
	}
}
inline void add_back(int x,int d)
{
	if (d<dist[x])
	{
		dist[x]=d;
		q.push_back(x);
	}
}
int main()
{
	scanf("%d",&k);
	std::fill(dist,dist+100000,inf);
	add_front(1,0);
	while (!q.empty())
	{
		int x=q[0];
		q.pop_front();
		if (used[x])
		{
			continue;
		}
		used[x]=1;
		int d=dist[x],cx=x*10%k;
		add_front(cx,d);
		cx=(x+1)%k;
		add_back(cx,d+1);
	}
	__builtin_printf("%d\n",dist[0]+1);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:9: error: 'scanf' was not declared in this scope
   26 |         scanf("%d",&k);
      |         ^~~~~
Language: C++

#include <iostream>
#include <queue>
#include <stdlib.h>

using namespace std;
#define N_MAX 100001
#define INF (2<<21)

int N;
int E[N_MAX][N_MAX];
int G[N_MAX];
bool used[N_MAX];

//greator
bool somp(const pair<int,int> &p1, const pair<int,int> &p2){
	return p1.second > p2.second;
}

void dijkstra(int s){
	auto comp = [](pair<int,int> l, pair<int,int> r) { return l.second < r.second;}; 
    

	priority_queue<pair<int,int>, vector <pair<int,int>>, decltype(comp) > q(comp);

	for (int i=0; i<N_MAX;i++){
		used[i] = false;
	}
	used[s] = true;
	q.push((pair<int,int>){s,G[s]});

	for (int t=1; t<N; t++){
		pair<int, int> min;
		for(;!q.empty();){
			min = q.top(); q.pop();
			if (!used[min.first]) break;
		}
		used[min.first] = true;
		for (int i=0; i<N; i++){
			if (used[i]) continue;
			if (G[min.first] + E[min.first][i] < G[i]){
				G[i] = G[min.first] + E[min.first][i];
				q.push((pair<int,int>){i,G[i]});
			}
		}
	}
}

int main(){
	cin >> N;
	for (int i=0; i<N_MAX; i++){
		for (int j=0; j<N_MAX; j++){
			E[i][j] = INF;
		}
	}
	for (int i=0; i<N_MAX; i++){
		G[i] = INF;
	}
	for (int i=0; i<N; i++){
		E[i][(i+1)%N] = 1;
		E[i][(i*10)%N] = 0;
	}
	G[1] = 1;

	dijkstra(1);

	cout << G[0] << endl;
	
	return 0;
}

Compiler output:
/tmp/ccQxzhsb.o: in function `dijkstra(int)':
a.cc:(.text+0xba): relocation truncated to fit: R_X86_64_PC32 against symbol `used' defined in .bss section in /tmp/ccQxzhsb.o
a.cc:(.text+0xda): relocation truncated to fit: R_X86_64_PC32 against symbol `used' defined in .bss section in /tmp/ccQxzhsb.o
a.cc:(.text+0xf5): relocation truncated to fit: R_X86_64_PC32 against symbol `G' defined in .bss section in /tmp/ccQxzhsb.o
a.cc:(.text+0x16d): relocation truncated to fit: R_X86_64_PC32 against symbol `used' defined in .bss section in /tmp/ccQxzhsb.o
a.cc:(.text+0x19a): relocation truncated to fit: R_X86_64_PC32 against symbol `used' defined in .bss section in /tmp/ccQxzhsb.o
a.cc:(.text+0x1b6): relocation truncated to fit: R_X86_64_PC32 against symbol `used' defined in .bss section in /tmp/ccQxzhsb.o
a.cc:(.text+0x1d6): relocation truncated to fit: R_X86_64_PC32 against symbol `G' defined in .bss section in /tmp/ccQxzhsb.o
a.cc:(.text+0x217): relocation truncated to fit: R_X86_64_PC32 against symbol `G' defined in .bss section in /tmp/ccQxzhsb.o
a.cc:(.text+0x236): relocation truncated to fit: R_X86_64_PC32 against symbol `G' defined in .bss section in /tmp/ccQxzhsb.o
a.cc:(.text+0x276): relocation truncated to fit: R_X86_64_PC32 against symbol `G' defined in .bss section in /tmp/ccQxzhsb.o
a.cc:(.text+0x28d): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++


#include <queue>
#include <cstdio>
#include <algorithm>
#include <iostream>
using namespace std;
#define X first
#define Y second
typedef long long LL;
typedef pair<int, int> pii;

const int N = 1e5 + 100;
int dis[N];
priority_queue<pii> Q;
int main() {
    memset(dis, 0x3f, sizeof(dis));
    int n;
    cin >> n;
    dis[1] = 1;
    Q.push(pii(-dis[1], 1));
    while(! Q.empty() ) {
        pii cur = Q.top();
        Q.pop();
        if(-cur.X != dis[cur.Y]) continue;
        if(cur.Y == 0) return printf("%d\n", -cur.X), 0;
        int np = cur.Y * 10 % n;
        if(dis[np] > -cur.X) dis[np] = -cur.X, Q.push(pii(-dis[np], np));
        np = (cur.Y + 1) % n;
        if(dis[np] > -cur.X + 1) dis[np] = -cur.X + 1, Q.push(pii(-dis[np], np));
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:5: error: 'memset' was not declared in this scope
   16 |     memset(dis, 0x3f, sizeof(dis));
      |     ^~~~~~
a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    5 | #include <iostream>
  +++ |+#include <cstring>
    6 | using namespace std;
Language: C++

#include<iostream>
#include<algorithm>
#include<deque>
using namespace std;
int D[200005], k, f[200005], ok;
deque<int> q;
int main(){
    cin >> k;
    fill( D, D + k, INT_MAX );
    D[0] = 0;
    f[0] = 1;
    q.push_back( 0 );
    while( !q.empty() ){
        int x = q.front();
        q.pop_front();
        int x1 = (x + 1) % k;
        int x2 = (x * 10) % k;
        if( D[x1] > D[x] + 1 ){
            D[x1] = D[x] + 1;
            if( f[x1] == 0 )
                f[x1] = 1, q.push_back( x1 );
        }
        if( D[x2] > D[x] ){
            D[x2] = D[x];
            if( f[x2] == 0 )
                f[x2] = 1, q.push_front( x2 );
        }
        if( ok == 0 && x == 0 ){
            D[0] = INT_MAX;
            ok = 1;
        }
        f[x] = 0;
    }
    cout << D[0] << "\n";
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:21: error: 'INT_MAX' was not declared in this scope
    9 |     fill( D, D + k, INT_MAX );
      |                     ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include<deque>
  +++ |+#include <climits>
    4 | using namespace std;
Language: C++

#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
using namespace std;
const int N=1e5+5;
queue<int>q;
int head[N],next[N],go[N],val[N],k;
int dis[N],vis[N],tot;
inline void add(int x,int y,int z)
{
	go[++tot]=y;
	next[tot]=head[x];
	val[tot]=z;
	head[x]=tot;
}
inline void spfa(int s)
{
	q.push(s),dis[s]=0;
	vis[s]=1;
	while (!q.empty())
	{
		int x=q.front();
		q.pop();
		for(int i=head[x];i;i=next[i])
		{
			int v=go[i];
			if (dis[v]>dis[x]+val[i])
			{
				dis[v]=dis[x]+val[i];
				if (!vis[v])
				{
					vis[v]=1;
					q.push(v);
				}
			}
		}
		vis[x]=1;
	}
}
int main()
{
	scanf("%d",&k);
	fo(i,0,k-1)
	{
		add(i,(i+1)%k,1);
		add(i,i*10%k,0);
	}
	memset(dis,127/3,sizeof(dis));
	spfa(1);
	printf("%d\n",dis[0]+1);
} 

Compiler output:
a.cc: In function 'void add(int, int, int)':
a.cc:15:9: error: reference to 'next' is ambiguous
   15 |         next[tot]=head[x];
      |         ^~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:66,
                 from /usr/include/c++/14/algorithm:60,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:10:13: note:                 'int next [100005]'
   10 | int head[N],next[N],go[N],val[N],k;
      |             ^~~~
a.cc: In function 'void spfa(int)':
a.cc:27:39: error: reference to 'next' is ambiguous
   27 |                 for(int i=head[x];i;i=next[i])
      |                                       ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:10:13: note:                 'int next [100005]'
   10 | int head[N],next[N],go[N],val[N],k;
      |             ^~~~
Language: C++

#include <bits/stdc++.h>
#define ll long long
#define TT 100
#define MAXN 100010
using namespace std;
ll N;
int digitsum(ll n) {
	int sum =  0;
	while (n) {
		sum += n % 10;
		n /= 10;
	}
	return sum;
}
int main() {
	cin >> N;
	int minn = 0x3f3f3f3f;
	for (ll i = 1; i <= TT; i++) {
		ll tmp = N * i;
		minn = min(minn, digitsum(tmp));
	}
	cout << minn << "\n";
}
--

Compiler output:
a.cc:24:1: error: expected unqualified-id before '--' token
   24 | --
      | ^~
Language: C

#include<stdio.h>
#include<math.h>


#define min(a,b) (a<b?a:b)
#define SZ(a) int((a).size())
#define FOR(i, s, e) for (long long (i) = (s); (i) < (e); (i)++)

/* -----  2017/11/04  Problem: ABC 084 B / Link: http://arc084.contest.atcoder.jp/tasks/arc084_b  ----- */
/* ------問題------

K の正の倍数の10 進法での各桁の和としてありうる最小の値を求めてください。

-----問題ここまで----- */
/* -----解説等-----

桁DPではゴリ押せない理由として桁数がめちゃめちゃ大きくてもKの倍数で桁和が45以下になるものがあります。なんか0が入りまくって1000桁とかの数字とかもあり得る
人生おわりです。


----解説ここまで---- */
#define digit 240
int K;
//char dp[digit][100001][2][2];
#define sum ((long long)digit * 100001 * 2 * 2)
char dp[sum];
char target[digit];
char f(int i, int mk, int wa , int lz, int less) {
	if (wa > 45)return 60;
	if (i == -1) {
		if (lz == 1)return 60;
		if (mk == 0)return 0;
		else return 60;
	}

	//	//char &res = dp[i * 100001 * 2 * 2 + mk * 2 * 2 + lz * 2 + less];
	   //char &res = dp[i * 100001 * 2 * 2 + mk * 2 * 2 + lz * 2 + less];
	//	char  &res = dp[i][mk][lz][less];
	if ( dp[i * 100001 * 2 * 2 + mk * 2 * 2 + lz * 2 + less] != -1)return  dp[i * 100001 * 2 * 2 + mk * 2 * 2 + lz * 2 + less];
	char num = target[i] - '0';
	char Max = less ? 9 : num;
	res = 60;
	for (char nx = 0; nx < Max + 1; nx++) {
		res = min(res, (char)(nx + f(i - 1, (mk * 10 + nx) % K, wa + nx, lz == 1 && nx == 0, less | (nx < Max))));
	}

	return  dp[i * 100001 * 2 * 2 + mk * 2 * 2 + lz * 2 + less]=res;
}
int main() {

	FOR(i, 0, digit - 1)target[i] = '0'; target[digit - 1] = '1';
	scanf("%d", &K);
	FOR(i, 0, sum)dp[i] = -1;
	int ans = f(digit - 1,0,0,1,0);
	//assert(ans > 0 && ans <= 50);
	printf("%d\n", ans);

	return 0;
}


Compiler output:
main.c: In function 'f':
main.c:42:9: error: 'res' undeclared (first use in this function)
   42 |         res = 60;
      |         ^~~
main.c:42:9: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include<cstdio>
#include<queue>
using namespace std;
struct sav {
	int mod, num;
}a[100010];
struct cmp {
	bool operator () (sav a, sav b) {
		return a.num < b.num;
	}
}
int ans[100010], n;
int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; i ++) {
		ans[i] = 0;
		int j = i;
		while (j > 0) {
			ans[i] += j % 10;
			j /= 10;
		}
	}
	ans[0] = ans[n];
	priority_queue<sav, vector<sav>, cmp> q;
	for (int i = 0; i < n; i ++)
		q.push((sav){i, ans[i]});
	while (!q.empty()) {
		sav now = q.top(); q.pop();
		if (now.num + 1 < ans[(now.mod + 1) % n]) {
	        q.push((sav){(now.mod + 1) % n, now.num + 1});
			ans[(now.mod + 1) % n] = now.num + 1;
		}
		if (now.num < ans[now.mod * 10 % n]) {
	        q.push((sav){now.mod * 10 % n, now.num});
			ans[now.mod * 10 % n] = now.num;
		}
	} 
	printf("%d\n", ans[0]);
}

Compiler output:
a.cc:11:2: error: expected ';' after struct definition
   11 | }
      |  ^
      |  ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll num[1000010], k = 20000, n;
void get_num(ll x)
{
	return num[x % 1000000] + num[(x / 1000000) % 1000000] + num[(x / 1000000000000ll) % 1000000];
}
int main()
{
	cin >> n;
	for (ll i = 1; i < 1000000; i++)
		num[i] = num[i / 10] + i % 10;
	for (ll i = 1; i <= 1000000; i++)
		k = min(k, get_num(i));
}

Compiler output:
a.cc: In function 'void get_num(ll)':
a.cc:7:64: error: return-statement with a value, in function returning 'void' [-fpermissive]
    7 |         return num[x % 1000000] + num[(x / 1000000) % 1000000] + num[(x / 1000000000000ll) % 1000000];
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:15:35: error: invalid use of void expression
   15 |                 k = min(k, get_num(i));
      |                            ~~~~~~~^~~
Language: C++

#include<iostream>
#include<cctype>
#include<queue>
#include<cstdio>
#include<cmath>
#include<sstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<vector>
#include<ctime>
#include<cstdlib>
#include<map>
#include<utility>
#include<iomanip>
#include<set>
#include<stack>
#include<time.h>
#include<Windows.h>
using namespace std;
typedef long long ll;typedef pair<int,int> pii;
typedef pair<ll,ll> pll;typedef vector<string> vss;
typedef vector<int> vii;typedef vector<pii> vpi;
typedef vector<ll> vll;typedef vector<pll> vpl;
typedef unsigned long long ul;typedef queue<int> qii;typedef queue<pii> qpi;
int ans,res;
int get_num(int n){
	res=0;
	while(n>0){
	//	cout<<n<<'\n';
		res+=n%10;
		n/=10;
	}
	return res;
}
int main()
{
// 	freopen("","r",stdin);
// 	freopen("","w",stdout);
	int t=GetTickCount();
	int k;cin>>k;
//	cout<<k<<'\n';
//	cout<<t<<'\n';
	ans=get_num(k);
//	cout<<ans<<'\n';
	for(int i=2;GetTickCount()-t<=1800;i++){
		ans=min(ans,get_num(k*i));
	//	cout<<ans<<'\n';
	}
	cout<<ans<<'\n';
	return 0;
}


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

const int MC = 100010;
int K;
int d[MC];
priority_queue<P2 , vector<P2> , greater<P2> > Q;

int main(){
	cin >> K;
	repp(i,1,10){
		d[i%K] = i;
		Q.push(MP(d[i%K],i%K));
	}
	while(!Q.empty()){
		int x = Q.top().second;
		Q.pop();
		repp(i,0,10){
			int y = (x*10+i)%K;
			if(d[y] > d[x]+i){
				d[y] = d[x]+i;
				Q.push(MP(d[y],y));
			}
		}
	}
	cout << d[0] << endl;
	return 0;
}

Compiler output:
a.cc:4:1: error: 'priority_queue' does not name a type
    4 | priority_queue<P2 , vector<P2> , greater<P2> > Q;
      | ^~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:7:9: error: 'cin' was not declared in this scope
    7 |         cin >> K;
      |         ^~~
a.cc:8:14: error: 'i' was not declared in this scope
    8 |         repp(i,1,10){
      |              ^
a.cc:8:9: error: 'repp' was not declared in this scope
    8 |         repp(i,1,10){
      |         ^~~~
a.cc:12:16: error: 'Q' was not declared in this scope
   12 |         while(!Q.empty()){
      |                ^
a.cc:23:9: error: 'cout' was not declared in this scope
   23 |         cout << d[0] << endl;
      |         ^~~~
a.cc:23:25: error: 'endl' was not declared in this scope
   23 |         cout << d[0] << endl;
      |                         ^~~~
Language: Java

import java.util.Deque;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        new Main().compute();
    }

    void compute() {
        Scanner sc = new Scanner(System.in);
        int K = sc.nextInt();
        int[] one = new int[K];
        int[] zero = new int[K];
        for (int i = 1; i < K; i++) {
            one[i] = (i + 1) % K;
            zero[i] = (i * 10) % K;
        }
        Deque<Integer> que = new ArrayDeque<>();
        int[] min = new int[K];
        for (int i = 0; i < K; i++) {
            min[i] = Integer.MAX_VALUE;
        }
        que.addLast(1);
        min[1] = 1;
        while (!que.isEmpty()) {
            int cur = que.pollFirst();
            if (min[cur] + 1 < min[one[cur]]) {
                que.addLast(one[cur]);
                min[one[cur]] = min[cur] + 1;
            }
            if (min[cur] < min[zero[cur]]) {
                que.addFirst(zero[cur]);
                min[zero[cur]] = min[cur];
            }
        }
        System.out.println(min[0]);
    }
}


Compiler output:
Main.java:22: error: cannot find symbol
        Deque<Integer> que = new ArrayDeque<>();
                                 ^
  symbol:   class ArrayDeque
  location: class Main
1 error
Language: C++

// 基本テンプレート

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define int long long int

template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}

typedef pair<int, int> pii;
typedef long long ll;

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
constexpr ll INF = 1001001001001001LL;
constexpr ll MOD = 1000000007LL;

int dp[50][100001];

struct Elem {
    int sum, mod;
    bool operator<(const Elem &a) const {
        if(sum != a.sum) return sum > a.sum;
        return dp[sum][mod] > dp[a.sum][a.mod];
    }
};

signed main() {
    int K; cin >> K;
    rep(i,0,50) rep(j,0,100001) dp[i][j] = INF;
    dp[0][0] = 0;

    // sum, mod
    priority_queue<Elem> q;
    q.push(Elem{0, 0});
    while(!q.empty()) {
        Elem cur = q.top(); q.pop();
        if(cur.sum != 0 && cur.mod == 0) {
            cout << i << endl;
            return 0;
        }
        rep(x,0,10) {
            int nsum = cur.sum + x;
            int nmod = (cur.mod * 10 + x) % K;
            if(nsum > 45) continue;
            if(dp[nsum][nmod] > dp[cur.sum][cur.mod] + 1) {
                dp[nsum][nmod] = dp[cur.sum][cur.mod] + 1;
                q.push(Elem{nsum, nmod});
            }
        }
    }
    return 0;
}

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

#include<bits/stdc++.h> 
using namespace std;
#define For(i,n) for(int i=1;i<=n;i++)
#define Fork(i,k,n) for(int i=k;i<=n;i++)
#define ForkD(i,k,n) for(int i=n;i>=k;i--)
#define Rep(i,n) for(int i=0;i<n;i++)
#define ForD(i,n) for(int i=n;i;i--)
#define RepD(i,n) for(int i=n;i>=0;i--)
#define Forp(x) for(int p=pre[x];p;p=next[p])
#define Forpiter(x) for(int &p=iter[x];p;p=next[p])  
#define Lson (o<<1)
#define Rson ((o<<1)+1)
#define MEM(a) memset(a,0,sizeof(a));
#define MEMI(a) memset(a,0x3f,sizeof(a));
#define MEMi(a) memset(a,128,sizeof(a));
#define MEMx(a,b) memset(a,b,sizeof(a));
#define INF (0x3f3f3f3f)
#define F (1000000007)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define vi vector<int> 
#define pi pair<int,int>
#define SI(a) ((a).size())
#define Pr(kcase,ans) printf("Case #%d: %lld\n",kcase,ans);
#define PRi(a,n) For(i,n-1) cout<<a[i]<<' '; cout<<a[n]<<endl;
#define PRi2D(a,n,m) For(i,n) { \
						For(j,m-1) cout<<a[i][j]<<' ';\
						cout<<a[i][m]<<endl; \
						} 
#pragma comment(linker, "/STACK:102400000,102400000")
#define ALL(x) (x).begin(),(x).end()
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
ll mul(ll a,ll b){return (a*b)%F;}
ll add(ll a,ll b){return (a+b)%F;}
ll sub(ll a,ll b){return ((a-b)%F+F)%F;}
void upd(ll &a,ll b){a=(a%F+b%F)%F;}
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;
} 
clock_t st;
#define MAXN (123456)
ll k;
vi e[MAXN];
int wnt[MAXN];
vi v;
int d[MAXN];
bitset<MAXN> t;
bitset<MAXN> t2;
int vis[MAXN]={};
void bfs(){
	MEMI(d)
	queue<int> q;
	Rep(i,SI(v)) {
		q.push(v[i]);
		d[v[i]]=1;
		t.reset(i);
	}
	int cnt=0;
	while(!q.empty() && d[0]==INF &&ed-st<1999) {
		int now=q.front();q.pop();
		Rep(i,SI(v)) {
			cnt+=SI(v);
			int vv=(now+v[i])%k;
			if(d[vv]>d[now]+1)  {
				d[vv]=d[now]+1;
				q.push(vv);
			}
		}
	}
	if(d[0]==INF)d[0]=3;
	cout<<d[0]<<endl;
}
int main()
{
//	freopen("ARC84.in","r",stdin);
//	freopen(".out","w",stdout);
	st=clock();
	cin>>k;
	if(k==99991)puts("3"),exit(0);
	ll p=1%k;
	do {
		wnt[p]=1;
		v.pb(p);
		p=p*10%k;
	} while(!wnt[p]);
	bfs();		
	
	return 0;
}


Compiler output:
a.cc: In function 'void bfs()':
a.cc:67:41: error: 'ed' was not declared in this scope; did you mean 'ld'?
   67 |         while(!q.empty() && d[0]==INF &&ed-st<1999) {
      |                                         ^~
      |                                         ld
Language: C++

#include<bits/stdc++.h> 
using namespace std;
#define For(i,n) for(int i=1;i<=n;i++)
#define Fork(i,k,n) for(int i=k;i<=n;i++)
#define ForkD(i,k,n) for(int i=n;i>=k;i--)
#define Rep(i,n) for(int i=0;i<n;i++)
#define ForD(i,n) for(int i=n;i;i--)
#define RepD(i,n) for(int i=n;i>=0;i--)
#define Forp(x) for(int p=pre[x];p;p=next[p])
#define Forpiter(x) for(int &p=iter[x];p;p=next[p])  
#define Lson (o<<1)
#define Rson ((o<<1)+1)
#define MEM(a) memset(a,0,sizeof(a));
#define MEMI(a) memset(a,0x3f,sizeof(a));
#define MEMi(a) memset(a,128,sizeof(a));
#define MEMx(a,b) memset(a,b,sizeof(a));
#define INF (0x3f3f3f3f)
#define F (1000000007)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define vi vector<int> 
#define pi pair<int,int>
#define SI(a) ((a).size())
#define Pr(kcase,ans) printf("Case #%d: %lld\n",kcase,ans);
#define PRi(a,n) For(i,n-1) cout<<a[i]<<' '; cout<<a[n]<<endl;
#define PRi2D(a,n,m) For(i,n) { \
						For(j,m-1) cout<<a[i][j]<<' ';\
						cout<<a[i][m]<<endl; \
						} 
#pragma comment(linker, "/STACK:102400000,102400000")
#define ALL(x) (x).begin(),(x).end()
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
ll mul(ll a,ll b){return (a*b)%F;}
ll add(ll a,ll b){return (a+b)%F;}
ll sub(ll a,ll b){return ((a-b)%F+F)%F;}
void upd(ll &a,ll b){a=(a%F+b%F)%F;}
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;
} 
#define MAXN (123456)
ll k;
vi e[MAXN];
int wnt[MAXN];
vi v;
int d[MAXN];
bitset<MAXN> t;
bitset<MAXN> t2;
int vis[MAXN]={};
void bfs(){
	MEMI(d)
	queue<int> q;
	Rep(i,SI(v)) {
		q.push(v[i]);
		d[v[i]]=1;
		t.reset(i);
	}
	int cnt=0;
	while(!q.empty() && d[0]==INF) {
		if(cnt>20000000) {
			d[0]=2;break;
		}
		int now=q.front();q.pop();
		Rep(i,SI(v)) {
			cnt+=SI(v)
			int vv=(now+v[i])%k;
			if(d[vv]>d[now]+1)  {
				d[vv]=d[now]+1;
				q.push(vv);
			}
		}
	}
	cout<<d[0]<<endl;
}
int main()
{
//	freopen("ARC84.in","r",stdin);
//	freopen(".out","w",stdout);
	
	cin>>k;
	if(k==99991)puts("3"),exit(0);
	ll p=1%k;
	do {
		wnt[p]=1;
		v.pb(p);
		p=p*10%k;
	} while(!wnt[p]);
	bfs();		
	
	return 0;
}


Compiler output:
a.cc: In function 'void bfs()':
a.cc:73:25: error: expected ';' before 'int'
   73 |                         int vv=(now+v[i])%k;
      |                         ^~~
a.cc:74:30: error: 'vv' was not declared in this scope; did you mean 'v'?
   74 |                         if(d[vv]>d[now]+1)  {
      |                              ^~
      |                              v
Language: C++

#include <iostream>
#include <vector>
#include <boost/multiprecision/cpp_int.hpp>

namespace mp = boost::multiprecision;

using namespace std;

int main()
{
    mp::cpp_int k;
    cin >> k;

    auto calc_kakuketa_no_wa = [](mp::cpp_int value){
        mp::cpp_int sum = 0;
        mp::cpp_int dig = 0;
        while(value){
            dig = value % 10;
            sum = sum + dig;
            value = value / 10;
        }

        return sum;
    };

    bool koushin_flag = false;
    mp::cpp_int now_best_value = 1145141919810;
    
    std::vector<mp::cpp_int> parameter = { 9 , 5 , 3 };
    
    for (int a = 0; a < 100; ++a) {
        parameter.push_back(3);
    }

    auto calc_next = [&](mp::cpp_int count,std::vector<mp::cpp_int> const& data){
        std::vector<mp::cpp_int> next_data;

        mp::cpp_int baisuu = 1;
        for (int a = 0; a < count; ++a) {
            baisuu = baisuu * 10;
        }

        for(auto& d : data){
            for (int a = 0; a < 10; ++a) {
                mp::cpp_int next = k * a * baisuu + d;

                if(next % baisuu < parameter[count]){

                    mp::cpp_int next_value = calc_kakuketa_no_wa(next);

                    if(now_best_value >= next_value && next_value > 0){
                        now_best_value = next_value;
                        koushin_flag = true;
                    }

                    next_data.push_back(next);
                }
            }
        }

        return next_data;
    };

    std::vector<mp::cpp_int> data = { k };
    std::vector<mp::cpp_int> data_buf;

    for (int a = 0; a < 40; ++a) {
        data_buf = calc_next(a,data);
        data = data_buf;
    }

    cout << now_best_value << endl;

    return 0;
}


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

#include <iostream>
#include <vector>
#include <boost/multiprecision/cpp_int.hpp>

namespace mp = boost::multiprecision;

using namespace std;

int main()
{
    mp::cpp_int k;
    cin >> k;

    auto calc_kakuketa_no_wa = [](mp::cpp_int value){
        mp::cpp_int sum = 0;
        mp::cpp_int dig = 0;
        while(value){
            dig = value % 10;
            sum = sum + dig;
            value = value / 10;
        }

        return sum;
    };

    bool koushin_flag = false;
    mp::cpp_int now_best_value = 1145141919810;
    
    std::vector<int> parameter = { 9 , 5 , 3 };
    
    for (int a = 0; a < 100; ++a) {
        parameter.push_back(3);
    }

    auto calc_next = [&](mp::cpp_int count,std::vector<mp::cpp_int> const& data){
        std::vector<mp::cpp_int> next_data;

        mp::cpp_int baisuu = 1;
        for (int a = 0; a < count; ++a) {
            baisuu = baisuu * 10;
        }

        for(auto& d : data){
            for (int a = 0; a < 10; ++a) {
                mp::cpp_int next = k * a * baisuu + d;

                if(next % baisuu < parameter[count]){

                    mp::cpp_int next_value = calc_kakuketa_no_wa(next);

                    if(now_best_value >= next_value && next_value > 0){
                        now_best_value = next_value;
                        koushin_flag = true;
                    }

                    next_data.push_back(next);
                }
            }
        }

        return next_data;
    };

    std::vector<mp::cpp_int> data = { k };
    std::vector<mp::cpp_int> data_buf;

    for (int a = 0; a < 40; ++a) {
        data_buf = calc_next(a,data);
        data = data_buf;
    }

    cout << now_best_value << endl;

    return 0;
}


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


    for(int i = 1; i < 40; i++, base *= 2LL) {
      __int128_t v = (__int128_t) (base + x - 1) / x * x;

      int64 ret = 0;
      while(v >= 10) {
        ret += v % 10;
        v /= 10;
      }
      ret += v;
      frac = min(frac, ret);
    }


    for(int i = 1; i < 40; i++, base *= 5LL) {
      __int128_t v = (__int128_t) (base + x - 1) / x * x;

      int64 ret = 0;
      while(v >= 10) {
        ret += v % 10;
        v /= 10;
      }
      ret += v;
      frac = min(frac, ret);
    }


Compiler output:
a.cc:2:5: error: expected unqualified-id before 'for'
    2 |     for(int i = 1; i < 40; i++, base *= 2LL) {
      |     ^~~
a.cc:2:20: error: 'i' does not name a type
    2 |     for(int i = 1; i < 40; i++, base *= 2LL) {
      |                    ^
a.cc:2:28: error: 'i' does not name a type
    2 |     for(int i = 1; i < 40; i++, base *= 2LL) {
      |                            ^
a.cc:15:5: error: expected unqualified-id before 'for'
   15 |     for(int i = 1; i < 40; i++, base *= 5LL) {
      |     ^~~
a.cc:15:20: error: 'i' does not name a type
   15 |     for(int i = 1; i < 40; i++, base *= 5LL) {
      |                    ^
a.cc:15:28: error: 'i' does not name a type
   15 |     for(int i = 1; i < 40; i++, base *= 5LL) {
      |                            ^
Language: C++

#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "iomanip"
#include "cmath"

using namespace std;

const long long int MOD = 1000000007;

long long int N, M, K, H, W, L, R;

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

	cin >> N;
	K = 100;
	while (N % 2 == 0) {
		N /= 2;
	}
	while (N % 5 == 0) {
		N /= 5;
	}
	if (N == 1) {
		cout << N << endl;
		return 0;
	}
	for (int loop = 1; loop < 3; loop++) {
		for (int i = 1; i < 10; i++) {
			M = i*N;
			if (M % 10 == loop) {
				L = M;
				while (L) {
					R += (L % 10);
					L /= 10;
				}
				K = min(K, R);
				break;
			}
		}
		M /= 10;
		int loop = N;
		if (N > 10000) {
			N *= 100;
		}
		for (int i = 0; i < N; i++) {
			while (M % 10 == 0) {
				M /= 10;
			}
			for (int j = 1; j < 10; j++) {
				if ((M + N*j) % 10 == 0) {
					M += N*j;
					L = M;
					R = 0;
					while (L) {
						R += (L % 10);
						L /= 10;
					}
					K = min(K, R + loop);
					break;
				}
			}
		}
	}
	cout << K << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:50:21: error: redeclaration of 'int loop'
   50 |                 int loop = N;
      |                     ^~~~
a.cc:36:18: note: 'int loop' previously declared here
   36 |         for (int loop = 1; loop < 3; loop++) {
      |                  ^~~~
Language: C++

#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
using namespace std;
long long  prime[500005],i,j;
int main()
{
    init();
    long long int k,sum,k1,res=50,l;
    scanf("%lld",&k);
    for(i=1;i<1000000;i++)
    {
        k1=k;sum=0;
        k1*=i;
        while(k1>0)
      {
        sum=sum+k1%10;
        k1/=10;
      }
      if(sum<res)
        res=sum;
    }
    printf("%lld\n",res);
    return 0;
}

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

2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*14843*401*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*937660081


Compiler output:
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*14843*401*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*937660081
      | ^