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

#include <bits/stdc++.h>

using namespace std;

typedef unsigned uint;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ldbl;
typedef pair<int, int> pii;
typedef pair<uint, uint> puu;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pull;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<uint> vu;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pii> vpii;
typedef vector<puu> vpuu;
typedef vector<pll> vpll;
typedef vector<pull> vpull;
typedef vector<string> vstr;
typedef vector<double> vdbl;
typedef vector<ldbl> vldbl;
#define pb push_back
#define ppb pop_back
#define pfr push_front
#define ppfr pop_front
#define emp emplace
#define empb emplace_back
#define be begin
#define rbe rbegin
#define all(x) (x).be(), (x).end()
#define rall(x) (x).rbe(), (x).rend()
#define fir first
#define sec second
#define mkp make_pair
#define brif(cond) if (cond) break
#define ctif(cond) if (cond) continue
#define retif(cond) if (cond) return
void canhazfast() {ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);}
template<typename T> T gcd(T a, T b) {return b ? gcd(b, a%b) : a;}
template<typename T> T extgcd(T a, T b, T &x, T &y)
{
    T x0 = 1, y0 = 0, x1 = 0, y1 = 1;
    while (b) {
        T q = a/b; a %= b; swap(a, b);
        x0 -= q*x1; swap(x0, x1);
        y0 -= q*y1; swap(y0, y1);
    }
    x = x0; y = y0; return a;
}
int ctz(uint x) {return __builtin_ctz(x);}
int ctzll(ull x) {return __builtin_ctzll(x);}
int clz(uint x) {return __builtin_clz(x);}
int clzll(ull x) {return __builtin_clzll(x);}
int popcnt(uint x) {return __builtin_popcount(x);}
int popcntll(ull x) {return __builtin_popcountll(x);}
int bsr(uint x) {return 31^clz(x);}
int bsrll(ull x) {return 63^clzll(x);}

