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

#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	long long int a;
	cin >> a;
	long long int j = (long long int)sqrt(a);
	for(int i = j;;i--)
	{
		if (a % i == 0)
		{
			cout << (a / i) + i << endl;
			break;
		}
	}
	return 0;
}

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

#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	long long int a;
	cin >> a;
	long long int j = sqrt(a) / 1;
	for(int i = j;;i--)
	{
		if (a % i == 0)
		{
			cout << (a / i) + i << endl;
			break;
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:27: error: 'sqrt' was not declared in this scope
    8 |         long long int j = sqrt(a) / 1;
      |                           ^~~~
Language: Java


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.util.ArrayList;
public class Pr_5 {

    public static void main(String[] args) {
        FastReader f = new FastReader();
        
     long n = f.nextLong();
     long q=(long)Math.sqrt(n);
     ArrayList<Long> a1 = new ArrayList<Long>();

     for(long i = 1 ;i <= q ; i++){
         if(n%i==0){
         a1.add(i);
        // long x =(long)(n/i);
         a1.add((long)(n/i));
         
         }
     }
     
        long [] arr = new long[a1.size()];
        for(int i= 0;i<arr.length;i++){
            arr[i]=a1.get(i);
        }
     Arrays.sort(arr);
     int mid=(int)arr.length/2;     
     
       System.out.println((arr[mid] + arr[mid-1])-2);
        
        
     
     
    }   
 }




class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() 
        { 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        byte nextByte() 
        { 
            return Byte.parseByte(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    
}


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

#include<iostream>
#include<vector>
#include<set>
#include<algorithm>
#include<map>
#include<climits>
using namespace std;
long long n;
long long dfs(long long nodex,long long nodey,long long count) {
	
	if (nodex * nodey > n)
		return INT_MAX;
	if (nodex * nodey == n)
		return count;
	else
		return min(dfs(nodex + 1, nodey, count + 1), dfs(nodex, nodey + 1, count + 1));
}
bool isPrime(long long n) {
	if (n < 2)
		return false;
	else if (n == 2)
		return 2;
	else
	{
		bool b = true;
		long long s= sqrt(n);
		for (int i = 2; i <= s; i++)
			if (n % i == 0)
			{
				b = false;
				break;
			}
		return b;
	}
}
int main(){
    cin >> n;
	if (n % 2 == 1)
		if (isPrime(n))
			cout << n - 1;
		else
	cout << dfs(1,1,0);
	else
		cout << dfs(1, 1, 0);
		
	return 0;
}


Compiler output:
a.cc: In function 'bool isPrime(long long int)':
a.cc:26:30: error: 'sqrt' was not declared in this scope
   26 |                 long long s= sqrt(n);
      |                              ^~~~
Language: C++

#include<iostream>
#include<vector>
#include<set>
#include<algorithm>
#include<map>
using namespace std;
long long n;
long long dfs(long long nodex,long long nodey,long long count) {
	
	if (nodex * nodey > n)
		return INT_MAX;
	if (nodex * nodey == n)
		return count;
	else
		return min(dfs(nodex + 1, nodey, count + 1), dfs(nodex, nodey + 1, count + 1));
}
bool isPrime(long long n) {
	if (n < 2)
		return false;
	else if (n == 2)
		return 2;
	else
	{
		bool b = true;
		long long s= sqrt(n);
		for (int i = 2; i <= s; i++)
			if (n % i == 0)
			{
				b = false;
				break;
			}
		return b;
	}
}
int main(){
    cin >> n;
	if (n % 2 == 1)
		if (isPrime(n))
			cout << n - 1;
		else
	cout << dfs(1,1,0);
	else
		cout << dfs(1, 1, 0);
		
	return 0;
}


Compiler output:
a.cc: In function 'long long int dfs(long long int, long long int, long long int)':
a.cc:11:24: error: 'INT_MAX' was not declared in this scope
   11 |                 return INT_MAX;
      |                        ^~~~~~~
a.cc:6:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    5 | #include<map>
  +++ |+#include <climits>
    6 | using namespace std;
a.cc: In function 'bool isPrime(long long int)':
a.cc:25:30: error: 'sqrt' was not declared in this scope
   25 |                 long long s= sqrt(n);
      |                              ^~~~
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.util.StringTokenizer;
 
class Main {
    static Scanner sc = new Scanner();
 
    public static void main(final String[] args) throws IOException {
        long n = sc.nextLong();
        int n_sqrt = (int)Math.ceil(Math.sqrt(n));
        long ans = n+1;
        for (int i = 1; i < n_sqrt; i++) {
            int temp = n/i;
            if (n%i == 0) {
                ans = temp+i;
            }
        }
        System.out.println(ans-2);
    }
 
    static class Scanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;
 
        String next() throws IOException {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(reader.readLine());
            }
            return tokenizer.nextToken();
        }
 
        int nextInt() throws IOException {
            return Integer.parseInt(next());
        }
 
        long nextLong() throws IOException {
            return Long.parseLong(next());
        }
    }
}


Compiler output:
Main.java:15: error: incompatible types: possible lossy conversion from long to int
            int temp = n/i;
                        ^
1 error
Language: C++

#include <iostream>

using namespace std;

int main() {
    long int N;
    cin >> N;
    auto ans = N;

    for (auto i = std::size_t(1); i < ceil(sqrt(N)); ++i) {
        if (N % i == 0 && ans > i + N / i){
            ans = i + N / i;
        }
    }

    cout << ans - 2 << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:44: error: 'sqrt' was not declared in this scope
   10 |     for (auto i = std::size_t(1); i < ceil(sqrt(N)); ++i) {
      |                                            ^~~~
a.cc:10:39: error: 'ceil' was not declared in this scope
   10 |     for (auto i = std::size_t(1); i < ceil(sqrt(N)); ++i) {
      |                                       ^~~~
Language: C++

#include <iostream>

using namespace std;

int main() {
    long int N;
    cin >> N;
    auto ans = N + 1;

    for (auto i = std::size_t(1); i < floor(sqrt(N)); ++i) {
        if (N % i == 0 && ans > i + N / i){
            ans = i + N / i;
        }
    }

    cout << ans - 2 << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:45: error: 'sqrt' was not declared in this scope
   10 |     for (auto i = std::size_t(1); i < floor(sqrt(N)); ++i) {
      |                                             ^~~~
a.cc:10:39: error: 'floor' was not declared in this scope
   10 |     for (auto i = std::size_t(1); i < floor(sqrt(N)); ++i) {
      |                                       ^~~~~
Language: C++

#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;

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


Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: 'cin' was not declared in this scope
    9 |         cin >> n;
      |         ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include<vector>
  +++ |+#include <iostream>
    3 | using namespace std;
a.cc:15:9: error: 'cout' was not declared in this scope
   15 |         cout << ans << endl;
      |         ^~~~
a.cc:15:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:15:24: error: 'endl' was not declared in this scope
   15 |         cout << ans << endl;
      |                        ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    2 | #include<vector>
  +++ |+#include <ostream>
    3 | using namespace std;
Language: C++

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

int main(){
  int n,i,c=0,x;
  cin>>n;
  x=10000;
  double ret =sqrt(n);
  for(i=1;i<=n;i++){
    if(n%i==0){
      if(i+n/i-2<x)
      x=i+n/i-2;
  }
  cout<<x<<endl;
  
      return 0;
    }
    
    


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

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

int main(){
  int n,i,c=0,x;
  cin>>n;
  x=10000;
  double ret =sqrt(n);
  for(i=1;i<=ret;i++){
    if(n%i==0){
      if(i+n/i-2<x)
      x=i+n/i-2;
  }
  cout<<x<<endl;
  
      return 0;
    }
    
    


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

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

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


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

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

int main(){
  int n,i,c=0,x;
  cin>>n;
  for(i=1;i<=cmath.sprt((double)n);i++){
    if(n%i==0)
      x=i;
  }
  cout<<x+n/x-2<<endl;
  
      return 0;
    }
    
    


Compiler output:
a.cc: In function 'int main()':
a.cc:7:14: error: 'cmath' was not declared in this scope
    7 |   for(i=1;i<=cmath.sprt((double)n);i++){
      |              ^~~~~
Language: C++

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

int main(){
  int n,i,c=0,x;
  cin>>n;
  for(i=1;i<=sprt((double)n);i++){
    if(n%i==0)
      x=i;
  }
  cout<<x+n/x-2<<endl;
  
      return 0;
    }
    
    


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

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

int main(){
  int n,i,c=0,x;
  cin>>n;
  for(i=1;i<=sprt(n);i++){
    if(n%i==0)
      x=i;
  }
  cout<<x+n/x-2<<endl;
  
      return 0;
    }
    
    


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

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

int main(){
  int n,i,c=0,x;
  cin>>n;
  for(i=1;i<=(int)sprt((double)n);i++){
    if(n%i==0)
      x=i;
  }
  cout<<x+n/x-2<<endl;
  
      return 0;
    }
    
    


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

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

int main(){
  int n,i,c=0,x;
  cin>>n;
  if(i=1;i<=(int)sprt((double)n);i++){
    if(n%i==0)
      x=i;
  }
  cout<<x+n/x-2<<endl;
  
      return 0;
    }
    
    


Compiler output:
a.cc: In function 'int main()':
a.cc:7:18: error: 'sprt' was not declared in this scope; did you mean 'sqrt'?
    7 |   if(i=1;i<=(int)sprt((double)n);i++){
      |                  ^~~~
      |                  sqrt
a.cc:7:33: error: expected ')' before ';' token
    7 |   if(i=1;i<=(int)sprt((double)n);i++){
      |     ~                           ^
      |                                 )
a.cc:7:37: error: expected ';' before ')' token
    7 |   if(i=1;i<=(int)sprt((double)n);i++){
      |                                     ^
      |                                     ;
Language: C++

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

int main(){
  int n,i,c=0,x;
  cin>>n;
  if(i=1;i<=sprt(n);i++){
    if(n%i==0)
      x=i;
  }
  cout<<x+n/x-2<<endl;
  
      return 0;
    }
    
    


Compiler output:
a.cc: In function 'int main()':
a.cc:7:13: error: 'sprt' was not declared in this scope; did you mean 'sqrt'?
    7 |   if(i=1;i<=sprt(n);i++){
      |             ^~~~
      |             sqrt
a.cc:7:20: error: expected ')' before ';' token
    7 |   if(i=1;i<=sprt(n);i++){
      |     ~              ^
      |                    )
a.cc:7:24: error: expected ';' before ')' token
    7 |   if(i=1;i<=sprt(n);i++){
      |                        ^
      |                        ;
Language: Java

import java.lang.Math;
import java.util.*;
public class HelloWorld{

     public static void main(String []args){
        Scanner sc = new Scanner(System.in);
        
        long N = sc.nextLong();
        long temp = N;
        for(long i = 1; i <= Math.sqrt(N); i++){
            if( N % i == 0 && N/i + i < temp){

                temp = N/i + i;
            }
        }
        if(temp == N){
            System.out.println(N-1);
        }else System.out.println(temp - 2);
     }
}

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

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

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


Compiler output:
main.c: In function 'main':
main.c:16:16: error: 'c' undeclared (first use in this function)
   16 |          min = c;
      |                ^
main.c:16:16: 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(){
  i64 n;
  cin >> n;
  i64 a;
  for(i64 i=1; i<sqrt(n); i++){
    if(n%i){a=i;}
  }
  i64 ans;
  ans = a + (n/a) -2;
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:3: error: 'i64' was not declared in this scope
    4 |   i64 n;
      |   ^~~
a.cc:5:10: error: 'n' was not declared in this scope; did you mean 'yn'?
    5 |   cin >> n;
      |          ^
      |          yn
a.cc:6:6: error: expected ';' before 'a'
    6 |   i64 a;
      |      ^~
      |      ;
a.cc:7:10: error: expected ';' before 'i'
    7 |   for(i64 i=1; i<sqrt(n); i++){
      |          ^~
      |          ;
a.cc:7:16: error: 'i' was not declared in this scope
    7 |   for(i64 i=1; i<sqrt(n); i++){
      |                ^
a.cc:8:13: error: 'a' was not declared in this scope
    8 |     if(n%i){a=i;}
      |             ^
a.cc:10:6: error: expected ';' before 'ans'
   10 |   i64 ans;
      |      ^~~~
      |      ;
a.cc:11:3: error: 'ans' was not declared in this scope; did you mean 'abs'?
   11 |   ans = a + (n/a) -2;
      |   ^~~
      |   abs
a.cc:11:9: error: 'a' was not declared in this scope
   11 |   ans = a + (n/a) -2;
      |         ^
Language: C

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

int main(){
  int64_t N;
  cin>>N;
  int64_t i=1,j=N;
  printf("%ld\n",N);
  for(int64_t x=1;x*x<N;x++){
    if(N%x==0){
      i=x;
      j=N/x;
    }
  }
  printf("%ld\n%ld",N,i+j-2);
  return 0;
}

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:3:3: error: 'cin' was not declared in this scope
    3 |   cin >> N;
      |   ^~~
a.cc:4:19: error: 'sqrt' was not declared in this scope
    4 |   int tmp = trunc(sqrt(N));
      |                   ^~~~
a.cc:4:13: error: 'trunc' was not declared in this scope
    4 |   int tmp = trunc(sqrt(N));
      |             ^~~~~
a.cc:8:5: error: 'cout' was not declared in this scope
    8 |     cout << (tmp-1) + (i-1) << endl;
      |     ^~~~
a.cc:8:32: error: 'endl' was not declared in this scope
    8 |     cout << (tmp-1) + (i-1) << endl;
      |                                ^~~~
a.cc:12:3: error: 'cout' was not declared in this scope
   12 |   cout << N - 1 << endl;
      |   ^~~~
a.cc:12:20: error: 'endl' was not declared in this scope
   12 |   cout << N - 1 << endl;
      |                    ^~~~
Language: C++

#include<iostream>
#include<math.h>
using namespace std;
double n, min_step;
int main()
{
  cin >> n;
  min_step = pow(10.0, 12.0);
  for (int i=2; i<=sqrt(n); i++) {
    if (n % i == 0.0 && min_step >= i + n / i - 2) {
      min_step = i + n / i - 2;
    }
  }
  cout << min_step;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:11: error: invalid operands of types 'double' and 'int' to binary 'operator%'
   10 |     if (n % i == 0.0 && min_step >= i + n / i - 2) {
      |         ~ ^ ~
      |         |   |
      |         |   int
      |         double
Language: C++

#include<iostream>
#include<math.h>
using namespace std;
double n, min_step;
int main()
{
  cin >> n;
  min_step = pow(10.0, 12.0);
  for (int i=2; i<=sqrt(n); i++) {
    if (n % i == 0 && min_step >= i + n / i - 2) {
      min_step = i + n / i - 2;
    }
  }
  cout << min_step;
  return 0;
}


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

#include<iostream>
#include<math.h>
using namespace std;
double n, min_step;
int main()
{
  cin >> n;
  min_step = pow(10.0, 12.0);
  for (int i=2; i<=sqrt(n); i++) {
    if (n % i == 0 && min_step >= i + n / i - 2) {
      min_step = i + n / i - 2
    }
  }
  cout << min_step;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:11: error: invalid operands of types 'double' and 'int' to binary 'operator%'
   10 |     if (n % i == 0 && min_step >= i + n / i - 2) {
      |         ~ ^ ~
      |         |   |
      |         |   int
      |         double
a.cc:11:31: error: expected ';' before '}' token
   11 |       min_step = i + n / i - 2
      |                               ^
      |                               ;
   12 |     }
      |     ~
Language: C++

#include<iostream>
#include<math.h>
double n, min_step;
int main()
{
  cin >> n;
  min_step = pow(10.0, 12.0);
  for (int i=2; i<=sqrt(n); i++) {
    if (n % i == 0 && min_step >= i + n / i - 2) {
      min_step = i + n / i - 2
    }
  }
  cout << min_step;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    6 |   cin >> n;
      |   ^~~
      |   std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:9:11: error: invalid operands of types 'double' and 'int' to binary 'operator%'
    9 |     if (n % i == 0 && min_step >= i + n / i - 2) {
      |         ~ ^ ~
      |         |   |
      |         |   int
      |         double
a.cc:10:31: error: expected ';' before '}' token
   10 |       min_step = i + n / i - 2
      |                               ^
      |                               ;
   11 |     }
      |     ~                          
a.cc:13:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   13 |   cout << min_step;
      |   ^~~~
      |   std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
Language: C++

#include<iostream>
#include<math.h>
double n, min_step;
int main()
{
  cin >> n;
  min_step = pow(10.0, 12.0);
  for (int i=2; i<=sqrt(n); i++) {
    if (n % i == 0 && min_step >= i + n / i - 2) {
      min_step = i + n / i - 2
    }
  }
  puts(min_step);
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    6 |   cin >> n;
      |   ^~~
      |   std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:9:11: error: invalid operands of types 'double' and 'int' to binary 'operator%'
    9 |     if (n % i == 0 && min_step >= i + n / i - 2) {
      |         ~ ^ ~
      |         |   |
      |         |   int
      |         double
a.cc:10:31: error: expected ';' before '}' token
   10 |       min_step = i + n / i - 2
      |                               ^
      |                               ;
   11 |     }
      |     ~                          
a.cc:13:8: error: cannot convert 'double' to 'const char*'
   13 |   puts(min_step);
      |        ^~~~~~~~
      |        |
      |        double
In file included from /usr/include/c++/14/cstdio:42,
                 from /usr/include/c++/14/ext/string_conversions.h:45,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41:
/usr/include/stdio.h:714:30: note:   initializing argument 1 of 'int puts(const char*)'
  714 | extern int puts (const char *__s);
      |                  ~~~~~~~~~~~~^~~
Language: C++

#include<iostream>
#include<math.h>
double n, min_step;
int main()
{
  scanf("%d", &n);
  min_step = 10 ** 12;
  for (int i=2; i<=sqrt(n); i++) {
    if (n % i == 0 && min_step >= i + n / i) {
      min_step = i + n / i
    }
  }
  puts(min_step);
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:18: error: invalid type argument of unary '*' (have 'int')
    7 |   min_step = 10 ** 12;
      |                  ^~~~
a.cc:9:11: error: invalid operands of types 'double' and 'int' to binary 'operator%'
    9 |     if (n % i == 0 && min_step >= i + n / i) {
      |         ~ ^ ~
      |         |   |
      |         |   int
      |         double
a.cc:10:27: error: expected ';' before '}' token
   10 |       min_step = i + n / i
      |                           ^
      |                           ;
   11 |     }
      |     ~                      
a.cc:13:8: error: cannot convert 'double' to 'const char*'
   13 |   puts(min_step);
      |        ^~~~~~~~
      |        |
      |        double
In file included from /usr/include/c++/14/cstdio:42,
                 from /usr/include/c++/14/ext/string_conversions.h:45,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/stdio.h:714:30: note:   initializing argument 1 of 'int puts(const char*)'
  714 | extern int puts (const char *__s);
      |                  ~~~~~~~~~~~~^~~
Language: C++

#include<bits/stdc++.h>
int n, min_step=10**12;
scanf("%d", &n);
int main()
{
  for (i=2; i<=n**0.5; i++) {
    if (n % i == 0 && min_step >= i + n / i) {
      min_step = i + n / i
    }
  }
  puts(min_step);
  return 0;
}


Compiler output:
a.cc:2:20: error: invalid type argument of unary '*' (have 'int')
    2 | int n, min_step=10**12;
      |                    ^~~
a.cc:3:6: error: expected constructor, destructor, or type conversion before '(' token
    3 | scanf("%d", &n);
      |      ^
a.cc: In function 'int main()':
a.cc:6:8: error: 'i' was not declared in this scope
    6 |   for (i=2; i<=n**0.5; i++) {
      |        ^
a.cc:6:18: error: invalid type argument of unary '*' (have 'double')
    6 |   for (i=2; i<=n**0.5; i++) {
      |                  ^~~~
a.cc:11:8: error: invalid conversion from 'int' to 'const char*' [-fpermissive]
   11 |   puts(min_step);
      |        ^~~~~~~~
      |        |
      |        int
In file included from /usr/include/c++/14/cstdio:42,
                 from /usr/include/c++/14/ext/string_conversions.h:45,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/stdio.h:714:30: note:   initializing argument 1 of 'int puts(const char*)'
  714 | extern int puts (const char *__s);
      |                  ~~~~~~~~~~~~^~~
Language: C++

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

int pro(lo N){
	lo ans = N + 1 - 2;
	for(lo i=1;i*i<=N;i++){
		for(lo j=1;j<=N/i;j++){
		else if(i*j > N) break; 
		if(i*j == N) ans = min((int)ans,(int)(i+j-2)); 
	}
}
return ans;
}
	
int main(){
	lo a;
	cin >> a; 
	cout << pro(a) << endl;	
}


Compiler output:
a.cc: In function 'int pro(lo)':
a.cc:9:17: error: 'else' without a previous 'if'
    9 |                 else if(i*j > N) break;
      |                 ^~~~
Language: C++

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

int main(){
    int n;
    cin >> n;
    int m = n - 1;
    for (int i = (int)sqrt((float)n); i >= 2; i--) {
        bool f = n % i == 0;
        if (f) {
            int j = n / i;
            m = min(m, i + j - 2);
            break;
        }
    }
    cout << m << "\n";
    return 0;
}

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

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#pragma comment(linker, "/STACK:16777216")
#pragma warning( disable : 6031)
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <iostream>
#include <map>
#include <stack>
#include <set>
#include <queue>
#include <numeric>
#include <algorithm>
#include <utility>
#include <bitset>
#include <cmath>
#include <sstream>
#include <functional>
#include <iomanip>
#include <limits>

#define all(a) (a).begin(),(a).end()
#define sz(a) (int)(a).size()
#define eps (1e-15)
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector<double> vd;
typedef vector< vd > vvd;
typedef vector< string > vs;
typedef pair< int, int > pii;
typedef vector< pii > vpii;
typedef tuple<int, int, int> tiii;



int main()
{
#ifdef LOCAL_MACHINE
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);
#endif
	int n;
	cin >> n;
	int res = INT_MAX;
	for (int i = 2; i * i <= n; i++)
	{
		if (n % i == 0)
		{
			res = min(res, i + n / i - 2);
		}
	}
	cout << res;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:50:19: error: 'INT_MAX' was not declared in this scope
   50 |         int res = INT_MAX;
      |                   ^~~~~~~
a.cc:23:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   22 | #include <iomanip>
  +++ |+#include <climits>
   23 | #include <limits>
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#pragma comment(linker, "/STACK:16777216")
#pragma warning( disable : 6031)
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <iostream>
#include <map>
#include <stack>
#include <set>
#include <queue>
#include <numeric>
#include <algorithm>
#include <utility>
#include <bitset>
#include <cmath>
#include <sstream>
#include <functional>
#include <iomanip>

#define all(a) (a).begin(),(a).end()
#define sz(a) (int)(a).size()
#define eps (1e-15)
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector<double> vd;
typedef vector< vd > vvd;
typedef vector< string > vs;
typedef pair< int, int > pii;
typedef vector< pii > vpii;
typedef tuple<int, int, int> tiii;



int main()
{
#ifdef LOCAL_MACHINE
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);
#endif
	int n;
	cin >> n;
	int res = INT_MAX;
	for (int i = 2; i * i <= n; i++)
	{
		if (n % i == 0)
		{
			res = min(res, i + n / i - 2);
		}
	}
	cout << res;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:49:19: error: 'INT_MAX' was not declared in this scope
   49 |         int res = INT_MAX;
      |                   ^~~~~~~
a.cc:23:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   22 | #include <iomanip>
  +++ |+#include <climits>
   23 |
Language: C++

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

typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)

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


Compiler output:
a.cc: In function 'int main()':
a.cc:17:23: error: expected ';' before 'i'
   17 |   for (ll i=1; i*i < n i++){
      |                       ^~
      |                       ;
Language: C++

#include<iostream>
#include<string.h>
#include<stdio.h>

using namespace std;
int main() {
	long long a;
	long long b;

	cin >> a;
	//cout << a << endl;
	long long i = 0;
	long long k = 1;
	int t = 0;
	i = sqrt(a);

	for (i = sqrt(a); i >0 ; i--) {
		if (a % i == 0) {
			k = i;
			break;
			}

	}
	long long ans = (k - 1) + (a / k - 1);


	

	cout << ans << endl;

}

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

#include<iostream>
#include<cmath>
#include<complex>
#include<cstdlib>
#include<algorithm>
#include<functional>
using namespace std;

int main() {
    long long n,ans,a=0,b,f=INT_MAX;
    cin>>n;
    for(int i=1;i<=n/2;i++){
        if(n%i==0&&i+n/i<f){
            f=i+n/i;
            cout<<f<<endl;
            ans=i+n/i-2;
        }
    }
    cout<<ans<<endl;
    
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:10:29: error: 'INT_MAX' was not declared in this scope
   10 |     long long n,ans,a=0,b,f=INT_MAX;
      |                             ^~~~~~~
a.cc:7:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    6 | #include<functional>
  +++ |+#include <climits>
    7 | using namespace std;
Language: C++

#include <iostream>
using namespace std;

int main()
{
	long long n;

	cin >> n;
	long long ans = n;
	while(i*i<=n){
		if (n % i == 0)
			ans = min(ans, i+n/i-2);
      i+=1;
    }

	cout << ans << '\n';

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:15: error: 'i' was not declared in this scope
   10 |         while(i*i<=n){
      |               ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int i=1;
  ans=n;
  while(i*i<=n)
  {
    if(n%i==0)
      ans=min(ans,i-1+(n/i)-1);
  }
  std::cout<<ans;
  return 0;
}

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

#include<iostream>
using namespace std;
int main()
{
  int n,i,root,sum=0;
  cin>>n;
  root=sqrt(n);
  for(i=root;i>=1;i--)
  {sum=sum+i;break;}
  for(i=root;i<=n;i++)
  {sum=sum+i;break;}
  cout<<sum-2<<endl;
  return 0;
}

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

#include <stdio.h>

int main(){
	int i,j,k,n=k-2,m;

	scanf("%d",&k);

	for(i=1; i<k/2; i++){
		for(j=1; j<k/2; j++){
			if(i*j=k){
				if(n>i+j-2){
					n=i+j-2;
				}
			}
		}
	}

	printf("%d",n);

	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:10:31: error: lvalue required as left operand of assignment
   10 |                         if(i*j=k){
      |                               ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll= long long;
using vi= vector<int>;
using vvi= vector<vi>;
#define rep(i,x,n) for(int i=x; i<n; i++)
#define all(x) x.begin(), x.end()

int main(){
  ll n;
  cin >> n;
  ll ans=n;
  
  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:16:27: error: expected ';' before '}' token
   16 |       ans=min(ans,i+n/i-2)
      |                           ^
      |                           ;
   17 |     }
      |     ~
Language: C++

#include <bits/stdc++.h>

#define long long long int

using namespace std;

// @author: pashka

int main() {
    ios::sync_with_stdio(false);

    long n;
    cin >> n;
    long res = LONG_MAX;
    for (int i = 1; i * i <= n; i++) {
        int j = n / i;
        if (i * j == n) {
            res = min(res, i + j - 2);            
        }
    }
    cout << res;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:22: error: no matching function for call to 'min(long long int&, int)'
   18 |             res = min(res, i + j - 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:18:22: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   18 |             res = min(res, i + j - 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:18:22: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   18 |             res = min(res, i + j - 2);
      |                   ~~~^~~~~~~~~~~~~~~~
Language: C++

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

int main(){
  ll n;
  ll ans = LLONG_MAX;
  cin >> n;

  for(ll i = 1; i * i < n; i++){
    if(n % i == 0){
      ll a = i;
      ll b = n/i;
      ans = min(ans, a+b-2);
    }
  }
  
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:3: error: 'll' was not declared in this scope
    5 |   ll n;
      |   ^~
a.cc:6:5: error: expected ';' before 'ans'
    6 |   ll ans = LLONG_MAX;
      |     ^~~~
      |     ;
a.cc:7:10: error: 'n' was not declared in this scope; did you mean 'yn'?
    7 |   cin >> n;
      |          ^
      |          yn
a.cc:9:9: error: expected ';' before 'i'
    9 |   for(ll i = 1; i * i < n; i++){
      |         ^~
      |         ;
a.cc:9:17: error: 'i' was not declared in this scope
    9 |   for(ll i = 1; i * i < n; i++){
      |                 ^
a.cc:11:9: error: expected ';' before 'a'
   11 |       ll a = i;
      |         ^~
      |         ;
a.cc:12:9: error: expected ';' before 'b'
   12 |       ll b = n/i;
      |         ^~
      |         ;
a.cc:13:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
   13 |       ans = min(ans, a+b-2);
      |       ^~~
      |       abs
a.cc:13:22: error: 'a' was not declared in this scope
   13 |       ans = min(ans, a+b-2);
      |                      ^
a.cc:13:24: error: 'b' was not declared in this scope
   13 |       ans = min(ans, a+b-2);
      |                        ^
a.cc:17:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   17 |   cout << ans << endl;
      |           ^~~
      |           abs
Language: C++

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


using namespace std;

int main()
{
  int n;
  cin >>n;
  
  int min =n+1;
  
  for(int i=1;i++;i<1+2/n){
    if(n%i==0&&(i+n/i<min))min=i+n/;}
  
  cout<<min;}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:17:36: error: expected primary-expression before ';' token
   17 |     if(n%i==0&&(i+n/i<min))min=i+n/;}
      |                                    ^
Language: C++

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


using namespace std;

int main()
{
  int n;
  cin >>n;
  
  int min =n+1;
  
  for(int i=1;i++;i<1+2/n){
    if(n%i==0&&(i+n/i<min))min=i+n/i}
  
  cout<<min;}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:17:37: error: expected ';' before '}' token
   17 |     if(n%i==0&&(i+n/i<min))min=i+n/i}
      |                                     ^
      |                                     ;
Language: C++

#include <bits/stdc++.h>
#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 A,B,C,min;
  cin >> A;
  for (int i = 1; i< pow(A, 0.5);i++ ){
    B = A/i;
    if (B*i == A){
      C = B + i -2;
      min = min(C,min);
    }
  }
    
  cout << min << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:16: error: 'min' cannot be used as a function
   31 |       min = min(C,min);
      |             ~~~^~~~~~~
Language: C++

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

int main(){
  ll n;
  cin >> n;
  for(ll i = 1;i <= n;i++){
    for(ll j = 1;j <= i;j++){
      if(i * j == n){
	cout << i+j << endl;
	break;
      }
    }
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: 'll' was not declared in this scope
    6 |   ll n;
      |   ^~
a.cc:7:10: error: 'n' was not declared in this scope; did you mean 'yn'?
    7 |   cin >> n;
      |          ^
      |          yn
a.cc:8:9: error: expected ';' before 'i'
    8 |   for(ll i = 1;i <= n;i++){
      |         ^~
      |         ;
a.cc:8:16: error: 'i' was not declared in this scope
    8 |   for(ll i = 1;i <= n;i++){
      |                ^
a.cc:9:11: error: expected ';' before 'j'
    9 |     for(ll j = 1;j <= i;j++){
      |           ^~
      |           ;
a.cc:9:18: error: 'j' was not declared in this scope; did you mean 'jn'?
    9 |     for(ll j = 1;j <= i;j++){
      |                  ^
      |                  jn
Language: C++

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

int main(){
  int n;
  cin >> n;
  for(long i = sqrt(n);i >= 1;i--){
    for(long j = i;j >= 1;j--){
      if(i * j == n){
	cout << i+j << endl;
	break;
      }
    }
  }
  return 0;
}


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

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


int main()
{
	long long int n;
	cin>>n;
	long double nsd;
	nsd = sqrt(n);
	int nsi = nsd;
	for(size_t i = 0; i<=nsi; i++)
	{
		if(n%(nsi-i)==0)
		{
			cout<<((nsi-i)+n/(nsi-i)-2)<<endl;
			break;
		}

	}
	
	return 0;
}



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

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;
typedef long long ll;
const int INF=1001001001;
int main(){
  ll N;
  cin>>N;
  ll sqrt=pow(N,0.5);
  ll CS=floor(sprt);
  ll tmp=0;
  ll ans=0;
  for (int i=CS; i>=1;--i){
    tmp=N%i;
    if (tmp!=0) continue;
    ans=tmp+i-2;
    exit();
  }
  cout<<ans<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:15: error: 'sprt' was not declared in this scope; did you mean 'sqrt'?
   10 |   ll CS=floor(sprt);
      |               ^~~~
      |               sqrt
a.cc:17:9: error: too few arguments to function 'void exit(int)'
   17 |     exit();
      |     ~~~~^~
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42,
                 from a.cc:1:
/usr/include/stdlib.h:756:13: note: declared here
  756 | extern void exit (int __status) __THROW __attribute__ ((__noreturn__));
      |             ^~~~
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:17:7: error: no match for call to '(std::ostream {aka std::basic_ostream<char>}) (int)'
   17 |   cout(a+b-2)<<endl;
      |   ~~~~^~~~~~~
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:20:11: error: no match for call to '(std::ostream {aka std::basic_ostream<char>}) (int)'
   20 |       cout(a+b-2)<<endl;
      |       ~~~~^~~~~~~
a.cc:21:3: error: 'retrun' was not declared in this scope
   21 |   retrun 0;
      |   ^~~~~~
Language: C++

#ifndef LOCAL
#pragma GCC optimize("O2")
#endif
#include <iostream>
#include <vector>
#include<algorithm>
#include<math.h>
using namespace std;

int main(){
   long long int N; cin >> N;
    int score;score = 1e9;
    for(int i=1; i<=sqrt(N); i++)
    {
        if(N%i == 0)
        {
            //cout << score << "\n";
            score = min(i+N/i-2, score);
        }
    }

    cout << score ;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:24: error: no matching function for call to 'min(long long int, int&)'
   18 |             score = min(i+N/i-2, score);
      |                     ~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:4:
/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:18:24: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   18 |             score = min(i+N/i-2, score);
      |                     ~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:6:
/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:18:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   18 |             score = min(i+N/i-2, score);
      |                     ~~~^~~~~~~~~~~~~~~~