submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3
values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s782226098 | p00009 | C++ | #include<iostream>
using namespace std;
int main()
{
int n,S;
while(cin>>n)
{
S=0;
if(n==1)
{
cout<<0<<endl;
}
else if(n>=2)
{
S++;
}
else if
{
for(int i=2;i<=n;i++)
{
for(int j=i-1;j>1;j--)
{
if(i%j==0)
{
break;
}
if(j==2)
{
S++;
}
}
}
cout<<S<<endl;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:18:9: error: expected '(' before '{' token
18 | {
| ^
| (
|
s332328371 | p00009 | C++ | #include<iostream>
using namespace std;
int main(){
int N,count=0;
cin >> N
for(int x=2;x<=N;x++){
int flag = 0;
for(int y=2;y<x;y++){
if((x%y)==0) flag = 1;
}
if(flag == 0) count++;
}
cout << count << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:5:17: error: expected ';' before 'for'
5 | cin >> N
| ^
| ;
6 | for(int x=2;x<=N;x++){
| ~~~
a.cc:6:21: error: 'x' was not declared in this scope
6 | for(int x=2;x<=N;x++){
| ... |
s709272096 | p00009 | C++ | #include<iostream>
using namespace std;
int main(k<30){
int N,count=0,k;
while(){
cin >> N;
count = 0;
if(N<0) break;
for(int x=2;x<=N;x++){
int flag = 0;
for(int y=2;y<x;y++){
if((x%y)==0) flag = 1;
}
if(flag == 0) count++;
}
cout << count << endl;
k++;
}
return 0;
} | a.cc:3:5: error: cannot declare '::main' to be a global variable
3 | int main(k<30){
| ^~~~
a.cc:3:10: error: 'k' was not declared in this scope
3 | int main(k<30){
| ^
|
s336230994 | p00009 | C++ | #include<iostream>
using namespace std;
int main(){
long long int N,count[1000000];
count[1] = 1;
if(N<0) break;
for(int x=2;x<=1000000;x++){
int flag = 0;
for(int y=2;y<x;y++){
if((x%y)==0) flag = 1;
}
if(flag == 0) count[i] = count[i-1]+1;
}
while(cin >> N){
cout << count[N] << endl;
}
return 0... | a.cc: In function 'int main()':
a.cc:6:25: error: break statement not within loop or switch
6 | if(N<0) break;
| ^~~~~
a.cc:12:39: error: 'i' was not declared in this scope
12 | if(flag == 0) count[i] = count[i-1]+1;
| ... |
s319020366 | p00009 | C++ | #include<iostream>
using namespace std;
int main(){
long long int N,count[1000000];
count[1] = 1;
for(int x=2;x<=1000000;x++){
int flag = 0;
for(int y=2;y<x;y++){
if((x%y)==0) flag = 1;
}
if(flag == 0) count[i] = count[i-1]+1;
}
while(cin >> N){
cout << count[N] << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:11:39: error: 'i' was not declared in this scope
11 | if(flag == 0) count[i] = count[i-1]+1;
| ^
|
s306848553 | p00009 | C++ | import math
def check_prime(goal):
true_or_false=False
for i in range(2,int(math.sqrt(goal))+1):
if goal%i==0:
true_or_false=True
if true_or_false==False:
return True
else:
return False
anss=[]
while True:
try:
num=int(input())
num_of_prime=0
... | a.cc:1:1: error: 'import' does not name a type
1 | import math
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
|
s653269757 | p00009 | C++ | #include<iostream>
using namespace std;
int Era(int N) {
int prime_num = 0;
int* array = new int[N + 1];
for (int i = 2; i < N + 1; i++) {
array[i] = 1;
}
for (int i = 2; i <= sqrt(N); i++) {
if (array[i]) {
for (int j = 0; i*(j + 2) <= N; j++) {
array[i*(j + 2)] = 0;
}
}
}
for (int i = 2; i < N... | a.cc: In function 'int Era(int)':
a.cc:10:30: error: 'sqrt' was not declared in this scope
10 | for (int i = 2; i <= sqrt(N); i++) {
| ^~~~
|
s173624610 | p00009 | C++ | #include<iostream>
using namespace std;
int Era(int N) {
int prime_num = 0;
int* array = new int[N + 1];
for (int i = 2; i < N + 1; i++) {
array[i] = 1;
}
for (int i = 2; i < sqrt(N); i++) {
if (array[i]) {
for (int j = 0; i*(j + 2) <= N; j++) {
array[i*(j + 2)] = 0;
}
}
}
for (int i = 2; i < N ... | a.cc: In function 'int Era(int)':
a.cc:10:29: error: 'sqrt' was not declared in this scope
10 | for (int i = 2; i < sqrt(N); i++) {
| ^~~~
|
s101823226 | p00009 | C++ | #include <iostream>
const bool isPrime(const int p)
{
if(p == 2)
{
return true;
}
if(p < 2 || p % 2 == 0)
{
return false;
}
for(int i = 3; i <= sqrt(p); i += 2)
{
if(p % i == 0)
{
return false;
}
}
return true;
}
int main(v... | a.cc: In function 'const bool isPrime(int)':
a.cc:15:25: error: 'sqrt' was not declared in this scope
15 | for(int i = 3; i <= sqrt(p); i += 2)
| ^~~~
|
s062766136 | p00009 | C++ | #include<stdio.h>
int main(void){
int s[10000], l, m, n, i, sum;
sum = 0;
for ( i = 1; i <= 1000000; i++ ) {
s[i] = 0;
}
for ( k = 2; k <= 1000000; k++ ){
if (s[k] == 0) {
for ( l = 2; l <= 100000 / k; l++ ) {
s[k * l] = 1;
}
}
}
while(scanf("%d", &n)... | a.cc: In function 'int main()':
a.cc:8:10: error: 'k' was not declared in this scope
8 | for ( k = 2; k <= 1000000; k++ ){
| ^
|
s305310616 | p00009 | C++ | #include <iostream>
#include <cmath>
#include <time.h> // for clock()
using namespace std;
/*
1???2 ?????? n ?????§?????´??°???????????????
2??????????????£???????????°????????§???????°?????????????????????? p ??¨?????????????????????????????????????????°?????? p ??¨?????????
p ??\?????? p ????????°?????¨????¶????... | a.cc: In function 'int SieveOfEratosthenes(int)':
a.cc:21:9: error: 'memset' was not declared in this scope
21 | memset(fl, true, sizeof(fl));
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <cmath>
+... |
s083090323 | p00009 | C++ | #include <iostream>
#include <cmath>
#include <cstdio>
#include <time.h> // for clock()
using namespace std;
/*
1???2 ?????? n ?????§?????´??°???????????????
2??????????????£???????????°????????§???????°?????????????????????? p ??¨?????????????????????????????????????????°?????? p ??¨?????????
p ??\?????? p ??????... | a.cc: In function 'int SieveOfEratosthenes(int)':
a.cc:22:9: error: 'memset' was not declared in this scope
22 | memset(fl, true, sizeof(fl));
| ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include <cstdio>
... |
s179863932 | p00009 | C++ | #include <iostream>
#include <cmath>
//#include <ctime>
#define Even(n) n%2
using namespace std;
void count_Prime(int n);
bool IsPrime(int num);
int main()
{
int Data = 0;
// clock_t start, end;
while (cin >> Data)
{
// start = clock();
count_Prime(Data);
// end = clock();
cout << (double)(end - start) / C... | a.cc: In function 'int main()':
a.cc:21:40: error: 'start' was not declared in this scope
21 | cout << (double)(end - start) / CLOCKS_PER_SEC << "sec" << endl;
| ^~~~~
|
s723154409 | p00009 | C++ | #include<iostream>
#include<iomanip>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cmath>
#include<queue>
#include<stack>
#include<functional>
#include<string>
#include<cstring>
#include <sstream>
using namespace std;
int main(void){
int n,ans,i;
while(cin >> n){
ans = 0;
if(n <... | a.cc: In function 'int main()':
a.cc:27:21: error: 'sqrti' was not declared in this scope; did you mean 'sqrtl'?
27 | if(ceil(sqrti) == floor(sqrti)){
| ^~~~~
| sqrtl
|
s595735001 | p00009 | C++ | #include <iostream>
using namespace std;
const int MAX_V = 1000000; // 100????????§?´???°??¨?????????
const int prime[MAX_V+1]; // 1????´???°???0????´???°??§??????
const pcount[MAX_V+1];
int main() {
int i, k,a,sum=0;
for(i = 2; i <= MAX_V; i++) {
prime[i] = 1; // 2??\????´???°??¨??????
}
for(... | a.cc:4:11: error: uninitialized 'const prime' [-fpermissive]
4 | const int prime[MAX_V+1]; // 1????´???°???0????´???°??§??????
| ^~~~~
a.cc:5:7: error: 'pcount' does not name a type
5 | const pcount[MAX_V+1];
| ^~~~~~
a.cc: In function 'int main()':
a.cc:9:18: error: assignment of re... |
s068618887 | p00009 | C++ | include <stdio.h>
const int MAX_V = 1000000;
int prime[MAX_V+1],sum[MAX_V+2]={0};
int main(){
int n;
for(int i = 2;i <= MAX_V;i++){
prime[i] = 1;
}
for(int i = 2;i * i <= MAX_V;i++){
if(prime[i]){
for(int k = 2* i;k <= MAX_V;k += i)
prime[k]=0;
}
}
for(int i = 2;i < MAX_V;i++){
s... | a.cc:1:1: error: 'include' does not name a type
1 | include <stdio.h>
| ^~~~~~~
a.cc:3:11: error: 'MAX_V' was not declared in this scope
3 | int prime[MAX_V+1],sum[MAX_V+2]={0};
| ^~~~~
a.cc:3:24: error: 'MAX_V' was not declared in this scope
3 | int prime[MAX_V+1],sum[MAX_V+2]={0};
... |
s735368823 | p00009 | C++ | #include <stdio.h>
#include <iostream>
const int MAX_V = 10000;
int prime[MAX_V+1];
void init(){
int i, k, v;
for(i=2; i<=MAX_V; i++){
prime[i] = 1;
}
for(i=2; i*i<=MAX_V; i++){
if(prime[i]){
for(k=2*i; k<=MAX_V; k+=i){
prime[k]=0;
}
}
... | a.cc: In function 'int main()':
a.cc:29:11: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
29 | while(cin >> num){
| ^~~
| std::cin
In file included from a.cc:2:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin;... |
s364960798 | p00009 | C++ | import math
while True:
try:
n = int(input())
c = [1 for i in range(n)]
c[0] = 0
i = 2
while i**2 <= n:
j = i*2
while j <= n:
c[j - 1] = 0
j += i
i += 1
print(sum(c))
except:
break | a.cc:1:1: error: 'import' does not name a type
1 | import math
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
|
s622847973 | p00009 | C++ | #include<iostream>
using namespace std;
int get_num_of_under_n(int n) {
bool* numbers = new bool[n + 1];
for (int i = 2; i < n + 1; i++) {
numbers[i] = true;
}
for (int i = 2; i < sqrt(n); i++) {
if (numbers[i] == true) {
for (int j = 0; i*(j + 2) <= n; j++) {
numbers[i*(j + 2)] = false;
}
}
}
in... | a.cc: In function 'int get_num_of_under_n(int)':
a.cc:9:29: error: 'sqrt' was not declared in this scope
9 | for (int i = 2; i < sqrt(n); i++) {
| ^~~~
|
s933341768 | p00009 | C++ | #include <iostream>
#include <cstdio>
using namespace std;
bool isPrime(int x) {
if (x==2) {
return true;
}
if (x<2 || x%2==0) {
return false;
}
i=3;
while (i*i<=x) {
if (x%i==0) {
return false;
}
i+=2;
}
/*for (int i=3; i*i<=x; i+=2) ... | a.cc: In function 'bool isPrime(int)':
a.cc:12:5: error: 'i' was not declared in this scope
12 | i=3;
| ^
|
s663278589 | p00009 | C++ | include <iostream>
using namespace std;
int main(){
bool is_prime[1000000];
is_prime[0]=is_prime[1]=false;
for(int i=2;i<1000000;i++)
is_prime[i]=true;
for(int i=2;i*i<1000000;i++){
if(is_prime[i]){
for(int j=i*i;j<1000000;j+=i){
is_prime[j]=false;
}
}
}
... | a.cc:1:1: error: 'include' does not name a type
1 | include <iostream>
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:25:7: error: 'cin' was not declared in this scope
25 | cin >> x;
| ^~~
a.cc:28:7: error: 'cout' was not declared in this scope; did you mean 'count'?
28 | cout <<... |
s252985279 | p00009 | C++ | #include<iostream>
using namespace std;
int sushu(int a)
{
int flag = 1;
for (int i = 2; i < sqrt(a)+1; i++)
{
if (a%i == 0)
{
flag = 0;
break;
}
}
return flag;
}
int main()
{
int n;
while (cin >> n)
{
int ans = 0, flag = 1;
if (n == 1)
cout << ans << endl;
else
{
for (int i = 2; i <= ... | a.cc: In function 'int sushu(int)':
a.cc:6:29: error: 'sqrt' was not declared in this scope
6 | for (int i = 2; i < sqrt(a)+1; i++)
| ^~~~
|
s354400105 | p00009 | C++ | #include <iostream>
//#include <vector>
//#include <math.h>
//#include <string>
//#include <cmath>
int main(void);
int count_prime_number(int n);
int main(){
int n;
int cnt = 0;
int result[30];
//while (cnt < 3){
//std::cin >> n;
while (std::cin >> n){
result[cnt] = count_prime_number(n);
cnt++;
}
for ... | a.cc: In function 'int count_prime_number(int)':
a.cc:45:38: error: 'sqrt' was not declared in this scope
45 | for (int j = 3; j <= sqrt(i); j+= 2) //ルートi以上のiの約数はルートi以下のiの約数と対になっているので範囲はルートiまででいい
| ^~~~
|
s805042868 | p00009 | C++ | #include <iostream>
//#include <vector>
//#include <math.h>
//#include <string>
//#include <cmath>
int main(void);
int count_prime_number(int n);
int main(){
int n;
int cnt = 0;
int result[30];
//while (cnt < 3){
//std::cin >> n;
while (std::cin >> n){
result[cnt] = count_prime_number(n);
cnt++;
}
for ... | a.cc: In function 'int count_prime_number(int)':
a.cc:45:38: error: 'sqrt' was not declared in this scope
45 | for (int j = 3; j <= sqrt(i); j+= 2) //ルートi以上のiの約数はルートi以下のiの約数と対になっているので範囲はルートiまででいい
| ^~~~
|
s397023053 | p00009 | C++ | #include <iostream>
//#include <vector>
//#include <math.h>
//#include <string>
//#include <cmath>
int main(void);
int count_prime_number(int n);
int main(){
int n;
int cnt = 0;
int result[30];
//while (cnt < 3){
//std::cin >> n;
while (std::cin >> n){
result[cnt] = count_prime_number(n);
cnt++;
}
for ... | a.cc: In function 'int count_prime_number(int)':
a.cc:45:38: error: 'sqrt' was not declared in this scope
45 | for (int j = 3; j <= sqrt(i); j+= 2) //ルートi以上のiの約数はルートi以下のiの約数と対になっているので範囲はルートiまででいい
| ^~~~
|
s099695931 | p00009 | C++ | #include <iostream>
//#include <vector>
//#include <math.h>
//#include <string>
//#include <cmath>
int main(void);
int count_prime_number(int n);
int main(){
int n;
int cnt = 0;
int result[30];
//while (cnt < 3){
//std::cin >> n;
while (std::cin >> n){
result[cnt] = count_prime_number(n);
cnt++;
}
for ... | a.cc: In function 'int count_prime_number(int)':
a.cc:45:38: error: 'sqrt' was not declared in this scope
45 | for (int j = 3; j <= sqrt(i); j+= 2) //ルートi以上のiの約数はルートi以下のiの約数と対になっているので範囲はルートiまででいい
| ^~~~
|
s818318404 | p00009 | C++ | #include <cassert>
#include <iostream>
using namespace std;
constexpr int ceil_sqrt(int x) {
int ans = 0;
while (ans*ans < x) { ++ans; }
return ans;
}
template<int size>
struct Sieve {
constexpr Sieve(): factor(), primes() {
factor[0] = factor[1] = 1;
for (int p = 2; p < size; ++p) {
primes[p] ... | a.cc:33:36: in 'constexpr' expansion of 'Sieve<1200000>()'
a.cc:19:7: error: 'constexpr' loop iteration count exceeds limit of 262144 (use '-fconstexpr-loop-limit=' to increase the limit)
19 | for (int n = 2*p; n < size; n += p) {
| ^~~
|
s945366123 | p00009 | C++ | #include<iostream>
#include<cstdio>
using namespace std;
const int len 200000
int prime[len];
int a;
bool mark[len];
void f()
{
a=0;
long long int i,j;
for( i=0; i<len; i++)
{
mark[i]=false;
}
for( i=2; i<len; i++)
{
if(mark[i]==1)
continue;
else
... | a.cc:4:15: error: expected initializer before numeric constant
4 | const int len 200000
| ^~~~~~
a.cc:7:11: error: 'len' was not declared in this scope; did you mean 'mblen'?
7 | bool mark[len];
| ^~~
| mblen
a.cc: In function 'void f()':
a.cc:13:17: error: 'l... |
s384206841 | p00009 | C++ | #include<iostream>
#include<vector>
#define MAX 1000000
using namespace std;
int main(){
vector<int> v(MAX);
for(int i = 0;i<MAX;i++)
v[i]=true;
v[0]=false;
v[1]=false;
for(int i = 2;i<MAX;i++){
if(v[i]==true){
for(long long int = (long long int)i*i;j<MAX;j=j*j){
v... | a.cc: In function 'int main()':
a.cc:14:28: error: expected unqualified-id before '=' token
14 | for(long long int = (long long int)i*i;j<MAX;j=j*j){
| ^
a.cc:14:26: error: expected ';' before '=' token
14 | for(long long int = (long long int)i*i;j<MAX;j=j*j){
... |
s001740952 | p00009 | C++ | #include<iostream>
#include<vector>
#define MAX 1000000
using namespace std;
int main(){
vector<int> v(MAX);
for(int i = 0;i<MAX;i++)
v[i]=true;
v[0]=false;
v[1]=false;
for(int i = 2;i<MAX;i++){
if(v[i]==true){
for(long long int = (long long int)i*i;j<MAX;j=j*j){
v... | a.cc: In function 'int main()':
a.cc:14:28: error: expected unqualified-id before '=' token
14 | for(long long int = (long long int)i*i;j<MAX;j=j*j){
| ^
a.cc:14:26: error: expected ';' before '=' token
14 | for(long long int = (long long int)i*i;j<MAX;j=j*j){
... |
s917772985 | p00009 | C++ | #include <iostream>
using namespace std;
int main(){
bool is_prime[1000000];
is_prime[0]=is_prime[1]=false;
for(int i=2;i<1000000i++){
is_prime[i] = true;
}
for(int i=2;i*i<1000000;i++){
if(is_prime[i]){
for(int j=i*i;j<1000000;j=j+i){
is_prime[j] = false;
}
}
}
int n_p... | a.cc: In function 'int main()':
a.cc:8:25: error: lvalue required as increment operand
8 | for(int i=2;i<1000000i++){
| ^~
a.cc:8:27: error: expected ';' before ')' token
8 | for(int i=2;i<1000000i++){
| ^
| ;
|
s656125994 | p00009 | C++ | #include <iostream>
using namespace std;
bool IsPrime(int n) {
for(int i = 2; i*i <= n; i++) {
if(n % i == 0) {
return false;
}
}
return true;
}
int main(void){
int count = 0;
int n;
cin >> n;
for(int i=0; i<n; i++){
int p;
cin >> p;
if(IsPrime(p)){
count++;
}
}... | a.cc: In function 'int main()':
a.cc:24:24: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
24 | count << count << endl;
| ~~~~~~~~~~~~~~~^~~~~~~
|
s747807783 | p00009 | C++ | #include <iostream>
using namespace std;
bool IsPrime(int x) {
return true; /* ダミー: 全て素数と判定 */
}
int main(void){
int count = 0, n;
cin >> n; /* n個整数を読む */
for(int i = 0; i < n; i++) {
int p;
cin >> p;
if(IsPrime(p)) {
bool IsPrime(int n) {
for(int i = 2; i*i <= n; i++) {
... | a.cc: In function 'int main()':
a.cc:15:30: error: a function-definition is not allowed here before '{' token
15 | bool IsPrime(int n) {
| ^
|
s168093470 | p00009 | C++ | #include <iostream>
bool IsPrime(int n) {
for(int i = 2; i*i <= n; i++) {
if(n % i == 0) {
return false;
}
}
return true;
}
int main() {
// your code goes here
int n;
while(1){
cin >> n;
if(cin.eof()){
break;
}
int count = 0;
for(int i=2;i<=n;i++){
if(IsPrim... | a.cc: In function 'int main()':
a.cc:17:17: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
17 | cin >> n;
| ^~~
| std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | exte... |
s949039838 | p00009 | C++ | #include <iostream>
using namespace std;
int main(){
bool is_prime[1000000];
is_prime[0]=is_prime[1]=false;
for(int i=2;i<1000000i++){
is_prime[i] = true;
}
for(int i=2;i*i<1000000;i++){
if(is_prime[i]){
for(int j=i*i;j<1000000;j=j+i){
is_prime[j] = false;
}
}
}
int n_p... | a.cc: In function 'int main()':
a.cc:8:25: error: lvalue required as increment operand
8 | for(int i=2;i<1000000i++){
| ^~
a.cc:8:27: error: expected ';' before ')' token
8 | for(int i=2;i<1000000i++){
| ^
| ;
|
s233224160 | p00009 | C++ | #include <iostream>
using namespace std;
bool IsPrime(int n){
for(int i=2;i*i<=n;i++){
if(n%i == 0){return false;}
}
return true;
}
int main(void) {
int n;
while(cin >> n){
for(i=2;i<=n;i++){
if(IsPrime(i)) count++;
}
cout << count << endl;
}
return 0;... | a.cc:17:2: error: extended character is not valid in an identifier
17 | if(IsPrime(i)) count++;
| ^
a.cc:17:2: error: extended character is not valid in an identifier
a.cc:18:2: error: extended character is not valid in an identifier
18 | }
| ^
a.cc: In function 'int main(... |
s850138282 | p00009 | C++ | #include <iostream>
using namespace std;
int main(){
int n,k,kk;
while(cin>>n){
kk=0;
for(int j=3;j<=n;j+=2){
k=0;
for(int i=3;i<=sqrt(j);i+=2){
if(j%i==0)k++;
}
if(k==1)kk++;
}
if(n==1)cout<<"0"<<endl;
else if(n==2)cout<<"1"<<endl;
else cout<<kk+1<<endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:9:40: error: 'sqrt' was not declared in this scope
9 | for(int i=3;i<=sqrt(j);i+=2){
| ^~~~
|
s961112039 | p00009 | C++ | std::vector<bool> IsPrime;
void sieve(size_t max){
if(max+1 > IsPrime.size()){
IsPrime.resize(max+1,true);
}
IsPrime[0] = false;
IsPrime[1] = false;
for(size_t i=2; i*i<=max; ++i)
if(IsPrime[i])
for(size_t j=2; i*j<=max; ++j)
IsPrime[i*j] = fals... | a.cc:1:6: error: 'vector' in namespace 'std' does not name a template type
1 | std::vector<bool> IsPrime;
| ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
+++ |+#include <vector>
1 | std::vector<bool> IsPrime;
a.cc:3:6: e... |
s095977276 | p00009 | C++ | #include<stdio.h> int main(void){ int a,b,r,ans,a1,b1; double c; while(scanf("%d %d",&a,&b)!=EOF){ a1=a,b1=b; while(1){ r=a%b; if(r==0){ ans=b; break; }else{ a=b; b=r; } } c=(double)(a1)*(double)(b1)/(double)(ans); printf("%d %.0f\n",ans,c); } return 0; }
| a.cc:1:19: warning: extra tokens at end of #include directive
1 | #include<stdio.h> int main(void){ int a,b,r,ans,a1,b1; double c; while(scanf("%d %d",&a,&b)!=EOF){ a1=a,b1=b; while(1){ r=a%b; if(r==0){ ans=b; break; }else{ a=b; b=r; } } c=(double)(a1)*(double)(b1)/(double)(ans); printf("%d %.0f\n",ans,c); } return... |
s629824660 | p00009 | C++ | #include<stdio.h> int prime[1000000]; int main(){ prime[0]=-1; prime[1]=-1; for(int i=2;i<1000000;i++){ if(prime[i]==0){ prime[i]=1; for(int j=i*2;j<1000000;j+=i)prime[j]=-1; } } int now; while(~scanf("%d",&now)){ int ans=0; for(int i=1;i<now+1;i++)if(prime[i]==1)ans++; printf("%d\n",ans); } }
| a.cc:1:19: warning: extra tokens at end of #include directive
1 | #include<stdio.h> int prime[1000000]; int main(){ prime[0]=-1; prime[1]=-1; for(int i=2;i<1000000;i++){ if(prime[i]==0){ prime[i]=1; for(int j=i*2;j<1000000;j+=i)prime[j]=-1; } } int now; while(~scanf("%d",&now)){ int ans=0; for(int i=1;i<now+1;i++)i... |
s509458614 | p00009 | C++ | #define _USE_MATH_DEFINES
#include <iostream>
#include <math.h>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
int main(){
int N;
while(cin >> N)
double p = std::log2(N);
while (cin >> N){
int sum =0;
cout << N*p << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:14:27: error: 'p' was not declared in this scope
14 | cout << N*p << endl;
| ^
|
s610734675 | p00009 | C++ | #define _USE_MATH_DEFINES
#include <iostream>
#include <math.h>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
int main(){
int N;
while(cin >> N)
double p = log2(N);
while (cin >> N){
int sum =0;
cout << N*p << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:14:27: error: 'p' was not declared in this scope
14 | cout << N*p << endl;
| ^
|
s031840434 | p00009 | C++ | import sys
def prime_calc(n):
if n < 2:
return False
else:
i = 2
while n > i:
if n % i == 0:
return False
else:
i += 1
return True
def prime(n):
cnt = 0
for i in range(0, n+1):
ans = prime_calc(i)
if an... | a.cc:1:1: error: 'import' does not name a type
1 | import sys
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
|
s095103477 | p00009 | C++ | #include<iostream>
#define MAX 1000000
using namespace std;
bool prime[MAX+1];
int T[MAX];
void eratos( int n ){
for ( int i = 0; i < n; i++ ) prime[i] = false;
for ( int i = 3; i <= n; i += 2 ) prime[i] = true;
prime[2] = true;
for ( int i = 3, limit = (int)sqrt(n); i <= limit; i += 2 ) {
if ( !pri... | a.cc: In function 'void eratos(int)':
a.cc:13:35: error: 'sqrt' was not declared in this scope
13 | for ( int i = 3, limit = (int)sqrt(n); i <= limit; i += 2 ) {
| ^~~~
a.cc: At global scope:
a.cc:27:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-... |
s181175864 | p00009 | C++ | import java.util.*;
import java.io.*;
class Main
{
public static void main(String[] args)
{
Boorean[] bit = new Boorean[1000000];
Arrays.fill(bit, true);
bit[0] = false;
bit[1] = false;
for(int i=2; i<1000; ++i){
if(bit[i]){
for(int j=i*2; j<1000000; j+=i)
bit[j] = false;
}
}
int[] pri... | a.cc:1:1: error: 'import' does not name a type
1 | import java.util.*;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
2 | import java.io.*;
| ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:15:... |
s132631512 | p00009 | C++ | #include <stdio.h>
main(n){
int b[100000],i,j;
while(~scanf("%d",&n)){
n++;
for(i=2;i<n;i++)b[i]=1;
for(i=2;i<n;i++)for(j=i*2;j<n;j+=i)b[j]=0;
for(i=2,j=0;i<n;i++)j+=b[i]?1:0;
printf("%d\n",j);
}
} | a.cc:2:5: error: expected constructor, destructor, or type conversion before '(' token
2 | main(n){
| ^
|
s235999488 | p00009 | C++ | #include <iostream>
#include <bitset>
using namespace std;
int main() {
bitset<1000000> primes;
int i, j, n, ans;
for (n = 0; n <= 999999; n++) {
primes.reset();
for (i = 2; i <= n; i++)
if (primes[i] == false)
for (j = i + i; j <= n; j += i)
primes[j] = true;
cout << n == 0 ? 0: n - prime... | a.cc: In function 'int main()':
a.cc:15:15: error: no match for 'operator==' (operand types are 'std::basic_ostream<char>' and 'int')
15 | cout << n == 0 ? 0: n - primes.count() - 1 << endl;
| ~~~~~~~~~ ^~ ~
| | |
| | int
| std::basic_ostream<cha... |
s159987959 | p00009 | C++ | #include <iostream>
using namespace std;
int main(){
const int NUM = 1000000;
bool prime[NUM];
prime[0] = false;prime[1] = false;
for(int i=2;i<NUM;i++)
prime[i] = true;
for(int i=2;i*i<NUM;i++)
for(int k=2;i*k<NUM;k++)
prime[i*k]=false;
int n,c=0,i=0;
for(cin>>n;i<n;i++)if(prime[i})count++;... | a.cc: In function 'int main()':
a.cc:13:32: error: expected ']' before '}' token
13 | for(cin>>n;i<n;i++)if(prime[i})count++;
| ^
| ]
a.cc:13:32: error: expected ')' before '}' token
13 | for(cin>>n;i<n;i++)if(prime[i})count++;
| ... |
s877246011 | p00009 | C++ | import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
public class Main{
Scanner sc;
static final int INF=1<<28;
static final double EPS=1e-9;
void run(){
sc=new Scanner(System.in);
for(;;){
if(!sc.hasNext())
b... | a.cc:1:1: error: 'import' does not name a type
1 | import java.util.*;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
2 | import java.lang.*;
| ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1... |
s018773597 | p00009 | C++ | #include<iostream>
#include<string>
int main(){for(int m,n,o,c,d,e,i;!(std::cin>>n).eof();){if(n<3)e=n>1;else{bool*v=new bool[c=(n&1?n:--n)/2+1];memset(v,1,c);for(i=m=e=1;i<c;i++){for(m=i;m<c&&!v[m];)m++;if(m==c)break;e++;for(d=o=m*2+1;d<n+1;d+=o*2)v[d/2]=0;if(n<o*o)break;}for(i=1;i<c;)e+=v[i++];delete[]v;}printf("%d\n... | a.cc: In function 'int main()':
a.cc:3:110: error: 'memset' was not declared in this scope
3 | int main(){for(int m,n,o,c,d,e,i;!(std::cin>>n).eof();){if(n<3)e=n>1;else{bool*v=new bool[c=(n&1?n:--n)/2+1];memset(v,1,c);for(i=m=e=1;i<c;i++){for(m=i;m<c&&!v[m];)m++;if(m==c)break;e++;for(d=o=m*2+1;d<n+1;d+=o*2)v[d/2]=0... |
s890760455 | p00009 | C++ | #include<iostream>
#include<string>
int main(){for(int m,n,o,c,d,e,i;!(std::cin>>n).eof();){if(n<3)e=n>1;else{bool*v=new bool[c=(n&1?n:--n)/2+1];memset(v,1,c);for(i=m=e=1;i<c;i++){for(m=i;m<c&&!v[m];)m++;if(m==c)break;e++;for(d=o=m*2+1;d<n+1;d+=o*2)v[d/2]=0;if(n<o*o)break;}for(i=1;i<c;)e+=v[i++];delete[]v;}printf("%d\n... | a.cc: In function 'int main()':
a.cc:3:110: error: 'memset' was not declared in this scope
3 | int main(){for(int m,n,o,c,d,e,i;!(std::cin>>n).eof();){if(n<3)e=n>1;else{bool*v=new bool[c=(n&1?n:--n)/2+1];memset(v,1,c);for(i=m=e=1;i<c;i++){for(m=i;m<c&&!v[m];)m++;if(m==c)break;e++;for(d=o=m*2+1;d<n+1;d+=o*2)v[d/2]=0... |
s792804390 | p00009 | C++ | #include<iostream>
#include<string>
#include<new>
int main(){for(int m,n,o,c,d,e,i;!(std::cin>>n).eof();){if(n<3)e=n>1;else{bool*v=new bool[c=(n&1?n:--n)/2+1];memset(v,1,c);for(i=m=e=1;i<c;i++){for(m=i;m<c&&!v[m];)m++;if(m==c)break;e++;for(d=o=m*2+1;d<n+1;d+=o*2)v[d/2]=0;if(n<o*o)break;}for(i=1;i<c;)e+=v[i++];delete[]v... | a.cc: In function 'int main()':
a.cc:4:110: error: 'memset' was not declared in this scope
4 | int main(){for(int m,n,o,c,d,e,i;!(std::cin>>n).eof();){if(n<3)e=n>1;else{bool*v=new bool[c=(n&1?n:--n)/2+1];memset(v,1,c);for(i=m=e=1;i<c;i++){for(m=i;m<c&&!v[m];)m++;if(m==c)break;e++;for(d=o=m*2+1;d<n+1;d+=o*2)v[d/2]=0... |
s868848745 | p00009 | C++ | #include<iostream>
#include<string>
int main(){for(int m,n,o,c,d,e,i;!(std::cin>>n).eof();){if(n<3)e=n>1;else{bool*v=new bool[c=(n&1?n:--n)/2+1];std::memset(v,1,c);for(i=m=e=1;i<c;i++){for(m=i;m<c&&!v[m];)m++;if(m==c)break;e++;for(d=o=m*2+1;d<n+1;d+=o*2)v[d/2]=0;if(n<o*o)break;}for(i=1;i<c;)e+=v[i++];delete[]v;}printf(... | a.cc: In function 'int main()':
a.cc:3:115: error: 'memset' is not a member of 'std'; did you mean 'wmemset'?
3 | int main(){for(int m,n,o,c,d,e,i;!(std::cin>>n).eof();){if(n<3)e=n>1;else{bool*v=new bool[c=(n&1?n:--n)/2+1];std::memset(v,1,c);for(i=m=e=1;i<c;i++){for(m=i;m<c&&!v[m];)m++;if(m==c)break;e++;for(d=o=m*2... |
s374781575 | p00009 | C++ | #include <iostream>
using namespace std;
typedef long long ll;
int main()
{
int prime_num[1000001];
memset(prime_num, 0, 1000001);
prime_num[2] = 1;
int ans = 1;
for(int i = 3; i <= 1000000; i++) {
if(i % 2 == 0) {
prime_num[i] = prime_num[i-1];
continue;
... | a.cc: In function 'int main()':
a.cc:10:5: error: 'memset' was not declared in this scope
10 | memset(prime_num, 0, 1000001);
| ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include <iostream>
+++ |+#include <cstring... |
s065607341 | p00009 | C++ | #include <iostream>
#include <math>
using namespace std;
int main() {
int lim;
int i,n;
int count=1;
bool isPrime=true;
scanf("%d",&n);
for(lim=2;lim<=n;lim++) {
for(i=2;i<(int)(sqrt(lim)+1.0);i++) {
if((lim%i)==0) {
isPrime=false;
count++;
break;
}
}
}
printf("%d",... | a.cc:2:10: fatal error: math: No such file or directory
2 | #include <math>
| ^~~~~~
compilation terminated.
|
s417300608 | p00009 | C++ | #include<cstdio>
#include<cstring>
int main(){
int n,cnt=0;
scanf("%d",&n);
int a[n+1];
memset(a,-1,sizeof(int)*(n+1));
for(int i=2;i<=n;i++){
if(a[i]==-1){ con++;
for(int j=i;j<=n;j=j+i) a[j]=0;}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:9:16: error: 'con' was not declared in this scope
9 | if(a[i]==-1){ con++;
| ^~~
|
s512019373 | p00009 | C++ | #include <cstdio>
int NUM = 1000000;
bool prime[NUM];
int main(){
prime[0] = false;prime[1] = false;
for(int i=2;i<NUM;i++)prime[i] = true;
for(int i=2;i*i<NUM;i++)
for(int k=2;i*k<NUM;k++)
prime[i*k]=false;
int primeNum[NUM];
for(int i=0,c=0;i<NUM;i++){
prime[i]&&c++;
primeNum[i] = c;
}
for(in... | a.cc:3:12: error: size of array 'prime' is not an integral constant-expression
3 | bool prime[NUM];
| ^~~
|
s550479476 | p00009 | C++ | #include <cstdio>
const int N = 1000000;
int p[NUM],int pN[NUM];
main(){p[0]=0;p[1]=0;int i,k,n,c;
for(i=2;i<N;i++)prime[i]=1;for(i=2;i*i<N;){for(k=2;i*k<N;k++)p[i*k]=0;do{i++;}while(!p[i]);}for(i=0,c=0;i<N;i++){p[i]&&c++;pN[i] = c;}for(;scanf("%d",&n)+1;printf("%d\n",pN[n]));} | a.cc:3:7: error: 'NUM' was not declared in this scope
3 | int p[NUM],int pN[NUM];
| ^~~
a.cc:3:12: error: expected unqualified-id before 'int'
3 | int p[NUM],int pN[NUM];
| ^~~
a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
4 | main(){p[0]=... |
s559981648 | p00009 | C++ | #include <cstdio>
const int N = 1000000;
int p[N],int pN[N];
main(){p[0]=0;p[1]=0;int i,k,n,c;
for(i=2;i<N;i++)prime[i]=1;for(i=2;i*i<N;){for(k=2;i*k<N;k++)p[i*k]=0;do{i++;}while(!p[i]);}for(i=0,c=0;i<N;i++){p[i]&&c++;pN[i] = c;}for(;scanf("%d",&n)+1;printf("%d\n",pN[n]));} | a.cc:3:10: error: expected unqualified-id before 'int'
3 | int p[N],int pN[N];
| ^~~
a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
4 | main(){p[0]=0;p[1]=0;int i,k,n,c;
| ^~~~
a.cc: In function 'int main()':
a.cc:5:17: error: 'prime' was not declared ... |
s683568620 | p00009 | C++ | #include <iostream>
using namespace std;
#define MAX 1000000;
int N;
int prime[MAX];
int main(){
prime[0]=1;
prime[1]=1;
prime[2]=0;
prime[3]=0;
for(int i=0;i*i<=MAX;i++) {
if(prime[i]==1) continue;
for(int t = i*2;t<MAX;t+=i)
prime[i]=1;
}
while(cin.eof()){
int m = 0;
cin >> N;
for(int i =0;i<... | a.cc:3:20: error: expected ']' before ';' token
3 | #define MAX 1000000;
| ^
a.cc:6:11: note: in expansion of macro 'MAX'
6 | int prime[MAX];
| ^~~
a.cc:6:14: error: expected unqualified-id before ']' token
6 | int prime[MAX];
| ^
a.cc: In function... |
s300215021 | p00009 | C++ | #include <iostream>
using namespace std;
int main(){
int a;
int i, j;
int past=1, a_sqrt;
int count;
bool chk[1000000];
for(i=1; i<1000000; i++) chk[i]=true;
while(cin>>a){
count=0;
if(past>=a){
for(i=1; i<=a; i++){
if(chk[i]) count++;
}
printf("%d\n", count);
}
... | a.cc: In function 'int main()':
a.cc:21:15: error: invalid operands of types 'int' and 'double' to binary 'operator^'
21 | a_sqrt=a^0.5;
| ~^~~~
| | |
| | double
| int
|
s912143661 | p00009 | C++ | #include <iostream>
using namespace std;
int main(){
int a;
int i, j;
int past=1, a_sqrt;
int count;
bool chk[1000000];
for(i=1; i<1000000; i++) chk[i]=true;
while(cin>>a){
count=0;
if(past>=a){
for(i=1; i<=a; i++){
if(chk[i]) count++;
}
printf("%d\n", count);
}
... | a.cc: In function 'int main()':
a.cc:21:19: error: 'sqrt' was not declared in this scope; did you mean 'a_sqrt'?
21 | a_sqrt=(int)sqrt(a);
| ^~~~
| a_sqrt
|
s792171889 | p00009 | C++ | #include <iostream>
using namespace std;
int main(){
int a;
int i, j;
int past=1, a_sqrt;
int count;
bool chk[1000000];
for(i=1; i<1000000; i++) chk[i]=true;
while(cin >> a){
count=0;
if(past>=a){
for(i=1; i<=a; i++){
if(chk[i]) count++;
}
printf("%d\n", count);
}
... | a.cc: In function 'int main()':
a.cc:21:19: error: 'sqrt' was not declared in this scope; did you mean 'a_sqrt'?
21 | a_sqrt=(int)sqrt(a);
| ^~~~
| a_sqrt
|
s742641962 | p00009 | C++ | import java.io.*;
import java.util.*;
import java.math.*;
class Main{
private static ArrayList<Integer> sum_check(int a){
int count = 0;
ArrayList<Integer> s = new ArrayList<Integer>();
for(int i=0;i<=a;i++){
s.add(0);
}
s.set(2,1);
for(int i=3;i<=a;i=i+2) s.set(i,1);
for(int i=3;i<=Math.sqrt... | a.cc:1:1: error: 'import' does not name a type
1 | import java.io.*;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
3 | import java.util.*;
| ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: ... |
s073022942 | p00009 | C++ | #include<iostream>
#include<string>
#include<cmath>
#include<time.h>
using namespace std;
int main()
{
long long int k,p[100000];
long long int n;
time_t time1,time2;
p[0]=2;
cin>>n;
time(&time1);
if(n<0){
break;
}
k=0;
int r=(int)sqrt((float)n);
for(int i=3;i<=r;i++){
for(int j=0;j<k+1;j++){
if... | a.cc: In function 'int main()':
a.cc:17:25: error: break statement not within loop or switch
17 | break;
| ^~~~~
|
s797829920 | p00009 | C++ | #include<iostream>
#include<string>
#include<cmath>
using namespace std;
int main()
{
long long int k,p[100000];
long long int n;
p[0]=2;
cin>>n;
if(n<0){
break;
}
k=0;
int r=(int)sqrt((float)n);
for(int i=3;i<=r;i++){
for(int j=0;j<k+1;j++){
if(i%p[j]==0){
break;
}else if(j==k){
k++;
... | a.cc: In function 'int main()':
a.cc:16:25: error: break statement not within loop or switch
16 | break;
| ^~~~~
|
s017787791 | p00009 | C++ | j,a[' '],s;main(i){for(;++i<1e6;){if(!a[i])for(j=i;j<1e6;)a[j+=i]=1;a[i]=s+=!a[i];}for(;~scanf("%d",&i);printf("%d\n",a[i]));} | a.cc:1:5: warning: multi-character character constant [-Wmultichar]
1 | j,a[' '],s;main(i){for(;++i<1e6;){if(!a[i])for(j=i;j<1e6;)a[j+=i]=1;a[i]=s+=!a[i];}for(;~scanf("%d",&i);printf("%d\n",a[i]));}
| ^~~~~
a.cc:1:1: error: 'j' does not name a type
1 | j,a[' '],s;main(i){for(;++i<1e6;){if(!a[i])fo... |
s335623308 | p00009 | C++ | j,a[' '],s;main(i){for(;++i<1e6||~scanf("%d",&j)&&printf("%d\n",a[j]);)for(s+=!a[j=i];j<1e6;a[i]=s)a[j+=i]=1;} | a.cc:1:5: warning: multi-character character constant [-Wmultichar]
1 | j,a[' '],s;main(i){for(;++i<1e6||~scanf("%d",&j)&&printf("%d\n",a[j]);)for(s+=!a[j=i];j<1e6;a[i]=s)a[j+=i]=1;}
| ^~~~~
a.cc:1:1: error: 'j' does not name a type
1 | j,a[' '],s;main(i){for(;++i<1e6||~scanf("%d",&j)&&printf("%d\... |
s270113248 | p00009 | C++ | j,a[' '],s;main(i){for(;++i<1e6||~scanf(s="%d\n",&j)&&printf(s,a[j]);)for(a[i]=s+=!a[j=i];j<1e6;a[j+=i]=1);} | a.cc:1:5: warning: multi-character character constant [-Wmultichar]
1 | j,a[' '],s;main(i){for(;++i<1e6||~scanf(s="%d\n",&j)&&printf(s,a[j]);)for(a[i]=s+=!a[j=i];j<1e6;a[j+=i]=1);}
| ^~~~~
a.cc:1:1: error: 'j' does not name a type
1 | j,a[' '],s;main(i){for(;++i<1e6||~scanf(s="%d\n",&j)&&printf(s,... |
s151665737 | p00009 | C++ | #include<iostream>
using namespace std;
int main(){
int n;
int max=1;
while(cin>>n){
for(int i=3;i<=n;i+=2){
for(int j=2;j<=i/2+1;j++){
if(i%j==0){max++;goto A;}
}
A:
;
cout<<max<<endl;
max=1;
}
} | a.cc: In function 'int main()':
a.cc:16:2: error: expected '}' at end of input
16 | }
| ^
a.cc:3:11: note: to match this '{'
3 | int main(){
| ^
|
s695663079 | p00009 | C++ | j,a[' '],s;main(i){for(;++i<1e6||~scanf(s="%d\n",&j)&&printf(s,a[j]);)for(a[i]=s+=!a[j=i];j<1e6;a[j+=i]=1);} | a.cc:1:5: warning: multi-character character constant [-Wmultichar]
1 | j,a[' '],s;main(i){for(;++i<1e6||~scanf(s="%d\n",&j)&&printf(s,a[j]);)for(a[i]=s+=!a[j=i];j<1e6;a[j+=i]=1);}
| ^~~~~
a.cc:1:1: error: 'j' does not name a type
1 | j,a[' '],s;main(i){for(;++i<1e6||~scanf(s="%d\n",&j)&&printf(s,... |
s435274644 | p00009 | C++ | j,a[' '],s;main(i){for(;++i<1e6||~scanf(s="%d\n",&j)&&printf(s,a[j]);)for(a[i]=s+=!a[j=i];j<1e6;a[j+=i]=1);} | a.cc:1:5: warning: multi-character character constant [-Wmultichar]
1 | j,a[' '],s;main(i){for(;++i<1e6||~scanf(s="%d\n",&j)&&printf(s,a[j]);)for(a[i]=s+=!a[j=i];j<1e6;a[j+=i]=1);}
| ^~~~~
a.cc:1:1: error: 'j' does not name a type
1 | j,a[' '],s;main(i){for(;++i<1e6||~scanf(s="%d\n",&j)&&printf(s,... |
s268080664 | p00009 | C++ | #include <iostream>
#include <cstdlib>
using namespace std;
bool is_prime(int n){
for(int i=2;i*i<=n;i++){
if(n % i == 0) return false;
}
return n!=1;
}
int main(){
int n;
while(~scanf("%d",&n)){
int* table = new int[1000000];
memset(table,sizeof(table),1);
table[0]=0;
for(int i=1;i<=n;i++){
if(!is_prime(i)) {
for... | a.cc: In function 'int main()':
a.cc:17:1: error: 'memset' was not declared in this scope
17 | memset(table,sizeof(table),1);
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <cstdlib>
+++ |+#include <cstring>
3 |... |
s478597239 | p00009 | C++ | #include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <limits>
#include <map>
using namespace std;
bool is_prime(int n){
for(int i=2;i*i<=n;i++){
if(n % i == 0) return false;
}
return n!=1;
}
int main(){
int n;
while(~scanf("%d",&n)){
int* table = new int[1000000];
... | a.cc: In function 'int main()':
a.cc:22:1: error: 'memset' was not declared in this scope
22 | memset(table,sizeof(table),1);
| ^~~~~~
a.cc:8:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
7 | #include <map>
+++ |+#include <cstring>
8 | usi... |
s339638879 | p00009 | C++ | #include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <limits>
#include <map>
#include <string>
using namespace std;
bool is_prime(int n){
for(int i=2;i*i<=n;i++){
if(n % i == 0) return false;
}
return n!=1;
}
int main(){
int n;
while(~scanf("%d",&n)){
int* table = ... | a.cc: In function 'int main()':
a.cc:23:1: error: 'memset' was not declared in this scope
23 | memset(table,sizeof(table),1);
| ^~~~~~
a.cc:8:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
7 | #include <map>
+++ |+#include <cstring>
8 | #in... |
s277461425 | p00009 | C++ | #include<iostream>
using namespace std;
int main(void){
long int n,f,k,i;
int count;
bool chk;
scanf("%d",&n)!=EOF);
count=0;
for(i=2;i<=n;i++){
chk=0;
f=i/2;
k=2;
while(f>=k){
if((i%k)==0){
chk=true;
break;
}
k++;
}
if(chk==false){
count++;
}
}
co... | a.cc: In function 'int main()':
a.cc:10:28: error: expected ';' before ')' token
10 | scanf("%d",&n)!=EOF);
| ^
|
s274128509 | p00009 | C++ | #include <iostream>
#include <string>
#include <array>
 
int main() {
    std::array<bool, 1000000> is_prime_table = { false, false, true };
    for( int i=3; i<=is_prime_table.size(); i+=2 ) {
        is_prime_table[i] = [&i]() -> boo... | a.cc:4:2: error: stray '#' in program
4 |  
| ^
a.cc:6:2: error: stray '#' in program
6 |     std::array<bool, 1000000> is_prime_table = { false, false, true };
| ^
a.cc:6:8: error: stray '#' in program
6 |     std::array<bool, 1000000> is_prime_tab... |
s291172549 | p00009 | C++ | #include <iostream>
#include <string>
#include <array>
 
int main() {
    std::array<bool, 1000000> is_prime_table = { false, false, true };
    for( int i=3; i<=is_prime_table.size(); i+=2 ) {
        is_prime_table[i] = [&i]() -> boo... | a.cc:4:2: error: stray '#' in program
4 |  
| ^
a.cc:6:2: error: stray '#' in program
6 |     std::array<bool, 1000000> is_prime_table = { false, false, true };
| ^
a.cc:6:8: error: stray '#' in program
6 |     std::array<bool, 1000000> is_prime_tab... |
s869188105 | p00009 | C++ | #include<iostream>
using namespace std;
bool Prime(int n)
{
if((n==1)||(n==0))
{
return false;
}
for(int i=2;i<=n-1;++i)
{
if(n%i==0)
{
return false;
}
}
return true;
}
void main()
{
int n;
while(cin>>n)
{
int count = 0;
for(int i=0;i<=n;++i)
{
if(Prime(i))
{
++count;
}
}
... | a.cc:23:1: error: '::main' must return 'int'
23 | void main()
| ^~~~
|
s004711801 | p00009 | C++ | #include<iostream>
using namespace std;
bool Prime(int n)
{
if((n==1)||(n==0))
{
return false;
}
for(int i=2;i<=(int)sqrt((double)n);++i)
{
if(n%i==0)
{
return false;
}
}
return true;
}
int main()
{
int n;
while(cin>>n)
{
int count = 0;
for(int i=0;i<=n;++i)
{
if(Prime(i))
{
++... | a.cc: In function 'bool Prime(int)':
a.cc:13:29: error: 'sqrt' was not declared in this scope
13 | for(int i=2;i<=(int)sqrt((double)n);++i)
| ^~~~
|
s919820776 | p00009 | C++ | #include<iostream>
using namespace std;
__forceinline int isPrime(int n){
//sieve of Eratosthenes
if(n==2) return 1;
if(n%2==0 || n<2){
return 0;
}
for(int i=3; i*i<=n; i+=2){
if(n%i==0){
return 0;
}
}
return 1;
}
//0009
int main()
{
int n;
while(cin >> n){
int cnt = 0;
for(; n>1; n--){
... | a.cc:4:1: error: '__forceinline' does not name a type
4 | __forceinline int isPrime(int n){
| ^~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:28:28: error: 'isPrime' was not declared in this scope
28 | if(isPrime(n))
| ^~~~~~~
|
s814921453 | p00009 | C++ | #include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;
bool t[1000000];
int main(){
memset(t,1,sizeof(t));
t[0] = t[1] = false;
for(int i = 2; i < 1000; i++){
if(t[i])
for(int j = 2 * i; j < 1000000; j += i){
t[j] = false;
}
}
int n;
whil... | a.cc: In function 'int main()':
a.cc:12:9: error: 'memset' was not declared in this scope
12 | memset(t,1,sizeof(t));
| ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
4 | #include <cmath>
+++ |+#include <cstring>
... |
s107805280 | p00009 | C++ | #include <stdio.h>
bool isPrimeNumber(int number){
if(number == 2) return true;
if(number % 2 == 0) return false;
for(int i = 3; i <= sqrt(number) ;i += 2){
if(number % i == 0) return false;
}
return true;
}
int main(int argc, char** argv){
int search, counter;
while((scanf("%d", &search)) != EOF){... | a.cc: In function 'bool isPrimeNumber(int)':
a.cc:7:29: error: 'sqrt' was not declared in this scope
7 | for(int i = 3; i <= sqrt(number) ;i += 2){
| ^~~~
|
s406039192 | p00009 | C++ | #include<stdio.h>
#include<float.h>
#include<vector>
vector<int> primes;
int ref_max=2;
int makePrimenumbers(int a){
if(a<ref_max)return 0;
temp = ref_max;
ref_max=a;
int i,k,isp=1;
for(k=temp;k<ref_max;k++){
for(i=0;i<primes.size();i++){
if(k%primes[i]==0){
isp=0;
break;
}
}
if(isp==1){
... | a.cc:6:1: error: 'vector' does not name a type
6 | vector<int> primes;
| ^~~~~~
a.cc: In function 'int makePrimenumbers(int)':
a.cc:12:9: error: 'temp' was not declared in this scope; did you mean 'tempnam'?
12 | temp = ref_max;
| ^~~~
| tempnam
a.cc:17:27: error: 'prime... |
s802997737 | p00009 | C++ | #include<stdio.h>
#include<float.h>
#include<vector>
vector<int> primes;
int ref_max=2;
int makePrimenumbers(int a){
if(a<ref_max)return 0;
temp = ref_max;
ref_max=a;
int i,k,isp=1;
for(k=temp;k<ref_max;k++){
for(i=0;i<primes.size();i++){
if(k%primes[i]==0){
isp=0;
break;
}
}
if(isp==1){
... | a.cc:6:1: error: 'vector' does not name a type
6 | vector<int> primes;
| ^~~~~~
a.cc: In function 'int makePrimenumbers(int)':
a.cc:12:9: error: 'temp' was not declared in this scope; did you mean 'tempnam'?
12 | temp = ref_max;
| ^~~~
| tempnam
a.cc:17:27: error: 'prime... |
s688237684 | p00009 | C++ | #include<stdio.h>
#include<float.h>
#include<vector>
int makePrimenumbers(int a){
int temp;
if(a<ref_max)return 0;
temp = ref_max;
ref_max=a;
int i,k,isp=1;
for(k=temp;k<ref_max;k++){
for(i=0;i<primes.size();i++){
if(k%primes[i]==0){
isp=0;
break;
}
}
if(isp==1){
primes.push_back(k);... | a.cc: In function 'int makePrimenumbers(int)':
a.cc:10:14: error: 'ref_max' was not declared in this scope
10 | if(a<ref_max)return 0;
| ^~~~~~~
a.cc:12:16: error: 'ref_max' was not declared in this scope
12 | temp = ref_max;
| ^~~~~~~
a.cc:17:27: error: 'pr... |
s875236132 | p00009 | C++ | #include<stdio.h>
#include<float.h>
#include<vector>
int makePrimenumbers(int a, int ref_max, vector<int> primes){
int temp;
if(a<ref_max)return 0;
temp = ref_max;
ref_max=a;
int i,k,isp=1;
for(k=temp;k<ref_max;k++){
for(i=0;i<primes.size();i++){
if(k%primes[i]==0){
isp=0;
break;
}
}
if... | a.cc:7:42: error: 'vector' has not been declared
7 | int makePrimenumbers(int a, int ref_max, vector<int> primes){
| ^~~~~~
a.cc:7:48: error: expected ',' or '...' before '<' token
7 | int makePrimenumbers(int a, int ref_max, vector<int> primes){
| ... |
s706834448 | p00009 | C++ | #include <iostream>
using namespace std;
int main(){
int n;
int a=0;
cin >> n)
for(int i = 0; i < n; ++i){
for(int j = 2; j <= i; ++j){
if(i%j == 0){
if(i==j){
++a;
}else{
break;
}
}
}
}
cout << a << '\n';
} | a.cc: In function 'int main()':
a.cc:7:17: error: expected ';' before ')' token
7 | cin >> n)
| ^
| ;
a.cc:8:32: error: 'i' was not declared in this scope
8 | for(int i = 0; i < n; ++i){
| ^
|
s166134423 | p00009 | C++ | #include<iostream>
bool sieve[1000000];
void makesieve();
int main()
{
makesieve();
while(1)
{
int n,ans=0;
std::cin>>n;
if(std::cin.eof())break;
for(int i=0;i<n;i++)
{
ans+=sieve[i]?1:0;
}
std::cout<<ans<<std::endl;
}
return 0;
}
void makesieve()
{
memset(sieve,-1,sizeof(sieve));
sieve[0]=f... | a.cc: In function 'void makesieve()':
a.cc:26:9: error: 'memset' was not declared in this scope
26 | memset(sieve,-1,sizeof(sieve));
| ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include<iostream>
+++ |+#in... |
s679248051 | p00009 | C++ | import java.util.Scanner;
public class Main
{
public static void main(String arg[])
{
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int count=0;
for (int i=2; i<=n; i++)
{
if(prim(i))
count++;
}
System.out.println(count);
}
public static boolean prim(int a)
{
if(a<2)
... | a.cc:1:1: error: 'import' does not name a type
1 | import java.util.Scanner;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
3 | public class Main
| ^~~~~~
|
s188185121 | p00009 | C++ | #include<stdio.h>
#define max 1000001;
int main(void)
{
int *d, f1, f2, n, cnt;
d = new int [max];
for(f1 = 0; f1 < max; f1++)
{
d[f1] = 1;
}
for(f1 = 2; f1 *f1 < max; f1++)
{
if(d[f1] == 1)
{
for(f2 = 2 * f1; f2 < max; f2 += f1)
{
d[f2] = 0;
}
}
}
while (scanf("%d",&n) != EOF)
{
cnt= ... | a.cc: In function 'int main()':
a.cc:2:20: error: expected ']' before ';' token
2 | #define max 1000001;
| ^
a.cc:7:22: note: in expansion of macro 'max'
7 | d = new int [max];
| ^~~
a.cc:7:25: error: expected primary-expression before ']' token
7 ... |
s894284318 | p00009 | C++ | #include<iostream>
#include<math.h>
main(){int i,j,n,p[1000000];std::cin>>n;for(i=2;i<=n;i++)p[i]=1;for(i=2;i<n;i++)if(p[i])for(j=2;i*j<=n;j++)p[i*j]=0;j=0;for(i=2;i<=n;i++)j+=p[i];std::cout<<j<<lend;} | a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
3 | main(){int i,j,n,p[1000000];std::cin>>n;for(i=2;i<=n;i++)p[i]=1;for(i=2;i<n;i++)if(p[i])for(j=2;i*j<=n;j++)p[i*j]=0;j=0;for(i=2;i<=n;i++)j+=p[i];std::cout<<j<<lend;}
| ^~~~
a.cc: In function 'int main()':
a.cc:3:160: err... |
s193555443 | p00009 | C++ | main(){int i,j,n;char p[1000000];while(scanf("%d",&n)!=-1){for(i=2;i<=n;i++)p[i]=1;for(i=2;i<n;i++)for(j=2;i*j<=n;j++)p[i*j]=0;j=0;for(i=2;i<=n;i++)j+=p[i];printf("%d\n",j);}} | a.cc:1:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
1 | main(){int i,j,n;char p[1000000];while(scanf("%d",&n)!=-1){for(i=2;i<=n;i++)p[i]=1;for(i=2;i<n;i++)for(j=2;i*j<=n;j++)p[i*j]=0;j=0;for(i=2;i<=n;i++)j+=p[i];printf("%d\n",j);}}
| ^~~~
a.cc: In function 'int main()':
a.cc:... |
s179712498 | p00009 | C++ | #include<stdio.h>
#include<stdlib.h>
int main(void)
{
_Bool *list;
int n,i,j,cnt;
while(scanf("%d",&n) != EOF)
{
cnt = 0;
list = (int*)calloc(n+1,sizeof(int));
for(i = 2; i <= n; i++)
{
if(list[i] != 1) /*prime number:0 no prime numbers:1*/
{
cnt++;
for(j = i+i; j <= n; j+=i) list[j] = 1;... | a.cc: In function 'int main()':
a.cc:6:2: error: '_Bool' was not declared in this scope
6 | _Bool *list;
| ^~~~~
a.cc:6:9: error: 'list' was not declared in this scope
6 | _Bool *list;
| ^~~~
|
s960346456 | p00009 | C++ | #include <iostream>
#include <cmath>
using namespace std;
#define N 1000000
int main()
{
bool prm[N];
for(int i=0; i<N; i++)
{
prm[i]=true;
}
int upto= (int) sqrt(N);
for(int i=2;i<= upto; i++)
{
if(prm[i])
for(int j=2; j*i<N; j++)
{
prm[i*j]=false;
}
}
int n;
while(cin... | a.cc:34:9: error: expected unqualified-id before 'return'
34 | return 0;
| ^~~~~~
a.cc:35:1: error: expected declaration before '}' token
35 | }
| ^
|
s721126633 | p00009 | C++ | #include <iostream>
#include <cmath>
using namespace std;
#define N 1000000
int main()
{
bool prm[N];
for(int i=0; i<N; i++)
{
prm[i]=true;
}
int upto= (int) sqrt(N);
for(int i=2;i<= upto; i++)
{
if(prm[i])
{
for(int j=2; j*i<N; j++)
{
prm[i*j]=false;
}
}
}
int n;
while... | a.cc:36:9: error: expected unqualified-id before 'return'
36 | return 0;
| ^~~~~~
a.cc:37:1: error: expected declaration before '}' token
37 | }
| ^
|
s603460376 | p00009 | C++ | #include<iostream>
#include<cstring>
#include<cmath>
using namespace std;
int main(void){
int n;
while(cin >> n){
if(n < 3){
if(n < 2){
cout << 0 << endl;
}else{
cout << 1 << endl;
}
}
for(int i = 3; i <= n; i += 2){
bool flag = true;
for(int j = 3; j <= sqrt(i); j += 2)... | a.cc: In function 'int main()':
a.cc:24:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
24 | ans++;
| ^~~
| abs
a.cc:26:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
26 | cout << ans << endl;
| ^~~
| ... |
s034640147 | p00009 | C++ | #include<iostream>
#include<cstring>
#include<cmath>
using namespace std;
int main(void){
int n;
bool p[1000000];
p[0] = p[1] = 0;
p[2] = 1;
int ans = 0;
bool flag;
for(int i = 0; i < 1000000; i++)
p[i] = false;
p[2] = true;
for(int i = 3; i <= 1000000; i += 2){
flag = true;
for(int j = 3... | a.cc: In function 'int main()':
a.cc:34:13: error: 'ansi' was not declared in this scope; did you mean 'ans'?
34 | cout << ansi << endl;
| ^~~~
| ans
|
s112202787 | p00009 | C++ | #include <iostream>
#include <string>
using namespace std;
int main(){
int n;
cin >> n;
int a[n+1];
int b;
int c;
b=1;
while(b<n+1){
a[b]=0;
b=b+1;}
a[1]=1;
b=2;
while(b<n+1){
if(a[b]=0){ c=2; while(1){if(c*b>n){break;} a[c*b]=1; c=c+1;}
b=b+1;}
int d;
d=0;
b=1;
while(b<n+1){
if(a[b]=0){d=d+1;}
b=b+1;}
cout << d;
} | a.cc: In function 'int main()':
a.cc:30:2: error: expected '}' at end of input
30 | }
| ^
a.cc:5:11: note: to match this '{'
5 | int main(){
| ^
|
s751946095 | p00009 | C++ | int main(){
int n;
while(cin >> n){
int a[n+1];
int b;
int c;
b=1;
while(b<n+1){
a[b]=0;
b=b+1;}
a[1]=1;
int d;
d=0;
b=2;
while(b<n+1){
if(a[b]==0){d=d+1; c=2; while(1){if(c*b>n){break;} a[c*b]=1; c=c+1;}}
b=b+1;}
cout << d;} | a.cc: In function 'int main()':
a.cc:3:7: error: 'cin' was not declared in this scope
3 | while(cin >> n){
| ^~~
a.cc:18:1: error: 'cout' was not declared in this scope
18 | cout << d;}
| ^~~~
a.cc:18:12: error: expected '}' at end of input
18 | cout << d;}
| ^
a.cc:1:11: no... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.