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

#include <iostream>
#include <math.h>
using namespace std;
int main()
{
  long long int n;
  long long int a = sqrt(n);
  lonh long int i;
  for(i=a;;i--)
  {
    if(n%i==0)
      break;
  }
  cout<<(i+(n/i)-2);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: 'lonh' was not declared in this scope; did you mean 'long'?
    8 |   lonh long int i;
      |   ^~~~
      |   long
a.cc:9:7: error: 'i' was not declared in this scope
    9 |   for(i=a;;i--)
      |       ^
a.cc:14:10: error: 'i' was not declared in this scope
   14 |   cout<<(i+(n/i)-2);
      |          ^
Language: C++

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

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

Compiler output:
a.cc:3:21: error: expected ';' before ':' token
    3 | using ll = long long:
      |                     ^
      |                     ;
Language: Java

import java.util.*;
import java.lang.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		long NN = sc.nextLong();
		long a = 0;
		long b = 0; 
		String S = String.valueOf(NN);
		int R = S.length()/2+S.lenth()%2;
		if( R<3 ){
			R = S.length();
		}    
		if( NN==1000000000000L ){
			R = 6;          
        }          
		long c = 1;
		for( int i=0; i<R; i++ ){
			c = c*10;
		}
		for( int i=1; i<=c; i++ ){
			a++;
			b = NN/a;
			if( a>=b && NN%a==0 ){
				break;
			}
			if( i==c ){
				a = NN;
				b = 1;
			}
		}
		System.out.println((a-1)+(b-1));
	}
}


Compiler output:
Main.java:11: error: cannot find symbol
		int R = S.length()/2+S.lenth()%2;
		                      ^
  symbol:   method lenth()
  location: variable S of type String
1 error
Language: C

