submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3
values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s213747543 | p03672 | C++ | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
char str[233];
int main() {
while(~scanf("%s", str)) {
int ln = strlen(str);
int res;
for(int i = ln-1; i >= 0; i--) {
if(i & 1) {
bool flg=1;
for(int j = 0, k=(i-1)/2 + 1; j <= (i-1)/2, k <= i; j++, k++) {
if(str[i] != str[j] {
flg=0;
break;
}
}
if(!flg) continue;
else { res = i+1; break;}
}
}
printf("%d\n", res);
}
} | a.cc: In function 'int main()':
a.cc:17:20: error: expected ')' before '{' token
17 | if(str[i] != str[j] {
| ~ ^~
| )
a.cc:21:1: error: expected primary-expression before '}' token
21 | }
| ^
|
s216068310 | p03672 | C++ | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
char str[233];
int main() {
while(~scanf("%s", str)) {
int ln = strlen(str);
int res;
for(int i = ln-1; i >= 0; i--) {
if(i & 1) {
bool flg=1;
for(int j = 0, k=(i-1)/2 + 1; j <= (i-1)/2, k <= i; j++, k++) {
if(str[i] != str[j] {
flg=0;
break;
}
}
if(!flg) continue;
else { res = i+1; break;}
}
}
printf("%d\n", res);
}
} | a.cc: In function 'int main()':
a.cc:17:20: error: expected ')' before '{' token
17 | if(str[i] != str[j] {
| ~ ^~
| )
a.cc:21:1: error: expected primary-expression before '}' token
21 | }
| ^
|
s794500651 | p03672 | C++ | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
char str[233];
int main() {
while(~scanf("%s", str)) {
int ln = strlen(str);
int res;
for(int i = ln-1; i >= 0; i--) {
if(i & 1) {
bool flg=1;
for(int j = 0, k=(i-1)/2 + 1; j <= (i-1)/2, k <= i; j++, k++) {
if(str[i] != str[j] {
flg=0;
break;
}
}
if(!flg) continue;
else { res = i; break;}
}
}
printf("%d\n", i+1);
}
} | a.cc: In function 'int main()':
a.cc:17:20: error: expected ')' before '{' token
17 | if(str[i] != str[j] {
| ~ ^~
| )
a.cc:21:1: error: expected primary-expression before '}' token
21 | }
| ^
a.cc:26:16: error: 'i' was not declared in this scope
26 | printf("%d\n", i+1);
| ^
|
s681178948 | p03672 | C++ | #include <iostream>
#include <vector>
#include <limits>
#include <string>
#include <boost/range/irange.hpp>
#include <boost/range/adaptors.hpp>
using namespace std;
using namespace boost;
using uint = unsigned int;
using ll = long long int;
using ull = unsigned long long int;
bool is_ok(const string & s){
if (s.size()%2==1)return false; else {
for (auto &&i: irange(0U, s.size()/2)){
if (s.at(i)!=s.at(s.size()/2+i))return false;
}
}
return true;
}
int main() {
string s;
cin >> s;
s.pop_back();
while (!s.empty()){
if (is_ok(s)){cout << s.size();return 0;} else s.pop_back();
}
return 0;
} | a.cc:5:10: fatal error: boost/range/irange.hpp: No such file or directory
5 | #include <boost/range/irange.hpp>
| ^~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
|
s439213168 | p03672 | C++ | #include <iostream>
using namespace std;
int main(void){
int len,i,cnt;
vector<int> a;
scanf("%s",a);
for(i=a.size()/2;--i;){
cnt=0;
for(int j=0;j<i;j++)if(a[j]==a[j+i])cnt++;
if(cnt==i)break;
}
printf("%d\n",i*2);
} | a.cc: In function 'int main()':
a.cc:5:5: error: 'vector' was not declared in this scope
5 | vector<int> a;
| ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
1 | #include <iostream>
+++ |+#include <vector>
2 | using namespace std;
a.cc:5:12: error: expected primary-expression before 'int'
5 | vector<int> a;
| ^~~
a.cc:6:16: error: 'a' was not declared in this scope
6 | scanf("%s",a);
| ^
|
s760570902 | p03672 | C++ | #include<stdio.h>
#include<string.h>
#include<conio.h>
main()
{
int i,j,k,l,sum=0,count=0;
char a[200];
gets(a);
l=strlen(a)-1;
for(i=0;i<l/2;i++)
{
// printf("c%dc",l);
if(l%2==0){
for(j=0;j<l;j++)
{
if(a[i]==a[j])
{
count++;
}
}
// printf("%c=%d\n",a[i],count);
if(count%2!=0)
{
l--;
count=0;
i=0;
}
else{
sum=sum+count;
count=0;
}
}
else {
l--;i=0;
}
}
printf("%d",l);
} | a.cc:3:9: fatal error: conio.h: No such file or directory
3 | #include<conio.h>
| ^~~~~~~~~
compilation terminated.
|
s151111837 | p03672 | C++ | #include<stdio.h>
#include<string.h>
main()
{
int i,j,k,l,sum=0,count=0;
char a[200];
gets(a);
l=strlen(a)-1;
for(i=0;i<l/2;i++)
{
// printf("c%dc",l);
if(l%2==0){
for(j=0;j<l;j++)
{
if(a[i]==a[j])
{
count++;
}
}
// printf("%c=%d\n",a[i],count);
if(count%2!=0)
{
l--;
count=0;
i=0;
}
else{
sum=sum+count;
count=0;
}
}
else {
l--;i=0;
}
}
printf("%d",l);
} | a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
3 | main()
| ^~~~
a.cc: In function 'int main()':
a.cc:7:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
7 | gets(a);
| ^~~~
| getw
|
s679928012 | p03672 | C++ | #include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <vector>
#include <cstdio>
#include <cmath>
using namespace std;
int main(){
string s;
cin>>s;
int size=s.length();
for(int i=size+1;i>=2;i=i-2){
int k=i/2;
string sub=s.substr(0,k-1);
string test=sub+sub;
if(test==s.substr(0,i-1){
cout<<i;
break;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:19:29: error: expected ')' before '{' token
19 | if(test==s.substr(0,i-1){
| ~ ^
| )
a.cc:23:3: error: expected primary-expression before '}' token
23 | }
| ^
|
s782802707 | p03672 | Java | public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String S = sc.next();
int O = S.length()-1;
int ans = 1;
char[] C = S.toCharArray();
if (O% 2 == 1) {
O = O - 1;
ans++;
}
lavel:for (int i = 0; i < O/2;i=i+2) {
for (int j = 0; j < (O-i) / 2; j++) {
if (C[j] == C[(O-i) / 2 + j]){} else {
ans=ans+2;
continue lavel;
}
}
break;
}
System.out.println(S.length()-ans);
}
} | Main.java:4: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:4: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
2 errors
|
s836498539 | p03672 | C++ | #include<iostream>
#include<stdio.h>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
int main()
{
char s[200];
cin >> s;
int len = strlen(s);
for (int i = len - 2; i; i -= 2) {
if (strncmp(s, s + i / 2, i / 2) == 0) {
cout << i << endl;
return 0;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:12:19: error: 'strlen' was not declared in this scope
12 | int len = strlen(s);
| ^~~~~~
a.cc:6:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
5 | #include<vector>
+++ |+#include <cstring>
6 | using namespace std;
a.cc:14:21: error: 'strncmp' was not declared in this scope
14 | if (strncmp(s, s + i / 2, i / 2) == 0) {
| ^~~~~~~
a.cc:14:21: note: 'strncmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
|
s872364017 | p03672 | C++ | #include<iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
int main()
{
char s[200];
cin >> s;
int len = strlen(s);
for (int i = len - 2; i; i -= 2) {
if (strncmp(s, s + i / 2, i / 2) == 0) {
cout << i << endl;
return 0;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:11:19: error: 'strlen' was not declared in this scope
11 | int len = strlen(s);
| ^~~~~~
a.cc:5:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
4 | #include<vector>
+++ |+#include <cstring>
5 | using namespace std;
a.cc:13:21: error: 'strncmp' was not declared in this scope
13 | if (strncmp(s, s + i / 2, i / 2) == 0) {
| ^~~~~~~
a.cc:13:21: note: 'strncmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
|
s087352545 | p03672 | C++ | #include <iostream>
#include <climits>
#include <string>
#include <stdlib.h>
#include <algorithm>
using namespace std;
int ascSort(const void* v1, const void* v2) {
const int _v1 = *((const int*)v1);
const int _v2 = *((const int*)v2);
if ( _v1 < _v2 ) {
return 1;
} else if ( _v1 > _v2 ) {
return -1;
} else {
return 0;
}
}
string a[50];
int main(){
int n,x=0;
char s[202];
cin >> s;
n = strlen(s);
int i,j;
for(i=n-2;i>=0;i-=2){
x=0;
for(j=0;j<i/2;j++){
if(s[j]!=s[j+i/2]){
x=1;
break;
}
}
if(x==0){
cout << i << endl;
break;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:28:13: error: 'strlen' was not declared in this scope
28 | n = strlen(s);
| ^~~~~~
a.cc:6:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
5 | #include <algorithm>
+++ |+#include <cstring>
6 |
|
s946226125 | p03672 | C++ | #include <bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<queue>
#include<map>
#include<cstring>
#include<string>
#include <math.h>
#include<algorithm>
// #include <boost/multiprecision/cpp_int.hpp>
#include<functional>
// #define int long long
#define inf 1000000007
#define pa pair<int,int>
#define ll long long
#define pal pair<double,pa>
#define ppa pair<int,int>
#define ppap pair<pa,pa>
#define ssa pair<string,int>
#define mp make_pair
#define pb push_back
#define EPS (1e-10)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define VI vector<int>
using namespace std;
class pas{
public:
int x,y;
pas(int x=0,int y=0):x(x),y(y) {}
pas operator + (pas p) {return pas(x+p.x,y+p.y);}
pas operator - (pas p) {return pas(x-p.x,y-p.y);}
pas operator * (int a) {return pas(x*a,y*a);}
pas operator / (int a) {return pas(x/a,y/a);}
// double absv() {return sqrt(norm());}
int norm() {return x*x+y*y;}
bool operator < (const pas &p) const{
return x != p.x ? x<p.x: y<p.y;
}
bool operator == (const pas &p) const{
return x==p.x && y==p.y;
}
};
int a[60];
signed main(){
string s;
cin>>s;
int l=s.length();
while(int i=(l-2)/2;i=0;i++){
if(s.substr(0,i)==s.substr(i,2*i)){
cout<<i*2<<endl;
return 0;
}
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:52:36: error: expected ')' before ';' token
52 | while(int i=(l-2)/2;i=0;i++){
| ~ ^
| )
a.cc:52:37: error: 'i' was not declared in this scope
52 | while(int i=(l-2)/2;i=0;i++){
| ^
|
s123774570 | p03672 | C++ | #include <iostream>
#include <string>
using namespace std;
int main(void) {
int a, b, c = INT_MAX;
string n, x, y;
cin >> n;
a = size(n);
for (int i = 1; i < a; i++) {
b = a - i;
if ((b % 2) == 0) {
x = n.substr(0, (b / 2));
y = n.substr((b / 2), (b / 2));
if (x.compare(y) == 0) {
if (i < c)
c = i;
}
}
}
cout << a - c << endl;
} | a.cc: In function 'int main()':
a.cc:6:17: error: 'INT_MAX' was not declared in this scope
6 | int a, b, c = INT_MAX;
| ^~~~~~~
a.cc:2:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
1 | #include <iostream>
+++ |+#include <climits>
2 | #include <string>
|
s683458425 | p03672 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
int size = s.size();
for (int i = 0; i < size; i++) {
s.pop_back();
itn ss = s.size();
if (s.substr(0, ss/2) == s.substr(ss/2, ss/2)) {
cout << ss - 1 << endl;
return 0;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:11:9: error: 'itn' was not declared in this scope; did you mean 'int'?
11 | itn ss = s.size();
| ^~~
| int
a.cc:12:25: error: 'ss' was not declared in this scope; did you mean 's'?
12 | if (s.substr(0, ss/2) == s.substr(ss/2, ss/2)) {
| ^~
| s
|
s008386488 | p03672 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const ll INF = 1023456789;
#define REP(i,n) for(int i=0;i<n;++i)
#define REPR(i,n) for(int i=n-1;i>=0;--i)
#define FOR(i,s,n) for(int i=s;i<n;++i)
#define FORR(i,s,n) for(int i=n-1;i>=s;--i)
#define ALL(c) (c).begin(),(c).end()
#define CLEAR(v) memset(v,0,sizeof(v))
#define MP(a,b) make_pair((a),(b))
#define ABS(a) ((a)>0?(a):-(a))
#define F first
#define S second
int main(int argc, char **argv) {
string s;
cin >> s;
for (int i = s.length() - 2; i -= 2) {
bool f = true;
REP(j, i / 2) f &= (s[j] == s[i / 2 + j]);
if (f) {
cout << i << endl;
break;
}
}
return 0;
}
| a.cc: In function 'int main(int, char**)':
a.cc:28:44: error: expected ';' before ')' token
28 | for (int i = s.length() - 2; i -= 2) {
| ^
| ;
|
s348906219 | p03672 | C++ | #include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <numeric>
using namespace std;
const double PI = acos(-1.0);
const string ALP = "abcdefghijklmnopqrstuvwxyz";
#define PB push_back
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
int main(){
string s;
cin >> s;
for(int i=1,i<s.length(),i++){
string t = s.substr(0, s.length()-i);
if(t.length()%2==0){
if(t.substr(0,t.length()/2)== t.substr(t.length()/2,t.length()/2)){
cout << t.length();
break;
}
}
}
cout << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:17:16: error: expected ';' before '<' token
17 | for(int i=1,i<s.length(),i++){
| ^
| ;
a.cc:17:16: error: expected primary-expression before '<' token
a.cc:17:31: error: expected ';' before ')' token
17 | for(int i=1,i<s.length(),i++){
| ^
| ;
|
s098798399 | p03672 | C++ | //abc066_b ss
#include <bits/stdc++.h>
using namespace std;
namespace
{
bool Chk( const char *S, const int iNum )
{
int i;
char C;
for( i = 0; i < iNum; i++ )
{
C = S[ i ];
if( C == '\0' || C != S[ i + iNum ] ) return false;
}
return true;
}
}
int main()
{
int i;
int iLen;
char S[ 210 ];
cin >> S;
iLen = strlen( S );
for( i = iLen / 2; i > 0; i-- )
{
if( Chk( i ) )
{
cout << i * 2 << endl;
return 0;
}
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:36:26: error: invalid conversion from 'int' to 'const char*' [-fpermissive]
36 | if( Chk( i ) )
| ^
| |
| int
a.cc:36:24: error: too few arguments to function 'bool {anonymous}::Chk(const char*, int)'
36 | if( Chk( i ) )
| ~~~^~~~~
a.cc:9:6: note: declared here
9 | bool Chk( const char *S, const int iNum )
| ^~~
|
s085868187 | p03672 | C++ | //abc066_b ss
#include <bits/stdc++.h>
using namespace std;
namespace
{
bool Chk( const char *S, const int iNum )
{
int i;
char C;
for( i = 0; i < iNum; i++ )
{
C = S[ i ];
if( C == '\0' || C != S[ i + iNum ]; ) return false;
}
return true;
}
}
int main()
{
int i;
int iLen;
char S[ 210 ];
cin >> S;
iLen = strlen( S );
for( i = iLen / 2; i > 0; i-- )
{
if( Chk( i ) )
{
cout << i * 2 << endl;
return 0;
}
}
return 0;
}
| a.cc: In function 'bool {anonymous}::Chk(const char*, int)':
a.cc:17:54: error: expected primary-expression before ')' token
17 | if( C == '\0' || C != S[ i + iNum ]; ) return false;
| ^
a.cc: In function 'int main()':
a.cc:36:26: error: invalid conversion from 'int' to 'const char*' [-fpermissive]
36 | if( Chk( i ) )
| ^
| |
| int
a.cc:36:24: error: too few arguments to function 'bool {anonymous}::Chk(const char*, int)'
36 | if( Chk( i ) )
| ~~~^~~~~
a.cc:9:6: note: declared here
9 | bool Chk( const char *S, const int iNum )
| ^~~
|
s312373678 | p03672 | C++ | include<bits/stdc++.h>
using namespace std;
int main(){
string S, s;
cin>>S;
int res=0;
for(int i=0;i<(int)S.size();i+=2){
s+=S[i];
s+=S[i+1];
if(s.substr(0, i/2)==s.substr(i/2, i/2)){
res=i;
}
}
cout<<res<<endl;
return 0;
}
| a.cc:1:1: error: 'include' does not name a type
1 | include<bits/stdc++.h>
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:6:9: error: 'string' was not declared in this scope
6 | string S, s;
| ^~~~~~
a.cc:7:9: error: 'cin' was not declared in this scope
7 | cin>>S;
| ^~~
a.cc:7:14: error: 'S' was not declared in this scope
7 | cin>>S;
| ^
a.cc:10:17: error: 's' was not declared in this scope
10 | s+=S[i];
| ^
a.cc:16:9: error: 'cout' was not declared in this scope
16 | cout<<res<<endl;
| ^~~~
a.cc:16:20: error: 'endl' was not declared in this scope
16 | cout<<res<<endl;
| ^~~~
|
s193121403 | p03672 | C | #include<stdio.h>
int main()
{
char s;
scanf("%e",&s);
/* 文字数をカウント */
for(i=0; moji[i]!='\0'; ++i);
i = i-2
/* 文字数を出力 */
printf("%d\n",i);
// 出力
return 0;
} | main.c: In function 'main':
main.c:7:7: error: 'i' undeclared (first use in this function)
7 | for(i=0; moji[i]!='\0'; ++i);
| ^
main.c:7:7: note: each undeclared identifier is reported only once for each function it appears in
main.c:7:12: error: 'moji' undeclared (first use in this function)
7 | for(i=0; moji[i]!='\0'; ++i);
| ^~~~
main.c:8:9: error: expected ';' before 'printf'
8 | i = i-2
| ^
| ;
9 | /* 文字数を出力 */
10 | printf("%d\n",i);
| ~~~~~~
|
s130430994 | p03672 | C++ | #include <iostream>
#include <string>
using namespace std;
int main(){
string s;
cin >> s;
if(s.length() % 2 == 1) s.insert(-1,"a");
while(1){
int ans, i=0;
s.erase(s.end()-1);
if(s.substr(0,s.length()/2) == s.substr(s.length()/2)){
ans = s.length() / 2;
break;
}
i++;
}
cout << &ans << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:19:14: error: 'ans' was not declared in this scope; did you mean 'abs'?
19 | cout << &ans << endl;
| ^~~
| abs
|
s820008534 | p03672 | C++ | #include <iostream>
#include<sstream>
#include<vector>
#include<iterator>
using namespace std;
int main(void)
{
string S;
cin >> S;
string rs(S);
reverse(rs.begin(), rs.end());
int ret;
for(int i=(S.size()%2==0 ? 2 : 1); i<S.size(); i+=2)
{
string l, r;
int length = (S.size() - i) / 2;
int size = length / 2;
l = rs.substr(i, length);
r = rs.substr(i+length, length);
if(l == r)
{
ret = length * 2;
break;
}
}
cout << ret << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:13:9: error: 'reverse' was not declared in this scope
13 | reverse(rs.begin(), rs.end());
| ^~~~~~~
|
s220453303 | p03672 | Java | import java.util.*;
import org.apache.tools.ant.taskdefs.Exit;
public class Main {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
String s = sc.nextLine();
isOddString(s.substring(0, s.length() - 1));
}
public static void isOddString(String s) {
if (s.length() % 2 != 0) {
isOddString(s.substring(0, s.length() - 1));
}
if (s.substring(0, s.length() / 2).equals(s.substring(s.length() / 2, s.length()))) {
System.out.println(s.length());
System.exit(0);
} else {
isOddString(s.substring(0, s.length() - 1));
}
}
}
| Main.java:3: error: package org.apache.tools.ant.taskdefs does not exist
import org.apache.tools.ant.taskdefs.Exit;
^
1 error
|
s438512203 | p03672 | Java | import java.util.Scanner;
public class Main2 {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
String str = scan.nextLine();
String ans;
String ans2;
int answer = 0;
for(int i = 1; i < str.length()+1; i++){
ans = str.substring(0, str.length()-i);
if(ans.length() % 2 == 0){
if(ans.substring(0, ans.length()/2).equals(ans.substring(ans.length()/2, ans.length()))){
answer = ans.length();
break;
}
}
}
System.out.println(answer);
}
}
| Main.java:3: error: class Main2 is public, should be declared in a file named Main2.java
public class Main2 {
^
1 error
|
s743690693 | p03672 | C++ |
#include <iostream>
#include <vector>
#include <string>
#include <limits.h>
using namespace std;
int main(void) {
string s; cin >> s;
while (true) {
string s1;
string s2;
s.pop_back();
int size = static_cast<int>(s.size());
int mid = size / 2;
for (int i = 0; i <= mid; ++i) {
s1.push_back(s[i]);
}
for (int i = mid + 1; i <= size - 1; ++i) {
s2.push_back(s[i]);
}
if (s1 == s2) { break; }
}
cout << s1.size() << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:41:13: error: 's1' was not declared in this scope; did you mean 's'?
41 | cout << s1.size() << endl;
| ^~
| s
|
s964064786 | p03672 | C++ | int main()
{
string str;
cin >> str;
int l = str.length() -1;
l /= 2;
for (int i = l ; i >= 0; i--)
{
string A, B;
A = str.substr(0, i);
B = str.substr(i, i);
if (A == B)
{
cout << i * 2 << endl;
return 0;
}
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:3:9: error: 'string' was not declared in this scope
3 | string str;
| ^~~~~~
a.cc:5:9: error: 'cin' was not declared in this scope
5 | cin >> str;
| ^~~
a.cc:5:16: error: 'str' was not declared in this scope; did you mean 'std'?
5 | cin >> str;
| ^~~
| std
a.cc:13:23: error: expected ';' before 'A'
13 | string A, B;
| ^~
| ;
a.cc:16:17: error: 'A' was not declared in this scope
16 | A = str.substr(0, i);
| ^
a.cc:17:17: error: 'B' was not declared in this scope
17 | B = str.substr(i, i);
| ^
a.cc:20:25: error: 'cout' was not declared in this scope
20 | cout << i * 2 << endl;
| ^~~~
a.cc:20:42: error: 'endl' was not declared in this scope
20 | cout << i * 2 << endl;
| ^~~~
|
s794569201 | p03672 | C++ | #include<stdio.h>
#include<string.h>
char a[220];
int main(){
gets(a);
int s=strlen(a),head,end,sum,i,ans=0,j;
for(i=0;i<s;i++){
if(a[i]==a[i+1]){
sum=0;
head=i,end=i+1;
while(a[head]==a[end]&&head>0&&end<s-1){
sum+=2;
head--;end++;
}
if(ans<sum)
ans=sum;
}
}
for(i=0;i<s;i++){
for(j=i+1;j<s;j++){
if(a[i]==a[j]){
sum=0;
head=i,end=j;
while(a[head]==a[end]&&end<s-1&&head<j){
sum+=2;head++,end++;
}
if(ans<sum&&j==head)
ans=sum;
}
}
}
printf("%d\n",ans);
return 0;
} | a.cc: In function 'int main()':
a.cc:5:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
5 | gets(a);
| ^~~~
| getw
|
s661211237 | p03672 | C++ | #include <iostream>
#include <string>
using namespace std;
int main (void)
{
char input[201];
char a[100], b[100];
int i,j,l;
int check;
int ans;
cin >> input ;
l = strlen(input);
while(1){
j = 0;
//aにコピー
for(i = 0; i <= (l-2)/2; l++){
a[j] = input[i];
j++;
}
a[j] = '\0';
j = 0;
//bにコピー
for(i = (l-2)/2 + 1; i <= l-1; i++){
b[j] = input[i];
j++;
}
b[j] = '\0';
j = 0;
//偶文字列かどうか
check = strcmp(a, b);
if(check == 0){
ans = strlen(a)*2;
break;
}
l = l-2;
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:14:9: error: 'strlen' was not declared in this scope
14 | l = strlen(input);
| ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include <iostream>
+++ |+#include <cstring>
2 | #include <string>
a.cc:34:17: error: 'strcmp' was not declared in this scope
34 | check = strcmp(a, b);
| ^~~~~~
a.cc:34:17: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
|
s945756597 | p03672 | C | #include<stdio.h>
#include<string.h>
int main(){
char str[222];
scanf("%s",str);
int n= strlen (str);
for (int i=n-2; i ; i-=2){
if(strncmp (str , str+i/2,i/2) ==0){
printf("%d\n",i);
return0;
}
}
return = 0;
} | main.c:3:4: error: stray '\343' in program
3 | int<U+3000>main(){
| ^~~~~~~~
main.c: In function 'main':
main.c:10:1: error: 'return0' undeclared (first use in this function)
10 | return0;
| ^~~~~~~
main.c:10:1: note: each undeclared identifier is reported only once for each function it appears in
main.c:13:8: error: expected expression before '=' token
13 | return = 0;
| ^
|
s995899026 | p03672 | C++ | #include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
cin>>s;
while(!s.empty()){
int len=strlen(s);
if(s.substr(0,len/2)==s.substr(len/2,len) and len%2==0)break;
s.pop_back();
}
cout<<s.length()<<endl;
}
| a.cc: In function 'int main()':
a.cc:9:32: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*'
9 | int len=strlen(s);
| ^
| |
| std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/cstring:43,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121,
from a.cc:1:
/usr/include/string.h:407:35: note: initializing argument 1 of 'size_t strlen(const char*)'
407 | extern size_t strlen (const char *__s)
| ~~~~~~~~~~~~^~~
|
s456874489 | p03672 | C++ | #include <iostream>
using namespace std;
int main() {
string s;
cin >> s;
for (int deleted { 1 }; i < s.length(); ++deleted) {
const int len { s.length() - deleted };
if (len % 2 != 0) continue;
const int half { len / 2 };
int iterator { 0 };
while (iterator < half) {
if (s[iterator] != s[iterator + half]) break;
}
if (iterator == half) {
cout << deleted << endl;
return 0;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:8:29: error: 'i' was not declared in this scope
8 | for (int deleted { 1 }; i < s.length(); ++deleted) {
| ^
a.cc:9:36: warning: narrowing conversion of '(s.std::__cxx11::basic_string<char>::length() - ((std::__cxx11::basic_string<char>::size_type)deleted))' from 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} to 'int' [-Wnarrowing]
9 | const int len { s.length() - deleted };
| ~~~~~~~~~~~^~~~~~~~~
|
s546357166 | p03672 | Java | import java.io.PrintWriter;
import java.util.Scanner;
public class Main {
static Scanner in;
static PrintWriter out;
static void solve() {
String S = in.next();
if (S.length() == 2) {
System.out.println(0);
return;
}
for(int i = 0; i < S.length(); i++) {
S = S.substring(0, S.length() - 2);
String first = S.substring(0, S.length()/2);
String second = S.substring(S.length()/2);
if (first.equals(second)) {
System.out.println(S.length());
return;
}
}
}
public static void main(String[] args) {
in = new Scanner(System.in);
out = new PrintWriter(System.out);
solve();
out.flush();
out.close();
in.close();
} | Main.java:30: error: reached end of file while parsing
}
^
1 error
|
s038529909 | p03672 | C | # include < stdio .h >
# include < string .h >
int main () {
char str [222];
scanf ("%s", str ) ;
int n= strlen (str ) ;
for (int i=n -2; i; i -=2) {
if( strncmp (str , str +i/2 , i/2) ==0) {
printf ("%d\n" ,i) ;
return 0;
}
}
return 0;
} | main.c:1:11: fatal error: stdio .h : No such file or directory
1 | # include < stdio .h >
| ^~~~~~~~~~~~
compilation terminated.
|
s315813387 | p03672 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(void) {
string s;
cin >> s;
int sz, size = s.size();
for (int i = 2; i <= size; i += 2) {
s = s.substr(0, s.size() - 2);
sz = s.size() / 2;
if (s.substr(0, sz) == s.substr(sz, sz)) {
cout << size - i << endl;
return 0;
}
}
return 0;
}#include <bits/stdc++.h>
using namespace std;
int main(void) {
string s;
cin >> s;
int sz, size = s.size();
for (int i = 2; i <= size; i += 2) {
s = s.substr(0, s.size() - 2);
sz = s.size() / 2;
if (s.substr(0, sz) == s.substr(sz, sz)) {
cout << size - i << endl;
return 0;
}
}
return 0;
} | a.cc:20:2: error: stray '#' in program
20 | }#include <bits/stdc++.h>
| ^
a.cc:20:3: error: 'include' does not name a type
20 | }#include <bits/stdc++.h>
| ^~~~~~~
a.cc:24:5: error: redefinition of 'int main()'
24 | int main(void) {
| ^~~~
a.cc:5:5: note: 'int main()' previously defined here
5 | int main(void) {
| ^~~~
|
s164511526 | p03672 | C++ | #include <iostream>
using namespace std;
int main()
{
char str[222];
cin >> str;
int n = strlen(str);
for (int i = n - 2; i; i -= 2) {
if (strncmp(str, str + i / 2, i / 2) == 0) {
cout << i << endl;
return 0;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:9:17: error: 'strlen' was not declared in this scope
9 | int n = strlen(str);
| ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include <iostream>
+++ |+#include <cstring>
2 | using namespace std;
a.cc:12:21: error: 'strncmp' was not declared in this scope
12 | if (strncmp(str, str + i / 2, i / 2) == 0) {
| ^~~~~~~
a.cc:12:21: note: 'strncmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
|
s028696770 | p03672 | C++ | #include <iostream>
using namespace std;
int main()
{
char str[222];
cin >> str;
int n = strlen(str);
for (int i = n - 2; i; i -= 2) {
if (strncmp(str, str + i / 2, i / 2) == 0) {
cout << i << endl;
break;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:9:17: error: 'strlen' was not declared in this scope
9 | int n = strlen(str);
| ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include <iostream>
+++ |+#include <cstring>
2 | using namespace std;
a.cc:12:21: error: 'strncmp' was not declared in this scope
12 | if (strncmp(str, str + i / 2, i / 2) == 0) {
| ^~~~~~~
a.cc:12:21: note: 'strncmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
|
s240192850 | p03672 | C++ | #include <iostream>
using namespace std;
int main()
{
char str[222];
cin >> str;
int n = strlen(str);
for (int i = n - 2; i; i -= 2) {
if (strncmp(str, str + i / 2, i / 2) == 0) {
cout << i << endl;
break;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:9:17: error: 'strlen' was not declared in this scope
9 | int n = strlen(str);
| ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include <iostream>
+++ |+#include <cstring>
2 | using namespace std;
a.cc:12:21: error: 'strncmp' was not declared in this scope
12 | if (strncmp(str, str + i / 2, i / 2) == 0) {
| ^~~~~~~
a.cc:12:21: note: 'strncmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
|
s609601057 | p03672 | C++ | a, b, c = [int(i) for i in input().split()]
if a > b:
a, b = b, a
if b > c:
b, c = c, b
if a > b:
a, b = b, a
print(a+b) | a.cc:1:1: error: 'a' does not name a type
1 | a, b, c = [int(i) for i in input().split()]
| ^
|
s077048176 | p03672 | C++ | #include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main() {
int a,b,c;
int i,j,k,n;
string s;
cin>>s;
int panjang=s.length()-1;
int jumlah=1;
for (i=0;i<=199;i++)
{
string potong;
potong=s;
potong.erase(panjang-i,jumlah;)
if (potong.length()%2==0)
{
int panjangpotong=potong.length();
int dua=panjangpotong/2;
bool cek=true;
for (j=0;j<dua;j++)
{
if (potong[j]!=potong[j+dua])
{
cek=false;
break;
}
}
if (cek)
{
cout<<panjangpotong<<"\n";
return 0;
}
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:17:46: error: expected ')' before ';' token
17 | potong.erase(panjang-i,jumlah;)
| ~ ^
| )
a.cc:17:47: error: expected primary-expression before ')' token
17 | potong.erase(panjang-i,jumlah;)
| ^
|
s427902220 | p03672 | C++ | #include <string>
using namespace std;
int main(void){
string S;
int ans = 0;
cin >> S;
while(!S.empty()){
S.pop_back();
S.pop_back();
int half_size = S.size()/2;
// cout <<"half_size:"<< half_size << endl;
for(int i=0;i<half_size;++i){
// cout << S[i] << ' ' << S[half_size + i] << endl;
if(S[i] != S[half_size + i]) break;
else if(i == half_size-1) ans = S.size();
}
if(ans > 0) break;
}
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:6:9: error: 'cin' was not declared in this scope
6 | cin >> S;
| ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
1 | #include <string>
+++ |+#include <iostream>
2 | using namespace std;
a.cc:21:9: error: 'cout' was not declared in this scope
21 | cout << ans << endl;
| ^~~~
a.cc:21:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:21:24: error: 'endl' was not declared in this scope
21 | cout << ans << endl;
| ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
1 | #include <string>
+++ |+#include <ostream>
2 | using namespace std;
|
s698203286 | p03672 | C++ | #pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<int,string> pis;
double pi=3.1415926535898;
#define speed ios::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);
#define lop(i,n) for(int i=0;i<int(n);i++)
#define rep(i,a,b) for(int i=a;i<=int(b);++i)
#define sz(x) (int)x.size()
#define bb(x) cerr<< x <<endl;
#define F first
#define S second // __builtin_popcount;
//freopen("output.txt","w",stdout),freopen("input.txt","r",stdin);
const ll M = 1e9+7 ;
const int N = 100100;
const int inf = INT_MAX;
const double eps = 1e-7;
////////////////////// Hi ^_^ hack me if you can :P
int n;
int A;
int a[100100];
bool baned[1234567];
int alic;
int mx = 0;
int col ;
map < int, int > mm;
int main()
{
speed;
string s;
cin >> s;
int ans = 0;
if (sz(s)&1) {s.pop_back();ans++;}
while (sz(s)) {
if (sz(s)&1) {s.pop_back();ans++;}
else { bool ok = 1;
lop(i,sz(s)/2) {if(s[i]!=s[i+sz(s)/2]) {s.pop_back();ans++;ok=0;break;} }
if ( ok ) breake;
}
}
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:43:15: error: 'breake' was not declared in this scope
43 | if ( ok ) breake;
| ^~~~~~
|
s318005930 | p03672 | C++ | #include<iostream>
#include<string>
using namespace std;
int main(){
string s;
cin>>s;
s=s.substr(0,s.size()-1);
int len;
for(len=s.size()/2;len>=0;len--){
if(s.substr(0,len) == s.substr(len,len)){
break;
}
}
cout<< len * 2<,endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:15:17: error: expected primary-expression before ',' token
15 | cout<< len * 2<,endl;
| ^
|
s838960379 | p03672 | C++ | #include<iostream>
#include<string>
using namespace std;
int main(){
string s;
cin>>s;
s=s.substr(0,s.size()-1);
int len
for(len=s.size()/2;len>=0;len--){
if(s.substr(0,len) == s.substr(len,len)){
break;
}
}
cout<< len * 2<,endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:10:2: error: expected initializer before 'for'
10 | for(len=s.size()/2;len>=0;len--){
| ^~~
a.cc:10:21: error: 'len' was not declared in this scope; did you mean 'mblen'?
10 | for(len=s.size()/2;len>=0;len--){
| ^~~
| mblen
a.cc:15:17: error: expected primary-expression before ',' token
15 | cout<< len * 2<,endl;
| ^
|
s374541686 | p03672 | C | #include<stdio.h>
#include<string.h>
int main(){
int len,n,sp=1,s=0;
char in[201];
scanf("%s",in);
while(1){
len = strlen(in);
len--;
in[len] = '\0';
if(len%2 == 1){
len--;
in[len] = '\0';
}
for(i=0;i<len/2;i++){
if(in[i] != in[i+len/2]){
break;
}
if(i == len/2 - 1){
printf("%d",i+1);
return 0;
}
}
}
return -1;
} | main.c: In function 'main':
main.c:19:21: error: 'i' undeclared (first use in this function); did you mean 'in'?
19 | for(i=0;i<len/2;i++){
| ^
| in
main.c:19:21: note: each undeclared identifier is reported only once for each function it appears in
|
s169280796 | p03672 | C | #include<stdio.h>
#include<string.h>
int main(){
int len,n,sp=1,s=0;
char in[201];
scanf("%s",in)
while(1){
len = strlen(in);
len--;
in[len] = '\0';
if(len%2 == 1){
len--;
in[len] = '\0';
}
for(i=0;i<len/2;i++){
if(in[i] != in[i+len/2]){
break;
}
if(i == len/2 - 1){
printf("%d",i+1);
return 0;
}
}
}
return -1;
} | main.c: In function 'main':
main.c:8:23: error: expected ';' before 'while'
8 | scanf("%s",in)
| ^
| ;
9 |
10 | while(1){
| ~~~~~
|
s345071524 | p03672 | C | #include<stdio.h>
#include<strlib.h>
int main(){
int len,n,sp=1,s=0;
char in[201];
scanf("%s",in)
while(1){
len = strlen(in);
len--;
in[len] = '\0';
if(len%2 == 1){
len--;
in[len] = '\0';
}
for(i=0;i<len/2;i++){
if(in[i] != in[i+len/2]){
break;
}
if(i == len/2 - 1){
printf("%d",i+1);
return 0;
}
}
}
return -1;
} | main.c:2:9: fatal error: strlib.h: No such file or directory
2 | #include<strlib.h>
| ^~~~~~~~~~
compilation terminated.
|
s402256553 | p03672 | C++ | #include <cstdlib>
#include <iostream>
#include <queue>
#include <vector>
#include <cmath>
#include <string>
using namespace std;
typedef unsigned long long u64;
typedef signed long long l64;
u64 over = 1000000007;
int main(void)
{
cin.tie(0);
ios::sync_with_stdio(false);
string s;
cin >> s;
int n = s.size();
for (int i = (n-1)/2; i >= 0; --i) {
is (s.substr(0, i) == s.substr(i, i)) {
cout << i*2 << endl;
return 0;
}
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:20:5: error: 'is' was not declared in this scope; did you mean 'i'?
20 | is (s.substr(0, i) == s.substr(i, i)) {
| ^~
| i
|
s423017677 | p03672 | C++ | #include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <functional>
#include <unordered_map>
#include <map>
#include <numeric>
#include <limits>
#include <utility>
#include <queue>
using namespace std;
typedef long long LL;
int main(void) {
string s;
cin >> s;
for (int i = 0; i < s.size(); i++) {
s.pop_back();
if (s.size() % 2 == 0) {
for (int j = 0; j < s.size() / 2; j++) {
if (s[j] != s[j + (s.size() / 2)])break;
if (j == s.size()/2 - 1) {
cout << s.size() << endl;
return 0;
}
}
//}
}
cout << 0 << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:34:2: error: expected '}' at end of input
34 | }
| ^
a.cc:17:16: note: to match this '{'
17 | int main(void) {
| ^
|
s739298625 | p03672 | C++ | #include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main(){
string s,a,b;
cin>>s;
int i =1;
if(s.size()%2==0){}
i++;
else
i+=2;
for(;i<s.size();i+=2){
for(int j=0;j<(s.size()-i)/2;j++)
a[j]=s[j];
for(int j=(s.size()-i)/2;j<s.size()-i;j++)
b[j-(s.size()-i)/2]=s[j];
if(a==b){
cout<<s.size()-i<<endl;
break;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:13:1: error: 'else' without a previous 'if'
13 | else
| ^~~~
|
s606464846 | p03672 | C++ | #include <iostream>
#include<string>
using namespace std;
int main(void){
string s,a="",b="",str="";
cin>>s;
for(int i=0;;i++){
for(int j=0;j<s.size();j++){
s[s.size()-1-j]='';
for(int l=0;l<s.size()/2;l++){
a=a+str[l];
}
for(int l=s.size()/2;l<s.size();l++){
b=b+str[l];
}
if(a==b)break;
str="";
}
if(a==b){
cout<<a.size()+b.size()<<endl;
break;
}
}
return 0;
}
| a.cc:9:28: error: empty character constant
9 | s[s.size()-1-j]='';
| ^~
|
s776278675 | p03672 | Java | import java.util.Scanner;
public class Main {
public static void main(String args[]){
//B問題
Scanner scan = new Scanner(System.in);
//文字列格納用
String S;
S = scan.next();
while(S.length() >= 2){
//1文字削除
if(S != null && S.length() > 0){
S = S.substring(0, S.length()-1);
}
//文字数が偶数ならば
if(S.length() % 2 == 0){
String sa = S.substring(0,S.length() / 2);
String sb = S.substring(S.length() / 2 ,S.length());
if(sa.equals(sb)){
System.out.println(S.length());
break;
}
}
} | Main.java:30: error: reached end of file while parsing
}
^
1 error
|
s946935888 | p03672 | Java | import java.util.Scanner;
public class Main {
public static void main(String args[]){
//B問題
Scanner scan = new Scanner(System.in);
//文字列格納用
String S;
S = scan.next();
while(S.length() >= 2){
//1文字削除
if(S != null && S.length() > 0){
S = S.substring(0, S.length()-1);
}
//文字数が偶数ならば
if(S.length() % 2 == 0){
String sa = S.substring(0,S.length() / 2);
String sb = S.substring(S.length() / 2 ,S.length());
if(sa.equals(sb)){
System.out.println(S.length());
break;
}
}
}
} | Main.java:32: error: reached end of file while parsing
}
^
1 error
|
s364303137 | p03672 | Java | package atcoder0701;
import java.util.Scanner;
public class main {
public static void main(String args[]){
//B問題
Scanner scan = new Scanner(System.in);
//文字列格納用
String S;
S = scan.next();
while(S.length() >= 2){
//1文字削除
if(S != null && S.length() > 0){
S = S.substring(0, S.length()-1);
}
//文字数が偶数ならば
if(S.length() % 2 == 0){
String sa = S.substring(0,S.length() / 2);
String sb = S.substring(S.length() / 2 ,S.length());
if(sa.equals(sb)){
System.out.println(S.length());
break;
}
}
}
}
}
| Main.java:5: error: class main is public, should be declared in a file named main.java
public class main {
^
1 error
|
s606532557 | p03672 | Java | import java.util.Scanner;
public class Main {
public static void main(String args[]){
//B問題
Scanner scan = new Scanner(System.in);
//文字列格納用
String S;
S = scan.next();
while(S.length() >= 2){
//1文字削除
if(S != null && S.length() > 0){
S = S.substring(0, S.length()-1);
}
//文字数が偶数ならば
if(S.length() % 2 == 0){
String sa = S.substring(0,S.length() / 2);
String sb = S.substring(S.length() / 2 ,S.length());
if(sa.equals(sb)){
System.out.println(S.length());
break;
//}
}
}
} | Main.java:31: error: reached end of file while parsing
}
^
1 error
|
s343010918 | p03672 | C++ | #include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
char s[205], t1[205], t2[205];
int main()
{
gets(s);
int len = strlen(s);
int w = len;
for (int j = 1; j <= 200; j++){
int tot = -1;
for (int i = 0; i <= (len - 3) / 2; i++) t1[i] = s[i];
for (int i = (len - 3) / 2 + 1; i < len - 1; i++){
t2[++tot] = s[i];
}
t2[++tot] = '\0';
// puts(t2);
if (strcmp(t1, t2) == 0){
// puts(t1);
// puts(t2);
printf ("%d\n", len - 1);
return 0;
}
else{
// puts(t1);
// puts(t2);
len--;
// printf ("%d\n", len);
memset(t1, 0, sizeof(t1));
memset(t2, 0, sizeof(t2));
}
}
}
| a.cc: In function 'int main()':
a.cc:11:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
11 | gets(s);
| ^~~~
| getw
|
s781753839 | p03672 | C++ | #include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
char s[205], t1[205], t2[205];
int main()
{
gets(s);
int len = strlen(s);
int w = len;
for (int j = 1; j <= 200; j++){
int tot = -1;
for (int i = 0; i <= (len - 3) / 2; i++) t1[i] = s[i];
for (int i = (len - 3) / 2 + 1; i < len - 1; i++){
t2[++tot] = s[i];
}
t2[++tot] = '\0';
// puts(t2);
if (strcmp(t1, t2) == 0){
// puts(t1);
// puts(t2);
printf ("%d\n", len - 1);
return 0;
}
else{
// puts(t1);
// puts(t2);
len--;
// printf ("%d\n", len);
memset(t1, 0, sizeof(t1));
memset(t2, 0, sizeof(t2));
}
}
}
| a.cc: In function 'int main()':
a.cc:11:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
11 | gets(s);
| ^~~~
| getw
|
s177743806 | p03672 | C++ | #include <string>
#include <iostream>
using namespace std;
bool iseven(string& str)
{
if (str.length() % 2 != 0)return false;
else
{
if (string(str.begin(), str.begin() + str.length() / 2) == string(str.begin() + str.length() / 2, str.end()))
return true;
else return false;
}
}
int main(void)
{
string str;
cin >> str;
int len = str.length();
for (int i = len-1; i >=2; i--)//长度
{
for (int j = 0; j + i != len; j++) {
if (iseven(string(str.begin() + j, str.begin() + j + i))) {
cout << i << endl;
return 0;
}
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:24:36: error: cannot bind non-const lvalue reference of type 'std::string&' {aka 'std::__cxx11::basic_string<char>&'} to an rvalue of type 'std::string' {aka 'std::__cxx11::basic_string<char>'}
24 | if (iseven(string(str.begin() + j, str.begin() + j + i))) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:5:21: note: initializing argument 1 of 'bool iseven(std::string&)'
5 | bool iseven(string& str)
| ~~~~~~~~^~~
|
s079643218 | p03672 | C++ | #include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main(){
string s,a,b;
cin>>s;
for(int i =0;i<s.size();i+=2){
if(s.size()%2==1)
i++;
for(int j=0;j<(s.size()-i)/2;j++)
a[j]=s[j];
for(int j=(s.size()-i)/2;j<s.size())-i;j++)
b[j]=s[j];
if(a==b){
cout<<s.size()<<endl;
break;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:15:36: error: expected ';' before ')' token
15 | for(int j=(s.size()-i)/2;j<s.size())-i;j++)
| ^
| ;
a.cc:15:40: error: 'j' was not declared in this scope
15 | for(int j=(s.size()-i)/2;j<s.size())-i;j++)
| ^
|
s740374332 | p03672 | C++ | We will call a string that can be obtained by concatenating two equal strings an even string. For example, xyzxyz and aaaaaa are even, while ababab and xyzxy are not.
You are given an even string S consisting of lowercase English letters. Find the length of the longest even string that can be obtained by deleting one or more characters from the end of S. It is guaranteed that such a non-empty string exists for a given input.
Constraints
2≤|S|≤200
S is an even string consisting of lowercase English letters.
There exists a non-empty even string that can be obtained by deleting one or more characters from the end of S.
| a.cc:6:1: error: extended character ≤ is not valid in an identifier
6 | 2≤|S|≤200
| ^
a.cc:6:6: error: extended character ≤ is not valid in an identifier
6 | 2≤|S|≤200
| ^
a.cc:1:1: error: 'We' does not name a type
1 | We will call a string that can be obtained by concatenating two equal strings an even string. For example, xyzxyz and aaaaaa are even, while ababab and xyzxy are not.
| ^~
|
s476839829 | p03672 | Java | import java.util.Scanner;
public class SS{
public static void Main(String[] args){
Scanner sc = new Scanner(System.in);
String str = sc.nextLine();
sc.close();
for(int i = 1; i < str.length(); i++) {
if(isEven(str.substring(0, str.length()-i))) {
System.out.println(str.length() - i);
break;
}
}
}
static boolean isEven(String str) {
if(str.length() % 2 == 1) return false;
else {
for(int i = 0; i < str.length() / 2; i++) {
if(str.charAt(i) != str.charAt(str.length() / 2 + i)) return false;
}
return true;
}
}
}
| Main.java:3: error: class SS is public, should be declared in a file named SS.java
public class SS{
^
1 error
|
s540013017 | p03672 | C++ | #include<stdio.h>
#include<string.h>
int main ()
{
char s[250];
while(gets(s))
{
int i,len,n;
len=strlen(s);
n=len/2-1;
while(n)
{
int k=0;
for(i=0;i<n;i++)
if(s[i]!=s[i+n])
k++;
n--;
if(k==0){
printf("%d\n",n*2-2);
break;
}
}
}
} | a.cc: In function 'int main()':
a.cc:6:15: error: 'gets' was not declared in this scope; did you mean 'getw'?
6 | while(gets(s))
| ^~~~
| getw
|
s135967834 | p03672 | C++ | #include<stdio.h>
#include<string.h>
char s[250];
int main ()
{
while(scanf("%s",s)!=EOF)
{
int i,len,n,;
len=strlen(s);
n=len/2-1;
while(n)
{
int k=0;
for(i=0;i<n;i++)
if(s[i]!=s[i+n])
k++;
n--;
if(k==0){
printf("%d\n",n*2+2);
break;
}
}
}
} | a.cc: In function 'int main()':
a.cc:8:29: error: expected unqualified-id before ';' token
8 | int i,len,n,;
| ^
|
s889114609 | p03672 | C++ | #include<stdio.h>
#include<string.h>
int main ()
{
char s[250];
while(scanf("%s",s)!=EOF)
{
int i,len,n,;
len=strlen(s);
n=len/2-1;
while(n)
{
int k=0;
for(i=0;i<n;i++)
if(s[i]!=s[i+n])
k++;
n--;
if(k==0){
printf("%d\n",n*2+2);
break;
}
}
}
} | a.cc: In function 'int main()':
a.cc:8:29: error: expected unqualified-id before ';' token
8 | int i,len,n,;
| ^
|
s790141931 | p03672 | C++ | #include<stdio.h>
#include<string.h>
int main ()
{
char s[250];
while(gets(s))
{
int i,len,n,;
len=strlen(s);
n=len/2-1;
while(n)
{
int k=0;
for(i=0;i<n;i++)
if(s[i]!=s[i+n])
k++;
n--;
if(k==0){
printf("%d\n",n*2+2);
break;
}
}
}
} | a.cc: In function 'int main()':
a.cc:6:15: error: 'gets' was not declared in this scope; did you mean 'getw'?
6 | while(gets(s))
| ^~~~
| getw
a.cc:8:29: error: expected unqualified-id before ';' token
8 | int i,len,n,;
| ^
|
s271723892 | p03672 | Java | import java.util.Scanner;
public class B {
private static boolean is_even(String s) {
if (0 == s.length() % 2) {
return true;
}
else {
return false;
}
}
private static boolean is_even_string(String s) {
int length = s.length();
if (s.substring(0, length / 2).equals(s.substring(length / 2, length))) {
return true;
}
else {
return false;
}
}
public static void main(String[] args) {
Scanner stdIn = new Scanner(System.in);
String s = stdIn.next();
s = s.substring(0, s.length()-1);
for (int i = s.length(); i > 1; i--) {
if (!is_even(s)) {
s = s.substring(0, s.length()-1);
continue;
}
if (is_even_string(s)) {
System.out.println(s.length());
}
s = s.substring(0, s.length()-1);
}
}
}
| Main.java:3: error: class B is public, should be declared in a file named B.java
public class B {
^
1 error
|
s011448028 | p03672 | C++ | #include<stdio.h>
#include<string.h>
int main ()
{
char s[250];
while(gets(s))
{
int i,len,n,;
len=strlen(s);
n=len/2-1;
while(n)
{
int k=0;
for(i=0;i<n;i++)
if(s[i]!=s[i+n])
k++;
n--;
if(k==0){
printf("%d\n",n*2+2);
break;
}
}
}
} | a.cc: In function 'int main()':
a.cc:6:15: error: 'gets' was not declared in this scope; did you mean 'getw'?
6 | while(gets(s))
| ^~~~
| getw
a.cc:8:29: error: expected unqualified-id before ';' token
8 | int i,len,n,;
| ^
|
s231251228 | p03672 | C | #define _CRT_SECURE_NO_WARNINGS
//#define DEBUG
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
//後ろから2文字ずつ削って判定してく関数
//配列をポインタで渡す場合長さも渡しておく
int mojikezuri(char* str, int length) {
int flag = 0;
int l2=length/2;
char str1[101];
char str2[101];
int i;
int ans;
strcpy(str1, str, l2);
strcpy(str2, str + l2, l2);
str1[l2] = '\0';
str2[l2] = '\0';
#ifdef DEBUG
printf("%s\n", str1);
printf("%s\n", str2);
#endif
if (strcmp(str1,str2)) {
ans = mojikezuri(str, length - 2);
}
else {
ans = length;
}
return ans;
}
int main(void) {
#ifdef DEBUG
printf("");
#endif
char S[201] = { '\0' };
int length=0;
int ans=0;
int i;
scanf("%s", S);
#ifdef DEBUG
printf("%s\n", S);
#endif
for (i = 0; i < 200; i++) {
if (S[i] == '\0') {
length = i;
break;
}
}
#ifdef DEBUG
printf("length=%d\n", length);
#endif
ans = mojikezuri(S,length-2);
printf("%d\n", ans);
return 0;
}
| main.c: In function 'mojikezuri':
main.c:18:9: error: too many arguments to function 'strcpy'
18 | strcpy(str1, str, l2);
| ^~~~~~
In file included from main.c:4:
/usr/include/string.h:141:14: note: declared here
141 | extern char *strcpy (char *__restrict __dest, const char *__restrict __src)
| ^~~~~~
main.c:19:9: error: too many arguments to function 'strcpy'
19 | strcpy(str2, str + l2, l2);
| ^~~~~~
/usr/include/string.h:141:14: note: declared here
141 | extern char *strcpy (char *__restrict __dest, const char *__restrict __src)
| ^~~~~~
|
s612305050 | p03672 | C++ | #include <iostream>
#include<string>
using namespace std;
int main(void){
string s,a,b;
cin>>s;
for(int i=0;;i++){
for(int j=0;j<s.size();j++){
s=s-s[s.size()-j-1];
for(int l=0;l<s.size()/2;l++){
a=a+a[l];
}
for(int l=s.size()/2;l<s.size();l++){
b=b+b[l];
}
if(a==b)break;
}
if(a==b){
cout<<a.size()+b.size()<<endl;
break;
}
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:9:16: error: no match for 'operator-' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'})
9 | s=s-s[s.size()-j-1];
In file included from /usr/include/c++/14/string:48,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
618 | operator-(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: template argument deduction/substitution failed:
a.cc:9:31: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
9 | s=s-s[s.size()-j-1];
| ^
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1790 | operator-(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: template argument deduction/substitution failed:
a.cc:9:31: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
9 | s=s-s[s.size()-j-1];
| ^
|
s086801612 | p03672 | C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
int Main(void){
int i=0,j,k,count=0,s=0;
char list[200][200];
while(scanf("%s",list[i])!=EOF){
i++;
if(i==1) break;
}
for (k = strlen(list[0])-1; k>1; k--)
{
s=0;
if(k%2==0)
{
for(j=0;j<k/2;j++){
if(list[0][j]!=list[0][j+k/2]) s=1;
}
if(s==0) break;
}
}
printf("%d\n",k);
} | /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
|
s470739360 | p03672 | C++ | #include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int main (){
char s[300] = {0};
int ans = 0;
int i,j;
scanf("%s",s);
ans = strlen(s);
while(1){
ans -= 2;
j = ans / 2;
int z = ans /2;
for(i=0;i<j;i++){
if(s[i] != s[z]){
//printf("%d %d %d\n",i,j,ans);
break;
}else{
z++;
}
}
if(z == ans){
printf("%d\n",ans);
break;
}
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:13:11: error: 'strlen' was not declared in this scope
13 | ans = strlen(s);
| ^~~~~~
a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include <algorithm>
+++ |+#include <cstring>
4 | using namespace std;
|
s335366090 | p03672 | C++ | #include <iostream>
#include <numeric>
#include <algorithm>
#include <string>
int main(void)
{
std::string S;
std::cin >> S;
std::vector<std::string> checker;
size_t pos = 0;
for(size_t i = 2, end = S.size(); i < end; i+=2, pos+=1){
checker.push_back(S.substr(0, i));
}
for(auto it = checker.rbegin(), end=checker.rend(); it != end; ++it){
if(it->substr(0, it->size()/2) == it->substr(it->size()/2)){
std::cout << it->size() << std::endl;
return 0;
}
}
return -1;
}
| a.cc: In function 'int main()':
a.cc:11:8: error: 'vector' is not a member of 'std'
11 | std::vector<std::string> checker;
| ^~~~~~
a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
3 | #include <algorithm>
+++ |+#include <vector>
4 | #include <string>
a.cc:11:26: error: expected primary-expression before '>' token
11 | std::vector<std::string> checker;
| ^
a.cc:11:28: error: 'checker' was not declared in this scope
11 | std::vector<std::string> checker;
| ^~~~~~~
a.cc:18:61: error: 'end' was not declared in this scope; did you mean 'std::end'?
18 | for(auto it = checker.rbegin(), end=checker.rend(); it != end; ++it){
| ^~~
| std::end
In file included from /usr/include/c++/14/string:53,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/range_access.h:116:37: note: 'std::end' declared here
116 | template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
| ^~~
|
s920151757 | p03672 | C++ | s = input()
s = s[:len(s) - 1]
if len(s) % 2 != 0:
s = s[:len(s) - 1]
while True:
mid = int(len(s) / 2)
if s[:mid] == s[mid:]:
print(len(s))
break
else:
s = s[:len(s) - 1] | a.cc:1:1: error: 's' does not name a type
1 | s = input()
| ^
|
s611727582 | p03672 | C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
char s[201];
scanf("%s",s);
int len=strlen(s);
int i,j;
for(i=1;i<len/2;i++){
int k=len-i*2;
int count=0;
for(j=0;j<k/2;j++){
if(s[j]==s[j+k/2])count++;
}
if(count==k/2){
printf("%d\n",count*2);
break;
}
}
return 0;
| main.c: In function 'main':
main.c:24:9: error: expected declaration or statement at end of input
24 | return 0;
| ^~~~~~
|
s076340814 | p03672 | C++ | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
char s[201];
scanf("%s",s);
int len=strlen(s);
int i,j;
for(i=1;i<len/2;i++){
int k=len-i*2;
int count=0;
for(j=0;j<k/2;j++){
if(s[j]==s[j+k/2])count++;
}
if(count==k/2){
printf("%d\n",count*2);
break;
}
}
return 0;
| a.cc: In function 'int main()':
a.cc:24:18: error: expected '}' at end of input
24 | return 0;
| ^
a.cc:6:1: note: to match this '{'
6 | {
| ^
|
s248945815 | p03672 | C++ | #include<iostream>
#include<vector#include<string>
using namespace std;
int main(){
string s;
cin >> s;
int n = s.size() - 2;
for(int i=0; i<n/2; i++){
if(s[i]!=s[i+n/2]){
n -= 2;
} else {
cout << n << endl;
break;
}
}
return 0;
} | a.cc:2:9: fatal error: vector#include<string: No such file or directory
2 | #include<vector#include<string>
| ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
|
s137127922 | p03672 | C++ | #include <iostream>
#include <string>
using namespace std;
int main(int argc, char* argv[])
{
char p[201];
string S;
cin>>S;
int SLen=S.size();
char *pStr=(char*)S.c_str();
string s;
int i=0;
int maxNum=0;
int maxLen=0;
for (int len=1;len<=SLen;len++){
memset(p,0,201);
strncpy(p,pStr,len);
int num=0;
for (i=0;i<SLen;i+=len){
if (memcmp(pStr+i,p,len)){
break;
}
num++;
}
if (maxNum<num){
maxNum=num;
maxLen=len;
}
}
if (maxNum==1){
cout<<0<<endl;
return 0;
}
if (maxNum==SLen){
if (maxNum%2==1){
maxNum--;
}
cout<<maxNum/2<<endl;
return 0;
}
if (maxNum%2==1){
maxNum--;
}
cout<<maxNum*maxLen<<endl;
return 0;
} | a.cc: In function 'int main(int, char**)':
a.cc:17:17: error: 'memset' was not declared in this scope
17 | memset(p,0,201);
| ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include <iostream>
+++ |+#include <cstring>
2 | #include <string>
a.cc:18:17: error: 'strncpy' was not declared in this scope
18 | strncpy(p,pStr,len);
| ^~~~~~~
a.cc:18:17: note: 'strncpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:21:29: error: 'memcmp' was not declared in this scope
21 | if (memcmp(pStr+i,p,len)){
| ^~~~~~
a.cc:21:29: note: 'memcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
|
s567649402 | p03672 | C++ | #include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
int main() {
string s;
cin >> s;
int sz = s.size();
int ans = 0;
for(int i=sz-2;i>=0;i-=2) {
int c = i/2;
bool ok = true;;
for(int j=0;j<c;j++) {
if(s[j] != s[j+c]) {
ok = false;
break;
}
}
if(ok) {
ans = i;
break;
}
}
cout << ans << endl;
}
| a.cc: In function 'int main()':
a.cc:9:5: error: 'string' was not declared in this scope
9 | string s;
| ^~~~~~
a.cc:4:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
3 | #include <cmath>
+++ |+#include <string>
4 |
a.cc:10:5: error: 'cin' was not declared in this scope
10 | cin >> s;
| ^~~
a.cc:4:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
3 | #include <cmath>
+++ |+#include <iostream>
4 |
a.cc:10:12: error: 's' was not declared in this scope
10 | cin >> s;
| ^
a.cc:27:5: error: 'cout' was not declared in this scope
27 | cout << ans << endl;
| ^~~~
a.cc:27:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:27:20: error: 'endl' was not declared in this scope
27 | cout << ans << endl;
| ^~~~
a.cc:4:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
3 | #include <cmath>
+++ |+#include <ostream>
4 |
|
s495149564 | p03672 | C++ | #include <bits/stdc++.h>
using namespace std;
int main()
{
char s[200];
gets(s);
int len = strlen(s);
for(int i=(len-2)/2;i>0;--i)
{
int x = 0;
for(int j=0;j<i;++j)
{
if(s[j] == s[j+i]) x++;
}
if(x==i)
{
cout<<2*i<<endl;
return 0;
}
}
}
| a.cc: In function 'int main()':
a.cc:8:5: error: 'gets' was not declared in this scope; did you mean 'getw'?
8 | gets(s);
| ^~~~
| getw
|
s881383049 | p03672 | C++ | #include <bits/stdc++.h>
using namespace std;
int main()
{
char s[200];
gets(s);
int len = strlen(s);
for(int i=(len-2)/2;i>0;--i)
{
int x = 0;
for(int j=0;j<i;++j)
{
if(s[j] == s[j+i]) x++;
}
if(x==i)
{
cout<<2*i<<endl;
return 0;
}
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:8:5: error: 'gets' was not declared in this scope; did you mean 'getw'?
8 | gets(s);
| ^~~~
| getw
|
s942803615 | p03672 | C++ | #include <bits/stdc++.h>
using namespace std;
int main()
{
char s[200];
gets(s);
int len = strlen(s);
for(int i=(len-2)/2;i>0;--i)
{
int x = 0;
for(int j=0;j<i;++j)
{
if(s[j] == s[j+i]) x++;
}
if(x==i)
{
cout<<2*i<<endl;
return 0;
}
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:8:5: error: 'gets' was not declared in this scope; did you mean 'getw'?
8 | gets(s);
| ^~~~
| getw
|
s894281457 | p03672 | C++ | h#include <bits/stdc++.h>
using namespace std;
int main(void){
string s;
cin >> s;
char c[201] = {'\0'};
bool sw = false;
s.copy(c, s.size());
for(int i = s.size() - 2; i > 0; i--){
if(i %2 == 0) continue;
for (int j = 0; j <= i / 2; j++){
if(c[j] != c[i / 2 + 1 + j]) break;
if (j == i / 2) sw = true;
}
if(sw){
/*
for(int j = 0; j <= i; j++){
cout << c[j] << flush;
}
cout << endl;
*/
cout << i + 1 << endl;
return 0;
}
}
//cout << c[0] << endl;
cout << 1 << endl;
return 0;
}
| a.cc:1:2: error: stray '#' in program
1 | h#include <bits/stdc++.h>
| ^
a.cc:1:1: error: 'h' does not name a type
1 | h#include <bits/stdc++.h>
| ^
a.cc: In function 'int main()':
a.cc:6:3: error: 'string' was not declared in this scope
6 | string s;
| ^~~~~~
a.cc:7:3: error: 'cin' was not declared in this scope
7 | cin >> s;
| ^~~
a.cc:7:10: error: 's' was not declared in this scope
7 | cin >> s;
| ^
a.cc:25:7: error: 'cout' was not declared in this scope
25 | cout << i + 1 << endl;
| ^~~~
a.cc:25:24: error: 'endl' was not declared in this scope
25 | cout << i + 1 << endl;
| ^~~~
a.cc:31:3: error: 'cout' was not declared in this scope
31 | cout << 1 << endl;
| ^~~~
a.cc:31:16: error: 'endl' was not declared in this scope
31 | cout << 1 << endl;
| ^~~~
|
s664738960 | p03672 | C |
akasakaakasakasakaakas
| main.c:2:1: error: expected '=', ',', ';', 'asm' or '__attribute__' at end of input
2 | akasakaakasakasakaakas
| ^~~~~~~~~~~~~~~~~~~~~~
|
s811477844 | p03672 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
string s;
cin>>s;
cout<<s.len()<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:6:13: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'len'
6 | cout<<s.len()<<endl;
| ^~~
|
s330965639 | p03673 | Java | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int[] a = new int[N];
for(int i=0; i<N; i++){
a[i] = sc.nextInt();
}
for(int i=N-1;i>=0;i-=2){
System.out.print(a[i] + " ");
}
for(int j=n%2;j<N;j+=2){
System.out.print(a[j] + " ");
}
}
}
| Main.java:17: error: cannot find symbol
for(int j=n%2;j<N;j+=2){
^
symbol: variable n
location: class Main
1 error
|
s611503440 | p03673 | C++ | #include<iostream>
#include<vector>
using namespace std;
int main(){
int n,m;
cin>>n;
vector<int>a();
for(int i=0;i<n;i++){
cin>>m;
a.push_back(m);
reverse(a.begin(),a.end());
}
for(int i=0;i<a.size();i++)cout<<a[i]<<" ";
return 0;
}
| a.cc: In function 'int main()':
a.cc:7:17: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
7 | vector<int>a();
| ^~
a.cc:10:11: error: request for member 'push_back' in 'a', which is of non-class type 'std::vector<int>()'
10 | a.push_back(m);
| ^~~~~~~~~
a.cc:11:19: error: request for member 'begin' in 'a', which is of non-class type 'std::vector<int>()'
11 | reverse(a.begin(),a.end());
| ^~~~~
a.cc:11:29: error: request for member 'end' in 'a', which is of non-class type 'std::vector<int>()'
11 | reverse(a.begin(),a.end());
| ^~~
a.cc:11:9: error: 'reverse' was not declared in this scope
11 | reverse(a.begin(),a.end());
| ^~~~~~~
a.cc:13:21: error: request for member 'size' in 'a', which is of non-class type 'std::vector<int>()'
13 | for(int i=0;i<a.size();i++)cout<<a[i]<<" ";
| ^~~~
a.cc:13:41: warning: pointer to a function used in arithmetic [-Wpointer-arith]
13 | for(int i=0;i<a.size();i++)cout<<a[i]<<" ";
| ^
|
s621627583 | p03673 | C++ | #include<iostream>
#include<vector>
using namespace std;
int main(){
int n,m;
cin>>n;
vector<int>a(0);
for(int i=0;i<n;i++){
cin>>m;
a.push_back(m);
reverse(a.begin(),a.end());
}
for(int i=0;i<a.size();i++)cout<<a[i]<<" ";
return 0;
} | a.cc: In function 'int main()':
a.cc:11:9: error: 'reverse' was not declared in this scope
11 | reverse(a.begin(),a.end());
| ^~~~~~~
|
s167088267 | p03673 | C++ | #include<bits\stdc++.h>
using namespace std;
typedef long long ll;
const int Max=1e5+5;
const int Mod=1e9+7;
int lst[Max];
int main()
{
int n;
cin>>n;
for(int i=1;i<=n;i++)
{
scanf("%d",&lst[i]);
reverse(lst+1,lst+i+1);
}
for(int i=1;i<=n;i++)
{
printf("%d ",lst[i]);
}
} | a.cc:1:9: fatal error: bits\stdc++.h: No such file or directory
1 | #include<bits\stdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s039983427 | p03673 | C++ | #include <bits/stdc++.h>
using namespace std; | /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
|
s240816191 | p03673 | C++ | #include <iostream>
#include <deque>
#include <string>
using namespace std;
typedef false LEFT;
typedef true RIGHT;
int main() {
long long n;
cin >> n;
long long a[n] = {0};
for (int i = 0; i < n; i++) {
cin >> a[i];
}
deque<long long> b;
bool insert;
if (n % 2 == 0) {
//start insert from left
insert = LEFT;
}
else {
insert = RIGHT;
}
b.push_back(a[0]);
for (long long i = 1; i < n; i++) {
if (insert == RIGHT) {
b.push_back(a[i]);
}
else {
b.push_front(a[i]);
}
insert = !insert;
}
for (long long i = 0; i < n; i++) {
cout << b[i];
}
return 0;
} | a.cc:7:9: error: expected unqualified-id before 'false'
7 | typedef false LEFT;
| ^~~~~
a.cc:8:9: error: expected unqualified-id before 'true'
8 | typedef true RIGHT;
| ^~~~
a.cc: In function 'int main()':
a.cc:21:14: error: 'LEFT' was not declared in this scope
21 | insert = LEFT;
| ^~~~
a.cc:24:14: error: 'RIGHT' was not declared in this scope
24 | insert = RIGHT;
| ^~~~~
a.cc:28:19: error: 'RIGHT' was not declared in this scope
28 | if (insert == RIGHT) {
| ^~~~~
|
s594277067 | p03673 | C++ | n = int(input())
a = list(map(int, input().split()))
pushpush = []
for i in range(n):
if (i%2 == (n-1)%2):
pushpush.insert(0, a[i])
else:
pushpush.append(a[i])
print(*pushpush) | a.cc:1:1: error: 'n' does not name a type
1 | n = int(input())
| ^
|
s988284468 | p03673 | Java | import java.util.*;
public class Main {
public static void main(String[] args) throws Exception{
Scanner scn = new Scanner(System.in);
int n = scn.nextInt();
String[] a = new String[n];
for(int i=0; i<a.length; i++){
a[i] = scn.next();
}
ArrayList<String> list = new ArrayList<>();
for(int i=0; i<a.length; i++){
list.add(a[i]);
Collection.reverse(list);
}
for(int i=0; i<list.size(); i++){
String ans = list.get(i);
System.out.print(ans + " ");
}
}
}
| Main.java:14: error: cannot find symbol
Collection.reverse(list);
^
symbol: method reverse(ArrayList<String>)
location: interface Collection
1 error
|
s308930483 | p03673 | Java | import java.util.*;
public class Main {
public static void main(String[] args) throws Exception{
Scanner scn = new Scanner(System.in);
int n = scn.nextInt();
String[] a = new String[n];
for(int i=0; i<a.length; i++){
a[i] = scn.next();
}
ArrayList<string> list = new ArrayList<>();
for(int i=0; i<a.length; i++){
list.add(a[i]);
Collection.reverse(list);
}
for(int i=0; i<list.size(); i++){
String ans = list.get(i);
System.out.print(ans + " ");
}
}
} | Main.java:11: error: cannot find symbol
ArrayList<string> list = new ArrayList<>();
^
symbol: class string
location: class Main
1 error
|
s826526470 | p03673 | C++ | #include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < (int)c; i++)
int main() {
int n;
scanf("%d", &n);
vector<ll> a(n);
rep(i, n) scanf("%lld", &a[i]);
deque<ll> ans;
int temp = 1;
if(n % 2) temp = 0; //nが奇数なら0、偶数なら1
rep(i, n) {
if(i % 2 == temp) ans.push_front(a[i]); //偶奇が一致してたら
else ans.push_back(a[i]);
}
rep(i, n) printf("%lld ", ans[i]);
printf("\n");
return 0;
} | a.cc: In function 'int main()':
a.cc:7:12: error: 'll' was not declared in this scope
7 | vector<ll> a(n);
| ^~
a.cc:7:14: error: template argument 1 is invalid
7 | vector<ll> a(n);
| ^
a.cc:7:14: error: template argument 2 is invalid
a.cc:8:31: error: invalid types 'int[int]' for array subscript
8 | rep(i, n) scanf("%lld", &a[i]);
| ^
a.cc:9:13: error: template argument 2 is invalid
9 | deque<ll> ans;
| ^
a.cc:13:31: error: request for member 'push_front' in 'ans', which is of non-class type 'int'
13 | if(i % 2 == temp) ans.push_front(a[i]); //偶奇が一致してたら
| ^~~~~~~~~~
a.cc:13:43: error: invalid types 'int[int]' for array subscript
13 | if(i % 2 == temp) ans.push_front(a[i]); //偶奇が一致してたら
| ^
a.cc:14:18: error: request for member 'push_back' in 'ans', which is of non-class type 'int'
14 | else ans.push_back(a[i]);
| ^~~~~~~~~
a.cc:14:29: error: invalid types 'int[int]' for array subscript
14 | else ans.push_back(a[i]);
| ^
a.cc:16:34: error: invalid types 'int[int]' for array subscript
16 | rep(i, n) printf("%lld ", ans[i]);
| ^
|
s043627370 | p03673 | C++ | #include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <complex>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <iterator>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
#include <limits>
#include <time.h>
#include <cstdint>
using namespace std;
using pii = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define sc second
#define fr first
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(ll i=n-1;i>=0;i--)
#define rRep(i,a,b) for(ll i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
int ctoi(const char c){
if('0' <= c && c <= '9') return (c-'0');
return -1;
}
ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ll INF=1000000011;
constexpr ll MOD2=998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS=10e-8;
template <class T, class U> inline bool chmax(T& lhs, const U& rhs) { if (lhs < rhs) { lhs = rhs; return 1; } return 0; }
template <class T, class U> inline bool chmin(T& lhs, const U& rhs) { if (lhs > rhs) { lhs = rhs; return 1; } return 0; }
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
for(auto i=begin(v); i != end(v); ++i){
if(i !=begin(v)) os << ' ';
os << *i;
}
return os;
}
// modint
template <std::uint_fast64_t Modulus> class modint {
using u64 = std::uint_fast64_t;
public:
u64 a;
constexpr modint(const u64 x = 0) noexcept : a(x % Modulus) {}
constexpr u64 &value() noexcept { return a; }
constexpr const u64 &value() const noexcept { return a; }
constexpr modint operator+(const modint rhs) const noexcept {
return modint(*this) += rhs;
}
constexpr modint operator-(const modint rhs) const noexcept {
return modint(*this) -= rhs;
}
constexpr modint operator*(const modint rhs) const noexcept {
return modint(*this) *= rhs;
}
constexpr modint operator/(const modint rhs) const noexcept {
return modint(*this) /= rhs;
}
constexpr modint &operator+=(const modint rhs) noexcept {
a += rhs.a;
if (a >= Modulus) {
a -= Modulus;
}
return *this;
}
constexpr modint &operator-=(const modint rhs) noexcept {
if (a < rhs.a) {
a += Modulus;
}
a -= rhs.a;
return *this;
}
constexpr modint &operator*=(const modint rhs) noexcept {
a = a * rhs.a % Modulus;
return *this;
}
constexpr modint &operator/=(modint rhs) noexcept {
u64 exp = Modulus - 2;
while (exp) {
if (exp % 2) {
*this *= rhs;
}
rhs *= rhs;
exp /= 2;
}
return *this;
}
};
vector<ll> A;
int main(){
ll N,B;
cin >> N;
rep(i,N){
cin >> B ;
A.pb(B);
}
ll T = N-1;
while(T>=0){
cout << A[T] << " ";
T-=2;
}
T=0;
if(N%2==1){
T=1;
}
while(T<N-1){
cout << A[T] << " ";
T+=2;
}
cout << endl;
}
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <iterator>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
using namespace std;
using pii = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define sc second
#define fr first
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rRep(i,a,b) for(int i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
int ctoi(const char c){
if('0' <= c && c <= '9') return (c-'0');
return -1;
}
ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ll INF=1000000011;
constexpr ll MOD2=998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS=10e-8;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
for(auto i=begin(v); i != end(v); ++i){
if(i !=begin(v)) os << ' ';
os << *i;
}
return os;
}
vector<ll> A;
int main(){
ll N,B;
cin >> N;
rep(i,N){
cin >> B ;
A.pb(B);
}
ll T = N-1;
while(T>=0){
cout << A[T] << " ";
T-=2;
}
T=0;
if(N%2==1){
T=1;
}
while(T<N-1){
cout << A[T] << " ";
T+=2;
}
cout << endl;
} | a.cc:176:9: warning: "rrep" redefined
176 | #define rrep(i,n) for(int i=n-1;i>=0;i--)
| ^~~~
a.cc:36:9: note: this is the location of the previous definition
36 | #define rrep(i,n) for(ll i=n-1;i>=0;i--)
| ^~~~
a.cc:177:9: warning: "rRep" redefined
177 | #define rRep(i,a,b) for(int i=a;i>=b;i--)
| ^~~~
a.cc:37:9: note: this is the location of the previous definition
37 | #define rRep(i,a,b) for(ll i=a;i>=b;i--)
| ^~~~
a.cc:183:5: error: redefinition of 'int ctoi(char)'
183 | int ctoi(const char c){
| ^~~~
a.cc:43:5: note: 'int ctoi(char)' previously defined here
43 | int ctoi(const char c){
| ^~~~
a.cc:187:4: error: redefinition of 'll gcd(ll, ll)'
187 | ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
| ^~~
a.cc:47:4: note: 'll gcd(ll, ll)' previously defined here
47 | ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
| ^~~
a.cc:188:4: error: redefinition of 'll lcm(ll, ll)'
188 | ll lcm(ll a,ll b){return a*b/gcd(a,b);}
| ^~~
a.cc:48:4: note: 'll lcm(ll, ll)' previously defined here
48 | ll lcm(ll a,ll b){return a*b/gcd(a,b);}
| ^~~
a.cc:189:14: error: redefinition of 'constexpr const ll MOD'
189 | constexpr ll MOD=1000000007;
| ^~~
a.cc:49:14: note: 'constexpr const ll MOD' previously defined here
49 | constexpr ll MOD=1000000007;
| ^~~
a.cc:190:14: error: redefinition of 'constexpr const ll INF'
190 | constexpr ll INF=1000000011;
| ^~~
a.cc:50:14: note: 'constexpr const ll INF' previously defined here
50 | constexpr ll INF=1000000011;
| ^~~
a.cc:191:14: error: redefinition of 'constexpr const ll MOD2'
191 | constexpr ll MOD2=998244353;
| ^~~~
a.cc:51:14: note: 'constexpr const ll MOD2' previously defined here
51 | constexpr ll MOD2=998244353;
| ^~~~
a.cc:192:14: error: redefinition of 'constexpr const ll LINF'
192 | constexpr ll LINF = 1001002003004005006ll;
| ^~~~
a.cc:52:14: note: 'constexpr const ll LINF' previously defined here
52 | constexpr ll LINF = 1001002003004005006ll;
| ^~~~
a.cc:193:14: error: redefinition of 'constexpr const ld EPS'
193 | constexpr ld EPS=10e-8;
| ^~~
a.cc:53:14: note: 'constexpr const ld EPS' previously defined here
53 | constexpr ld EPS=10e-8;
| ^~~
a.cc:196:31: error: redefinition of 'template<class T> std::istream& operator>>(std::istream&, std::vector<_Tp>&)'
196 | template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
| ^~~~~~~~
a.cc:56:31: note: 'template<class T> std::istream& operator>>(std::istream&, std::vector<_Tp>&)' previously declared here
56 | template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
| ^~~~~~~~
a.cc:197:42: error: redefinition of 'template<class T, class U> std::istream& operator>>(std::istream&, std::pair<_T1, _T2>&)'
197 | template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
| ^~~~~~~~
a.cc:57:42: note: 'template<class T, class U> std::istream& operator>>(std::istream&, std::pair<_T1, _T2>&)' previously declared here
57 | template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
| ^~~~~~~~
a.cc:198:42: error: redefinition of 'template<class T, class U> std::ostream& operator>>(std::ostream&, const std::pair<_T1, _T2>&)'
198 | template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
| ^~~~~~~~
a.cc:58:42: note: 'template<class T, class U> std::ostream& operator>>(std::ostream&, const std::pair<_T1, _T2>&)' previously declared here
58 | template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
| ^~~~~~~~
a.cc:199:28: error: redefinition of 'template<class T> std::ostream& operator<<(std::ostream&, std::vector<_Tp>&)'
199 | template<class T> ostream& operator<<(ostream& os, vector<T>& v){
| ^~~~~~~~
a.cc:59:28: note: 'template<class T> std::ostream& operator<<(std::ostream&, std::vector<_Tp>&)' previously declared here
59 | template<class T> ostream& operator<<(ostream& os, vector<T>& v){
| ^~~~~~~~
a.cc:207:12: error: redefinition of 'std::vector<long long int> A'
207 | vector<ll> A;
| ^
a.cc:121:12: note: 'std::vector<long long int> A' previously declared here
121 | vector<ll> A;
| ^
a.cc:209:5: error: redefinition of 'int main()'
209 | int main(){
| ^~~~
a.cc:123:5: note: 'int main()' previously defined here
123 | int main(){
| ^~~~
|
s116743710 | p03673 | C++ | #include <bits/stdc++.h>
#include <math.h>
#define ALL(a) a.begin(), a.end()
#define rep(i, K, N) for(int i = K; i < N; i++)
#define ll long long int
using namespace std;
int main() {
ll N, A;cin >> N;
vector<ll> B;
rep(i, 0, N){
cin >> A;
if(i%2 == 0)B.push_back(A);
else B.insert(B.begin(), A);
}
if(N%2 != 0)reverse(ALL(B)):
rep(i, 0, B.size())cout << B[i] << " ";
}
| a.cc: In function 'int main()':
a.cc:21:28: error: expected ';' before ':' token
21 | if(N%2 != 0)reverse(ALL(B)):
| ^
| ;
a.cc:23:5: error: 'i' was not declared in this scope
23 | rep(i, 0, B.size())cout << B[i] << " ";
| ^
a.cc:4:38: note: in definition of macro 'rep'
4 | #define rep(i, K, N) for(int i = K; i < N; i++)
| ^
|
s685938724 | p03673 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
veector<int> vec (n);
for(int i=0;i<n;++i) cin>>vec[i];
vector<int> kara(0);
for(int i=0;i<n;++i){
kara.push_back(vec[i]);
reverse(kara.begin(),kara.end());
}
for(int i=0;i<n;++i){
cout<<kara[i];
if(i+1==0) break;
cout<<" ";
}
cout<<endl;
}
| a.cc: In function 'int main()':
a.cc:7:3: error: 'veector' was not declared in this scope
7 | veector<int> vec (n);
| ^~~~~~~
a.cc:7:11: error: expected primary-expression before 'int'
7 | veector<int> vec (n);
| ^~~
a.cc:8:29: error: 'vec' was not declared in this scope
8 | for(int i=0;i<n;++i) cin>>vec[i];
| ^~~
a.cc:11:20: error: 'vec' was not declared in this scope
11 | kara.push_back(vec[i]);
| ^~~
|
s204837524 | p03673 | C++ | #intclude <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
veector<int> vec (n);
for(int i=0;i<n;++i) cin>>vec[i];
vector<int> kara(0);
for(int i=0;i<n;++i){
kara.push_back(vec[i]);
reverse(kara.begin(),kara.end());
}
for(int i=0;i<n;++i){
cout<<kara[i];
if(i+1==0) break;
cout<<" ";
}
cout<<endl;
} | a.cc:1:2: error: invalid preprocessing directive #intclude; did you mean #include?
1 | #intclude <bits/stdc++.h>
| ^~~~~~~~
| include
a.cc: In function 'int main()':
a.cc:6:3: error: 'cin' was not declared in this scope
6 | cin>>n;
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | #intclude <bits/stdc++.h>
a.cc:7:3: error: 'veector' was not declared in this scope
7 | veector<int> vec (n);
| ^~~~~~~
a.cc:7:11: error: expected primary-expression before 'int'
7 | veector<int> vec (n);
| ^~~
a.cc:8:29: error: 'vec' was not declared in this scope
8 | for(int i=0;i<n;++i) cin>>vec[i];
| ^~~
a.cc:9:3: error: 'vector' was not declared in this scope
9 | vector<int> kara(0);
| ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
+++ |+#include <vector>
1 | #intclude <bits/stdc++.h>
a.cc:9:10: error: expected primary-expression before 'int'
9 | vector<int> kara(0);
| ^~~
a.cc:11:5: error: 'kara' was not declared in this scope
11 | kara.push_back(vec[i]);
| ^~~~
a.cc:11:20: error: 'vec' was not declared in this scope
11 | kara.push_back(vec[i]);
| ^~~
a.cc:12:5: error: 'reverse' was not declared in this scope
12 | reverse(kara.begin(),kara.end());
| ^~~~~~~
a.cc:15:5: error: 'cout' was not declared in this scope
15 | cout<<kara[i];
| ^~~~
a.cc:15:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:15:11: error: 'kara' was not declared in this scope
15 | cout<<kara[i];
| ^~~~
a.cc:19:3: error: 'cout' was not declared in this scope
19 | cout<<endl;
| ^~~~
a.cc:19:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:19:9: error: 'endl' was not declared in this scope
19 | cout<<endl;
| ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
+++ |+#include <ostream>
1 | #intclude <bits/stdc++.h>
|
s032405130 | p03673 | Java | import java.io.*;
import java.math.*;
import java.util.*;
public class PushPush {
public static void main(String[] args) { //Ball out dawg
FastScanner I = new FastScanner(); //Input
OutPut O = new OutPut(); //Output
int N =I.nextInt();
long[] a = new long[N];
for (int i = 0; i < N; i++) a[i] =I.nextLong();
int ptr = N-1;
while (ptr>=0) {
O.p(a[ptr]+" ");
ptr-=2;
}
ptr=N%2;
while (ptr<N) {
O.p(a[ptr]+" ");
ptr+=2;
}
}
public static long ceil(long num, long den) {long ans = num/den; if (num%den!=0)
ans++; return ans;}
public static long GCD(long a, long b) {
if (a==0||b==0) return Math.max(a,b);
return GCD(Math.min(a, b),Math.max(a, b)%Math.min(a, b));
}
public static long FastExp(long base, long exp, long mod) {
long ans=1;
while (exp>0) {
if (exp%2==1) ans*=base;
exp/=2;
base*=base;
base%=mod;
ans%=mod;
}
return ans;
}
public static long ModInv(long num,long mod) {return FastExp(num,mod-2,mod);}
static class FastScanner {
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st=new StringTokenizer("");
String next() {
while (!st.hasMoreTokens())
try {
st=new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
return st.nextToken();
}
int nextInt() {return Integer.parseInt(next());}
long nextLong() {return Long.parseLong(next());};
}
static class OutPut{
PrintWriter w = new PrintWriter(System.out);
void pln(int x) {w.println(x);w.flush();}
void pln(long x) {w.println(x);w.flush();}
void pln(String x) {w.println(x);w.flush();}
void pln(char x) {w.println(x);w.flush();}
void pln(StringBuilder x) {w.println(x);w.flush();}
void p(int x) {w.print(x);w.flush();}
void p(long x) {w.print(x);w.flush();}
void p(String x) {w.print(x);w.flush();}
void p(char x) {w.print(x);w.flush();}
void p(StringBuilder x) {w.print(x);w.flush();}
}
} | Main.java:4: error: class PushPush is public, should be declared in a file named PushPush.java
public class PushPush {
^
1 error
|
s177105891 | p03673 | C++ | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
long long n;
cin >> n;
vector<long long> res;
for (long long i=0;i<n;i++) {
long long a;
cin >> a;
res.push_back(a);
sort(res.end(), res.begin());
}
for (long long i=0;i<n-1;i++) {
cout << res[i] << " ";
}
cout << res[n-1 | a.cc: In function 'int main()':
a.cc:20:18: error: expected ']' at end of input
20 | cout << res[n-1
| ^
| ]
a.cc:20:18: error: expected ';' at end of input
20 | cout << res[n-1
| ^
| ;
a.cc:20:18: error: expected '}' at end of input
a.cc:7:12: note: to match this '{'
7 | int main() {
| ^
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.