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

v#include <bits/stdc++.h>

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}

int main() {
	int64_t n;
	std::cin >> n;
	int64_t res = 1000000000000000000;
	for (int i = 1; (int64_t) i * i <= n; i++) {
		if (n % i) continue;
		res = std::min(res, i + n / i);
	}
	std::cout << res - 2 << std::endl;
	return 0;
}


Compiler output:
a.cc:1:2: error: stray '#' in program
    1 | v#include <bits/stdc++.h>
      |  ^
a.cc:1:1: error: 'v' does not name a type
    1 | v#include <bits/stdc++.h>
      | ^
a.cc: In function 'int main()':
a.cc:10:9: error: 'int64_t' was not declared in this scope
   10 |         int64_t n;
      |         ^~~~~~~
a.cc:1:1: note: 'int64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
  +++ |+#include <cstdint>
    1 | v#include <bits/stdc++.h>
a.cc:11:14: error: 'cin' is not a member of 'std'
   11 |         std::cin >> n;
      |              ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | v#include <bits/stdc++.h>
a.cc:11:21: error: 'n' was not declared in this scope
   11 |         std::cin >> n;
      |                     ^
a.cc:12:16: error: expected ';' before 'res'
   12 |         int64_t res = 1000000000000000000;
      |                ^~~~
      |                ;