#include<stdio.h>
int main(void){
  long int N,min;
   scanf("%ld\n",&N);
    min=N;
  for(int a=1;a*a<=N;n++){
      if(N%a==0&&a+N/a-2<min){
        min=N/a+a-2;
      }
  }
  printf("%ld\n",min);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:6:22: error: 'n' undeclared (first use in this function)
    6 |   for(int a=1;a*a<=N;n++){
      |                      ^
main.c:6:22: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

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

int main() {
  int N, i, j, k;
  cin>>N;
  int F[N];
  int G[N];
  k=0;
  for(i=1;i<N;i++){
    if(N%i==0){
      k++;
      F[k]=i;
      G[k]=(N/i);
      
    }
  }
  for(j=1;j<=k;j++){
    if(fabs(F[j]-G[j])<=fabs(F[j+1]-G[j+1])){
      printf("%d",(f[j]+G[j]-2));
      break;
    }
  }
       
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:20: error: 'f' was not declared in this scope
   20 |       printf("%d",(f[j]+G[j]-2));
      |                    ^
Language: C++

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

int main() {
  int N, i, j, k;
  cin>>N;
  int F[N];
  int G[N];
  k=0;
  for(i=1;i<N;i++){
    if(N%i==0){
      k++;
      F[k]=i;
      G[k]=(N/i);
      
    }
  }
  for(j=1;j<=k;j++){
    if(fabs(F[j]-G[j])<=fabs(F[j+1]-G[j+1]){
      printf("%d",(f[j]+G[j]-2));
      break;
    }
       }
       
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:44: error: expected ')' before '{' token
   19 |     if(fabs(F[j]-G[j])<=fabs(F[j+1]-G[j+1]){
      |       ~                                    ^
      |                                            )
a.cc:23:8: error: expected primary-expression before '}' token
   23 |        }
      |        ^
Language: C

#include<stdio.h>
int main(void){
  long int N,min;
   scanf("%ld\n",&N);
    min=N;
  for(int a=1;a*a<=N;n++){
      if(N%a==0&&a+N/a<min){
        min=N/a+a;
      }
  }
  printf("%ld\n",min);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:6:22: error: 'n' undeclared (first use in this function)
    6 |   for(int a=1;a*a<=N;n++){
      |                      ^
main.c:6:22: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

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

int f(int64_t N,int64_t i)
{
  int64_t answer=N-1;
  if(i==N)
    return answer;
  if(N%i==0)
  {
    answer=min(i*(N/i)+1,answer);
    return answer;
  }
  return f(N,i+1)
}

int main()
{
  int64_t N;
  cin >> N;
  cout << f(N,N) << endl;
}

Compiler output:
a.cc: In function 'int f(int64_t, int64_t)':
a.cc:14:18: error: expected ';' before '}' token
   14 |   return f(N,i+1)
      |                  ^
      |                  ;
   15 | }
      | ~
Language: Java

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

    long b = Long.MAX_VALUE /2;
    long c = Long.MAX_VALUE /2;
    List<Long> list = factorization(a);
    for (long i : list) {
        if((a/i + i) < (b + c) ){
          b = a/i;
          c = i;
        }
    }
    System.out.println(b + c -2);
  }

  static List<Long> factorization(long x) {
    List<Long> result = new ArrayList<>();

    while (x >= 4 && x % 2 == 0) {
        result.add(2);
        x /= 2;
    }
    long d = 3;
    long q = x / d;
    while (q >= d) {
        if (x % d == 0) {
            result.add(d);
            x = q;
        } else {
            d += 2;
        }
        q = x / d;
    }
    result.add(x);
    return result;
  }
}

Compiler output:
Main.java:23: error: incompatible types: int cannot be converted to Long
        result.add(2);
                   ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
1 error
Language: C

#include<iostream>
using namespace std;
int main()
{
	long long int a;
	long long int b = 0, c = 0;
	cin >> a;
	for (long long int i = 2; i*i < a; i++)
	{
		if (a%i == 0)
		{
			b = i;
			c = 1;
		}
	}
	if (c == 0)
	{
		cout << a - 1;
	}
	else if (c == 1)
	{
		cout << b + a / b - 2;
	}
}

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

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		int[] a = new int[n];
		int k = 0;
		
		for(int i = 1; i <= n/2; i++) {
			if(n%i == 0) {
				int b = n/i; //商
				a[k] = compare(i,b);
				k++;
			}

		}

		int min = Integer.MAX_VALUE;
		
		List<Integer> list = new ArrayList<Integer>(Arrays.asList(a));
		list.remove(0);
		
		for(int i = 0; i < a.length; i++) {
			if(min > a[i]) {
				min = a[i];
			}
		}
		System.out.println(min);

	}
	static int compare(int a, int b) {  //移動回数の合計を出すメソッド
		int count = 0;
		count += a-1;
		count += b-1;
		return count;
	}


}


Compiler output:
Main.java:24: error: no suitable constructor found for ArrayList(List<int[]>)
		List<Integer> list = new ArrayList<Integer>(Arrays.asList(a));
		                     ^
    constructor ArrayList.ArrayList(int) is not applicable
      (argument mismatch; no instance(s) of type variable(s) T exist so that List<T> conforms to int)
    constructor ArrayList.ArrayList(Collection<? extends Integer>) is not applicable
      (argument mismatch; inference variable T has incompatible bounds
          upper bounds: Integer,Object
          lower bounds: int[])
  where T is a type-variable:
    T extends Object declared in method <T>asList(T...)
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
1 error
Language: C++

#include<iostream>
using namespace std;

int main(){
    int N;
    cin>>N;
    int A,B;
    int min=INT_MAX;
    for(int i=1;i<=N;i++){
        if(N%i==0){
            if(abs(i-(N/i))<min){
                min=abs(i-(N/i));
                A=i;
                B=(N/i);
            }
        }
    }
    cout<<A+B-2<<endl;
    return 0;
}

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

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

int f(int64_t N,int64_t i)
{
  int64_t answer=N-1;
  if(i==N)
    return answer;
  if(N%i==0)
  {
    answer=min(i*(N/i)+1,answer);
    return answer;
  }
  return f(N,i+1)
}

int main()
{
  int64_t N;
  cin >> N;
  cout << f(N) << endl;
}

Compiler output:
a.cc: In function 'int f(int64_t, int64_t)':
a.cc:14:18: error: expected ';' before '}' token
   14 |   return f(N,i+1)
      |                  ^
      |                  ;
   15 | }
      | ~                 
a.cc: In function 'int main()':
a.cc:21:12: error: too few arguments to function 'int f(int64_t, int64_t)'
   21 |   cout << f(N) << endl;
      |           ~^~~
a.cc:4:5: note: declared here
    4 | int f(int64_t N,int64_t i)
      |     ^
Language: C

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

#define x 1000000000001

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

int main(void) {

	unsigned long long int a[x][x]={{0}};
	unsigned long long int b[x]={0};
	unsigned long long int n,i,j,left,right, m=0,cent;

	scanf("%lld", &n);
	for(i=1;i<n+1;i++){
		for(j=1;j<n+1;j++){
			a[i][j]=i*j;
		}
	}

	for(i=1;i<n+1;i++){
		left =1;
		right = n;

		while(1){
			cent =(left+right)/2;

			if(n==a[i][cent]){
				b[m]=i+cent-2;
				m++;
				break;
			}

			if(n > a[i][cent]){
				left = cent+1;
			}else{
				right =cent-1;
			}
			if(left>=right){
				break;
			}
		}
	}

	qsort(b,m,sizeof(long long int),compare_int);
	printf("%lld",b[0]);
	return EXIT_SUCCESS;
}


Compiler output:
main.c: In function 'main':
main.c:12:32: error: size of array 'a' exceeds maximum object size '9223372036854775807'
   12 |         unsigned long long int a[x][x]={{0}};
      |                                ^
Language: C++

//ABC144
#include<iostream>
#include<bits/stdc++.h>
#include<string>
using namespace std;
int main()
{
  int a,b ;
  cin >> a >> b  ;
  
  if(a<=9 && b <=9){
    cout << a*b << endl ;
  }else{
    cout << -1 << endl ;
  }
  return 0 ;
}

//B
#include<iostream>
#include<bits/stdc++.h>
#include<string>
using namespace std;
int main()
{
  int n ;
  cin >> n  ;

  for(int i=1;i<=9;i++){
    for(int j=1;j<=9;j++){
      if((i*j)==n){
        cout << "Yes" << endl ;
        return 0 ;
      }
    }
  }  

  cout << "No" << endl ;
  return 0 ;
}

//
//C
#include<iostream>
#include<bits/stdc++.h>
#include<string>
using namespace std;
int main()
{
  int n ;
  cin >> n  ;
  
  int cnt ;
  int walk = (n-1) ;
  
  
  for(int i=1;i<=n;i++){
    if(n%2==0 && i%2==0) continue ;
    if(n%2!=0 && i%2!=0) continue ;
    
    for(int j=1;j<=n;j++){
      if(n==i*j){
        cnt = (i-1)+(j-1) ;
        if(cnt<walk){
          walk = cnt ;
        }
      }
    }
  }  
  
  cout << walk << endl ;
  return 0 ;
}





Compiler output:
a.cc:24:5: error: redefinition of 'int main()'
   24 | int main()
      |     ^~~~
a.cc:6:5: note: 'int main()' previously defined here
    6 | int main()
      |     ^~~~
a.cc:48:5: error: redefinition of 'int main()'
   48 | int main()
      |     ^~~~
a.cc:6:5: note: 'int main()' previously defined here
    6 | int main()
      |     ^~~~
Language: C

#include<iostream>
using namespace std;
int main()
{
	long long int a;
	long long int b = 0, c = 0;
	cin >> a;
	for (int i = 2; i*i < a; i++)
	{
		if (a%i == 0)
		{
			b = i;
			c = 1;
		}
	}
	if (c == 0)
	{
		printf("%d", a - 1);
	}
	else if (c == 1)
	{
		printf("%d", b + a / b - 2);
	}
	system("pause");
}

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

#include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define debug(x) cerr << #x << ": " << x << '\n'
#define INF 999999999
typedef long long int Int;
typedef pair<int,int> P;
using ll = long long;
using VI = vector<int>;
map< int64_t, Int > prime_factor(int64_t n) {
  map< int64_t, Int > ret;
  for(int64_t i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}//素因数分解

int main(){
  Int n;cin >> n;
  pair<Int,Int> a;//left,right
  map<Int,Int> mp = prime_factor(n);
  vector<Int> insu;
  for(auto &i:mp) insu.push_back(i.first*i.second);
  sort(insu.rbegin(),insu.rend());
  Int l = insu[0];
  Int r = n/l;
  Int ans = l+r;
  if(l==1) ans--;
  if(r==1) ans--;
  cout << ans << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:33: error: conversion from 'map<long int,[...]>' to non-scalar type 'map<long long int,[...]>' requested
   28 |   map<Int,Int> mp = prime_factor(n);
      |                     ~~~~~~~~~~~~^~~
Language: C

#include<stdio.h>
int main(void){
  long int N,min;
  int a[1000000000000]={0},pn=0,i=2;
   scanf("%ld\n",&N);
  min=N;
   while(i<=N){
     if(N%i==0){
       a[pn++]=i;
       N=N/i;
   }
     else
       i++;
   }
  for(i=1;i<=pn;i++){
    if(a[i]+N/a[i]<min)
        min=a[i]-2+N/a[i];
    }
  }
  printf("%ld\n",min);
  return 0;
}

Compiler output:
main.c:20:10: error: expected declaration specifiers or '...' before string constant
   20 |   printf("%ld\n",min);
      |          ^~~~~~~
main.c:20:18: error: unknown type name 'min'
   20 |   printf("%ld\n",min);
      |                  ^~~
main.c:21:3: error: expected identifier or '(' before 'return'
   21 |   return 0;
      |   ^~~~~~
main.c:22:1: error: expected identifier or '(' before '}' token
   22 | }
      | ^
Language: C++

#include <iostream>
#include <math.h>

int main(void){
  long int N;
  std::cin >>N ;
  long int min=N-1;
  long int prod=1;
  for (long int i = 2; i <= sqrt(N); i++){ 
      N /= i;
      prod = prod * i;
      if(min > (prod-1) + (N-1)) min = (prod-1) + (N-1);
    }
  }
  std::cout << min;
  return 0;
}


