submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3
values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s944361279 | p00009 | C++ | #include <iostream>
#include <xutility>
using namespace std;
#define MAX_N 99999
#define MAX_D 30
bool prime_check(int n, int k = 2)
{
if (n < k * k) { return true; }
if (n % k == 0) { return false; }
return prime_check(n, k + 1);
}
int main()
{
int n;
bool isprime[MAX_N + 1];
for (int i = 2; i < MAX_N + ... | a.cc:2:10: fatal error: xutility: No such file or directory
2 | #include <xutility>
| ^~~~~~~~~~
compilation terminated.
|
s896045442 | p00009 | C++ |
#include<iostream>
using namespace std;
int sushu[1000010];
int n;
bool isPrime(int a){
if (sushu[a] != -1){
return sushu[a] == 0 ? false : true;
}
int i;
for (i = 2; i < a; ++i){
if (a%i == 0){
sushu[a] = 0;
return false;
}
}
sushu[a] = 1;
return true;
}
int main()
{
memset(sushu, -1, sizeof(sushu... | a.cc: In function 'int main()':
a.cc:22:9: error: 'memset' was not declared in this scope
22 | memset(sushu, -1, sizeof(sushu));
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include<iostream>
+++ |+#includ... |
s712850996 | p00009 | C++ | #include <Stdio.h>
int main()
{
int n,i,j,flag=0,cnt,h,k;
while(scanf("%d",&n) !=EOF)
{
if(n==2)
printf("1");
else if(n==3)
printf("2");
else
{
cnt=2;
h=n/2;
for(k=4; k<=n; k++)
{
for(j=2... | a.cc:1:10: fatal error: Stdio.h: No such file or directory
1 | #include <Stdio.h>
| ^~~~~~~~~
compilation terminated.
|
s421101115 | p00009 | C++ | LIMIT = 10000000
isPrime = [True for _ in range(LIMIT)]
isPrime[0] = isPrime[1] = False
for i in range(2, int(LIMIT ** 0.5)+1):
if isPrime[i]:
for j in range(i * i, LIMIT, i):
isPrime[j] = False
try:
while True:
n = int(input())
count = 0
for i in range(n+1):
i... | a.cc:1:1: error: 'LIMIT' does not name a type
1 | LIMIT = 10000000
| ^~~~~
|
s730963649 | p00009 | C++ | #include <stdio.h>
#include <math.h>
#include <stdlib.h>
#define N 999999L
bool num[N];
void furui(){
long int i;
int divide;
int rt = (int) sqrt(N);
for(i = 0L; i < N; i++){
num[i] = true;
}
num[0] = false;
num[1] = false;
for(divide = 2; divide <= rt; divide++){
if(num[divide] == false) conti... | a.cc: In function 'int main()':
a.cc:48:10: error: 'cout' is not a member of 'std'
48 | std::cout << count << '\n';
| ^~~~
a.cc:4:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
3 | #include <stdlib.h>
+++ |+#include <iostream>... |
s329723381 | p00009 | C++ | #include <stdio.h>
#include <math.h>
#include <stdlib.h>
#define N 999999L
bool num[N];
void furui(){
long int i;
int divide;
int rt = (int) sqrt(N);
for(i = 0L; i < N; i++){
num[i] = true;
}
num[0] = false;
num[1] = false;
for(divide = 2; divide <= rt; divide++){
if(num[divide] == false) conti... | a.cc: In function 'int main()':
a.cc:48:10: error: 'cout' is not a member of 'std'
48 | std::cout << count << "\n";
| ^~~~
a.cc:4:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
3 | #include <stdlib.h>
+++ |+#include <iostream>... |
s534014714 | p00009 | C++ | // aoj.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//
#include "stdafx.h"
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <iostream>
#define N 1000000L
bool num[N];
void furui() {
long int i;
int divide;
int rt = 1000;
for (i = 0L; i < N; i++) {
num[i] = true;
}
num[0] = false;
num[1] = false;... | a.cc:4:10: fatal error: stdafx.h: No such file or directory
4 | #include "stdafx.h"
| ^~~~~~~~~~
compilation terminated.
|
s954379962 | p00009 | C++ | #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
// cin >>
// cin <<
bool isPrime(int x){
if(x==2) return true;
if(x<2||x%2==0) return false;
int i=3;
while(i<=sqrt(x)){
if (x%i==0)return false;
i= i+2;
}
return true;
}
int main(){
int in[30]={};
int out=0;
for(int i=0;i<... | a.cc: In function 'bool isPrime(int)':
a.cc:14:18: error: 'sqrt' was not declared in this scope
14 | while(i<=sqrt(x)){
| ^~~~
|
s240432524 | p00009 | C++ | #include <iostream>
#include <cmath>
#define MAX_NUM (1000000)
static int getPrimeNum(int maxVal);
int main(void)
{
int n;
while (std::cin >> n) {
std::cout << getPrimeNum(n) << std::endl;
}
return 0;
}
static int getPrimeNum(int maxVal)
{
static int searchList[MAX_NUM] = {0};
static int prime... | a.cc: In function 'int getPrimeNum(int)':
a.cc:24:3: error: 'memset' was not declared in this scope
24 | memset(searchList, 0, sizeof(int) * MAX_NUM);
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <cmath>
+++ |... |
s270679573 | p00009 | C++ |
import java.util.Scanner;
public class Main{
public static void main(String[] args){
while(true){
Scanner sc=new Scanner(System.in);
int INF=1000;
int cnt=0;
int n=sc.nextInt();
int[] prime=new int[n+1];
for(int i=0;i<=n;i++){
prime[i]=INF;
}
for(int i=2;i<=n;i++){
if(prime[i]==INF&&... | a.cc:2:1: error: 'import' does not name a type
2 | import java.util.Scanner;
| ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
3 | public class Main{
| ^~~~~~
|
s686375443 | p00009 | C++ |
import java.util.Scanner;
public class Main{
public static void main(String[] args){
while(true){
Scanner sc=new Scanner(System.in);
int INF=1000;
int cnt=0;
int n=sc.nextInt();
int[] prime=new int[n+1];
for(int i=0;i<=n;i++){
prime[i]=INF;
}
for(int i=2;i<=n;i++){
if(prime[i]==INF&&... | a.cc:2:1: error: 'import' does not name a type
2 | import java.util.Scanner;
| ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
3 | public class Main{
| ^~~~~~
|
s443782629 | p00009 | C++ | #include <iostream>
#include <cstdio>
#include <vector>
using namespace std;
const int MAX_N = int(1e6);
??
int main(){
??
????int n, i, j, maxin = 2;
????bool jud;
????vector <int> vec;
????for(i = 2;i <= MAX_N; i++){
????????????????jud = 0;
????????????????for(j = 0;?? j < vec.size() ; j++){
????????????????????if(v... | a.cc:6:1: error: expected unqualified-id before '?' token
6 | ??
| ^
|
s895078253 | p00009 | C++ | #include <iostream>
#include <cstdio>
#include <vector>
using namespace std;
const int MAX_N = int(1e6);
int main(){
int n, i, j, maxin = 2;
bool jud;
vector <int> vec;
for (i = 2; i <= MAX_N; i++){
jud = 0;
for (j = 0; j < vec.size(); j++){
if (vec[j] * vec[j] > i) break;
... | a.cc: In function 'int main()':
a.cc:25:17: error: 'upper_bound' was not declared in this scope
25 | cout << upper_bound(vec.begin(), vec.end(), n) - vec.begin() << endl;
| ^~~~~~~~~~~
|
s796208226 | p00009 | C++ | #include <stdio.h>
#define MN
int main(void)
{
int n;
int i, j;
long LN = 1000001;
int pn[1000001];
for (i = 0; i < LN; i++){
pn[i] = 1;
}
pn[0] = pn[1] = 0;
for (i = 2; i * i < LN; i++){
if (pn[i] == 1){
for (j = i * i; j < LN; j += i){
... | a.cc: In function 'int main()':
a.cc:30:12: error: 'cin' was not declared in this scope
30 | while (cin >> n){
| ^~~
a.cc:31:9: error: 'cout' was not declared in this scope
31 | cout << pn[n] << endl;
| ^~~~
a.cc:31:26: error: 'endl' was not declared in this scope
31 ... |
s896621795 | p00009 | C++ | #include <iostream>
using namespace std;
int main()
{
int n;
int count;
while (1)
{
cin >> n;
if (cin.fail()) break;
bool *isPrime;
isPrime = new bool[n + 1];
memset(isPrime, true, sizeof(bool) * (n + 1));
isPrime[0] = isPrime[1] = false;
count = 0;
for (int i = 2; i <= n; ++i)
{
for (int... | a.cc: In function 'int main()':
a.cc:16:17: error: 'memset' was not declared in this scope
16 | memset(isPrime, true, sizeof(bool) * (n + 1));
| ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #inc... |
s002734917 | p00009 | C++ | #include<iostream>
#include<string>
using namespace std;
int main(){
int n,a[9];
a[0]=9592;
a[1]=17984;
a[2]=25997;
a[3]=33860;
a[4]=41538;
a[5]=49098;
a[6]=56543;
a[7]=63951;
a[8]=71274;
while(cin>>n){
int count=0;
int i=0;
while(true){
if((i+1)*100000<=n)
count=a[i];
else
break;
i++;... | a.cc: In function 'int main()':
a.cc:29:49: error: 'sqrt' was not declared in this scope
29 | for(int k=2;k<1+(double)sqrt((double)j);k++){
| ^~~~
a.cc:40:53: error: 'sqrt' was not declared in this scope
40 | ... |
s945010150 | p00009 | C++ | #include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
int n, count,k;
while(cin >> n){
count = 1;
k = 0;
for(int i = 3; i <= n; i += 2){
for(int j = 3; j <= sqrt((double)i); j += 2)
{
if(i%j == 0){
k = 1;
break;
}
}
if(k == 0){
count++;
}
}
... | a.cc:5:22: error: '_TCHAR' has not been declared
5 | int _tmain(int argc, _TCHAR* argv[])
| ^~~~~~
a.cc: In function 'int _tmain(int, int**)':
a.cc:14:45: error: 'sqrt' was not declared in this scope
14 | for(int j = 3; j <= sqrt((double)i); j += 2)
| ... |
s121705112 | p00009 | C++ | // PrimeNumber.cpp : ??????????????? ??¢????????±????????§????????¨????????? ?????????????????????????????????
//
#include "stdafx.h"
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
int n, count,k;
while(cin >> n){
count = 1;
k = 0;
for(int i = 3; i <= n; i += 2){
for(int j =... | a.cc:4:10: fatal error: stdafx.h: No such file or directory
4 | #include "stdafx.h"
| ^~~~~~~~~~
compilation terminated.
|
s143109431 | p00009 | C++ |
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
int n, count,k;
while(cin >> n){
count = 1;
k = 0;
for(int i = 3; i <= n; i += 2){
for(int j = 3; j <= sqrt((double)i); j += 2)
{
if(i%j == 0){
k = 1;
break;
}
}
if(k == 0){
count++;
}
}
cou... | a.cc: In function 'int main(int, char**)':
a.cc:15:45: error: 'sqrt' was not declared in this scope
15 | for(int j = 3; j <= sqrt((double)i); j += 2)
| ^~~~
|
s914699002 | p00009 | C++ |
#include <iostream>
using namespace std;
int main()
{
int n, count,k;
while(cin >> n){
count = 1;
k = 0;
for(int i = 3; i <= n; i += 2){
for(int j = 3; j <= std::sqrt((double)i); j += 2)
{
if(i%j == 0){
k = 1;
break;
}
}
if(k == 0){
count++;
}
}
cout << count << end... | a.cc: In function 'int main()':
a.cc:15:50: error: 'sqrt' is not a member of 'std'
15 | for(int j = 3; j <= std::sqrt((double)i); j += 2)
| ^~~~
|
s771732780 | p00009 | C++ | #include <iostream>
#include <string>
#include <stack>
#include <math.h>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <vector>
using namespace std;
int sieve(int n);
int prime[1000000];
bool is_prime[1000000];
int main()
{
int p = 0;
for (int i = 0; i <= 999999; i++) {
is_prime[i] = true;
}... | a.cc: In function 'int main()':
a.cc:32:16: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
32 | while (scanf_s("%d", &n) != EOF) {
| ^~~~~~~
| scanf
|
s713396388 | p00009 | C++ | #include <iostream>
#include <string>
#include <stack>
#include <math.h>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <vector>
using namespace std;
int sieve(int n);
int prime[1000000];
bool is_prime[1000000];
int main()
{
int p = 0;
for (int i = 0; i <= 999999; i++) {
is_prime[i] = true;
}... | a.cc: In function 'int main()':
a.cc:32:16: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
32 | while (scanf_s("%d", &n) != EOF) {
| ^~~~~~~
| scanf
|
s934623581 | p00009 | C++ | #include <iostream>
#include <string>
#include <stack>
#include <math.h>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <vector>
using namespace std;
int sieve(int n);
int prime[1000000];
bool is_prime[1000000];
int main()
{
int p = 0;
for (int i = 0; i <= 999999; i++) {
is_prime[i] = true;
}... | a.cc: In function 'int main()':
a.cc:32:16: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
32 | while (scanf_s("%d", &n) != EOF) {
| ^~~~~~~
| scanf
|
s764844188 | p00009 | C++ | #include <iostream>
using namespace std;
int main(){
int number,cnt=0;
cin>>number;
int* arr = new int[number+1];
for (int i = 1; i <= number; i+=2)
{
arr[i-1]=0;
arr[i]=1;
}
for (int i = 3; i < sqrt(number); i+=2)
if (arr[i])
for (int j = i+i; j <=number; j+=i)
arr[j]=0;
arr[2]=1;arr[1]=0;
for ... | a.cc: In function 'int main()':
a.cc:14:29: error: 'sqrt' was not declared in this scope
14 | for (int i = 3; i < sqrt(number); i+=2)
| ^~~~
|
s893953713 | p00009 | C++ |
int main()
{
bool num[1000000]={false};
for(int i=2;i<1000;i++){
if(!num[i]){
for(int j=i*i;j<1000000;j+=i){
num[j]=true;
}
}
}
int n;
while(cin>>n){
int ans=0;
for(int i=2;i<=n;i++){
if(!num[i])
ans... | a.cc: In function 'int main()':
a.cc:13:11: error: 'cin' was not declared in this scope
13 | while(cin>>n){
| ^~~
a.cc:19:9: error: 'cout' was not declared in this scope
19 | cout<<ans<<endl;
| ^~~~
a.cc:19:20: error: 'endl' was not declared in this scope
19 | ... |
s548151893 | p00009 | C++ | #include<iostream>
#include<stdio.h>
using namespace std;
typedef long long ll;
const ll MAX=1e6;
ll prime[MAX+2],mark[MAX+2],ans[MAX+2];
void Prime(){
memset(mark,0,sizeof(mark));
ll index=0;
for(ll i=2;i<=MAX;i++){
if(mark[i]) continue;
else{
prime[++index]=i;
for(l... | a.cc: In function 'void Prime()':
a.cc:8:5: error: 'memset' was not declared in this scope
8 | memset(mark,0,sizeof(mark));
| ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include<iostream>
+++ |+#include <cstring>
... |
s147879697 | p00009 | C++ | #include <iostream>
#include <vector>
#include <numeric>
using namespace std;
int main() {
int n;
vector<int> v;
while (cin >> n) {
if (v.size() > n) {
cout << accmulate(v.begin(), v.end() - (v.size() - n), 0) << endl;
}
v.resize(n + 1);
fill(v.begin(), v.end(), 1);
v[0] = 0;
v[1] = ... | a.cc: In function 'int main()':
a.cc:10:15: error: 'accmulate' was not declared in this scope
10 | cout << accmulate(v.begin(), v.end() - (v.size() - n), 0) << endl;
| ^~~~~~~~~
|
s213878241 | p00009 | C++ | /*
Volume0-0009
*/
//#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#define N 1000000
#define TRUE (int)(0==0)
#define FALSE !TRUE
#define BUFLEN 1024
//using std;
int syserr(char *str)
{
fputs(str, stderr);
exit(-1);
}
int main(int argc, char *argv[]){
int f[N];
memset(f, TRUE, N);
f[1]=FALSE;... | a.cc: In function 'int main(int, char**)':
a.cc:22:3: error: 'memset' was not declared in this scope
22 | memset(f, TRUE, N);
| ^~~~~~
a.cc:7:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
6 | #include <stdlib.h>
+++ |+#include <cstring>
... |
s333963668 | p00009 | C++ | /*
Volume0-0009
*/
#include <iostream>
#include <stdlib.h>
#include <string.h>
#define N 1000000
#define TRUE (int)(0==0)
#define FALSE !TRUE
#define BUFLEN 1024
using namespace std;
int main(int argc, char *argv[]){
int f[N];
// memset(f, TRUE, N);
f[0]=FALSE;
f[1]=FALSE;
for (int i=2; i<N; i++)
f[i... | a.cc: In function 'int main(int, char**)':
a.cc:32:17: error: expected primary-expression before 'int'
32 | while (cin >> int n) != NULL){
| ^~~
a.cc:32:16: error: expected ')' before 'int'
32 | while (cin >> int n) != NULL){
| ~ ^~~~
| )
a.cc:32:2... |
s529819225 | p00009 | C++ | /*
Volume0-0009
*/
#include <iostream>
#include <stdlib.h>
#include <string.h>
#define N 1000000
#define TRUE (int)(0==0)
#define FALSE !TRUE
using namespace std;
int main(int argc, char *argv[]){
int f[N];
// memset(f, TRUE, N);
f[0]=FALSE;
f[1]=FALSE;
for (int i=2; i<N; i++)
f[i] = TRUE;
for (in... | a.cc: In function 'int main(int, char**)':
a.cc:31:20: error: expected primary-expression before '!=' token
31 | while (cin >> n) != NULL){
| ^~
|
s289749224 | p00009 | C++ | #include<stdio.h>
#include<Math.h>
int main(){
int n;
int a[10000];
int b;
int i, j, p;
int c[30];
p = 0;
while (scanf("%d", &n) != EOF){
b = (int)pow((double)n, 0.5);
c[p] = 0;
a[0] = -1;
for (i = 2; i <= b; i++){
for (j = 2; j <= n / i; j++){
a[i*j - 1] = -1;
}
}
for (i = 1; i <= n; i++)... | a.cc:2:9: fatal error: Math.h: No such file or directory
2 | #include<Math.h>
| ^~~~~~~~
compilation terminated.
|
s353696970 | p00009 | C++ | #include<stdio.h>
#include<Math.h>
int main(){
int n;
int a[1000];
int b;
int i, j, p;
int c[30];
p = 0;
while (scanf("%d", &n) != EOF){
b = (int)pow((double)n, 0.5);
c[p] = 0;
a[0] = -1;
for (i = 2; i <= b; i++){
for (j = 2; j <= n / i; j++){
a[i*j - 1] = -1;
}
}
for (i = 1; i <= n; i++){... | a.cc:2:9: fatal error: Math.h: No such file or directory
2 | #include<Math.h>
| ^~~~~~~~
compilation terminated.
|
s782372524 | p00009 | C++ | #include<stdio.h>
#include<Math.h>
int main(){
int n;
int a[100000];
int b;
int i, j, p;
int c[30];
p = 0;
while (scanf("%d", &n) != EOF){
b = (int)pow((double)n, 0.5);
c[p] = 0;
a[0] = -1;
for (i = 2; i <= b; i++){
for (j = 2; j <= n / i; j++){
a[i*j - 1] = -1;
}
}
for (i = 1; i <= n; i++... | a.cc:2:9: fatal error: Math.h: No such file or directory
2 | #include<Math.h>
| ^~~~~~~~
compilation terminated.
|
s368548716 | p00009 | C++ | import numpy
def get_input():
while True:
try:
yield ''.join(input())
except EOFError:
break
def primesfrom3to(n):
sieve = numpy.ones(int(n/2), dtype=numpy.bool)
if n%2 != 0:
sieve = numpy.append(sieve,n/2)
for i in range(3,int(n**0.5)+1,2):
if sie... | a.cc:5:19: error: empty character constant
5 | yield ''.join(input())
| ^~
a.cc:21:10: error: invalid preprocessing directive #print
21 | #print(primeList)
| ^~~~~
a.cc:1:1: error: 'import' does not name a type
1 | import numpy
| ^~~~~~
a.cc:1:... |
s992152910 | p00009 | C++ | #include<iostream>
using namespace std;
int main(){
int a,i;
cin>>a;
for(int x=0;x<a;x++){
if(a%x){i++}
cout<<i<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:7:12: error: expected ';' before '}' token
7 | if(a%x){i++}
| ^
| ;
|
s672206289 | p00009 | C++ | #include<iostream>
using namespace std;
int main(){
int a,i;
cin>>a;
for(int x=2x<a;x++){
if(a%x==0){i++}
cout<<i<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:6:11: error: unable to find numeric literal operator 'operator""x'
6 | for(int x=2x<a;x++){
| ^~
a.cc:6:19: error: expected ';' before ')' token
6 | for(int x=2x<a;x++){
| ^
| ;
a.cc:7:15: error: expected ';' be... |
s146440262 | p00009 | C++ | #include<iostream>
using namespace std;
int main(){
int a,i;
for(;;){
cin>>a;
for(int x=2x<a;x++){
if(a%x==0){i++}
cout<<i<<endl;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:7:11: error: unable to find numeric literal operator 'operator""x'
7 | for(int x=2x<a;x++){
| ^~
a.cc:7:19: error: expected ';' before ')' token
7 | for(int x=2x<a;x++){
| ^
| ;
a.cc:8:15: error: expected ';' be... |
s033893861 | p00009 | C++ | #include<iostream>
using namespace std;
int main(){
int a,i;
for(;;){
cin>>a;
for(int x=2x<a;x++){
if(a%x>0){i++}
cout<<i<<endl;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:7:11: error: unable to find numeric literal operator 'operator""x'
7 | for(int x=2x<a;x++){
| ^~
a.cc:7:19: error: expected ';' before ')' token
7 | for(int x=2x<a;x++){
| ^
| ;
a.cc:8:14: error: expected ';' be... |
s583172040 | p00009 | C++ | #include<Upstream>
#include<cstdio>
#include<cstring>
using namespace std;
Int pn[1000002];
int main(){
int n, Count;
con.tie(0);
while(scanf("%d",&n)!=EOF){
Count=0;
memset(pn,0,n);
pn[0]=pn[1]=1;
for(int i=0;i<=n;i++) if(!pn[i]) for(int j=0;i*j<=n;j++) pn[i*j]=1;
Count=count(pn,pn+n,0);
count<<Count<<endl;
}
return... | a.cc:1:9: fatal error: Upstream: No such file or directory
1 | #include<Upstream>
| ^~~~~~~~~~
compilation terminated.
|
s370620778 | p00009 | C++ | #include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
Int pn[1000002];
int main(){
int n, Count;
con.tie(0);
while(scanf("%d",&n)!=EOF){
Count=0;
memset(pn,0,n);
pn[0]=pn[1]=1;
for(int i=0;i<=n;i++) if(!pn[i]) for(int j=0;i*j<=n;j++) pn[i*j]=1;
Count=count(pn,pn+n,0);
count<<Count<<endl;
}
return... | a.cc:6:1: error: 'Int' does not name a type; did you mean 'int'?
6 | Int pn[1000002];
| ^~~
| int
a.cc: In function 'int main()':
a.cc:10:1: error: 'con' was not declared in this scope
10 | con.tie(0);
| ^~~
a.cc:13:8: error: 'pn' was not declared in this scope; did you mean 'n'?
13 | memset... |
s153774177 | p00009 | C++ | #include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
Int pn[1000002];
int main(){
int n, Count;
cin.tie(0);
while(scanf("%d",&n)!=EOF){
Count=0;
memset(pn,0,n);
pn[0]=pn[1]=1;
for(int i=2;i<=n;i++) if(!pn[i]) for(int j=1;i*j<=n;j++) pn[i*j]=1;
Count=count(pn,pn+n,0);
cout<<Count<<endl;
}
return ... | a.cc:6:1: error: 'Int' does not name a type; did you mean 'int'?
6 | Int pn[1000002];
| ^~~
| int
a.cc: In function 'int main()':
a.cc:13:8: error: 'pn' was not declared in this scope; did you mean 'n'?
13 | memset(pn,0,n);
| ^~
| n
a.cc:16:7: error: 'count' was not declared... |
s724053584 | p00009 | C++ | #include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int pn[1000002];
int main(){
int n, Count;
cin.tie(0);
while(scanf("%d",&n)!=EOF){
Count=0;
memset(pn,0,n);
pn[0]=pn[1]=1;
for(int i=2;i<=n;i++) if(!pn[i]) for(int j=1;i*j<=n;j++) pn[i*j]=1;
Count=count(pn,pn+n,0);
cout<<Count<<endl;
}
return ... | a.cc: In function 'int main()':
a.cc:16:7: error: 'count' was not declared in this scope; did you mean 'Count'?
16 | Count=count(pn,pn+n,0);
| ^~~~~
| Count
|
s193053201 | p00009 | C++ | import java.util.Scanner;
class Main {
public static void main(String[] a) {
String input;
int datasetCount = 0;
Scanner stdin = new Scanner(System.in);
while (++datasetCount <= 30) {
int primes = 0;
input = stdin.nextLine();
try {
int n = Integer.parseUnsignedInt(input);
if (n... | 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:5:15: error: expected ':' before 'static'
5 | public static void main(String[] a) {
| ^~~~~~~
| :
a.c... |
s459344956 | p00009 | C++ | #include <iostream>
#include <vector>
#define pb(a) push_back(a)
#define rep(i,a,n) for(int i=a; i<n; i++)
using namespace std;
int main() {
int n = 1000000;
vector<int> v;
v.pb(2);
for(int i=3;i<=n;i+=2) {
bool add = true;
rep(j,0,v.size()) {
if(v[j] * v[j] > i) break;
... | a.cc: In function 'int main()':
a.cc:25:17: error: 'upper_bound' was not declared in this scope
25 | cout << upper_bound(v.begin(), v.end(), m) - v.begin() << endl;
| ^~~~~~~~~~~
|
s544604128 | p00009 | C++ | import java.util.Scanner;
import java.io.*;
class Main{
public static void main(String[] args){
Scanner sc =new Scanner(System.in);
int ans,n;
while(sc.hasNext()){
n=sc.nextInt();
ans=0;
if(n==1)ans=-1;
for(int i=1;i<=n;i+=2){
int flag=0;
for(int j=3;j<=Math.sqrt(i);j+=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: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... |
s769854611 | p00009 | C++ | #include<iostream>
using namespace std;
int main(){
int a[999999]={0,0,1,2},n,k=0;count=2;
for(int i=4;i<999999;i++){
for(int j=2;j*j<=i;j++){
if(i%j==0)k++;
}
if(k==1)count++;
a[i]=count;
k=0;
}
while(cin>>n)cout<<a[n]<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:4:39: error: 'count' was not declared in this scope
4 | int a[999999]={0,0,1,2},n,k=0;count=2;
| ^~~~~
|
s270000297 | p00009 | C++ | #include&<iostream>
#include&<vector>
using namespace std;
int main(){
int n,k,sum,check;
int t=1;
vector<int> prime;
prime.push_back(0);
prime.push_back(0);
for(int i=2;i<1000000;i++){
prime.push_back(1);
}
while(t<1000000){
for(int j=t+1;j<=1000000;j++){
if(... | a.cc:1:9: error: #include expects "FILENAME" or <FILENAME>
1 | #include&<iostream>
| ^
a.cc:2:9: error: #include expects "FILENAME" or <FILENAME>
2 | #include&<vector>
| ^
a.cc: In function 'int main()':
a.cc:7:5: error: 'vector' was not declared in this scope
7 | vector<int>... |
s726889194 | p00009 | C++ | #include<iostream>
using namespace std;
int main(){
int n, cnt;
int N = 1000000;
bool num[N] = true;
num[0] = false;
num[1] = false;
for(int i = 2; i*i <= N; i++){
if(num[i]){
for(int j = i; i*j < N; j++){
num[i*j] = false;
}
}
}
while(cin >> n){
for(int i = 1; i < n; i++) if(num[i]) cnt++... | a.cc: In function 'int main()':
a.cc:6:23: error: array must be initialized with a brace-enclosed initializer
6 | bool num[N] = true;
| ^~~~
|
s072715176 | p00009 | C++ | #include<iostream>
using namespace std;
int main(){
int n, cnt;
int N = 1000000;
bool prime[N] = false;
prime[1] = true; //1???????????\
while(cin >> n){
// ??¨??????????????????????????????
for(int j = 2; j*j <= n; j++){
if(prime[j] == false){
for(int k = j; k*j <= n; k++){
prime[j*k] =true;
... | a.cc: In function 'int main()':
a.cc:6:25: error: array must be initialized with a brace-enclosed initializer
6 | bool prime[N] = false;
| ^~~~~
|
s879799251 | p00009 | C++ | #include<iostream>
using namespace std;
int main(){
int n, cnt;
bool prime[1000000] = false;
prime[1] = true; //1???????????\
while(cin >> n){
// ??¨??????????????????????????????
for(int j = 2; j*j <= n; j++){
if(prime[j] == false){
for(int k = j; k*j <= n; k++){
prime[j*k] =true;
}
}
}
... | a.cc: In function 'int main()':
a.cc:5:31: error: array must be initialized with a brace-enclosed initializer
5 | bool prime[1000000] = false;
| ^~~~~
|
s229853380 | p00009 | C++ | #include <iostream>
#include <cmath>
using namespace std;
int main()
{
int n;
int count=0;
while(cin >> n){
double nd=(double)n;
int root=(int)sqrt(nd);
for(int i=2;i<=n;i++){
for(int j=2;j<=root;j++){
if(i%j==0) break;
}
if(j==root) count++;
}
cout << count << ... | a.cc: In function 'int main()':
a.cc:17:10: error: 'j' was not declared in this scope
17 | if(j==root) count++;
| ^
|
s652989060 | p00009 | C++ | $inputArray = array();
while (!feof(STDIN)) {
$input = trim(fgets(STDIN));
if (empty($input)) {
break;
}
array_push($inputArray, $input);
}
foreach ($inputArray as $input) {
$count = 0;
for ($i = 2; $i <= $input; $i++) {
if (isSosu($i)) {
$count++;
}
}
echo $count . "\n";
}
function ... | a.cc:1:1: error: '$inputArray' does not name a type
1 | $inputArray = array();
| ^~~~~~~~~~~
a.cc:2:1: error: expected unqualified-id before 'while'
2 | while (!feof(STDIN)) {
| ^~~~~
a.cc:10:9: error: expected constructor, destructor, or type conversion before '(' token
10 | foreach ($inputArray... |
s623459228 | p00009 | C++ | int main() {
bool isPrime[1000000] = {true};
for (int i = 0; i < 1000000; i++) {
isPrime[i] = true;
}
isPrime[1] = false;
for (int i = 2; i < 1000000; i++) {
if (!isPrime[i])
continue;
if (isPrime[i]) {
int k = 2*i;
while (k < 1000000) {
isPrime[k] = false;
k += i;
}
}
}
int n;
w... | a.cc: In function 'int main()':
a.cc:23:16: error: 'cin' was not declared in this scope
23 | while (cin >> n) {
| ^~~
a.cc:29:17: error: 'cout' was not declared in this scope
29 | cout << sum << endl;
| ^~~~
a.cc:29:32: error: 'endl' was not decla... |
s123319973 | p00009 | C++ | ???#include <iostream>
using namespace std;
int main()
{
unsigned int n;
cin >> n;
unsigned int num, count = 0;
for(int i = 0; i < n; i++)
{
cin >> num;
for(int j = 2; j < num; j++)
{
if(num % j == 0)
{
break;
}
if(num - 1 == j)
{
count++;
}
}
if(num == 2)
{
count++;
... | a.cc:1:4: error: stray '#' in program
1 | ???#include <iostream>
| ^
a.cc:1:1: error: expected unqualified-id before '?' token
1 | ???#include <iostream>
| ^
a.cc: In function 'int main()':
a.cc:8:9: error: 'cin' was not declared in this scope
8 | cin >> n;
| ^~~
a.cc:29... |
s034789723 | p00009 | C++ | ???#include <iostream>
using namespace std;
int main()
{
unsigned int n;
cin >> n;
unsigned int num, count = 0;
for(int i = 0; i < n; i++)
{
cin >> num;
for(int j = 2; j <=num; j++)
{
if(num == j)count++;
if(num % j == 0)
{
break;
}
}
}
cout << count << endl;
return 0;
} | a.cc:1:4: error: stray '#' in program
1 | ???#include <iostream>
| ^
a.cc:1:1: error: expected unqualified-id before '?' token
1 | ???#include <iostream>
| ^
a.cc: In function 'int main()':
a.cc:8:9: error: 'cin' was not declared in this scope
8 | cin >> n;
| ^~~
a.cc:22... |
s212001579 | p00009 | C++ | ???#include <iostream>
using namespace std;
int main()
{
unsigned int n;
cin >> n;
unsigned int num, count = 0;
for(int i = 0; i < n; i++)
{
cin >> num;
for(int j = 2; j <=num; j++)
{
if(num == j)count++;
if(num % j == 0)
{
break;
}
}
}
cout << count << endl;
return 0;
} | a.cc:1:4: error: stray '#' in program
1 | ???#include <iostream>
| ^
a.cc:1:1: error: expected unqualified-id before '?' token
1 | ???#include <iostream>
| ^
a.cc: In function 'int main()':
a.cc:8:9: error: 'cin' was not declared in this scope
8 | cin >> n;
| ^~~
a.cc:22... |
s901345217 | p00009 | C++ | #include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
using namespace std;
int main() {
int n, count = 0;
int a[9999] = { 0 };
// ??¨???????????????????????????
while (cin >> n){
for (int i = 2; i <= n; i++) {
a[i] = 1;
}
for (int i = 2; i < sqrt(n); i++) {
if (a[i]) {
... | a.cc: In function 'int main()':
a.cc:21:37: error: 'sqrt' was not declared in this scope
21 | for (int i = 2; i < sqrt(n); i++) {
| ^~~~
|
s143868438 | p00009 | C++ | include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
int n;
int num[1000000]={0};
num[0]=1;
num[1]=1;
for(int i=2;i<1000000;i++){
if(num[i]==0){
for(int j=2;j*i<1000000;j++){
num[j*i]=1;
}
}
}
while(scanf(" %d",&n)!=EOF){
int cnt=0;
... | a.cc:1:1: error: 'include' does not name a type
1 | include<cstdio>
| ^~~~~~~
In file included from /usr/include/c++/14/iosfwd:42,
from /usr/include/c++/14/ios:40,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
fro... |
s839319122 | p00009 | C++ | include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
int n;
int num[1000000]={0};
num[0]=1;
num[1]=1;
for(int i=2;i<1000000;i++){
if(num[i]==0){
for(int j=2;j*i<1000000;j++){
num[j*i]=1;
}
}
}
while(scanf(" %d",&n)!=EOF){
int cnt=0;
... | a.cc:1:1: error: 'include' does not name a type
1 | include<cstdio>
| ^~~~~~~
In file included from /usr/include/c++/14/iosfwd:42,
from /usr/include/c++/14/ios:40,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
fro... |
s867573013 | p00009 | C++ | #include<iostream>
#include<vector>
using namespace std;
#define MAX_N 100001
int main(){
int n;
while(cin >> n){
vector<int> vec;
vector<int>::iterator it =vec.begin();
for(int i=2;i<=n;i++){
int flag=0;
it =vec.begin();
while(it!= vec.end()){
if(i% *it==0){
flag=1;
break;
}
it++... | a.cc: In function 'int main()':
a.cc:28:10: error: expected '}' at end of input
28 | }
| ^
a.cc:5:11: note: to match this '{'
5 | int main(){
| ^
|
s561551737 | p00009 | C++ | #include<iostream>
#include<vector>
using namespace std;
#define MAX_N 100001
int main(){
int n;
while(cin >> n){
vector<int> vec;
vector<int>::iterator it =vec.begin();
for(int i=2;i<=n;i++){
int flag=0;
it =vec.begin();
while(it!= vec.end()){
if(i% *it==0){
flag=1;
break;
}
it++... | a.cc: In function 'int main()':
a.cc:28:10: error: expected '}' at end of input
28 | }
| ^
a.cc:5:11: note: to match this '{'
5 | int main(){
| ^
|
s205063957 | p00009 | C++ | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <cstudio>
//ranker
using namespace std;
#define REPS(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) f... | a.cc:8:10: fatal error: cstudio: No such file or directory
8 | #include <cstudio>
| ^~~~~~~~~
compilation terminated.
|
s235142955 | p00009 | C++ | #include <iostream>
#include <string>
#include <array>
using namespace std;
int main(void){
const int n = 1000000;
bool* check_A = (bool*)malloc(sizeof(bool)*n);
int* num_A = (int*)malloc(sizeof(int)*n);
int N = 0, temp = 2;
memset(check_A, true, n);
check_A[0] = false;
check_A[1] = false;
num_A[0]... | a.cc: In function 'int main()':
a.cc:12:3: error: 'memset' was not declared in this scope
12 | memset(check_A, true, n);
| ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include <array>
+++ |+#include <cstring>
4 |
|
s113948072 | p00009 | C++ | #include <iostream>
#include <string>
using namespace std;
int main(void){
const int n = 1000000;
bool* check_A = (bool*)malloc(sizeof(bool)*n);
int* num_A = (int*)malloc(sizeof(int)*n);
int N = 0, temp = 2;
memset(check_A, true, n);
check_A[0] = false;
check_A[1] = false;
num_A[0] = 0;
num_A[1] ... | a.cc: In function 'int main()':
a.cc:11:3: error: 'memset' was not declared in this scope
11 | memset(check_A, true, n);
| ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include <iostream>
+++ |+#include <cstring>
2 |... |
s179628481 | p00009 | C++ | #include <iostream>
#include <string>
#include <cstdlib>
using namespace std;
int main(void){
const int n = 1000000;
bool* check_A = (bool*)malloc(sizeof(bool)*n);
int* num_A = (int*)malloc(sizeof(int)*n);
int N = 0, temp = 2;
memset(check_A, true, n);
check_A[0] = false;
check_A[1] = false;
num_A[... | a.cc: In function 'int main()':
a.cc:12:3: error: 'memset' was not declared in this scope
12 | memset(check_A, true, n);
| ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include <cstdlib>
+++ |+#include <cstring>
4 | ... |
s438519163 | p00009 | C++ | #include <iostream>
#include <string>
#include <cstdlib>
using namespace std;
int main(void){
const int n = 1000000;
bool* check_A = (bool*)malloc(sizeof(bool)*n);
int* num_A = (int*)malloc(sizeof(int)*n);
int N = 0, temp = 2;
memset(check_A, true, n);
check_A[0] = false;
check_A[1] = false;
num_A[... | a.cc: In function 'int main()':
a.cc:12:3: error: 'memset' was not declared in this scope
12 | memset(check_A, true, n);
| ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include <cstdlib>
+++ |+#include <cstring>
4 | ... |
s184980070 | p00009 | C++ | def sieve_prime(n): # return prime numbers within [1, n]
primes = []
is_prime = [True] * (n+1) # [0, n]
for i in range(2, n+1):
if not is_prime[i]:
continue # need only primes
primes.append(i)
for j in range(i*2, n+1, i): # range(i*2, n+1, i) = {i*2, i*3, ...}
is_prime[j] = False
"""... | a.cc:1:21: error: stray '#' in program
1 | def sieve_prime(n): # return prime numbers within [1, n]
| ^
a.cc:3:29: error: stray '#' in program
3 | is_prime = [True] * (n+1) # [0, n]
| ^
a.cc:6:16: error: stray '#' in program
6 | continue # ... |
s562564950 | p00009 | C++ | #include <iostream>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <iomanip>
#include <fstream>
#include <cstdint>
#include <cmath>
#include <algorithm>
#include <utility>
#include <numeric>
using namespace std;
#define REP(i,f,n) for(int i=(f); i < (n); ++i)
#define PER(i,f,n) for(int i=(n... | a.cc: In function 'int main()':
a.cc:46:57: error: expected '}' at end of input
46 | cout << i <<'\n'; break;
| ^
a.cc:45:41: note: to match this '{'
45 | if(prime[i] > n){
| ... |
s600854832 | p00009 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
int main()
{
while (cin)
{
string tmpstr;
int tmp;
getline(cin, &tmpstr);
tmp = atoi(tmpstr.c_str());
vector<int> prime;
for (int i(2); i <= tmp; ++i)
{
for (vector<int>::iterator i2(prime.begin()), ... | a.cc: In function 'int main()':
a.cc:13:24: error: no matching function for call to 'getline(std::istream&, std::string*)'
13 | getline(cin, &tmpstr);
| ~~~~~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:55,
from /usr/include/c++/14/bits/loca... |
s617734585 | p00009 | C++ | #include <iostream>
using namespace std;
??
#define Max 1000000
??
int prime [10000000];
??
int main()
{
????????int n, out;
??
????????for (int i = 2; i * i < Max; i++){
????????????????if (prime[i] == 0){
????????????????????????for (int j = i; j < Max; j += i){
????????????????????????????????if (!(j == i)) prime[j]... | a.cc:3:1: error: expected unqualified-id before '?' token
3 | ??
| ^
a.cc:7:1: error: expected unqualified-id before '?' token
7 | ??
| ^
|
s840757368 | p00009 | C++ | #include <iostream>
using namespace std;
??
#define Max 1000000
??
int prime [10000000];
??
int main()
{
????????int n, out;
??
????????for (int i = 2; i * i < Max; i++){
????????????????if (prime[i] == 0){
????????????????????????for (int j = i; j < Max; j += i){
????????????????????????????????if (!(... | a.cc:3:1: error: expected unqualified-id before '?' token
3 | ??
| ^
a.cc:7:9: error: expected unqualified-id before '?' token
7 | ??
| ^
|
s125768623 | p00009 | C++ | #include <iostream>
#include <cmath>
using namespace std;
int whether(int num);
int count(int num);
int main(){
int n;
while(cin >> n){
cout << count(n)+1<<endl;
}
return 0;
}
int whether(int num){//if num is prime, 1
int s=sqrt(num);
for(int i=3; i<=s; i+=2){
if(num%i==0){ retu... | a.cc:22:5: error: expected initializer before 'if'
22 | if(num==99) return 24;
| ^~
a.cc:23:5: error: expected unqualified-id before 'if'
23 | if(num==999) return 167;
| ^~
a.cc:24:5: error: expected unqualified-id before 'if'
24 | if(num==9999) return 1228;
| ^~
a.cc:... |
s459933351 | p00009 | C++ | ##include<cstdio>
#include<math.h>
using namespace std;
int A[1000000];
int Eratosthenes(int n)
{
int mama = 0;
for (int i = 0; i < n; i++)
{
A[i] = 1;
}
for (int i = 2; i < sqrt(n); i++)
{
if (A[i])
{
for (int j = 0; i*(j + 2) < n; j++)
{
A[i*(j + 2)] = 0;
}
}
}
for (int i = 2; i < n; i... | a.cc:1:1: error: stray '##' in program
1 | ##include<cstdio>
| ^~
a.cc:1:3: error: 'include' does not name a type
1 | ##include<cstdio>
| ^~~~~~~
In file included from /usr/include/c++/14/cmath:45,
from /usr/include/c++/14/math.h:36,
from a.cc:2:
/usr/include/c++/... |
s181428783 | p00009 | C++ | import sys
def prime(x):
for i in p_list:
if x % i == 0:
return 0
return 1
if __name__ == "__main__":
a = 10000
i = 2
p_list = []
while i < a:
if prime(i):
p_list.append(i)
i += 1
print(p_list)
for i in sys.stdin:
n = int(i)
... | 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'
|
s612656576 | p00009 | C++ | #include <iostream>
#include <algorithm>
#include <vector>
typedef int TInt;
typedef std::vector<TInt> TList;
bool IsPrime(TInt Value, const TList& Prime)
{
TInt Max = std::sqrt(Value);
for(TList::const_iterator It = Prime.begin();
It != Prime.end() && *It <= Max;
++It)
{
if(Value %... | a.cc: In function 'bool IsPrime(TInt, const TList&)':
a.cc:9:21: error: 'sqrt' is not a member of 'std'; did you mean 'sort'?
9 | TInt Max = std::sqrt(Value);
| ^~~~
| sort
|
s464590314 | p00009 | C++ | <?php
$max=1000000;
$maxR=floor(sqrt($max));
$ch=[0,0,1,1];
for($i=4;$i<$max;$i+=2){$ch[]=0;$ch[]=1;}
for($i=3;$i<$maxR;$i+=2) if($ch[$i]) for($j=$i+$i;$j<$max;$j+=$i) $ch[$j]=0;
for($i=3;$i<$max;$i++) $ch[$i]+=$ch[$i-1];
while(fscanf(STDIN,"%d",$n)) printf("%d\n",$ch[$n]); | a.cc:1:1: error: expected unqualified-id before '<' token
1 | <?php
| ^
a.cc:3:1: error: '$maxR' does not name a type
3 | $maxR=floor(sqrt($max));
| ^~~~~
a.cc:5:1: error: '$ch' does not name a type
5 | $ch=[0,0,1,1];
| ^~~
a.cc:7:1: error: expected unqualified-id before 'for'
7 | for(... |
s077875352 | p00009 | C++ | <?php
$max=1000000;
$maxR=floor(sqrt($max));
$ch=[0,0,1,1];
for($i=4;$i<$max;$i+=2){
$ch[]=0;$ch[]=1;
}
for($i=3;$i<$maxR;$i+=2){
if($ch[$i]){
for($j=$i+$i;$j<$max;$j+=$i){
$ch[$j]=0;
}
}
}
for($i=3;$i<$max;$i++){
$ch[$i]+=$ch[$i-1];
}
while(fscanf(STDIN,"%d",$n)){
printf("%d\n",$ch[$n]);
} | a.cc:1:1: error: expected unqualified-id before '<' token
1 | <?php
| ^
a.cc:3:1: error: '$maxR' does not name a type
3 | $maxR=floor(sqrt($max));
| ^~~~~
a.cc:5:1: error: '$ch' does not name a type
5 | $ch=[0,0,1,1];
| ^~~
a.cc:7:1: error: expected unqualified-id before 'for'
7 | for(... |
s775361177 | p00009 | C++ | #include <iostream>
int main(){
int i,j,ch[1000000];
for(i=0;i<1000000;i+=2){ch[i]=0;ch[i+1]=1;}
ch[1]=0;
ch[2]=1;
for(i=3;i<1000;i+=2) if(ch[i]) for(j=i<<1;j<1000000;j+=i) ch[j]=0;
for(i=3;i<1000000;i++) ch[i]+=ch[i-1];
while(cin>>i) cout<<ch[i]<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:14:11: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
14 | while(cin>>i) cout<<ch[i]<<endl;
| ^~~
| std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | exter... |
s723250047 | p00009 | C++ | #include <iostream>
#define _USE_MATH_DEFINES
#include <math.h>
#define MAX_N 100000
void q9() {
bool IsPrime[MAX_N];
memset(IsPrime, 1, sizeof(IsPrime));
IsPrime[0] = false;
IsPrime[1] = false;
for (int i = 0; i < sqrt(MAX_N); i++) {
if (!IsPrime[i]) continue;
for (int j = i * 2; j < MAX_N; j += i) {
IsPr... | a.cc: In function 'void q9()':
a.cc:8:9: error: 'memset' was not declared in this scope
8 | memset(IsPrime, 1, sizeof(IsPrime));
| ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include <math.h>
+++ |+#includ... |
s542870673 | p00009 | C++ | #include <iostream>
#include <string.h>
#define _USE_MATH_DEFINES
#include <math.h>
#define MAX_N 100000
void q9() {
bool IsPrime[MAX_N];
memset(IsPrime, 1, sizeof(IsPrime));
IsPrime[0] = false;
IsPrime[1] = false;
for (int i = 0; i < sqrt(MAX_N); i++) {
if (!IsPrime[i]) continue;
for (int j = i * 2; j < MAX_... | a.cc: In function 'void q9()':
a.cc:26:16: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
26 | for (; cin >> n;) {
| ^~~
| std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | exter... |
s026403498 | p00009 | C++ | import sys
import math as mas
def sieve(n):
p=[True for i in range(n+1)]
p[0]=p[1]=False
end=int(n**0.5)
for i in range(2,end+1):
if p[i]:
for j in range(i*i,n+1,i):
p[j]=False
return p
sosu=sieve(1000010)
for i in sys.stdin:
t=int(i)
if t<2:print(0)
elif t==2:print(1)
else:print(1+sum(sosu[t] for ... | a.cc:21:9: error: invalid preprocessing directive #a
21 | # a,b=map(int,i.split())
| ^
a.cc:22:9: error: invalid preprocessing directive #print
22 | # print(gcd(a,b),lcm(a,b))
| ^~~~~
a.cc:1:1: error: 'import' does not name a type
1 | import sys
| ^~~~~~
a.cc:1:1:... |
s569574723 | p00009 | C++ | #include <iostream>
#include <cmath>
int prime[1000000];
bool isPrime(int n) {
int x = sqrt(static_cast<double>n);
for (int i = 3; i <= x; i += 2) {
if (n % i == 0) {
return false;
}
}
return true;
}
void get_prime(int max_num) {
int primecount = 1;
prime[2] = primecount;
for (int i = 3... | a.cc: In function 'bool isPrime(int)':
a.cc:8:35: error: expected '(' before 'n'
8 | int x = sqrt(static_cast<double>n);
| ^
| (
a.cc:8:37: error: expected ')' before ';' token
8 | int x = sqrt(static_cast<double>n);
| ... |
s504637497 | p00009 | C++ | #include <stdio.h>
int main()
{
int low, high, i, flag,c=0,s;
while(scanf("%d",&high)==!EOF)
{
int start = 2;
while (start <= high)
{
flag = 0;
s = sqrt(start);
for(i = 2; i <= start/2; i++)
{
... | a.cc: In function 'int main()':
a.cc:12:21: error: 'sqrt' was not declared in this scope
12 | s = sqrt(start);
| ^~~~
|
s012077502 | p00009 | C++ | #include<bits/stdc++.h>
int main()
{
long long int low, high, i, flag,c, s ;
while(scanf("%lld", &high)!=EOF){
long long int start = 2;
c = 0;
while (start <= high)
{
flag = 0;
s = sqrt(start);
for(i = 2; i <= s; i++)
{
if(start% i == 0)
... | a.cc: In function 'int main()':
a.cc:33:6: error: expected '}' at end of input
33 | }
| ^
a.cc:3:1: note: to match this '{'
3 | {
| ^
|
s602556539 | p00009 | C++ | #include<iostream>
using namespace std;
int main(int argv,int* argv[]){
unsigned x[30];
int count=0;
for(int i=0;i<argv;i++){
cin>>x[i];
}
for(int i=0;i<argv;i++){
for(int j=1;j<x[i];j++){
if(x[i]%j!=0)
count++;
}
cout<<count<<endl;
count=0;
}
return 0;
} | a.cc:3:24: error: conflicting declaration 'int** argv'
3 | int main(int argv,int* argv[]){
| ~~~~~^~~~~~
a.cc:3:14: note: previous declaration as 'int argv'
3 | int main(int argv,int* argv[]){
| ~~~~^~~~
|
s338157897 | p00009 | C++ | #include<iostream>
using namespace std;
int main(int argv,char* argv[]){
unsigned x[30];
int count=0;
for(int i=0;i<argv;I++){
cin>>x[i];
}
for(int i=0;i<argv;i++){
for(int j=1;j<x[i];j++){
if(x[i]%j!=0)
count++;
}
cout<<count<<endl;
count=0;
}
return 0;
} | a.cc:3:25: error: conflicting declaration 'char** argv'
3 | int main(int argv,char* argv[]){
| ~~~~~~^~~~~~
a.cc:3:14: note: previous declaration as 'int argv'
3 | int main(int argv,char* argv[]){
| ~~~~^~~~
a.cc: In function 'int main(...)':
a.cc:6:20: error: 'I' was not ... |
s010511564 | p00009 | C++ | #include<iostream>
using namespace std;
int main(int argc,char* argv[]){
unsigned x[30];
int count=0;
for(int i=0;i<argc;I++){
cin>>x[i];
}
for(int i=0;i<argc(i++){
for(int j=1;j<x[i];j++){
if(x[i]%j!=0)
count++;
}
cout<<count<<endl;
count=0;
}
return 0;
} | a.cc: In function 'int main(int, char**)':
a.cc:6:20: error: 'I' was not declared in this scope
6 | for(int i=0;i<argc;I++){
| ^
a.cc:9:19: error: 'argc' cannot be used as a function
9 | for(int i=0;i<argc(i++){
| ~~~~^~~~~
a.cc:9:24: error: expected ';' before '{' t... |
s783829158 | p00009 | C++ | #include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
int main(void){
int unti[1000002] = {0};
fill(unti,unti + 1000001;n++)
{
if(unti[n] == 0)
{
for(int a = 2;(a * n) < 1000001;a++)
{
if((a * n ) < 1000001 ) unti[a * n]++;
}
}
}
int b;
for(int i;i <= 31;i++){
cin >> b
int cnt = (count(un... | a.cc: In function 'int main()':
a.cc:8:25: error: expected ')' before ';' token
8 | fill(unti,unti + 1000001;n++)
| ~ ^
| )
a.cc:8:26: error: 'n' was not declared in this scope
8 | fill(unti,unti + 1000001;n++)
| ^
a.cc:20:... |
s286554401 | p00009 | C++ | #include<iostream>
#include<stdio.h>
#include<windows.h>
#include<conio.h>
#include<String>
#include<time.h>
#include<math.h>
using namespace std;
int main() {
int c = 0;
int i = 1;
unsigned long long a = 0;
unsigned long long b = 0;
unsigned long long sosuu[100000] = { 0 };
char fire = 0;
int pattara = 0;
c... | a.cc:3:9: fatal error: windows.h: No such file or directory
3 | #include<windows.h>
| ^~~~~~~~~~~
compilation terminated.
|
s818929327 | p00009 | C++ | import java.util.*;
class Prime2 {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int[] x = new int[30];
int t=0,j,count=0;
while(scan.hasNextInt()){
count = 0;
int lim = scan.nextInt();
int ptr = 0; //??... | 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:4:11: error: expected ':' before 'static'
4 | public static void main(String[] args) {
| ^~~~~~~
| :
a.cc:4:29: error: ... |
s411401507 | p00009 | C++ | #include<iostream>
#include<vector>
using namespace std;
#define MAX 1000000
int main(void){
int n;
cin >> n;
int num = 0;
vector<long int> array(MAX,0);
array[0] = 2; count++;
array[1] = 3; count++;
for(int i = 5 i < n ; i+=2){
int flag = 0;
for(int j = 0; array[j]*array[j] <= n;j++){
... | a.cc: In function 'int main()':
a.cc:16:17: error: 'count' was not declared in this scope
16 | array[0] = 2; count++;
| ^~~~~
a.cc:19:16: error: expected ';' before 'i'
19 | for(int i = 5 i < n ; i+=2){
| ^~
| ;
|
s688827445 | p00009 | C++ | import math
def isPrime(n):
if n==1: return False
if n==2: return True
for i in range(2,int(math.sqrt(n))+2):
if n%i==0: return False
return True
while True:
a = input()
if a=='EOF': break
sum = 0
for i in range(1,a+1):
if isPrime(i)==True:
sum+=1
print sum | a.cc:12:15: warning: multi-character character constant [-Wmultichar]
12 | if a=='EOF': 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'
|
s248419466 | p00009 | C++ | #coding:utf-8
import time
import math
import numpy as np
def flatten(L):
if isinstance(L, list):
if L == []:
return []
else:
return flatten(L[0]) + flatten(L[1:])
else:
return [L]
def Eratos(data):
p_list = [] # ????????????
tmp = []
num = int(math.... | a.cc:1:2: error: invalid preprocessing directive #coding
1 | #coding:utf-8
| ^~~~~~
a.cc:17:17: error: stray '#' in program
17 | p_list = [] # ????????????
| ^
a.cc:2:1: error: 'import' does not name a type
2 | import time
| ^~~~~~
a.cc:2:1: note: C++20 'import' only av... |
s779684429 | p00009 | C++ | #include<iostream>
#include<stdio.h>
#include<windows.h>
#include<conio.h>
#include<String>
#include<time.h>
#include<math.h>
using namespace std;
int c = 0;
int i = 1;
unsigned long long a = 0;
unsigned long long b = 0;
unsigned long long sosuu[100000] = { 0 };
char fire = 0;
int pattara = 0;
int sub(int c) {
... | a.cc:3:9: fatal error: windows.h: No such file or directory
3 | #include<windows.h>
| ^~~~~~~~~~~
compilation terminated.
|
s144591019 | p00009 | C++ | #include<iostream>
#include<stdio.h>
#include<windows.h>
#include<conio.h>
#include<String>
#include<time.h>
#include<math.h>
using namespace std;
int c = 0;
int i = 1;
unsigned long long a = 0;
unsigned long long b = 0;
unsigned long long sosuu[100000] = { 0 };
char fire = 0;
int pattara = 0;
int sub(int c) {
... | a.cc:3:9: fatal error: windows.h: No such file or directory
3 | #include<windows.h>
| ^~~~~~~~~~~
compilation terminated.
|
s795175989 | p00009 | C++ | #include<iostream>
#include<stdio.h>
#include<windows.h>
#include<conio.h>
#include<String>
#include<time.h>
#include<math.h>
using namespace std;
int c = 0;
int i = 1;
unsigned long long a = 0;
unsigned long long b = 0;
unsigned long long sosuu[100000] = { 0 };
char fire = 0;
int pattara = 0;
int sub(int c) {
... | a.cc:3:9: fatal error: windows.h: No such file or directory
3 | #include<windows.h>
| ^~~~~~~~~~~
compilation terminated.
|
s596053702 | p00009 | C++ | #include<stdio.h>
int main(void)
{
int n,i,j,z,x;
scanf("%d",&n);
for(n!=1){
for(i=2;i<=n;i++){
z=0;
for(j=2;j<=i;j++){
if(i%j==0 && i!=j){
z++;
break;
}
}
if(z==0){
x++;
}
}
printf("%d\n",x);
scanf("%d",&n);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:7:17: error: expected ';' before ')' token
7 | for(n!=1){
| ^
| ;
a.cc:23:9: error: expected primary-expression before 'return'
23 | return 0;
| ^~~~~~
a.cc:22:10: error: expected ';' before 'return'
... |
s198457727 | p00009 | C++ | #include<stdio.h>
int main(void)
{
int n,i,j,z,x;
scanf("%d",&n);
for(n!=1){
for(i=2;i<=n;i++){
z=0;
for(j=2;j<=i;j++){
if(i%j==0 && i!=j){
z++;
break;
}
}
if(z==0){
x++;
}
}
printf("%d\n",x);
scanf("%d",&n);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:7:17: error: expected ';' before ')' token
7 | for(n!=1){
| ^
| ;
a.cc:23:9: error: expected primary-expression before 'return'
23 | return 0;
| ^~~~~~
a.cc:22:10: error: expected ';' before 'return'
... |
s760584052 | p00009 | C++ | #include<iostream>
using namespace std;
int main()
{
bool is_prime[100000]:
is_prime[0]=is_prime[1]=false;
for(int i=2;i<1000000;i<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_primej]=false;
}
}
}
int n_prime[1000000];
int cn... | a.cc: In function 'int main()':
a.cc:6:30: error: expected initializer before ':' token
6 | bool is_prime[100000]:
| ^
a.cc:10:17: error: 'is_prime' was not declared in this scope
10 | is_prime[i]=true;
| ^~~~~~~~
a.cc:14:20: error:... |
s014940614 | p00009 | C++ | include <bits/stdc++.h>
using namespace std;
static const long MAX = 1000000L;
int main() {
vector<long> prime;
bool isPrime;
long n;
long i, len = sqrt(MAX) + 1;
long j, lenJ;
long k;
prime.push_back(2);
for (i = 3; i <= len; i += 2) {
isPrime = true;
lenJ ... | a.cc:1:1: error: 'include' does not name a type
1 | include <bits/stdc++.h>
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:8:5: error: 'vector' was not declared in this scope
8 | vector<long> prime;
| ^~~~~~
a.cc:8:12: error: expected primary-expression before 'long'
8 | vector<long>... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.