submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3
values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s144189469 | p02257 | C++ | #include <iostream>
using namespace std;
int main(){
int n,x;
int count=0;
cin >> n;
int *a =new int [n];
for(int i=0;i < n ;i++){
cin >> x;
a[i]=x;
if(a[i]%2==1) count ++;
}
cout << count???<<endl;
return 0;
} | a.cc:18:23: warning: trigraph ??< ignored, use -trigraphs to enable [-Wtrigraphs]
18 | cout << count???<<endl;
a.cc: In function 'int main()':
a.cc:18:23: error: expected primary-expression before '?' token
18 | cout << count???<<endl;
| ^
a.cc:18:24: error: expected pr... |
s581947306 | p02257 | C++ | #include <stdio.h>
#include <vector>
#include <algorithm>
int gcd(int x, int y) {
if (y == 0) return x;
if (x >= y) return gcd(y, x % y);
else return gcd(x, y % x);
}
bool isprime(int a) {
if (a == 1) return false;
for (int i = 2; i < a; i++) {
if (a % i == 0) return false;
}
return true;
}
int main() {
... | a.cc: In function 'int main()':
a.cc:26:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
26 | scanf_s("%d", &n);
| ^~~~~~~
| scanf
|
s710509096 | p02257 | C++ | using namespace std;
void InsertionSort(int a[], int n) {
for (int i = 0; i < n; i++) {
int v = a[i];
int j = i - 1;
while (j >= 0 && a[j] > v) {
a[j + 1] = a[j];
j--;
}
a[j + 1] = v;
for (int i = 0; i < n-1; i++) {
cout << a[i] << ' ';
}
cout << a[n - 1] << endl;
}
}
int GCD(int x, int y) ... | a.cc: In function 'void InsertionSort(int*, int)':
a.cc:13:25: error: 'cout' was not declared in this scope
13 | cout << a[i] << ' ';
| ^~~~
a.cc:1:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
... |
s502891499 | p02257 | C++ | #include <iostream>
using namespace std;
bool check_prime(int n){
int i = 2;
bool flg==true;
while(i < n){
if (n%i==0) {
flg==false;
break;
}
else{
i++;
}
}
return flg;
}
int main() {
int N;
const int MAX_N = 10000;
cin >> N;
int arr[MAX_N];
for(int i = 0; i<N ;i++){
cin >> arr[i]... | a.cc: In function 'bool check_prime(int)':
a.cc:6:17: error: expected initializer before '==' token
6 | bool flg==true;
| ^~
a.cc:9:25: error: 'flg' was not declared in this scope
9 | flg==false;
| ^~~
a.cc:16:16: error: 'flg' w... |
s495781024 | p02257 | C++ | #include <iostream>
using namespace std;
bool check_prime(int n){
int i = 2;
bool flg==true;
while(i < n){
if (n%i==0) {
flg = false;
break;
}
else{
i++;
}
}
return flg;
}
int main() {
int N;
const int MAX_N = 10000;
cin >> N;
int arr[MAX_N];
for(int i = 0; i<N ;i++){
cin >> arr[i... | a.cc: In function 'bool check_prime(int)':
a.cc:6:17: error: expected initializer before '==' token
6 | bool flg==true;
| ^~
a.cc:9:25: error: 'flg' was not declared in this scope
9 | flg = false;
| ^~~
a.cc:16:16: error: 'flg' ... |
s112338539 | p02257 | C++ | #include<stdio.h>
#include<iostream>
using namespace std;
int main(){
int n;
int p=0;
cin>>n;
for(int i=0;i<n;i++){
int m;
cin>>m;
if(m==2) {
p++;
continue;
}
else if( m<2 || m%2==0)continue;
int t=0;
for(int j=3;j<=sqrt(m);j++){
if(m%j=0){
t++;
break;
}
if(t==0)p++;
}
cout<<p<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:22:16: error: 'sqrt' was not declared in this scope
22 | for(int j=3;j<=sqrt(m);j++){
| ^~~~
a.cc:23:5: error: lvalue required as left operand of assignment
23 | if(m%j=0){
| ~^~
a.cc:35:2: error: expected '}' at end of input
35 | }
| ^
... |
s381649010 | p02257 | C++ | #include<stdio.h>
#include<iostream>
using namespace std;
int main(){
int n;
int p=0;
cin>>n;
for(int i=0;i<n;i++){
int m;
cin>>m;
if(m==2) {
p++;
continue;
}
else if( m<2 || m%2==0)continue;
int t=0;
bouble sqr=sqrt(m);
for(int j=3;j<=sqr;j++){
if(m%j=0){
t++;
break;
}
if(t==0)p++;
}
cout<<p<<endl;
return... | a.cc: In function 'int main()':
a.cc:22:1: error: 'bouble' was not declared in this scope; did you mean 'double'?
22 | bouble sqr=sqrt(m);
| ^~~~~~
| double
a.cc:23:16: error: 'sqr' was not declared in this scope
23 | for(int j=3;j<=sqr;j++){
| ^~~
a.cc:24:5: error: lvalue require... |
s653371125 | p02257 | C++ | #include<stdio.h>
#include<iostream>
using namespace std;
int main(){
int n;
int p=0;
cin>>n;
for(int i=0;i<n;i++){
int m;
cin>>m;
if(m==2) {
p++;
continue;
}
else if( m<2 || m%2==0)continue;
int t=0;
double sqr=sqrt(m);
for(int j=3;j<=sqr;j++){
if(m%j=0){
t++;
break;
}
if(t==0)p++;
}
cout<<p<<endl;
return... | a.cc: In function 'int main()':
a.cc:22:12: error: 'sqrt' was not declared in this scope; did you mean 'sqr'?
22 | double sqr=sqrt(m);
| ^~~~
| sqr
a.cc:24:5: error: lvalue required as left operand of assignment
24 | if(m%j=0){
| ~^~
a.cc:36:2: error: expected '}' at end... |
s033011017 | p02257 | C++ | #include<stdio.h>
#include<iostream>
using namespace std;
int main(){
int n;
int p=0;
cin>>n;
for(int i=0;i<n;i++){
double m;
cin>>m;
if(m==2) {
p++;
continue;
}
else if( m<2 || m%2==0)continue;
int t=0;
double sqr=sqrt(m);
for(int j=3;j<=sqr;j++){
if(m%j=0){
t++;
break;
}
if(t==0)p++;
}
cout<<p<<endl;
ret... | a.cc: In function 'int main()':
a.cc:19:18: error: invalid operands of types 'double' and 'int' to binary 'operator%'
19 | else if( m<2 || m%2==0)continue;
| ~^~
| | |
| | int
| double
a.cc:22:12: error: 'sqrt' was not declared i... |
s559937236 | p02257 | C++ | #include<stdio.h>
#include<iostream>
using namespace std;
int main(){
int n;
int p=0;
cin>>n;
for(int i=0;i<n;i++){
int m;
cin>>m;
double mt=m;
if(m==2) {
p++;
continue;
}
else if( m<2 || m%2==0)continue;
int t=0;
double sqr=sqrt(mt);
for(int j=3;j<=sqr;j++){
if(m%j=0){
t++;
break;
}
if(t==0)p++;
}
cout<<p... | a.cc: In function 'int main()':
a.cc:25:12: error: 'sqrt' was not declared in this scope; did you mean 'sqr'?
25 | double sqr=sqrt(mt);
| ^~~~
| sqr
a.cc:27:5: error: lvalue required as left operand of assignment
27 | if(m%j=0){
| ~^~
a.cc:39:2: error: expected '}' at en... |
s405018133 | p02257 | C++ | #include<stdio.h>
#include<iostream>
#include<math.h>
using namespace std;
int main(){
int n;
int p=0;
cin>>n;
for(int i=0;i<n;i++){
int m;
cin>>m;
double mt=m;
if(m==2) {
p++;
continue;
}
else if( m<2 || m%2==0)continue;
int t=0;
double sqr=sqrt(mt);
for(int j=3;j<=sqr;j++){
if(m%j=0){
t++;
break;
}
if(t==0... | a.cc: In function 'int main()':
a.cc:28:5: error: lvalue required as left operand of assignment
28 | if(m%j=0){
| ~^~
a.cc:40:2: error: expected '}' at end of input
40 | }
| ^
a.cc:7:11: note: to match this '{'
7 | int main(){
| ^
|
s175505535 | p02257 | C++ | #include<stdio.h>
#include<iostream>
#include<math.h>
using namespace std;
int main(){
int n;
int p=0;
cin>>n;
for(int i=0;i<n;i++){
int m;
cin>>m;
if(m==2) {
p++;
continue;
}
else if( m<2 || m%2==0)continue;
int t=0;
double sqr=sqrt(m);
for(int j=3;j<=sqr;j++){
if(m%j=0){
t++;
break;
}
if(t==0)p++;
}
cou... | a.cc: In function 'int main()':
a.cc:28:5: error: lvalue required as left operand of assignment
28 | if(m%j=0){
| ~^~
a.cc:40:2: error: expected '}' at end of input
40 | }
| ^
a.cc:7:11: note: to match this '{'
7 | int main(){
| ^
|
s883660616 | p02257 | C++ | #include<stdio.h>
#include<iostream>
#include<math.h>
using namespace std;
int main(){
int n;
int p=0;
cin>>n;
for(int i=0;i<n;i++){
int m;
cin>>m;
if(m==2) {
p++;
continue;
}
else if( m<2 || m%2==0)continue;
int t=0;
double sqr=sqrt(m);
for(int j=3;j<=sqr;j++){
if(m%j=0){
t++;
break;
}
if(t==0)p++;
}
cou... | a.cc: In function 'int main()':
a.cc:28:5: error: lvalue required as left operand of assignment
28 | if(m%j=0){
| ~^~
a.cc:40:2: error: expected '}' at end of input
40 | }
| ^
a.cc:7:11: note: to match this '{'
7 | int main(){
| ^
|
s163351701 | p02257 | C++ | #include<stdio.h>
#include<iostream>
#include<math.h>
using namespace std;
int solve(int m){
if (m == 2){
p++;
return 1;
}
if (m < 2 || m % 2 == 0) return 0;
int e = 0;
for (int j = 3; j<sqrt(m); j++){
if (m%j == 0){
return 0;
}
}
if (e == 0)return 1;
}
int main(){
int n;
int p=0;
cin>>n;
for(... | a.cc: In function 'int solve(int)':
a.cc:10:17: error: 'p' was not declared in this scope
10 | p++;
| ^
a.cc:23:1: warning: control reaches end of non-void function [-Wreturn-type]
23 | }
| ^
|
s195109661 | p02257 | C++ | #include<stdio.h>
#include<iostream>
#include<math.h>
using namespace std;
int solve(int m){
if (m == 2){
p++;
return 1;
}
if (m < 2 || m % 2 == 0) return 0;
int e = 0;
for (int j = 3; j<sqrt(m); j++){
if (m%j == 0){
return 0;
}
}
if (e == 0)return 1;
}
int main(){
int n;
int p=0;
cin>>n;
for(... | a.cc: In function 'int solve(int)':
a.cc:10:17: error: 'p' was not declared in this scope
10 | p++;
| ^
a.cc:23:1: warning: control reaches end of non-void function [-Wreturn-type]
23 | }
| ^
|
s959404983 | p02257 | C++ | #include<stdio.h>
#include<iostream>
#include<math.h>
using namespace std;
int solve(int m){
if (m == 2){
p++;
return 1;
}
if (m < 2 || m % 2 == 0) return 0;
int e = 0;
for (int j = 3; j<sqrt(m); j++){
if (m%j == 0){
return 0;
}
}
return 1;
}
int main(){
int n;
int p=0;
cin>>n;
for(int i=0;i<n... | a.cc: In function 'int solve(int)':
a.cc:10:17: error: 'p' was not declared in this scope
10 | p++;
| ^
|
s818613054 | p02257 | C++ | #include<bits/stdc++.h>
using namespace std;
#define D 100000000
int main(){
int a[N]={},m[100000]={},n,count=0;
a[0]=a[1]=1;
for(int i=2;i*i<=N;i++)
if(a[i]==0)
for(int j=2;j*i<N;j++)a[i*j]=1;
cin>>n;
for(int i=0;i<n;i++){
cin>>m[i];
if(a[m[i]]==0)count++;
}
cout<<count<<endl;
return 0;... | a.cc: In function 'int main()':
a.cc:5:9: error: 'N' was not declared in this scope
5 | int a[N]={},m[100000]={},n,count=0;
| ^
a.cc:6:3: error: 'a' was not declared in this scope
6 | a[0]=a[1]=1;
| ^
|
s803553368 | p02257 | C++ | #include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
bool Judge(int a){
for(int i = 2; i <= sqrt(a); i+){
if(a & i == 0) return false;
}
return true;
}
int main(){
int n;
cin >> n;
int Count = 0;
for(int i = 0; i < n; i++){
int a
cin >> a;
if(Judge(a) == true) Count++
}
cout << C... | a.cc: In function 'bool Judge(int)':
a.cc:7:40: error: expected primary-expression before ')' token
7 | for(int i = 2; i <= sqrt(a); i+){
| ^
a.cc: In function 'int main()':
a.cc:19:17: error: expected initializer before 'cin'
19 | cin >> a;
... |
s071406645 | p02257 | C++ | #include<iostream>
#include<cmath>
#include<vector>
using namespace std;
bool Judge(int A)
{
for(int j=2;j<=fioor(sqrt((double)A));j++){
if(A%j==0)return false;
}
return true;
}
int PrimeNumbers(vector<int> A)
{
int count = 0;
for(int i=0;i<A.size();i++){
if(Judge(A[i]))count++;
}
return count;
}
int m... | a.cc: In function 'bool Judge(int)':
a.cc:9:24: error: 'fioor' was not declared in this scope; did you mean 'floor'?
9 | for(int j=2;j<=fioor(sqrt((double)A));j++){
| ^~~~~
| floor
|
s507406446 | p02257 | C++ | #include<iostream>
#include<algorithm>
#include<math.h>
#include<stdio.h>
using namespace std;
int i = 0;
int k;
bool prime(int n) {
if (n == 1) {
return false;
}
i = (int)sqrt(n) + 1;
for (k = 2; k < i; k++) {
if (n%k == 0) return false;
}
}
int main() {
int count = 0;
bool matched[99] = { true };
int a[9... | a.cc: In function 'int main()':
a.cc:25:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
25 | scanf_s("%d", &a[l]);
| ^~~~~~~
| scanf
a.cc: In function 'bool prime(int)':
a.cc:16:1: warning: control reaches end of non-void function... |
s313242744 | p02257 | C++ | #include<iostream>
#include<cmath>
using namespace std;
bool isprime(int x){
if(x == 2)
return true;
if(x % 2 == 0 || x < 2)
return false;
int j = 3;
while(j <= sqrt(x)){
if(x % j == 0)
return false;
j += 2;
}
return true;
}
int main(){
int n;
cin >> ... | a.cc: In function 'int main()':
a.cc:27:11: error: 'cnt' was not declared in this scope; did you mean 'int'?
27 | cout << cnt << "\n";
| ^~~
| int
|
s613697643 | p02257 | C++ | int main(){
int x,n[10000],d,s=0;
cin >> x;
for(int i=0;i<x;i++) cin >> n[i];
for(int i=0;i<x;i++){
d=1;
for(int j=2;j*j<=n[i];j++){
if(n[i]%j==0){
d=0;
break;
}
}
if(d==1) s++;
}
cout << s << "\n";
return 0;
} | a.cc: In function 'int main()':
a.cc:3:3: error: 'cin' was not declared in this scope
3 | cin >> x;
| ^~~
a.cc:16:3: error: 'cout' was not declared in this scope
16 | cout << s << "\n";
| ^~~~
|
s398613314 | p02257 | C++ | #include <bits/stdc++.h>
#define MAX 100000000
int eratos[MAX];
void Eratos() {
eratos[0] = 1;
for (int i = 1; i * i <= MAX; i++) {
if (eratos[i - 1] == 0) {
for (int j = i * 2; j <= MAX; j += i) {
eratos[j] = 1;
}
}
}
}
int main()
{
int n, res;
Eratos();
cin >> n;
for (int i = 0, tmp; i < n; i++... | a.cc: In function 'int main()':
a.cc:20:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
20 | cin >> n;
| ^~~
| std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
from a.cc:1:
/usr/include/c++/14/iostream... |
s994821994 | p02257 | C++ | #include<stdio.h>
#include<math.h>
int prime(int a){
int i,c=0;
for(i=1;i<=sqrt(a);i++){
if(a%i==0 && i!=1){
c=1;
}
}
if(c==1){
return 0;
}else{
return 1;
}
}
int main(void){
int n,co=0;
while(scanf("%d",&n)==1){
if(prime(n)==1){
co++
}
}
printf("%d\n"co);
} | a.cc: In function 'int main()':
a.cc:20:29: error: expected ';' before '}' token
20 | co++
| ^
| ;
21 | }
| ~
a.cc:23:16: error: unable to find string literal operator 'ope... |
s334715901 | p02257 | C++ | #include<stdio.h>
#include<math.h>
int prime(int a){
int i,c=0;
for(i=1;i<=sqrt(a);i++){
if(a%i==0 && i!=1){
c=1;
}
}
if(c==1){
return 0;
}else{
return 1;
}
}
int main(void){
int n,co=0;
while(scanf("%d",&n)==1){
if(prime(n)==1){
co++;
}
}
printf("%d\n"co);
} | a.cc: In function 'int main()':
a.cc:23:16: error: unable to find string literal operator 'operator""co' with 'const char [4]', 'long unsigned int' arguments
23 | printf("%d\n"co);
| ^~~~~~~~
|
s682134078 | p02257 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
int main(){
int n,a[10010],t,A=0;
double s;
cin>>n;
for(int i=0;i<n;i++){
cin>>a[i];
}
for(int i=0;i<n;i++){
s=sqrt(a[i]);
t=(int)s;
for(int j=2;j<=t;j++){
if(j==t)A++;
if(a[i]%j==0)break;
}
}
cout<<A<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:14:19: error: 'sqrt' was not declared in this scope
14 | s=sqrt(a[i]);
| ^~~~
|
s978741028 | p02257 | C++ | #include <iostream>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <cstdlib>
using namespace std;
class c_primeNumber
{
private:
int n;
int x[10000];
public:
void f_set_variables();
void f_primeNumber1();
int f_primeNumber2(int x);
};
void c_primeNumber::f_set_variables()
{... | a.cc: In member function 'void c_primeNumber::f_primeNumber1()':
a.cc:40:9: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int')
40 | cin << n;
| ~~~ ^~ ~
| | |
| | int
| std::istream {aka std::basic_istre... |
s074783816 | p02257 | C++ | #include <iostream>
#include <utility>
#include <algorithm>
#include <cmath>
using namespace std;
bool check(int x){
????????if (x==2) return true;
????????else 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;
}???? ... | a.cc: In function 'bool check(int)':
a.cc:7:1: error: expected primary-expression before '?' token
7 | ????????if (x==2) return true;
| ^
a.cc:7:2: error: expected primary-expression before '?' token
7 | ????????if (x==2) return true;
| ^
a.cc:7:3: error: expected primary-expression before '?' toke... |
s957981837 | p02257 | C++ | #include <iostream>
#include <utility>
#include <algorithm>
#include <cmath>
using namespace std;
bool check(int x){
????????if (x==2) return true;
????????else 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;
}???? ... | a.cc: In function 'bool check(int)':
a.cc:7:1: error: expected primary-expression before '?' token
7 | ????????if (x==2) return true;
| ^
a.cc:7:2: error: expected primary-expression before '?' token
7 | ????????if (x==2) return true;
| ^
a.cc:7:3: error: expected primary-expression before '?' toke... |
s997115224 | p02257 | C++ | #include <iostream>????
#include <cmath>
using namespace std;
??
bool Prime(int x){
????????if(x == 2){
????????????????return true;
????????}
??????????
????????if(x < 2 || x % 2 == 0){
????????????????return false;
????????}
??????????
????????for(int i = 3;i <= sqrt(x);i = i + 2){
????????????????if(x % i == 0){
??... | a.cc:1:20: warning: extra tokens at end of #include directive
1 | #include <iostream>????
| ^
a.cc:4:1: error: expected unqualified-id before '?' token
4 | ??
| ^
a.cc:22:1: error: expected unqualified-id before '?' token
22 | ??
| ^
|
s185251898 | p02257 | C++ | #include <iostream>????
#include <cmath>
using namespace std;
??
bool Prime(int x){
????????if(x == 2){
????????????????return true;
????????}
??????????
????????if(x < 2 || x % 2 == 0){
????????????????return false;
????????}
??????????
????????for(int i = 3;i <= sqrt(x);i = i + 2){
????????????????if(x % i == 0){
??... | a.cc:1:20: warning: extra tokens at end of #include directive
1 | #include <iostream>????
| ^
a.cc:4:1: error: expected unqualified-id before '?' token
4 | ??
| ^
a.cc:22:1: error: expected unqualified-id before '?' token
22 | ??
| ^
|
s597694578 | p02257 | C++ | #include<iostream>
using namespace std;
int main(){
int p[10000]={0},k=0,b[10000];
p[0]=p[1]=1;
for(int i=2;i<=100;i++){
if(p[i]==0){
for(int j=i*i;j<10000;j+=i)p[j]=1;
b[k++]=i;
}
}
int cnt=0,a;
cin >> n;
for(int i=0;i<n;i++){
cin >> a;
for(int j=0;j<k;j++){
if(a%b[j]==0){cnt++;break;}
}
}
cout << cnt << e... | a.cc: In function 'int main()':
a.cc:13:8: error: 'n' was not declared in this scope
13 | cin >> n;
| ^
|
s173484801 | p02257 | C++ | #include<cstdio>
#include<cstdlib>
#include<iostream>
using namespace std;
bool isPrime(int n)
{
for(int i=2;i<sqrt(n)+0.5;++i)
{
if(n%i==0)
{
return false;
}
}
return true;
}
int main()
{
int n, temp, ans = 0;;
cin >> n;
while(n--)
{
cin >> temp;
if(isPrime(temp))
{
++ans;
}
}
printf("... | a.cc: In function 'bool isPrime(int)':
a.cc:8:23: error: 'sqrt' was not declared in this scope
8 | for(int i=2;i<sqrt(n)+0.5;++i)
| ^~~~
|
s439036943 | p02257 | C++ | #include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <stack>
#include <queue>
#include <list>
#include <cstdlib>
#define _USE_MATH_DEFINES
using namespace std;
bool isPrime(int n) {
int i = 3;
if (n == 2)
return true;
if (n <= 1 || n %2 == 0)
return false;
while (i <= sqrt(... | a.cc: In function 'bool isPrime(int)':
a.cc:22:21: error: 'sqrt' was not declared in this scope
22 | while (i <= sqrt(n)) {
| ^~~~
|
s752703526 | p02257 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
bool isPrimenumber(const int n);
int main()
{
int n;
std::cin >> n;
std::vector<int> numbers(n);
int numPrimeNumber = 0;
int inputNumber = 0;
for (int i = 0; i < n; i++)
{
std::cin >> inputNumber;
if (isPrimenumber(inputNumber))
{
numPrimeNu... | a.cc: In function 'bool isPrimenumber(int)':
a.cc:30:35: error: 'sqrt' is not a member of 'std'; did you mean 'sort'?
30 | int loopLimit = (int)std::sqrt(n);
| ^~~~
| sort
|
s658067649 | p02257 | C++ | #include <iostream>
#define INPUT_FROM_FILE (0)
#if INPUT_FROM_FILE
#include <fstream>
#endif
#if INPUT_FROM_FILE
#define IS ifs
#else
#define IS std::cin
#endif
bool is_prime(int num){
bool ret = true;
int max = int(sqrt(num));
if(num == 2){
}
else if(num % 2 == 0){
ret = false;
}
else{
for(int i = 3; ... | a.cc: In function 'bool is_prime(int)':
a.cc:17:23: error: 'sqrt' was not declared in this scope
17 | int max = int(sqrt(num));
| ^~~~
|
s265045202 | p02257 | C++ | #define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
inline int getprime(int x) {
int i = sqrt(x);
while (i > 1) {
if (x % i == 0) return 0;
else i--;
}
return 1;
}
int main() {
int n;
cin >> n;
int x;
int cnt = 0;
for (in... | a.cc: In function 'int getprime(int)':
a.cc:8:17: error: 'sqrt' was not declared in this scope
8 | int i = sqrt(x);
| ^~~~
|
s978541080 | p02257 | C++ | #include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
inline int getprime(int x) {
int i = sqrt(x);
while (i > 1) {
if (x % i == 0) return 0;
else i--;
}
return 1;
}
int main() {
int n;
cin >> n;
int x;
int cnt = 0;
for (int i = 0; i < n; i++) {
cin >> x;
cnt += getprime(x);
... | a.cc: In function 'int getprime(int)':
a.cc:6:17: error: 'sqrt' was not declared in this scope
6 | int i = sqrt(x);
| ^~~~
|
s440361725 | p02257 | C++ | #include<iostream>
using namespace std;
unsigned int x, y;
int pisprime(int x)
{
int n;
if (x == 2) return 1;
if (x < 2 || x % 2 == 0) return 0;
for (n = 3; n <= sqrt((double)x); n += 2)
if (x % n == 0) return 0;
return 1;
}
int main() {
int temp=0, a, n;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a;
... | a.cc: In function 'int pisprime(int)':
a.cc:10:26: error: 'sqrt' was not declared in this scope
10 | for (n = 3; n <= sqrt((double)x); n += 2)
| ^~~~
|
s098282842 | p02257 | C++ | #include<iostream>
using namespace std;
unsigned int x, y;
int pisprime(int x)
{
int n;
if (x == 2) return 1;
if (x < 2 || x % 2 == 0) return 0;
for (n = 3; n <= sqrt((double)x); n += 2)
if (x % n == 0) return 0;
return 1;
}
int main() {
int temp=0, a, n,flag=0;
cin >> n;
for (int i = 0; i < n; i++) {
cin ... | a.cc: In function 'int pisprime(int)':
a.cc:10:26: error: 'sqrt' was not declared in this scope
10 | for (n = 3; n <= sqrt((double)x); n += 2)
| ^~~~
|
s998601487 | p02257 | C++ | <?php
$n=trim(fgets(STDIN));
$c=0;
for($i=0;$i<$n;$i++){
if(trim(fgets(STDIN))) ++$c;
}
print $c;
function isPn($n){
if($n<2) return 0;
if($n==2) return 1;
if($n%2==0) return 0;
$max=floor(sqrt($n));
for($i=3;$i<=$max;$i++) if($n%$i==0) return 0;
return 1;
}
?> | a.cc:1:1: error: expected unqualified-id before '<' token
1 | <?php
| ^
a.cc:3:1: error: '$c' does not name a type
3 | $c=0;
| ^~
a.cc:4:1: error: expected unqualified-id before 'for'
4 | for($i=0;$i<$n;$i++){
| ^~~
a.cc:4:10: error: '$i' does not name a type
4 | for($i=0;$i<$n;$i++){
... |
s039343102 | p02257 | C++ | #include<iostream>
using namespace std;
int prime?(long int n);
int main(){
long int n;
long int num;
long int count=0;
cin>>n;
for(i=0;i<n;i++){
cin>>num;
if(prime?(num)==1){
count++;
}
}
c... | a.cc:3:10: error: expected initializer before '?' token
3 | int prime?(long int n);
| ^
a.cc: In function 'int main()':
a.cc:10:13: error: 'i' was not declared in this scope
10 | for(i=0;i<n;i++){
| ^
a.cc:12:20: error: 'prime' was not declared in this scope
12 | ... |
s054732061 | p02257 | C++ | #include<iostream>
using namespace std;
int prime(long int n);
int main(){
long int n;
long int num;
long int count=0;
cin>>n;
for(i=0;i<n;i++){
cin>>num;
if(prime(num)==1){
count++;
}
}
cout... | a.cc: In function 'int main()':
a.cc:10:13: error: 'i' was not declared in this scope
10 | for(i=0;i<n;i++){
| ^
|
s115012172 | p02257 | C++ | #include<iostream>
using namespace std;
int prime(long int n);
int main(){
long int n;
long int num;
long int count=0;
????????????long int i;
cin>>n;
for(i=0;i<n;i++){
cin>>num;
if(prime(num)==1){
count++;
... | a.cc: In function 'int main()':
a.cc:9:1: error: expected primary-expression before '?' token
9 | ????????????long int i;
| ^
a.cc:9:2: error: expected primary-expression before '?' token
9 | ????????????long int i;
| ^
a.cc:9:3: error: expected primary-expression before '?' token
9 | ?????????... |
s462826379 | p02257 | C++ | #include<stdio.h>
int prime(int x){
int i;
int answer = 0;
for(i=2; i<x; i+){
if(x%i == 0){
answer = 1;
break;
}
}
return (answer==1) ? 1 : 0;
}
int main(){
int n;
int i;
int num[100];
int count = 0;
scanf("%d", &n);
for(i=0; i<n; i++){... | a.cc: In function 'int prime(int)':
a.cc:5:21: error: expected primary-expression before ')' token
5 | for(i=2; i<x; i+){
| ^
|
s963688167 | p02257 | C++ | #include<stdio.h>
#include<math.h>
int prime(double x){
int i;
int answer = 0;
for(i=2; i<sqrt(x); i++){
if(x%i == 0){
answer = 1;
break;
}
}
return (answer!=0) ? 1 : 0;
}
int main(){
int n;
int i;
double num[20000];
int count = 0;
scanf("%... | a.cc: In function 'int prime(double)':
a.cc:7:13: error: invalid operands of types 'double' and 'int' to binary 'operator%'
7 | if(x%i == 0){
| ~^~
| | |
| | int
| double
|
s183546690 | p02257 | C++ | #include<stdio.h>
#include<math.h>
int prime(double x){
double i;
int answer = 0;
for(i=2; i<sqrt(x); i++){
if(x%i == 0){
answer = 1;
break;
}
}
return (answer!=0) ? 1 : 0;
}
int main(){
int n;
int i;
double num[20000];
int count = 0;
scanf... | a.cc: In function 'int prime(double)':
a.cc:7:13: error: invalid operands of types 'double' and 'double' to binary 'operator%'
7 | if(x%i == 0){
| ~^~
| | |
| | double
| double
|
s509495983 | p02257 | C++ | #include <iostream>
using namespace std;
int couent = 0;
int keisann(int a) {
if (a == 2) { couent++; }
if (a % 2 == 0) { return 0; }
int v = sqrt(a);
for (int i = 3; i < v; i+=2)
{
if (a%i == 0) {
return 0;
}
}
couent++;
}
int main()
{
int dataset;
cin >> dataset;
for (size_t i = 0; i < dataset; i++... | a.cc: In function 'int keisann(int)':
a.cc:9:17: error: 'sqrt' was not declared in this scope
9 | int v = sqrt(a);
| ^~~~
a.cc:16:15: warning: control reaches end of non-void function [-Wreturn-type]
16 | couent++;
| ~~~~~~^~
|
s093402785 | p02257 | C++ | #include <stdio.h>
#include <math.h>
#define N 10000
#define TRUE 1
#define FALSE 0
int isprime(int);
int main(){
int i,j,num,A[N],count=0;
while(1){
scanf("%d",&num);
if(1 <= num && num <= N) break;
}
for(i = 0;i < num;i++) scanf("%d",&A[i]);
for(i = 0;i < num;i++) if(isprime(A[i]) == TRUE) count... | a.cc: In function 'int isprime(int)':
a.cc:33:15: error: expected '}' at end of input
33 | return TRUE;
| ^
a.cc:24:19: note: to match this '{'
24 | int isprime(int a){
| ^
|
s691647920 | p02257 | C++ | #include<iostream>
using namespace std;
int main(){
bool* isPrime = new bool[50000000];
isPrime[0] = true;
isPrime[1] = true;
for(int i = 2; i < 50000000; i++){
if(!isPrime[i]){
for(int j = i * 2; j < 50000000; j+= i){
isPrime[j] = true;
}
}
}
int n;
cin >> n;
int count = 0;
for(int i = 0; i < n... | a.cc:40:31: error: stray '#' in program
40 | cout << count << endl;#include<iostream>
| ^
a.cc: In function 'int main()':
a.cc:40:32: error: 'include' was not declared in this scope
40 | cout << count << endl;#include<iostream>
| ... |
s553251583 | p02257 | C++ | #include<iostream>
using namespace std;
bool snt(long a){
if(a==2 || a==3 || a==5 || a==7)
return true;
if(a<8)
return false;
long n=sqrt(a);
for(int i=7;i<n;i++)
if(n%i==0)
return false;
return true;
}
int main(){
int n,d=0;
long b;
cin >>n;
whil... | a.cc: In function 'bool snt(long int)':
a.cc:8:12: error: 'sqrt' was not declared in this scope
8 | long n=sqrt(a);
| ^~~~
|
s558955718 | p02257 | C++ | #include <cstdio>
using namespace std;
bool prime(int num){
for(int i = 1; i < n; i++){
if(i*i >= n){
int max = i*i;
break;
}
}
for(int i = 2; i < max; i++){
if(num%i == 0){
return true;
}
}
return false;
}
int main(){
int n;
... | a.cc: In function 'bool prime(int)':
a.cc:5:24: error: 'n' was not declared in this scope
5 | for(int i = 1; i < n; i++){
| ^
a.cc:11:24: error: 'max' was not declared in this scope
11 | for(int i = 2; i < max; i++){
| ^~~
|
s385955825 | p02257 | C++ | #include<iostream>
using namespace std;
bool isprime(int x)
{
if(x==2)
return true;
if(x<2||x%==2)
return false;
for(int i=3;i*i<=x;i+=2)
if(x%i==0)
return false;
}
return true;
}
int mai()
{
int n;
cin>>n;
int cnt=0;
for(int i=0;i<n;i++){
int x;
cin>>x;
if(isprime(x)){
cnt++;
... | a.cc: In function 'bool isprime(int)':
a.cc:9:20: error: expected primary-expression before '=' token
9 | if(x<2||x%==2)
| ^
a.cc: At global scope:
a.cc:17:9: error: expected unqualified-id before 'return'
17 | return true;
| ^~~~~~
a.cc:18:1: error: expecte... |
s042025163 | p02257 | C++ | #include<iostream>
using namespace std;
bool isprime(int x)
{
if(x==2)
return true;
if(x<2||x%==2)
return false;
for(int i=3;i*i<=x;i+=2)
if(x%i==0)
return false;
}
return true;
}
int main()
{
int n;
cin>>n;
int cnt=0;
for(int i=0;i<n;i++){
int x;
cin>>x;
if(isprime(x)){
cnt++;
... | a.cc: In function 'bool isprime(int)':
a.cc:9:20: error: expected primary-expression before '=' token
9 | if(x<2||x%==2)
| ^
a.cc: At global scope:
a.cc:17:9: error: expected unqualified-id before 'return'
17 | return true;
| ^~~~~~
a.cc:18:1: error: expecte... |
s116763190 | p02257 | C++ | #include<iostream>
using namespace std;
bool isprime(int x)
{
if(x==2)
return true;
if(x<2||x%2==)
return false;
for(int i=3;i*i<=x;i+=2)
if(x%i==0)
return false;
}
return true;
}
int main()
{
int n;
cin>>n;
int cnt=0;
for(int i=0;i<n;i++){
int x;
cin>>x;
if(isprime(x)){
cnt++;
... | a.cc: In function 'bool isprime(int)':
a.cc:9:22: error: expected primary-expression before ')' token
9 | if(x<2||x%2==)
| ^
a.cc: At global scope:
a.cc:17:9: error: expected unqualified-id before 'return'
17 | return true;
| ^~~~~~
a.cc:18:1: error: expec... |
s856078134 | p02257 | C++ | #include<iostream>
using namespace std;
bool isprime(int x)
{
if(x==2)
return true;
if(x<2||x%2==0)
return false;
for(int i=3;i*i<=x;i+=2)
if(x%i==0)
return false;
}
return true;
}
int main()
{
int n;
cin>>n;
int cnt=0;
for(int i=0;i<n;i++){
int x;
cin>>x;
if(isprime(x)){
cnt++;
... | a.cc:17:9: error: expected unqualified-id before 'return'
17 | return true;
| ^~~~~~
a.cc:18:1: error: expected declaration before '}' token
18 | }
| ^
a.cc: In function 'bool isprime(int)':
a.cc:15:9: warning: control reaches end of non-void function [-Wreturn-type]
15 | }
... |
s108612582 | p02257 | C++ | #include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include<cstdio>
#include <vector>
#include<queue>
#include<limits.h>
#include<string.h>
#include<functional>
#include<map>
#include<set>
#include<list>
using namespace std;
signed main() {
int a; cin >> a;
int sum = 0;
for (int i = 0; i ... | a.cc: In function 'int main()':
a.cc:20:23: error: found ':' in nested-name-specifier, expected '::'
20 | int b : cin >> b;
| ^
| ::
a.cc:20:21: error: 'b' has not been declared
20 | int b : cin >> b;
| ... |
s577134034 | p02257 | C++ | #include <iostream>
using namespace std;
static const int N = 100;
int a[N];
int i;
int main(){
cin>>n;
for (i=0,i<n;i++){
cin>>a[i];
}
int ans=0;
for (i=0;i<n;i++){
int j = floor(sqrt(a[i]));
for (int k=2;k<=j;k++){
if (a[i]%k == 0){
break;
... | a.cc: In function 'int main()':
a.cc:7:10: error: 'n' was not declared in this scope
7 | cin>>n;
| ^
a.cc:8:21: error: expected ';' before ')' token
8 | for (i=0,i<n;i++){
| ^
| ;
a.cc:13:23: error: 'sqrt' was not declared in this scope
... |
s762639101 | p02257 | C++ | #include <iostream>
using namespace std;
static const int N = 100;
int a[N];
int i,n;
int main(){
cin>>n;
for (i=0,i<n;i++){
cin>>a[i];
}
int ans=0;
for (i=0;i<n;i++){
int j = floor(sqrt(a[i]));
for (int k=2;k<=j;k++){
if (a[i]%k == 0){
break;
... | a.cc: In function 'int main()':
a.cc:8:21: error: expected ';' before ')' token
8 | for (i=0,i<n;i++){
| ^
| ;
a.cc:13:23: error: 'sqrt' was not declared in this scope
13 | int j = floor(sqrt(a[i]));
| ^~~~
a.cc:13:17: er... |
s749029276 | p02257 | C++ | #include <iostream>
using namespace std;
static const int N = 100;
int a[N];
int i,n;
int main(){
cin>>n;
for (i=0;i<n;i++){
cin>>a[i];
}
int ans=0;
for (i=0;i<n;i++){
int j = floor(sqrt(a[i]));
for (int k=2;k<=j;k++){
if (a[i]%k == 0){
break;
... | a.cc: In function 'int main()':
a.cc:13:23: error: 'sqrt' was not declared in this scope
13 | int j = floor(sqrt(a[i]));
| ^~~~
a.cc:13:17: error: 'floor' was not declared in this scope
13 | int j = floor(sqrt(a[i]));
| ^~~~~
|
s246739742 | p02257 | C++ | int main(){
ios::sync_with_stdio(false);
cin>>n;
for (i=0;i<n;i++){
cin>>a[i];
}
int ans=0;
for (i=0;i<n;i++){
flag=1;
for (int k=2;k*k<=a[i];k++){
if (a[i]%k == 0){
flag=0;
break;
}
}
if... | a.cc: In function 'int main()':
a.cc:2:5: error: 'ios' has not been declared
2 | ios::sync_with_stdio(false);
| ^~~
a.cc:3:5: error: 'cin' was not declared in this scope
3 | cin>>n;
| ^~~
a.cc:3:10: error: 'n' was not declared in this scope
3 | cin>>n;
| ^
a.cc... |
s897994584 | p02257 | C++ | #include <stdio.h>
#include <iostream>
using namespace std;
int countPrimeNumbers(int nums[], int n);
int main(void)
{
int n, nums[10000];
cin >> n;
for (int i = 0; i < n; i++) {
cin >> nums[i];
}
int count = countPrimeNumbers(nums, n);
cout << count << endl;
return 0;
}
int countPrimeNumbers(int nu... | a.cc: In function 'int countPrimeNumbers(int*, int)':
a.cc:31:20: error: 'j' was not declared in this scope
31 | if(j == nums[i]) count++;
| ^
|
s732759676 | p02257 | C++ | #include <stdio.h>
#include <iostream>
using namespace std;
int countPrimeNumbers(int nums[], int n);
int main(void)
{
int n, nums[10000];
cin >> n;
for (int i = 0; i < n; i++) {
cin >> nums[i];
}
int count = countPrimeNumbers(nums, n);
cout << count << endl;
return 0;
}
int countPrimeNumbers(int nu... | a.cc: In function 'int countPrimeNumbers(int*, int)':
a.cc:31:21: error: 'j' was not declared in this scope
31 | if (j == nums[i]) count++;
| ^
|
s237817458 | p02257 | C++ | #include <stdio.h>
#include <iostream>
using namespace std;
int countPrimeNumbers(int nums[], int n);
int main(void)
{
int n, nums[10000];
cin >> n;
for (int i = 0; i < n; i++) {
cin >> nums[i];
}
int count = countPrimeNumbers(nums, n);
cout << count << endl;
return 0;
}
int countPrimeNumbers(int nu... | a.cc: In function 'int countPrimeNumbers(int*, int)':
a.cc:28:22: error: 'j' was not declared in this scope
28 | for (j = 2; j <= nums[i]; j++) {
| ^
a.cc:31:21: error: 'j' was not declared in this scope
31 | if (j == nums[i]) count++;
| ... |
s629389175 | p02257 | C++ | #include <stdio.h>
#include <iostream>
using namespace std;
int countPrimeNumbers(int nums[], int n);
int main(void)
{
int n, nums[10000];
cin >> n;
for (int i = 0; i < n; i++) {
cin >> nums[i];
}
int count = countPrimeNumbers(nums, n);
cout << count << endl;
return 0;
}
int countPrimeNumbers(int nu... | a.cc: In function 'int countPrimeNumbers(int*, int)':
a.cc:28:22: error: 'j' was not declared in this scope
28 | for (j = 2; j * j <= nums[i]; j++) {
| ^
a.cc:31:21: error: 'j' was not declared in this scope
31 | if (j * j > nums[i]) count++;
| ... |
s625345334 | p02257 | C++ | #include <stdio.h>
#include <iostream>
using namespace std;
int countPrimeNumbers(int nums[], int n);
int main(void)
{
int n, nums[10000];
cin >> n;
for (int i = 0; i < n; i++) {
cin >> nums[i];
}
int count = countPrimeNumbers(nums, n);
cout << count << endl;
return 0;
}
int countPrimeNumbers(int nu... | a.cc: In function 'int countPrimeNumbers(int*, int)':
a.cc:31:21: error: 'j' was not declared in this scope
31 | if (j * j > nums[i]) count++;
| ^
|
s442602458 | p02257 | C++ | #include <stdio.h>
#include <iostream>
using namespace std;
int countPrimeNumbers(int nums[], int n);
int main(void)
{
int n, nums[10000];
cin >> n;
for (int i = 0; i < n; i++) {
cin >> nums[i];
}
int count = countPrimeNumbers(nums, n);
cout << count << endl;
return 0;
}
int countPrimeNumbers(int nu... | a.cc: In function 'int countPrimeNumbers(int*, int)':
a.cc:31:21: error: 'j' was not declared in this scope
31 | if (j * j > nums[i]) count++;
| ^
|
s752386870 | p02257 | C++ | #include <stdio.h>
#include <math.h>
??
int isPrime(int);
??
int main(){
??
????int n,data[100000],i,c=0;
??
????scanf("%d",&n);
??
????for(i=0 ; i<n ; i++){
????????scanf("%d",&data[i]);
????????if(isPrime(data[i])==0) c++;
????}
??
printf("%d\n",c);
??
return 0;
??
}
??
??
int isPrime(int x){
??
????int i,a;
??
????a... | a.cc:3:1: error: expected unqualified-id before '?' token
3 | ??
| ^
a.cc:5:1: error: expected unqualified-id before '?' token
5 | ??
| ^
a.cc:22:1: error: expected unqualified-id before '?' token
22 | ??
| ^
|
s192232152 | p02257 | C++ | {
int n, x, i, cnt = 0;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d", &x);
if(isprime(x))
cnt++;
}
printf("%d\n", cnt);
return 0;
} | a.cc:1:1: error: expected unqualified-id before '{' token
1 | {
| ^
|
s210474941 | p02257 | C++ | #include <cmath>
#include <deque>
#include <iostream>
#include <numeric>
#include <vector>
using namespace std;
int main()
{
int n;
cin >> n;
deque<int> d;
vector<bool> v(1000000);
constexpr auto size = 123456 * 2;
d.resize(size - 1);
iota(begin(d), end(d), 2);
const int cut = sqrt(si... | a.cc: In function 'int main()':
a.cc:22:17: error: 'remove_if' was not declared in this scope; did you mean 'remove'?
22 | d.erase(remove_if(begin(d),
| ^~~~~~~~~
| remove
|
s741213219 | p02257 | C++ | #include<iostream>
using namespace std;
int main(){
int n, a;
cin >> n;
int count = 0;
for(int i = 0; i < n; i++){
cin >> a;
if(prime(a) == 1){count++}
}
cout << count <<endl;
}
int prime(int a){
if (n < 2){
return 0;
}
else if (n == 2){
return 1;
}
if (n % 2 == 0){
... | a.cc: In function 'int main()':
a.cc:11:7: error: 'prime' was not declared in this scope
11 | if(prime(a) == 1){count++}
| ^~~~~
a.cc:11:29: error: expected ';' before '}' token
11 | if(prime(a) == 1){count++}
| ^
| ;
a.cc: In f... |
s307824195 | p02257 | C++ | #include<iostream>
using namespace std;
int main(){
int n, a;
cin >> n;
int count = 0;
for(int i = 0; i < n; i++){
cin >> a;
if(prime(a) == 1){count++}
}
cout << count <<endl;
}
int prime(int a){
if (n < 2){
return 0;
}
else if (n == 2){
return 1;
}
if (n % 2 == 0){
... | a.cc: In function 'int main()':
a.cc:11:7: error: 'prime' was not declared in this scope
11 | if(prime(a) == 1){count++}
| ^~~~~
a.cc:11:29: error: expected ';' before '}' token
11 | if(prime(a) == 1){count++}
| ^
| ;
a.cc: In f... |
s872732439 | p02257 | C++ | #include<iostream>
using namespace std;
int main(){
int n, a;
cin >> n;
int count = 0;
for(int i = 0; i < n; i++){
cin >> a;
if(prime(a) == 1){count++}
}
cout << count <<endl;
}
int prime(int n){
if (n < 2){
return 0;
}
else if (n == 2){
return 1;
}
if (n % 2 == 0){
... | a.cc: In function 'int main()':
a.cc:11:7: error: 'prime' was not declared in this scope
11 | if(prime(a) == 1){count++}
| ^~~~~
a.cc:11:29: error: expected ';' before '}' token
11 | if(prime(a) == 1){count++}
| ^
| ;
|
s637679429 | p02257 | C++ | #include<iostream>
using namespace std;
int main(){
int n, a;
cin >> n;
int count = 0;
for(int i = 0; i < n; i++){
cin >> a;
if(prime(a) == 1){count++;}
}
cout << count <<endl;
}
int prime(int n){
if (n < 2){
return 0;
}
else if (n == 2){
return 1;
}
if (n % 2 == 0){
... | a.cc: In function 'int main()':
a.cc:11:7: error: 'prime' was not declared in this scope
11 | if(prime(a) == 1){count++;}
| ^~~~~
|
s084611240 | p02257 | C++ | #include<iostream>
using namespace std;
int main(){
int n, a;
cin >> n;
int count = 0;
for(int i = 0; i < n; i++){
cin >> a;
if(prime(a) == 1){count++;}
}
cout << count <<endl;
}
int prime(int n){
if (n < 2){
return 0;
}
else if (n == 2){
return 1;
}
if (n % 2 == 0){
... | a.cc: In function 'int main()':
a.cc:11:7: error: 'prime' was not declared in this scope
11 | if(prime(a) == 1){count++;}
| ^~~~~
|
s998456344 | p02257 | C++ | #include<iostream>
using namespace std;
int main(){
int n, a;
cin >> n;
int count = 0;
for(int i = 0; i < n; i++){
cin >> a;
if(prime(a) == 1){count++;}
}
cout << count <<endl;
}
public static int prime(int n){
if (n < 2){
return 0;
}
else if (n == 2){
return 1;
}
if (n %... | a.cc: In function 'int main()':
a.cc:11:7: error: 'prime' was not declared in this scope
11 | if(prime(a) == 1){count++;}
| ^~~~~
a.cc: At global scope:
a.cc:17:1: error: expected unqualified-id before 'public'
17 | public static int prime(int n){
| ^~~~~~
|
s113450750 | p02257 | C++ | #include<iostream>
using namespace std;
int main(){
int n, a;
cin >> n;
int count = 0;
for(int i = 0; i < n; i++){
cin >> a;
if(prime(a) == 1){count++;}
}
cout << count <<endl;
}
static int prime(int n){
if (n < 2){
return 0;
}
else if (n == 2){
return 1;
}
if (n % 2 == 0)... | a.cc: In function 'int main()':
a.cc:11:7: error: 'prime' was not declared in this scope
11 | if(prime(a) == 1){count++;}
| ^~~~~
|
s787300562 | p02257 | C++ | #include<iostream>
using namespace std;
class Main{
int main(){
int n, a;
cin >> n;
int count = 0;
for(int i = 0; i < n; i++){
cin >> a;
if(prime(a) == 1){count++;}
}
cout << count <<endl;
}
int prime(int n){
if (n < 2){
return 0;
}
else if (n == 2){
return 1;
}
if (n % 2 =... | a.cc:36:2: error: expected ';' after class definition
36 | }
| ^
| ;
a.cc: In member function 'int Main::main()':
a.cc:15:1: warning: no return statement in function returning non-void [-Wreturn-type]
15 | }
| ^
|
s740767938 | p02257 | C++ | #include<iostream>
using namespace std;
class Main{
int main(){
int n, a;
cin >> n;
int count = 0;
for(int i = 0; i < n; i++){
cin >> a;
if(prime(a) == 1){count++;}
}
cout << count <<endl;
}
int prime(int n){
if (n < 2){
return 0;
}
else if (n == 2){
return 1;
}
if (n % 2 ... | a.cc:37:2: error: expected ';' after class definition
37 | }
| ^
| ;
a.cc: In member function 'int Main::main()':
a.cc:14:1: warning: no return statement in function returning non-void [-Wreturn-type]
14 | }
| ^
|
s236284555 | p02257 | C++ | #include<iostream>
using namespace std;
class Main{
int main(){
int n, a;
cin >> n;
int count = 0;
for(int i = 0; i < n; i++){
cin >> a;
if(prime(a) == 1){count++;}
}
cout << count <<endl;
}
int prime(int n){
if (n < 2){
return 0;
}
else if (n == 2){
return 1;
}
if (n % 2 ... | a.cc:37:2: error: expected ';' after class definition
37 | }
| ^
| ;
a.cc: In member function 'int Main::main()':
a.cc:14:1: warning: no return statement in function returning non-void [-Wreturn-type]
14 | }
| ^
|
s929430322 | p02257 | C++ | #include<iostream>
using namespace std;
class Main{
int main(){
int n, a;
cin >> n;
int count = 0;
for(int i = 0; i < n; i++){
cin >> a;
if(prime(a) == 1){count++;}
}
cout << count <<endl;
}
int prime(int n){
if (n < 2){
return 0;
}
else if (n == 2){
return 1;
}
if (n % ... | a.cc:38:2: error: expected ';' after class definition
38 | }
| ^
| ;
a.cc: In member function 'int Main::main()':
a.cc:16:1: warning: no return statement in function returning non-void [-Wreturn-type]
16 | }
| ^
|
s160580232 | p02257 | C++ | #include<iostream>
using namespace std;
class Main{
int main(){
int n, a;
cin >> n;
int count = 0;
for(int i = 0; i < n; i++){
cin >> a;
if(prime(a) == 1){count++;}
}
cout << count <<endl;
}
int prime(int n){
if (n < 2){
return 0;
}
else if (n == 2){
return 1;
}
if (n % ... | a.cc:38:2: error: expected ';' after class definition
38 | }}
| ^
| ;
a.cc: In member function 'int Main::main()':
a.cc:16:1: warning: no return statement in function returning non-void [-Wreturn-type]
16 | }
| ^
a.cc: At global scope:
a.cc:38:2: error: expected declaration before '}' token
... |
s939805154 | p02257 | C++ | #include<iostream>
using namespace std;
void inputData(int R[], int *N)
{
cin >> *N;
for (int i = 0; i < *N; i++)
{
cin >> R[i];
}
}
void traceData(int R[], int N)
{
int i;
for (i = 0; i < (N - 1); i++)
{
cout << R[i];
}
cout << R[i];
}
bool isPrimeNumber(int in)
{
if (in == 2) return true;
if (in % 2... | a.cc: In function 'bool isPrimeNumber(int)':
a.cc:27:22: error: 'sqrt' was not declared in this scope
27 | int s = (int)sqrt((double)in);
| ^~~~
|
s393135711 | p02257 | C++ | #include<iostream>
using namespace std;
void inputData(int R[], int *N)
{
cin >> *N;
for (int i = 0; i < *N; i++)
{
cin >> R[i];
}
}
bool isPrimeNumber(int in)
{
if (in == 2) return true;
if (in % 2 == 0) return false;
int s = (int)sqrt((double)in);
for (int i = 3; i < s; i=i+2)
{
if ((in % i) == 0)
{... | a.cc: In function 'bool isPrimeNumber(int)':
a.cc:17:22: error: 'sqrt' was not declared in this scope
17 | int s = (int)sqrt((double)in);
| ^~~~
|
s620650835 | p02257 | C++ | #include<iostream>
#include <math.h>
using namespace std;
int main(){
int N, x, c;c=0;
cin >> N;
for (int i =0; i < N; i++) {
cin >> x;
int fc;fc=0;
for (int j =1; j < sqrt(x); j++) {
if (x%j=0) fc+=1;
}
if (fc==2) c+=1;
}
cout << c;
return 0;
} | a.cc: In function 'int main()':
a.cc:12:15: error: lvalue required as left operand of assignment
12 | if (x%j=0) fc+=1;
| ~^~
|
s029626924 | p02257 | C++ | #include<iostream>
#include <math.h>
using namespace std;
int main(){
int N, x, c;c=0;
cin >> N;
for (int i =0; i < N; i++) {
cin >> x;
int fc;fc=0;
for (int j =1; j < sqrt(x); j++)
if (x%j=0) fc+=1;
if (fc==2) c+=1;
}
cout << c;
return 0;
} | a.cc: In function 'int main()':
a.cc:12:15: error: lvalue required as left operand of assignment
12 | if (x%j=0) fc+=1;
| ~^~
|
s632182507 | p02257 | C++ | #include <stdio.h>
int main() {
int n,i,p;
int flag = 0;
scanf("%d", &n);
for( i=0;i<n;++i ) {
scanf("%d\n",&p)
}
for(i=2,i<p,i++){
if( n%i==0 ) {
flag = 1;
break;
}
if( flag==0 ){
printf("%d\n",p);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:9:20: error: expected ';' before '}' token
9 | scanf("%d\n",&p)
| ^
| ;
10 | }
| ~
a.cc:11:18: error: expected ';' before ')' token
11 | for(i=2,i<p,i++){
| ^
| ... |
s602462022 | p02257 | C++ | #include <stdio.h>
int main() {
int n,i,p;
int flag = 0;
scanf("%d", &n);
for( i=0;i<n;++i ) {
scanf("%d\n",&p)
}
for(i=2,i<p,i++){
if( n%i==0 ) {
flag = 1;
break;
}
}
if( flag==0 ){
printf("%d\n",p);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:9:20: error: expected ';' before '}' token
9 | scanf("%d\n",&p)
| ^
| ;
10 | }
| ~
a.cc:11:18: error: expected ';' before ')' token
11 | for(i=2,i<p,i++){
| ^
| ... |
s025177860 | p02257 | C++ | int main(void) {
int i,j,n, m[10000],count=0;
j = 0;
scanf("%d",&n);
for (i = 0; i < n; i++) scanf("%d",&m[i]);
while (1) {
while (1) {
if (m[j] < 2)
break;
else if (m[j] == 2) {
count++;
break;
}
if (m[j] % 2 == 0)
break;
for (i = 3; i <= m[j] / i; i += 2)
if (m[j] % i ==... | a.cc: In function 'int main()':
a.cc:5:9: error: 'scanf' was not declared in this scope
5 | scanf("%d",&n);
| ^~~~~
a.cc:34:9: error: 'printf' was not declared in this scope
34 | printf("%d", count);
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; th... |
s724678118 | p02257 | C++ | #include <stdlib.h>
#include <math.h>
#include <stdio.h>
int main(){
int i,j,n,x;
scanf("%d",&n);
for(i=0;i<n;i++){
int a[i];
scanf("%d",a[i]);
printf(" ");
}
x=0;
for(i=0;i<n;i++){
while(j<a[i]){
if(a[i]%j == 0){
break;
}
x +=1;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:15:12: error: 'a' was not declared in this scope
15 | while(j<a[i]){
| ^
a.cc:22:2: error: expected '}' at end of input
22 | }
| ^
a.cc:5:11: note: to match this '{'
5 | int main(){
| ^
|
s742848167 | p02257 | C++ | #include <stdlib.h>
#include <math.h>
#include <stdio.h>
int main(){
int i,j,n,x,y;
scanf("%d",&n);
for(i=0;i<n;i++){
int a[i];
scanf("%d",a[i]);
printf("\n");
}
x = y =0;
for(i=0;i<n;i++){
for(j=2;j<a[i];j++){
if(a[i]%j != 0){
x = 1;
}
}
y += x;
}
printf("%d\n",y);
re... | a.cc: In function 'int main()':
a.cc:15:15: error: 'a' was not declared in this scope
15 | for(j=2;j<a[i];j++){
| ^
|
s540090531 | p02257 | C++ | #include <stdlib.h>
#include <math.h>
#include <stdio.h>
int main(){
int i,j,n,x,y,z;
scanf("%d",&n);
for(i=0;i<n;i++){
int a[i];
scanf("%d",a[i]);
printf("\n");
}
x = y =0;
for(i=0;i<n;i++){
z = a[i];
for(j=2;j<z;j++){
if(a[i]%j != 0){
x = 1;
}
}
y += x;
}
printf(... | a.cc: In function 'int main()':
a.cc:15:9: error: 'a' was not declared in this scope
15 | z = a[i];
| ^
|
s137955366 | p02257 | C++ | #include <stdlib.h>
#include <math.h>
#include <stdio.h>
int main(){
int i,j,n,x,y,z,a[];
scanf("%d",&n);
for(i=0;i<n;i++){
int a[i];
scanf("%d",a[i]);
printf("\n");
}
x = y =0;
for(i=0;i<n;i++){
for(j=2;j<a[i];j++){
if(a[i]%j != 0){
x = 1;
}
}
y += x;
}
printf("%d\n",... | a.cc: In function 'int main()':
a.cc:6:17: error: storage size of 'a' isn't known
6 | int i,j,n,x,y,z,a[];
| ^
|
s905215603 | p02257 | C++ | #include <stdlib.h>
#include <math.h>
#include <stdio.h>
int main(){
int i,j,n,x,y,z;
scanf("%d",&n);
int a[n];
for(i=0;i<n;i++){
int a[i];
scanf("%d",a[i]);
printf("\n");
}
x = y =0;
for(i=0;i<n;i++){
for(j=2;j<a[i];j++){
if(a[i]%j =! 0){
x = 1;
}
}
y += x;
}
printf("... | a.cc: In function 'int main()':
a.cc:17:16: error: lvalue required as left operand of assignment
17 | if(a[i]%j =! 0){
| ~~~~^~
|
s068197010 | p02257 | C++ | #include<iostream>
#include<cmath>
#define size 1000;
using namespace std;
bool isprime (int x) {
int = i;
if (x == 2) {
return true;
}
if (x < 2 || x % 2) {
return false;
}
for (i = 3; i <= sqrt(x); i += 2) {
if (n % i) {
return false;
}... | a.cc: In function 'bool isprime(int)':
a.cc:10:9: error: expected unqualified-id before '=' token
10 | int = i;
| ^
a.cc:24:10: error: 'i' was not declared in this scope
24 | for (i = 3; i <= sqrt(x); i += 2) {
| ^
a.cc:26:13: error: 'n' was not declared in this scope
26 | ... |
s246945577 | p02257 | C++ | #include<iostream>
#include<cmath>
#define size 1000;
using namespace std;
bool isprime (int x) {
int i;
if (x == 2) {
return true;
}
if (x < 2 || x % 2) {
return false;
}
for (i = 3; i <= sqrt(x); i += 2) {
if (n % i) {
return false;
}
... | a.cc: In function 'bool isprime(int)':
a.cc:26:13: error: 'n' was not declared in this scope
26 | if (n % i) {
| ^
a.cc: At global scope:
a.cc:39:1: error: expected declaration before '}' token
39 | }
| ^
a.cc: In function 'int main()':
a.cc:4:18: error: expected ']' before ';' tok... |
s048192182 | p02257 | C++ | #include<iostream>
#include<cmath>
#define size 1000;
using namespace std;
bool isprime (int x) {
int i;
if (x == 2) {
return true;
}
if (x < 2 || x % 2) {
return false;
}
for (i = 3; i <= sqrt(x); i += 2) {
if (n % i == 0) {
return false;
... | a.cc: In function 'bool isprime(int)':
a.cc:26:13: error: 'n' was not declared in this scope
26 | if (n % i == 0) {
| ^
a.cc: At global scope:
a.cc:39:1: error: expected declaration before '}' token
39 | }
| ^
a.cc: In function 'int main()':
a.cc:4:18: error: expected ']' before ';... |
s317570368 | p02257 | C++ | #include<iostream>
#include<cmath>
#define size 1000;
using namespace std;
bool isprime (int x) {
int i;
if (x == 2) {
return true;
}
if (x < 2 || x % 2 == 0) {
return false;
}
for (i = 3; i <= sqrt(x); i += 2) {
if (n % i == 0) {
return false;
... | a.cc: In function 'bool isprime(int)':
a.cc:26:13: error: 'n' was not declared in this scope
26 | if (n % i == 0) {
| ^
a.cc: At global scope:
a.cc:39:1: error: expected declaration before '}' token
39 | }
| ^
a.cc: In function 'int main()':
a.cc:4:18: error: expected ']' before ';... |
s246032287 | p02257 | C++ | #include<iostream>
#include<cmath>
#define size = 1000;
using namespace std;
bool isprime (int x) {
int i;
if (x == 2) {
return true;
}
if (x < 2 || x % 2 == 0) {
return false;
}
for (i = 3; i <= sqrt(x); i += 2) {
if (n % i == 0) {
return false;
... | a.cc: In function 'bool isprime(int)':
a.cc:26:13: error: 'n' was not declared in this scope
26 | if (n % i == 0) {
| ^
a.cc: At global scope:
a.cc:39:1: error: expected declaration before '}' token
39 | }
| ^
a.cc: In function 'int main()':
a.cc:4:14: error: expected primary-expre... |
s477115955 | p02257 | C++ | #include<stdio.h>
int main()
{
int i,j,n,s, d;
int a[10000];
scanf("%d", &n);
s = n;
for (i = 0; i < n; i++) {
scanf("%d", &a[i]);
}
for (i = 0; i < n; i++)
{
for (j = 2; j < a[i]; j++) {
if (a[i] % j == 0 || a[i]%2+==0) {
s = s - 1;
break;
}
}
}
printf("%d\n", s);
} | a.cc: In function 'int main()':
a.cc:16:54: error: expected primary-expression before '=' token
16 | if (a[i] % j == 0 || a[i]%2+==0) {
| ^
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.