submission_id
stringlengths 10
10
| problem_id
stringlengths 6
6
| language
stringclasses 3
values | code
stringlengths 1
522k
| compiler_output
stringlengths 43
10.2k
|
|---|---|---|---|---|
s897214891
|
p03957
|
Java
|
import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
String s = sc.next();
// 出力
boolean cok = false;
boolean fok = false;
for(int i=0; i<s.length; i++){
if(s.charAt(i).equals("C")){
if(cok = false){
cok = true;
}
}
else if(cok = true && s.charAt(i).equals("F")){
fok = true;
}
}
if(fok){
System.out.println("Yes");
}
else{
System.out.println("No");
}
}
}
|
Main.java:9: error: cannot find symbol
for(int i=0; i<s.length; i++){
^
symbol: variable length
location: variable s of type String
Main.java:10: error: char cannot be dereferenced
if(s.charAt(i).equals("C")){
^
Main.java:15: error: char cannot be dereferenced
else if(cok = true && s.charAt(i).equals("F")){
^
3 errors
|
s958194784
|
p03957
|
Java
|
import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
String s = sc.next();
// 出力
boolean cok = false;
boolean fok = false;
for(int i=0; i<s.length, i++){
if(s.charAt(i).equals("C")){
if(cok = false){
cok = true;
}
}
else if(cok = true && s.charAt(i).equals("F")){
fok = true;
}
}
if(fok){
System.out.println("Yes");
}
else{
System.out.println("No");
}
}
}
|
Main.java:9: error: ';' expected
for(int i=0; i<s.length, i++){
^
1 error
|
s850925986
|
p03957
|
C++
|
#include <iostream>
#include <string>
using namespace std;
int main(){
string s;
cin >> s;
int cflag = 0, fflag = 0;
for(auto x: s){
if(*x=='C') cflag=1;
if(cflag==1 && *x=='F') fflag=1;
}
if(fflag) cout<<"Yes¥n";
else cout<<"No¥n";
return 0;
}
|
a.cc: In function 'int main()':
a.cc:9:4: error: invalid type argument of unary '*' (have 'char')
9 | if(*x=='C') cflag=1;
| ^~
a.cc:10:16: error: invalid type argument of unary '*' (have 'char')
10 | if(cflag==1 && *x=='F') fflag=1;
| ^~
|
s238423588
|
p03957
|
C++
|
#include <iostream>
#include <string>
using namespace std;
int main(){
string s;
cin >> s;
int cflag = 0, fflag = 0;
for(auto x: s){
if(*x=="C") cflag=1;
if(cflag==1 && *x=="F") fflag=1;
}
if(fflag) cout<<"Yes¥n";
else cout<<"No¥n";
return 0;
}
|
a.cc: In function 'int main()':
a.cc:9:4: error: invalid type argument of unary '*' (have 'char')
9 | if(*x=="C") cflag=1;
| ^~
a.cc:10:16: error: invalid type argument of unary '*' (have 'char')
10 | if(cflag==1 && *x=="F") fflag=1;
| ^~
|
s003539496
|
p03957
|
C++
|
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int index[26];
void init(){
for (int i = 0; i < 26; i++){
index[i] = -1;
}
}
int main(){
string s;
cin >> s;
init();
for (int i = 0; i < s.size(); i++){
if (s[i] == 'C' && index[s[i] - 'A'] == -1){
index[s[i] - 'A'] = i;
}
else if (s[i] == 'F'){
index[s[i] - 'A'] = i;
}
}
if (index[2] == -1 || index[5] == -1 || (index[2] > index[5])){
cout << "No" << endl;
}
else {
cout << "Yes" << endl;
}
return 0;
}
|
a.cc:6:13: error: 'int index [26]' redeclared as different kind of entity
6 | int index[26];
| ^
In file included from /usr/include/string.h:462,
from /usr/include/c++/14/cstring:43,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121,
from a.cc:2:
/usr/include/strings.h:50:20: note: previous declaration 'const char* index(const char*, int)'
50 | extern const char *index (const char *__s, int __c)
| ^~~~~
a.cc: In function 'void init()':
a.cc:10:14: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
10 | index[i] = -1;
| ^
a.cc: In function 'int main()':
a.cc:24:33: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
24 | if (s[i] == 'C' && index[s[i] - 'A'] == -1){
| ^
a.cc:25:18: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
25 | index[s[i] - 'A'] = i;
| ^
a.cc:28:18: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
28 | index[s[i] - 'A'] = i;
| ^
a.cc:32:14: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
32 | if (index[2] == -1 || index[5] == -1 || (index[2] > index[5])){
| ^
a.cc:32:32: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
32 | if (index[2] == -1 || index[5] == -1 || (index[2] > index[5])){
| ^
a.cc:32:51: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
32 | if (index[2] == -1 || index[5] == -1 || (index[2] > index[5])){
| ^
a.cc:32:62: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
32 | if (index[2] == -1 || index[5] == -1 || (index[2] > index[5])){
| ^
|
s257532285
|
p03957
|
C++
|
#include <iostream>
#include <string>
using namespace std;
int main(){
string s;
cin >> s;
int cflag = 0, fflag = 0;
for(auto x: s){
if(x=="C") cflag=1;
if(cflag==1 && x=="F") fflag=1;
}
if(fflag) cout<<"Yes¥n";
else cout<<"No¥n";
return 0;
}
|
a.cc: In function 'int main()':
a.cc:9:5: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
9 | if(x=="C") cflag=1;
| ~^~~~~
a.cc:10:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
10 | if(cflag==1 && x=="F") fflag=1;
| ~^~~~~
|
s603452609
|
p03957
|
Java
|
import java.util.*;
public class A{
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
String str = s.next();
String[] arr2 = str.split("");
int count = 0;
int indexC = 0;
int indexF = 0;
int flag = 0;
int flagC = 0;
int flagF = 0;
for(int i=0;i<arr2.length;i++){
if(arr2[i].equals("C")){
indexC = i;
flagC = 1;
}else if(arr2[i].equals("F")){
indexF = i;
flagF = 1;
}
}
if(indexF>indexC && flagC==1 && flagF==1){
flag = 1;
}
if(flag ==1){
System.out.println("Yes");
}else{
System.out.println("No");
}
}
}
|
Main.java:3: error: class A is public, should be declared in a file named A.java
public class A{
^
1 error
|
s132904252
|
p03957
|
C++
|
#include <iostream>
#include <string>
int main(){
string s;
cin >> s;
int cflag = 0, fflag = 0;
for(auto x: s){
if(x=="C") cflag=1;
if(cflag==1 && x=="F") fflag=1;
}
if(fflag) cout<<"Yes¥n";
else cout<<"No¥n";
return 0;
}
|
a.cc: In function 'int main()':
a.cc:5:1: error: 'string' was not declared in this scope
5 | string s;
| ^~~~~~
a.cc:5:1: note: suggested alternatives:
In file included from /usr/include/c++/14/iosfwd:41,
from /usr/include/c++/14/ios:40,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stringfwd.h:77:33: note: 'std::string'
77 | typedef basic_string<char> string;
| ^~~~~~
In file included 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:
/usr/include/c++/14/string:76:11: note: 'std::pmr::string'
76 | using string = basic_string<char>;
| ^~~~~~
a.cc:6:1: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
6 | cin >> s;
| ^~~
| std::cin
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:6:8: error: 's' was not declared in this scope
6 | cin >> s;
| ^
a.cc:12:11: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
12 | if(fflag) cout<<"Yes¥n";
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:13:6: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
13 | else cout<<"No¥n";
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
|
s260799812
|
p03957
|
C++
|
#include <iostream>
#include <string>
int main{
string s;
cin >> s;
int cflag = 0, fflag = 0;
for(auto x: s){
if(x=="C") cflag=1;
if(cflag==1 && x=="F") fflag=1;
}
if(fflag) cout<<"Yes¥n";
else cout<<"No¥n";
return 0;
}
|
a.cc:4:5: error: cannot declare '::main' to be a global variable
4 | int main{
| ^~~~
a.cc:5:1: error: 'string' was not declared in this scope
5 | string s;
| ^~~~~~
a.cc:5:1: note: suggested alternatives:
In file included from /usr/include/c++/14/iosfwd:41,
from /usr/include/c++/14/ios:40,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stringfwd.h:77:33: note: 'std::string'
77 | typedef basic_string<char> string;
| ^~~~~~
In file included 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:
/usr/include/c++/14/string:76:11: note: 'std::pmr::string'
76 | using string = basic_string<char>;
| ^~~~~~
a.cc:5:8: error: expected '}' before 's'
5 | string s;
| ^
a.cc:4:9: note: to match this '{'
4 | int main{
| ^
a.cc:6:1: error: 'cin' does not name a type
6 | cin >> s;
| ^~~
a.cc:8:1: error: expected unqualified-id before 'for'
8 | for(auto x: s){
| ^~~
a.cc:12:1: error: expected unqualified-id before 'if'
12 | if(fflag) cout<<"Yes¥n";
| ^~
a.cc:13:1: error: expected unqualified-id before 'else'
13 | else cout<<"No¥n";
| ^~~~
a.cc:14:1: error: expected unqualified-id before 'return'
14 | return 0;
| ^~~~~~
a.cc:15:1: error: expected declaration before '}' token
15 | }
| ^
|
s172257151
|
p03957
|
C++
|
#include<stdio.h>
#include<string.h>
#include <stack>
using namespace std;
int main(void)
{
char st[200000];
stack <char> po;
int i;
scanf("%s",st);
for(i = 0;i<strlen(st);i++){
if(st[i]=='C'){
po.push('C');
}
if(st[i]=='F' && !po.empty() && po.top == 'C'){
po.push('F');
}
}
if((int)po.size()>=2){
printf("Yes\n");
}
else{
printf("No\n");
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:18:56: error: invalid operands of types '<unresolved overloaded function type>' and 'char' to binary 'operator=='
18 | if(st[i]=='F' && !po.empty() && po.top == 'C'){
| ~~~~~~ ^~ ~~~
| | |
| | char
| <unresolved overloaded function type>
|
s806377936
|
p03957
|
C++
|
#include <iostream>
#include <string.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned ll
#define db double
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define PII pair<int, int>
string str;
int main() {
cin >> str;
int c = INT_MAX;
int f = -1;
for (int i = 0; i < str.size(); i++) {
if (str[i] == 'C') {
c = min(c, i);
} else if (str[i] == 'F') {
f = max(f, i);
}
}
if (c < f) {
printf("Yes\n");
} else {
printf("No\n");
}
}
|
a.cc: In function 'int main()':
a.cc:20:13: error: 'INT_MAX' was not declared in this scope
20 | int c = INT_MAX;
| ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
3 | #include <string.h>
+++ |+#include <climits>
4 |
|
s386771183
|
p03957
|
C++
|
#include <iostream>
int main{
string s;
cin >> s;
int cflag = 0, fflag = 0;
for(auto x: s){
if(x=="C") cflag=1;
if(cflag==1 && x=="F") fflag=1;
}
if(fflag) cout<<"Yes¥n";
else cout<<"No¥n";
return 0;
}
|
a.cc:3:5: error: cannot declare '::main' to be a global variable
3 | int main{
| ^~~~
a.cc:4:1: error: 'string' was not declared in this scope
4 | string s;
| ^~~~~~
a.cc:4:1: note: suggested alternatives:
In file included from /usr/include/c++/14/iosfwd:41,
from /usr/include/c++/14/ios:40,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stringfwd.h:77:33: note: 'std::string'
77 | typedef basic_string<char> string;
| ^~~~~~
In file included 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:
/usr/include/c++/14/string:76:11: note: 'std::pmr::string'
76 | using string = basic_string<char>;
| ^~~~~~
a.cc:4:8: error: expected '}' before 's'
4 | string s;
| ^
a.cc:3:9: note: to match this '{'
3 | int main{
| ^
a.cc:5:1: error: 'cin' does not name a type
5 | cin >> s;
| ^~~
a.cc:7:1: error: expected unqualified-id before 'for'
7 | for(auto x: s){
| ^~~
a.cc:11:1: error: expected unqualified-id before 'if'
11 | if(fflag) cout<<"Yes¥n";
| ^~
a.cc:12:1: error: expected unqualified-id before 'else'
12 | else cout<<"No¥n";
| ^~~~
a.cc:13:1: error: expected unqualified-id before 'return'
13 | return 0;
| ^~~~~~
a.cc:14:1: error: expected declaration before '}' token
14 | }
| ^
|
s253748725
|
p03957
|
C++
|
using System;
using System.Linq;
using System.Diagnostics;
namespace ConsoleApplication
{
public class Program
{
public static void Main(string[] args)
{
var s = Console.ReadLine();
var c = s.IndexOf('C');
var f = s.IndexOf('F');
var result = c > 0 && f > 0 && c < f ? "Yes" : "No";
Console.WriteLine(result);
}
}
public static class Ex
{
public static int ToInt(this string str) => int.Parse(str);
}
}
|
a.cc:1:7: error: expected nested-name-specifier before 'System'
1 | using System;
| ^~~~~~
a.cc:2:7: error: expected nested-name-specifier before 'System'
2 | using System.Linq;
| ^~~~~~
a.cc:3:7: error: expected nested-name-specifier before 'System'
3 | using System.Diagnostics;
| ^~~~~~
a.cc:7:5: error: expected unqualified-id before 'public'
7 | public class Program
| ^~~~~~
a.cc:19:5: error: expected unqualified-id before 'public'
19 | public static class Ex
| ^~~~~~
|
s834034239
|
p03957
|
C++
|
class Main {
public:
bool hasCf(string str) {
int ci = 0;
for (int i = 0;i < str.size();i++) {
if (str[i] == 'C') {
ci = i;
break;
}
}
int fi = -1;
for (int i = str.size()-1;i>=0;i--) {
if (str[i] == 'F') {
fi = i;
break;
}
}
return ci < fi;
}
};
int main()
{
Main m;
string str;
cin >> str;
cout << (m.hasCf(str) ? "Yes" : "No") << endl;
return 0;
}
|
a.cc:5:20: error: 'string' has not been declared
5 | bool hasCf(string str) {
| ^~~~~~
a.cc: In member function 'bool Main::hasCf(int)':
a.cc:7:40: error: request for member 'size' in 'str', which is of non-class type 'int'
7 | for (int i = 0;i < str.size();i++) {
| ^~~~
a.cc:8:32: error: invalid types 'int[int]' for array subscript
8 | if (str[i] == 'C') {
| ^
a.cc:15:34: error: request for member 'size' in 'str', which is of non-class type 'int'
15 | for (int i = str.size()-1;i>=0;i--) {
| ^~~~
a.cc:16:32: error: invalid types 'int[int]' for array subscript
16 | if (str[i] == 'F') {
| ^
a.cc: In function 'int main()':
a.cc:30:9: error: 'string' was not declared in this scope
30 | string str;
| ^~~~~~
a.cc:32:9: error: 'cin' was not declared in this scope
32 | cin >> str;
| ^~~
a.cc:32:16: error: 'str' was not declared in this scope; did you mean 'std'?
32 | cin >> str;
| ^~~
| std
a.cc:34:9: error: 'cout' was not declared in this scope
34 | cout << (m.hasCf(str) ? "Yes" : "No") << endl;
| ^~~~
a.cc:34:50: error: 'endl' was not declared in this scope
34 | cout << (m.hasCf(str) ? "Yes" : "No") << endl;
| ^~~~
|
s303309005
|
p03957
|
C++
|
#include <iostream>
#include <string>
using namespace std;
int main(){
string s;
cin >> s;
bool findC = false;
bool findF = false;
for(int i = 0; i < s.size(); i++){
if(s[i] == 'C')
findC = true;
else if(s[i] == 'F' && findC )
findF = true;
}
cout << findC && findF << endl;
}
|
a.cc: In function 'int main()':
a.cc:16:29: error: invalid operands of types 'bool' and '<unresolved overloaded function type>' to binary 'operator<<'
16 | cout << findC && findF << endl;
| ~~~~~~^~~~~~~
|
s928287484
|
p03957
|
C++
|
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <iomanip>
#include <deque>
#include <stdio.h>
using namespace std;
string s;
int a=1000000;
int b=0;
cin >> s;
for(int i=0;i<s.size();i++){
if(s[i] == 'C'){
a = i;
break;}
}
for(int j=(int)s.size()-1;j>1;j--){
if(s[j] == 'F'){
b = j;
break;
}
}
if(a!=0 && b !=0 && a > b)
cout << "Yes"<<endl;
else cout << "No"<<endl;
|
a.cc:21:1: error: 'cin' does not name a type
21 | cin >> s;
| ^~~
a.cc:22:5: error: expected unqualified-id before 'for'
22 | for(int i=0;i<s.size();i++){
| ^~~
a.cc:22:17: error: 'i' does not name a type
22 | for(int i=0;i<s.size();i++){
| ^
a.cc:22:28: error: 'i' does not name a type
22 | for(int i=0;i<s.size();i++){
| ^
a.cc:27:5: error: expected unqualified-id before 'for'
27 | for(int j=(int)s.size()-1;j>1;j--){
| ^~~
a.cc:27:31: error: 'j' does not name a type
27 | for(int j=(int)s.size()-1;j>1;j--){
| ^
a.cc:27:35: error: 'j' does not name a type
27 | for(int j=(int)s.size()-1;j>1;j--){
| ^
a.cc:33:5: error: expected unqualified-id before 'if'
33 | if(a!=0 && b !=0 && a > b)
| ^~
a.cc:35:5: error: expected unqualified-id before 'else'
35 | else cout << "No"<<endl;
| ^~~~
|
s312560149
|
p03957
|
C++
|
#include <iostream>
#include <string.h>
#include <process.h>
using namespace std;
char str[101];
int main(){
cin >> str;
int len = strlen(str);
bool jud1 = false, jud2 = false;
for(int i=0; i<len; i++){
if(str[i] == 'C') jud1 = true;
if(str[i] == 'F' && jud1 == true) jud2 = true;
}
if(jud2 == true) cout << "Yes" << endl;
else cout << "No" << endl;
return 0;
}
|
a.cc:3:10: fatal error: process.h: No such file or directory
3 | #include <process.h>
| ^~~~~~~~~~~
compilation terminated.
|
s942328972
|
p03957
|
C++
|
#include <iostream>
using namespace std;
int main(){
string str;
int length;
int i,j;
cin >> str;
length = str.size();
for(i=0; i<length; i++){
if(str[i] == 'C'){
for(j=i; j<length; j++){
if(str[j] == 'F'){
cout << Yes << endl;
return 0;
}else{
cout << No << endl;
return 0;
}
}
}else{
cout << No << endl;
return 0;
}
}
}
|
a.cc: In function 'int main()':
a.cc:17:49: error: 'Yes' was not declared in this scope
17 | cout << Yes << endl;
| ^~~
a.cc:20:49: error: 'No' was not declared in this scope
20 | cout << No << endl;
| ^~
a.cc:25:33: error: 'No' was not declared in this scope
25 | cout << No << endl;
| ^~
|
s306598464
|
p03957
|
C
|
#include<stdio.h>
void main(void){
int flag1=0,flag2=0;
int i,memo;
char s[100];
scanf("%s",s);
for(i=0;i<100;i++){
if(s[i]=='C'){
memo=i;
flag1=1;
}
while(memo<100){
if(s[memo]=='F'){
flag2=1;
}
memo++;
}
if(flag1==1&&flag2==1){
printf("Yes");
}
else
printf("No");
}
|
main.c: In function 'main':
main.c:23:1: error: expected declaration or statement at end of input
23 | }
| ^
|
s717638404
|
p03957
|
C++
|
//C++14 (Clang 3.8.0)
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string>
#include <cstdlib>
#define rp(i,a,b) for(int (i)=(int)(a);i<(int)(b);++i)
typedef long long ll;
using namespace std;
int main(){
string s;
cin>>s;
bool f1==false,f2=false;
rp(i,0,s.size()){
if(f1==false and f2==false and s[i]=='C')
f1=true;
if(f1==true and f2==false and s[i]=='F')
f2=true;
}
if(f2) cout<<"Yes"<<endl;
else cout<<"No"<<endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:33:12: error: expected initializer before '==' token
33 | bool f1==false,f2=false;
| ^~
a.cc:35:12: error: 'f1' was not declared in this scope; did you mean 'y1'?
35 | if(f1==false and f2==false and s[i]=='C')
| ^~
| y1
a.cc:35:26: error: 'f2' was not declared in this scope
35 | if(f1==false and f2==false and s[i]=='C')
| ^~
a.cc:37:12: error: 'f1' was not declared in this scope; did you mean 'y1'?
37 | if(f1==true and f2==false and s[i]=='F')
| ^~
| y1
a.cc:37:25: error: 'f2' was not declared in this scope
37 | if(f1==true and f2==false and s[i]=='F')
| ^~
a.cc:40:8: error: 'f2' was not declared in this scope
40 | if(f2) cout<<"Yes"<<endl;
| ^~
|
s136514244
|
p03957
|
C++
|
string s;
int a=1000000;
int b=0;
cin >> s;
for(int i=0;i<s.size();i++){
if(s[i] == 'C'){
a = i;
break;}
}
for(int j=s.size()-1;j=1;j--){
if(s[j] == 'F'){
b = j;
break;
}
}
if(a!=0 && b !=0 && a > b)
cout << "Yes"<<endl;
else cout << "No"<<endl;
|
a.cc:1:1: error: 'string' does not name a type
1 | string s;
| ^~~~~~
a.cc:4:1: error: 'cin' does not name a type
4 | cin >> s;
| ^~~
a.cc:5:5: error: expected unqualified-id before 'for'
5 | for(int i=0;i<s.size();i++){
| ^~~
a.cc:5:17: error: 'i' does not name a type
5 | for(int i=0;i<s.size();i++){
| ^
a.cc:5:28: error: 'i' does not name a type
5 | for(int i=0;i<s.size();i++){
| ^
a.cc:10:5: error: expected unqualified-id before 'for'
10 | for(int j=s.size()-1;j=1;j--){
| ^~~
a.cc:10:26: error: 'j' does not name a type
10 | for(int j=s.size()-1;j=1;j--){
| ^
a.cc:10:30: error: 'j' does not name a type
10 | for(int j=s.size()-1;j=1;j--){
| ^
a.cc:16:5: error: expected unqualified-id before 'if'
16 | if(a!=0 && b !=0 && a > b)
| ^~
a.cc:18:5: error: expected unqualified-id before 'else'
18 | else cout << "No"<<endl;
| ^~~~
|
s312099597
|
p03957
|
C++
|
#include<cstdio>
#include<string>
#include<algorithm>
using namespace std;
char input[101]={};
int main(){
scanf("%s",input);
int len = strlen(input);
for (int i=0; i<len; i++) {
if(input[i] == 'C' && input[i+1] == 'O' && input[i+2] == 'D' && input[i+3] == 'E' && input[i+4] == 'F'&& input[i+5] == 'E' && input[i+6] == 'S' && input[i+7] == 'T' && input[i+8] == 'I'&& input[i+9] == 'V' && input[i+10] == 'A' && input[i+11] == 'L'){
printf("Yes\n");
return 0;
}
if(input[i] == 'C' && input[i] == 'F'){
printf("Yes\n");
return 0;
}
}
printf("No\n");
}
|
a.cc: In function 'int main()':
a.cc:11:15: error: 'strlen' was not declared in this scope
11 | int len = strlen(input);
| ^~~~~~
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 |
|
s690467497
|
p03957
|
C
|
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
int main(void){
char S[100];
int i;
for(i=0;i<100;i++){
scanf("%s",&S[i]);
if(S[i]=='C'){
flag = 1;
}
else if(S[i]=='F' && flag==1){
flag = 2;
}
}
if(flag == 2){
printf("Yes");
}
else{
printf("No");
}
return 0;
}
|
main.c: In function 'main':
main.c:13:25: error: 'flag' undeclared (first use in this function)
13 | flag = 1;
| ^~~~
main.c:13:25: note: each undeclared identifier is reported only once for each function it appears in
|
s982062570
|
p03957
|
C++
|
// Example program
#include <iostream>
#include <string>
using namespace std;
int main()
{
string s;
cin >> s;
int x=0;
for (int i=0; i<strlen(s.c_str()); i++) {
if (s.c_str()[i] == 'C' && x == 0) x++;
if (s.c_str()[i] == 'F' && x == 1) x++;
}
if (x==2) cout << "Yes" << endl;
else cout << "No" << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:11:21: error: 'strlen' was not declared in this scope
11 | for (int i=0; i<strlen(s.c_str()); i++) {
| ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <iostream>
+++ |+#include <cstring>
3 | #include <string>
|
s400691788
|
p03957
|
C++
|
S = gets.to_s.split('')
able = 0
for i in 0..S.count
if S[i] == "C" then
for j in i..S.count
if S[j] == "F" then
able = 1
end
end
end
end
if able == 1 then
puts "Yes"
else
puts "No"
end
|
a.cc:1:21: error: empty character constant
1 | S = gets.to_s.split('')
| ^~
a.cc:3:10: error: too many decimal points in number
3 | for i in 0..S.count
| ^~~~~~~~~~
a.cc:1:1: error: 'S' does not name a type
1 | S = gets.to_s.split('')
| ^
|
s149626729
|
p03957
|
C
|
#include<stdio.h>
int main(){
char s[100];
scanf("%s", s);
while(*s != 'C'){
if(*s == EOF) goto NO;
s++;
}
while(*s != 'F'){
if(*s == EOF) goto NO;
s++;
}
printf("Yes\n");
return 0;
NO:
printf("No\n");
return 0;
}
|
main.c: In function 'main':
main.c:7:2: error: lvalue required as increment operand
7 | s++;
| ^~
main.c:11:2: error: lvalue required as increment operand
11 | s++;
| ^~
|
s048491962
|
p03957
|
C++
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace code_festival_2016_c {
class Program {
static void Main(string[] args) {
bool c = false;
bool f = false;
string str = Console.ReadLine();
for(int i = 0; i < str.Length; i++) {
if (str[i] == 'C') {
c = true;
}else if (str[i] == 'F' && c == true) {
f = true;
}
}
Console.WriteLine((f)?"Yes":"No");
}
}
}
|
a.cc:1:7: error: expected nested-name-specifier before 'System'
1 | using System;
| ^~~~~~
a.cc:2:7: error: expected nested-name-specifier before 'System'
2 | using System.Collections.Generic;
| ^~~~~~
a.cc:3:7: error: expected nested-name-specifier before 'System'
3 | using System.Linq;
| ^~~~~~
a.cc:4:7: error: expected nested-name-specifier before 'System'
4 | using System.Text;
| ^~~~~~
a.cc:5:7: error: expected nested-name-specifier before 'System'
5 | using System.Threading.Tasks;
| ^~~~~~
a.cc:9:26: error: 'string' has not been declared
9 | static void Main(string[] args) {
| ^~~~~~
a.cc:9:35: error: expected ',' or '...' before 'args'
9 | static void Main(string[] args) {
| ^~~~
a.cc:23:6: error: expected ';' after class definition
23 | }
| ^
| ;
a.cc: In static member function 'static void code_festival_2016_c::Program::Main(int*)':
a.cc:12:13: error: 'string' was not declared in this scope
12 | string str = Console.ReadLine();
| ^~~~~~
a.cc:13:32: error: 'str' was not declared in this scope; did you mean 'std'?
13 | for(int i = 0; i < str.Length; i++) {
| ^~~
| std
a.cc:20:13: error: 'Console' was not declared in this scope
20 | Console.WriteLine((f)?"Yes":"No");
| ^~~~~~~
|
s279110081
|
p03957
|
Java
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.math.*;
public class Main {
public static void main(String[] args)throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
String a = br.readLine();
int l = a.length();
boolean cf = false;
for(int i = 0; i < l; i++){
char c = a.charAt(i);
if(c=='C')
cf = true;
if(cf && c=='F'){
sb.append("Yes");
System.out.println(sb);
return 0;
}
}
sb.append("No");
System.out.println(sb);
}
}
|
Main.java:22: error: incompatible types: unexpected return value
return 0;
^
1 error
|
s217437577
|
p03957
|
C++
|
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
#define bv vector<bool>
using namespace std;
typedef pair<int, int>PA;
using namespace std;
#define MAX 999999
int main(){
char s[10000];
cin >> s;
int l = (int)strlen(s);
int check = 0;
rep(i,l){
if(check == 0 && s[i] == 'C')
check ++;
if(check == 1 && s[i] == 'F')
check++;
}
if(check == 2)
cout << "YES" << endl;
else
cout << "NO" << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:34:18: error: 'strlen' was not declared in this scope
34 | int l = (int)strlen(s);
| ^~~~~~
a.cc:12:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
11 | #include<complex>
+++ |+#include <cstring>
12 | #define vi vector<int>
|
s001850171
|
p03957
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
bool f = false;
for(auto i : s)[]
if(i == 'C'){
f = true;
}
if(i == 'F' && f){
cout << "Yes" << endl;
return 0;
}
}
cout << "No" << endl;
}
|
a.cc: In lambda function:
a.cc:10:5: error: expected '{' before 'if'
10 | if(i == 'C'){
| ^~
a.cc: In function 'int main()':
a.cc:9:20: error: expected ';' before 'if'
9 | for(auto i : s)[]
| ^
| ;
10 | if(i == 'C'){
| ~~
a.cc:13:8: error: 'i' was not declared in this scope
13 | if(i == 'F' && f){
| ^
a.cc: At global scope:
a.cc:19:3: error: 'cout' does not name a type
19 | cout << "No" << endl;
| ^~~~
a.cc:20:1: error: expected declaration before '}' token
20 | }
| ^
|
s646174915
|
p03957
|
C++
|
// Example program
#include <iostream>
#include <string>
using namespace std;
int main()
{
string s;
cin >> s;
int x=0;
for (i=0; i<strlen(s.c_str()); i++) {
if (s.c_str()[i] == 'C' && x == 0) x++;
if (s.c_str()[i] == 'F' && x == 1) x++;
}
if (x==2) cout << "Yes" << endl;
else cout << "No" << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:11:10: error: 'i' was not declared in this scope
11 | for (i=0; i<strlen(s.c_str()); i++) {
| ^
a.cc:11:17: error: 'strlen' was not declared in this scope
11 | for (i=0; i<strlen(s.c_str()); i++) {
| ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <iostream>
+++ |+#include <cstring>
3 | #include <string>
|
s652827939
|
p03957
|
C++
|
/*input
FCC
*/
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
char s[102];
gets(s);
int n = strlen(s);
for (int i = 0; i < n - 1; ++i) {
if (s[i] == 'C')
for (int j = i + 1; j < n; ++j) {
if (s[j] == 'F') {
puts("Yes");
return 0;
}
}
}
puts("No");
return 0;
}
|
a.cc: In function 'int main(int, const char**)':
a.cc:9:3: error: 'gets' was not declared in this scope; did you mean 'getw'?
9 | gets(s);
| ^~~~
| getw
|
s216555063
|
p03957
|
C++
|
s = raw_input()
flag = 0
for i in s:
if flag == 0 and i == 'C': flag = 1
elif: flag == 1 and i == 'F': flag = 2
print 'Yes' if flag == 2 else 'No'
|
a.cc:7:7: warning: multi-character character constant [-Wmultichar]
7 | print 'Yes' if flag == 2 else 'No'
| ^~~~~
a.cc:7:31: warning: multi-character character constant [-Wmultichar]
7 | print 'Yes' if flag == 2 else 'No'
| ^~~~
a.cc:1:1: error: 's' does not name a type
1 | s = raw_input()
| ^
|
s570564118
|
p03957
|
C++
|
import sys
s=raw_input()
flag=False
for j in range(s):
if s[j]=='C':
flag=True
if s[j]=='F' and flag:
print "Yes"
sys.exit()
print "No"
|
a.cc:1:1: error: 'import' does not name a type
1 | import sys
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
|
s054251858
|
p03957
|
C++
|
#include <iostream>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <algorithm>
#include <functional>
#include <cstring>
#include <limits.h>
#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define SZ(i) ((int)i.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ALL(X) (X).begin(),(X).end()
typedef long long LL;
using namespace std;
int main(void){
string s;
cin >> s;
int flag=0;
for(i=0;i<SZ(s);i++){
if(flag==0&&s[i]=='C')
flag++;
if(flag==1&&s[i]=='F')
flag++;
}
if(flag==2)
cout<<"Yes"<<endl;
else
cout<<"No"<<endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:33:9: error: 'i' was not declared in this scope
33 | for(i=0;i<SZ(s);i++){
| ^
|
s149360137
|
p03957
|
C++
|
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <math.h>
using namespace std;
#define ll long long int
int main(void) {
string s;
cin >> s ;
int flag = 0;
for (int i = 0; i < s.length(); i++)
{
if (s.at(i) == 'C')
{
flag++;
}
if ((flag == 1) && (s.at(i) == 'F'))
flag++;
}
if (flag > 1)
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
}#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <math.h>
using namespace std;
#define ll long long int
int main(void) {
string s;
cin >> s ;
int flag = 0;
for (int i = 0; i < s.length(); i++)
{
if (s.at(i) == 'C')
{
flag++;
}
if ((flag == 1) && (s.at(i) == 'F'))
flag++;
}
if (flag > 1)
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
}
|
a.cc:35:2: error: stray '#' in program
35 | }#include <iostream>
| ^
a.cc:35:3: error: 'include' does not name a type
35 | }#include <iostream>
| ^~~~~~~
a.cc:46:5: error: redefinition of 'int main()'
46 | int main(void) {
| ^~~~
a.cc:12:5: note: 'int main()' previously defined here
12 | int main(void) {
| ^~~~
|
s051143054
|
p03957
|
C++
|
#include <string>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <stdlib.h>
#include <algorithm>
#include <list>
#include <math.h>
#define reps(i,j,k) for(int i=(j);i<(k);i++)
#define rep(i,j) reps(i,0,j)
// rep(i,10)cout << i << endl;
using namespace std;
int main(void){
int cnt=0;
char s[1000];
scanf("%d" ,s);
int len=strlen(s);
int flg=0;
rep(i,len){
if(s[i]=='C') flg=1;
if(s[i]=='F' && flg==1)flg=2;
}
if(flg==2) printf("Yes\n");
else printf("No\n");
return 0;
}
|
a.cc: In function 'int main()':
a.cc:19:17: error: 'strlen' was not declared in this scope
19 | int len=strlen(s);
| ^~~~~~
a.cc:9:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
8 | #include <math.h>
+++ |+#include <cstring>
9 | #define reps(i,j,k) for(int i=(j);i<(k);i++)
|
s704092635
|
p03957
|
C++
|
a = raw_input()
ans = False
flag = False
for c in a:
if c == "F" and flag:
ans = True
if c == "C":
flag = True
print "Yes" if ans else "No"
|
a.cc:1:1: error: 'a' does not name a type
1 | a = raw_input()
| ^
|
s607252129
|
p03957
|
C++
|
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define loop(i,a,b) for(ull i=(a);i<ull(b);++i)
#define rep(i,n) loop(i,0,n)
#define iter(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define riter(i,c) for(auto i=(c).rbegin(); i!=(c).rend(); ++i)
const double eps = 1e-10;
const double pi = acos(-1.0);
const double inf = (int)1e8;
#define clr(a,i) memset((a), (i) ,sizeof(a))
int main(){
string s;
std::cin >> s;
bool t=false;
rep(i,s.size()){
if(s[i]=='C') t=true;
if(s[i]=='F'&&t=true) {
std::cout << "Yes" << std::endl;
return 0;
}
}
std::cout << "No" << std::endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:36:17: error: lvalue required as left operand of assignment
36 | if(s[i]=='F'&&t=true) {
|
s814933034
|
p03957
|
C++
|
#include<bits/stdc++.h>
using namespace std;
#define lli long long
#define FOR(i,a,b) for (lli i=(a);i<(b);i++)
#define REP(i,n) for (lli i=0;i<(n);i++)
#define rep(i,n) for (lli i=0;i<(n);i++)
#define INF LONG_MAX/3
#define PB push_back
#define pb push_back
#define all(a) (a).begin(),(a),end()
#define pll pair<lli,lli>
int main(){
int f=0
string s;
cin>>s;
rep(i,s.length()){
if(s[i]=='C'){
f=1;
}
if(s[i]=='F' and f==1){
cout<<"Yes"<<endl;
return 0;
}
}
cout<<"No"<<endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:17:3: error: expected ',' or ';' before 'string'
17 | string s;
| ^~~~~~
a.cc:18:8: error: 's' was not declared in this scope
18 | cin>>s;
| ^
|
s585221289
|
p03957
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
int status = 0;
for(int unsigned i=0;i<s.size;i++){
if(s[i] == 'C' && status == 0) status = 1;
if(s[i] == 'F' && status == 1) status = 2;
}
if(status == 2){
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:9:34: 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 unsigned int]' (did you forget the '()' ?)
9 | for(int unsigned i=0;i<s.size;i++){
| ~~^~~~
| ()
|
s949326465
|
p03957
|
C++
|
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
using namespace std;
#define debug(x) cout<<#x<<": "<<x<<endl
#define rep(i,a,b) for(int i=a;i<b;i++)
#define PB push_back
#define putn(x,n) cout<< fixed<< setprecision(n)<< x << endl;
typedef long long ll;
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
string s;
cin >> s;
rep(i, 0, s.length()){
if (s[i] == 'C'){
rep(j, i, s.length()){
if (s[j] == 'F'){
cout << "Yes" << endl;
exit(0);
}
}
}
cout << "No" << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:33:2: error: expected '}' at end of input
33 | }
| ^
a.cc:14:11: note: to match this '{'
14 | int main(){
| ^
|
s218718037
|
p03957
|
C++
|
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <map>
#include <tuple>
using namespace std;
int main(int, char**) {
string str;
cin >> str;
bool a, b;
for(int i(0); i< str.length(); ++i){
if(str[i]=="C"){ a= true; }
if(a&&str[i]=="F") {b=true;}
}
if (b) { cout << "Yes" <<endl; }
else { cout << "No" <<endl; }
return 0;
}
|
a.cc: In function 'int main(int, char**)':
a.cc:15:16: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
15 | if(str[i]=="C"){ a= true; }
a.cc:16:19: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
16 | if(a&&str[i]=="F") {b=true;}
|
s486655452
|
p03957
|
C++
|
#include <stdio.h>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
int main(void)
{
string st[200000];
stack <char> po;
int i;
scanf("%s",st);
for(i = 0;i<st.length();i++){
if(st[i]=='C'){
po.push('C');
}
if(st[i]=='F'){
po.push('F');
}
}
if((int)po.size>=2){
printf("Yes");
}
else{
printf("No");
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:24:24: error: request for member 'length' in 'st', which is of non-class type 'std::string [200000]' {aka 'std::__cxx11::basic_string<char> [200000]'}
24 | for(i = 0;i<st.length();i++){
| ^~~~~~
a.cc:25:25: error: no match for 'operator==' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'char')
25 | if(st[i]=='C'){
| ~~~~~^~~~~
| | |
| | char
| std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/deque:62,
from /usr/include/c++/14/stack:62,
from a.cc:2:
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed:
a.cc:25:27: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::pair<_T1, _T2>'
25 | if(st[i]=='C'){
| ^~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
441 | operator==(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed:
a.cc:25:27: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
25 | if(st[i]=='C'){
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
486 | operator==(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed:
a.cc:25:27: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
25 | if(st[i]=='C'){
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1667 | operator==(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed:
a.cc:25:27: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
25 | if(st[i]=='C'){
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1737 | operator==(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed:
a.cc:25:27: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
25 | if(st[i]=='C'){
| ^~~
In file included from /usr/include/c++/14/deque:63:
/usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_Tp1>&, const allocator<_T2>&)'
235 | operator==(const allocator<_T1>&, const allocator<_T2>&)
| ^~~~~~~~
/usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed:
a.cc:25:27: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::allocator<_Tp1>'
25 | if(st[i]=='C'){
| ^~~
In file included from /usr/include/c++/14/deque:66:
/usr/include/c++/14/bits/stl_deque.h:2294:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator==(const deque<_Tp, _Alloc>&, const deque<_Tp, _Alloc>&)'
2294 | operator==(const deque<_Tp, _Alloc>& __x, const deque<_Tp, _Alloc>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_deque.h:2294:5: note: template argument deduction/substitution failed:
a.cc:25:27: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::deque<_Tp, _Alloc>'
25 | if(st[i]=='C'){
| ^~~
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
from /usr/include/c++/14/deque:81:
/usr/include/c++/14/tuple:2558:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator==(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)'
2558 | operator==(const tuple<_TElements...>& __t,
| ^~~~~~~~
/usr/include/c++/14/tuple:2558:5: note: template argument deduction/substitution failed:
a.cc:25:27: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::tuple<_UTypes ...>'
25 | if(st[i]=='C'){
| ^~~
In file included from /usr/include/c++/14/stack:63:
/usr/include/c++/14/bits/stl_stack.h:354:5: note: candidate: 'template<class _Tp, class _Seq> bool std::operator==(const stack<_Tp, _Seq>&, const stack<_Tp, _Seq>&)'
354 | operator==(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_stack.h:354:5: note: template argument deduction/substitution failed:
a.cc:25:27: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::stack<_Tp, _Seq>'
25 | if(st[i]=='C'){
| ^~~
In file included from /usr/include/c++/14/iosfwd:42,
from /usr/include/c++/14/ios:40,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:6:
/usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)'
192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed:
a.cc:25:27: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::fpos<_StateT>'
25 | if(st[i]=='C'){
| ^~~
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54,
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:
/usr/include/c++/14/string_view:629:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
629 | operator==(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution failed:
a.cc:25:27: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
25 | if(st[i]=='C'){
| ^~~
/usr/include/c++/14/string_view:637:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
637 | operator==(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:637:5: note: template argument deduction/substitution failed:
a.cc:25:27: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
25 | if(st[i]=='C'){
| ^~~
/usr/include/c++/14/string_view:644:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
644 | operator==(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:644:5: note: template argument deduction/substitution failed:
a.cc:25:27: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'char'
25 | if(st[i]=='C'){
| ^~~
/usr/include/c++/14/bits/basic_string.h:3755:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3755 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3755:5: note: template argument deduction/substitution failed:
a.cc:25:27: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'char'
25 | if(st[i]=='C'){
| ^~~
/usr/include/c++/14/bits/basic_string.h:3772:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3772 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
|
|
s805126392
|
p03957
|
C++
|
#include <bits/stdc++.h>
using namespace std;
#define int long long // <-----!!!!!!!!!!!!!!!!!!!
#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(a)-1;i>=b;i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define printV(v) for(auto&& x : v){cout << x << " ";} cout << endl
#define printVV(vv) for(auto&& v : vv){for(auto&& x : v){cout << x << " ";}cout << endl;}
#define printP(p) cout << p.first << " " << p.second << endl
#define printVP(vp) for(auto&& p : vp) printP(p);
typedef long long ll;
typedef pair<int, int> Pii;
typedef tuple<int, int, int> TUPLE;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<Pii> vp;
const int inf = 1e9;
const int mod = 1e9 + 7;
signed main() {
std::ios::sync_with_stdio(false);
std::cin.tie(0);
string s;
cin >> s;
int x = n + 1, y = -1;
rep(i, n) {
if (s[i] == 'C') {
x = i;
break;
}
}
rrep(i, n) {
if (s[i] == 'F') {
y = i;
break;
}
}
if (x < y) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
}
|
a.cc: In function 'int main()':
a.cc:32:13: error: 'n' was not declared in this scope
32 | int x = n + 1, y = -1;
| ^
a.cc:41:13: error: 'y' was not declared in this scope
41 | y = i;
| ^
a.cc:46:13: error: 'y' was not declared in this scope
46 | if (x < y) {
| ^
|
s707800816
|
p03957
|
C++
|
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
using namespace std;
#define debug(x) cout<<#x<<": "<<x<<endl
#define rep(i,a,b) for(int i=a;i<b;i++)
#define PB push_back
#define putn(x,n) cout<< fixed<< setprecision(n)<< x << endl;
typedef long long ll;
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
cin >> s;
rep(i, 0, s.length()){
if (s[i] == 'C'){
rep(j, i, s.length()){
if (s[j] == 'F'){
cout << "Yes" << endl;
exit(0);
}
}
}
cout << "No" << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:17:16: error: 's' was not declared in this scope
17 | cin >> s;
| ^
a.cc:32:2: error: expected '}' at end of input
32 | }
| ^
a.cc:14:11: note: to match this '{'
14 | int main(){
| ^
|
s205577414
|
p03957
|
C++
|
#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <set>
#include <map>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <array>
//cin.sync_with_stdio(false);
//streambuf
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
using vi = vector<int>;
using vll = vector<ll>;
using vpii = vector<pii>;
using ti3 = tuple<int, int, int>;
using vti3 = vector<ti3>;
template<class T, int s>using va = vector<array<T, s>>;
template<class T, class T2> using umap = unordered_map<T, T2>;
template<class T> using uset = unordered_set<T>;
template<class T> void cmin(T &a, const T&b) { if (a > b)a = b; }
template<class T> void cmax(T &a, const T&b) { if (a < b)a = b; }
#define ALL(a) a.begin(),a.end()
#define rep(i,a) for(int i=0;i<a;i++)
#define rep1(i,a) for(int i=1;i<=a;i++)
const ll mod = 1000000007;
#ifndef INT_MAX
const int INT_MAX = numeric_limits<signed>().max();
#endif
template<class T>using heap = priority_queue<T, vector<T>, greater<T>>;
template<class T>using pque = priority_queue<T, vector<T>, function<T(T, T)>>;
template <class T>
inline void hash_combine(size_t & seed, const T & v) {
hash<T> hasher;
seed ^= hasher(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
}
namespace std {
template<typename S, typename T> struct hash<pair<S, T>> {
inline size_t operator()(const pair<S, T> & v) const {
size_t seed = 0;
hash_combine(seed, v.first);
hash_combine(seed, v.second);
return seed;
}
};
// Recursive template code derived from Matthieu M.
template <class Tuple, size_t Index = std::tuple_size<Tuple>::value - 1>
struct HashValueImpl
{
static void apply(size_t& seed, Tuple const& tuple)
{
HashValueImpl<Tuple, Index - 1>::apply(seed, tuple);
hash_combine(seed, std::get<Index>(tuple));
}
};
template <class Tuple>
struct HashValueImpl<Tuple, 0>
{
static void apply(size_t& seed, Tuple const& tuple)
{
hash_combine(seed, std::get<0>(tuple));
}
};
template <typename ... TT>
struct hash<std::tuple<TT...>>
{
size_t
operator()(std::tuple<TT...> const& tt) const
{
size_t seed = 0;
HashValueImpl<std::tuple<TT...> >::apply(seed, tt);
return seed;
}
};
}
ll pow(ll base, ll i, ll mod) {
ll a = 1;
while (i) {
if (i & 1) {
a *= base;
a %= mod;
}
base *= base;
base %= mod;
i /= 2;
}
return a;
}
class unionfind {
vector<int> par, rank, size_;//速度ではなくメモリ効率を考えるならrankのかわりにsizeを使う
public:
unionfind(int n) :par(n), rank(n), size_(n, 1) {
iota(ALL(par), 0);
}
int find(int x) {
if (par[x] == x)return x;
return par[x] = find(par[x]);
}
void unite(int x, int y) {
x = find(x), y = find(y);
if (x == y)return;
if (rank[x] < rank[y])swap(x, y);
par[y] = x;
size_[x] += size_[y];
if (rank[x] == rank[y])rank[x]++;
}
bool same(int x, int y) {
return find(x) == find(y);
}
int size(int x) {
return size_[find(x)];
}
};
ll gcd(ll a, ll b) {
while (b) {
ll c = a%b;
a = b;
b = c;
}
return a;
}
ll lcm(ll a, ll b) {
return a / gcd(a, b)*b;
}
int popcnt(unsigned long long a) {
a = (a & 0x5555555555555555) + (a >> 1 & 0x5555555555555555);
a = (a & 0x3333333333333333) + (a >> 2 & 0x3333333333333333);
a = (a & 0x0f0f0f0f0f0f0f0f) + (a >> 4 & 0x0f0f0f0f0f0f0f0f);
a = (a & 0x00ff00ff00ff00ff) + (a >> 8 & 0x00ff00ff00ff00ff);
a = (a & 0x0000ffff0000ffff) + (a >> 16 & 0x0000ffff0000ffff);
return (a & 0xffffffff) + (a >> 32);
}
template<class T, class Func = function<T(T, T)>>
class segtree {
vector<T> obj;
int offset;
Func updater;
T e;
int bufsize(int num) {
int i = 1;
for (; num >i; i <<= 1);
offset = i - 1;
return (i << 1) - 1;
}
T query(int a, int b, int k, int l, int r) {
if (r <= a || b <= l)return e;
if (a <= l && r <= b)return obj[k];
else return updater(query(a, b, k * 2 + 1, l, (l + r) / 2), query(a, b, k * 2 + 2, (l + r) / 2, r));
}
public:
T query(int a, int b) {//[a,b)
return query(a, b, 0, 0, offset + 1);
}
void updateall(int l = 0, int r = -1) {
if (r < 0)r = offset + 1;
l += offset, r += offset;
do {
l = l - 1 >> 1, r = r - 1 >> 1;
for (int i = l; i < r; i++)obj[i] = updater(obj[i * 2 + 1], obj[i * 2 + 2]);
} while (r);
}
void update(int k, T &a) {
k += offset;
obj[k] = a;
while (k) {
k = k - 1 >> 1;
obj[k] = updater(obj[k * 2 + 1], obj[k * 2 + 2]);
}
}
segtree(int n, T e, const Func &updater_ = Func()) :obj(bufsize(n), e), e(e), updater(updater_) {}
segtree(vector<T> &vec, T e, const Func &updater = Func()) :obj(bufsize(vec.size()), e), e(e), updater(updater) {
copy(vec.begin(), vec.end(), obj.begin() + offset);
updateall();
}
typename vector<T>::reference operator[](int n) {
return obj[n + offset];
}
};
template<class T>
class matrix {
vector<vector<T>> obj;
pair<int, int> s;
public:
matrix(pair<int, int> size, T e = 0) :matrix(size.first, size.second, e) {}
matrix(int n, int m = -1, T e = 0) :obj(n, vector<T>(m == -1 ? n : m, e)), s(n, m == -1 ? n : m) {}
static matrix e(int n) {
matrix a = (n);
for (int i = 0; i < n; i++)a[i][i] = 1;
return a;
}
matrix& operator+=(const matrix &p) {
if (s != p.s)throw runtime_error("matrix error");
for (int i = 0; i < s.first; i++)
for (int j = 0; j < s.second; j++)obj[i][j] += p.obj[i][j];
return *this;
}
matrix operator+(const matrix &p) {
matrix res(*this);
return res += p;
}
matrix& operator-=(const matrix &p) {
if (s != p.s)throw runtime_error("matrix error");
for (int i = 0; i < s.first; i++)
for (int j = 0; j < s.second; j++)obj[i][j] -= p.obj[i][j];
return *this;
}
matrix operator-(const matrix &p) {
matrix res(*this);
return res -= p;
}
matrix& operator*=(T p) {
for (auto &a : obj)
for (auto &b : a)b *= p;
return *this;
}
matrix operator*(T p) {
matrix res(*this);
return res *= p;
}
matrix operator*(const matrix &p) {
if (s.second != p.s.first)throw runtime_error("matrix error");
matrix ret(s.first, p.s.first);
for (int i = 0; i < s.first; i++)
for (int j = 0; j < s.second; j++)
for (int k = 0; k < p.s.second; k++)ret[i][k] += obj[i][j] * p.obj[j][k];
return ret;
}
matrix &operator*=(const matrix &p) {
return *this = *this*p;
}
pair<int, int> size() const {
return s;
}
matrix &mod(T m) {
for (auto &a : obj)
for (auto &b : a)b %= m;
return *this;
}
typename vector<vector<T>>::reference operator[](int t) {
return obj[t];
}
};
template<class T> inline
matrix<T> pow(matrix<T> &base, unsigned exp) {
auto base_(base);
if (base_.size().first != base_.size().second)throw runtime_error("matrix error");
matrix<T> res = matrix<T>::e(base_.size().first);
for (;;) {
if (exp & 1)res *= base_;
if (!(exp /= 2))break;
base_ *= base_;
}
return res;
}
template<class T> inline
matrix<T> modpow(matrix<T> &base, unsigned exp, T m) {
auto base_(base);
if (base.size().first != base_.size().second)throw runtime_error("matrix error");
matrix<T> res = matrix<T>::e(base_.size().first);
for (;;) {
if (exp & 1)(res *= base_).mod(m);
if (!(exp /= 2))break;
(base_ *= base_).mod(m);
}
return res;
}
struct edge { int to, cap, rev, cost,mf; };
constexpr int MAX_V = 2000;
vector<edge> G[MAX_V];
bool used[MAX_V];
int level[MAX_V];
int iter[MAX_V];
void add_edge(int from, int to, int cap, int cost = 0) {
G[from].push_back(edge{ to, cap,(int) G[to].size(),cost,cap });
G[to].push_back(edge{ from,0,(int)G[from].size() - 1,-cost,cap });
}
void bfs(int s) {
fill_n(level, MAX_V, -1);
queue<int> que;
level[s] = 0;
que.push(s);
while (!que.empty()) {
int v = que.front(); que.pop();
for (int i = 0; i < G[v].size(); i++) {
edge &e = G[v][i];
if (e.cap > 0 && level[e.to] < 0) {
level[e.to] = level[v] + 1;
que.push(e.to);
}
}
}
}
int dfs(int v, int t, int f) {
if (v == t)return f;
for (int &i = iter[v]; i < G[v].size(); i++) {
edge &e = G[v][i];
if (e.cap > 0 && level[v] < level[e.to]) {
int d = dfs(e.to, t, min(f, e.cap));
if (d > 0) {
e.cap -= d;
G[e.to][e.rev].cap += d;
return d;
}
}
}
return 0;
}
int max_flow(int s, int t) {
int flow = 0;
for (;;) {
bfs(s);
if (level[t] < 0)return flow;
fill_n(iter, MAX_V, 0);
int f;
while ((f = dfs(s, t, numeric_limits<int>::max()))>0) {
flow += f;
}
}
}
typedef pair<int, int> P;
int V=MAX_V;
int h[MAX_V];
int dist[MAX_V];
int prevv[MAX_V], preve[MAX_V];
int min_cost_flow(int s, int t, int f) {
int res = 0;
fill_n(h, V, 0);
while (f > 0) {
priority_queue<P, vector<P>, greater<P>> que;
fill_n(dist, V, numeric_limits<int>::max());
dist[s] = 0;
que.push({ 0,s });
while (!que.empty()) {
P p = que.top(); que.pop();
int v = p.second;
if (dist[v] < p.first)continue;
for (int i = 0; i < G[v].size(); i++) {
edge &e = G[v][i];
if (e.cap > 0 && dist[e.to]>dist[v] + e.cost + h[v] - h[e.to]){
dist[e.to] = dist[v] + e.cost + h[v] - h[e.to];
prevv[e.to] = v;
preve[e.to] = i;
que.push({ dist[e.to],e.to });
}
}
}
if (dist[t] == numeric_limits<int>::max()) {
return -1;
}
for (int v = 0; v < V; v++)h[v] += dist[v];
int d = f;
for (int v = t; v != s; v = prevv[v]) {
d = min(d, G[prevv[v]][preve[v]].cap);
}
f -= d;
res += d*h[t];
for (int v = t; v != s; v = prevv[v]) {
edge &e = G[prevv[v]][preve[v]];
e.cap -= d;
G[v][e.rev].cap += d;
}
}
return res;
}
int main() {
string s;
cin >> s;
int f = 0;
for (auto a : s) {
if (a == 'C')f = 1;
if (f&&a == 'F') {
cout << "Yes" << endl;
return;
}
}
cout << "No" << endl;
}
|
a.cc: In function 'int main()':
a.cc:394:25: error: return-statement with no value, in function returning 'int' [-fpermissive]
394 | return;
| ^~~~~~
|
s338078650
|
p03957
|
C
|
#include<stdio.h>
int main(){
int f=0;
char s[1000010];
scanf("%s",s);
for(i=0;s[i];i++){
if(s[i]=='C'&&f==0)f=1;
if(s[i]=='F'&&f==1)f=2;
}
printf("%s\n",f==2?"Yes":"No");
return 0;
}
|
main.c: In function 'main':
main.c:6:7: error: 'i' undeclared (first use in this function)
6 | for(i=0;s[i];i++){
| ^
main.c:6:7: note: each undeclared identifier is reported only once for each function it appears in
|
s202530341
|
p03957
|
C++
|
cout << "No" << endl;
|
a.cc:1:5: error: 'cout' does not name a type
1 | cout << "No" << endl;
| ^~~~
|
s769776463
|
p03957
|
C++
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#include <limits.h>
#define lli long long int
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define abs(a) ((a)<0?-(a):(a))
int main(void){
char *s;
bool flag = false;
s = calloc(sizeof(char),100000);
scanf("%s",s);
while(*s){
if(*s == 'W'){
flag = true;
}
if(*s == 'F' && flag){
printf("Yes\n");
return 0;
}
s++;
}
printf("No\n");
return 0;
}
|
a.cc: In function 'int main()':
a.cc:17:19: error: invalid conversion from 'void*' to 'char*' [-fpermissive]
17 | s = calloc(sizeof(char),100000);
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~
| |
| void*
|
s936178469
|
p03957
|
C++
|
s = input()
ans = 0
if s.index('C') < s.index('F'):
print('Yes')
else:
print('No')
|
a.cc:6:11: warning: multi-character character constant [-Wmultichar]
6 | print('Yes')
| ^~~~~
a.cc:8:11: warning: multi-character character constant [-Wmultichar]
8 | print('No')
| ^~~~
a.cc:2:1: error: 's' does not name a type
2 | s = input()
| ^
|
s109112195
|
p03957
|
C++
|
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
string s;
cin>>S;
int a=0,b=0;
for(int i=0;i<S.size();i++){
if(S[i] == 'C'){
a=1;
}
if(S[i] == 'F' && a==1){
cout<<"Yes"<<endl;
return 0;
}
}
cout<<"No"<<endl;
}
|
a.cc: In function 'int main()':
a.cc:9:14: error: 'S' was not declared in this scope
9 | cin>>S;
| ^
|
s523774353
|
p03958
|
Java
|
import java.util.*; import java.io.*; import java.math.*;
public class Main{
static void solve(){//Here is the main function
ArrayList<Integer> one = nextIntArray();
int K = one.get(0);
int T = one.get(1);
ArrayList<Integer> list = nextIntArray();
int max = 0;
for(int i = 0; i < N; i++){
max = Math.max(max, list.get(i));
}
int output = 0;
for(int i = 0; i < N; i++){
output = Math.max(output, max - 1 - list.get(i));
}
myout(output);
}
//Method addition frame start
//Method addition frame end
//Don't have to see. start------------------------------------------
static class InputIterator{
ArrayList<String> inputLine = new ArrayList<String>(1024);
int index = 0; int max; String read;
InputIterator(){
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try{
while((read = br.readLine()) != null){
inputLine.add(read);
}
}catch(IOException e){}
max = inputLine.size();
}
boolean hasNext(){return (index < max);}
String next(){
if(hasNext()){
return inputLine.get(index++);
}else{
throw new IndexOutOfBoundsException("There is no more input");
}
}
}
static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
static PrintWriter out = new PrintWriter(System.out);
static void flush(){out.flush();}
static void myout(Object t){out.println(t);}
static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
static String next(){return ii.next();}
static boolean hasNext(){return ii.hasNext();}
static int nextInt(){return Integer.parseInt(next());}
static long nextLong(){return Long.parseLong(next());}
static double nextDouble(){return Double.parseDouble(next());}
static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
static ArrayList<Integer> nextIntArray(){
ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
for(int i = 0; i < input.size(); i++){
ret.add(Integer.parseInt(input.get(i)));
}
return ret;
}
static ArrayList<Long> nextLongArray(){
ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
for(int i = 0; i < input.size(); i++){
ret.add(Long.parseLong(input.get(i)));
}
return ret;
}
static String myconv(Object list, int no){//only join
String joinString = CONVSTR.get(no);
if(list instanceof String[]){
return String.join(joinString, (String[])list);
}else if(list instanceof ArrayList){
return String.join(joinString, (ArrayList)list);
}else{
throw new ClassCastException("Don't join");
}
}
static ArrayList<String> myconv(String str, int no){//only split
String splitString = CONVSTR.get(no);
return new ArrayList<String>(Arrays.asList(str.split(splitString)));
}
public static void main(String[] args){
CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
solve();flush();
}
//Don't have to see. end------------------------------------------
}
|
Main.java:9: error: cannot find symbol
for(int i = 0; i < N; i++){
^
symbol: variable N
location: class Main
Main.java:13: error: cannot find symbol
for(int i = 0; i < N; i++){
^
symbol: variable N
location: class Main
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors
|
s850597134
|
p03958
|
C++
|
#include <bits/stdc++.h>
using namespace std;
const long long N = 3e5+2;
int k;
int t;
int ar[N];
set < int > s;
int main(){
scanf("%d%d" , &k , &t);
int mx = 0;
for(int i = 1; i <= t; i++){
scanf("%d" , &ar[i]);
s.insert(i);
mx = max(mx , ar[i]);
}
int ans = 0;
int prv = -1;
auto it = s.begin();
while(k--){
if(prv == *it)
ans++;
//cout << *it << "\n";
int cur = *it;
prv = cur;
ar[cur]--;
if(!ar[cur]){
s.erase(cur);
}
it = s.upper_bound(cur);
if(it == s.end()){
it = s.begin();
}
}
printf("%d\n" , ans - (mx % 2 == 0 && n > 1));
}
|
a.cc: In function 'int main()':
a.cc:38:43: error: 'n' was not declared in this scope
38 | printf("%d\n" , ans - (mx % 2 == 0 && n > 1));
| ^
|
s778691256
|
p03958
|
C++
|
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
#define int long long
int INF = 1e9+7;
signed main() {
int K,T;
cin >> K >> T;
vector<int>a(T);
for(int i = 0; i < T; i++) {
cin >> a[i];
}
sort(a.begin(),a.end());
cout << max(0,a[T-1]-(K-1-a[T-1])) << endl;
}
|
a.cc: In function 'int main()':
a.cc:14:16: error: no matching function for call to 'max(int, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)'
14 | cout << max(0,a[T-1]-(K-1-a[T-1])) << endl;
| ~~~^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:14:16: note: deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'})
14 | cout << max(0,a[T-1]-(K-1-a[T-1])) << endl;
| ~~~^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:14:16: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
14 | cout << max(0,a[T-1]-(K-1-a[T-1])) << endl;
| ~~~^~~~~~~~~~~~~~~~~~~~~~~
|
s384030951
|
p03958
|
C++
|
#include <bits/stdc++.h>
using namespace std;
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout << fixed << setprecision(20);
#define int long long
#define double long double
const int INF = 1e18, MOD = 1e9 + 7;
signed main() {
int k, t;
cin>>k>>t;
int a;
int mx = -INF;
for (int i = 0; i < t; i++) {
cin>>a;
mx = max(mx, a);
}
cout<<max(0, mx - 1 - k + mx)<<endl;
}
|
a.cc: In function 'int main()':
a.cc:17:14: error: no matching function for call to 'max(int, long long int)'
17 | cout<<max(0, mx - 1 - k + mx)<<endl;
| ~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:17:14: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
17 | cout<<max(0, mx - 1 - k + mx)<<endl;
| ~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:17:14: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
17 | cout<<max(0, mx - 1 - k + mx)<<endl;
| ~~~^~~~~~~~~~~~~~~~~~~~
|
s619848205
|
p03958
|
C++
|
#include<bits/stdc++.h>
using namespace std;
int main(){
int k,n;
cin >> k >> n;
int a[n];
int d=0,e;
for(int i=0;i<n;i++){
cin >> a[i];
if(d<a[i]){
d=a[i];
e=i;
}
}
cout << max(a[e]−1−(k−a[e]),0);
}
|
a.cc:15:19: error: extended character − is not valid in an identifier
15 | cout << max(a[e]−1−(k−a[e]),0);
| ^
a.cc:15:19: error: extended character − is not valid in an identifier
a.cc:15:23: error: extended character − is not valid in an identifier
15 | cout << max(a[e]−1−(k−a[e]),0);
| ^
a.cc: In function 'int main()':
a.cc:15:19: error: expected ')' before '\U000022121\U00002212'
15 | cout << max(a[e]−1−(k−a[e]),0);
| ~ ^~~
| )
|
s074977573
|
p03958
|
C++
|
/**
* code generated by JHelper
* More info: https://github.com/AlexeyDmitriev/JHelper
* @author
*/
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <functional>
#include <cmath>
#include <numeric>
#include <iterator>
#include <fstream>
#define SIZE 100005
#define MOD 1000000007
using namespace std;
class BK {
public:
static void solve(std::istream& cin, std::ostream& cout) {
int64_t k, t;
cin >> k >> t;
vector<int64_t> vec(t);
for (int i = 0; i < t; ++i) {
cin >> vec[i];
}
sort(vec.begin(), vec.end());
int64_t max_vec = vec.back();
vec.pop_back();
int64_t sum = accumulate(vec.begin(), vec.end(), 0l);
cout << max(max_vec - sum - 1, 0ll) << endl;
}
};
int main() {
BK solver;
std::istream& in(std::cin);
std::ostream& out(std::cout);
solver.solve(in, out);
return 0;
}
|
a.cc: In static member function 'static void BK::solve(std::istream&, std::ostream&)':
a.cc:38:18: error: no matching function for call to 'max(int64_t, long long int)'
38 | cout << max(max_vec - sum - 1, 0ll) << endl;
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
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:8:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:38:18: note: deduced conflicting types for parameter 'const _Tp' ('long int' and 'long long int')
38 | cout << max(max_vec - sum - 1, 0ll) << endl;
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:9:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:38:18: note: mismatched types 'std::initializer_list<_Tp>' and 'long int'
38 | cout << max(max_vec - sum - 1, 0ll) << endl;
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~
|
s324701193
|
p03958
|
C++
|
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define int long long
const long long INF=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long, long > > vpll;
typedef vector<pair<int, int > > vpii;
int32_t main() {
oneforall
oneforall
oneforall
oneforall
oneforall
oneforall
oneforall
oneforall
oneforall
oneforall
oneforall
oneforall
oneforall
oneforall
ini(n);
ini(n1);
vi morty;
FOR(i,0,n1){
ini(x);
morty.push_back(x);
}
if(n1 == 1){
out(n-1);
return 0;
}
while(n>0){
sort(all(morty),greater<int>());
//for(auto x:morty){cout<<x<<" ";}cout<<"\n";
if(morty[1] == 0){if(morty[0]!=0{out(morty[0]-1);return 0;}}
morty[0]--;morty[1]--;
}
out(0);
return 0;
}
|
a.cc: In function 'int32_t main()':
a.cc:51:49: error: expected ')' before '{' token
51 | if(morty[1] == 0){if(morty[0]!=0{out(morty[0]-1);return 0;}}
| ~ ^
| )
a.cc:51:76: error: expected primary-expression before '}' token
51 | if(morty[1] == 0){if(morty[0]!=0{out(morty[0]-1);return 0;}}
| ^
|
s521844999
|
p03958
|
Java
|
#include <algorithm>
#include <iostream>
#include <vector>
int main() {
int k, t;
std::cin >> k >> t;
std::vector<int> a(t);
for (int i = 0; i < t; i++) std::cin >> a[i];
sort(a.begin(), a.end());
std::cout << std::max(0, a[t - 1] - 1 - (k - a[t - 1])) << "\n";
}
|
Main.java:1: error: illegal character: '#'
#include <algorithm>
^
Main.java:2: error: illegal character: '#'
#include <iostream>
^
Main.java:3: error: illegal character: '#'
#include <vector>
^
Main.java:7: error: class, interface, enum, or record expected
std::cin >> k >> t;
^
Main.java:8: error: class, interface, enum, or record expected
std::vector<int> a(t);
^
Main.java:9: error: class, interface, enum, or record expected
for (int i = 0; i < t; i++) std::cin >> a[i];
^
Main.java:9: error: class, interface, enum, or record expected
for (int i = 0; i < t; i++) std::cin >> a[i];
^
Main.java:9: error: class, interface, enum, or record expected
for (int i = 0; i < t; i++) std::cin >> a[i];
^
Main.java:11: error: class, interface, enum, or record expected
sort(a.begin(), a.end());
^
Main.java:12: error: class, interface, enum, or record expected
std::cout << std::max(0, a[t - 1] - 1 - (k - a[t - 1])) << "\n";
^
Main.java:13: error: class, interface, enum, or record expected
}
^
11 errors
|
s773081821
|
p03958
|
C++
|
import sys
readline = sys.stdin.buffer.readline
K, T = map(int, readline().split())
A = sorted(list(map(int, readline().split())))[::-1]
B = [-1 for _ in range(K)]
j = 0
for i, a in enumerate(A):
for _ in range(a):
if j <= K // 2 - 1:
B[2 * j] = i
else:
B[2 * (j - K // 2) - 1] = i
j += 1
print(B)
cnt = 0
for i in range(1, K):
if B[i - 1] == B[i]:
cnt += 1
print(cnt)
|
a.cc:1:1: error: 'import' does not name a type
1 | import sys
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
|
s505261147
|
p03958
|
C++
|
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main() {
ll k,t;
cin >> k >> t;
ll a=0;
ll b;
for(int i=0;i<t;i++){
cin >> b;
a=max(a,b);
}
b=k-a;
cout << max(0,a-b-1) << endl;
}
|
a.cc: In function 'int main()':
a.cc:25:14: error: no matching function for call to 'max(int, ll)'
25 | cout << max(0,a-b-1) << endl;
| ~~~^~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:25:14: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
25 | cout << max(0,a-b-1) << endl;
| ~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:25:14: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
25 | cout << max(0,a-b-1) << endl;
| ~~~^~~~~~~~~
|
s508856128
|
p03958
|
C++
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
ll n, t;
cin >> n >> t;
vector<ll> a(t);
ll maxi = 0, sum = 0;
for (int i = 0; i < t; i++)
{
cin >> a[i];
sum += a[i];
maxi = max(a[i], maxi);
}
sum -= maxi;
cout << max(0,abs(sum - maxi) - 1) << endl;
}
|
a.cc: In function 'int main()':
a.cc:17:16: error: no matching function for call to 'max(int, long long int)'
17 | cout << max(0,abs(sum - maxi) - 1) << endl;
| ~~~^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:17:16: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
17 | cout << max(0,abs(sum - maxi) - 1) << endl;
| ~~~^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:17:16: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
17 | cout << max(0,abs(sum - maxi) - 1) << endl;
| ~~~^~~~~~~~~~~~~~~~~~~~~~~
|
s507856382
|
p03958
|
C++
|
#include <iostream>
#include <vector>
#include <cstdlib>
#include <bits/stdc++.h>
using namespace std;
int main() {
int k,t;
cin >> k >> t;
vector<int> a(t);
for(int i = 0; i < n; i++){
cin >> a.at(i);
}
sort(a.begin(), a.end());
reverse(a.begin(), a.end());
cout << max(a.at(n-1) - 1 - (k - a.at(n-1)), 0);
}
|
a.cc: In function 'int main()':
a.cc:11:24: error: 'n' was not declared in this scope
11 | for(int i = 0; i < n; i++){
| ^
a.cc:16:22: error: 'n' was not declared in this scope
16 | cout << max(a.at(n-1) - 1 - (k - a.at(n-1)), 0);
| ^
|
s576383807
|
p03958
|
C++
|
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define PER(i, n) for (int i = (n-1); i >= 0; --i)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NEXP(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define popb(n) pop_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl
#define yes(n) cout << ((n) ? "yes" : "no" ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {if((V).size()-1!=i){cout << (V)[i] << " ";}else{cout << (V)[i] << endl;}}
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define VVi vector<vector<ll>>
#define Vd vector<double>
#define Vb vector<bool>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
using ll = long long;
using Graph = vector<vector<int>>;
const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
class UnionFind {
public:
vector <int> par;
vector <int> siz;
UnionFind(int sz_): par(sz_), siz(sz_, 1LL) {
for (int i = 0; i < sz_; ++i) par[i] = i;
}
void init(ll sz_) {
par.resize(sz_);
siz.assign(sz_, 1LL);
for (int i = 0; i < sz_; ++i) par[i] = i;
}
int root(int x) {
while (par[x] != x) {
x = par[x] = par[par[x]];
}
return x;
}
bool merge(int x, int y) {
x = root(x);
y = root(y);
if (x == y) return false;
if (siz[x] < siz[y]) swap(x, y);
siz[x] += siz[y];
par[y] = x;
return true;
}
bool issame(int x, int y) {
return root(x) == root(y);
}
int size(int x) {
return siz[root(x)];
}
};
int gcd(int a, int b) {
return b != 0 ? gcd(b, a % b) : a;
}
int lcm(int a, int b) {
return a * b / gcd(a, b);
}
// 文字を全て大文字にします
string toStrUp(string str) {
char diff = 'A'-'a';
REP(i,str.size()) str[i] += diff;
return str;
}
// 文字をstring型で一文字取得します
string get1ch(string str, int key) {
return str.substr(key,1);
}
// 素因数分解 (O(sqrt(n)))
map<int,int> prime_factor(int n) {
map<int,int> ret;
for(int i = 2; i * i <= n; i++) {
while(n % i == 0) {
ret[i]++;
n /= i;
}
}
if(n != 1) ret[n] = 1;
return ret;
}
// 素数判定 (O(sqrt(n)))
bool is_prime(int x) {
for(int i = 2; i * i <= x; i++) {
if(x % i == 0) return false;
}
return true;
}
// 進数変換 (O(log n))
template<typename T>
vector<T> convert_base(T x, T b) {
vector< T > ret;
T t = 1, k = abs(b);
while(x) {
ret.emplace_back((x * t) % k);
if(ret.back() < 0) ret.back() += k;
x -= ret.back() * t;
x /= k;
t *= b / k;
}
if(ret.empty()) ret.emplace_back(0);
reverse(begin(ret), end(ret));
return ret;
}
template<class T> inline bool chmin(T& a, T b) {
if(a > b) {
a = b;
return true;
}
return false;
}
template<class T> inline bool chmax(T& a, T b) {
if(a < b){
a = b;
return true;
}
return false;
}
int modPow(int a, int n) {
if(n == 1) return a%MOD;
if(n%2 == 1) return (a*modPow(a,n-1)) % MOD;
int t = modPow(a, n/2);
return (t*t) % MOD;
}
signed main() {
cin.tie(0);
ios::sync_with_stdio(false);
cout << fixed << setprecision(15);
// デフォルト変数定義
int n=0,m=0,a=0,b=0,c=0,d=0,x=0,y=0,z=0;
string s="",t="";
//
// ここから
int K,T;
IN2(K,T);
Vi A(T);
VIN(A)
int maxe = *max_element(ALL(A))-1;
int sume = VSUM(A) - maxe - 1;
OUT(min(maxe-sume, 0));
}
|
a.cc: In function 'int main()':
a.cc:195:10: error: no matching function for call to 'min(long long int, int)'
195 | OUT(min(maxe-sume, 0));
| ~~~^~~~~~~~~~~~~~
a.cc:30:24: note: in definition of macro 'OUT'
30 | #define OUT(n) cout << n << endl
| ^
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:2:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed:
a.cc:195:10: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
195 | OUT(min(maxe-sume, 0));
| ~~~^~~~~~~~~~~~~~
a.cc:30:24: note: in definition of macro 'OUT'
30 | #define OUT(n) cout << n << endl
| ^
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed:
a.cc:195:10: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
195 | OUT(min(maxe-sume, 0));
| ~~~^~~~~~~~~~~~~~
a.cc:30:24: note: in definition of macro 'OUT'
30 | #define OUT(n) cout << n << endl
| ^
|
s467906898
|
p03958
|
C++
|
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define PER(i, n) for (int i = (n-1); i >= 0; --i)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NEXP(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define popb(n) pop_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl
#define yes(n) cout << ((n) ? "yes" : "no" ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {if((V).size()-1!=i){cout << (V)[i] << " ";}else{cout << (V)[i] << endl;}}
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define VVi vector<vector<ll>>
#define Vd vector<double>
#define Vb vector<bool>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
using ll = long long;
using Graph = vector<vector<int>>;
const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
class UnionFind {
public:
vector <int> par;
vector <int> siz;
UnionFind(int sz_): par(sz_), siz(sz_, 1LL) {
for (int i = 0; i < sz_; ++i) par[i] = i;
}
void init(ll sz_) {
par.resize(sz_);
siz.assign(sz_, 1LL);
for (int i = 0; i < sz_; ++i) par[i] = i;
}
int root(int x) {
while (par[x] != x) {
x = par[x] = par[par[x]];
}
return x;
}
bool merge(int x, int y) {
x = root(x);
y = root(y);
if (x == y) return false;
if (siz[x] < siz[y]) swap(x, y);
siz[x] += siz[y];
par[y] = x;
return true;
}
bool issame(int x, int y) {
return root(x) == root(y);
}
int size(int x) {
return siz[root(x)];
}
};
int gcd(int a, int b) {
return b != 0 ? gcd(b, a % b) : a;
}
int lcm(int a, int b) {
return a * b / gcd(a, b);
}
// 文字を全て大文字にします
string toStrUp(string str) {
char diff = 'A'-'a';
REP(i,str.size()) str[i] += diff;
return str;
}
// 文字をstring型で一文字取得します
string get1ch(string str, int key) {
return str.substr(key,1);
}
// 素因数分解 (O(sqrt(n)))
map<int,int> prime_factor(int n) {
map<int,int> ret;
for(int i = 2; i * i <= n; i++) {
while(n % i == 0) {
ret[i]++;
n /= i;
}
}
if(n != 1) ret[n] = 1;
return ret;
}
// 素数判定 (O(sqrt(n)))
bool is_prime(int x) {
for(int i = 2; i * i <= x; i++) {
if(x % i == 0) return false;
}
return true;
}
// 進数変換 (O(log n))
template<typename T>
vector<T> convert_base(T x, T b) {
vector< T > ret;
T t = 1, k = abs(b);
while(x) {
ret.emplace_back((x * t) % k);
if(ret.back() < 0) ret.back() += k;
x -= ret.back() * t;
x /= k;
t *= b / k;
}
if(ret.empty()) ret.emplace_back(0);
reverse(begin(ret), end(ret));
return ret;
}
template<class T> inline bool chmin(T& a, T b) {
if(a > b) {
a = b;
return true;
}
return false;
}
template<class T> inline bool chmax(T& a, T b) {
if(a < b){
a = b;
return true;
}
return false;
}
int modPow(int a, int n) {
if(n == 1) return a%MOD;
if(n%2 == 1) return (a*modPow(a,n-1)) % MOD;
int t = modPow(a, n/2);
return (t*t) % MOD;
}
signed main() {
cin.tie(0);
ios::sync_with_stdio(false);
cout << fixed << setprecision(15);
// デフォルト変数定義
int n=0,m=0,a=0,b=0,c=0,d=0,x=0,y=0,z=0;
string s="",t="";
//
// ここから
int K,T;
IN2(K,T);
Vi A(T);
VIN(A)
int maxe = max(A)-1;
int sume = VSUM(A) - maxe - 1;
OUT(min(maxe-sume, 0));
}
|
a.cc: In function 'int main()':
a.cc:193:17: error: no matching function for call to 'max(std::vector<long long int>&)'
193 | int maxe = max(A)-1;
| ~~~^~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:2:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: template argument deduction/substitution failed:
a.cc:193:17: note: 'std::vector<long long int>' is not derived from 'std::initializer_list<_Tp>'
193 | int maxe = max(A)-1;
| ~~~^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate expects 2 arguments, 1 provided
a.cc:195:10: error: no matching function for call to 'min(long long int, int)'
195 | OUT(min(maxe-sume, 0));
| ~~~^~~~~~~~~~~~~~
a.cc:30:24: note: in definition of macro 'OUT'
30 | #define OUT(n) cout << n << endl
| ^
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed:
a.cc:195:10: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
195 | OUT(min(maxe-sume, 0));
| ~~~^~~~~~~~~~~~~~
a.cc:30:24: note: in definition of macro 'OUT'
30 | #define OUT(n) cout << n << endl
| ^
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed:
a.cc:195:10: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
195 | OUT(min(maxe-sume, 0));
| ~~~^~~~~~~~~~~~~~
a.cc:30:24: note: in definition of macro 'OUT'
30 | #define OUT(n) cout << n << endl
| ^
|
s445984753
|
p03958
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main(){
long long k,t;
cin >> k >> t;
long long total=0;
long long a[t];
for(int i=0;i<t;i++){
cin >> a[i];
total+=a[i];
}
sort(a,a+t);
total-=a[t-1];
cout << max(0,a[t-1]-total-1) << endl;
}
|
a.cc: In function 'int main()':
a.cc:15:16: error: no matching function for call to 'max(int, long long int)'
15 | cout << max(0,a[t-1]-total-1) << endl;
| ~~~^~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:15:16: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
15 | cout << max(0,a[t-1]-total-1) << endl;
| ~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:15:16: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
15 | cout << max(0,a[t-1]-total-1) << endl;
| ~~~^~~~~~~~~~~~~~~~~~
|
s296531080
|
p03958
|
C++
|
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define rep(i, a, n) for (int i = a; i < (n); ++i)
int main()
{
int k, t;
cin >> k >> t;
vector<int> a(n);
rep(i, 0, t) cin >> a[i];
sort(a.begin(), a.end());
rep(i, 0, t-1)
{
a[i+1] -= a[i];
}
cout << a[t-1]-1 << endl;
}
|
a.cc: In function 'int main()':
a.cc:13:23: error: 'n' was not declared in this scope
13 | vector<int> a(n);
| ^
|
s700419628
|
p03958
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main(){
int k,t,a[1];cin>>k>>t;
for(int i=0;i<t;i++){cin>>a[1];a[0]=max(a[0],a[1]);}
cout<<max(2*a-1-k,0);
}
|
a.cc: In function 'int main()':
a.cc:6:12: error: invalid operands of types 'int' and 'int [1]' to binary 'operator*'
6 | cout<<max(2*a-1-k,0);
| ~^~
| | |
| | int [1]
| int
|
s950257228
|
p03958
|
C++
|
#include <iostream>
#include <string.h>
#define inf 999999
using namespace std;
int n, m;
int main()
{
cin >> n >> m;
int x, maxim;
maxim = -1;
for(int i = 1; i <= m; i++)
{
cin >> x;
if(maxim < x) maxim = x;
}
if(maxim * t == n) cout << 0;
else cout << maxim - m;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:17:16: error: 't' was not declared in this scope
17 | if(maxim * t == n) cout << 0;
| ^
|
s488337691
|
p03958
|
C++
|
#include<bits/stdc++.h>
using namespace std;
int main(void){
int k,t;
cin >> k >> t;
int a[t];
for(int i = 0;i < n;i++)cin >> a[i];
sort(a,a+t);
if(t == 1)cout << k-1;
else if(a[t-1] - a[t-2] >= 2)cout << a[t-1] - a[t-2];
else cout << 0;
}
|
a.cc: In function 'int main()':
a.cc:8:23: error: 'n' was not declared in this scope
8 | for(int i = 0;i < n;i++)cin >> a[i];
| ^
|
s162452752
|
p03958
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main(){
int k, t;
cin >> k >> t;
vector<int> a(t);
for(int i = 0; i < t, i++){
cin >> a.at(i);
}
sort(a.rbegin(), a.rend());
int ma = a.at(0);
int za = n - ma;
if(za >= n - 1){
cout << 0;
}else{
cout << ma - 1 - za;
}
}
|
a.cc: In function 'int main()':
a.cc:8:28: error: expected ';' before ')' token
8 | for(int i = 0; i < t, i++){
| ^
| ;
a.cc:13:12: error: 'n' was not declared in this scope
13 | int za = n - ma;
| ^
|
s341997006
|
p03958
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main(){
int k, t;
cin >> k >> t;
vector<int> a(m);
for(int i = 0; i < m, i++){
cin >> a.at(i);
}
sort(a.rbegin(), a.rend());
int ma = a.at(0);
int za = n - ma;
if(za >= n - 1){
cout << 0;
}else{
cout << ma - 1 - za;
}
}
|
a.cc: In function 'int main()':
a.cc:7:17: error: 'm' was not declared in this scope
7 | vector<int> a(m);
| ^
a.cc:8:28: error: expected ';' before ')' token
8 | for(int i = 0; i < m, i++){
| ^
| ;
a.cc:13:12: error: 'n' was not declared in this scope
13 | int za = n - ma;
| ^
|
s688029132
|
p03958
|
C++
|
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x) cout << #x << " = " << (x) << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//#define int long long
void solve() {
int k, t; cin >> k >> t;
vector<int> a(t);
rep(i, t) {
cin << a[i];
if((k + 1) / 2 < a[i]) {
cout << k - ((k - a[i]) * 2 + 1) << endl;
return;
}
}
cout << 0 << endl;
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
//cout << fixed << setprecision(10);
//init();
solve();
//cout << "finish" << endl;
return 0;
}
|
a.cc: In function 'void solve()':
a.cc:56:13: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
56 | cin << a[i];
a.cc:56:13: note: candidate: 'operator<<(int, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int})' (built-in)
a.cc:56:13: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int'
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54,
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/string_view:763:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, basic_string_view<_CharT, _Traits>)'
763 | operator<<(basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/string_view:763:5: note: template argument deduction/substitution failed:
a.cc:56:19: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
56 | cin << a[i];
| ^
/usr/include/c++/14/bits/basic_string.h:4077:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
4077 | operator<<(basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4077:5: note: template argument deduction/substitution failed:
a.cc:56:19: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
56 | cin << a[i];
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:38,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/cstddef:125:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator<<(byte, _IntegerType)'
125 | operator<<(byte __b, _IntegerType __shift) noexcept
| ^~~~~~~~
/usr/include/c++/14/cstddef:125:5: note: template argument deduction/substitution failed:
a.cc:56:9: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte'
56 | cin << a[i];
| ^~~
In file included from /usr/include/c++/14/bits/ios_base.h:46:
/usr/include/c++/14/system_error:339:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const error_code&)'
339 | operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e)
| ^~~~~~~~
/usr/include/c++/14/system_error:339:5: note: template argument deduction/substitution failed:
a.cc:56:19: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
56 | cin << a[i];
| ^
/usr/include/c++/14/ostream:563:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _CharT)'
563 | operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:563:5: note: template argument deduction/substitution failed:
a.cc:56:19: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
56 | cin << a[i];
| ^
/usr/include/c++/14/ostream:573:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char)'
573 | operator<<(basic_ostream<_CharT, _Traits>& __out, char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:573:5: note: template argument deduction/substitution failed:
a.cc:56:19: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
56 | cin << a[i];
| ^
/usr/include/c++/14/ostream:579:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char)'
579 | operator<<(basic_ostream<char, _Traits>& __out, char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:579:5: note: template argument deduction/substitution failed:
a.cc:56:19: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
56 | cin << a[i];
| ^
/usr/include/c++/14/ostream:590:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char)'
590 | operator<<(basic_ostream<char, _Traits>& __out, signed char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:590:5: note: template argument deduction/substitution failed:
a.cc:56:19: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
56 | cin << a[i];
| ^
/usr/include/c++/14/ostream:595:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char)'
595 | operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:595:5: note: template argument deduction/substitution failed:
a.cc:56:19: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
56 | cin << a[i];
| ^
/usr/include/c++/14/ostream:654:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const _CharT*)'
654 | operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:654:5: note: template argument deduction/substitution failed:
a.cc:56:19: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
56 | cin << a[i];
| ^
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:307:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const char*)'
307 | operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s)
| ^~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:307:5: note: template argument deduction/substitution failed:
a.cc:56:19: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
56 | cin << a[i];
| ^
/usr/include/c++/14/ostream:671:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const char*)'
671 | operator<<(basic_ostream<char, _Traits>& __out, const char* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:671:5: note: template argument deduction/substitution failed:
a.cc:56:19: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
56 | cin << a[i];
| ^
/usr/include/c++/14/ostream:684:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const signed char*)'
684 | operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:684:5: note: template argument deduction/substitution failed:
a.cc:56:19: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
56 | cin << a[i];
| ^
/usr/include/c++/14/ostream:689:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const unsigned char*)'
689 | operator<<(basic_ostream<char, _Traits>& __out, const unsigned char* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:689:5: note: template argument deduction/substitution failed:
a.cc:56:19: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
56 | cin << a[i];
| ^
/usr/include/c++/14/ostream:810:5: note: candidate: 'template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&)'
810 | operator<<(_Ostream&& __os, const _Tp& __x)
| ^~~~~~~~
/usr/include/c++/14/ostream:810:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/ostream: In substitution of 'template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&) [with _Ostream = std::basic_istream<char>&; _Tp = int]':
a.cc:56:19: required from here
56 | cin << a[i];
| ^
/usr/include/c++/14/ostream:810:5: error: no type named 'type' in 'struct std::enable_if<false, void>'
810 | operator<<(_Ostream&& __os, const _Tp& __x)
| ^~~~~~~~
In file included from a.cc:9:
/usr/include/c++/14/iomanip:84:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _Resetiosflags)'
84 | operator<<(basic_ostream<_CharT, _Traits>& __os, _Resetiosflags __f)
| ^~~~~~~~
/usr/include/c++/14/iomanip:84:5: note: template argument deduction/substitution failed:
a.cc:56:19:
|
s044239170
|
p03958
|
Java
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int K = sc.nectInt();
int T = sc.nextInt();
int max = 0;
int sum = 0;
for (int i = 0; i < T; i++) {
int a = sc.nextInt();
max = Math.max(max, a);
sum += a;
}
int others = sum - max;
System.out.println(Math.max(max-1-others, 0));
}
}
|
Main.java:6: error: cannot find symbol
int K = sc.nectInt();
^
symbol: method nectInt()
location: variable sc of type Scanner
1 error
|
s458140372
|
p03958
|
C++
|
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a); i<(b); ++i) // a ≦ i < b
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少.
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+b,(a).begin()+c // コンテナ a の 要素 b から c へのイテレータ
#define MOD 1000000007
#define INF 1000000000
typedef pair<int64_t, int64_t> PII;
typedef vector<int64_t> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int K, T; cin >> K >> T;
VI a(T); rep(i, 0, T) cin >> a[i];
int sum = accumulate(ALL(a), 0);
int ans = 0;
rep(i, 0, T){
ans += max(0LL, a[i] - 1 - (sum - a[i]));
}
cout << ans << endl;
}
// 境界,出力文字列 チェック
// 可読性優先.高速化次点.
// まずは全探索,分割統治,次にDP
// 制限を見る
// 偶奇,逆から,ソート,出現回数,出現位置,DP, 余事象,包除
// データ構造. 問題の特徴量
// 存在判定:構成方法,入力の特徴
// gcd, lcm ,素因数分解.
// 例外を十分に含む一般化.想像力の限界
// 小さい系から例示
// 始めは過剰に例示・場合分けしてもいい.各場合を確実に対処.
// 自明な例から処理,除外.
// 小数のときは,精度の設定する.doubel 変数に数値を入力するときは 123. とする.
// テストケース作成は数表あり
|
a.cc: In function 'int main()':
a.cc:27:15: error: no matching function for call to 'max(long long int, __gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type)'
27 | ans += max(0LL, a[i] - 1 - (sum - a[i]));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:27:15: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type' {aka 'long int'})
27 | ans += max(0LL, a[i] - 1 - (sum - a[i]));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:27:15: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
27 | ans += max(0LL, a[i] - 1 - (sum - a[i]));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
s329778727
|
p03958
|
C++
|
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a); i<(b); ++i) // a ≦ i < b
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少.
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+b,(a).begin()+c // コンテナ a の 要素 b から c へのイテレータ
#define MOD 1000000007
#define INF 1000000000
typedef pair<int64_t, int64_t> PII;
typedef vector<int64_t> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int K, T; cin >> K >> T;
VI a(T); rep(i, 0, T) cin >> a[i];
int sum = accumulate(ALL(a), 0);
int ans = 0;
rep(i, 0, T){
ans += max(0ll, a[i] - 1 - (sum - a[i]));
}
cout << ans << endl;
}
// 境界,出力文字列 チェック
// 可読性優先.高速化次点.
// まずは全探索,分割統治,次にDP
// 制限を見る
// 偶奇,逆から,ソート,出現回数,出現位置,DP, 余事象,包除
// データ構造. 問題の特徴量
// 存在判定:構成方法,入力の特徴
// gcd, lcm ,素因数分解.
// 例外を十分に含む一般化.想像力の限界
// 小さい系から例示
// 始めは過剰に例示・場合分けしてもいい.各場合を確実に対処.
// 自明な例から処理,除外.
// 小数のときは,精度の設定する.doubel 変数に数値を入力するときは 123. とする.
// テストケース作成は数表あり
|
a.cc: In function 'int main()':
a.cc:27:15: error: no matching function for call to 'max(long long int, __gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type)'
27 | ans += max(0ll, a[i] - 1 - (sum - a[i]));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:27:15: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type' {aka 'long int'})
27 | ans += max(0ll, a[i] - 1 - (sum - a[i]));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:27:15: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
27 | ans += max(0ll, a[i] - 1 - (sum - a[i]));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
s772896954
|
p03958
|
C++
|
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using datas=pair<ll,ll>;
using ddatas=pair<double,double>;
using tdata=pair<ll,datas>;
using vec=vector<ll>;
using mat=vector<vec>;
using pvec=vector<datas>;
using pmat=vector<pvec>;
#define For(i,a,b) for(i=a;i<b;i++)
#define bFor(i,a,b) for(i=a;i>=b;i--)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define brep(i,N) bFor(i,N-1,0)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define endl "\n"
#define pb push_back
#define output(v) do{bool f=0;for(auto outi:v){cout<<(f?" ":"")<<outi;f=1;}cout<<endl;}while(0)
const ll mod=1000000007;
const ll inf=1LL<<60;
template<class T> inline bool chmax(T& a,T b){bool x=a<b;if(x)a=b;return x;}
template<class T> inline bool chmin(T& a,T b){bool x=a>b;if(x)a=b;return x;}
double distance(ddatas& x,ddatas& y){
double a=x.first-y.first,b=x.second-y.second;
return sqrt(a*a+b*b);
}
ll modinv(ll a) {
ll b=mod,u=1,v=0,t;
while(b){
t=a/b;
a-=t*b; swap(a,b);
u-=t*v; swap(u,v);
}
return (u+mod)%mod;
}
ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}
vec modncrlistp,modncrlistm;
ll modncr(ll n,ll r){
ll i,size=modncrlistp.size();
if(size<=n){
modncrlistp.resize(n+1);
modncrlistm.resize(n+1);
if(!size){
modncrlistp[0]=modncrlistm[0]=1;
size++;
}
For(i,size,n+1){
modncrlistp[i]=modncrlistp[i-1]*i%mod;
modncrlistm[i]=modinv(modncrlistp[i]);
}
}
return modncrlistp[n]*modncrlistm[r]%mod*modncrlistm[n-r]%mod;
}
ll modpow(ll a,ll n){
ll res=1;
while(n){
if(n&1)res=res*a%mod;
a=a*a%mod;
n>>=1;
}
return res;
}
ll gcd(ll a,ll b){if(!b)return a;return (a%b==0)?b:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll countdigits(ll n){
ll ans=0;
while(n){n/=10;ans++;}
return ans;
}
ll sumdigits(ll n){
ll ans=0;
while(n){ans+=n%10;n/=10;}
return ans;
}
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
ll i,N,T,ans=0;
cin>>N>>T;
vec v(T);
rep(i,T)cin>>v[i];
v.pb(0);
vrsort(v);
while(v[1]!=0){
v[0]--;
v[1]--;
vrsort(v);
}
cout<<max(v[0]-1,0LL)<<endl;
return 0;
|
a.cc: In function 'int main()':
a.cc:105:12: error: expected '}' at end of input
105 | return 0;
| ^
a.cc:90:11: note: to match this '{'
90 | int main(){
| ^
|
s711774090
|
p03958
|
C++
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int N, T;
priority_queue<int> pq;
int main() {
cin >> N >> T;
for (int i = 0; i < T; i++) {
int a;
cin >> a;
pq.push(a);
}
int a_top = pq.top();
cout << max(a_top − 1 − (K − a_top), 0) << endl;
return 0;
}
|
a.cc:18:23: error: extended character − is not valid in an identifier
18 | cout << max(a_top − 1 − (K − a_top), 0) << endl;
| ^
a.cc:18:27: error: extended character − is not valid in an identifier
18 | cout << max(a_top − 1 − (K − a_top), 0) << endl;
| ^
a.cc:18:32: error: extended character − is not valid in an identifier
18 | cout << max(a_top − 1 − (K − a_top), 0) << endl;
| ^
a.cc: In function 'int main()':
a.cc:18:22: error: expected ')' before '\U00002212'
18 | cout << max(a_top − 1 − (K − a_top), 0) << endl;
| ~ ^~
| )
|
s675128872
|
p03958
|
C++
|
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
int main(void){
int K,T;
cin >> K >> T;
vector<int>a(T);
for(int i=0;i<T;i++){
cin >> a[i];
}
int max = 0;
for(int i=0;i<T;i++){
if(max < a[i]) max = a[i];
}
cout << max(max - 1 - (K - max) , 0) << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:20:14: error: 'max' cannot be used as a function
20 | cout << max(max - 1 - (K - max) , 0) << endl;
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~
|
s396765582
|
p03958
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main () {
int K, T;
cin >> K >> T;
int a, m = 0;
for(int i = 0; i < N; i++){
cin >> a;
m = max(m, a);
}
if(m - 1 <= K - m)cout << 0 << endl;
else cout << m - 1 - K + m;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:7:22: error: 'N' was not declared in this scope
7 | for(int i = 0; i < N; i++){
| ^
|
s674369802
|
p03958
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main () {
int K, T;
cin >> K >> T;
int a, m = 0;
for(int i = 0; i < N; i++){
cin >> a;
m = max(m, a);
}
if(m - 1 =< K - m)cout << 0 << endl;
else cout << m - 1 - K + m;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:7:22: error: 'N' was not declared in this scope
7 | for(int i = 0; i < N; i++){
| ^
a.cc:11:13: error: expected primary-expression before '<' token
11 | if(m - 1 =< K - m)cout << 0 << endl;
| ^
|
s197198481
|
p03958
|
C++
|
#include <iostream>
using namespace std;
int main(){
int n,k;
cin >> n>>k;
int m=0,t;
for(i=0;i<k;i++){
cin >> t;
m = max(t,m);
}
cout << max(m-1-n+m,0)<<endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:9:7: error: 'i' was not declared in this scope
9 | for(i=0;i<k;i++){
| ^
|
s653279783
|
p03958
|
C++
|
#include<iostream>
#include<vector>
using namespace std;
int main(){
int k,t;
cin>>k>>t;
int MAX=0;
for(int i=0;i<t;i++){
int a;cin>>a;
if(MAX<a) MAX=a;
}
int ans=2*MAX-K-1;
if(ans<0) cout<<0<<endl;
else cout<<ans<<endl;
}
|
a.cc: In function 'int main()':
a.cc:12:17: error: 'K' was not declared in this scope
12 | int ans=2*MAX-K-1;
| ^
|
s900356523
|
p03958
|
C++
|
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<queue>
#include<math.h>
#include<complex>
using namespace std;
//ユークリッドの互除法 a,bは最大公約数を求めたい2つの数
long long int gcd(long long int a, long long int b) {
long long int tmp;
long long int r = 1;
if (b > a) {
tmp = a;
a = b;
b = tmp;
}
r = a % b;
while (r != 0) {
a = b;
b = r;
r = a % b;
}
return b;
}
const long long int mod=1000000007;
int main(){
//cout << fixed << setprecision(10);
long long int k,t,a[2000];
string str,str2;
cin>>k>>t;
for(int i=0;i<t;i++){
cin>>a[i];
}
sort(a,a+t);
cout<<max(2*a[t-1]-k,1LL)-1<<endl;
}
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<queue>
#include<math.h>
#include<complex>
using namespace std;
//ユークリッドの互除法 a,bは最大公約数を求めたい2つの数
long long int gcd(long long int a, long long int b) {
long long int tmp;
long long int r = 1;
if (b > a) {
tmp = a;
a = b;
b = tmp;
}
r = a % b;
while (r != 0) {
a = b;
b = r;
r = a % b;
}
return b;
}
const long long int mod=1000000007;
int main(){
//cout << fixed << setprecision(10);
long long int k,t,a[2000];
string str,str2;
cin>>k>>t;
for(int i=0;i<t;i++){
cin>>a[i];
}
sort(a,a+t);
cout<<max(2*a[t-1]-k,1LL)-1<<endl;
}
|
a.cc:67:15: error: redefinition of 'long long int gcd(long long int, long long int)'
67 | long long int gcd(long long int a, long long int b) {
| ^~~
a.cc:18:15: note: 'long long int gcd(long long int, long long int)' previously defined here
18 | long long int gcd(long long int a, long long int b) {
| ^~~
a.cc:87:21: error: redefinition of 'const long long int mod'
87 | const long long int mod=1000000007;
| ^~~
a.cc:38:21: note: 'const long long int mod' previously defined here
38 | const long long int mod=1000000007;
| ^~~
a.cc:88:5: error: redefinition of 'int main()'
88 | int main(){
| ^~~~
a.cc:39:5: note: 'int main()' previously defined here
39 | int main(){
| ^~~~
|
s788254431
|
p03958
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int tori(int n) {
int k. t;
cin >> k >> t;
int a[t];
for(int i = 0; i < t; i++) {
cin >> a[i];
cout << max(a[i] - 1 - (k - a[i]), 0) << endl;
}
return 0;
}
|
a.cc: In function 'int tori(int)':
a.cc:5:8: error: expected initializer before '.' token
5 | int k. t;
| ^
a.cc:6:10: error: 'k' was not declared in this scope
6 | cin >> k >> t;
| ^
a.cc:6:15: error: 't' was not declared in this scope
6 | cin >> k >> t;
| ^
a.cc:9:12: error: 'a' was not declared in this scope
9 | cin >> a[i];
| ^
|
s271696465
|
p03958
|
C++
|
#include<bits/stdc++.h>
using namespace std;
int main(){
int k,t;
cin >>k >>t;
int a[k];
for(int i=0;i<t;i++)cin >>a[i];
sort(a,a+t);
int ans=a[t-1];
cout <<max(K-2*ans-1,0)<<endl;
}
|
a.cc: In function 'int main()':
a.cc:10:14: error: 'K' was not declared in this scope
10 | cout <<max(K-2*ans-1,0)<<endl;
| ^
|
s747930616
|
p03958
|
C++
|
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
#define pb(a) push_back(a)
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
typedef vector<unsigned int>vec;
typedef vector<vec> mat;
//typedef tuple<ll, ll, ll> T;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
void add(ll& a, ll b){a = (a+b) % MOD;}
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int k,t;
cin>>k>>t;
int ans=0;
REP(i,t){
int a;
cin>>a;
if(a-t>0) max(ans,a-t)
}
cout<<ans<<endl;
}
|
a.cc: In function 'int main()':
a.cc:36:31: error: expected ';' before '}' token
36 | if(a-t>0) max(ans,a-t)
| ^
| ;
37 | }
| ~
a.cc:36:22: warning: ignoring return value of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&) [with _Tp = int]', declared with attribute 'nodiscard' [-Wunused-result]
36 | if(a-t>0) max(ans,a-t)
| ~~~^~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: declared here
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
|
s138547693
|
p03958
|
C++
|
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> pll;
#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)
const ll MOD = 1000000007;
const ll INF = (ll)1e15;
ll A[105];
int main()
{
ll K, T;
cin >> K >> T;
int max = 0;
REP(i, T)
{
cin >> A[i];
max = std::max(max, A[i]);
}
cout << std::max(0LL, 2 * max - K - 1) << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:24:23: error: no matching function for call to 'max(int&, ll&)'
24 | max = std::max(max, A[i]);
| ~~~~~~~~^~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
24 | max = std::max(max, A[i]);
| ~~~~~~~~^~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
24 | max = std::max(max, A[i]);
| ~~~~~~~~^~~~~~~~~~~
|
s366552641
|
p03958
|
C++
|
#include <iostream>
#define REP(i, n) for(int i = 0; i < n; i++)
using namespace std;
int main()
{
int K, T;
cin >> K >> T;
int ma = -1;
REP(i, T) {
int a;
cin >> a;
ma = max(a, ma);
}
cout << ma(ma - 1 - (K - ma), 0) << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:14:13: error: 'ma' cannot be used as a function
14 | cout << ma(ma - 1 - (K - ma), 0) << endl;
| ~~^~~~~~~~~~~~~~~~~~~~~~
|
s324551948
|
p03958
|
C++
|
#include <iostream>
#define REP(i, n) for(int i = 0; i < n; i++)
using namespace std;
int main()
{
int K, T;
cin >> K >> T;
int ma = -1;
REP(i, N) {
int a;
cin >> a;
ma = max(a, ma);
}
cout << ma(ma - 1 - (K - ma), 0) << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:9:10: error: 'N' was not declared in this scope
9 | REP(i, N) {
| ^
a.cc:2:38: note: in definition of macro 'REP'
2 | #define REP(i, n) for(int i = 0; i < n; i++)
| ^
a.cc:14:13: error: 'ma' cannot be used as a function
14 | cout << ma(ma - 1 - (K - ma), 0) << endl;
| ~~^~~~~~~~~~~~~~~~~~~~~~
|
s881063494
|
p03958
|
C++
|
#include <ios>
#include <iomanip>
#include <iostream>
#include <functional>
#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>
#include <climits>
using namespace std;
typedef long long int ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)
#define PI (acos(-1))
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
typedef pair <ll,ll> P;
ll nCrModp(ll n, ll r, ll p)
{
ll C[r+1];
memset(C, 0, sizeof(C));
C[0] = 1;
for (ll i = 1; i <= n; i++)
{
for (ll j = min(i, r); j > 0; j--)
C[j] = (C[j] + C[j-1])%p;
}
return C[r];
}
int main()
{
ll K, T;
cin >> K >> T;
vector<ll> a(T);
rep(i, T) cin >> a[i];
ll ma = *max_element(all(a));
print(max(ma - 1 - (K-ma),(ll)0));
return 0;
}
#include <ios>
#include <iomanip>
#include <iostream>
#include <functional>
#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>
#include <climits>
using namespace std;
typedef long long int ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)
#define PI (acos(-1))
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
typedef pair <ll,ll> P;
ll nCrModp(ll n, ll r, ll p)
{
ll C[r+1];
memset(C, 0, sizeof(C));
C[0] = 1;
for (ll i = 1; i <= n; i++)
{
for (ll j = min(i, r); j > 0; j--)
C[j] = (C[j] + C[j-1])%p;
}
return C[r];
}
int main()
{
ll K, T;
cin >> K >> T;
vector<ll> a(T);
rep(i, T) cin >> a[i];
ll ma = *max_element(all(a));
print(max(ma - 1 - (K-ma),(ll)0));
return 0;
}
|
a.cc:96:4: error: redefinition of 'll gcd(ll, ll)'
96 | ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
| ^~~
a.cc:34:4: note: 'll gcd(ll, ll)' previously defined here
34 | ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
| ^~~
a.cc:97:4: error: redefinition of 'll lcm(ll, ll)'
97 | ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
| ^~~
a.cc:35:4: note: 'll lcm(ll, ll)' previously defined here
35 | ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
| ^~~
a.cc:100:4: error: redefinition of 'll nCrModp(ll, ll, ll)'
100 | ll nCrModp(ll n, ll r, ll p)
| ^~~~~~~
a.cc:38:4: note: 'll nCrModp(ll, ll, ll)' previously defined here
38 | ll nCrModp(ll n, ll r, ll p)
| ^~~~~~~
a.cc:115:5: error: redefinition of 'int main()'
115 | int main()
| ^~~~
a.cc:53:5: note: 'int main()' previously defined here
53 | int main()
| ^~~~
|
s214587946
|
p03958
|
C++
|
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;
#define RET(ans) {cout<<ans<<endl;return 0;}
// 二次元ベクターの基本
/*
vector<vector<int>> dp; // 宣言
dp.resize(n); // 1次元めの要素数決定
dp[i].push_back(int); // プッシュバック
rep(i,n){
sort(dp[i].begin(),dp[i].end()); // 二次元めを昇順ソート
}
*/
// 整数スキャン(複数)
/*
int x,y,z;
scanf("%d%d%d",&x,&y,&z);
// n個の整数のスキャン
/*
ll a[n] = {};
rep(i,n){
scanf("%lld",&a[i]);
}
*/
// 文字列スキャン
/*
string s; cin >> s;
*/
// n個の文字列スキャン
/*
vector<string> slist;
rep(i,n){
string s; cin >> s;
slist.push_back(s);
}
*/
int main() {
int k,t;
cin >> k >> t;
ll a[t] = {};
rep(i,t){
scanf("%lld",&a[i]);
}
sort(a,a+t);
int ans = 0;
int sum = 0;
rep(i,t-1){
sum += a[i];
}
ans = max(0,a[t-1]-sum-1);
cout << ans << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:107:14: error: no matching function for call to 'max(int, ll)'
107 | ans = max(0,a[t-1]-sum-1);
| ~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:107:14: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
107 | ans = max(0,a[t-1]-sum-1);
| ~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:107:14: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
107 | ans = max(0,a[t-1]-sum-1);
| ~~~^~~~~~~~~~~~~~~~
|
s968731398
|
p03958
|
C++
|
#define debug_interval ','
#define dump_interval ' '
#define debug_toggle 1
//{
#pragma GCC optimize ("O3","unroll-loops")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
#define hi cerr<<"hi"<<endl;
#define int long long
#define INT_MAX LLONG_MAX
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define fi first
#define se second
#define mp make_pair
#define rev reverse
#define dans dump(ans)
#define MOD 1000000007
#define amp(v,n) (v).count(n)?v[n]++:v[n]=1
#define sysp system("pause")
#define PI acos(-1)
//{
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class...A> inline void dump(){cout<<endl;}
template<class...A> inline void dump_rest() {cout<<endl;}
template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);}
template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);}
template<class...A> inline void debug(){cerr<<endl;}
template<class...A> inline void debug_rest() {cerr<<endl;}
template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cerr<<debug_interval<<first;debug_rest(rest...);}
template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cerr<<first,debug_rest(rest...);}
//}
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
template<int m>class mint{private:int i;public:mint() : i(0){}mint(int i): i((i%m+m)%m){}mint operator+(const mint& o){return o.i+i;}mint operator*(const mint& o){return o.i*i;}mint operator-(){return -i;}operator int() {return i;}};
//}
main(){
int n,k;
cin>>n>>k;
int a[k];
rep(i,k)cin>>a[i];
sort(a,a+n);rev(a,a+n);
int t=0;
for(int i-1;i<n;i++)t+=a[i];
dump(max(a[0]-t-1,0));
}
|
a.cc:12:9: warning: "INT_MAX" redefined
12 | #define INT_MAX LLONG_MAX
| ^~~~~~~
In file included from /usr/include/c++/14/climits:42,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:38,
from a.cc:8:
/usr/lib/gcc/x86_64-linux-gnu/14/include/limits.h:120:9: note: this is the location of the previous definition
120 | #define INT_MAX __INT_MAX__
| ^~~~~~~
a.cc:51:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
51 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:58:18: error: expected ';' before '-' token
58 | for(int i-1;i<n;i++)t+=a[i];
| ^
| ;
a.cc:58:24: error: expected ')' before ';' token
58 | for(int i-1;i<n;i++)t+=a[i];
| ~ ^
| )
a.cc:58:25: error: 'i' was not declared in this scope
58 | for(int i-1;i<n;i++)t+=a[i];
| ^
a.cc:59:17: error: no matching function for call to 'max(long long int, int)'
59 | dump(max(a[0]-t-1,0));
| ~~~^~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:59:17: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
59 | dump(max(a[0]-t-1,0));
| ~~~^~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:59:17: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
59 | dump(max(a[0]-t-1,0));
| ~~~^~~~~~~~~~~~
|
s410805188
|
p03958
|
C++
|
#include <iostream>
#include <vector>
#include <math.h>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <regex>
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using dbl = double;
using pii = pair<int, int>;
using pl4 = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using vvs = vector<vs>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vpii = vector<pii>;
using vvpii = vector<vpii>;
using vpl4 = vector<pl4>;
using vvpl4 = vector<vpl4>;
using vd = vector<dbl>;
using vvd = vector<vd>;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pob pop_back()
#define sz size()
#define be begin()
#define en end()
#define asn assign
#define emp empty()
#define ft front()
#define bk back()
#define clr clear()
#define ins insert
#define ers erase
#define res resize
#define tp top()
#define p_q priority_queue
#define REP(i,a) for(int i=0;i<(a);i++)
#define REP1(i,a) for(int i=1;i<=(a);i++)
#define rREP(i,a) for(int i=(a-1);i>=0;i--)
#define rREP1(i,a) for(int i=(a);i>0;i--)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define rFOR(i,a,b) for(int i=(b);i>=(a);i--)
#define ROR(v,i) for(auto &(i):(v))
#define IOTA(a,n) iota((a).be,(a).en,(n))
#define SORT(a) sort((a).be,(a).en)
#define rSORT(a) sort((a).rbegin(),(a).rend())
#define UNIQUE(a) (a).erase(unique((a).be,(a).en),(a).en)
#define PREVP(a) prev_permutation((a).be,(a).en)
#define NEXTP(a) next_permutation((a).be,(a).en)
#define BINS(a,b) binary_search((a).be,(a).en,(b))
#define LOWB(a,b) (lower_bound((a).be,(a).en,(b))-(a).be)
#define UPB(a,b) (upper_bound((a).be,(a).en,(b))-(a).be)
#define CNT(a,b) count((a).be,(a).en,b)
#define SUM(a) accumulate((a).be,(a).en,0)
#define REV(a) reverse((a).be,(a).en)
#define REGS(a,b) regex_search((a),regex(b))
#define REGM(a,b) regex_match((a),regex(b))
#define yn(a) cout <<((a)?"yes":"no")<<endl;
#define Yn(a) cout <<((a)?"Yes":"No")<<endl;
#define YN(a) cout <<((a)?"YES":"NO")<<endl;
#define Imp(a) cout <<((a)?"Possible":"Impossible")<<endl;
#define say(a) cout <<(a);
#define sal(a) cout <<(a)<<endl;
#define sak cout <<endl;
#define sas cout <<" ";
#define sat cout <<"\t";
#define dbg(a) cout <<(#a)<<": "<<(a)<<endl;
#define c2l(a) ((ll)(a-48))
#define a2l(a) ((ll)(a-97))
#define A2l(a) ((ll)(a-65))
#define l2c(a) ((char)(a+48))
#define l2a(a) ((char)(a+97))
#define l2A(a) ((char)(a+65))
#define DigN2(a) ((llabs(a)==0)?(1):((ll)(log2(double(llabs(a))))+1))
#define DigN10(a) ((llabs(a)==0)?(1):((ll)(log10(double(llabs(a))))+1))
#define Dig2(a,b) (((a)>>(b))&1)
#define Dig10(a,b) (ll)(((a)/((ll)(pow(10.0,(double)(b)))))%10)
#define Pow2(a) (1<<(a))
#define Pow10(a) ((ll)(pow(10.0,double(a))))
#define llin(a) ll (a);cin >>(a);
#define stin(a) string (a);cin >>(a);
#define vin(v) ROR((v),(i)){cin >>(i);};
#define vllin(v,N) vll (v)((N));vin(v);
#define vsin(v,N) vs (v)((N));vin(v);
#define rdn(a,b) ((a)/(b))
#define rou(a,b) ((((double(a)/double(b))-((a)/(b)))<0.5)?((a)/(b)):(((a)/(b))+1))
#define rup(a,b) ((((a)%(b))==0)?((a)/(b)):(((a)/(b))+1))
#define min(a,b) ((a<b)?(a):(b))
#define max(a,b) ((a>b)?(a):(b))
#define powll(a,b) (ll)(pow((double)(a),(double)(b)))
#define Triangle(x1,y1,x2,y2,x3,y3) (((x1)-(x2))*((y1)-(y3))-((x1)-(x3))*((y1)-(y2)))
#define int ll
const ll MOD = 1e9 + 7;
const ll N = 1e5 + 20;
//const ll MOD = 998244353;
//const ll MOD = 9007199254740881;
const ll INF = 1LL << 60;
const string alp = "abcdefghijklmnopqrstuvwxyz";
const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
ll gcd(ll a, ll b) { if (b == 0)return a; return gcd(b, a%b); }
ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
ll inverse[N];
void init_inverse() {
inverse[1] = 1;
for (int i = 2; i < N; i++) inverse[i] = (MOD - MOD / i) * inverse[MOD%i] % MOD;
}
pl4 Bezout(ll a, ll b) {
if (b != 0) {
pl4 xy;
xy = Bezout(b, a%b);
return mp(xy.se, xy.fi - ((a / b)*xy.se));
}
if (b == 0) {
return mp(1, 0);
}
}
pl4 Bez(ll a, ll b, ll c) {
pl4 xy;
ll x, y, z, gc;
xy = Bezout(a, b);
gc = gcd(a, b);
if (c%gc != 0) return mp(-1, -1);
x = xy.fi*(c / gc); y = xy.se*(c / gc);
if (x < 0) z = rup(-x, (b / gc));
if (x >= 0) z = -x / (b / gc);
x += z * (b / gc);
y -= z * (a / gc);
return mp(x, y);
}
void salv(vll v) {
say("{");
FOR(i, 0, v.sz - 1) {
say(v[i]);
if (i != v.sz - 1) say(",");
}
sal("}")
}
ll DigS10(ll n) {
ll m = 0;
FOR(i, 0, DigN10(n) - 1) {
m += (ll)((llabs(n) % (ll)(pow(10.0, (double)(i + 1)))) / (ll)(pow(10.0, (double)i)));
}
return m;
}
ll isP(ll n) {
if (n <= 1) return 0;
FOR(i, 2, (ll)sqrt(n)) {
if (n%i == 0) return 0;
}
return 1;
}
vll FactM(1, 1);
vll FactMI(1, 1);
ll PowM(ll a, ll b) {
ll ans = 1, x = (a%MOD);
FOR(i, 0, DigN2(b) - 1) {
if (Dig2(b, i) == 1) ans = (ans*x) % MOD;
if (i != (DigN2(b) - 1)) x = (x*x) % MOD;
}
return ans;
}
void CFactM(ll n) {
if (FactM.sz <= n) {
FOR(i, FactM.sz, n) {
FactM.pb((FactM[i - 1] * (i%MOD)) % MOD);
}
}
return;
}
void CFactMI(ll n) {
CFactM(n);
if (FactMI.sz < (n + 1)) FactMI.res(n + 1, -1);
if (FactMI[n] == -1) FactMI[n] = PowM(FactM[n], MOD - 2);
rFOR(i, 1, n - 1) {
if (FactMI[i] != -1) break;
FactMI[i] = ((FactMI[i + 1] * ((i + 1) % MOD)) % MOD);
}
return;
}
ll CombM(ll n, ll k) {
if ((n < 0) || (k < 0)) return 0;
if (n < k) return 0;
if (n + 1 > FactMI.sz) CFactMI(n);
return ((((FactMI[k] * FactMI[n - k]) % MOD)*FactM[n]) % MOD);
}
ll LIS(vll v, ll m) {
if (v.sz > 0) {
ll ans = 0;
vll dp(v.sz, INF);
FOR(i, 0, v.sz - 1) {
dp[m ? UPB(dp, v[i]) : LOWB(dp, v[i])] = v[i];
}
FOR(i, 0, v.sz - 1) {
if (dp[i] == INF) break;
ans++;
}
return ans;
}
else {
return 0;
}
}
signed main() {
ll k,t;
vll a;
cin >> k >> t;
REP(i,t){
cin >> aa;
a.pb(aa);
}
SORT(a);
cout << max(a[t-1]-1-(k-a[t-1]),0);
return 0;
}
|
a.cc: In function 'int main()':
a.cc:239:12: error: 'aa' was not declared in this scope; did you mean 'a'?
239 | cin >> aa;
| ^~
| a
a.cc: In function 'pl4 Bezout(ll, ll)':
a.cc:137:1: warning: control reaches end of non-void function [-Wreturn-type]
137 | }
| ^
|
s425063510
|
p03958
|
C++
|
#include<bits/stdc++.h>
using namespace std;
signed main(){
int K,T;
cin>>K>>T;
vint C(T);
rep(i,T)cin>>C[i];
rep(i,T){
if(C[i]*2-1<=K)continue;
int t=C[i]-(K+1)/2;
cout<<t*2-(K%2==0)<<endl;
return 0;
}
cout<<0<<endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:6:5: error: 'vint' was not declared in this scope; did you mean 'uint'?
6 | vint C(T);
| ^~~~
| uint
a.cc:7:9: error: 'i' was not declared in this scope
7 | rep(i,T)cin>>C[i];
| ^
a.cc:7:5: error: 'rep' was not declared in this scope
7 | rep(i,T)cin>>C[i];
| ^~~
|
s369544798
|
p03958
|
C++
|
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
int k, t;
cin >> k >> t;
vector<int> a(t);
for(int i = 0; i < t; i++) cin >> a[i];
sort(a, a+t);
int sum = a[t-1];
for(int i = 0; i < t-1; i++) sum -= a[i];
cout << max(0, sum-1) << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:12:18: error: no match for 'operator+' (operand types are 'std::vector<int>' and 'int')
12 | sort(a, a+t);
| ~^~
| | |
| | int
| std::vector<int>
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:627:5: note: candidate: 'template<class _Iterator> constexpr std::reverse_iterator<_Iterator> std::operator+(typename reverse_iterator<_Iterator>::difference_type, const reverse_iterator<_Iterator>&)'
627 | operator+(typename reverse_iterator<_Iterator>::difference_type __n,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:627:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
12 | sort(a, a+t);
| ^
/usr/include/c++/14/bits/stl_iterator.h:1798:5: note: candidate: 'template<class _Iterator> constexpr std::move_iterator<_IteratorL> std::operator+(typename move_iterator<_IteratorL>::difference_type, const move_iterator<_IteratorL>&)'
1798 | operator+(typename move_iterator<_Iterator>::difference_type __n,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1798:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
12 | sort(a, a+t);
| ^
In file included from /usr/include/c++/14/string:54:
/usr/include/c++/14/bits/basic_string.h:3598:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3598 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3598:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
12 | sort(a, a+t);
| ^
/usr/include/c++/14/bits/basic_string.h:3616:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3616 | operator+(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3616:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: mismatched types 'const _CharT*' and 'std::vector<int>'
12 | sort(a, a+t);
| ^
/usr/include/c++/14/bits/basic_string.h:3635:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3635 | operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3635:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
12 | sort(a, a+t);
| ^
/usr/include/c++/14/bits/basic_string.h:3652:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3652 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3652:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
12 | sort(a, a+t);
| ^
/usr/include/c++/14/bits/basic_string.h:3670:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, _CharT)'
3670 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3670:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
12 | sort(a, a+t);
| ^
/usr/include/c++/14/bits/basic_string.h:3682:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3682 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3682:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: 'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
12 | sort(a, a+t);
| ^
/usr/include/c++/14/bits/basic_string.h:3689:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
3689 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3689:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
12 | sort(a, a+t);
| ^
/usr/include/c++/14/bits/basic_string.h:3696:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
3696 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3696:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: 'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
12 | sort(a, a+t);
| ^
/usr/include/c++/14/bits/basic_string.h:3719:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
3719 | operator+(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3719:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: mismatched types 'const _CharT*' and 'std::vector<int>'
12 | sort(a, a+t);
| ^
/usr/include/c++/14/bits/basic_string.h:3726:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
3726 | operator+(_CharT __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3726:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
12 | sort(a, a+t);
| ^
/usr/include/c++/14/bits/basic_string.h:3733:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const _CharT*)'
3733 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3733:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: 'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
12 | sort(a, a+t);
| ^
/usr/include/c++/14/bits/basic_string.h:3740:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, _CharT)'
3740 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3740:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: 'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
12 | sort(a, a+t);
| ^
|
s394029803
|
p03958
|
C++
|
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <stdio.h>
using namespace std;
using ll =long long;
int main (void) {
int K,T;
cin >> K >>T ;
int a[T];
int max=0;
int sum=0;
for (int i=0;i<T;i++){
cin >> a[i];
if(a[i]>max){
max=a[i];
}
}
int ans=0;
ans=max(ans,K-max-1);
cout << ans;
}
|
a.cc: In function 'int main()':
a.cc:26:10: error: 'max' cannot be used as a function
26 | ans=max(ans,K-max-1);
| ~~~^~~~~~~~~~~~~
|
s022026009
|
p03958
|
C++
|
#include <bits/stdc++.h>
using namespace std;
using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;
using msi=map<string,int>;
using mii=map<int,int>;
//using pii=pair<int,int>;
using vlai=valarray<int>;
using ll=long long;
using pii=pair<ll,ll>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1e9
#define EPS 1e-9
#define MOD (1e9+7)
void get(){}template<class H,class...T>void get(H&h,T&...t){cin>>h;get(t...);}
#define dcl(...) ll __VA_ARGS__;get(__VA_ARGS__);
int main(){
dcl(k,t);
vi c(t);
rep(i,t)cin>>c[i];
sort(rall(c));
cout<<max(c[0]*2-k-1,0)<<endl;
}
|
a.cc: In function 'int main()':
a.cc:34:14: error: no matching function for call to 'max(ll, int)'
34 | cout<<max(c[0]*2-k-1,0)<<endl;
| ~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:2:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:34:14: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
34 | cout<<max(c[0]*2-k-1,0)<<endl;
| ~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:34:14: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
34 | cout<<max(c[0]*2-k-1,0)<<endl;
| ~~~^~~~~~~~~~~~~~
|
s692430859
|
p03958
|
C++
|
#include<bits/stdc++.h>
using namespace std;
const long long INF = (1LL << 32);
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef vector<ll> vi;
typedef vector<pair<ll, ll>> vp;
typedef vector<string> vs;
typedef vector<char> vc;
typedef list<ll> lst;
typedef pair<ll, ll> P;
ll n, m, k, ans = 0, sum = 0, cnt = 0;
string s;
char c;
#define Endl endl
/*--------------------template--------------------*/
int main() {
cin >> m >> n;
vi v(n);
REP(i,n) {
cin >> v[i];
}
REP(i,n){
ll a = 2 * v[i] - 1 - m;
vv.push_back(a);
}
vv.push_back(sum);
sort(ALL(vv));
cout << vv.back() << endl;
}
|
a.cc: In function 'int main()':
a.cc:37:9: error: 'vv' was not declared in this scope; did you mean 'v'?
37 | vv.push_back(a);
| ^~
| v
a.cc:39:5: error: 'vv' was not declared in this scope; did you mean 'v'?
39 | vv.push_back(sum);
| ^~
| v
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.