Language: C++


                                 /*Bismillahir Rahmanir Rahim*/


#include<bits/stdc++.h>
#include<cstring>
#include<vector>
#include<map>
#include<set>
#define ll long long int
#define dd double
using namespace std;
#define M 1000001
ll ara[M];
ll size=1000001;
void sieve()
   {
      int i, j, root;
      for(i = 2; i < size; i++) {
            ara[i] = 1;
         }
   root = sqrt(size);

      for(i = 2; i <= root; i++) {
   if(ara[i] == 1) {
for(j = 2; i * j <= size; j++) {
ara[i * j] = 0;
}



}
      }
   }

int main()
{
   ll t,n,i,j,x,a,b,y;
  
   
 sieve();
      cin>>n;
     
      if(ara[n]==1)
      cout<<n<<endl;
      else{
         for(i=n+1;;i++)
         {
            if (ara[i]==1)
            {
            cout<<i<<endl;
               break;
            }
         
      }
      
    
   }

  
   
  

}

//Apna Time Aayega :)

Compiler output:
a.cc: In function 'void sieve()':
a.cc:19:22: error: reference to 'size' is ambiguous
   19 |       for(i = 2; i < size; i++) {
      |                      ^~~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:5:
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:15:4: note:                 'long long int size'
   15 | ll size=1000001;
      |    ^~~~
a.cc:22:16: error: reference to 'size' is ambiguous
   22 |    root = sqrt(size);
      |                ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:15:4: note:                 'long long int size'
   15 | ll size=1000001;
      |    ^~~~
a.cc:26:21: error: reference to 'size' is ambiguous
   26 | for(j = 2; i * j <= size; j++) {
      |                     ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:15:4: note:                 'long long int size'
   15 | ll size=1000001;
      |    ^~~~