Language: C++

#include <iostream>
#include <cstdio>
#include <queue>
#include <stdlib.h>
#include <stack>
#include <string.h>
#include <set>
#include <iomanip>
#include <ctime>
#include <map>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <cstring>
#define eps 1e-15
#define ull unsigned long long
//priority_queue<int,vector<int>,greater<int> > q;
//priority_queue<int,vector<int>,less<int> > q;
//#define ls l, mid, rt << 1
//#define rs mid + 1, r, rt << 1 | 1
using namespace std;
typedef long long ll;
//typedef pair<int,int> P;
const int inf = 0x3f3f3f3f;
const int mod = 1e9+7;
const long long mod1 = 1e16;
//int gcd(int a, int b) {return a % b == 0 ? b : gcd(b, a % b);}
//int Find(int x){return x == p[x] ? x : p[x] = Find(p[x]);}
//#define lson 1<<rt
//#define rson 1<<rt|1
const int maxn=1e5+7;
#define pi 3.1415926535898
#define PI atan(1.0)*4
int dx[4]= {0,1,0,-1},dy[4]= {1,0,-1,0};
int dir[4][2]= {{1,0},{-1,0},{0,1},{0,-1}};
int dir1[8][2]= {{1,0},{-1,0},{0,1},{0,-1},{1,1},{-1,1},{1,-1},{-1,-1}};
//int d[]= {1,-1,4,-4}; //八数码问题
//----------------------------------------

#include <iostream>
#include <cstdio>
#include <queue>
#include <stdlib.h>
#include <stack>
#include <string.h>
#include <set>
#include <iomanip>
#include <ctime>
#include <map>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <cstring>
#define eps 1e-15
#define ull unsigned long long
//priority_queue<int,vector<int>,greater<int> > q;
//priority_queue<int,vector<int>,less<int> > q;
//#define ls l, mid, rt << 1
//#define rs mid + 1, r, rt << 1 | 1
using namespace std;
typedef long long ll;
//typedef pair<int,int> P;
const int inf = 0x3f3f3f3f;
const int mod = 1e9+7;
const long long mod1 = 1e16;
//int gcd(int a, int b) {return a % b == 0 ? b : gcd(b, a % b);}
//int Find(int x){return x == p[x] ? x : p[x] = Find(p[x]);}
//#define lson 1<<rt
//#define rson 1<<rt|1
const int maxn=1e5+7;
#define pi 3.1415926535898
#define PI atan(1.0)*4
int dx[4]= {0,1,0,-1},dy[4]= {1,0,-1,0};
int dir[4][2]= {{1,0},{-1,0},{0,1},{0,-1}};
int dir1[8][2]= {{1,0},{-1,0},{0,1},{0,-1},{1,1},{-1,1},{1,-1},{-1,-1}};
//int d[]= {1,-1,4,-4}; //八数码问题
//----------------------------------------
int n,a[100001],ans;

bool check(int mid)
{
    ll s=a[mid];
    for(int j=0;j<n;j++)
    {
        if(j!=mid)
        {
            if(a[j]>s*2)
                a[j]+=s;
            else
                return 0;
        }
    }
    return 1;
}

int main()
{
    cin>>n;
    for(int i=0; i<n; i++)
        cin>>a[i];
    sort(a,a+n);
    int l=0,r=100000,mid;
    while(l<=r)
    {
        mid=(l+r)/2;
        if(check(mid))
        {
            r=mid-1;
        }
            else
            l=mid+1;
    }
    cout<<l-1<<endl;
    return 0;
}


Compiler output:
a.cc:63:11: error: redefinition of 'const int inf'
   63 | const int inf = 0x3f3f3f3f;
      |           ^~~
a.cc:24:11: note: 'const int inf' previously defined here
   24 | const int inf = 0x3f3f3f3f;
      |           ^~~
a.cc:64:11: error: redefinition of 'const int mod'
   64 | const int mod = 1e9+7;
      |           ^~~
a.cc:25:11: note: 'const int mod' previously defined here
   25 | const int mod = 1e9+7;
      |           ^~~
a.cc:65:17: error: redefinition of 'const long long int mod1'
   65 | const long long mod1 = 1e16;
      |                 ^~~~
a.cc:26:17: note: 'const long long int mod1' previously defined here
   26 | const long long mod1 = 1e16;
      |                 ^~~~
a.cc:70:11: error: redefinition of 'const int maxn'
   70 | const int maxn=1e5+7;
      |           ^~~~
a.cc:31:11: note: 'const int maxn' previously defined here
   31 | const int maxn=1e5+7;
      |           ^~~~
a.cc:73:5: error: redefinition of 'int dx [4]'
   73 | int dx[4]= {0,1,0,-1},dy[4]= {1,0,-1,0};
      |     ^~
a.cc:34:5: note: 'int dx [4]' previously defined here
   34 | int dx[4]= {0,1,0,-1},dy[4]= {1,0,-1,0};
      |     ^~
a.cc:73:23: error: redefinition of 'int dy [4]'
   73 | int dx[4]= {0,1,0,-1},dy[4]= {1,0,-1,0};
      |                       ^~
a.cc:34:23: note: 'int dy [4]' previously defined here
   34 | int dx[4]= {0,1,0,-1},dy[4]= {1,0,-1,0};
      |                       ^~
a.cc:74:5: error: redefinition of 'int dir [4][2]'
   74 | int dir[4][2]= {{1,0},{-1,0},{0,1},{0,-1}};
      |     ^~~
a.cc:35:5: note: 'int dir [4][2]' previously defined here
   35 | int dir[4][2]= {{1,0},{-1,0},{0,1},{0,-1}};
      |     ^~~
a.cc:75:5: error: redefinition of 'int dir1 [8][2]'
   75 | int dir1[8][2]= {{1,0},{-1,0},{0,1},{0,-1},{1,1},{-1,1},{1,-1},{-1,-1}};
      |     ^~~~
a.cc:36:5: note: 'int dir1 [8][2]' previously defined here
   36 | int dir1[8][2]= {{1,0},{-1,0},{0,1},{0,-1},{1,1},{-1,1},{1,-1},{-1,-1}};
      |     ^~~~