submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s180126144
p03705
C++
use std::io; fn next_vec() -> Vec<i64> { let mut buf = String::new(); io::stdin().read_line(&mut buf).unwrap(); buf.split_whitespace().map(|n| n.parse().unwrap()).collect() } fn main() { let v = next_vec(); let n = v[0]; let a = v[1]; let b = v[2]; let minimum = a * (n - 1) + b; let maximum = a + b * (n - 1); let ans = maximum - minimum + 1; println!("{:?}", if ans < 0 {0} else {ans}); }
a.cc:1:1: error: 'use' does not name a type 1 | use std::io; | ^~~ a.cc:3:1: error: 'fn' does not name a type 3 | fn next_vec() -> Vec<i64> { | ^~ a.cc:9:1: error: 'fn' does not name a type 9 | fn main() { | ^~
s207306486
p03705
C++
#include <bits/stdc++.h> #include<iostream> #include<cstdio> #include<vector> #include<queue> #include<map> #include<cstring> #include<string> #include <math.h> #include<algorithm> // #include <boost/multiprecision/cpp_int.hpp> #include<functional> #define int long long #define inf 1000000007 #define pa pair<int,int> #define ll long long #define pal pair<double,pa> #define ppa pair<int,int> #define ppap pair<int,pa> #define ssa pair<string,int> #define mp make_pair #define pb push_back #define EPS (1e-10) #define equals(a,b) (fabs((a)-(b))<EPS) using namespace std; class Point{ public: double x,y; Point(double x=0,double y=0):x(x),y(y) {} Point operator + (Point p) {return Point(x+p.x,y+p.y);} Point operator - (Point p) {return Point(x-p.x,y-p.y);} Point operator * (double a) {return Point(x*a,y*a);} Point operator / (double a) {return Point(x/a,y/a);} double absv() {return sqrt(norm());} double norm() {return x*x+y*y;} bool operator < (const Point &p) const{ return x != p.x ? x<p.x: y<p.y; } bool operator == (const Point &p) const{ return fabs(x-p.x)<EPS && fabs(y-p.y)<EPS; } }; typedef Point Vector; struct Segment{ Point p1,p2; }; double dot(Vector a,Vector b){ return a.x*b.x+a.y*b.y; } double cross(Vector a,Vector b){ return a.x*b.y-a.y*b.x; } bool parareru(Point a,Point b,Point c,Point d){ // if(abs(cross(a-b,d-c))<EPS)cout<<"dd "<<cross(a-b,d-c)<<endl; return abs(cross(a-b,d-c))<EPS; } double distance_ls_p(Point a, Point b, Point c) { if ( dot(b-a, c-a) < EPS ) return (c-a).absv(); if ( dot(a-b, c-b) < EPS ) return (c-b).absv(); return abs(cross(b-a, c-a)) / (b-a).absv(); } bool is_intersected_ls(Segment a,Segment b) { if(a.p1==b.p1||a.p2==b.p1||a.p1==b.p2||a.p2==b.p2) return false; if(parareru((a.p2),(a.p1),(a.p1),(b.p2))&&parareru((a.p2),(a.p1),(a.p1),(b.p1))){ // cout<<"sss"<<endl; if(dot(a.p1-b.p1,a.p1-b.p2)<EPS) return true; if(dot(a.p2-b.p1,a.p2-b.p2)<EPS) return true; if(dot(a.p1-b.p1,a.p2-b.p1)<EPS) return true; if(dot(a.p1-b.p2,a.p2-b.p2)<EPS) return true; return false; } else return ( cross(a.p2-a.p1, b.p1-a.p1) * cross(a.p2-a.p1, b.p2-a.p1) < EPS ) && ( cross(b.p2-b.p1, a.p1-b.p1) * cross(b.p2-b.p1, a.p2-b.p1) < EPS ); } double segment_dis(Segment a,Segment b){ if(is_intersected_ls(a,b))return 0; double r=distance_ls_p(a.p1, a.p2, b.p1); r=min(r,distance_ls_p(a.p1, a.p2, b.p2)); r=min(r,distance_ls_p(b.p1, b.p2, a.p2)); r=min(r,distance_ls_p(b.p1, b.p2, a.p1)); return r; } Point intersection_ls(Segment a, Segment b) { Point ba = b.p2-b.p1; double d1 = abs(cross(ba, a.p1-b.p1)); double d2 = abs(cross(ba, a.p2-b.p1)); double t = d1 / (d1 + d2); return a.p1 + (a.p2-a.p1) * t; } string itos( int i ) { ostringstream s ; s << i ; return s.str() ; } int gcd(int v,int b){ if(v>b) return gcd(b,v); if(v==b) return b; if(b%v==0) return v; return gcd(v,b%v); } double distans(double x1,double y1,double x2,double y2){ double rr=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2); return sqrt(rr); } /* int pr[100010]; //int inv[100010]; */ int beki(int wa,int rr,int warukazu){ if(rr==0) return 1ll; if(rr==1) return wa%warukazu; if(rr%2==1) return (beki(wa,rr-1,warukazu)*wa)%warukazu; int zx=beki(wa,rr/2,warukazu); return (zx*zx)%warukazu; } /* void gya(){ pr[0]=1; for(int i=1;i<100010;i++){ pr[i]=(pr[i-1]*i)%inf; } for(int i=0;i<100010;i++) inv[i]=beki(pr[i],inf-2); } */ //sort(ve.begin(),ve.end(),greater<int>()); //----------------kokomade tenpure------------ //vector<double> ans(100000000),ans2(100000000); int ma[2010][2010]; int yoko[2010][2010]={0}; int tate[2010][2010]={0}; int rui[2010][2010]={0}; int n,m,q; vector<int> ve; signed main(){ cin>>n>>a>>b; int si=a*(n-1)+b; int ue=b*(n-1)+a; cout<<ue-si+1<<endl; //cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:150:17: error: 'a' was not declared in this scope 150 | cin>>n>>a>>b; | ^ a.cc:150:20: error: 'b' was not declared in this scope 150 | cin>>n>>a>>b; | ^
s188888337
p03705
C++
#include<bits/sdtc++.h> using namespace std; int n,a,b; int main(){ cin>>n>>a>>b; if(n==1&&a!=b)printf("0"); else if(a>b)printf("0"); else{ long long sm=1LL*a*(n-1)+b; long long bi=1LL*b*(n-1)+a; printf("%lld",bi-sm+1); return 0; } }
a.cc:1:9: fatal error: bits/sdtc++.h: No such file or directory 1 | #include<bits/sdtc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s045348853
p03705
C++
#define _USE_MATH_DEFINES #define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include<string> #include<iostream> #include<cctype> #include<cstdio> #include<vector> #include<stack> #include<queue> #include <algorithm> #include<math.h> #include<set> #include<map> #include <sstream> #include<iomanip> #include <ctype.h> //#include<bits/stdc++.h> using namespace std; int main() { long long int a, b, c; cin >> a >> b >> c; long long int ans = 0,m=0; if (b > c) { cout << 0 << endl; return 0; } m = b*a - b; m += c; /* if (a == 1) { cout << max(c - b + 1,0) << endl; } */cout << max(c*a-c+b - m+1,0) << endl; return 0; }
a.cc: In function 'int main()': a.cc:41:22: error: no matching function for call to 'max(long long int, int)' 41 | */cout << max(c*a-c+b - m+1,0) << endl; | ~~~^~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from a.cc:4: /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:41:22: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 41 | */cout << max(c*a-c+b - m+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, from a.cc:11: /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:41:22: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 41 | */cout << max(c*a-c+b - m+1,0) << endl; | ~~~^~~~~~~~~~~~~~~~~
s207518130
p03705
Java
<?php class In { private $buf = []; private $count = 0; private $pointer = 0; public function nextLine() { $ret = ''; if($this->hasNext()){ while($this->hasNext()){ $ret .= $this->next(); } }else{ $ret = trim(fgets(STDIN)); } return $ret; } public function next() { if(!$this->hasNext()) { $str = trim(fgets(STDIN)); $this->buf = explode(' ',$str); $this->count = count($this->buf); $this->pointer = 0; } return $this->buf[$this->pointer++]; } public function hasNext() { return $this->pointer < $this->count; } public function nextInt() { return (int)$this->next(); } public function nextDouble() { return (double)$this->next(); } } class Out { public function println($str = '') { echo $str . PHP_EOL; } } $in = new In(); $out = new Out(); $N = $in->nextInt(); $A = $in->nextInt(); $B = $in->nextInt(); if ($A > $B) { $out->println(0); return; } if ($N <= 1) { if ($A == $B) { $out->println(1); } else { $out->println(0); } return; } $ans = ($N - 2) * ($B - $A) + 1; $out->println($ans); ?>
Main.java:1: error: class, interface, enum, or record expected <?php ^ Main.java:5: error: <identifier> expected private $buf = []; ^ Main.java:5: error: illegal start of expression private $buf = []; ^ Main.java:6: error: <identifier> expected private $count = 0; ^ Main.java:7: error: <identifier> expected private $pointer = 0; ^ Main.java:10: error: empty character literal $ret = ''; ^ Main.java:13: error: <identifier> expected $ret .= $this->next(); ^ Main.java:25: error: not a statement $this->buf = explode(' ',$str); ^ Main.java:26: error: not a statement $this->count = count($this->buf); ^ Main.java:27: error: not a statement $this->pointer = 0; ^ Main.java:47: error: <identifier> expected public function println($str = '') { ^ Main.java:47: error: empty character literal public function println($str = '') { ^ Main.java:48: error: ';' expected echo $str . PHP_EOL; ^ Main.java:48: error: not a statement echo $str . PHP_EOL; ^ Main.java:52: error: class, interface, enum, or record expected $in = new In(); ^ Main.java:53: error: class, interface, enum, or record expected $out = new Out(); ^ Main.java:55: error: class, interface, enum, or record expected $N = $in->nextInt(); ^ Main.java:56: error: class, interface, enum, or record expected $A = $in->nextInt(); ^ Main.java:57: error: class, interface, enum, or record expected $B = $in->nextInt(); ^ Main.java:59: error: class, interface, enum, or record expected if ($A > $B) { ^ Main.java:61: error: class, interface, enum, or record expected return; ^ Main.java:62: error: class, interface, enum, or record expected } ^ Main.java:67: error: class, interface, enum, or record expected } else { ^ Main.java:69: error: class, interface, enum, or record expected } ^ Main.java:71: error: class, interface, enum, or record expected } ^ Main.java:75: error: class, interface, enum, or record expected $out->println($ans); ^ Main.java:77: error: class, interface, enum, or record expected ?> ^ 27 errors
s461227185
p03705
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n,a,b; cin >> n >> a >> b; ans=(b-a)*(n-2)+1; cout << (ans<0?0:ans) << endl; return 0; }
a.cc: In function 'int main()': a.cc:8:9: error: 'ans' was not declared in this scope; did you mean 'abs'? 8 | ans=(b-a)*(n-2)+1; | ^~~ | abs
s414736231
p03705
C++
#include<iostream> using namespace std; int main() { string s; cin >> s; long long int ans = 0; for (int i = 0; i < s.size(); ++i) { if (s[i] = 'U') { ans += (2 * (i - 1) + s.size() - 2; } else { ans += i - 1 + (s.size() - 2) * 2; } } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:10:59: error: expected ')' before ';' token 10 | ans += (2 * (i - 1) + s.size() - 2; | ~ ^ | )
s498436663
p03705
C++
#include <bits/stdc++.h> using namespace std; #define int __int64 main() { int n, a, b; cin >> n >> a >> b; if (n == 1) { cout << (a == b ? 1 : 2); } else if (b < a) { cout << 0; } else if (n == 2) { cout << 1; } else { cout << ((a+b * (n-1)) - (a * (n-1) + b) + 1); } }
a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 4 | main() { | ^~~~ a.cc: In function 'int main()': a.cc:3:13: error: '__int64' was not declared in this scope; did you mean '__ynf64'? 3 | #define int __int64 | ^~~~~~~ a.cc:5:9: note: in expansion of macro 'int' 5 | int n, a, b; | ^~~ a.cc:6:16: error: 'n' was not declared in this scope; did you mean 'yn'? 6 | cin >> n >> a >> b; | ^ | yn a.cc:6:21: error: 'a' was not declared in this scope 6 | cin >> n >> a >> b; | ^ a.cc:6:26: error: 'b' was not declared in this scope 6 | cin >> n >> a >> b; | ^
s089861672
p03705
C++
#include <iostream> #include <cstdio> #include <stdlib.h> using namespace std; typedef long long LL; int main() { __int64 n,a,b; scanf("%I64d%I64d%I64d",&n,&a,&b); if(a>b ) { printf("0\n"); return 0; } if(n == 1 && a != b) { printf("0\n"); return 0; } printf("%I64d\n",(b-a)*(n-2)+1); return 0; }
a.cc: In function 'int main()': a.cc:8:5: error: '__int64' was not declared in this scope; did you mean '__int64_t'? 8 | __int64 n,a,b; | ^~~~~~~ | __int64_t a.cc:9:30: error: 'n' was not declared in this scope 9 | scanf("%I64d%I64d%I64d",&n,&a,&b); | ^ a.cc:9:33: error: 'a' was not declared in this scope 9 | scanf("%I64d%I64d%I64d",&n,&a,&b); | ^ a.cc:9:36: error: 'b' was not declared in this scope 9 | scanf("%I64d%I64d%I64d",&n,&a,&b); | ^
s800424227
p03705
C++
#include <iostream> #include <cstdio> using namespace std; typedef long long LL; int main() { __int64 n,a,b; scanf("%I64d%I64d%I64d",&n,&a,&b); if(a>b ) { printf("0\n"); return 0; } if(n == 1 && a != b) { printf("0\n"); return 0; } printf("%I64d\n",(b-a)*(n-2)+1); return 0; }
a.cc: In function 'int main()': a.cc:7:5: error: '__int64' was not declared in this scope; did you mean '__int64_t'? 7 | __int64 n,a,b; | ^~~~~~~ | __int64_t a.cc:8:30: error: 'n' was not declared in this scope 8 | scanf("%I64d%I64d%I64d",&n,&a,&b); | ^ a.cc:8:33: error: 'a' was not declared in this scope 8 | scanf("%I64d%I64d%I64d",&n,&a,&b); | ^ a.cc:8:36: error: 'b' was not declared in this scope 8 | scanf("%I64d%I64d%I64d",&n,&a,&b); | ^
s187593723
p03705
C++
#include <iostream> #include <cstdio> using namespace std; int main() { int n,a,b; while(cin>>n>>a>>b) { if(a>b ) { cout<<"0"<<endl; continue; } if(n == 1 && a != b) { cout<<"0"<<endl; continue; } cout<<(b-a)*(n-2)+1)<<endl;; } return 0; }
a.cc: In function 'int main()': a.cc:19:28: error: expected ';' before ')' token 19 | cout<<(b-a)*(n-2)+1)<<endl;; | ^ | ;
s430404934
p03705
C++
#include <iostream> #include <cstdio> using namespace std; int main() { __in64 n,a,b; while(~scanf("%I64d%I64d%I64d",&n,&a,&b)) { if(a>b ) { printf("0\n"); continue; } if(n == 1 && a != b) { printf("0\n"); continue; } printf("%I64d\n",(b-a)*(n-2)+1); } return 0; }
a.cc: In function 'int main()': a.cc:6:5: error: '__in64' was not declared in this scope; did you mean '__u64'? 6 | __in64 n,a,b; | ^~~~~~ | __u64 a.cc:7:37: error: 'n' was not declared in this scope 7 | while(~scanf("%I64d%I64d%I64d",&n,&a,&b)) | ^ a.cc:7:40: error: 'a' was not declared in this scope 7 | while(~scanf("%I64d%I64d%I64d",&n,&a,&b)) | ^ a.cc:7:43: error: 'b' was not declared in this scope 7 | while(~scanf("%I64d%I64d%I64d",&n,&a,&b)) | ^
s078437750
p03705
C++
#include<bits/stdc++.h> using namespace std; typedef long long int64; int main() { int64 N, A, B; cin >> N >> A >> B; if(N == 1) { if(A == B) cout << 1 << endl; else cout << 0 << endl; } else { cout << max(0, (N * B - B + A) - (N * A - A + B) + 1) << endl; } }
a.cc: In function 'int main()': a.cc:16:16: error: no matching function for call to 'max(int, int64)' 16 | cout << max(0, (N * B - B + A) - (N * A - 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:16:16: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'int64' {aka 'long long int'}) 16 | cout << max(0, (N * B - B + A) - (N * A - 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:16:16: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 16 | cout << max(0, (N * B - B + A) - (N * A - A + B) + 1) << endl; | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s730863393
p03705
C++
#include <iostream> #include <cmath> int main(){ int N, A, B, tmp; std::cin >> N >> A >> B; tmp = (B - A) * (N - 2) + 1; if(N < 1) std::cout << 0 << std::endl; else if(A != B && N = 1) std::cout << 0 << std::endl; else std::cout << tmp << std::endl; }
a.cc: In function 'int main()': a.cc:9:20: error: lvalue required as left operand of assignment 9 | else if(A != B && N = 1) std::cout << 0 << std::endl; | ~~~~~~~^~~~
s896825988
p03705
C++
#include<iostream> using namespace std; int main() { long N,A,B,result; int temp; cin>>N>>A>>B; if (A>B) { temp=0; cout<<temp<<endl; } else if((B-A+1)>N) { temp=0; cout<<temp<<endl; } else if(n==1 && A==B) { temp=1; cout<<temp<<endl; } else { result= (A+(N-1)*B)-((N-1)*A+B)+1; cout<<result<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:22:17: error: 'n' was not declared in this scope 22 | else if(n==1 && A==B) | ^
s367009044
p03705
C++
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import java.util.*; /** * * @author Jeel */ public class Main { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner sc=new Scanner(System.in); long n=sc.nextLong(); long a=sc.nextLong(); long b=sc.nextLong(); if(n==1&a!=b) { System.out.print("0"); return; } else if(b<a) { System.out.print("0"); return; } System.out.print((b*(n-1)+a)-((a*(n-1))+b)+1); } }
a.cc:6:1: error: 'import' does not name a type 6 | import java.util.*; | ^~~~~~ a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:11:1: error: expected unqualified-id before 'public' 11 | public class Main { | ^~~~~~
s019923812
p03705
C++
#include <bits/stdc++.h> using namespace std; #define lpa(i,a,b) for(int i=a; i<b; ++i) #define lp(i,n) lpa(i,0,n) void p1() { long long n,a,b; cin>>n>>a>>b; if(n==1) cout<<a==b; else if(a>b) cout<<0; else cout<<(n-2)*(b-a)+1; } int main() { p1(); }
a.cc: In function 'void p1()': a.cc:9:25: error: no match for 'operator==' (operand types are 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} and 'long long int') 9 | if(n==1) cout<<a==b; | ~~~~~~~^~~ | | | | | long long int | std::basic_ostream<char>::__ostream_type {aka std::basic_ostream<char>} a.cc:9:25: note: candidate: 'operator==(int, long long int)' (built-in) 9 | if(n==1) cout<<a==b; | ~~~~~~~^~~ a.cc:9:25: note: no known conversion for argument 1 from 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} to 'int' In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:1: /usr/include/c++/14/bits/regex.h:1103:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1103 | operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1103:5: note: template argument deduction/substitution failed: a.cc:9:27: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 9 | if(n==1) cout<<a==b; | ^ /usr/include/c++/14/bits/regex.h:1199:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)' 1199 | operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1199:5: note: template argument deduction/substitution failed: a.cc:9:27: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' 9 | if(n==1) cout<<a==b; | ^ /usr/include/c++/14/bits/regex.h:1274:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)' 1274 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1274:5: note: template argument deduction/substitution failed: a.cc:9:27: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 9 | if(n==1) cout<<a==b; | ^ /usr/include/c++/14/bits/regex.h:1366:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1366 | operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1366:5: note: template argument deduction/substitution failed: a.cc:9:27: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'long long int' 9 | if(n==1) cout<<a==b; | ^ /usr/include/c++/14/bits/regex.h:1441:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1441 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1441:5: note: template argument deduction/substitution failed: a.cc:9:27: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 9 | if(n==1) cout<<a==b; | ^ /usr/include/c++/14/bits/regex.h:1534:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1534 | operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1534:5: note: template argument deduction/substitution failed: a.cc:9:27: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'long long int' 9 | if(n==1) cout<<a==b; | ^ /usr/include/c++/14/bits/regex.h:1613:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1613 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1613:5: note: template argument deduction/substitution failed: a.cc:9:27: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 9 | if(n==1) cout<<a==b; | ^ /usr/include/c++/14/bits/regex.h:2186:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)' 2186 | operator==(const match_results<_Bi_iter, _Alloc>& __m1, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:2186:5: note: template argument deduction/substitution failed: a.cc:9:27: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::match_results<_BiIter, _Alloc>' 9 | if(n==1) cout<<a==b; | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, 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_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:9:27: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::pair<_T1, _T2>' 9 | if(n==1) cout<<a==b; | ^ 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:9:27: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 9 | if(n==1) cout<<a==b; | ^ /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:9:27: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 9 | if(n==1) cout<<a==b; | ^ /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:9:27: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 9 | if(n==1) cout<<a==b; | ^ /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:9:27: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 9 | if(n==1) cout<<a==b; | ^ In file included from /usr/include/c++/14/bits/char_traits.h:42, from /usr/include/c++/14/string:42, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /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:9:27: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::fpos<_StateT>' 9 | if(n==1) cout<<a==b; | ^ In file included from /usr/include/c++/14/string:43: /usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)' 235 | operator==(const allocator<_T1>&, const allocator<_
s444261826
p03705
C++
#include <bits/stdc++.h> using namespace std; #define lpa(i,a,b) for(int i=a; i<b; ++i) #define lp(i,n) lpa(i,0,n) void p1() { int n,a,b; cin>>n>>a>>b; if(n==1) cout<< a==b; else if(a>b) cout<<0; else cout<<(n-2)*(b-a)+1; } int main() { p1(); }
a.cc: In function 'void p1()': a.cc:9:26: error: no match for 'operator==' (operand types are 'std::basic_ostream<char>' and 'int') 9 | if(n==1) cout<< a==b; | ~~~~~~~~^~~ | | | | | int | std::basic_ostream<char> a.cc:9:26: note: candidate: 'operator==(int, int)' (built-in) 9 | if(n==1) cout<< a==b; | ~~~~~~~~^~~ a.cc:9:26: note: no known conversion for argument 1 from 'std::basic_ostream<char>' to 'int' In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:1: /usr/include/c++/14/bits/regex.h:1103:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1103 | operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1103:5: note: template argument deduction/substitution failed: a.cc:9:28: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 9 | if(n==1) cout<< a==b; | ^ /usr/include/c++/14/bits/regex.h:1199:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)' 1199 | operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1199:5: note: template argument deduction/substitution failed: a.cc:9:28: note: 'std::basic_ostream<char>' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' 9 | if(n==1) cout<< a==b; | ^ /usr/include/c++/14/bits/regex.h:1274:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)' 1274 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1274:5: note: template argument deduction/substitution failed: a.cc:9:28: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 9 | if(n==1) cout<< a==b; | ^ /usr/include/c++/14/bits/regex.h:1366:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1366 | operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1366:5: note: template argument deduction/substitution failed: a.cc:9:28: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 9 | if(n==1) cout<< a==b; | ^ /usr/include/c++/14/bits/regex.h:1441:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1441 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1441:5: note: template argument deduction/substitution failed: a.cc:9:28: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 9 | if(n==1) cout<< a==b; | ^ /usr/include/c++/14/bits/regex.h:1534:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1534 | operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1534:5: note: template argument deduction/substitution failed: a.cc:9:28: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 9 | if(n==1) cout<< a==b; | ^ /usr/include/c++/14/bits/regex.h:1613:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1613 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1613:5: note: template argument deduction/substitution failed: a.cc:9:28: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 9 | if(n==1) cout<< a==b; | ^ /usr/include/c++/14/bits/regex.h:2186:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)' 2186 | operator==(const match_results<_Bi_iter, _Alloc>& __m1, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:2186:5: note: template argument deduction/substitution failed: a.cc:9:28: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::match_results<_BiIter, _Alloc>' 9 | if(n==1) cout<< a==b; | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, 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_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:9:28: note: 'std::basic_ostream<char>' is not derived from 'const std::pair<_T1, _T2>' 9 | if(n==1) cout<< a==b; | ^ 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:9:28: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>' 9 | if(n==1) cout<< a==b; | ^ /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:9:28: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>' 9 | if(n==1) cout<< a==b; | ^ /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:9:28: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>' 9 | if(n==1) cout<< a==b; | ^ /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:9:28: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>' 9 | if(n==1) cout<< a==b; | ^ In file included from /usr/include/c++/14/bits/char_traits.h:42, from /usr/include/c++/14/string:42, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /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:9:28: note: 'std::basic_ostream<char>' is not derived from 'const std::fpos<_StateT>' 9 | if(n==1) cout<< a==b; | ^ In file included from /usr/include/c++/14/string:43: /usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, 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:9:28: note: 'std::basic_ostream<char>' is not derived from 'const std::allocator<_CharT>' 9 | if(n==1) cout<< a==b; | ^ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /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_
s313390389
p03705
C++
#include <bits/stdc++.h> using namespace std; #define lpa(i,a,b) for(int i=a; i<b; ++i) #define lp(i,n) lpa(i,0,n) void p1() { int n,a,b; cin>>n>>a>>b; if(n==1) cout<<a==b; else if(a>b) cout<<0; else cout<<(n-2)*(b-a)+1; } int main() { p1(); }
a.cc: In function 'void p1()': a.cc:9:25: error: no match for 'operator==' (operand types are 'std::basic_ostream<char>' and 'int') 9 | if(n==1) cout<<a==b; | ~~~~~~~^~~ | | | | | int | std::basic_ostream<char> a.cc:9:25: note: candidate: 'operator==(int, int)' (built-in) 9 | if(n==1) cout<<a==b; | ~~~~~~~^~~ a.cc:9:25: note: no known conversion for argument 1 from 'std::basic_ostream<char>' to 'int' In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:1: /usr/include/c++/14/bits/regex.h:1103:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1103 | operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1103:5: note: template argument deduction/substitution failed: a.cc:9:27: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 9 | if(n==1) cout<<a==b; | ^ /usr/include/c++/14/bits/regex.h:1199:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)' 1199 | operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1199:5: note: template argument deduction/substitution failed: a.cc:9:27: note: 'std::basic_ostream<char>' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' 9 | if(n==1) cout<<a==b; | ^ /usr/include/c++/14/bits/regex.h:1274:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)' 1274 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1274:5: note: template argument deduction/substitution failed: a.cc:9:27: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 9 | if(n==1) cout<<a==b; | ^ /usr/include/c++/14/bits/regex.h:1366:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1366 | operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1366:5: note: template argument deduction/substitution failed: a.cc:9:27: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 9 | if(n==1) cout<<a==b; | ^ /usr/include/c++/14/bits/regex.h:1441:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1441 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1441:5: note: template argument deduction/substitution failed: a.cc:9:27: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 9 | if(n==1) cout<<a==b; | ^ /usr/include/c++/14/bits/regex.h:1534:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1534 | operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1534:5: note: template argument deduction/substitution failed: a.cc:9:27: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 9 | if(n==1) cout<<a==b; | ^ /usr/include/c++/14/bits/regex.h:1613:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1613 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1613:5: note: template argument deduction/substitution failed: a.cc:9:27: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 9 | if(n==1) cout<<a==b; | ^ /usr/include/c++/14/bits/regex.h:2186:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)' 2186 | operator==(const match_results<_Bi_iter, _Alloc>& __m1, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:2186:5: note: template argument deduction/substitution failed: a.cc:9:27: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::match_results<_BiIter, _Alloc>' 9 | if(n==1) cout<<a==b; | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, 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_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:9:27: note: 'std::basic_ostream<char>' is not derived from 'const std::pair<_T1, _T2>' 9 | if(n==1) cout<<a==b; | ^ 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:9:27: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>' 9 | if(n==1) cout<<a==b; | ^ /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:9:27: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>' 9 | if(n==1) cout<<a==b; | ^ /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:9:27: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>' 9 | if(n==1) cout<<a==b; | ^ /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:9:27: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>' 9 | if(n==1) cout<<a==b; | ^ In file included from /usr/include/c++/14/bits/char_traits.h:42, from /usr/include/c++/14/string:42, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /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:9:27: note: 'std::basic_ostream<char>' is not derived from 'const std::fpos<_StateT>' 9 | if(n==1) cout<<a==b; | ^ In file included from /usr/include/c++/14/string:43: /usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, 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:9:27: note: 'std::basic_ostream<char>' is not derived from 'const std::allocator<_CharT>' 9 | if(n==1) cout<<a==b; | ^ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /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 argumen
s934710991
p03705
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vint; typedef pair<int,int> pint; typedef vector<pint> vpint; #define rep(i,n) for(int i=0;i<(n);i++) #define REP(i,n) for(int i=n-1;i>=(0);i--) #define reps(i,f,n) for(int i=(f);i<(n);i++) #define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++) #define all(v) (v).begin(),(v).end() #define eall(v) unique(all(v), v.end()) #define pb push_back #define mp make_pair #define fi first #define se second #define chmax(a, b) a = (((a)<(b)) ? (b) : (a)) #define chmin(a, b) a = (((a)>(b)) ? (b) : (a)) const int MOD = 1e9 + 7; const int INF = 1e9; const ll INFF = 1e18; int main(void) { ll N, A, B; cin >> N >> A >> B; if(N == 1){ if(A != B)printf("0\n"); else printf("1\n"); return 0; } ll ma = A + B * (N - 1); ll mi = A * (N - 1) + B; printf("%lld\n", max(0, ma - mi + 1)); return 0; }
a.cc: In function 'int main()': a.cc:34:29: error: no matching function for call to 'max(int, ll)' 34 | printf("%lld\n", max(0, ma - mi + 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:34:29: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'}) 34 | printf("%lld\n", max(0, ma - mi + 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:34:29: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 34 | printf("%lld\n", max(0, ma - mi + 1)); | ~~~^~~~~~~~~~~~~~~~
s590967901
p03705
C++
#include <bits/stdc++.h> using namespace std; #define N 2001 int n, m, sum[N][N], ngang[N][N], doc[N][N], Q; int x1, y1, x2, y2; char a[N][N]; // Tinh số thành pahanf liên thông của HCN giới hạn bởi 4 đường x1 y1 x2 y2; // Theo đề bài : Graph các đỉnh xanh LÀ 1 CÂY // =>> Số thành phần liên thông của cây : = số đình - số cạnh // => Duy trì mảng sum (i, j) : Tổng số đỉnh trong khoảng HCN (1, 1) -> (i, j) // => Duy trì mảng ngang (i, j) : Tổng số cạnh ngang trong khoảng HCN (1, 1) -> (i, j) // => Duy trì mảng doc (i, j) : Tổng số cạnh dọc trong khoảng HCN (1, 1) -> (i, j) void Init() { cin >> n >> m >> Q; for(int i = 1; i <= n; i++) for(int j = 1; j <= m; j++) sum[i][j] = 0, doc[i][j] = 0, ngang[i][j] = 0; for(int i = 1; i <= n; i++) for(int j = 1; j <= m; j++) { cin >> a[i][j]; sum[i][j] = sum[i][j - 1] + sum[i - 1][j] - sum[i - 1][j - 1] + (a[i][j] - '0'); // a(i,j) = 1 khi dinh> mau xanh ngang[i][j] = ngang[i][j - 1] + ngang[i - 1][j] - ngang[i - 1][j - 1] + (a[i][j] == '1' && a[i][j - 1] == '1' ? 1 : 0); // Nếu có cạnh nối từ a(i,j) xuống HCN(1,1) (i, j - 1) thì số cạnh tăng 1 doc[i][j] = doc[i][j - 1] + doc[i - 1][j] - doc[i - 1][j - 1] + (a[i][j] == '1' && a[i - 1][j] == '1' ? 1 : 0); // Nếu có cạnh nối từ a(i,j) về HCN(1,1) (i - 1, j) thì số cạnh tăng 1 } } void Solve() { for(int i = 1; i <= Q; i++) { cin >> x1 >> y1 >> x2 >> y2; int cnt_dinh = sum[x2][y2] - sum[x1 - 1][y2] - sum[x2][y1 - 1] + sum[x1 - 1][y1 - 1]; int cnt_ngang = ngang[x2][y2] - ngang[x1 - 1][y2] - ngang[x2][y1] + ngang[x1 - 1][y1]; int cnt_doc = doc[x2][y2] - doc[x1][y2] - doc[x2][y1 - 1] + doc[x1][y1 - 1]; // Vs đếm ngang thì sẽ tính giới hạn cột từ x1 + 1 đến x2 để tránh cột x1 liên thông svs bên ngoài, tương tự vs đếm dọc cout << cnt_dinh - cnt_doc - cnt_ngang << endl; } } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); //freopen("NUSKE.INP", "r", stdin); // freopen("NUSKE.OUT", "w", stdout); Init(); Solve(); }
a.cc:6:9: error: 'int y1' redeclared as different kind of entity 6 | int x1, y1, x2, y2; | ^~ In file included from /usr/include/features.h:523, from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683, from /usr/include/c++/14/cassert:43, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:33, from a.cc:1: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:257:1: note: previous declaration 'double y1(double)' 257 | __MATHCALL (y1,, (_Mdouble_)); | ^~~~~~~~~~ a.cc: In function 'void Solve()': a.cc:38:19: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'double(double) noexcept') 38 | cin >> x1 >> y1 >> x2 >> y2; | ~~~~~~~~~ ^~ ~~ | | | | | double(double) noexcept | std::basic_istream<char>::__istream_type {aka std::basic_istream<char>} In file included from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed: a.cc:38:22: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'double (*)(double) noexcept' 38 | cin >> x1 >> y1 >> x2 >> y2; | ^~ /usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed: a.cc:38:22: error: invalid conversion from 'double (*)(double) noexcept' to 'short int' [-fpermissive] 38 | cin >> x1 >> y1 >> x2 >> y2; | ^~ | | | double (*)(double) noexcept a.cc:38:22: error: cannot bind rvalue '(short int)y1' to 'short int&' /usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed: a.cc:38:22: error: invalid conversion from 'double (*)(double) noexcept' to 'short unsigned int' [-fpermissive] 38 | cin >> x1 >> y1 >> x2 >> y2; | ^~ | | | double (*)(double) noexcept a.cc:38:22: error: cannot bind rvalue '(short unsigned int)y1' to 'short unsigned int&' /usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed: a.cc:38:22: error: invalid conversion from 'double (*)(double) noexcept' to 'int' [-fpermissive] 38 | cin >> x1 >> y1 >> x2 >> y2; | ^~ | | | double (*)(double) noexcept a.cc:38:22: error: cannot bind rvalue '(int)y1' to 'int&' /usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed: a.cc:38:22: error: invalid conversion from 'double (*)(double) noexcept' to 'unsigned int' [-fpermissive] 38 | cin >> x1 >> y1 >> x2 >> y2; | ^~ | | | double (*)(double) noexcept a.cc:38:22: error: cannot bind rvalue '(unsigned int)y1' to 'unsigned int&' /usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed: a.cc:38:22: error: invalid conversion from 'double (*)(double) noexcept' to 'long int' [-fpermissive] 38 | cin >> x1 >> y1 >> x2 >> y2; | ^~ | | | double (*)(double) noexcept a.cc:38:22: error: cannot bind rvalue '(long int)y1' to 'long int&' /usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed: a.cc:38:22: error: invalid conversion from 'double (*)(double) noexcept' to 'long unsigned int' [-fpermissive] 38 | cin >> x1 >> y1 >> x2 >> y2; | ^~ | | | double (*)(double) noexcept a.cc:38:22: error: cannot bind rvalue '(long unsigned int)y1' to 'long unsigned int&' /usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed: a.cc:38:22: error: invalid conversion from 'double (*)(double) noexcept' to 'long long int' [-fpermissive] 38 | cin >> x1 >> y1 >> x2 >> y2; | ^~ | | | double (*)(double) noexcept a.cc:38:22: error: cannot bind rvalue '(long long int)y1' to 'long long int&' /usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed: a.cc:38:22: error: invalid conversion from 'double (*)(double) noexcept' to 'long long unsigned int' [-fpermissive] 38 | cin >> x1 >> y1 >> x2 >> y2; | ^~ | | | double (*)(double) noexcept a.cc:38:22: error: cannot bind rvalue '(long long unsigned int)y1' to 'long long unsigned int&' /usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed: a.cc:38:22: error: invalid conversion from 'double (*)(double) noexcept' to 'void*' [-fpermissive] 38 | cin >> x1 >> y1 >> x2 >> y2; | ^~ | | | double (*)(double) noexcept a.cc:38:22: error: cannot bind rvalue '(void*)y1' to 'void*&' /usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:122:7: note: conversion of argument 1 would be ill-formed: a.cc:38:22: error: invalid conversion from 'double (*)(double) noexcept' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} [-fpermissive] 38 | cin >> x1 >> y1 >> x2 >> y2; | ^~ | | | double (*)(double) noexcept /usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]' (near match) 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:126:7: note: conversion of
s099091094
p03705
C++
/* _ _ _______ _ _ | | / / | _____| | | / / | | / / | | | | / / | |/ / | |_____ | |/ / | |\ \ | _____| | |\ \ | | \ \ | | | | \ \ | | \ \ | |_____ | | \ \ |_| \_\ |_______| |_| \_\ */ /*#include <iostream> #include <cstdio> #include <set> #include <map> #include <stack> #include <queue> #include <vector> #include <cstring> #include <string> #include <iomanip> #include <cmath> #include <algorithm> #include <assert.h>*/ #include <bits/stdc++.h> using namespace std; typedef unsigned long long ull; typedef long long ll; typedef double ld; typedef pair <int, int> PII; typedef pair <ll, ll> PLL; #define F first #define S second #define pb push_back #define eb emplace_back #define right(x) x << 1 | 1 #define left(x) x << 1 #define forn(x, a, b) for (int x = a; x <= b; ++x) #define for1(x, a, b) for (int x = a; x >= b; --x) #define mkp make_pair #define sz(a) (int)a.size() #define all(a) a.begin(), a.end() #define y1 kekekek const ll ool = 1e18 + 9; const int oo = 1e9 + 9, base = 1e9 + 7; const ld eps = 1e-7; const int N = 2e6 + 6; int main() { ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0); //freopen("in", "r", stdin); ll n, A, B; cin >> n >> A >> B; cout << max((n - 1) * B + A - ((n - 1) * A + B) + 1, 0) << "\n"; return 0; }
a.cc: In function 'int main()': a.cc:60:16: error: no matching function for call to 'max(ll, int)' 60 | cout << max((n - 1) * B + A - ((n - 1) * A + B) + 1, 0) << "\n"; | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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:26: /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:60:16: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 60 | cout << max((n - 1) * B + A - ((n - 1) * A + B) + 1, 0) << "\n"; | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /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:60:16: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 60 | cout << max((n - 1) * B + A - ((n - 1) * A + B) + 1, 0) << "\n"; | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s047589758
p03705
C++
/* _ _ _______ _ _ | | / / | _____| | | / / | | / / | | | | / / | |/ / | |_____ | |/ / | |\ \ | _____| | |\ \ | | \ \ | | | | \ \ | | \ \ | |_____ | | \ \ |_| \_\ |_______| |_| \_\ */ /*#include <iostream> #include <cstdio> #include <set> #include <map> #include <stack> #include <queue> #include <vector> #include <cstring> #include <string> #include <iomanip> #include <cmath> #include <algorithm> #include <assert.h>*/ #include <bits/stdc++.h> using namespace std; typedef unsigned long long ull; typedef long long ll; typedef double ld; typedef pair <int, int> PII; typedef pair <ll, ll> PLL; #define F first #define S second #define pb push_back #define eb emplace_back #define right(x) x << 1 | 1 #define left(x) x << 1 #define forn(x, a, b) for (int x = a; x <= b; ++x) #define for1(x, a, b) for (int x = a; x >= b; --x) #define mkp make_pair #define sz(a) (int)a.size() #define all(a) a.begin(), a.end() #define y1 kekekek const ll ool = 1e18 + 9; const int oo = 1e9 + 9, base = 1e9 + 7; const ld eps = 1e-7; const int N = 2e6 + 6; int main() { ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0); //freopen("in", "r", stdin); ll n, A, B; cin >> n >> A >> B: cout << (n - 1) * A + B - ((n - 1) * B + A) << "\n"; return 0; }
a.cc: In function 'int main()': a.cc:59:23: error: found ':' in nested-name-specifier, expected '::' 59 | cin >> n >> A >> B: | ^ | :: a.cc:59:22: error: 'B' is not a class, namespace, or enumeration 59 | cin >> n >> A >> B: | ^
s009216612
p03705
C++
#define debug(x) cout<<#x<<": "<<x<<endl #define rep(a, b) for(int unsafe_cnt=a; unsafe_cnt < b;unsafe_cnt++) #define fn auto #include <iostream> #include <stdio.h> #include <vector> #include <math.h> #include <algorithm> #include <string> using namespace std; void newline() {cout << endl;} template <typename T> void display(T input){cout << input;} template <typename T> void put(T input){display(input); newline();} void iput(int input) {put(input);} void lput(long long input) {put(input);} void main() { long long n, a, b, max, min, ans; cin >> n >> a >> b; if(a > b){ ans = 0; }else if(n==1 && a==b){ ans = 1; }else if(n==1 && a!=b){ ans = 0; } else { min = a * (n-1) + b; max = a + (n-1) * b; ans = max - min + 1; } lput(ans); }
a.cc:18:1: error: '::main' must return 'int' 18 | void main() { | ^~~~
s565158208
p03705
C++
123
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 123 | ^~~
s243711438
p03705
C++
#include <bits/stdc++.h> using namespace std; int a, n, b; int main(){ cin >> n >> a >> b; cout << 1LL * (n - 2) * ( b - a) + 1 }
a.cc: In function 'int main()': a.cc:7:37: error: expected ';' before '}' token 7 | cout << 1LL * (n - 2) * ( b - a) + 1 | ^ | ; 8 | } | ~
s754335198
p03705
C++
#include<bits/stdc++.h> #define rep(i,a,b) for(int i=(a);i<=(b);i++) #define per(i,a,b) for(int i=(a);i>=(b);i--) using namespace std; inline void read(int &x){ x=0;char ch=getchar();int f=1; while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();} while(ch>='0'&&ch<='9'){x=10*x+ch-'0';ch=getchar();}x*=f; } inline void judge(){ freopen("in.txt","r",stdin); freopen("out.txt","w",stdout); } i64 n,a,b; int main(){ cin>>n>>a>>b; i64 v1=n*a,v2=n*b; cout<<v2-v1+1; }
a.cc:14:1: error: 'i64' does not name a type 14 | i64 n,a,b; | ^~~ a.cc: In function 'int main()': a.cc:16:14: error: 'n' was not declared in this scope; did you mean 'yn'? 16 | cin>>n>>a>>b; | ^ | yn a.cc:16:17: error: 'a' was not declared in this scope 16 | cin>>n>>a>>b; | ^ a.cc:16:20: error: 'b' was not declared in this scope 16 | cin>>n>>a>>b; | ^ a.cc:17:9: error: 'i64' was not declared in this scope 17 | i64 v1=n*a,v2=n*b; | ^~~ a.cc:18:15: error: 'v2' was not declared in this scope 18 | cout<<v2-v1+1; | ^~ a.cc:18:18: error: 'v1' was not declared in this scope; did you mean '__pstl::execution::v1'? 18 | cout<<v2-v1+1; | ^~ | __pstl::execution::v1 In file included from /usr/include/c++/14/pstl/glue_algorithm_defs.h:15, from /usr/include/c++/14/algorithm:86, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/pstl/execution_defs.h:19:18: note: '__pstl::execution::v1' declared here 19 | inline namespace v1 | ^~
s223444803
p03705
C++
#include <iostream> using namespace std; int solve(int N, int B){ if(B < 0) return 0; if(N == 1) return (B == 0) ? 1 : 0; else{ return (N - 2) * B + 1; } } int main(){ int N, A, B; cin >> N >> A >> B; cout << solve(N, B - A) << endl; }#include <iostream> using namespace std; int solve(int N, int B){ if(B < 0) return 0; if(N == 1) return (B == 0) ? 1 : 0; else{ return (N - 2) * B + 1; } } int main(){ int N, A, B; cin >> N >> A >> B; cout << solve(N, B - A) << endl; }
a.cc:16:2: error: stray '#' in program 16 | }#include <iostream> | ^ a.cc:16:3: error: 'include' does not name a type 16 | }#include <iostream> | ^~~~~~~ a.cc:19:5: error: redefinition of 'int solve(int, int)' 19 | int solve(int N, int B){ | ^~~~~ a.cc:4:5: note: 'int solve(int, int)' previously defined here 4 | int solve(int N, int B){ | ^~~~~ a.cc:27:5: error: redefinition of 'int main()' 27 | int main(){ | ^~~~ a.cc:12:5: note: 'int main()' previously defined here 12 | int main(){ | ^~~~
s231427943
p03705
C++
#include<cstdio> int main(){ int n,a,b; if(a > b) return 0*printf("0\n"); if(n == 1 && a < b) return 0*printf("0\n"); printf("%d\n",a+b*(n-1)-(b+a*(n-1)+1); return 0; }
a.cc: In function 'int main()': a.cc:8:38: error: expected ')' before ';' token 8 | printf("%d\n",a+b*(n-1)-(b+a*(n-1)+1); | ~ ^ | )
s024762879
p03705
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<ll> vi; typedef vector<vi> vvi; #define pb push_back #define rep(i, a, n) for(int i = (a); i < (n); i++) #define dep(i, a, n) for(int i = (a); i >= (n); i--) #define vin(n, d) rep(i, 0, n) cin >> d[i] #define out(n) cout << (n) << endl __attribute__((constructor)) void initial() { cin.tie(0); ios::sync_with_stdio(false); } int main() { int n, a, b; cin >> n >> a >> b; out((b * n) - (a * n)) }
a.cc: In function 'int main()': a.cc:25:1: error: expected ';' before '}' token 25 | } | ^
s434624837
p03705
C++
#include <iostream> int main() { long N, A, B; std::cin >> N >> A >> B; std::cout << std::max( 0, ( A + B * ( N - 1 ) ) - ( A * ( N - 1 ) + B ) + 1 ) << std::endl; return 0; }
a.cc: In function 'int main()': a.cc:7:31: error: no matching function for call to 'max(int, long int)' 7 | std::cout << std::max( 0, ( A + B * ( N - 1 ) ) - ( A * ( N - 1 ) + B ) + 1 ) << std::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: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:7:31: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long int') 7 | std::cout << std::max( 0, ( A + B * ( N - 1 ) ) - ( A * ( N - 1 ) + B ) + 1 ) << std::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
s974606523
p03705
C
#include<stdio.h>   int main() {   long n, a, b, m;   scanf("%d %d %d", &n, &a, &b);   if (a > b) { m = 0; } else { if (n == 1) { if (a == b) { m = 1; } else { m = 0; } }   else if (n > 1) { m = (b - a)*(n - 2) + 1; } else { m = 0; } } printf("%d\n", m); return 0; }
main.c:3:1: error: stray '\302' in program 3 | <U+00A0> | ^~~~~~~~ main.c: In function 'main': main.c:5:1: error: stray '\302' in program 5 | <U+00A0> | ^~~~~~~~ main.c:7:1: error: stray '\302' in program 7 | <U+00A0> | ^~~~~~~~ main.c:9:1: error: stray '\302' in program 9 | <U+00A0> | ^~~~~~~~ main.c:22:1: error: stray '\302' in program 22 | <U+00A0> | ^~~~~~~~
s277573836
p03705
C++
#include <bits/stdc++.h> using namespace std; long long n,a,b; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin>>n>>a>>b; cout<<max(0,(n-2)*(b-a+1))<<endl; }
a.cc: In function 'int main()': a.cc:11:11: error: no matching function for call to 'max(int, long long int)' 11 | cout<<max(0,(n-2)*(b-a+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: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:11:11: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 11 | cout<<max(0,(n-2)*(b-a+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:11:11: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 11 | cout<<max(0,(n-2)*(b-a+1))<<endl; | ~~~^~~~~~~~~~~~~~~~~
s455429559
p03705
C++
#include <bits/stdc++.h> #include <sys/time.h> using namespace std; #define rep(i,n) for(long long i = 0; i < (long long)(n); i++) #define repi(i,a,b) for(long long i = (long long)(a); i < (long long)(b); i++) #define pb push_back #define all(x) (x).begin(), (x).end() #define fi first #define se second #define mt make_tuple #define mp make_pair template<class T1, class T2> bool chmin(T1 &a, T2 b) { return b < a && (a = b, true); } template<class T1, class T2> bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); } #define exists find_if #define forall all_of using ll = long long; using vll = vector<ll>; using vvll = vector<vll>; using P = pair<ll, ll>; using ld = long double; using vld = vector<ld>; using vi = vector<int>; using vvi = vector<vi>; vll conv(vi& v) { vll r(v.size()); rep(i, v.size()) r[i] = v[i]; return r; } using Pos = complex<double>; template <typename T, typename U> ostream &operator<<(ostream &o, const pair<T, U> &v) { o << "(" << v.first << ", " << v.second << ")"; return o; } template<size_t...> struct seq{}; template<size_t N, size_t... Is> struct gen_seq : gen_seq<N-1, N-1, Is...>{}; template<size_t... Is> struct gen_seq<0, Is...> : seq<Is...>{}; template<class Ch, class Tr, class Tuple, size_t... Is> void print_tuple(basic_ostream<Ch,Tr>& os, Tuple const& t, seq<Is...>){ using s = int[]; (void)s{0, (void(os << (Is == 0? "" : ", ") << get<Is>(t)), 0)...}; } template<class Ch, class Tr, class... Args> auto operator<<(basic_ostream<Ch, Tr>& os, tuple<Args...> const& t) -> basic_ostream<Ch, Tr>& { os << "("; print_tuple(os, t, gen_seq<sizeof...(Args)>()); return os << ")"; } ostream &operator<<(ostream &o, const vvll &v) { rep(i, v.size()) { rep(j, v[i].size()) o << v[i][j] << " "; o << endl; } return o; } template <typename T> ostream &operator<<(ostream &o, const vector<T> &v) { o << '['; rep(i, v.size()) o << v[i] << (i != v.size()-1 ? ", " : ""); o << "]"; return o; } template <typename T> ostream &operator<<(ostream &o, const set<T> &m) { o << '['; for (auto it = m.begin(); it != m.end(); it++) o << *it << (next(it) != m.end() ? ", " : ""); o << "]"; return o; } template <typename T, typename U> ostream &operator<<(ostream &o, const map<T, U> &m) { o << '['; for (auto it = m.begin(); it != m.end(); it++) o << *it << (next(it) != m.end() ? ", " : ""); o << "]"; return o; } template <typename T, typename U, typename V> ostream &operator<<(ostream &o, const unordered_map<T, U, V> &m) { o << '['; for (auto it = m.begin(); it != m.end(); it++) o << *it; o << "]"; return o; } vector<int> range(const int x, const int y) { vector<int> v(y - x + 1); iota(v.begin(), v.end(), x); return v; } template <typename T> istream& operator>>(istream& i, vector<T>& o) { rep(j, o.size()) i >> o[j]; return i;} string bits_to_string(ll input, ll n=64) { string s; rep(i, n) s += '0' + !!(input & (1ll << i)); reverse(all(s)); return s; } template <typename T> unordered_map<T, ll> counter(vector<T> vec){unordered_map<T, ll> ret; for (auto&& x : vec) ret[x]++; return ret;}; string substr(string s, P x) {return s.substr(x.fi, x.se - x.fi); } struct ci : public iterator<forward_iterator_tag, ll> { ll n; ci(const ll n) : n(n) { } bool operator==(const ci& x) { return n == x.n; } bool operator!=(const ci& x) { return !(*this == x); } ci &operator++() { n++; return *this; } ll operator*() const { return n; } }; size_t random_seed; namespace std { using argument_type = P; template<> struct hash<argument_type> { size_t operator()(argument_type const& x) const { size_t seed = random_seed; seed ^= hash<ll>{}(x.fi); seed ^= (hash<ll>{}(x.se) << 1); return seed; } }; }; // hash for various class namespace myhash{ const int Bsizes[]={3,9,13,17,21,25,29,33,37,41,45,49,53,57,61,65,69,73,77,81}; const int xor_nums[]={0x100007d1,0x5ff049c9,0x14560859,0x07087fef,0x3e277d49,0x4dba1f17,0x709c5988,0x05904258,0x1aa71872,0x238819b3,0x7b002bb7,0x1cf91302,0x0012290a,0x1083576b,0x76473e49,0x3d86295b,0x20536814,0x08634f4d,0x115405e8,0x0e6359f2}; const int hash_key=xor_nums[rand()%20]; const int mod_key=xor_nums[rand()%20]; template <typename T> struct myhash{ std::size_t operator()(const T& val) const { return (hash<T>{}(val)%mod_key)^hash_key; } }; }; template <typename T> class uset:public std::unordered_set<T,myhash::myhash<T>> { using SET=std::unordered_set<T,myhash::myhash<T>>; public: uset():SET(){SET::rehash(myhash::Bsizes[rand()%20]);} }; template <typename T,typename U> class umap:public std::unordered_map<T,U,myhash::myhash<T>> { public: using MAP=std::unordered_map<T,U,myhash::myhash<T>>; umap():MAP(){MAP::rehash(myhash::Bsizes[rand()%20]);} }; struct timeval start; double sec() { struct timeval tv; gettimeofday(&tv, NULL); return (tv.tv_sec - start.tv_sec) + (tv.tv_usec - start.tv_usec) * 1e-6; } struct init_{init_(){ gettimeofday(&start, NULL); ios::sync_with_stdio(false); cin.tie(0); srand((unsigned int)time(NULL)); random_seed = RAND_MAX / 2 + rand() / 2; }} init__; static const double EPS = 1e-14; static const long long INF = 1e18; static const long long mo = 1e9+7; #define ldout fixed << setprecision(40) int main(void) { ll n, a, b; cin >> n >> a >> b; cout << max(0, a + (n - 1) * b - b - (n - 1) * a + 1) << endl; return 0; }
a.cc:40:20: warning: 'template<class _Category, class _Tp, class _Distance, class _Pointer, class _Reference> struct std::iterator' is deprecated [-Wdeprecated-declarations] 40 | struct ci : public iterator<forward_iterator_tag, ll> { ll n; ci(const ll n) : n(n) { } bool operator==(const ci& x) { return n == x.n; } bool operator!=(const ci& x) { return !(*this == x); } ci &operator++() { n++; return *this; } ll operator*() const { return n; } }; | ^~~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:65, 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_iterator_base_types.h:127:34: note: declared here 127 | struct _GLIBCXX17_DEPRECATED iterator | ^~~~~~~~ a.cc: In function 'int main()': a.cc:57:16: error: no matching function for call to 'max(int, ll)' 57 | cout << max(0, a + (n - 1) * b - b - (n - 1) * a + 1) << endl; | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /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:57:16: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'}) 57 | cout << max(0, a + (n - 1) * b - b - (n - 1) * a + 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:57:16: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 57 | cout << max(0, a + (n - 1) * b - b - (n - 1) * a + 1) << endl; | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s169816760
p03705
Java
/** * Created by Karan Jobanputra on 29-05-2017. */ import java.util.Scanner; import java.io.*; import java.util.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; public class AtC015A { public static void main(String args[]) throws Exception { InputReader sc = new InputReader(System.in); PrintWriter pw = new PrintWriter(System.out); int n = sc.nextInt(); int a = sc.nextInt(); int b = sc.nextInt(); if(n==1) { if(a==b) pw.println(1); else pw.println(0); } else { if(n>1) { if(a>b) { pw.println(0); } else { int remaining = n-2; int minSum = remaining*a; int maxSum = remaining*b; pw.println(maxSum-minSum+1); } } } pw.close(); } static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numChars; private SpaceCharFilter filter; public InputReader(InputStream stream) { this.stream = stream; } public int read() { if (numChars == -1) throw new InputMismatchException(); if (curChar >= numChars) { curChar = 0; try { numChars = stream.read(buf); } catch (IOException e) { throw new InputMismatchException(); } if (numChars <= 0) return -1; } return buf[curChar++]; } public String nextLine() { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str = ""; try { str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } return str; } public int nextInt() { int c = read(); while (isSpaceChar(c)) c = read(); int sgn = 1; if (c == '-') { sgn = -1; c = read(); } int res = 0; do { if (c < '0' || c > '9') throw new InputMismatchException(); res *= 10; res += c - '0'; c = read(); } while (!isSpaceChar(c)); return res * sgn; } public long nextLong() { int c = read(); while (isSpaceChar(c)) c = read(); int sgn = 1; if (c == '-') { sgn = -1; c = read(); } long res = 0; do { if (c < '0' || c > '9') throw new InputMismatchException(); res *= 10; res += c - '0'; c = read(); } while (!isSpaceChar(c)); return res * sgn; } public double nextDouble() { int c = read(); while (isSpaceChar(c)) c = read(); int sgn = 1; if (c == '-') { sgn = -1; c = read(); } double res = 0; while (!isSpaceChar(c) && c != '.') { if (c == 'e' || c == 'E') return res * Math.pow(10, nextInt()); if (c < '0' || c > '9') throw new InputMismatchException(); res *= 10; res += c - '0'; c = read(); } if (c == '.') { c = read(); double m = 1; while (!isSpaceChar(c)) { if (c == 'e' || c == 'E') return res * Math.pow(10, nextInt()); if (c < '0' || c > '9') throw new InputMismatchException(); m /= 10; res += (c - '0') * m; c = read(); } } return res * sgn; } public String readString() { int c = read(); while (isSpaceChar(c)) c = read(); StringBuilder res = new StringBuilder(); do { res.appendCodePoint(c); c = read(); } while (!isSpaceChar(c)); return res.toString(); } public boolean isSpaceChar(int c) { if (filter != null) return filter.isSpaceChar(c); return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; } public String next() { return readString(); } public interface SpaceCharFilter { public boolean isSpaceChar(int ch); } } static class Node implements Comparable<Node> { int v; int w; Node(int v, int w) { this.v = v; this.w = w; } public int compareTo(Node node) { if (w == node.w) return Integer.compare(v, node.v); return (-1) * Integer.compare(w, node.w); } } }
Main.java:13: error: class AtC015A is public, should be declared in a file named AtC015A.java public class AtC015A { ^ 1 error
s212420363
p03705
C++
#include<bits/stdc++.h> #include<stdlib.h> using namespace std;   int main(){ int n,a,b; cin>>n>>a>>b; if((n==1)&&(a!=b)) cout<<0<<endl; exit(0); if(a>b) cout<<0<<endl; exit(0); if((n!=1)&&(a==b)) cout<<0<<endl; exit(0); int min=a*(n-1)+b; int max=a+b*(n-1); cout<<max-min+1<<endl; }
a.cc:4:1: error: extended character   is not valid in an identifier 4 |   | ^ a.cc:4:1: error: '\U000000a0' does not name a type 4 |   | ^
s423423606
p03705
C++
#include <stdio.h> int main(){ long int N,A,B,OUTPUT; scanf("%ld %ld %ld",&N,&A,&B); if(A>B){ printf("0"); return 0; } if(N==1){ if(A!=B){ printf("0"); return 0; } printf("1"); return 0; } OUTPUT = (n-2)*(B-A); // OUTPUT=(B*(N-1)+A) - (A*(N-1)+B); if(OUTPUT>0)OUTPUT++; if(OUTPUT==0)OUTPUT=1; if(OUTPUT<0)OUTPUT=0; printf("%ld\n",OUTPUT); }
a.cc: In function 'int main()': a.cc:17:19: error: 'n' was not declared in this scope 17 | OUTPUT = (n-2)*(B-A); | ^
s730032174
p03705
C++
#include <bits/stdc++.h> int main(){ unsigned long long A, B, N; cin >> N >> A >> B; if(B<A){ cout << "0" << endl; }else{ unsigned long long min = (N-1)*A + B; unsigned long long max = (N-1)*B + A; cout << max-min+1 << endl; } return 0; }
a.cc: In function 'int main()': a.cc:6:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 6 | cin >> N >> A >> B; | ^~~ | std::cin In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146, from a.cc:1: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ a.cc:9:19: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 9 | cout << "0" << endl; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:9:34: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 9 | cout << "0" << endl; | ^~~~ | std::endl In file included from /usr/include/c++/14/istream:41, from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~ a.cc:14:19: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 14 | cout << max-min+1 << endl; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:14:40: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 14 | cout << max-min+1 << endl; | ^~~~ | std::endl /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~
s686534538
p03705
C++
#include "stdafx.h" #include <iostream> using namespace std; void ap(); int main() { ap(); return 0; } void ap() { int N, A, B; cin >> N >> A >> B; int minv, maxv; minv = A*(N - 1) + B; maxv = A + B*(N - 1); int result = maxv - minv >= 0 ? maxv - minv + 1 : 0; cout << result << endl; }
a.cc:1:10: fatal error: stdafx.h: No such file or directory 1 | #include "stdafx.h" | ^~~~~~~~~~ compilation terminated.
s664326038
p03705
Java
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int N = scanner.nextInt(); int A = scanner.nextInt(); int B = scanner.nextInt(); int count = (N - 2)*(B - A) + 1; if (N == 1 && A == B) { System.out.println(1); } if (N == 1 && A !== B) { System.out.println(0); } if (N >= 2 && A > B) { System.out.println(0); } if (N >= 2 && A <= B) { System.out.println(count); } } }
Main.java:15: error: illegal start of expression if (N == 1 && A !== B) { ^ 1 error
s991826766
p03705
C++
#include <iostream> using namespace std; int main() { long long n, a, b; int ans; cin >> n >> a >> b; if(n == 1 && a == b){ ans = 1; } else if(n == 1 && a < b){ ans = 0; } else if(n == 1 && a > b){ ans = 0; if(n != 1 && a > b){ ans = 0; } else if(n != 1 && a <= b){ ans = (b-a)*(n-2)+1; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:24:2: error: expected '}' at end of input 24 | } | ^ a.cc:4:1: note: to match this '{' 4 | { | ^
s138686617
p03705
C++
#include <iostream> #include <cmath> using namespace std; int main() { int num, min, max; cin >> num >> min >> max; int between = max-min; if (num <= 0 || num < between || between < 0) { cout << 0 << endl; return 0; } else if (between == 0){ cout << 1 << endl; return 0 ; } else { cout << max(((max*(num-1)+min) - (min*(num-1)+max) +1), 0); return 0 ; } }
a.cc: In function 'int main()': a.cc:19:20: error: 'max' cannot be used as a function 19 | cout << max(((max*(num-1)+min) - (min*(num-1)+max) +1), 0); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s895400422
p03705
C++
# include <stdio.h> # include <algorithm> long long N, A, B; int main(void){ // Here your code ! scanf("%lld%lld%lld",&N,&A,&B); long long D = B - A; if (D < 0) {printf("%d\n", 0);} else if (D == 0) { if (N == 1) {printf("%d\n", 1);} else {printf("%d\n", 0);} } else { else {printf("%lld\n", (1 + (N - 2) * D));} } return 0; }
a.cc: In function 'int main()': a.cc:19:9: error: 'else' without a previous 'if' 19 | else {printf("%lld\n", (1 + (N - 2) * D));} | ^~~~
s557091759
p03705
C++
#include <stdio.h> int main(){ long int n,min,max; scanf("%d %d %d",&n,&min,&max); int i; int k=1; if(min>max || n==1){ k=0; } else if(min==max || n==2){ k=1; } else if(){ k=((max)*(n-1)+min)-(min*(n-1)+max)+1; } printf("%d",k); return 0; }
a.cc: In function 'int main()': a.cc:12:19: error: expected primary-expression before ')' token 12 | } else if(){ | ^
s737124990
p03705
C++
#include <stdio.h> int main(){ long int n,min,max; scanf("%d %d %d",&n,&min,&max); int i; int k=1; if(min>max || n==1){ k=0; } else if(min==max || n==2){ k=1; } else if(){ k=((max)*(n-1)+min)-(min*(n-1)+max)+1; } printf("%d",k); return 0; }
a.cc: In function 'int main()': a.cc:12:19: error: expected primary-expression before ')' token 12 | } else if(){ | ^
s991133997
p03705
C++
#include <algorithm> #include <iostream> #include <iomanip> #include <cstdio> #include <random> #include <string> #include <vector> #include <cmath> #include <queue> #include <set> #include <map> using namespace std; typedef pair<int,int> pii; typedef vector<int> vi; typedef vector<vi> vvi; typedef long long ll; string s; ll ans; int main() { ios::sync_with_stdio(0); cin.tie(0); cin >> s; ll n = s.size(); ll u = 0,d = 0; for(int i = 0; i < n; ++i) { ans += u; u += s[i] == 'U' } for(int i = n-1; i >= 0; --i) { ans += d; d += s[i] == 'D'; } ans += 2*((n*(n-1)) - ans); cout << ans << "\n"; return 0; }
a.cc: In function 'int main()': a.cc:28:33: error: expected ';' before '}' token 28 | u += s[i] == 'U' | ^ | ; 29 | } | ~
s868893853
p03705
C++
#include <iostream> int main() { long long n, a, b; std::cin >> n >> a >> b; std::cout << max(n*b-n*a+1,0ll); }
a.cc: In function 'int main()': a.cc:5:22: error: 'max' was not declared in this scope; did you mean 'std::max'? 5 | std::cout << max(n*b-n*a+1,0ll); | ^~~ | std::max 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:1: /usr/include/c++/14/bits/stl_algobase.h:303:5: note: 'std::max' declared here 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~
s840772804
p03705
C++
#include<iostream> #include<utility> using namespace std; int64_t main() { int64_t N, A, B; cin >> N >> A >> B; int64_t ans = 0; if (A > B) { ans = 0; } else if (N == 1) { ans = (A == B) ? 1 : 0; } else { ans = (B - A) * (N - 2) + 1; } cout << ans << endl; }
a.cc:5:1: error: '::main' must return 'int' 5 | int64_t main() { | ^~~~~~~
s104314065
p03705
C++
}
a.cc:1:1: error: expected declaration before '}' token 1 | } | ^
s106776380
p03705
Java
package atcoder; import java.util.*; public class A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long n = sc.nextLong(); long a = sc.nextLong(); long b = sc.nextLong(); System.out.println(ans(n,a,b)); sc.close(); } public static long ans(long n, long a, long b) { if (a > b) { return 0; } if (n == 1) { if (a == b) { return 1; } return 0; } return (b-a) * (n-2) + 1; } }
Main.java:5: error: class A is public, should be declared in a file named A.java public class A { ^ 1 error
s263625140
p03705
C++
#include<iostream> #include<utility> using namespace std; int main() { int N, A, B; cin >> N >> A >> B; int64_t ans = 0; if (A > B) { ans = 0; } else if (N == 1) ans = (A == B) ? 1 : 0; } else { int64_t min = A * (N - 2); int64_t max = B * (N - 2); ans = (max - min + 1); } cout << ans << endl; }
a.cc:17:9: error: expected unqualified-id before 'else' 17 | else { | ^~~~ a.cc:23:9: error: 'cout' does not name a type 23 | cout << ans << endl; | ^~~~ a.cc:24:1: error: expected declaration before '}' token 24 | } | ^
s407757500
p03705
C++
#include<iostream> #include<utility> using namespace std; int main() { int N, A, B; cin >> N >> A >> B; int64_t ans = 0; if (A > B) { ans = 0; } else if (N == 1) ans = (A == B) ? 1 : 0; } else { int64_t min = A * (N - 2); int64_t max = B * (N - 2); ans = (max - min + 1); } cout << ans << endl; }
a.cc:17:9: error: expected unqualified-id before 'else' 17 | else { | ^~~~ a.cc:23:9: error: 'cout' does not name a type 23 | cout << ans << endl; | ^~~~ a.cc:24:1: error: expected declaration before '}' token 24 | } | ^
s810478120
p03705
C++
#include<iostream> #include<utility> using namespace std; int main() { int N, A, B; cin >> N >> A >> B; int64_t ans = 0; if (A > B) { ans = 0; } else if (N == 1) ans = (A == B) ? 1 : 0; } else { int64_t min = A * (N - 2); int64_t max = B * (N - 2); ans = (max - min + 1); } cout << ans << endl; }
a.cc:17:9: error: expected unqualified-id before 'else' 17 | else { | ^~~~ a.cc:23:9: error: 'cout' does not name a type 23 | cout << ans << endl; | ^~~~ a.cc:24:1: error: expected declaration before '}' token 24 | } | ^
s273165212
p03705
C++
#include<iostream> #include<utility> using namespace std; int main() { int N, A, B; cin >> N >> A >> B; int64_t ans = 0; if (A > B) { ans = 0; } else if (N == 1) ans = (A == B) ? 1 : 0; } else { int64_t min = A * (N - 2); int64_t max = B * (N - 2); ans = (max - min + 1); } cout << ans << endl; }
a.cc:17:9: error: expected unqualified-id before 'else' 17 | else { | ^~~~ a.cc:23:9: error: 'cout' does not name a type 23 | cout << ans << endl; | ^~~~ a.cc:24:1: error: expected declaration before '}' token 24 | } | ^
s090413673
p03705
C++
#include<iostream> #include<utility> using namespace std; int main() { int N, A, B; cin >> N >> A >> B; int64_t ans = 0; if (A > B) { ans = 0; } else if (N == 1) ans = (A == B) ? 1 : 0; } else { int64_t min = A * (N - 2); int64_t max = B * (N - 2); ans = (max - min + 1); } cout << ans << endl; }
a.cc:17:9: error: expected unqualified-id before 'else' 17 | else { | ^~~~ a.cc:23:9: error: 'cout' does not name a type 23 | cout << ans << endl; | ^~~~ a.cc:24:1: error: expected declaration before '}' token 24 | } | ^
s675968827
p03705
C++
#include<iostream> #include<utility> using namespace std; int main() { int N, A, B; cin >> N >> A >> B; int64_t ans = 0; if (A > B) { ans = 0; } else if (N == 1) ans = (A == B) ? 1 : 0; } else { int64_t min = A * (N - 2); int64_t max = B * (N - 2); ans = (max - min + 1); } cout << ans << endl; }
a.cc:17:9: error: expected unqualified-id before 'else' 17 | else { | ^~~~ a.cc:23:9: error: 'cout' does not name a type 23 | cout << ans << endl; | ^~~~ a.cc:24:1: error: expected declaration before '}' token 24 | } | ^
s409695171
p03705
C++
#include<iostream> #include<utility> using namespace std; int main() { int N, A, B; cin >> N >> A >> B; int64_t ans = 0; if (A > B) { ans = 0; } else if (N == 1) ans = (A == B) ? 1 : 0; } else { int64_t min = A * (N - 2); int64_t max = B * (N - 2); ans = (max - min + 1); } cout << ans << endl; }
a.cc:17:9: error: expected unqualified-id before 'else' 17 | else { | ^~~~ a.cc:23:9: error: 'cout' does not name a type 23 | cout << ans << endl; | ^~~~ a.cc:24:1: error: expected declaration before '}' token 24 | } | ^
s320606475
p03705
C++
#include<iostream> #include<utility> using namespace std; int main() { int N, A, B; cin >> N >> A >> B; int64_t ans = 0; if (A > B) { ans = 0; } else if (N == 1) ans = (A == B) ? 1 : 0; } else { int64_t min = A * (N - 2); int64_t max = B * (N - 2); ans = (max - min + 1); } cout << ans << endl; }
a.cc:17:9: error: expected unqualified-id before 'else' 17 | else { | ^~~~ a.cc:23:9: error: 'cout' does not name a type 23 | cout << ans << endl; | ^~~~ a.cc:24:1: error: expected declaration before '}' token 24 | } | ^
s448798440
p03705
C++
#include<iostream> #include<utility> using namespace std; int main() { int N, A, B; cin >> N >> A >> B; int64_t ans = 0; if (A > B) { ans = 0; } else if (N == 1) ans = (A == B) ? 1 : 0; } else { int64_t min = A * (N - 2); int64_t max = B * (N - 2); ans = (max - min + 1); } cout << ans << endl; }
a.cc:17:9: error: expected unqualified-id before 'else' 17 | else { | ^~~~ a.cc:23:9: error: 'cout' does not name a type 23 | cout << ans << endl; | ^~~~ a.cc:24:1: error: expected declaration before '}' token 24 | } | ^
s321363632
p03705
C++
#include <cstdio> #include <queue> #include <iostream> #include <algorithm> #define INT long long #define oo 987654321 #define MOD 1000000007 using namespace std; INT n, base, T[1<<19], ans, p[200020] = {1}; struct V{ INT x, v; } a[200020]; bool cmp(V a, V b) { return a.x < b.x; } bool cmp2(V a, V b) { return a.v < b.v; } INT getSum(int l, int r) { INT sum = 0; while( l <= r ) { if( l%2 == 1 ) sum+=T[l], l++; if( r%2 == 0 ) sum+=T[r], r--; l>>=1, r>>=1; } return sum; } int main() { ios::sync_with_stdio(false); cin>>n; for(int i = 1 ; i <= n ; i++ ) p[i] = p[i-1]*2, p[i]%=MOD; for( base = 1 ; base < n ; base<<=1); for(int i = 0 ; i < n ; i++ ) cin>>a[i].x>>a[i].v; sort(a, a+n, cmp2); for(int i = 0 ; i < n ; i++ ) a[i].v = i; sort(a, a+n, cmp); for(int i = 0 ; i < n ; i++ ) { ans += (INT)pow(getSum(base+a[i].v, base*2-1)); ans %= MOD; T[base+a[i].v] = 1; } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:43:21: error: 'pow' was not declared in this scope 43 | ans += (INT)pow(getSum(base+a[i].v, base*2-1)); | ^~~
s358899720
p03705
C++
#include <iostream> using namespace std; int main() { int num, min, max; cin >> num >> min >> max; int bet = max-min; if (num <= 0 || num < bet) { cout << 0 << endl; return 0; } else if (num=bet){ cout << 1 << endl; return 0 ; } else { cout << (max(num-1)+min) - (min(num-1)+max); return 0 ; } }
a.cc: In function 'int main()': a.cc:19:21: error: 'max' cannot be used as a function 19 | cout << (max(num-1)+min) - (min(num-1)+max); | ~~~^~~~~~~ a.cc:19:40: error: 'min' cannot be used as a function 19 | cout << (max(num-1)+min) - (min(num-1)+max); | ~~~^~~~~~~
s790448173
p03705
C++
using namespace std; int main() { int A,B,N,K; cin>>N,A,B; if (A<B) if (N<=2) K=1; else K=(N-2)*(B-A+1); else if (A==B) K=1; else K=0; cout<<K<<endl; return 0; }
a.cc: In function 'int main()': a.cc:6:5: error: 'cin' was not declared in this scope 6 | cin>>N,A,B; | ^~~ a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' +++ |+#include <iostream> 1 | using namespace std; a.cc:21:5: error: 'cout' was not declared in this scope 21 | cout<<K<<endl; | ^~~~ a.cc:21:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:21:14: error: 'endl' was not declared in this scope 21 | cout<<K<<endl; | ^~~~ a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' +++ |+#include <ostream> 1 | using namespace std;
s218895296
p03705
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll n, a, b; scanf("%lld %lld %lld", &n, &a, &b); printf("%lld", max(0, b * (n - 2) - a * (n - 2) + 1)); }
a.cc: In function 'int main()': a.cc:9:27: error: no matching function for call to 'max(int, ll)' 9 | printf("%lld", max(0, b * (n - 2) - a * (n - 2) + 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:9:27: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'}) 9 | printf("%lld", max(0, b * (n - 2) - a * (n - 2) + 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:9:27: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 9 | printf("%lld", max(0, b * (n - 2) - a * (n - 2) + 1)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s581470894
p03705
C++
#include <iostream> #include <vector> #include <algorithm> #include <set> #include <numeric> using namespace std; set<int> ans; void CombinationRepetitionUtil(int chosen[], int arr[], int index, int r, int start, int end) { // Since index has become r, current combination is // ready to be printed, print if (index == r) { int s = 0; for (int i = 0; i < r; i++){ s += arr[chosen[i]]; } ans.insert(s); return; } // One by one choose all elements (without considering // the fact whether element is already chosen or not) // and recur for (int i = start; i <= end; i++) { chosen[index] = i; CombinationRepetitionUtil(chosen, arr, index + 1, r, i, end); } } void CombinationRepetition(int arr[], int n, int r) { // Allocate memory int chosen[r+1]; // Call the recursice function CombinationRepetitionUtil(chosen, arr, 0, r, 0, n-1); } int main(){ long long N, A, B; vector<long long> v; cin >> N >> A >> B; if ( (A > B) || (N==1 && A < B) ){ cout << 0 << endl; return 0; } if ((N==1 && A==B) || N==2){ cout << 1 << endl; } N = N-2; for(long long i=A;i<=B;i++) v.push_back(i); CombinationRepetition(&v[0],v.size(),N); cout << ans.size() << endl; return 0; //CombinationRepetitionUtil(&v[0],v.size(),) }
a.cc: In function 'int main()': a.cc:63:25: error: cannot convert '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type*' {aka 'long long int*'} to 'int*' 63 | CombinationRepetition(&v[0],v.size(),N); a.cc:38:32: note: initializing argument 1 of 'void CombinationRepetition(int*, int, int)' 38 | void CombinationRepetition(int arr[], int n, int r) | ~~~~^~~~~
s516694810
p03705
Java
import java.util.*; import java.lang.*; import java.io.*; public class Main{ public static void main (String[] args) throws java.lang.Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); char[] building = br.readLine().toCharArray(); int sum = 0; int length = building.length; if(length > 5000){} for(int i = 1;i<=length;i++){ if(building[i-1] == 'U'){ sum += (i - 1) * 2; sum += length - i; } else if(building[i-1] == 'D'){ sum += i - 1; sum += (length - i) * 2; } }} else{ for(int i = 0;i<length;i++){ for(int l = 0;l<length;l++){ if(i == l) continue; if((i < l && building[i] == 'D') || (i > l && building[i] == 'U')){ sum += 2; } else{ sum++; } } } } System.out.println(sum); } }
Main.java:22: error: illegal start of type else{ ^ Main.java:35: error: <identifier> expected System.out.println(sum); ^ Main.java:35: error: <identifier> expected System.out.println(sum); ^ Main.java:38: error: class, interface, enum, or record expected } ^ 4 errors
s466077964
p03705
C++
#include<iostream> using namespace std; long long n,a,b; int main() { cin>>n>>a>>b; long long mn=a*(n-1)+b,mx=b*(n-1)+a; cout<<((a>b||(n==1&&a!=b))?0:mx-mn+1); return 0; }
a.cc: In function 'int main()': a.cc:9:8: error: unable to find numeric literal operator 'operator""\U0000ff1b' 9 | return 0; | ^~~ a.cc:9:11: error: expected ';' before '}' token 9 | return 0; | ^ | ; 10 | } | ~
s278114941
p03705
C++
#include<bits/stdc++.h> using namespace std; int main(){ long long int N,A,B; cin>>N>>A>>B; if(A==B){ cout<<a<<endl; return 0; } if(A>B){ cout<<0<<endl; return 0; } if(N==1){ if(A==B){ cout<<1<<endl; } else{ cout<<0<<endl; } return 0; } if(N==2){ cout<<1<<endl; return 0; } if(N%5!=0){ cout<<(N-2)*(B-A)+1<<endl; } else{ if(B-A<=1) cout<<(N-2)*(B-A)+1<<endl; else cout<<(N-2)*(B-A)<<endl; } }
a.cc: In function 'int main()': a.cc:7:23: error: 'a' was not declared in this scope 7 | cout<<a<<endl; | ^
s486409019
p03705
C++
# include <stdio.h> long long N, A, B; int main(void){ // Here your code ! scanf("%lld%lld%lld",&N,&A,&B); long long D = B - A; if (D < 0) {printf("%d\n", 0); return 0;} if (D == 0) { if (N == 1) printf("%d\n", 1); return 0; else {printf("%d\n", 0); return 0; } else { if (N == 1) {printf("%d\n", 0); return 0;} printf("%lld\n", (1 + (N - 2) * D)); } return 0; }
a.cc: In function 'int main()': a.cc:15:9: error: expected '}' before 'else' 15 | else {printf("%d\n", 0); return 0; | ^~~~ a.cc:13:17: note: to match this '{' 13 | if (D == 0) { | ^ a.cc:17:5: error: 'else' without a previous 'if' 17 | else { | ^~~~
s738280882
p03705
Java
import java.util.Scanner; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int a = sc.nextInt(); int b = sc.nextInt(); if(n==0 || a>b){ System.out.print(0); }else if(a<b && n==1){ System.out.print(0); }else if(a==b && n!=1){ System.out.print(0); }else if(a==b && n==1){ System.out.print(1); }else if(n==2){ System.out.print(1); } int k = n-2; int j = b-a-1; int s = j+2; for (int i = 0; i < s; i++ ) { int r += (s-i); } int ret = r*k; } }
Main.java:24: error: ';' expected int r += (s-i); ^ Main.java:24: error: not a statement int r += (s-i); ^ Main.java:24: error: ';' expected int r += (s-i); ^ 3 errors
s345321781
p03705
Java
import java.util.Scanner; /** * Created by DELL on 2017/5/27. */ public class _1 { public static void main(String[] args) { Scanner input=new Scanner(System.in); int N=input.nextInt(); int A=input.nextInt(); int B=input.nextInt(); if(N<1) System.out.println(0); else if((N==1&&(A!=B))||A>B) System.out.println(0); else if(A==B) System.out.println(1); else System.out.println(B*(N-1)+A-(A*(N-1)+B)+1); } }
Main.java:6: error: class _1 is public, should be declared in a file named _1.java public class _1 { ^ 1 error
s620078329
p03705
C
#include <stdio.h> int main(void){ int a,b; int n; unsigned long long int ans; scanf("%d %d %d", &n, &a, &b); if( a > b) ans = 0; if( a =< b) ans = (unsigned long long int)(b-a)*(n-2)+1; if( n == 1) ans = 0; printf("%llu\n", ans); return 0; }
main.c: In function 'main': main.c:10:12: error: expected expression before '<' token 10 | if( a =< b) ans = (unsigned long long int)(b-a)*(n-2)+1; | ^
s714017034
p03705
C++
#include <iostream> using namespace std; int solve(){ long n,a,b,cnt; long ans=1,cnt=0; cin>>n>>a>>b; if(b<a){ ans=0; }else if(b>=a&&n<2){ ans=0; }else{ while(cnt<n-2){ ans*=(b-a+1); cnt++; } } cout<<ans<<endl; } int main() { solve(); return 0; }
a.cc: In function 'int solve()': a.cc:6:20: error: redeclaration of 'long int cnt' 6 | long ans=1,cnt=0; | ^~~ a.cc:5:20: note: 'long int cnt' previously declared here 5 | long n,a,b,cnt; | ^~~ a.cc:19:1: warning: no return statement in function returning non-void [-Wreturn-type] 19 | } | ^
s257127329
p03705
C++
#include <stdio.h> int main() { int n, a, b; scanf("%d %d %d", &n, &a, &b); int count = 0; if(n == 1 && a == b) { printf("%d\n", 1); return 0; } else if(n == 2 && a =< b) { printf("%d\n", 2); return 0; } else if(n <= 2) { printf("%d\n", 0); return 0; } printf("%d\n", (b-a+1)*(n-2)); return 0; }
a.cc: In function 'int main()': a.cc:15:27: error: expected primary-expression before '<' token 15 | else if(n == 2 && a =< b) | ^
s321043942
p03705
C++
#include <iostream> using namespace std; int solve(){ long n,a,b,cnt; long ans=1,cnt=0; cin>>n>>a>>b; while(cnt<n-2){ ans*=(b-a+1); cnt++; } cout<<ans<<endl; } int main() { solve(); return 0; }
a.cc: In function 'int solve()': a.cc:6:20: error: redeclaration of 'long int cnt' 6 | long ans=1,cnt=0; | ^~~ a.cc:5:20: note: 'long int cnt' previously declared here 5 | long n,a,b,cnt; | ^~~ a.cc:13:1: warning: no return statement in function returning non-void [-Wreturn-type] 13 | } | ^
s072798465
p03705
C++
#include<stdio.h> #include<vector> #include<algorithm> #include<iostream> #include<stack> #include<queue> using namespace std; int main() { int a,b,c; int o=0; cin>>a>>b>>c; if(b<c) cout<<0<<endl; vector<int> a; for(int i=0;i<a;i++) int sup=0; for(int u=b;u<c+1;u++) sup+=u; return 0; }
a.cc: In function 'int main()': a.cc:17:21: error: conflicting declaration 'std::vector<int> a' 17 | vector<int> a; | ^ a.cc:12:13: note: previous declaration as 'int a' 12 | int a,b,c; | ^ a.cc:21:9: error: 'sup' was not declared in this scope 21 | sup+=u; | ^~~
s549419958
p03705
C++
#include<stdio.h> #include<vector> #include<algorithm> #include<iostream> #include<stack> #include<queue> using namespace std; int main() { int a,b,c; int o=0; cin>>a>>b>>c; if(b<c) cout<<0<<endl; vector<int> a; for(int i=0;i<a;i++) int sup=0 for(int u=b;u<c+1;u++) sup+=u; return 0; }
a.cc: In function 'int main()': a.cc:17:21: error: conflicting declaration 'std::vector<int> a' 17 | vector<int> a; | ^ a.cc:12:13: note: previous declaration as 'int a' 12 | int a,b,c; | ^ a.cc:20:9: error: expected ',' or ';' before 'for' 20 | for(int u=b;u<c+1;u++) | ^~~ a.cc:20:21: error: 'u' was not declared in this scope 20 | for(int u=b;u<c+1;u++) | ^
s428013422
p03705
C++
#include<stdio.h> #include<math.h> #include<string.h> #include<algorithm> #include<stdlib.h> #include<queue> #include<iostream> #include<map> #include<stack> using namespace std; int main() { int N,A,B; long long result=0; scanf("%d%d%d",&N,&A,&B); if(A>B||N<2){printf("%d",result);return;} result = pow(N-2,(B-A))+1; printf("%lld",result); }
a.cc: In function 'int main()': a.cc:17:42: error: return-statement with no value, in function returning 'int' [-fpermissive] 17 | if(A>B||N<2){printf("%d",result);return;} | ^~~~~~
s570841508
p03705
C++
#include<stdio.h> #include<math.h> #include<string.h> #include<algorithm> #include<stdlib.h> #include<queue> #include<iostream> #include<map> #include<stack> using namespace std; int main() { int N,A,B; long long result=0; scanf("%d%d%d",&N,&A,&B); if(A>B||N<2){printf("%d",result);return;} result = pow(N-2,(B-A))+1; printf("%d",result); }
a.cc: In function 'int main()': a.cc:17:42: error: return-statement with no value, in function returning 'int' [-fpermissive] 17 | if(A>B||N<2){printf("%d",result);return;} | ^~~~~~
s387985697
p03705
Java
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int N=scan.nextInt(); int A=scan.nextInt(); int B=scan.nextInt(); System.out.println((Math.abs(A-B)+1)*2-1); }
Main.java:13: error: reached end of file while parsing } ^ 1 error
s976606573
p03705
C
#include <stdio.h> int main() { int a, b, i, n, nr, msum, rsum, m, conbi; m=msum=nr=rsum=conbi=0; scanf("%d%d%d", &n, &a, &b); if(a>b){ printf("0\n", ); }else if(n<b-a){ printf("0\n"); }else{ m=(b-a)+1; nr=m-(n-2) for (i = m; i > nr; i--) { msum*=i; } for(i=1;i<=n-2;i++){ rsum*=i; } conbi=msum/rsum; printf("%d\n", conbi); } return 0; }
main.c: In function 'main': main.c:9:31: error: expected expression before ')' token 9 | printf("0\n", ); | ^ main.c:14:27: error: expected ';' before 'for' 14 | nr=m-(n-2) | ^ | ; 15 | for (i = m; i > nr; i--) | ~~~
s746451191
p03705
Java
import java.util; public class Main { public static vaid main (String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int a = sc.nextInt(); int b = sc.nextInt(); if(n==0 || a>b){ System.out.print(0); }else if(a<b && n==1){ System.out.print(0); }else if(a==b && n!=1){ System.out.print(0); }else if(a==b && n==1){ System.out.print(1); } System.out.print(N+1); } }
Main.java:1: error: cannot find symbol import java.util; ^ symbol: class util location: package java Main.java:4: error: cannot find symbol public static vaid main (String[] args) { ^ symbol: class vaid location: class Main Main.java:5: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:5: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:18: error: cannot find symbol System.out.print(N+1); ^ symbol: variable N location: class Main 5 errors
s702247236
p03705
C++
include <iostream> using namespace std; int N, A,B, ans; void solve(){ if(N == 1){ if ( A == B){ ans = 1; } else{ ans = 0; } } else { ans = (A - B) * (N-2) + 1; } } void swapab(){ int tmp; if(A < B){ tmp = A; A = B; B = tmp; } } int main(){ cin >> N >> A >> B; swapab(); solve(); printf("%d", ans); return 0; }
a.cc:1:1: error: 'include' does not name a type 1 | include <iostream> | ^~~~~~~ a.cc: In function 'int main()': a.cc:30:5: error: 'cin' was not declared in this scope 30 | cin >> N >> A >> B; | ^~~ a.cc:33:5: error: 'printf' was not declared in this scope 33 | printf("%d", ans); | ^~~~~~ a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | include <iostream>
s134247161
p03705
C++
#include <cstdio> #include <iostream> using namespace std; int checkbox[1000000000000]; int count; int main(){ for(int i = 0; i < 10000000; i++) checkbox[i] = 0; int N, min, max; cin >> N >> min >> max; if(N == 1 && max - min >=1) { cout << 0 << endl; return 0;} if(min > max) { cout << 0 << endl; return 0;} if(N == 1 && max == min){ cout << 1 << endl; return 0; } N = N - 2; count = count + max * N - min * N + 1; cout << count << endl; }
/tmp/ccXsAvyl.o: in function `main': a.cc:(.text+0x144): relocation truncated to fit: R_X86_64_PC32 against symbol `count' defined in .bss section in /tmp/ccXsAvyl.o a.cc:(.text+0x15d): relocation truncated to fit: R_X86_64_PC32 against symbol `count' defined in .bss section in /tmp/ccXsAvyl.o a.cc:(.text+0x163): relocation truncated to fit: R_X86_64_PC32 against symbol `count' defined in .bss section in /tmp/ccXsAvyl.o collect2: error: ld returned 1 exit status
s126609437
p03705
Java
mport java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int A = sc.nextInt(); int B = sc.nextInt(); if(B<A){ System.out.println(0); } else if(N==1){ if(B!=A){ System.out.println(0); } if(B==A){ System.out.println(1); } } else{ System.out.println(B*(N-2)-A*(N-2)+1); } } }
Main.java:1: error: class, interface, enum, or record expected mport java.util.*; ^ 1 error
s358197357
p03705
C
#include <stdio.h> int main(void){ int a,b; int n; long long long int ans; scanf("%d %d %d", &n, &a, &b); if( a == b) ans = 1; if( a > b) ans = 0; if( a < b) ans = (long long long int)(b-a)*(n-2)+1; printf("%llld\n", ans); return 0; }
main.c: In function 'main': main.c:5:15: error: 'long long long' is too long for GCC 5 | long long long int ans; | ^~~~ main.c:11:33: error: 'long long long' is too long for GCC 11 | if( a < b) ans = (long long long int)(b-a)*(n-2)+1; | ^~~~
s933572818
p03705
C++
#include<iostream> #include<fstream> #include<cmath> #include<string> #include<set> #include <map> #include<vector> #include <queue> #include <stack> #include<algorithm> using namespace std; typedef long long ll; #define f(i, x, n) for(int i = x; i < (int)(n); ++i) typedef pair<int, int> ii; const double PI = acos(-1.0); const ll INF = LLONG_MAX; const ll F = LLONG_MIN; const int A = 1234567; int main() { int a, b, c; cin >> a >> b >> c; if (a == 1) { if (b == c) { cout << 1; } else cout << 0; return 0; } if (b > c) { cout << 0; return 0; } int f = 2 + (c - b -1); //cout << f << endl; int p = a - 2; cout << p * f - 1; return 0; }
a.cc:16:16: error: 'LLONG_MAX' was not declared in this scope 16 | const ll INF = LLONG_MAX; | ^~~~~~~~~ a.cc:11:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 10 | #include<algorithm> +++ |+#include <climits> 11 | using namespace std; a.cc:17:14: error: 'LLONG_MIN' was not declared in this scope 17 | const ll F = LLONG_MIN; | ^~~~~~~~~ a.cc:17:14: note: 'LLONG_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
s573764398
p03705
C
#include<stdio.h> int main(){ int n,a,b; scanf("%d %d %d",&n,&a,&b);
main.c: In function 'main': main.c:4:1: error: expected declaration or statement at end of input 4 | scanf("%d %d %d",&n,&a,&b); | ^~~~~
s507948420
p03705
C++
#include <stdio.h> int main(){ scanf("%d%d%d",&n,&A,&B); if(A>B){puts("0");return 0;} if(n==1){printf("%d\n",A==B);return 0;} printf("%lld\n",(B-A)*1ll*n); }
a.cc: In function 'int main()': a.cc:3:25: error: 'n' was not declared in this scope 3 | scanf("%d%d%d",&n,&A,&B); | ^ a.cc:3:28: error: 'A' was not declared in this scope 3 | scanf("%d%d%d",&n,&A,&B); | ^ a.cc:3:31: error: 'B' was not declared in this scope 3 | scanf("%d%d%d",&n,&A,&B); | ^
s168883298
p03705
C++
#include <stdio.h> int main(){ scanf("%d%d%d",&n,&A,&B); if(A>B){puts("0");return 0;} if(n==1){printf("%d\n",A==B);return 0;} printf("%lld\n",(B-A)*1ll*n); }
a.cc: In function 'int main()': a.cc:3:25: error: 'n' was not declared in this scope 3 | scanf("%d%d%d",&n,&A,&B); | ^ a.cc:3:28: error: 'A' was not declared in this scope 3 | scanf("%d%d%d",&n,&A,&B); | ^ a.cc:3:31: error: 'B' was not declared in this scope 3 | scanf("%d%d%d",&n,&A,&B); | ^
s928510622
p03705
C++
#include<iostream> #include<stdint> using namespace std; int main() { int N, A, B; cin >> N >> A >> B; if (A > B) cout << 0; else if (N == 1 && A < B) cout << 0; else cout << (int64_t) (B - A) * (N - 2) + 1; return 0; } /* A~BまではB-A+1通りの数字がある N個において、A*(N-1)+BからA+B*(N-1)までの通りがあるので、 A+B*(N-1)-(A*(N-1)+B)+1=B*(N-2)-A*(N-2)+1=(B-A)*(N-2)+1 ただしA>Bなら0 */
a.cc:2:9: fatal error: stdint: No such file or directory 2 | #include<stdint> | ^~~~~~~~ compilation terminated.
s582141110
p03705
C++
#include <cstdio> #include <iostream> #include <algorithm> using namespace std; typedef long long ll; ll a,b,n; int main(){ cin >> n >> a >> b; if (n == 1 && a == b) cout << 1; n -= 2; else if (a > b || n < 0) cout << 0; else { cout << (b-a)*n+1; } return 0; }
a.cc: In function 'int main()': a.cc:11:9: error: 'else' without a previous 'if' 11 | else if (a > b || n < 0) cout << 0; | ^~~~
s162935301
p03705
C++
import java.util.*; public class Main{ public static void main(String [] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int l = sc.nextInt(); int r = sc.nextInt(); int min = (n - 1) * l + r; int max = (n - 1) * r + l; int ans = max - min + 1; if(ans < 0){ ans = 0; } System.out.println(ans); } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.*; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: expected unqualified-id before 'public' 3 | public class Main{ | ^~~~~~
s409768370
p03705
C++
#include <cstdio> #include <cstring> #include <algorithm> using namespace std; template<class T> inline void read(T& x) { char c = getchar(); T p = 1, n = 0; while(c < '0' || c > '9'){if(c == '-') p = -1; c = getchar();} while(c >= '0' && c <= '9'){n = n * 10 + c - '0'; c = getchar();} x = p * n; } template<class T, class U> inline void read(T& x, U& y){read(x), read(y);} template<class T, class U, class V> inline void read(T& x, U& y, V& z){read(x), read(y), read(z);} int main() { long long n, a, b; read(n, a, b); if(a > b) { puts("0"); return 0; } if(n == 1 && a != b) { puts("0"); return 0; } long long ans = a + b * (n - 1) - b - a * (n - 1) + 1; printf("%lld\n", max(ans, 0)); return 0; }
a.cc: In function 'int main()': a.cc:29:29: error: no matching function for call to 'max(long long int&, int)' 29 | printf("%lld\n", max(ans, 0)); | ~~~^~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from a.cc:3: /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:29:29: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 29 | printf("%lld\n", max(ans, 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:29:29: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 29 | printf("%lld\n", max(ans, 0)); | ~~~^~~~~~~~
s219621223
p03705
C++
#include<iostream> #include<algorithm> #include<cstdio> #include<cmath> #include<math.h> #include<string> #include<string.h> #include<stack> #include<queue> #include<vector> #include<utility> #include<set> #include<map> #include<stdlib.h> #include<iomanip> using namespace std; #define ll long long #define ld long double #define EPS 0.0000000001 #define INF 1e9 #define MOD 1000000007 #define rep(i,n) for(i=0;i<n;i++) #define loop(i,a,n) for(i=a;i<n;i++) #define all(in) in.begin(),in.end() #define shosu(x) fixed<<setprecision(x) #define int ll typedef vector<int> vi; typedef pair<int,int> pii; signed main(void) { int i,j; int n,a,b; string s; cin>>n>>a>>b; int ans1=a+b*(n-1); int ans2=a*(n-1)+b; cout<<max(0,ans1-ans2+1)<<endl; }
a.cc: In function 'int main()': a.cc:40:12: error: no matching function for call to 'max(int, long long int)' 40 | cout<<max(0,ans1-ans2+1)<<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: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:40:12: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 40 | cout<<max(0,ans1-ans2+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, from a.cc:3: /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:40:12: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 40 | cout<<max(0,ans1-ans2+1)<<endl; | ~~~^~~~~~~~~~~~~~~
s852946358
p03705
Java
import java.io.IOException; import java.io.InputStream; import java.util.NoSuchElementException; public class Main { private static FastScanner sc = new FastScanner(); public static void main(String[] args) { long n = sc.nextInt(); long a = sc.nextInt(); long b = sc.nextInt(); if(n == 1) { if(a != b) { System.out.println(0); return; } else { System.out.println(1); return; } } long ans = (b-a)*(n-2)+1 System.out.println(ans); } static class FastScanner { private final InputStream in = System.in; private final byte[] buffer = new byte[1024]; private int ptr = 0; private int buflen = 0; private boolean hasNextByte() { if (ptr < buflen) { return true; }else{ ptr = 0; try { buflen = in.read(buffer); } catch (IOException e) { e.printStackTrace(); } if (buflen <= 0) { return false; } } return true; } private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;} private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;} private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;} public boolean hasNext() { skipUnprintable(); return hasNextByte();} public String next() { if (!hasNext()) throw new NoSuchElementException(); StringBuilder sb = new StringBuilder(); int b = readByte(); while(isPrintableChar(b)) { sb.appendCodePoint(b); b = readByte(); } return sb.toString(); } public long nextLong() { return Long.parseLong(next()); } public int nextInt(){ return Integer.parseInt(next()); } } }
Main.java:23: error: ';' expected long ans = (b-a)*(n-2)+1 ^ 1 error
s060303319
p03705
C++
#include <iostream> #include <algorithm> #include <vector> #include <string> int main() { int64_t N, A, B; std::cin >> N >> A >> B; int64_t min = A + B + A * (N - 2); int64_t max = A + B + B * (N - 2); std::cout << std::max(0LL, max - min + 1) << std::endl; }
a.cc: In function 'int main()': a.cc:13:30: error: no matching function for call to 'max(long long int, int64_t)' 13 | std::cout << std::max(0LL, max - min + 1) << std::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: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:13:30: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int64_t' {aka 'long int'}) 13 | std::cout << std::max(0LL, max - min + 1) << std::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:2: /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:13:30: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 13 | std::cout << std::max(0LL, max - min + 1) << std::endl; | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~
s738081761
p03705
C++
#include <iostream> #include <vector> #include <algorithm> #include <map> #include <queue> #include <tuple> #include <cmath> using namespace std; typedef pair<int,int> P; typedef tuple<int,int,int> T; int main(){ int64_t N,A,B; cin>>N>>A>>B; int64_t lo = (N-1)*A+B; int64_t up = (N-1)*B+A; cout<<max(0LL,up-lo+1)<<endl; return 0; }
a.cc: In function 'int main()': a.cc:17:14: error: no matching function for call to 'max(long long int, int64_t)' 17 | cout<<max(0LL,up-lo+1)<<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: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' ('long long int' and 'int64_t' {aka 'long int'}) 17 | cout<<max(0LL,up-lo+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, from a.cc:3: /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 'long long int' 17 | cout<<max(0LL,up-lo+1)<<endl; | ~~~^~~~~~~~~~~~~
s117556539
p03705
C++
#include<map> #include<set> #include<list> #include<cmath> #include<queue> #include<stack> #include<cstdio> #include<string> #include<vector> #include<complex> #include<cstdlib> #include<cstring> #include<numeric> #include<sstream> #include<iostream> #include<algorithm> #include<functional> #define mp make_pair #define pb push_back #define all(x) (x).begin(),(x).end() #define YES() printf("YES\n") #define NO() printf("NO\n") using namespace std; #define int long long //typedef long long ll; typedef unsigned long long ull; typedef vector<bool> vb; typedef vector<int> vi; typedef vector<vb> vvb; typedef vector<vi> vvi; typedef pair<int,int> P; const int INF=1e+9; const double EPS=1e-9; const int MOD=1000000007; const int dx[]={1,0,-1,0},dy[]={0,-1,0,1}; signed main(){ int n,a,b,mi,ma; cin >> n >> a >> b; mi = a * (n - 1) + b; ma = b * (n - 1) + a; cout << max(0,ma - mi + 1) << endl; return 0; }
a.cc: In function 'int main()': a.cc:47:20: error: no matching function for call to 'max(int, long long int)' 47 | cout << max(0,ma - mi + 1) << endl; | ~~~^~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_tree.h:63, from /usr/include/c++/14/map:62, 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:47:20: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 47 | cout << max(0,ma - mi + 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, from a.cc:16: /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:47:20: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 47 | cout << max(0,ma - mi + 1) << endl; | ~~~^~~~~~~~~~~~~~~
s733279195
p03705
C++
#include<bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(0); cin.tie(0); long long n, a, b; cin >> n >> a >> b; cout << (a + (n-1)*b) - (b + (n-1)*a)) + 1 << endl; }
a.cc: In function 'int main()': a.cc:9:46: error: expected ';' before ')' token 9 | cout << (a + (n-1)*b) - (b + (n-1)*a)) + 1 << endl; | ^ | ;
s609712801
p03706
C++
#include <bits/stdc++.h> using namespace std; #define int long long int main() { string S; cin >> S; int N = S.size(); int ans = (N-1)*(N-1); for(int i=0; i<N; i++){ if(i == 0 || i == N-1){ continue; } else if(S[i] == 'U'){ ans += i; } else{ ans += N-1-i; } } cout << ans << endl; }
cc1plus: error: '::main' must return 'int'