Language: C++

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include<stdio.h>
#include<string.h>
#include<time.h>
#include<math.h>
#include<stdlib.h>
#include<iostream>
#include<iomanip>
#include<utility>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#define ll long long
#define fi first
#define sec second
#define pb push_back
#define mp make_pair
#define rep(a,b,c) for(ll a=1;a<=b;a+=c)
#define repp(a,b,c,d) for(ll a=b;a<=c;a+=d)

const double PI=acos(-1);
const long double EPS=1e-12;
const ll MOD=1e9+7;
const int INF=1<<30;


using namespace std;

vector<ll>pr;
bool vis[30005];
void pre(){
	pr.pb(2);
	repp(i,3,30000,2){
		if(!vis[i]){
			pr.pb(i);
			repp(j,i*i,30000,i){
				vis[j]=true;
			}
		}
	}
}


int main(){
	ll a,b,x;
	pre();
	cin>>a>>b;
	if(a%b==0||a==1)cout<<-1<<endl;
	else{
		x=__gcd(a,b);
		a/=x;
		b/=x;
		int sz=pr.size();
		for(int i=0;i<sz;i++){
			if((a*pr[i])%b!=0){
				cout<<a*x*pr[i]<<endl;
				return 0;
			}
		}
		cout<<-1<<endl;
	}
}


Compiler output:
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 1
      | ^
In file included from a.cc:65:
/usr/include/string.h:44:22: error: 'size_t' has not been declared
   44 |                      size_t __n) __THROW __nonnull ((1, 2));
      |                      ^~~~~~
/usr/include/string.h:47:56: error: 'size_t' has not been declared
   47 | extern void *memmove (void *__dest, const void *__src, size_t __n)
      |                                                        ^~~~~~
/usr/include/string.h:55:32: error: 'size_t' has not been declared
   55 |                       int __c, size_t __n)
      |                                ^~~~~~
/usr/include/string.h:61:42: error: 'size_t' has not been declared
   61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
      |                                          ^~~~~~
/usr/include/string.h:64:56: error: 'size_t' has not been declared
   64 | extern int memcmp (const void *__s1, const void *__s2, size_t __n)
      |                                                        ^~~~~~
/usr/include/string.h:80:60: error: 'size_t' has not been declared
   80 | extern int __memcmpeq (const void *__s1, const void *__s2, size_t __n)
      |                                                            ^~~~~~
/usr/include/string.h:87:42: error: 'size_t' has not been declared
   87 | extern void *memchr (void *__s, int __c, size_t __n)
      |                                          ^~~~~~
/usr/include/string.h:89:54: error: 'size_t' has not been declared
   89 | extern const void *memchr (const void *__s, int __c, size_t __n)
      |                                                      ^~~~~~
/usr/include/string.h:126:49: error: 'size_t' has not been declared
  126 | extern "C++" void *memrchr (void *__s, int __c, size_t __n)
      |                                                 ^~~~~~
/usr/include/string.h:129:61: error: 'size_t' has not been declared
  129 | extern "C++" const void *memrchr (const void *__s, int __c, size_t __n)
      |                                                             ^~~~~~
/usr/include/string.h:145:53: error: 'size_t' has not been declared
  145 |                       const char *__restrict __src, size_t __n)
      |                                                     ^~~~~~
/usr/include/string.h:153:23: error: 'size_t' has not been declared
  153 |                       size_t __n) __THROW __nonnull ((1, 2));
      |                       ^~~~~~
/usr/include/string.h:159:57: error: 'size_t' has not been declared
  159 | extern int strncmp (const char *__s1, const char *__s2, size_t __n)
      |                                                         ^~~~~~
/usr/include/string.h:166:8: error: 'size_t' does not name a type
  166 | extern size_t strxfrm (char *__restrict __dest,
      |        ^~~~~~
/usr/include/string.h:34:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
   33 | #include <stddef.h>
  +++ |+#include <cstddef>
   34 | 
/usr/include/string.h:179:8: error: 'size_t' does not name a type
  179 | extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n,
      |        ^~~~~~
/usr/include/string.h:179:8: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/string.h:195:45: error: 'size_t' has not been declared
  195 | extern char *strndup (const char *__string, size_t __n)
      |                                             ^~~~~~
/usr/include/string.h:293:8: error: 'size_t' does not name a type
  293 | extern size_t strcspn (const char *__s, const char *__reject)
      |        ^~~~~~
/usr/include/string.h:293:8: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/string.h:297:8: error: 'size_t' does not name a type
  297 | extern size_t strspn (const char *__s, const char *__accept)
      |        ^~~~~~
/usr/include/string.h:297:8: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/string.h:389:46: error: 'size_t' has not been declared
  389 | extern void *memmem (const void *__haystack, size_t __haystacklen,
      |                                              ^~~~~~
/usr/include/string.h:390:44: error: 'size_t' has not been declared
  390 |                      const void *__needle, size_t __needlelen)
      |                                            ^~~~~~
/usr/include/string.h:398:55: error: 'size_t' has not been declared
  398 |                         const void *__restrict __src, size_t __n)
      |                                                       ^~~~~~