int main()
{
    canhazfast();

    int n;

    cin >> n;
    for (int i = 1; i < 10; ++i) {
        retif(n%i == 0 && n/i < 10) cout << "Yes\n";
    }
    cout << "No\n";

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:70:42: error: cannot convert 'std::basic_ostream<char>' to 'int' in return
   70 |         retif(n%i == 0 && n/i < 10) cout << "Yes\n";
      |                                     ~~~~~^~~~~~~~~~
      |                                          |
      |                                          std::basic_ostream<char>
Language: C

n=int(input())

def solve():
    for i in range(1,10):
        for j in range(1,10):
            if(i*j==n):
                print("Yes")
                return
    print("No")

solve()

Compiler output:
main.c:1:1: warning: data definition has no type or storage class
    1 | n=int(input())
      | ^
main.c:1:1: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
main.c:1:3: error: expected expression before 'int'
    1 | n=int(input())
      |   ^~~
Language: C++

#include <cmath>
#include <cstdio>
#include <vector>
#include <list>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <stack>
#include <fstream>
#include <queue>
#include <iomanip>
#include <iterator>
#include <map>
#include <unordered_map>
#include <set>
#define fast ios_base::sync_with_stdio(false)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vvi vector<vi >
#define pi pair<ll,ll>
#define vvpi vector<vector<pi > >
#define vpi vector<pi >
#define vppi vector<pair<ll,pi > >
#define vs vector<string>
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define fs first
#define se second
#define crz(v,n,c) v.clear(),v.resize(n,c)
#define print(v) for(ll it=0;it<v.size();it++) cout<<v[it]<<" ";cout<<endl
#define printp(v) for(ll it=0;it<v.size();it++) cout<<v[it].first<<" "<<v[it].second<<endl
using namespace std;
int main(){
	ll n,i;
	cin>>n;
	for(i=1;i<=9;i++) if(n%i==0&&n/i<=9) return cout<<"Yes\n";
	cout<<"No\n";
}


Compiler output:
a.cc: In function 'int main()':
a.cc:40:57: error: cannot convert 'std::basic_ostream<char>' to 'int' in return
   40 |         for(i=1;i<=9;i++) if(n%i==0&&n/i<=9) return cout<<"Yes\n";
      |                                                     ~~~~^~~~~~~~~
      |                                                         |
      |                                                         std::basic_ostream<char>
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
inline ll read(){
    ll res=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-f;ch=getchar();}
    while(ch>='0'&&ch<='9'){res=(res<<3)+(res<<1)+ch-'0';ch=getchar();}
    return res*f;
}
void write(ll x){
    if(x<0) putchar('-'),x=-x;
    if(x>9) write(x/10);
    putchar(x%10|'0');
}
signed main(){
    int a=read();
    for(int i=1;i<=9;i++){
        for(int j=1;j<=9;j++)
        if(i*j==n){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:17: error: 'n' was not declared in this scope
   21 |         if(i*j==n){
      |                 ^
Language: C++

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

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i < 10; ++i)
    if (n / i < 10 && n / i * i == n) {
      puts("Yes");
      return 0;
    }
  puts("No")
}

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

n = int(input())
r = False
for i in range(1, 10):
    for j in range(1, 10):
        if i* j == n:
            r = True
print("Yes" if r else "No")

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;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (int i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()

int n;

int main() {
    cin >> n;
    FOR (i, 1, 10) FOR (j, 1, 10) {
        if (n == i*j) {
            cout << "Yes" << endl;
            return;
        }
    }
    cout << "No" << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:13: error: return-statement with no value, in function returning 'int' [-fpermissive]
   31 |             return;
      |             ^~~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define sim template <class c
#define ris return *this
#define dor > debug &operator<<
#define eni(x)                                                                        \
	sim > typename enable_if<sizeof dud<c>(0) x 1, debug &>::type operator<<(c i) \
	{
sim > struct rge
{
	c b, e;
};
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c *x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug
{
#ifdef LOCAL
	~debug()
	{
		cerr << endl;
	}
	eni(!=) cerr << boolalpha << i;
	ris;
} eni(==) ris << range(begin(i), end(i));
}
sim, class b dor(pair<b, c> d)
{
	ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d)
{
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
	sim dor(const c &)
	{
		ris;
	}
#endif
}
;
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define forn(i, n) for (ll i = 0; i < int(n); i++)
#define rfor(n, i) for (ll i = (n - 1); i >= 0; --i)
#define all(V) V.begin(), V.end()
#define rall(V) V.rbegin(), V.rend()
#define len(V) (int)V.size()
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define endl '\n'
#define M_PI 3.14159265358979323846
#define EPS 1e-7

vector<ll> func(ll n)
{
	vector<ll> res;
	res.pb(1LL), res.pb(n);
	for (ll i = 2; i * 1LL * i <= n); ++i)
	{
		if (i * 1LL * i == n)
		{
			res.pb(i);
		}
		else if (n % i == 0LL)
		{
			res.pb(i);
			res.pb(n / i);
		}
	}
	return res;
}

void solve()
{
	ll n; cin >> n;
	vector<ll> d = func(n);
	if (d.size() == 2)
	{
		cout << n - 1 << endl;
	}
	else
	{
		sort(all(d));
		ll res = INT_MAX;
		for (ll i = 0; i < d.size() / 2; ++i)
		{
			res = min(res, d[i] + d[d.size() - 1 - i] - 2LL);
		}
		if (d.size() % 2 != 0) cout << 2 * (sqrt(n) - 1);
		else cout << res << endl;
	}
	
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	solve();
}

Compiler output:
a.cc: In function 'std::vector<long long int> func(long long int)':
a.cc:69:40: error: expected ';' before ')' token
   69 |         for (ll i = 2; i * 1LL * i <= n); ++i)
      |                                        ^
      |                                        ;
a.cc:69:45: error: 'i' was not declared in this scope
   69 |         for (ll i = 2; i * 1LL * i <= n); ++i)
      |                                             ^
Language: C++

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

int main(){
  ll n,min=0;
  cin >> n;
  vector<ll> a;
  
  for(ll i=1; i<=sqrt(n); i++){
    if(n%i==0) a.push_back(i);
  }
  ll b=a.size();
  
  for(ll i=0; i<b; i++)
    min=a[i]+n/a[i]-2;
  
  cout << min << endl
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:22: error: expected ';' before '}' token
   19 |   cout << min << endl
      |                      ^
      |                      ;
   20 | }
      | ~
Language: C++

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

int main(){
  ll n;
  cin >> n;
  vector<ll> a;
  
  for(ll i=1; i<=n; i++){
    if(n%i==0) a.push_back(i);
  }
  ll b=a.size();
  
  for(ll i=0; i<(b+1)/2; i++)
    ll min=a[i]+a[b-1-i]-2;
  
  printf("%d",min);
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:9: error: overloaded function with no contextual type information
   19 |   printf("%d",min);
      |   ~~~~~~^~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
//二項係数の計算
int nCr(int A, int B) {
    ll ans = 1;
    for (int i = 0; i < B; i++) {
        ans *= A - i;
    }
    for (int i = 0; i < B; i++) {
        ans /= i + 1;
    }
    return ans;
}
int main() {
 ll N;
 cin>>N;
 cout<<__gcd(N)+N/__gcd(N)-2<<endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:20:13: error: no matching function for call to '__gcd(ll&)'
   20 |  cout<<__gcd(N)+N/__gcd(N)-2<<endl;
      |        ~~~~~^~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:1137:5: note: candidate: 'template<class _EuclideanRingElement> _EuclideanRingElement std::__gcd(_EuclideanRingElement, _EuclideanRingElement)'
 1137 |     __gcd(_EuclideanRingElement __m, _EuclideanRingElement __n)
      |     ^~~~~
/usr/include/c++/14/bits/stl_algo.h:1137:5: note:   candidate expects 2 arguments, 1 provided
a.cc:20:24: error: no matching function for call to '__gcd(ll&)'
   20 |  cout<<__gcd(N)+N/__gcd(N)-2<<endl;
      |                   ~~~~~^~~
/usr/include/c++/14/bits/stl_algo.h:1137:5: note: candidate: 'template<class _EuclideanRingElement> _EuclideanRingElement std::__gcd(_EuclideanRingElement, _EuclideanRingElement)'
 1137 |     __gcd(_EuclideanRingElement __m, _EuclideanRingElement __n)
      |     ^~~~~
/usr/include/c++/14/bits/stl_algo.h:1137:5: note:   candidate expects 2 arguments, 1 provided
Language: C++

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

int main(){
  ll n;
  cin >> n;
  vector<ll> a;
  for(ll i=1; i<=n; i++){
    for(ll j=1; j<=(n+1)/2; j++){
      if(i*j==n)  a.push_back()=i+j;
    }
  }
  ll min=n;
  rep(i,a.size()) if(a[i]<min) min=a[i];
  
  cout << min-2 << endl;
}
  
      


Compiler output:
a.cc: In function 'int main()':
a.cc:12:30: error: no matching function for call to 'std::vector<long long int>::push_back()'
   12 |       if(i*j==n)  a.push_back()=i+j;
      |                   ~~~~~~~~~~~^~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; value_type = long long int]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; value_type = long long int]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note:   candidate expects 1 argument, 0 provided
Language: C++

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

int main(){
  ll n;
  cin >> n;
  vector<ll> a;
  for(ll i=1; i<=n; i++){
    for(ll j=1; j<=(n+1)/2; j++){
      if(i*j==n)  a.push_back()=i+j;
    }
  }
  ll min=n
  rep(i,a.size()) if(a[i]<min) min=a[i];
  
  cout << min-2 << endl;
}
  
      

Compiler output:
a.cc: In function 'int main()':
a.cc:12:30: error: no matching function for call to 'std::vector<long long int>::push_back()'
   12 |       if(i*j==n)  a.push_back()=i+j;
      |                   ~~~~~~~~~~~^~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; value_type = long long int]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; value_type = long long int]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note:   candidate expects 1 argument, 0 provided
