submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s612228570
p03838
C++
#include <bits/stdc++.h> #define REP(i, x, n) for (int i = x; i < (int)(n); i++) #define rep(i, n) REP(i, 0, n) #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define sz(x) (int)(x.size()) #define popcount(x) __builtin_popcount(x) #define popcountll(x) __builtin_popcountll(x) #define uniq(x) x.erase(unique(x.begin(), x.end()), x.end()) #define F first #define S second #define mp make_pair #define eb emplace_back #define pii pair<int, int> #define pll pair<ll, ll> using namespace std; typedef long long ll; /* --- INFやMODの値が適切か確認する --- */ // const int INF = 1 << 30; // const ll INF = 1LL << 60; // const ll MOD = 1000000007; int main() { int x, y; cin >> x >> y; if (x <= y) { if ((x >= 0 && y >= 0) || (x <= 0 && y <= 0)) { cout << (y - x) << endl; } else { cout << abs(abs(x) - y) + 1 << endl; } } else { if ((x >= 0 && y >= 0) || (x <= 0 && y <= 0)) { cout << x - y + (x == 0 || y == 0) ? 1 : 2 << endl; } else { cout << abs(abs(y) - x) + 1 << endl; } } }
a.cc: In function 'int main()': a.cc:39:50: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<' 39 | cout << x - y + (x == 0 || y == 0) ? 1 : 2 << endl; | ~~^~~~~~~
s478007248
p03838
C++
a
a.cc:1:1: error: 'a' does not name a type 1 | a | ^
s723227728
p03838
C++
#include <bits/stdc++.h> using namespace std; int main() { int x, y; cin >> x >> y; long long ans = abs( abs( y - abs( x ) ); if( x * y < 0 || x < 0 && y < 0 && abs( Y ) < abs( x ) ) ans++; else if( x < 0 && y < 0 && abs( Y ) >= abs( x ) || x > 0 && y > 0 && abs( Y ) < abs( x ) ) ans += 2; cout << ans << endl; }
a.cc: In function 'int main()': a.cc:9:49: error: expected ')' before ';' token 9 | long long ans = abs( abs( y - abs( x ) ); | ~ ^ | ) a.cc:10:49: error: 'Y' was not declared in this scope 10 | if( x * y < 0 || x < 0 && y < 0 && abs( Y ) < abs( x ) ) ans++; | ^
s509118282
p03838
C
#include <stdio.h> #include <stdlib.h> int main() { int x,y; scanf("%d %d",&x,&y); int ans = abs(abs(x) - abs(y)); if(y > x) { if(x < 0 && y > 0) { ans += 1; } } else { if(x < 0 && y > 0) { ans += 2; } else { ans += ; } } printf("%d",ans); }
main.c: In function 'main': main.c:26:20: error: expected expression before ';' token 26 | ans += ; | ^
s731749982
p03838
C++
#include <bits/stdc++.h> using namespace std; int main(){ long int x, y; cin >> x >> y; if(x * y = 0){ if(x > 0){ cout << x + 1; }else if(x < 0){ cout << x; }else if(y < 0){ cout << y + 1; }else{ cout << y; } }else if(x * y < 0){ cout << x + y + 1; }else if(x > y){ cout << x - y + 2; }else{ cout << y - x; } }
a.cc: In function 'int main()': a.cc:7:8: error: lvalue required as left operand of assignment 7 | if(x * y = 0){ | ~~^~~
s975740585
p03838
C++
//C #ifndef _GLIBCXX_NO_ASSERT #include <cassert> #endif #include <cctype> #include <cerrno> #include <cfloat> #include <ciso646> #include <climits> #include <clocale> #include <cmath> #include <csetjmp> #include <csignal> #include <cstdarg> #include <cstddef> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #if __cplusplus >= 201103L #include <ccomplex> #include <cfenv> #include <cinttypes> #include <cstdalign> #include <cstdbool> #include <cstdint> #include <ctgmath> #include <cwchar> #include <cwctype> #endif // C++ #include <algorithm> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <locale> #include <map> #include <memory> #include <new> #include <numeric> #include <ostream> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdexcept> #include <streambuf> #include <string> #include <typeinfo> #include <utility> #include <valarray> #include <vector> #if __cplusplus >= 201103L #include <array> #include <atomic> #include <chrono> #include <condition_variable> #include <forward_list> #include <future> #include <initializer_list> #include <mutex> #include <random> #include <ratio> #include <regex> #include <scoped_allocator> #include <system_error> #include <thread> #include <tuple> #include <typeindex> #include <type_traits> #include <unordered_map> #include <unordered_set> #endif //ここまで毎回include //以下プログラム using namespace std; int main() { int x, y; cin >> x >> y; int result = 0; if (0 <= x && 0 <= y) { if (x <= y) { result += y - x; } else { result++; result += (y * (-1) - (x * (-1)); result++; } } else if (x < 0 && 0 <= y) { if (x * (-1) <= y) { result++; result += y - (x * (-1)); } else { result += (y * (-1)) - x; result++; } } else if (0 <= x && y < 0) { if (x * (-1) <= y) { result++; result += y - (x * (-1)); } else { result += y * (-1) - x; result++; } } else { if (x <= y) { result += y - x; } else { result++; result += (y * (-1)) - (x * (-1)); } } cout << result << endl; }
a.cc: In function 'int main()': a.cc:104:57: error: expected ')' before ';' token 104 | result += (y * (-1) - (x * (-1)); | ~ ^ | )
s093797928
p03838
C++
#include <bits/stdc++.h> #define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) #define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++) #define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--) #define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--) #define ALL(v) (v).begin(),(v).end() #define MOD 1000000007 #define NIL -1 #define FI first #define SE second #define MP make_pair #define PB push_back #define SZ(x) (int)x.size() #define SP(x) setprecision((int)x) using namespace std ; typedef long long ll; typedef vector<int> vint; typedef vector<vint> vvint; typedef vector<string> vstr; typedef pair<int, int> pii; const int INF = 1e9; const ll LINF = 1e18; const double EPS = 1e-9; ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;} //最大公約数 ll lcm(ll a, ll b) {return a / gcd(a, b) * b;} //最小公倍数 //------------------------------------------------- // //------------------------------------------------- int main() { cin.tie(0); ios::sync_with_stdio(false); int x, y ; cin >> x >> y ; int ans = 0 ; if(abs(x)==abs(y)){ if(x!=y){ ans++ ; } } else if(abs(x)<abs(y)){ if(x<0){ ans++ ; } if(y<0){ ans++ ; } cnt += (abs(y)-abs(x)) ; } else{ if(x<0){ ans += y-x ; } else if(x>0){ ans++ ; ans += x+y ; } else{ if(y<0){ ans++ ; } ans += abs(y) ; } } cout <<ans <<endl ; return 0 ; }
a.cc: In function 'int main()': a.cc:56:5: error: 'cnt' was not declared in this scope; did you mean 'int'? 56 | cnt += (abs(y)-abs(x)) ; | ^~~ | int
s161595965
p03838
C++
asdf
a.cc:1:1: error: 'asdf' does not name a type 1 | asdf | ^~~~
s075261500
p03838
C++
#include <bits/stdc++.h> using namespace std; int main(){ int x,y; cin>>x>>y; if(x<y){ if(abs(x)<abs(y)){ cout<<min(y-x,1+abs(y+x))<<endl; }else if(-x==y){ cout<<1<<endl; }else{ cout<<min(y-x,abs(x)-abs(y)+1)<<endl; } }else{ if(abs(x)<abs(y)){ cout<<min(abs(y)-x+1,2+abs(y)-abs(x))<<endl; }else if(abs(x)==abs(y)){ cout<<1<<endl; }else{ if(y<=0){ cout<<1+x+y<<endl; }else{ cout<<2+x-y<<endl } } } }
a.cc: In function 'int main()': a.cc:23:26: error: expected ';' before '}' token 23 | cout<<2+x-y<<endl | ^ | ; 24 | } | ~
s401281994
p03838
C++
#include <bits/stdc++.h> using namespace std; #define rep(i, N) for(int i=0; i<N; i++) typedef long long ll; int main() { ll x, y; cin >> x >> y; if(x==y){ cout << 0 << endl; return 0; } if(x==0){ if(y<0) {cout << -y+1LL << endl; return 0;} else {cout << y << endl; return 0;} } if(y==0){ if(x<0) {cout << -x << endl; return 0;} if(x>0) {cout << x+1LL << endl; return 0;} } if(x < 0 && y < x){ cout << (x-y) + 2LL << endl; } else if(x < 0 && y < 0){ cout << (y-x) << endl; } else if(x < 0 && y > 0 && -x < y){ cout << y + x + 1LL<< endl; } else if(x < 0 && y > 0 && -x > y){ cout << -x - y + 1LL << endl; } if(x > 0 && y > x){ cout << y - x << endl; } else if(x > 0 && 0 < y){ cout << x - y + 2LL << endl; } else if(x > 0 && y < 0 && -y > x){ cout << -y - x + 1LL << endl; } else if(x > 0 && y < 0 && -y < x){ cout << x + y + 1Ll << endl; } }
a.cc: In function 'int main()': a.cc:49:25: error: unable to find numeric literal operator 'operator""Ll' 49 | cout << x + y + 1Ll << endl; | ^~~
s446681288
p03838
C++
#include <bits/stdc++.h> #define rep(i,n)for(long long i=0;i<(n);i++) using namespace std; typedef long long ll; typedef pair<int,int> P; const int MOD=1000000007; const int INF=0x3f3f3f3f; const ll INFL=0x3f3f3f3f3f3f3f3f; ll gcd(ll x, ll y){ if(y==0) return x; else return gcd(y, x%y); } ll lcm(ll x,ll y){ ll g=gcd(x,y); return x/g*y; } int main(){ ll x,y; cin >> x >> y; if(x<y){ if(0<=x && 0<=y)cout << y-x << endl; else if(0<=y && y>=-x)cout<<1+y+x<<endl; else if(0<=y && -x>=y) cout << y-x << endl; else cout << y-x << endl; else{ if(0<=x && 0<=y)cout<<2+x-y<<endl; else if(0<=x && x>=-y) cout<<1+x+y<<endl; else if(0<=x && x<=-y) cout<<1-y-x<<endl; else cout <<2-y+x << endl; } }
a.cc: In function 'int main()': a.cc:27:3: error: expected '}' before 'else' 27 | else{ | ^~~~ a.cc:22:10: note: to match this '{' 22 | if(x<y){ | ^
s503823500
p03838
C++
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize("Ofast") #define rep(i,n) for(int i=0;i<n;i++) const long long MOD = 1000000007; typedef pair<int,int> P; typedef long long ll; ll n,m,k,ans; string s; int main(){ long long x,y; cin >> x >> y; if( x < y ) { if( x*y > 0 ) cout << y-x << "\n"; else if( abs(x) < abs(y) ) cout << abs(y)-abs(x)+1 << "\n"; else cout << y-x << "\n"; }else (x > y){ if(x*y > 0 && x < 0) cout << x-y+2 << "\n"; else if(x*y > 0 && x > 0) cout << x+y+1 << "\n"; else if(abs(x) < abs(y) ) cout << -y-x+1 << "\n"; else cout << y+x+1 << "\n"; }else { cout << 0 << "\n"; } }
a.cc: In function 'int main()': a.cc:18:16: error: expected ';' before '{' token 18 | }else (x > y){ | ^ | ; a.cc:23:4: error: 'else' without a previous 'if' 23 | }else { | ^~~~
s410163081
p03838
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, N) for (int i = 0; i < (int)N; i++) const ll MOD = pow(10,9)+7; const ll LLINF = pow(2,61)-1; const int INF = pow(2,30)-1; int main() { ll x, y; cin >> x >> y; ll result = 0; if (x<0) { if (y<0) { if (x>y) result = x-y+2; else result = y-x; } else { result = abs(x+y)+1; } } else if (x>0){ if (y<0) { result = abs(x+y)+1; } else { if (x>y) result = x+y+1; else result = y-x; } } else { reuslt = (y>0) ? y : y+1; } cout << result << endl; return 0; }
a.cc: In function 'int main()': a.cc:34:5: error: 'reuslt' was not declared in this scope; did you mean 'result'? 34 | reuslt = (y>0) ? y : y+1; | ^~~~~~ | result
s785420187
p03838
Java
// x < y // x < 0 && y < 0 || x > 0 && y > 0 : y-x // x < 0 && y > 0 // |x| < |y| : y+x+1 // |y| < |x| : -y-x+1 // y < x // y < 0 && x < 0 : +2 // y > 0 && x > 0 : +2 // y < 0 && x > 0 // |x| < |y| : +1 // |y| < |x| : +1 import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int x = sc.nextInt(); int y = sc.nextInt(); int A = Math.abs(Math.abs(x)-Math.abs(y)); int B = 0; if (x == 0 || y == 0) { B = 0; } else if (x > y) { B = (long)x*y < 0 ? 1 : 0; } else if (y < x) { B = (long)x*y > 0 ? 2 : 1; } Systrm.out.println(A+B); } }
Main.java:29: error: package Systrm does not exist Systrm.out.println(A+B); ^ 1 error
s480644410
p03838
Java
// x < y // x < 0 && y < 0 || x > 0 && y > 0 : y-x // x < 0 && y > 0 // |x| < |y| : y+x+1 // |y| < |x| : -y-x+1 // y < x // y < 0 && x < 0 : +2 // y > 0 && x > 0 : +2 // y < 0 && x > 0 // |x| < |y| : +1 // |y| < |x| : +1 import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int x = sc.nextInt(); int y = sc.nextInt(); int A = Math.abs(Math.abs(x)-Math.abs(y)); int B = 0; if (x == 0 || y == 0) { B = 0; } else if (x > y) { B = (long)x*y < 0 ? 1 : 0; } else if (y < x) { B = (long)x*y > 0 : 2 : 1; } Systrm.out.println(A+B); } }
Main.java:27: error: ';' expected B = (long)x*y > 0 : 2 : 1; ^ 1 error
s753236084
p03838
C++
#include <bits/stdc++.h> using namespace std; int main(){ long long int a,b; cin >> a >> b; if (a>=0 && a<b) { cout << b-a <<endl; }else if (a>=0 && b>0){ cout <<2+a-b<< endl; }else if (b<=0 && a<b){ cout << b-a <<endl; }else if (a<0 && b<a) cout << 2+a-b <<endl; } else{ cout << 1+abs(abs(a)-abs(b)) <<endl; } }
a.cc:12:3: error: expected unqualified-id before 'else' 12 | } else{ cout << 1+abs(abs(a)-abs(b)) <<endl; | ^~~~ a.cc:14:1: error: expected declaration before '}' token 14 | } | ^
s085225710
p03838
C++
#include <bits/stdc++.h> #define ll long long #define rep(i, n) for(ll i=0; i<n; i++) #define repr(i, s, e) for(ll i=s; i>=e; i--) #define reps(i, s, e) for(ll i=s; i<=e; i++) #define inf 1e18 #define all(v) v.begin(),v.end() #define vsort(v) sort(v.begin(), v.end()) #define vsortr(v) sort(v.begin(), v.end(), greater<ll>()) #define sz(x) x.size() #define ceil(a, b) (a+b-1)/b #define ok cout << "ok" << endl; #define sp << " " << using namespace std; template<typename T> inline bool chmax(T &a, T b){ if(a<b){ a=b; return true; } return false; } template<typename T> inline bool chmin(T &a, T b){ if(b<a){ a=b; return true; } return false; } template<typename T> T gcd(T a, T b){ if(b==0) return a; return gcd(b, a%b); } template<typename T> T lcm(T a, T b){ return a*(b/gcd(a, b)); } template<typename T> T keta(T num){ T k=0; while(num>0){ num/=10; k++; } return k; } template<typename T> void vdebug(vector<T> v){ for(auto vv : v){ cout << vv << " "; } cout << endl; } template<typename T> void adebug(T arr[], ll n){ reps(i, 0, n){ cout << arr[i] << " "; } cout << endl; } void ans(bool b){ if(b) cout << "Yes" << endl; else cout << "No" << endl; } void ans2(bool b){ if(b) cout << "YES" << endl; else cout << "NO" << endl; } int dx[] = {1, -1, 0, 0, 1, -1, 1, -1}; int dy[] = {0, 0, 1, -1, 1, -1, -1, 1}; int main(){ ios::sync_with_stdio(false); cin.tie(0); ll x, y; cin >> x >> y; ll res = 0; if(y > x){ if(y*x >= 0){ res = y-x; }else{ if(abs(y) > abs(x)){ res = y-abs(x)+1; }else if(abs(y) < abs(x)){ res = abs(x)-y+1; }else{ res = 1; } } }else{ if(abs(x) > abs(y)){ res = abs(x)-abs(y)+1 }else if(abs(x) < abs(y)){ if(x >= 0){ res = abs(y)-x+1; }else{ res = abs(y)-abs(x)+2; } }else{ res = 1; } } cout << res << endl; return 0; }
a.cc: In function 'int main()': a.cc:50:34: error: expected ';' before '}' token 50 | res = abs(x)-abs(y)+1 | ^ | ; 51 | }else if(abs(x) < abs(y)){ | ~
s837437190
p03838
C++
#include <iostream> using namespace std; int main() { long long int x, y; cin >> x >> y; long long int ans = 1LL << 60; if (x <= y) ans = min(res, y-x); if (-x <= y) ans = min(ans, y+x+1); if (x <= -y) ans = min(ans, -y-x+1); if (-x <= -y) ans = min(ans, -y + x + 2); cout << ans << endl; }
a.cc: In function 'int main()': a.cc:8:25: error: 'res' was not declared in this scope 8 | if (x <= y) ans = min(res, y-x); | ^~~
s077431765
p03838
C++
#include <bits/stdc++.h> using namespace std; const int MOD = 1000000007; const double PI = acos(-1); //long long using ll = long long; //出力系 #define print(x) cout << x << endl #define yes cout << "Yes" << endl #define YES cout << "YES" << endl #define no cout << "No" << endl #define NO cout << "NO" << endl // begin() end() #define all(x) (x).begin(),(x).end() //for #define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i) //最大公約数(ll) ll gcd(ll x, ll y) { return y ? gcd(y,x%y) : x;} //素因数分解 vector<pair<ll, int>>factorize(ll n){ vector<pair<ll, int>> res; for(ll i = 2; i * i <= n; ++i){ if(n % i) continue; res.emplace_back(i, 0); while(n % i == 0){ n /= i; res.back().second++; } } if(n != 1) res.emplace_back(n, 1); return res; } //二分探索(最小値を出す問題は疑う) // bool C(ll x){ // ll res = 0; // for(int i = 0; i < n; ++i){ // res += max(0ll, a[i]-x/f[i]); // } // return res <= k; // } // ll binary_search(ll ok, ll ng){ // while(abs(ok - ng) > 1){ // ll mid = (ok + ng) / 2; // if(C(mid)) ok = mid; // else ng = mid; // } // return ok; // } int main(){ int x, y; cin >> x >> y; ll ans = 10e18; if(x <= y) ans = min(ans, y - x); if(-x <= y) ans = min(ans, y + x + 1); if(x <= - y) ans = min(ans, -y + x + 1); if(-x <= -y) ans = min(ans, - y + x - 2); cout << ans << endl; }
a.cc: In function 'int main()': a.cc:67:12: warning: overflow in conversion from 'double' to 'll' {aka 'long long int'} changes value from '1.0e+19' to '9223372036854775807' [-Woverflow] 67 | ll ans = 10e18; | ^~~~~ a.cc:68:23: error: no matching function for call to 'min(ll&, int)' 68 | if(x <= y) ans = min(ans, y - x); | ~~~^~~~~~~~~~~~ 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:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:68:23: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 68 | if(x <= y) ans = min(ans, y - x); | ~~~^~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:68:23: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 68 | if(x <= y) ans = min(ans, y - x); | ~~~^~~~~~~~~~~~ a.cc:69:24: error: no matching function for call to 'min(ll&, int)' 69 | if(-x <= y) ans = min(ans, y + x + 1); | ~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:69:24: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 69 | if(-x <= y) ans = min(ans, y + x + 1); | ~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:69:24: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 69 | if(-x <= y) ans = min(ans, y + x + 1); | ~~~^~~~~~~~~~~~~~~~ a.cc:70:25: error: no matching function for call to 'min(ll&, int)' 70 | if(x <= - y) ans = min(ans, -y + x + 1); | ~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:70:25: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 70 | if(x <= - y) ans = min(ans, -y + x + 1); | ~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:70:25: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 70 | if(x <= - y) ans = min(ans, -y + x + 1); | ~~~^~~~~~~~~~~~~~~~~ a.cc:71:25: error: no matching function for call to 'min(ll&, int)' 71 | if(-x <= -y) ans = min(ans, - y + x - 2); | ~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:71:25: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 71 | if(-x <= -y) ans = min(ans, - y + x - 2); | ~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:71:25: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 71 | if(-x <= -y) ans = min(ans, - y + x - 2); | ~~~^~~~~~~~~~~~~~~~~~
s592618532
p03838
C++
#include <bits/stdc++.h> using namespace std; //↓0-originか1-originでn回繰り返し #define rep(i,n) for(int i = 0; i < ((int)(n)); i++) //0-origin昇順 #define rep1(i,n) for(int i = 1; i <= ((int)(n)); i++) //1-origin昇順 #define rrep(i,n) for(int i = ((int)(n)-1); i >= 0; i--) //0-origin降順 #define rrep1(i,n) for(int i = ((int)(n)); i >= 1; i--) //1-origin降順 //rep2 -> 第二引数 m から n 回繰り返し ex) m=5 n=3 なら i=5,i=6,i=7 まで #define rep2(i,m,n) for(int i = ((int)(m)); i < ((int)(n))+((int)(m)); i++) #define SIZE(x) ((int)((x).size())) #define all(x) (x).begin(),(x).end() typedef long long ll; typedef long double ld; typedef vector<int> vi; typedef vector<vi> vii; //2次元配列 typedef vector<ll> vll; typedef vector<string> vs; template<typename T> bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1;} return 0;} template<typename T> bool chmin(T &a, const T &b){ if(a>b){ a=b; return 1;} return 0;} /*FUNCs=================================================*/ /*MAIN==================================================*/ int main(){ int x, y; cin >> x >> y; ll ans = 1e16; if(x <= y) ans = min(ans, y - x); if(x <= -y) ans = min(ans, -y - x + 1); if(-x <= y) ans = min(ans, y + x + 1); if(-x <= -y) ans = min(ans, -y + x + 2); cout<< ans << '\n'; }
a.cc: In function 'int main()': a.cc:32:29: error: no matching function for call to 'min(ll&, int)' 32 | if(x <= y) ans = min(ans, y - x); | ~~~^~~~~~~~~~~~ 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:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:32:29: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 32 | if(x <= y) ans = min(ans, y - x); | ~~~^~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:32:29: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 32 | if(x <= y) ans = min(ans, y - x); | ~~~^~~~~~~~~~~~ a.cc:34:30: error: no matching function for call to 'min(ll&, int)' 34 | if(x <= -y) ans = min(ans, -y - x + 1); | ~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:34:30: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 34 | if(x <= -y) ans = min(ans, -y - x + 1); | ~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:34:30: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 34 | if(x <= -y) ans = min(ans, -y - x + 1); | ~~~^~~~~~~~~~~~~~~~~ a.cc:36:30: error: no matching function for call to 'min(ll&, int)' 36 | if(-x <= y) ans = min(ans, y + x + 1); | ~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:36:30: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 36 | if(-x <= y) ans = min(ans, y + x + 1); | ~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:36:30: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 36 | if(-x <= y) ans = min(ans, y + x + 1); | ~~~^~~~~~~~~~~~~~~~ a.cc:38:31: error: no matching function for call to 'min(ll&, int)' 38 | if(-x <= -y) ans = min(ans, -y + x + 2); | ~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:38:31: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 38 | if(-x <= -y) ans = min(ans, -y + x + 2); | ~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:38:31: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 38 | if(-x <= -y) ans = min(ans, -y + x + 2); | ~~~^~~~~~~~~~~~~~~~~
s079235653
p03838
C++
#include <bits/stdc++.h> //press B 0 or 1 time, then press A 0 or more times, then press B 0 or 1 time int main(){ int x, y; cin >> x >> y; ll ans = 1e16; //0...0 if(x <= y) ans = min(ans, y - x); //0...1 if(x <= -y) ans = min(ans, -y - x + 1); //1...0 if(-x <= y) ans = min(ans, y + x + 1); //1...1 if(-x <= -y) ans = min(ans, -y + x + 2); cout<< ans << '\n'; }
a.cc: In function 'int main()': a.cc:7:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 7 | cin >> x >> y; | ^~~ | 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:8:9: error: 'll' was not declared in this scope 8 | ll ans = 1e16; | ^~ a.cc:10:20: error: 'ans' was not declared in this scope; did you mean 'abs'? 10 | if(x <= y) ans = min(ans, y - x); | ^~~ | abs a.cc:10:26: error: 'min' was not declared in this scope; did you mean 'std::min'? 10 | if(x <= y) ans = min(ans, y - x); | ^~~ | std::min In file included from /usr/include/c++/14/algorithm:61, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ a.cc:12:21: error: 'ans' was not declared in this scope; did you mean 'abs'? 12 | if(x <= -y) ans = min(ans, -y - x + 1); | ^~~ | abs a.cc:12:27: error: 'min' was not declared in this scope; did you mean 'std::min'? 12 | if(x <= -y) ans = min(ans, -y - x + 1); | ^~~ | std::min /usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ a.cc:14:21: error: 'ans' was not declared in this scope; did you mean 'abs'? 14 | if(-x <= y) ans = min(ans, y + x + 1); | ^~~ | abs a.cc:14:27: error: 'min' was not declared in this scope; did you mean 'std::min'? 14 | if(-x <= y) ans = min(ans, y + x + 1); | ^~~ | std::min /usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ a.cc:16:22: error: 'ans' was not declared in this scope; did you mean 'abs'? 16 | if(-x <= -y) ans = min(ans, -y + x + 2); | ^~~ | abs a.cc:16:28: error: 'min' was not declared in this scope; did you mean 'std::min'? 16 | if(-x <= -y) ans = min(ans, -y + x + 2); | ^~~ | std::min /usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ a.cc:17:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 17 | cout<< ans << '\n'; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:17:16: error: 'ans' was not declared in this scope; did you mean 'abs'? 17 | cout<< ans << '\n'; | ^~~ | abs
s578305190
p03838
C++
#include <bits/stdc++.h> #define INF INT_MAX #define ll long long #define ull unsigned long long #define rep(i,n) for(ll i=0; i<n; ++i) #define FOR(i, s, e) for(ll i=s; i<e; ++i) #define MOD 1000000007 using namespace std; template<class T> inline bool chmin(T& a, T b) { if(a>b) {a=b; return true;} return false;} template<class T> inline bool chmax(T& a, T b) { if(a<b) {a=b; return true;} return false;} int main() { cin.tie(0); ios::sync_with_stdio(false); int X, Y; cin >> X >> Y; if(X<0&&Y<X)ans+=2; else if(X>0&&Y>0&&X>Y)ans+=2; else if(X<0&&Y<=0&&X<Y)ans+=0; else if(X<0&&Y<0&&X<Y)ans++; else if((X<0&&Y>0)||(X>0&&Y<0))ans++; else if(X==0&&Y<0)ans++; else if(X>0&&Y==0)ans++; cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:16:15: error: 'ans' was not declared in this scope; did you mean 'abs'? 16 | if(X<0&&Y<X)ans+=2; | ^~~ | abs a.cc:17:25: error: 'ans' was not declared in this scope; did you mean 'abs'? 17 | else if(X>0&&Y>0&&X>Y)ans+=2; | ^~~ | abs a.cc:18:26: error: 'ans' was not declared in this scope; did you mean 'abs'? 18 | else if(X<0&&Y<=0&&X<Y)ans+=0; | ^~~ | abs a.cc:19:25: error: 'ans' was not declared in this scope; did you mean 'abs'? 19 | else if(X<0&&Y<0&&X<Y)ans++; | ^~~ | abs a.cc:20:34: error: 'ans' was not declared in this scope; did you mean 'abs'? 20 | else if((X<0&&Y>0)||(X>0&&Y<0))ans++; | ^~~ | abs a.cc:21:21: error: 'ans' was not declared in this scope; did you mean 'abs'? 21 | else if(X==0&&Y<0)ans++; | ^~~ | abs a.cc:22:21: error: 'ans' was not declared in this scope; did you mean 'abs'? 22 | else if(X>0&&Y==0)ans++; | ^~~ | abs a.cc:23:9: error: 'ans' was not declared in this scope; did you mean 'abs'? 23 | cout<<ans<<endl; | ^~~ | abs
s370837573
p03838
C++
#include <iostream> #include <fstream> #include <vector> #include <cstring> #include <string> #include <cmath> #include <algorithm> // sort #include <iomanip> #include <queue> #include <map> #include <bits/stdc++.h> using namespace std; #define DEBUG 0 #define REP(i, n) for (long long i = 0; i < (n); i++) typedef long long ll; static const ll INF = 1000000000000000000LL; typedef pair<int,int> pint; const int MOD = 1000000007; //1,2,3,4 // //1,2 //1,2,3 //1,2,3,4 //2,3 //2,3,4 //3,4 int main(){ #if DEBUG std::ifstream in("input.txt"); std::cin.rdbuf(in.rdbuf()); #endif ll x, y; cin >> x >> y; ll res; if(x > = 0 && x <= y) { res = y-x; } else { if(abs(x) <= abs(y)) { res = y - x + 1; if(x < 0)++res; } else { res = x + y + 1; } } cout << res << endl; return 0; }
a.cc: In function 'int main()': a.cc:44:12: error: expected primary-expression before '=' token 44 | if(x > = 0 && x <= y) | ^
s248008744
p03838
Java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int x = sc.nextInt(); int y = sc.nextInt(); int cnt1 = 1; int cnt2 = 1; int cnt3 = 2; if(x<=y){ if(x>=0||y<=0){ System.out.println(y-x); return; }else if(-x>y){ System.out.println(y-x); return; }else if(-x==y){ System.out.println(1); return; }else{ System.out.println(1+y+x); return; } } if(y>=0){ cnt1+=3000000000; cnt2+=y+x; cnt3+=3000000000; } else if(-y<x){ cnt1+=3000000000; cnt2+=y+x; cnt3+=x-y; } else{ cnt1+=-y-x; cnt2+=3000000000; cnt3+=x-y; } System.out.println(Math.min(cnt1,Math.min(cnt2,cnt3))); } }
Main.java:26: error: integer number too large cnt1+=3000000000; ^ Main.java:28: error: integer number too large cnt3+=3000000000; ^ Main.java:31: error: integer number too large cnt1+=3000000000; ^ Main.java:37: error: integer number too large cnt2+=3000000000; ^ 4 errors
s566234666
p03838
C++
/* @ by batr (T) */ #include <bits/stdc++.h> #define ll long long #define pb push_back #define mp make_pair #define all(X) (X).begin(), (X).end() #define cmp_all(X) (X).begin(), (X).end(), cmp #define B begin() #define E end() #define sz size() #define skip continue #define ppi pair<pair<int, int>, int> #define pii pair<int, int> #define pli pair<ll, int> #define pcc pair<char, char> #define F first #define S second using namespace std; const int maxn = 1e7 + 17; const int MAXN = maxn * 4; const int darr = 1e3 + 17; const ll INF = 1e17 + 5; const int mod = 1e9 + 7; void Need_For_Speed () { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); } int ct; int n, m; int main () { Need_For_Speed(); cin >> n >> m; if (n > m) { cout << n - m + 2; } else { cout << m - x; } return 0; }
a.cc: In function 'int main()': a.cc:48:29: error: 'x' was not declared in this scope 48 | cout << m - x; | ^
s652401838
p03838
C++
/* @ by batr (T) */ #include <bits/stdc++.h> #define ll long long #define pb push_back #define mp make_pair #define all(X) (X).begin(), (X).end() #define cmp_all(X) (X).begin(), (X).end(), cmp #define B begin() #define E end() #define sz size() #define skip continue #define ppi pair<pair<int, int>, int> #define pii pair<int, int> #define pli pair<ll, int> #define pcc pair<char, char> #define F first #define S second using namespace std; const int maxn = 1e7 + 17; const int MAXN = maxn * 4; const int darr = 1e3 + 17; const ll INF = 1e17 + 5; const int mod = 1e9 + 7; void Need_For_Speed () { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); } int ct; int n, m; int main () { Need_For_Speed(); cin >> n >> m; if (n == m) { cout << 0; return 0; } if (n == 0 && m) { cout << m; return 0; } if (n && m == 0) { if (n > 0) { ct++; } cout << m + ct; return 0; } if (n < 0 && m > 0) { n = abs(n); if (n <= m) { cout << m - n + 1; } else { n *= -1; cout << m - n + 1; } } if (n > 0 && m < 0) { m = abs(m); if (n <= m) { cout << m - n + 1; } else { cout << n - m + 1; } } if (n < 0 && m < 0) { n = abs(n); m = abs(m); if (n <= m) { cout << m - n + 2; } -5 -2 else { cout << m - n; } } if (n > 0 && m > 0) { if (n <= m) { cout << m - n; } else { cout << n - m + 2; } } return 0; }
a.cc: In function 'int main()': a.cc:84:22: error: expected ';' before 'else' 84 | -5 -2 | ^ | ; 85 | else { | ~~~~
s962885760
p03838
C++
/* @ by batr (T) */ #include <bits/stdc++.h> #define ll long long #define pb push_back #define mp make_pair #define all(X) (X).begin(), (X).end() #define cmp_all(X) (X).begin(), (X).end(), cmp #define B begin() #define E end() #define sz size() #define skip continue #define ppi pair<pair<int, int>, int> #define pii pair<int, int> #define pli pair<ll, int> #define pcc pair<char, char> #define F first #define S second using namespace std; const int maxn = 1e7 + 17; const int MAXN = maxn * 4; const int darr = 1e3 + 17; const ll INF = 1e17 + 5; const int mod = 1e9 + 7; void Need_For_Speed () { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); } int ct; int n, m; int main () { #ifndef ONLINE_JUDGE freopen ("input.txt", "r", stdin); freopen ("output.txt", "w", stdout); #endif Need_For_Speed(); cin >> n >> m; if (n == m) { cout << 0; return 0; } if (n == 0 && m) { cout << m; return 0; } if (n && m == 0) { if (n > 0) { ct++; } cout << m + ct; return 0; } if (n < 0 && m > 0) { n = abs(n); if (n <= m) { cout << m - n + 1; } else { n *= -1; cout << m - n + 1; } } if (n > 0 && m < 0) { m = abs(m); if (n <= m) { cout << m - n + 1; } else { cout << n - m + 1; } } if (n < 0 && m < 0) { n = abs(n); m = abs(m); if (n <= m) { cout << m - n + 2; } -5 -2 else { cout << m - n; } } if (n > 0 && m > 0) { if (n <= m) { cout << m - n; } else { cout << n - m + 2; } } return 0; }
a.cc: In function 'int main()': a.cc:88:22: error: expected ';' before 'else' 88 | -5 -2 | ^ | ; 89 | else { | ~~~~
s603111513
p03838
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> #define ll long long #define rep(i,n) for(ll i=0;i<(n);i++) #define max(p,q) ((p)>(q)?(p):(q)) #define min(p,q) ((p)<(q)?(p):(q)) #define chmax(a,b) ((a)=(a)>(b)?(a):(b)) #define chmin(a,b) ((a)=(a)<(b)?(a):(b)) #define abs(p) ((p)>=(0)?(p):(-(p))) #define MOD 1000000007 ll powll(ll a,ll b){ll r=1;rep(i,b){r*=a;}return r;} #define swap(a,b) do{ll w=(a);(a)=(b);(b)=w;}while(0) #define swapd(a,b) do{double w=(a);(a)=(b);(b)=w}while(0) #define in(a) scanf("%lld", &(a)) #define in2(a,b) scanf("%lld %lld",&(a),&(b)) #define in3(a,b,c) scanf("%lld %lld %lld",&(a),&(b),&(c)) #define ind(a) scanf("%lf", &(a)) #define ins(a) scanf("%s", (a)) #define inc(a) scanf("%c", &(a)) #define put(a) printf("%lld\n", (a)) #define putd(a) printf("%.15f\n", (a)) // puts(a) printf("%s\n", a) 文字はこっち //your code here! int main(void){ ll x, y; in2(x,y); ll ans = abs(abs(x)-abs(y)); if(ans){ if(x<y && x*y>=0) put(ans); else if(x<y) put(min(++ans), y-x); else if(x>y && x*y>0) put(ans+2); else put(++ans); } else { puts("1"); } return 0; }
main.c: In function 'main': main.c:32:41: error: macro "put" passed 2 arguments, but takes just 1 32 | else if(x<y) put(min(++ans), y-x); | ^ main.c:22:9: note: macro "put" defined here 22 | #define put(a) printf("%lld\n", (a)) | ^~~ main.c:32:22: error: 'put' undeclared (first use in this function); did you mean 'puts'? 32 | else if(x<y) put(min(++ans), y-x); | ^~~ | puts main.c:32:22: note: each undeclared identifier is reported only once for each function it appears in
s502632046
p03838
C++
#include <iostream> using namespace std; long long ll; int main() { ll x, y; cin >> x >> y; int ans = 0; if(x * y < 0) ans++; else if(x > y) ans += 2; cout << ans + abs(abs(x) - abs(y)) << endl; }
a.cc: In function 'int main()': a.cc:8:7: error: expected ';' before 'x' 8 | ll x, y; | ^~ | ; a.cc:9:12: error: 'x' was not declared in this scope 9 | cin >> x >> y; | ^ a.cc:9:17: error: 'y' was not declared in this scope 9 | cin >> x >> y; | ^
s520523153
p03838
C++
#include <iostream> #include <fstream> #include <set> #include <map> #include <stack> #include <queue> #include <vector> #include <algorithm> #include <cmath> #include <chrono> using namespace std; int main(int argc, const char * argv[]) { ios::sync_with_stdio(false); cin.tie(0); int x, y; cin >> x >> y; int64_t ans = 0; if (abs(x) <= abs(y)) { int64_t dis = abs(y) - abs(x); if (x >= 0 && y >= 0) ans = dis; if (x >= 0 && y < 0) ans = dis + 1; if (x < 0 && y >= 0) ans = dis + 1; if (x < 0 && y < 0) ans = dis + 2; } else { int64_t dis = abs(x) - abs(y); if (x >= 0 && y >= 0) ans = dis + 2; if (x >= 0 && y < 0) ans = dis + 1; if (x < 0 && y >= 0) ans = dis+ 1; if (x < 0 && y < 0) ans = dis; } cout << ans << endl; return 0; } #include <iostream> #include <fstream> #include <set> #include <map> #include <stack> #include <queue> #include <vector> #include <algorithm> #include <cmath> #include <chrono> using namespace std; int main(int argc, const char * argv[]) { ios::sync_with_stdio(false); cin.tie(0); int x, y; cin >> x >> y; int64_t ans = 0; if (abs(x) == abs(y)) { if (x == y) ans = 0; else ans = 1; } else if (abs(x) < abs(y)) { int64_t dis = abs(y) - abs(x); if (x >= 0 && y >= 0) ans = dis; if (x >= 0 && y < 0) ans = dis + 1; if (x < 0 && y >= 0) ans = dis + 1; if (x < 0 && y < 0) ans = dis + 2; } else { int64_t dis = abs(x) - abs(y); if (x >= 0 && y >= 0) ans = dis + 2; if (x >= 0 && y < 0) ans = dis + 1; if (x < 0 && y >= 0) ans = dis + 1; if (x < 0 && y < 0) ans = dis; } cout << ans << endl; return 0; }
a.cc:53:5: error: redefinition of 'int main(int, const char**)' 53 | int main(int argc, const char * argv[]) { | ^~~~ a.cc:14:5: note: 'int main(int, const char**)' previously defined here 14 | int main(int argc, const char * argv[]) { | ^~~~
s096997015
p03838
C++
#include <bits/stdc++.h> #define rep(i, n) for(int i = 0; i < (int)(n); i++) #define all(x) (x).begin(),(x).end() #define rall(x) (x).rbegin(),(x).rend() #define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() ); using namespace std; using ll = long long; int main(){ int a, b; cin >> a >> b; int ansl if(a == -b) cout << 1 << endl; else if(a >= 0 && b < 0) ans = abs(a-b)+1; else if(a <= b) cout << abs(a-b) << endl; else cout << abs(a-b)+2 << endl; }
a.cc: In function 'int main()': a.cc:14:5: error: expected initializer before 'if' 14 | if(a == -b) cout << 1 << endl; | ^~ a.cc:15:5: error: 'else' without a previous 'if' 15 | else if(a >= 0 && b < 0) ans = abs(a-b)+1; | ^~~~ a.cc:15:30: error: 'ans' was not declared in this scope; did you mean 'abs'? 15 | else if(a >= 0 && b < 0) ans = abs(a-b)+1; | ^~~ | abs
s271501892
p03838
C++
#include<iostream> #include<algorithm> using namespace std; int main() { int x,y,c = 0; cin >> x >> y; if (abs(x)==abs(y)){ c = 1; } else { if (x<y) { if (0<x) {c = y-x;} else if (0>x and 0<y) { if (abs(x)<y) { ++c; c += y-abs(x); } else if (abs(x)>y) { c += abs(x)-y; ++c; } } else if (y<0) {c = y-x;} } else if (y<x) { if (0<y) { ++c; c += abs(x) - y; ++c; } else if (0>y and 0<x) { if (abs(y) < x) { ++c; c += x -abs(y); } else if (abs(y) < x){ c += abs(y) - x; ++c; } } else if (x<0) { ++c; c += x-y; ++c; } } } cout << c << endl; return 0;
a.cc: In function 'int main()': a.cc:49:14: error: expected '}' at end of input 49 | return 0; | ^ a.cc:4:12: note: to match this '{' 4 | int main() { | ^
s804858485
p03838
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } #define all(x) (x).begin(),(x).end() #define pll pair<ll,ll> #define rep(i,n) for(int i=0;i<n;i++) const ll INF = 1LL<<60; const ll mod = (int)1e9 + 7; int main() { //ll N; cin >> N; //ll N,M; cin >> N >> M; //string S; cin >> S; //ll H,W; cin >> H >> W; ll x,y; cin >> x >> y; if(x*y>=0 && y>x)cout << y-x,; if(x*y>=0 && x>y && x>0)cout << min(x-y+2,x+y+1); else if(x*y>=0 && x>y)cout << x-y+2; else if(x*y<0)cout << abs(x+y)+1; } /* */
a.cc: In function 'int main()': a.cc:19:34: error: expected primary-expression before ';' token 19 | if(x*y>=0 && y>x)cout << y-x,; | ^
s180914528
p03838
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } #define all(x) (x).begin(),(x).end() #define pll pair<ll,ll> #define rep(i,n) for(int i=0;i<n;i++) const ll INF = 1LL<<60; const ll mod = (int)1e9 + 7; int main() { //ll N; cin >> N; //ll N,M; cin >> N >> M; //string S; cin >> S; //ll H,W; cin >> H >> W; ll x,y; cin >> x >> y; if(x*y>=0 && y>x)cout << y-x,; else if(x*y>=0 && x>y)cout << min(x-y+2,x+y+1); else if(x*y<0)cout << abs(x+y)+1; } /* */
a.cc: In function 'int main()': a.cc:19:34: error: expected primary-expression before ';' token 19 | if(x*y>=0 && y>x)cout << y-x,; | ^
s649275960
p03838
C++
#include <bits/stdc++.h> using namespace std; int main(){ int64_t x,y; cin>>x>>y; if(x<y&&x*y>=0){ cout<<max(x,y)-min(x,y); } if(x<y&&x*y>0){ cout<<2+max(x,y)-min(x,y); } if(x<y&&x*y=0){ cout<<1+max(x,y)-min(x,y); } else { int a=max(x,y); int b=min(x,y); int B=abs(b); int c=max(a,B); int d=min(a,B); int e=c-d; cout<<e+1; } }
a.cc: In function 'int main()': a.cc:12:12: error: lvalue required as left operand of assignment 12 | if(x<y&&x*y=0){ | ~~~^~~~~
s907561196
p03838
C++
#include<bits/stdc++.h> using namespace std; #define int long long #define fo(a,b) for(int a=0;a<b;a++) #define Sort(a) sort(a.begin(),a.end()) #define rev(a) reverse(a.begin(),a.end()) int wari(int a,int b) { if(a%b==0) return a/b; else return a/b+1; } int keta(int a){ double b=a; b=log10(b); int c=b; return c+1; } int souwa(int a){ return a*(a+1)/2; } int lcm(int a,int b){ int d=a,e=b,f; if(a<b) swap(a,b); int c,m=1; while(m){ c=a%b; if(c==0){ f=b; m--; } else{ a=b; b=c; } } return d*e/f; } int gcm(int a,int b){ int d=a,e=b,f; if(a<b) swap(a,b); int c,m=1; while(m){ c=a%b; if(c==0){ f=b; m--; } else{ a=b; b=c; } } return f; } bool prime(int a){ if(a<2) return false; else if(a==2) return true; else if(a%2==0) return false; double b=sqrt(a); for(int i=3;i<=b;i+=2){ if(a%i==0){ return false; } } return true; } signed main(){ int a,b; cin>>a>>b; if(a<=b){ if((a>=0&&b>=0)||(a<=0&&b<=0)) cout<<b-a<<endl; else cout<<1+abs(abs(a)-b)<<endl; } else{ if((a>=0&&b>=0)||(a<=0&&b<=0)) cout<<2+abs(a-b)<<endl; else cout<<1+cout<<1+abs(abs(b)-a)<<endl; } }
a.cc: In function 'int main()': a.cc:86:14: error: no match for 'operator+' (operand types are 'int' and 'std::ostream' {aka 'std::basic_ostream<char>'}) 86 | cout<<1+cout<<1+abs(abs(b)-a)<<endl; | ~^~~~~ | | | | | std::ostream {aka std::basic_ostream<char>} | int a.cc:86:14: note: candidate: 'operator+(int, int)' (built-in) 86 | cout<<1+cout<<1+abs(abs(b)-a)<<endl; | ~^~~~~ a.cc:86:14: note: no known conversion for argument 2 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int' In file included from /usr/include/c++/14/bits/stl_algobase.h:67, 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.h:627:5: note: candidate: 'template<class _Iterator> constexpr std::reverse_iterator<_Iterator> std::operator+(typename reverse_iterator<_Iterator>::difference_type, const reverse_iterator<_Iterator>&)' 627 | operator+(typename reverse_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:627:5: note: template argument deduction/substitution failed: a.cc:86:15: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 86 | cout<<1+cout<<1+abs(abs(b)-a)<<endl; | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:1798:5: note: candidate: 'template<class _Iterator> constexpr std::move_iterator<_IteratorL> std::operator+(typename move_iterator<_IteratorL>::difference_type, const move_iterator<_IteratorL>&)' 1798 | operator+(typename move_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1798:5: note: template argument deduction/substitution failed: a.cc:86:15: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 86 | cout<<1+cout<<1+abs(abs(b)-a)<<endl; | ^~~~ In file included from /usr/include/c++/14/string:54, 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/basic_string.h:3598:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3598 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3598:5: note: template argument deduction/substitution failed: a.cc:86:15: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 86 | cout<<1+cout<<1+abs(abs(b)-a)<<endl; | ^~~~ /usr/include/c++/14/bits/basic_string.h:3616:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3616 | operator+(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3616:5: note: template argument deduction/substitution failed: a.cc:86:15: note: mismatched types 'const _CharT*' and 'int' 86 | cout<<1+cout<<1+abs(abs(b)-a)<<endl; | ^~~~ /usr/include/c++/14/bits/basic_string.h:3635:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3635 | operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3635:5: note: template argument deduction/substitution failed: a.cc:86:15: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 86 | cout<<1+cout<<1+abs(abs(b)-a)<<endl; | ^~~~ /usr/include/c++/14/bits/basic_string.h:3652:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3652 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3652:5: note: template argument deduction/substitution failed: a.cc:86:15: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 86 | cout<<1+cout<<1+abs(abs(b)-a)<<endl; | ^~~~ /usr/include/c++/14/bits/basic_string.h:3670:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, _CharT)' 3670 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3670:5: note: template argument deduction/substitution failed: a.cc:86:15: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 86 | cout<<1+cout<<1+abs(abs(b)-a)<<endl; | ^~~~ /usr/include/c++/14/bits/basic_string.h:3682:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3682 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3682:5: note: template argument deduction/substitution failed: a.cc:86:15: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 86 | cout<<1+cout<<1+abs(abs(b)-a)<<endl; | ^~~~ /usr/include/c++/14/bits/basic_string.h:3689:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3689 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3689:5: note: template argument deduction/substitution failed: a.cc:86:15: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 86 | cout<<1+cout<<1+abs(abs(b)-a)<<endl; | ^~~~ /usr/include/c++/14/bits/basic_string.h:3696:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3696 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3696:5: note: template argument deduction/substitution failed: a.cc:86:15: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 86 | cout<<1+cout<<1+abs(abs(b)-a)<<endl; | ^~~~ /usr/include/c++/14/bits/basic_string.h:3719:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3719 | operator+(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3719:5: note: template argument deduction/substitution failed: a.cc:86:15: note: mismatched types 'const _CharT*' and 'int' 86 | cout<<1+cout<<1+abs(abs(b)-a)<<endl; | ^~~~ /usr/include/c++/14/bits/basic_string.h:3726:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3726 | operator+(_CharT __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3726:5: note: template argument deduction/substitution failed: a.cc:86:15: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 86 | cout<<1+cout<<1+abs(abs(b)-a)<<endl; | ^~~~ /usr/include/c++/14/bits/basic_string.h:3733:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const _CharT*)' 3733 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3733:5: note: template argument deduction/substitution failed: a.cc:86:15: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 86 | cout<<1+cout<<1+abs(abs(b)-a)<<endl; | ^~~~ /usr/include/c++/14/bits/basic_string.h:3740:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, _CharT)' 3740 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3740:5: note: template argument deduction/substitution failed: a.cc:86:15: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 86 | cout<<1+cout<<1+abs(abs(b)-a)<<endl; | ^~~~ In file included from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/st
s320437765
p03838
C++
#include<bits/stdc++.h> using namespace std; int main(){ long long u,v,x,y,op=0; cin>>x>>y; u=abs(x); v=abs(y); op+=abs(v-u); if(x==y){ cout<<0<<endl; return 0; } if(y>0&&x==0) cout<<op<<endl; else if(y==0&&x>0) cout<op+1;<<endl; else if(x==0&&y<0) cout<<op+1<<endl; else if(y==0&&x<0) cout<<op<<endl; else if((x<0&&y>0)||(x>0&&y<0)){ cout<<op+1<<endl; } else if(x<=0&&y<=0){ if(x>y) cout<<op+2<<endl; else if(x<y) cout<<op<<endl; } else if(x>=0&&y>=0){ if(x>y){ op=x+y; cout<<op<<endl; } else if(x<y) cout<<op<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:14:32: error: no match for 'operator<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'long long int') 14 | else if(y==0&&x>0) cout<op+1;<<endl; | ~~~~^~~~~ | | | | | long long int | std::ostream {aka std::basic_ostream<char>} a.cc:14:32: note: candidate: 'operator<(int, long long int)' (built-in) 14 | else if(y==0&&x>0) cout<op+1;<<endl; | ~~~~^~~~~ a.cc:14:32: note: no known conversion for argument 1 from 'std::ostream' {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:1143:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1143 | operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1143:5: note: template argument deduction/substitution failed: a.cc:14:36: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 14 | else if(y==0&&x>0) cout<op+1;<<endl; | ^ /usr/include/c++/14/bits/regex.h:1224: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>&)' 1224 | operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1224:5: note: template argument deduction/substitution failed: a.cc:14:36: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' 14 | else if(y==0&&x>0) cout<op+1;<<endl; | ^ /usr/include/c++/14/bits/regex.h:1317: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>&)' 1317 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1317:5: note: template argument deduction/substitution failed: a.cc:14:36: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 14 | else if(y==0&&x>0) cout<op+1;<<endl; | ^ /usr/include/c++/14/bits/regex.h:1391:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1391 | operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1391:5: note: template argument deduction/substitution failed: a.cc:14:36: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'long long int' 14 | else if(y==0&&x>0) cout<op+1;<<endl; | ^ /usr/include/c++/14/bits/regex.h:1485:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1485 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1485:5: note: template argument deduction/substitution failed: a.cc:14:36: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 14 | else if(y==0&&x>0) cout<op+1;<<endl; | ^ /usr/include/c++/14/bits/regex.h:1560:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1560 | operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1560:5: note: template argument deduction/substitution failed: a.cc:14:36: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'long long int' 14 | else if(y==0&&x>0) cout<op+1;<<endl; | ^ /usr/include/c++/14/bits/regex.h:1660:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1660 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1660:5: note: template argument deduction/substitution failed: a.cc:14:36: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 14 | else if(y==0&&x>0) cout<op+1;<<endl; | ^ 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:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed: a.cc:14:36: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::pair<_T1, _T2>' 14 | else if(y==0&&x>0) cout<op+1;<<endl; | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 448 | operator<(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed: a.cc:14:36: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 14 | else if(y==0&&x>0) cout<op+1;<<endl; | ^ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 493 | operator<(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed: a.cc:14:36: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 14 | else if(y==0&&x>0) cout<op+1;<<endl; | ^ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1694 | operator<(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed: a.cc:14:36: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 14 | else if(y==0&&x>0) cout<op+1;<<endl; | ^ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1760 | operator<(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed: a.cc:14:36: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 14 | else if(y==0&&x>0) cout<op+1;<<endl; | ^ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 673 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed: a.cc:14:36: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 14 | else if(y==0&&x>0) cout<op+1;<<endl; | ^ /usr/include/c++/14/string_view:680: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> >)' 680 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed: a.cc:14:36: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 14 | else if(y==0&&x>0) cout<op+1;<<endl; | ^ /usr/include/c++/14/string_view:688:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits
s313557471
p03838
C++
#include<bits/stdc++.h> using namespace std; #define all(a) (a).begin(),(a).end() typedef long long ll; ll mod=1000000007; int main() { ll x,y; cin >>x>>y; ll out; if(x>=0&&y>=0){ out = abs(y-x); if(x>y) out += 2; } else if(x<0&&y<0)){ out = abs(y-x); if(x>y)out += 2; } else { if(x==0||y==0){ out = abs(abs(y)-abs(x)); } else{ out = abs(abs(y)-abs(x))+1; } } cout << out << endl; return 0; }
a.cc: In function 'int main()': a.cc:13:22: error: expected primary-expression before ')' token 13 | } else if(x<0&&y<0)){ | ^
s087172644
p03838
C++
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll,ll> P; #define a first #define b second #define sz size() #define pb(x) push_back(x) #define bg begin() #define ed end() #define rep(i,n) for(ll i=0;i<n;i++) #define rep1(i,n) for(ll i=1;i<=n;i++) #define mp(x,y) make_pair(x,y) const ll MOD=1000000007; ll maxx(ll x,ll y,ll z){ return max(max(x,y),z); } ll minn(ll x,ll y,ll z){ return min(min(x,y),z); } ll gcd(ll x,ll y){ if(x%y==0) return y; else return gcd(y,x%y); } ll lcm(ll x,ll y){ return x*(y/gcd(x,y)); } //a,b x int main(){ ll x,y; cin>>>x>>y; if(x>y) cout<<x-y+2; else cout<<y-x; }
a.cc: In function 'int main()': a.cc:33:22: error: expected primary-expression before '>' token 33 | ll x,y; cin>>>x>>y; | ^
s819815457
p03838
C++
#include<bits/stdc++.h> #include<algorithm> #include<math.h> #include<string> #include<iostream> #include<vector> #include<cstdlib> using namespace std; template <class T> using V = vector<T>; template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } const long long INF = 1LL << 60; using ll = long long; using db = double; using st = string; using ch = char; using bl = bool; using vll = V<ll>; using vpll =V<pair<ll,ll>>; using vst = V<st>; using vdb = V<db>; using vch = V<ch>; using vbl = V<bl>; #define FOR(i,a,b) for(ll i=(a);i<(b);i++) #define rFOR(i,a,b) for(ll i=(a);i>(b);i--) #define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2) #define bgn begin() #define en end() #define SORT(a) sort((a).bgn,(a).en) #define REV(a) reverse((a).bgn,(a).en) #define M(a,b) max(a,b) #define rM(a,b) min(a,b) #define fi first #define se second #define sz size() #define gcd(a,b) __gcd(a,b) #define co(a) cout<<a<<endl; #define ci(a) cin>>a; ll sum(ll n) { ll m=0; FOR(i,0,20){ m+=n%10; n/=10; if(n==0){ break; } } return m; } const int MAX = 510000; const int MOD = 1000000007; long long fac[MAX], finv[MAX], inv[MAX]; void Comuse() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for (int i = 2; i < MAX; i++){ fac[i] = fac[i - 1] * i % MOD; inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD; finv[i] = finv[i - 1] * inv[i] % MOD; } } #define comuse Comuse() ll combi(int n, int k){ if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD; } ll lcm(ll a,ll b){ ll n; n=a/gcd(a,b)*b; return n; } /****************************************\ | Thank you for viewing my code:) | | Written by RedSpica a.k.a. RanseMirage | | Twitter:@asakaakasaka | \****************************************/ signed main() { ll x,y; ci(x>>y) if(x>0){ co(rM(abs(x-y),abs(x+y)+1)) } else{ x*=-1; co(rM(abs(x-y)+1,abs(x+y)+2) } }
a.cc:124:9: error: unterminated argument list invoking macro "co" 124 | } | ^ a.cc: In function 'int main()': a.cc:122:5: error: 'co' was not declared in this scope 122 | co(rM(abs(x-y)+1,abs(x+y)+2) | ^~ a.cc:122:7: error: expected '}' at end of input 122 | co(rM(abs(x-y)+1,abs(x+y)+2) | ^ a.cc:120:7: note: to match this '{' 120 | else{ | ^ a.cc:122:7: error: expected '}' at end of input 122 | co(rM(abs(x-y)+1,abs(x+y)+2) | ^ a.cc:114:15: note: to match this '{' 114 | signed main() { | ^
s860534733
p03838
C++
#include<iostream> #include<string> #include<algorithm> #include<vector> #include<iomanip> #include<math.h> #include<complex> #include<queue> #include<deque> #include<stack> #include<map> #include<set> #include<bitset> using namespace std; #define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i ) #define rep(i,n) REP(i,0,n) typedef long long ll; typedef pair<int,int> pint; typedef pair<ll,int> pli; const int inf=1e9+7; const ll longinf=1LL<<60 ; const ll mod=1000003 ; int main(){ ll x,y; cin >> x >> y; ll ans=abs(abs(x)-abs(y)); if(x*y>0 && x>y)ans+=2; if(x*y<0)ans++; if() cout << ans << endl; return 0;}
a.cc: In function 'int main()': a.cc:30:6: error: expected primary-expression before ')' token 30 | if() | ^
s097616908
p03838
C++
#include <bits/stdc++.h> using namespace std; int main() { int x,y; cin>>x>>y; if(x==(-1*y){ cout<<'1'<<endl;} else { if(x<y)){int t;t=y-x; cout<<t<<endl;} else if(x>y){ if (x>0 && y>0){int t;t=x+y+1; cout<<t<<endl;} else if (x>0 && y<0){int t;t=(-y)-x+1; cout<<t<<endl;} else if (x<0 && y<0){int t;t=(-y)-x+2; cout<<t<<endl;} } } return 0; }
a.cc: In function 'int main()': a.cc:7:15: error: expected ';' before '{' token 7 | if(x==(-1*y){ | ^ | ; a.cc:9:6: error: expected primary-expression before 'else' 9 | else { | ^~~~ a.cc:8:20: error: expected ')' before 'else' 8 | cout<<'1'<<endl;} | ^ | ) 9 | else { | ~~~~ a.cc:7:5: note: to match this '(' 7 | if(x==(-1*y){ | ^
s940393730
p03838
Java
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int x = Integer.parseInt(in.nextLine().split(" ")[0]); int y = Integer.parseInt(in.nextLine().split(" ")[1]); String xb = Integer.toBinaryString(x); String yb = integer.toBinaryString(y); int z = !(xb.length() == 32 ^ yb.length() == 32) && y - x < 0 ? Math.abs(x) - Math.abs(y) + 2 : (!(xb.length() == 32 ^ yb.length() == 32) && x - y < 0) || (xb.length() == 0 ^ yb.length() == 0) && x - y < 0 ? Math.abs(y) - Math.abs(x) : Math.abs(y) > Math.abs(x) ? Math.abs(y) - Math.abs(x) + 1 : Math.abs(x) -Math.abs(y) + 1; System.out.println(z); } }
Main.java:9: error: cannot find symbol String yb = integer.toBinaryString(y); ^ symbol: variable integer location: class Main 1 error
s376664668
p03838
C++
#include <iostream> #include <cstdlib> #include <bits/stdc++.h> using namespace std; int main() { int x, y; cin >> x >> y; if (x > y) { if (x<0) cout << (abs(y) - abs(x)) + 2 << endl; else if (x==0) cout << abs(y) + 1 << endl; else if (x>0&&y<0) cout << abs(x+y) + 1 << endl; else if (x>0&&y==0) cout << x+1 << endl; else if (x>0&&y>0) cout << (x-y) + 2 << endl; } else if (x < y) { if (x<0&&y==0) cout << abs(x) << endl; else if (x<0&&y<0) cout << abx(x) - abs(y) << endl; else if (x<0&&y>0) cout << abs(x+y) + 1 << endl; else if (x==0) cout << y << endl; else if (x>0) cout << y-x << endl; } return 0; }
a.cc: In function 'int main()': a.cc:25:15: error: 'abx' was not declared in this scope; did you mean 'abs'? 25 | cout << abx(x) - abs(y) << endl; | ^~~ | abs
s174680358
p03838
C++
#include <algorithm> #include <iostream> #include <iomanip> #include <map> #include <numeric> #include <set> #include <sstream> #include <string> #include <vector> #include <cmath> #include <unordered_map> using namespace std; #define REPI(i,a,b) for (ll i=(a);i<(b);i++) #define REP(i,n) REPI(i,0,n) typedef long long int ll; int SURP = 1000000007; int ceil(int a,int b){ return (a+b-1)/b; } ll gcd(ll a,ll b){ ll p; if (b > a){ p = a; a = b; b = p; } while(b != 0){ p = a % b; a = b; b = p; } return a; } int main(){ ll a,b; cin >> a >> b; ll ret = LLONG_MAX; ll tmp1,tmp2; tmp1 = a; tmp2 = b; if(tmp1 <= tmp2){ if(ret > tmp2 -tmp1) ret = tmp2 -tmp1; } tmp1 = a*(-1); tmp2 = b; if(tmp1 <= tmp2){ if(ret > tmp2 -tmp1 + 1) ret = tmp2 -tmp1 + 1; } tmp1 = a; tmp2 = b*(-1); if(tmp1 <= tmp2){ if(ret > tmp2 -tmp1 + 1) ret = tmp2 -tmp1 + 1; } tmp1 = a*(-1); tmp2 = b*(-1); if(tmp1 <= tmp2){ if(ret > tmp2 -tmp1 + 2) ret = tmp2 -tmp1 + 2; } cout << ret << endl; return 0; }
a.cc: In function 'int main()': a.cc:45:18: error: 'LLONG_MAX' was not declared in this scope 45 | ll ret = LLONG_MAX; | ^~~~~~~~~ a.cc:12:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 11 | #include <unordered_map> +++ |+#include <climits> 12 | using namespace std;
s342816597
p03838
C++
#include<bits/stdc++.h> using namespace std; #define int long long #define endl "\n" #define REP(i,a,n) for(int i=a;i<n;++i) #define RUP(a,b) ((a+b-1)/(b)) #define SORTG(v) sort(v.begin(),v.end(),greater<>()) #define SORT(v) sort(v.begin(),v.end()) #define ALL(v) (v).begin(),(v).end() #define pb push_back #define mp make_pair #define mt make_tuple #define MOD 1000000007 #define INF LLONG_MAX/3 typedef long long ll; typedef pair<int,int> Pii; typedef tuple<int,int,int> Tiii; typedef vector<int> Vi; typedef vector<Vi> VVi; typedef vector<string> Vs; template<class T> void chmax(T& a, T b) {if(a<b){a=b;}} template<class T> void chmin(T& a, T b) {if(a>b){a=b;}} void YesNo(int a) {if(a){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}} void YESNO(int a) {if(a){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}} int gcd(int a,int b){return b?gcd(b,a%b):a;} void start(){cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);} signed main(){start(); int x,y,ans; cin>>x>>y; int absx=abs(x),absy=abs(y); if(x==0 || y==0){ if(x>y) ans=abs(absx-absy)+1; else ans=abs(absx-absy); } if(x>0 && y>0){ if(abs(x)>abs(y)) ans=abs(absx-absy)+2; else ans=abs(absx-absy); }else if(x>0 && y<0){ if(abs(x)>abs(y)) ans=abs(absx-absy)+1; else ans=abs(absx-absy)+1; }else if(x<0 && y>0){ if(abs(x)>abs(y)) ans=abs(absx-absy)+1; else ans=abs(absx-absy)+1; }else if(x<0 && y<0){ if(abs(x)>abs(y)) ans=abs(absx-absy); else ans=abs(absx-absy)+2; } cout<<abs<<endl; return 0; }
a.cc: In function 'int main()': a.cc:52:9: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and '<unresolved overloaded function type>') 52 | cout<<abs<<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, from a.cc:1: /usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'} 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]' 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ^~~~~~~~ /usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::ios_base& (*)(std::ios_base&)' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 174 | operator<<(long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long int' 174 | operator<<(long __n) | ~~~~~^~~ /usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 178 | operator<<(unsigned long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long unsigned int' 178 | operator<<(unsigned long __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 182 | operator<<(bool __n) | ^~~~~~~~ /usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'bool' 182 | operator<<(bool __n) | ~~~~~^~~ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]' 96 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short int' 97 | operator<<(short __n) | ~~~~~~^~~ /usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 189 | operator<<(unsigned short __n) | ^~~~~~~~ /usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short unsigned int' 189 | operator<<(unsigned short __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]' 110 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'int' 111 | operator<<(int __n) | ~~~~^~~ /usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 200 | operator<<(unsigned int __n) | ^~~~~~~~ /usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'unsigned int' 200 | operator<<(unsigned int __n) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 211 | operator<<(long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long int' 211 | operator<<(long long __n) | ~~~~~~~~~~^~~ /usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 215 | operator<<(unsigned long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long unsigned int' 215 | operator<<(unsigned long long __n) | ~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 231 | operator<<(double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'double' 231 | operator<<(double __f) | ~~~~~~~^~~ /usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 235 | operator<<(float __f) | ^~~~~~~~ /usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'float' 235 | operator<<(float __f) | ~~~~~~^~~ /usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 243 | operator<<(long double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long double' 243 | operator<<(long double __f) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 301 | operator<<(const void* __p) | ^~~~~~~~ /usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'const void*' 301 | operator<<(const void* __p) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:306:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::nullptr_t) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; std::nullptr_t = std::nullptr_t]' 30
s582045817
p03838
C++
#include<iostream> #include<string> #include<algorithm> #include<bits/stdc++.h> #include<vector> using namespace std; int MOD=1000000007; int main(){ int x,y,ans=0; cin >> x >> y; if(x>=0 && y>=0 && y>=x) cout << y-x << endl; else if(x>=0 && y>=0 && x>y) cout << abs(y-x)*2+2 << endl; else if(x>=0 && y<0) cout << abs(y)-x+1 << endl; else if(x<0 && y<0 && x=y) cout << abs(y)-abs(x)+2 << endl; else if(x<0 && y<0 && x<=y) cout << abs(x)-abs(y) << endl; else cout << y-abs(x)+1 << endl; }
a.cc: In function 'int main()': a.cc:15:28: error: lvalue required as left operand of assignment 15 | else if(x<0 && y<0 && x=y) cout << abs(y)-abs(x)+2 << endl; | ~~~~~~~~~~~^~~~
s043143528
p03838
C++
#include<algorithm> #include<climits> #include<cmath> #include<cstdlib> #include<iomanip> #include<iostream> #include<numeric> #include<string> using namespace std; long gcd(long x, long y) { if (x > y) { return gcd(y, x); } long r; while (y != 0) { r = x % y; x = y; y = r; }return x; } long lcm(long x, long y) { return(x / gcd(x, y)) * y; } void indexsort(long* first, long* last, long* func) { sort(first, last, [&](long a, long b) {return func[a] < func[b]; }); } //-------------------- int main() { long x, y; cin >> x >> y; long long res = 100000; if (x <= y) res = min(res, y - x); x *= -1; if (x <= y) res = min(res, y - x + 1); y *= -1; if (x <= y) res = min(res, y - x + 2); x *= -1; if (x <= y) res = min(res, y - x + 1); cout << res << endl; }
a.cc: In function 'int main()': a.cc:20:30: error: no matching function for call to 'min(long long int&, long int)' 20 | if (x <= y) res = min(res, y - x); | ~~~^~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:20:30: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long int') 20 | if (x <= y) res = min(res, y - x); | ~~~^~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:20:30: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 20 | if (x <= y) res = min(res, y - x); | ~~~^~~~~~~~~~~~ a.cc:22:30: error: no matching function for call to 'min(long long int&, long int)' 22 | if (x <= y) res = min(res, y - x + 1); | ~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:22:30: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long int') 22 | if (x <= y) res = min(res, y - x + 1); | ~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:22:30: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 22 | if (x <= y) res = min(res, y - x + 1); | ~~~^~~~~~~~~~~~~~~~ a.cc:24:30: error: no matching function for call to 'min(long long int&, long int)' 24 | if (x <= y) res = min(res, y - x + 2); | ~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:24:30: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long int') 24 | if (x <= y) res = min(res, y - x + 2); | ~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:24:30: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 24 | if (x <= y) res = min(res, y - x + 2); | ~~~^~~~~~~~~~~~~~~~ a.cc:26:30: error: no matching function for call to 'min(long long int&, long int)' 26 | if (x <= y) res = min(res, y - x + 1); | ~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:26:30: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long int') 26 | if (x <= y) res = min(res, y - x + 1); | ~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:26:30: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 26 | if (x <= y) res = min(res, y - x + 1); | ~~~^~~~~~~~~~~~~~~~
s171247628
p03838
C++
#include <bits/stdc++.h> using namespace std; int main(void) { int x, y; cin >> x >> y; int count = 0; if(abs(x) < abs(y)){ count = abs(y) - abs(x); if(x<0&&y=>0 || x=>0 &&y<0) count++; else if(x<0 && y<0) count+=2; } else{ count = abs(x)- abs(y); if(x>0 && y>0) count+=2; else if(x<=0 && y>0|| x>0 && y <= 0) count++; } cout << count << endl; return 0; }
a.cc: In function 'int main()': a.cc:13:17: error: expected primary-expression before '>' token 13 | if(x<0&&y=>0 || x=>0 &&y<0) | ^ a.cc:13:25: error: expected primary-expression before '>' token 13 | if(x<0&&y=>0 || x=>0 &&y<0) | ^
s106161958
p03838
C++
x,y=gets.split.map(&:to_i) puts [y-x, 1+(-y)-x, 1+y-(-x), 2+(-y)-(-x)].select(&:positive?).min
a.cc:1:1: error: 'x' does not name a type 1 | x,y=gets.split.map(&:to_i) | ^
s595073581
p03838
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <time.h> #define _CRT_SECURE_NO_WARNINGS #define TLong long long int main(int argc, char const *argv[]) { int x,y,cnt; scanf("%d%d",&x,&y); cnt = abs(abs(x) - abs(y)); if(x > y){ if(x * y < 0) ++cnt; else cnt += 2; } printf("%d\n", cnt); return 0 }
main.c: In function 'main': main.c:20:17: error: expected ';' before '}' token 20 | return 0 | ^ | ; 21 | } | ~
s596313529
p03838
C++
#include<iostream> using namespace std; int main(){ long long x,y; cin>>x>>y; if(x*y>0){ if(x>y)ans+=2; } else if(x*y<0){ ans++; } else{ if(x>y)ans++; } return 0; cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:7:12: error: 'ans' was not declared in this scope; did you mean 'abs'? 7 | if(x>y)ans+=2; | ^~~ | abs a.cc:10:5: error: 'ans' was not declared in this scope; did you mean 'abs'? 10 | ans++; | ^~~ | abs a.cc:13:12: error: 'ans' was not declared in this scope; did you mean 'abs'? 13 | if(x>y)ans++; | ^~~ | abs a.cc:16:9: error: 'ans' was not declared in this scope; did you mean 'abs'? 16 | cout<<ans<<endl; | ^~~ | abs
s249285379
p03838
C++
#include<iostream> #include<cstring> #include<cstdio> #include<algorithm> using namespace std; inline int read(){ int f=1,ans=0;char c=getchar(); while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();} while(c>='0'&&c<='9'){ans=ans*10+c-'0';c=getchar();} return f*ans; }int x,y; int dis(int x,int y){return y-x;} int main(){ int minn=INT_MAX; x=read(),y=read(); if(x<=y) minn=min(minn,dis(x,y)); if(-x<=y) minn=min(minn,1+dis(-x,y)); if(x<0&&y<0) minn=min(minn,2*dis(y,x)+2); printf("%d\n",minn); }
a.cc: In function 'int main()': a.cc:14:18: error: 'INT_MAX' was not declared in this scope 14 | int minn=INT_MAX; | ^~~~~~~ a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 4 | #include<algorithm> +++ |+#include <climits> 5 | using namespace std;
s246075670
p03838
C++
#include<bits/stdc++.h> #define all(x) (x).begin(),(x).end() typedef long long ll; #define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i) using namespace std; #define sz(x) ((int)(x).size()) #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) #define MEMSET(v, h) memset((v), h, sizeof(v)) template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } #define pb push_back #define mp make_pair #define y0 y3487465 #define y1 y8687969 #define j0 j1347829 #define j1 j234892 ll gcd(ll a,ll b){return b?gcd(b,a%b):a;} const ll INF = 1LL<<58; int main() { ll x,y; cin >> x >> y; ll ans = 0; if(x >= 0 && y >= 0 || x < 0 && y < 0){ if(y >= x) ans = y - x; else ans = x - y + 2; } else{ if(llabs(y) >= llabs(x)) ans = y - x + 1; else ans = x - y + 1; } cout << ans << endl; }
a.cc:25:31: error: extended character   is not valid in an identifier 25 | if(x >= 0 && y >= 0 || x < 0 && y < 0){ | ^ a.cc: In function 'int main()': a.cc:25:31: error: '\U00003000x' was not declared in this scope 25 | if(x >= 0 && y >= 0 || x < 0 && y < 0){ | ^~~
s667995985
p03838
C
#include <bits/stdc++.h> using namespace std; int main() { long x, y; cin >> x >> y; long ans; if (x >= 0) { if (y >= 0) { ans = (x <= y) ? (y - x) : (x - y + 2); } else { ans = abs(y + x) + 1; } } else { if (y >= 0) { ans = abs(x + y) + 1; } else { ans = (x <= y) ? (y - x) : (x - y + 2); } } cout << ans << endl; return 0; }
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory 1 | #include <bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s058486930
p03838
C++
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<ll, ll> pll; #define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i)) #define REP(i, n) FOR(i, n, 0) #define OF64 std::setprecision(10) const ll MOD = 1000000007; const ll INF = (ll)1e15; int main() { ll x, y; cin >> x >> y; ll s = abs(abs(x) - abs(y)); //! 反転ボタンを押す数を決める if (y < x && (x < 0 || y > 0)) s += 2; else if (y < x && 0 <= x) s++; else if (x < y && y > 0 && x < 0) s++; cout << s << endl; return 0; }#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<ll, ll> pll; #define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i)) #define REP(i, n) FOR(i, n, 0) #define OF64 std::setprecision(10) const ll MOD = 1000000007; const ll INF = (ll)1e15; int main() { ll x, y; cin >> x >> y; ll s = abs(abs(x) - abs(y)); //! 反転ボタンを押す数を決める if (y < x && (x < 0 || y > 0)) s += 2; else if (y < x && 0 <= x) s++; else if (x < y && y > 0 && x < 0) s++; cout << s << endl; return 0; }
a.cc:28:2: error: stray '#' in program 28 | }#include <bits/stdc++.h> | ^ a.cc:28:3: error: 'include' does not name a type 28 | }#include <bits/stdc++.h> | ^~~~~~~ a.cc:38:10: error: redefinition of 'const ll MOD' 38 | const ll MOD = 1000000007; | ^~~ a.cc:11:10: note: 'const ll MOD' previously defined here 11 | const ll MOD = 1000000007; | ^~~ a.cc:39:10: error: redefinition of 'const ll INF' 39 | const ll INF = (ll)1e15; | ^~~ a.cc:12:10: note: 'const ll INF' previously defined here 12 | const ll INF = (ll)1e15; | ^~~ a.cc:41:5: error: redefinition of 'int main()' 41 | int main() | ^~~~ a.cc:14:5: note: 'int main()' previously defined here 14 | int main() | ^~~~
s699596992
p03838
C++
//#include <bits/stdc++.h> #include <iostream> #include <complex> #include <sstream> #include <string> #include <algorithm> #include <deque> #include <list> #include <map> #include <numeric> #include <queue> #include <vector> #include <set> #include <limits> #include <cstdio> #include <cctype> #include <cmath> #include <cstring> #include <cstdlib> #include <ctime> #include <climits> #include <iomanip> #define REP(i, n) for(int i = 0; i < (int)(n); i++) #define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i) #define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i) #define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++) #define SORT(v, n) sort(v, v+n) #define REVERSE(v) reverse((v).begin(), (v).end()) using namespace std; using ll = long long; const ll MOD=1000000007LL; typedef pair<int, int> P; ll ADD(ll x, ll y) { return (x+y) % MOD; } ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; } ll MUL(ll x, ll y) { return x*y % MOD; } ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; } ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); } template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;} template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;} int main(void){ ios_base::sync_with_stdio(false); cin.tie(0); ll x, y, ans=0; cin >> x >> y; if(x >= 0 && y >= x) ans += abs(abs(y)-abs(x)); else if(x >= 0 && x > y) { x = -x; ans++; ans += abs(abs(y)-ans(x)); } else if(x < 0 && y >= x) ans += abs(abs(y)-abs(x)); // x<0 && y < x else { x = -x; ans++; ans += abs(abs(y)-abs(x)); x = -x; ans++; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:57:26: error: 'ans' cannot be used as a function 57 | ans += abs(abs(y)-ans(x)); | ~~~^~~
s518899008
p03838
C++
#include <iostream> using namespace std; using uint = unsigned int; using ll = long long; using ull = unsigned long long; #include <string> #include <cstdio> #include <algorithm> #include <vector> #include <cmath> #include <climits> #include <bitset> #include <array> #include <deque> #include <queue> #include <map> #include <set> #define all(x) (x).begin(),(x).end() const int MOD = 1e9 + 7; void solve(){ } int main(){ int x,y; cin >> x >> y; int ans = INT_MAX; int dx = {1,1,-1,-1}; int dy = {1,-1,1,-1}; for (int i = 0; i < 4; ++i) { int tx = x * dx[i]; int ty = y * dy[i]; if (tx <= ty) { ans = min(ans, ty - tx); } } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:30:9: error: scalar object 'dx' requires one element in initializer 30 | int dx = {1,1,-1,-1}; | ^~ a.cc:31:9: error: scalar object 'dy' requires one element in initializer 31 | int dy = {1,-1,1,-1}; | ^~
s330868652
p03838
C++
//program luogu.AT2263 #include <iostream> #include <cstdio> using namespace std; #define LL long long LL x,y; int main(){ scanf("%lld %lld",&x,&y); if( x==y ) printf("0\n"); else if( !x || !y) { if( y>x ) printf("%lld\n",y-x); else printf("%lld\n",x-y+1); } else if( x>0 && y>0 ) { if( x>y ) printf("%lld\n",x-y+2); else printf("%lld\n",y-x); } else if( ( x<0 && y>0 ) || ( x>0 && y<0 ) ) printf("%lld\n",abs(abs(a)-abs(b))+1); else { if( x>y ) printf("%lld\n",x-y+2); else printf("%lld\n",y-x); } return 0; }
a.cc: In function 'int main()': a.cc:26:41: error: 'a' was not declared in this scope 26 | printf("%lld\n",abs(abs(a)-abs(b))+1); | ^ a.cc:26:48: error: 'b' was not declared in this scope 26 | printf("%lld\n",abs(abs(a)-abs(b))+1); | ^
s596320497
p03838
C++
#include <iostream> #include <cstdio> using namespace std; inline long long abs(long long x) { return x > 0 ? x : -x; } long long x, y; int main() { scanf ("%lld%lld", &x, &y); long long a = abs(x), b = abs(y); if (a > b) { if (x > 0 && y > 0) { printf ("%lld", -y + x + 2); return 0; } else if (x > 0 && y < 0) { printf ("%lld", y + x + 1); return 0; } else if (x < 0 && y > 0) { printf ("%lld", -y - x + 1); return 0; } else if (x < 0 && y < 0) { printf ("%lld", -x + y); return 0; } } else { if (x > 0 && y > 0) { printf ("%lld", y - x); return 0; } else if (x > 0 && y < 0) { cout << -y - x + 1; return 0; } else if (x < 0 && y > 0) { cout << y + x + 1; return 0; } else if (x < 0 && y < 0) { cout << -y + x + 2; return 0; } } return 0; }
a.cc: In function 'int main()': a.cc:10:26: error: call of overloaded 'abs(long long int&)' is ambiguous 10 | long long a = abs(x), b = abs(y); | ~~~^~~ In file included from /usr/include/c++/14/cstdlib:79, from /usr/include/c++/14/ext/string_conversions.h:43, from /usr/include/c++/14/bits/basic_string.h:4154, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)' 980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; | ^~~ a.cc:4:18: note: candidate: 'long long int abs(long long int)' 4 | inline long long abs(long long x) { | ^~~ In file included from /usr/include/c++/14/cstdlib:81: /usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)' 137 | abs(__float128 __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)' 85 | abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; } | ^~~ /usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)' 79 | abs(long double __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)' 75 | abs(float __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)' 71 | abs(double __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)' 61 | abs(long long __x) { return __builtin_llabs (__x); } | ^~~ /usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)' 56 | abs(long __i) { return __builtin_labs(__i); } | ^~~ a.cc:11:17: error: 'b' was not declared in this scope 11 | if (a > b) { | ^
s373183796
p03838
C++
#include <iostream> #include <cstdio> using namespace std; inline long long abs(long long x) { return x > 0 ? x : -x; } long long x, y; int main() { scanf ("%lld%lld", &x, &y); long long a = abs(x), b = abs(y); if (a > b) { if (x > 0 && y > 0) { printf ("%lld", -y + x + 2); return 0; } else if (x > 0 && y < 0) { printf ("%lld", -y + x + 1); return 0; } else if (x < 0 && y > 0) { printf ("%lld", -y - x + 1); return 0; } else if (x < 0 && y < 0) { printf ("%lld", -x + y); return 0; } } else { if (x > 0 && y > 0) { printf ("%lld", y - x); return 0; } else if (x > 0 && y < 0) { cout << -y - x + 1; return 0; } else if (x < 0 && y > 0) { cout << y + x + 1; return 0; } else if (x < 0 && y < 0) { cout << -y + x + 2; return 0; } } return 0; }
a.cc: In function 'int main()': a.cc:10:26: error: call of overloaded 'abs(long long int&)' is ambiguous 10 | long long a = abs(x), b = abs(y); | ~~~^~~ In file included from /usr/include/c++/14/cstdlib:79, from /usr/include/c++/14/ext/string_conversions.h:43, from /usr/include/c++/14/bits/basic_string.h:4154, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)' 980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; | ^~~ a.cc:4:18: note: candidate: 'long long int abs(long long int)' 4 | inline long long abs(long long x) { | ^~~ In file included from /usr/include/c++/14/cstdlib:81: /usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)' 137 | abs(__float128 __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)' 85 | abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; } | ^~~ /usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)' 79 | abs(long double __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)' 75 | abs(float __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)' 71 | abs(double __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)' 61 | abs(long long __x) { return __builtin_llabs (__x); } | ^~~ /usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)' 56 | abs(long __i) { return __builtin_labs(__i); } | ^~~ a.cc:11:17: error: 'b' was not declared in this scope 11 | if (a > b) { | ^
s708592753
p03838
C++
#include <iostream> using namespace std; int main() { int x, y; cin >> x >> y; int ans = numeric_limits<int>::max(); for (int bit = 0; bit < 1 << 3; ++bit) { int cnt = 0, tx = x, ty = y; if (bit & (1 << 1)) { tx *= -1; ++cnt; } if (bit & (1)) { ty *= -1; ++cnt; } cnt += ty - tx; if (cnt < 0)continue; ans = min(ans, cnt); } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:9:15: error: 'numeric_limits' was not declared in this scope 9 | int ans = numeric_limits<int>::max(); | ^~~~~~~~~~~~~~ a.cc:9:30: error: expected primary-expression before 'int' 9 | int ans = numeric_limits<int>::max(); | ^~~
s963594513
p03838
C++
#include "bits/stdc++.h" using namespace std; int main() { int A, B, A-, B-; cin >> A >> B; A- = A * (-1); B- = B * (-1); int ans = pow(10, 9); if (A <= B) { ans = min(ans, B - A); } if (A <= B-) { ans = min(ans, B- - A); } if (A- <= B) { ans = min(ans, B - A-); } if (A- <= B-) { ans = min(ans, B- - A-); } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:5:16: error: expected initializer before '-' token 5 | int A, B, A-, B-; | ^ a.cc:7:8: error: expected primary-expression before '=' token 7 | A- = A * (-1); | ^ a.cc:8:8: error: expected primary-expression before '=' token 8 | B- = B * (-1); | ^ a.cc:14:16: error: expected primary-expression before ')' token 14 | if (A <= B-) { | ^ a.cc:17:12: error: expected primary-expression before '<=' token 17 | if (A- <= B) { | ^~ a.cc:18:30: error: expected primary-expression before ')' token 18 | ans = min(ans, B - A-); | ^ a.cc:20:12: error: expected primary-expression before '<=' token 20 | if (A- <= B-) { | ^~ a.cc:20:17: error: expected primary-expression before ')' token 20 | if (A- <= B-) { | ^ a.cc:21:31: error: expected primary-expression before ')' token 21 | ans = min(ans, B- - A-); | ^
s535818838
p03838
C
#include <iostream> using namespace std; int main(){ long long int n,m; cin>>n>>m; if(m>=n) { cout<<min(m-n,m+n+1); }else if(n*m>=0){ cout<<n-m+2; }else { cout<<n+m+1; } }
main.c:1:10: fatal error: iostream: No such file or directory 1 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s940420900
p03838
C++
#include <bits/stdc++.h> using namespace std; int main(){ int x,y; cin >> x >> y; if(x==0){ if(y>0){ cout << y <<endl; }else{ cout << -y+1 << endl; } return 0; } if(y==0){ if(x>0){ cout << 1+x << endl; }else{ cout << -x << endl; } retrun 0; } if(x>=0 && y>x){ cout << y-x << endl; return 0; } if(y>=0 && x>y){ cout << y-x+1 << endl; return 0; } if(x>=0 && y<=0){ cout << abs(y+x)+1 << endl; return 0; } if(y>=0 && x<=0){ cout << abs(y+x)+1 << endl; return 0; } if(y<=0 && y>x){ cout << y-x << endl; return 0; } if(x<=0 && y<x){ cout << x-y+2 << endl; return 0; } }
a.cc: In function 'int main()': a.cc:20:5: error: 'retrun' was not declared in this scope 20 | retrun 0; | ^~~~~~
s451337963
p03838
C++
#include<iostream> #include<vector> #include<algorithm> #include<string> using namespace std; #define ll long long; #define MM = 1000000000; #define mod = MM + 7; #define INF (ll)1e18 #define pi acos(-1.0) #define MAX 100005 #define NIL -1 int main(){ ll x, y; cin >> x >> y; ll ans = 0; if(x <= y){ if(x >= 0 && y >= 0){ ans = y-x; } else if(x <= 0 && y <= 0){ ans = y-x; } else { if(abs(x) <= abs(y)){ ans = y-abs(x)+1; } else { ans = y-x; } } } else { if(x >= 0 && y >= 0){ ans = y+x+1; } else if(x <= 0 && y <= 0){ ans = abs(x)+abs(y)+1; } else { if(x >= abs(y)){ ans = abs(y)-x+1; } else { ans = x-abs(y)+1; } } } }
a.cc: In function 'int main()': a.cc:6:17: error: declaration does not declare anything [-fpermissive] 6 | #define ll long long; | ^~~~ a.cc:14:5: note: in expansion of macro 'll' 14 | ll x, y; cin >> x >> y; | ^~ a.cc:14:8: error: 'x' was not declared in this scope 14 | ll x, y; cin >> x >> y; | ^ a.cc:14:11: error: 'y' was not declared in this scope 14 | ll x, y; cin >> x >> y; | ^ a.cc:6:17: error: declaration does not declare anything [-fpermissive] 6 | #define ll long long; | ^~~~ a.cc:15:5: note: in expansion of macro 'll' 15 | ll ans = 0; | ^~ a.cc:15:8: error: 'ans' was not declared in this scope; did you mean 'abs'? 15 | ll ans = 0; | ^~~ | abs
s590645233
p03838
C++
#include<bits/stdc++.h> #define lli long long int #define MOD 1000000007 #define FOR(i,n) for(int i=0;i<(int)n;i++) #define ALL(x) (x).begin(),(x).end() using namespace std; inline lli getint(){ lli n; scanf("%lld",&n); return n; } inline vector<lli> getints(int n){ vector<lli> a(n); for(int i=0;i<n;i++)scanf("%lld",&a[i]); return a; } inline string getstr(){ string s; cin>>s; return s; } inline string slice(string s,int a,int b){ return s.substr(a,b-a-1); } void dumpints(vector<lli> a){ cout<<"["; for(int i=0;i<a.size()-1;i++){ cout<<a[i]<<","; } cout<<a[a.size()-1]<<"]"<<endl; } template<class T> bool ifinclude(vector<T> a,T x){ auto itr=find(a.begin(),a.end(),x); return distance(a.begin(),itr)!=a.size(); } int main(void){ int x=getint(),y=getint(); int ans; if(x==y){ ans=0; }else if(x==-y){ ans=1; }else if(x>=0&&y>=0){ if(x<y){ ans=y-x; }else{ ans=x+y+1; } }else if(x>=0&&y<0){ ans=abs(x+y)+1; }else if(x<0&&y>0){ ans=abs(y+x)+1; }else if(x<0&&y==0){ ans=-x; } }else{ if(x<y){ ans=y-x; }else{ ans=x-y+2; } } cout<<ans<<endl; return 0; }
a.cc:62:4: error: expected unqualified-id before 'else' 62 | }else{ | ^~~~ a.cc:69:3: error: 'cout' does not name a type 69 | cout<<ans<<endl; | ^~~~ a.cc:70:3: error: expected unqualified-id before 'return' 70 | return 0; | ^~~~~~ a.cc:71:1: error: expected declaration before '}' token 71 | } | ^
s422423865
p03838
C++
#include <iostream> #include <string> #include <vector> #include <map> #include <algorithm> #include <deque> #include <cctype> #include <cstdio> #include <math.h> using namespace std; int main(){ long long x,y; cin >> x >> y; long long ans=0; if(abs(x)<abs(y)){ ans+=abs((abs(y)-abs(x)); if(x<0){ ans++; } if(y<0){ ans++; } }else if(abs(x)==abs(y)){ if(x*y>0){ ans=0; }else{ ans++; } }else{ if(y<0){ ans+=abs(abs(x)-abs(y)); if(x>0){ ans++; } }else{ ans+=abs(abs(x)+abs(y)); if(x>0){ ans++; } } } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:16:33: error: expected ')' before ';' token 16 | ans+=abs((abs(y)-abs(x)); | ~ ^ | )
s465903486
p03838
C++
#include <stdio.h> int solve(int x, int y) { int ay = y > 0 ? y : -y; int ax = x > 0 ? x : -x; if(ax == ay) return x != y; if(ay < ax) return (x > 0) + ax - ay + (y > 0)); return (x < 0) + ay - ax + (y < 0); } int main(){ int x, y; scanf("%d %d", &x, &y); printf("%d\n", solve(x, y)); return 0; }
a.cc: In function 'int solve(int, int)': a.cc:7:49: error: expected ';' before ')' token 7 | if(ay < ax) return (x > 0) + ax - ay + (y > 0)); | ^ | ; a.cc:7:49: error: expected primary-expression before ')' token
s792162157
p03838
C++
#define dbg(x) do { std::cerr << #x << ": " << x << std::endl; } while (0) using namespace std; int main() { // freopen("a.inp", "r", stdin); long long x, y; cin >> x >> y; int xx = abs(x), yy = abs(y); // dbg(xx); // dbg(yy); if (xx > yy) xx = -xx, yy = -yy; int ans = 0; if (xx != x) ++ans; if (yy != y) ++ans; // dbg(ans); // dbg(abs(abs(x)-abs(y))); cout << ans + abs(abs(x)-abs(y)); return 0; }
a.cc: In function 'int main()': a.cc:8:5: error: 'cin' was not declared in this scope 8 | cin >> x >> y; | ^~~ a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' +++ |+#include <iostream> 1 | #define dbg(x) do { std::cerr << #x << ": " << x << std::endl; } while (0) a.cc:9:14: error: 'abs' was not declared in this scope 9 | int xx = abs(x), yy = abs(y); | ^~~ a.cc:12:14: error: 'yy' was not declared in this scope; did you mean 'y'? 12 | if (xx > yy) xx = -xx, yy = -yy; | ^~ | y a.cc:15:9: error: 'yy' was not declared in this scope; did you mean 'y'? 15 | if (yy != y) ++ans; | ^~ | y a.cc:18:5: error: 'cout' was not declared in this scope 18 | cout << ans + abs(abs(x)-abs(y)); | ^~~~ a.cc:18:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
s627919082
p03838
C++
#include<cstdio> using namespace std; int main(){ int x,y,ans=2000000003; scanf("%d %d",&x,&y); if(x<=y) ans=y-x; if(-1*x<=y) ans=min(ans,y+x+1); if(x<=-1*y) ans=min(ans,-1*y-x+1); if(-1*x<=-1*y) ans=min(ans,-1*y+x+2); printf("%d\n",ans); }
a.cc: In function 'int main()': a.cc:9:9: error: 'min' was not declared in this scope; did you mean 'main'? 9 | ans=min(ans,y+x+1); | ^~~ | main a.cc:11:9: error: 'min' was not declared in this scope; did you mean 'main'? 11 | ans=min(ans,-1*y-x+1); | ^~~ | main a.cc:13:9: error: 'min' was not declared in this scope; did you mean 'main'? 13 | ans=min(ans,-1*y+x+2); | ^~~ | main
s445688150
p03838
C++
x,y=gets.split.map(&:to_i) if x<=y puts y-x else puts x-y+2 end
a.cc:1:1: error: 'x' does not name a type 1 | x,y=gets.split.map(&:to_i) | ^
s006545315
p03838
C++
#include<iostream> #include<cmath> #include<algorithm> using namespace std; int main() { int x, y; cin >> x >> y; int b = max(abs(x), abs(y)), s = min(abs(x), abs(y)); if(y - x >= 0){ if(x * y >= 0){ cout << y - x << endl; return 0; } } if(x * y =< 0){ cout << b - s + 1 << endl; return 0; } cout << b - s + 2 << endl; return 0; }
a.cc: In function 'int main()': a.cc:18:15: error: expected primary-expression before '<' token 18 | if(x * y =< 0){ | ^
s461516137
p03838
C++
#include<bits/stdc++.h> using namespace std;int a,b;main(){cin>>a>>b;cout<<(a<b)?min(b-a,abs(b+a)+1):min(1+a-b,abs(a+b))+1;
a.cc:2:29: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 2 | using namespace std;int a,b;main(){cin>>a>>b;cout<<(a<b)?min(b-a,abs(b+a)+1):min(1+a-b,abs(a+b))+1; | ^~~~ a.cc: In function 'int main()': a.cc:2:100: error: expected '}' at end of input 2 | using namespace std;int a,b;main(){cin>>a>>b;cout<<(a<b)?min(b-a,abs(b+a)+1):min(1+a-b,abs(a+b))+1; | ~ ^
s971307279
p03838
C++
#include<bits/stdc++.h> using namespace std;int a,b;main(){cin>>a>>b;cout<<a<b?min(b-a,abs(b+a)+1):min(1+a-b,abs(a+b))+1;
a.cc:2:29: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 2 | using namespace std;int a,b;main(){cin>>a>>b;cout<<a<b?min(b-a,abs(b+a)+1):min(1+a-b,abs(a+b))+1; | ^~~~ a.cc: In function 'int main()': a.cc:2:53: error: no match for 'operator<' (operand types are 'std::basic_ostream<char>' and 'int') 2 | using namespace std;int a,b;main(){cin>>a>>b;cout<<a<b?min(b-a,abs(b+a)+1):min(1+a-b,abs(a+b))+1; | ~~~~~~~^~ | | | | | int | std::basic_ostream<char> a.cc:2:53: note: candidate: 'operator<(int, int)' (built-in) 2 | using namespace std;int a,b;main(){cin>>a>>b;cout<<a<b?min(b-a,abs(b+a)+1):min(1+a-b,abs(a+b))+1; | ~~~~~~~^~ a.cc:2:53: 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:1143:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1143 | operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1143:5: note: template argument deduction/substitution failed: a.cc:2:54: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 2 | using namespace std;int a,b;main(){cin>>a>>b;cout<<a<b?min(b-a,abs(b+a)+1):min(1+a-b,abs(a+b))+1; | ^ /usr/include/c++/14/bits/regex.h:1224: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>&)' 1224 | operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1224:5: note: template argument deduction/substitution failed: a.cc:2:54: note: 'std::basic_ostream<char>' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' 2 | using namespace std;int a,b;main(){cin>>a>>b;cout<<a<b?min(b-a,abs(b+a)+1):min(1+a-b,abs(a+b))+1; | ^ /usr/include/c++/14/bits/regex.h:1317: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>&)' 1317 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1317:5: note: template argument deduction/substitution failed: a.cc:2:54: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 2 | using namespace std;int a,b;main(){cin>>a>>b;cout<<a<b?min(b-a,abs(b+a)+1):min(1+a-b,abs(a+b))+1; | ^ /usr/include/c++/14/bits/regex.h:1391:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1391 | operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1391:5: note: template argument deduction/substitution failed: a.cc:2:54: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 2 | using namespace std;int a,b;main(){cin>>a>>b;cout<<a<b?min(b-a,abs(b+a)+1):min(1+a-b,abs(a+b))+1; | ^ /usr/include/c++/14/bits/regex.h:1485:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1485 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1485:5: note: template argument deduction/substitution failed: a.cc:2:54: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 2 | using namespace std;int a,b;main(){cin>>a>>b;cout<<a<b?min(b-a,abs(b+a)+1):min(1+a-b,abs(a+b))+1; | ^ /usr/include/c++/14/bits/regex.h:1560:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1560 | operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1560:5: note: template argument deduction/substitution failed: a.cc:2:54: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 2 | using namespace std;int a,b;main(){cin>>a>>b;cout<<a<b?min(b-a,abs(b+a)+1):min(1+a-b,abs(a+b))+1; | ^ /usr/include/c++/14/bits/regex.h:1660:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1660 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1660:5: note: template argument deduction/substitution failed: a.cc:2:54: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 2 | using namespace std;int a,b;main(){cin>>a>>b;cout<<a<b?min(b-a,abs(b+a)+1):min(1+a-b,abs(a+b))+1; | ^ 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:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed: a.cc:2:54: note: 'std::basic_ostream<char>' is not derived from 'const std::pair<_T1, _T2>' 2 | using namespace std;int a,b;main(){cin>>a>>b;cout<<a<b?min(b-a,abs(b+a)+1):min(1+a-b,abs(a+b))+1; | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 448 | operator<(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed: a.cc:2:54: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>' 2 | using namespace std;int a,b;main(){cin>>a>>b;cout<<a<b?min(b-a,abs(b+a)+1):min(1+a-b,abs(a+b))+1; | ^ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 493 | operator<(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed: a.cc:2:54: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>' 2 | using namespace std;int a,b;main(){cin>>a>>b;cout<<a<b?min(b-a,abs(b+a)+1):min(1+a-b,abs(a+b))+1; | ^ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1694 | operator<(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed: a.cc:2:54: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>' 2 | using namespace std;int a,b;main(){cin>>a>>b;cout<<a<b?min(b-a,abs(b+a)+1):min(1+a-b,abs(a+b))+1; | ^ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1760 | operator<(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed: a.cc:2:54: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>' 2 | using namespace std;int a,b;main(){cin>>a>>b;cout<<a<b?min(b-a,abs(b+a)+1):min(1+a-b,abs(a+b))+1; | ^ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 673 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed: a.cc:2:54: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 2 | using namespace std;int a,b;main(){c
s093638442
p03838
C++
#include<bits/stdc++.h> using namespace std; #define rp(i,n) for(int i=0;i<n;i++) #define rep(i,m,n) for(int i=m;i<=n;i++) #define llrp(i,n) for(long long i=0;i<n;i++) #define llrep(i,m,n) for(long long i=m;i<=n;i++) #define sort(a) sort(a.begin(),a.end()) #define reverse(a) reverse(a.begin(),a.end()) #define pb push_back #define elif else if #define vcin(a); rp(i,a.size()){cin>>a[i];} #define vcout(a); rp(i,a.size()){cout<<a[i]<<endl;} typedef vector<int> vi; typedef vector<long long> vll; typedef vector<string> vs; typedef vector<char> vc; typedef long long ll; typedef string S; typedef pair<int,int> P; bool isOK(int index, int key,vi a) { if (a[index] >= key) return true; else return false; } int binary_search(int key,vi a) { int left = -1; int right = (int)a.size(); while (right - left > 1) { int mid = left + (right - left) / 2; if (isOK(mid, key,a)) right = mid; else left = mid; } return right; } int modpow(int a,int b,int p){ if(b==0){ return 1; }elif(b%2==0){ return modpow((a*a)%p,b/2,p); }else{ return (a*modpow(a,b-1,p))%p; } } int main(){ cin.tie(0); ios::sync_with_stdio(false); int n,m; cin >> n >> m; if(n<=m){ if(m>0&&n<0){ cout << min(ans,m+n+1) << endl; }else{ cout << m-n << endl; } }elif(n>0&&m<0){ if(-n<m){ cout << n+m+1 << endl; }else{ cout << -n-m+1 << endl; } }elif(n<0&&m<0){ cout << n-m+2 << endl; }elif(n>0&&m>0){ cout << n-m+2 << endl; }else{ if(n==0){ cout << -m+1 << endl; }elif(m==0){ cout << n+1 << endl; } } return 0; }
a.cc: In function 'int main()': a.cc:56:25: error: 'ans' was not declared in this scope; did you mean 'abs'? 56 | cout << min(ans,m+n+1) << endl; | ^~~ | abs
s265586332
p03838
C++
#include<algorithm> #include<iostream> #include<vector> #include<string> #include<cstring> #include<utility> #include<queue> using namespace std; #define REP(i, a,b) for(i=a;i<b;i++) #define REP1(i,b,a) for(i=b-1;i>=a;i--) #define output(x) cout<<x<<endl; #define pb(x) push_back(x); typedef long long int ll; const int MAX = 510000; const int MOD = 1000000007; long long fac[MAX], finv[MAX], inv[MAX]; // テーブルを作る前処理 void COMinit() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for (int i = 2; i < MAX; i++) { fac[i] = fac[i - 1] * i % MOD; inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD; finv[i] = finv[i - 1] * inv[i] % MOD; } } // 二項係数計算 long long COM(int n, int k) { if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD; } long long ruijyo(ll n, ll k) { if (k == 0) { return 1; } ll sum = 1; ll i; REP(i, 0, k) { sum *= n; sum %= MOD; } return sum; } int main() { ll i, j, k, l, m,n, sum, flag, N, M, K, H, W, B,C,D; sum = 0; flag = 0; ll A[7]; REP(i, 0, 7) { cin >> A[i]; } ll ans,ans1; ans =ans1= 0; ans += 3; ans += ((A[0] - 1) / 2) * 2 + (A[1]) + ((A[3] - 1) / 2) * 2 + ((A[4] - 1) / 2) * 2; ans1 += (A[0] / 2) * 2 + (A[1]) + (A[3] / 2) * 2 + (A[4] / 2) * 2; k = fmax(ans, ans1); output(k); return 0; }
a.cc: In function 'int main()': a.cc:66:21: error: 'fmax' was not declared in this scope 66 | k = fmax(ans, ans1); | ^~~~
s924160068
p03838
C++
#include<cstdio> #include<iostream> using namespace std; int x,y,ans=0; inline int abs(int x) {return x<0 ? -x:x;} int main() { cin>>x>>y if(x==-y) ans=1; else if(abs(x)<abs(y)) ans=abs(y)-abs(x)+(x<0)+(y<0); else ans=abs(x)-abs(y)+(x>0)+(y>0); printf("%d\n",ans); return 0; }
a.cc: In function 'int main()': a.cc:7:14: error: expected ';' before 'if' 7 | cin>>x>>y | ^ | ; 8 | if(x==-y) ans=1; | ~~ a.cc:9:5: error: 'else' without a previous 'if' 9 | else if(abs(x)<abs(y)) ans=abs(y)-abs(x)+(x<0)+(y<0); | ^~~~
s976960970
p03838
C++
#include<iostream> using namespace std; int main(){ int X=0; int Y=0; cin>>X; cin>>Y; int ans=abs(abs(X)-abs(Y)); if(Y>X&&X>0||0>=&&Y>X){ }else if(Y>=0&&X>Y||0>=X&&X<Y){ ans+=2; }else{ ans+=1; } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:14:19: error: ordered comparison of pointer with integer zero ('int' and 'void*') 14 | if(Y>X&&X>0||0>=&&Y>X){ | ~^~~~~ a.cc:14:23: error: label 'Y' used but not defined 14 | if(Y>X&&X>0||0>=&&Y>X){ | ^
s337858981
p03838
C++
#include <iostream> using namespace std; int f(int x, int y) { if (x > y) return 2e9+50; return y - x; } int main() { int x, y; cin >> x >> y; cout << min({f(x,y),1+f(x,-y),1+f(-x,y),2+f(-x,-y)}) << endl; return 0; }
a.cc: In function 'int main()': a.cc:13:14: error: no matching function for call to 'min(<brace-enclosed initializer list>)' 13 | cout << min({f(x,y),1+f(x,-y),1+f(-x,y),2+f(-x,-y)}) << 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:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 1 provided
s067052400
p03838
C++
#include<iostream> using namespace std; typedef long long ll; int main(){ ll a, b, ans = LLONG_MAX; cin >> a >> b; for(int i = 0; i < 4; i++){ ll tmp = 0; if(1&i){ a = -a; tmp++; } if(i&2){ b = -b; tmp++; } if(a <= b){ tmp += b - a; ans = min(ans, tmp); } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:7:18: error: 'LLONG_MAX' was not declared in this scope 7 | ll a, b, ans = LLONG_MAX; | ^~~~~~~~~ a.cc:2:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 1 | #include<iostream> +++ |+#include <climits> 2 | using namespace std; a.cc:27:2: error: expected '}' at end of input 27 | } | ^ a.cc:6:11: note: to match this '{' 6 | int main(){ | ^
s757800888
p03838
C
#include <stdio.h> #include <stdlib.h> int main(void){ int x,y; scanf("%d%d",&x,&y); if (x*y>0){ if(x<y){ printf("%d\n",y-x); } else { printf("%d\n",x-y+2)); } } else { printf("%d\n",abs(abs(x)-abs(y))+1); } return 0 ; }
main.c: In function 'main': main.c:11:33: error: expected ';' before ')' token 11 | printf("%d\n",x-y+2)); | ^ | ; main.c:11:33: error: expected statement before ')' token
s770905239
p03838
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main(){ int x, y; cin >> x >> y; if(x*y==0){ cout << abs(x)+abs(y) + x>y?1:0; } else if(x*y<0){ cout << abs(abs(y)-abs(x))+1; } else{ if(x<y) cout << y-x; else cout << 2+y-x; } }
a.cc: In function 'int main()': a.cc:8:30: error: no match for 'operator>' (operand types are 'std::basic_ostream<char>' and 'int') 8 | cout << abs(x)+abs(y) + x>y?1:0; | ~~~~~~~~~~~~~~~~~~~~~~~~~^~ | | | | | int | std::basic_ostream<char> a.cc:8:30: note: candidate: 'operator>(int, int)' (built-in) 8 | cout << abs(x)+abs(y) + x>y?1:0; | ~~~~~~~~~~~~~~~~~~~~~~~~~^~ a.cc:8:30: 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:1176:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1176 | operator>(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1176:5: note: template argument deduction/substitution failed: a.cc:8:31: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 8 | cout << abs(x)+abs(y) + x>y?1:0; | ^ /usr/include/c++/14/bits/regex.h:1236: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>&)' 1236 | operator>(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1236:5: note: template argument deduction/substitution failed: a.cc:8:31: note: 'std::basic_ostream<char>' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' 8 | cout << abs(x)+abs(y) + x>y?1:0; | ^ /usr/include/c++/14/bits/regex.h:1329: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>&)' 1329 | operator>(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1329:5: note: template argument deduction/substitution failed: a.cc:8:31: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 8 | cout << abs(x)+abs(y) + x>y?1:0; | ^ /usr/include/c++/14/bits/regex.h:1403:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1403 | operator>(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1403:5: note: template argument deduction/substitution failed: a.cc:8:31: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 8 | cout << abs(x)+abs(y) + x>y?1:0; | ^ /usr/include/c++/14/bits/regex.h:1497:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1497 | operator>(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1497:5: note: template argument deduction/substitution failed: a.cc:8:31: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 8 | cout << abs(x)+abs(y) + x>y?1:0; | ^ /usr/include/c++/14/bits/regex.h:1573:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1573 | operator>(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1573:5: note: template argument deduction/substitution failed: a.cc:8:31: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 8 | cout << abs(x)+abs(y) + x>y?1:0; | ^ /usr/include/c++/14/bits/regex.h:1673:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1673 | operator>(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1673:5: note: template argument deduction/substitution failed: a.cc:8:31: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 8 | cout << abs(x)+abs(y) + x>y?1:0; | ^ 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:1058:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1058 | operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1058:5: note: template argument deduction/substitution failed: a.cc:8:31: note: 'std::basic_ostream<char>' is not derived from 'const std::pair<_T1, _T2>' 8 | cout << abs(x)+abs(y) + x>y?1:0; | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:462:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 462 | operator>(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:462:5: note: template argument deduction/substitution failed: a.cc:8:31: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>' 8 | cout << abs(x)+abs(y) + x>y?1:0; | ^ /usr/include/c++/14/bits/stl_iterator.h:507:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 507 | operator>(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:507:5: note: template argument deduction/substitution failed: a.cc:8:31: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>' 8 | cout << abs(x)+abs(y) + x>y?1:0; | ^ /usr/include/c++/14/bits/stl_iterator.h:1714:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1714 | operator>(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1714:5: note: template argument deduction/substitution failed: a.cc:8:31: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>' 8 | cout << abs(x)+abs(y) + x>y?1:0; | ^ /usr/include/c++/14/bits/stl_iterator.h:1774:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1774 | operator>(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1774:5: note: template argument deduction/substitution failed: a.cc:8:31: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>' 8 | cout << abs(x)+abs(y) + x>y?1:0; | ^ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/string_view:695:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 695 | operator> (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:695:5: note: template argument deduction/substitution failed: a.cc:8:31: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 8 | cout << abs(x)+abs(y) + x>y?1:0; | ^ /usr/include/c++/14/string_view:702: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> >)' 702 | operator> (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:702:5: note: template argument deduction/substitution failed: a.cc:8:31: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 8 | cout << abs(x)+abs(y) + x>y?1:0; | ^ /usr/include/c++/14/string_view:710:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 710 | operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:710:5: note: template argument deduction/substitution failed: a.cc:8:31: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int' 8 | cout << abs(x)+abs(y) + x>y?1:0; | ^ /usr/include/c++/14/bits/basic_string.h:3915:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3915 | opera
s032856560
p03838
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main(){ int x, y; cin >> x >> y; if(x*y==0){ cout << abs(x)+abs(y) + x>y?1:0; } else (x*y<0){ cout << abs(abs(y)-abs(x))+1; } else{ if(x<y) cout << y-x; else cout << 2+y-x; } }
a.cc: In function 'int main()': a.cc:8:30: error: no match for 'operator>' (operand types are 'std::basic_ostream<char>' and 'int') 8 | cout << abs(x)+abs(y) + x>y?1:0; | ~~~~~~~~~~~~~~~~~~~~~~~~~^~ | | | | | int | std::basic_ostream<char> a.cc:8:30: note: candidate: 'operator>(int, int)' (built-in) 8 | cout << abs(x)+abs(y) + x>y?1:0; | ~~~~~~~~~~~~~~~~~~~~~~~~~^~ a.cc:8:30: 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:1176:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1176 | operator>(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1176:5: note: template argument deduction/substitution failed: a.cc:8:31: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 8 | cout << abs(x)+abs(y) + x>y?1:0; | ^ /usr/include/c++/14/bits/regex.h:1236: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>&)' 1236 | operator>(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1236:5: note: template argument deduction/substitution failed: a.cc:8:31: note: 'std::basic_ostream<char>' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' 8 | cout << abs(x)+abs(y) + x>y?1:0; | ^ /usr/include/c++/14/bits/regex.h:1329: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>&)' 1329 | operator>(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1329:5: note: template argument deduction/substitution failed: a.cc:8:31: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 8 | cout << abs(x)+abs(y) + x>y?1:0; | ^ /usr/include/c++/14/bits/regex.h:1403:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1403 | operator>(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1403:5: note: template argument deduction/substitution failed: a.cc:8:31: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 8 | cout << abs(x)+abs(y) + x>y?1:0; | ^ /usr/include/c++/14/bits/regex.h:1497:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1497 | operator>(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1497:5: note: template argument deduction/substitution failed: a.cc:8:31: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 8 | cout << abs(x)+abs(y) + x>y?1:0; | ^ /usr/include/c++/14/bits/regex.h:1573:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1573 | operator>(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1573:5: note: template argument deduction/substitution failed: a.cc:8:31: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 8 | cout << abs(x)+abs(y) + x>y?1:0; | ^ /usr/include/c++/14/bits/regex.h:1673:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1673 | operator>(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1673:5: note: template argument deduction/substitution failed: a.cc:8:31: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 8 | cout << abs(x)+abs(y) + x>y?1:0; | ^ 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:1058:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1058 | operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1058:5: note: template argument deduction/substitution failed: a.cc:8:31: note: 'std::basic_ostream<char>' is not derived from 'const std::pair<_T1, _T2>' 8 | cout << abs(x)+abs(y) + x>y?1:0; | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:462:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 462 | operator>(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:462:5: note: template argument deduction/substitution failed: a.cc:8:31: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>' 8 | cout << abs(x)+abs(y) + x>y?1:0; | ^ /usr/include/c++/14/bits/stl_iterator.h:507:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 507 | operator>(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:507:5: note: template argument deduction/substitution failed: a.cc:8:31: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>' 8 | cout << abs(x)+abs(y) + x>y?1:0; | ^ /usr/include/c++/14/bits/stl_iterator.h:1714:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1714 | operator>(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1714:5: note: template argument deduction/substitution failed: a.cc:8:31: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>' 8 | cout << abs(x)+abs(y) + x>y?1:0; | ^ /usr/include/c++/14/bits/stl_iterator.h:1774:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1774 | operator>(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1774:5: note: template argument deduction/substitution failed: a.cc:8:31: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>' 8 | cout << abs(x)+abs(y) + x>y?1:0; | ^ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/string_view:695:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 695 | operator> (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:695:5: note: template argument deduction/substitution failed: a.cc:8:31: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 8 | cout << abs(x)+abs(y) + x>y?1:0; | ^ /usr/include/c++/14/string_view:702: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> >)' 702 | operator> (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:702:5: note: template argument deduction/substitution failed: a.cc:8:31: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 8 | cout << abs(x)+abs(y) + x>y?1:0; | ^ /usr/include/c++/14/string_view:710:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 710 | operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:710:5: note: template argument deduction/substitution failed: a.cc:8:31: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int' 8 | cout << abs(x)+abs(y) + x>y?1:0; | ^ /usr/include/c++/14/bits/basic_string.h:3915:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3915 | opera
s277019682
p03838
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main(){ int x, y; cin >> x >> y; if(x*y==0){ if(x>0) cout << abs(x)+1; else cout << abs(x); } else (x*y<0){ cout << abs(abs(y)-abs(x))+1; } else{ if(x<y) cout << y-x; else cout << 2+y-x; } }
a.cc: In function 'int main()': a.cc:11:15: error: expected ';' before '{' token 11 | else (x*y<0){ | ^ | ; a.cc:14:3: error: 'else' without a previous 'if' 14 | else{ | ^~~~
s288495966
p03838
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main(){ int x, y; cin >> x >> y; if(x*y==0){ if(x) cout << x+1; else cout << y; } else (x*y<0){ cout << abs(y)-abs(x)+1; } else{ if(x<y) cout << y-x; else cout << 2+y-x; } }
a.cc: In function 'int main()': a.cc:11:15: error: expected ';' before '{' token 11 | else (x*y<0){ | ^ | ; a.cc:14:3: error: 'else' without a previous 'if' 14 | else{ | ^~~~
s186424179
p03838
C++
#include <bits/stdc++.h> #define int long long using namespace std; signed main(){ int x,y; cin>>x>>y; if(x>0){ if(y>0){ if(x<y)cout<<max(x-y,y-x)<<endl; else cout<<max(x-y,y-x)+2<<endl; else cout<<max(x+y,-x-y)+1<<endl; } if(x==0){ if(y>=0)cout<<y<<endl; else cout<<1-y<<endl; } if(x<0){ if(y>0)cout<<max(x+y,-x-y)+1<<endl; if(y==0)cout<<-x<<endl; if(y<0){ if(x>y)cout<<x-y+2<<endl; else cout<<y-x<<endl; } } }
a.cc: In function 'int main()': a.cc:12:5: error: expected '}' before 'else' 12 | else cout<<max(x+y,-x-y)+1<<endl; | ^~~~ a.cc:9:12: note: to match this '{' 9 | if(y>0){ | ^
s175255941
p03838
C++
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <map> #include <cmath> #include <queue> using namespace std; #define FOR(i,a,b) for(int (i)=(a);(i)<=(b);(i)++) #define rep(i,n) FOR(i,0,n-1) #define ll long long #define MOD 998244353 #define MAXN 100005 #define P pair<int,int> vector<string> v; signed main(){ int x,y;cin >>x>>y; ans = abs(abs(x) - abs(y)); if(x<0)ans++; if(y<0)ans++; cout << ans << endl; }
a.cc: In function 'int main()': a.cc:22:9: error: 'ans' was not declared in this scope; did you mean 'abs'? 22 | ans = abs(abs(x) - abs(y)); | ^~~ | abs
s603807602
p03838
C++
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <map> #include <cmath> #include <queue> using namespace std; #define FOR(i,a,b) for(int (i)=(a);(i)<=(b);(i)++) #define rep(i,n) FOR(i,0,n-1) #define ll long long #define MOD 998244353 #define MAXN 100005 #define P pair<int,int> vector<string> v; signed main(){ int x,y; ans = abs(abs(x) - abs(y)); if(x<0)ans++; if(y<0)ans++; cout << ans << endl; }
a.cc: In function 'int main()': a.cc:22:9: error: 'ans' was not declared in this scope; did you mean 'abs'? 22 | ans = abs(abs(x) - abs(y)); | ^~~ | abs
s755675893
p03838
C++
#include <iostream> #include <vector> #include <algorithm> #include <cmath> #include <queue> #include <limits> #define REP(i,n) for(long (i)=0;(i)<(n);(i)++) #define REPI(i,a,b) for(long (i)=(a);(i)<(b);(i)++) #define INF numeric_limits<double>::infinity() constexpr long MOD = 998244353; using namespace std; using P = pair<long, long>; using VI = vector<long>; int main() { long x, y; cin >> x >> y; // 8 cases if (y >= 0) { if (x >= 0 && x <= y) { cout << y - x << endl; return 0; } if (x >= y) { cout << x - y + 2 << endl; return 0; } if (x <= 0 && -x <= y) { cout << y - (-x) + 1 << endl; return 0; } assert(x <= 0 && -x >= y); cout << -x - y + 1 << endl; return 0; } if (y <= 0) { if (y <= x && x <= 0) { cout << -y - (-x) + 2 << endl; return 0; } if (x <= y) { cout << y - x << endl; return 0; } if (x >= 0 && x >= -y) { cout << x - (-y) + 1 << endl; return 0; } assert(x >= 0 && x <= -y); cout << -y - x + 1 << endl; } }
a.cc: In function 'int main()': a.cc:33:9: error: 'assert' was not declared in this scope 33 | assert(x <= 0 && -x >= y); | ^~~~~~ a.cc:6:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>' 5 | #include <queue> +++ |+#include <cassert> 6 | #include <limits> a.cc:50:9: error: 'assert' was not declared in this scope 50 | assert(x >= 0 && x <= -y); | ^~~~~~ a.cc:50:9: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
s603275795
p03838
C++
#include <iostream> #include <algorithm> #include <cmath> #include <limits> #include <vector> #include <cstdio> #include <bits/stdc++.h> #include <set> #include <map> #include <stdio.h> using namespace std; using ll = long long; map <int ,int> mpa,mpb; int main(){ ll x,y; cin >>x >>y; ll ans=0; if(x=0 ||y=0){ ans=max(abs(x),abs(y)); if(x<0 || y<0) ans++; cout << ans; return 0; } else if(x*y>0 && x<=y){ cout << y-x; return 0; } else if(x*y>0 && x>y){ cout << x-y+2; return 0; } else if(x*y<0){ cout << abs(x+y)+1; return 0; } }
a.cc: In function 'int main()': a.cc:19:10: error: lvalue required as left operand of assignment 19 | if(x=0 ||y=0){ | ~~^~~
s266007945
p03838
C++
#include <iostream> #include <algorithm> #include <cmath> #include <limits> #include <vector> #include <cstdio> #include <bits/stdc++.h> #include <set> #include <map> #include <stdio.h> using namespace std; using ll = long long; map <int ,int> mpa,mpb; int main(){ ll x,y; cin >>x >>y; ll ans=0; if(x*y=0){ ans=max(abs(x),abs(y)); if(x<0 || y<0) ans++; cout << ans; return 0; } else if(x*y>0 && x<=y){ cout << y-x; return 0; } else if(x*y>0 && x>y){ cout << x-y+2; return 0; } else if(x*y<0){ cout << abs(x+y)+1; return 0; } }
a.cc: In function 'int main()': a.cc:19:7: error: lvalue required as left operand of assignment 19 | if(x*y=0){ | ~^~
s203924731
p03838
C++
#include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <map> #include <set> #include <vector> #include <stack> #include <queue> #include <bitset> #include <algorithm> #include <numeric> #include <functional> using namespace std; #define Rep(b, e, i) for(int i = b; i <= e; i++) #define Repr(e, b, i) for(int i = e; i >= b; i--) #define rep(n, i) Rep(0, n-1, i) #define repr(n, i) Repr(n-1, 0, i) #define all(v) (v).begin(), (v).end() #define pb(v) push_back(v) #define uniq(v) (v).erase(unique(all(v)),(v).end()) #define bitcnt(x) __builtin_popcount(x) typedef long long ll; typedef pair<ll, ll> llP; typedef pair<int, int> intP; typedef std::priority_queue<int> IntPrioQueue; //Z->A typedef std::priority_queue<int, std::vector<int>, std::greater<int> > IntReversePrioQueue; //A->Z //vector の中身を出力 template <class T>ostream &operator<<(ostream &o,const vector<T>&v) {o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;} void solve(void){ int N, M; cin >> N >> M; if (N > M) { if (M > 0) { cout << N - M + 2 << endl; return; } if (N > 0) { cout << abs(M + N) + 1 << endl; return; } else { cout << abs(M - N) + 2 << endl; return; } } else { else cout << min(abs(M - N), abs(M+N)+1) << endl; return; } } int main(void){ solve(); //cout << "yui(*-v・)yui" << endl; return 0; }
a.cc: In function 'void solve()': a.cc:54:9: error: 'else' without a previous 'if' 54 | else cout << min(abs(M - N), abs(M+N)+1) << endl; | ^~~~
s984269648
p03838
C++
#include <iostream> #include <algorithm> #include <set> #include <cstring> using namespace std; typedef long long ll; int x,y; int main(void){ scanf("%d%d",&x,&y); if((x>=0&&y>0)||(x<=0&&y<0)){ if(x<=y)printf("%d\n",y-x); else printf("%d\n",x-y+2); }else{ else printf("%d\n",abs(abs(x)-abs(y))+1); } }
a.cc: In function 'int main()': a.cc:14:8: error: 'else' without a previous 'if' 14 | else printf("%d\n",abs(abs(x)-abs(y))+1); | ^~~~
s809160503
p03838
C++
#include<bits/stdc++.h> const int INF = 1e9; const int MOD = 1e9+7; #define LL long long const LL LINF = 1e18; using namespace std; #define COUT(v) cout<<(v)<<endl #define CIN(n) int(n);cin >> (n) #define YES(n) cout<<((n)? "YES" : "NO")<<endl #define Yes(n) cout<<((n)? "Yes" : "No")<<endl #define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE" ) << endl #define Possible(n) cout << ((n) ? "Possible" : "Impossible" ) <<endl #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) for(int i=0;i<(n);++i) #define REPR(i,n) for(int i=n;i>=0;i--) #define FOREACH(x,a) for(auto& (x) : (a) ) #define ALL(obj) (obj).begin(),(obj).end() #define P pair<int,int> #define I vector<int> #define S set<int> #define pb(v) push_back(v) #define V vector #define rt return pair<int,int> A,B; int main(){ CIN(B);CIN(A); LL ans1,ans2,ans3,ans4; V<LL>; ans1 = (-A>=B?-A-B:INF)+1; ans2 = (A>=B?A-B:INF); ans3 = (-A>=-B?(-A)-(-B):INF)+2; ans4 = (A>=-B?A-(-B):INF)+1; v.pb(ans1); v.pb(ans2); v.pb(ans3); v.pb(ans4); sort(ALL(v)); COUT(v.at(0)); return 0; }
a.cc: In function 'int main()': a.cc:26:11: error: declaration does not declare anything [-fpermissive] 26 | #define V vector | ^ a.cc:34:5: note: in expansion of macro 'V' 34 | V<LL>; | ^ a.cc:39:5: error: 'v' was not declared in this scope 39 | v.pb(ans1); | ^
s197793478
p03838
C++
#include <cstdio> #include <cstdlib> #include <iostream> #include <fstream> #include <sstream> #include <set> #include <map> #include <vector> #include <list> #include <algorithm> #include <cstring> #include <cmath> #include <string> #include <queue> #include <bitset> //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic #include <cassert> #include <iomanip> //do setprecision #include <ctime> #include <complex> using namespace std; #define FOR(i,b,e) for(int i=(b);i<(e);++i) #define FORQ(i,b,e) for(int i=(b);i<=(e);++i) #define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i) #define REP(x, n) for(int x = 0; x < (n); ++x) #define ST first #define ND second #define PB push_back #define MP make_pair #define LL long long #define ULL unsigned LL #define LD long double const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342; const int mod=1000000007; int main(){ LL a,b,c=0; cin>>a>>b; FOR(i,0,4){ int t=0; if(i&1){ t++; a=-a; } if(fabs(b)-a<0)continue; t+=fabs(b)-a; if(i&2){ t++; a=-a; } if(b!=a)continue; c=min(c,t); } cout<<c<<endl; return 0; }
a.cc: In function 'int main()': a.cc:54:22: error: no matching function for call to 'min(long long int&, int&)' 54 | c=min(c,t); | ~~~^~~~~ 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:3: /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:54:22: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 54 | c=min(c,t); | ~~~^~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61, from a.cc:10: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:54:22: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 54 | c=min(c,t); | ~~~^~~~~
s639009167
p03838
Java
import java.util.Scanner; public class AGC08a{ static int calc(int init, int goal){ if(goal * init < 0){ return Math.abs(goal + init) + 1; } else if(init > 0 && goal > 0){ int ret; if(init > goal){ ret = init - goal + 2; }else{ ret = goal - init; } return ret; }else{ return calc(-goal, -init); } } public static void main(String[] args) { Scanner sc = new Scanner(System.in); int init; int goal; init = Integer.parseInt(sc.next()); goal = Integer.parseInt(sc.next()); sc.close(); System.out.println(calc(init, goal)); } }
Main.java:3: error: class AGC08a is public, should be declared in a file named AGC08a.java public class AGC08a{ ^ 1 error
s703408963
p03838
Java
import java.util.*; public class AGC08a{ static int init; static int goal; static int calc(int init, int goal){ int ret = 0; if(goal * init < 0){ ret = Math.abs(goal + init) + 1; } else if(init > 0 && goal > 0){ if(init > goal){ ret = init - goal + 2; }else{ ret = goal - init; } }else{ ret = calc(-goal, -init); } return ret; } public static void main(String[] args) { Scanner sc = new Scanner(System.in); int init; int goal; init = Integer.parseInt(sc.next()); goal = Integer.parseInt(sc.next()); System.out.println(calc(init, goal)); } }
Main.java:2: error: class AGC08a is public, should be declared in a file named AGC08a.java public class AGC08a{ ^ 1 error
s549462173
p03838
C++
#include<bits/stdc++.h> #define REP(i,s,n) for(int i=s;i<n;++i) #define rep(i,n) REP(i,0,n) #define ALL(x) x.begin(),x.end() #define EPS (1e-8) #define equals(a,b) (fabs((a)-(b))<EPS) using namespace std; typedef long long ll; inline bool LT(double a,double b) { return !equals(a,b) && b < b; } inline bool LTE(double a,double b) { return equals(a,b) || b < b; } void compute() { } int main() { int x,y; cin >> x >> y; int ans = abs( abs(x) - abs(y) ); if( x == 0 ) { if( x != y && y < 0 ) ans += 1; } else if( y == 0 ) { if( x != y && x > 0 ) ans += 1; } else { if( abs(x) == abs(y) ) { if( x != y ) ans += 1; } else
a.cc: In function 'int main()': a.cc:31:11: error: expected statement at end of input 31 | } else | ^ a.cc:31:11: error: expected '}' at end of input a.cc:28:10: note: to match this '{' 28 | } else { | ^ a.cc:31:11: error: expected '}' at end of input 31 | } else | ^ a.cc:20:12: note: to match this '{' 20 | int main() { | ^
s108851057
p03838
C++
#include<bits/stdc++.h> #define REP(i,s,n) for(int i=s;i<n;++i) #define rep(i,n) REP(i,0,n) #define ALL(x) x.begin(),x.end() #define EPS (1e-8) #define equals(a,b) (fabs((a)-(b))<EPS) using namespace std; typedef long long ll; inline bool LT(double a,double b) { return !equals(a,b) && b < b; } inline bool LTE(double a,double b) { return equals(a,b) || b < b; } void compute() { } int main() { int x,y; cin >> x >> y; int ans = abs( abs(x) - abs(y) ); if( x == 0 ) { if( x != y && y < 0 ) ans += 1; } else if( y == 0 ) { if( x != y && x > 0 ) ans += 1; } else { if( abs(x) == abs(y) ) { if( x != y ) ans += 1; } else
a.cc: In function 'int main()': a.cc:31:11: error: expected statement at end of input 31 | } else | ^ a.cc:31:11: error: expected '}' at end of input a.cc:28:10: note: to match this '{' 28 | } else { | ^ a.cc:31:11: error: expected '}' at end of input 31 | } else | ^ a.cc:20:12: note: to match this '{' 20 | int main() { | ^