/usr/include/string.h:401:53: error: 'size_t' has not been declared
  401 |                       const void *__restrict __src, size_t __n)
      |                                                     ^~~~~~
/usr/include/string.h:407:8: error: 'size_t' does not name a type
  407 | extern size_t strlen (const char *__s)
      |        ^~~~~~
/usr/include/string.h:407:8: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/string.h:413:8: error: 'size_t' does not name a type
  413 | extern size_t strnlen (const char *__string, size_t __maxlen)
      |        ^~~~~~
/usr/include/string.h:413:8: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/string.h:444:53: error: 'size_t' has not been declared
  444 | extern char *strerror_r (int __errnum, char *__buf, size_t __buflen)
      |                                                     ^~~~~~
In file included from /usr/include/string.h:462:
/usr/include/strings.h:34:54: error: 'size_t' has not been declared
   34 | extern int bcmp (const void *__s1, const void *__s2, size_t __n)
      |                                                      ^~~~~~
/usr/include/strings.h:38:53: error: 'size_t' has not been declared
   38 | extern void bcopy (const void *__src, void *__dest, size_t __n)
      |                                                     ^~~~~~
/usr/include/strings.h:42:31: error: 'size_t' has not been declared
   42 | extern void bzero (void *__s, size_t __n) __THROW __nonnull ((1));
      |                               ^~~~~~
/usr/include/strings.h:120:61: error: 'size_t' has not been declared
  120 | extern int strncasecmp (const char *__s1, const char *__s2, size_t __n)
      |                                                             ^~~~~~
/usr/include/strings.h:134:27: error: 'size_t' has not been declared
  134 |                           size_t __n, locale_t __loc)
      |                           ^~~~~~
/usr/include/string.h:466:40: error: 'size_t' has not been declared
  466 | extern void explicit_bzero (void *__s, size_t __n) __THROW __nonnull ((1))
      |                                        ^~~~~~
/usr/include/string.h:497:55: error: 'size_t' has not been declared
  497 |                         const char *__restrict __src, size_t __n)
      |                                                       ^~~~~~
/usr/include/string.h:500:53: error: 'size_t' has not been declared
  500 |                       const char *__restrict __src, size_t __n)
      |                                                     ^~~~~~
/usr/include/string.h:506:8: error: 'size_t' does not name a type
  506 | extern size_t strlcpy (char *__restrict __dest,
      |        ^~~~~~
/usr/include/string.h:506:8: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/string.h:512:8: error: 'size_t' does not name a type
  512 | extern size_t strlcat (char *__restrict __dest,
      |        ^~~~~~
/usr/include/string.h:512:8: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/string.h:526:34: error: 'size_t' has not been declared
  526 | extern void *memfrob (void *__s, size_t __n) __THROW __nonnull ((1))
      |                                  ^~~~~~
In file included from /usr/include/x86_64-linux-gnu/bits/timex.h:22,
                 from /usr/include/x86_64-linux-gnu/bits/time.h:73,
                 from /usr/include/time.h:33,
                 from a.cc:66:
/usr/include/x86_64-linux-gnu/bits/types/struct_timeval.h:14:3: error: '__time_t' does not name a type
   14 |   __time_t tv_sec;              /* Seconds.  */
      |   ^~~~~~~~
/usr/include/x86_64-linux-gnu/bits/types/struct_timeval.h:15:3: error: '__suseconds_t' does not name a type
   15 |   __suseconds_t tv_usec;        /* Microseconds.  */
      |   ^~~~~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/timex.h:59:3: error: '__syscall_slong_t' does not name a type
   59 |   __syscall_slong_t offset;     /* time offset (usec) */
      |   ^~~~~~~~~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/timex.h:60:3: error: '__syscall_slong_t' does not name a type
   60 |   __syscall_slong_t freq;       /* frequency offset (scaled ppm) */
      |   ^~~~~~~~~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/timex.h:61:3: error: '__syscall_slong_t' does not name a type
   61 |   __syscall_slong_t maxerror;   /* maximum error (usec) */
      |   ^~~~~~~~~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/timex.h:62:3: error: '__syscall_slong_t' does not name a type
   62 |   __syscall_slong_t esterror;   /* estimated error (usec) */
      |   ^~~~~~~~~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/timex.h:64:3: error: '__syscall_slong_t' does not name a type
   64 |   __syscall_slong_t constant;   /* pll time constant */
      |   ^~~~~~~~~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/timex.h:65:3: error: '__syscall_slong_t' does not name a type
   65 |   __syscall_slong_t precision;  /* clock precision (usec) (ro) */
      |   ^~~~~~~~~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/timex.h:66:3: error: '__syscall_slong_t' does not name a type
   66 |   __syscall_slong_t tolerance;  /* clock frequency tolerance (ppm) (ro) */
      |   ^~~~~~~~~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/timex.h:68:3: error: '__syscall_slong_t' does not name a type
   68 |   __syscall_slong_t tick;       /*