Language: C++

#include <iostream> #include <cstring> #include <string> #include <cstdio> #include <algorithm> #include <queue> #include <ctime> #include <cmath> #include <stack> #include <set> #include <map>  #define INF 0x3f3f3f3f #define ll long long #define rep(i, n) for(ll i=0;i<n;i++) #define per(i, n) for(int i=n;i>=0;i--) #define rep2(i, n) for(ll i=1;i<=n;i++) #define pb(x) push_back(x) #define clint(x, n) memset(x,n,sizeof(x)) #define mp make_pair #define fi first #define se second #define IO std::ios::sync_with_stdio(false) #define ull unsigned long long #define ud long double #define pii pair<int,int> #define random(x) (rand()%x) using namespace std; const ll inf = 0x3f3f3f3f; const int mod = 1e9 + 7; const int MAX = 123123; const int N = 555; const double eps = 1e-6;  inline int read() {     int x = 0, f = 1;     char ch = getchar();     while (ch < '0' || ch > '9') {         if (ch == '-') f = -1;         ch = getchar();     }     while (ch >= '0' && ch <= '9') {         x = x * 10 + ch - '0';         ch = getchar();     }     return x * f; }  inline ll read1() {     ll x = 0, f = 1;     char ch = getchar();     while (ch < '0' || ch > '9') {         if (ch == '-') f = -1;         ch = getchar();     }     while (ch >= '0' && ch <= '9') {         x = x * 10 + ch - '0';         ch = getchar();     }     return x * f; }  ll max(ll a, ll b) {     if (a > b) return a;     return b; }  ll min(ll a, ll b) {     if (a < b) return a;     return b; }  ll multi(ll a, ll b, ll p) {     ll ans = 0;     while (b) {         if (b & 1ll) ans = (ans + a) % p;         a = (a + a) % p;         b >>= 1;     }     return ans; }  ll pow_mod(ll a, ll b, ll p) {     ll ans = 1;     while (b) {         if (b & 1ll) ans = multi(ans, a, p);         a = multi(a, a, p);         b >>= 1;     }     return ans; }  int qpow(int a, int b) {     int ans = 1, base = a;     while (b != 0) {         if ((b & 1) != 0)             ans *= base;         base *= base;         b >>= 1;     }     return ans; }  int lowbit(ll x) {     return x & (-x); }  int gcd(int a, int b) {     return b > 0 ? gcd(b, a % b) : a; }  bool cmp(int &a, int &b) {     return a > b; }  const int maxn = 1e5 + 10;  //**************************************  int main() {     ll a;     cin>>a;     for(int i=sqrt(a);i>0;i--){         if(a%i==0){              cout<<(i+a/i-2)<<endl;             break;         }     }     return 0; } 

Compiler output:
a.cc:1:21: warning: extra tokens at end of #include directive
    1 | #include <iostream> #include <cstring> #include <string> #include <cstdio> #include <algorithm> #include <queue> #include <ctime> #include <cmath> #include <stack> #include <set> #include <map>  #define INF 0x3f3f3f3f #define ll long long #define rep(i, n) for(ll i=0;i<n;i++) #define per(i, n) for(int i=n;i>=0;i--) #define rep2(i, n) for(ll i=1;i<=n;i++) #define pb(x) push_back(x) #define clint(x, n) memset(x,n,sizeof(x)) #define mp make_pair #define fi first #define se second #define IO std::ios::sync_with_stdio(false) #define ull unsigned long long #define ud long double #define pii pair<int,int> #define random(x) (rand()%x) using namespace std; const ll inf = 0x3f3f3f3f; const int mod = 1e9 + 7; const int MAX = 123123; const int N = 555; const double eps = 1e-6;  inline int read() {     int x = 0, f = 1;     char ch = getchar();     while (ch < '0' || ch > '9') {         if (ch == '-') f = -1;         ch = getchar();     }     while (ch >= '0' && ch <= '9') {         x = x * 10 + ch - '0';         ch = getchar();     }     return x * f; }  inline ll read1() {     ll x = 0, f = 1;     char ch = getchar();     while (ch < '0' || ch > '9') {         if (ch == '-') f = -1;         ch = getchar();     }     while (ch >= '0' && ch <= '9') {         x = x * 10 + ch - '0';         ch = getchar();     }     return x * f; }  ll max(ll a, ll b) {     if (a > b) return a;     return b; }  ll min(ll a, ll b) {     if (a < b) return a;     return b; }  ll multi(ll a, ll b, ll p) {     ll ans = 0;     while (b) {         if (b & 1ll) ans = (ans + a) % p;         a = (a + a) % p;         b >>= 1;     }     return ans; }  ll pow_mod(ll a, ll b, ll p) {     ll ans = 1;     while (b) {         if (b & 1ll) ans = multi(ans, a, p);         a = multi(a, a, p);         b >>= 1;     }     return ans; }  int qpow(int a, int b) {     int ans = 1, base = a;     while (b != 0) {         if ((b & 1) != 0)             ans *= base;         base *= base;         b >>= 1;     }     return ans; }  int lowbit(ll x) {     return x & (-x); }  int gcd(int a, int b) {     return b > 0 ? gcd(b, a % b) : a; }  bool cmp(int &a, int &b) {     return a > b; }  const int maxn = 1e5 + 10;  //**************************************  int main() {     ll a;     cin>>a;     for(int i=sqrt(a);i>0;i--){         if(a%i==0){              cout<<(i+a/i-2)<<endl;             break;         }     }     return 0; }
      |                     ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status