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

/*
オーダー
10**6	余裕を持って間に合う	
10**7	おそらく間に合う	余裕を持って間に合う
10**8	非常にシンプルな処理でない限り厳しい	おそらく間に合う
10**9		非常にシンプルな処理でない限り厳しい
logn	:OK
n		:10^7
nlogn	:10^6
n**2	:10^4
n**3	:300
2**n	:20
n!		:10



// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

sort(a, a + N, greater<int>());  // a[0:N] を大きい順にソート

int num[110] = {0};  // バケット
for (int i = 0; i < N; ++i) {
    num[d[i]]++;  // d[i] が 1 個増える
}

map<string, int> mp; // 連想配列 map<キー型, 値型> オブジェクト名
for (int i = 0; i < N; ++i) {
    auto itr = mp.find(s[i]);        // s[i] が設定されているか？
    if(itr != mp.end() ) {
         mp[s[i]] += 1;
    }
    else {
         mp[s[i]] += 1 ;
    }
}
stack<int> s;	//intをデータとするスタックを用意
s.push(1);		//{} -> {1}
printf("%d\n", s.top());	// 3
s.pop();

queue<int> que;	//intをデータとするキューを用意
que.push(1);		//{} -> {1}
printf("%d\n", que.front());	// 1
que.pop();
*/
#include <iostream>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>

using namespace std;

// #define for(i,a,b) for (int i=(a);i<(b);++i)
typedef long long ll;
typedef pair<ll,ll> P;
#define REP(i,n) for(long long i = 0; i < (long long)(n); i++)
#define pb push_back // vectorに要素追加
#define INF (ll)1e18
// int 
// 各桁の和を計算する関数
ll findSumOfDigits(ll n) {
	ll sum = 0;
	ll keta = 0;
	while (n > 0) { // n が 0 になるまで
		sum += n % 10;
		if (keta%10==0)
		n /= 10;
	}
	return sum;
}
 
 

int main() {
	// 入力
	ll K;
	cin >> K;
	
	// 解法
	ll ans = 100;
	ll k = 0;
	for (ll i = 1; i < 10; ++i){
		if (findSumOfDigits(K*i)<ans){
			ans = findSumOfDigits(K*i);
			k = i;
		}
	}
	
	出力
	printf("%lld\n", ans);
	// printf("%lld\n", k);
	// printf("%lld\n", k*K);
	
}


Compiler output:
a.cc: In function 'int main()':
a.cc:103:9: error: '\U000051fa\U0000529b' was not declared in this scope
  103 |         出力
      |         ^~~~
Language: C++