Compiler output:
a.cc:15:8: error: 'cout' in namespace 'std' does not name a type
   15 |   std::cout << min;
      |        ^~~~
In file included from a.cc:1:
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:16:3: error: expected unqualified-id before 'return'
   16 |   return 0;
      |   ^~~~~~
a.cc:17:1: error: expected declaration before '}' token
   17 | }
      | ^
Language: C++

import math
import itertools
n = int(input())
L=[1]
for i in range(2, int(math.sqrt(n))+3):
    while n%i==0:
        L.append(i)
        n = n/i

if(len(L)==1):
    L.append(n)

a, b=1,1
for i in range(len(L)-1, -1,-1):
    if(i%2==0):
        a*=L[i]
    else:
        b*=L[i]
print(a+b-2)

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import math
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

int main(){
  int N,a,b,i,d,n;
  scanf("%ld",&N);
  d=N;
  int c;
  for(i=1;i<=N;++i){
  a=N%i;
    if(a==0){
      b=N/i;
      c=labs(b+i-2);
      if(d>=c){
      d=c;
    }
      }
  }
 
  printf("%ld\n",d);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:3:3: error: 'scanf' was not declared in this scope
    3 |   scanf("%ld",&N);
      |   ^~~~~
a.cc:10:9: error: 'labs' was not declared in this scope
   10 |       c=labs(b+i-2);
      |         ^~~~
a.cc:17:3: error: 'printf' was not declared in this scope
   17 |   printf("%ld\n",d);
      |   ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | int main(){
Language: C++

int main(){
  int N,a,b,i,d,n;
  scanf("%d",&N);
  d=N;
  int c;
  for(i=1;i<=N;++i){
  a=N%i;
    if(a==0){
      b=N/i;
      c=labs(b+i-2);
      if(d>=c){
      d=c;
    }
      }
  }
 
  printf("%d\n",d);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:3:3: error: 'scanf' was not declared in this scope
    3 |   scanf("%d",&N);
      |   ^~~~~
a.cc:10:9: error: 'labs' was not declared in this scope
   10 |       c=labs(b+i-2);
      |         ^~~~
a.cc:17:3: error: 'printf' was not declared in this scope
   17 |   printf("%d\n",d);
      |   ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | int main(){
Language: C++

int main(){
  int N,a,b,i,d,n;
  scanf("%d",&N);
  d=N;
  int c;
  for(i=1;i<=N;++i){
  a=N%i;
    if(a==0){
      b=N/i;
      c=abs(b+i-2);
      if(d>=c){
      d=c;
    }
      }
  }
 
  printf("%d\n",d);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:3: error: 'scanf' was not declared in this scope
    3 |   scanf("%d",&N);
      |   ^~~~~
a.cc:10:9: error: 'abs' was not declared in this scope
   10 |       c=abs(b+i-2);
      |         ^~~
a.cc:17:3: error: 'printf' was not declared in this scope
   17 |   printf("%d\n",d);
      |   ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | int main(){
Language: C++

#include<iostream>
using namespace std;

int main(){
	double n,a,i,b,dis;

	cin >> n;

	for(i=0;i>=0;i++){
		a=n/i;
		b=n%i;
		if(b==0){
			break;
		}
	}

	dis=(a-1)+(i-1);
	cout << dis << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:20: error: invalid operands of types 'double' and 'double' to binary 'operator%'
   11 |                 b=n%i;
      |                   ~^~
      |                   | |
      |                   | double
      |                   double
Language: C++

#include <iostream>
#include <math.h>
using namespace std;
 
int main() {
    int N;
    cin >> N;
    int result = 0;
  int a = 0;
  for(a = 0;(a + 1) * (a + 1) < N;a += 1){};
    for(a = a;;a > 0;a -= 1){
    
      if(N % a == 0){
        
        result = a + (N / a) - 2;
        break;
      };
      
    };
  
    cout << result << endl;
};

Compiler output:
a.cc: In function 'int main()':
a.cc:11:21: error: expected ')' before ';' token
   11 |     for(a = a;;a > 0;a -= 1){
      |        ~            ^
      |                     )
a.cc:11:28: error: expected ';' before ')' token
   11 |     for(a = a;;a > 0;a -= 1){
      |                            ^
      |                            ;
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<cstring>
#include<cmath>
#include<math.h>
#include <cmath>
#include <limits>
#define ll long long
#define M 1000000
#define pi 3.141592653
using namespace std;

int main() {
    ll N;
    cin >> N;
    bool flag = 0;
    ll min = N;
    for(int i = 1; i * i <= N; i++){
        if(N % i == 0){
            min = i + N / i;
        }
    }

    cout << min(N - 1,min) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:16: error: 'min' cannot be used as a function
   25 |     cout << min(N - 1,min) << endl;
      |             ~~~^~~~~~~~~~~
Language: C

#include<stdio.h>

int main() {
    int x,y,z;
    int ans,tmp,ans2;
    int i = 1;
    scanf("%d",&x);
    while (1) {
        y = x % i;
        if (y==0){
            z = x / i;
            tmp = ans;
            ans = (i + z) - 2;
            if (ans <= tmp) {
                ans2 = ans
            }
            
        }
        if (i==x) {
            break;
        }
        
        i++;
    }
    printf("%d",ans2);
}

Compiler output:
main.c: In function 'main':
main.c:15:27: error: expected ';' before '}' token
   15 |                 ans2 = ans
      |                           ^
      |                           ;
   16 |             }
      |             ~
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<cstring>
#include<cmath>
#include<math.h>
#include <cmath>
#include <limits>
#define ll long long
#define M 1000000
#define pi 3.141592653
using namespace std;

int main() {
    ll N;
    cin >> N;
    bool flag = 0;
    ll min = N;
    for(int i = 1; i * i <= N; i++){
        if(N % i == 0){
            min = i + N / i;
        }
    }

    cout << min(N - 1; min) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:22: error: expected ')' before ';' token
   25 |     cout << min(N - 1; min) << endl;
      |                ~     ^
      |                      )
a.cc:25:27: error: expected ';' before ')' token
   25 |     cout << min(N - 1; min) << endl;
      |                           ^
      |                           ;
Language: C++

#include<iostream>
#include<vector>
#include <string>
#include <algorithm>
#include <functional>
using namespace std;

int main(){
	long long N;
	long long A;
	bool is = false;
	
	A = 1000000000000;

	cin >> N;

	for (long long i = sqrt(N); i >= 1; i--){
		if (N % i == 0){
			long long tmp = N / i;
			if (A > i + tmp){
				A = (i - 1) + (tmp - 1);
				is = true;
			}
		}
	}
	
	cout << A << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:28: error: 'sqrt' was not declared in this scope
   17 |         for (long long i = sqrt(N); i >= 1; i--){
      |                            ^~~~
Language: C++

#include <iostream>
#include <vector>

using namespace std;

long long int N;

vector<pair<long long int,int>> decompose(long long int number) {
    vector<pair<long long int,int>> results;

    for (long long int i = 2; i*i <= number; i++) {
        int count = 0;
        while (number % i == 0) {
            count++;
            number /= i;
        }

        if (count)
            results.push_back(make_pair(i, count));
    }

    if (number != 1)
        results.push_back(make_pair(number, 1));

    return results;
}

long long int power(long long int base, int times) {

    if (times == 0)
        return 1;

    if (times == 1)
        return base;

    long long int half = power(base, times/2);

    if (times % 2)
        return half*half*base;
    else
        return half*half;
    
}


long long int minimum;

void find (long long int multi, int index, vector<pair<long long int,int>>& elements) {

    if (index == elements.size()) {
        long long int value = multi + (N/multi);
        if (value < minimum)
            minimum = value;
        return; 
    }

    auto element = elements[index];
    for (int num = 0; num <= element.second; num++) {
        long long int value = power(element.first, num);
        find(multi*value, index+1, elements);
    }
}

int main(){
   
    cin >> N;

    auto elements = decompose(N);

    minimum = LLONG_MAX; 

    find((long long int)1, 0, elements);
    
    cout << minimum-2 << "\n";

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:70:15: error: 'LLONG_MAX' was not declared in this scope
   70 |     minimum = LLONG_MAX;
      |               ^~~~~~~~~
a.cc:3:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <vector>
  +++ |+#include <climits>
    3 |
Language: Java

import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int r[]= new int[N];
		int moda =0;
			for(int a = 2;a<=Math.sqrt(N);a++) {
					if(N%a==0) {
					 moda = N/a;
						for(int b = 0;b<N;b++) {
							r[b]=a+moda-2;
						}
					}
			}
			Arrays.sort(r);
			System.out.println(r[0]);
	}
}
vimport java.util.Arrays;
import java.util.Scanner;

public class abc144c {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int r[]= new int[N];
		int moda =0;
			for(int a = 2;a<=Math.sqrt(N);a++) {
					if(N%a==0) {
					 moda = N/a;
						for(int b = 0;b<N;b++) {
							r[b]=a+moda-2;
						}
					}
			}
			Arrays.sort(r);
			System.out.println(r[0]);
	}
}


Compiler output:
Main.java:23: error: class, interface, enum, or record expected
vimport java.util.Arrays;
^
Main.java:24: error: class, interface, enum, or record expected
import java.util.Scanner;
^
2 errors
Language: C++

#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<tuple>
#include<map>
#include<queue>
#define rep(i, n) rep2(i,0,n)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
using namespace std;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:17:18: error: 'sqrt' was not declared in this scope
   17 |         rep2(i,1,sqrt(n)) {
      |                  ^~~~
a.cc:9:51: note: in definition of macro 'rep2'
    9 | #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
      |                                                   ^
Language: C

#include<stdio.h>
 
int main(){
  int n,i,j,sum=9;
  scanf("%d",&n);

  r=j-i;
  
  for(i=1; i<=n/2; i++){
    for(j=1; j<=n; j++){
 if(n=i*j && sum>i-1+j-1)
   sum=i-1+j-1;
    }
  }
  printf("%d",sum);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:7:3: error: 'r' undeclared (first use in this function)
    7 |   r=j-i;
      |   ^
main.c:7:3: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

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

int main()
{
  int N;
  cin>>N;
  a=(int)sqrt(N);
  int b;
  while(a>=1)
  {
    if(N%a==0)
    {
      b=N/a;
      break;
    }
    a--;
  }
  cout<<a+b-2<<endl;
  return 0;
}

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

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

int main()
{
  int n;
  cin >> n;
  int b = n;
  int a = 1;
  for(int i=2; i<b; i++){
    while((b % i) == 0;){
      a *= i;
      b /= i;
    }
  }
  int ans = a + b - 2;
  
  cout << ans << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:23: error: expected ')' before ';' token
   11 |     while((b % i) == 0;){
      |          ~            ^
      |                       )
a.cc:11:24: error: expected primary-expression before ')' token
   11 |     while((b % i) == 0;){
      |                        ^
Language: Java

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

    long b = Long.MAX_VALUE /2;
    long c = Long.MAX_VALUE /2;
    for(long i = (a-1)2; i > 0; i--){
      if(a % i == 0){
        if((a/i + i) < (b + c) ){
          b = a/i;
          c = i;
        }
      }
    }
    System.out.println(b + c -2);
  }
}


Compiler output:
Main.java:9: error: ';' expected
    for(long i = (a-1)2; i > 0; i--){
                      ^
Main.java:9: error: not a statement
    for(long i = (a-1)2; i > 0; i--){
                           ^
Main.java:9: error: ')' expected
    for(long i = (a-1)2; i > 0; i--){
                              ^
Main.java:9: error: ';' expected
    for(long i = (a-1)2; i > 0; i--){
                                   ^
4 errors
Language: C++


#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0; (i)<(n); (i)++)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define ll long long
#define pii pair<int,int> 
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
const int INF = 1001001001;
//int 2×10の9乗
//vector<vector<int>> a(n, vector<int>(m));
  //rep(i,n) rep(j,m) cin >> a[i][j]; 
//cout << fixed << setprecision(10);
//int gcd(int x, int y){
  //if(y==0) return x;
  //return gcd(y, x%y);
//}
//sort小さい順(昇順)
//g++ code.cpp   ./a.out 
int main(){
  ll n, ans=0;
  cin >> n;
  for(int i=1; i<n; i++){
    for(int j=i; j<n; j++){
      if(i*j==n){
        ans += i+j-2;
      }
      break;
    }
    ans = min(INF, ans);
  }
  cout << ans << endl;
}


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

#include <iostream>
using namespace std;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:8:17: error: 'sqrt' was not declared in this scope
    8 |   long long m = sqrt(n);
      |                 ^~~~
Language: C++

#include <iostream>
#include <string>
#include <vector>
using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i <= (n); ++i)
typedef long long ll;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N;
	cin >> N;
	int *arr = (int *)malloc(sizeof(int) * N);
	rep(i, N) arr[i] = 0;
	ll arr_size = 0;
	rep1(i, sqrt(N)) rep1(j, N - (i - 1)) {
		if (i * j == N) {
			arr[arr_size++] = i;
			break;
		}
	}
	ll min = N;
	rep(i, arr_size) {
		ll tmp = arr[i] - 1 + N / arr[i] - 1;
		if (tmp < min) min = tmp;
	}
	free(arr);
	cout << min << "\n";
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:17: error: 'sqrt' was not declared in this scope
   18 |         rep1(i, sqrt(N)) rep1(j, N - (i - 1)) {
      |                 ^~~~
a.cc:7:42: note: in definition of macro 'rep1'
    7 | #define rep1(i, n) for (int i = 1; i <= (n); ++i)
      |                                          ^
Language: C

#include <stdio.h>
int kaijo(int x){
  int M=1, i;
  if(x==0){
    return 1;
  }else{
  	for(i=1:i<=M;i++){
    	M=M*i;
  	}
  return M;
  }
}

int main(void){
  int N, i, j, k, l, min, a[1000000000001], b[1000000000001];
  scanf("%d", &N);
  for(i=1;i<=N;i++){
    a[i] = N/(i);
  }
  for(j=1;j<=N;j++){
    b[j]=(kaijo(a[j]+j))/(kaijo(a[j])*kaijo(j));
  }
  min = b[1];
  for(k=1;k<=N;k++){
    for(l=k+1;l<=N;l++){
      if(b[l]<=b[k]){
        min = b[l];
      }
    }
  }
  printf("%d", min);
}
  
    

Compiler output:
main.c: In function 'kaijo':
main.c:7:16: error: expected ';' before ':' token
    7 |         for(i=1:i<=M;i++){
      |                ^
      |                ;
main.c:7:25: error: expected ';' before ')' token
    7 |         for(i=1:i<=M;i++){
      |                         ^
      |                         ;
Language: Java

import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    long a = 1000000000000;
    long b = 1000000000000;
    for(int i = 1;i < N;i++){
      for(int j = 1;j < N;j++){
        if(N == i * j){
          if(i + j < a + b){
            a = i;
            b = j;
          }
        }
      }
    }
    System.out.println(a + b - 2);

  }
}


Compiler output:
Main.java:7: error: integer number too large
    long a = 1000000000000;
             ^
Main.java:8: error: integer number too large
    long b = 1000000000000;
             ^
2 errors
Language: C++

#include <bits/stdc++.h>

using namespace std;

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


Compiler output:
a.cc: In function 'int main()':
a.cc:10:17: error: invalid operands of types 'double' and 'int' to binary 'operator%'
   10 |     if((double)n%i==0){
      |        ~~~~~~~~~^~
      |        |         |
      |        double    int
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;
int main()
{
	long long n;
	cin >> n;
	long long  min = LLONG_MAX;
	
	for (int i = 1; i <= sqrt(n); i++) {
		
		if (n % i == 0) {
			long long  k;
			k = n / i;

			if (((i - 1) + (k - 1) < min))  min = (i - 1) + (k - 1);
			//cout << (i - 1) << " " << (k - 1) << endl;
		}
	}

	cout << min << endl;

	
}



Compiler output:
a.cc: In function 'int main()':
a.cc:9:26: error: 'LLONG_MAX' was not declared in this scope
    9 |         long long  min = LLONG_MAX;
      |                          ^~~~~~~~~
a.cc:3:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <algorithm>
  +++ |+#include <climits>
    3 | 
a.cc:11:30: error: 'sqrt' was not declared in this scope
   11 |         for (int i = 1; i <= sqrt(n); i++) {
      |                              ^~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

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


Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: invalid operands of types 'double' and 'int' to binary 'operator%'
   10 |     if(n%i==0){
      |        ~^~
      |        | |
      |        | int
      |        double
Language: C

/******************************************************************************

Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby, 
C#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS
Code, Compile, Run and Debug online from anywhere in world.

*******************************************************************************/
#include <stdio.h>
int  main()
{  long long int  i,ans;
    long long int  n,temp,temp1;
    scanf ("%lld",&n);
    for (i=2;i<=n;i++)
    {
        if (n%i==0)
        {
            temp=i;
            temp1=n/i;
            if (i==2)
            ans=temp+temp1-2;
            else if ((temp+temp1-2)<ans)
            ans=temp+temp1-2;
        }
    }
    
    printf ("%lld",ans);
}
/******************************************************************************

Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby, 
C#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS
Code, Compile, Run and Debug online from anywhere in world.

*******************************************************************************/
#include <stdio.h>
int  main()
{  long long int  i,ans;
    long long int  n,temp,temp1;
    scanf ("%lld",&n);
    for (i=2;i<=n;i++)
    {
        if (n%i==0)
        {
            temp=i;
            temp1=n/i;
            if (i==2)
            ans=temp+temp1-2;
            else if ((temp+temp1-2)<ans)
            ans=temp+temp1-2;
        }
    }
    
    printf ("%lld",ans);
}


Compiler output:
main.c:38:6: error: redefinition of 'main'
   38 | int  main()
      |      ^~~~
main.c:10:6: note: previous definition of 'main' with type 'int()'
   10 | int  main()
      |      ^~~~
Language: C++

#include"bits/stdc++.h"
using namespace std;
bool a[100000000010];
long long n,m;
void solve(bool a[]){
	memset(a,false,sizeof(a));
	for(int i=2;i<=sqrt(n);i++){
		if(a[i])continue;
		else {
			for(int j=i*i;j<=n;j+=i){
				a[j]=true;
			}
		}
	}
} 
int main(){
	cin>>n;
	m=sqrt(n);
	solve(a);
	if(a[n]){
		for(int i=m;i<n;i++){
			if(n%i==0){
				cout<<i-1+(n/i)-1<<endl;
				return 0;
			}
		}
	}else{
		printf("%lld\n",n-1);
	}
}

Compiler output:
a.cc: In function 'void solve(bool*)':
a.cc:6:31: warning: 'sizeof' on array function parameter 'a' will return size of 'bool*' [-Wsizeof-array-argument]
    6 |         memset(a,false,sizeof(a));
      |                              ~^~
a.cc:5:17: note: declared here
    5 | void solve(bool a[]){
      |            ~~~~~^~~
/tmp/ccvu3UtV.o: in function `solve(bool*)':
a.cc:(.text+0x69): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccvu3UtV.o
a.cc:(.text+0x8a): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccvu3UtV.o
/tmp/ccvu3UtV.o: in function `main':
a.cc:(.text+0xbf): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccvu3UtV.o
a.cc:(.text+0xd8): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccvu3UtV.o
a.cc:(.text+0xec): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccvu3UtV.o
a.cc:(.text+0x102): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccvu3UtV.o
a.cc:(.text+0x11c): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccvu3UtV.o
a.cc:(.text+0x128): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccvu3UtV.o
a.cc:(.text+0x14e): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccvu3UtV.o
a.cc:(.text+0x19c): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccvu3UtV.o
a.cc:(.text+0x1aa): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <math.h>

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define repP(i, a, b) for(int i = a; i < b; i++)
#define repM(i, a, b) for(int i = a - 1; i >= b; i--)

using namespace std;

int main()
{
  long a = 0 , b = 0, c = 0, d = 0, e = 0, f = 0, i = 0, j = 0;
  long num = 0, count = 0, ans = 0, min = 9999999999999;
  double d1 = 0, d2 = 0, d3 = 0, d4 = 0, d5 = 0, d6 = 0;
  long a1[40000000], a2[40000000], a3[40000000];
  //char s1[200000], s2[200000], s3[200000];
  //string s1, s2, s3;
  
  cin >> a;
  
   for(i = 1; i <= a; i++){
    if( num % i == 0 ){
      a1[b] = num % i;
      b++;
    }
  }
  if(b % 2 == 0){
    for(i = 0; i < b / 2; i++){
      c = a1[i] + a1[b - i];
      if(min >= c){
        min = c;
      }
    }
    c = a1[i] * 2;
    if(min >= c){
      min = c;
    }
  }else if{
    for(i = 0; i < b / 2; i++){
      c = a1[i] + a1[b - i];
      if(min >= c){
        min = c;
      }
    }
    cout << min << endl;
   }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:50:11: error: expected '(' before '{' token
   50 |   }else if{
      |           ^
      |           (
Language: C++

#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
	long long N;
	cin >> N;

	vector<long long> h;

	long long Nsqrt = ceil(sqrt(N));
	for (long long i = 1; i < Nsqrt; i++) {
		if (N % i == 0) {
			h.emplace_back(i);
		}
	}
	long long hoge = h.back();
	if (hoge != 1) {
		hoge = N / hoge - 1 + hoge - 1;
	}
	else {
		hoge = N / hoge - 1;
	}

	cout << hoge << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:32: error: 'sqrt' was not declared in this scope; did you mean 'Nsqrt'?
   27 |         long long Nsqrt = ceil(sqrt(N));
      |                                ^~~~
      |                                Nsqrt
a.cc:27:27: error: 'ceil' was not declared in this scope
   27 |         long long Nsqrt = ceil(sqrt(N));
      |                           ^~~~
Language: C++


#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <queue>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

// rep(i, 100) { cout << i << endl; } => 0 1 2 ... 99
#define rep(i, n) for(int i = 0, i##_len = (n); i < (int)n; i++)

// std::sort(all(v));
#define all(x) (x).begin(), (x).end()

// long long int
using ll = long long;

// utility to cast return value of size function to int
#define SZ(x) ((int)(x).size())

// VS defines "_DEBUG" macro when debug configuration.
#if _DEBUG
#define dump(x) cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#else
#define dump(x)
#define debug(x)
#endif

// update max
template<class T>bool chmax(T & prov, const T & cur)
{
	if (cur > prov)
	{
		prov = cur;
		return true;
	}
	return false;
}

// update min
template<class T>bool chmin(T & prov, const T & cur)
{
	if (cur < prov)
	{
		prov = cur;
		return true;
	}
	return false;
}

ll gmin = LONG_MAX;

void df(ll x, ll y, const vector<ll> & n, int index)
{
	if (index == n.size())
	{
		chmin(gmin, x + y);
		return;
	}

	if (gmin <= x + y)
	{
		return;
	}

	df(x * n[index], y, n, index + 1);
	df(x, y * n[index], n, index + 1);
}

int main()
{
	ll N;
	cin >> N;
	vector<ll> yaku;
	ll n = N;
	ll ans;
	ll sq = sqrt(N);
	for (ll i = 2; n > 1 && i <= sq; i++)
	{
		while (n % i == 0 && i != 1)
		{
			yaku.push_back(i);
			n /= i;
		}
	}

	if (yaku.size() == 0)
	{
		ans = N - 1;
	}
	else
	{
		df(1, 1, yaku, 0);

		ans = gmin - 2;
	}

	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc:56:11: error: 'LONG_MAX' was not declared in this scope
   56 | ll gmin = LONG_MAX;
      |           ^~~~~~~~
a.cc:7:1: note: 'LONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    6 | #include <queue>
  +++ |+#include <climits>
    7 | #include <string>
a.cc: In function 'int main()':
a.cc:82:17: error: 'sqrt' was not declared in this scope; did you mean 'sq'?
   82 |         ll sq = sqrt(N);
      |                 ^~~~
      |                 sq
Language: C++

#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#define int long long
#define mod 1000000007
#define for0(i, n) for(int i = 0; i < (n); i++)
#define for1(i, n) for(int i = 1; i <= (n);i++)
using namespace std;
signed main() {
	int n; cin >> n;
	int ans = n + 10;
	for1(i, sqrt(n))if (n%i == 0)ans = min(ans, i + n / i - 2);
	cout << ans << "\n";
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:17: error: 'sqrt' was not declared in this scope
   13 |         for1(i, sqrt(n))if (n%i == 0)ans = min(ans, i + n / i - 2);
      |                 ^~~~
a.cc:8:41: note: in definition of macro 'for1'
    8 | #define for1(i, n) for(int i = 1; i <= (n);i++)
      |                                         ^
Language: C++

#include<iostream>
#include<cmath>
using namespace std;
int main(){
  long long n,k;
  cin>>n;
  k=(int)sqrt(n);
  for(int i=0;i<k;i++){
    if(n%(k-i)==0){
      cout<<n/(k-i)+(k-i)-2<<endl;
      return 0;
    }
  }
 
  

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

long long mySolution(long long num){
	long long min_step = num;
	for(long long i=1; i<=sqrt(num); i++){
		if(num%i==0){
			long long d = num/i;
			long long cur_step = d-1+i-1;
			min_step = min(min_step, cur_step);
		}
	}
	return min_step;
}
int main(){
	long long n;
	cin >> n;
	cout << mySolution(n) << endl;
    return 0;
}

Compiler output:
a.cc: In function 'long long int mySolution(long long int)':
a.cc:3:31: error: 'sqrt' was not declared in this scope
    3 |         for(long long i=1; i<=sqrt(num); i++){
      |                               ^~~~
a.cc:7:36: error: 'min' was not declared in this scope
    7 |                         min_step = min(min_step, cur_step);
      |                                    ^~~
a.cc: In function 'int main()':
a.cc:14:9: error: 'cin' was not declared in this scope
   14 |         cin >> n;
      |         ^~~
a.cc:15:9: error: 'cout' was not declared in this scope
   15 |         cout << mySolution(n) << endl;
      |         ^~~~
a.cc:15:34: error: 'endl' was not declared in this scope
   15 |         cout << mySolution(n) << endl;
      |                                  ^~~~
Language: C++

#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <math.h>

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define repP(i, a, b) for(int i = a; i < b; i++)
#define repM(i, a, b) for(int i = a - 1; i >= b; i--)

using namespace std;

int main()
{
  long a = 0 , b = 0, c = 0, d = 0, e = 0, f = 0, i = 0, j = 0;
  long num = 0, count = 0, ans = 0, min = 9999999999999;
  double d1 = 0, d2 = 0, d3 = 0, d4 = 0, d5 = 0, d6 = 0;
  long a1[40000000], a2[40000000], a3[40000000];
  //char s1[200000], s2[200000], s3[200000];
  //string s1, s2, s3;
  
  cin >> a;
  
   for(i = 1; i <= a; i++){
    if( num % i == 0 ){
      a1[b] = num % i;
      b++;
    }
  }
  if(b % 2 == 0){
    for(i = 0; i < b / 2; i++){
      c = a1[i] + a1[b - i];
      if(min >= c){
        min = c;
      }
    }
    c = a1[i] * 2;
    if(min >= c){
      min = c;
    }
  }else if(
    for(i = 0; i < b / 2; i++){
      c = a1[i] + a1[b - i];
      if(min >= c){
        min = c;
      }
    }
    cout << min << endl;
   }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:51:5: error: expected primary-expression before 'for'
   51 |     for(i = 0; i < b / 2; i++){
      |     ^~~
a.cc:50:12: error: expected ')' before 'for'
   50 |   }else if(
      |           ~^
      |            )
   51 |     for(i = 0; i < b / 2; i++){
      |     ~~~     
a.cc:51:30: error: expected ';' before ')' token
   51 |     for(i = 0; i < b / 2; i++){
      |                              ^
      |                              ;
a.cc: At global scope:
a.cc:59:1: error: expected declaration before '}' token
   59 | }
      | ^
Language: C++

#include<iostream>
using namespace std;

unsigned long yakusu(unsigned long n){
  unsigned long ans = n+1; 
  for(unsigned long i=1; i*i<=n; ++i){
    if(n%i == 0){
      unsigned long j = n/i;
      if(ans > i+j) ans = i+j
    }
  }
  return ans;
}

}
int main(){
  unsigned long N;
  cin >> N;
  unsigned long ans = yakusu(N);
  cout << ans-2 << endl;
  return 0;
}

Compiler output:
a.cc: In function 'long unsigned int yakusu(long unsigned int)':
a.cc:9:30: error: expected ';' before '}' token
    9 |       if(ans > i+j) ans = i+j
      |                              ^
      |                              ;
   10 |     }
      |     ~                         
a.cc: At global scope:
a.cc:15:1: error: expected declaration before '}' token
   15 | }
      | ^