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

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

typedef long long ll;
#define all(x) (x).begin(), (x).end()  // sortなどの引数を省略
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define max3(x, y, z) max(x, max(y, z))

#ifdef _MSC_FULL_VER  //デバッグ出力
#define dout cout
#define debug() if (true)
#define check(x) std::cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) std::cout << "☆" << x << endl
#else
#define dout \
  if (false) cout
#define debug() if (false)
#define check(x) \
  if (false) cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) \
  if (false) cout << "☆" << x << endl
#endif
using namespace std;
int main() {
  ll N;
  cin >> N;
  int min = 99999999999999;
  for (ll i = 1; i < sqrt(N) + 5; i++) {
    if (N % i == 0) {
      if (N / i + i < min) {
        min = N / i + i;
      }
    }
  }
  cout << min-2;
  return 0;
}
/*
//よく使うやつ
int N;
cin >> N;
vector<int> list(N);
for (int i = 0; i < N; i++) {
  cin >> list[i];
}
// for文
for (int i = 0; i < N; i++) {
}
//配列
vector<int> vec;
vec.at(i)
vector<vector<int>> vec(10, vector<int>(10));
sort(all(vec));
sort(all(vec), greater<int>());
    //配列の内容表示
dout << "====vecの内容====\n";
for (int i = 0; i < N; i++) dout << vec[i] << endl;
dout << "====ここまで====\n";
*/

Compiler output:
a.cc: In function 'int main()':
a.cc:29:13: warning: overflow in conversion from 'long int' to 'int' changes value from '99999999999999' to '276447231' [-Woverflow]
   29 |   int min = 99999999999999;
      |             ^~~~~~~~~~~~~~
