submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3
values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s397997333 | p00009 | C | #include<stdio.h>
int main(){
int i,k;
scanf("%d",&i);
for(int j=2; j<i; j++){
k=i%j
if(k==0){
continue;
}else{
}
}
} | main.c: In function 'main':
main.c:6:15: error: expected ';' before 'if'
6 | k=i%j
| ^
| ;
7 | if(k==0){
| ~~
|
s704693613 | p00009 | C | #include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<cmath>
#include<vector>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> PII;
#define pi acos(-1.0)
#define eps 1e-10
#define pf printf
#define sf scanf
#define lson rt<<1,l,m
#define rson rt<<1|1,m+1,r
#define e tree[rt]
#define _s second
#define _f first
#define all(x) (x).begin,(x).end
#define mem(i,a) memset(i,a,sizeof i)
#define for0(i,a) for(int (i)=0;(i)<(a);(i)++)
#define for1(i,a) for(int (i)=1;(i)<=(a);(i)++)
#define mi ((l+r)>>1)
#define sqr(x) ((x)*(x))
const int inf=0x3f3f3f3f;
const int Max=1e6+1;
bool vis[Max+1];
int p[Max/3],m,num[Max+1];
void prime()
{
mem(vis,0);
p[0]=0;
vis[1]=1;
for(int i=2;i<=Max;i++)
{
if(!vis[i])p[++p[0]]=i;
for(int j=1;j<=p[0]&&(ll)i*p[j]<=Max;j++)
{
vis[i*p[j]]=1;
if(!(i%p[j]))break;
}
}
num[0]=0;
for(int i=1;i<=Max;i++)
num[i]=!vis[i]?num[i-1]+1:num[i-1];
}
int main()
{
prime();
while(~sf("%d",&m))
pf("%d\n",num[m]);
return 0;
} | main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s474461592 | p00009 | C | #include <stdlib.h>
#include <stdio.h>
#include <stdbool>
#include <math.h>
#define N 999999
bool prime_num [N + 1] = { 0 };
void select_prime_num()
{
for (int i = 2; i <= N; i++)
{
if (!prime_num [i])
continue;
for(int j = 2; i * j <= N; j++)
prime_num [i * j] = 0;
}
}
int main()
{
for (int i = 0; i <= N; i++)
prime_num [i] = 1;
select_prime_num();
int n;
while (scanf("%d", &n) == 1)
{
int num = 0;
for (int i = 2; i <= n; i++)
{
if (prime_num [i])
num++;
}
printf("%d\n", num);
}
return 0;
} | main.c:3:10: fatal error: stdbool: No such file or directory
3 | #include <stdbool>
| ^~~~~~~~~
compilation terminated.
|
s757007029 | p00009 | C | #include<stdio.h>
int main(void){
int i, n, s, k, sum;
scanf(scanf("%d", &n) != EOF);
sum = 0;
for(s = 2; s <= n; s++){
for(i = 2; i < s; i++){
if(s % i == 0){
break;
}
}
if(i == s){
sum++;
}
}
printf("%d", sum);
}
return 0;
} | main.c: In function 'main':
main.c:4:26: error: passing argument 1 of 'scanf' makes pointer from integer without a cast [-Wint-conversion]
4 | scanf(scanf("%d", &n) != EOF);
| ^
| |
| int
In file included from main.c:1:
/usr/include/stdio.h:428:42: note: expected 'const char *' but argument is of type 'int'
428 | extern int scanf (const char *__restrict __format, ...) __wur;
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
main.c: At top level:
main.c:18:4: error: expected identifier or '(' before 'return'
18 | return 0;
| ^~~~~~
main.c:19:1: error: expected identifier or '(' before '}' token
19 | }
| ^
|
s774303120 | p00009 | C | #include<stdio.h>
int main(void){
??????int s[10000], l, m, n, i, k, sum;
??????sum = 0;
??????for ( k = 2; k <= 10; k++ ){
????????????if (s[k] != 1 ) {
??????????????????for ( l = 1; l <= 10 / k; l++ ) {
????????????????????????s[k * l] = 1;
??????????????????}
????????????}
??????}
??????return 0;
} | main.c: In function 'main':
main.c:3:1: error: expected expression before '?' token
3 | ??????int s[10000], l, m, n, i, k, sum;
| ^
main.c:4:1: error: expected expression before '?' token
4 | ??????sum = 0;
| ^
main.c:4:7: error: 'sum' undeclared (first use in this function)
4 | ??????sum = 0;
| ^~~
main.c:4:7: note: each undeclared identifier is reported only once for each function it appears in
main.c:5:1: error: expected expression before '?' token
5 | ??????for ( k = 2; k <= 10; k++ ){
| ^
|
s029937654 | p00009 | C | include<stdio.h>
int main(){
int i,n,j;
int k=0;
int count=0;
int a[50];
int l=0;
while(scanf("%d",&n)!=EOF){
for(j=2;j<=n;j++){
for(i=2;i<j;i++){
if((j%i)==0) break;
k++;
}
if(k==j-2) count++;
k=0;
}
a[l]=count;
l++;
count=0;
}
for(i=0;i<l;i++){
printf("%d\n",a[i]);
}
return 0;
} | main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
1 | include<stdio.h>
| ^
|
s094281784 | p00009 | C | #include<stdio.h>
cost int MAX_V = 1000000;
int prime[MAX_V+1]
int main(){
int i, k, n, count = 0;
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;
}
}
}
while(scanf("%d", &n) != EOF){
for(i = 0;i <= n;i++){
if(prime[i] == 1){
count++;
}
}
printf("%d\n", count);
}
return 0;
} | main.c:2:5: error: expected ';' before 'int'
2 | cost int MAX_V = 1000000;
| ^~~~
| ;
main.c:3:19: error: expected ';' before 'int'
3 | int prime[MAX_V+1]
| ^
| ;
4 | int main(){
| ~~~
main.c: In function 'main':
main.c:7:5: error: 'prime' undeclared (first use in this function)
7 | prime[i] = 1;
| ^~~~~
main.c:7:5: note: each undeclared identifier is reported only once for each function it appears in
|
s704419533 | p00009 | C | #include<stdio.h>
const int MAX_V = 1000000;
int prime[MAX_V+1];
int main(){
int i, k, n, count = 0;
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;
}
}
}
while(scanf("%d", &n) != EOF){
for(i = 0;i <= n;i++){
if(prime[i] == 1){
count++;
}
}
printf("%d\n", count);
}
return 0;
} | main.c:3:5: error: variably modified 'prime' at file scope
3 | int prime[MAX_V+1];
| ^~~~~
|
s614273475 | p00009 | C | #include<stdio.h>
const int MAX_V=1000000;
int prime[MAX_V+1];
int sum[31];
int main() {
int n,i,k,ans;
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;
}
}
}
while(scanf("%d", &n) != EOF) {
for(i=0;i<=n;i++) {
sum[i+1]=sum[i]+prime[i];
}
ans=sum[n+1];
printf("%d?????§????´???°?????°???%d???\n",n,ans);
}
return 0;
} | main.c:3:5: error: variably modified 'prime' at file scope
3 | int prime[MAX_V+1];
| ^~~~~
|
s073630928 | p00009 | C | #include<stdio.h>
const int MAX_V=1000000;
int prime[MAX_V+1];
int sum[31];
int main() {
int n,i,k,ans;
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;
}
}
}
while(scanf("%d", &n) != EOF) {
for(i=0;i<=n;i++) {
sum[i+1]=sum[i]+prime[i];
}
ans=sum[n+1];
printf("%d\n",ans);
}
return 0;
} | main.c:3:5: error: variably modified 'prime' at file scope
3 | int prime[MAX_V+1];
| ^~~~~
|
s511806042 | p00009 | C | #include<stdio.h>
int prime[1000001];
int sum[31];
int main() {
int n,i,k,ans;
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;
}
}
}
while(scanf("%d", &n) != EOF) {
for(i=0;i<=n;i++) {
sum[i+1]=sum[i]+prime[i];
}
ans=sum[n+1];
printf("%d\n",ans);
}
return 0;
} | main.c: In function 'main':
main.c:7:20: error: 'MAX_V' undeclared (first use in this function)
7 | for(i=2;i<=MAX_V;i++) {
| ^~~~~
main.c:7:20: note: each undeclared identifier is reported only once for each function it appears in
|
s865949540 | p00009 | C | #include<stdio.h>
const int MAX_V=1000000;
int prime[MAX_V];
int sum[MAX+1];
int main() {
int n,i,k,ans;
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;
}
}
}
while(scanf("%d", &n) != EOF) {
for(i=0;i<=n;i++) {
sum[i+1]=sum[i]+prime[i];
}
ans=sum[n+1];
printf("%d\n",ans);
}
return 0;
} | main.c:3:5: error: variably modified 'prime' at file scope
3 | int prime[MAX_V];
| ^~~~~
main.c:4:9: error: 'MAX' undeclared here (not in a function); did you mean 'MAX_V'?
4 | int sum[MAX+1];
| ^~~
| MAX_V
|
s681238120 | p00009 | C | #include<stdio.h>
int main() {
int n,i,k,ans;
const int MAX_V=1000000;
int prime[MAX_V];
int sum[MAX+1];
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;
}
}
}
while(scanf("%d", &n) != EOF) {
for(i=0;i<=n;i++) {
sum[i+1]=sum[i]+prime[i];
}
ans=sum[n+1];
printf("%d\n",ans);
}
return 0;
} | main.c: In function 'main':
main.c:6:17: error: 'MAX' undeclared (first use in this function); did you mean 'MAX_V'?
6 | int sum[MAX+1];
| ^~~
| MAX_V
main.c:6:17: note: each undeclared identifier is reported only once for each function it appears in
|
s578134840 | p00009 | C | #include <stdio.h>
const int MAX_V = 10000;
int prime[MAX_V+1];
int main() {
int i, k, v, cnt;
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;
}
}
}
while(scanf("%d",&v)!=EOF) {
for(i=2;i<=v;i++){
if(prime[i]){
cnt++;
}
}
printf("%d\n",cnt);
}
return 0;
}
| main.c:3:5: error: variably modified 'prime' at file scope
3 | int prime[MAX_V+1];
| ^~~~~
|
s670450542 | p00009 | C | #include <stdio.h>
const int MAX_V = 10000;
int prime[MAX_V+1];
int main() {
int i, k, v, cnt=0;
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;
}
}
}
while(scanf("%d",&v)!=EOF) {
for(i=2;i<=v;i++){
if(prime[i]){
cnt++;
}
}
printf("%d\n",cnt);
}
return 0;
} | main.c:3:5: error: variably modified 'prime' at file scope
3 | int prime[MAX_V+1];
| ^~~~~
|
s934185159 | p00009 | C | #include <stdio.h>
const int MAX_V = 1000000;
int prime[MAX_V+1];
int main() {
int i, k, v, cnt=0;
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;
}
}
}
while(scanf("%d",&v)!=EOF) {
for(i=2;i<=v;i++){
if(prime[i]){
cnt++;
}
}
printf("%d\n",cnt);
}
return 0;
} | main.c:3:5: error: variably modified 'prime' at file scope
3 | int prime[MAX_V+1];
| ^~~~~
|
s589066192 | p00009 | C | #include <stdio.h>
const int MAX_V = 1000000;
int prime[MAX_V+1];
int main() {
int i, k, v, cnt=0;
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;
}
}
}
while(scanf("%d",&v)!=EOF) {
for(i=2;i<=v;i++){
if(prime[i]){
cnt++;
}
}
printf("%d\n",cnt);
}
return 0;
} | main.c:3:5: error: variably modified 'prime' at file scope
3 | int prime[MAX_V+1];
| ^~~~~
|
s542548261 | p00009 | C | #include <stdio.h>
const int MAX_V = 1000000;
int prime[MAX_V+1];
int main() {
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;
}
}
}
while(scanf("%d",&v)!=EOF) {
int cnt = 0;
for(i=2;i<=v;i++){
if(prime[i]==1){
cnt++;
}
}
printf("%d\n",cnt);
}
return 0;
} | main.c:4:5: error: variably modified 'prime' at file scope
4 | int prime[MAX_V+1];
| ^~~~~
|
s903437068 | p00009 | C | #include <stdio.h>
const int MAX_V = 1000000;
int prime[MAX_V+1];
int main() {
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;
}
}
}
while(scanf("%d",&v)!=EOF) {
int cnt = 0;
for(i=2; i<=v; i++){
if(prime[i]==1){
cnt++;
}
}
printf("%d\n",cnt);
}
} | main.c:4:5: error: variably modified 'prime' at file scope
4 | int prime[MAX_V+1];
| ^~~~~
|
s504614876 | p00009 | C | #include <stdio.h>
#include <ctype.h>
const int MAX_V = 1000000;
int prime[MAX_V+1];
int main() {
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;
}
}
}
while(scanf("%d",&v)!=EOF) {
int cnt = 0;
for(i=2; i<=v; i++){
if(prime[i]==1){
cnt++;
}
}
printf("%d\n",cnt);
}
} | main.c:4:5: error: variably modified 'prime' at file scope
4 | int prime[MAX_V+1];
| ^~~~~
|
s442978419 | p00009 | C | #include<stdio.h>
int isprime(int n) {
for(int i=2;i*i<=n;i++) {
if(n%i==0) return 0;
}
return 1;
}
int main() {
int n,p1,q1;
while(1) {
scanf("%d", &n);
if(n==0) break;
for(i=3;i<=n-2;i+=2) {
if(isprime(i)==1 && isprime(i+2)==1) {
if(i+2>big) {
p1=i; q1=i+2;
}
}
}
printf("%d %d\n",p1,q1);
}
return 0;
} | main.c: In function 'main':
main.c:14:21: error: 'i' undeclared (first use in this function)
14 | for(i=3;i<=n-2;i+=2) {
| ^
main.c:14:21: note: each undeclared identifier is reported only once for each function it appears in
main.c:16:40: error: 'big' undeclared (first use in this function)
16 | if(i+2>big) {
| ^~~
|
s125876436 | p00009 | C | #include<stdio.h>
int isprime(int n) {
for(int i=2;i*i<=n;i++) {
if(n%i==0) return 0;
}
return 1;
}
int main() {
int n,p1,q1,i;
while(1) {
scanf("%d", &n);
if(n==0) break;
for(i=3;i<=n-2;i+=2) {
if(isprime(i)==1 && isprime(i+2)==1) {
if(i+2>big) {
p1=i; q1=i+2;
}
}
}
printf("%d %d\n",p1,q1);
}
return 0;
} | main.c: In function 'main':
main.c:16:40: error: 'big' undeclared (first use in this function)
16 | if(i+2>big) {
| ^~~
main.c:16:40: note: each undeclared identifier is reported only once for each function it appears in
|
s818292343 | p00009 | C | #include <stdio.h>
const int MAX_V = 1000000; // 100????????§?´???°??¨?????????
int prime[MAX_V+1]; // 1????´???°???0????´???°??§??????
int pcount[MAX_V+1];
int main() {
int i, k,a,sum=0;
for(i = 2; i <= MAX_V; i++) {
prime[i] = 1; // 2??\????´???°??¨??????
}
for(i = 2; i*i <= MAX_V; i++) {
if(prime[i]) {
for(k = 2 * i; k <= MAX_V; k += i) {
prime[k] = 0; // ?´???°2?????\????????°?´???°??§??????
}
}
}
pcount[0]=0;
pcount[1]=0;
for(i=2;i<MAX_V;i++){
if(prime[i]){
sum++;
}
pcount[i]=sum;
}
for(i=0;i<30;i++){
scanf("%d",&a);
printf("%d\n",pcount[a]);
}
return 0;
} | main.c:3:5: error: variably modified 'prime' at file scope
3 | int prime[MAX_V+1]; // 1????´???°???0????´???°??§??????
| ^~~~~
main.c:4:5: error: variably modified 'pcount' at file scope
4 | int pcount[MAX_V+1];
| ^~~~~~
|
s164719252 | p00009 | C | #include <stdio.h>
const int MAX_V = 1000000;
int prime[MAX_V];
int pcount[MAX_V];
int main() {
int i, k,a,sum=0;
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;
}
}
}
pcount[0]=0;
pcount[1]=0;
for(i=2;i<MAX_V;i++){
if(prime[i]){
sum++;
}
pcount[i]=sum;
}
for(i=0;i<30;i++){
scanf("%d",&a);
printf("%d\n",pcount[a]);
}
return 0;
} | main.c:3:5: error: variably modified 'prime' at file scope
3 | int prime[MAX_V];
| ^~~~~
main.c:4:5: error: variably modified 'pcount' at file scope
4 | int pcount[MAX_V];
| ^~~~~~
|
s794950517 | p00009 | C | #include <stdio.h>
#include <iostream>
const int MAX_V = 1000000; // 100????????§?´???°??¨?????????
int prime[MAX_V+1]; // 1????´???°???0????´???°??§??????
int pcount[MAX_V+1];
int main() {
int i, k,a,sum=0;
for(i = 2; i <= MAX_V; i++) {
prime[i] = 1; // 2??\????´???°??¨??????
}
for(i = 2; i*i <= MAX_V; i++) {
if(prime[i]) {
for(k = 2 * i; k <= MAX_V; k += i) {
prime[k] = 0; // ?´???°2?????\????????°?´???°??§??????
}
}
}
pcount[0]=0;
pcount[1]=0;
for(i=2;i<MAX_V;i++){
if(prime[i]){
sum++;
}
pcount[i]=sum;
}
for(i=0;i<30;i++){
scanf("%d",&a);
printf("%d\n",pcount[a]);
}
return 0;
} | main.c:2:10: fatal error: iostream: No such file or directory
2 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s423656374 | p00009 | C | #include <stdio.h>
const int MAX_V = 1000000; // 100????????§?´???°??¨?????????
int prime[MAX_V+1]; // 1????´???°???0????´???°??§??????
int pcount[MAX_V+1];
int main() {
int i, k,a,sum=0;
for(i = 2; i <= MAX_V; i++) {
prime[i] = 1; // 2??\????´???°??¨??????
}
for(i = 2; i*i <= MAX_V; i++) {
if(prime[i]) {
for(k = 2 * i; k <= MAX_V; k += i) {
prime[k] = 0; // ?´???°2?????\????????°?´???°??§??????
}
}
}
pcount[0]=0;
pcount[1]=0;
for(i=2;i<MAX_V;i++){
if(prime[i]){
sum++;
}
pcount[i]=sum;
}
for(i=0;i<30;i++){
scanf("%d",&a);
printf("%d\n",pcount[a]);
}
return 0;
} | main.c:3:5: error: variably modified 'prime' at file scope
3 | int prime[MAX_V+1]; // 1????´???°???0????´???°??§??????
| ^~~~~
main.c:4:5: error: variably modified 'pcount' at file scope
4 | int pcount[MAX_V+1];
| ^~~~~~
|
s794521075 | p00009 | C | #include <stdio.h>
const int MAX_V = 1000000; // 100????????§?´???°??¨?????????
int prime[MAX_V+1]; // 1????´???°???0????´???°??§??????
int pcount[MAX_V];
int main() {
int i, k,a,sum=0;
for(i = 2; i <= MAX_V; i++) {
prime[i] = 1; // 2??\????´???°??¨??????
}
for(i = 2; i*i <= MAX_V; i++) {
if(prime[i]) {
for(k = 2 * i; k <= MAX_V; k += i) {
prime[k] = 0; // ?´???°2?????\????????°?´???°??§??????
}
}
}
pcount[0]=0;
pcount[1]=0;
for(i=2;i<MAX_V;i++){
if(prime[i]){
sum++;
}
pcount[i]=sum;
}
for(i=0;i<30;i++){
scanf("%d",&a);
printf("%d\n",pcount[a]);
}
return 0;
} | main.c:3:5: error: variably modified 'prime' at file scope
3 | int prime[MAX_V+1]; // 1????´???°???0????´???°??§??????
| ^~~~~
main.c:4:5: error: variably modified 'pcount' at file scope
4 | int pcount[MAX_V];
| ^~~~~~
|
s680585843 | p00009 | C | #include <stdio.h>
const int MAX_V = 1000000;
int prime[MAX_V+1];
int pcount[MAX_V];
int main() {
int i, k,a,sum=0;
for(i = 2; i <= MAX_V; i++) {
prime[i] = 1; // 2??\????´???°??¨??????
}
for(i = 2; i*i <= MAX_V; i++) {
if(prime[i]) {
for(k = 2 * i; k <= MAX_V; k += i) {
prime[k] = 0; // ?´???°2?????\????????°?´???°??§??????
}
}
}
pcount[0]=0;
pcount[1]=0;
for(i=2;i<MAX_V;i++){
if(prime[i]){
sum++;
}
pcount[i]=sum;
}
for(i=0;i<30;i++){
scanf("%d",&a);
printf("%d\n",pcount[a]);
}
return 0;
} | main.c:3:5: error: variably modified 'prime' at file scope
3 | int prime[MAX_V+1];
| ^~~~~
main.c:4:5: error: variably modified 'pcount' at file scope
4 | int pcount[MAX_V];
| ^~~~~~
|
s878310025 | p00009 | C | #include <stdio.h>
const int MAX_V = 1000000;
int prime[MAX_V+1];
int pcount[MAX_V];
int main() {
int i, k,a,sum=0;
for(i = 2; i <= MAX_V; i++) {
prime[i] = 1; // 2??\????´???°??¨??????
}
for(i = 2; i*i <= MAX_V; i++) {
if(prime[i]) {
for(k = 2 * i; k <= MAX_V; k += i) {
prime[k] = 0; // ?´???°2?????\????????°?´???°??§??????
}
}
}
pcount[0]=0;
pcount[1]=0;
for(i=2;i<MAX_V;i++){
if(prime[i]){
sum++;
}
pcount[i]=sum;
}
for(i=0;i<30;i++){
scanf("%d",&a);
printf("%d\n",pcount[a]);
}
return 0;
} | main.c:3:5: error: variably modified 'prime' at file scope
3 | int prime[MAX_V+1];
| ^~~~~
main.c:4:5: error: variably modified 'pcount' at file scope
4 | int pcount[MAX_V];
| ^~~~~~
|
s002497230 | p00009 | C | #include<stdio.h>
const int MAX_V = 10000;
int prime[MAX_V + 1];
int sum[MAX_V + 1];
int main(){
int n, i, k;
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;
}
}
}
sum[0] = 0;
for(i = 0;i < MAX_V;i++){
sum[i+1] = sum[i]+prime[i+1];
}
while(scanf("%d", &n) != EOF){
printf("%d\n", sum[n]);
}
return 0;
} | main.c:3:5: error: variably modified 'prime' at file scope
3 | int prime[MAX_V + 1];
| ^~~~~
main.c:4:5: error: variably modified 'sum' at file scope
4 | int sum[MAX_V + 1];
| ^~~
|
s618517639 | p00009 | C | #include<stdio.h>
int MAX_V = 10000;
int prime[MAX_V + 1];
int sum[MAX_V + 1];
int main(){
int n, i, k;
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;
}
}
}
sum[0] = 0;
for(i = 0;i < MAX_V;i++){
sum[i+1] = sum[i]+prime[i+1];
}
while(scanf("%d", &n) != EOF){
printf("%d\n", sum[n]);
}
return 0;
} | main.c:3:5: error: variably modified 'prime' at file scope
3 | int prime[MAX_V + 1];
| ^~~~~
main.c:4:5: error: variably modified 'sum' at file scope
4 | int sum[MAX_V + 1];
| ^~~
|
s991705842 | p00009 | C | #include <stdio.h>
const int MAX_V = 999999;
int prime[MAX_V+1];
int sum[MAX_V+1];
int main(){
int i, k, n;
for(i = 2; i <= MAX_V; i++) prime[i] = 1;
for(i = 2; i <= MAX_V; i++){
if(prime[i]){
for(k = 2 * i; k <= MAX_V; k += i){
prime[k] = 0;
}
}
}
sum[1]=0;
for(i = 2; i <= MAX_V; i++) sum[i] = sum[i-1]+prime[i];
while(scanf("%d", &n) != EOF) printf("%d\n",sum[n]);
return 0;
} | main.c:4:5: error: variably modified 'prime' at file scope
4 | int prime[MAX_V+1];
| ^~~~~
main.c:5:5: error: variably modified 'sum' at file scope
5 | int sum[MAX_V+1];
| ^~~
|
s483749795 | p00009 | C | #include <stdio.h>
const int MAX_V = 999999;
int prime[MAX_V+1];
int sum[MAX_V+1];
int main(){
int i, k, n;
for(i = 2; i <= MAX_V; i++) prime[i] = 1;
for(i = 2; i <= MAX_V; i++){
if(prime[i]){
for(k = 2 * i; k <= MAX_V; k += i){
prime[k] = 0;
}
}
}
sum[1]=0;
for(i = 2; i <= MAX_V; i++) sum[i] = sum[i-1]+prime[i];
while(scanf("%d", &n) != EOF) printf("%d\n",sum[n]);
return 0;
} | main.c:4:9: error: variably modified 'prime' at file scope
4 | int prime[MAX_V+1];
| ^~~~~
main.c:5:9: error: variably modified 'sum' at file scope
5 | int sum[MAX_V+1];
| ^~~
|
s414767366 | p00009 | C | #include<stdio.h>
const int MAX_V = 100000;
int prime[100001];
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(i = 0;i < 30;i++){
scanf("%d", &n);
int count = 0;
for(int i = 0;i < n;i++){
if(prime[i]){
count++;
}
}
printf("%d\n", count);
}
return 0;
} | main.c: In function 'main':
main.c:18:13: error: 'i' undeclared (first use in this function)
18 | for(i = 0;i < 30;i++){
| ^
main.c:18:13: note: each undeclared identifier is reported only once for each function it appears in
|
s054706754 | p00009 | C | #include<stdio.h>
const int MAX_V = 100000;
int prime[100001];
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(i = 0;i < 30;i++){
scanf("%d", &n);
int count = 0;
for(int j = 0;j < n;j++){
if(prime[j]){
count++;
}
}
printf("%d\n", count);
}
return 0;
} | main.c: In function 'main':
main.c:18:13: error: 'i' undeclared (first use in this function)
18 | for(i = 0;i < 30;i++){
| ^
main.c:18:13: note: each undeclared identifier is reported only once for each function it appears in
|
s991822340 | p00009 | C | #include<stdio.h>
#define int MAX_V = 10000;
int prime[MAX_V + 1];
int sum[MAX_V + 1];
int main(){
int n, i, k;
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;
}
}
}
sum[0] = 0;
for(i = 0;i < MAX_V;i++){
sum[i+1] = sum[i]+prime[i+1];
}
while(scanf("%d", &n) != EOF){
printf("%d\n", sum[n]);
}
return 0;
} | main.c:2:13: warning: data definition has no type or storage class
2 | #define int MAX_V = 10000;
| ^~~~~
main.c:3:1: note: in expansion of macro 'int'
3 | int prime[MAX_V + 1];
| ^~~
main.c:2:13: error: type defaults to 'int' in declaration of 'MAX_V' [-Wimplicit-int]
2 | #define int MAX_V = 10000;
| ^~~~~
main.c:3:1: note: in expansion of macro 'int'
3 | int prime[MAX_V + 1];
| ^~~
main.c:3:5: warning: data definition has no type or storage class
3 | int prime[MAX_V + 1];
| ^~~~~
main.c:3:5: error: type defaults to 'int' in declaration of 'prime' [-Wimplicit-int]
main.c:3:5: error: variably modified 'prime' at file scope
main.c:2:13: warning: data definition has no type or storage class
2 | #define int MAX_V = 10000;
| ^~~~~
main.c:4:1: note: in expansion of macro 'int'
4 | int sum[MAX_V + 1];
| ^~~
main.c:2:13: error: type defaults to 'int' in declaration of 'MAX_V' [-Wimplicit-int]
2 | #define int MAX_V = 10000;
| ^~~~~
main.c:4:1: note: in expansion of macro 'int'
4 | int sum[MAX_V + 1];
| ^~~
main.c:2:13: error: redefinition of 'MAX_V'
2 | #define int MAX_V = 10000;
| ^~~~~
main.c:4:1: note: in expansion of macro 'int'
4 | int sum[MAX_V + 1];
| ^~~
main.c:2:13: note: previous definition of 'MAX_V' with type 'int'
2 | #define int MAX_V = 10000;
| ^~~~~
main.c:3:1: note: in expansion of macro 'int'
3 | int prime[MAX_V + 1];
| ^~~
main.c:4:5: warning: data definition has no type or storage class
4 | int sum[MAX_V + 1];
| ^~~
main.c:4:5: error: type defaults to 'int' in declaration of 'sum' [-Wimplicit-int]
main.c:4:5: error: variably modified 'sum' at file scope
main.c:2:13: warning: data definition has no type or storage class
2 | #define int MAX_V = 10000;
| ^~~~~
main.c:5:1: note: in expansion of macro 'int'
5 | int main(){
| ^~~
main.c:2:13: error: type defaults to 'int' in declaration of 'MAX_V' [-Wimplicit-int]
2 | #define int MAX_V = 10000;
| ^~~~~
main.c:5:1: note: in expansion of macro 'int'
5 | int main(){
| ^~~
main.c:2:13: error: redefinition of 'MAX_V'
2 | #define int MAX_V = 10000;
| ^~~~~
main.c:5:1: note: in expansion of macro 'int'
5 | int main(){
| ^~~
main.c:2:13: note: previous definition of 'MAX_V' with type 'int'
2 | #define int MAX_V = 10000;
| ^~~~~
main.c:3:1: note: in expansion of macro 'int'
3 | int prime[MAX_V + 1];
| ^~~
main.c:5:5: error: return type defaults to 'int' [-Wimplicit-int]
5 | int main(){
| ^~~~
main.c: In function 'main':
main.c:6:7: error: 'n' undeclared (first use in this function)
6 | int n, i, k;
| ^
main.c:6:7: note: each undeclared identifier is reported only once for each function it appears in
main.c:6:10: error: 'i' undeclared (first use in this function)
6 | int n, i, k;
| ^
main.c:6:13: error: 'k' undeclared (first use in this function)
6 | int n, i, k;
| ^
|
s043091854 | p00009 | C | #include<stdio.h>
#define MAX_V 10000;
int prime[MAX_V + 1];
int sum[MAX_V + 1];
int main(){
int n, i, k;
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;
}
}
}
sum[0] = 0;
for(i = 0;i < MAX_V;i++){
sum[i+1] = sum[i]+prime[i+1];
}
while(scanf("%d", &n) != EOF){
printf("%d\n", sum[n]);
}
return 0;
} | main.c:2:20: error: expected ']' before ';' token
2 | #define MAX_V 10000;
| ^
main.c:3:11: note: in expansion of macro 'MAX_V'
3 | int prime[MAX_V + 1];
| ^~~~~
main.c:2:20: error: expected ']' before ';' token
2 | #define MAX_V 10000;
| ^
main.c:4:9: note: in expansion of macro 'MAX_V'
4 | int sum[MAX_V + 1];
| ^~~~~
main.c: In function 'main':
main.c:7:23: error: expected expression before ';' token
7 | for(i = 2;i <= MAX_V;i++){
| ^
main.c:8:5: error: 'prime' undeclared (first use in this function)
8 | prime[i] = 1;
| ^~~~~
main.c:8:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:10:21: error: expected expression before ';' token
10 | for(i=2;i*i<=MAX_V;i++){
| ^
main.c:12:29: error: expected expression before ';' token
12 | for(k = 2*i;k <= MAX_V;k += i){
| ^
main.c:17:3: error: 'sum' undeclared (first use in this function)
17 | sum[0] = 0;
| ^~~
main.c:18:22: error: expected expression before ';' token
18 | for(i = 0;i < MAX_V;i++){
| ^
|
s683965123 | p00009 | C | #include <stdio.h>
const int MAX_V = 999999;
int prime[MAX_V+1]={0};
int sum[MAX_V+2]={0};
int main(){
int i, k, v ,n;
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;
}
}
}
for(i=0 ;i<=MAX_V+1 ;i++){
sum[i+1] += sum[i] + prime[i];
}
while(scanf("%d" ,&n) != EOF){
printf("%d\n" ,sum[n+1]);
}
return 0;
} | main.c:3:5: error: variably modified 'prime' at file scope
3 | int prime[MAX_V+1]={0};
| ^~~~~
main.c:4:5: error: variably modified 'sum' at file scope
4 | int sum[MAX_V+2]={0};
| ^~~
|
s589617768 | p00009 | C | #include <stdio.h>
const int MAX_V = 999999;
int prime[MAX_V+1];
int sum[MAX_V+2;
int main(){
int i, k, v ,n;
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;
}
}
}
for(i=0 ;i<=MAX_V+1 ;i++){
sum[i+1] += sum[i] + prime[i];
}
while(scanf("%d" ,&n) != EOF){
printf("%d\n" ,sum[n+1]);
}
return 0;
} | main.c:3:5: error: variably modified 'prime' at file scope
3 | int prime[MAX_V+1];
| ^~~~~
main.c:4:16: error: expected ']' before ';' token
4 | int sum[MAX_V+2;
| ^
| ]
|
s428901035 | p00009 | C | #include <stdio.h>
const int MAX_V = 999999;
int prime[MAX_V+1]={0};
int sum[MAX_V+2]={0};
int main(){
int i, k, v ,n;
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;
}
}
}
for(i=0 ;i<=MAX_V+1 ;i++){
sum[i+1] += sum[i] + prime[i];
}
while(scanf("%d" ,&n) != EOF){
printf("%d\n" ,sum[n+1]);
}
return 0;
} | main.c:3:5: error: variably modified 'prime' at file scope
3 | int prime[MAX_V+1]={0};
| ^~~~~
main.c:4:5: error: variably modified 'sum' at file scope
4 | int sum[MAX_V+2]={0};
| ^~~
|
s565133426 | p00009 | C | #include <stdio.h>
const int MAX_V = 999999;
int prime[MAX_V+1]={0};
int sum[MAX_V+2]={0};
int main(){
int i, k, v ,n;
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;
}
}
}
for(i=0 ;i<=MAX_V+1 ;i++){
sum[i+1] += sum[i] + prime[i];
}
while(scanf("%d" ,&n) != EOF){
printf("%d\n" ,sum[n+1]);
}
return 0;
} | main.c:3:5: error: variably modified 'prime' at file scope
3 | int prime[MAX_V+1]={0};
| ^~~~~
main.c:4:5: error: variably modified 'sum' at file scope
4 | int sum[MAX_V+2]={0};
| ^~~
|
s075581709 | p00009 | C | #include<stdio.h>
const int MAX_V=1000000;
int prime[MAX_V+1];
int sum[MAX_V+2];
int main(){
int i,k,n;
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;
}
}
}
for(i=0;i<MAX_V+1;i++){
sum[i+1]+=sum[i]+prime[i];
}
while(scanf("%d",&n)!=EOF){
printf("%d\n",sum[n+1]);
}
return 0;
} | main.c:3:5: error: variably modified 'prime' at file scope
3 | int prime[MAX_V+1];
| ^~~~~
main.c:4:5: error: variably modified 'sum' at file scope
4 | int sum[MAX_V+2];
| ^~~
|
s714071668 | p00009 | C | #include <stdio.h>
const int MAX_V = 999999;
int prime[MAX_V+1]={0};
int sum[MAX_V+2]={0};
int main(){
int i, k, v ,n;
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;
}
}
}
for(i=0 ;i<=MAX_V+1 ;i++){
sum[i+1] += sum[i] + prime[i];
}
while(scanf("%d" ,&n)){
if(n==0)break;
printf("%d\n" ,sum[n+1]);
}
return 0;
} | main.c:3:5: error: variably modified 'prime' at file scope
3 | int prime[MAX_V+1]={0};
| ^~~~~
main.c:4:5: error: variably modified 'sum' at file scope
4 | int sum[MAX_V+2]={0};
| ^~~
|
s026673037 | p00009 | C | #include <stdio.h>
const int MAX_V = 999999;
int main(){
int prime[MAX_V+1]={0};
int sum[MAX_V+2]={0};
int i, k, v ,n;
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;
}
}
}
for(i=0 ;i<=MAX_V+1 ;i++){
sum[i+1] += sum[i] + prime[i];
}
while(scanf("%d" ,&n)){
if(n==0)break;
printf("%d\n" ,sum[n+1]);
}
return 0;
} | main.c: In function 'main':
main.c:4:20: error: variable-sized object may not be initialized except with an empty initializer
4 | int prime[MAX_V+1]={0};
| ^
main.c:5:18: error: variable-sized object may not be initialized except with an empty initializer
5 | int sum[MAX_V+2]={0};
| ^
|
s204854999 | p00009 | C | #include <stdio.h>
const int MAX = 100000;
int prime[MAX+1];
int sum[MAX+2];
int main() {
int n, i, k;
for(i = 2; i <= MAX; i++) {
prime[i] = 1;
}
for(i = 2; i <= MAX; i++) {
if(prime[i]) {
for(k = 2*i; k <= MAX; k+=i) {
prime[k] = 0;
}
}
}
sum[0] = 0;
for(i = 0; i <= MAX+1; i++) sum[i+1] = sum[i] + prime[i];
while(scanf("%d", &n) != EOF) {
printf("%d\n", sum[n+1]);
}
return 0;
} | main.c:3:5: error: variably modified 'prime' at file scope
3 | int prime[MAX+1];
| ^~~~~
main.c:4:5: error: variably modified 'sum' at file scope
4 | int sum[MAX+2];
| ^~~
|
s041406648 | p00009 | C | #include <stdio.h>
const int MAX = 100000;
int main() {
int n, i, k;
int prime[MAX+1] = {0};
int sum[MAX+2] = {0};
for(i = 2; i <= MAX; i++) {
prime[i] = 1;
}
for(i = 2; i <= MAX; i++) {
if(prime[i]) {
for(k = 2*i; k <= MAX; k+=i) {
prime[k] = 0;
}
}
}
for(i = 0; i <= MAX+1; i++) sum[i+1] = sum[i] + prime[i];
while(scanf("%d", &n) != EOF) {
printf("%d\n", sum[n+1]);
}
return 0;
} | main.c: In function 'main':
main.c:6:24: error: variable-sized object may not be initialized except with an empty initializer
6 | int prime[MAX+1] = {0};
| ^
main.c:7:22: error: variable-sized object may not be initialized except with an empty initializer
7 | int sum[MAX+2] = {0};
| ^
|
s353245156 | p00009 | C | #include <stdio.h>
const int MAX = 100000;
int main() {
int n, i, k;
int prime[MAX+1] = {0};
int sum[MAX+2] = {0};
for(i = 2; i <= MAX; i++) {
prime[i] = 1;
}
for(i = 2; i <= MAX; i++) {
if(prime[i]) {
for(k = 2*i; k <= MAX; k+=i) {
prime[k] = 0;
}
}
}
for(i = 0; i < MAX+1; i++) sum[i+1] = sum[i] + prime[i];
while(scanf("%d", &n) != EOF) {
printf("%d\n", sum[n+1]);
}
return 0;
} | main.c: In function 'main':
main.c:6:24: error: variable-sized object may not be initialized except with an empty initializer
6 | int prime[MAX+1] = {0};
| ^
main.c:7:22: error: variable-sized object may not be initialized except with an empty initializer
7 | int sum[MAX+2] = {0};
| ^
|
s636575247 | p00009 | C | #include <stdio.h>
const int MAX_V = 10000;
int prime[MAX_V+1];
int main(){
int i, k, v;
for(i = 2; i <= MAX_V; i++) prime[i] = 1;
for(i = 2; i <= MAX_V; i++){
if(prime[i]){
for(k = 2 * i; k <= MAX_V; k += i){
prime[k] = 0;
}
}
}
while(scanf("%d", &v) != EOF) {
for(i = v; i >= 5; i--){
if(prime[i] && prime[i-2]) {
printf("%d %d\n", i-2, i);
break;
}
}
}
} | main.c:4:5: error: variably modified 'prime' at file scope
4 | int prime[MAX_V+1];
| ^~~~~
|
s936418410 | p00009 | C | #include <stdio.h>
int main(){
const int MAX_V = 10000;
int prime[MAX_V+1];
int i, k, v;
for(i = 2; i <= MAX_V; i++) prime[i] = 1;
for(i = 2; i <= MAX_V; i++){
if(prime[i]){
for(k = 2 * i; k <= MAX_V; k += i){
prime[k] = 0;
}
}
}
while(scanf("%d", &v) != EOF) {
for(i = v; i >= 5; i--){
if(prime[i] && prime[i-2]) {
printf("%d %d\n", i-2, i);
break;
}
}
}
} | main.c: In function 'main':
main.c:4:1: error: stray '\343' in program
4 | <U+3000><U+3000>const int MAX_V = 10000;
| ^~~~~~~~
main.c:4:3: error: stray '\343' in program
4 | <U+3000><U+3000>const int MAX_V = 10000;
| ^~~~~~~~
main.c:5:1: error: stray '\343' in program
5 | <U+3000><U+3000>int prime[MAX_V+1];
| ^~~~~~~~
main.c:5:3: error: stray '\343' in program
5 | <U+3000><U+3000>int prime[MAX_V+1];
| ^~~~~~~~
|
s194487565 | p00009 | C | #include <stdio.h>
const int MAX_V=1000000;
int prime[MAX_V+1];//1?´???°,0?´???°??§??????
int sum[MAX_V+1];
int main(){
int i,k,v;
for(i=2;i<=MAX_V;i++){
prime[i]=1;//2??\???????´???°??¨??????
}
for(i=2;i*i<=MAX_V;i++){
if(prime[i]){
for(k=2*i;k<=MAX_V;k+=i){
prime[k]=0;//?´???°???2?????\???????????°????´???°??§??????
}
}
}
for(i=0;i<MAX_V+1;i++){
sum[i+1]=sum[i]+prime[i];
}
while(scanf("%d",&v)!=EOF){
printf("%d\n",sum[v+1]);
}
return 0;
} | main.c:4:5: error: variably modified 'prime' at file scope
4 | int prime[MAX_V+1];//1?´???°,0?´???°??§??????
| ^~~~~
main.c:5:5: error: variably modified 'sum' at file scope
5 | int sum[MAX_V+1];
| ^~~
|
s855460941 | p00009 | C | #include <stdio.h>
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;
}
}
}
}
int isprime(int n){
return prime[n];
}
int main(){
init();
int num;
while(1){
int count=0;
scanf("%d", &num);
for(int i=2; i<=num; i++){
if(isprime(i)==1)
count++;
}
printf("%d\n", count);
}
return 0;
} | main.c:4:5: error: variably modified 'prime' at file scope
4 | int prime[MAX_V+1];
| ^~~~~
|
s594343646 | p00009 | C | #include <stdio.h>
const int MAX_V = 100000;
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;
}
}
}
}
int isprime(int n){
return prime[n];
}
int main(){
init();
int num;
while(scanf("%d", &num) != EOF){
int count=0;
for(int i=2; i<=num; i++){
if(isprime(i)==1)
count++;
}
printf("%d\n", count);
}
return 0;
} | main.c:4:5: error: variably modified 'prime' at file scope
4 | int prime[MAX_V+1];
| ^~~~~
|
s280408283 | p00009 | C | #include <stdio.h>
const int MAX_V = 1000000;
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;
}
}
}
}
int isprime(int n){
return prime[n];
}
int main(){
init();
int num;
while(scanf("%d", &num) != EOF){
int count=0;
for(int i=2; i<=num; i++){
if(isprime(i)==1)
count++;
}
printf("%d\n", count);
}
return 0;
} | main.c:4:5: error: variably modified 'prime' at file scope
4 | int prime[MAX_V+1];
| ^~~~~
|
s138709460 | p00009 | C | #include <stdio.h>
int main(){
int n, i, j;
int prime[10001] = {0};
int cnt[10002] = {0};
for(i = 2; i <= 10000; i++) {
prime[i] = 1;
}
for(i = 2; i*i <= 10000; i++) {
if(prime[i]) {
for(j = 2 * i; j <= 10000; j += i) {
prime[j] = 0;
}
}
}
for(i=0; i <= 10001; i++){
cnt[i+1] = cnt[i] + a[i];
}
while(scanf("%d", &n) != EOF){
printf("%d\n", cnt[n]);
}
return 0;
} | main.c: In function 'main':
main.c:18:25: error: 'a' undeclared (first use in this function)
18 | cnt[i+1] = cnt[i] + a[i];
| ^
main.c:18:25: note: each undeclared identifier is reported only once for each function it appears in
|
s571013870 | p00009 | C | #include<stdio.h>
#define MAX_V 1000000
int prime[MAX_V + 1];
int sum[MAX_V + 1];
int main(){
int n, i, k;
prime[0]=prime[1]=0;
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;
}
}
}
sum[0] = 0;
for(i = 0;i < MAX_V;i++){
sum[i+1] = sum[i]+prime[i+1];
}
while(scanf("%d", &n) == 1){
printf("%d\n", sum[n]);
}
printf("count = %d\n", count);
return 0;
} | main.c: In function 'main':
main.c:25:26: error: 'count' undeclared (first use in this function)
25 | printf("count = %d\n", count);
| ^~~~~
main.c:25:26: note: each undeclared identifier is reported only once for each function it appears in
|
s909730379 | p00009 | C | #include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<cstring>
#include<vector>
#include<stack>
#include<queue>
using namespace std;
#define up(i,j,k) for(int i=j;i<k;i++)
#define uup(i,j,k) for(int i=j;i>=k;i--)
#define mem(i,j) memset(i,j,sizeof i)
#define ll long long
#define mod(x) (x)%mod
#define sfi(i) scanf("%d",&i)
#define sfs(i) scanf("%s",i)
#define sfc(i) scanf("%c",&i)
#define sfd(i) scanf("%lf",&i)
#define sff(i) scanf("%f",&i)
#define sfl(i) scanf("%lld",&i)
#define whatis(i) cout<<"This is:"<<i<<endl;
#define setflag() cout<<"This is a flag!"<<endl;
const int N = 1e6 + 5;
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
const double PI = acos(-1.0);
const int MAX = 1e6 + 5;
int arr[MAX];
bool vis[MAX];
void Init_Prim()
{
arr[1] = 0;
up(i, 2, 1000000)
{
if (!vis[i])
{
arr[i] = arr[i - 1] + 1;
for (ll j = i; (ll)j*i <= 1000000;j++)
{
if (!vis[i*j])
vis[i*j] = true;
else
break;
}
}
else
arr[i] = arr[i - 1];
}
}
int main()
{
Init_Prim();
int n;
while (~sfi(n))
{
printf("%d\n", arr[n]);
}
return 0;
}
| main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s300685875 | p00009 | C | #include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <string>
#include <iostream>
#include <queue>
#include <stack>
#include <sstream>
#define ll long long
#define fre freopen("data.in", "r", stdin); freopen("data.out", "w", stdout)
using namespace std;
bool vis[1000000] = {false};
int res[1000000] = {0};
int main(int argc, char const *argv[])
{
for (int i = 2; i < 1000000; ++i) {
if (!vis[i]) res[i] = res[i - 1] + 1;
else res[i] = res[i - 1];
if (i > 1000) continue;
for (int j = i * i; j < 1000000; j += i) {
vis[j] = true;
}
}
int n;
while (scanf("%d", &n) != EOF) {
printf("%d\n", res[n]);
}
return 0;
}
| main.c:1:10: fatal error: cstdio: No such file or directory
1 | #include <cstdio>
| ^~~~~~~~
compilation terminated.
|
s923758933 | p00009 | C | #include<iostream>
#include<cmath>
using namespace std;
int jj[1000000];
int jud(int n){
int i;
for (i=2;i<=sqrt(n);i++)
if (n%i==0)
return 0;
return 1;
}
int main(){
int n,i,j,res;
while (cin>>n){
res=0;
for (i=0;i<1000000;i++)
jj[i]=1;
for (i=2;i<=n;i++){
if (jj[i]){
if(jud(i)){
res++;
for (j=i*i;j<1000000;j+=i)
jj[j]=0;
}
}
}
cout<<res<<endl;
}
return 0;
}
| main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s906879411 | p00009 | C | #include<iostream>
using namespace std;
int a[1000000];
void prime()
{
int i;
for(i=0;i<1000000;i++)
a[i]=1;
for(i=2;i<1000;i++) //一定被最小素数因子消去;
{
if(a[i])
{
for(int j=i*i;j<1000000;j+=i)
a[j]=0;
}
}
a[1]=0;
for(i=2;i<1000000;i++)
a[i]=a[i-1]+a[i]; //a[i]表示到当前数时素数的个数;
}
int main()
{
int n;
prime();
while(cin>>n)
{
cout<<a[n]<<endl;
}
return 0;
}
| main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s069407988 | p00009 | C | #include<stdio.h>
#define MAX 999999
int isPrime(int n)
int main(void){
int a,i;
int prime[MAX];
for(i=0;i<=MAX;i++)
prime[i]=isPrime(i);
for(i=1;i<MAX;i++)
prime[i]+=prime[i-1];
while(scanf("%d",&a)!=EOF){
printf("%d\n",prime[a]);
}
return 0;
}
int isPrime(int n){
int i;
if(n<2) return 0;
if(n==2) return 1;
if(n%2==0) return 0;
for(i=3;i*i<=n;i+=2)
if(n%i==0) return 0;
return 1;
}
| main.c: In function 'isPrime':
main.c:4:15: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
4 | int main(void){
| ^
main.c:17:19: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
17 | int isPrime(int n){
| ^
main.c:26: error: expected '{' at end of input
|
s130071635 | 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++) {
if(n % i == 0) {
return false;
}
}
return true;
}
}
}
cout << count << endl;
return 0;
}
| main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s869865715 | p00009 | C | #include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<stack>
#include<vector>
#include<queue>
#include<set>
using namespace std;
#define N 1000000
typedef long long ll;
int a[N],isprime[N],sum[N];
void prime()
{
int k=0;
memset(isprime,0,sizeof(isprime));
for(int i=2; i<N; i++)
{
if(!isprime[i])
a[k++]=i;
for(int j=0; j<k&&i*a[j]<N; j++)
{
isprime[i*a[j]]=1;
if(i%a[j]==0)
break;
}
}
}
int main()
{
prime();
memset(sum,0,sizeof(sum));
for(int i=2;i<N;i++){
sum[i]=sum[i-1];
if(!isprime[i])
sum[i]++;
}
int n;
while(scanf("%d",&n)!=EOF){
printf("%d\n",sum[n]);
}
return 0;
}
| main.c:1:9: fatal error: cstdio: No such file or directory
1 | #include<cstdio>
| ^~~~~~~~
compilation terminated.
|
s465210445 | p00009 | C | #include <math.h>
#include <stdio.h>
int primenumber(int);
int main(){
int a[200],t[200],i,j;
for(i=0;scanf("%d",&a[i]) != EOF;i++){
t[i] = 0;
while(a[i] > 1){
if(primenumber(a[i]) == 1){
t[i] = t[i]+1;
}
a[i]--;
}
}
for(j = 0;j < i;j++){
printf("%d\n",t[j]);
}
return 0;
}
int primenumber(int num){
if(num == 2) return 1;
if(num % 2 == 0) return 0;
for(int k = 2;k < i;k++){
if(num % k == 0){
return 0;
}
}
return 1;
}
| main.c: In function 'primenumber':
main.c:23:23: error: 'i' undeclared (first use in this function)
23 | for(int k = 2;k < i;k++){
| ^
main.c:23:23: note: each undeclared identifier is reported only once for each function it appears in
|
s190334987 | p00009 | C | #include <math.h>
#include <stdio.h>
int primenumber(int);
int main(){
int a[200],t[200],i,j;
for(i=0;scanf("%d",&a[i]) != EOF;i++){
t[i] = 0;
while(a[i] > 1){
if(primenumber(a[i]) == 1){
t[i] = t[i]+1;
}
a[i]--;
}
}
for(j = 0;j < i;j++){
printf("%d\n",t[j]);
}
getch();
return 0;
}
int primenumber(int num){
if(num == 2) return 1;
if(num % 2 == 0) return 0;
for(int k = 2;k < i;k++){
if(num % k == 0){
return 0;
}
}
return 1;
}
| main.c: In function 'main':
main.c:18:9: error: implicit declaration of function 'getch'; did you mean 'getc'? [-Wimplicit-function-declaration]
18 | getch();
| ^~~~~
| getc
main.c: In function 'primenumber':
main.c:24:23: error: 'i' undeclared (first use in this function)
24 | for(int k = 2;k < i;k++){
| ^
main.c:24:23: note: each undeclared identifier is reported only once for each function it appears in
|
s489748927 | p00009 | C | #include <math.h>
#include <stdio.h>
int primenumber(int);
int main(){
int a[200],t[200],i,j;
for(i=0;scanf("%d",&a[i]) != EOF;i++){
t[i] = 0;
while(a[i] > 1){
if(primenumber(a[i]) == 1){
t[i] = t[i]+1;
}
a[i]--;
}
}
for(j = 0;j < i;j++){
printf("%d\n",t[j]);
}
return 0;
}
int primenumber(int num){
if(num == 2) return 1;
if(num % 2 == 0) return 0;
for(int k = 2;k < i;k++){
if(num % k == 0){
return 0;
}
}
return 1;
}
| main.c: In function 'primenumber':
main.c:23:23: error: 'i' undeclared (first use in this function)
23 | for(int k = 2;k < i;k++){
| ^
main.c:23:23: note: each undeclared identifier is reported only once for each function it appears in
|
s671293668 | p00009 | C | #include<stdio.h>
int main()
{
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; }
}
| main.c:19:1: error: expected identifier or '(' before '}' token
19 | }
| ^
|
s314730457 | p00009 | C | #include <stdio.h>
int main()
{
int n ,i, j;
while(scanf("%d",&n);!=EOF){
int count=0;
int flag;
for( i=2;i<=n;++i ) {
flag = 0;
for( j=2;j<i;++j ){
if( i%j==0 ) {
flag = 1;
break;
}
}
if( flag==0 )
count++;
}
printf("%d",count);
}
return 0;
}
| main.c: In function 'main':
main.c:5:23: error: expected ')' before ';' token
5 | while(scanf("%d",&n);!=EOF){
| ~ ^
| )
|
s203521949 | p00009 | C | #include <stdio.h>
int main()
{
int n ,i, j;
while(scanf("%d",&n);!=EOF){
int count=0;
int flag;
for( i=2;i<=n;++i ) {
flag = 0;
for( j=2;j<i;++j ){
if( i%j==0 ) {
flag = 1;
break;
}
}
if( flag==0 )
count++;
}
printf("%d",count);
}}
return 0;
}
| main.c: In function 'main':
main.c:5:23: error: expected ')' before ';' token
5 | while(scanf("%d",&n);!=EOF){
| ~ ^
| )
main.c: At top level:
main.c:21:3: error: expected identifier or '(' before 'return'
21 | return 0;
| ^~~~~~
main.c:22:1: error: expected identifier or '(' before '}' token
22 | }
| ^
|
s287513701 | p00009 | C | include<stdio.h>
int main(void){
int p[1000000],n,count;
while(scanf("%d",&n)!=EOF){
for(int i=0;i<=n;i++)p[i]=0;
count=0;
for(int i=2;i<=n;i++){
if(p[i]==0){
count++;
for(int j=1;i*j<=n;j++){
p[i*j]=1;
}
}
}
printf("%d\n",count);
}
return 0;
}
| main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
1 | include<stdio.h>
| ^
|
s968147931 | p00009 | C | #include <stdio.h>
#include <math.h>
unsigned long long calc_pow(int a, unsigned k, unsigned n);
int suspect(int b, unsigned n);
int prime_test(unsigned n);
int main(){
unsigned int n,i,c;
while (scanf("%d",&n) != EOF){
c = 0;
for(i=1;i <= n;i++){
if(Prime(i) == 1) c++;
}
printf("%d\n",c);
}
return 0;
}
unsigned long long calc_pow(int a, unsigned k, unsigned n)
{
unsigned long long p;
unsigned bit;
p = 1;
for (bit = 0x80000000U; bit > 0; bit >>= 1) {
if (p > 1) p = (p*p) % n;
if (k & bit) p = (p*a) % n;
}
return p;
}
int suspect(int b, unsigned n)
{
unsigned i;
unsigned t, u;
unsigned long long x0, x1;
u = n-1;
t = 0;
while ((u & 1) == 0) {
t++;
u >>= 1;
}
x0 = calc_pow(b, u, n);
for (i = 1; i <= t; i++) {
x1 = (x0*x0) % n;
if (x1 == 1 && x0 != 1 && x0 != n-1) return 0;
x0 = x1;
}
return x1 == 1;
}
int prime_test(unsigned n)
{
if (n <= 1) return 0; /* 0, 1 */
if (n == 2) return 1; /* 2 */
if (n == 3) return 1; /* 3 */
if ((n & 1) == 0) return 0; /* other even integers */
if (n <= 1000000) {
if (!suspect(2, n)) return 0;
if (!suspect(3, n)) return 0;
} else {
if (!suspect(2, n)) return 0;
if (!suspect(7, n)) return 0;
if (!suspect(61, n)) return 0;
}
return 1;
} | main.c: In function 'main':
main.c:12:10: error: implicit declaration of function 'Prime' [-Wimplicit-function-declaration]
12 | if(Prime(i) == 1) c++;
| ^~~~~
|
s968519286 | p00009 | C | #include <stdio.h>
int main(){
int n,i,j,f,c,p[168];
while (scanf("%d",&n) != EOF){
c = 0;
p[c++] = 2;
p[c++] = 3;
for(i=5;i<=n;i += 2){
f = 0;
for(j = 1;p[j]*p[j] <= i;j++){
if(i % prime[j] == 0){f = 1;break;}
}
if(!f) p[c++] = i;
}
printf("%d\n",c);
}
return 0;
} | main.c: In function 'main':
main.c:13:15: error: 'prime' undeclared (first use in this function)
13 | if(i % prime[j] == 0){f = 1;break;}
| ^~~~~
main.c:13:15: note: each undeclared identifier is reported only once for each function it appears in
|
s072497407 | p00009 | C | #include <stdio.h>
int main(){
int n,i,j,f,c,p[168];
while(scanf("%d",&n)){
if(n == 1) printf("0\n");
else if(n == 2)ツ printf("1\n");
else{
c = 0;
p[c++] = 2;
p[c++] = 3;
for(i=5;i<=n;i += 2){
f = 0;
for(j = 1;p[j]*p[j] <= i;j++){
if(i % p[j] == 0){f = 1;break;}
}
if(f==0){c++;if(i <= 1000) p[c-1] = i;}
}
printf("%d\n",c);
}
}
return 0;
} | main.c: In function 'main':
main.c:8:22: error: stray '\343' in program
8 | else if(n == 2)<U+30C4><U+3000>printf("1\n");
| ^~~~~~~~
main.c:8:20: error: '\U000030c4' undeclared (first use in this function)
8 | else if(n == 2)ツ printf("1\n");
| ^~
main.c:8:20: note: each undeclared identifier is reported only once for each function it appears in
main.c:8:22: error: expected ';' before 'printf'
8 | else if(n == 2)ツ printf("1\n");
| ^ ~~~~~~
| ;
|
s006967728 | p00009 | C | #include <stdio.h>
int main(){
int n,i,j,f,c,p[168];
while(scanf("%d",&n) != EOF){
if(n == 1) printf("0\n");
else if(n == 2)ツ printf("1\n");
else{
c = 0;
p[c++] = 2;
p[c++] = 3;
for(i=5;i<=n;i += 2){
f = 0;
for(j = 1;p[j]*p[j] <= i;j++){
if(i % p[j] == 0){f = 1;break;}
}
if(f==0){c++;if(i <= 1000) p[c-1] = i;}
}
printf("%d\n",c);
}
}
return 0;
} | main.c: In function 'main':
main.c:8:22: error: stray '\343' in program
8 | else if(n == 2)<U+30C4><U+3000>printf("1\n");
| ^~~~~~~~
main.c:8:20: error: '\U000030c4' undeclared (first use in this function)
8 | else if(n == 2)ツ printf("1\n");
| ^~
main.c:8:20: note: each undeclared identifier is reported only once for each function it appears in
main.c:8:22: error: expected ';' before 'printf'
8 | else if(n == 2)ツ printf("1\n");
| ^ ~~~~~~
| ;
|
s522775009 | p00009 | C | #include<stdio.h>
#include<math.h>
#define MAX 1000000
int main(){
int p[MAX],a,k=0;
memset(p, 1, sizeof(p));
p[0] = 0;
p[1] = 0;
for (int i=2; i<sqrt(MAX)+1; i++)
if (p[i])
for (int j=i*2; j<MAX; j+=i)
p[j] = 0;
scanf("%d",&a);
while(a>p[k++]){
}
printf("%d\n",k-1);
return 0;
} | main.c: In function 'main':
main.c:6:1: error: implicit declaration of function 'memset' [-Wimplicit-function-declaration]
6 | memset(p, 1, sizeof(p));
| ^~~~~~
main.c:3:1: note: include '<string.h>' or provide a declaration of 'memset'
2 | #include<math.h>
+++ |+#include <string.h>
3 | #define MAX 1000000
main.c:6:1: warning: incompatible implicit declaration of built-in function 'memset' [-Wbuiltin-declaration-mismatch]
6 | memset(p, 1, sizeof(p));
| ^~~~~~
main.c:6:1: note: include '<string.h>' or provide a declaration of 'memset'
|
s526405052 | p00009 | C | #include<stdio.h>
#include<math.h>
#define MAX 1000000
int main(){
int p[MAX],a,k=0;
memset(p, 1, sizeof(p));
p[0] = 0;
p[1] = 0;
for(int i=2; i<sqrt(MAX)+1; i++)
if (p[i])
for(int j=i*2; j<MAX; j+=i)
p[j] = 0;
scanf("%d",&a);
while(a>p[k++]){
}
printf("%d\n",k-1);
return 0;
} | main.c: In function 'main':
main.c:6:1: error: implicit declaration of function 'memset' [-Wimplicit-function-declaration]
6 | memset(p, 1, sizeof(p));
| ^~~~~~
main.c:3:1: note: include '<string.h>' or provide a declaration of 'memset'
2 | #include<math.h>
+++ |+#include <string.h>
3 | #define MAX 1000000
main.c:6:1: warning: incompatible implicit declaration of built-in function 'memset' [-Wbuiltin-declaration-mismatch]
6 | memset(p, 1, sizeof(p));
| ^~~~~~
main.c:6:1: note: include '<string.h>' or provide a declaration of 'memset'
|
s805175136 | p00009 | C | #define z 1000000 main(){int a[z]={},b[z]={},n,i,x=0,c;for(i=2;i<z;i++)a[i]=i;for(i=0;i<z;i++)if(a[i]!=0){b[x++]=i;for(c=i;c<z;c+=i)a[c]=0;}while(scanf("%d",&n)!=-1){c=0;while(b[c]<=n && b[c]!=0){c++;}printf("%d\n",c);}return 0;} | /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s630756808 | p00009 | C | #define z 1000000
a[z],b[z],n,i=1,x,c;main(){for(;i++<z;)a[i]=i;for(i=-1;i++<z;)if(a[i]){b[x++]=i;for(c=i;c<z;c+=i)a[c]=0;}for(;~scanf("%d",&n);c=0)while(b[c]<=n && b[c])c++;printf("%d\n",c);}exit(0);} | main.c:2:1: warning: data definition has no type or storage class
2 | a[z],b[z],n,i=1,x,c;main(){for(;i++<z;)a[i]=i;for(i=-1;i++<z;)if(a[i]){b[x++]=i;for(c=i;c<z;c+=i)a[c]=0;}for(;~scanf("%d",&n);c=0)while(b[c]<=n && b[c])c++;printf("%d\n",c);}exit(0);}
| ^
main.c:2:1: error: type defaults to 'int' in declaration of 'a' [-Wimplicit-int]
main.c:2:6: error: type defaults to 'int' in declaration of 'b' [-Wimplicit-int]
2 | a[z],b[z],n,i=1,x,c;main(){for(;i++<z;)a[i]=i;for(i=-1;i++<z;)if(a[i]){b[x++]=i;for(c=i;c<z;c+=i)a[c]=0;}for(;~scanf("%d",&n);c=0)while(b[c]<=n && b[c])c++;printf("%d\n",c);}exit(0);}
| ^
main.c:2:11: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
2 | a[z],b[z],n,i=1,x,c;main(){for(;i++<z;)a[i]=i;for(i=-1;i++<z;)if(a[i]){b[x++]=i;for(c=i;c<z;c+=i)a[c]=0;}for(;~scanf("%d",&n);c=0)while(b[c]<=n && b[c])c++;printf("%d\n",c);}exit(0);}
| ^
main.c:2:13: error: type defaults to 'int' in declaration of 'i' [-Wimplicit-int]
2 | a[z],b[z],n,i=1,x,c;main(){for(;i++<z;)a[i]=i;for(i=-1;i++<z;)if(a[i]){b[x++]=i;for(c=i;c<z;c+=i)a[c]=0;}for(;~scanf("%d",&n);c=0)while(b[c]<=n && b[c])c++;printf("%d\n",c);}exit(0);}
| ^
main.c:2:17: error: type defaults to 'int' in declaration of 'x' [-Wimplicit-int]
2 | a[z],b[z],n,i=1,x,c;main(){for(;i++<z;)a[i]=i;for(i=-1;i++<z;)if(a[i]){b[x++]=i;for(c=i;c<z;c+=i)a[c]=0;}for(;~scanf("%d",&n);c=0)while(b[c]<=n && b[c])c++;printf("%d\n",c);}exit(0);}
| ^
main.c:2:19: error: type defaults to 'int' in declaration of 'c' [-Wimplicit-int]
2 | a[z],b[z],n,i=1,x,c;main(){for(;i++<z;)a[i]=i;for(i=-1;i++<z;)if(a[i]){b[x++]=i;for(c=i;c<z;c+=i)a[c]=0;}for(;~scanf("%d",&n);c=0)while(b[c]<=n && b[c])c++;printf("%d\n",c);}exit(0);}
| ^
main.c:2:21: error: return type defaults to 'int' [-Wimplicit-int]
2 | a[z],b[z],n,i=1,x,c;main(){for(;i++<z;)a[i]=i;for(i=-1;i++<z;)if(a[i]){b[x++]=i;for(c=i;c<z;c+=i)a[c]=0;}for(;~scanf("%d",&n);c=0)while(b[c]<=n && b[c])c++;printf("%d\n",c);}exit(0);}
| ^~~~
main.c: In function 'main':
main.c:2:112: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
2 | a[z],b[z],n,i=1,x,c;main(){for(;i++<z;)a[i]=i;for(i=-1;i++<z;)if(a[i]){b[x++]=i;for(c=i;c<z;c+=i)a[c]=0;}for(;~scanf("%d",&n);c=0)while(b[c]<=n && b[c])c++;printf("%d\n",c);}exit(0);}
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | #define z 1000000
main.c:2:112: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
2 | a[z],b[z],n,i=1,x,c;main(){for(;i++<z;)a[i]=i;for(i=-1;i++<z;)if(a[i]){b[x++]=i;for(c=i;c<z;c+=i)a[c]=0;}for(;~scanf("%d",&n);c=0)while(b[c]<=n && b[c])c++;printf("%d\n",c);}exit(0);}
| ^~~~~
main.c:2:112: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:2:157: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
2 | a[z],b[z],n,i=1,x,c;main(){for(;i++<z;)a[i]=i;for(i=-1;i++<z;)if(a[i]){b[x++]=i;for(c=i;c<z;c+=i)a[c]=0;}for(;~scanf("%d",&n);c=0)while(b[c]<=n && b[c])c++;printf("%d\n",c);}exit(0);}
| ^~~~~~
main.c:2:157: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:2:157: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:2:157: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c: At top level:
main.c:2:180: error: expected declaration specifiers or '...' before numeric constant
2 | a[z],b[z],n,i=1,x,c;main(){for(;i++<z;)a[i]=i;for(i=-1;i++<z;)if(a[i]){b[x++]=i;for(c=i;c<z;c+=i)a[c]=0;}for(;~scanf("%d",&n);c=0)while(b[c]<=n && b[c])c++;printf("%d\n",c);}exit(0);}
| ^
main.c:2:183: error: expected identifier or '(' before '}' token
2 | a[z],b[z],n,i=1,x,c;main(){for(;i++<z;)a[i]=i;for(i=-1;i++<z;)if(a[i]){b[x++]=i;for(c=i;c<z;c+=i)a[c]=0;}for(;~scanf("%d",&n);c=0)while(b[c]<=n && b[c])c++;printf("%d\n",c);}exit(0);}
| ^
|
s290365910 | p00009 | C | ain(){
int i,j=2,k=0,n,r,s[78499];
s[k++]=j++;
for(;j<999984;j+=2){
r=(int)sqrt(j)+1;
for(i=3;i<r;i+=2)
if(j%i==0){
r=0;
break;
}
if(r)
s[k++]=j;
}
s[78498]=1000000;
while(scanf("%d",&n)!=-1){
for(i=0;s[i]<=n;i++);
printf("%d\n",i);
}
return 0;
} | main.c:1:1: error: return type defaults to 'int' [-Wimplicit-int]
1 | ain(){
| ^~~
main.c: In function 'ain':
main.c:5:12: error: implicit declaration of function 'sqrt' [-Wimplicit-function-declaration]
5 | r=(int)sqrt(j)+1;
| ^~~~
main.c:1:1: note: include '<math.h>' or provide a declaration of 'sqrt'
+++ |+#include <math.h>
1 | ain(){
main.c:5:12: warning: incompatible implicit declaration of built-in function 'sqrt' [-Wbuiltin-declaration-mismatch]
5 | r=(int)sqrt(j)+1;
| ^~~~
main.c:5:12: note: include '<math.h>' or provide a declaration of 'sqrt'
main.c:15:9: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
15 | while(scanf("%d",&n)!=-1){
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | ain(){
main.c:15:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
15 | while(scanf("%d",&n)!=-1){
| ^~~~~
main.c:15:9: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:17:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
17 | printf("%d\n",i);
| ^~~~~~
main.c:17:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:17:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:17:5: note: include '<stdio.h>' or provide a declaration of 'printf'
|
s589134342 | p00009 | C | include<stdio.h>
main(){
int n,i,l,sum,a;
while(scanf("%d",&n)!=EOF){
a=0;
for(i=2;i<=n;i++){
sum=0;
for(l=2;l<=n;l++){
if(i%l==0){
sum++;
}
}
if(sum==1){
a++;
}
}
printf("%d",a);
}
return 0;
} | main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
1 | include<stdio.h>
| ^
|
s314958947 | p00009 | C | #include<stdio.h>
int main(void){
int n, i, pn=0, su=0;
while(scanf("%d", &n); != EOF){
while(n>2){
for(i=2;i<n;i++){
if((n%i)==0){
su++;
}
}
if(su==0){
pn++;
}
n--;
su = 0;
}
if(n>=2){
pn++;
}
printf("%d\n",pn);
}
return 0;
} | main.c: In function 'main':
main.c:6:30: error: expected ')' before ';' token
6 | while(scanf("%d", &n); != EOF){
| ~ ^
| )
|
s370545364 | p00009 | C | #include<stdio.h>
#define MAX_N 1000000
int main(void){
int prime[MAX_N];
int n,p,i,j;
bool is_prime[MAX_N+1];
scanf("%d",&n);
p=0;
for(i=0;i<n;i++){
is_prime[i]=true; //f»èzñÌú»
}
is_prime[0]=is_prime[1]=false; //0Æ1ÍfÅÍÈ¢ÌÅ\ßæè
for(i=2;i<=n;i++){
if(is_prime[i]){
prime[p++]=i;
for(j=2*i;j<=n;j=j+i){
is_prime[j]=false;
}
}
}
printf("%d\n",p);
} | main.c: In function 'main':
main.c:7:9: error: unknown type name 'bool'
7 | bool is_prime[MAX_N+1];
| ^~~~
main.c:2:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
1 | #include<stdio.h>
+++ |+#include <stdbool.h>
2 | #define MAX_N 1000000
main.c:14:29: error: 'true' undeclared (first use in this function)
14 | is_prime[i]=true; //f»èzñÌú»
| ^~~~
main.c:14:29: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c:14:29: note: each undeclared identifier is reported only once for each function it appears in
main.c:17:33: error: 'false' undeclared (first use in this function)
17 | is_prime[0]=is_prime[1]=false; //0Æ1ÍfÅÍÈ¢ÌÅ\ßæè
| ^~~~~
main.c:17:33: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
|
s615576212 | p00009 | C | #include<stdio.h>
#define MAX_N 100000
int main(void){
int prime[MAX_N];
int n,p,i,j;
bool is_prime[MAX_N+1];
scanf("%d",&n);
p=0;
for(i=0;i<n;i++){
is_prime[i]=true; //f»èzñÌú»
}
is_prime[0]=is_prime[1]=false; //0Æ1ÍfÅÍÈ¢ÌÅ\ßæè
for(i=2;i<=n;i++){
if(is_prime[i]){
prime[p++]=i;
for(j=2*i;j<=n;j=j+i){
is_prime[j]=false;
}
}
}
printf("%d\n",p);
return 0;
} | main.c: In function 'main':
main.c:7:9: error: unknown type name 'bool'
7 | bool is_prime[MAX_N+1];
| ^~~~
main.c:2:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
1 | #include<stdio.h>
+++ |+#include <stdbool.h>
2 | #define MAX_N 100000
main.c:14:29: error: 'true' undeclared (first use in this function)
14 | is_prime[i]=true; //f»èzñÌú»
| ^~~~
main.c:14:29: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c:14:29: note: each undeclared identifier is reported only once for each function it appears in
main.c:17:33: error: 'false' undeclared (first use in this function)
17 | is_prime[0]=is_prime[1]=false; //0Æ1ÍfÅÍÈ¢ÌÅ\ßæè
| ^~~~~
main.c:17:33: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
|
s165203530 | p00009 | C | #include<stdio.h>
#define MAX_N 100000
int main(void){
int prime[MAX_N];
int n,p,i,j;
bool is_prime[MAX_N+1];
while(scanf("%d",&n)!=EOF){
p=0;
for(i=0;i<n;i++){
is_prime[i]=true; //f»èzñÌú»
}
is_prime[0]=is_prime[1]=false; //0Æ1ÍfÅÍÈ¢ÌÅ\ßæè
for(i=2;i<=n;i++){
if(is_prime[i]){
prime[p++]=i;
for(j=2*i;j<=n;j=j+i){
is_prime[j]=false;
}
}
}
printf("%d\n",p);
}
return 0;
} | main.c: In function 'main':
main.c:7:9: error: unknown type name 'bool'
7 | bool is_prime[MAX_N+1];
| ^~~~
main.c:2:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
1 | #include<stdio.h>
+++ |+#include <stdbool.h>
2 | #define MAX_N 100000
main.c:14:37: error: 'true' undeclared (first use in this function)
14 | is_prime[i]=true; //f»èzñÌú»
| ^~~~
main.c:14:37: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c:14:37: note: each undeclared identifier is reported only once for each function it appears in
main.c:17:41: error: 'false' undeclared (first use in this function)
17 | is_prime[0]=is_prime[1]=false; //0Æ1ÍfÅÍÈ¢ÌÅ\ßæè
| ^~~~~
main.c:17:41: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
|
s396808475 | p00009 | C | j,a[' '],s,z=1e6;main(i){for(;++i<998;)for(j=i*i;!a[i]&&a[j]=j<z;j+=i);for(i=1;++i<z||~scanf(s="%d\n",&j)&&printf(s,a[j]);a[i]=s+=!a[i]);} | main.c:1:1: warning: data definition has no type or storage class
1 | j,a[' '],s,z=1e6;main(i){for(;++i<998;)for(j=i*i;!a[i]&&a[j]=j<z;j+=i);for(i=1;++i<z||~scanf(s="%d\n",&j)&&printf(s,a[j]);a[i]=s+=!a[i]);}
| ^
main.c:1:1: error: type defaults to 'int' in declaration of 'j' [-Wimplicit-int]
main.c:1:5: warning: multi-character character constant [-Wmultichar]
1 | j,a[' '],s,z=1e6;main(i){for(;++i<998;)for(j=i*i;!a[i]&&a[j]=j<z;j+=i);for(i=1;++i<z||~scanf(s="%d\n",&j)&&printf(s,a[j]);a[i]=s+=!a[i]);}
| ^~~~~
main.c:1:3: error: type defaults to 'int' in declaration of 'a' [-Wimplicit-int]
1 | j,a[' '],s,z=1e6;main(i){for(;++i<998;)for(j=i*i;!a[i]&&a[j]=j<z;j+=i);for(i=1;++i<z||~scanf(s="%d\n",&j)&&printf(s,a[j]);a[i]=s+=!a[i]);}
| ^
main.c:1:12: error: type defaults to 'int' in declaration of 's' [-Wimplicit-int]
1 | j,a[' '],s,z=1e6;main(i){for(;++i<998;)for(j=i*i;!a[i]&&a[j]=j<z;j+=i);for(i=1;++i<z||~scanf(s="%d\n",&j)&&printf(s,a[j]);a[i]=s+=!a[i]);}
| ^
main.c:1:14: error: type defaults to 'int' in declaration of 'z' [-Wimplicit-int]
1 | j,a[' '],s,z=1e6;main(i){for(;++i<998;)for(j=i*i;!a[i]&&a[j]=j<z;j+=i);for(i=1;++i<z||~scanf(s="%d\n",&j)&&printf(s,a[j]);a[i]=s+=!a[i]);}
| ^
main.c:1:20: error: return type defaults to 'int' [-Wimplicit-int]
1 | j,a[' '],s,z=1e6;main(i){for(;++i<998;)for(j=i*i;!a[i]&&a[j]=j<z;j+=i);for(i=1;++i<z||~scanf(s="%d\n",&j)&&printf(s,a[j]);a[i]=s+=!a[i]);}
| ^~~~
main.c: In function 'main':
main.c:1:20: error: type of 'i' defaults to 'int' [-Wimplicit-int]
main.c:1:63: error: lvalue required as left operand of assignment
1 | j,a[' '],s,z=1e6;main(i){for(;++i<998;)for(j=i*i;!a[i]&&a[j]=j<z;j+=i);for(i=1;++i<z||~scanf(s="%d\n",&j)&&printf(s,a[j]);a[i]=s+=!a[i]);}
| ^
main.c:1:90: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
1 | j,a[' '],s,z=1e6;main(i){for(;++i<998;)for(j=i*i;!a[i]&&a[j]=j<z;j+=i);for(i=1;++i<z||~scanf(s="%d\n",&j)&&printf(s,a[j]);a[i]=s+=!a[i]);}
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | j,a[' '],s,z=1e6;main(i){for(;++i<998;)for(j=i*i;!a[i]&&a[j]=j<z;j+=i);for(i=1;++i<z||~scanf(s="%d\n",&j)&&printf(s,a[j]);a[i]=s+=!a[i]);}
main.c:1:90: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
1 | j,a[' '],s,z=1e6;main(i){for(;++i<998;)for(j=i*i;!a[i]&&a[j]=j<z;j+=i);for(i=1;++i<z||~scanf(s="%d\n",&j)&&printf(s,a[j]);a[i]=s+=!a[i]);}
| ^~~~~
main.c:1:90: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:97: error: assignment to 'int' from 'char *' makes integer from pointer without a cast [-Wint-conversion]
1 | j,a[' '],s,z=1e6;main(i){for(;++i<998;)for(j=i*i;!a[i]&&a[j]=j<z;j+=i);for(i=1;++i<z||~scanf(s="%d\n",&j)&&printf(s,a[j]);a[i]=s+=!a[i]);}
| ^
main.c:1:97: error: passing argument 1 of 'scanf' makes pointer from integer without a cast [-Wint-conversion]
1 | j,a[' '],s,z=1e6;main(i){for(;++i<998;)for(j=i*i;!a[i]&&a[j]=j<z;j+=i);for(i=1;++i<z||~scanf(s="%d\n",&j)&&printf(s,a[j]);a[i]=s+=!a[i]);}
| ~^~~~~~~
| |
| int
main.c:1:97: note: expected 'const char *' but argument is of type 'int'
main.c:1:110: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
1 | j,a[' '],s,z=1e6;main(i){for(;++i<998;)for(j=i*i;!a[i]&&a[j]=j<z;j+=i);for(i=1;++i<z||~scanf(s="%d\n",&j)&&printf(s,a[j]);a[i]=s+=!a[i]);}
| ^~~~~~
main.c:1:110: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:110: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:1:110: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:117: error: passing argument 1 of 'printf' makes pointer from integer without a cast [-Wint-conversion]
1 | j,a[' '],s,z=1e6;main(i){for(;++i<998;)for(j=i*i;!a[i]&&a[j]=j<z;j+=i);for(i=1;++i<z||~scanf(s="%d\n",&j)&&printf(s,a[j]);a[i]=s+=!a[i]);}
| ^
| |
| int
main.c:1:117: note: expected 'const char *' but argument is of type 'int'
|
s675036546 | p00009 | C | #include<stdio.h>
#include<math.h>
int main(){
int a[80000],n,i,j,ans=0,temp=0;
a[0]=2;
while(scanf("%d",&n)!=EOF){
if (a[n-1] > n){
for(int i=0; ; i++){
if(a[i] > n){
ans = i;
break;
}
}
}else{
temp=0
for(i=a[num-1]+1 ; i<=n ; i++){
for (j=0 ; a[j]*a[j] <= i ; j++){
if(i % a[j] == 0){
temp=1;
break;
}
}
if(temp==1){
a[ans] = i;
ans++;
}
}
}
printf("%dn",ans);
}
return 0;
} | main.c: In function 'main':
main.c:16:31: error: expected ';' before 'for'
16 | temp=0
| ^
| ;
17 | for(i=a[num-1]+1 ; i<=n ; i++){
| ~~~
|
s628108449 | p00009 | C | #include<stdio.h>
#include<math.h>
int main(){
int a[80000],n,i,j,ans=0,temp=0;
a[0]=2;
while(scanf("%d",&n)!=EOF){
if (a[n-1] > n){
for(int i=0; 1=1 ; i++){
if(a[i] > n){
ans = i;
break;
}
}
}else{
temp=0
for(i=a[num-1]+1 ; i<=n ; i++){
for (j=0 ; a[j]*a[j] <= i ; j++){
if(i % a[j] == 0){
temp=1;
break;
}
}
if(temp==1){
a[ans] = i;
ans++;
}
}
}
printf("%dn",ans);
}
return 0;
} | main.c: In function 'main':
main.c:9:39: error: lvalue required as left operand of assignment
9 | for(int i=0; 1=1 ; i++){
| ^
main.c:16:31: error: expected ';' before 'for'
16 | temp=0
| ^
| ;
17 | for(i=a[num-1]+1 ; i<=n ; i++){
| ~~~
|
s264871880 | p00009 | C | #include<stdio.h>
#include<math.h>
int main(){
int a[80000],n,i,j,ans=0,temp=0;
a[0]=2;
while(scanf("%d",&n)!=EOF){
if (a[n-1] > n){
for(i=0; i>-1 ; i++){
if(a[i] > n){
ans = i;
break;
}
}
}else{
temp=0;
for(i=a[num-1]+1 ; i<=n ; i++){
for (j=0 ; a[j]*a[j] <= i ; j++){
if(i % a[j] == 0){
temp=1;
break;
}
}
if(temp==1){
a[ans] = i;
ans++;
}
}
}
printf("%dn",ans);
}
return 0;
} | main.c: In function 'main':
main.c:17:33: error: 'num' undeclared (first use in this function)
17 | for(i=a[num-1]+1 ; i<=n ; i++){
| ^~~
main.c:17:33: note: each undeclared identifier is reported only once for each function it appears in
|
s710430247 | p00009 | C | s,n;main(j){for(;scanf("%d",&n)*n;printf("%d\n",s))for(s=n-1;j=n>1;--n)for(;++j*j>i?0:i%j?:!s--;);} | main.c:1:1: warning: data definition has no type or storage class
1 | s,n;main(j){for(;scanf("%d",&n)*n;printf("%d\n",s))for(s=n-1;j=n>1;--n)for(;++j*j>i?0:i%j?:!s--;);}
| ^
main.c:1:1: error: type defaults to 'int' in declaration of 's' [-Wimplicit-int]
main.c:1:3: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
1 | s,n;main(j){for(;scanf("%d",&n)*n;printf("%d\n",s))for(s=n-1;j=n>1;--n)for(;++j*j>i?0:i%j?:!s--;);}
| ^
main.c:1:5: error: return type defaults to 'int' [-Wimplicit-int]
1 | s,n;main(j){for(;scanf("%d",&n)*n;printf("%d\n",s))for(s=n-1;j=n>1;--n)for(;++j*j>i?0:i%j?:!s--;);}
| ^~~~
main.c: In function 'main':
main.c:1:5: error: type of 'j' defaults to 'int' [-Wimplicit-int]
main.c:1:18: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
1 | s,n;main(j){for(;scanf("%d",&n)*n;printf("%d\n",s))for(s=n-1;j=n>1;--n)for(;++j*j>i?0:i%j?:!s--;);}
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | s,n;main(j){for(;scanf("%d",&n)*n;printf("%d\n",s))for(s=n-1;j=n>1;--n)for(;++j*j>i?0:i%j?:!s--;);}
main.c:1:18: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
1 | s,n;main(j){for(;scanf("%d",&n)*n;printf("%d\n",s))for(s=n-1;j=n>1;--n)for(;++j*j>i?0:i%j?:!s--;);}
| ^~~~~
main.c:1:18: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:35: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
1 | s,n;main(j){for(;scanf("%d",&n)*n;printf("%d\n",s))for(s=n-1;j=n>1;--n)for(;++j*j>i?0:i%j?:!s--;);}
| ^~~~~~
main.c:1:35: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:35: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:1:35: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:83: error: 'i' undeclared (first use in this function)
1 | s,n;main(j){for(;scanf("%d",&n)*n;printf("%d\n",s))for(s=n-1;j=n>1;--n)for(;++j*j>i?0:i%j?:!s--;);}
| ^
main.c:1:83: note: each undeclared identifier is reported only once for each function it appears in
|
s069716745 | p00009 | C | j,a[' '];main(i){for(;++i<1e6||~scanf(j="%d\n",a)&&printf(s,a[*a]);)if(!a[i])for(a[j=i]=*a+=!a[i];j<1e6;a[j+=i]=1);} | main.c:1:1: warning: data definition has no type or storage class
1 | j,a[' '];main(i){for(;++i<1e6||~scanf(j="%d\n",a)&&printf(s,a[*a]);)if(!a[i])for(a[j=i]=*a+=!a[i];j<1e6;a[j+=i]=1);}
| ^
main.c:1:1: error: type defaults to 'int' in declaration of 'j' [-Wimplicit-int]
main.c:1:5: warning: multi-character character constant [-Wmultichar]
1 | j,a[' '];main(i){for(;++i<1e6||~scanf(j="%d\n",a)&&printf(s,a[*a]);)if(!a[i])for(a[j=i]=*a+=!a[i];j<1e6;a[j+=i]=1);}
| ^~~~~
main.c:1:3: error: type defaults to 'int' in declaration of 'a' [-Wimplicit-int]
1 | j,a[' '];main(i){for(;++i<1e6||~scanf(j="%d\n",a)&&printf(s,a[*a]);)if(!a[i])for(a[j=i]=*a+=!a[i];j<1e6;a[j+=i]=1);}
| ^
main.c:1:12: error: return type defaults to 'int' [-Wimplicit-int]
1 | j,a[' '];main(i){for(;++i<1e6||~scanf(j="%d\n",a)&&printf(s,a[*a]);)if(!a[i])for(a[j=i]=*a+=!a[i];j<1e6;a[j+=i]=1);}
| ^~~~
main.c: In function 'main':
main.c:1:12: error: type of 'i' defaults to 'int' [-Wimplicit-int]
main.c:1:35: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
1 | j,a[' '];main(i){for(;++i<1e6||~scanf(j="%d\n",a)&&printf(s,a[*a]);)if(!a[i])for(a[j=i]=*a+=!a[i];j<1e6;a[j+=i]=1);}
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | j,a[' '];main(i){for(;++i<1e6||~scanf(j="%d\n",a)&&printf(s,a[*a]);)if(!a[i])for(a[j=i]=*a+=!a[i];j<1e6;a[j+=i]=1);}
main.c:1:35: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
1 | j,a[' '];main(i){for(;++i<1e6||~scanf(j="%d\n",a)&&printf(s,a[*a]);)if(!a[i])for(a[j=i]=*a+=!a[i];j<1e6;a[j+=i]=1);}
| ^~~~~
main.c:1:35: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:42: error: assignment to 'int' from 'char *' makes integer from pointer without a cast [-Wint-conversion]
1 | j,a[' '];main(i){for(;++i<1e6||~scanf(j="%d\n",a)&&printf(s,a[*a]);)if(!a[i])for(a[j=i]=*a+=!a[i];j<1e6;a[j+=i]=1);}
| ^
main.c:1:42: error: passing argument 1 of 'scanf' makes pointer from integer without a cast [-Wint-conversion]
1 | j,a[' '];main(i){for(;++i<1e6||~scanf(j="%d\n",a)&&printf(s,a[*a]);)if(!a[i])for(a[j=i]=*a+=!a[i];j<1e6;a[j+=i]=1);}
| ~^~~~~~~
| |
| int
main.c:1:42: note: expected 'const char *' but argument is of type 'int'
main.c:1:54: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
1 | j,a[' '];main(i){for(;++i<1e6||~scanf(j="%d\n",a)&&printf(s,a[*a]);)if(!a[i])for(a[j=i]=*a+=!a[i];j<1e6;a[j+=i]=1);}
| ^~~~~~
main.c:1:54: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:54: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:1:54: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:61: error: 's' undeclared (first use in this function)
1 | j,a[' '];main(i){for(;++i<1e6||~scanf(j="%d\n",a)&&printf(s,a[*a]);)if(!a[i])for(a[j=i]=*a+=!a[i];j<1e6;a[j+=i]=1);}
| ^
main.c:1:61: note: each undeclared identifier is reported only once for each function it appears in
|
s544455590 | p00009 | C | #include <stdio.h>
#include <stdlib.h>
#define FALSE 0
#define TRUE 1
char flag[N +1];
int main (int argc, char* argv[])
{
int i, p, k, count, n;
while (scanf("%d", &n) != EOF) {
count = 1;
for (i=0; i<=n; i++) {
flag[i] = TRUE;
}
for (i=0; i<=n; i++) {
if (flag[i]) {
p = i + i + 3;
for (k=i+p; k<=n; k++) {
flag[k] = FALSE;
}
count++;
}
}
printf("%d\n", count);
}
return 0;
} | main.c:6:11: error: 'N' undeclared here (not in a function)
6 | char flag[N +1];
| ^
|
s918613619 | p00009 | C | #include<iostream>
using namespace std;
int main(){
bool num[1000000] = {0};
for(int i=2; i<1000000; i++){
if(!num[i]){
for(int j=i*2; j<=500000; j+=i){num[j] = true;}
}
}
int n;
while(cin >>n){
int f = 0;
for(int i=2; i<=n; i++){
if(!num[i]){f++;}
}
cout <<f<<endl;
}
} | main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s922724602 | p00009 | C | #include <iostream>
#include <cmath>
using namespace std;
int main(){
const int MAX_NUM=1000000;
int table[MAX_NUM]={};
for(int i=2;i<1001;i++){
if(table[i]==1)continue;
for(int j=i*2;j<MAX_NUM;j+=i){
table[j]=1;
}
}
int input;
while(cin>>input){
int count=0;
for(int i=2;i<input;i++){
//cout<<"table:"<<i<<"="<<table[i]<<"\n";
if(table[i]==0)count++;
}
cout<<count<<"\n";
}
return 0;
} | main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s641306846 | p00009 | C | #include<stdio.h>
int array[1000000];
int main(){
int n;
int i;
int j;
int result;
while(scanf("%d",&n)!=EOF){
result = 0;
for(i=1;i<n+1;i++){
array[i] = 1;
}
for(i=2;i<n+1;i++){
if(array[i]){
result += 1;
for(j=2;j<n/i+1;j++){
array[i*j] = 0;
}
}
}
printf("%d\n",result);
}
return 0;
} | main.c: In function 'main':
main.c:24:1: error: stray '\343' in program
24 | <U+3000><U+3000><U+3000><U+3000> return 0;
| ^~~~~~~~
main.c:24:3: error: stray '\343' in program
24 | <U+3000><U+3000><U+3000><U+3000> return 0;
| ^~~~~~~~
main.c:24:5: error: stray '\343' in program
24 | <U+3000><U+3000><U+3000><U+3000> return 0;
| ^~~~~~~~
main.c:24:7: error: stray '\343' in program
24 | <U+3000><U+3000><U+3000><U+3000> return 0;
| ^~~~~~~~
|
s769339095 | 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= 0;
for(f1 = 2; f1 >= n; f1++)
{
if(d[f1] == 1)
cnt++;
}
printf("%d\n",cnt);
}
return 0;
}
| main.c: In function 'main':
main.c:7:13: error: 'new' undeclared (first use in this function)
7 | d = new int [max];
| ^~~
main.c:7:13: note: each undeclared identifier is reported only once for each function it appears in
main.c:7:16: error: expected ';' before 'int'
7 | d = new int [max];
| ^~~~
| ;
main.c:8:29: error: expected expression before ';' token
8 | for(f1 = 0; f1 < max; f1++)
| ^
main.c:12:33: error: expected expression before ';' token
12 | for(f1 = 2; f1 *f1 < max; f1++)
| ^
main.c:16:50: error: expected expression before ';' token
16 | for(f2 = 2 * f1; f2 < max; f2 += f1)
| ^
|
s528383450 | p00009 | C | include<stdio.h>
#include<stdlib.h>
int main(void)
{
int *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;
}
}
printf("%d\n",cnt);
free(list);
}
return 0;
} | main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
1 | include<stdio.h>
| ^
In file included from main.c:2:
/usr/include/stdlib.h:98:8: error: unknown type name 'size_t'
98 | extern size_t __ctype_get_mb_cur_max (void) __THROW __wur;
| ^~~~~~
/usr/include/stdlib.h:57:1: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
56 | #include <bits/floatn.h>
+++ |+#include <stddef.h>
57 |
/usr/include/stdlib.h:531:25: error: unknown type name 'size_t'
531 | size_t __statelen) __THROW __nonnull ((2));
| ^~~~~~
/usr/include/stdlib.h:531:25: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:561:25: error: unknown type name 'size_t'
561 | size_t __statelen,
| ^~~~~~
/usr/include/stdlib.h:561:25: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:661:42: error: unknown type name 'size_t'
661 | extern void arc4random_buf (void *__buf, size_t __size)
| ^~~~~~
/usr/include/stdlib.h:661:42: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:672:22: error: unknown type name 'size_t'
672 | extern void *malloc (size_t __size) __THROW __attribute_malloc__
| ^~~~~~
/usr/include/stdlib.h:672:22: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:675:22: error: unknown type name 'size_t'
675 | extern void *calloc (size_t __nmemb, size_t __size)
| ^~~~~~
/usr/include/stdlib.h:675:22: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:675:38: error: unknown type name 'size_t'
675 | extern void *calloc (size_t __nmemb, size_t __size)
| ^~~~~~
/usr/include/stdlib.h:675:38: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:683:36: error: unknown type name 'size_t'
683 | extern void *realloc (void *__ptr, size_t __size)
| ^~~~~~
/usr/include/stdlib.h:683:36: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:695:41: error: unknown type name 'size_t'
695 | extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size)
| ^~~~~~
/usr/include/stdlib.h:695:41: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:695:57: error: unknown type name 'size_t'
695 | extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size)
| ^~~~~~
/usr/include/stdlib.h:695:57: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:701:41: error: unknown type name 'size_t'
701 | extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size)
| ^~~~~~
/usr/include/stdlib.h:701:41: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:701:57: error: unknown type name 'size_t'
701 | extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size)
| ^~~~~~
/usr/include/stdlib.h:701:57: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
In file included from /usr/include/stdlib.h:706:
/usr/include/alloca.h:32:22: error: unknown type name 'size_t'
32 | extern void *alloca (size_t __size) __THROW;
| ^~~~~~
/usr/include/alloca.h:25:1: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
24 | #include <stddef.h>
+++ |+#include <stddef.h>
25 |
/usr/include/stdlib.h:712:22: error: unknown type name 'size_t'
712 | extern void *valloc (size_t __size) __THROW __attribute_malloc__
| ^~~~~~
/usr/include/stdlib.h:712:22: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:718:45: error: unknown type name 'size_t'
718 | extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size)
| ^~~~~~
/usr/include/stdlib.h:718:45: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:718:65: error: unknown type name 'size_t'
718 | extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size)
| ^~~~~~
/usr/include/stdlib.h:718:65: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:724:29: error: unknown type name 'size_t'
724 | extern void *aligned_alloc (size_t __alignment, size_t __size)
| ^~~~~~
/usr/include/stdlib.h:724:29: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:724:49: error: unknown type name 'size_t'
724 | extern void *aligned_alloc (size_t __alignment, size_t __size)
| ^~~~~~
/usr/include/stdlib.h:724:49: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:961:23: error: unknown type name 'size_t'
961 | size_t __nmemb, size_t __size, __compar_fn_t __compar)
| ^~~~~~
/usr/include/stdlib.h:961:23: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:961:39: error: unknown type name 'size_t'
961 | size_t __nmemb, size_t __size, __compar_fn_t __compar)
| ^~~~~~
/usr/include/stdlib.h:961:39: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:970:34: error: unknown type name 'size_t'
970 | extern void qsort (void *__base, size_t __nmemb, size_t __size,
| ^~~~~~
/usr/include/stdlib.h:970:34: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:970:50: error: unknown type name 'size_t'
970 | extern void qsort (void *__base, size_t __nmemb, size_t __size,
| ^~~~~~
/usr/include/stdlib.h:970:50: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:1044:20: error: unknown type name 'size_t'
1044 | size_t __len) __THROW __nonnull ((3, 4, 5));
| ^~~~~~
/usr/include/stdlib.h:1044:20: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:1047:20: error: unknown type name 'size_t'
1047 | size_t __len) __THROW __nonnull ((3, 4, 5));
| ^~~~~~
/usr/include/stdlib.h:1047:20: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:1051:45: error: unknown type name 'size_t'
1051 | char *__restrict __buf, size_t __len)
| ^~~~~~
/usr/include/stdlib.h:1051:45: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:1055:45: error: unknown type name 'size_t'
1055 | char *__restrict __buf, size_t __len)
| ^~~~~~
/usr/include/stdlib.h:1055:45: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:1062:36: error: unknown type name 'size_t'
1062 | extern int mblen (const char *__s, size_t __n) __THROW;
| ^~~~~~
/usr/include/stdlib.h:1062:36: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:1066:48: error: unknown type name 'size_t'
1066 | const char *__restrict __s, size_t __n) __THROW;
| ^~~~~~
/usr/include/stdlib.h:1066:48: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:1073:8: error: unknown type name 'size_t'
1073 | extern size_t mbstowcs (wchar_t *__restrict __pwcs,
| ^~~~~~
/usr/include/stdlib.h:1073:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:1074:53: error: unknown type name 'size_t'
1074 | const char *__restrict __s, size_t __n) __THROW
| ^~~~~~
/usr/include/stdlib.h:1074:53: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:1077:8: error: unknown type name 'size_t'
1077 | extern size_t wcstombs (char *__restrict __s,
| ^~~~~~
/usr/include/stdlib.h:1077:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably |
s167520639 | p00009 | C | /*#include <stdio.h>
int main(){
int a,b,c,d,n,sum=0;
while(scanf("%d",&n) != EOF){
for(a=0;a<10;a++){
for(b=0;b<10;b++){
for(c=0;c<10;c++){
for(d=0;d<10;d++){
if(a+b+c+d==n)
sum++;
}
}
}
}
printf("%d\n",sum);
sum=0;
}
return 0;
}*/#include <stdio.h>
int main(){
int i,j,n,hantei=0;
int sum=0;
scanf("%d",&n);
for(i=2;i<=n;i++){
for(j=2;j*j<=i;j++){
if(i%j != 0 || i == j){
hantei += 0;
}else{
hantei += 1;
}
}
if(hantei == 0){
sum++;
}
hantei=0;
}
printf("%d\n",sum);
sum=0;
hantei = 0;
}
return 0;
}
| main.c:42:1: error: expected identifier or '(' before 'return'
42 | return 0;
| ^~~~~~
main.c:43:1: error: expected identifier or '(' before '}' token
43 | }
| ^
|
s316745298 | p00009 | C | #include <stdio.h>
#include <math.h>
int main(void)
{
int n, box[1000], flag = 0, count = 2;
box[0]=2;
box[1]=3;
scanf("%d",&n);
for(int i = 4; i < n; i++ ){
flag = 0;
for(int j = 0; box[j] <= sqrt(i); j++){
if(i % box[j] == 0){
flag = 1;
break;
}
}
if(flag == 0){
box[count] = i;
count++;
}
}
printf("%d", count);
return 0;
} | /usr/bin/ld: /tmp/ccrqjfM1.o: in function `main':
main.c:(.text+0xbb): undefined reference to `sqrt'
collect2: error: ld returned 1 exit status
|
s192060019 | p00009 | C | #include<stdio.h>
#define MAX 1000100
int main(void){
bool prime[MAX];
int i,j,n,count;
for(i=0;i<MAX;i++){
prime[i]=1;
}
prime[0]=prime[1]=0;
for(i=2;i<MAX;i++){
for(j=2;i*j<MAX;j++){
prime[i*j]=0;
}
}
while((scanf("%d",&n))!=EOF){
count=0;
for(i=0;i<n+1;i++){
if(prime[i]==1){
count++;
}
}
printf("%d\n",count);
}
return 0;
} | main.c: In function 'main':
main.c:5:9: error: unknown type name 'bool'
5 | bool prime[MAX];
| ^~~~
main.c:2:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
1 | #include<stdio.h>
+++ |+#include <stdbool.h>
2 | #define MAX 1000100
|
s739517823 | p00009 | C | #include<stdio.h>
#include<math.h>
int main(void)
{
long long i,j,p,n,count;
bool flag[1000000];
while((scanf("%lld",&n)) != EOF)
{
p = (long long)sqrt((double)n);
for(i = 3; i <= p; i = i + 2)
{
for(j = i * i; j < n; j = j + 2 * i)
{
flag[j] = false;
}
}
count = 1;
for(i = 3; i <= n; i = i + 2)
{
if(flag[i])
count++;
}
printf("%lld\n",count);
}
return 0;
} | main.c: In function 'main':
main.c:6:9: error: unknown type name 'bool'
6 | bool flag[1000000];
| ^~~~
main.c:3:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
2 | #include<math.h>
+++ |+#include <stdbool.h>
3 | int main(void)
main.c:14:43: error: 'false' undeclared (first use in this function)
14 | flag[j] = false;
| ^~~~~
main.c:14:43: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c:14:43: note: each undeclared identifier is reported only once for each function it appears in
|
s320534751 | p00009 | C | #include <stdio.h>
#include <iostream>
using namespace std;
#define MAX 10000000
#define LMT 3163
int sieve();
int calculation();
unsigned flag[MAX>>6];
int primes[5761455];
#define ifc(n) (flag[n>>6]&(1<<((n>>1)&31)))
#define isc(n) (flag[n>>6]|=(1<<((n>>1)&31)))
int main()
{
sieve();
return 0;
}
int sieve()
{
unsigned i, j, k;
for(i=3; i<LMT; i+=2)
if(!ifc(i))
for(j=i*i, k=i<<1; j<MAX; j+=k)
isc(j);
calculation();
return 0;
}
int calculation()
{
int Rang, count;
unsigned int i;
int k = 1;
primes[0] = 2;
for( i=3; i<MAX; i+=2)
{
if(ifc(i)==0)
primes[k++] = i;
}
while(scanf("%d",&Rang)==1)
{
count = 0;
for(i=0; i<Rang; i++)
{
if(primes[i]<=Rang)
{
count++;
}
else if(primes[i]>Rang)
break;
}
cout << count << "\n";
}
return 0;
} | main.c:2:10: fatal error: iostream: No such file or directory
2 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.