#include <chrono>
inline unsigned long long f(unsigned long long i) {
	unsigned long long ret = 0;
	while (i>0){
		ret += i % 10;
		i /= 10;
	}
	return ret;
}
int main(void) {
	unsigned long long n, i=1, res=1000;
	scanf_s("%llu", &n);
	chrono::system_clock::time_point start=chrono::system_clock::now();
	while (chrono::duration_cast<chrono::milliseconds>(chrono::system_clock::now() - start).count() < 1950) {
		res = min(res, f(n*i));
		i++;
	}
	printf("%llu", res);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: 'scanf_s' was not declared in this scope
   12 |         scanf_s("%llu", &n);
      |         ^~~~~~~
a.cc:13:9: error: 'chrono' has not been declared
   13 |         chrono::system_clock::time_point start=chrono::system_clock::now();
      |         ^~~~~~
a.cc:14:16: error: 'chrono' has not been declared
   14 |         while (chrono::duration_cast<chrono::milliseconds>(chrono::system_clock::now() - start).count() < 1950) {
      |                ^~~~~~
a.cc:14:38: error: 'chrono' has not been declared
   14 |         while (chrono::duration_cast<chrono::milliseconds>(chrono::system_clock::now() - start).count() < 1950) {
      |                                      ^~~~~~
a.cc:14:60: error: 'chrono' has not been declared
   14 |         while (chrono::duration_cast<chrono::milliseconds>(chrono::system_clock::now() - start).count() < 1950) {
      |                                                            ^~~~~~
a.cc:14:90: error: 'start' was not declared in this scope
   14 |         while (chrono::duration_cast<chrono::milliseconds>(chrono::system_clock::now() - start).count() < 1950) {
      |                                                                                          ^~~~~
a.cc:15:23: error: 'min' was not declared in this scope; did you mean 'main'?
   15 |                 res = min(res, f(n*i));
      |                       ^~~
      |                       main
a.cc:18:9: error: 'printf' was not declared in this scope
   18 |         printf("%llu", res);
      |         ^~~~~~
a.cc:2:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
    1 | #include <chrono>
  +++ |+#include <cstdio>
    2 | inline unsigned long long f(unsigned long long i) {
Language: C++

// ConsoleApplication1.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h" 
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<cctype>
#include<queue>
#include<vector>
inline int read() {
	int x = 0, f = 1; char c = getchar();
	for (; !isdigit(c); c = getchar()) f ^= c == '-';
	for (; isdigit(c); c = getchar())  x = x * 10 + c - '0';
	return f ? x : -x;
}
using namespace std;
const int yuzu = 1e5;
int d[yuzu | 10],k;

void bfs(int u, int dep) {
	memset(d, 0x3f, sizeof d);
	queue<int> q;
	q.push(1), d[1] = 1;
	for (; !q.empty();) {
		int u = q.front();q.pop();
		int net = u * 10 % k;
		if (d[net] > d[u]) {
			q.push(net);
			d[net] = d[u];
		}
		net = (u + 1) % k;
		if (d[net] > d[u] + 1) {
			q.push(net);
			d[net] = d[u] + 1;
		}
	}
}

int main() {
	k = read();
	bfs(1, 1);
	cout << d[0]<<endl;
}

Compiler output:
a.cc:4:10: fatal error: stdafx.h: No such file or directory
    4 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
#include<queue>
#include<bitset>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define fill(x,y) memset(x,y,sizeof(x))
#define all(x) (x).begin(),(x).end()
#define size(x) ((int)(x).size())
#define dbg(x) cout<<#x"="<<x<<endl
#define dump(a) rep(i,n){ cout<<a[i]<<" "; } cout<<endl;
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define INF INT_MAX/3
#define EPS 1e-7


int digitsum(ll n) {
  ll t = n;
  ll s = 0;
  while(t>0){
    s += t % 10;
    t = t / 10;
  }
  return s;
}

int main(){
  ll n;
  cin>>n;
  ll m = INF;
  repl(i,1,10){
    m=mmin(m,digitsum(n*i));
  }
  cout<<m<<endl;
  return 0;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:17:13: error: 'INT_MAX' was not declared in this scope
   17 | #define INF INT_MAX/3
      |             ^~~~~~~
a.cc:34:10: note: in expansion of macro 'INF'
   34 |   ll m = INF;
      |          ^~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include<algorithm>
  +++ |+#include <climits>
    5 | using namespace std;
Language: C++

#include <bits/stdc++.h> 

using namespace std;

#define fcout(d) cout << fixed << setprecision(d)
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rep1(i,n) for(int i = 1; i <= (n); ++i)
#define repU(i,s,t) for(int i = (s); i <= (t); ++i)
#define repD(i,t,s) for(int i = (t); i >= (s); --i)
#define all(v)  begin(v),end(v)
#define clr(v) fill(all(v),0)
#define l_bnd lower_bound
#define u_bnd upper_bound
#define puf push_front
#define pub push_back
#define pof pop_front
#define pob pop_back
#define mkp make_pair
#define mkt make_tuple
#define fir first
#define sec second
#define q_ceil(n,d) ((n - 1)/(d) + 1)
#define parity(a,b) (((a)^(b)) & 1 ^ 1)

typedef long long ll;
typedef unsigned long long ull;
typedef double db;

const pair<int,int> DIR[] = { {1,0},{0,1},{-1,0},{0,-1},{1,1},{-1,1},{-1,-1},{1,-1} };
const int INF_32 = -1 + (1 << 30);
const ll INF_64 = -1 + (1LL << 62);
const int MOD = 1e9 + 7;


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int k; cin>>k;
	deque<int> deq;
	int dist[100000];
	fill(all(dist),INF_32);
	deq.puf(1),dist[1] = 1;
	while(!deque.empty()){
		int t = deq.front();
		deq.pof();
		if(dist[t * 10 % k] > dist[t]) dist[t * 10 % k] = dist[t],deq.puf(t * 10 % k);
		if(dist[(t + 1) % k] > 1 + dist[t]) dist[(t + 1) % k] = dist[t] + 1,deq.pub((t + 1) % k);
	}
	cout<<dist[0]<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:44:21: error: missing template arguments before '.' token
   44 |         while(!deque.empty()){
      |                     ^
Language: C++

# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
# include <unordered_map>
# include <numeric>
# include <complex>
# include <bitset>
# include <random>
# include <chrono>
# include <cstdlib>
# include <tuple>
# include <array>
#define ll long long int
#define rep(i,rept) for (ll i = 0; i < rept; i++)
using namespace std;
int ketawa(ll num) {
	int dig, sum = 0;
	while (num) {
		dig = num % 10;
		sum = sum + dig;
		num = num / 10;
	}
	return sum;
}
ll solve(int n, int k)
{
	int memo[110000];
	fill(memo, memo + k, INT_MAX);
	deque<ll> q;
	q.emplace_front(n);
	memo[n] = 0;

	while (!q.empty()) {
		ll cur = q.front(); q.pop_front();
		if (cur%k == 0) {
			return memo[cur] + 1;
		}
		//
		ll next = cur * 10;
		if (memo[next%k] > memo[cur]) {
			q.push_front(next%k);
			memo[next%k] = memo[cur];
		}

		//
		next = cur + 1;

		if (memo[next%k] > memo[cur]+1) {
			q.push_back(next%k);
			memo[next%k] = memo[cur] + 1;
		}
	}
	return -1;
}

int main()
{
	int n;
	cin >> n;
	cout << solve(1, n);
	return 0;
}


Compiler output:
a.cc: In function 'long long int solve(int, int)':
a.cc:39:30: error: 'INT_MAX' was not declared in this scope
   39 |         fill(memo, memo + k, INT_MAX);
      |                              ^~~~~~~
a.cc:22:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   21 | # include <cstdlib>
  +++ |+#include <climits>
   22 | # include <tuple>
Language: C++

#include <bits/stdc++.h>
using namespace std;
int sum[66666];
int kk=2,a=10,b=1;
int minx=0,minxx=0;

int main()
{
	for(int i=1;i<=10000;i++)  sum[i]=i;
	long long k;
	cin>>k;
	long long k2=k,ni,n,m;
	while(ni!=0)
	{
		ni/=10;
		int t=k%a/b;
		a*=10;b*=10;
		minx+=t;
	}
	if(minx==1)
	{
	cout<<minx<<endl;
	return 0;
	}
	a=10;b=1;
	n=k;
		while(kk!=1000)
	{
		n/=10;
		m=k2%a/b;
		a*=10;b*=10;
		minxx+=m;
		if(minxx>minx) {n=k*sum[kk++];a=10;b=1;k2=n;minxx=0;continue;}
		if(m>minx) {n=k*sum[kk++];a=10;b=1;k2=n;minxx=0;continue;}
		if(minx==1) break;
		if(n==0&&minxx<minx) {minx=minxx;n=k*sum[kk++];a=10;b=1;k2=n;minxx=0;continue;}
		if(n==0) {n=k*sum[kk++];a=10;b=1;k2=n;minxx=0;continue;}
		
	}
	
	

	
	cout<<minx<<endl;
	
	return 0;
}

李乐天 2018/5/29 14:40:59


Compiler output:
a.cc:49:1: error: '\U0000674e\U00004e50\U00005929' does not name a type
   49 | 李乐天 2018/5/29 14:40:59
      | ^~~~~~
Language: C

#include <bits/stdc++.h>
using namespace std;
int sum[66666];
int kk=2,a=10,b=1;
int minx=0,minxx=0;

int main()
{
	for(int i=1;i<=10000;i++)  sum[i]=i;
	long long k;
	cin>>k;
	long long k2=k,ni,n,m;
	while(ni!=0)
	{
		ni/=10;
		int t=k%a/b;
		a*=10;b*=10;
		minx+=t;
	}
	if(minx==1)
	{
	cout<<minx<<endl;
	return 0;
	}
	a=10;b=1;
	n=k;
		while(kk!=1000)
	{
		n/=10;
		m=k2%a/b;
		a*=10;b*=10;
		minxx+=m;
		if(minxx>minx) {n=k*sum[kk++];a=10;b=1;k2=n;minxx=0;continue;}
		if(m>minx) {n=k*sum[kk++];a=10;b=1;k2=n;minxx=0;continue;}
		if(minx==1) break;
		if(n==0&&minxx<minx) {minx=minxx;n=k*sum[kk++];a=10;b=1;k2=n;minxx=0;continue;}
		if(n==0) {n=k*sum[kk++];a=10;b=1;k2=n;minxx=0;continue;}
		
	}
	
	

	
	cout<<minx<<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 <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<map>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define P pair<int,int>
#define ll long long



ll n;
ll MA=(LONG_MAX-2)/2;

int main(){

cin>>n;
ll nn=n,ans=MA;

for(int i=0;i<100000;i++){
	ll tmp=nn,cnt=0;
	while(tmp>0)cnt+=tmp%10,tmp/=10;
	ans=min(ans,cnt);
	nn+=n;
	if(nn>=MA)break;
}
cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc:21:8: error: 'LONG_MAX' was not declared in this scope
   21 | ll MA=(LONG_MAX-2)/2;
      |        ^~~~~~~~
a.cc:11:1: note: 'LONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   10 | #include<cstdio>
  +++ |+#include <climits>
   11 | using namespace std;
Language: C++

#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<map>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define P pair<int,int>
#define ll __int64



ll n;
ll MA=(LONG_MAX-2)/2;

int main(){

cin>>n;
ll nn=n,ans=MA;

for(int i=0;i<100000;i++){
	ll tmp=nn,cnt=0;
	while(tmp>0)cnt+=tmp%10,tmp/=10;
	ans=min(ans,cnt);
	nn+=n;
	if(nn>=MA)break;
}
cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc:16:12: error: '__int64' does not name a type; did you mean '__int64_t'?
   16 | #define ll __int64
      |            ^~~~~~~
a.cc:20:1: note: in expansion of macro 'll'
   20 | ll n;
      | ^~
a.cc:16:12: error: '__int64' does not name a type; did you mean '__int64_t'?
   16 | #define ll __int64
      |            ^~~~~~~
a.cc:21:1: note: in expansion of macro 'll'
   21 | ll MA=(LONG_MAX-2)/2;
      | ^~
a.cc: In function 'int main()':
a.cc:25:6: error: 'n' was not declared in this scope
   25 | cin>>n;
      |      ^
a.cc:16:12: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
   16 | #define ll __int64
      |            ^~~~~~~
a.cc:26:1: note: in expansion of macro 'll'
   26 | ll nn=n,ans=MA;
      | ^~
a.cc:29:12: error: expected ';' before 'tmp'
   29 |         ll tmp=nn,cnt=0;
      |            ^~~
a.cc:30:15: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   30 |         while(tmp>0)cnt+=tmp%10,tmp/=10;
      |               ^~~
      |               tm
a.cc:30:21: error: 'cnt' was not declared in this scope; did you mean 'int'?
   30 |         while(tmp>0)cnt+=tmp%10,tmp/=10;
      |                     ^~~
      |                     int
a.cc:31:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   31 |         ans=min(ans,cnt);
      |         ^~~
      |         abs
a.cc:31:21: error: 'cnt' was not declared in this scope; did you mean 'int'?
   31 |         ans=min(ans,cnt);
      |                     ^~~
      |                     int
a.cc:32:9: error: 'nn' was not declared in this scope
   32 |         nn+=n;
      |         ^~
a.cc:33:16: error: 'MA' was not declared in this scope
   33 |         if(nn>=MA)break;
      |                ^~
a.cc:35:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
   35 | cout<<ans<<endl;
      |       ^~~
      |       abs
Language: C++

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef vector<ll> Vector;
typedef vector<Vector> DVector;

#define fi          first
#define se          second
#define pb          push_back
#define INF         INT_MAX
#define bcnt        __builtin_popcount
#define all(x)      (x).begin(),(x).end()
#define dbg(x)      cout<<#x"="<<x<<endl
#define uni(x)      x.erase(unique(all(x)),x.end())
#define ub(x,y)     upper_bound(all(x),y)-x.begin()
#define lb(x,y)     lower_bound(all(x),y)-x.begin()
#define rep(i,n)    repl(i,0,n-1)
#define usort(x)    sort(all(x))
#define dsort(x)    sort(all(x),greater<ll>())
#define mkp(x,y)    make_pair(x,y)
#define mmax(x,y)   (x>y?x:y)
#define mmin(x,y)   (x<y?x:y)
#define maxch(x,y)  x=mmax(x,y)
#define minch(x,y)  x=mmin(x,y)
#define exist(x,y)  (find(all(x),y)!=x.end())
#define each(itr,v) for(auto itr:v)
#define repl(i,a,b) for(ll i=(ll)(a);i<=(ll)(b);i++)

int main(){
  cin.sync_with_stdio(false);
  ll k;
  cin >> k;
  set<P> st;
  deque<P> deq;
  deq.push_front(mkp(1,1));
  st.insert(mkp(1,1));
  ll ans;
  while(deq.size()){
    P now = deq.front();deq.pop();
    if(st.count(now))continue;
    st.insert(now);
    if(now.fi == 0){
      ans = deq.se;
      break;
    }
    deq.push_front(mkp((now.fi*10)%k, cnt));
    deq.push_back(vertex((now,fi+1)%k, cnt+1));
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:29: error: 'class std::deque<std::pair<long long int, long long int> >' has no member named 'pop'
   42 |     P now = deq.front();deq.pop();
      |                             ^~~
a.cc:11:21: error: 'class std::deque<std::pair<long long int, long long int> >' has no member named 'second'
   11 | #define se          second
      |                     ^~~~~~
a.cc:46:17: note: in expansion of macro 'se'
   46 |       ans = deq.se;
      |                 ^~
a.cc:49:39: error: 'cnt' was not declared in this scope; did you mean 'int'?
   49 |     deq.push_front(mkp((now.fi*10)%k, cnt));
      |                                       ^~~
a.cc:23:33: note: in definition of macro 'mkp'
   23 | #define mkp(x,y)    make_pair(x,y)
      |                                 ^
a.cc:10:21: error: 'first' was not declared in this scope
   10 | #define fi          first
      |                     ^~~~~
a.cc:50:31: note: in expansion of macro 'fi'
   50 |     deq.push_back(vertex((now,fi+1)%k, cnt+1));
      |                               ^~
a.cc:50:19: error: 'vertex' was not declared in this scope
   50 |     deq.push_back(vertex((now,fi+1)%k, cnt+1));
      |                   ^~~~~~
Language: C++

#include<iostream>
#include<queue>
#include<set>
#include<string>
#include<map>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<(b);i++)
#define FOR(i,a) for(int i=0i<(a);i++) 
typedef long long ll;
typedef vector<int>vi;
typedef pair<int,int>pii;
const int MOD=(1<<29);
int k,dist[100050];
deque<int>dq;
int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin>>k;
	FOR(i,k)dist[i]=MOD;
	dist[1]=1;dq.push_back(1);
	while(dq.size())
	{
		int x=dq.front();dq.pop_front();
		if(dist[(10*x)%k]>dist[x])
		{
			dist[(10*x)%k]=dist[x];
			dq.push_front((10*x)%k);
		}
		if(dist[(x+1)%k]>dist[x]+1)
		{
			dist[(x+1)%k]=dist[x]+1;
			dq.push_back((x+1)&k);
		}
	}
	cout<<dist[0];
}

Compiler output:
a.cc:11:9: warning: "FOR" redefined
   11 | #define FOR(i,a) for(int i=0i<(a);i++)
      |         ^~~
a.cc:10:9: note: this is the location of the previous definition
   10 | #define FOR(i,a,b) for(int i=a;i<(b);i++)
      |         ^~~
a.cc: In function 'int main()':
a.cc:11:30: error: invalid operands of types '__complex__ int' and 'int' to binary 'operator<'
   11 | #define FOR(i,a) for(int i=0i<(a);i++)
a.cc:22:9: note: in expansion of macro 'FOR'
   22 |         FOR(i,k)dist[i]=MOD;
      |         ^~~
a.cc:11:38: error: expected ';' before ')' token
   11 | #define FOR(i,a) for(int i=0i<(a);i++)
      |                                      ^
a.cc:22:9: note: in expansion of macro 'FOR'
   22 |         FOR(i,k)dist[i]=MOD;
      |         ^~~
Language: C++

#include <algorithm>
#include <cstdint>
#include <cstdio>
#define REP3(i, m, n) for (int i = (m); (i) < int(n); ++ (i))
using ll = long long;
using namespace std;
template <class T> inline void chmin(T & a, T const & b) { a = min(a, b); }

int f(ll n) {
    int cnt = 0;
    while (n) {
        cnt += n % 10;
        n /= 10;
    }
    return cnt;
}
int main() {
    int k; scanf("%d", &k);
    int result = INT_MAX;
    REP3 (i, 1, 50000000) {
        chmin(result, f(k *(ll) i));
    }
    printf("%d\n", result);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:18: error: 'INT_MAX' was not declared in this scope
   19 |     int result = INT_MAX;
      |                  ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include <cstdio>
  +++ |+#include <climits>
    4 | #define REP3(i, m, n) for (int i = (m); (i) < int(n); ++ (i))
Language: C++

#include <algorithm>
#include <cstdio>
#define REP3(i, m, n) for (int i = (m); (i) < int(n); ++ (i))
using ll = long long;
using namespace std;
template <class T> inline void chmin(T & a, T const & b) { a = min(a, b); }

int f(ll n) {
    int cnt = 0;
    while (n) {
        cnt += n % 10;
        n /= 10;
    }
    return cnt;
}
int main() {
    int k; scanf("%d", &k);
    int result = INT_MAX;
    REP3 (i, 1, 50000000) {
        chmin(result, f(k *(ll) i));
    }
    printf("%d\n", result);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:18: error: 'INT_MAX' was not declared in this scope
   18 |     int result = INT_MAX;
      |                  ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <cstdio>
  +++ |+#include <climits>
    3 | #define REP3(i, m, n) for (int i = (m); (i) < int(n); ++ (i))
Language: C++

#include <cstdio>
#define REP3(i, m, n) for (int i = (m); (i) < int(n); ++ (i))
using ll = long long;
using namespace std;
template <class T> inline void chmin(T & a, T const & b) { a = min(a, b); }

int f(ll n) {
    int cnt = 0;
    while (n) {
        cnt += n % 10;
        n /= 10;
    }
    return cnt;
}
int main() {
    int k; scanf("%d", &k);
    int result = INT_MAX;
    REP3 (i, 1, 50000000) {
        chmin(result, f(k *(ll) i));
    }
    printf("%d\n", result);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:18: error: 'INT_MAX' was not declared in this scope
   17 |     int result = INT_MAX;
      |                  ^~~~~~~
a.cc:2:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    1 | #include <cstdio>
  +++ |+#include <climits>
    2 | #define REP3(i, m, n) for (int i = (m); (i) < int(n); ++ (i))
a.cc: In instantiation of 'void chmin(T&, const T&) [with T = int]':
a.cc:19:14:   required from here
   19 |         chmin(result, f(k *(ll) i));
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~
a.cc:5:67: error: 'min' was not declared in this scope; did you mean 'main'?
    5 | template <class T> inline void chmin(T & a, T const & b) { a = min(a, b); }
      |                                                                ~~~^~~~~~
      |                                                                main
Language: C++

# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr long long MOD = 1000000000 + 7;
constexpr long long INF = 1e17 - 10;
const double PI = acos(-1);
typedef pair<LL, LL> Pll;
typedef pair<LL, LL> Vec2;
LL h, w, n, m, s, ans = 0, num = 1, sum = 0;
bool f[10000000000];
string str;
struct Edge { int to, cost; };
vector<Edge>edge[10000];
LL bfs(LL s) {
	f[s] = 1;
	queue<LL> pq;
	pq.push(s); // (頂点番号) 
	while (!pq.empty()) {
		LL vv = pq.front();
		pq.pop();
		if (f[vv + 1] == 0) {
			f[vv + 1] = 1;
			if ((vv + 1) % n == 0)
				return vv + 1;
			pq.push(vv + 1);
		}
	}
}
int main() {
	cin >> n; 
	while (n % 2 == 0)
		n /= 2;
	while (n % 5 == 0)
		n /= 5;
	m = bfs(0);
	while (m > 0) {
		ans += m % 10;
		m /= 10;
	}
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc: In function 'LL bfs(LL)':
a.cc:52:1: warning: control reaches end of non-void function [-Wreturn-type]
   52 | }
      | ^
/tmp/ccSydbJD.o: in function `__tcf_0':
a.cc:(.text+0x2c5): relocation truncated to fit: R_X86_64_PC32 against symbol `edge' defined in .bss section in /tmp/ccSydbJD.o
a.cc:(.text+0x2cc): relocation truncated to fit: R_X86_64_PC32 against symbol `edge' defined in .bss section in /tmp/ccSydbJD.o
/tmp/ccSydbJD.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0x2f3): relocation truncated to fit: R_X86_64_PC32 against symbol `str[abi:cxx11]' defined in .bss section in /tmp/ccSydbJD.o
a.cc:(.text+0x30c): relocation truncated to fit: R_X86_64_PC32 against symbol `str[abi:cxx11]' defined in .bss section in /tmp/ccSydbJD.o
a.cc:(.text+0x325): relocation truncated to fit: R_X86_64_PC32 against symbol `edge' defined in .bss section in /tmp/ccSydbJD.o
collect2: error: ld returned 1 exit status
Language: C++

# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr long long MOD = 1000000000 + 7;
constexpr long long INF = 1e17 - 10;
const double PI = acos(-1);
typedef pair<LL, LL> Pll;
typedef pair<LL, LL> Vec2;
LL h, w, n, m, s, ans = 0, num = 1, sum = 0;
bool f[10000000000000];
string str;
struct Edge { int to, cost; };
vector<Edge>edge[10000];
LL bfs(LL s) {
	f[s] = 1;
	queue<LL> pq;
	pq.push(s); // (頂点番号) 
	while (!pq.empty()) {
		LL vv = pq.front();
		pq.pop();
		if (f[vv + 1] == 0) {
			f[vv + 1] = 1;
			if ((vv + 1) % n == 0)
				return vv + 1;
			pq.push(vv + 1);
		}
	}
}
int main() {
	cin >> n; 
	while (n % 2 == 0)
		n /= 2;
	while (n % 5 == 0)
		n /= 5;
	m = bfs(0);
	while (m > 0) {
		ans += m % 10;
		m /= 10;
	}
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc: In function 'LL bfs(LL)':
a.cc:52:1: warning: control reaches end of non-void function [-Wreturn-type]
   52 | }
      | ^
/tmp/ccMN4ulh.o: in function `__tcf_0':
a.cc:(.text+0x2c5): relocation truncated to fit: R_X86_64_PC32 against symbol `edge' defined in .bss section in /tmp/ccMN4ulh.o
a.cc:(.text+0x2cc): relocation truncated to fit: R_X86_64_PC32 against symbol `edge' defined in .bss section in /tmp/ccMN4ulh.o
/tmp/ccMN4ulh.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0x2f3): relocation truncated to fit: R_X86_64_PC32 against symbol `str[abi:cxx11]' defined in .bss section in /tmp/ccMN4ulh.o
a.cc:(.text+0x30c): relocation truncated to fit: R_X86_64_PC32 against symbol `str[abi:cxx11]' defined in .bss section in /tmp/ccMN4ulh.o
a.cc:(.text+0x325): relocation truncated to fit: R_X86_64_PC32 against symbol `edge' defined in .bss section in /tmp/ccMN4ulh.o
collect2: error: ld returned 1 exit status
Language: C++

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

const int MAX_N = (int)(1e5 + 5);
using pp = pair<int, int>;
bool vis[MAX_N];

int k;
deque<pp> dq;

int solve() {
  fill(vis, vis + MAX_N, false);

  dq.push_front(pp(1, 1));
  vis[1] = true;

  while (!dq.empty()) {
    pp p = dq.front(); dq.pop_front();
    int cur = p.first; int cnt = p.second;

    if (cur == 0) return cnt;

    int next = (cur + 1) % k;
    if (!vis[next]) {
      vis[next] = true;
      dq.push_back(pp(next, cnt + 1));
    }

    next = (cur * 10) % k;
    if (!vis[next]) {
      vis[next] = true;
      dq.push_front(pp(next, cnt));
    }
  }
}


Compiler output:
a.cc: In function 'int solve()':
a.cc:35:1: warning: control reaches end of non-void function [-Wreturn-type]
   35 | }
      | ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

int K;
int mi[101010];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>K;
	FOR(i,K) mi[i]=1<<30;
	priority_queue<pair<int,int>> P;
	for(i=1;i<=9;i++) {
		mi[i%K]=min(mi[i%K],i);
		P.push({-mi[i%K],i%K});
	}
	
	while(P.size()) {
		int cur=P.top().second;
		int cost=-P.top().first;
		P.pop();
		if(cost!=mi[cur]) continue;
		FOR(i,10) {
			int nc=cost+i;
			int nex=(cur*10+i)%K;
			if(mi[nex]>nc) {
				mi[nex]=nc;
				P.push({-mi[nex],nex});
			}
		}
	}
	
	cout<<mi[0]<<endl;
	
	
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:5:28: error: 'string' was not declared in this scope
    5 |         int i,j,k,l,r,x,y; string s;
      |                            ^~~~~~
a.cc:7:9: error: 'cin' was not declared in this scope
    7 |         cin>>K;
      |         ^~~
a.cc:8:9: error: 'FOR' was not declared in this scope
    8 |         FOR(i,K) mi[i]=1<<30;
      |         ^~~
a.cc:9:9: error: 'priority_queue' was not declared in this scope
    9 |         priority_queue<pair<int,int>> P;
      |         ^~~~~~~~~~~~~~
a.cc:9:24: error: 'pair' was not declared in this scope
    9 |         priority_queue<pair<int,int>> P;
      |                        ^~~~
a.cc:9:29: error: expected primary-expression before 'int'
    9 |         priority_queue<pair<int,int>> P;
      |                             ^~~
a.cc:11:25: error: 'min' was not declared in this scope; did you mean 'mi'?
   11 |                 mi[i%K]=min(mi[i%K],i);
      |                         ^~~
      |                         mi
a.cc:12:17: error: 'P' was not declared in this scope
   12 |                 P.push({-mi[i%K],i%K});
      |                 ^
a.cc:15:15: error: 'P' was not declared in this scope
   15 |         while(P.size()) {
      |               ^
a.cc:30:9: error: 'cout' was not declared in this scope
   30 |         cout<<mi[0]<<endl;
      |         ^~~~
a.cc:30:22: error: 'endl' was not declared in this scope
   30 |         cout<<mi[0]<<endl;
      |                      ^~~~
Language: C++

long long sum_digits(long long val){
  
  long long sum = 0;
  
  while (val > 0) {
    sum += val % 10;
    val /= 10;
  }
  
  return sum;
}



Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

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

int k, ans = 1000000000;

int main() {
  cin >> k;
  for (int i = 1; i < 10; ++i) {
    int tmp = 0;
    string s = to_string(k * i);

    for (int j = 0; j < s.size(); j++) {
      tmp = int(s[i] - ‘0’);
    }
    ans = min(ans, tmp);
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc:13:24: error: extended character ‘ is not valid in an identifier
   13 |       tmp = int(s[i] - ‘0’);
      |                        ^
a.cc:13:24: error: extended character ’ is not valid in an identifier
a.cc: In function 'int main()':
a.cc:13:24: error: '\U000020180\U00002019' was not declared in this scope
   13 |       tmp = int(s[i] - ‘0’);
      |                        ^~~
Language: C++

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

int ketasum(int n) {
	int ret = 0;
	while( n != 0 ) {
		ret += n % 10;
		n /= 10;
	}
	return ret;
}

int main(){
	cin >> k;

	int summx = INT_MAX;
	for(int i=1; i<=9; i++){
		summx = min(summx, ketasum(k * i));
	}

	cout << summx;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:21: error: 'INT_MAX' was not declared in this scope
   18 |         int summx = INT_MAX;
      |                     ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <algorithm>
  +++ |+#include <climits>
    3 | using namespace std;
Language: C++

#include <vector>
#include <iostream>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <limits>
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define pb push_back

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef long double ld;
typedef pair<ll, ll> pll;
const int N =1e5 + 10;
int k;
int dis[N];
int solve() {
    for (int i = 0; i < k; i++) dis[i] = INT_MAX;
    queue<pair<int, int>> pq;
    for (int i = 1; i < 10; i++) {
        pq.push({-i, i % k});
        dis[i % k] = min(dis[i % k], i);
    }
    int res = INT_MAX;
    while (pq.size()) {
        auto cur = pq.front();
        pq.pop();
        if (cur.second == 0) {
            res = min(res, -cur.first);
            continue;
        }
        if (dis[cur.second] == -cur.first) {
            for (int i = 0; i < 10; i++) {
                int next = (cur.second * 10 + i) % k;
                int value = -cur.first + i;
                if (dis[next] > value) {
                    pq.push({-value, next});
                    dis[next] = value;
                }
            }
        }
    }
    return res;
}
int main() {
    while (cin >> k) {
        cout << solve() << endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int solve()':
a.cc:21:42: error: 'INT_MAX' was not declared in this scope
   21 |     for (int i = 0; i < k; i++) dis[i] = INT_MAX;
      |                                          ^~~~~~~
a.cc:7:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    6 | #include <limits>
  +++ |+#include <climits>
    7 | #define all(a) (a).begin(), (a).end()
a.cc:27:15: error: 'INT_MAX' was not declared in this scope
   27 |     int res = INT_MAX;
      |               ^~~~~~~
a.cc:27:15: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

#include <vector>
#include <iostream>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define pb push_back

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef long double ld;
typedef pair<ll, ll> pll;
const int N =1e5 + 10;
int k;
int dis[N];
int solve() {
    for (int i = 0; i < k; i++) dis[i] = INT_MAX;
    queue<pair<int, int>> pq;
    for (int i = 1; i < 10; i++) {
        pq.push({-i, i % k});
        dis[i % k] = min(dis[i % k], i);
    }
    int res = INT_MAX;
    while (pq.size()) {
        auto cur = pq.front();
        pq.pop();
        if (cur.second == 0) {
            res = min(res, -cur.first);
            continue;
        }
        if (dis[cur.second] == -cur.first) {
            for (int i = 0; i < 10; i++) {
                int next = (cur.second * 10 + i) % k;
                int value = -cur.first + i;
                if (dis[next] > value) {
                    pq.push({-value, next});
                    dis[next] = value;
                }
            }
        }
    }
    return res;
}
int main() {
    while (cin >> k) {
        cout << solve() << endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int solve()':
a.cc:20:42: error: 'INT_MAX' was not declared in this scope
   20 |     for (int i = 0; i < k; i++) dis[i] = INT_MAX;
      |                                          ^~~~~~~
a.cc:6:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    5 | #include <queue>
  +++ |+#include <climits>
    6 | #define all(a) (a).begin(), (a).end()
a.cc:26:15: error: 'INT_MAX' was not declared in this scope
   26 |     int res = INT_MAX;
      |               ^~~~~~~
a.cc:26:15: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REP(i,b) FOR(i,0,b)
#define INF 1e9

int K;

int check10(int n){
  unsigned long long sum = 0;

  //cout<<n<<' ';

  while(n){
    sum += n%10;
    n /= 10;
  }

  //if(sum < 0) return INF;

  return sum;
}


int main()
{
  unsigned long long ans = INF;

  cin>>K;

  FOR(i,2,5000){

    ans = min(ans, check10(i*K));
    //cout<<ans<<endl;
    if (ans == 1) break;
  }

  cout<<ans<< endl;


  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:14: error: no matching function for call to 'min(long long unsigned int&, int)'
   35 |     ans = min(ans, check10(i*K));
      |           ~~~^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:35:14: note:   deduced conflicting types for parameter 'const _Tp' ('long long unsigned int' and 'int')
   35 |     ans = min(ans, check10(i*K));
      |           ~~~^~~~~~~~~~~~~~~~~~~
/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,
                 from a.cc:3:
/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:35:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long unsigned int'
   35 |     ans = min(ans, check10(i*K));
      |           ~~~^~~~~~~~~~~~~~~~~~~
Language: C++

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<cmath>
using namespace std;
long long ans,n;
int main(){
    scanf("%lld",&n);
    while(n%2==0)n/=2;
    while(n%5==0)n/=5;
    t=n;
    while(t){
    	ans+=t%10;
    	t/=10;
	}
    cout<<ans;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:5: error: 't' was not declared in this scope; did you mean 'tm'?
   15 |     t=n;
      |     ^
      |     tm
Language: C++

# include <bits/stdc++.h>

int main ( )  {
	register int base, sum ;
	scanf ( "%d", & base ) ;
	register int ans ( 0x3f3f3f3f ) ;
	for ( register int i = 1 ; i <= 40000000 ; ++ i )  {
		cur = 1LL * base * i ;
		sum = 0 ;
		while ( cur )  {
			sum += cur % 10, cur /= 10 ;
		}
		if ( sum < ans )  ans = sum ;
	}
	return printf ( "%d\n", ans ), 0 ;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    4 |         register int base, sum ;
      |                      ^~~~
a.cc:4:28: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    4 |         register int base, sum ;
      |                            ^~~
a.cc:6:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    6 |         register int ans ( 0x3f3f3f3f ) ;
      |                      ^~~
a.cc:7:28: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    7 |         for ( register int i = 1 ; i <= 40000000 ; ++ i )  {
      |                            ^
a.cc:8:17: error: 'cur' was not declared in this scope
    8 |                 cur = 1LL * base * i ;
      |                 ^~~
Language: C++

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

#define endl '\n'

const int N = (int)5e7;

int sd(long long n) {
  int res = 0;
  while(n > 0) {
    res += n % 10;
    n /= 10;
  }
  return res;
}

int main() {

    long long n;
    int res = INT_MAX;
    scanf("%lld", &n);
    for(int i = 1; i <= N; i++) {
      res = min(res, sd(n * (i)));
    }
   
    res = min(res, sd(n * (n - 1));
    res = min(res, sd(n * (n + 1));
    res = min(res, sd(n * (n));
 printf("%d", res);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:35: error: expected ')' before ';' token
   26 |     res = min(res, sd(n * (n - 1));
      |              ~                    ^
      |                                   )
a.cc:27:35: error: expected ')' before ';' token
   27 |     res = min(res, sd(n * (n + 1));
      |              ~                    ^
      |                                   )
a.cc:28:31: error: expected ')' before ';' token
   28 |     res = min(res, sd(n * (n));
      |              ~                ^
      |                               )
Language: C++

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<cmath>
using namespace std;
long long ans;
int main(){
    scanf("%lld",&n);
    while(n%2==0)n/=2;
    while(n%5==0)n/=5;
    t=n;
    while(t){
    	ans+=t%10;
    	t/=10;
	}
    cout<<ans;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:19: error: 'n' was not declared in this scope; did you mean 'yn'?
   12 |     scanf("%lld",&n);
      |                   ^
      |                   yn
a.cc:15:5: error: 't' was not declared in this scope; did you mean 'tm'?
   15 |     t=n;
      |     ^
      |     tm
Language: C++

#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>

using namespace std;
int main()
{
	int n;
	cin >> n;
	int count = 0;
	int answer = LONG_MAX, prom =0;
	for (long long i = n; count < 100000; i += n) {
		string s = to_string(i);
		for (auto j : s) {
			prom += j - '0';
		}
		if (prom < answer) answer = prom;
		count++;
		prom = 0;
	}
	cout << answer;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:22: error: 'LONG_MAX' was not declared in this scope
   13 |         int answer = LONG_MAX, prom =0;
      |                      ^~~~~~~~
a.cc:5:1: note: 'LONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include <vector>
  +++ |+#include <climits>
    5 | #include <string>
a.cc:17:25: error: 'prom' was not declared in this scope
   17 |                         prom += j - '0';
      |                         ^~~~
a.cc:19:21: error: 'prom' was not declared in this scope
   19 |                 if (prom < answer) answer = prom;
      |                     ^~~~
a.cc:21:17: error: 'prom' was not declared in this scope
   21 |                 prom = 0;
      |                 ^~~~
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
 
int main(){
    string K;
    cin >> K;
    while(stoi(K) % 2 == 0){
        K = to_string(stoi(K) / 2);
    }
    while(stoi(K) % 5 == 0){
        K = to_string(stoi(K) / 5);
    }
    long ans = 1e9;
    for(long i = 1; i < min(1e6, ans); i++){
        string text = "";
        long back = 0;
        for(long j = K.size() - 1; j >= 0; j--){
            long num = (K[j] - '0') * i + back;
            text = to_string(num % 10) + text;
            back = num / 10;
        }
        text = to_string(back) + text;
        long score = 0;
        for(long j = 0; j < text.size(); j++){
            score += text[j] - '0';
        }
        ans = min(ans, score);
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:28: error: no matching function for call to 'min(double, long int&)'
   15 |     for(long i = 1; i < min(1e6, ans); i++){
      |                         ~~~^~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:15:28: note:   deduced conflicting types for parameter 'const _Tp' ('double' and 'long int')
   15 |     for(long i = 1; i < min(1e6, ans); i++){
      |                         ~~~^~~~~~~~~~
/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,
                 from a.cc:2:
/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:15:28: note:   mismatched types 'std::initializer_list<_Tp>' and 'double'
   15 |     for(long i = 1; i < min(1e6, ans); i++){
      |                         ~~~^~~~~~~~~~