a.cc:2:18: error: expected ',' or ';' before 'for'
    2 | #define rep(i,n) for(int i=0; i<(n); i++)
      |                  ^~~
a.cc:16:3: note: in expansion of macro 'rep'
   16 |   rep(i,a.size()) if(a[i]<min) min=a[i];
      |   ^~~
a.cc:16:7: error: 'i' was not declared in this scope
   16 |   rep(i,a.size()) if(a[i]<min) min=a[i];
      |       ^
a.cc:2:31: note: in definition of macro 'rep'
    2 | #define rep(i,n) for(int i=0; i<(n); i++)
      |                               ^
Language: C++

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


Compiler output:
a.cc: In function 'int main()':
a.cc:3:33: error: expected primary-expression before '<' token
    3 | #define rep(i,n) for(long i=1;i=<n;i++)
      |                                 ^
a.cc:9:3: note: in expansion of macro 'rep'
    9 |   rep(i,sqrt(n)){
      |   ^~~
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>;

const int N_MAX = (ll) 1e9;
vector<pair<ll, int>> factors;
int factor_size;
ll n;
ll ans = (ll) 1e16;

// Sieve of Eratosthenes
// https://youtu.be/UTVg7wzMWQc?t=2774
struct Sieve {
    int n;
    vector<int> f, primes;
    Sieve(int n=1):n(n), f(n+1) {
        f[0] = f[1] = -1;
    for (ll i = 2; i <= n; ++i) {
      if (f[i]) continue;
      primes.push_back(i);
      f[i] = i;
      for (ll j = i*i; j <= n; j += i) {
        if (!f[j]) f[j] = i;
      }
    }
  }
  bool isPrime(int x) { return f[x] == x;}
  vector<int> factorList(int x) {
    vector<int> res;
    while (x != 1) {
      res.push_back(f[x]);
      x /= f[x];
    }
    return res;
  }
  vector<P> factor(int x) {
    vector<int> fl = factorList(x);
    if (fl.size() == 0) return {};
    vector<P> res(1, P(fl[0], 0));
    for (int p : fl) {
      if (res.back().first == p) {
        res.back().second++;
      } else {
        res.emplace_back(p, 1);
      }
    }
    return res;
  }
  vector<pair<ll,int>> factor(ll x) {
    vector<pair<ll,int>> res;
    for (int p : primes) {
      int y = 0;
      while (x%p == 0) x /= p, ++y;
      if (y != 0) res.emplace_back(p,y);
    }
    if (x != 1) res.emplace_back(x,1);
    return res;
  }
};

void dfs (ll product, int index) {
    if (index == factor_size) {
        ll sum = product + n/product;
        ans = min(ans, sum);
        return;
    }
    for (int i = 0; i <= factors.at(index).second; ++i) {
        dfs(product, index + 1);
        product *= factors.at(index).first;
    }
}

int main() {
    cin >> n;

    Sieve sv();
    factors = sv.factor(n);
    factor_size = factors.size();
    dfs(1, 0);
    cout << (ll) ans - 2 << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:78:13: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   78 |     Sieve sv();
      |             ^~
a.cc:78:13: note: remove parentheses to default-initialize a variable
   78 |     Sieve sv();
      |             ^~
      |             --
a.cc:78:13: note: or replace parentheses with braces to value-initialize a variable
a.cc:79:18: error: request for member 'factor' in 'sv', which is of non-class type 'Sieve()'
   79 |     factors = sv.factor(n);
      |                  ^~~~~~
Language: C++

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

using namespace std;
using ll = long long;

bool IsPrime(long long num) {
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2) {
		if (num % i == 0) {
			return false;
		}
	}
	return true;
}

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

	long long ans = N;
	if (IsPrime(N)) {
		ans -= 1;
	}
	else {
		for (int i = 2; i <= N; ++i) {
			if (N % i == 0) {
				long long result = (N / i) - 1 + i - 1;
				if (ans > result) {
					ans = result;
				}
				else {
					break;
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc: In function 'bool IsPrime(long long int)':
a.cc:14:26: error: 'sqrt' was not declared in this scope
   14 |         double sqrtNum = sqrt(num);
      |                          ^~~~
Language: C++

//#pragma warning(disable : 4996)
#include<iostream>
#include<vector>
#include<algorithm>
#include<fstream>
#include<stdio.h>
#include<map>
#include<set>
#include<limits.h>
#include<list>
#include <cassert>
#include<sstream>
#include<locale>
#include <bitset>
using namespace std;
using ll = long long int;

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





Compiler output:
a.cc: In function 'int main()':
a.cc:21:19: error: 'sqrt' was not declared in this scope
   21 |         for(int i=sqrt(n);i>0;--i)
      |                   ^~~~
Language: Java

import java.util.*;

public class std{
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		long n = input.nextLong();
		long res = Long.MAX_VALUE;
		for(long i = 1;i*i<=n;i++){
			long j = n/i;
			if(j*i == n){
				res = Math.min(res,j+i-2);
			}
		}
		System.out.println(res);
	}
}

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

import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		long n = scn.nextLong();
		long i = 1;
       	long j = 1;
      	long a = 1;
      while(a<=n/a){
        if(n%a==0){
          i = a;
          j = N/i;
        }
        a++;
      }
      System.out.println(i+j-2);
	}
}

Compiler output:
Main.java:13: error: cannot find symbol
          j = N/i;
              ^
  symbol:   variable N
  location: class Main
1 error
Language: C++

    #include <iostream>
    #include <iomanip>
    #include <algorithm>
    #include <vector>
    #include <set>
    #include <map>
    #include <cmath>
    #define rep(i,n) for (int i = 0; i < n; ++i)
    using namespace std;
    using ll = long long;
    using P = pair<int,int>;
     
    int main() {
      ll N;
      cin >> N;
      int m = 1000000;
      ll ans = 1000000000010;
      for (int i = 1; i <= m && i <= n; ++i) {
        if (n %i ==0) {
          ll tmp = i + n/i;
          ans = min(ans, tmp);
        }
      }
      cout << ans - 2 << endl;
      return 0;
    }

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

import java.util.Scanner;

public class CtestRepJ {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        long minResult = N - 1;
        for (long i = 1; i <= N; i++) {
            if (N % i == 0) {
                long j = N / i;
                minResult = Math.min(((i - 1) + (j - 1)), minResult);
            }
        }
        System.out.println(minResult);
    }
}


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

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
	ll N; cin >> N;
    for(int i=2;i<sqrt(n0;i++){
    	if(N%i==0){
        	ans = min(ans, i + N / i - 2);
        }
    }
       cout<<ans;
      return 0;
        }

Compiler output:
a.cc: In function 'int main()':
a.cc:52:24: error: 'n0' was not declared in this scope; did you mean 'y0'?
   52 |     for(int i=2;i<sqrt(n0;i++){
      |                        ^~
      |                        y0
a.cc:54:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   54 |                 ans = min(ans, i + N / i - 2);
      |                 ^~~
      |                 abs
a.cc:57:14: error: 'ans' was not declared in this scope; did you mean 'abs'?
   57 |        cout<<ans;
      |              ^~~
      |              abs
Language: C++

/**
 *    Author  : Ador
 *    Created : 24.07.2020
**/
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <algorithm>
#include <string>
#include <cstring>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <cctype>
typedef long long int ll ;
typedef unsigned long long int ull ;
using namespace std ;
int main(void)
{
    ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0) ;
        //freopen("input.txt", "r", stdin) ;
        //freopen("output.txt", "w", stdout) ;
    ll n , a , b , i , result = INT_MAX , flag = 0 ; cin >> n ;
    for(i = 1 ; i * i < n ; ++i)
    {
        if(!(n % i))
        {
            a = i ;
            b = n / i ;
            flag = 1 ;
            result = min(result , ((a - 1) + (b - 1))) ;
        }
    }
    if(flag) cout << result << "\n" ;
    else cout << n - 1 << "\n" ;
    return 0 ;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:33: error: 'INT_MAX' was not declared in this scope
   23 |     ll n , a , b , i , result = INT_MAX , flag = 0 ; cin >> n ;
      |                                 ^~~~~~~
a.cc:15:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   14 | #include <cctype>
  +++ |+#include <climits>
   15 | typedef long long int ll ;
a.cc:30:13: error: 'flag' was not declared in this scope
   30 |             flag = 1 ;
      |             ^~~~
a.cc:34:8: error: 'flag' was not declared in this scope
   34 |     if(flag) cout << result << "\n" ;
      |        ^~~~
Language: C++

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

int main(void)
{
    ll n,ans=INF; cin>>n;
    for(int i=1;i<=sqrt(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:7:14: error: 'INF' was not declared in this scope
    7 |     ll n,ans=INF; cin>>n;
      |              ^~~
Language: C++

#include <iostream>
#include <stdio.h>
using namespace std;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:10:19: error: expected '(' before '*' token
   10 |                 if*(N%i==0) ans = min(i+N-2,ans);
      |                   ^
      |                   (
Language: C++


#include <bits/stdc++.h>
#include <string.h>
#include <vector>
//s#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX 10000

using namespace std;

#define ll long long
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a; i<n; i++)
#define r0 return 0
#define INF (int)1e15
#define MOD 1000000007

 int main(){


  long long n,d;
  cin>>n;

  for(int i=1;i<=sqrt(n);i++){

   if(n%i == 0)
    d = max(i,d);
  }

  long long b = n/d;
   // int ani = n/d;

   // cout<<b<<endl;
   // cout<<ani<<endl;

  cout<<b-1+d-1<<endl;

 return 0;
 }

Compiler output:
a.cc: In function 'int main()':
a.cc:28:12: error: no matching function for call to 'max(int&, long long int&)'
   28 |     d = max(i,d);
      |         ~~~^~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algobase.h: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:28:12: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   28 |     d = max(i,d);
      |         ~~~^~~~~
/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:28:12: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   28 |     d = max(i,d);
      |         ~~~^~~~~
Language: C++



#include <bits/stdc++.h>
#include <string.h>
#include <vector>
//s#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX 10000

using namespace std;

#define ll long long
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a; i<n; i++)
#define r0 return 0
#define INF (int)1e15
#define MOD 1000000007

 int main(){


  long long n;
  cin>>n;

  for(int i=0;i<=sqrt(n);i++){

   if(n%i == 0)
    d = max(i,d);
  }

  long long b = n/d;

  cout<<b-1+d-1<<endl;

 return 0;
 }


Compiler output:
a.cc: In function 'int main()':
a.cc:29:5: error: 'd' was not declared in this scope
   29 |     d = max(i,d);
      |     ^
a.cc:32:19: error: 'd' was not declared in this scope
   32 |   long long b = n/d;
      |                   ^
Language: C++

#include<bits/stdc++.h>
#define ll long long 
using namespace std;
 
int main(){
    ll n;
    cin>>n;
    ll ans=1000000000005;
    for(ll i=1;i<=sqrt(n);i++){
        ll j=n/i;
        if(j*i==n) ans=min(ans,i+j-2);
    }
    cout<<ans<<"\n";
    return 0;

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

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


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

Compiler output:
a.cc: In function 'int main()':
a.cc:14:5: error: expected ',' or ';' before 'for'
   14 |     for(ll i = 2; i*i <= n; i++){
      |     ^~~
a.cc:14:19: error: 'i' was not declared in this scope
   14 |     for(ll i = 2; i*i <= n; i++){
      |                   ^
Language: C++

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

int main(){
  long long N;
  cin>>N;
  int i=1;
  while(true){
    if(N%i=0){
      int ans=N/i;
      break;
    }
  }
  cout<<i+ans-2;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: lvalue required as left operand of assignment
    9 |     if(N%i=0){
      |        ~^~
a.cc:14:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   14 |   cout<<i+ans-2;
      |           ^~~
      |           abs
Language: C++

#include <iostream>
using namespace std;

int main(){
  long long N;
  cin>>N;
  int i=1;
  while(true){
    if(N%i=0){
      int ans=N/i;
      break;
    }
  }
  cout<<i+ans-2;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: lvalue required as left operand of assignment
    9 |     if(N%i=0){
      |        ~^~
a.cc:14:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   14 |   cout<<i+ans-2;
      |           ^~~
      |           abs
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      	//入力値
      	long n = sc.nextLong();
      
      	//入力値の平方根
      	int a = Math.sqrt(n);
      	//移動回数
      	long b =0;
      	
      	for(int i = 1;i>=a+1;++1){
          if(n%i=0){
            if(i==1){
              b = 1+(n/1 - 1);
            }else if(b<(i-1)+(n/1 - 1)){
              b = (i-1)+(n/1 - 1);
            }
          }
        }
      System.out.print(b);
      	

    }
}


Compiler output:
Main.java:9: error: incompatible types: possible lossy conversion from double to int
      	int a = Math.sqrt(n);
      	                 ^
Main.java:13: error: unexpected type
      	for(int i = 1;i>=a+1;++1){
      	                       ^
  required: variable
  found:    value
Main.java:14: error: unexpected type
          if(n%i=0){
              ^
  required: variable
  found:    value
3 errors
Language: Java

import java.util.*;
 
public class Main {
    public static void main(String args[]) {
       //値の取得
       Scanner sc = new Scanner(System.in);
       long N = sc.nextLong(); //long型で宣言
       double root = Math.sqrt(N);
       long a = 1; //最初の地点
       long b = 1; //最初の地点
       long count = 0; //移動回数
       
       while(a < root){
           if(N%a == 0){ //aで割り切れる時
               b = N/a ;　//商をbとして設定
           }
           
       }
       
       

Compiler output:
Main.java:15: error: illegal character: '\u3000'
               b = N/a ;?//??b?????
                        ^
Main.java:18: error: reached end of file while parsing
       }
        ^
2 errors
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        double N = sc.nextInt();
        double roop = Math.sqrt(N);
      	double x = 1;
        double y;
      	int count = 0;
        while(x <= roop){
          if(N % x == 0){
            y = N / x;
            if(x + y - 2 < count || count == 0){
              count = (int)x + y - 2;
            }
          }
          x += 1;
        }
		 System.out.println(count);            
    }
}

Compiler output:
Main.java:14: error: incompatible types: possible lossy conversion from double to int
              count = (int)x + y - 2;
                                 ^
1 error
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        double roop = Math.sqrt(N);
      	double i = 2;
      	int x = 2;
        int y;
      	int count = 0;
        int endX;
        int endY;
        int sum;
        while(i < roop){
          if(N % x == 0){
            y = N / x;
            if(x + y - 2 < count || count == 0){
              endX = x;
              endY = y;
            }
          }
          x += 1;
          i += 1;
        }
        sum = endX + endY - 2;
		 System.out.println(sum);            
    }
}

Compiler output:
Main.java:25: error: variable endX might not have been initialized
        sum = endX + endY - 2;
              ^
Main.java:25: error: variable endY might not have been initialized
        sum = endX + endY - 2;
                     ^
2 errors
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        double roop = Math.sqrt(N);
      	double i = 2;
      	int x = 2;
        int y;
      	int count = 0;
        int endX;
        int endY;
        while(i < roop){
          if(N % x == 0){
            y = N / x;
            if(x + y - 2 < count || count == 0){
              endX = x;
              endY = y;
            }
          }
          x += 1;
          i += 1;
        }
        sum = endX + endY - 2;
		 System.out.println(sum);            
    }
}

Compiler output:
Main.java:24: error: cannot find symbol
        sum = endX + endY - 2;
        ^
  symbol:   variable sum
  location: class Main
Main.java:25: error: cannot find symbol
		 System.out.println(sum);            
		                    ^
  symbol:   variable sum
  location: class Main
2 errors
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        double roop = Math.sqrt(N);
      	double i = 2;
      	int x = 2;
        int y;
      	int count = 0;
        int endX;
        int endY
        while(i < roop){
          if(N % x == 0){
            y = N / x;
            if(x + y - 2 < count || count == 0){
              endX = x;
              endY = y;
            }
          }
          x += 1;
          i += 1;
        }
        sum = endX + endY - 2;
		 System.out.println(sum);            
    }
}

Compiler output:
Main.java:12: error: ';' expected
        int endY
                ^
1 error
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
      	int x = 2;
        int y;
        int sum;
        while(N % x == 0){
          i++;
        }
      	y = N / x;
        sum = (x-1)+(y-1);
		 System.out.println(sum);            
    }
}

Compiler output:
Main.java:10: error: cannot find symbol
          i++;
          ^
  symbol:   variable i
  location: class Main
1 error
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
      	int x = 2;
        int y;
        int sum;
        while(N % x == 0){
          i++
        }
      	y = N / x;
        sum = (x-1)+(y-1);
		 System.out.println(sum);            
    }
}

Compiler output:
Main.java:10: error: ';' expected
          i++
             ^
1 error
Language: C++

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

signed main(){
  unsigned long long int N;
  cin >> N;
  unsigned long long int count=0;
  for(int i=0;i<sprt(N)+1;i++){
    if(N%i==0){
      if(count==0){
        count=i+N/i-2;
      }
      else{
        count=min(count,i+N/i-2);
      }
    }
  }
  cout << count << endl;
}

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

using namespace std;
int main(){
  int64_t n;//オーバーフロが解決すればAC(のはず…後でやる）
  cin>>n;
  int c=0;
  vector<int>b(n);
  for(int64_t i=2;i<=n/2;i++){
    if(n%i==0){//約数（1とn除く）
      b.at(i)=i;
      c++;
    }
  }
  if(c==0){//1とnのみ
    cout<<n;
    return 0;
  }
  if(c%2!=0){//２乗の数の場合
    cout<<(sqrt(n)-1)*2;
    return 0;
  }
  int d=0;//そのほか
  int e=-2;//(1,1)分引いておく
  for(int i=0;i<=n/2;i++){
    if(b.at(i)!=0){
      d++;
    }
    if(d==c/2||d==c/2+1){//最も近い座標
      e+=b.at(i);
    }
  }
  cout<<e;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:3: error: 'int64_t' was not declared in this scope
    3 |   int64_t n;//オーバーフロが解決すればAC(のはず…後でやる）
      |   ^~~~~~~
a.cc:1:1: note: 'int64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
  +++ |+#include <cstdint>
    1 | using namespace std;
a.cc:4:3: error: 'cin' was not declared in this scope
    4 |   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:4:8: error: 'n' was not declared in this scope
    4 |   cin>>n;
      |        ^
a.cc:6:3: error: 'vector' was not declared in this scope
    6 |   vector<int>b(n);
      |   ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | using namespace std;
a.cc:6:10: error: expected primary-expression before 'int'
    6 |   vector<int>b(n);
      |          ^~~
a.cc:7:14: error: expected ';' before 'i'
    7 |   for(int64_t i=2;i<=n/2;i++){
      |              ^~
      |              ;
a.cc:7:19: error: 'i' was not declared in this scope
    7 |   for(int64_t i=2;i<=n/2;i++){
      |                   ^
a.cc:9:7: error: 'b' was not declared in this scope
    9 |       b.at(i)=i;
      |       ^
a.cc:14:5: error: 'cout' was not declared in this scope
   14 |     cout<<n;
      |     ^~~~
a.cc:14:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:18:5: error: 'cout' was not declared in this scope
   18 |     cout<<(sqrt(n)-1)*2;
      |     ^~~~
a.cc:18:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:18:12: error: 'sqrt' was not declared in this scope
   18 |     cout<<(sqrt(n)-1)*2;
      |            ^~~~
a.cc:24:8: error: 'b' was not declared in this scope
   24 |     if(b.at(i)!=0){
      |        ^
a.cc:28:10: error: 'b' was not declared in this scope
   28 |       e+=b.at(i);
      |          ^
a.cc:31:3: error: 'cout' was not declared in this scope
   31 |   cout<<e;
      |   ^~~~
a.cc:31:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:15:21: error: expected primary-expression before '<' token
   15 |     for(ll i=1; i*i=<n; i++){
      |                     ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
using ll = long long;
const int INF = 2147483647;
// const ll INF = 1000000000000000000LL;

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



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

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using st=string;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
st abc="abcdefghijklmnopqrstuvwxyz";
st ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct edge{ll to,cost;};

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


Compiler output:
a.cc: In function 'int main()':
a.cc:32:19: error: 'N' was not declared in this scope
   32 |       ans=min(ans,N/i+i);
      |                   ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using st=string;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
st abc="abcdefghijklmnopqrstuvwxyz";
st ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct edge{ll to,cost;};

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

Compiler output:
a.cc: In function 'int main()':
a.cc:31:8: error: 'N' was not declared in this scope
   31 |     if(N%i==0){
      |        ^
Language: C++

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

vector<ll> divisor(ll n) {
    vector<ll> ret;
    for (ll i = 1; i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(n / i);
        }
    }
    return ret;
}
//1 2 5 10 25 50
int main() {
  ll n; cin>>n;
  vector<ll> ret=divisor(n);
  if(ret.size()%2=1) {
    cout << (ret.at(ret.size()/2)-1)*2;
  }
  else {
    cout << ret.at(ret.size()/2)+ret.at(ret.size()-1);
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:16: error: lvalue required as left operand of assignment
   19 |   if(ret.size()%2=1) {
      |      ~~~~~~~~~~^~
Language: C++

//Jai Bhole Ki
#include <bits/stdc++.h>
using namespace std;
#define fast static int fastline = []() { std::ios::sync_with_stdio(false); cin.tie(NULL); return 0; }();
#define ll long long
#define LL unsigned ll
#define pb push_back
#define pi pair<ll,ll>
#define debug(x) cout<<x<<"\n";
#define debug cout<<"debugged\n";
#define minval -2e9
#define maxval 2e9
long double PI =3.14159265358979323846;
 
const ll M=1e9+7;
const ll inf=1e18;
const ll ms=2e5+5;
fast;
double ans;
ll n,chk,a,b;
void solve()
{
    cin>>n;
    chk=sqrt(n);
    while(chk)
        {
            if(n%chk==0)
            {a=chk,b=a/chk;break;}
            chk--;
        }
    }
    cout<<a+b-2<<endl;
}

int main()
{
 // freopen("input.txt","r",stdin);
//  freopen("output.txt","w",stdout);
   // int t;cin>>t;while(t--)
    {
        solve();
    }
    return 0;
}

Compiler output:
a.cc:10:9: warning: "debug" redefined
   10 | #define debug cout<<"debugged\n";
      |         ^~~~~
a.cc:9:9: note: this is the location of the previous definition
    9 | #define debug(x) cout<<x<<"\n";
      |         ^~~~~
a.cc:32:5: error: 'cout' does not name a type
   32 |     cout<<a+b-2<<endl;
      |     ^~~~
a.cc:33:1: error: expected declaration before '}' token
   33 | }
      | ^
Language: C++

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <stdbool.h>
#include <iostream>
#include <math.h>
#include <algorithm>

using namespace std;

int main()
{
	long long int i, j, v, count = INT_MAX;
	long long int a = 0;
	
	cin >> v;

	for (i = 1;i < v/2;i++)
	{
		
			if (v%i == 0)
			{
				a = 0;
				a += (v / i - 1 + i - 1);
				count = min(count, a);
			}


	}
	cout << count << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:40: error: 'INT_MAX' was not declared in this scope
   13 |         long long int i, j, v, count = INT_MAX;
      |                                        ^~~~~~~
a.cc:8:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    7 | #include <algorithm>
  +++ |+#include <climits>
    8 |
Language: C++

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

int main() {
ll x = 0, y = 0;
cin >> x >> y;

cout << abs(x-1)+abs(y-1);

return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:11:10: error: expected '}' at end of input
   11 | return 0;
      |          ^
a.cc:5:12: note: to match this '{'
    5 | int main() {
      |            ^
Language: C++

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

int main() {
ll x = 0, y = 0;
cin >> x >> y;

cout << abs(x-1)+abs(y-1);

return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:11:10: error: expected '}' at end of input
   11 | return 0;
      |          ^
a.cc:5:12: note: to match this '{'
    5 | int main() {
      |            ^