a.cc:30:22: error: 'sqrt' was not declared in this scope
   30 |   for (ll i = 1; i < sqrt(N) + 5; i++) {
      |                      ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main (){
    long int N;
    long int ans = 10000000000000;
    cin >> N;
    for (int a = 1; a < N/2; a++){

        if (N % a == 0 &&ans>ans = N / a + a)
        {
            ans = N / a + a;
        }
    }
    cout << ans-2 << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:24: error: lvalue required as left operand of assignment
    9 |         if (N % a == 0 &&ans>ans = N / a + a)
      |             ~~~~~~~~~~~^~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main (){
    long int N;
    long int ans = 10000000000000;
    cin >> N;
    for (int a = 0; a < N; a++){

        if (N % a == 0 &&ans>ans = N / a + a)
        {
            ans = N / a + a;
        }
    }
    cout << ans-2 << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:24: error: lvalue required as left operand of assignment
    9 |         if (N % a == 0 &&ans>ans = N / a + a)
      |             ~~~~~~~~~~~^~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main (){
    long int N;
    long int ans = 1000000000000;
    cin >> N;
    for (int a = 2; a < N/2; a++){

        if (N % a == 0 )
        {
          N = N % a;
          
      
    }
  
    cout << ans - 2 << endl;
}


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

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

int main(){
  int64_t N;
  cin >> N;
  double s=sqrt(N*1.0);
  int S=int(s);
  int64_t MIN=10000000000000;
  for(int64_t i = 1; i<s+1; i++){
    if(N%i==0){
      MIN=min(MIN,N/i+i-2);
    }
  }
  
  cout << MIN << endl;
}　
  
  

Compiler output:
a.cc:17:2: error: extended character 　 is not valid in an identifier
   17 | }　
      |  ^
a.cc:17:2: error: '\U00003000' does not name a type
   17 | }　
      |  ^~
Language: C

#include <stdio.h>
#include <conio.h>
#include <math.h>
int main()
{
  long long int n,a;
  scanf ("%lld",&n);
  long long int result =ceil(sqrt(n));
  int rem;
  while (rem!=0)
  {
    rem=n%result;
    result--;
    a=result;
  }
  long long int b=a+1;
  long long int c=n/b;
  long long int d,e;
  d=abs(b-1);
  e=abs(c-1);
  long long int total=d+e;
  printf ("%lld",total);
  return 0;

}


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

#include <iostream>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <string>
#include <math.h>
#include <iomanip>

using namespace std;

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

  long long div = sqrt(N);

  for (int i = div; i < 0; --i)
  {
    if (N%i == 0)
    {
      div = i;
      break;
    }

  cout << div + N / div - 2 << endl;
}

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

 #include<bits/stdc++.h>

using namespace std;

int main(){
  long long int N;
  cin >> N;
  long long int ans = 1000000000;
  for(long long int i = 1; i <= N; i++){
    if(N % i == 0){
      if(ans < (N - N / i) + (N - i)){
        ans = M - N / i + N - i;
      }
    } 
  }

  cout << ans << endl;

  return 0;
}





Compiler output:
a.cc: In function 'int main()':
a.cc:12:15: error: 'M' was not declared in this scope
   12 |         ans = M - N / i + N - i;
      |               ^
Language: C++

#include <iostream>
#include <vector>
#include <cmath>
#define rep(i, a, n) for(int i = a; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
    ll n;
    cin >> n;
    ll ans = 1000000000000;
    rep(i, 1, n+1){
        rep(j, 1, pow(n, 0.5)+1){
            if(i * j == n){
                ans = min(ans, i + j -2);
            }
        }
    }
    cout << ans << endl;
    return 0;
}


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

#include <bits/stdc++.h>
#define rep(i, n) for(long long i = 1; i <= n; i++)
#define ll long long
using namespace std;
 
int main() {
  ll n;
  cin>>n;
  ll d=n/2;
  ll p,q;
  for(ll i=d;d<=n;i++){
    for(ll j=d-1;d>0;d--){
      if(i*j==n){
        p=i;
        q=j;
        break;
      }
    }
  }
  cout<<i+j-2<<endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:20:9: error: 'i' was not declared in this scope
   20 |   cout<<i+j-2<<endl;
      |         ^
a.cc:20:11: error: 'j' was not declared in this scope
   20 |   cout<<i+j-2<<endl;
      |           ^
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for(long long i = 1; i <= n; i++)
#define ll long long
using namespace std;
 
int main() {
  ll n;
  cin>>n;
  ll d=n/2;
  for(ll i=d;d<=n;i++){
    for(ll j=d-1;d>0;d--){
      if(i*j==n){
        int p=i,q=j;
        break;
      }
    }
  }
  cout<<p+q-2<<endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:18:9: error: 'p' was not declared in this scope
   18 |   cout<<p+q-2<<endl;
      |         ^
a.cc:18:11: error: 'q' was not declared in this scope
   18 |   cout<<p+q-2<<endl;
      |           ^
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for(long long i = 1; i <= n; i++)
#define ll long long
using namespace std;
 
int main() {
  ll n;
  cin>>n;
  ll d=n/2;
  for(int i=d;d<=n;i++){
    for(int j=d-1;d>0;d--){
      if(i*j==n){
        int p=i,q=j;
        break;
      }
    }
  }
  cout<<i+j-2<<endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:18:9: error: 'i' was not declared in this scope
   18 |   cout<<i+j-2<<endl;
      |         ^
a.cc:18:11: error: 'j' was not declared in this scope
   18 |   cout<<i+j-2<<endl;
      |           ^
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for(long long i = 1; i <= n; i++)
#define ll long long
using namespace std;
 
int main() {
  ll n;
  cin>>n;
  ll d=n/2;
  for(ll i=d;d<=n;i++){
    for(ll j=d-1;d>0;d--){
      if(i*j==n){
        int p=i,q=j;
        break;
      }
    }
  }
  cout<<i+j-2<<endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:18:9: error: 'i' was not declared in this scope
   18 |   cout<<i+j-2<<endl;
      |         ^
a.cc:18:11: error: 'j' was not declared in this scope
   18 |   cout<<i+j-2<<endl;
      |           ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

vector<ll> enum_div(ll n) {
  vector<ll> ret;
  for(ll i = 1; i*i <= n; i++) {
    if(n%i == 0) {
      ret.push_back(i);
      if(i != 1 && i*i != n) {
        ret.push_back(n/i);
      }
    }
  }
  sort(ret.begin(), ret.end());
  return ret;
}

bool isprime(ll x) {
  ll i;
  if(x < 2) return 0;
  else if(x == 2) return 1;
  if(x%2 == 0) return 0;
  for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
  return 1;
}

int main() {
  ll n;
  cin >> n;
  if(isprime(n)) cout << n-1 << endl;
  else if()
  else {
    vector<ll> vec = enum_div(n);
    vec.push_back(n);
    ll ans = INT_MAX;
    rep(i, vec.size()) {
      ll m = vec.at(i) + n/vec.at(i) - 2;
      ans = min(ans, m);
    }
    cout << ans << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:11: error: expected primary-expression before ')' token
   34 |   else if()
      |           ^
a.cc:35:3: error: expected primary-expression before 'else'
   35 |   else {
      |   ^~~~
Language: C++

import sys

n=int(sys.stdin.readline())
min=n

for i in range(1,int(n**(1/2))+1):
    if n%i==0:
        c=n//i+i-2
        if c<min:
            min=c
print(min)
        


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

#include<bits/stdc++.h>

int main(){
  using namespace std;
  unsigned long N;
  cin >> N;
  unsigned long ans{numeric?limits<unsigned long>::max()};
  for(unsigned long i{1}; i * i <= N; ++i)if(N $ i == 0)ans = min(ans, i + N / i);
  cout << ans - 2 << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:21: error: 'numeric' was not declared in this scope
    7 |   unsigned long ans{numeric?limits<unsigned long>::max()};
      |                     ^~~~~~~
a.cc:7:29: error: 'limits' was not declared in this scope
    7 |   unsigned long ans{numeric?limits<unsigned long>::max()};
      |                             ^~~~~~
a.cc:7:36: error: expected primary-expression before 'unsigned'
    7 |   unsigned long ans{numeric?limits<unsigned long>::max()};
      |                                    ^~~~~~~~
a.cc:7:36: error: expected ':' before 'unsigned'
    7 |   unsigned long ans{numeric?limits<unsigned long>::max()};
      |                                    ^~~~~~~~
      |                                    :
a.cc:7:36: error: expected primary-expression before 'unsigned'
    7 |   unsigned long ans{numeric?limits<unsigned long>::max()};
      |                                    ^~~~~~~~
a.cc:7:36: error: expected '}' before 'unsigned'
    7 |   unsigned long ans{numeric?limits<unsigned long>::max()};
      |                    ~               ^~~~~~~~
a.cc: At global scope:
a.cc:8:3: error: expected unqualified-id before 'for'
    8 |   for(unsigned long i{1}; i * i <= N; ++i)if(N $ i == 0)ans = min(ans, i + N / i);
      |   ^~~
a.cc:8:27: error: 'i' does not name a type
    8 |   for(unsigned long i{1}; i * i <= N; ++i)if(N $ i == 0)ans = min(ans, i + N / i);
      |                           ^
a.cc:8:39: error: expected unqualified-id before '++' token
    8 |   for(unsigned long i{1}; i * i <= N; ++i)if(N $ i == 0)ans = min(ans, i + N / i);
      |                                       ^~
a.cc:9:3: error: 'cout' does not name a type
    9 |   cout << ans - 2 << endl;
      |   ^~~~
a.cc:10:3: error: expected unqualified-id before 'return'
   10 |   return 0;
      |   ^~~~~~
a.cc:11:1: error: expected declaration before '}' token
   11 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0;i < (int)(n);i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n);i++)
#define ALL(vec)  (vec).begin(),(vec).end()
#define lli long long int
#define pi 3.1415926535897932384626433832795
#define MAX_INF 9223372036854775807
#define MIN_INF 9223372036854775807+1
#define sosuu 1000000007

lli IsPrime(lli num)
{
  lli a=0;
    double sqrtNum = sqrt(num);
    for (int i = 2; i <= sqrtNum; i ++)
    {
        if (num % i == 0)
        {
          a=max(a,i);
        }
    }
  if(a) // 素数ではない
            return a;

    // 素数である
    return num;
}


int main(){
  lli N;
  cin >>N;
  
  if(IsPrime(N)==N){
  cout << N-1 << endl;
  }
  else
    cout << IsPrime(N)+N/IsPrime(N)-2 << endl;
}

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

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

int main(void)
{
	long long int n, x = 1, y = 1, min = LLONG_MAX;
	scanf("%lld", &n);
	for (int i = 1; i < sqrt(n); i++) {
		if (n % i == 0) {
			x = n / i - 1;
			y = i - 1;
			if ((x + y) < min)min = x + y;
		}
	}
	printf("%lld\n", min);
	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:8:46: error: 'LLONG_MAX' undeclared (first use in this function)
    8 |         long long int n, x = 1, y = 1, min = LLONG_MAX;
      |                                              ^~~~~~~~~
main.c:5:1: note: 'LLONG_MAX' is defined in header '<limits.h>'; this is probably fixable by adding '#include <limits.h>'
    4 | #include<math.h>
  +++ |+#include <limits.h>
    5 | 
main.c:8:46: note: each undeclared identifier is reported only once for each function it appears in
    8 |         long long int n, x = 1, y = 1, min = LLONG_MAX;
      |                                              ^~~~~~~~~
Language: C++

#include <iostream>
using namespace std;
#define rep(i,n) for (int i=0;i<n;i++)
typedef long long ll;

ll apple(ll n) {
	ll p = sqrt(n);
	ll k;
	ll t;
	bool flag = false;

	while (!flag) {
		if (n % p == 0) {
			k = n / p + p;
			t = n / p;
			flag = true;
		}
		else p--;
	}
	return k;
}

int main() {
	ll n;
	cin >> n;
	cout << apple(n) - 2 << endl;
	return 0;
}


Compiler output:
a.cc: In function 'll apple(ll)':
a.cc:7:16: error: 'sqrt' was not declared in this scope
    7 |         ll p = sqrt(n);
      |                ^~~~
Language: C++

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

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

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

include <bits/stdc++.h>
#define rep(i，n) for(int i = 0;i < n;i++)
using namespace std;
typedef long long ll;

int main(){
    ll n;
    cin >> n;
    ll run;
    run = pow(n,0.5);
    ll x = 0;
    for(ll i = run;i > 0;i--){
        if(n % i == 0){
            x = i;
            break;
        }
    }
    ll y;
    y = n / x;
    cout << x + y - 2 << endl;
    return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <bits/stdc++.h>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:8:5: error: 'cin' was not declared in this scope
    8 |     cin >> n;
      |     ^~~
a.cc:10:11: error: 'pow' was not declared in this scope
   10 |     run = pow(n,0.5);
      |           ^~~
a.cc:20:5: error: 'cout' was not declared in this scope
   20 |     cout << x + y - 2 << endl;
      |     ^~~~
a.cc:20:26: error: 'endl' was not declared in this scope
   20 |     cout << x + y - 2 << endl;
      |                          ^~~~
Language: C++

from math import sqrt
n = int(input())

sq = int(sqrt(n)) + 1

x = True

while(x):
    if n%sq == 0:
        print(int(sq + n/sq - 2))
        x = False
    else:
        sq -= 1

Compiler output:
a.cc:1:1: error: 'from' does not name a type
    1 | from math import sqrt
      | ^~~~
Language: C++

#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define INF 100000000
using namespace std;

int main() {
 
long long N,ans=INF*1000000;
cin >>N;
  for(int i=1; i<=sqrt(N); i++){
    double tmp;
    tmp=N/i;
    if((tmp)%1==0&&ans>(i+(N/i)))ans=i+(N/i);}
  cout<<ans<<endl;
// vector<int> A(N);
// for(int i=0; i<N; i++){cin>>A[i];}

}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:20: warning: integer overflow in expression of type 'int' results in '276447232' [-Woverflow]
    8 | long long N,ans=INF*1000000;
      |                    ^
a.cc:13:13: error: invalid operands of types 'double' and 'int' to binary 'operator%'
   13 |     if((tmp)%1==0&&ans>(i+(N/i)))ans=i+(N/i);}
      |        ~~~~~^~
      |         |    |
      |         |    int
      |         double
Language: C++

// at_abc144c.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
using namespace std;
typedef long long ll;
int main()
{
    ll num;cin >> num;
    ll cur = sqrt(num);
    while (true) {
        if (num % cur == 0) {
            cout << cur + num / cur - 2<<"\n";
            return 0;
        }
        else {
            cur++;
        }

    }
}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started: 
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file


Compiler output:
a.cc: In function 'int main()':
a.cc:10:14: error: 'sqrt' was not declared in this scope
   10 |     ll cur = sqrt(num);
      |              ^~~~
Language: C++

#include<bits\stdc++.h>
using namespace std;
#define int long long
signed main(){
    int n;
    cin >> n;
    int a = 1,b = 1;
    int c = sqrt(n);
    int cnt = 0;
    for(int i = 1; i < c + 1; c++){
        if(n % i == 0)
        cnt++;
        if(cnt < 2){
        cout <<n - b << endl;
        return 0;
        }
    }
    int d = 1e11;
    for(int i = 1; i < n / 2 + 1; i++){
        if(n % i == 0){
        int xpoint = abs(a - i);
        int f = abs( b - (n / i));
        
        if(xpoint + f < d)
        {
            xpoint += f;
            d = xpoint;
        }
    }
    }
    cout << d << endl;
}


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

#include <bits/stdc++.h>
using namespace std;
  
int main(){
  int64_t N;
  cin >> N;
  int64_t ans = 10000000000000;
  for(int64_t i=1; i*i <= N; i++){
    if(i + N/i < ans) ans = d[i] + N/d[i];
  }
  ans -= 2;
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:29: error: 'd' was not declared in this scope
    9 |     if(i + N/i < ans) ans = d[i] + N/d[i];
      |                             ^
Language: C++

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

int main() {
	long long N; cin >> N;
	long long res = sqrt(N);
	while (true) {
		if (N % res == 0) {
			break;
		}
		res--;
	}

	if (res == 0) {
		cout << N - 1 << endl;
	}
	else {
		cout << res + N / res - 2 << endl;
	}
}

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

#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b)  for(int i=(a),i##formax=(b);i< i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formin=(b);i>=i##formin;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max((x),(y))
#define mins(x,y) x=min((x),(y))
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define all(a) ((a).begin()),((a).end())
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define bit(n) (1LL<<(n))
typedef long long ll;
typedef __int128_t lll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>using P=pair<T,Y>;
template<class T,class Y>ostream& operator<<(ostream&o,P<T,Y>&p){return o<<"("<<p.fi<<","<<p.se<<")";}
template<class T>ostream& operator<<(ostream&o,V<T>&v){for(T&t:v)o<<t<<",";return o<<endl;}
template<class T>void uniq(V<T>&v){sort(all(v));v.erase(unique(all(v)), v.end());}

lll gcd(lll a,lll b,lll&x,lll&y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return(x%m+m)%m;}
ll modPow(lll a,lll n,ll m){lll p=1;for(;n;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return p;}
//V<ll>F,R;void setF(int n,int mod){F=R=V<ll>(++n);F[0]=1;FOR(i,1,n)F[i]=F[i-1]*i%mod;R[n-1]=modInv(F[n-1],mod);FORR(i,n-1,1)R[i-1]=R[i]*i%mod;}
//ll comb(int a,int b,int m){return a<b||b<0?0:F[a]*R[b]%m*R[a-b]%m;}

const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7; //998244353;
const int N = 1e5;
ll n;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  ll ans = 1;
  for(ll i=2; i*i<=n; i++) if(n%i==0) ans=i;
  cout << i+n/i-2 << endl;
}

Compiler output:
a.cc:37:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   37 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:43:11: error: 'i' was not declared in this scope
   43 |   cout << i+n/i-2 << endl;
      |           ^
Language: C++



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

	double max_i = sqrt(x)+1;

	long long num = x - 1;
	for (int i = 1; i < max_i; i++) {
		if ((x / i)*i == x) {
			long long candidate = (i - 1) + (x / i - 1);
			if (candidate < num) {
				num = candidate;
			}
		}
	}
		
	cout << num << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'cin' was not declared in this scope
    6 |         cin >> x;
      |         ^~~
a.cc:8:24: error: 'sqrt' was not declared in this scope
    8 |         double max_i = sqrt(x)+1;
      |                        ^~~~
a.cc:20:9: error: 'cout' was not declared in this scope
   20 |         cout << num << endl;
      |         ^~~~
a.cc:20:24: error: 'endl' was not declared in this scope
   20 |         cout << num << endl;
      |                        ^~~~
Language: C++

#include <bits/stdc++.h>
#include <ext/hash_map>
#include <ext/numeric>

using namespace std;
using namespace __gnu_cxx;

#define REP(i,n) for( (i)=0 ; (i)<(n) ; (i)++ )
#define rep(i,x,n) for( (i)=(x) ; (i)<(n) ; (i)++ )
#define REV(i,n) for( (i)=(n) ; (i)>=0 ; (i)-- )
#define FORIT(it,x) for( (it)=(x).begin() ; (it)!=(x).end() ; (it)++ )
#define foreach(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define rforeach(it,c) for(__typeof((c).rbegin()) it=(c).rbegin();it!=(c).rend();++it)
#define foreach2d(i, j, v) foreach(i,v) foreach(j,*i)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define SZ(x) ((int)(x).size())
#define MMS(x,n) memset(x,n,sizeof(x))
#define mms(x,n,s) memset(x,n,sizeof(x)*s)
#define pb push_back
#define mp make_pair
#define NX next_permutation
#define UN(x) sort(all(x)),x.erase(unique(all(x)),x.end())
#define CV(x,n) count(all(x),(n))
#define FIND(x,n) find(all(x),(n))-(x).begin()
#define ACC(x) accumulate(all(x),0)
#define PPC(x) __builtin_popcountll(x)
#define LZ(x) __builtin_clz(x)
#define TZ(x) __builtin_ctz(x)
#define mxe(x) *max_element(all(x))
#define mne(x) *min_element(all(x))
#define low(x,i) lower_bound(all(x),i)
#define upp(x,i) upper_bound(all(x),i)
#define NXPOW2(x) (1ll << ((int)log2(x)+1))
#define PR(x) cout << #x << " = " << (x) << endl ;

typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef pair<int, int> pii;

const int OO = (int) 2e9;
const double eps = 1e-9;

int main() {
	std::ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
#ifndef ONLINE_JUDGE
//	freopen("in.txt", "rt", stdin);
//	freopen("out.txt", "wt", stdout);
#endif
	ll n;
	cin >> n;
	ll res = n;
	for (ll i = 1; i * i <= n; i++) {
		if (n % i == 0) {
			res = min(res, i - 1, n / i - 1);
		}
	}
	cout << res << endl;
	return 0;
}


Compiler output:
In file included from /usr/include/c++/14/ext/hash_map:60,
                 from a.cc:2:
/usr/include/c++/14/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header which may be removed without further notice at a future date. Please use a non-deprecated interface with equivalent functionality instead. For a listing of replacement headers and interfaces, consult the file backward_warning.h. To disable this warning use -Wno-deprecated. [-Wcpp]
   32 | #warning \
      |  ^~~~~~~
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: In instantiation of 'constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare) [with _Tp = long long int; _Compare = long long int]':
a.cc:59:13:   required from here
   59 |                         res = min(res, i - 1, n / i - 1);
      |                               ~~~^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:284:17: error: '__comp' cannot be used as a function
  284 |       if (__comp(__b, __a))
      |           ~~~~~~^~~~~~~~~~
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:7:19: warning: left shift count >= width of type [-Wshift-count-overflow]
    7 |   long long ans=(1<<64)-1;
      |                  ~^~~~
a.cc:9:9: error: lvalue required as left operand of assignment
    9 |     if(n%i=0) {
      |        ~^~
Language: Java

import java.io.*;
import java.util.*;

public class Main {
	public static void main(String[] args) { new Main(); }
	FS in = new FS();
	PrintWriter out = new PrintWriter(System.out);

	long N;	
	
	Main() {
		N = in.nextLong();
		int min = (int)1e9;
		for (long i = 1; i * i <= N; i++)
			if (N %i == 0) {
				int j = N / i;
				min = min(min, i + j - 2);
			}
		out.println(min);
		out.close();
	}

	
	
	int abs(int x) { if (x < 0) return -x; return x; }
	long abs(long x) { if (x < 0) return -x; return x; }
	int max(int x, int y) { if (x < y) return y; return x; }
	int min(int x, int y) { if (x > y) return y; return x; }
	long max(long x, long y) { if (x < y) return y; return x; }
	long min(long x, long y) { if (x > y) return y; return x; }

	class FS {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens()) {
				try { st = new StringTokenizer(br.readLine()); }
				catch (Exception e) {}
			} return st.nextToken();
		}
		int nextInt() { return Integer.parseInt(next()); }
		long nextLong() { return Long.parseLong(next()); }
		double nextDouble() { return Double.parseDouble(next()); }

		void intArr(int sz, int[] x) { for (int i = 0; i < sz; i++) x[i] = nextInt(); }
		void longArr(int sz, long[] x) { for (int i = 0; i < sz; i++) x[i] = nextLong(); }
		void doubleArr(int sz, double[] x) { for (int i = 0; i < sz; i++) x[i] = nextDouble(); }
	}
}



Compiler output:
Main.java:16: error: incompatible types: possible lossy conversion from long to int
				int j = N / i;
				          ^
Main.java:17: error: incompatible types: possible lossy conversion from long to int
				min = min(min, i + j - 2);
				         ^
2 errors
Language: C++

#include<iostream>
#include<algorithm>
#include<functional>
using namespace std;
int main()
{
  int N;
  cin>>N;
  int a=1,b=N;
  for(int i=a;i=<b;i++){
    if(N%i==0){
      b=N/i;
    }
  }
  cout<<a+b-2<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:17: error: expected primary-expression before '<' token
   10 |   for(int i=a;i=<b;i++){
      |                 ^
Language: C++

#include<iostream>
#include<algorism>
#include<functional>
using namespace std;
int main()
{
  int N;
  cin>>N;
  int a=1,b=N;
  for(int i=a;i=<b;i++){
    if(N%i==0){
      b=N/i;
    }
  }
  cout<<a+b-2<<endl;
}

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

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define INF LLONG_MAX/10
#define rep(i,n) for(int i=0;i<n;i++)
#define krep(i,k,n,m) for(int i=k;i<n;i+=m)
#define erep(i,k,n) for(int i=k;i<n;i++)
#define mod 1000000007;
//最大公約数
int gcd(int s,int b){
    if(b==0)return s;
    return gcd(b,s%b);
}
signed main(){
    int kai=INF;
    int n;
    cin>>n;
    int min=
    rep(i,(n-n%2)/2){
        if(n%i==0){
            kai=min(kai,i+n/i-2);
        }
    }
    cout<<kai<<endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:5:18: error: expected primary-expression before 'for'
    5 | #define rep(i,n) for(int i=0;i<n;i++)
      |                  ^~~
a.cc:19:5: note: in expansion of macro 'rep'
   19 |     rep(i,(n-n%2)/2){
      |     ^~~
a.cc:19:9: error: 'i' was not declared in this scope
   19 |     rep(i,(n-n%2)/2){
      |         ^
a.cc:5:30: note: in definition of macro 'rep'
    5 | #define rep(i,n) for(int i=0;i<n;i++)
      |                              ^
Language: C++


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


Compiler output:
a.cc: In function 'int main()':
a.cc:11:38: error: expected ')' before ';' token
   11 |             s1=min(s1,(i-1)+((n/i)-1);
      |                   ~                  ^
      |                                      )
Language: C++


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


Compiler output:
a.cc: In function 'int main()':
a.cc:6:20: warning: overflow in conversion from 'double' to 'long long int' changes value from '1.0e+20' to '9223372036854775807' [-Woverflow]
    6 |     long long n,s1=1e20;
      |                    ^~~~
a.cc:11:38: error: expected ')' before ';' token
   11 |             s1=min(s1,(i-1)+((n/i)-1);
      |                   ~                  ^
      |                                      )
Language: C++

#include <iostream>
#include <cmath>
using namespace std;
int main(void){
long long n;
cin >> n;
long long a,b;
for(int i=1;i<sqrt(n);i++){
if(n % i == 0){
a = i;
b = n / i;
}

cout << a + b - 2 << endl;

return 0;
}




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

#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
using ll = long long;
int main() {
    ll n;
    std::vector<ll> vec;
    std::cin >> n;
    for (ll i = 1; i*i <= n; i++) {
        if (n % i == 0) {
            ll p = n / i;
            vec.push_back(p+i-2);
        }
    }
    std::cout << (*std::min_element(vec.begin(), vec.end()) << std::endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:16:61: error: invalid operands of types 'long long int' and '<unresolved overloaded function type>' to binary 'operator<<'
   16 |     std::cout << (*std::min_element(vec.begin(), vec.end()) << std::endl;
      |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
a.cc:16:73: error: expected ')' before ';' token
   16 |     std::cout << (*std::min_element(vec.begin(), vec.end()) << std::endl;
      |                  ~                                                      ^
      |                                                                         )
a.cc:16:74: error: expected '}' at end of input
   16 |     std::cout << (*std::min_element(vec.begin(), vec.end()) << std::endl;
      |                                                                          ^
a.cc:6:12: note: to match this '{'
    6 | int main() {
      |            ^
Language: C++

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

using namespace std;


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

	long long n;
	cin >> n;

	long long ans = 10e12;
	for (int i = 1; pow(i, 2) <= n; i++) {
		if (n % i == 0) {
			ans = min(ans, i + n / i - 2);
		}
	}

	cout << ans << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:25: error: 'pow' was not declared in this scope
   19 |         for (int i = 1; pow(i, 2) <= n; i++) {
      |                         ^~~
Language: C++

#include<iostream>
using namespace std;
int main(){
  int n;
  cin>>n;
  int a;
  for(int i=1;i*i<=n;i++){
    if(n%i)a=i;
  }
  ans=a+n/a-2;
  printf("%d\n",ans);
}

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

n = int(input())
for i in range(-int(-n**0.5//1),0,-1):
  if n%i==0:
    a=i
    b=n//i
print(a+b-2)

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n = int(input())
      | ^
Language: Java

import java.util.Scanner;
 
public class Main{
    public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
     
      int n = sc.nextInt();
      int count;
      
      for(int i = 1; i <= n; i++){
        for(int j = 1; j <= n; j++){
          if(i*j == n){
            if((i + j) < count){
              count = i + j;
            }
          }
        }
      }
      
      System.out.println(count - 2);
      
      sc.close();
    }
}

Compiler output:
Main.java:13: error: variable count might not have been initialized
            if((i + j) < count){
                         ^
Main.java:20: error: variable count might not have been initialized
      System.out.println(count - 2);
                         ^
2 errors
Language: C++

#include<iostream>
using namespace std;

int main() {
	int n;
	cin >> n;

	int a = sqrt(n);
	int ans;
	for (int i = a; i >= 1; i--) {
		if (n%i == 0) {
			ans = i;
			break;
		}
		else {
			continue;
		}
		break;
	}

	cout << ans + n / ans - 2 << endl;
}

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

n = int(input())
X = []
for i in range(2,int(10**12+1)):
  q,mod = divmod(n,i)
  if mod == 0:
    s = i+q
    X.append(s)
  
print(min(X))

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n = int(input())
      | ^
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:7:5: error: 'll' was not declared in this scope
    7 |     ll ans = 1e18;
      |     ^~
a.cc:12:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
   12 |       ans = min(ans,i+j-2);
      |       ^~~
      |       abs
a.cc:15:10: error: 'ans' was not declared in this scope; did you mean 'abs'?
   15 |  cout << ans << endl;
      |          ^~~
      |          abs
Language: C++

using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
int main(){
    int N;
    cin >> N;
    priority_queue<int,vector<int>,greater<int>> que;
  int M = N ^ (1/2);
 for(int (i)=1;(i)<(M);(i)++){
     if( N%i == 0 ) {
      int j = N/i ;
     que.push(i+j-2);
     }
 }
 cout <<que.top() << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:5: error: 'cin' was not declared in this scope
    5 |     cin >> N;
      |     ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:6:5: error: 'priority_queue' was not declared in this scope
    6 |     priority_queue<int,vector<int>,greater<int>> que;
      |     ^~~~~~~~~~~~~~
a.cc:1:1: note: 'std::priority_queue' is defined in header '<queue>'; this is probably fixable by adding '#include <queue>'
  +++ |+#include <queue>
    1 | using namespace std;
a.cc:6:20: error: expected primary-expression before 'int'
    6 |     priority_queue<int,vector<int>,greater<int>> que;
      |                    ^~~
a.cc:11:6: error: 'que' was not declared in this scope
   11 |      que.push(i+j-2);
      |      ^~~
a.cc:14:2: error: 'cout' was not declared in this scope
   14 |  cout <<que.top() << endl;
      |  ^~~~
a.cc:14:2: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:14:9: error: 'que' was not declared in this scope
   14 |  cout <<que.top() << endl;
      |         ^~~
a.cc:14:22: error: 'endl' was not declared in this scope
   14 |  cout <<que.top() << endl;
      |                      ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
int main(){
    int N;
    cin >> N;
    priority_queue<int,vector<int>,greater<int>> que;
  for (int (i)=1;(i)<(n);(i)++){
     if( N%i == 0 ) {
      int j = N/i ;
     que.push(i+j-2);
     }
 }
 cout <<que.top() << endl;
}

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

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

int main() {
    long long n;
    cin >>n;
    long long ans=1e13;
    for(long long i=1; i<sqrt(n); ++i){
        if(n%i==0 && ans>(n/i)){
            ans=(j-1)+(i-1);
        }
    }
    cout << ans <<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:18: error: 'j' was not declared in this scope
   10 |             ans=(j-1)+(i-1);
      |                  ^
Language: C++

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

int main() {
    long long n;
    cin >>n;
    long long ans=1e13;
    for(long long i=1; i<sqrt(n); ++i){
        if(n%i==0 && ans>(n/i){
            ans=(j-1)+(i-1);
        }
    }
    cout << ans <<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:31: error: expected ')' before '{' token
    9 |         if(n%i==0 && ans>(n/i){
      |           ~                   ^
      |                               )
a.cc:12:5: error: expected primary-expression before '}' token
   12 |     }
      |     ^
Language: C++

#include <iostream>

using namespace std;

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

    long long ans = 1001001001001;
    for (long long i=1; i<=sqrt(n); i++) {
        if (n%i != 0) continue;
        long long j = n/i;
        ans = min(ans, i+j-2);
    }

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


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

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

typedef long long int64;

int main(void) {
  int64 n;
  std::cin >> n;
  std::vector<std::pair<int64, int64> > ps;
  int64 sq_n = std::sqrt(n);
  for (int64 i = 1; i <= sq_n; i++) {
    if (n % i == 0) {
      std::pair<int64, int64> p(i, n / i);
      ps.push_back(p);
    }
  }

  int64 min = LLONG_MAX;

  for (auto p : ps) {
    int64 val = p.first + p.second - 2;
    min = std::min(min, val);
  }

  std::cout << min << std::endl;

  return 0;
}


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

int Main()
{
    #include <math.h>
    #include <stdio.h>
    int int_n;
    double s;
    scanf("%d",&int_n);
    s = sqrt(
        int_n
    );
    int i;
    i = s;
    while(i >= 1)
    {
          if (int_n % i == 0){
            int j;
            j = int_n/i;
            printf(math.floor((i - 1) + (j - 1)))
            break;
          }
              i = i - 1;
    }
}

Compiler output:
main.c: In function 'Main':
main.c:18:20: error: 'math' undeclared (first use in this function)
   18 |             printf(math.floor((i - 1) + (j - 1)))
      |                    ^~~~
main.c:18:20: note: each undeclared identifier is reported only once for each function it appears in
main.c:18:50: error: expected ';' before 'break'
   18 |             printf(math.floor((i - 1) + (j - 1)))
      |                                                  ^
      |                                                  ;
   19 |             break;
      |             ~~~~~
Language: C

Main()
{
#include <math.h>
#include <stdio.h>
    int int_n;
    double s;
    scanf("%d",&int_n);
    s = sqrt(
        int_n
    );
    int i;
    i = s;
    while(i >= 1)
    {
          if (int_n % i == 0){
            int j = int_n/i;
            printf(math.floor((i - 1) + (j - 1)))
            break;
          }
              i = i - 1;
    }
}


Compiler output:
main.c:1:1: error: return type defaults to 'int' [-Wimplicit-int]
    1 | Main()
      | ^~~~
main.c: In function 'Main':
main.c:17:20: error: 'math' undeclared (first use in this function)
   17 |             printf(math.floor((i - 1) + (j - 1)))
      |                    ^~~~
main.c:17:20: note: each undeclared identifier is reported only once for each function it appears in
main.c:17:50: error: expected ';' before 'break'
   17 |             printf(math.floor((i - 1) + (j - 1)))
      |                                                  ^
      |                                                  ;
   18 |             break;
      |             ~~~~~