submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3
values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s443221967 | p04030 | C++ | #include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
#define sz 12
char s[sz + 3];
int main(){
int i, j, len;
gets(s);
len = strlen(s);
if(len == 1){
puts(s);
}else{
for(i = 0; s[i]; i++){
if(s[i + 1] != 'B' && s[i] != 'B'){
... | a.cc: In function 'int main()':
a.cc:14:5: error: 'gets' was not declared in this scope; did you mean 'getw'?
14 | gets(s);
| ^~~~
| getw
|
s871712928 | p04030 | C++ | #include <iostream>
/* Karen {{{
___ ____
|_ ||_ _|
| |_/ / ,--. _ .--. .---. _ .--.
| __'. `'_\ : [ `/'`\]/ /__\\[ `.-. |
_| | \ \_ // | |, | | | \__., | | | |
|____||____|\'-;__/[___] '.__.'[___||__]
}}} */
/* cpp template {{{*/
/*
using namespace std;
#define endl '\n'
#define REP(i... | a.cc: In function 'int main()':
a.cc:61:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
61 | cin.tie(0);
| ^~~
| std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to ... |
s416461800 | p04030 | C++ | #include <iostream>
/* Karen {{{
___ ____
|_ ||_ _|
| |_/ / ,--. _ .--. .---. _ .--.
| __'. `'_\ : [ `/'`\]/ /__\\[ `.-. |
_| | \ \_ // | |, | | | \__., | | | |
|____||____|\'-;__/[___] '.__.'[___||__]
}}} */
/* cpp template {{{*/
/*
using namespace std;
#define endl '\n'
#define REP(i... | a.cc:51:7: error: 'll' does not name a type
51 | const ll MOD = 1e9 + 7;
| ^~
a.cc:52:7: error: 'll' does not name a type
52 | const ll INF = 1e9 + 9;
| ^~
a.cc:53:7: error: 'D' does not name a type
53 | const D EPS = 1e-9;
| ^
a.cc:57:2: error: expected unqualified-id befo... |
s689484948 | p04030 | C++ | #include <bits/stdc++.h>
/* Karen {{{
___ ____
|_ ||_ _|
| |_/ / ,--. _ .--. .---. _ .--.
| __'. `'_\ : [ `/'`\]/ /__\\[ `.-. |
_| | \ \_ // | |, | | | \__., | | | |
|____||____|\'-;__/[___] '.__.'[___||__]
}}} */
/* cpp template {{{*/
using namespace std;
#define endl '\n'
#define REP... | a.cc: In function 'int main()':
a.cc:74:31: error: operands to '?:' have different types 'bool' and 'std::basic_ostream<char>'
74 | REP(i, s.size()) s[i] == 'B'?:cout << s[i];
|
s866904559 | p04030 | C++ | #include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pb push_back
#defi... | a.cc: In function 'int main()':
a.cc:38:24: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
38 | if(s[i]=="B"){
|
s139565533 | p04030 | C++ | #include<iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int main() {
char str[10] = { }, ans[10] = { };
int count = 0;
cin >> str;
for (int i = 0; i < strlen(str); i++) {
if (str[i] == '0')
ans[count] = '0';
else if (str[i] == '1')
ans[count] = '1';
else {
if (cou... | a.cc: In function 'int main()':
a.cc:14:29: error: 'strlen' was not declared in this scope
14 | for (int i = 0; i < strlen(str); i++) {
| ^~~~~~
a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #includ... |
s105219034 | p04030 | Java | import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Scanner;
public class Test {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.nextLine();
Deque<Character> dq = new ArrayDeque<>();
for(int i=0; i<s.length(); i++) {
char c = s.charAt(i);
if... | Main.java:6: error: class Test is public, should be declared in a file named Test.java
public class Test {
^
1 error
|
s027773625 | p04030 | C | include <stdio.h>
int main(void)
{
char s[10];
char ans[10];
int i, j;
j = 0;
scanf("%s", s);
for(i=0; i<10; i++){
if(s[i] == '0' || s[i] == '1' ){
printf("%d\n", j);
ans[j] = s[i];
j++;
}else if(s[i] == 'B'){
printf("%s\n", ans);
if(j!=0){
ans[--j] = '\0';
}
}
}
printf("%s\n"... | main.c:1:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
1 | include <stdio.h>
| ^
|
s055440492 | p04030 | Java | import java.util.*;
public class Hoge {
public static int sum(int n){
return (1+n)*n/2;
}
public static String conv(String in){
String result = "";
for (int i = 1; i < in.length(); i++) {
if (in.charAt(i) != 'B') {
result += in.charAt(i-1);
... | Main.java:3: error: class Hoge is public, should be declared in a file named Hoge.java
public class Hoge {
^
1 error
|
s535710860 | p04030 | Java | import java.util.*;
public class Main {
public static int sum(int n){
return (1+n)*n/2;
}
public static String conv(String in){
String result = "";
int i = 1;
for (; i < in.length(); i++) {
if (in.charAt(i) != 'B') {
result += in.charAt(i-1);
... | Main.java:20: error: missing return statement
}
^
1 error
|
s604188371 | p04030 | Java | import java.util.*;
public class Main {
public static int sum(int n){
return (1+n)*n/2;
}
public static String conv(String in){
String result = "";
int i = 1;
for (; i < in.length(); i++) {
if (in.charAt(i) != 'B') {
result += in.charAt(i-1);
... | Main.java:25: error: incompatible types: String cannot be converted to int
int a = sc.next();
^
Main.java:26: error: incompatible types: int cannot be converted to String
System.out.println(conv(a));
^
Note: Some messages have been simplified; recompile with -Xdiags:verbos... |
s361572914 | p04030 | Java | import java.util.*;
public class Main {
public static int sum(int n){
return (1+n)*n/2;
}
public static String conv(String in){
String result = "";
int i = 1;
for (; i < in.length; i++) {
if (in.charAt(i) != 'B') {
result += in.charAt(i-1);
... | Main.java:12: error: cannot find symbol
for (; i < in.length; i++) {
^
symbol: variable length
location: variable in of type String
Main.java:25: error: cannot find symbol
int a = sc.nextString();
^
symbol: method nextString()
location: variable sc of type Scanner
... |
s269937388 | p04030 | C++ | #include<iostream>
using namespace std;
int main(int argc, char const *argv[]) {
string s,sout;
int i;
cin>>s;
for(i=0;i<s.length;i++){
if(s[i]=="B"){
if (!(sout.empty())) {
sout.pop_back();
}
}
else{
sout+=s[i];
}
}
cout<<sout;
return 0;
}
| a.cc: In function 'int main(int, const char**)':
a.cc:9:15: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size... |
s000793136 | p04030 | C++ | #include <iostream>
#include <string>
using namespace std;
int main(){
string s;
string ans="";
cin >> s;
for (int i = 0; i < s.size(); ++i)
{
switch(s[i]){
case '0':
ans+="0";
break;
case '1':
ans+="1";
break;
case 's':
if(!ans.empty()) 10ans.erase(ans.size()-1);
break;
}
}
cout <... | a.cc: In function 'int main()':
a.cc:18:42: error: unable to find numeric literal operator 'operator""ans.erase'
18 | if(!ans.empty()) 10ans.erase(ans.size()-1);
| ^~~~~~~~~~~
|
s844462698 | p04030 | C++ | #include <bits/stdc++.h>
#define EPS 1e-9
#define INF 1070000000LL
#define MOD 1000000007LL
#define fir first
#define foreach(it,X) for(auto it=(X).begin();it!=(X).end();it++)
#define numa(x,a) for(auto x: a)
#define ite iterator
#define mp make_pair
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i+... | a.cc: In function 'int main()':
a.cc:56:11: error: 'ouput' was not declared in this scope; did you mean 'output'?
56 | cout << ouput << endl;
| ^~~~~
| output
|
s685160015 | p04030 | C++ | #include <iostream>
#include <string>
using namespace std;
int main(int argc, char* argv[])
{
string s;
cin>>s;
int sLen=s.length()+1;
char *s1 = new char[sLen];
memset(s1,'\0',sLen);
char *pStr = (char*)s.c_str();
int i=0;
while (*pStr != '\0'){
if (*pStr != 'B'){
s1[i++] += *pStr;
}else{
if (i>0){
... | a.cc: In function 'int main(int, char**)':
a.cc:10:9: error: 'memset' was not declared in this scope
10 | memset(s1,'\0',sLen);
| ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include <iostream>
+++ |+#includ... |
s599094120 | p04030 | C++ | #include <iostream>
#include <string>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
int main(void){
string s; cin >> s;
string ans;
rep(i, s.size()){
if(s[i] == '0') ans += '0';
else if(s[i] == '1') ans += '1';
else{
if(!s) ans.pop_back();//空文字でなければ
}
}
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:13:28: error: no match for 'operator!' (operand type is 'std::string' {aka 'std::__cxx11::basic_string<char>'})
13 | if(!s) ans.pop_back();//空文字でなければ
| ^~
a.cc:13:28: note: candidate: 'operator!(bool)' (built-in)
a.cc:13:28... |
s375153357 | p04030 | C | #include <stdio.h>
#include <String.h>
int main(){
char s[10];
int i;
for(i = 0; i < 10; i++){
s[i] = getchar();
if(s[i] == '\n' || s[i] == '\r') break;
}
s[i] ='\0';
int s_index = 0;
int s_len = strlen(s);
int consec_b_count = 0;
if(s[0] == 'B'){ // if first letter is B, don't need to delete anything... | main.c:2:10: fatal error: String.h: No such file or directory
2 | #include <String.h>
| ^~~~~~~~~~
compilation terminated.
|
s121830310 | p04030 | C | #include<stdio.h>
#include <stdlib.h>
int main() {
char s[11];
char r[11];
char buf[64];
int i,n,j,dummy,k;
scanf_s("%s", s, 11);
for (n = 0; s[n] != '\0'; n++);
for (i = 0, j=0; s[i] != '\0'; i++) {
fgets(buf, 64, stdin);
if (s[i] == 'B') {
j--;
}
else {
r[j] = s[i];
j++;
}
for (k = 0,... | main.c: In function 'main':
main.c:12:9: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
12 | scanf_s("%s", s, 11);
| ^~~~~~~
| scanf
|
s948987635 | p04030 | C | #include<stdio.h>
#include <stdlib.h>
int main() {
char s[11];
char r[11];
char buf[64];
int i,n,j,dummy,k;
scanf_s("%s", s, 11);
for (n = 0; s[n] != '\0'; n++);
for (i = 0, j=0; s[i] != '\0'; i++) {
fgets(buf, 64, stdin);
if (s[i] == 'B') {
//j--;
continue;
}
r[j] = s[i];
j++;
for (k = 0,... | main.c: In function 'main':
main.c:12:9: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
12 | scanf_s("%s", s, 11);
| ^~~~~~~
| scanf
|
s962337798 | p04030 | C | #include<stdio.h>
#include <string.h>
#include <stdlib.h>
int main()
{
char S[11];
char S2[11];
int i;
int j;
int len;
scanf("%s",S);
len = strlen( S );
j = 0;
for (i=0; i < len; i++) {
if (S[i] == '0') {
j = j + 1;
... | main.c: In function 'main':
main.c:30:26: error: 'null' undeclared (first use in this function)
30 | S2[j] = null;
| ^~~~
main.c:30:26: note: each undeclared identifier is reported only once for each function it appears in
|
s195860107 | p04030 | C++ | include <iostream>
#include <string>
using namespace std;
signed main()
{
string ans,in;
cin >> in;
for(auto a:in)
{
if(a == 'B')
{
ans.pop_back();
}
else
{
ans.push_back(a);
}
}
cout << ans << endl;
} | a.cc:1:1: error: 'include' does not name a type
1 | include <iostream>
| ^~~~~~~
In file included from /usr/include/c++/14/bits/char_traits.h:42,
from /usr/include/c++/14/string:42,
from a.cc:2:
/usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a typ... |
s265874166 | p04030 | C++ | #include <iostream>
#include <math.h>
#include <string>
using namespace std;
int main() {
string a,b;
cin>>a;
int n=a.size();
for (int i=0;i<n;i++){
if (a[i]!='B'){
b+=a[i];
}else{
b.pop_back();}
cout<<b<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:17:2: error: expected '}' at end of input
17 | }
| ^
a.cc:6:12: note: to match this '{'
6 | int main() {
| ^
|
s907062009 | p04030 | C++ | #include <iostream>
#include <string>
using namespace std;
int main() {
string str;
cin >> str;
int len = str.length();
char* s = new char[len + 1];
memcpy(s, str.c_str(), len + 1);
for (int i = 0; i < len; i++) {
if (s[i] == 'B') {
if (i >= 1) {
for (int j = i - 1; j < len - -2; j++) {
s[j] = ... | a.cc: In function 'int main()':
a.cc:12:9: error: 'memcpy' was not declared in this scope
12 | memcpy(s, str.c_str(), len + 1);
| ^~~~~~
a.cc:2:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include <iostream>
+++ |+#includ... |
s223394279 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
string s;
string c;
cin>>c;
for(int i=0;i<c.size();i++){
if(c=='1'){
s+="1";
}else if(c=='0'){
s+="0";
}else if(c=='B'){
s.erase(s.end()-1);
}
}
cout<<s<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:11:5: error: no match for 'operator==' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'char')
11 | if(c=='1'){
| ~^~~~~
| | |
| | char
| std::string {aka std::__cxx11::basic_string<char>}
In file included from /... |
s906277269 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
string s;
string c;
for(int i=0;i<c.size();i++){
if(c=='1'){
s+="1";
}else if(c=='0'){
s+="0";
}else if(c=='B'){
s.erase(s.end()-1);
}
}
cout<<s<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:9:5: error: no match for 'operator==' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'char')
9 | if(c=='1'){
| ~^~~~~
| | |
| | char
| std::string {aka std::__cxx11::basic_string<char>}
In file included from /u... |
s853097588 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
vector<char> s;
char c;
for(int i=0;i<c.size();i++){
if(c=='1'){
s+="1";
}else if(c=='0'){
s+="0";
}else if(c=='B'){
s.erase(s.end()-1);
}
}
cout<<s<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:8:17: error: request for member 'size' in 'c', which is of non-class type 'char'
8 | for(int i=0;i<c.size();i++){
| ^~~~
a.cc:10:2: error: no match for 'operator+=' (operand types are 'std::vector<char>' and 'const char [2]')
10 | s+="1";
| ~^~~~~
... |
s981401976 | p04030 | C++ | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
#include<stdio.h>
int main() {
char s[10000],m[10000];
char c;
int i, j, k=0, l;
fgets(s, 10000, stdin);
for (i = 0;i < strlen(s);i++) {
switch (s[i])
{
case '0':
m[k] = '0... | a.cc: In function 'int main()':
a.cc:17:24: error: 'strlen' was not declared in this scope
17 | for (i = 0;i < strlen(s);i++) {
| ^~~~~~
a.cc:7:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
6 | #include<algorithm>
... |
s893145711 | p04030 | C++ | #include <iostream>
#include <string>
using namespace std;
int main(){
int n;
string s,ans;
for(int i = 0; i < s.size(); i++)
{
if(s[i]=='B'){
if(ans.size != 0){
ans = ans.substr(0,s.size()-1);
}
}
else{
ans += s[i];
}
}
cout << ans << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:11:14: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsig... |
s598743868 | p04030 | C++ | #include <stdio.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <list>
#include <vector>
#include <map>
using namespace std;
int main(void) {
string str,a;
cin >> str;
for (int i = 0; i < str.length(); i++) {
switch(str[i]) {
case '0':
a.push_back('0');
break;... | a.cc: In function 'int main()':
a.cc:27:31: error: cannot convert 'std::__cxx11::basic_string<char>::empty' from type 'bool (std::__cxx11::basic_string<char>::)() const noexcept' to type 'bool'
27 | if(!a.empty)
| ^~~~~
a.cc:27:31: error: in argument to una... |
s746254219 | p04030 | C++ | #include <iostream>
#include <string>
using namespace std;
int main(){
int n;
string s,ans;
for(int i = 0; i < s.size(); i++)
{
if(s[i]=="B"){
if(ans != 0){
ans = ans.substr(0,s.size()-1);
}
}
else{
ans += s[i];
}
}
cout << ans << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:10:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
10 | if(s[i]=="B"){
a.cc:11:14: error: no match for 'operator!=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int')
11 | if(ans != 0){
| ... |
s645037103 | p04030 | C++ | #include <iostream>
#include <string>
using namespace std;
int main(){
int n;
string s,ans;
for(int i = 0; i < strlen(s); i++)
{
if(s[i]=="B"){
if(ans != 0){
ans = ans.substr(0,strlen(ans)-1);
}
}
else{
ans += s[i];
}
}
cout << ans << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:8:22: error: 'strlen' was not declared in this scope
8 | for(int i = 0; i < strlen(s); i++)
| ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include <iostream>
+++ ... |
s764217222 | p04030 | C++ | string = input()
result = []
j=0
for i in range(len(string)):
if string[i] == '0':
result.append('0')
elif string[i] == '1':
result.append('1')
elif string[i]=='B' and result[-1] in ['0','1']:
result.append(" ")
str_result=" ".join(result)
print(str_result.replace(" ",""))
| a.cc:1:1: error: 'string' does not name a type
1 | string = input()
| ^~~~~~
|
s228409296 | p04030 | C++ | #include <iostream>
##include <string>
using namespace std;
int main(){
int n;
string s,ans;
for(int i = 0; i < strlen(s); i++)
{
if(s[i]=="B"){
if(ans != 0){
ans = ans.substr(0,strlen(ans)-1);
}
}
else{
ans += s[i];
}
}
cout << ans << endl;
return 0;
}
| a.cc:2:1: error: stray '##' in program
2 | ##include <string>
| ^~
a.cc:2:3: error: 'include' does not name a type
2 | ##include <string>
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:7:3: error: 'string' was not declared in this scope
7 | string s,ans;
| ^~~~~~
a.cc:7:3: note: sugg... |
s998478184 | p04030 | C | #include<stdio.h>
#include <string.h>
#include <stdlib.h>
int main()
{
char S[11];
char S2[11];
int i;
int j;
int len;
scanf("%s",S);
len = strlen( S );
j = 0;
for (i=0; i < len; i++) {
if (S[i] == 0) {
j = j + 1;
... | main.c: In function 'main':
main.c:34:1: error: expected declaration or statement at end of input
34 | }
| ^
|
s958975871 | p04030 | C | #include<stdio.h>
#include <string.h>
#include <stdlib.h>
int main()
{
char S[11];
char S2[11];
int i;
int j;
scanf("%s",S);
j = 0;
for (i=0; i < 10; i++) {
if (S[i] == 0) {
j = j + 1;
S2[j - 1] = 0;
}
... | main.c: In function 'main':
main.c:28:23: warning: comparison between pointer and integer
28 | if (S[i] == " ") {
| ^~
main.c:35:1: error: expected declaration or statement at end of input
35 | }
| ^
|
s191627853 | p04030 | C | #include<stdio.h>
#include <string.h>
#include <stdlib.h>
int main()
{
char S[11];
char S2[11];
int i;
int j;
scanf("%s",S);
j = 0;
for (i=0; i < 10; i++) {
if (S[i] == 0) {
j = j + 1;
S2[j - 1] = 0;
}
... | main.c: In function 'main':
main.c:25:24: warning: comparison between pointer and integer
25 | if ( S[i] == "B") {
| ^~
main.c:28:23: warning: comparison between pointer and integer
28 | if (S[i] == " ") {
| ^~
main.c:35:1: error... |
s290698278 | p04030 | C | #include<stdio.h>
#include <string.h>
#include <stdlib.h>
int main()
{
char S[11];
char S2[11];
int i;
int j;
scanf("%s",S);
j = 0;
for (i=0; i < 10; i++) {
if (S[i] == 0) {
j = j + 1;
S2[j - 1] = 0;
}
... | main.c: In function 'main':
main.c:25:28: error: 'B' undeclared (first use in this function)
25 | if ( S[i] == B) {
| ^
main.c:25:28: note: each undeclared identifier is reported only once for each function it appears in
main.c:28:23: warning: comparison between pointer... |
s536358437 | p04030 | C | #include<stdio.h>
#include <string.h>
#include <stdlib.h>
int main()
{
char S[11];
char S2[11];
int i;
int j;
scanf("%s",S);
j = 0;
for (i=0; i < 10; i++) {
if (S[i] == 0) {
j = j + 1;
S2[j - 1] = 0;
}
... | main.c: In function 'main':
main.c:20:31: error: expected ')' before '{' token
20 | if ( (S[i] == 1) {
| ~ ^~
| )
main.c:35:1: error: expected expression before '}' token
35 | }
| ^
main.c:35:1: error: expected declaration o... |
s494882407 | p04030 | C++ |
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
#include<stdio.h>
int main() {
int a;
char c;
int x=0,i=0,j,n=0;
char s[1000];
while(scanf("%c",&c)!=EOF){
switch (c)
{
case '0':
x *= 2;
i++;
if (x == 0)n++;
break;
case '1':
... | a.cc: In function 'int main()':
a.cc:45:9: error: 'itoa' was not declared in this scope
45 | itoa(x,s,2);
| ^~~~
|
s594836608 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
vector<char> s;
char c;
while(cin>>c){
if(c=="1"){
s.push_buck("1");
}else if(c=="0"){
s.push_buck("0");
}else if(c=="B"){
s.pop_buck();
}
}
for(auto it=s.begin();it!=s.end();it++) {
cout<<*it<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:9:5: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
9 | if(c=="1"){
| ~^~~~~
a.cc:10:3: error: 'class std::vector<char>' has no member named 'push_buck'; did you mean 'push_back'?
10 | s.push_buck("1");
| ^~~~~~~~~
| push... |
s356910173 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
vector<char> s;
char c;
while(cin>>c){
if(c=="1"){
s.push_buck("1");
}else if(c=="0"){
s.push_buck("0");
}else if(c=="B"){
s.pop_buck();
}
}
cout<<s<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:9:5: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
9 | if(c=="1"){
| ~^~~~~
a.cc:10:3: error: 'class std::vector<char>' has no member named 'push_buck'; did you mean 'push_back'?
10 | s.push_buck("1");
| ^~~~~~~~~
| push... |
s713387375 | p04030 | C++ | #include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
#include<stdio.h>
int main() {
int a;
int c;
int x=0,i=0,j,n=0;
char s[1000];
while(scanf("%c",&c)!=EOF){
switch (c)
{
case '0':
x *= 2;
i++;
if (x == 0)n++;
break;
case '1':
x *= 2;
x++;
... | a.cc: In function 'int main()':
a.cc:43:9: error: 'itoa' was not declared in this scope
43 | itoa(x,s,2);
| ^~~~
|
s908501401 | p04030 | C++ | #include <algorithm>
using namespace std;
int main(){
string s; cin >> s;
string a = "";
int cnt = 0;
for(int i = s.size() - 1; i >= 0; i--){
if(s[i] == 'B'){
cnt++;
continue;
}
a += s[i-cnt];
if(i-cnt == 0) break;
if(cnt < 0) cnt++;
}... | a.cc: In function 'int main()':
a.cc:5:5: error: 'string' was not declared in this scope
5 | string s; cin >> s;
| ^~~~~~
a.cc:2:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
1 | #include <algorithm>
+++ |+#include <string>
2 |... |
s203761452 | p04030 | C | #include<stdio.h>
int main(void){
char s[12],a[12];
int i,c=0;
scanf("%s",s);
for(i=0,s[i]!='\0',i++){
if(s[i]=='B'){
c--;
}else{
a[c]=s[i];
c++;
}
}
for(i=0;i<c;i++)printf("%c",a[i]);
puts("");return 0;
} | main.c: In function 'main':
main.c:6:23: error: expected ';' before ')' token
6 | for(i=0,s[i]!='\0',i++){
| ^
| ;
main.c:6:23: error: expected expression before ')' token
|
s137209339 | p04030 | Java | import java.util.*;
public class Main{
public static void main(String[] args){
Scanner x= new Scanner(System.in);
String y = x.next();
char[] z = new char[y.length()];
int c=0;
for(int i=0;i<y.length();i++){
if(y.charAt(i)=='B'){
if(c!=0){
c--;
z[c] =0;
}
}else{
z[c] = y.charAt(i);
c++;
}
}
... | Main.java:24: error: cannot find symbol
o = o+z.charAt(i);
^
symbol: method charAt(int)
location: variable z of type char[]
1 error
|
s455509391 | p04030 | C++ | #include <iostream>
using namespace std;
int main() {
string a;
cin >> a;
for(int i = 0; i <= a.size(); i++) {
if(a[i] == "b"){
a.erase(i - 1, 2)
i-= 2
};
}
cout << a << endl;
}
| a.cc: In function 'int main()':
a.cc:8:13: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
8 | if(a[i] == "b"){
a.cc:9:24: error: expected ';' before 'i'
9 | a.erase(i - 1, 2)
| ^
| ;
10 | i-= 2
| ... |
s785827052 | p04030 | Java | import java.util.*;
public class Main{
public static void main(String[] args){
Scanner x= new Scanner(System.in);
String y = x.next();
char[] z = new char[y.length()];
int c=0;
for(int i=0;i<y.length();i++){
if(y.charAt(i)=='B'){
if(c!=0){
c--;
z[c] =0;
}
}else{
z[c] = y.charAt(i);
c++;
}
}
... | Main.java:28: error: reached end of file while parsing
}
^
1 error
|
s647423377 | p04030 | C++ | s = raw_input()
words = []
for c in list(s):
if c == 'B':
words.pop()
else:
words.append(c)
print ''.join(words) | a.cc:8:7: error: empty character constant
8 | print ''.join(words)
| ^~
a.cc:1:1: error: 's' does not name a type
1 | s = raw_input()
| ^
|
s835812959 | p04030 | Java | import java.util.*;
public class Main{
public static void main(String[] args){
Scanner x= new Scanner(System.in);
String y = x.next();
char[] z = new char[y.length()];
int c=0;
for(int i=0;i<y.length();i++){
if(y.charAt(i)=='B'){
if(c!=0){
c--;
z[c] =0;
}
}else{
z[c] = y.charAt(i);
c++;
}
}
... | Main.java:23: error: illegal start of expression
for(int i=0;i<,z.length;i++){
^
Main.java:23: error: not a statement
for(int i=0;i<,z.length;i++){
^
Main.java:23: error: ')' expected
for(int i=0;i<,z.length;i++){
^
Main.java:23: error: ';' expected
for(int i=0;i<,z.... |
s571432723 | p04030 | C++ | #include <iostream>
using namespace std;
int main() {
string a;
cin >> a;
for(int i = 0; i <= a.size(); i++) {
if(a[i] == "b"){a.erase(i - 1, 2); i-= 2};
}
cout << a << endl;
} | a.cc: In function 'int main()':
a.cc:8:13: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
8 | if(a[i] == "b"){a.erase(i - 1, 2); i-= 2};
a.cc:8:45: error: expected ';' before '}' token
8 | if(a[i] == "b"){a.erase(i - 1, 2); i-= 2};
| ... |
s086021808 | p04030 | Java | import java.util.*;
public class Main{
public static void main(String[] args){
Scanner x= new Scanner(System.in);
String y = x.next();
char[] z = new char[y.length()];
int c=0;
for(int i=0;i<y.length();i++){
if(y.charAt(i)=='B'){
if(c!=0){
c--;
z[c] =0;
}
}else{
z[c] = y.charAt(i);
c++;
}
}
... | Main.java:23: error: illegal start of expression
for(int i=0;i<,z.length;i++)
^
Main.java:23: error: not a statement
for(int i=0;i<,z.length;i++)
^
Main.java:23: error: ')' expected
for(int i=0;i<,z.length;i++)
^
Main.java:23: error: ';' expected
for(int i=0;i<,z.len... |
s414145169 | p04030 | C++ | #include <iostream>
using namespace std;
int main() {
string a;
cin >> a;
for(int i = 0; i <= a.size(); i++) {
if(a.[i] == "b"){.erase(i - 1, 2); i-= 2};
}
cout << a << endl;
} | a.cc: In function 'int main()':
a.cc:8:10: error: expected unqualified-id before '[' token
8 | if(a.[i] == "b"){.erase(i - 1, 2); i-= 2};
| ^
a.cc:8:22: error: expected primary-expression before '.' token
8 | if(a.[i] == "b"){.erase(i - 1, 2); i-= 2};
| ^
a.cc:8... |
s832067391 | p04030 | C++ | #include <iostream>
#include<string>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
string s,ans;
cin >> s;
for (int i = 0; i < s.length(); ++i){
if (s[i] == '1'){ ans += '1'; }
if (s[i] == '0'){ ans+= '0'; }
if (s[i] == 'B'){ if(ans.length()>0) ans.pop_back(); }
}
cout << ans << endl;
return ... | a.cc:5:22: error: '_TCHAR' has not been declared
5 | int _tmain(int argc, _TCHAR* argv[])
| ^~~~~~
|
s300374185 | p04030 | C++ | #include <string>
using namespace std;
int main(){
string s; cin >> s;
string a = "";
int cnt = 0;
for(int i = s.size() - 1; i-cnt >= 0; i--){
if(s[i] == 'B'){
cnt++;
continue;
}
a += s[i-cnt];
}
cout << a << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:5:15: error: 'cin' was not declared in this scope
5 | string s; 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>
... |
s688362326 | p04030 | C++ | from re import sub
s = input()
print(sub(r'.B', '', s).replace('B', ''))
| a.cc:6:12: warning: multi-character character constant [-Wmultichar]
6 | print(sub(r'.B', '', s).replace('B', ''))
| ^~~~
a.cc:6:18: error: empty character constant
6 | print(sub(r'.B', '', s).replace('B', ''))
| ^~
a.cc:6:38: error: empty character constant
6 | print... |
s011226223 | p04031 | C++ | #include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <set>
#include <sstream>
#include <cctype>
#include <stack>
#include <queue>
#include <cstring>
#include <map>
#include <list>
#in... | a.cc: In function 'int main()':
a.cc:35:19: error: 'INT_MAX' was not declared in this scope
35 | int mincost = INT_MAX;
| ^~~~~~~
a.cc:19:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
18 | #include <cassert>
+++ |+#includ... |
s084713631 | p04031 | C++ | #include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#define INF 0x7fffffff
using namespace std;
int N;
int main() {
cin >> N;
vector<int> nums(N);
int sum = 0;
for (int i = 0; i < N; i++) {
cin >> nums[i];
sum += nums[i];
}
int x = floor(sum / n);
int y... | a.cc: In function 'int main()':
a.cc:19:25: error: 'n' was not declared in this scope
19 | int x = floor(sum / n);
| ^
|
s175757478 | p04031 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int n; cin>>n;
int arr[n];
for(int i=0;i<n;i++) cin>>arr[i];
int ans = 1e9;
for(int k=-100;k<=100;k++){
int cost = 0;
for(int i=0;i<n;i++) cost += (k-arr[i])*(k-arr[i]);
ans = min(ans,cost);
}
cout<<cost;
return 0;
} | a.cc: In function 'int main()':
a.cc:17:9: error: 'cost' was not declared in this scope; did you mean 'cosl'?
17 | cout<<cost;
| ^~~~
| cosl
|
s925989545 | p04031 | C++ | #include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define vec vector<int>
#define fo(i,n) for (int i = 0; i < n; i++)
#define so(v) sort(v.begin(), v.end())
#define fi first
#define se second
using namespace std;
int main()
{
int n;
cin>>n;
vector<int> a(n) ;
int sum = 0 ;
fo(i... | a.cc: In function 'int main()':
a.cc:27:9: error: conflicting declaration 'int a'
27 | int a = 0 ;
| ^
a.cc:19:17: note: previous declaration as 'std::vector<int> a'
19 | vector<int> a(n) ;
| ^
a.cc:30:10: error: no match for 'operator+=' (operand types are 'std::vector... |
s654835859 | p04031 | Java | import java.util.*;
/**
* C Main
*
* @date 2020.08.22
* @author 焼き鮭 <yaki-shake@up-tri.me>
*/
public class Main {
Scanner sc;
public static void main(String[] args) {
new Main().execute();
}
public void execute() {
this.sc = new Scanner(System.in);
int n = this.sc.nextInt();
int[] a = n... | Main.java:38: error: incompatible types: unexpected return value
return 0;
^
1 error
|
s416678781 | p04031 | C | #include<stdio.h>
void swap(int* a,int* b){
int temp;
temp = *a;
*a = *b;
*b = temp;
}
void sorted_array(int* array,int n){
int i,j;
int min_i;
for(i=0;i<n-1;i++){
min_i = i;
for(j=i+1;j<n;j++){
if(arr[j]<min_i){
min_i=j;
}
}
swap(&arr[i],&arr[min_i]);
}
}
int min(int... | main.c: In function 'sorted_array':
main.c:14:10: error: 'arr' undeclared (first use in this function); did you mean 'array'?
14 | if(arr[j]<min_i){
| ^~~
| array
main.c:14:10: note: each undeclared identifier is reported only once for each function it appears in
main.c: In functi... |
s881524353 | p04031 | C | #include<stdio.h>
int main(){
int N;
scanf("%d",&N);
int a[N];
for(int i=0;i<N;i++){
scanf("%d",&a[i]);
}
int sum=0;
for(int i=-100;i<=100;i++){
for(int j=0;j<N;j++){
sum+=(a[j]-i)*(a[j]-i);
}
if(i==-100){
min=sum;
}else{
temp=sum;
... | main.c: In function 'main':
main.c:18:9: error: 'min' undeclared (first use in this function); did you mean 'main'?
18 | min=sum;
| ^~~
| main
main.c:18:9: note: each undeclared identifier is reported only once for each function it appears in
main.c:20:9: error: 'temp' undeclared ... |
s849889713 | p04031 | C | #include<stdio.h>
int main(){
int N;
scanf("%d",&N);
int a[N];
for(int i=0;i<N;i++){
scanf("%d",&a[i]);
}
int sum=0;
int min=0;
int temp=0;
for(int i=-100;i<=100;i++){
for(int j=0;j<N;j++){
sum+=(a[j]-i)*(a[j]-i);
}
if(j==-100){
min=sum;
... | main.c: In function 'main':
main.c:19:10: error: 'j' undeclared (first use in this function)
19 | if(j==-100){
| ^
main.c:19:10: note: each undeclared identifier is reported only once for each function it appears in
|
s568125633 | p04031 | C | #include<stdio.h>
int main(){
int N;
scanf("%d",&N);
int a[N];
for(int i=0;i<N;i++){
scanf("%d",&a[i]);
}
int min=0;
int temp=0;
for(int i=-100;i<=100;i++){
for(int j=0;j<N;j++){
if(i==-100){
min+=(a[j]-i)*(a[j]-i);];
}else{
temp+=... | main.c: In function 'main':
main.c:17:36: error: expected statement before ']' token
17 | min+=(a[j]-i)*(a[j]-i);];
| ^
|
s725531033 | p04031 | C | #include <stdio.h>
int main (void){
long long N,A[101],B[101]i,j,k;
long long sum = 0;
long long min=10000*10000;
scanf("%lld",&N);
for(i=0;i<N;i++){
scanf("&lld",A[i]);
}
for(i=0;i<101;i++){
for(j=0;j<N;j++){
B[j] = (A[j]-i)*(A[j]-i);
sum +=B[j];
}
... | main.c: In function 'main':
main.c:5:34: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'i'
5 | long long N,A[101],B[101]i,j,k;
| ^
main.c:9:13: error: 'i' undeclared (first use in this function)
9 | for(i=0;i<N;i++){
| ^
m... |
s172884106 | p04031 | Java | import java.io.BufferedReader;
import java.io.IOException;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.File;
import java.util.*;
public class C {
public static StringBuilder output = new S... | Main.java:11: error: class C is public, should be declared in a file named C.java
public class C {
^
1 error
|
s284205446 | p04031 | C++ | int arr[105]/** "Ever tried.
Ever failed.
No matter.
Try Again.
Fail again.
Fail better.**/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define ll long long
#define bp __builtin_popcount
#define pb pus... | In file included from /usr/include/c++/14/cassert:43,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:33,
from a.cc:7:
/usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:308:1: error: expected initializer before 'namespace'
308 | namespace std
| ^~~~~~~~~
In file inc... |
s569610859 | p04031 | C++ | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
int n;
cin >> n;
vector<int> arr(n);
for (int i = 0; i < n; i++) cin >> arr[i];
int ans = 0;
ll curr_min = INT_MAX;
for (int i = -100; i <= 100; i++) {
int curr = 0;
for (int j = 0; j < n; j+... | a.cc: In function 'int main()':
a.cc:22:23: error: no matching function for call to 'min(long long int&, int&)'
22 | curr_min = min(curr_min, curr);
| ~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/1... |
s745213970 | p04031 | C++ | #include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <map>
#include <unordered_map>
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(a) (a).begin(), (a).end()
typedef long long ll;
using... | a.cc:40:1: error: expected declaration before '}' token
40 | }
| ^
|
s051673554 | p04031 | C++ | #include <bits/stdc++.h>
using namespace std;
int c(int d,vector<int> v){
int e = 0;
int n = v.size();
for (int y=0;y<n;y++){
e =(v[y]-d)*(v[y]-d) + e;
}
return e;
}
int main() {
int a=0;
int n; cin>>n;
vector<int> v(n);
for (int i=0;i<n;i++){
cin>>v[i];
}
for... | a.cc: In function 'int main()':
a.cc:22:34: error: expected '}' at end of input
22 | cout << min(c(b,v),c(b+1,v));
| ^
a.cc:11:12: note: to match this '{'
11 | int main() {
| ^
|
s559546061 | p04031 | C++ | #include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
vector<int> a(n);
for(int i=0;i<n;i++){
cin>>a[i];
}
int min_cost=100000000;
for(int i=-100;i<=100;i++){
int cost=0;
for(int j=0;j<n;j++){
int b=a[j]-i;
cost+=pow(b,2);
}
min_cost=min(min_cost,cost);
}
c... | a.cc: In function 'int main()':
a.cc:6:3: error: 'vector' was not declared in this scope
6 | vector<int> a(n);
| ^~~~~~
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 n... |
s642541390 | p04031 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int N;
cin >> N;
vector<int> A(N);
for(int i=0;i<N;i++){
cin >> A.at(i);
}
int min_cost=100000000;
for(int i=-100;i<101;i++){
int cost=0;
for(int j=0;j<N;j++){
int B=A.at(j)-i;
cost+=pow(B,2);
}
min_cost=min(min_cos... | a.cc: In function 'int main()':
a.cc:20:28: error: expected '}' at end of input
20 | cout << min_cost << endl;
| ^
a.cc:4:11: note: to match this '{'
4 | int main(){
| ^
|
s231065905 | p04031 | C++ | #include <bits/stdc++.h>
#include <math.h>
#define rep(i,n) for (int i=0;i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
int main() {
int n;
cin >> n;
vector<int> a(n);
ll tmp = 0;
ll ans = 1e9;
rep(i,n){
cin >> a[i];
}
sort(ALL(a))... | a.cc: In function 'int main()':
a.cc:21:13: error: 'temp' was not declared in this scope; did you mean 'tmp'?
21 | temp += (a[j]-i)*(a[j]-i);
| ^~~~
| tmp
|
s854845613 | p04031 | C++ | #include <bits/stdc++.h>
#include <math.h>
#define rep(i,n) for (int i=0;i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
int main() {
int n;
cin >> n;
vector<int> a(n);
ll tmp = 0;
ll ans = 1e9;
rep(i,n){
cin >> a[i];
}
sort(ALL(a))... | a.cc: In function 'int main()':
a.cc:21:13: error: 'temp' was not declared in this scope; did you mean 'tmp'?
21 | temp += (a[i]-i)*(a[i]-i);
| ^~~~
| tmp
|
s646163183 | p04031 | C++ | //C - Be Together
int N;
int a[101];
int main()
{
int min = -101,max = 101,mincost;
scanf("%d",&N);
for (int i=1;i<=N;i++)
{
scanf("%d",&a[i]);
if (a[i]<min)
min = a[i];
if (a[i]>max)
max = a[i];
}
mincost = computeCost(min);
for (int j=min;j<=max;j++)
{
int cost = computeCost(j);
if (cost<... | a.cc: In function 'int main()':
a.cc:8:9: error: 'scanf' was not declared in this scope
8 | scanf("%d",&N);
| ^~~~~
a.cc:20:19: error: 'computeCost' was not declared in this scope
20 | mincost = computeCost(min);
| ^~~~~~~~~~~
a.cc:29:9: error: 'printf' was n... |
s832047103 | p04031 | C++ | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n,i,m=1000000000,c=0;
cin>>n;
vector<int> arr(n);
for(i=0;i<n;i++)cin>>arr[i];
for(i=-100;i<=100;i++)
{
for(int w:arr)
cost+=(w-i)*(w-i);
m=min(m, cost);
}
cout<<m;
return 0;
} | a.cc: In function 'int main()':
a.cc:12:25: error: 'cost' was not declared in this scope; did you mean 'cosl'?
12 | cost+=(w-i)*(w-i);
| ^~~~
| cosl
a.cc:13:26: error: 'cost' was not declared in this scope; did you mean 'cosl'?
13... |
s880098217 | p04031 | C++ | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n,i,m=1000000000,c=0;
cin>>n;
vector<int> arr(n);
for (i=0;i<n; ++)cin>>arr[i];
for(i=-100;i<=100;i++)
{
for(int w:arr)
cost+=(w-i)*(w-i);
m=min(m, cost);
}
cout<<m;
return 0;
} | a.cc: In function 'int main()':
a.cc:8:25: error: expected primary-expression before ')' token
8 | for (i=0;i<n; ++)cin>>arr[i];
| ^
a.cc:12:25: error: 'cost' was not declared in this scope; did you mean 'cosl'?
12 | cost+=(w-i)*(w-i);
| ... |
s625137135 | p04031 | C++ | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <random>
#include <cstdio>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int) n; i++)
int main() {
int n;
cin >> n;
vector<int> a(n);
... | a.cc: In function 'int main()':
a.cc:21:15: error: 'INT_MAX' was not declared in this scope
21 | int ans = INT_MAX;
| ^~~~~~~
a.cc:10:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
9 | #include <map>
+++ |+#include <climits>
... |
s107402864 | p04031 | C++ | #include <iostream>
using namespace std;
const int N = 1e6 + 5;
const int inf = 1e9 + 7;
int a[N];
int main() {
int n, cost = inf, mn = inf, mx = -inf;
cin >> n;
for (int i = 0; i < n; i ++) {
cin >> a[i];
mn = min(mn, a[i]);
mx = max(mx, a[i]);
}
for (int i = mn; i <= mx; i ++) {
int sum = 0;
for (i... | a.cc: In function 'int main()':
a.cc:25:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
25 | ans = i;
| ^~~
| abs
|
s241275809 | p04031 | C++ | #include <iostream>
#include <cmath>
#include <numeric>
#include <vector>
using namespace std;
// int main(){
// int N, temp;
// cin >> N;
// vector<int> A;
// for(int i = 0; i < N; i++){
// cin >> temp;
// A.push_back(temp);
// }
// // 配列だとaccumulateを使用できないため、vectorを使用した。
// ... | a.cc: In function 'int main()':
a.cc:39:19: error: 'minConst' was not declared in this scope; did you mean 'minCost'?
39 | if(temp < minConst) minCost = temp;
| ^~~~~~~~
| minCost
|
s899986190 | p04031 | C++ | #include <bits/stdc++.h>
using namespace std;
int a[105],n;
int is_ok(int x)
{
int s=0;
for(int i=1; i<=n; i++)
s+=(a[i]-x)*(a[i]-x);
return s;
}
int main()
{
int i,r=0,l=105,iv=1e9,ans=0;
cin>>n;
for(i=1; i<=n; i++)
{
cin>>a[i];
r=max(r,a[i]);
l=min(l,a[i]);
}
sort(a+1,a+n+1);
for(i=l; i<=r; i++)
... | a.cc: In function 'int main()':
a.cc:25:25: error: 'v' was not declared in this scope; did you mean 'iv'?
25 | v=is_ok(i);
| ^
| iv
|
s811334711 | p04031 | C++ | #include <bits/stdc++.h>
using namespace std;
int a[105],n;
int is_ok(int x)
{
int s=0;
for(int i=1; i<=n; i++)
s+=(a[i]-x)*(a[i]-x);
return s;
}
int main()
{
int i,r=0,l=105,iv=1e9,ans=0;
cin>>n;
for(i=1; i<=n; i++)
{
cin>>a[i];
r=max(r,a[i]);
l=min(l,a[i]);
}
sort(a+1,a+n+1);
for(i=l; i<=r; i++)
... | a.cc: In function 'int main()':
a.cc:25:25: error: 'v' was not declared in this scope; did you mean 'iv'?
25 | v=is_ok(i);
| ^
| iv
|
s559483318 | p04031 | C | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n,i;
cin>>n;
int a[n+1];
int maxv;
for(i=1;i<=n;i++)
cin>>a[i];
for(i=1;i<=n;i++)
if(a[i]<0)
a[i]=0;
maxv=a[1];
for(i=1;i<=n;i++)
{
if(a[i]>maxv)
{
maxv=a[i];
}
}
cout<<maxv;
} | main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
1 | #include<bits/stdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s597525117 | p04031 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int MOD = 1000000007;
int main() {
int n;
cin>>n;
vector<int> a(n);
rep(i,n)cin>>a[i];
int ans=MOD;
for(int i=-100;i<=100;i++){
int sum=0;
rep(j,n){
... | a.cc: In function 'int main()':
a.cc:19:25: error: expected ';' before '}' token
19 | ans=min(ans,sum)
| ^
| ;
20 | }
| ~
|
s168361736 | p04031 | C++ | #include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
int n,i,j,min=1000000000,cost;
cin>>n;
int list[n];
for(i=0;i<n;i++)
cin>>list[i];
sort(list,list+n);
for(i=list[0];i<=list[n-1];i++)
{
cost=0
for(j=0;j<n;j++)
{
cost+=pow(i-list[j],2);... | a.cc: In function 'int main()':
a.cc:15:13: error: expected ';' before 'for'
15 | cost=0
| ^
| ;
16 | for(j=0;j<n;j++)
| ~~~
a.cc:16:21: error: expected ';' before ')' token
16 | for(j=0;j<n;j++)
| ^
| ... |
s879622870 | p04031 | C++ | n = int(input())
a = list(map(int, input().split()))
ans = 10000000
for i in range(-100, 101):
sm = 0
for x in a:
sm += (x-i) ** 2
ans = min(ans, sm)
print(ans) | a.cc:1:1: error: 'n' does not name a type
1 | n = int(input())
| ^
|
s034703341 | p04031 | C++ | #include <iostream>
#include <climits>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;
#pragma warning(disable: 4996)
int main()
{
int N;
int ret;
ret = scanf("%d", &N);
vector<int> v(N);
for (int i = 0; i < N; i++) {
ret = scanf("%d", &v[i... | a.cc: In function 'int main()':
a.cc:25:23: error: 'round' was not declared in this scope
25 | int average_int = round(average);
| ^~~~~
a.cc:29:27: error: 'pow' was not declared in this scope
29 | result += pow((v[i] - average_int), 2);
| ... |
s377590394 | p04031 | C++ | #include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <algorithm>
using namespace std;
//#define _DBG
int main()
{
uint32_t N;
int ret;
#ifdef _DBG
ret = scanf_s("%d", &N);
#else
ret = scanf("%d", &N);
#endif
vector<int> v(N);
for (size_t i = 0; i < N; i++) {
#ifdef _DBG
re... | a.cc: In function 'int main()':
a.cc:14:9: error: 'uint32_t' was not declared in this scope
14 | uint32_t N;
| ^~~~~~~~
a.cc:7:1: note: 'uint32_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
6 | #include <algorithm>
+++ |+#include <cstdint>
... |
s593846548 | p04031 | C++ | #include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
uint32_t N;
int ret;
ret = scanf_s("%d", &N);
vector<int> v(N);
uint32_t sum = 0;
for (size_t i = 0; i < N; i++) {
ret = scanf_s("%d", &v[i]);
}
// sort(v.begin(), v.end(), s... | a.cc: In function 'int main()':
a.cc:12:9: error: 'uint32_t' was not declared in this scope
12 | uint32_t N;
| ^~~~~~~~
a.cc:7:1: note: 'uint32_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
6 | #include <algorithm>
+++ |+#include <cstdint>
... |
s061007353 | p04031 | C++ | #include<bits/stdc++.h>
using namespace std;
int a[100100];
int main(){
int n;cin>>n;
f(i,1,n) cin>>a[i];
sort(a+1,a+1+n);
cout<<a[(n+1)>>1];} | a.cc: In function 'int main()':
a.cc:6:5: error: 'i' was not declared in this scope
6 | f(i,1,n) cin>>a[i];
| ^
a.cc:6:3: error: 'f' was not declared in this scope
6 | f(i,1,n) cin>>a[i];
| ^
|
s320392472 | p04031 | C++ | #include <bits/stdc++.h>
#define rep(i, N) for (ll i = 0; i < N; i++)
#define rep1(i, N) for (ll i = 1; i <= N; i++)
#define repr(i, N) for (ll i = N-1; i >= 0; i--)
#define repr1(i, N) for (ll i = N; i > 0; i--)
#define INF 1000000007
using ll = long long;
using namespace std;
typedef pair<int,int> P;
int main(){... | a.cc: In function 'int main()':
a.cc:21:21: error: no matching function for call to 'accumulate(int [200], int*)'
21 | ave = accumulate(a,a+N);
| ~~~~~~~~~~^~~~~~~
In file included from /usr/include/c++/14/numeric:62,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:58,
... |
s731570851 | p04031 | C++ | #include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
int n,a,mn,ans,as;
cin>>n;
vector<int>v;
while(n--)
{
cin>>a;
v.push_back(a);
}
sort(v.begin(),v.end());
for(int i=-1000;i<=1000;i++)
{
ans=0;
for(int j=0;j<v.size();j++)
{
ans=ans+((i-v[j])*(i-v[j]));
}
if(i==0)
... | a.cc: In function 'int main()':
a.cc:26:19: error: expected ';' before 'else'
26 | }2
| ^
| ;
27 |
28 | else
| ~~~~
|
s400417624 | p04031 | C | #include<bits/stdc++.h>
using namespace std;
int main ()
{
long long int sum= 0,count= 0;
int n,i;
cin >> n;
long long int ans = 1e18;
vector<int> arr(n);
for (i = 0 ; i<n ;i++)
{
cin >> arr[i];
sum += arr[i];
}
sum = sum /n;
for ( i = 0 ; i < n ;i++)
{
... | main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
1 | #include<bits/stdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s849061821 | p04031 | C++ | #include <bits/stdc++.h>
#define long long ll
using namespace std;
int main() {
init();
ll n,c=0,mi=INT_MAX;
cin>>n;
ll arr[n];
for(int i=0;i<n;i++)
cin>>arr[i];
for(int i=-100;i<=100;i++){
for(int o=0;o<n;o++){
c=pow(abs(i-arr[o]),2)+c;
}
mi=min(c,mi);
c=0;
}
cou... | a.cc: In function 'int main()':
a.cc:5:5: error: 'init' was not declared in this scope; did you mean 'int'?
5 | init();
| ^~~~
| int
a.cc:6:4: error: 'll' was not declared in this scope
6 | ll n,c=0,mi=INT_MAX;
| ^~
a.cc:7:9: error: 'n' was not declared in this scope; did you... |
s281067316 | p04031 | C++ | #include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <cctype>
#include <bitset>
#include <type_traits>
#include <list>
using namespace std;
#define REP(i, n) for (int... | a.cc: In function 'int main()':
a.cc:44:25: error: expected '}' at end of input
44 | cout << ans << endl;
| ^
a.cc:26:1: note: to match this '{'
26 | {
| ^
|
s283855877 | p04031 | C++ | //
#include <bits/stdc++.h>
using namespace std;
#define INF 1000000000
#define PI 3.14159265
#define EPS 1e-9
#define Pi acos(-1.0)
typedef pair<int, int> ii;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
#define forr(i,a,b) for(int i=(a); i<(b); i++)
#define clean(arr,val) memset(arr,val,size... | a.cc: In function 'int main()':
a.cc:52:9: error: redeclaration of 'int temp'
52 | int temp = 0;
| ^~~~
a.cc:44:9: note: 'int temp' previously declared here
44 | int temp = 0;
| ^~~~
|
s194609507 | p04031 | C++ | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
int main()
{
cin.tie(0);
... | a.cc: In function 'int main()':
a.cc:39:15: error: expected '}' at end of input
39 | cout<<ans;
| ^
a.cc:18:1: note: to match this '{'
18 | {
| ^
|
s060249459 | p04031 | C++ | #include <iosream>
int main()
{
int N;
std::cin >> N;
int a[N];
int i;
int sum_a = 0;
int sum_aa = 0;
for (i = 0; i < N; i++) {
std::cin >> a[i];
sum_a += a[i];
sum_aa += a[i] * a[i];
}
int min = 40000;
for (i = -100; i <= 100; i++) {
int tmp = sum_aa - 2 * i * sum_a ... | a.cc:1:10: fatal error: iosream: No such file or directory
1 | #include <iosream>
| ^~~~~~~~~
compilation terminated.
|
s276923814 | p04031 | C++ | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
int a[n];
int i;
int sum=0;
for(i=0;i<n;i++)
{
cin>>a[i];
sum+=a[i];
}
float m=1.0;
m*=sum;
m/=n;
float x=m-floor(m);
if(x>=0.5)
{
int p=m+1;
int ans1=0;
for(i=0;i<n;i++)
ans+=pow(abs(a[i]-p),2);
// cout<<ans<<endl;
p=m... | a.cc: In function 'int main()':
a.cc:24:9: error: 'ans' was not declared in this scope; did you mean 'ans1'?
24 | ans+=pow(abs(a[i]-p),2);
| ^~~
| ans1
a.cc:29:9: error: 'ans' was not declared in this scope; did you mean 'ans2'?
29 | ans+=pow(abs(a[i]-p),2);
| ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.