a.cc:13:34: error: expected ';' before 'i'
   13 |         for (int i = 1; (int64_t) i * i <= n; i++) {
      |                                  ^~
      |                                  ;
a.cc:13:45: error: expected ')' before ';' token
   13 |         for (int i = 1; (int64_t) i * i <= n; i++) {
      |             ~                               ^
      |                                             )
a.cc:13:47: error: 'i' was not declared in this scope
   13 |         for (int i = 1; (int64_t) i * i <= n; i++) {
      |                                               ^
a.cc:17:14: error: 'cout' is not a member of 'std'
   17 |         std::cout << res - 2 << std::endl;
      |              ^~~~
a.cc:17:14: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:17:22: error: 'res' was not declared in this scope
   17 |         std::cout << res - 2 << std::endl;
      |                      ^~~
a.cc:17:38: error: 'endl' is not a member of 'std'
   17 |         std::cout << res - 2 << std::endl;
      |                                      ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | v#include <bits/stdc++.h>
Language: C++

#include <iostream>
#include <cmath>

int main()
{
  using namespace std;
  
  using uint64_t = Long;
  Long N;
  
  cin >> N;
  
  Long i_, j_;
  
  for(Long i = (int)sqrt(N); i > 0; --i)
  {
    if(N % i == 0)
    {
      i_ = i;
      j_ = N / i;
      break;
    }
  }
  
  cout << i_ + j_ - 2 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:20: error: 'Long' does not name a type; did you mean 'long'?
    8 |   using uint64_t = Long;
      |                    ^~~~
      |                    long
a.cc:9:3: error: 'Long' was not declared in this scope; did you mean 'long'?
    9 |   Long N;
      |   ^~~~
      |   long
a.cc:11:10: error: 'N' was not declared in this scope
   11 |   cin >> N;
      |          ^
a.cc:13:7: error: expected ';' before 'i_'
   13 |   Long i_, j_;
      |       ^~~
      |       ;
a.cc:15:11: error: expected ';' before 'i'
   15 |   for(Long i = (int)sqrt(N); i > 0; --i)
      |           ^~
      |           ;
a.cc:15:30: error: 'i' was not declared in this scope
   15 |   for(Long i = (int)sqrt(N); i > 0; --i)
      |                              ^
a.cc:19:7: error: 'i_' was not declared in this scope
   19 |       i_ = i;
      |       ^~
a.cc:20:7: error: 'j_' was not declared in this scope; did you mean 'jn'?
   20 |       j_ = N / i;
      |       ^~
      |       jn
a.cc:25:11: error: 'i_' was not declared in this scope
   25 |   cout << i_ + j_ - 2 << endl;
      |           ^~
a.cc:25:16: error: 'j_' was not declared in this scope; did you mean 'jn'?
   25 |   cout << i_ + j_ - 2 << endl;
      |                ^~
      |                jn
Language: C++

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

int main() {
  int n;
  cin >> n;
  int min=0;
  for(int a=1;a<(sqrt(n)+1);++a){
    if(n%a==0){
      int b=n/a;
      if(min==0) min=a+b-2;
      else min=min(min,a+b-2);
    }
  }
  cout << min << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:19: error: 'min' cannot be used as a function
   12 |       else min=min(min,a+b-2);
      |                ~~~^~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#include <vector>
#include <iostream>
using namespace std;
typedef long long ll;

int N;
int j=0;

void input(){
    cin >> N;
}



void solve(){
    
    ll ans = 1000000000000000000000;
    for (int i = 2;i<N;i++){
        if (0 == N % i){
          j = N/i;
          ans = min(ans, j+i-2);
        }
    }
    cout << ans << endl;
    return;
}



int main() {
    input();
    solve();
    return 0;
}

Compiler output:
a.cc:18:14: warning: integer constant is too large for its type
   18 |     ll ans = 1000000000000000000000;
      |              ^~~~~~~~~~~~~~~~~~~~~~
a.cc: In function 'void solve()':
a.cc:22:20: error: no matching function for call to 'min(ll&, int)'
   22 |           ans = min(ans, j+i-2);
      |                 ~~~^~~~~~~~~~~~
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:22:20: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   22 |           ans = min(ans, j+i-2);
      |                 ~~~^~~~~~~~~~~~
/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:22:20: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   22 |           ans = min(ans, j+i-2);
      |                 ~~~^~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#include <vector>
#include <iostream>
using namespace std;
typedef long long ll;

int N;
vector<int> v(4000);
int j=0;

void input(){
    cin >> N;
}

void swapmin(){
    if(v[j-1] < v[j]){
        int i = v[j];
        v[j] = v[j-1];
        v[j-1] = i;
    }
}


void solve(){
	
    v[0] = N + 1;
    for (ll i = 2;i*i<=;i++){
        if (0 == N % i){
           j++;
           v.at(j) = i + (N/i); 
           swapmin();
        }
    }
    cout << v[j] - 2 << endl;
    return;
}



int main() {
    input();
    solve();
    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:27:24: error: expected primary-expression before ';' token
   27 |     for (ll i = 2;i*i<=;i++){
      |                        ^
Language: C

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

long solve(long n) {
    long temp = 1;
    int ceil = ceiling(sqrt(n));
    for (int i = 1; i <= ceil; ++i) {
        if (n % i == 0 && temp + n/temp > i + n/i) {
            temp = i;
        }
    }
    return temp;
}


int main () {
    long n, m;

    scanf("%ld", &n);
    m = solve(n);
    printf("%ld\n", m + n/m - 2);
}

Compiler output:
main.c: In function 'solve':
main.c:6:16: error: implicit declaration of function 'ceiling'; did you mean 'ceill'? [-Wimplicit-function-declaration]
    6 |     int ceil = ceiling(sqrt(n));
      |                ^~~~~~~
      |                ceill
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
using namespace std;
  
int main () {
  int n;
  cin >> n;
  for(int m=sprt(n);m>0;m--) {
    if(n % m == 0) {
      cout << n/m + m - 2;
      break;
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:13: error: 'sprt' was not declared in this scope; did you mean 'sqrt'?
    8 |   for(int m=sprt(n);m>0;m--) {
      |             ^~~~
      |             sqrt
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
using namespace std;
  
int main () {
  int n;
  cin >> n;
  for(int m=sprt(n);m>0;m--) {
    if(n % m == 0) {
      cout << n/m + m - 2;
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:13: error: 'sprt' was not declared in this scope; did you mean 'sqrt'?
    8 |   for(int m=sprt(n);m>0;m--) {
      |             ^~~~
      |             sqrt
Language: C++

#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
using namespace std;
typedef long long LL;
const int INF = 100000000;

int main()
{
#ifdef LOCAL
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
    int A;
    cin >> A;

    int min = INT_MAX;
    for(int i=1;i<A/2;i++){
        if(A % i == 0){
            if(i > A/i){
                break;
            }
            else{
                if(i + A/i - 2 < min){
                    min = i + A/i - 2;
                }
            }
        }
    }

    cout << min << endl;    

    return 0;
}


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

#include <stdio.h>
#include <math.h>
int main(){
  int N,SQRT,ANS;
  scanf("%d",&N);
  SQRT=sqrt(N);
  while(true){
    if(N%SQRT==0){
      ANS=N/SQRT;
      break;
    }
    SQRT++;
  }
  printf("%d",SQRT+ANS-2);
}

Compiler output:
main.c: In function 'main':
main.c:7:9: error: 'true' undeclared (first use in this function)
    7 |   while(true){
      |         ^~~~
main.c:3:1: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
    2 | #include <math.h>
  +++ |+#include <stdbool.h>
    3 | int main(){
main.c:7:9: note: each undeclared identifier is reported only once for each function it appears in
    7 |   while(true){
      |         ^~~~
Language: C

#include <stdio.h>
#include <maht.h>
int main(){
  int N,SQRT,ANS;
  scanf("%d",&N);
  SQRT=sqrt(N);
  while(true){
    if(N%SQRT==0){
      ANS=N/SQRT;
      break;
    }
    SQRT++;
  }
  printf("%d",SQRT+ANS-2);
}

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

#include <stdio.h>
#include <maht.h>
int main(){
  int N,SQRT,ANS;
  scanf("%d",&N);
  SQRT=sqrt(N);
  while(true){
    if(N%SQRT==0){
      ANS=N/SQRT;
      break;
    }
    SQRT++;
  }
  printf("%d",SQRT+ANS-2);
}

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

#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n,x;
    scanf("%lld",&n);
    x = sqrt(n);
    while(1)
    {
        if(n%x==0)
        {
            cout<<((n/x)+x)-2)<<endl;
            return 0;
        }
        x--;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:30: error: expected ';' before ')' token
   12 |             cout<<((n/x)+x)-2)<<endl;
      |                              ^
      |                              ;
Language: C++

#include <bits/stdc++.h>
#define lint long long
using namespace std;
 
int main()
{
    lint n;
    cin >> n;
    ll ans = 1e16;
    for(ll i = 1; i*i <= n; i++){
        if(n%i) continue;
        ans = min(ans, i+n/i-2);
    }
    cout << ans << endl;
 
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:5: error: 'll' was not declared in this scope
    9 |     ll ans = 1e16;
      |     ^~
a.cc:10:11: error: expected ';' before 'i'
   10 |     for(ll i = 1; i*i <= n; i++){
      |           ^~
      |           ;
a.cc:10:19: error: 'i' was not declared in this scope
   10 |     for(ll i = 1; i*i <= n; i++){
      |                   ^
a.cc:12:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   12 |         ans = min(ans, i+n/i-2);
      |         ^~~
      |         abs
a.cc:14:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   14 |     cout << ans << endl;
      |             ^~~
      |             abs
Language: Java

#include <bits/stdc++.h>
#define lint long long
using namespace std;
 
int main()
{
    lint n;
    cin >> n;
    ll ans = 1e16;
    for(ll i = 1; i*i <= n; i++){
        if(n%i) continue;
        ans = min(ans, i+n/i-2);
    }
    cout << ans << endl;
 
    return 0;
}

Compiler output:
Main.java:1: error: illegal character: '#'
#include <bits/stdc++.h>
^
Main.java:1: error: class, interface, enum, or record expected
#include <bits/stdc++.h>
         ^
Main.java:2: error: illegal character: '#'
#define lint long long
^
Main.java:8: error: not a statement
    cin >> n;
        ^
Main.java:14: error: not a statement
    cout << ans << endl;
                ^
Main.java:5: error: unnamed classes are a preview feature and are disabled by default.
int main()
^
  (use --enable-preview to enable unnamed classes)
6 errors
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin >> n;
	for(int i = sqrt(n); i>=0; i--) {
		if(!(n % i) {
			cout << i-1+(n/i-1);
			break;
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:28: error: expected ')' before '{' token
    7 |                 if(!(n % i) {
      |                   ~        ^~
      |                            )
a.cc:11:9: error: expected primary-expression before '}' token
   11 |         }
      |         ^
Language: C

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

int main(){
  long int n, ans[2], i;
  i = scanf("%ld", &n);
  if(n == 2 || n == 3)printf("%ld\n", n - 1);exit();
  for(i = (long int)sqrt((double)n) - 1; i < n; i++){
    if(n % i == 0){
      ans[0] = i;
      ans[1] = n / i;
      break;
    }
  }
  printf("%ld\n", ans[0] + ans[1] - 2);
}

Compiler output:
main.c: In function 'main':
main.c:8:46: error: too few arguments to function 'exit'
    8 |   if(n == 2 || n == 3)printf("%ld\n", n - 1);exit();
      |                                              ^~~~
In file included from main.c:3:
/usr/include/stdlib.h:756:13: note: declared here
  756 | extern void exit (int __status) __THROW __attribute__ ((__noreturn__));
      |             ^~~~
Language: C

#
include <stdio.h>
#include <math.h>
int main(void){
    long int i,j,n;
    scanf ("%ld",&n);
  long int ans = 100000000000;
    for (i = 1;i <= n;i++)
    {
        for (j = 1;j <= i;j++)
        {
     
        if (i*j == n){
          if(ans > i+j-2)ans = i+j-2;
          }
  
        }
    }
 printf("%ld",ans);
    return 0;
}

Compiler output:
main.c:2:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    2 | include <stdio.h>
      |         ^
main.c: In function 'main':
main.c:6:5: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    6 |     scanf ("%ld",&n);
      |     ^~~~~
main.c:4:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
    3 | #include <math.h>
  +++ |+#include <stdio.h>
    4 | int main(void){
main.c:6:5: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    6 |     scanf ("%ld",&n);
      |     ^~~~~
main.c:6:5: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:19:2: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   19 |  printf("%ld",ans);
      |  ^~~~~~
main.c:19:2: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:19:2: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:19:2: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C++

#include<bits/stdc++.h>
#include <stdio.h>
#include <math.h>
int main(void){
    long int i,j,n;
    scanf ("%d",&n);
  long int ans = 0;
    for (i = 1;i <= n;i++)
    {
        for (j = 1;j <= i;j++)
        {
     
        if (i*j == n)max(ans,i+j-2);
  
        }
    }
 printf("%d",ans);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:22: error: 'max' was not declared in this scope; did you mean 'std::max'?
   13 |         if (i*j == n)max(ans,i+j-2);
      |                      ^~~
      |                      std::max
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
Language: C

#include <stdio.h>
#include <math.h>
int main(void){
    int i,j,n;
    scanf ("%d",&n);
    for (i = 1;i < n;i++)
    {
        for (j = 1;j < i;j++)
        {        
        if (i*j == n)
        break;
        ptintf("%d %d",i,j);
        }
    if (i*j == n)
    break;
    }
    if (j == 0);
    {printf ("%d",i);
    }else{
    printf("%d",i+j-2);
    }
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:12:9: error: implicit declaration of function 'ptintf'; did you mean 'printf'? [-Wimplicit-function-declaration]
   12 |         ptintf("%d %d",i,j);
      |         ^~~~~~
      |         printf
main.c:19:6: error: 'else' without a previous 'if'
   19 |     }else{
      |      ^~~~
Language: C

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

int main(){
  int n,p;
  scanf("%d",&n);
  
  for(int i=1;i<=double sqrt(double n);i++){
    if(n%i==0) p=i;
  }
  
  printf("%d",p+n/p);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:8:18: error: expected expression before 'double'
    8 |   for(int i=1;i<=double sqrt(double n);i++){
      |                  ^~~~~~
Language: C

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

int main(){
  int n,p;
  scanf("%d",&n);
  
  for(int i=1;i<=sqrt(double n);i++){
    if(n%i==0) p=i;
  }
  
  printf("%d",p+n/p);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:8:23: error: expected expression before 'double'
    8 |   for(int i=1;i<=sqrt(double n);i++){
      |                       ^~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
long long int printDivisors(long long int n) 
{ 
    long long int minAns = 1000000000005;
    for (int i=1; i<=sqrt(n); i++) 
    { 
        if (n%i == 0) 
        { 
            if (n/i == i) 
                minAns = min(minAns, 2*abs(i-1));//printf("%d ", i); 
  
            else 
                minAns = min(minAns, abs(i-1)+abs(n/i-1));//printf("%d %d ", i, n/i); 
        } 
    }
    return minAns;
}
int main()
{
  long long int n;
  cin >> n;
  cout << printDivisors(n) << endl;
}

Compiler output:
a.cc: In function 'long long int printDivisors(long long int)':
a.cc:11:29: error: no matching function for call to 'min(long long int&, int)'
   11 |                 minAns = min(minAns, 2*abs(i-1));//printf("%d ", i);
      |                          ~~~^~~~~~~~~~~~~~~~~~~~
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:11:29: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   11 |                 minAns = min(minAns, 2*abs(i-1));//printf("%d ", 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:
/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:11:29: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   11 |                 minAns = min(minAns, 2*abs(i-1));//printf("%d ", i);
      |                          ~~~^~~~~~~~~~~~~~~~~~~~
Language: Java

import java.util.*;
public class CWalkon{
  public static void main(String[]args){
      Scanner sc = new Scanner(System.in);

      long N = sc.nextLong();
      long min = N;
      long a = 0;
      long b = 0;

      for(long i = 1;i<=Math.sqrt(N);i++){
          if(N%i==0){
             a = i-1;
             b = N/i-1;
        }
          min = Math.min(a+b,min);
      }
      System.out.println(min);
  }
}

Compiler output:
Main.java:2: error: class CWalkon is public, should be declared in a file named CWalkon.java
public class CWalkon{
       ^
1 error
Language: Java

import java.util.*;
public class Kk{
  public static void main(String []args){
    Scanner sc=new Scanner(System.in);
    long N = sc.nextLong();
    long min=N;
    long x=0;
    long y=0;
    for(int i=1;i*i<=N;i++){
      if(N%i==0){
        x=i-1;
        y=N/i-1;
       min=Math.min(min,x+y);
      // System.out.println(x,y);
      // System.out.println(min);
     }
    }
    System.out.println(min);
  }
}


Compiler output:
Main.java:2: error: class Kk is public, should be declared in a file named Kk.java
public class Kk{
       ^
1 error
Language: Java

import java.util.*;
public class Kk{
  public static void main(String []args){
    Scanner sc=new Scanner(System.in);
    long N = sc.nextLong();
    long min=N;
    for(int i=1;i*i<=N;i++){
      if(N%i==0){
      long x=i-1;
      long y=N/i-1;
      min=Math.min(min,x+y);
      // System.out.println(x,y);
      // System.out.println(min);
     }
    }
    System.out.println(min);
  }
}

Compiler output:
Main.java:2: error: class Kk is public, should be declared in a file named Kk.java
public class Kk{
       ^
1 error
Language: C++

#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp> // <-- add!!!
using namespace std;
using namespace boost::multiprecision::cpp_int bigint;

int func() {
    cpp_int n;
    cin >> n;
    double root = sqrt(n);
    int rn = root;
    for (int i = rn; i > 1; i--) {
        if (n % i == 0) {
            return (i - 1) + (n/i - 1);
        }
    }
    return n - 1;
}

int main() {
    cout << func() << endl;
}

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

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

int main() 
{
	ll n;
	cin >> n;
    ll ans=1e18;
	for(ll i=1; i<=sprt(n) ; i++)
	{
		if( n%i != 0 )
			continue;
		ll j = n/i;
		ans = min(ans,i+ j-2);
	}

	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:24: error: 'sprt' was not declared in this scope; did you mean 'sqrt'?
   10 |         for(ll i=1; i<=sprt(n) ; i++)
      |                        ^~~~
      |                        sqrt
Language: C++

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

int main() 
{
	ll n;
	cin >> n;
    ll ans;
	for(ll i=1; i<=sprt(n) ; i++)
	{
		if( n%i != 0 )
			continue;
		ll j = n/i;
		ans = min(ans,i+ j-2);
	}

	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:24: error: 'sprt' was not declared in this scope; did you mean 'sqrt'?
   10 |         for(ll i=1; i<=sprt(n) ; i++)
      |                        ^~~~
      |                        sqrt
Language: C++

#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using boost::multiprecision::cpp_int bigint;

int func() {
    bigint n;
    cin >> n;
    double root = sqrt(n);
    int rn = root;
    for (int i = rn; i > 1; i--) {
        if (n % i == 0) {
            return (i - 1) + (n/i - 1);
        }
    }
    return n - 1;
}

int main() {
    cout << func() << endl;
}


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

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

int main(){
  long int N;
  cin >> N;
  
  long int ans=1;
  for(long int i=1; i<sqrt(N); ++i){
    if(N%i==0){
      ans = i+(N/i)-2);
    }
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:22: error: expected ';' before ')' token
   11 |       ans = i+(N/i)-2);
      |                      ^
      |                      ;
Language: C++

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

int main() 
{
	int i;
	long long int j,n,count;
	cin >> n;

	for( i=2; i<=sprt(n) ; i++)
	{
		if( n%i == 0 )
			break;
	}
	j = n/i;
	count = i + j -2;

	cout << count << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:22: error: 'sprt' was not declared in this scope; did you mean 'sqrt'?
   10 |         for( i=2; i<=sprt(n) ; i++)
      |                      ^~~~
      |                      sqrt
Language: C++

#include<stdio.h>
#include<cmath.h>
#include<stdlib.h>
int main()
{
    long long int a,b,c,n,min,x,y;
    scanf("%lld",&n);
    min=n;
    for(a=1;a<=sqrt(n);a++)
    {
        if(n%a==0)
        {
            b=n/a;
            c=abs(b-a);
            if(c<min)
            {
                min=c;
                x=a;
                y=b;
            }
        }
    }
    printf("%lld\n",x+y-2);
    return 0;
}


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

#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using boost::multiprecision::cpp_int;

int func() {
    cpp_int n;
    cin >> n;
    double root = sqrt(n);
    int rn = root;
    for (int i = rn; i > 1; i--) {
        if (n % i == 0) {
            return (i - 1) + (n/i - 1);
        }
    }
    return n - 1;
}

int main() {
    cout << func() << endl;
}

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

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPP(i, n) for(int i = 1; i <= n; ++i)
#define REPR(i, n) for(int i = n-1; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const int MOD = 1000000007;

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b) {if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b) {if(a<b) a=b;}

template<typename T>
vector<T> Divisor(T x) {
    vector<T> res;
    for(T i = 1; i*i<=x; ++i) {
        if(!x%i) {
            res.emplace_back(i);
            if(i*i!=x) res.emplace_back(n/i);
        }
    }
    sort(res.begin(), res.end());
    return res;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n; cin >> n;
    ll ans = LLONG_MAX;
    vector<ll> d = Divisor(n);
    int l = d.size();
    REP(i,l) {
        int a = d[i], b = n/d[i]; --a, --b;
        ll tmp = a+b;
        chmin(ans,a+b);
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'std::vector<_Tp> Divisor(T)':
a.cc:20:41: error: 'n' was not declared in this scope
   20 |             if(i*i!=x) res.emplace_back(n/i);
      |                                         ^
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPP(i, n) for(int i = 1; i <= n; ++i)
#define REPR(i, n) for(int i = n-1; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const int MOD = 1000000007;

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b) {if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b) {if(a<b) a=b;}

template<typename T>
vector<T> Divisor(T x) {
    vector<T> res;
    for(T i = 1; i*i<=x; ++i) {
        if(!x%i) {
            res.emplace_back(i);
            if(i*i!=x) res.emplace_back(n/i);
        }
    }
    sort(res.begin(), res.end());
    return res;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n; cin >> n;
    ll ans = LLONG_MAX;
    vector<ll> d = Divisor(n);
    int l = d.size();
    REP(i,l) {
        int a = d[i], b = n/d[i]; --a, --b;
        ll tmp = a+b
        chmin(ans,a+b);
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'std::vector<_Tp> Divisor(T)':
a.cc:20:41: error: 'n' was not declared in this scope
   20 |             if(i*i!=x) res.emplace_back(n/i);
      |                                         ^
a.cc: In function 'int main()':
a.cc:37:9: error: expected ',' or ';' before 'chmin'
   37 |         chmin(ans,a+b);
      |         ^~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
 
#define lli long long int
#define FOR(a,b) for(i=a;i<b;i++)
int main(){
    lli n,i;
    cin >> n;
    lli s = n-1;
    FOR(1,sqrt(1000000000000){
        if(n%i==0)
            s = min(s, n/i+i-2);
    }
    cout << s << endl;
}

Compiler output:
a.cc:15:2: error: unterminated argument list invoking macro "FOR"
   15 | }
      |  ^
a.cc: In function 'int main()':
a.cc:10:5: error: 'FOR' was not declared in this scope
   10 |     FOR(1,sqrt(1000000000000){
      |     ^~~
a.cc:10:8: error: expected '}' at end of input
   10 |     FOR(1,sqrt(1000000000000){
      |        ^
a.cc:6:11: note: to match this '{'
    6 | int main(){
      |           ^
Language: C++

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


int main() {
	long long int n;
	cin >> n ; 
	int flag = 0;
	int a1, a2;
	int i, j;
  for(long long  i=2 ; i*i<=a; ++i)
    {
        if(a%i==0) {
            minn=a/i +i -2;
 
        }
    }
    if(minn) cout << minn << endl;
    else{cout << a-1 << endl;}
	return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:29: error: 'a' was not declared in this scope
   14 |   for(long long  i=2 ; i*i<=a; ++i)
      |                             ^
a.cc:17:13: error: 'minn' was not declared in this scope
   17 |             minn=a/i +i -2;
      |             ^~~~
a.cc:21:8: error: 'minn' was not declared in this scope
   21 |     if(minn) cout << minn << endl;
      |        ^~~~
a.cc:22:18: error: 'a' was not declared in this scope
   22 |     else{cout << a-1 << endl;}
      |                  ^
Language: C++

#include <iostream>
using namespace std;
typedef ll long long; 
int main() {
	ll n;
 	cin >> n;
  	ll ans = (ll)(1e12);
  	for(int i = 1; i * i <= n; i++) {
      if (n % i == 0) {
      	ans = min(ans, i + n / i - 2);
      }
    }
  	cout << ans;
}

Compiler output:
a.cc:3:9: error: 'll' does not name a type
    3 | typedef ll long long;
      |         ^~
a.cc: In function 'int main()':
a.cc:5:9: error: 'll' was not declared in this scope
    5 |         ll n;
      |         ^~
a.cc:6:16: error: 'n' was not declared in this scope
    6 |         cin >> n;
      |                ^
a.cc:7:11: error: expected ';' before 'ans'
    7 |         ll ans = (ll)(1e12);
      |           ^~~~
      |           ;
a.cc:10:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   10 |         ans = min(ans, i + n / i - 2);
      |         ^~~
      |         abs
a.cc:13:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   13 |         cout << ans;
      |                 ^~~
      |                 abs
Language: C++

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

int main() {
	ll n;
 	cin >> n;
  	ll ans = ll(1e12);
  	for(int i = 1; i * i <= n; i++) {
      if (n % i == 0) {
      	ans = min(ans, i + n / i - 2);
      }
    }
  	cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:2:12: error: expected primary-expression before 'long'
    2 | #define ll long long
      |            ^~~~
a.cc:8:18: note: in expansion of macro 'll'
    8 |         ll ans = ll(1e12);
      |                  ^~
Language: C++

#include<iostream>
using namespace std;
int main () {
  long long N;
  cin >> N;
  long long max = 1e6;
  long long min = 1;
  while (max != min) {
    long long mid = (max + min) / 2;
    if(mid * mid > N) {
      max = mid - 1;
    }
    else min = mid;
  }
  for(long long i = min; i >= 1 i --) {
    if(!(N % i)) {
      cout << i + N / i  - 2 << endl;
      return 0;
    }
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:32: error: expected ';' before 'i'
   15 |   for(long long i = min; i >= 1 i --) {
      |                                ^~
      |                                ;
Language: C++

#include<iostream>
using namespace std;

int main() {
	long long N, ans;
	double M;
	cin >> N;
	M = sqrt((double)N);
	ans = N - 1;
	long long i;
	for (i = 1; i <= M; ++i) {
		if (N % i == 0) {
			long long val;
			val = N / i + i - 2;
			if (ans > val) ans = val;
		}
	}
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:13: error: 'sqrt' was not declared in this scope
    8 |         M = sqrt((double)N);
      |             ^~~~
Language: C++

#include<iostream>
using namespace std;

int main() {
	long long N, M, ans;
	cin >> N;
	M = sqrt((double)N);
	ans = N - 1;
	long long i;
	for (i = 1; i <= M; ++i) {
		if (N % i == 0) {
			long long val;
			val = N / i + i - 2;
			if (ans > val) ans = val;
		}
	}
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:13: error: 'sqrt' was not declared in this scope
    7 |         M = sqrt((double)N);
      |             ^~~~
Language: C++

#include<iostream>
using namespace std;

int main() {
	long long N, M, ans;
	cin >> N;
	M = sqrt(N);
	ans = N - 1;
	long long i;
	for (i = 1; i <= M; ++i) {
		if (N % i == 0) {
			long long val;
			val = N / i + i - 2;
			if (ans > val) ans = val;
		}
	}
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:13: error: 'sqrt' was not declared in this scope
    7 |         M = sqrt(N);
      |             ^~~~
Language: C++

#include<iostream>
using namespace std;

int main() {
	long long N, M, ans;
	cin >> N;
	M = sqrt(N);
	ans = N - 1;
	long long i;
	for (i = 1; i <= M; ++i) {
		if (N % i == 0) {
			long long val = N / i + i - 2;
			if (ans > val)ans = val;
		}
	}
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:13: error: 'sqrt' was not declared in this scope
    7 |         M = sqrt(N);
      |             ^~~~
Language: C++

#include<iostream>
using namespace std;

int main() {
	long N, M, ans;
	cin >> N;
	M = sqrt(N);
	ans = N - 1;
	long i;
	for (i = 1; i <= M; ++i) {
		if (N % i == 0) {
			long val = N / i + i - 2;
			if (ans > val)ans = val;
		}
	}
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:13: error: 'sqrt' was not declared in this scope
    7 |         M = sqrt(N);
      |             ^~~~
Language: C

#include <stdio.h>

int main(){
  int i, n;
  int divisor[2];
  
  scanf("%d",&n);
for (i=n/2,i>1;i--){
  if (n%i==0){
    divisor[0]=i;
    divisor[1]=n/i;
    break;
  }
}
printf("%d",(divisor[0]-1)*(divisor[1]-1));
  return 0;
}

  

Compiler output:
main.c: In function 'main':
main.c:8:19: error: expected ';' before ')' token
    8 | for (i=n/2,i>1;i--){
      |                   ^
      |                   ;
Language: C

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

int main()
{
	long N,a,walk,walkmini,j;
	scanf_s("%ld", &N);
	walkmini = N-1;
		for (long i = 1; i <= sqrt(N); i++)
		{
			a = N % i;
			if (a == 0)
			{
				j = N / i;
				walk = (i - 1) + (j - 1);
				if (walkmini > walk)
				{
					walkmini = walk;
				}
			}
		}
	printf("%d", walkmini);
}

Compiler output:
main.c: In function 'main':
main.c:7:9: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
    7 |         scanf_s("%ld", &N);
      |         ^~~~~~~
      |         scanf
Language: C++

#include<cmath>
using namespace std;

int main(){
  long x,min,m;
  cin>>x;
  for(int i=1;i<=sqrt(x);i++){
    if(x%i==0){
        m=x/i;
        min=m-1+i-1;
    }
  }
  cout<<min;
}
   

Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: 'cin' was not declared in this scope
    6 |   cin>>x;
      |   ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include<cmath>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:13:3: error: 'cout' was not declared in this scope
   13 |   cout<<min;
      |   ^~~~
a.cc:13:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

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

int main(){
    ll n;
    cin >> n;
    for(ll i = sqrt(n); i > 0; --i ){
        if(n%i == 0){
            cout << i + n/i -2 << endl;
            break;
        }
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:16: error: 'sqrt' was not declared in this scope
    8 |     for(ll i = sqrt(n); i > 0; --i ){
      |                ^~~~
Language: C++

#include <iostream>
#include <cmath>
using namespace std;
int main(){
	int N,i,x;
 	cin>>N;	
  int min=N
  	for(i=1;i<sqrt(N)&&i<=1000000;i++){
  	if(N%i==0){
      x=(i-1)+(N/i-1);
     if(min>x)min=x;
    }	
  }
  cout<<x;
  cout<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:9: error: expected ',' or ';' before 'for'
    8 |         for(i=1;i<sqrt(N)&&i<=1000000;i++){
      |         ^~~
a.cc:8:42: error: expected ';' before ')' token
    8 |         for(i=1;i<sqrt(N)&&i<=1000000;i++){
      |                                          ^
      |                                          ;
Language: C++

#include <iostream>
#include <vector>
#include<algorithm>

int main(int N){	
	int ans1=1, ans2=N;
	int sum = 101;
	for (int i = 0; i < sqrt(N); i++) {
		for (int j = 0; j < sqrt(N); j++) {
			if (i*j == N) {
				sum = std::max(sum,i+j);
			}
		}
	}
  return sum;
}

Compiler output:
a.cc:5:5: warning: 'int main(int)' takes only zero or two arguments [-Wmain]
    5 | int main(int N){
      |     ^~~~
a.cc: In function 'int main(int)':
a.cc:8:29: error: 'sqrt' was not declared in this scope
    8 |         for (int i = 0; i < sqrt(N); i++) {
      |                             ^~~~
Language: C++

int main(int N){	
	int ans1=1, ans2=N;
	int sum = 101;
	for (int i = 0; i < sqrt(N); i++) {
		for (int j = 0; j < sqrt(N); j++) {
			if (i*j == N) {
				sum = std::max(sum,i+j);
			}
		}
	}
  return sum;
}

Compiler output:
a.cc:1:5: warning: 'int main(int)' takes only zero or two arguments [-Wmain]
    1 | int main(int N){
      |     ^~~~
a.cc: In function 'int main(int)':
a.cc:4:29: error: 'sqrt' was not declared in this scope
    4 |         for (int i = 0; i < sqrt(N); i++) {
      |                             ^~~~
a.cc:7:44: error: 'max' is not a member of 'std'
    7 |                                 sum = std::max(sum,i+j);
      |                                            ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  uint64_t N;
  cin >> N;
  
  uint64_t res = N;
  
  for (uint64_t i=1; i*i<N; i++) {
    if ( N % i == 0) {
      int64_t j = i + N / i - 2;
      res = min( res, j);
    }
  }
  
  cout << res << endl;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:16: error: no matching function for call to 'min(uint64_t&, int64_t&)'
   13 |       res = min( res, j);
      |             ~~~^~~~~~~~~
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:13:16: note:   deduced conflicting types for parameter 'const _Tp' ('long unsigned int' and 'int64_t' {aka 'long int'})
   13 |       res = min( res, j);
      |             ~~~^~~~~~~~~
/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:13:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'long unsigned int'
   13 |       res = min( res, j);
      |             ~~~^~~~~~~~~
Language: C++

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

int main() {
  int n;
  cin >> n;
  vector<int> soinsu;
  for(int i=2; i<pow(10,6)/*wakaran*/; ++i){
    if(n%i==0){
      soinsu.push_back(i);
      n /= i;
    }
    else if(n<i){
      break;
    }
  }
  soinsu.reverse(soinsu.begin(), soinsu.end());
  int a=1, b=1;
  for(int i=0; i<soinsu.size(); ++i){
    if(i%2==0)
      a *= soinsu[i];
    else
      b*=soinsu[i];
  }
  cout << (a-1)+(b-1) << endl;
  return;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:10: error: 'class std::vector<int>' has no member named 'reverse'; did you mean 'reserve'?
   18 |   soinsu.reverse(soinsu.begin(), soinsu.end());
      |          ^~~~~~~
      |          reserve
a.cc:27:3: error: return-statement with no value, in function returning 'int' [-fpermissive]
   27 |   return;
      |   ^~~~~~
Language: C++

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

int main() {
  int n;
  cin >> n;
  vector<int> soinsu;
  for(int i=2; i<pow(10,6)/*wakaran*/; ++i){
    if(n%i==0){
      soinsu.push_back(i);
      n /= i;
    }
    else if(n<i){
      break;
    }
  }
  soinsu.reverse(soinsu.begin(), soinsu.end());
  int a=1, b=1;
  for(int i=0; i<soinsu.size(); ++i){
    if(i%2==0)
      a *= soinsu[i];
    else
      b*=soinsu[i];
  }
  cout << (a-1)+(b-1) << endl;
  return;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:10: error: 'class std::vector<int>' has no member named 'reverse'; did you mean 'reserve'?
   17 |   soinsu.reverse(soinsu.begin(), soinsu.end());
      |          ^~~~~~~
      |          reserve
a.cc:26:3: error: return-statement with no value, in function returning 'int' [-fpermissive]
   26 |   return;
      |   ^~~~~~
Language: C++

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

int main() {

    int i, N, A, B, S;

    cin >> N;
    S = N + 1;

    for (i = 1; i <= sqrt(N) N; i++) {
        if (N % i == 0) {
            A = i;
            B = N / i;
            if (A + B < S) {
                S = A + B;
            }
        }
    }
    cout << S-2 << endl;
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:29: error: expected ';' before 'N'
   12 |     for (i = 1; i <= sqrt(N) N; i++) {
      |                             ^~
      |                             ;
a.cc:12:31: error: expected ')' before ';' token
   12 |     for (i = 1; i <= sqrt(N) N; i++) {
      |         ~                     ^
      |                               )
a.cc:12:36: error: expected ';' before ')' token
   12 |     for (i = 1; i <= sqrt(N) N; i++) {
      |                                    ^
      |                                    ;
Language: C++

#include <iostream>
using namespace std;

int main() {

	int i, N, A, B, S;

	cin >> N;
	S = N+1;

	for(i=1, i<=N, i++){
	    if(N%i==0){
	        A = i;
	        B = N/i;
	        if (A+B<S){
	            S = A + B;
	        }
	    }

	cout << S-2 << endl;

	return 0;


}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:27: error: expected ';' before ')' token
   11 |         for(i=1, i<=N, i++){
      |                           ^
      |                           ;
a.cc:25:2: error: expected primary-expression at end of input
   25 | }
      |  ^
a.cc:25:2: error: expected ';' at end of input
   25 | }
      |  ^
      |  ;
a.cc:25:2: error: expected primary-expression at end of input
a.cc:25:2: error: expected ')' at end of input
   25 | }
      |  ^
      |  )
a.cc:11:12: note: to match this '('
   11 |         for(i=1, i<=N, i++){
      |            ^
a.cc:25:2: error: expected statement at end of input
   25 | }
      |  ^
a.cc:25:2: error: expected '}' at end of input
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
	long long n;cin>>n;
    ll ans=1e18;
  for(ll i=1;i*i<=n;i++){
    if(n%i==0){
    	ans=min(ans,i+n/i-2);
       
    }
    cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:5: error: 'll' was not declared in this scope
    5 |     ll ans=1e18;
      |     ^~
a.cc:6:9: error: expected ';' before 'i'
    6 |   for(ll i=1;i*i<=n;i++){
      |         ^~
      |         ;
a.cc:6:14: error: 'i' was not declared in this scope
    6 |   for(ll i=1;i*i<=n;i++){
      |              ^
a.cc:8:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
    8 |         ans=min(ans,i+n/i-2);
      |         ^~~
      |         abs
a.cc:11:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   11 |     cout<<ans<<endl;
      |           ^~~
      |           abs
a.cc:12:2: error: expected '}' at end of input
   12 | }
      |  ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^