submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s432363407
p04011
Java
import java.util.*; public class main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int k = in.nextInt(); int x = in.nextInt(); int y = in.nextInt(); int z; if (k > n) { System.out.println(x * n); } else { z = n - k; System.out.println((x * k) + (y * z)); } } }
Main.java:4: error: class main is public, should be declared in a file named main.java public class main { ^ 1 error
s446994935
p04011
C
/* C++ */ #include<bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<ll,ll> pint; const int MAX = 510000; const int MOD = 1000000007; #define rep(i, n) for(ll i = ll(0); i < ll(n); i++) #define Rep(i, n) for(ll i = ll(1); i < ll(n); i++) #define ALL(a) (a).begin(),(a).end() #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define PI 3.14159265358979323846 #define ifYN(x) cout<<(x?"Yes":"No")<<"\n" ll fac[MAX], finv[MAX], inv[MAX]; 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; } bool palindrome(string s){ bool flag=true; rep(i,(ll)s.size()) if(s[i]!=s[s.size()-1-i]) flag=false; return flag; } // テーブルを作る前処理 void COMinit() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for (ll 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; } } ll Len(ll n) { ll s=0; while(n!=0) s++, n/=10; return s; } ll Sint(ll n) { ll ans=0; while(n!=0) ans+=n%10,n/=10; return ans; } ll Svec(vector<ll> v){ ll n=0; rep(i,(ll)v.size()) n+=v[i]; return n; } 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; } ll Factorial(ll n){ ll m=1; while(n>=1) m*=n,n--; return m; } void runlength(string s,vector<pair<char,ll>> &p){ ll x=1; if(s.size()==1){ p.push_back(pair<char,ll>(s[0],1)); } rep(i,(ll)s.size()-1){ if(s[i]==s[i+1]){ x++; if(i==(ll)s.size()-2){ p.push_back(pair<char,ll>(s[i],x)); } }else{ p.push_back(pair<char,ll>(s[i],x)); x=1; if(i==(ll)s.size()-2){ p.push_back(pair<char,ll>(s[s.size()-1],x)); } } } } ll COM(ll n,ll k){ if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD; } ll modpow(ll a, ll n, ll mod) { ll res = 1; while (n > 0) { if (n & 1) res = res * a % mod; a = a * a % mod; n >>= 1; } return res; } string Toupper(string s){ string ans=""; rep(i,s.size()){ if('a'<=s[i] && s[i]<='z') ans+=(char)s[i]-32; else ans+=s[i]; } return ans; } string Tolower(string s){ string ans=""; rep(i,s.size()){ if('A'<=s[i] && s[i]<='Z') ans+=(char)s[i]+32; else ans+=s[i]; } return ans; } void dis(vector<ll> v){ rep(i,v.size()) cout<<v[i]<<endl; } void dis2(vector<vector<ll>> v){ rep(i,v.size()){ rep(j,v[0].size()) cout<<v[i][j]<<' '; cout<<endl; } } const int MAX_N=100010; vector<bool> sieve_of_eratosthenes(){ vector<bool> isPrime(MAX_N+1,true); /* isPrime[1]=false; */ for(int i=2;i<=MAX_N;i++){ if(isPrime[i]){ for(int j=2*i;j<=MAX_N;j+=i){ isPrime[j]=false; } } } return isPrime; } vector<pint> prime_factorize(ll n){ vector<pint> ans; for(ll p=2;p<=sqrt(n);p++){ if(n%p!=0) continue; ll cnt=0; while(n%p==0){ n/=p; cnt++; } ans.push_back(make_pair(p,cnt)); } if(n!=1) ans.push_back(make_pair(n,1)); return ans; } /*bool cmp(pint a, pint b) { return a.second < b.second; }*/ /*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/ int main() { IOS; ll n,k,x,y; cin>>n>>k>>x>>y; ll ans=0; if(n<=k) ans+=n*x; else{ ans+=(n-k)*y; ans+=k*x; } cout<<ans<<endl; }
main.c:2:9: fatal error: bits/stdc++.h: No such file or directory 2 | #include<bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s990851476
p04011
Java
import java.util.*; public class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); int x = sc.nextInt(); int y = sc.nextInt(); if(n >= k){ int sum = k * x + (n - k) * y; System.out.println(sum); }else{ int sum = k * x; } System.out.println(sum); } }
Main.java:18: error: cannot find symbol System.out.println(sum); ^ symbol: variable sum location: class Main 1 error
s661024620
p04011
C++
#include<iostream> #include<string> using namespace std; int data[26];// int main(){ string str; //int str; cin>>str; for(int i=0;i<str.size();i++){ //for(int i=0;i<strlen(str);i++){ int index = str.at(i)-'a'; //今見ている文字列をアルファベット昇順の順番の数に変換する data[index]++; //カウンタを増やす } int flag=0; //数え上げたアルファベットの数を確認する for(int i=0;i<26;i++){ if(data[i]%2==1)flag=1; } if(flag==0)cout<< "YES"<<endl; else cout<< "NO"<<endl; return 0; }
a.cc: In function 'int main()': a.cc:16:9: error: reference to 'data' is ambiguous 16 | data[index]++; //カウンタを増やす | ^~~~ In file included from /usr/include/c++/14/string:53, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:6:5: note: 'int data [26]' 6 | int data[26];// | ^~~~ a.cc:22:12: error: reference to 'data' is ambiguous 22 | if(data[i]%2==1)flag=1; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:6:5: note: 'int data [26]' 6 | int data[26];// | ^~~~
s840671160
p04011
C
#include <stdio.h> int main(void){ int N, K, X, Y; scanf("%d %d %d %d",&N, &K, &X, &Y); if(1<=Y<=X<=10000 && 1<=N<=10000 && 1<=K<=10000){ if (N<=K){ printf("%d\n", X*K); } else if (N>K){ printf("%d\n", X*K+Y*(N-K)); } else { printf("%s\n","Invalid."); } return 0; }
main.c: In function 'main': main.c:15:2: error: expected declaration or statement at end of input 15 | } | ^
s005319837
p04011
C
#include <stdio.h> int main(void){ int N, K, X, Y; scanf("%d %d %d %d",&N, &K, &X, &Y); if(1<=Y<=X<=10000 && 1<=N<=10000 && 1<=K<=10000){ if (N<=K){ printf("%d\n", X*K); } else if (N>K){ printf("%d\n", X*K+Y*(N-K); } else { printf("%s\n","Invalid."); } return 0; }
main.c: In function 'main': main.c:10:31: error: expected ')' before ';' token 10 | printf("%d\n", X*K+Y*(N-K); | ~ ^ | ) main.c:10:32: error: expected ';' before '}' token 10 | printf("%d\n", X*K+Y*(N-K); | ^ | ; 11 | } else { | ~ main.c:15:2: error: expected declaration or statement at end of input 15 | } | ^
s430052282
p04011
C
#include <stdio.h> int main(void){ int N, K, X, Y; scanf("%d %d %d %d",&N, &K, &X, &Y); if(1<=Y<=X<=10000 && 1<=N<=10000 && 1<=K<=10000){ if (N<=K){ printf("%d\n", X*K); } else if (N>K){ printf("%d\n", X*K+Y*(N-K); } } else { printf("%s\n","Invalid."); } return 0; }
main.c: In function 'main': main.c:10:31: error: expected ')' before ';' token 10 | printf("%d\n", X*K+Y*(N-K); | ~ ^ | ) main.c:10:32: error: expected ';' before '}' token 10 | printf("%d\n", X*K+Y*(N-K); | ^ | ; 11 | } | ~
s991284335
p04011
C++
#include<iostream> using namespace std; int main(){ int n,k,x,y; cin >> n >> k >> x >> y; if(n>=k){ cout << k*x+(n-k)*y << endl; } else{ cout << k:x << endl; } }
a.cc: In function 'int main()': a.cc:10:12: error: found ':' in nested-name-specifier, expected '::' 10 | cout << k:x << endl; | ^ | :: a.cc:10:11: error: 'k' is not a class, namespace, or enumeration 10 | cout << k:x << endl; | ^
s943130680
p04011
C++
#include<iostream.h> using namespace std; int main() { int n,k,x,y,i,sum=0; cin>>n; cin>>k; cin>>x; cin>>y; for(i=1;i<=n;i++) { if(i<=k) { sum+=x; } else { sum+=y; } } cout<<sum<<endl; return 0; }
a.cc:1:9: fatal error: iostream.h: No such file or directory 1 | #include<iostream.h> | ^~~~~~~~~~~~ compilation terminated.
s751153132
p04011
C++
#include<iostream> using namespace std; int main(){ int n,k,x,y; cin>>n>>k>>x>>y; if (n<=k){ cout<<n*x<<endl; } else{ cout<<(k-n)*y+n*x<<emdl; } }
a.cc: In function 'int main()': a.cc:12:28: error: 'emdl' was not declared in this scope 12 | cout<<(k-n)*y+n*x<<emdl; | ^~~~
s349709356
p04011
C++
#include<iostream> using namespace std; int main(){ int n,k,x,y; cin>>n>>k>>x>>y; if (n<=k){ cout<<n*x<<endl; } else{ cout<<(k-n)*y+n*x<<emdl; } }
a.cc: In function 'int main()': a.cc:12:28: error: 'emdl' was not declared in this scope 12 | cout<<(k-n)*y+n*x<<emdl; | ^~~~
s135796425
p04011
C++
#include<bits/stdc++.h> using namespace std; int main(void){ int n,k,x,y; cin>>n>>k>>x>>y; ll ans=0; for(int i=1;i<=n;i++){ if(i<=k) ans+=x; else ans+=y; } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:7:5: error: 'll' was not declared in this scope 7 | ll ans=0; | ^~ a.cc:10:9: error: 'ans' was not declared in this scope; did you mean 'abs'? 10 | ans+=x; | ^~~ | abs a.cc:12:9: error: 'ans' was not declared in this scope; did you mean 'abs'? 12 | ans+=y; | ^~~ | abs a.cc:14:11: error: 'ans' was not declared in this scope; did you mean 'abs'? 14 | cout<<ans<<endl; | ^~~ | abs
s406083447
p04011
C++
#include <bits/stdc++>h> using namespace std; int main() { int a, b, x, y; cin >> a >> b >> x >> y; cout << a * x + (b - a) * y << endl; }
a.cc:1:24: warning: extra tokens at end of #include directive 1 | #include <bits/stdc++>h> | ^ a.cc:1:10: fatal error: bits/stdc++>: No such file or directory 1 | #include <bits/stdc++>h> | ^~~~~~~~~~~~~~ compilation terminated.
s126462985
p04011
C++
/** * auther: moririn_cocoa */ // #pragma GCC target("avx") // CPU 処理並列化 // #pragma GCC optimize("O3") // CPU 処理並列化 // #pragma GCC optimize("unroll-loops") // 条件処理の呼び出しを減らす // #define BEGIN_STACK_EXTEND(size) void * stack_extend_memory_ = malloc(size);void * stack_extend_origin_memory_;char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);*stack_extend_dummy_memory_ = 0;asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024)); // #define END_STACK_EXTEND asm volatile("mov %%rax, %%rsp"::"a"(stack_extend_origin_memory_));free(stack_extend_memory_) #include <iostream> #include <cstdio> #include <cstdlib> #include <algorithm> #include <cmath> #include <vector> #include <set> #include <map> #include <unordered_set> #include <unordered_map> #include <queue> #include <ctime> #include <cassert> #include <complex> #include <string> #include <cstring> #include <chrono> #include <random> #include <bitset> using namespace std; #define rep(i,n) for(int i=0;i<(n);i++) #define per(i,a,n) for (int i=n-1;i>=a;i--) #define pb push_back #define mp make_pair #define eb emplace_back #define all(x) (x).begin(),(x).end() #define SZ(x) ((int)(x).size()) #define fi first #define se second int main(int argc, char* argv[]) { int N; int K; int X; int Y; cin >> N; cin >> K; cin >> X; cin >> Y; if ( N >= K ) { cout << K * X + ( N - K ) * Y << endl; } else if { cout << K * X << endl; } return 0; }
a.cc: In function 'int main(int, char**)': a.cc:58:11: error: expected '(' before '{' token 58 | else if { | ^ | (
s685201130
p04011
C++
#include <iostream> using namespace std; int main(void){ int n, k, x, y; if (n >= k){ cout << n * x << endl;} if(n < k) { cout << (n - k) * y + k * x; << endl;} return 0; }
a.cc: In function 'int main()': a.cc:8:34: error: expected primary-expression before '<<' token 8 | cout << (n - k) * y + k * x; << endl;} | ^~
s817912205
p04011
C++
#include <iostream> using namespace std; int main(void){ int n, k, x, y; if (n >= k){ cout << k * x << endl; } if(n > k) { cout << (n - k) * y + k * x; << endl; } return 0; }
a.cc: In function 'int main()': a.cc:9:34: error: expected primary-expression before '<<' token 9 | cout << (n - k) * y + k * x; << endl; | ^~
s458780261
p04011
C++
#include <iostream> using namespace std; int main(void){ int n, k, x, y; if (n >= k){ cout << k * x << endl; if(n > k) { cout << (n - k) * y + k * x; << endl; return 0; }
a.cc: In function 'int main()': a.cc:8:34: error: expected primary-expression before '<<' token 8 | cout << (n - k) * y + k * x; << endl; | ^~ a.cc:11:2: error: expected '}' at end of input 11 | } | ^ a.cc:5:14: note: to match this '{' 5 | if (n >= k){ | ^ a.cc:11:2: error: expected '}' at end of input 11 | } | ^ a.cc:3:15: note: to match this '{' 3 | int main(void){ | ^
s139985743
p04011
C
#include <stdio.h> void main(){ int i,k,n,x,y,total; scanf("%d",&n); scanf("%d",&k); scanf("%d",&x); scanf("%d",&y); for( i = 1; i < n, i++ ) { if( i <= k ) { total += x; } else { total += y; } } printf( "%d", total ); return; }
main.c: In function 'main': main.c:11:25: error: expected ';' before ')' token 11 | for( i = 1; i < n, i++ ) { | ^~ | ;
s074113744
p04011
C
#include <stdio.h> void main(){ int i,k,n,x,y,total; scanf("%d",n); scanf("%d",k); scanf("%d",x); scanf("%d",y); for( i = 1; i < n, i++ ) { if( i <= k ) { total += x; } else { total += y; } printf( "%d", total ); return; }
main.c: In function 'main': main.c:11:25: error: expected ';' before ')' token 11 | for( i = 1; i < n, i++ ) { | ^~ | ; main.c:21:1: error: expected declaration or statement at end of input 21 | } | ^
s922656944
p04011
C++
#include <iostream> using namespace std; int main(void){ int n, k, x, y; cin>>n>>k>>x>>y; if (n=<k){ int ans=n*x; cout<<ans<<endl; } else { int a=k*y, b=(n-k)*y; int ans=a+b; cout<<ans<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:6:11: error: expected primary-expression before '<' token 6 | if (n=<k){ | ^
s934482132
p04011
C++
#include<bits/stdc++.h> int main(){ int N,K,X,Y,S; cin >>N>>K>>X>>Y; if(N>=K){ S=K*X+(N-K)*Y; cout <<S<<endl;} else{ S=N*X; cout <<S<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:5:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 5 | cin >>N>>K>>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:9:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 9 | cout <<S<<endl;} | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:9:13: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 9 | cout <<S<<endl;} | ^~~~ | std::endl In file included from /usr/include/c++/14/istream:41, from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~ a.cc:12:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 12 | cout <<S<<endl; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:12:13: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 12 | cout <<S<<endl; | ^~~~ | std::endl /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~
s456428001
p04011
C++
#include<bits/stdc++.h> int main(){ int N,K,X,Y,S; cin >>N>>K>>X>>Y; if(N>=K){ S=(N-K+1)*X+(N-K)*Y; cout <<S<<endl;} else{ S=N*X; cout <<S<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:5:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 5 | cin >>N>>K>>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:9:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 9 | cout <<S<<endl;} | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:9:13: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 9 | cout <<S<<endl;} | ^~~~ | std::endl In file included from /usr/include/c++/14/istream:41, from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~ a.cc:12:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 12 | cout <<S<<endl; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:12:13: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 12 | cout <<S<<endl; | ^~~~ | std::endl /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~
s619457929
p04011
C++
#include <bits/stdc++.h> using namespace std; int main(){ long long n,k,x,y; cin>>n>>k>>x>>y; cout<<min(k,n)*x+max(0,n-k)*y; }
a.cc: In function 'int main()': a.cc:8:29: error: no matching function for call to 'max(int, long long int)' 8 | cout<<min(k,n)*x+max(0,n-k)*y; | ~~~^~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:8:29: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 8 | cout<<min(k,n)*x+max(0,n-k)*y; | ~~~^~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:8:29: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 8 | cout<<min(k,n)*x+max(0,n-k)*y; | ~~~^~~~~~~
s731562038
p04011
C++
スコード Copy Copy #include <bits/stdc++.h> using namespace std; int main() { int n, k, x, y; cin >> n >> k >> x >> y; int total = 0; for (int i = 1; i <= n; i++) { if (i <= k) { total += x; } else if (i > k) { total += y; } }
a.cc:1:1: error: '\U000030b9\U000030b3\U000030fc\U000030c9' does not name a type 1 | スコード | ^~~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:5: /usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity 164 | __is_null_pointer(std::nullptr_t) | ^ /usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)' 159 | __is_null_pointer(_Type) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'? 164 | __is_null_pointer(std::nullptr_t) | ^~~~~~~~~ In file included from /usr/include/c++/14/cstddef:50, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41: /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here 443 | typedef decltype(nullptr) nullptr_t; | ^~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'? 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here 443 | typedef decltype(nullptr) nullptr_t; | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared 2086 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope 2087 | struct remove_extent<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid 2087 | struct remove_extent<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared 2099 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope 2100 | struct remove_all_extents<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid 2100 | struct remove_all_extents<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared 2171 | template<std::size_t _Len> | ^~~ /usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope 2176 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^~~~ /usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^ /usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope 2202 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope 2203 | struct __attribute__((__aligned__((_Align)))) { } __align; | ^~~~~~ In file included from /usr/include/c++/14/bits/stl_tempbuf.h:59, from /usr/include/c++/14/bits/stl_algo.h:69, from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive] 132 | __attribute__((__externally_visible__)); | ^ /usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive] 134 | __attribute__((__externally_visible__)); |
s958258538
p04011
C++
#include <bits/stdc++.h> using namespace std; int main() { int n, k, x, y; cin >> n >> k >> x >> y; int total = 0; for (int i = 1; i <= n; i++) { if (int i <= k) { total += x; } else if (i > k) { total += y; } } cout << total << endl; }
a.cc: In function 'int main()': a.cc:10:15: error: expected initializer before '<=' token 10 | if (int i <= k) { | ^~ a.cc:10:14: error: expected ')' before '<=' token 10 | if (int i <= k) { | ~ ^~~ | )
s952289052
p04011
Java
import java.util.Scanner; public class Abc044a { public static void main(String args[]) { Scanner sc = new Scanner(System.in); // 入力(n) int n = sc.nextInt(); // 入力(k) int k = sc.nextInt(); // 入力(x) int x = sc.nextInt(); // 入力(y) int y = sc.nextInt(); int fee = 0; if (n <= k) { fee = n * x; } else { fee = k * x + (n - k) * y; } System.out.println(fee); sc.close(); } }
Main.java:3: error: class Abc044a is public, should be declared in a file named Abc044a.java public class Abc044a { ^ 1 error
s375250603
p04011
C++
#include<bits/stdc++.h> using namespace std; int main() { int n,k,x,y; cin>>n>>k>>x>>; cout<<k*x+(n-k)*y<<endl; }
a.cc: In function 'int main()': a.cc:6:19: error: expected primary-expression before ';' token 6 | cin>>n>>k>>x>>; | ^
s298726585
p04011
C++
using namespace std; int counts = 0; int sum(vector<int> li, int size) { int sum = 0; for (int i = 0; i< size; i++) { sum +=li[i]; } return sum; } void agg(vector<int> car, int avg,int size ){ if(size>=2) { if ( sum(car, size)/size== avg){ counts+=1; } vector<int> temp1(size-1); for(int i = 0; i<size-1;i++) { temp1.push_back(car[i]); } agg(temp1, avg, size-1); }else { if (car[0] == avg){ counts += 1; } } } int main(){ int A, N; vector<int> card(A); cin >> A >> N; for(int i=0; i<A;i++) { cin >> card[i]; } for (int test = 0; test< A; test++) { vector<int> temp(A-test); for(int i=0; i<A; i++) { temp.push_back(card[i]); } agg(temp, N, temp.size()); } cout << counts << endl; }
a.cc:5:9: error: 'vector' was not declared in this scope 5 | int sum(vector<int> li, int size) { | ^~~~~~ a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' +++ |+#include <vector> 1 | using namespace std; a.cc:5:16: error: expected primary-expression before 'int' 5 | int sum(vector<int> li, int size) { | ^~~ a.cc:5:25: error: expected primary-expression before 'int' 5 | int sum(vector<int> li, int size) { | ^~~ a.cc:5:33: error: expression list treated as compound expression in initializer [-fpermissive] 5 | int sum(vector<int> li, int size) { | ^ a.cc:13:6: error: variable or field 'agg' declared void 13 | void agg(vector<int> car, int avg,int size ){ | ^~~ a.cc:13:10: error: 'vector' was not declared in this scope 13 | void agg(vector<int> car, int avg,int size ){ | ^~~~~~ a.cc:13:10: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' a.cc:13:17: error: expected primary-expression before 'int' 13 | void agg(vector<int> car, int avg,int size ){ | ^~~ a.cc:13:27: error: expected primary-expression before 'int' 13 | void agg(vector<int> car, int avg,int size ){ | ^~~ a.cc:13:35: error: expected primary-expression before 'int' 13 | void agg(vector<int> car, int avg,int size ){ | ^~~ a.cc: In function 'int main()': a.cc:33:5: error: 'vector' was not declared in this scope 33 | vector<int> card(A); | ^~~~~~ a.cc:33:5: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' a.cc:33:12: error: expected primary-expression before 'int' 33 | vector<int> card(A); | ^~~ a.cc:35:5: error: 'cin' was not declared in this scope 35 | cin >> A >> N; | ^~~ a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' +++ |+#include <iostream> 1 | using namespace std; a.cc:37:16: error: 'card' was not declared in this scope 37 | cin >> card[i]; | ^~~~ a.cc:40:16: error: expected primary-expression before 'int' 40 | vector<int> temp(A-test); | ^~~ a.cc:42:13: error: 'temp' was not declared in this scope 42 | temp.push_back(card[i]); | ^~~~ a.cc:42:28: error: 'card' was not declared in this scope 42 | temp.push_back(card[i]); | ^~~~ a.cc:44:13: error: 'temp' was not declared in this scope 44 | agg(temp, N, temp.size()); | ^~~~ a.cc:44:9: error: 'agg' was not declared in this scope 44 | agg(temp, N, temp.size()); | ^~~ a.cc:47:5: error: 'cout' was not declared in this scope 47 | cout << counts << endl; | ^~~~ a.cc:47:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:47:23: error: 'endl' was not declared in this scope 47 | cout << counts << endl; | ^~~~ a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' +++ |+#include <ostream> 1 | using namespace std;
s567469596
p04011
C++
#include <bits/stdc++.h> using namespace std; int main() { int N,K,X,Y; cin>>N>>K>>X>>Y; if(N<=K){ cout<<X*K<<endl; } else{ cout<<X*N+Y*(K-N)<<endl; }
a.cc: In function 'int main()': a.cc:11:3: error: expected '}' at end of input 11 | } | ^ a.cc:3:14: note: to match this '{' 3 | int main() { | ^
s563201602
p04011
C++
#include <iostream> #include <vector> #include <string> using namespace std; int main() { string w = ""; cin >> w; bool test = true; vector <char> tested; for (int i = 0; i < w.size()-1; i++) { if (find(tested.begin(), tested.end(), w[i]) == tested.end()) { tested.push_back(w[i]); int num = 1; for (int a = i+1; a < w.size(); a++) { if (w[i] == w[a]) { num += 1; } } if (num % 2 != 0) { test = false; break; } } } if (test != false) { cout << "Yes" << endl; } else { cout << "No" << endl; } }
a.cc: In function 'int main()': a.cc:15:17: error: no matching function for call to 'find(std::vector<char>::iterator, std::vector<char>::iterator, __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type&)' 15 | if (find(tested.begin(), tested.end(), w[i]) == tested.end()) | ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/bits/locale_facets.h:48, from /usr/include/c++/14/bits/basic_ios.h:37, from /usr/include/c++/14/ios:46, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)' 435 | find(istreambuf_iterator<_CharT> __first, | ^~~~ /usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: template argument deduction/substitution failed: a.cc:15:17: note: '__gnu_cxx::__normal_iterator<char*, std::vector<char> >' is not derived from 'std::istreambuf_iterator<_CharT>' 15 | if (find(tested.begin(), tested.end(), w[i]) == tested.end()) | ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s853670267
p04011
C++
#include <iostream> #include <vector> #include <string> using namespace std; int main() { string w = ""; cin >> w; sort(w.begin(), w.end()); bool test = true; vector <char> tested; for (int i = 0; i < w.size()-1; i++) { if (find(tested.begin(), tested.end(), w[i]) == tested.end()) { tested.push_back(w[i]); int num = 1; for (int a = i+1; a < w.size(); a++) { if (w[i] == w[a]) { num += 1; } } if (num % 2 != 0) { test = false; break; } } } if (test != false) { cout << "Yes" << endl; } else { cout << "No" << endl; } }
a.cc: In function 'int main()': a.cc:11:5: error: 'sort' was not declared in this scope; did you mean 'short'? 11 | sort(w.begin(), w.end()); | ^~~~ | short a.cc:16:17: error: no matching function for call to 'find(std::vector<char>::iterator, std::vector<char>::iterator, __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type&)' 16 | if (find(tested.begin(), tested.end(), w[i]) == tested.end()) | ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/bits/locale_facets.h:48, from /usr/include/c++/14/bits/basic_ios.h:37, from /usr/include/c++/14/ios:46, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)' 435 | find(istreambuf_iterator<_CharT> __first, | ^~~~ /usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: template argument deduction/substitution failed: a.cc:16:17: note: '__gnu_cxx::__normal_iterator<char*, std::vector<char> >' is not derived from 'std::istreambuf_iterator<_CharT>' 16 | if (find(tested.begin(), tested.end(), w[i]) == tested.end()) | ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s441942702
p04011
C++
#include <iostream> using namespace std; int main() { int n, k, x, y, ret; cin << n; cin << k; cin << x; cin << y; ret = k * x + (n - k) * y; cout << ret << endl; }
a.cc: In function 'int main()': a.cc:6:7: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int') 6 | cin << n; | ~~~ ^~ ~ | | | | | int | std::istream {aka std::basic_istream<char>} a.cc:6:7: note: candidate: 'operator<<(int, int)' (built-in) 6 | cin << n; | ~~~~^~~~ a.cc:6:7: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int' In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/string_view:763:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, basic_string_view<_CharT, _Traits>)' 763 | operator<<(basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/string_view:763:5: note: template argument deduction/substitution failed: a.cc:6:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 6 | cin << n; | ^ /usr/include/c++/14/bits/basic_string.h:4077:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 4077 | operator<<(basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4077:5: note: template argument deduction/substitution failed: a.cc:6:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 6 | cin << n; | ^ In file included from /usr/include/c++/14/bits/memory_resource.h:38, from /usr/include/c++/14/string:68: /usr/include/c++/14/cstddef:125:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator<<(byte, _IntegerType)' 125 | operator<<(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:125:5: note: template argument deduction/substitution failed: a.cc:6:3: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte' 6 | cin << n; | ^~~ In file included from /usr/include/c++/14/bits/ios_base.h:46: /usr/include/c++/14/system_error:339:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const error_code&)' 339 | operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e) | ^~~~~~~~ /usr/include/c++/14/system_error:339:5: note: template argument deduction/substitution failed: a.cc:6:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 6 | cin << n; | ^ /usr/include/c++/14/ostream:563:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _CharT)' 563 | operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c) | ^~~~~~~~ /usr/include/c++/14/ostream:563:5: note: template argument deduction/substitution failed: a.cc:6:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 6 | cin << n; | ^ /usr/include/c++/14/ostream:573:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char)' 573 | operator<<(basic_ostream<_CharT, _Traits>& __out, char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:573:5: note: template argument deduction/substitution failed: a.cc:6:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 6 | cin << n; | ^ /usr/include/c++/14/ostream:579:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char)' 579 | operator<<(basic_ostream<char, _Traits>& __out, char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:579:5: note: template argument deduction/substitution failed: a.cc:6:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 6 | cin << n; | ^ /usr/include/c++/14/ostream:590:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char)' 590 | operator<<(basic_ostream<char, _Traits>& __out, signed char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:590:5: note: template argument deduction/substitution failed: a.cc:6:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 6 | cin << n; | ^ /usr/include/c++/14/ostream:595:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char)' 595 | operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:595:5: note: template argument deduction/substitution failed: a.cc:6:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 6 | cin << n; | ^ /usr/include/c++/14/ostream:654:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const _CharT*)' 654 | operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:654:5: note: template argument deduction/substitution failed: a.cc:6:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 6 | cin << n; | ^ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:307:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const char*)' 307 | operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s) | ^~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:307:5: note: template argument deduction/substitution failed: a.cc:6:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 6 | cin << n; | ^ /usr/include/c++/14/ostream:671:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const char*)' 671 | operator<<(basic_ostream<char, _Traits>& __out, const char* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:671:5: note: template argument deduction/substitution failed: a.cc:6:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 6 | cin << n; | ^ /usr/include/c++/14/ostream:684:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const signed char*)' 684 | operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:684:5: note: template argument deduction/substitution failed: a.cc:6:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 6 | cin << n; | ^ /usr/include/c++/14/ostream:689:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const unsigned char*)' 689 | operator<<(basic_ostream<char, _Traits>& __out, const unsigned char* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:689:5: note: template argument deduction/substitution failed: a.cc:6:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 6 | cin << n; | ^ /usr/include/c++/14/ostream:810:5: note: candidate: 'template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&)' 810 | operator<<(_Ostream&& __os, const _Tp& __x) | ^~~~~~~~ /usr/include/c++/14/ostream:810:5: note: template argument deduction/substitution failed: /usr/include/c++/14/ostream: In substitution of 'template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&) [with _Ostream = std::basic_istream<char>&; _Tp = int]': a.cc:6:10: required from here 6 | cin << n; | ^ /usr/include/c++/14/ostream:810:5: error: no type named 'type' in 'struct std::enable_if<false, void>' 810 | operator<<(_Ostream&& __os, const _Tp& __x) | ^~~~~~~~ a.cc:7:7: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int') 7 | cin << k; | ~~~ ^~ ~ | | | | | int | std::istream {aka std::basic_istream<char>} a.cc:7:7: note: candidate: 'operator<<(int, int)' (built-in) 7 | cin << k; | ~~~~^~~~ a.cc:7:7: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int' /usr/include/c++/14/string_view:763:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, basic_string_view<_CharT, _Traits>)' 763 | operator<<(basic_o
s448639404
p04011
C++
#include <bits/stdc++.h> using namespace std; int main() { int N, K, X, Y; cin N >> K >> X >> Y; cout << K*X + Y*(N-K); }
a.cc: In function 'int main()': a.cc:6:6: error: expected ';' before 'N' 6 | cin N >> K >> X >> Y; | ^~ | ;
s243315111
p04011
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int,int> P; #define all(v) v.begin(), v.end() const ll mod=1000000007; ll countBits(ll in){ int res=0; for(;in>0;in>>=1){ if((in&0x01)!=0){ res++; } } return res; } template<typename T> void show2dVector(vector<vector<T>>& v){ for(int i=0;i<v.size();i++){ int m=v[i].size(); cout<<i<<" : "; for(int j=0;i<m;i++){ cout<<v[i][j]<<" "; } cout<<endl; } } void bfs(const vector<vector<int>>&g, int v, vector<bool>& seen){ seen[v]=true; cout<<v<<" "; for(auto next: g[v]){ if(seen[next]){ continue; } bfs(g,next,seen); } } bool dfs(vector<vector<int>> &g,int start,int goal,vector<bool>&seen){ bool res=false; seen[start]=true; if(start==goal){ return true; } for(auto next: g[start]){ if(seen[next]){ continue; } res=dfs(g,next,goal,seen); if(res){ break; } } return res; } ll gcd(ll a,ll b) { return b? gcd(b,a%b): a; } ll lcm(ll a,ll b) { return a*b/gcd(a,b); } bool isLowerCase(char c){ return (c>='a'&&c<='z'); } ll powm(ll a,ll n, ll m){ ll ret=1; while(n>0){ if(n%2==1){ ret=(ret*a)%m; } n>>=1; a=(a*a)%m; } return ret; } const string yesno(bool ans){ return (ans?"Yes":"No"); } int main() { ll n,k,x,y;cin>>n>>k>>x>>y; ll ans=min(n,k)*x+max(0,n-k)*y; cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:89:24: error: no matching function for call to 'max(int, ll)' 89 | ll ans=min(n,k)*x+max(0,n-k)*y; | ~~~^~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:89:24: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'}) 89 | ll ans=min(n,k)*x+max(0,n-k)*y; | ~~~^~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:89:24: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 89 | ll ans=min(n,k)*x+max(0,n-k)*y; | ~~~^~~~~~~
s694082474
p04011
Java
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(); // 整数の入力 int N = sc.nextInt(); int K = sc.nextInt(); int X = sc.nextInt(); int Y = sc.nextInt(); // 宿泊費の合計を計算 int sum = 0; if (N<=K) { sum = N * X; } else { sum = K * X + (N - K) * Y; } // 出力 System.out.println(sum); } }
Main.java:4: error: no suitable constructor found for Scanner(no arguments) Scanner sc = new Scanner(); ^ constructor Scanner.Scanner(Readable,Pattern) is not applicable (actual and formal argument lists differ in length) constructor Scanner.Scanner(Readable) is not applicable (actual and formal argument lists differ in length) constructor Scanner.Scanner(InputStream) is not applicable (actual and formal argument lists differ in length) constructor Scanner.Scanner(InputStream,String) is not applicable (actual and formal argument lists differ in length) constructor Scanner.Scanner(InputStream,Charset) is not applicable (actual and formal argument lists differ in length) constructor Scanner.Scanner(File) is not applicable (actual and formal argument lists differ in length) constructor Scanner.Scanner(File,String) is not applicable (actual and formal argument lists differ in length) constructor Scanner.Scanner(File,Charset) is not applicable (actual and formal argument lists differ in length) constructor Scanner.Scanner(File,CharsetDecoder) is not applicable (actual and formal argument lists differ in length) constructor Scanner.Scanner(Path) is not applicable (actual and formal argument lists differ in length) constructor Scanner.Scanner(Path,String) is not applicable (actual and formal argument lists differ in length) constructor Scanner.Scanner(Path,Charset) is not applicable (actual and formal argument lists differ in length) constructor Scanner.Scanner(String) is not applicable (actual and formal argument lists differ in length) constructor Scanner.Scanner(ReadableByteChannel) is not applicable (actual and formal argument lists differ in length) constructor Scanner.Scanner(ReadableByteChannel,String) is not applicable (actual and formal argument lists differ in length) constructor Scanner.Scanner(ReadableByteChannel,Charset) is not applicable (actual and formal argument lists differ in length) 1 error
s320024981
p04011
Java
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(); // 整数の入力 int N = sc.nextInt(); int K = sc.nextInt(); int X = sc.nextInt(); int Y = sc.nextInt(); // 宿泊費の合計を計算 int sum; if (N<=K) { sum = N * X; } else { sum = K * X + (N - K) * Y; } // 出力 System.out.println(sum); } }
Main.java:4: error: no suitable constructor found for Scanner(no arguments) Scanner sc = new Scanner(); ^ constructor Scanner.Scanner(Readable,Pattern) is not applicable (actual and formal argument lists differ in length) constructor Scanner.Scanner(Readable) is not applicable (actual and formal argument lists differ in length) constructor Scanner.Scanner(InputStream) is not applicable (actual and formal argument lists differ in length) constructor Scanner.Scanner(InputStream,String) is not applicable (actual and formal argument lists differ in length) constructor Scanner.Scanner(InputStream,Charset) is not applicable (actual and formal argument lists differ in length) constructor Scanner.Scanner(File) is not applicable (actual and formal argument lists differ in length) constructor Scanner.Scanner(File,String) is not applicable (actual and formal argument lists differ in length) constructor Scanner.Scanner(File,Charset) is not applicable (actual and formal argument lists differ in length) constructor Scanner.Scanner(File,CharsetDecoder) is not applicable (actual and formal argument lists differ in length) constructor Scanner.Scanner(Path) is not applicable (actual and formal argument lists differ in length) constructor Scanner.Scanner(Path,String) is not applicable (actual and formal argument lists differ in length) constructor Scanner.Scanner(Path,Charset) is not applicable (actual and formal argument lists differ in length) constructor Scanner.Scanner(String) is not applicable (actual and formal argument lists differ in length) constructor Scanner.Scanner(ReadableByteChannel) is not applicable (actual and formal argument lists differ in length) constructor Scanner.Scanner(ReadableByteChannel,String) is not applicable (actual and formal argument lists differ in length) constructor Scanner.Scanner(ReadableByteChannel,Charset) is not applicable (actual and formal argument lists differ in length) 1 error
s780195723
p04011
Java
import java.util.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); int x = sc.nextInt(); int y = sc.nextInt(); int sum = 0; if((n-k) >= 0){ sum += (k*x)+((n-k)*y); }else{ sum += n*x } System.out.println(sum); } }
Main.java:14: error: ';' expected sum += n*x ^ 1 error
s755326512
p04011
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N, K, X, Y; cin >> N; cin >> K; cin >> X; cin >> Y; int sum; if (N>K){ sum = K*X+(N-K)*Y; } else { sum = N*X; }
a.cc: In function 'int main()': a.cc:16:2: error: expected '}' at end of input 16 | } | ^ a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s605601948
p04011
C++
#include <bits/stdc++.h> using namespace std; int main () { int n,k,x,y; cin >>n>>k>>x>>y; if(n <= k) { answer == k*x } else { answer == k*x+(n-k)*y } cout << answer << endl; }
a.cc: In function 'int main()': a.cc:9:5: error: 'answer' was not declared in this scope 9 | answer == k*x | ^~~~~~ a.cc:11:5: error: 'answer' was not declared in this scope 11 | answer == k*x+(n-k)*y | ^~~~~~ a.cc:13:11: error: 'answer' was not declared in this scope 13 | cout << answer << endl; | ^~~~~~
s088631690
p04011
C++
#include <bits/stdc++.h> using namespace std; int main () { int n,k,x,y; cin >>n>>k>>x>>y; cout >> n*y-k*(x-y) >> endl; }
a.cc: In function 'int main()': a.cc:8:8: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int') 8 | cout >> n*y-k*(x-y) >> endl; | ~~~~ ^~ ~~~~~~~~~~~ | | | | | int | std::ostream {aka std::basic_ostream<char>} a.cc:8:8: note: candidate: 'operator>>(int, int)' (built-in) 8 | cout >> n*y-k*(x-y) >> endl; | ~~~~~^~~~~~~~~~~~~~ a.cc:8:8: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int' In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41, from a.cc:1: /usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)' 131 | operator>>(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed: a.cc:8:3: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte' 8 | cout >> n*y-k*(x-y) >> endl; | ^~~~ In file included from /usr/include/c++/14/string:55, 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.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 835 | operator>>(basic_istream<_CharT, _Traits>& __in, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed: a.cc:8:21: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 8 | cout >> n*y-k*(x-y) >> endl; | ^ /usr/include/c++/14/bitset:1597:5: note: candidate: 'template<class _CharT, class _Traits, long unsigned int _Nb> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, bitset<_Nb>&)' 1597 | operator>>(std::basic_istream<_CharT, _Traits>& __is, bitset<_Nb>& __x) | ^~~~~~~~ /usr/include/c++/14/bitset:1597:5: note: template argument deduction/substitution failed: a.cc:8:21: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 8 | cout >> n*y-k*(x-y) >> endl; | ^ In file included from /usr/include/c++/14/istream:1109, from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)' 978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c) | ^~~~~~~~ /usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed: a.cc:8:21: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 8 | cout >> n*y-k*(x-y) >> endl; | ^ /usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)' 849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed: a.cc:8:21: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 8 | cout >> n*y-k*(x-y) >> endl; | ^ /usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)' 854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed: a.cc:8:21: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 8 | cout >> n*y-k*(x-y) >> endl; | ^ /usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)' 896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed: a.cc:8:21: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 8 | cout >> n*y-k*(x-y) >> endl; | ^ /usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)' 939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed: a.cc:8:21: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 8 | cout >> n*y-k*(x-y) >> endl; | ^ /usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)' 945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed: a.cc:8:21: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 8 | cout >> n*y-k*(x-y) >> endl; | ^ /usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed: /usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = int]': a.cc:8:21: required from here 8 | cout >> n*y-k*(x-y) >> endl; | ^ /usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/14/complex:509:5: note: candidate: 'template<class _Tp, class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, complex<_Tp>&)' 509 | operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x) | ^~~~~~~~ /usr/include/c++/14/complex:509:5: note: template argument deduction/substitution failed: a.cc:8:21: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 8 | cout >> n*y-k*(x-y) >> endl; | ^ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:143: /usr/include/c++/14/iomanip:76:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Resetiosflags)' 76 | operator>>(basic_istream<_CharT, _Traits>& __is, _Resetiosflags __f) | ^~~~~~~~ /usr/include/c++/14/iomanip:76:5: note: template argument deduction/substitution failed: a.cc:8:21: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 8 | cout >> n*y-k*(x-y) >> endl; | ^ /usr/include/c++/14/iomanip:106:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Setiosflags)' 106 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setiosflags __f) | ^~~~~~~~ /usr/include/c++/14/iomanip:106:5: note: template argument deduction/substitution failed: a.cc:8:21: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 8 | cout >> n*y-k*(x-y) >> endl; | ^ /usr/include/c++/14/iomanip:137:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Setbase)' 137 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setbase __f) | ^~~~~~~~ /usr/include/c++/14/iomanip:137:5: note: template argument deduction/substitution failed: a.cc:8:21: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 8 | cout >> n*y-k*(x-y) >> endl; | ^ /usr/include/c++/14/iomanip:177:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Setfill<_CharT>)' 177 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setfill<_CharT> __f) | ^~~~~~~~ /usr/include/c++/14/iomanip:177:5: note: template argument deduction/substitution failed: a.cc:8:21: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 8 | cout >> n*y-k*(x-y) >> endl; | ^ /usr/include/c++/14/iomanip:207:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Setprecision)
s558750379
p04011
C++
#include <bits/stdc++.h> using namespace std; int main () { int n,k,x,y; cin >>n>>k>>x>>y; cout >> n*y-K*(x-y) >> endl; }
a.cc: In function 'int main()': a.cc:8:15: error: 'K' was not declared in this scope 8 | cout >> n*y-K*(x-y) >> endl; | ^
s649830403
p04011
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n,k,x,y; cin >> n >> k >> x >> y; if(n<=k){ cout << n*x << endl; } else if{ cout << k*x + (n-k)*y << endl; } }
a.cc: In function 'int main()': a.cc:10:10: error: expected '(' before '{' token 10 | else if{ | ^ | (
s988957606
p04011
C++
#include <bits/stdc++.h> using namespace std; int main() { int N,K,X,Y,A; cin >> N; cin >> K; cin >> X; cin >> Y; if(N<K){ a=X*N; }else{ a=X*K+Y*(N-K); } cout << a << endl; }
a.cc: In function 'int main()': a.cc:12:5: error: 'a' was not declared in this scope 12 | a=X*N; | ^ a.cc:14:5: error: 'a' was not declared in this scope 14 | a=X*K+Y*(N-K); | ^ a.cc:16:11: error: 'a' was not declared in this scope 16 | cout << a << endl; | ^
s283483456
p04011
C++
#include <iostream> #include <bitset> #include <vector> #include <string> #include <algorithm> #include <set> #include <map> using namespace std; using ll = long long int; using dd = long double; const ll MOD = 1e9 + 7; vector<string> dfs(string s, ll depth, vector<char> symbol) { vector<string> ret; if (depth == 0) { ret.push_back(s); return ret; } for (ll i = 0; i < symbol.size(); i++) { auto vec = dfs(s + symbol[i], depth - 1, symbol); for (auto &&e : vec) { ret.push_back(e); } } return ret; } ll gcd(ll a, ll b) { if (a % b == 0) { return b; } return gcd(b, a % b); } int main() { ll N, K, X, Y; cin >> N >> K >> X >> Y; cout << min(N - K, 0) * Y + min(N, K) * X << endl; }
a.cc: In function 'int main()': a.cc:47:16: error: no matching function for call to 'min(ll, int)' 47 | cout << min(N - K, 0) * Y + min(N, K) * X << 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: template argument deduction/substitution failed: a.cc:47:16: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 47 | cout << min(N - K, 0) * Y + min(N, K) * X << endl; | ~~~^~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61, from a.cc:5: /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:47:16: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 47 | cout << min(N - K, 0) * Y + min(N, K) * X << endl; | ~~~^~~~~~~~~~
s631326604
p04011
C++
#include <bits/stdc++.h> using namespace std; int main() { int a,b,c; cin >> a >> b >> c >> d; int answer == b*c + ( a-b ) * b cout << answer << endl; }
a.cc: In function 'int main()': a.cc:6:25: error: 'd' was not declared in this scope 6 | cin >> a >> b >> c >> d; | ^ a.cc:8:14: error: expected initializer before '==' token 8 | int answer == b*c + ( a-b ) * b | ^~
s647796537
p04011
C++
#include <iostream> #include <string> using namespace std; int main() { int N, K, X, Y; int sum; cin >> N >> K >> X >> Y; if (N > K) { sum = K * X + (N-K) * Y } else sum = N * X cout << sum << endl; }
a.cc: In function 'int main()': a.cc:13:28: error: expected ';' before '}' token 13 | sum = K * X + (N-K) * Y | ^ | ; 14 | } | ~ a.cc:15:19: error: expected ';' before 'cout' 15 | else sum = N * X | ^ | ; 16 | 17 | cout << sum << endl; | ~~~~
s737842174
p04011
C++
#include <iostream> using namespace std; int test(int current,int max_day,int p_up,int price1,int price2){ if(current==max_day and current>p_up){ return price2; } else if(current==max_day and current<=p_up){ return price1; } else if(current<=p_up){ return test(current+1,max_day,p_up,price1,price2)+price1; } else if(current>p_up){ return test(current+1,max_day,p_up,price1,price2)+price2; } } int main(){ int n,k,x,y; cin>>n; cin>>k; cin>>x; cin>>y; cout<<test(n,k,x,y); }
a.cc: In function 'int main()': a.cc:28:13: error: too few arguments to function 'int test(int, int, int, int, int)' 28 | cout<<test(n,k,x,y); | ~~~~^~~~~~~~~ a.cc:5:5: note: declared here 5 | int test(int current,int max_day,int p_up,int price1,int price2){ | ^~~~ a.cc: In function 'int test(int, int, int, int, int)': a.cc:19:1: warning: control reaches end of non-void function [-Wreturn-type] 19 | } | ^
s501274484
p04011
C++
#include <bits/stdc> using namespace std; int main() { int k,x,y,n; cin >> k >> x >> y >> n; if (n <= k) { cout << x*n << endl; } else { int z = k*x; z += (n-k)*y; cout << z << endl; } }
a.cc:1:10: fatal error: bits/stdc: No such file or directory 1 | #include <bits/stdc> | ^~~~~~~~~~~ compilation terminated.
s687810912
p04011
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N,K,X,Y; cin >> N >> K >> X >> Y; if(K>N){ cout << N*X << endl; } else{ cout << (N-K)*Y+K*X << endl; }
a.cc: In function 'int main()': a.cc:13:4: error: expected '}' at end of input 13 | } | ^ a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s981984082
p04011
C++
#include <bits/stdc++.h> using namespace std; int main() { int N, K, X, Y; cin << N << K << X << Y; if (N <= K){ cout << N*X << endl; } else{ cout << N*X+(N-K)*Y << endl; } }
a.cc: In function 'int main()': a.cc:6:7: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int') 6 | cin << N << K << X << Y; | ~~~ ^~ ~ | | | | | int | std::istream {aka std::basic_istream<char>} a.cc:6:7: note: candidate: 'operator<<(int, int)' (built-in) 6 | cin << N << K << X << Y; | ~~~~^~~~ a.cc:6:7: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int' In file included from /usr/include/c++/14/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:1715:5: note: candidate: 'template<class _Ch_type, class _Ch_traits, class _Bi_iter> std::basic_ostream<_CharT, _Traits>& std::__cxx11::operator<<(std::basic_ostream<_CharT, _Traits>&, const sub_match<_Bi_iter>&)' 1715 | operator<<(basic_ostream<_Ch_type, _Ch_traits>& __os, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1715:5: note: template argument deduction/substitution failed: a.cc:6:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 6 | cin << N << K << X << Y; | ^ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41: /usr/include/c++/14/cstddef:125:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator<<(byte, _IntegerType)' 125 | operator<<(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:125:5: note: template argument deduction/substitution failed: a.cc:6:3: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte' 6 | cin << N << K << X << Y; | ^~~ 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:763:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, basic_string_view<_CharT, _Traits>)' 763 | operator<<(basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/string_view:763:5: note: template argument deduction/substitution failed: a.cc:6:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 6 | cin << N << K << X << Y; | ^ /usr/include/c++/14/bits/basic_string.h:4077:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 4077 | operator<<(basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4077:5: note: template argument deduction/substitution failed: a.cc:6:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 6 | cin << N << K << X << Y; | ^ /usr/include/c++/14/bitset:1687:5: note: candidate: 'template<class _CharT, class _Traits, long unsigned int _Nb> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const bitset<_Nb>&)' 1687 | operator<<(std::basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/bitset:1687:5: note: template argument deduction/substitution failed: a.cc:6:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 6 | cin << N << K << X << Y; | ^ In file included from /usr/include/c++/14/bits/ios_base.h:46, from /usr/include/c++/14/streambuf:43, from /usr/include/c++/14/bits/streambuf_iterator.h:35, from /usr/include/c++/14/iterator:66, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54: /usr/include/c++/14/system_error:339:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const error_code&)' 339 | operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e) | ^~~~~~~~ /usr/include/c++/14/system_error:339:5: note: template argument deduction/substitution failed: a.cc:6:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 6 | cin << N << K << X << Y; | ^ In file included from /usr/include/c++/14/memory:80, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:56: /usr/include/c++/14/bits/shared_ptr.h:70:5: note: candidate: 'template<class _Ch, class _Tr, class _Tp, __gnu_cxx::_Lock_policy _Lp> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __shared_ptr<_Tp, _Lp>&)' 70 | operator<<(std::basic_ostream<_Ch, _Tr>& __os, | ^~~~~~~~ /usr/include/c++/14/bits/shared_ptr.h:70:5: note: template argument deduction/substitution failed: a.cc:6:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 6 | cin << N << K << X << Y; | ^ In file included from /usr/include/c++/14/istream:41, from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/ostream:563:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _CharT)' 563 | operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c) | ^~~~~~~~ /usr/include/c++/14/ostream:563:5: note: template argument deduction/substitution failed: a.cc:6:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 6 | cin << N << K << X << Y; | ^ /usr/include/c++/14/ostream:573:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char)' 573 | operator<<(basic_ostream<_CharT, _Traits>& __out, char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:573:5: note: template argument deduction/substitution failed: a.cc:6:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 6 | cin << N << K << X << Y; | ^ /usr/include/c++/14/ostream:579:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char)' 579 | operator<<(basic_ostream<char, _Traits>& __out, char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:579:5: note: template argument deduction/substitution failed: a.cc:6:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 6 | cin << N << K << X << Y; | ^ /usr/include/c++/14/ostream:590:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char)' 590 | operator<<(basic_ostream<char, _Traits>& __out, signed char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:590:5: note: template argument deduction/substitution failed: a.cc:6:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 6 | cin << N << K << X << Y; | ^ /usr/include/c++/14/ostream:595:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char)' 595 | operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:595:5: note: template argument deduction/substitution failed: a.cc:6:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 6 | cin << N << K << X << Y; | ^ /usr/include/c++/14/ostream:654:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const _CharT*)' 654 | operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:654:5: note: template argument deduction/substitution failed: a.cc:6:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 6 | cin << N << K << X << Y; | ^ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:307:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const char*)' 307 | operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s) | ^~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:307:5: note: template argument deduction/substitution failed: a.cc:6:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 6 | cin << N << K << X << Y; | ^ /usr/include/c++/14/ostream:671:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const char*)' 671 | operator<<(basic_ostream<char, _Traits>& __out, const char* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:671:5: note: template argument deduction/substitution failed: a.cc:6:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<c
s171647572
p04011
Java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); int x = sc.nextInt(); int y = sc.nextInt(); if(n-k<0){ System.out.println(n*x); }else{ System.out.printnln(k*x+(n-k)*y); } } }
Main.java:13: error: cannot find symbol System.out.printnln(k*x+(n-k)*y); ^ symbol: method printnln(int) location: variable out of type PrintStream 1 error
s529214332
p04011
C++
include<bits/stdc++.h> using namespace std; int main(){ int N,K,X,Y; cin>>N>>K>>X>>Y; if(N<=K) cout<<N*X<<endl; else cout<<K*X+(N-K)*Y<<endl; return 0; }
a.cc:1:1: error: 'include' does not name a type 1 | include<bits/stdc++.h> | ^~~~~~~ a.cc: In function 'int main()': a.cc:5:3: error: 'cin' was not declared in this scope 5 | cin>>N>>K>>X>>Y; | ^~~ a.cc:7:5: error: 'cout' was not declared in this scope 7 | cout<<N*X<<endl; | ^~~~ a.cc:7:16: error: 'endl' was not declared in this scope 7 | cout<<N*X<<endl; | ^~~~ a.cc:9:5: error: 'cout' was not declared in this scope 9 | cout<<K*X+(N-K)*Y<<endl; | ^~~~ a.cc:9:24: error: 'endl' was not declared in this scope 9 | cout<<K*X+(N-K)*Y<<endl; | ^~~~
s918212380
p04011
C++
#include <bits/stdc++.h> using namespace std; int main() { int N , K , X , Y ; cin >> N >> K >> X >> Y : cout << K*X + (N-K)*Y << endl; }
a.cc: In function 'int main()': a.cc:6:27: error: found ':' in nested-name-specifier, expected '::' 6 | cin >> N >> K >> X >> Y : | ^ | :: a.cc:6:25: error: 'Y' is not a class, namespace, or enumeration 6 | cin >> N >> K >> X >> Y : | ^
s567832284
p04011
C++
#include <bits/stdc++.h> using namespace std; int main() { int n, k, x, y; int ans = 0; cin >> n >> endl; cin >> k >> endl; cin >> x >> endl; cin >> y >> endl; if (n <= k) { ans = x * k; } else { ans = x * k + y * (n-k); } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:7:12: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and '<unresolved overloaded function type>') 7 | cin >> n >> endl; | ~~~~~~~~~^~~~~~~ In file included from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127, from a.cc:1: /usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:24: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'bool&' 170 | operator>>(bool& __n) | ~~~~~~^~~ /usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:25: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short int&' 174 | operator>>(short& __n); | ~~~~~~~^~~ /usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:34: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short unsigned int&' 177 | operator>>(unsigned short& __n) | ~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'int&' 181 | operator>>(int& __n); | ~~~~~^~~ /usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'unsigned int&' 184 | operator>>(unsigned int& __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:24: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long int&' 188 | operator>>(long& __n) | ~~~~~~^~~ /usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:33: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long unsigned int&' 192 | operator>>(unsigned long& __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:29: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long int&' 199 | operator>>(long long& __n) | ~~~~~~~~~~~^~~ /usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:38: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long unsigned int&' 203 | operator>>(unsigned long long& __n) | ~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 219 | operator>>(float& __f) | ^~~~~~~~ /usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'float&' 219 | operator>>(float& __f) | ~~~~~~~^~~ /usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 223 | operator>>(double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'double&' 223 | operator>>(double& __f) | ~~~~~~~~^~~ /usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 227 | operator>>(long double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long double&' 227 | operator>>(long double& __f) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:25: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'void*&' 328 | operator>>(void*& __p) | ~~~~~~~^~~ /usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]' 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:126:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:133:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 133 | operator>>(ios_base& (*__pf)(ios_base&)) | ^~~~~~~~ /usr/include/c++/14/istream:133:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::ios_base& (*)(std::ios_base&)' 133 | operator>>(ios_base& (*__pf)(ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:352:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; __streambuf_type = std::basic_streambuf<char>]' 352 | operator>>(__streambuf_type* __sb); | ^~~~~~~~ /usr/include/c++/14/istream:352:36: note: no known conversion for argument 1 from '<unresolved over
s065326112
p04011
C++
#include <bits/stdc++.h> using namespace std; int main() { int n, k, x, y int ans = 0; cin >> n >> k >> x >> y; if (n <= k) { ans = x * k; } else { ans = x * k + y * (n-k); } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:6:3: error: expected initializer before 'int' 6 | int ans = 0; | ^~~ a.cc:7:25: error: 'y' was not declared in this scope 7 | cin >> n >> k >> x >> y; | ^ a.cc:9:5: error: 'ans' was not declared in this scope; did you mean 'abs'? 9 | ans = x * k; | ^~~ | abs a.cc:11:5: error: 'ans' was not declared in this scope; did you mean 'abs'? 11 | ans = x * k + y * (n-k); | ^~~ | abs a.cc:13:11: error: 'ans' was not declared in this scope; did you mean 'abs'? 13 | cout << ans << endl; | ^~~ | abs
s676355694
p04011
C++
#include <bits/stdc++.h> using namespace std; //long long using ll = long long; // pair<int, int> using PII = pair<int, int>; //最大値、mod const int MOD = 1000000007; const int mod = 1000000007; const int INF = 1000000000; const long long LINF = 1e18; const int MAX = 510000; //出力系 #define print(x) cout << x << endl #define prints(x) cout << fixed << setprecision(10) << x << endl #define printc(x) cout << setw(2) << setfill('0') << 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) //最大公約数 unsigned gcd(unsigned a, unsigned b) { if(a < b) return gcd(b, a); unsigned r; while ((r=a%b)) { a = b; b = r; } return b; } // 最小公倍数 unsigned lcm(unsigned a, unsigned b){ return a / gcd(a, b) * b; } // a = max(a, b), a = min(a, b) template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } // 階乗(MODをとる) ll pow_mod(ll num, ll pow, ll mod) { ll prod = 1; num %= mod; while (pow > 0) { if (pow & 1) prod = prod * num % mod; num = num * num % mod; pow >>= 1; } return prod; } // 二項係数(MODとる、1 ≦ k ≦ n ≦ 10^7 程度) // COMinit() // COM(x, y) // とコンビで使う // テーブルを作る前処理 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; } //int dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0}; struct UnionFind { vector<int> par; vector<int> rank; vector<ll> Size; UnionFind(int n = 1) { init(n); } void init(int n = 1) { par.resize(n + 1); rank.resize(n + 1); Size.resize(n + 1); for (int i = 0; i <= n; ++i) par[i] = i, rank[i] = 0, Size[i] = 1; } int root(int x) { if (par[x] == x) { return x; } else { int r = root(par[x]); return par[x] = r; } } bool issame(int x, int y) { return root(x) == root(y); } bool merge(int x, int y) { x = root(x); y = root(y); if (x == y) return false; if (rank[x] < rank[y]) swap(x, y); if (rank[x] == rank[y]) ++rank[x]; par[y] = x; Size[x] += Size[y]; return true; } ll size(int x){ return Size[root(x)]; } }; #define rrep(i,a,b) for(int i=(a);i>(b);i--) #define rep(i,a,b) for(int i=(a);i<(b);i++) struct Mint { int val; Mint inv() const{ int tmp,a=val,b=mod,x=1,y=0; while(b)tmp=a/b,a-=tmp*b,swap(a,b),x-=tmp*y,swap(x,y); return Mint(x); } public: Mint():val(0){} Mint(ll x){if((val=x%mod)<0)val+=mod;} Mint pow(ll t){Mint res=1,b=*this; while(t){if(t&1)res*=b;b*=b;t>>=1;}return res;} Mint& operator+=(const Mint& x){if((val+=x.val)>=mod)val-=mod;return *this;} Mint& operator-=(const Mint& x){if((val+=mod-x.val)>=mod)val-=mod; return *this;} Mint& operator*=(const Mint& x){val=(ll)val*x.val%mod; return *this;} Mint& operator/=(const Mint& x){return *this*=x.inv();} bool operator==(const Mint& x) const{return val==x.val;} bool operator!=(const Mint& x) const{return val!=x.val;} bool operator<(const Mint& x) const{return val<x.val;} bool operator<=(const Mint& x) const{return val<=x.val;} bool operator>(const Mint& x) const{return val>x.val;} bool operator>=(const Mint& x) const{return val>=x.val;} Mint operator+(const Mint& x) const{return Mint(*this)+=x;} Mint operator-(const Mint& x) const{return Mint(*this)-=x;} Mint operator*(const Mint& x) const{return Mint(*this)*=x;} Mint operator/(const Mint& x) const{return Mint(*this)/=x;} }; struct factorial { vector<Mint> Fact, Finv; public: factorial(int maxx){ Fact.resize(maxx+1),Finv.resize(maxx+1); Fact[0]=Mint(1); rep(i,0,maxx)Fact[i+1]=Fact[i]*(i+1); Finv[maxx]=Mint(1)/Fact[maxx]; rrep(i,maxx,0)Finv[i-1]=Finv[i]*i; } Mint fact(int n,bool inv=0){if(inv)return Finv[n];else return Fact[n];} Mint nPr(int n,int r){if(n<0||n<r||r<0)return Mint(0);else return Fact[n]*Finv[n-r];} Mint nCr(int n,int r){if(n<0||n<r||r<0)return Mint(0);else return Fact[n]*Finv[r]*Finv[n-r];} }; ll modfact(ll n) { if (n <= 1) return 1; return (n * modfact(n - 1)) % MOD; } const double PI = acos(-1); int main() { int n, k, x, y; cin >> n >> k >> x >> y; ll ans = 0; for(i, k) ans += x; for(i, n - k) ans += y; cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:191:7: error: 'i' was not declared in this scope 191 | for(i, k) ans += x; | ^ a.cc:192:3: error: expected primary-expression before 'for' 192 | for(i, n - k) ans += y; | ^~~ a.cc:191:22: error: expected ';' before 'for' 191 | for(i, k) ans += x; | ^ | ; 192 | for(i, n - k) ans += y; | ~~~ a.cc:192:3: error: expected primary-expression before 'for' 192 | for(i, n - k) ans += y; | ^~~ a.cc:191:22: error: expected ')' before 'for' 191 | for(i, k) ans += x; | ~ ^ | ) 192 | for(i, n - k) ans += y; | ~~~ a.cc:194:3: error: expected primary-expression before 'return' 194 | return 0; | ^~~~~~ a.cc:193:23: error: expected ')' before 'return' 193 | cout << ans << endl; | ^ | ) 194 | return 0; | ~~~~~~ a.cc:192:6: note: to match this '(' 192 | for(i, n - k) ans += y; | ^
s124737650
p04011
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i,n) for (int i = 0; i < (int)(n); i++) int main( void ) { int n,k,x,y; cin >> n >> k >> x >. y; int ans = k * x + (n - k) * y; cout << ans << endl; }
a.cc: In function 'int main()': a.cc:9:25: error: expected primary-expression before '.' token 9 | cin >> n >> k >> x >. y; | ^
s082279643
p04011
C++
n,k,x,y=[int(input())for _ in [0]*4] print(n*x) if n<k else print(y*(n-k)+x*k)
a.cc:1:1: error: 'n' does not name a type 1 | n,k,x,y=[int(input())for _ in [0]*4] | ^
s110828310
p04011
C++
#include <iostream> using namespace std; int main() { int N, A; cin >> N >> A; int x[53]; int sum = 0; for (int i = 0; i < N; i++) { cin >> x[i]; sum += x[i]; } long long dp[53][2550][53] = { 0 }; dp[0][0][0] = 1; for (int i = 0; i < N; i++) { for (int k = 0; k <= i; k++) { for (int j = 0; j <= sum; j++) { if (j >= x[i]&&k>0) { dp[i + 1][j][k] = dp[i][j - x[i]][k - 1] + dp[i][j][k]; } else { dp[i + 1][j][k] = dp[i][j][k]; } } } } long long combi; combi = 0; int n = 0; n = sum / A; for (int i = 1; i <= n; i++) { combi += dp[N][i*A][i]; } cout << combi; return 0; } #include <iostream> using namespace std; int main() { int N, A; cin >> N >> A; int x[53]; int sum = 0; for (int i = 0; i < N; i++) { cin >> x[i]; sum += x[i]; } long long dp[53][2550][53] = { 0 }; dp[0][0][0] = 1; for (int i = 0; i < N; i++) { for (int k = 0; k <= i+1; k++) { for (int j = 0; j <= sum; j++) { if (j >= x[i]&&k>0) { dp[i + 1][j][k] = dp[i][j - x[i]][k - 1] + dp[i][j][k]; } else { dp[i + 1][j][k] = dp[i][j][k]; } } } } long long combi; combi = 0; for (int i = 1; i <= N; i++) { combi += dp[N][i*A][i]; } cout << combi; return 0; }
a.cc:40:5: error: redefinition of 'int main()' 40 | int main() { | ^~~~ a.cc:4:5: note: 'int main()' previously defined here 4 | int main() { | ^~~~
s114021807
p04011
C++
include <iostream> using namespace std ; int main() { int N, K, X, Y, sum ; cin >> N >> K >> X >> Y ; if( N >= K ) sum = X*N ; else sum = (X*K)+Y*(N-K) ; cout << sum << '\n' ; return 0 ; }
a.cc:1:1: error: 'include' does not name a type 1 | include <iostream> | ^~~~~~~ a.cc: In function 'int main()': a.cc:7:5: error: 'cin' was not declared in this scope 7 | cin >> N >> K >> X >> Y ; | ^~~ a.cc:14:5: error: 'cout' was not declared in this scope 14 | cout << sum << '\n' ; | ^~~~
s119088518
p04011
C++
int main() { int whole,key,be,af; cin >> whole; cin >> key; cin >> be; cin >> af; if(whole >= key){ cout << (whole - key + 1) * be + (whole - key) * af << endl; } else{ cout << whole * key << endl; } }
a.cc: In function 'int main()': a.cc:4:5: error: 'cin' was not declared in this scope 4 | cin >> whole; | ^~~ a.cc:9:5: error: 'cout' was not declared in this scope 9 | cout << (whole - key + 1) * be + (whole - key) * af << endl; | ^~~~ a.cc:9:60: error: 'endl' was not declared in this scope 9 | cout << (whole - key + 1) * be + (whole - key) * af << endl; | ^~~~ a.cc:12:9: error: 'cout' was not declared in this scope 12 | cout << whole * key << endl; | ^~~~ a.cc:12:32: error: 'endl' was not declared in this scope 12 | cout << whole * key << endl; | ^~~~
s971863478
p04011
Java
public static void main(String[] args) { System.out.println( new App().calcCost( toInt(args[0]) ,toInt(args[1]) ,toInt(args[2]) ,toInt(args[3]) ) ); } public static int toInt (String a) { return Integer.parseInt(a); } private int calcCost( final int numStayDay , final int limitDay1 , final int amountDay1 , final int amountDay2) { final int numOfHighCostDay = limitDay1 > numStayDay ? 0 : numStayDay - limitDay1; final int x = limitDay1 * amountDay1; final int y = numOfHighCostDay * amountDay2; return x + y; }
Main.java:1: error: unnamed classes are a preview feature and are disabled by default. public static void main(String[] args) { ^ (use --enable-preview to enable unnamed classes) 1 error
s310867755
p04011
C++
Copy Copy #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; int main() { ios::sync_with_stdio(0); cin.tie(0); ll n, k, x, y; cin >> n >> k >> x >> y; cout << x*min(k, n)+y*min((n-k), 0) << endl; }
a.cc:1:1: error: 'Copy' does not name a type 1 | Copy | ^~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:3: /usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity 164 | __is_null_pointer(std::nullptr_t) | ^ /usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)' 159 | __is_null_pointer(_Type) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'? 164 | __is_null_pointer(std::nullptr_t) | ^~~~~~~~~ In file included from /usr/include/c++/14/cstddef:50, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41: /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here 443 | typedef decltype(nullptr) nullptr_t; | ^~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'? 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here 443 | typedef decltype(nullptr) nullptr_t; | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared 2086 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope 2087 | struct remove_extent<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid 2087 | struct remove_extent<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared 2099 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope 2100 | struct remove_all_extents<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid 2100 | struct remove_all_extents<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared 2171 | template<std::size_t _Len> | ^~~ /usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope 2176 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^~~~ /usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^ /usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope 2202 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope 2203 | struct __attribute__((__aligned__((_Align)))) { } __align; | ^~~~~~ In file included from /usr/include/c++/14/bits/stl_tempbuf.h:59, from /usr/include/c++/14/bits/stl_algo.h:69, from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive] 132 | __attribute__((__externally_visible__)); | ^ /usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive] 134 | __attribute__((__externally_visible__)); | ^ /usr/incl
s795645212
p04011
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int n,k,x,y; cin >> n >> k >> x >> y; if(n>k){ cout << x*k << endl; } else{ cout << n*k-(n-k)*x-y << endl; } } f
a.cc:16:1: error: 'f' does not name a type 16 | f | ^
s695798452
p04011
C++
#include <iostream> int main() { int N, K, X, Y; std::cin >> N >> K >> X >> Y; if (N - K > 0) std::cout << K*X + (N-K)*Y; else std::out << N*X; return 0; }
a.cc: In function 'int main()': a.cc:9:13: error: 'out' is not a member of 'std'; did you mean 'oct'? 9 | else std::out << N*X; | ^~~ | oct
s417470583
p04011
C++
#include<bits/stdc++.h> using namespace std; int main() { int n,k,x,y; cin>>n>>k>>x>>y; if(n<=k) int l=k*x; else int l=k*x + (n-k)*y; cout<<l; return 0; }
a.cc: In function 'int main()': a.cc:12:9: error: 'l' was not declared in this scope 12 | cout<<l; | ^
s743145361
p04011
C++
#include <iostream> int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(nullptr); std::cout.tie(nullptr); int n, k, x, y; std::cin >> n > k >> x >> y; if (n > k) { std::cout << (k * x + (n - k) * y) << '\n'; } else { std::cout << (n * x) << '\n'; } }
a.cc: In function 'int main()': a.cc:9:17: error: no match for 'operator>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'int') 9 | std::cin >> n > k >> x >> y; | ~~~~~~~~~~~~~ ^ ~~~~~~~~~~~ | | | | | int | std::basic_istream<char>::__istream_type {aka std::basic_istream<char>} a.cc:9:17: note: candidate: 'operator>(int, int)' (built-in) 9 | std::cin >> n > k >> x >> y; | ~~~~~~~~~~~~~~^~~~~~~~~~~~~ a.cc:9:17: note: no known conversion for argument 1 from 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'int' In file included from /usr/include/c++/14/string:48, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_iterator.h: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:9:29: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 9 | std::cin >> n > k >> x >> y; | ^ /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:9:29: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 9 | std::cin >> n > k >> x >> y; | ^ /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:9:29: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 9 | std::cin >> n > k >> x >> y; | ^ /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:9:29: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 9 | std::cin >> n > k >> x >> y; | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string: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:9:29: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::pair<_T1, _T2>' 9 | std::cin >> n > k >> x >> y; | ^ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view: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:9:29: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 9 | std::cin >> n > k >> x >> y; | ^ /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:9:29: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 9 | std::cin >> n > k >> x >> y; | ^ /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:9:29: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int' 9 | std::cin >> n > k >> x >> y; | ^ /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 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3915:5: note: template argument deduction/substitution failed: a.cc:9:29: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 9 | std::cin >> n > k >> x >> y; | ^ /usr/include/c++/14/bits/basic_string.h:3929:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3929 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3929:5: note: template argument deduction/substitution failed: a.cc:9:29: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 9 | std::cin >> n > k >> x >> y; | ^ /usr/include/c++/14/bits/basic_string.h:3942:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3942 | operator>(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3942:5: note: template argument deduction/substitution failed: a.cc:9:29: note: mismatched types 'const _CharT*' and 'std::basic_istream<char>' 9 | std::cin >> n > k >> x >> y; | ^ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2619:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator>(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2619 | operator>(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2619:5: note: template argument deduction/substitution failed: a.cc:9:29: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::tuple<_UTypes ...>' 9 | std::cin >> n > k >> x >> y; | ^
s078742157
p04011
C
/* Anki:未済 作成日: */ #include <stdio.h> int main() { int n, k, x, y, cost; scanf( "%d\n%d\n%d\n%d", &n, &k, &x, &y ); if( n < k+1 ) { cost = x * k; return 0; } else { cost = x * k + y * ( n-k ) } printf( "%d", cost ); return 0; }
main.c: In function 'main': main.c:20:35: error: expected ';' before '}' token 20 | cost = x * k + y * ( n-k ) | ^ | ; 21 | } | ~
s536683602
p04011
C
/* Anki:未済 作成日: */ #include <stdio.h> int main() { int n, k, x, y; scanf( "%d\n%d\n%d\n%d", &n, &k, &x, &y ); if( n < k+1 ) { cost = x * k; return 0; } else { cost = x * k + y * ( n-k ) } printf( "%d", cost ); return 0; }
main.c: In function 'main': main.c:15:9: error: 'cost' undeclared (first use in this function) 15 | cost = x * k; | ^~~~ main.c:15:9: note: each undeclared identifier is reported only once for each function it appears in main.c:20:35: error: expected ';' before '}' token 20 | cost = x * k + y * ( n-k ) | ^ | ; 21 | } | ~
s673730316
p04011
C
5 3 10000 9000
main.c:1:1: error: expected identifier or '(' before numeric constant 1 | 5 | ^
s089107627
p04011
C++
#include"bits/stdc++.h" using namespace std; int main() { int N, K, X, Y; cin >> N >> K >> X >> Y; int sum = 0; for (int i = 0; i < N + 1; i++) { if (i < K + 1) { sum += X; } else { sum += Y; } } cout << sum << endl; } #include"bits/stdc++.h" using namespace std; int main() { int N, K, X, Y; cin >> N >> K >> X >> Y; int sum = 0; for (int i = 0; i < N + 1; i++) { if (i < K) { sum += X; } else { sum += Y; } } cout << sum << endl; }
a.cc:22:5: error: redefinition of 'int main()' 22 | int main() { | ^~~~ a.cc:4:5: note: 'int main()' previously defined here 4 | int main() { | ^~~~
s531040653
p04011
C
#include <stdio.h> #include <limits.h> int main() { int t,x,y,z,p; scanf("%d%d%d%d",&x,&y,&z,&p); (x>y)? t=y*z+(x-y)*p: t=x*z; printf("%d",t); return 0; }
main.c: In function 'main': main.c:7:6: error: lvalue required as left operand of assignment 7 | t=x*z; | ^
s848280652
p04011
C++
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long n, k, x, y, ans = 0; cin >> n >> k >> x >> y; ans = min(n, k) *x; ans += max(0, n-k) * y; cout << ans << '\n'; return 0; }
a.cc: In function 'int main()': a.cc:14:19: error: no matching function for call to 'max(int, long long int)' 14 | ans += max(0, n-k) * y; | ~~~^~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:14:19: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 14 | ans += max(0, n-k) * y; | ~~~^~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:14:19: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 14 | ans += max(0, n-k) * y; | ~~~^~~~~~~~
s237440525
p04011
C++
#include<stdc++.h> using namespace std; int main(){ int N,K,X,Y;cin >> N >> K >> X >> Y; if (N <= K){ cout << X*N << endl; }else{ cout << X*K+Y*(N-K) << endl; } }
a.cc:1:9: fatal error: stdc++.h: No such file or directory 1 | #include<stdc++.h> | ^~~~~~~~~~ compilation terminated.
s626511435
p04011
C++
int N,K,X,Y;cin >> N >> K >> X >> Y; if (N <= K){ cout << X*N << endl; }else{ cout << X*K+Y*(N-K) << endl; }
a.cc:1:13: error: 'cin' does not name a type 1 | int N,K,X,Y;cin >> N >> K >> X >> Y; | ^~~ a.cc:2:1: error: expected unqualified-id before 'if' 2 | if (N <= K){ | ^~ a.cc:4:2: error: expected unqualified-id before 'else' 4 | }else{ | ^~~~
s142911504
p04011
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N,K,X,Y; cin >> N; cin >> K; cin >> X; cin >> Y; int sum=0; for(int i=1;i<=N;i++){ if(i<=K) sum+=X; else sum+=Y } cout << sum << endl; }
a.cc: In function 'int main()': a.cc:16:19: error: expected ';' before '}' token 16 | sum+=Y | ^ | ; 17 | } | ~
s002622246
p04011
C++
#include<iostream> using namespace std; int main(){ int N,K,X,Y,sum=0; cin>>N>>K>>X>>Y; int i=0; while(i<K && I<N){ sum+=X; i++; } while(i<N){ sum+=Y; i++; } cout<<sum; return 0; }
a.cc: In function 'int main()': a.cc:8:16: error: 'I' was not declared in this scope 8 | while(i<K && I<N){ | ^
s083426667
p04011
C++
#include<iostream> using namespace std; int main(){ int N,K,X,Y,sum=0; cin>>N>>K>>X>>Y; int i=0; while(i<K){ sum+=X; i++; } while(i<N){ sum+=Y; i++ } return 0; }
a.cc: In function 'int main()': a.cc:14:8: error: expected ';' before '}' token 14 | i++ | ^ | ; 15 | } | ~
s078790087
p04011
C++
#include<bits/stdc++.h> using namespace std; int B,a,D,C; int main() { cin>>C>>D>>a>>B; if(C>D) cout<<C*a<<endl else {C-=D;cout<<a*D+B*C<<endl;} return 0; }
a.cc: In function 'int main()': a.cc:7:28: error: expected ';' before 'else' 7 | if(C>D) cout<<C*a<<endl | ^ | ; 8 | else {C-=D;cout<<a*D+B*C<<endl;} | ~~~~
s671932610
p04011
C++
#include <bits/stdc++.h> using namespace std; int main() { int n,k,x,y,s; cin>>n>>k>>x>>y; if(n<=k)s=x*n; if(n>k)s=l*x+(n-k)*y; cout << s<<endl; }
a.cc: In function 'int main()': a.cc:8:12: error: 'l' was not declared in this scope 8 | if(n>k)s=l*x+(n-k)*y; | ^
s525232160
p04011
C++
#include <bits/stdc++.h> using namespace std; int main() { int n,k,x,y,s; cin>>n>>k>>x>>y; if(n<=k)s=x*n; if(n>k)s=l*x+(n-k)*y cout << s<<endl; }
a.cc: In function 'int main()': a.cc:8:12: error: 'l' was not declared in this scope 8 | if(n>k)s=l*x+(n-k)*y | ^
s866004870
p04011
C++
int main() { int n,k,x,y; cin >> n >> k >> x >> y; if(n<=k){ cout << n*x; } else{ cout << k*x+(n-k)*y; } }
a.cc: In function 'int main()': a.cc:3:5: error: 'cin' was not declared in this scope 3 | cin >> n >> k >> x >> y; | ^~~ a.cc:5:9: error: 'cout' was not declared in this scope 5 | cout << n*x; | ^~~~ a.cc:8:9: error: 'cout' was not declared in this scope 8 | cout << k*x+(n-k)*y; | ^~~~
s731970019
p04011
C++
#include "bits/stdc++.h" using namespace std; int main() { int N,K,X,Y; cin >>N>>K>>X>>Y; int A; if (N<=K){ A= N*X; }else{ A= K*X+(N-K)*Y+ } cout << A; return 0; }
a.cc: In function 'int main()': a.cc:11:1: error: expected primary-expression before '}' token 11 | } | ^
s047807252
p04011
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n, k, x, y; cin >> n >> k >> x >> y; if(n <= k) int ans = n * x; else int ans = k * x + (n - k) * y; cout << ans; }
a.cc: In function 'int main()': a.cc:10:17: error: 'ans' was not declared in this scope; did you mean 'abs'? 10 | cout << ans; | ^~~ | abs
s875900515
p04011
Java
import java.util.Scanner; class Main{ Scanner sin = new Scanner(System.in); int N = sin.nextInt(); int K = sin.nextInt(); int X = sin.nextInt(); int Y = sin.nextInt(); if(N<=K){ int XY = X*N; }else{ int NK = N-K; int XY = X*K + Y*NK; } System.out.println(XY); }
Main.java:10: error: illegal start of type if(N<=K){ ^ Main.java:10: error: <identifier> expected if(N<=K){ ^ Main.java:10: error: <identifier> expected if(N<=K){ ^ Main.java:12: error: illegal start of type }else{ ^ Main.java:16: error: <identifier> expected System.out.println(XY); ^ Main.java:16: error: <identifier> expected System.out.println(XY); ^ 6 errors
s331572086
p04011
Java
#include <bits/stdc++.h> using namespace std; int main(){ int n,k,x,y; cin >> n >> k >> x >> y; if(n<=k){ cout << x*n; }else{ cout << x*k+y*(n-k); } }
Main.java:1: error: illegal character: '#' #include <bits/stdc++.h> ^ Main.java:1: error: class, interface, enum, or record expected #include <bits/stdc++.h> ^ Main.java:6: error: not a statement cin >> n >> k >> x >> y; ^ Main.java:8: error: not a statement cout << x*n; ^ Main.java:10: error: not a statement cout << x*k+y*(n-k); ^ Main.java:4: error: unnamed classes are a preview feature and are disabled by default. int main(){ ^ (use --enable-preview to enable unnamed classes) 6 errors
s391224974
p04011
C++
#include <bits/stdc++.h> using namespace std; #define ll long long #define endl "\n" #define pb push_back #define f(i,n) for(i=0;i<n;i++) #define F(i,a,b) for(i=a;a<=b;i++) #define arr(a,n) for( i=0;i<n;i++)cin>>a[i]; #define fi first #define se second #define mp make_pair #define mod 1000000007 #define YES cout<<"YES"<<endl; #define Yes cout<<"Yes"<<endl; #define NO cout<<"NO"<<endl; #define No cout<<"No"<<endl; #define yes cout<<"yes"<<endl; #define no cout<<"no"<<endl; #define vi vector<ll> #define ed end() #define bg begin() #define sz size() #define ln length() #define s() sort(a,a+n); #define sr() sort(a,a+n,greater<ll>()); #define v() sort(v.begin(),v.end()); #define vr() sort(v.begin(),v.end(),greater<ll>()); #define mod 1000000007 #define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);} ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;} int main() { /* #ifndef ONLINE_JUDGE // for getting input from input.txt freopen("input.txt", "r", stdin); // for writing output to output.txt freopen("output.txt", "w", stdout); #endif*? fast(); //ll t;cin>>t;while(t--) { ll n,k,x,y,s=0; cin>>n>>k>>x>>y; ll ans=min(n,k)*x; ll temp=(n-k)>0?((n-k)*y):0; cout<<ans+temp<<endl; } return 0; }
a.cc:33:3: error: unterminated comment 33 | /* #ifndef ONLINE_JUDGE | ^ a.cc: In function 'int main()': a.cc:32:13: error: expected '}' at end of input 32 | int main() { | ~^
s657932281
p04011
C++
clude<iostream> #include <string> #include <vector> #include <algorithm> #include <math.h> #include <functional> #include <iomanip> #include <bitset> #include <numeric> #include <queue> #include <map> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) const long long mod = 1000000007; typedef long long ll; typedef pair<int, double> P; const vector<int> di = {-1, 0, 1, 0}; const vector<int> dj = { 0, 1, 0, -1 }; int main() { int n, k, x, y; cin >> n >> k >> x >> y; if (n > k) { int ans = x * k + y * (n - k); cout << ans << endl; } else { int ans = x * n; cout << ans << endl; } return 0; }
a.cc:1:1: error: 'clude' does not name a type 1 | clude<iostream> | ^~~~~ In file included from /usr/include/c++/14/bits/char_traits.h:42, from /usr/include/c++/14/string:42, from a.cc:2: /usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type 68 | typedef ptrdiff_t streamsize; // Signed integral type | ^~~~~~~~~ /usr/include/c++/14/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 40 | #include <cwchar> // For mbstate_t +++ |+#include <cstddef> 41 | In file included from /usr/include/c++/14/bits/char_traits.h:50: /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std' 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ In file included from /usr/include/wchar.h:35, from /usr/include/c++/14/cwchar:44, from /usr/include/c++/14/bits/postypes.h:40: /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared 2086 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope 2087 | struct remove_extent<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid 2087 | struct remove_extent<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared 2099 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope 2100 | struct remove_all_extents<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid 2100 | struct remove_all_extents<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared 2171 | template<std::size_t _Len> | ^~~ /usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope 2176 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^~~~ /usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^ /usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope 2202 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope 2203 | struct __attribute__((__aligned__((_Align)))) { } __align; | ^~~~~~ /usr/include/c++/14/bits/char_traits.h:144:61: error: 'std::size_t' has not been declared 144 | compare(const char_type* __s1, const char_type* __s2, std::size_t __n); | ^~~ /usr/include/c++/14/bits/char_traits.h:146:40: error: 'size_t' in namespace 'std' does not name a type 146 | static _GLIBCXX14_CONSTEXPR std::size_t | ^~~~~~ /usr/include/c++/14/bits/char_traits.h:150:34: error: 'std::size_t' has not been declared 150 | find(const char_type* __s, std::size_t __n, const char_type& __a); | ^~~ /usr/include/c++/14/bits/char_traits.h:153:52: error: 'std::size_t' has not been declared 153 | move(char_type* __s1, const char_type* __s2, std::size_t __n); | ^~~ /usr/include/c++/14/bits/char_traits.h:156:52: error: 'std::size_t' has not been declared 156 | copy(char_type* __s1, const char_type* __s2, std::size_t __n); | ^~~ /usr/include/c++/14/bits/char_traits.h:159:30: error: 'std::size_t' has not been declared 159 | assign(char_type* __s, std::size_t __n, char_type __a); | ^~~ /usr/include/c++/14/bits/char_traits.h:187:59: error: 'std::size_t' has not been declared 187 | compare(const char_type* __s1, const char_type* __s2, std::size_t __n) | ^~~ /usr/include/c++/14/bits/char_traits.h: In static member function 'static constexpr int __gnu_cxx::char_traits<_CharT>::compare(const char_type*, const char_type*, int)': /usr/include/c++/14/bits/char_traits.h:189:17: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 189 | for (std::size_t __i = 0; __i < __n; ++__i) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/bits/char_traits.h:189:33: error: '__i' was not declared in this scope; did you mean '__n'? 189 | for (std::size_t __i = 0; __i < __n; ++__i) | ^~~ | __n /usr/include/c++/14/bits/char_traits.h: At global scope: /usr/include/c++/14/bits/char_traits.h:198:31: error: 'size_t' in namespace 'std' does not name a type 198 | _GLIBCXX14_CONSTEXPR std::size_t |
s320003461
p04011
Java
import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args){ BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); int stay = Integer.parseInt(input.readLine()); int sale = Integer.parseInt(input.readLine()); int normalCost = Integer.parseInt(input.readLine()); int saleCost = Integer.parseInt(input.readLine()); if(stay > sale){ System.out.println(sale * normalCost + (( stay - sale ) * saleCost)); }else{ System.out.println(stay * normalCost); } } }
Main.java:8: error: unreported exception IOException; must be caught or declared to be thrown int stay = Integer.parseInt(input.readLine()); ^ Main.java:9: error: unreported exception IOException; must be caught or declared to be thrown int sale = Integer.parseInt(input.readLine()); ^ Main.java:10: error: unreported exception IOException; must be caught or declared to be thrown int normalCost = Integer.parseInt(input.readLine()); ^ Main.java:11: error: unreported exception IOException; must be caught or declared to be thrown int saleCost = Integer.parseInt(input.readLine()); ^ 4 errors
s378050625
p04011
Java
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); int stay = Integer.parseInt(input.readLine()); int sale = Integer.parseInt(input.readLine()); int normalCost = Integer.parseInt(input.readLine()); int saleCost = Integer.parseInt(input.readLine()); if(stay > sale){ System.out.println(sale * normalCost + (( stay - sale ) * saleCost)); }else{ System.out.println(stay * normalCost); } } }
Main.java:10: error: unreported exception IOException; must be caught or declared to be thrown int stay = Integer.parseInt(input.readLine()); ^ Main.java:11: error: unreported exception IOException; must be caught or declared to be thrown int sale = Integer.parseInt(input.readLine()); ^ Main.java:12: error: unreported exception IOException; must be caught or declared to be thrown int normalCost = Integer.parseInt(input.readLine()); ^ Main.java:13: error: unreported exception IOException; must be caught or declared to be thrown int saleCost = Integer.parseInt(input.readLine()); ^ 4 errors
s258556609
p04011
Java
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); BufferedReader input = new BufferedReader(new InputStreamReader(System.in)) int stay = Integer.parseInt(input.readLine()); int sale = Integer.parseInt(input.readLine()); int normalCost = Integer.parseInt(input.readLine()); int saleCost = Integer.parseInt(input.readLine()); if(stay > sale){ System.out.println(sale * normalCost + (( stay - sale ) * saleCost)); }else{ System.out.println(stay * normalCost); } } }
Main.java:9: error: ';' expected BufferedReader input = new BufferedReader(new InputStreamReader(System.in)) ^ 1 error
s790632903
p04011
C++
#include<bits/stdc++.h> using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); long long n, k, x, y; cin >> n >> k >> x >> y; if((n-k)<0) { int num = 0; } else { num = n-k; } cout << k*x+num*y << endl; }
a.cc: In function 'int main()': a.cc:11:8: error: 'num' was not declared in this scope; did you mean 'enum'? 11 | num = n-k; | ^~~ | enum a.cc:13:16: error: 'num' was not declared in this scope; did you mean 'enum'? 13 | cout << k*x+num*y << endl; | ^~~ | enum
s302423637
p04011
Java
import java.util.Scanner; public class Hotel { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n,k,x,y ; n = sc.nextInt(); k = sc.nextInt(); x = sc.nextInt(); y = sc.nextInt(); if(n > k) { System.out.println((k*x)+((n-k)*y)); }else{ System.out.println("n*x"); } } }
Main.java:3: error: class Hotel is public, should be declared in a file named Hotel.java public class Hotel { ^ 1 error
s458431488
p04011
Java
import java.util.Scanner; public class Hotel { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n,k,x,y ; n = sc.nextInt(); k = sc.nextInt(); x = sc.nextInt(); y = sc.nextInt(); System.out.println((k*x)+((n-k)*y)); } }
Main.java:3: error: class Hotel is public, should be declared in a file named Hotel.java public class Hotel { ^ 1 error
s065315270
p04011
Java
package java_sample; import java.util.Scanner; public class Hotel { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n,k,x,y ; n = sc.nextInt(); k = sc.nextInt(); x = sc.nextInt(); y = sc.nextInt(); System.out.println((k*x)+((n-k)*y)); } }
Main.java:5: error: class Hotel is public, should be declared in a file named Hotel.java public class Hotel { ^ 1 error
s594404460
p04011
C
#include <stdio.h> int main(){ int n,k,x,y; int total=0; scanf_s("%d",&n); scanf_s("%d",&k); scanf_s("%d",&x); scanf_s("%d",&y); if(n<=k){ total=n*x; } else { total=k*x; total+=((n-k)*y); } printf("%d",total); }
main.c: In function 'main': main.c:7:3: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration] 7 | scanf_s("%d",&n); | ^~~~~~~ | scanf
s643541221
p04011
C++
#include<bits/stdc++.h> using namespace std; int main(){ long long N,K,X,Y; cin>>N; cin>>K; cin>>X; cin>>Y; if(N<K){ cout<<N*X; } else{ 2 cout<<(K*X)+(N-K)*Y; } return 0; }
a.cc: In function 'int main()': a.cc:21:2: error: expected ';' before 'cout' 21 | 2 | ^ | ; 22 | cout<<(K*X)+(N-K)*Y; | ~~~~
s742780747
p04011
C++
#include <bits/stdc++.h> using namespace std; int main() { int A,B,C,D,ans; cin>>A>>B>>C>>D; for(int i=0; i<N;i++){ if(i>K){ans+=D;} else{ans+=C;} } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:8:16: error: 'N' was not declared in this scope 8 | for(int i=0; i<N;i++){ | ^ a.cc:9:8: error: 'K' was not declared in this scope 9 | if(i>K){ans+=D;} | ^
s326613043
p04011
Java
import java.util.*; import java.util.ArrayList; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); int d = sc.nextInt(); int n = a-b; int counter =0; if(n>0){ System.out.println( (b*c)+(n*d)); }else{ System.out.println(a*d); } }
Main.java:18: error: reached end of file while parsing } ^ 1 error
s163431434
p04011
C++
#include <iostream> using namespace std; int main() { int n,k,x,y; cin>>n>>K>>x>>y; cout<<min(k,n)*x+max(n-k,0)*y<<endl; }
a.cc: In function 'int main()': a.cc:5:11: error: 'K' was not declared in this scope 5 | cin>>n>>K>>x>>y; | ^